@mycodemap/mycodemap 1.9.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +138 -928
- package/README.zh-CN.md +1096 -0
- package/dist/cli/commands/analyze-options.d.ts.map +1 -1
- package/dist/cli/commands/analyze-options.js +8 -0
- package/dist/cli/commands/analyze-options.js.map +1 -1
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +60 -41
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/benchmark.d.ts +8 -0
- package/dist/cli/commands/benchmark.d.ts.map +1 -0
- package/dist/cli/commands/benchmark.js +150 -0
- package/dist/cli/commands/benchmark.js.map +1 -0
- package/dist/cli/commands/deps.d.ts +2 -1
- package/dist/cli/commands/deps.d.ts.map +1 -1
- package/dist/cli/commands/deps.js +107 -78
- package/dist/cli/commands/deps.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +3 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +34 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/query.d.ts +1 -0
- package/dist/cli/commands/query.d.ts.map +1 -1
- package/dist/cli/commands/query.js +123 -140
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/doctor/check-agent.d.ts +3 -0
- package/dist/cli/doctor/check-agent.d.ts.map +1 -0
- package/dist/cli/doctor/check-agent.js +60 -0
- package/dist/cli/doctor/check-agent.js.map +1 -0
- package/dist/cli/doctor/check-ghost-commands.d.ts +3 -0
- package/dist/cli/doctor/check-ghost-commands.d.ts.map +1 -0
- package/dist/cli/doctor/check-ghost-commands.js +86 -0
- package/dist/cli/doctor/check-ghost-commands.js.map +1 -0
- package/dist/cli/doctor/check-native-deps.d.ts +3 -0
- package/dist/cli/doctor/check-native-deps.d.ts.map +1 -0
- package/dist/cli/doctor/check-native-deps.js +54 -0
- package/dist/cli/doctor/check-native-deps.js.map +1 -0
- package/dist/cli/doctor/check-workspace-drift.d.ts +3 -0
- package/dist/cli/doctor/check-workspace-drift.d.ts.map +1 -0
- package/dist/cli/doctor/check-workspace-drift.js +83 -0
- package/dist/cli/doctor/check-workspace-drift.js.map +1 -0
- package/dist/cli/doctor/formatter.d.ts +20 -0
- package/dist/cli/doctor/formatter.d.ts.map +1 -0
- package/dist/cli/doctor/formatter.js +91 -0
- package/dist/cli/doctor/formatter.js.map +1 -0
- package/dist/cli/doctor/index.d.ts +8 -0
- package/dist/cli/doctor/index.d.ts.map +1 -0
- package/dist/cli/doctor/index.js +9 -0
- package/dist/cli/doctor/index.js.map +1 -0
- package/dist/cli/doctor/orchestrator.d.ts +3 -0
- package/dist/cli/doctor/orchestrator.d.ts.map +1 -0
- package/dist/cli/doctor/orchestrator.js +37 -0
- package/dist/cli/doctor/orchestrator.js.map +1 -0
- package/dist/cli/doctor/types.d.ts +19 -0
- package/dist/cli/doctor/types.d.ts.map +1 -0
- package/dist/cli/doctor/types.js +4 -0
- package/dist/cli/doctor/types.js.map +1 -0
- package/dist/cli/index.js +72 -20
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/interface-contract/commands/analyze.d.ts +3 -0
- package/dist/cli/interface-contract/commands/analyze.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/analyze.js +138 -0
- package/dist/cli/interface-contract/commands/analyze.js.map +1 -0
- package/dist/cli/interface-contract/commands/benchmark.d.ts +3 -0
- package/dist/cli/interface-contract/commands/benchmark.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/benchmark.js +107 -0
- package/dist/cli/interface-contract/commands/benchmark.js.map +1 -0
- package/dist/cli/interface-contract/commands/deps.d.ts +3 -0
- package/dist/cli/interface-contract/commands/deps.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/deps.js +129 -0
- package/dist/cli/interface-contract/commands/deps.js.map +1 -0
- package/dist/cli/interface-contract/commands/doctor.d.ts +3 -0
- package/dist/cli/interface-contract/commands/doctor.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/doctor.js +59 -0
- package/dist/cli/interface-contract/commands/doctor.js.map +1 -0
- package/dist/cli/interface-contract/commands/index.d.ts +9 -0
- package/dist/cli/interface-contract/commands/index.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/index.js +18 -0
- package/dist/cli/interface-contract/commands/index.js.map +1 -0
- package/dist/cli/interface-contract/commands/init.d.ts +3 -0
- package/dist/cli/interface-contract/commands/init.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/init.js +87 -0
- package/dist/cli/interface-contract/commands/init.js.map +1 -0
- package/dist/cli/interface-contract/commands/query.d.ts +3 -0
- package/dist/cli/interface-contract/commands/query.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/query.js +185 -0
- package/dist/cli/interface-contract/commands/query.js.map +1 -0
- package/dist/cli/interface-contract/index.d.ts +22 -0
- package/dist/cli/interface-contract/index.d.ts.map +1 -0
- package/dist/cli/interface-contract/index.js +41 -0
- package/dist/cli/interface-contract/index.js.map +1 -0
- package/dist/cli/interface-contract/schema.d.ts +30 -0
- package/dist/cli/interface-contract/schema.d.ts.map +1 -0
- package/dist/cli/interface-contract/schema.js +72 -0
- package/dist/cli/interface-contract/schema.js.map +1 -0
- package/dist/cli/interface-contract/types.d.ts +76 -0
- package/dist/cli/interface-contract/types.d.ts.map +1 -0
- package/dist/cli/interface-contract/types.js +4 -0
- package/dist/cli/interface-contract/types.js.map +1 -0
- package/dist/cli/output/apply-suggestion.d.ts +12 -0
- package/dist/cli/output/apply-suggestion.d.ts.map +1 -0
- package/dist/cli/output/apply-suggestion.js +29 -0
- package/dist/cli/output/apply-suggestion.js.map +1 -0
- package/dist/cli/output/error-codes.d.ts +22 -0
- package/dist/cli/output/error-codes.d.ts.map +1 -0
- package/dist/cli/output/error-codes.js +82 -0
- package/dist/cli/output/error-codes.js.map +1 -0
- package/dist/cli/output/errors.d.ts +14 -0
- package/dist/cli/output/errors.d.ts.map +1 -0
- package/dist/cli/output/errors.js +170 -0
- package/dist/cli/output/errors.js.map +1 -0
- package/dist/cli/output/index.d.ts +13 -0
- package/dist/cli/output/index.d.ts.map +1 -0
- package/dist/cli/output/index.js +11 -0
- package/dist/cli/output/index.js.map +1 -0
- package/dist/cli/output/mode.d.ts +12 -0
- package/dist/cli/output/mode.d.ts.map +1 -0
- package/dist/cli/output/mode.js +23 -0
- package/dist/cli/output/mode.js.map +1 -0
- package/dist/cli/output/progress.d.ts +9 -0
- package/dist/cli/output/progress.d.ts.map +1 -0
- package/dist/cli/output/progress.js +65 -0
- package/dist/cli/output/progress.js.map +1 -0
- package/dist/cli/output/render.d.ts +11 -0
- package/dist/cli/output/render.d.ts.map +1 -0
- package/dist/cli/output/render.js +18 -0
- package/dist/cli/output/render.js.map +1 -0
- package/dist/cli/output/types.d.ts +53 -0
- package/dist/cli/output/types.d.ts.map +1 -0
- package/dist/cli/output/types.js +14 -0
- package/dist/cli/output/types.js.map +1 -0
- package/dist/cli/output/wasm-fallback.d.ts +13 -0
- package/dist/cli/output/wasm-fallback.d.ts.map +1 -0
- package/dist/cli/output/wasm-fallback.js +92 -0
- package/dist/cli/output/wasm-fallback.js.map +1 -0
- package/dist/cli/tree-sitter-check.d.ts +6 -1
- package/dist/cli/tree-sitter-check.d.ts.map +1 -1
- package/dist/cli/tree-sitter-check.js +23 -1
- package/dist/cli/tree-sitter-check.js.map +1 -1
- package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/SQLiteStorage.js +2 -2
- package/dist/infrastructure/storage/adapters/SQLiteStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts +23 -0
- package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts.map +1 -0
- package/dist/infrastructure/storage/adapters/sqlite-loader.js +210 -0
- package/dist/infrastructure/storage/adapters/sqlite-loader.js.map +1 -0
- package/dist/orchestrator/types.d.ts +2 -0
- package/dist/orchestrator/types.d.ts.map +1 -1
- package/dist/orchestrator/types.js.map +1 -1
- package/dist/parser/implementations/tree-sitter-loader.d.ts +16 -0
- package/dist/parser/implementations/tree-sitter-loader.d.ts.map +1 -0
- package/dist/parser/implementations/tree-sitter-loader.js +105 -0
- package/dist/parser/implementations/tree-sitter-loader.js.map +1 -0
- package/dist/parser/implementations/tree-sitter-parser.d.ts +3 -0
- package/dist/parser/implementations/tree-sitter-parser.d.ts.map +1 -1
- package/dist/parser/implementations/tree-sitter-parser.js +8 -3
- package/dist/parser/implementations/tree-sitter-parser.js.map +1 -1
- package/dist/server/mcp/schema-adapter.d.ts +45 -0
- package/dist/server/mcp/schema-adapter.d.ts.map +1 -0
- package/dist/server/mcp/schema-adapter.js +290 -0
- package/dist/server/mcp/schema-adapter.js.map +1 -0
- package/dist/server/mcp/server.d.ts.map +1 -1
- package/dist/server/mcp/server.js +32 -2
- package/dist/server/mcp/server.js.map +1 -1
- package/docs/AI_ASSISTANT_SETUP.md +169 -12
- package/docs/README.md +40 -1
- package/docs/SETUP_GUIDE.md +11 -14
- package/docs/ai-guide/COMMANDS.md +68 -10
- package/docs/ai-guide/INTEGRATION.md +77 -10
- package/docs/ai-guide/OUTPUT.md +295 -2
- package/docs/ai-guide/PROMPTS.md +2 -2
- package/docs/ai-guide/QUICKSTART.md +28 -1
- package/docs/ai-guide/README.md +2 -2
- package/docs/archive/ideation/2026-04-15-executable-architecture-constitution-ideation-archive.md +70 -0
- package/docs/archive/ideation/2026-04-20-mycodemap-init-enhancements-ideation-archive.md +109 -0
- package/docs/archive/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation-archive.md +54 -0
- package/docs/ideation/2026-04-15-executable-architecture-constitution-ideation.md +10 -22
- package/docs/ideation/2026-04-20-mycodemap-init-enhancements-ideation.md +15 -60
- package/docs/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation.md +47 -52
- package/docs/ideation/2026-04-29-ux-install-agent-experience-ideation.md +256 -0
- package/docs/plans/2026-04-30-install-guide-and-repo-analyzer-design.md +394 -0
- package/docs/rules/README.md +1 -0
- package/docs/rules/architecture-guardrails.md +2 -1
- package/docs/rules/engineering-with-codex-openai.md +1 -1
- package/docs/rules/harness.md +106 -0
- package/docs/rules/pre-release-checklist.md +28 -0
- package/docs/rules/testing.md +51 -0
- package/examples/claude/skills/mycodemap-repo-analyzer/SKILL.md +294 -0
- package/examples/claude/skills/mycodemap-repo-analyzer/references/analysis-guide.md +166 -0
- package/examples/claude/skills/mycodemap-repo-analyzer/references/module-analysis-guide.md +150 -0
- package/package.json +7 -4
- package/scripts/sync-analyze-docs.js +2 -2
- package/scripts/validate-docs.js +113 -16
- package/docs/references/tmp.md +0 -527
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Ideation: CodeMap User Experience, Installation/Configuration, and Human vs AI Agent Experience
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-04-29
|
|
4
|
+
**Focus:** User experience, installation and configuration experience, human vs AI agent experience
|
|
5
|
+
**Run ID:** 9e3b69d4496d7cc8
|
|
6
|
+
**Agents dispatched:** 9 (codebase scan + learnings + web research + 6 ideation frames)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Grounding Summary
|
|
11
|
+
|
|
12
|
+
### Codebase Context
|
|
13
|
+
CodeMap is a TypeScript/Node.js ESM CLI tool generating structured code maps (`AI_MAP.md`, `codemap.json`) for AI/Agent consumption. Uses `commander`, `tree-sitter`, `better-sqlite3`, `hono`. Layered architecture with `src/cli-new/` coexisting alongside `src/cli/`, signaling migration in progress. Heavy AI-agent governance docs (`AGENTS.md`, `CLAUDE.md`, `.claude/`, `.kimi/`, `.agents/`).
|
|
14
|
+
|
|
15
|
+
### Key Pain Points
|
|
16
|
+
- **Native dependency install friction** (`better-sqlite3`, `tree-sitter` often fail without build tools) — #1 drop-off point
|
|
17
|
+
- **Broken promises in `package.json`** (`check:architecture`, `check:unused` are no-ops)
|
|
18
|
+
- **Dual CLI confusion** (`cli/` + `cli-new/`)
|
|
19
|
+
- **MCP underpowered** (only 2 tools: `codemap_query`, `codemap_impact`)
|
|
20
|
+
- **Agent interface inconsistency** (`--json` not uniform, silent failures, low confidence on explicit paths)
|
|
21
|
+
- **Onboarding overload** — manual skill copying from `examples/`
|
|
22
|
+
- **Agent dogfood rated 6/10** agent-friendly (2026-04-17)
|
|
23
|
+
|
|
24
|
+
### Past Learnings
|
|
25
|
+
- `init` redesigned as "project state reconciler" with `.mycodemap/` workspace (v1.7 shipped)
|
|
26
|
+
- v0.5.1 install bug: `devDependencies` used at runtime caused global install crashes
|
|
27
|
+
- CLI surface cleanup (v1.0): removed commands with explicit failure + migration messages
|
|
28
|
+
- Three-layer readiness gate (`hard`/`warn-only`/`fallback`) from v1.11
|
|
29
|
+
|
|
30
|
+
### External Context
|
|
31
|
+
- CLI is beating MCP for coding agents in 2025-2026 due to token efficiency
|
|
32
|
+
- Agent-native patterns: JSON-first, structured errors, predictable exit codes, field filtering, `--help-json`, progress on stderr
|
|
33
|
+
- Prior art: `hubspot-cli` (dual entry point), `gdelt-cli` (machine-readable help), `discord-cli` (YAML structured output)
|
|
34
|
+
- Snyk praised for smoothest onboarding (`snyk test` = seconds)
|
|
35
|
+
- Research pain points: false positives up to 60%, lack of meaningful messages, configuration effort
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Raw Candidate Pool
|
|
40
|
+
|
|
41
|
+
52 candidates generated across 6 ideation frames + 4 cross-cutting combinations. Full list preserved in checkpoint:
|
|
42
|
+
`/tmp/compound-engineering/ce-ideate/9e3b69d4496d7cc8/raw-candidates.md`
|
|
43
|
+
|
|
44
|
+
### Frame Summary
|
|
45
|
+
| Frame | Count | Key Themes |
|
|
46
|
+
|-------|-------|------------|
|
|
47
|
+
| Pain and friction | 8 | Graceful degradation, presumptive onboarding, unified CLI, agent handshake, streaming MCP, confidence metadata, pre-install check, doctor |
|
|
48
|
+
| Inversion/removal/automation | 8 | Zero-command install, config-as-cache, honest CLI, intent router, JSON-RPC daemon, auto-provisioned skills, failure-to-action, CLI-as-MCP gateway |
|
|
49
|
+
| Assumption-breaking | 8 | Zero-install runtime, split human/agent interface, self-healing init, SDK mode, confidence-first output, progressive disclosure, git-native maps, declarative contract |
|
|
50
|
+
| Leverage/compounding | 8 | WASM-first build, auto-reconciling state, interface contract architecture, zero-config preview, structured errors, skill ecosystem, agent-native mode, uncertainty budget |
|
|
51
|
+
| Cross-domain analogy | 8 | Auto-mode installer, RPG onboarding, Netflix recommendations, language server daemon, tasting menu presets, accessibility profiles, pairing mode, confidence routing |
|
|
52
|
+
| Constraint-flipping | 8 | 100ms install, self-teaching CLI, AI-first default, fingerprint config, unconfigurable tool, MCP-primary, concierge daemon, self-healing promise |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Explicit Rejections (Why These Did Not Survive)
|
|
57
|
+
|
|
58
|
+
### Rejected: Incremental / Already In Progress
|
|
59
|
+
- **Unified CLI Surface with Subcommand Shadows** — Addresses real pain but is essentially "finish the cli-new migration," already in progress. Not an ideation breakthrough.
|
|
60
|
+
- **Presumptive Onboarding / Config Proposed Not Asked** — Overlaps with existing v1.7 init reconciler design; less precise than Zero-Config Preview.
|
|
61
|
+
- **Streaming MCP with Progress Tokens** — Good but naturally follows from CLI-as-MCP Gateway; not a standalone priority.
|
|
62
|
+
|
|
63
|
+
### Rejected: Over-Engineered / Heavy Solutions to Simple Problems
|
|
64
|
+
- **Agent Handshake Protocol** — Over-engineered for the actual problem: inconsistent `--json` and silent failures. A formal pre-command negotiation adds complexity; explicit flags/env vars are simpler.
|
|
65
|
+
- **Smart Home "Pairing Mode" Auto-Negotiation** — Auto-detecting agent vs human is fragile (env vars, parent process names). Explicit `--agent` or `CODEMAP_MACHINE=1` is more reliable.
|
|
66
|
+
- **Intent-Based Unified Router / Natural Language** — "Map my backend API surface" is cool but adds NLP complexity for marginal gain over good subcommand naming.
|
|
67
|
+
|
|
68
|
+
### Rejected: Too Speculative / Missing Prerequisites
|
|
69
|
+
- **100ms Install Mandate: Pure-JS Mode** — More extreme than WASM-first. Node 22+ `node:sqlite` is not universally available. Pure-JS tree-sitter grammar pack doesn't exist yet.
|
|
70
|
+
- **The Embedded CodeMap / SDK Mode** — Powerful but scope explosion. If WASM-first happens, SDK mode becomes natural. Doing both simultaneously is too much.
|
|
71
|
+
- **10x Budget: Agent Concierge Mode / Daemon + IDE Extension** — Visionary but the project already deferred viz/TUI/API (MVP3 PRD). A daemon is an architectural commitment for a future milestone.
|
|
72
|
+
- **No Users, Only Agents: MCP as Primary Interface** — Inverts reality: the CLI exists and works. Making MCP primary would discard human UX investment.
|
|
73
|
+
|
|
74
|
+
### Rejected: Provocative but Not Actionable
|
|
75
|
+
- **Team of One: The Unconfigurable Tool** — Radical convention-over-configuration that would alienate power users and non-standard projects.
|
|
76
|
+
- **Self-Correcting CLI Surface / Honest CLI** — "CLI audits itself on startup" is harder to implement and explain than a `doctor` command. Overlaps with #7 survivor.
|
|
77
|
+
- **The Declarative Project Contract / codemap.yaml** — Overlaps with existing `.mycodemap/config.json` approach. YAML doesn't add enough value to justify migration.
|
|
78
|
+
|
|
79
|
+
### Rejected: Framing Devices, Not Technical Directions
|
|
80
|
+
- **Video Game Accessibility Profiles** — Good analogy but essentially combines "split interface" + "AI-first default" into a framing device.
|
|
81
|
+
- **RPG "First Quest" Tutorial Onboarding** — UX polish framing of Zero-Config Preview. The tutorial aspect is surface, not architecture.
|
|
82
|
+
- **Fine Dining "Tasting Menu" Presets** — Same as accessibility profiles; a UX framing of modes that already exist in other forms.
|
|
83
|
+
- **Airport Customs "Green Lane / Red Lane"** — Clever analogy but confidence routing is already captured by Confidence-First Output.
|
|
84
|
+
|
|
85
|
+
### Rejected: Overlap with Stronger Survivors
|
|
86
|
+
- **Pre-Install Environment Contract Check** — Narrower than WASM-first; solves same problem less completely.
|
|
87
|
+
- **The Self-Healing Init** — Covered by existing init reconciler + doctor command.
|
|
88
|
+
- **Auto-Reconciling Project State** — Extension of existing v1.7 init reconciler; incremental, not breakthrough.
|
|
89
|
+
- **Netflix "Because You Watched" Config Recommendations** — Incremental enhancement to init; not a distinct direction.
|
|
90
|
+
- **Structured Error Recovery Protocol** — Overlaps heavily with Failure-to-Action Protocol.
|
|
91
|
+
- **Configuration as a Cache, Not a Contract** — Interesting reframing but risks making configuration opaque and hard to debug.
|
|
92
|
+
- **Agent-Native Streaming Protocol / JSON-RPC Daemon** — High complexity; daemon mode deferred per project scope.
|
|
93
|
+
- **No Docs Allowed: The Self-Teaching CLI** — Framing device; interactive help is a feature, not a strategic direction.
|
|
94
|
+
- **1M Users, Zero Support: Auto-Configured by Fingerprint** — Overlaps with Zero-Config Preview + existing init reconciler.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Top Survivors (Ranked)
|
|
99
|
+
|
|
100
|
+
### 1. Machine-Readable Interface Contract as Core Architecture
|
|
101
|
+
**Source:** Leverage frame
|
|
102
|
+
**Idea:** Define the entire CLI surface as a formal schema (commands, args, flags, output shapes, error codes) in a single source-of-truth file. Generate the human CLI parser, the MCP server, `--help-json`, shell completions, and documentation from this schema. Never hand-write argument parsing or output formatting again.
|
|
103
|
+
|
|
104
|
+
**Why it survived:**
|
|
105
|
+
- **Highest leverage:** Every new command automatically gets full agent support, MCP exposure, and perfect consistency.
|
|
106
|
+
- **Addresses root cause:** `--json` inconsistency, MCP underpoweredness, and agent-friendly 6/10 rating all stem from hand-maintained dual surfaces.
|
|
107
|
+
- **Compounding:** As the CLI grows, the benefit multiplies. Adding one schema entry creates CLI flag, MCP tool, help text, and completion in one shot.
|
|
108
|
+
- **Grounded:** Agent-native patterns from external research explicitly demand JSON-first, structured errors, and `--help-json`. This makes them free.
|
|
109
|
+
|
|
110
|
+
**Risks:** Upfront schema design effort; migration of existing commands. Mitigation: incremental adoption, one command at a time.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 2. WASM-First Build, Native-Opt-In Runtime
|
|
115
|
+
**Source:** Leverage frame / Constraint-flip frame
|
|
116
|
+
**Idea:** Ship `tree-sitter` and `better-sqlite3` as WASM modules by default; detect and opportunistically upgrade to native binaries only when the environment supports it and the user opts in. `npm install codemap` works on every platform, every CI image, every fresh laptop with zero build tools.
|
|
117
|
+
|
|
118
|
+
**Why it survived:**
|
|
119
|
+
- **#1 pain point killer:** Native dependency install friction is the top drop-off point. This eliminates it entirely.
|
|
120
|
+
- **Proven pattern:** esbuild's WASM fallback mode works in the same ecosystem. `web-tree-sitter` exists. Node 22 ships `node:sqlite` built-in.
|
|
121
|
+
- **Platform coverage:** Reaches 100% of users instead of 70% who have build tools installed.
|
|
122
|
+
- **Agent value:** Eliminates environment-dependent failures that break automated workflows.
|
|
123
|
+
|
|
124
|
+
**Risks:** Performance regression for very large repos. Mitigation: native opt-in for performance-sensitive users; benchmark WASM vs native.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### 3. CLI-as-MCP Automatic Gateway
|
|
129
|
+
**Source:** Inversion frame
|
|
130
|
+
**Idea:** Implement a generic `--mcp-stdio` adapter that dynamically exposes every CodeMap CLI subcommand as an MCP tool with auto-generated JSON schemas derived from TypeScript types (or the Interface Contract schema). Adding a new CLI command instantly creates a new MCP tool with zero extra work. The entire CLI surface becomes the MCP surface.
|
|
131
|
+
|
|
132
|
+
**Why it survived:**
|
|
133
|
+
- **Closes the integration gap:** MCP is currently underpowered (2 tools) while CLI has 20+ commands. Agents route around MCP to CLI because of this.
|
|
134
|
+
- **Eliminates drift:** No more hand-maintained MCP server that lags behind CLI features.
|
|
135
|
+
- **Depends on #1:** Best paired with Interface Contract architecture, but can start with TypeScript type reflection.
|
|
136
|
+
- **High agent impact:** Transforms MCP from a second-class citizen into a first-class, complete interface.
|
|
137
|
+
|
|
138
|
+
**Risks:** MCP schema generation must handle complex nested types. Mitigation: start with simple commands, iterate.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### 4. AI-First Default, Human-Pretty Optional
|
|
143
|
+
**Source:** Constraint-flip frame / Assumption-breaking frame
|
|
144
|
+
**Idea:** Flip the output paradigm. All commands emit structured JSON/NDJSON on stdout by default. A `--human` flag (or auto-detected TTY) pipes through a built-in renderer for tables, spinners, and color. Progress goes to stderr as structured events. This makes the CLI natively composable for agents without special flags.
|
|
145
|
+
|
|
146
|
+
**Why it survived:**
|
|
147
|
+
- **Directly fixes agent inconsistency:** The current `--json` bolt-on is inconsistent across commands. Making structured output the default forces consistency.
|
|
148
|
+
- **External evidence:** Research confirms CLI beats MCP for token efficiency when structured. This maximizes that advantage.
|
|
149
|
+
- **Low implementation risk:** TTY detection is standard; renderers can be built incrementally.
|
|
150
|
+
- **Composable:** `codemap analyze | jq '.findings[] | select(.severity=="high")'` works out of the box.
|
|
151
|
+
|
|
152
|
+
**Risks:** Breaking change for existing human users who expect pretty output. Mitigation: major version bump; TTY auto-detection preserves current behavior for interactive use.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### 5. Zero-Config Preview / Progressive Commitment Model
|
|
157
|
+
**Source:** Leverage frame / Cross-domain analogy
|
|
158
|
+
**Idea:** `npx codemap` with no config, no init, no flags performs a full analysis and emits a rich preview (top-level summary, detected project type, sample map). It then offers: "Looks good? Run `codemap --persist` to save configuration and generate full artifacts." No setup, no decisions, no config files until the user sees value.
|
|
159
|
+
|
|
160
|
+
**Why it survived:**
|
|
161
|
+
- **Snyk-inspired:** Snyk is praised for smoothest onboarding because `snyk test` demonstrates value in seconds.
|
|
162
|
+
- **Low implementation cost:** Can be built on top of existing init reconciler and analysis pipeline.
|
|
163
|
+
- **High conversion impact:** Removes the fear of side effects from trying the tool.
|
|
164
|
+
- **Dual audience:** Humans see a preview and decide; agents can run `--persist` non-interactively.
|
|
165
|
+
|
|
166
|
+
**Risks:** Preview must be fast (<5 seconds) or it backfires. Mitigation: default to shallow/symbolic scan for preview; deep analysis on demand.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### 6. Failure-to-Action Protocol
|
|
171
|
+
**Source:** Inversion frame / Leverage frame
|
|
172
|
+
**Idea:** Every error returns a structured document containing: what was attempted, the root cause, a machine-readable remediation plan, and a confidence score. For native dep failures: auto-suggest `--wasm-fallback` or a prebuilt binary URL. For agents, errors include the exact next command to try. Errors become state transitions, not dead ends.
|
|
173
|
+
|
|
174
|
+
**Why it survived:**
|
|
175
|
+
- **Addresses silent failures:** The dogfood report explicitly found `analyze -i find` failing silently with near-empty JSON. This makes every failure explicit and actionable.
|
|
176
|
+
- **Research-backed:** Studies cite "lack of meaningful messages" as a top pain point for code analysis tools.
|
|
177
|
+
- **Agent self-healing:** Agents can attempt remediation without human intervention.
|
|
178
|
+
- **Incremental:** Can be adopted command by command; doesn't require a big-bang rewrite.
|
|
179
|
+
|
|
180
|
+
**Risks:** Remediation suggestions can be wrong, creating cascading failures. Mitigation: confidence scoring on suggestions; never auto-execute without `--apply-suggestion`.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### 7. codemap doctor as Continuous Health Monitor
|
|
185
|
+
**Source:** Pain frame / Constraint-flip frame
|
|
186
|
+
**Idea:** A living diagnostics command that audits the entire CodeMap ecosystem: detects no-op scripts in `package.json` (`check:architecture`, `check:unused`), verifies native dep health, checks `.mycodemap/` workspace drift, validates CLI vs MCP version skew, and runs agent interface regression checks. Emits both human-readable reports and machine-readable diagnostics. Can run in CI as a health gate.
|
|
187
|
+
|
|
188
|
+
**Why it survived:**
|
|
189
|
+
- **Familiar pattern:** `npm doctor`, `brew doctor`, `flutter doctor` — users know what to expect.
|
|
190
|
+
- **Addresses broken promises directly:** Surfaces the no-op scripts and other latent brokenness that erodes trust.
|
|
191
|
+
- **CI-friendly:** Machine-readable output enables automated health checks in CI pipelines.
|
|
192
|
+
- **Incremental:** Each diagnostic is a small addition; the command grows over time.
|
|
193
|
+
|
|
194
|
+
**Risks:** Can become a dumping ground for random checks. Mitigation: categorize diagnostics (install, config, runtime, agent); require evidence tags for each check.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### 8. Auto-Provisioned Agent Skills / Self-Distributing Integration
|
|
199
|
+
**Source:** Inversion frame
|
|
200
|
+
**Idea:** When CodeMap detects it is being invoked by an AI agent (via `KIMI_`, `CLAUDE_`, or `CODEX_` env vars), it automatically writes or updates the appropriate skill files into the agent's skill directory (`.claude/skills/codemap/`, `.kimi/skills/codemap/`). The tool maintains its own bindings, ensuring agents always use the latest integration layer.
|
|
201
|
+
|
|
202
|
+
**Why it survived:**
|
|
203
|
+
- **Directly solves onboarding overload:** "Manual skill copying from `examples/`" is explicitly cited as a pain point.
|
|
204
|
+
- **Self-describing:** CodeMap knows its own CLI schema better than any human; it should generate its own agent integration.
|
|
205
|
+
- **Version safety:** Skills stay in sync with the installed CodeMap version.
|
|
206
|
+
- **Low cost if paired with #1 and #3:** If we have an interface contract and auto-generated MCP, skill generation is a thin layer on top.
|
|
207
|
+
|
|
208
|
+
**Risks:** Overwriting user-customized skill files. Mitigation: write to `.mycodemap/skills/` and symlink/copy to agent dirs; never modify existing files without `--force`.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Cross-Cutting Synthesis
|
|
213
|
+
|
|
214
|
+
Three meta-patterns emerge from the survivors:
|
|
215
|
+
|
|
216
|
+
### A. Self-Describing Universal API (#1 + #3 + #8)
|
|
217
|
+
If the CLI surface is defined as a machine-readable contract, then:
|
|
218
|
+
- The MCP server generates automatically (#3)
|
|
219
|
+
- Agent skills generate automatically (#8)
|
|
220
|
+
- `--help-json`, shell completions, and docs generate automatically (#1)
|
|
221
|
+
- Every new CLI command is instantly agent-ready
|
|
222
|
+
|
|
223
|
+
This is the **highest-compounding architectural bet** in the entire ideation set.
|
|
224
|
+
|
|
225
|
+
### B. Zero-Friction Installation & Onboarding (#2 + #5)
|
|
226
|
+
WASM-first eliminates install failures (#2). Zero-config preview eliminates configuration anxiety (#5). Together they create a "Snyk-class" onboarding where a new user goes from "heard about it" to "seeing value" in under 10 seconds with zero prerequisites.
|
|
227
|
+
|
|
228
|
+
### C. Trust Architecture (#6 + #7 + confidence implications of #1)
|
|
229
|
+
Failure-to-action protocol makes errors recoverable (#6). Doctor command continuously audits health (#7). Interface contract ensures output schemas are predictable (#1). Together they address the agent-friendly 6/10 rating by making the tool transparent, honest, and self-healing.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Ideas by Dimension
|
|
234
|
+
|
|
235
|
+
| Dimension | Top Idea |
|
|
236
|
+
|-----------|----------|
|
|
237
|
+
| **Workflow / DX** | Zero-Config Preview (#5) — demonstrates value before asking commitment |
|
|
238
|
+
| **Reliability** | WASM-First Build (#2) — eliminates #1 source of install failures |
|
|
239
|
+
| **Extensibility** | Interface Contract Architecture (#1) — every new feature is agent-ready by construction |
|
|
240
|
+
| **Missing capabilities** | CLI-as-MCP Gateway (#3) — closes the 2-tool gap |
|
|
241
|
+
| **Docs / Knowledge compounding** | Auto-Provisioned Skills (#8) — self-generating agent integration |
|
|
242
|
+
| **Quality / Maintenance** | codemap doctor (#7) — continuous health monitoring |
|
|
243
|
+
| **Agent experience** | AI-First Default (#4) — JSON-first, consistent, composable |
|
|
244
|
+
| **Error handling** | Failure-to-Action Protocol (#6) — structured, recoverable errors |
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Next Steps Menu
|
|
249
|
+
|
|
250
|
+
This ideation artifact identifies promising directions. The next step depends on what you want to do with these ideas:
|
|
251
|
+
|
|
252
|
+
1. **Refine** — Deep-dive into one or more survivors, exploring edge cases, implementation approaches, and interdependencies.
|
|
253
|
+
2. **Brainstorm** — Select one survivor and define it precisely enough for planning (requirements, boundaries, acceptance criteria). This hands off to `ce:brainstorm`.
|
|
254
|
+
3. **Save and end** — Archive this ideation and return to it later when priorities shift.
|
|
255
|
+
|
|
256
|
+
> **Routing note:** `ce:ideate` answers "What are the strongest ideas worth exploring?" `ce:brainstorm` answers "What exactly should one chosen idea mean?" `ce:plan` answers "How should it be built?" Do not skip to planning from ideation output.
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
# 安装引导增强 + mycodemap-repo-analyzer 技能 实施计划
|
|
2
|
+
|
|
3
|
+
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
|
|
4
|
+
|
|
5
|
+
**Goal:** 增强 mycodemap 的 AI CLI 安装引导体验,并新增基于 repo-analyzer 的深度架构分析技能
|
|
6
|
+
|
|
7
|
+
**Architecture:** 需求1 在现有 `docs/AI_ASSISTANT_SETUP.md` 中增加 "AI CLI 一键安装引导" 章节;需求2 在 `examples/claude/skills/mycodemap-repo-analyzer/` 下创建衍生 skill,基于 repo-analyzer 的 8 阶段流程,替换执行层面操作为 mycodemap CLI
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Markdown, mycodemap CLI, Claude Code skill format
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 前置说明
|
|
14
|
+
|
|
15
|
+
### 关键发现
|
|
16
|
+
|
|
17
|
+
1. **`docs/AI_ASSISTANT_SETUP.md` 已存在** — 当前是面向人类的分平台配置指南(Kimi/Claude/Codex/Copilot),需要在其基础上增加"AI CLI 一键安装引导"章节,而非创建新文件
|
|
18
|
+
2. **现有 skill 文件** — `examples/claude/codemap-skill.md` 和 `examples/codex/codemap-agent.md` 是基础 skill 模板;`.claude/skills/codemap/SKILL.md` 是当前项目实际使用的完整 skill
|
|
19
|
+
3. **README.md 已有 AI 文档索引** — 第 99-117 行有 "AI / Agent 专属文档" 章节,需在此增加新 skill 的链接
|
|
20
|
+
|
|
21
|
+
### 文件路径约定
|
|
22
|
+
|
|
23
|
+
| 文件 | 说明 |
|
|
24
|
+
|------|------|
|
|
25
|
+
| `docs/AI_ASSISTANT_SETUP.md` | 现有 AI 助手配置指南,需追加"一键安装引导"章节 |
|
|
26
|
+
| `examples/claude/skills/mycodemap-repo-analyzer/SKILL.md` | 新增:衍生 skill 主文件 |
|
|
27
|
+
| `examples/claude/skills/mycodemap-repo-analyzer/references/analysis-guide.md` | 新增:分析哲学(从 repo-analyzer 保留) |
|
|
28
|
+
| `examples/claude/skills/mycodemap-repo-analyzer/references/module-analysis-guide.md` | 新增:模块分析指南(从 repo-analyzer 保留) |
|
|
29
|
+
| `README.md` | 修改:AI 文档索引章节增加链接 |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### Task 1: 创建 mycodemap-repo-analyzer skill 目录结构
|
|
34
|
+
|
|
35
|
+
**Files:**
|
|
36
|
+
- Create: `examples/claude/skills/mycodemap-repo-analyzer/SKILL.md`
|
|
37
|
+
- Create: `examples/claude/skills/mycodemap-repo-analyzer/references/analysis-guide.md`
|
|
38
|
+
- Create: `examples/claude/skills/mycodemap-repo-analyzer/references/module-analysis-guide.md`
|
|
39
|
+
|
|
40
|
+
**Step 1: 创建目录**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
mkdir -p examples/claude/skills/mycodemap-repo-analyzer/references
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Step 2: 拷贝 references 文件**
|
|
47
|
+
|
|
48
|
+
从 repo-analyzer 原版保留 analysis-guide.md 和 module-analysis-guide.md,不做修改。
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# 从 GitHub 获取原版文件内容,写入本地
|
|
52
|
+
gh api repos/yzddmr6/repo-analyzer/contents/skills/repo-analyzer/references/analysis-guide.md -q '.content' | base64 -d > examples/claude/skills/mycodemap-repo-analyzer/references/analysis-guide.md
|
|
53
|
+
|
|
54
|
+
gh api repos/yzddmr6/repo-analyzer/contents/skills/repo-analyzer/references/module-analysis-guide.md -q '.content' | base64 -d > examples/claude/skills/mycodemap-repo-analyzer/references/module-analysis-guide.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Step 3: 验证文件**
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
ls -la examples/claude/skills/mycodemap-repo-analyzer/references/
|
|
61
|
+
wc -l examples/claude/skills/mycodemap-repo-analyzer/references/*.md
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Expected: 两个文件均存在,各 100-300 行
|
|
65
|
+
|
|
66
|
+
**Step 4: Commit**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git add examples/claude/skills/mycodemap-repo-analyzer/references/
|
|
70
|
+
git commit -m "feat: add repo-analyzer reference docs (unmodified from upstream)"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### Task 2: 编写 mycodemap-repo-analyzer SKILL.md
|
|
76
|
+
|
|
77
|
+
**Files:**
|
|
78
|
+
- Create: `examples/claude/skills/mycodemap-repo-analyzer/SKILL.md`
|
|
79
|
+
|
|
80
|
+
**Step 1: 编写 SKILL.md**
|
|
81
|
+
|
|
82
|
+
基于 repo-analyzer 原版 SKILL.md,关键改动点:
|
|
83
|
+
|
|
84
|
+
1. **frontmatter**:`name: mycodemap-repo-analyzer`,触发词加 `mycodemap` 前缀
|
|
85
|
+
2. **阶段1**:git clone 后增加 `mycodemap generate` 生成 AI_MAP.md 作为分析基础
|
|
86
|
+
3. **阶段2**:从 AI_MAP.md 读取模块统计替代手动 `find + wc`
|
|
87
|
+
4. **阶段4**:增加 `mycodemap query/deps/cycles/complexity` 快速获取架构特征
|
|
88
|
+
5. **阶段6**:subagent prompt 增加 mycodemap CLI 使用指令
|
|
89
|
+
6. **阶段7**:增加 `mycodemap impact` 辅助交叉验证
|
|
90
|
+
|
|
91
|
+
文件内容要点:
|
|
92
|
+
|
|
93
|
+
```markdown
|
|
94
|
+
---
|
|
95
|
+
name: mycodemap-repo-analyzer
|
|
96
|
+
description: Use when the user mentions "mycodemap 分析项目"、"mycodemap 架构分析"、"mycodemap 项目分析"、"mycodemap 源码分析"、"mycodemap 学习这个项目"、"mycodemap 研究这个框架"
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
# MyCodeMap 项目深度分析技能
|
|
100
|
+
|
|
101
|
+
[保留 repo-analyzer 的核心原则、When to Use/Not to Use、输出语言]
|
|
102
|
+
|
|
103
|
+
## 核心原则
|
|
104
|
+
[同原版 5 条核心原则,不变]
|
|
105
|
+
|
|
106
|
+
## 分析工作流
|
|
107
|
+
|
|
108
|
+
### 阶段 1: 项目获取与初始化(改动)
|
|
109
|
+
1. 解析输入(同原版)
|
|
110
|
+
2. 创建工作区(同原版)
|
|
111
|
+
3. git clone(同原版)
|
|
112
|
+
4. **[新增]** 在项目目录运行 `mycodemap generate` 生成代码地图
|
|
113
|
+
5. **[新增]** 阅读 `.mycodemap/AI_MAP.md` 获取项目结构概览
|
|
114
|
+
6. 获取基本元数据(同原版)
|
|
115
|
+
|
|
116
|
+
### 阶段 2: 项目规模评估(改动)
|
|
117
|
+
1. **[替换]** 从 `.mycodemap/AI_MAP.md` 读取模块列表和代码统计
|
|
118
|
+
2. **[替换]** 用 `mycodemap complexity` 获取复杂度分布
|
|
119
|
+
3. 向用户报告并选择分析模式(同原版)
|
|
120
|
+
4. 写入 drafts/03-plan.md(同原版)
|
|
121
|
+
|
|
122
|
+
### 阶段 3: 外部调研(不变)
|
|
123
|
+
[同原版]
|
|
124
|
+
|
|
125
|
+
### 阶段 4: 项目特征识别(改动)
|
|
126
|
+
1. 快速扫描(同原版)
|
|
127
|
+
2. **[增强]** 用 mycodemap CLI 加速特征识别:
|
|
128
|
+
- `mycodemap deps` 查看模块依赖拓扑
|
|
129
|
+
- `mycodemap cycles` 检测循环依赖
|
|
130
|
+
- `mycodemap complexity` 了解复杂度热点
|
|
131
|
+
3. 从特征中提炼问题(同原版)
|
|
132
|
+
4. 向用户提问(同原版)
|
|
133
|
+
|
|
134
|
+
### 阶段 5: 动态报告结构设计(不变)
|
|
135
|
+
[同原版]
|
|
136
|
+
|
|
137
|
+
### 阶段 6: 并行深度分析(改动)
|
|
138
|
+
subagent prompt 模板增加:
|
|
139
|
+
- **[新增]** 使用 mycodemap CLI 辅助分析:
|
|
140
|
+
- `mycodemap query -s "<symbol>"` 查询核心符号
|
|
141
|
+
- `mycodemap query -m "<module>"` 获取模块上下文
|
|
142
|
+
- `mycodemap analyze --intent overview -t "<path>"` 获取模块概览
|
|
143
|
+
- **[替换]** 优先用 mycodemap 获取结构化信息,减少逐文件 Read
|
|
144
|
+
|
|
145
|
+
### 阶段 7: 交叉验证(改动)
|
|
146
|
+
1-3. 覆盖率门控/抽查验证(同原版)
|
|
147
|
+
4. **[增强]** 用 `mycodemap impact -f "<file>"` 验证跨模块影响结论
|
|
148
|
+
5. 写入 drafts/07-cross-validation.md(同原版)
|
|
149
|
+
|
|
150
|
+
### 阶段 8: 最终报告(不变)
|
|
151
|
+
[同原版]
|
|
152
|
+
|
|
153
|
+
[其余章节:草稿文件清单、特殊场景、输出要求 — 同原版]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Step 2: 验证文件**
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
wc -l examples/claude/skills/mycodemap-repo-analyzer/SKILL.md
|
|
160
|
+
grep -c "mycodemap" examples/claude/skills/mycodemap-repo-analyzer/SKILL.md
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Expected: 300-500 行,mycodemap 出现 10+ 次
|
|
164
|
+
|
|
165
|
+
**Step 3: Commit**
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
git add examples/claude/skills/mycodemap-repo-analyzer/SKILL.md
|
|
169
|
+
git commit -m "feat: add mycodemap-repo-analyzer skill with CLI integration"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### Task 3: 增强 AI_ASSISTANT_SETUP.md — 增加一键安装引导章节
|
|
175
|
+
|
|
176
|
+
**Files:**
|
|
177
|
+
- Modify: `docs/AI_ASSISTANT_SETUP.md`
|
|
178
|
+
|
|
179
|
+
**Step 1: 在文件末尾("参考"章节之前)增加新章节**
|
|
180
|
+
|
|
181
|
+
章节标题:`AI CLI 一键安装引导`
|
|
182
|
+
|
|
183
|
+
内容结构:
|
|
184
|
+
|
|
185
|
+
```markdown
|
|
186
|
+
## AI CLI 一键安装引导
|
|
187
|
+
|
|
188
|
+
> 本章节面向 AI CLI 工具(Claude Code、Codex CLI 等),提供结构化安装引导。
|
|
189
|
+
> 当用户说"帮我安装 mycodemap"时,AI CLI 应按照以下步骤引导。
|
|
190
|
+
|
|
191
|
+
### Step 1: 前置条件检查 [CONFIRM]
|
|
192
|
+
|
|
193
|
+
在开始安装前,确认以下条件:
|
|
194
|
+
|
|
195
|
+
- Node.js >= 18 是否已安装(`node --version`)
|
|
196
|
+
- 当前项目是否有 package.json(`ls package.json`)
|
|
197
|
+
- 向用户确认:是项目级别安装还是全局安装
|
|
198
|
+
|
|
199
|
+
### Step 2: 安装依赖 [CONFIRM]
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# 项目级别安装(推荐)
|
|
203
|
+
npm install @mycodemap/mycodemap
|
|
204
|
+
|
|
205
|
+
# 或全局安装
|
|
206
|
+
npm install -g @mycodemap/mycodemap
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Step 3: 初始化 [CONFIRM]
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# 先预览配置(不写入文件)
|
|
213
|
+
mycodemap init
|
|
214
|
+
|
|
215
|
+
# 确认后写入
|
|
216
|
+
mycodemap init -y
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Step 4: 生成代码地图
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
mycodemap generate
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
安装完成后会生成:
|
|
226
|
+
- `.mycodemap/AI_MAP.md` — 项目全局概览
|
|
227
|
+
- `.mycodemap/codemap.json` — 结构化数据
|
|
228
|
+
- `.mycodemap/CONTEXT.md` — 上下文入口
|
|
229
|
+
|
|
230
|
+
### Step 5: 配置 AI 助手 skill [CONFIRM]
|
|
231
|
+
|
|
232
|
+
根据使用的 AI 助手,拷贝对应的 skill 文件:
|
|
233
|
+
|
|
234
|
+
**Claude Code:**
|
|
235
|
+
```bash
|
|
236
|
+
mkdir -p .claude/skills/codemap
|
|
237
|
+
cp node_modules/@mycodemap/mycodemap/examples/claude/codemap-skill.md .claude/skills/codemap/SKILL.md
|
|
238
|
+
|
|
239
|
+
# 可选:安装架构分析技能
|
|
240
|
+
mkdir -p .claude/skills/mycodemap-repo-analyzer
|
|
241
|
+
cp node_modules/@mycodemap/mycodemap/examples/claude/skills/mycodemap-repo-analyzer/SKILL.md .claude/skills/mycodemap-repo-analyzer/SKILL.md
|
|
242
|
+
cp -r node_modules/@mycodemap/mycodemap/examples/claude/skills/mycodemap-repo-analyzer/references .claude/skills/mycodemap-repo-analyzer/
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Codex CLI:**
|
|
246
|
+
```bash
|
|
247
|
+
mkdir -p .agents/skills/codemap
|
|
248
|
+
cp node_modules/@mycodemap/mycodemap/examples/codex/codemap-agent.md .agents/skills/codemap/SKILL.md
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Step 6: 更新项目 rules [CONFIRM]
|
|
252
|
+
|
|
253
|
+
在项目的 `CLAUDE.md` 和 `AGENTS.md` 中追加以下内容:
|
|
254
|
+
|
|
255
|
+
```markdown
|
|
256
|
+
## CodeMap Skill
|
|
257
|
+
|
|
258
|
+
### 何时使用
|
|
259
|
+
- 需要理解项目整体结构或模块关系
|
|
260
|
+
- 分析代码变更的影响范围
|
|
261
|
+
- 查询符号定义、调用关系、依赖链
|
|
262
|
+
- 评估代码复杂度或检测循环依赖
|
|
263
|
+
|
|
264
|
+
### 何时不用
|
|
265
|
+
- 简单的单文件修改或调试
|
|
266
|
+
- 非代码文件操作(文档、配置等)
|
|
267
|
+
- 已有明确上下文的局部改动
|
|
268
|
+
|
|
269
|
+
### 如何使用
|
|
270
|
+
- 参考 .claude/skills/codemap/ 中的 skill 指令
|
|
271
|
+
- 使用 mycodemap CLI 命令(generate/query/impact/deps/cycles/complexity)
|
|
272
|
+
|
|
273
|
+
### 索引维护
|
|
274
|
+
- 代码变更后需运行 `mycodemap generate` 更新索引
|
|
275
|
+
- 在重大功能开发/重构完成后,主动更新一次
|
|
276
|
+
- 如发现 mycodemap 查询结果与代码不一致,先更新索引再使用
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Step 7: 验证安装
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# 验证 CLI 可用
|
|
283
|
+
mycodemap query --help
|
|
284
|
+
|
|
285
|
+
# 验证 skill 文件已就位
|
|
286
|
+
ls .claude/skills/codemap/SKILL.md
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### 可选:MCP 服务器配置
|
|
290
|
+
|
|
291
|
+
如需使用 MCP 协议与 AI 助手集成:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
mycodemap generate --symbol-level
|
|
295
|
+
mycodemap mcp install
|
|
296
|
+
```
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Step 2: 验证文件**
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
grep -c "一键安装引导" docs/AI_ASSISTANT_SETUP.md
|
|
303
|
+
grep -c "CONFIRM" docs/AI_ASSISTANT_SETUP.md
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Expected: 一键安装引导出现 1 次,CONFIRM 出现 6 次
|
|
307
|
+
|
|
308
|
+
**Step 3: Commit**
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
git add docs/AI_ASSISTANT_SETUP.md
|
|
312
|
+
git commit -m "feat: add AI CLI one-click install guide to AI_ASSISTANT_SETUP.md"
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
### Task 4: 更新 README.md — AI 文档索引增加新 skill 链接
|
|
318
|
+
|
|
319
|
+
**Files:**
|
|
320
|
+
- Modify: `README.md:99-117`(AI / Agent 专属文档章节)
|
|
321
|
+
|
|
322
|
+
**Step 1: 在 AI 文档表格中增加一行**
|
|
323
|
+
|
|
324
|
+
在第 114 行(`docs/AI_ASSISTANT_SETUP.md` 行)之后增加:
|
|
325
|
+
|
|
326
|
+
```markdown
|
|
327
|
+
| **[🔍 examples/claude/skills/mycodemap-repo-analyzer/](examples/claude/skills/mycodemap-repo-analyzer/)** | 项目深度架构分析技能(基于 repo-analyzer + mycodemap CLI) |
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Step 2: 验证**
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
grep "mycodemap-repo-analyzer" README.md
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Expected: 1 行匹配
|
|
337
|
+
|
|
338
|
+
**Step 3: Commit**
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
git add README.md
|
|
342
|
+
git commit -m "docs: add mycodemap-repo-analyzer skill link to README AI docs index"
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
### Task 5: 端到端验证
|
|
348
|
+
|
|
349
|
+
**Step 1: 验证安装引导文档可读性**
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# 检查 AI_ASSISTANT_SETUP.md 中新增章节的格式
|
|
353
|
+
grep -A 3 "一键安装引导" docs/AI_ASSISTANT_SETUP.md
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
**Step 2: 验证 skill 文件结构完整**
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
find examples/claude/skills/mycodemap-repo-analyzer -type f
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Expected: 3 个文件(SKILL.md, analysis-guide.md, module-analysis-guide.md)
|
|
363
|
+
|
|
364
|
+
**Step 3: 验证 SKILL.md 中 mycodemap 集成点**
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
grep "mycodemap" examples/claude/skills/mycodemap-repo-analyzer/SKILL.md | head -20
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Expected: 阶段1/2/4/6/7 中都有 mycodemap 命令引用
|
|
371
|
+
|
|
372
|
+
**Step 4: 运行文档检查**
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
npm run docs:check
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Expected: 通过,无错误
|
|
379
|
+
|
|
380
|
+
**Step 5: 最终 commit(如有修复)**
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
git add -A
|
|
384
|
+
git commit -m "chore: fix docs check issues from install guide and skill additions"
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## 验证方案
|
|
390
|
+
|
|
391
|
+
1. **安装引导**:用新的 AI CLI 会话,说"帮我安装 mycodemap",验证 AI 能否按步骤引导完成
|
|
392
|
+
2. **Rules 文本片段**:拷贝 Step 6 的内容到测试项目的 CLAUDE.md,验证格式和内容正确
|
|
393
|
+
3. **repo-analyzer skill**:在 Claude Code 中安装 skill 后,说"mycodemap 分析项目 xxx",验证 skill 激活和 mycodemap 命令调用
|
|
394
|
+
4. **文档同步**:`npm run docs:check` 通过
|
package/docs/rules/README.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
| 改分层、依赖方向、模块边界 | `architecture-guardrails.md` | `node dist/cli/index.js deps -m "<module>"` |
|
|
13
13
|
| 改测试、fixture、测试文件布局 | `testing.md` | `npm test` |
|
|
14
14
|
| 改 hooks、CI、验证顺序、repo-local guardrail | `validation.md` | `npm run docs:check` / `python3 scripts/validate-rules.py code --report-only` |
|
|
15
|
+
| 改 harness、agent 控制、上下文分层、权限升级策略 | `harness.md` | `npm run docs:check` |
|
|
15
16
|
| 改 agent 执行协议、CLI/CI 工程护栏 | `engineering-with-codex-openai.md` | `node dist/cli/index.js ci check-docs-sync` |
|
|
16
17
|
| 改 `/release workflow`、milestone 绑定、确认门 | `release.md` | `npm run docs:check:pre-release` |
|
|
17
18
|
| 改发布/打包 mechanics | `deployment.md` | `npm run build` / `npm run validate-pack` |
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
```bash
|
|
27
27
|
node dist/cli/index.js deps -m "src/domain"
|
|
28
28
|
node dist/cli/index.js impact -f "src/interface/types/index.ts"
|
|
29
|
-
npm run check:architecture
|
|
30
29
|
```
|
|
31
30
|
|
|
31
|
+
> 架构依赖检查通过 `deps` 命令完成,不再使用单独的 npm script。
|
|
32
|
+
|
|
32
33
|
## 常见误区
|
|
33
34
|
|
|
34
35
|
- `Server Layer` 是内部架构层,不等于公共产品面的 `mycodemap server`。
|