Skip to content

feat(skills): add archive and restore subcommands - #246

Merged
amirulabu merged 3 commits into
mainfrom
feat/skills-archive-restore
Jul 7, 2026
Merged

feat(skills): add archive and restore subcommands#246
amirulabu merged 3 commits into
mainfrom
feat/skills-archive-restore

Conversation

@amirulabu

@amirulabu amirulabu commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds two new subcommands to wukong skills for temporarily deactivating skills without deleting them:

  • wukong skills archive — interactive multi-select of installed skills; moves each .agents/skills/<slug>.agents/skills-archive/<slug> (per scope: project/global) and removes the .claude/skills/<slug> symlink so agents no longer see it.
  • wukong skills restore — interactive multi-select of archived skills; moves them back into .agents/skills/<slug> and recreates the .claude/skills/<slug> symlink via the existing create_skill_symlink().

This is a non-destructive alternative to skills remove. The mv-manifest.json is left untouched so update-tracking is preserved across archive/restore.

Details

  • Uses fs::rename (same root/filesystem → atomic, simple).
  • Skips already-archived / already-active slugs with a warning.
  • Local-only commands (no registry/config client needed), matching the remove pattern.
  • Core file operations are extracted into pure archive_skill() / restore_skill() helpers so they can be unit-tested independently of the interactive prompt.

Follow-up hardening

  • Idempotent restore. Restore now removes any stale .claude/skills/<slug>/SKILL.md before recreating the symlink. Previously, a leftover link (e.g. from a partially-failed archive) made create_skill_symlink() fail with EEXIST, so the skill was moved back and the archive dir deleted but the command reported Failed — leaving a half-restored state that re-runs never repaired ("already active"). Restore is now safe to re-run.
  • No config required for local-only commands. All skills subcommands previously routed through a context builder that hard-failed if ~/.config/wukong/.../config.toml was missing (Run wukong init), even though archive/restore/remove/init touch no network or auth. Added a config-tolerant get_skills_context() so local-only commands run without wukong init; the registry-backed commands (list/find/add/update/publish) still load config themselves and surface the same error if it's missing.
  • Self-documenting archive folder. archive writes a README.md into .agents/skills-archive/ explaining what the folder is and that the Wukong CLI created it, so the (intentionally reversible) folder isn't a mystery — including the empty parent left behind after a full restore.

Test plan

  • cargo fmt --all
  • cargo clippy -- -D warnings
  • cargo test --test skills and --test completion ✅ (completion snapshots regenerated for the two new subcommands)
  • New unit tests over the extracted helpers ✅ — archive move + link removal + README, archive-conflict skip, restore round-trip + symlink, restore idempotency with a stale .claude link (regression for the fix above), restore already-active skip.
  • Manual end-to-end (via pty): archive moves the skill dir + drops the symlink and writes the README; restore moves it back and the symlink resolves again; both run with no config file present; re-running hits the skip paths.

Note: a full cargo test on my machine has unrelated linker failures in other test binaries (ld: library 'clang_rt.osx' not found, broken local Command Line Tools — toolchain looks under clang/17, system has clang/21) — environmental, not from this change. CI should be unaffected.

amirulabu added 3 commits July 7, 2026 09:27
Add `wukong skills archive` to move installed skills out of the active
folder (`.agents/skills` -> `.agents/skills-archive`) and remove the
`.claude/skills` symlink so agents no longer see them, and `wukong skills
restore` to move them back and recreate the symlink. Non-destructive
alternative to `skills remove`.
…ocal commands

- restore: recreate .claude symlink idempotently so a stale leftover link no
  longer fails with EEXIST and leaves a half-restored, misreported state
- archive/restore: extract pure archive_skill/restore_skill helpers
- skills: build a config-tolerant context so local-only commands (init, remove,
  archive, restore) run without `wukong init`; registry commands still require it
- archive: write a self-documenting README.md into .agents/skills-archive/
- tests: add unit coverage for the archive/restore file operations
Archived and removed skills keep their mv-manifest.json entry, so
`skills update` would recreate their .agents/skills/<slug> folder when an
update was available. Skip manifest entries whose active source is gone.
@amirulabu
amirulabu requested a review from mfauzaan July 7, 2026 03:32
@amirulabu
amirulabu merged commit 564ad99 into main Jul 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants