Repository navigation
refactor(uninstall): run the CLI and dashboard through one operation - #455
Merged
Merged
Conversation
The uninstall sequence (move-out check, dirty check, move to trash,
.gitignore cleanup, metadata prune) lived in the CLI and in three
dashboard handlers, and the copies had drifted: three different prune
rule sets, no dirty check on DELETE /api/repos, and no metadata prune
at all on DELETE /api/resources, which left the removed skill's entry
and target overrides in .metadata.json.
internal/uninstall now owns the sequence for resolved items. Callers
keep name resolution, prompts, output, HTTP status and oplog.
MetadataStore.RemoveByNames is the single prune rule set: an entry goes
when it is a removed path or lies below one, by key or by Group, plus
the tracked legacy group of a top-level repo.
Behaviour changes, all intended:
- DELETE /api/repos/{name} refuses a dirty tracked repo, or one whose
git status cannot be read, with 409 unless ?force=true.
- DELETE /api/repos/{name} refuses a followed link whose folder is
itself a skill, like every other uninstall path.
- DELETE /api/resources/{name} prunes the skill's metadata.
- Removing top-level "foo" no longer prunes "frontend/foo" (CLI), and
removing repo "_team" no longer prunes the untracked group "team"
(dashboard batch); both dropped metadata of skills still installed.
Refs #442
Review of the shared uninstall operation found that RemoveByNames still matched a bare key: removing top-level "foo" pruned the legacy entry "foo" with Group "frontend", which belongs to the installed frontend/foo. Entries are now matched by their full path only. Also from review: a dry run no longer runs git status for tracked repos (it reports no git state), the unused Outcome.Removed is gone, the two single-item handlers share one status mapping, and the CLI reports a single target in one place instead of three flag checks. Refs #442
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
DELETE /api/repos/{name} now refuses a repo with uncommitted changes or
unreadable git status, and the Dashboard page never sent force, so those
repos could not be removed from it at all.
The two refusals force overrides now carry their own error code. The
page still sends the first request without force; on either code the
confirmation says why and retries with force only when the user
confirms. Other refusals, such as a linked folder that is itself a
skill, keep the plain error because force does not change them.
Refs #442
Owner
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type
proposals/only — see CONTRIBUTING.md)Architecture refactor from #442. It is larger than "minor" and carries the intended behaviour changes listed below.
Linked Issue
Closes #442
What moved where
New package
internal/uninstall:Run(items, opts)sourcefs.CheckSkillMoveOut→git.IsDirtyfor tracked repos unless forced →trash.MoveToTrash. Then for everything removed:.gitignorecleanup,MetadataStore.RemoveByNames, save. Returns a result per item.runUninstallSkills,handleBatchUninstallSkills,handleUninstallRepo,handleUninstallSkillPreflight(items, opts)Agents(...)uninstall agents, both dashboard agent pathsMetadataStore.RemoveByNamesis the single prune rule set. The two inline rule sets inhandler_skills.goandhandler_uninstall.goare gone.--group/--allparsing, path-based resolution, prompts, output and oplog. Handlers keep request parsing, flat-name resolution, JSON, status codes and oplog. Which names resolve is unchanged.ErrDirty,*StatusError,*TrashError) so each caller keeps its wording.Intentional behaviour changes
DELETE /api/repos/{name}refuses a tracked repo with uncommitted changes, or whose git status cannot be read, with 409.?force=trueskips the check. Before: always removed. These two refusals carry their ownerror_code(repo_dirty,repo_status_failed). The Dashboard page sends the first request without force; on either code its confirmation dialog says why (uncommitted changes, or git status could not be read) and offers Retry with Force, which repeats the request withforce=true. Cancel leaves the repo. Any other refusal is shown as an error with no override.DELETE /api/repos/{name}refuses a followed source link whose folder is itself a skill (409, "use unlink to remove the link"), like the CLI and the other routes. Before: the link was moved to trash.DELETE /api/resources/{name}prunes the skill's metadata entry and target overrides. Before: both stayed in.metadata.jsonuntil a later install, update or batch uninstall reconciled.foono longer prunes the metadata of the still-installedfrontend/foo(the old basename rule)._teamno longer prunes the untracked groupteam/…that is still installed (the old legacy-group match had noTrackedcheck).team/…for_team).Smaller, visible only in edge cases:
uninstall agents --dry-runno longer rewrites the agents.metadata.json.Open questions for the maintainer
UninstallDialogshows "Retry with Force" after any failed item, including refusals force cannot override; the batch response has no per-item code. Not changed here.reconcileSkillsConfig, as before. Putting it in the shared server helper madeDELETE /api/reposdrop every entry whose directory is missing and rewrite project config, which existing tests pin against. In project mode theskills:config entry and lock pin stay until the next reconcile after a single-route uninstall..gitignorecleanup still differs. CLI project mode drops the entry of every removed item; the dashboard only for tracked repos. Kept per caller.Options.Forcein the CLI. The CLI callsRunwithForce: trueafter applying its ownPreflight, so the field means "skip the dirty check", not "the user passed--force".resolveTrackedReporeturns a backslash name for nested repos, which does not match slash metadata keys; CLI agent uninstall ignores a metadata save error.Checks
Run in a Linux container from the devcontainer image:
make check(docs-check, fmt-check,go vet ./..., unit and integration tests): exit 0, 35 packages ok, on the final commit.New tests were run against the old code first and failed where expected (stale metadata on the single route, 200 for a dirty repo, the two over-pruning cases, link trashed by the repo route).
python3 scripts/ai-context.py check: ok.UI (same container):
pnpm run lint0 errors,pnpm run buildok,pnpm run test969 passed, 2 failed. The 2 failures (MemoryNotes.test.tsx"reloads the note list and content from disk on refresh",MCPServerList.test.tsx"shows a server's Pi exposure on its row…") fail the same way on the unmodified parent commit and are in files this PR does not touch. The newDashboardPagetests and the locale parity test pass.Not run: rendered screenshots of the new dialog states, website build, E2E runbooks, Windows locally (CI covers Windows).
Checklist
make check) — for code changes (make checkpasses; 2 pre-existing UI test failures noted above)