Skip to content

feat(cli): add archon skill install command#1445

Merged
leex279 merged 4 commits intodevfrom
feat/cli-skill-install
May 1, 2026
Merged

feat(cli): add archon skill install command#1445
leex279 merged 4 commits intodevfrom
feat/cli-skill-install

Conversation

@leex279
Copy link
Copy Markdown
Collaborator

@leex279 leex279 commented Apr 27, 2026

Summary

  • Problem: There is no scriptable way to install the bundled Archon skill into a project — today the only path is the interactive archon setup wizard.
  • Why it matters: Maintainers and users want a one-shot, non-interactive command they can run in a fresh project (or in CI/automation) to drop the skill into .claude/skills/archon/ so Claude Code picks it up.
  • What changed: Adds archon skill install [path] (defaulting to cwd), and refactors the existing copyArchonSkill helper out of commands/setup.ts into a dedicated commands/skill.ts so the helper is shared without dragging @clack/prompts into the new code path.
  • What did not change (scope boundary): The interactive setup wizard's "install the skill" step, the bundled skill file list, the bundled-skill.ts static-imports module, or any other CLI command. No changes to @archon/workflows, server, web, or adapters.

UX Journey

Before

User                                      Archon CLI
----                                      ----------
needs Archon skill in project --------->  archon setup        (interactive wizard)
                                          - DB prompts
                                          - AI prompts
                                          - Platform prompts
                                          - "Install the Archon skill?" [y/n]
sees skill copied <----------------------  .claude/skills/archon/  (only via wizard)

After

User                                      Archon CLI
----                                      ----------
needs Archon skill in project --------->  [archon skill install]            (new, one-shot)
                                          - copies 18 bundled skill files
sees skill copied <----------------------  .claude/skills/archon/

User running setup wizard ------------->  archon setup            (unchanged)
                                          - "Install the Archon skill?" [y/n]
                                            - same copyArchonSkill helper

Architecture Diagram

Before

packages/cli/src/
- cli.ts ---------------> commands/setup.ts ----+
                                                | exports copyArchonSkill
                                                v
                          bundled-skill.ts <----+ (BUNDLED_SKILL_FILES)
- commands/{workflow,isolation,validate,...}.ts

After

packages/cli/src/
- cli.ts ---------------> commands/setup.ts ----+
                          [+] commands/skill.ts +
                                                | both consume
                                                v
                          bundled-skill.ts <----+ (BUNDLED_SKILL_FILES)

  [~] cli.ts dispatches new `skill install` subcommand
  [~] setup.ts re-imports copyArchonSkill from ./skill (no functional change)
- commands/{workflow,isolation,validate,...}.ts

Connection inventory:

From To Status Notes
cli.ts commands/skill.ts new skill install dispatch
commands/setup.ts commands/skill.ts new copyArchonSkill re-imported from new home
commands/skill.ts bundled-skill.ts new reads BUNDLED_SKILL_FILES
commands/setup.ts bundled-skill.ts removed direct import gone (now via ./skill)
commands/setup.test.ts commands/skill.ts modified copyArchonSkill import re-pointed

Label Snapshot

  • Risk: risk: low
  • Size: size: S
  • Scope: cli
  • Module: cli:commands

Change Metadata

  • Change type: feature
  • Primary scope: cli

Linked Issue

  • Closes #
  • Related #
  • Depends on #
  • Supersedes #

(no linked issue — this is a small developer-experience addition)

Validation Evidence (required)

bun --filter @archon/cli type-check   # exit 0
bun --filter @archon/cli test         # 47 + 93 + 18 + 8 + 12 tests pass, 0 fail
bun run lint                          # exit 0
bun run format:check                  # exit 0
bun run validate                      # exit 0 (with the unrelated, pre-existing
                                      # untracked .archon/workflows/defaults/archon-feedback.yaml
                                      # set aside; that file is not part of this PR)

End-to-end smoke tests against the dev shim (~/.archon/bin/archon execs bun packages/cli/src/cli.ts):

$ archon skill install /tmp/archon-link-smoke
Installing Archon skill (18 files) into .../archon-link-smoke/.claude/skills/archon
Done. Restart Claude Code to load the skill.
$ ls /tmp/archon-link-smoke/.claude/skills/archon/
SKILL.md  examples/  guides/  references/

