@mycodemap/mycodemap 0.1.0 → 0.1.1

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +86 -6
  2. package/README.md +172 -80
  3. package/dist/cli/commands/cycles.d.ts.map +1 -1
  4. package/dist/cli/commands/cycles.js +2 -0
  5. package/dist/cli/commands/cycles.js.map +1 -1
  6. package/dist/cli/commands/init.d.ts.map +1 -1
  7. package/dist/cli/commands/init.js +3 -1
  8. package/dist/cli/commands/init.js.map +1 -1
  9. package/dist/cli/commands/logs.d.ts +5 -0
  10. package/dist/cli/commands/logs.d.ts.map +1 -0
  11. package/dist/cli/commands/logs.js +189 -0
  12. package/dist/cli/commands/logs.js.map +1 -0
  13. package/dist/cli/commands/report.d.ts +12 -0
  14. package/dist/cli/commands/report.d.ts.map +1 -0
  15. package/dist/cli/commands/report.js +158 -0
  16. package/dist/cli/commands/report.js.map +1 -0
  17. package/dist/cli/commands/watch-foreground.d.ts.map +1 -1
  18. package/dist/cli/commands/watch-foreground.js +2 -0
  19. package/dist/cli/commands/watch-foreground.js.map +1 -1
  20. package/dist/cli/commands/watch.d.ts.map +1 -1
  21. package/dist/cli/commands/watch.js +2 -0
  22. package/dist/cli/commands/watch.js.map +1 -1
  23. package/dist/cli/first-run-guide.d.ts +23 -0
  24. package/dist/cli/first-run-guide.d.ts.map +1 -0
  25. package/dist/cli/first-run-guide.js +83 -0
  26. package/dist/cli/first-run-guide.js.map +1 -0
  27. package/dist/cli/index.js +63 -0
  28. package/dist/cli/index.js.map +1 -1
  29. package/dist/cli/platform-check.d.ts +21 -0
  30. package/dist/cli/platform-check.d.ts.map +1 -0
  31. package/dist/cli/platform-check.js +94 -0
  32. package/dist/cli/platform-check.js.map +1 -0
  33. package/dist/cli/tree-sitter-check.d.ts +35 -0
  34. package/dist/cli/tree-sitter-check.d.ts.map +1 -0
  35. package/dist/cli/tree-sitter-check.js +133 -0
  36. package/dist/cli/tree-sitter-check.js.map +1 -0
  37. package/dist/cli/utils/sanitize.d.ts +54 -0
  38. package/dist/cli/utils/sanitize.d.ts.map +1 -0
  39. package/dist/cli/utils/sanitize.js +131 -0
  40. package/dist/cli/utils/sanitize.js.map +1 -0
  41. package/docs/AI_ASSISTANT_SETUP.md +743 -0
  42. package/docs/CI_GATEWAY_DESIGN.md +784 -0
  43. package/docs/OMC_TEAM_DEBUG_REPORT.md +285 -0
  44. package/docs/PUBLISH_NPM_DESIGN_FINAL.md +485 -0
  45. package/docs/REFACTOR_ARCHITECTURE_OVERVIEW.md +552 -0
  46. package/docs/REFACTOR_CONFIDENCE_DESIGN.md +244 -0
  47. package/docs/REFACTOR_GIT_ANALYZER_DESIGN.md +785 -0
  48. package/docs/REFACTOR_ORCHESTRATOR_DESIGN.md +1065 -0
  49. package/docs/REFACTOR_REQUIREMENTS.md +970 -0
  50. package/docs/REFACTOR_RESULT_FUSION_DESIGN.md +315 -0
  51. package/docs/REFACTOR_TEST_LINKER_DESIGN.md +311 -0
  52. package/docs/SETUP_GUIDE.md +407 -0
  53. package/docs/archive/AI_INTEGRATION_GUIDE_ARCHIVED.md +385 -0
  54. package/docs/archive/PUBLISH_NPM_DESIGN_V1.md +1693 -0
  55. package/docs/archive/PUBLISH_NPM_DESIGN_V2.md +390 -0
  56. package/docs/archive/TASK_DESIGN_COVERAGE_REPORT.md +314 -0
  57. package/docs/plans/POST_TASK_PLAN.md +129 -0
  58. package/docs/plans/archive/2026-03-03-deps-path-extension-fix.md +186 -0
  59. package/examples/README.md +61 -0
  60. package/examples/claude/codemap-skill.md +94 -0
  61. package/examples/codex/codemap-agent.md +66 -0
  62. package/examples/copilot/copilot-instructions.md +24 -0
  63. package/examples/kimi/codemap-skill.md +92 -0
  64. package/package.json +5 -3
