Repository navigation
Description
Problem
The uninstall sequence (resolve → move-out check → move to trash → .gitignore cleanup → metadata prune → oplog) is implemented four times: once in the CLI and three times in dashboard handlers. There is no internal/uninstall; the shared pieces are leaf helpers (trash.MoveToTrash, sourcefs.CheckSkillMoveOut, MetadataStore.RemoveByNames), so the sequencing and the prune rules live in each caller and have drifted.
Evidence (v0.25.0, aeaea40e)
cmd/skillshare/uninstall_handlers.go—runUninstallSkills:194,performUninstallQuiet:111,performUninstall:135internal/server/handler_skills.go—handleUninstallRepo:408,handleUninstallSkill:499internal/server/handler_uninstall.go—handleBatchUninstallSkills:148,resolveUninstallSkill:397internal/install/metadata.go—RemoveByNames:166
Observed differences:
- Metadata prune has three rule sets:
RemoveByNames(CLI),handler_skills.go:457-482,handler_uninstall.go:335-364. handleUninstallRepohas nogit.IsDirtycheck; the batch handler (handler_uninstall.go:214) and the CLI (uninstall_handlers.go:618) do.- The skill branch of
handleUninstallSkill(:562-597) does not touchskillsStoreor callreconcileSkillsConfig; the batch handler does (:335-370). Whether this leaves stale metadata has not been verified — another reconcile path may cover it. handler_uninstall.go:166-313repeats the same six-line failure block nine times.
Related fixes that had to be applied per caller: 3ad3af7, db45b0d, cd6e016, e66529f, 1f4a466, 8e5a09c, 20ae89a. 7dfb764 merged the CLI's global and project flows; the server did not follow.
Proposed change
One domain operation that takes a list of names plus force and performs resolution, followed-link handling, dirty preflight, move to trash, .gitignore cleanup and metadata prune, returning a per-item result. The CLI keeps confirmation and output; the three handlers translate the result to JSON. CLI-only parsing (globs, --group, --all) stays in the CLI.
Tests move to the new interface against a temp dir; the duplicated CLI/server behaviour tests can then shrink.
Risks
- The CLI resolves names by path and the server by flat name. Unifying resolution may change user-visible behaviour and needs a decision first.
- Interface design is deliberately left open here.
Activity
feat(ui): let the dashboard force a refused tracked-repo uninstall
refactor(uninstall): run the CLI and dashboard through one operation
fix(uninstall): keep a grouped skill's legacy metadata key on review