Add agent discovery setup to the CLI - #192
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The managed-markdown end-marker search logic can select the wrong marker and corrupt or mis-edit instruction files, and the CLI development docs include Windows-only commands.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds a “CLI-first” agent discovery workflow to the Microsoft Learn CLI so users can install/remove a bundled skill plus always-loaded instructions for GitHub Copilot, Claude Code, and Codex, without configuring MCP.
Changes:
- Introduces
mslearn setup/mslearn removecommands that write/remove managed discovery assets in user or project scope (including Codex managed-section edits toAGENTS.md/AGENTS.override.md). - Bundles discovery assets into the npm package (
cli/assets/microsoft-learn-cli/*) and updates documentation to describe CLI-first vs plugin (MCP-first) modes. - Expands unit coverage around installation/removal idempotency and updates repo validation to include the new CLI files/assets.
File summaries
| File | Description |
|---|---|
| scripts/validate-repo.ps1 | Adds new CLI command/setup modules and packaged assets to the repo validator allowlist. |
| README.md | Documents the new CLI-first setup/remove workflow and clarifies CLI-first vs MCP-first modes. |
| cli/test/unit/cli.test.ts | Adds filesystem-backed tests covering setup/remove behavior, idempotency, and Codex managed-section handling. |
| cli/src/setup/managed-markdown.ts | Implements managed-section upsert/removal helpers for Codex instruction files. |
| cli/src/setup/copilot.ts | Defines Copilot discovery file locations for global/project scope. |
| cli/src/setup/agents.ts | Centralizes per-agent discovery paths/assets and instruction formatting (e.g., Copilot frontmatter). |
| cli/src/index.ts | Registers new setup and remove commands in the CLI program. |
| cli/src/context.ts | Extends CLI context to include cwd and homeDir for path resolution. |
| cli/src/commands/setup.ts | Implements mslearn setup to install skills/instructions across selected agents/scopes. |
| cli/src/commands/remove.ts | Implements mslearn remove to remove only managed discovery content and preserve unrelated files. |
| cli/README.md | Adds “Agent discovery” docs and updates command reference and development instructions. |
| cli/package.json | Ensures assets/ ships in the npm package and makes build remove dist/ before compiling. |
| cli/assets/microsoft-learn-cli/SKILL.md | Adds the bundled CLI-first skill content installed into agent skill directories. |
| cli/assets/microsoft-learn-cli/INSTRUCTIONS.md | Adds the bundled always-loaded instruction content referenced by setup. |
Review details
- Files reviewed: 14/14 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
@microsoft-github-policy-service agree company="Microsoft" |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
LGTM |
Summary
setupandremovecommands for agent discovery and configuration