feat(cli): dirctl init to install directory Agent Skill and MCP server#1787
Open
akijakya wants to merge 3 commits into
Open
feat(cli): dirctl init to install directory Agent Skill and MCP server#1787akijakya wants to merge 3 commits into
dirctl init to install directory Agent Skill and MCP server#1787akijakya wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Step 3 to dirctl init to install (and --remove to uninstall) the built-in Directory Agent Skill and Directory MCP server entry into detected AI coding agents, reusing shared placement logic and enabling per-artifact agent selection.
Changes:
- Introduces
cli/internal/agentinstallas a shared “derive artifacts + install/uninstall” engine used by bothdirctl installanddirctl init. - Adds
cli/internal/agentcfg.ParseSelection/AgentIDsto centralize--agentsparsing and flag help/validation. - Implements
dirctl initStep 3 with an interactive, dependency-free checkbox selector (skill selection and MCP selection handled independently), plus unit tests.
Reviewed changes
Copilot reviewed 18 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/internal/agentinstall/testdata/skill.json | Adds skill-only OASF record fixture for derive/apply tests. |
| cli/internal/agentinstall/testdata/multi.json | Adds combined skill+MCP OASF record fixture for derive/apply tests. |
| cli/internal/agentinstall/testdata/mcp.json | Adds MCP-only OASF record fixture for derive/apply tests. |
| cli/internal/agentinstall/testdata/bare.json | Adds empty-modules fixture to validate “no installable module” errors. |
| cli/internal/agentinstall/testdata/a2a.json | Adds A2A-only fixture to validate “cannot install into agent configs” errors. |
| cli/internal/agentinstall/filter.go | Adds Artifacts.SkillOnly() / MCPOnly() to support independent placement flows (init prompts). |
| cli/internal/agentinstall/derive.go | Renames/exports Artifacts + DeriveArtifacts under new agentinstall package. |
| cli/internal/agentinstall/derive_test.go | Updates tests to agentinstall package and exported DeriveArtifacts. |
| cli/internal/agentinstall/apply.go | Exports Install / Uninstall entrypoints for reuse across commands. |
| cli/internal/agentinstall/apply_test.go | Updates apply tests to use exported Artifacts + Install/Uninstall. |
| cli/internal/agentcfg/selection.go | Centralizes --agents sentinel (all) and selection parsing/validation. |
| cli/internal/agentcfg/selection_test.go | Adds unit tests for ParseSelection and AgentIDs. |
| cli/cmd/install/uninstall.go | Switches uninstall command to use agentinstall.Uninstall. |
| cli/cmd/install/install.go | Switches install command to use agentinstall.DeriveArtifacts + agentinstall.Install and shared agent selection parsing. |
| cli/cmd/install/flags.go | Updates --agents flag help/defaults to use agentcfg.AllAgents and agentcfg.AgentIDs(). |
| cli/cmd/install/flags_test.go | Removes now-obsolete tests for in-command --agents parsing (moved to agentcfg). |
| cli/cmd/install/batch.go | Switches batch install/uninstall to use agentinstall engine and artifact type. |
| cli/cmd/install/batch_test.go | Updates batch tests to use agentinstall.DeriveArtifacts and inline bare record. |
| cli/cmd/init/select.go | Adds raw-terminal checkbox selector UI (decodeKey, render loop) for interactive agent picking. |
| cli/cmd/init/run.go | Adds Step 3 into wizard flow and hooks --remove to also uninstall from agents. |
| cli/cmd/init/options.go | Adds --agents flag to scope which agents are eligible in the Step 3 wizard. |
| cli/cmd/init/agents.go | Implements Step 3 logic (derive built-in DIR artifacts, prompt independently, install/uninstall). |
| cli/cmd/init/agents_test.go | Adds unit tests covering Step 3 install/remove and selector state/key decoding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: András Jáky <ajaky@cisco.com>
Signed-off-by: András Jáky <ajaky@cisco.com>
Signed-off-by: András Jáky <ajaky@cisco.com>
37d7f63 to
2ebc4d9
Compare
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.
Closes #1705
Summary
Adds a "Directory MCP server & skills" step to the existing
dirctl initonboarding wizard, filling the slot it previously reserved as "MCP server & skills — coming soon." The step installs the built-in DIR MCP server entry and DIR Agent Skill into the user's detected AI coding agents, anddirctl init --removetears them down symmetrically.What it does
On
dirctl init, after the client-context and OASF-extractor steps, the wizard detects installed AI coding agents and asks — with two independent, interactive checkbox prompts (skill first, then MCP server) — which agents each artifact should go into. All detected agents are selected by default; the two selections are independent.j/k) move, space toggles, enter confirms, q/esc skips that artifact.--yes, installs both into every detected agent; without--yeson a non-TTY, it skips rather than acting unattended.--agentsnarrows the candidate pool; the step is skippable and idempotent, and--removeuninstalls what it added.Implementation notes
skill.BuildRecord(fromserver/skill, which embedsSKILL.mdas the single source of truth), then its artifacts are derived — skill body from the embeddedSKILL.md, MCP entry from theserver/skilldefinition (dirctl mcp serve, stdio). The MCP server is keyed by the OASF translator's normalized name (agntcy-dir).dirctl installinto a new internal packagecli/internal/agentinstall(Artifacts,DeriveArtifacts,Install,Uninstall), soinitandinstallshare the same derive + apply code and the same per-agent path/codec/managed-block/atomic-write engine (cli/internal/agentcfg).installbehavior is unchanged.agentinstall.Artifacts.SkillOnly()/MCPOnly()filters letinitplace the skill and MCP server independently (one per prompt).--agentsparsing moved intocli/internal/agentcfg(AllAgents,AgentIDs,ParseSelection), reused by both commands.golang.org/x/term(already a CLI dependency) — no new TUI library. Key decoding (decodeKey) and list state (selectState) are pure functions; the selector is injected into the step so the logic is unit-tested without a TTY.agentcfg(re-running only adds/updates what is missing).Tests
agentinstall/agentcfg: derive + apply andParseSelectionunit tests.init:installAgentscovered for no-agents-detected (skip), non-interactive-without---yes(skip, writes nothing),--yes(installs both), interactive per-artifact independence (skill vs. MCP selected separately), and--remove(entry proven present-before / absent-after). PlusdecodeKey(arrows,j/k, space, enter, ctrl-c, q) andselectState(cursor clamp + toggle).task lint:go= 0 issues across all modules;task test:unitpasses.