$ archon skill install /tmp/does-not-exist     # exit 1, "Directory does not exist"
$ archon skill                                  # exit 1, "Missing skill subcommand / Available: install"
$ archon skill foo                              # exit 1, "Unknown skill subcommand: foo / Available: install"
$ archon help | grep skill                      # new command listed in help + examples
  • Evidence provided: command output above; new skill.test.ts covers happy path, missing-dir, and overwrite behavior using mkdtempSync.
  • If any command is intentionally skipped: bun run validate's check:bundled flagged the bundle as stale — that staleness comes from a pre-existing untracked .archon/workflows/defaults/archon-feedback.yaml that was already on disk before this branch and is not part of this PR. With that file moved aside, bun run validate is green.

Security Impact (required)

  • New permissions/capabilities? No — only writes to <target>/.claude/skills/archon/ under a user-supplied path.
  • New external network calls? No.
  • Secrets/tokens handling changed? No.
  • File system access scope changed? No — same write surface as the existing copyArchonSkill helper used by archon setup. Bundled skill files are static text imported at compile time.

Compatibility / Migration

  • Backward compatible? Yes — purely additive CLI subcommand. The existing copyArchonSkill export from commands/setup.ts is removed, but it was an internal helper consumed only by setup.test.ts (re-pointed in this PR).
  • Config/env changes? No.
  • Database migration needed? No.

Human Verification (required)

What was personally validated beyond CI:

  • Verified scenarios:
    • archon skill install with no path arg installs into the cwd.
    • archon skill install <path> installs into the given path.
    • archon skill install --cwd <path> works via the global --cwd flag.
    • All 18 bundled files are written under .claude/skills/archon/.
    • Re-running overwrites previously installed files (verified by overwrite test in skill.test.ts).
    • archon skill (no subcommand) and archon skill foo exit 1 with helpful messages.
    • Missing target directory exits 1 with a clear error.
    • archon help shows the new command and example invocations.
    • archon setup interactive wizard still installs the skill (helper relocation only).
  • Edge cases checked: missing target directory, unknown subcommand, missing subcommand, overwrite of pre-existing skill files, target directory under a non-existent parent (copyArchonSkill creates intermediate dirs).
  • What was not verified: behaviour inside the compiled binary (bun build --compile). Static imports of BUNDLED_SKILL_FILES are unchanged, so the binary path is expected to behave identically — flagging here for completeness.

Side Effects / Blast Radius (required)

  • Affected subsystems/workflows: only @archon/cli. No changes to workflow execution, isolation, server, adapters, web, or providers.
  • Potential unintended effects: the only behavioural change to setup.ts is that copyArchonSkill now lives in ./skill. Tests guard the import path, and the wizard's call site is unchanged.
  • Guardrails/monitoring for early detection: existing CLI test suite + new skill.test.ts exercise both the happy and error paths. archon help now exposes the command, so users will discover it via the standard help surface.

Rollback Plan (required)

  • Fast rollback command/path: git revert <merge-sha> — single isolated commit with no data-model or storage impact.
  • Feature flags or config toggles: none. The command is a pure additive CLI surface; not invoking it is the rollback.
  • Observable failure symptoms: archon skill install ... exiting non-zero, or skill files not appearing under .claude/skills/archon/ on a successful run.

Risks and Mitigations

  • Risk: A user runs archon skill install against a project that already has a customised .claude/skills/archon/SKILL.md; the command will overwrite it.
    • Mitigation: Behaviour matches the existing wizard's "install skill" step (always overwrites — same contract on copyArchonSkill). The CLI prints the absolute target path before writing, so the destination is visible. Future PR could add --dry-run or --no-overwrite if maintainers want it.
  • Risk: The CLI grows another nested subcommand surface (skill *) which future contributors must keep consistent (help text, examples, no-git list).
    • Mitigation: Mirrors the existing workflow and isolation subcommand patterns; covered by tests; one-line help/example entries land alongside the dispatch.

Summary by CodeRabbit

  • New Features

    • Added archon skill install [path] to install bundled Archon skill into a project (current dir or specified path); installer overwrites existing skill files.
  • Documentation

    • Added usage examples and CLI reference documenting install location and behavior.
  • Tests

    • Added tests covering install success, overwrite behavior, and error handling for missing directories.

