feat(cli): MCP setup diagnostics + adf tidy routing improvements#208
Merged
Conversation
…#198) - `charter hook print --mcp-config [--client claude|codex|cursor]` emits the mcpServers JSON snippet for wiring charter serve into any supported AI client - `charter doctor --mcp` detects MCP client config files and verifies charter is wired under mcpServers; surfaces actionable hint when not found - `charter adf tidy --dry-run` now shows per-item routing plan (target module + section) in text output so users can review before applying - `adf tidy` retains Session Start / Session Protocol / Session Setup headings alongside Environment and Module Index (not treated as bloat) - `adf tidy` preserves full code-block content with fencing instead of collapsing to a single-line description Closes #191, #198 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove dead branch in buildMcpConfigSnippet (both arms were identical); inline the snippet construction directly in printMcpConfig - Fix --client flag parsing: guard indexOf result before indexing so a missing --client flag never reads args[0] as the client value - Fix dry-run routing plan truncation: split on newline before slicing so multi-line items (fenced code blocks) don't embed raw newlines - Add unit tests for all hook print --mcp-config paths (5 cases) - Add integration tests for charter doctor --mcp (5 cases: no files, missing entry, wired, invalid JSON, partial wiring) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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
charter hook print --mcp-config [--client claude|codex|cursor]— emits themcpServersJSON snippet for wiringcharter serveinto Claude Code, Codex, or Cursor. Defaults to--client claude. Supports--ai-dirpass-through for non-default.aidir locations.charter doctor --mcp— focused check: scans.claude/settings.json,.claude/settings.local.json,.mcp.json, and.cursor/mcp.jsonfor amcpServers.charterentry. Reports PASS or a WARN with thehook printhint.adf tidy --dry-runrouting plan — text output now shows per-item routing (target module + section) so users can review before applying.Session Start,Session Protocol,Session Setupare no longer treated as bloat (joinsEnvironmentandModule Index).adf tidynow keeps full code-block content with fencing instead of collapsing to a one-liner.Test plan
charter hook print --mcp-config→ outputsmcpServers.charterJSON withcommand: charter, args: [serve]charter hook print --mcp-config --client cursor→ same JSON, hint says.mcp.jsoncharter hook print --mcp-config --ai-dir custom/ai→args: [serve, --ai-dir, custom/ai]charter doctor --mcp→ PASS ifmcpServers.charterfound, WARN + hint if notcharter adf tidy --dry-run→ routing plan visible in text outputCloses #191, #198
🤖 Generated with Claude Code