feat(cli): dirctl install#1745
Merged
Merged
Conversation
to auto-discover coding agents on a user's machine, and add MCP and Agent Skill records to their configs from Directory Signed-off-by: András Jáky <ajaky@cisco.com>
… flag Signed-off-by: András Jáky <ajaky@cisco.com>
Signed-off-by: András Jáky <ajaky@cisco.com>
…install` Signed-off-by: András Jáky <ajaky@cisco.com>
akijakya
force-pushed
the
feat/dirctl-install
branch
from
July 3, 2026 09:45
de38c6f to
64b1e9c
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new dirctl install command (plus uninstall/list) that pulls a record and installs its MCP server config and/or Agent Skill into the config files of detected AI coding agents, backed by a new shared cli/internal/agentcfg placement engine (paths, codecs, managed-block merge, atomic writes, reporting).
Changes:
- Introduces
cli/internal/agentcfgwith per-agent registry, config codecs (JSON/YAML/TOML), atomic file writes, and plan/summary formatting. - Adds
cli/cmd/installcommand group (install,install run,install uninstall,install list) and a top-leveldirctl uninstallshorthand. - Updates CLI reference docs to document the new install/uninstall/list behavior.
Reviewed changes
Copilot reviewed 47 out of 47 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/content/dir/dir-cli-reference.md | Documents the new install/uninstall/list commands and flags. |
| cli/internal/agentcfg/types.go | Defines core agent/target types (MCP + skill strategies). |
| cli/internal/agentcfg/summary.go | Implements post-run summary rendering. |
| cli/internal/agentcfg/summary_test.go | Tests summary output/tally behavior. |
| cli/internal/agentcfg/skill_render.go | Renders canonical SKILL.md into tool-specific rule formats. |
| cli/internal/agentcfg/skill_render_test.go | Tests skill rendering for each supported renderer. |
| cli/internal/agentcfg/skill_path.go | Implements skill path resolution helpers and ErrNoGlobalPath. |
| cli/internal/agentcfg/skill_frontmatter.go | Parses YAML frontmatter from canonical SKILL.md. |
| cli/internal/agentcfg/skill_frontmatter_test.go | Tests frontmatter parsing behavior. |
| cli/internal/agentcfg/skill_engine.go | Installs/removes skill artifacts (folder/file/managed-block). |
| cli/internal/agentcfg/skill_engine_test.go | Tests skill install/uninstall idempotency and fallbacks. |
| cli/internal/agentcfg/skill_block.go | Managed-block upsert/remove helpers for shared instruction files. |
| cli/internal/agentcfg/skill_block_test.go | Tests managed-block upsert/remove semantics. |
| cli/internal/agentcfg/result.go | Defines Outcome/Action and helpers for failure reporting. |
| cli/internal/agentcfg/registry.go | Adds the supported-agent registry (paths, detection markers, targets). |
| cli/internal/agentcfg/registry_test.go | Tests registry integrity and target path resolvability. |
| cli/internal/agentcfg/plan.go | Implements pre-run plan formatting. |
| cli/internal/agentcfg/plan_test.go | Tests plan formatting. |
| cli/internal/agentcfg/paths.go | Centralizes per-agent config path resolution by OS. |
| cli/internal/agentcfg/paths_test.go | Tests platform-specific path resolution. |
| cli/internal/agentcfg/options.go | Agent selection resolution logic (detected-only). |
| cli/internal/agentcfg/options_test.go | Tests selection behavior for explicit/all choices. |
| cli/internal/agentcfg/mcp_remove_test.go | Tests MCP removal behavior (only our key removed). |
| cli/internal/agentcfg/mcp_engine.go | Installs/removes MCP server entries with structured codecs + atomic writes. |
| cli/internal/agentcfg/mcp_engine_test.go | Tests MCP install/update/idempotency/dry-run behavior. |
| cli/internal/agentcfg/fsutil/atomic.go | Implements atomic file writes (temp + rename). |
| cli/internal/agentcfg/fsutil/atomic_test.go | Tests atomic write behavior and temp cleanup. |
| cli/internal/agentcfg/codec/codec.go | Adds JSON/YAML/TOML decode/encode and nested-map helpers. |
| cli/internal/agentcfg/codec/codec_test.go | Tests codec round-trips and nested helpers. |
| cli/cmd/root.go | Registers install commands and skips client setup for install list. |
| cli/cmd/install/uninstall.go | Implements install uninstall and top-level uninstall shorthand. |
| cli/cmd/install/testdata/skill.json | Test record fixture: skill-only module. |
| cli/cmd/install/testdata/multi.json | Test record fixture: skill + MCP modules. |
| cli/cmd/install/testdata/mcp.json | Test record fixture: MCP-only module. |
| cli/cmd/install/testdata/bare.json | Test record fixture: no modules. |
| cli/cmd/install/testdata/a2a.json | Test record fixture: A2A-only module. |
| cli/cmd/install/run.go | Defines install run subcommand. |
| cli/cmd/install/options.go | Shared flag struct for install subcommands. |
| cli/cmd/install/list.go | Implements install list (detect + show target paths). |
| cli/cmd/install/install.go | Implements main install flow: pull+derive → plan → confirm → apply → summary. |
| cli/cmd/install/install_test.go | Tests list behavior, subcommand wiring, uninstall shorthand flags. |
| cli/cmd/install/flags.go | Implements --agents, --dry-run, --yes/-y flag plumbing/validation. |
| cli/cmd/install/flags_test.go | Tests --agents parsing/validation. |
| cli/cmd/install/derive.go | Derives installable artifacts (skill + MCP entries) from record modules. |
| cli/cmd/install/derive_test.go | Tests artifact derivation and slug sanitization. |
| cli/cmd/install/apply.go | Applies/removes artifacts across selected agents (including skill dedupe). |
| cli/cmd/install/apply_test.go | Tests end-to-end apply behavior for MCP and skill targets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
YAML-quote skill name, propagate read errors, deterministic MCP order Signed-off-by: András Jáky <ajaky@cisco.com>
Signed-off-by: András Jáky <ajaky@cisco.com>
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.
Summary
Implements
dirctl install(#1737): pull a record by CID or verifiable name and install its OASF-derived artifacts — an MCP server entry and/or an Agent Skill — directly into the configs of detected AI coding agents (Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Cline, Roo, Gemini, OpenCode, Zed, Continue, Codex).The placement machinery is extracted into a shared
cli/internal/agentcfgengine (per-agent paths, JSON/YAML/TOML codec, managed-block merge, atomic writes, detection, summary) sodirctl init(#1705) can reuse it.Commands
dirctl install <cid-or-name>(≡install run) — detect → plan → confirm → installdirctl install uninstall <cid-or-name>(top-leveldirctl uninstallshorthand) — reverse itdirctl install list— show detected agents and target pathsBehavior
agentskills→ skill,integration/mcp→ MCP entry;a2a-only or no installable module → clear error pointing todirctl export).--agents all|<ids>selects agents; detection is always required — undetected agents are skipped, never forced.Follow-ups tracked in #1705 (
dirctl initwizard) and #1742 (batch install).Closes #1737.