Adds a standalone `archon skill install [path]` subcommand that copies
the bundled Archon skill files into `<target>/.claude/skills/archon/`,
so users can install or refresh the skill outside the interactive setup
wizard. Defaults to the current directory.

Refactors `copyArchonSkill` out of `commands/setup.ts` into a new
`commands/skill.ts` so the helper can be shared between the wizard and
the new CLI command without pulling in `@clack/prompts`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c544dbef-33cc-44fb-acc9-799a200bbd38

📥 Commits

Reviewing files that changed from the base of the PR and between 12ce692 and bc46041.

📒 Files selected for processing (1)
  • packages/cli/src/commands/skill.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli/src/commands/skill.ts

📝 Walkthrough

Walkthrough

Adds a new top-level skill install CLI command that installs the bundled Archon skill into a target project. The copyArchonSkill implementation is moved from setup.ts into a new skill.ts module; CLI dispatcher, tests, and docs are updated accordingly. (48 words)

Changes

Cohort / File(s) Summary
CLI Command & implementation
packages/cli/src/commands/skill.ts, packages/cli/src/cli.ts, packages/cli/src/commands/setup.ts
New skill.ts exports copyArchonSkill and skillInstallCommand; CLI dispatcher recognizes skill install [path], resolves optional path, skips git validation for skill, and routes to skillInstallCommand. copyArchonSkill removed from setup.ts.
Tests
packages/cli/src/commands/skill.test.ts, packages/cli/src/commands/setup.test.ts
New tests validating installation, file overwrite behavior, exit codes, and logging. setup.test.ts updated to import copyArchonSkill from skill module.
Package script
packages/cli/package.json
test script updated to include skill.test.ts in the chained test runs (inserted between setup.test.ts and workflow.test.ts).
Documentation & guide
CLAUDE.md, packages/docs-web/src/content/docs/reference/cli.md, packages/docs-web/src/content/docs/guides/skills.md
Added CLI usage examples and reference/guide entries for archon skill install [path], noting install location .claude/skills/archon/ and overwrite behavior.

Sequence Diagram

sequenceDiagram
    participant User as User/CLI
    participant CLI as cli.ts
    participant SkillCmd as skillInstallCommand
    participant CopyFn as copyArchonSkill
    participant Bundled as Bundled Skill
    participant FS as File System

    User->>CLI: archon skill install [path]
    CLI->>CLI: parse args, resolve target path
    CLI->>SkillCmd: skillInstallCommand(targetPath)
    SkillCmd->>FS: check target directory exists
    alt directory missing
        FS-->>SkillCmd: error
        SkillCmd-->>User: log "Directory does not exist"
        SkillCmd-->>CLI: return 1
    else directory exists
        SkillCmd->>CopyFn: copyArchonSkill(targetPath)
        CopyFn->>Bundled: dynamic import BUNDLED_SKILL_FILES
        Bundled-->>CopyFn: file map
        loop per bundled file
            CopyFn->>FS: create dirs and write/overwrite file to .claude/skills/archon/
        end
        CopyFn-->>SkillCmd: success
        SkillCmd-->>User: log completion + restart message
        SkillCmd-->>CLI: return 0
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 I hopped the CLI, a nimble hare,
Pushed bundled skill with diligent care,
Files tucked in .claude/skills/archon/ neat,
Overwritten, arranged, and ready to greet,
Restart Claude Code — now the workflow's complete. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(cli): add archon skill install command' accurately and specifically describes the main change—the addition of a new CLI command for installing the Archon skill, which is the primary feature introduced by this PR.
Description check ✅ Passed The pull request description comprehensively covers all required template sections: a well-structured summary with problem/impact/changes, detailed UX journey and architecture diagrams with connection inventory, appropriate labels and metadata, linked issues (none needed), validation evidence with test results and smoke tests, security and compatibility analysis, human verification details, side effects/blast radius assessment, and a rollback plan with risk mitigation strategies.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-skill-install

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@leex279
Copy link
Copy Markdown
Collaborator Author

leex279 commented Apr 27, 2026

🔍 Comprehensive PR Review

PR: #1445 — feat(cli): add archon skill install command
Reviewed by: 5 specialized agents (code-review, error-handling, test-coverage, comment-quality, docs-impact)
Date: 2026-04-27


Summary

Clean, well-structured PR that extracts copyArchonSkill from setup.ts into a dedicated skill.ts module and adds a standalone archon skill install [path] CLI command. No bugs found, no CLAUDE.md violations. The only actionable items are documentation gaps.

