Skip to content

feat(iss-63): ./sync.sh uninstall [--dry-run] - #66

Merged
maceorichards merged 10 commits into
developfrom
feat/iss-63-sync-uninstall
Nov 4, 2026
Merged

maceorichards merged 10 commits into
developfrom
feat/iss-63-sync-uninstall

Conversation

@maceorichards

Copy link
Copy Markdown
Owner

Summary

New command ./sync.sh uninstall [--dry-run]: removes every managed skill from every provider's skills folder and the devflow section from every provider's instructions file. It reads only manifest.json: no vendor clones, no network.

uninstall(argv)                       # dispatched before load(), so no vendor checks
  uninstall_skills                    # each distinct skills_dir, in table order
    same folder as an earlier one?  → SKIP (same folder as ~/.claude/skills)
    each marked, non-symlink folder → removed <name> | would remove <name> | FAIL
  uninstall_instructions              # each provider's instructions file
    remove_instructions             → removed … devflow section | SKIP … left untouched
    same file as an earlier one?    → SKIP <file>: same file as <first>, left untouched
  uninstall_notes                     # git ignore lines kept (named file), Cursor reminder,
                                      # what's kept, how to reinstall
  closing                             # nothing to remove / <k> item(s) left by hand / exit 1 on FAIL

It keeps the git ignore lines, devflow.local.json, vendor/, and each project's .devflow/ and .worktrees/. The README gains a Commands line and an Uninstall note: dry run, uninstall, then delete the clone. "Uninstall, then ./sync.sh" is the documented clean reinstall. The glossary defines Managed skill.

The final review found that a removal failing partway could delete the marker and leave the folder behind. A rerun of uninstall then reported "nothing to remove", and a sync skipped that skill as unmanaged. The fix changes the removal step that remove_managed shares with prune and cleanup:

 remove_managed(root, d, …)
-  rmtree(<d>)
+  rename <d> → free <d>.devflow-gone[-N]   # read-only root fails here, nothing touched
+  delete contents, marker last
+  on partial failure: rename back to <d>, still marked

Evidence

  • Before: ./sync.sh uninstall printed the usage. Removing devflow meant deleting skills and sections by hand.
    After: 32 new tests in SyncSandbox (25 for the command, 7 for the README) cover install claude,codex then uninstall, the dry run snapshot (nothing changes), the second run ("nothing to remove", exit 0), unmanaged and symlinked folders and user text around the markers surviving, incomplete markers (SKIP plus closing count), shared folders and files, a marked skill no longer in the manifest, no vendor/, FAIL with exit 1, and bad arguments.
  • Before (review fix): read-only skills folder, then uninstall (FAIL), restore permissions, then uninstall printed "nothing to remove", and ./sync.sh printed SKIP (exists, not managed by devflow) tdd.
    After: markers survive the failed run, the rerun removes everything, and a sync reinstalls with no SKIP. 7 tests in tests/test_uninstall_failures.py; the three read-only cases fail on the old code.
  • Full suite on the branch: 405 passed, 0 failed (baseline 366 at the start of the feature, then 373 after the README ticket).

Merge Danger

Door: two-way

The command is additive and only runs when called by name. The one change to existing behaviour, the safer remove_managed, prints the same output.

Blast Radius: sync

prune and cleanup (deselecting providers, dropped skills) now go through the rename-then-delete path. Their output is unchanged, and the full sync suite passes.

Tickets

# Title Lane Outcome Merge
#64 uninstall removes managed skills and devflow sections rigor merged, 2 tasks reviewed and approved, no rulings 911d7e4
#65 README documents uninstall fast merged eace41b

Final review fix: 40ebcbd.

Follow-ups

Minor findings, none blocking:

  • "nothing to remove" can print next to the hand-removal count, or above the failure count when every removal failed.
  • An instructions file that held only the devflow section, for example a ~/.gemini/GEMINI.md the sync created, is left as an empty file.
  • Hard-linked instructions files: the dry run says the second file is "left untouched", but the real run's atomic rewrite breaks the link and cleans both. The end state is right; the prediction isn't.
  • A write error in remove_instructions, or an unreadable skills folder, ends in a traceback. The sync has the same gap.
  • The uninstall counts read remove_instructions' printed lines (removed / would remove / SKIP), so rewording those lines would break the counts.
  • Duplication:
    • git-ignore-lines parsing appears in both uninstall_notes and sync_git_ignore;
    • the shared-folder and shared-file checks repeat one shape;
    • the seen dict mixes path and (dev, ino) keys;
    • the _write and _read test helpers are redefined per module.
  • Small additions the spec didn't ask for: the <k> folder(s) could not be removed closing line, and "if you added it" in the Cursor reminder.
  • Untested branches:
    • the notes line for an ignore file that can't be located;
    • the dry-run "would remove devflow section" line;
    • the unreadable-file SKIP count;
    • a run that both removes skills and skips a file;
    • a direct check that nothing in the clone changes.

Closes #63
Closes #64
Closes #65
Closes #47

🤖 Generated with Claude Code

maceorichards and others added 10 commits November 4, 2026 15:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…older

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename to a free .devflow-gone sibling before deleting, delete the marker last, and rename back on a partial failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maceorichards
maceorichards merged commit 57acae7 into develop Nov 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant