@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.
- package/CHANGELOG.md +86 -6
- package/README.md +172 -80
- package/dist/cli/commands/cycles.d.ts.map +1 -1
- package/dist/cli/commands/cycles.js +2 -0
- package/dist/cli/commands/cycles.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +3 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/logs.d.ts +5 -0
- package/dist/cli/commands/logs.d.ts.map +1 -0
- package/dist/cli/commands/logs.js +189 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/report.d.ts +12 -0
- package/dist/cli/commands/report.d.ts.map +1 -0
- package/dist/cli/commands/report.js +158 -0
- package/dist/cli/commands/report.js.map +1 -0
- package/dist/cli/commands/watch-foreground.d.ts.map +1 -1
- package/dist/cli/commands/watch-foreground.js +2 -0
- package/dist/cli/commands/watch-foreground.js.map +1 -1
- package/dist/cli/commands/watch.d.ts.map +1 -1
- package/dist/cli/commands/watch.js +2 -0
- package/dist/cli/commands/watch.js.map +1 -1
- package/dist/cli/first-run-guide.d.ts +23 -0
- package/dist/cli/first-run-guide.d.ts.map +1 -0
- package/dist/cli/first-run-guide.js +83 -0
- package/dist/cli/first-run-guide.js.map +1 -0
- package/dist/cli/index.js +63 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/platform-check.d.ts +21 -0
- package/dist/cli/platform-check.d.ts.map +1 -0
- package/dist/cli/platform-check.js +94 -0
- package/dist/cli/platform-check.js.map +1 -0
- package/dist/cli/tree-sitter-check.d.ts +35 -0
- package/dist/cli/tree-sitter-check.d.ts.map +1 -0
- package/dist/cli/tree-sitter-check.js +133 -0
- package/dist/cli/tree-sitter-check.js.map +1 -0
- package/dist/cli/utils/sanitize.d.ts +54 -0
- package/dist/cli/utils/sanitize.d.ts.map +1 -0
- package/dist/cli/utils/sanitize.js +131 -0
- package/dist/cli/utils/sanitize.js.map +1 -0
- package/docs/AI_ASSISTANT_SETUP.md +743 -0
- package/docs/CI_GATEWAY_DESIGN.md +784 -0
- package/docs/OMC_TEAM_DEBUG_REPORT.md +285 -0
- package/docs/PUBLISH_NPM_DESIGN_FINAL.md +485 -0
- package/docs/REFACTOR_ARCHITECTURE_OVERVIEW.md +552 -0
- package/docs/REFACTOR_CONFIDENCE_DESIGN.md +244 -0
- package/docs/REFACTOR_GIT_ANALYZER_DESIGN.md +785 -0
- package/docs/REFACTOR_ORCHESTRATOR_DESIGN.md +1065 -0
- package/docs/REFACTOR_REQUIREMENTS.md +970 -0
- package/docs/REFACTOR_RESULT_FUSION_DESIGN.md +315 -0
- package/docs/REFACTOR_TEST_LINKER_DESIGN.md +311 -0
- package/docs/SETUP_GUIDE.md +407 -0
- package/docs/archive/AI_INTEGRATION_GUIDE_ARCHIVED.md +385 -0
- package/docs/archive/PUBLISH_NPM_DESIGN_V1.md +1693 -0
- package/docs/archive/PUBLISH_NPM_DESIGN_V2.md +390 -0
- package/docs/archive/TASK_DESIGN_COVERAGE_REPORT.md +314 -0
- package/docs/plans/POST_TASK_PLAN.md +129 -0
- package/docs/plans/archive/2026-03-03-deps-path-extension-fix.md +186 -0
- package/examples/README.md +61 -0
- package/examples/claude/codemap-skill.md +94 -0
- package/examples/codex/codemap-agent.md +66 -0
- package/examples/copilot/copilot-instructions.md +24 -0
- package/examples/kimi/codemap-skill.md +92 -0
- package/package.json +5 -3
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# CodeMap 后续任务计划
|
|
2
|
+
|
|
3
|
+
> 生成时间: 2026-03-03
|
|
4
|
+
> 状态: 规划中
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 一、v2.5 工作流编排器实现状态
|
|
9
|
+
|
|
10
|
+
### ✅ 已完成 (核心功能)
|
|
11
|
+
|
|
12
|
+
| 模块 | 实现文件 | 状态 |
|
|
13
|
+
|------|---------|------|
|
|
14
|
+
| WorkflowOrchestrator | `src/orchestrator/workflow/workflow-orchestrator.ts` | ✅ |
|
|
15
|
+
| WorkflowPersistence | `src/orchestrator/workflow/workflow-persistence.ts` | ✅ |
|
|
16
|
+
| PhaseCheckpoint | `src/orchestrator/workflow/phase-checkpoint.ts` | ✅ |
|
|
17
|
+
| WorkflowContext | `src/orchestrator/workflow/workflow-context.ts` | ✅ |
|
|
18
|
+
| CLI Commands | `src/cli/commands/workflow.ts` | ✅ |
|
|
19
|
+
| CI Integration | `src/cli/commands/ci.ts` | ✅ |
|
|
20
|
+
|
|
21
|
+
### ⚠️ 扩展功能 (v2.6 规划)
|
|
22
|
+
|
|
23
|
+
| 模块 | 设计位置 | 优先级 | 说明 |
|
|
24
|
+
|------|---------|--------|------|
|
|
25
|
+
| WorkflowResultFusion | RESULT_FUSION_DESIGN.md §8.1 | P2 | 跨阶段结果融合 |
|
|
26
|
+
| PhaseInheritance | RESULT_FUSION_DESIGN.md §8.2 | P2 | 阶段结果继承 |
|
|
27
|
+
| WorkflowTestLinker | TEST_LINKER_DESIGN.md §7.2 | P3 | 工作流测试建议 |
|
|
28
|
+
| WorkflowGitAnalyzer | GIT_ANALYZER_DESIGN.md §10.2 | P3 | 工作流Git分析 |
|
|
29
|
+
| WorkflowCIExecutor | CI_GATEWAY_DESIGN.md §11.2 | P3 | 工作流CI执行 |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 二、后续任务清单
|
|
34
|
+
|
|
35
|
+
### P0 - 立即执行 (24小时内)
|
|
36
|
+
|
|
37
|
+
| 任务ID | 任务描述 | 依赖 | 状态 |
|
|
38
|
+
|--------|---------|------|------|
|
|
39
|
+
| T001 | 运行完整测试套件验证功能 | - | ✅ done |
|
|
40
|
+
| T002 | 更新 README.md 工作流文档 | T001 | pending |
|
|
41
|
+
|
|
42
|
+
### P1 - 高优先级 (本周)
|
|
43
|
+
|
|
44
|
+
| 任务ID | 任务描述 | 依赖 | 状态 |
|
|
45
|
+
|--------|---------|------|------|
|
|
46
|
+
| T003 | 实现 WorkflowResultFusion 跨阶段融合 | T001 | pending |
|
|
47
|
+
| T004 | 实现 PhaseInheritance 阶段继承 | T003 | pending |
|
|
48
|
+
| T005 | 添加工作流 E2E 集成测试 | T001 | pending |
|
|
49
|
+
|
|
50
|
+
### P2 - 中优先级 (本月)
|
|
51
|
+
|
|
52
|
+
| 任务ID | 任务描述 | 依赖 | 状态 |
|
|
53
|
+
|--------|---------|------|------|
|
|
54
|
+
| T006 | WorkflowTestLinker 实现 | T005 | pending |
|
|
55
|
+
| T007 | WorkflowGitAnalyzer 实现 | T005 | pending |
|
|
56
|
+
| T008 | WorkflowCIExecutor 实现 | T005 | pending |
|
|
57
|
+
|
|
58
|
+
### P3 - 低优先级 (季度)
|
|
59
|
+
|
|
60
|
+
| 任务ID | 任务描述 | 依赖 | 状态 |
|
|
61
|
+
|--------|---------|------|------|
|
|
62
|
+
| T009 | 工作流可视化 UI | T005 | pending |
|
|
63
|
+
| T010 | 工作流模板系统 | T005 | pending |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 三、验收标准
|
|
68
|
+
|
|
69
|
+
### 功能验收
|
|
70
|
+
|
|
71
|
+
- [x] 所有 CLI 命令正常工作 (`workflow start/status/proceed/resume/checkpoint`)
|
|
72
|
+
- [x] CI 门禁全部通过 (`check-commits/check-headers/assess-risk/check-output-contract`)
|
|
73
|
+
- [x] 单元测试通过率 >= 80% (723/723)
|
|
74
|
+
- [x] 工作流持久化正常工作
|
|
75
|
+
|
|
76
|
+
### 性能验收
|
|
77
|
+
|
|
78
|
+
- [ ] Hit@8 >= 90% (需要基准测试验证)
|
|
79
|
+
- [ ] Token 消耗降低 >= 40% (需要基准测试验证)
|
|
80
|
+
- [ ] CLI 响应时间 < 2s
|
|
81
|
+
|
|
82
|
+
### 文档验收
|
|
83
|
+
|
|
84
|
+
- [ ] README.md 更新
|
|
85
|
+
- [ ] CLI 命令文档完整
|
|
86
|
+
- [ ] API 文档同步更新
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 四、里程碑
|
|
91
|
+
|
|
92
|
+
### M1: v2.5 正式发布 (目标: 2026-03-07)
|
|
93
|
+
- [x] P0 任务全部完成 (测试已通过)
|
|
94
|
+
- [x] 核心功能稳定 (723/723 测试通过)
|
|
95
|
+
- [ ] 文档更新完成 (README.md 待更新)
|
|
96
|
+
|
|
97
|
+
### M2: v2.6 规划 (目标: 2026-04-01)
|
|
98
|
+
- [ ] P1 任务全部完成
|
|
99
|
+
- [ ] 扩展功能实现
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 五、技术债务
|
|
104
|
+
|
|
105
|
+
| 债务项 | 描述 | 优先级 |
|
|
106
|
+
|--------|------|--------|
|
|
107
|
+
| TEST_PATTERNS 硬编码 | 测试匹配模式应配置化 | P2 |
|
|
108
|
+
| 缺少错误重试机制 | 网络/IO 错误应自动重试 | P2 |
|
|
109
|
+
| 日志轮转配置 | 生产环境需要日志轮转 | P3 |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 六、资源
|
|
114
|
+
|
|
115
|
+
### 相关文档
|
|
116
|
+
|
|
117
|
+
- [REFACTOR_ARCHITECTURE_OVERVIEW.md](../docs/REFACTOR_ARCHITECTURE_OVERVIEW.md)
|
|
118
|
+
- [REFACTOR_ORCHESTRATOR_DESIGN.md](../docs/REFACTOR_ORCHESTRATOR_DESIGN.md)
|
|
119
|
+
- [CI_GATEWAY_DESIGN.md](../docs/CI_GATEWAY_DESIGN.md)
|
|
120
|
+
|
|
121
|
+
### 代码位置
|
|
122
|
+
|
|
123
|
+
- 工作流核心: `src/orchestrator/workflow/`
|
|
124
|
+
- CLI 命令: `src/cli/commands/workflow.ts`
|
|
125
|
+
- CI 命令: `src/cli/commands/ci.ts`
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
*此文档由 Claude Code 自动生成*
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# 依赖路径扩展名修复计划
|
|
2
|
+
|
|
3
|
+
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
|
|
4
|
+
|
|
5
|
+
**Goal:** 修复 `codemap deps` 命令显示 `.js` 扩展名而非源代码 `.ts` 扩展名的问题
|
|
6
|
+
|
|
7
|
+
**Architecture:** 在 fast-parser 中添加路径规范化逻辑,将构建路径转换为源代码路径
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** TypeScript, Node.js, 正则表达式
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 问题分析
|
|
14
|
+
|
|
15
|
+
当前 `codemap deps` 输出示例:
|
|
16
|
+
```
|
|
17
|
+
⬇️ 直接依赖 (dependencies):
|
|
18
|
+
• ../types/index.js [source]
|
|
19
|
+
• ./interfaces/IParser.js [source]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
期望输出:
|
|
23
|
+
```
|
|
24
|
+
⬇️ 直接依赖 (dependencies):
|
|
25
|
+
• ../types/index.ts [source]
|
|
26
|
+
• ./interfaces/IParser.ts [source]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**根源位置:** `src/parser/implementations/fast-parser.ts:141`
|
|
30
|
+
- 直接使用 import 语句中的原始路径
|
|
31
|
+
- 未将 `.js` 后缀转换为 `.ts` 后缀
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 任务 1: 添加路径规范化函数
|
|
36
|
+
|
|
37
|
+
**Files:**
|
|
38
|
+
- Modify: `src/parser/implementations/fast-parser.ts`
|
|
39
|
+
|
|
40
|
+
**Step 1: 添加规范化函数**
|
|
41
|
+
|
|
42
|
+
在 `fast-parser.ts` 文件末尾添加路径规范化函数:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
/**
|
|
46
|
+
* 将构建路径转换为源代码路径
|
|
47
|
+
* 例如: ../types/index.js -> ../types/index.ts
|
|
48
|
+
*/
|
|
49
|
+
function normalizeSourcePath(depPath: string): string {
|
|
50
|
+
// 已经是 .ts 或 .tsx 的不需要转换
|
|
51
|
+
if (depPath.endsWith('.ts') || depPath.endsWith('.tsx')) {
|
|
52
|
+
return depPath;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 替换 .js/.jsx 后缀为 .ts/.tsx
|
|
56
|
+
return depPath.replace(/\.js$/i, '.ts').replace(/\.jsx$/i, '.tsx');
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Step 2: 在 extractImportsSimple 中使用**
|
|
61
|
+
|
|
62
|
+
找到第 140-145 行,修改 import 路径处理:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// 原代码
|
|
66
|
+
imports.push({
|
|
67
|
+
source: match[4], // <-- 直接使用原始路径
|
|
68
|
+
sourceType: match[4].startsWith('.') ? 'relative' : 'alias',
|
|
69
|
+
specifiers: specifiers.map(s => ({ name: s, isTypeOnly: false })) as any,
|
|
70
|
+
isTypeOnly: false
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// 修改为
|
|
74
|
+
imports.push({
|
|
75
|
+
source: normalizeSourcePath(match[4]), // <-- 使用规范化路径
|
|
76
|
+
sourceType: match[4].startsWith('.') ? 'relative' : 'alias',
|
|
77
|
+
specifiers: specifiers.map(s => ({ name: s, isTypeOnly: false })) as any,
|
|
78
|
+
isTypeOnly: false
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Step 3: 构建并测试**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm run build
|
|
86
|
+
node dist/cli/index.js deps -m "src/parser"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
预期输出应显示 `.ts` 扩展名。
|
|
90
|
+
|
|
91
|
+
**Step 4: 提交**
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git add src/parser/implementations/fast-parser.ts
|
|
95
|
+
git commit -m "fix: normalize .js to .ts in dependency paths"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 任务 2: 验证影响分析命令
|
|
101
|
+
|
|
102
|
+
**Files:**
|
|
103
|
+
- Test: 运行 `node dist/cli/index.js impact -f src/cache/lru-cache.ts`
|
|
104
|
+
|
|
105
|
+
**Step 1: 验证 impact 命令**
|
|
106
|
+
|
|
107
|
+
impact 命令也使用相同的 codemap.json 数据,路径问题应该已自动修复。
|
|
108
|
+
|
|
109
|
+
**Step 2: 提交**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
git commit -m "test: verify impact command uses normalized paths"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 任务 3: 添加回归测试
|
|
118
|
+
|
|
119
|
+
**Files:**
|
|
120
|
+
- Modify: `src/parser/__tests__/fast-parser.test.ts`
|
|
121
|
+
|
|
122
|
+
**Step 1: 添加测试用例**
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
describe('normalizeSourcePath', () => {
|
|
126
|
+
it('should convert .js to .ts', () => {
|
|
127
|
+
expect(normalizeSourcePath('../types/index.js')).toBe('../types/index.ts');
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('should keep .ts unchanged', () => {
|
|
131
|
+
expect(normalizeSourcePath('../types/index.ts')).toBe('../types/index.ts');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('should handle nested paths', () => {
|
|
135
|
+
expect(normalizeSourcePath('./foo/bar.js')).toBe('./foo/bar.ts');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Step 2: 运行测试**
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npm test -- --run src/parser/__tests__/fast-parser.test.ts
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Step 3: 提交**
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
git add src/parser/__tests__/fast-parser.test.ts
|
|
150
|
+
git commit -m "test: add path normalization tests"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 验证命令
|
|
156
|
+
|
|
157
|
+
修复完成后运行以下命令验证:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# 1. 依赖分析
|
|
161
|
+
node dist/cli/index.js deps -m "src/parser"
|
|
162
|
+
# 期望: 显示 .ts 而非 .js
|
|
163
|
+
|
|
164
|
+
# 2. 影响分析
|
|
165
|
+
node dist/cli/index.js impact -f src/cache/lru-cache.ts --transitive
|
|
166
|
+
# 期望: 显示 .ts 而非 .js
|
|
167
|
+
|
|
168
|
+
# 3. 构建
|
|
169
|
+
npm run build
|
|
170
|
+
# 期望: 无错误
|
|
171
|
+
|
|
172
|
+
# 4. 测试
|
|
173
|
+
npm test -- --run
|
|
174
|
+
# 期望: 713+ 通过
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 回滚计划
|
|
180
|
+
|
|
181
|
+
如果修复导致问题:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git revert HEAD
|
|
185
|
+
git push
|
|
186
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# MyCodeMap 配置示例
|
|
2
|
+
|
|
3
|
+
本目录包含各种 AI 助手和开发环境的配置示例。
|
|
4
|
+
|
|
5
|
+
## 目录结构
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
examples/
|
|
9
|
+
├── kimi/ # Kimi CLI 配置
|
|
10
|
+
│ └── codemap-skill.md # Skill 定义文件
|
|
11
|
+
├── claude/ # Claude Code 配置
|
|
12
|
+
│ └── codemap-skill.md # Skill 定义文件
|
|
13
|
+
├── codex/ # Codex CLI 配置
|
|
14
|
+
│ └── codemap-agent.md # Agent 定义文件
|
|
15
|
+
├── copilot/ # GitHub Copilot 配置
|
|
16
|
+
│ └── copilot-instructions.md # 提示词文件
|
|
17
|
+
└── README.md # 本文件
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 快速使用
|
|
21
|
+
|
|
22
|
+
### Kimi CLI
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
mkdir -p .kimi/skills/codemap
|
|
26
|
+
cp examples/kimi/codemap-skill.md .kimi/skills/codemap/SKILL.md
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Claude Code
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
mkdir -p .claude/skills/codemap
|
|
33
|
+
cp examples/claude/codemap-skill.md .claude/skills/codemap/SKILL.md
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Codex CLI
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
mkdir -p .agents/skills/codemap
|
|
40
|
+
cp examples/codex/codemap-agent.md .agents/skills/codemap/SKILL.md
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### GitHub Copilot
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
mkdir -p .github
|
|
47
|
+
cp examples/copilot/copilot-instructions.md .github/copilot-instructions.md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 自定义配置
|
|
51
|
+
|
|
52
|
+
复制示例文件后,可以根据项目需求进行调整:
|
|
53
|
+
|
|
54
|
+
1. **修改命令别名** - 如果项目中使用了不同的命令别名
|
|
55
|
+
2. **添加项目特定规则** - 针对项目结构的特殊处理
|
|
56
|
+
3. **调整输出格式** - 根据 AI 助手的解析能力调整
|
|
57
|
+
|
|
58
|
+
## 更多信息
|
|
59
|
+
|
|
60
|
+
- [安装配置指南](../docs/SETUP_GUIDE.md)
|
|
61
|
+
- [AI 助手集成指南](../docs/AI_ASSISTANT_SETUP.md)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# MyCodeMap Code Analysis
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Use MyCodeMap to analyze TypeScript/JavaScript project structure, query symbols, analyze dependencies, and assess change impact.
|
|
6
|
+
|
|
7
|
+
## CLI Detection
|
|
8
|
+
|
|
9
|
+
Detect MyCodeMap CLI availability:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Check global installation
|
|
13
|
+
if command -v mycodemap &> /dev/null; then
|
|
14
|
+
CODEMAP="mycodemap"
|
|
15
|
+
# Check local installation
|
|
16
|
+
elif [ -f "./node_modules/.bin/mycodemap" ]; then
|
|
17
|
+
CODEMAP="./node_modules/.bin/mycodemap"
|
|
18
|
+
# Fallback to npx
|
|
19
|
+
else
|
|
20
|
+
CODEMAP="npx @mycodemap/mycodemap"
|
|
21
|
+
fi
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
### Generate Code Map
|
|
27
|
+
```bash
|
|
28
|
+
$CODEMAP generate
|
|
29
|
+
```
|
|
30
|
+
Generates: `.mycodemap/AI_MAP.md`, `.mycodemap/CONTEXT.md`, `.mycodemap/codemap.json`
|
|
31
|
+
|
|
32
|
+
### Query Symbol
|
|
33
|
+
```bash
|
|
34
|
+
$CODEMAP query -s "<symbol-name>"
|
|
35
|
+
$CODEMAP query -s "<symbol-name>" -j # JSON output
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Query Module
|
|
39
|
+
```bash
|
|
40
|
+
$CODEMAP query -m "<module-path>"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Search
|
|
44
|
+
```bash
|
|
45
|
+
$CODEMAP query -S "<keyword>" -l 10
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Dependency Analysis
|
|
49
|
+
```bash
|
|
50
|
+
$CODEMAP deps -m "<module-path>"
|
|
51
|
+
$CODEMAP deps -m "<module-path>" -j
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Impact Analysis
|
|
55
|
+
```bash
|
|
56
|
+
$CODEMAP impact -f "<file-path>"
|
|
57
|
+
$CODEMAP impact -f "<file-path>" --transitive
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Cycle Detection
|
|
61
|
+
```bash
|
|
62
|
+
$CODEMAP cycles
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Complexity Analysis
|
|
66
|
+
```bash
|
|
67
|
+
$CODEMAP complexity
|
|
68
|
+
$CODEMAP complexity -f "<file-path>"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Workflows
|
|
72
|
+
|
|
73
|
+
### Understanding Project Structure
|
|
74
|
+
|
|
75
|
+
1. Generate code map: `$CODEMAP generate`
|
|
76
|
+
2. Read `.mycodemap/AI_MAP.md` for overview
|
|
77
|
+
3. Query specific modules as needed
|
|
78
|
+
|
|
79
|
+
### Before Code Changes
|
|
80
|
+
|
|
81
|
+
1. Run impact analysis: `$CODEMAP impact -f "<file>" --transitive`
|
|
82
|
+
2. Review affected files
|
|
83
|
+
3. Suggest test cases based on impact
|
|
84
|
+
|
|
85
|
+
### Finding Code
|
|
86
|
+
|
|
87
|
+
1. Search symbol: `$CODEMAP query -s "<name>"`
|
|
88
|
+
2. If not found, fuzzy search: `$CODEMAP query -S "<name>"`
|
|
89
|
+
3. Check module context: `$CODEMAP query -m "<path>"`
|
|
90
|
+
|
|
91
|
+
## Output Format
|
|
92
|
+
|
|
93
|
+
- Default: Human-readable text
|
|
94
|
+
- JSON: Add `-j` flag for structured data
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# MyCodeMap Skill
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Code analysis tool for TypeScript/JavaScript projects. Provides project structure analysis, symbol querying, dependency analysis, and impact assessment.
|
|
6
|
+
|
|
7
|
+
## CLI Command Detection
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Priority: global > local > npx
|
|
11
|
+
if command -v mycodemap &> /dev/null; then
|
|
12
|
+
CODEMAP_CMD="mycodemap"
|
|
13
|
+
elif [ -f "./node_modules/.bin/mycodemap" ]; then
|
|
14
|
+
CODEMAP_CMD="./node_modules/.bin/mycodemap"
|
|
15
|
+
else
|
|
16
|
+
CODEMAP_CMD="npx @mycodemap/mycodemap"
|
|
17
|
+
fi
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Available Commands
|
|
21
|
+
|
|
22
|
+
| Command | Purpose | Example |
|
|
23
|
+
|---------|---------|---------|
|
|
24
|
+
| `generate` | Generate code map | `$CODEMAP_CMD generate` |
|
|
25
|
+
| `query -s` | Query symbol | `$CODEMAP_CMD query -s "ClassName"` |
|
|
26
|
+
| `query -m` | Query module | `$CODEMAP_CMD query -m "src/parser"` |
|
|
27
|
+
| `query -S` | Fuzzy search | `$CODEMAP_CMD query -S "keyword"` |
|
|
28
|
+
| `deps` | Dependency analysis | `$CODEMAP_CMD deps -m "src/core"` |
|
|
29
|
+
| `impact` | Impact analysis | `$CODEMAP_CMD impact -f "src/index.ts"` |
|
|
30
|
+
| `cycles` | Cycle detection | `$CODEMAP_CMD cycles` |
|
|
31
|
+
| `complexity` | Complexity metrics | `$CODEMAP_CMD complexity` |
|
|
32
|
+
|
|
33
|
+
## Usage Patterns
|
|
34
|
+
|
|
35
|
+
### Pattern 1: Project Onboarding
|
|
36
|
+
```
|
|
37
|
+
User: "Explain this project structure"
|
|
38
|
+
Agent:
|
|
39
|
+
1. $CODEMAP_CMD generate
|
|
40
|
+
2. Read .mycodemap/AI_MAP.md
|
|
41
|
+
3. Summarize key components
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Pattern 2: Change Impact
|
|
45
|
+
```
|
|
46
|
+
User: "What happens if I modify X?"
|
|
47
|
+
Agent:
|
|
48
|
+
1. $CODEMAP_CMD impact -f "<path>" --transitive
|
|
49
|
+
2. Analyze output
|
|
50
|
+
3. List affected files and suggest tests
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Pattern 3: Code Navigation
|
|
54
|
+
```
|
|
55
|
+
User: "Where is function Y defined?"
|
|
56
|
+
Agent:
|
|
57
|
+
1. $CODEMAP_CMD query -s "Y"
|
|
58
|
+
2. Report location
|
|
59
|
+
3. Offer to show code context
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Best Practices
|
|
63
|
+
|
|
64
|
+
- Always generate code map before queries if `.mycodemap/` is stale
|
|
65
|
+
- Use `-j` flag for programmatic processing
|
|
66
|
+
- Use `--transitive` for complete impact analysis
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# MyCodeMap Integration
|
|
2
|
+
|
|
3
|
+
This project uses MyCodeMap for code analysis.
|
|
4
|
+
|
|
5
|
+
## Available Commands
|
|
6
|
+
|
|
7
|
+
Before answering questions about project structure, run:
|
|
8
|
+
```bash
|
|
9
|
+
mycodemap generate
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Then read `.mycodemap/AI_MAP.md` for context.
|
|
13
|
+
|
|
14
|
+
## Common Queries
|
|
15
|
+
|
|
16
|
+
- Find symbol: `mycodemap query -s "<name>"`
|
|
17
|
+
- Check dependencies: `mycodemap deps -m "<path>"`
|
|
18
|
+
- Impact analysis: `mycodemap impact -f "<path>"`
|
|
19
|
+
|
|
20
|
+
## When Answering
|
|
21
|
+
|
|
22
|
+
1. Always check the code map first for structural questions
|
|
23
|
+
2. Use impact analysis before suggesting changes
|
|
24
|
+
3. Reference specific files and line numbers
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codemap
|
|
3
|
+
description: MyCodeMap 代码分析技能,用于项目结构分析、符号查询、依赖分析和影响评估。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MyCodeMap Skill
|
|
7
|
+
|
|
8
|
+
## 环境检测
|
|
9
|
+
|
|
10
|
+
首先检测 CLI 是否可用:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# 检测全局安装的 mycodemap
|
|
14
|
+
if command -v mycodemap &> /dev/null; then
|
|
15
|
+
CODEMAP_CMD="mycodemap"
|
|
16
|
+
# 检测本地安装的 mycodemap
|
|
17
|
+
elif [ -f "./node_modules/.bin/mycodemap" ]; then
|
|
18
|
+
CODEMAP_CMD="./node_modules/.bin/mycodemap"
|
|
19
|
+
# 使用 npx
|
|
20
|
+
else
|
|
21
|
+
CODEMAP_CMD="npx @mycodemap/mycodemap"
|
|
22
|
+
fi
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 常用命令
|
|
26
|
+
|
|
27
|
+
### 生成代码地图
|
|
28
|
+
```bash
|
|
29
|
+
$CODEMAP_CMD generate
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 查询符号
|
|
33
|
+
```bash
|
|
34
|
+
$CODEMAP_CMD query -s "<symbol-name>"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 查询模块
|
|
38
|
+
```bash
|
|
39
|
+
$CODEMAP_CMD query -m "<module-path>"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 模糊搜索
|
|
43
|
+
```bash
|
|
44
|
+
$CODEMAP_CMD query -S "<keyword>" -l 10
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 依赖分析
|
|
48
|
+
```bash
|
|
49
|
+
$CODEMAP_CMD deps -m "<module-path>"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 影响范围分析
|
|
53
|
+
```bash
|
|
54
|
+
$CODEMAP_CMD impact -f "<file-path>"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 循环依赖检测
|
|
58
|
+
```bash
|
|
59
|
+
$CODEMAP_CMD cycles
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 复杂度分析
|
|
63
|
+
```bash
|
|
64
|
+
$CODEMAP_CMD complexity -f "<file-path>"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 使用场景
|
|
68
|
+
|
|
69
|
+
### 场景 1:理解项目结构
|
|
70
|
+
|
|
71
|
+
当用户询问项目结构或特定模块时:
|
|
72
|
+
1. 运行 `$CODEMAP_CMD generate` 生成最新代码地图
|
|
73
|
+
2. 阅读 `.mycodemap/AI_MAP.md` 获取项目概览
|
|
74
|
+
3. 根据需要使用 `query` 或 `deps` 获取详细信息
|
|
75
|
+
|
|
76
|
+
### 场景 2:代码变更影响分析
|
|
77
|
+
|
|
78
|
+
当用户要修改某个文件时:
|
|
79
|
+
1. 运行 `$CODEMAP_CMD impact -f "<file-path>" --transitive`
|
|
80
|
+
2. 分析输出结果,告知用户受影响的模块和文件
|
|
81
|
+
|
|
82
|
+
### 场景 3:查找代码定义
|
|
83
|
+
|
|
84
|
+
当用户询问某个类/函数的位置时:
|
|
85
|
+
1. 运行 `$CODEMAP_CMD query -s "<symbol-name>"`
|
|
86
|
+
2. 根据结果提供精确的文件路径和行号
|
|
87
|
+
|
|
88
|
+
## 输出处理
|
|
89
|
+
|
|
90
|
+
- 直接返回 CLI 输出给用户
|
|
91
|
+
- 使用 `-j` 参数获取 JSON 格式便于解析
|
|
92
|
+
- 复杂输出可重定向到临时文件分析
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mycodemap/mycodemap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "TypeScript 代码地图工具 - 为 AI 辅助开发提供结构化上下文",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist/",
|
|
17
|
+
"docs/",
|
|
18
|
+
"examples/",
|
|
17
19
|
"README.md",
|
|
18
20
|
"LICENSE",
|
|
19
21
|
"CHANGELOG.md",
|
|
@@ -25,10 +27,10 @@
|
|
|
25
27
|
"test": "vitest run",
|
|
26
28
|
"lint": "eslint src --ext .ts",
|
|
27
29
|
"typecheck": "tsc --noEmit",
|
|
28
|
-
"postinstall": "sh scripts/hooks/install-hooks.sh",
|
|
29
30
|
"benchmark": "bash scripts/run-benchmark.sh",
|
|
30
31
|
"test:all": "npm run test && npm run benchmark",
|
|
31
|
-
"prepublishOnly": "npm run build && npm test"
|
|
32
|
+
"prepublishOnly": "npm run build && npm test",
|
|
33
|
+
"validate-pack": "node scripts/validate-pack.js"
|
|
32
34
|
},
|
|
33
35
|
"keywords": [
|
|
34
36
|
"typescript",
|