Verdict: APPROVE (with documentation updates recommended)

Severity Count
🔴 CRITICAL 0
🟠 HIGH 2
🟡 MEDIUM 1
🟢 LOW 6

🟠 High Issues (Documentation Gaps)

1. CLAUDE.md Missing skill install CLI Command

📍 CLAUDE.md — CLI (Command Line) section

The CLI section lists every available command but is missing skill install. Since CLAUDE.md is loaded into every agent conversation, this means agents won't know the command exists.

Suggested addition
# Install the bundled Archon skill into a project
bun run cli skill install
bun run cli skill install /path/to/project

2. docs-web CLI Reference Missing skill install

📍 packages/docs-web/src/content/docs/reference/cli.md

The CLI reference documents every command but has no section for skill install. Users consulting the docs won't find it.

Suggested addition
## skill install

Install the bundled Archon skill files into a project's `.claude/skills/archon/` directory.
Always overwrites existing files to ensure the latest version.

\`\`\`bash
archon skill install
archon skill install /path/to/project
\`\`\`

Also installed automatically during `archon setup`.

🟡 Medium Issues (Needs Decision)

1. Skills Guide Could Mention archon skill install

📍 packages/docs-web/src/content/docs/guides/skills.md

The skills guide shows third-party skill installation but doesn't mention the bundled Archon skill. A 1-2 line note would complete the picture.

Options: Fix now (1-2 lines) | Create issue | Skip


🟢 Low Issues

View 6 low-priority observations (all "keep as-is")
Issue Location Agent Recommendation
Double resolve() in skillInstallCommand skill.ts:42 Code Review Keep — defensive, idempotent
async without await skill.ts:41 Code Review Keep — matches CLI convention
Catch discards err.code skill.ts:55 Error Handling Keep — err.message includes it
Partial write not communicated skill.ts:22-31 Error Handling Keep — idempotent re-run fixes
CLI dispatch untested cli.ts:573-598 Test Coverage Keep — matches codebase pattern
Docstring lists specific file types skill.ts:4 Comment Quality Keep — accurate today

✅ What's Good

  • Clean refactorcopyArchonSkill extracted without behavioral changes
  • Follows existing patternsskill dispatch mirrors validate exactly
  • Strong test coverage — install, overwrite, success, and error paths all tested
  • Proper test isolationspyOn only, correct batch grouping, no mock pollution
  • Fail-fast designexistsSync guard + try/catch with clear error messages
  • Idempotent — always overwrites, safe to re-run
  • No silent failures — every error path reports to user with exit code 1
  • Concise — 61 lines source, 85 lines tests

📋 Next Steps

  1. 📝 Add skill install to CLAUDE.md CLI section (HIGH)
  2. 📝 Add skill install to docs-web CLI reference (HIGH)
  3. 📝 Consider mentioning bundled skill in skills guide (MEDIUM)
  4. 🎯 Merge when documentation is updated

Agent Findings Verdict
Code Review 2 LOW APPROVE
Error Handling 2 LOW APPROVE
Test Coverage 2 LOW APPROVE
Comment Quality 1 LOW APPROVE
Docs Impact 2 HIGH + 1 MEDIUM UPDATES_REQUIRED

Reviewed by Archon comprehensive-pr-review workflow

- Add `skill install` command entries to CLAUDE.md CLI section
- Add `skill install` section to docs-web CLI reference page
- Add bundled Archon skill to Popular Skills table in skills guide

Addresses HIGH findings from comprehensive PR review.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leex279
Copy link
Copy Markdown
Collaborator Author

leex279 commented Apr 27, 2026

⚡ Auto-Fix Report

Status: COMPLETE
Pushed: ✅ Changes pushed to feat/cli-skill-install


Fixes Applied

Severity Fixed Skipped
🔴 CRITICAL 0 0
🟠 HIGH 2 0
🟡 MEDIUM 1 (bonus) 0

What Was Fixed

  • CLAUDE.md missing skill install — Added command entries with examples to CLI section
  • docs-web CLI reference missing skill install — Added full skill install [path] section with description, usage, and context
  • Skills guide missing bundled Archon skill — Added archon (bundled) row to Popular Skills table with archon skill install as the install command

Commit

01df8ffddocs: add skill install to CLAUDE.md, CLI reference, and skills guide


🟢 Low Issues (No Action Needed)

All 6 LOW findings were independently assessed as "keep as-is" by their review agents. See the comprehensive review comment for details.


Validation

✅ Type check | ✅ Lint | ✅ Format


Auto-fixed by Archon comprehensive-pr-review workflow
Fixes pushed to branch feat/cli-skill-install

Resolves conflict in packages/cli/src/commands/setup.ts: PR extracted
copyArchonSkill into ./skill while dev (#1394) added a lazy-import fix
inline. Kept PR's structure (function lives in skill.ts) and applied
dev's lazy-import pattern there so archon --help no longer crashes when
source skill files are missing on linked-source installs.

- packages/cli/src/commands/skill.ts: dynamic-import bundled-skill;
  copyArchonSkill is now async
- packages/cli/src/commands/setup.ts: await copyArchonSkill at the
  setup-wizard call site
- packages/cli/src/commands/skill.test.ts: await the now-async helper

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@leex279 leex279 marked this pull request as ready for review May 1, 2026 09:56
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/cli/src/cli.ts (1)

579-582: ⚡ Quick win

Resolve relative install paths against --cwd for consistency.

When users pass both --cwd and a relative [path], resolve(targetArg) is based on process.cwd(), not the overridden cwd. Consider resolve(cwd, targetArg) to keep path behavior consistent with global --cwd.

Proposed diff
-            const targetPath = targetArg ? resolve(targetArg) : cwd;
+            const targetPath = targetArg ? resolve(cwd, targetArg) : cwd;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli/src/cli.ts` around lines 579 - 582, The positional install path
is being resolved relative to process.cwd() instead of the overridden cwd, so
update the resolution logic to use the resolved CLI cwd as the base: when
computing targetPath from positionals[2] (targetArg), call resolve(cwd,
targetArg) rather than resolve(targetArg), and then pass that targetPath into
skillInstallCommand; keep the existing fallback of using cwd when no positional
is provided and ensure symbols referenced are positionals, targetArg,
targetPath, cwd and skillInstallCommand.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cli/src/commands/skill.ts`:
- Around line 55-67: The import of BUNDLED_SKILL_FILES is outside the
error-handling path so failures there can crash the CLI; move or replicate the
dynamic import (await import('../bundled-skill')) into the same try block that
calls copyArchonSkill(absoluteTarget) (or wrap it in its own try/catch) and on
failure log the same styled error and return 1 (use the same error handling used
for copyArchonSkill), ensuring any references to BUNDLED_SKILL_FILES and the
computed skillRoot are only used after the guarded import succeeds.

---

Nitpick comments:
In `@packages/cli/src/cli.ts`:
- Around line 579-582: The positional install path is being resolved relative to
process.cwd() instead of the overridden cwd, so update the resolution logic to
use the resolved CLI cwd as the base: when computing targetPath from
positionals[2] (targetArg), call resolve(cwd, targetArg) rather than
resolve(targetArg), and then pass that targetPath into skillInstallCommand; keep
the existing fallback of using cwd when no positional is provided and ensure
symbols referenced are positionals, targetArg, targetPath, cwd and
skillInstallCommand.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 34f65baa-c111-4324-995a-01e9c3df6a1d

📥 Commits

Reviewing files that changed from the base of the PR and between 1820a35 and 12ce692.

📒 Files selected for processing (9)
  • CLAUDE.md
  • packages/cli/package.json
  • packages/cli/src/cli.ts
  • packages/cli/src/commands/setup.test.ts
  • packages/cli/src/commands/setup.ts
  • packages/cli/src/commands/skill.test.ts
  • packages/cli/src/commands/skill.ts
  • packages/docs-web/src/content/docs/guides/skills.md
  • packages/docs-web/src/content/docs/reference/cli.md

Comment thread packages/cli/src/commands/skill.ts
…lock

The dynamic `await import('../bundled-skill')` was outside the try/catch,
so a load failure crashed uncaught instead of returning exit code 1.
Move the import (and the success log + return) inside the try so import,
copy, and post-copy errors all flow through the same controlled path.

Addresses coderabbitai review on PR #1445.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@leex279 leex279 merged commit 4631b8e into dev May 1, 2026
4 checks passed
@leex279 leex279 deleted the feat/cli-skill-install branch May 1, 2026 10:11
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.

2 participants