Skip to content

fix(uninstall): preserve dirty-repo guard in JSON mode - #243

Merged
runkids merged 2 commits into
runkids:mainfrom
hhh2210:fix/uninstall-json-dirty-guard
Jul 15, 2026
Merged

runkids merged 2 commits into
runkids:mainfrom
hhh2210:fix/uninstall-json-dirty-guard

Conversation

@hhh2210

@hhh2210 hhh2210 commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)

Linked Issue

Closes #242

What changed

Global skill uninstall --json no longer sets force=true internally. JSON mode remains non-interactive, but a dirty tracked repository now requires an explicit --force.

The regression coverage checks four paths:

  • a clean skill is removed without a confirmation prompt;
  • a dirty tracked repository returns a pure JSON error and remains in place;
  • an all-dirty batch reports the uncommitted changes instead of a generic pre-flight error;
  • mixed batches skip dirty repositories without polluting JSON output, while --json --force retains the previous forced behavior.

The CLI help, command reference, and bundled Skillshare skill now describe the updated boundary. This PR does not change project skill uninstall, agent uninstall, install, or collect JSON semantics.

Validation

  • make check
  • SKILLSHARE_TEST_BINARY=/tmp/skillshare-pr-bin go test -v ./tests/integration -run 'TestUninstall_JSON_(SkipsConfirmation|DirtyRepoRequiresExplicitForce)' -count=1

Checklist

  • I've read CONTRIBUTING.md
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

Copilot AI review requested due to automatic review settings July 12, 2026 14:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression where skillshare uninstall --json implicitly enabled --force, causing dirty tracked repositories to be uninstalled without requiring explicit user intent. JSON mode remains non-interactive, but now preserves the dirty-repo guard unless --force is provided.

Changes:

  • Removed the implicit --force behavior from global uninstall --json, while keeping JSON non-interactive (confirmation suppressed).
  • Updated uninstall pre-flight behavior so dirty tracked repos fail with a JSON error when uninstalling a single target, and are skipped quietly in mixed JSON batches.
  • Added/updated integration coverage and adjusted docs/reference wording to reflect the new boundary.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/skillshare/uninstall.go Stops treating --json as implicit --force for global uninstall; updates dirty-repo handling and confirmation gating in JSON mode.
tests/integration/json_output_test.go Replaces the old “json implies force” coverage with tests for “skip confirmation” and “dirty repo requires explicit force” (including mixed-batch behavior).
website/docs/reference/commands/uninstall.md Updates command reference to clarify JSON behavior in global mode and the --force requirement for dirty tracked repos.
skills/skillshare/SKILL.md Updates bundled skill examples to reflect the new uninstall JSON/force boundary.
skills/skillshare/references/install.md Updates documentation snippet describing uninstall JSON behavior to match the new semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +849 to 853
ui.StepSkip(t.name, "uncommitted changes, use --force")
}
ui.StepSkip(t.name, "uncommitted changes, use --force")
continue
}
if !opts.jsonOutput {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 50b40a4. When every batch target is a dirty tracked repo, the JSON error now names uncommitted changes and points to explicit --force. Added integration coverage for two dirty repos; make check passes.

@hhh2210

hhh2210 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

@runkids ready for reveiw

@runkids
runkids self-requested a review July 15, 2026 01:30
@runkids
runkids merged commit e2c0a64 into runkids:main Jul 15, 2026
9 checks passed
@runkids

runkids commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Thanks!

runkids added a commit that referenced this pull request Jul 15, 2026
--json implied --force, silently overwriting existing skills/agents
in source when collecting. Decouple confirmation-skip from the
overwrite guard, same fix as PR #243 for uninstall.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(uninstall): keep --json from bypassing dirty-repo protection

3 participants