@@ -0,0 +1,407 @@
1
+ # MyCodeMap 安装与配置指南
2
+
3
+ > 面向人类开发者的完整安装、配置和使用指南
4
+
5
+ ---
6
+
7
+ ## 目录
8
+
9
+ 1. [快速开始](#快速开始)
10
+ 2. [安装方式](#安装方式)
11
+ 3. [初始化配置](#初始化配置)
12
+ 4. [日常使用](#日常使用)
13
+ 5. [AI 助手集成](#ai-助手集成)
14
+ 6. [CI/CD 集成](#cicd-集成)
15
+ 7. [故障排除](#故障排除)
16
+
17
+ ---
18
+
19
+ ## 快速开始
20
+
21
+ ### 5 分钟上手
22
+
23
+ ```bash
24
+ # 1. 安装
25
+ npm install -g @mycodemap/mycodemap
26
+
27
+ # 2. 在项目根目录初始化
28
+ mycodemap init -y
29
+
30
+ # 3. 生成代码地图
31
+ mycodemap generate
32
+
33
+ # 4. 查看结果
34
+ ls .mycodemap/
35
+ ```
36
+
37
+ ---
38
+
39
+ ## 安装方式
40
+
41
+ ### 方式一:全局安装(推荐)
42
+
43
+ ```bash
44
+ npm install -g @mycodemap/mycodemap
45
+ ```
46
+
47
+ **优点**:
48
+ - 所有项目可用
49
+ - 直接使用 `mycodemap` 命令
50
+
51
+ ### 方式二:项目本地安装
52
+
53
+ ```bash
54
+ npm install --save-dev @mycodemap/mycodemap
55
+ ```
56
+
57
+ **使用**:
58
+ ```bash
59
+ npx mycodemap --help
60
+ ```
61
+
62
+ **优点**:
63
+ - 版本锁定
64
+ - 团队协作一致
65
+ - 可作为 npm 脚本使用
66
+
67
+ ### 方式三:使用 npx(无需安装)
68
+
69
+ ```bash
70
+ npx @mycodemap/mycodemap --help
71
+ ```
72
+
73
+ **适用场景**:
74
+ - 临时使用
75
+ - CI/CD 环境
76
+
77
+ ---
78
+
79
+ ## 初始化配置
80
+
81
+ ### 交互式初始化
82
+
83
+ ```bash
84
+ mycodemap init
85
+ ```
86
+
87
+ 会询问以下问题:
88
+ - 分析模式(fast/smart/hybrid)
89
+ - 包含的文件路径
90
+ - 排除的文件路径
91
+ - 输出目录
92
+
93
+ ### 使用默认配置
94
+
95
+ ```bash
96
+ mycodemap init -y
97
+ ```
98
+
99
+ 生成的配置文件 `mycodemap.config.json`:
100
+
101
+ ```json
102
+ {
103
+ "$schema": "https://mycodemap.dev/schema/config.json",
104
+ "mode": "hybrid",
105
+ "include": ["src/**/*"],
106
+ "exclude": [
107
+ "node_modules/**",
108
+ "dist/**",
109
+ "**/*.test.ts",
110
+ "**/*.spec.ts"
111
+ ],
112
+ "output": ".mycodemap"
113
+ }
114
+ ```
115
+
116
+ ### 配置选项详解
117
+
118
+ | 配置项 | 类型 | 默认值 | 说明 |
119
+ |--------|------|--------|------|
120
+ | `mode` | string | `"hybrid"` | 分析模式:`fast`(快速正则)、`smart`(AST深度分析)、`hybrid`(自动选择) |
121
+ | `include` | string[] | `["src/**/*"]` | 包含的文件 glob 模式 |
122
+ | `exclude` | string[] | 见上 | 排除的文件 glob 模式 |
123
+ | `output` | string | `".mycodemap"` | 输出目录路径 |
124
+
125
+ ---
126
+
127
+ ## 日常使用
128
+
129
+ ### 生成代码地图
130
+
131
+ ```bash
132
+ # 默认 hybrid 模式
133
+ mycodemap generate
134
+
135
+ # 指定模式
136
+ mycodemap generate -m smart
137
+
138
+ # 指定输出目录
139
+ mycodemap generate -o ./docs/codemap
140
+ ```
141
+
142
+ ### 查询代码
143
+
144
+ ```bash
145
+ # 查询符号
146
+ mycodemap query -s "ModuleInfo"
147
+
148
+ # 查询模块
149
+ mycodemap query -m "src/parser"
150
+
151
+ # 模糊搜索
152
+ mycodemap query -S "cache" -l 10
153
+
154
+ # JSON 输出
155
+ mycodemap query -s "IntentRouter" -j
156
+ ```
157
+
158
+ ### 依赖分析
159
+
160
+ ```bash
161
+ # 查看所有依赖
162
+ mycodemap deps
163
+
164
+ # 查看指定模块依赖
165
+ mycodemap deps -m "src/parser"
166
+
167
+ # 检测循环依赖
168
+ mycodemap cycles
169
+ ```
170
+
171
+ ### 影响范围分析
172
+
173
+ ```bash
174
+ # 分析文件变更影响
175
+ mycodemap impact -f src/cli/index.ts
176
+
177
+ # 包含传递依赖
178
+ mycodemap impact -f src/cli/index.ts --transitive
179
+ ```
180
+
181
+ ### 监听模式
182
+
183
+ ```bash
184
+ # 前台监听
185
+ mycodemap watch
186
+
187
+ # 后台守护进程
188
+ mycodemap watch -d
189
+
190
+ # 查看状态
191
+ mycodemap watch -t
192
+
193
+ # 停止守护进程
194
+ mycodemap watch -s
195
+ ```
196
+
197
+ ---
198
+
199
+ ## AI 助手集成
200
+
201
+ MyCodeMap 可以与多种 AI 编程助手集成,提升代码理解效率。
202
+
203
+ ### 支持的 AI 助手
204
+
205
+ | AI 助手 | 配置方式 | 详细文档 |
206
+ |---------|----------|----------|
207
+ | Kimi CLI | Skill 配置 | [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md#kimi-cli) |
208
+ | Claude Code | Skill 配置 | [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md#claude-code) |
209
+ | Codex CLI | Agent 配置 | [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md#codex-cli) |
210
+ | GitHub Copilot | 提示词模板 | [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md#github-copilot) |
211
+
212
+ ### 快速配置
213
+
214
+ #### Kimi CLI
215
+
216
+ ```bash
217
+ # 复制示例配置到项目
218
+ cp node_modules/@mycodemap/mycodemap/examples/kimi/codemap-skill.md .kimi/skills/codemap/SKILL.md
219
+ ```
220
+
221
+ #### Claude Code
222
+
223
+ ```bash
224
+ # 复制示例配置
225
+ cp node_modules/@mycodemap/mycodemap/examples/claude/codemap-skill.md .claude/skills/codemap/SKILL.md
226
+ ```
227
+
228
+ #### Codex CLI
229
+
230
+ ```bash
231
+ # 复制示例配置
232
+ cp node_modules/@mycodemap/mycodemap/examples/codex/codemap-agent.md .agents/skills/codemap/SKILL.md
233
+ ```
234
+
235
+ 详细配置步骤请参考 [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md)。
236
+
237
+ ---
238
+
239
+ ## CI/CD 集成
240
+
241
+ ### Git Hooks(本地门禁)
242
+
243
+ #### 自动安装
244
+
245
+ ```bash
246
+ # 安装 Git hooks
247
+ npm run postinstall # 如果 package.json 中配置了
248
+
249
+ # 或手动安装
250
+ sh scripts/hooks/install-hooks.sh
251
+ ```
252
+
253
+ #### 手动配置
254
+
255
+ 如果项目没有提供 hooks 安装脚本,可以手动配置:
256
+
257
+ ```bash
258
+ # 创建 .githooks 目录
259
+ mkdir -p .githooks
260
+
261
+ # 创建 pre-commit hook
262
+ cat > .githooks/pre-commit << 'EOF'
263
+ #!/bin/sh
264
+ # MyCodeMap pre-commit check
265
+
266
+ if ! command -v mycodemap &> /dev/null; then
267
+ exit 0
268
+ fi
269
+
270
+ # 可选:运行测试
271
+ # npm test
272
+
273
+ # 可选:检查文件头
274
+ # mycodemap ci check-headers
275
+
276
+ exit 0
277
+ EOF
278
+
279
+ chmod +x .githooks/pre-commit
280
+
281
+ # 配置 git 使用自定义 hooks 目录
282
+ git config core.hookspath .githooks
283
+ ```
284
+
285
+ ### GitHub Actions
286
+
287
+ 创建 `.github/workflows/codemap.yml`:
288
+
289
+ ```yaml
290
+ name: CodeMap CI
291
+
292
+ on: [push, pull_request]
293
+
294
+ jobs:
295
+ codemap:
296
+ runs-on: ubuntu-latest
297
+ steps:
298
+ - uses: actions/checkout@v4
299
+
300
+ - name: Setup Node.js
301
+ uses: actions/setup-node@v4
302
+ with:
303
+ node-version: '20'
304
+
305
+ - name: Install dependencies
306
+ run: npm ci
307
+
308
+ - name: Run tests
309
+ run: npm test
310
+
311
+ - name: Check commits
312
+ run: npx mycodemap ci check-commits --range origin/main..HEAD
313
+
314
+ - name: Check headers
315
+ run: npx mycodemap ci check-headers
316
+
317
+ - name: Generate codemap
318
+ run: npx mycodemap generate
319
+
320
+ - name: Check codemap sync
321
+ run: git diff --exit-code .mycodemap/
322
+ ```
323
+
324
+ ### 其他 CI 平台
325
+
326
+ 参考 [CI_GATEWAY_DESIGN.md](./CI_GATEWAY_DESIGN.md) 了解所有检查项。
327
+
328
+ ---
329
+
330
+ ## 故障排除
331
+
332
+ ### 常见问题
333
+
334
+ #### 1. 命令未找到
335
+
336
+ ```bash
337
+ # 检查是否安装
338
+ which mycodemap
339
+
340
+ # 全局安装后可能需要刷新 shell hash
341
+ hash -r
342
+
343
+ # 或使用 npx
344
+ npx mycodemap --help
345
+ ```
346
+
347
+ #### 2. 配置文件未找到
348
+
349
+ ```bash
350
+ # 确认配置文件存在
351
+ ls mycodemap.config.json
352
+
353
+ # 重新初始化
354
+ mycodemap init -y
355
+ ```
356
+
357
+ #### 3. 权限问题
358
+
359
+ ```bash
360
+ # 检查文件权限
361
+ ls -la .mycodemap/
362
+
363
+ # 修复权限
364
+ chmod -R u+rw .mycodemap/
365
+ ```
366
+
367
+ #### 4. tree-sitter 构建失败
368
+
369
+ 某些环境可能需要安装构建工具:
370
+
371
+ ```bash
372
+ # Ubuntu/Debian
373
+ sudo apt-get install build-essential
374
+
375
+ # macOS
376
+ xcode-select --install
377
+ ```
378
+
379
+ ### 获取帮助
380
+
381
+ ```bash
382
+ # 查看帮助
383
+ mycodemap --help
384
+
385
+ # 查看子命令帮助
386
+ mycodemap generate --help
387
+
388
+ # 查看版本
389
+ mycodemap --version
390
+ ```
391
+
392
+ ### 日志与调试
393
+
394
+ CLI 运行日志默认写入 `.mycodemap/logs/mycodemap-YYYY-MM-DD.log`
395
+
396
+ 环境变量:
397
+ - `CODEMAP_RUNTIME_LOG_ENABLED=false`:关闭运行日志
398
+ - `CODEMAP_RUNTIME_LOG_DIR=<dir>`:自定义日志目录
399
+ - `CODEMAP_RUNTIME_LOG_RETENTION_DAYS=<days>`:设置保留天数
400
+
401
+ ---
402
+
403
+ ## 下一步
404
+
405
+ - 了解 [AI 助手配置](./AI_ASSISTANT_SETUP.md)
406
+ - 查看 [CLI 完整命令参考](../README.md#cli-命令)
407
+ - 阅读 [架构设计文档](./REFACTOR_ARCHITECTURE_OVERVIEW.md)