feat: Add experimental CLI for Learn MCP - #117
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds an in-repo, experimental TypeScript companion CLI (mslearn) that acts as a thin MCP client for the public Microsoft Learn MCP endpoint, plus repository wiring to validate/build/test it.
Changes:
- Introduces the
cli/Node/TypeScript package implementingsearch,fetch,code-search, anddoctor. - Adds MCP client logic for tool discovery and session/tool caching, plus unit tests.
- Updates repository docs and CI/validation to include the new CLI package.
Reviewed changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/validate-repo.ps1 | Adds repository validation for the new cli/ package structure. |
| cli_spec.md | Documents the v0.1 CLI goals, commands, and architecture contract. |
| cli/tsconfig.json | TypeScript compilation settings for the CLI package. |
| cli/test/unit/tool-discovery.test.ts | Unit tests for mapping/discovering Learn MCP tools. |
| cli/test/unit/markdown.test.ts | Unit tests for markdown section extraction and truncation. |
| cli/test/unit/cli.test.ts | CLI contract tests for help, output, exit codes, and options. |
| cli/test/unit/cache.test.ts | Unit tests for persistent cache behavior and direct-call fallback paths. |
| cli/src/utils/text.ts | Text formatting helpers (doctor text output, newline normalization). |
| cli/src/utils/options.ts | CLI option parsing and endpoint/URL normalization. |
| cli/src/utils/markdown.ts | Markdown section extraction and output truncation helpers. |
| cli/src/utils/errors.ts | CLI error types with exit-code semantics. |
| cli/src/utils/contracts.ts | Shared constants/types for CLI behavior (formats, doctor report shape). |
| cli/src/mcp/tool-discovery.ts | Logic for mapping discovered tools to CLI capabilities. |
| cli/src/mcp/client.ts | MCP client wrapper with caching, tool calls, and recovery behavior. |
| cli/src/mcp/cache.ts | Persistent file-backed session/tool cache implementation. |
| cli/src/index.ts | CLI entrypoint wiring commander commands and error handling. |
| cli/src/context.ts | Dependency-injection context for IO/fetch/client creation. |
| cli/src/commands/search.ts | Implements mslearn search. |
| cli/src/commands/fetch.ts | Implements mslearn fetch with section/max-chars options. |
| cli/src/commands/doctor.ts | Implements mslearn doctor diagnostics and reporting. |
| cli/src/commands/code-search.ts | Implements mslearn code-search. |
| cli/package.json | Defines the CLI npm package metadata, dependencies, and scripts. |
| cli/package-lock.json | Locks CLI dependency graph for reproducible installs in CI. |
| cli/README.md | CLI usage and development instructions. |
| cli/.gitignore | Ignores CLI build output and dependencies. |
| README.md | Documents the presence of the companion CLI and how to run it. |
| .gitignore | Adds ignores relevant to Node/CLI and local Claude settings. |
| .github/workflows/validate.yml | Updates CI to install/build/test the CLI before repo validation. |
Files not reviewed (1)
- cli/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 28 changed files in this pull request and generated 5 comments.
Files not reviewed (1)
- cli/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 28 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- cli/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
890032c
into
MicrosoftDocs:main
Summary
Add an in-repo mslearn companion CLI for the Microsoft Learn MCP server, plus docs, tests, and validation wiring.
What’s included
Validation