@mycodemap/mycodemap 0.4.0 → 0.4.2
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 +45 -0
- package/README.md +214 -221
- package/dist/cli/commands/analyze-options.d.ts +36 -0
- package/dist/cli/commands/analyze-options.d.ts.map +1 -0
- package/dist/cli/commands/analyze-options.js +147 -0
- package/dist/cli/commands/analyze-options.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +93 -4
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +592 -176
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/ci.d.ts +47 -1
- package/dist/cli/commands/ci.d.ts.map +1 -1
- package/dist/cli/commands/ci.js +208 -1
- package/dist/cli/commands/ci.js.map +1 -1
- package/dist/cli/commands/export.d.ts.map +1 -1
- package/dist/cli/commands/export.js +2 -2
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/generate.d.ts +8 -2
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +151 -22
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +2 -13
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/ship/analyzer.d.ts +1 -1
- package/dist/cli/commands/ship/analyzer.d.ts.map +1 -1
- package/dist/cli/commands/ship/analyzer.js +8 -1
- package/dist/cli/commands/ship/analyzer.js.map +1 -1
- package/dist/cli/commands/ship/checker.d.ts +1 -1
- package/dist/cli/commands/ship/checker.d.ts.map +1 -1
- package/dist/cli/commands/ship/checker.js +17 -6
- package/dist/cli/commands/ship/checker.js.map +1 -1
- package/dist/cli/commands/ship/index.js +2 -2
- package/dist/cli/commands/ship/index.js.map +1 -1
- package/dist/cli/commands/ship/monitor.d.ts +17 -2
- package/dist/cli/commands/ship/monitor.d.ts.map +1 -1
- package/dist/cli/commands/ship/monitor.js +116 -29
- package/dist/cli/commands/ship/monitor.js.map +1 -1
- package/dist/cli/commands/ship/pipeline.d.ts.map +1 -1
- package/dist/cli/commands/ship/pipeline.js +97 -18
- package/dist/cli/commands/ship/pipeline.js.map +1 -1
- package/dist/cli/commands/ship/publisher.d.ts +12 -2
- package/dist/cli/commands/ship/publisher.d.ts.map +1 -1
- package/dist/cli/commands/ship/publisher.js +217 -37
- package/dist/cli/commands/ship/publisher.js.map +1 -1
- package/dist/cli/commands/ship/rules/quality-rules.d.ts +2 -2
- package/dist/cli/commands/ship/rules/quality-rules.d.ts.map +1 -1
- package/dist/cli/commands/ship/rules/quality-rules.js +53 -54
- package/dist/cli/commands/ship/rules/quality-rules.js.map +1 -1
- package/dist/cli/commands/ship/versioner.d.ts +1 -1
- package/dist/cli/commands/ship/versioner.d.ts.map +1 -1
- package/dist/cli/commands/ship/versioner.js +4 -2
- package/dist/cli/commands/ship/versioner.js.map +1 -1
- package/dist/cli/commands/workflow.js +4 -4
- package/dist/cli/commands/workflow.js.map +1 -1
- package/dist/cli/config-loader.d.ts +31 -0
- package/dist/cli/config-loader.d.ts.map +1 -0
- package/dist/cli/config-loader.js +235 -0
- package/dist/cli/config-loader.js.map +1 -0
- package/dist/cli/index.js +19 -64
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/removed-commands.d.ts +9 -0
- package/dist/cli/removed-commands.d.ts.map +1 -0
- package/dist/cli/removed-commands.js +48 -0
- package/dist/cli/removed-commands.js.map +1 -0
- package/dist/cli/storage-runtime.d.ts +8 -0
- package/dist/cli/storage-runtime.d.ts.map +1 -0
- package/dist/cli/storage-runtime.js +14 -0
- package/dist/cli/storage-runtime.js.map +1 -0
- package/dist/cli/tree-sitter-check.d.ts.map +1 -1
- package/dist/cli/tree-sitter-check.js +0 -1
- package/dist/cli/tree-sitter-check.js.map +1 -1
- package/dist/cli-new/commands/export.d.ts.map +1 -1
- package/dist/cli-new/commands/export.js +2 -2
- package/dist/cli-new/commands/export.js.map +1 -1
- package/dist/cli-new/commands/query.d.ts.map +1 -1
- package/dist/cli-new/commands/query.js +5 -4
- package/dist/cli-new/commands/query.js.map +1 -1
- package/dist/cli-new/index.d.ts.map +1 -1
- package/dist/cli-new/index.js +0 -2
- package/dist/cli-new/index.js.map +1 -1
- package/dist/core/analyzer.d.ts.map +1 -1
- package/dist/core/analyzer.js +7 -39
- package/dist/core/analyzer.js.map +1 -1
- package/dist/core/file-discovery.d.ts +17 -0
- package/dist/core/file-discovery.d.ts.map +1 -0
- package/dist/core/file-discovery.js +75 -0
- package/dist/core/file-discovery.js.map +1 -0
- package/dist/core/global-index.d.ts +5 -0
- package/dist/core/global-index.d.ts.map +1 -1
- package/dist/core/global-index.js +71 -21
- package/dist/core/global-index.js.map +1 -1
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +8 -0
- package/dist/generator/index.js.map +1 -1
- package/dist/infrastructure/parser/implementations/GoParser.d.ts +2 -5
- package/dist/infrastructure/parser/implementations/GoParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/GoParser.js +2 -5
- package/dist/infrastructure/parser/implementations/GoParser.js.map +1 -1
- package/dist/infrastructure/parser/implementations/PythonParser.d.ts +1 -5
- package/dist/infrastructure/parser/implementations/PythonParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/PythonParser.js +1 -5
- package/dist/infrastructure/parser/implementations/PythonParser.js.map +1 -1
- package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts +1 -5
- package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/TypeScriptParser.js +1 -5
- package/dist/infrastructure/parser/implementations/TypeScriptParser.js.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.d.ts +0 -1
- package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.js +4 -29
- package/dist/infrastructure/storage/StorageFactory.js.map +1 -1
- package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/FileSystemStorage.js +24 -137
- package/dist/infrastructure/storage/adapters/FileSystemStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts +10 -18
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.js +103 -146
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts +0 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.js +16 -136
- package/dist/infrastructure/storage/adapters/MemoryStorage.js.map +1 -1
- package/dist/infrastructure/storage/graph-helpers.d.ts +16 -0
- package/dist/infrastructure/storage/graph-helpers.d.ts.map +1 -0
- package/dist/infrastructure/storage/graph-helpers.js +161 -0
- package/dist/infrastructure/storage/graph-helpers.js.map +1 -0
- package/dist/infrastructure/storage/index.d.ts.map +1 -1
- package/dist/interface/config/index.d.ts +10 -1
- package/dist/interface/config/index.d.ts.map +1 -1
- package/dist/interface/types/index.d.ts +13 -0
- package/dist/interface/types/index.d.ts.map +1 -1
- package/dist/interface/types/storage.d.ts +1 -4
- package/dist/interface/types/storage.d.ts.map +1 -1
- package/dist/orchestrator/confidence.d.ts +9 -9
- package/dist/orchestrator/confidence.d.ts.map +1 -1
- package/dist/orchestrator/confidence.js +44 -67
- package/dist/orchestrator/confidence.js.map +1 -1
- package/dist/orchestrator/file-header-scanner.d.ts.map +1 -1
- package/dist/orchestrator/file-header-scanner.js +22 -31
- package/dist/orchestrator/file-header-scanner.js.map +1 -1
- package/dist/orchestrator/intent-router.d.ts +2 -11
- package/dist/orchestrator/intent-router.d.ts.map +1 -1
- package/dist/orchestrator/intent-router.js +58 -49
- package/dist/orchestrator/intent-router.js.map +1 -1
- package/dist/orchestrator/tool-orchestrator.d.ts.map +1 -1
- package/dist/orchestrator/tool-orchestrator.js +6 -4
- package/dist/orchestrator/tool-orchestrator.js.map +1 -1
- package/dist/orchestrator/types.d.ts +113 -2
- package/dist/orchestrator/types.d.ts.map +1 -1
- package/dist/orchestrator/types.js +29 -0
- package/dist/orchestrator/types.js.map +1 -1
- package/dist/orchestrator/workflow/config.d.ts +4 -12
- package/dist/orchestrator/workflow/config.d.ts.map +1 -1
- package/dist/orchestrator/workflow/config.js +4 -6
- package/dist/orchestrator/workflow/config.js.map +1 -1
- package/dist/orchestrator/workflow/git-analyzer.d.ts.map +1 -1
- package/dist/orchestrator/workflow/git-analyzer.js +9 -19
- package/dist/orchestrator/workflow/git-analyzer.js.map +1 -1
- package/dist/orchestrator/workflow/phase-inheritance.d.ts.map +1 -1
- package/dist/orchestrator/workflow/phase-inheritance.js +14 -23
- package/dist/orchestrator/workflow/phase-inheritance.js.map +1 -1
- package/dist/orchestrator/workflow/result-fusion.d.ts.map +1 -1
- package/dist/orchestrator/workflow/result-fusion.js +9 -11
- package/dist/orchestrator/workflow/result-fusion.js.map +1 -1
- package/dist/orchestrator/workflow/templates.d.ts +4 -1
- package/dist/orchestrator/workflow/templates.d.ts.map +1 -1
- package/dist/orchestrator/workflow/templates.js +49 -207
- package/dist/orchestrator/workflow/templates.js.map +1 -1
- package/dist/orchestrator/workflow/test-linker.d.ts.map +1 -1
- package/dist/orchestrator/workflow/test-linker.js +12 -24
- package/dist/orchestrator/workflow/test-linker.js.map +1 -1
- package/dist/orchestrator/workflow/types.d.ts +11 -8
- package/dist/orchestrator/workflow/types.d.ts.map +1 -1
- package/dist/orchestrator/workflow/types.js +8 -1
- package/dist/orchestrator/workflow/types.js.map +1 -1
- package/dist/orchestrator/workflow/visualizer.d.ts.map +1 -1
- package/dist/orchestrator/workflow/visualizer.js +7 -9
- package/dist/orchestrator/workflow/visualizer.js.map +1 -1
- package/dist/orchestrator/workflow/workflow-context.d.ts.map +1 -1
- package/dist/orchestrator/workflow/workflow-context.js +3 -5
- package/dist/orchestrator/workflow/workflow-context.js.map +1 -1
- package/dist/orchestrator/workflow/workflow-orchestrator.d.ts +0 -4
- package/dist/orchestrator/workflow/workflow-orchestrator.d.ts.map +1 -1
- package/dist/orchestrator/workflow/workflow-orchestrator.js +7 -99
- package/dist/orchestrator/workflow/workflow-orchestrator.js.map +1 -1
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +2 -2
- package/dist/parser/index.js.map +1 -1
- package/dist/plugins/index.d.ts +5 -3
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +19 -8
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/plugin-loader.d.ts +21 -6
- package/dist/plugins/plugin-loader.d.ts.map +1 -1
- package/dist/plugins/plugin-loader.js +170 -54
- package/dist/plugins/plugin-loader.js.map +1 -1
- package/dist/plugins/plugin-registry.d.ts +7 -4
- package/dist/plugins/plugin-registry.d.ts.map +1 -1
- package/dist/plugins/plugin-registry.js +62 -14
- package/dist/plugins/plugin-registry.js.map +1 -1
- package/dist/plugins/types.d.ts +16 -6
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js +2 -0
- package/dist/plugins/types.js.map +1 -1
- package/dist/server/handlers/AnalysisHandler.d.ts +16 -2
- package/dist/server/handlers/AnalysisHandler.d.ts.map +1 -1
- package/dist/server/handlers/AnalysisHandler.js +31 -47
- package/dist/server/handlers/AnalysisHandler.js.map +1 -1
- package/dist/server/routes/api.d.ts.map +1 -1
- package/dist/server/routes/api.js +31 -12
- package/dist/server/routes/api.js.map +1 -1
- package/docs/AI_ASSISTANT_SETUP.md +3 -1
- package/docs/PUBLISHING.md +18 -4
- package/docs/SETUP_GUIDE.md +41 -17
- package/docs/ai-guide/COMMANDS.md +107 -103
- package/docs/ai-guide/INTEGRATION.md +23 -21
- package/docs/ai-guide/OUTPUT.md +206 -10
- package/docs/ai-guide/PATTERNS.md +64 -15
- package/docs/ai-guide/PROMPTS.md +50 -12
- package/docs/ai-guide/QUICKSTART.md +35 -19
- package/docs/ai-guide/README.md +22 -4
- package/docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md +159 -434
- package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-PRD.md +169 -261
- package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md +201 -1259
- package/docs/product-specs/README.md +8 -1
- package/docs/rules/architecture-guardrails.md +1 -2
- package/docs/rules/engineering-with-codex-openai.md +15 -9
- package/docs/rules/validation.md +26 -4
- package/mycodemap.config.schema.json +76 -5
- package/package.json +1 -1
- package/scripts/pre-release-check.js +21 -3
- package/scripts/sync-analyze-docs.js +500 -0
- package/scripts/validate-ai-docs.js +54 -1
- package/scripts/validate-docs.js +746 -26
- package/dist/cli/commands/server.d.ts +0 -9
- package/dist/cli/commands/server.d.ts.map +0 -1
- package/dist/cli/commands/server.js +0 -68
- package/dist/cli/commands/server.js.map +0 -1
- package/dist/cli-new/commands/server.d.ts +0 -13
- package/dist/cli-new/commands/server.d.ts.map +0 -1
- package/dist/cli-new/commands/server.js +0 -94
- package/dist/cli-new/commands/server.js.map +0 -1
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts +0 -49
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts.map +0 -1
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js +0 -222
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js.map +0 -1
|
@@ -5,7 +5,14 @@
|
|
|
5
5
|
## 当前状态
|
|
6
6
|
|
|
7
7
|
- 截至 2026-03-15,历史重构需求草稿已归档到 `docs/archive/product-specs/`。
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
## 当前有效规格
|
|
10
|
+
|
|
11
|
+
- `MVP3-ARCHITECTURE-COMPARISON.md`:把历史设计目标与 `v1.3` 已落地基线并列,防止把愿景误写成现实。
|
|
12
|
+
- `MVP3-ARCHITECTURE-REDESIGN-PRD.md`:记录当前产品边界、Deferred 范围与用户价值。
|
|
13
|
+
- `MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md`:记录当前技术基线、目录现实、护栏与迁移语义。
|
|
14
|
+
|
|
15
|
+
> 以上 3 份规格目前都属于“已交付基线同步版”,不是新的待实施 roadmap。
|
|
9
16
|
|
|
10
17
|
## 应放内容
|
|
11
18
|
|
|
@@ -35,7 +35,7 @@ CodeMap 采用 **MVP3 分层架构**,各层职责如下:
|
|
|
35
35
|
├─────────────────────────────────────────────────────────────┤
|
|
36
36
|
│ Infrastructure Layer │
|
|
37
37
|
│ src/infrastructure/ - 技术实现细节 │
|
|
38
|
-
│ - storage/: FileSystemStorage, MemoryStorage, KuzuDBStorage
|
|
38
|
+
│ - storage/: FileSystemStorage, MemoryStorage, KuzuDBStorage
|
|
39
39
|
│ - parser/: TypeScriptParser, GoParser, PythonParser, ParserRegistry
|
|
40
40
|
│ - repositories/: CodeGraphRepositoryImpl(仓库接口实现) │
|
|
41
41
|
├─────────────────────────────────────────────────────────────┤
|
|
@@ -180,7 +180,6 @@ src/
|
|
|
180
180
|
FileSystemStorage.ts
|
|
181
181
|
MemoryStorage.ts
|
|
182
182
|
KuzuDBStorage.ts
|
|
183
|
-
Neo4jStorage.ts
|
|
184
183
|
StorageFactory.ts
|
|
185
184
|
parser/ # 解析器
|
|
186
185
|
interfaces/
|
|
@@ -45,11 +45,16 @@
|
|
|
45
45
|
- 仓库内调试与验证优先使用 `node dist/cli/index.js <command>`,因为当前真实 CLI 入口是 `dist/cli/index.js`。
|
|
46
46
|
- 需求澄清、影响分析、引用定位优先走 `query`、`analyze`、`deps`、`impact`,不要直接全仓漫游。
|
|
47
47
|
- 修改 `analyze`、`query`、`ci`、`workflow` 等高影响命令时,至少验证:
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
48
|
+
- `node dist/cli/index.js analyze --help` 与文档示例一致;
|
|
49
|
+
- `find` / `read` / `link` / `show` 中受影响的 public intent 可以在当前仓库运行;
|
|
50
|
+
- 若文档保留 legacy alias 说明,真实输出仍会返回 `warnings[]`;
|
|
51
|
+
- 若涉及机器输出,`--json` 与 `--structured --json` 仍保持纯 JSON 契约。
|
|
52
|
+
- 修改 `README.md`、`AI_GUIDE.md`、`docs/ai-guide/OUTPUT.md`、`ARCHITECTURE.md` 这类入口文档时,必须明确区分“目标产品基线”和“当前 CLI 现实”,尤其是 `Server Layer` / `mycodemap server` 的命名边界。
|
|
53
|
+
- 修改 `docs/product-specs/*` 现行规格时,必须同步 `docs/product-specs/README.md` 与 `scripts/validate-docs.js` 的高信号断言,避免规格正文和目录索引分叉。
|
|
51
54
|
- 若改动会影响 agent 执行手册、README 示例、测试事实或入口路由,先执行 `npm run docs:check`。
|
|
52
|
-
- 若希望通过统一 CLI 护栏入口执行同一检查,使用 `node dist/cli/index.js ci check-docs-sync`。
|
|
55
|
+
- 若希望通过统一 CLI 护栏入口执行同一检查,使用 `node dist/cli/index.js ci check-docs-sync`;该命令会同时执行 docs guardrail 与 `sync-analyze-docs.js --check`。
|
|
56
|
+
- `ci check-branch --allow` 支持 `*` 通配;在 CI / PR 环境中,分支识别会回退到 `GITHUB_HEAD_REF` / `GITHUB_REF_NAME`。
|
|
57
|
+
- `generate`、`analyze` 与 `ci check-headers -d` 共享 `.gitignore` 感知文件发现模块;没有 `.gitignore` 时回退到统一默认 `exclude`。
|
|
53
58
|
- 涉及发布边界时,再补 `npm run build` 与 `npm run validate-pack`;不要把本地临时产物当成发布事实。
|
|
54
59
|
|
|
55
60
|
## 5. 当前项目的 CI 护栏
|
|
@@ -59,7 +64,8 @@
|
|
|
59
64
|
- 当变更涉及 README、`docs/`、CLI 入口、测试配置或 CI 配置时,`.githooks/pre-commit` 还会执行 `npm run docs:check`。
|
|
60
65
|
- `.githooks/commit-msg` 会校验 `[TAG] scope: message` 格式与单次 commit 文件数量。
|
|
61
66
|
- 服务端护栏:
|
|
62
|
-
- `.github/workflows/ci-gateway.yml` 会执行 `npm run docs:check`、`npm run typecheck`、`npm test`、`npm run build
|
|
67
|
+
- `.github/workflows/ci-gateway.yml` 会执行 `npm run docs:check`、`npm run typecheck`、`npm test`、`npm run build`,并通过 `node dist/cli/index.js ci ...` 执行 `check-docs-sync`(含 docs guardrail + analyze generated block)、`check-commits`、`check-commit-size`、`check-headers`、`assess-risk`、`check-output-contract` 与 AI feed 同步检查。
|
|
68
|
+
- `check-working-tree`、`check-branch`、`check-scripts` 作为共享发布前 gate checks,由本地 `ci` 命令提供,`ship` 的 CHECK 阶段直接复用它们。
|
|
63
69
|
- `.github/workflows/publish.yml` 会在发布前执行 `npm test` 与 `npm run build`。
|
|
64
70
|
- 仓库协议仍然禁止通过 `--no-verify`、关闭 hook、放宽阈值、删除检查项来"修复"问题。
|
|
65
71
|
|
|
@@ -89,7 +95,7 @@ AI 生成代码时,以下模式触发**硬性阻断**:
|
|
|
89
95
|
│ src/cli/ - 命令行接口,注册命令、参数解析、用户交互 │
|
|
90
96
|
├─────────────────────────────────────────────────────────────┤
|
|
91
97
|
│ Server Layer │
|
|
92
|
-
│ src/server/ -
|
|
98
|
+
│ src/server/ - 内部 Server Layer / transport,Handler 处理 │
|
|
93
99
|
├─────────────────────────────────────────────────────────────┤
|
|
94
100
|
│ Domain Layer │
|
|
95
101
|
│ src/domain/ - 核心业务逻辑,领域实体与服务 │
|
|
@@ -100,7 +106,7 @@ AI 生成代码时,以下模式触发**硬性阻断**:
|
|
|
100
106
|
├─────────────────────────────────────────────────────────────┤
|
|
101
107
|
│ Infrastructure Layer │
|
|
102
108
|
│ src/infrastructure/ - 技术实现细节 │
|
|
103
|
-
│ - storage/: FileSystemStorage, MemoryStorage, KuzuDBStorage
|
|
109
|
+
│ - storage/: FileSystemStorage, MemoryStorage, KuzuDBStorage
|
|
104
110
|
│ - parser/: TypeScriptParser, GoParser, PythonParser, ParserRegistry
|
|
105
111
|
│ - repositories/: CodeGraphRepositoryImpl │
|
|
106
112
|
├─────────────────────────────────────────────────────────────┤
|
|
@@ -155,7 +161,7 @@ import type { IStorage } from '../interface/types/storage'; // 正确:只依
|
|
|
155
161
|
至少预演一个失败模式,而不是只验证 happy path。当前仓库已经出现过两类高信号风险:
|
|
156
162
|
|
|
157
163
|
- 文档漂移:例如测试规则曾与真实 `vitest.config.ts` 不一致,导致 agent 按旧规则执行错误命令。
|
|
158
|
-
- 文档检索盲区:当 `analyze
|
|
164
|
+
- 文档检索盲区:当 `analyze -i show` 无法命中文档概览时,agent 需要立即回退到 `rg` / 直接读文件,并在适用时记录 CodeMap 缺陷,而不是假装"没问题"。
|
|
159
165
|
|
|
160
166
|
## 10. 最小交付清单(更新版 - Harness 规范)
|
|
161
167
|
|
|
@@ -177,7 +183,7 @@ import type { IStorage } from '../interface/types/storage'; // 正确:只依
|
|
|
177
183
|
| 你的改动 | 必须更新的文档 |
|
|
178
184
|
|---------|--------------|
|
|
179
185
|
| 新增/修改 CLI 命令或参数 | `CLAUDE.md`、`docs/rules/engineering-with-codex-openai.md` |
|
|
180
|
-
| 新增/修改配置项或 Schema | `README.md`、相关配置示例 |
|
|
186
|
+
| 新增/修改配置项或 Schema | `README.md`、`docs/SETUP_GUIDE.md`、`docs/AI_ASSISTANT_SETUP.md`、相关配置示例 |
|
|
181
187
|
| 修改类型定义/公共接口 | 接口注释、`docs/rules/` 中相关文档 |
|
|
182
188
|
| 修改 CI/CD 流程 | `docs/rules/validation.md`、`.github/workflows/` |
|
|
183
189
|
| 修改 Git Hooks | `docs/rules/validation.md` |
|
package/docs/rules/validation.md
CHANGED
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
1. 先验证与你改动最相关的命令、测试或模块。
|
|
6
6
|
2. 若改动影响 agent 路由、CLI 示例、规则文档或测试事实,先执行 `npm run docs:check`。
|
|
7
|
-
3. 若改动同时影响 CLI 护栏入口,再补 `node dist/cli/index.js ci check-docs-sync
|
|
8
|
-
4.
|
|
9
|
-
5.
|
|
7
|
+
3. 若改动同时影响 CLI 护栏入口,再补 `node dist/cli/index.js ci check-docs-sync`;该命令会串联 docs guardrail 与 analyze generated block 校验。
|
|
8
|
+
4. 若改动涉及 `analyze` canonical 示例、选项表或 `AI_GUIDE.md` 速查模板,优先用 `node scripts/sync-analyze-docs.js --check` 直接定位 generated block 漂移。
|
|
9
|
+
5. 若改动涉及产品定位、输出契约、共享文件发现规则或 `Server Layer` / `mycodemap server` 边界,确认 README、AI 文档、架构文档和 guardrail 脚本使用同一套措辞。
|
|
10
|
+
6. 若改动涉及 `docs/product-specs/*` 的现行规格,确认 `docs/product-specs/README.md`、相关规格文档与 `scripts/validate-docs.js` 同步;当前 docs guardrail 会显式校验 MVP3 三份架构规格的 shipped baseline 表述。
|
|
11
|
+
7. 若改动涉及 `mycodemap.config.json.storage` 或图数据库适配器,至少补跑对应 storage adapter 定点测试,并确认 `README.md`、`AI_GUIDE.md`、`docs/ai-guide/COMMANDS.md`、`docs/SETUP_GUIDE.md`、`mycodemap.config.schema.json` 与 guardrail 脚本同步。
|
|
12
|
+
8. 再扩大到 `npm run typecheck`、`npm run lint`、`npm test`。
|
|
13
|
+
9. 涉及发布或打包时,再执行 `npm run build` 与 `npm run validate-pack`。
|
|
10
14
|
|
|
11
15
|
## CI Gateway 验证流程
|
|
12
16
|
|
|
@@ -17,7 +21,9 @@ CI Gateway 已集成以下自动检查(按执行顺序):
|
|
|
17
21
|
3. `npm run lint` - ESLint 代码质量检查(渐进式规则,0 error 通过)
|
|
18
22
|
4. `npm test` - 单元测试
|
|
19
23
|
5. `npm run build` - 构建验证
|
|
20
|
-
6. CLI
|
|
24
|
+
6. CLI 相关检查(当前 CI Gateway 直接执行 `check-docs-sync`、commit 格式、文件头、risk、output contract;`ship` 的本地 CHECK 阶段复用 `check-working-tree`、`check-branch`、`check-scripts`)
|
|
25
|
+
|
|
26
|
+
> 当前 `check-docs-sync` 会串联 docs guardrail 与 analyze generated block 校验。
|
|
21
27
|
|
|
22
28
|
## 强约束
|
|
23
29
|
|
|
@@ -26,11 +32,27 @@ CI Gateway 已集成以下自动检查(按执行顺序):
|
|
|
26
32
|
- 涉及 CI / hooks / 输出契约时,必须给出失败场景与修复验证证据。
|
|
27
33
|
- 严禁使用 `--no-verify`、禁用 hooks、删除检查项规避失败。
|
|
28
34
|
|
|
35
|
+
## 典型失败模式
|
|
36
|
+
|
|
37
|
+
- 入口文档改成 AI-first,但 `scripts/validate-docs.js` 仍检查旧措辞 → `npm run docs:check` 失败。
|
|
38
|
+
- 把 `Server Layer` 和公共 `mycodemap server` 命令混写成同一件事 → 架构文档与命令文档发生边界漂移。
|
|
39
|
+
- 手改 `README.md`、`docs/ai-guide/COMMANDS.md` 或 `AI_GUIDE.md` 的 `analyze` canonical 代码块 / 选项表 / 速查模板,却没同步 generated block → `node scripts/sync-analyze-docs.js --check` 失败。
|
|
40
|
+
- 文档声称扫描类命令会尊重 `.gitignore`,但实现仍保留手写跳过规则 → `analyze` 与 `check-headers -d` 的文件集合漂移。
|
|
41
|
+
- 把 `workflow` 重新扩回非分析阶段,却没同步 README / AI 命令文档 / guardrail 脚本 → `npm run docs:check` 失败。
|
|
42
|
+
- `docs/product-specs/README.md` 仍写“当前活跃产品规格暂为空”,但目录里已经有现行规格 → 目录索引与规格正文自相矛盾。
|
|
43
|
+
- MVP3 规格文档继续把历史设计愿景写成当前现实(例如把 `neo4j`、14 种语言或公共 `server` 产品面写回去)→ `npm run docs:check` 失败。
|
|
44
|
+
- `config-loader` 已支持 `storage`,但 schema / README / AI 文档没同步 → 用户能写配置,编辑器和 guardrail 却仍把它当非法字段。
|
|
45
|
+
- 旧的 `neo4j` 配置已经不受支持,但文档还把它写成正式 backend,或缺少 `kuzu` 时却被文档写成会自动 fallback → 现场排障方向错误,误判为实现 bug。
|
|
46
|
+
|
|
29
47
|
## 常用命令
|
|
30
48
|
|
|
31
49
|
```bash
|
|
32
50
|
npm run docs:check
|
|
51
|
+
node scripts/sync-analyze-docs.js --check
|
|
33
52
|
node dist/cli/index.js ci check-docs-sync
|
|
53
|
+
node dist/cli/index.js ci check-working-tree
|
|
54
|
+
node dist/cli/index.js ci check-branch
|
|
55
|
+
SHIP_IN_CI=1 node dist/cli/index.js ci check-scripts
|
|
34
56
|
npm run typecheck
|
|
35
57
|
npm test
|
|
36
58
|
npm run lint
|
|
@@ -5,18 +5,22 @@
|
|
|
5
5
|
"description": "Configuration schema for MyCodeMap CLI tool",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
+
"$schema": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "JSON Schema reference for editor tooling"
|
|
11
|
+
},
|
|
8
12
|
"mode": {
|
|
9
13
|
"type": "string",
|
|
10
|
-
"enum": ["fast", "smart"],
|
|
11
|
-
"default": "
|
|
12
|
-
"description": "Parsing mode: fast (regex-based)
|
|
14
|
+
"enum": ["fast", "smart", "hybrid"],
|
|
15
|
+
"default": "hybrid",
|
|
16
|
+
"description": "Parsing mode: fast (regex-based), smart (TypeScript AST), or hybrid (auto-select)"
|
|
13
17
|
},
|
|
14
18
|
"include": {
|
|
15
19
|
"type": "array",
|
|
16
20
|
"items": {
|
|
17
21
|
"type": "string"
|
|
18
22
|
},
|
|
19
|
-
"default": ["src
|
|
23
|
+
"default": ["src/**/*.ts"],
|
|
20
24
|
"description": "Glob patterns to include"
|
|
21
25
|
},
|
|
22
26
|
"exclude": {
|
|
@@ -24,7 +28,7 @@
|
|
|
24
28
|
"items": {
|
|
25
29
|
"type": "string"
|
|
26
30
|
},
|
|
27
|
-
"default": ["node_modules/**", "dist/**", "**/*.test.ts", "**/*.spec.ts"],
|
|
31
|
+
"default": ["node_modules/**", "dist/**", "build/**", "coverage/**", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"],
|
|
28
32
|
"description": "Glob patterns to exclude"
|
|
29
33
|
},
|
|
30
34
|
"output": {
|
|
@@ -36,6 +40,73 @@
|
|
|
36
40
|
"type": "boolean",
|
|
37
41
|
"default": false,
|
|
38
42
|
"description": "Enable watch mode for file changes"
|
|
43
|
+
},
|
|
44
|
+
"storage": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"description": "Graph storage backend configuration",
|
|
47
|
+
"properties": {
|
|
48
|
+
"type": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"enum": ["filesystem", "kuzudb", "memory", "auto"],
|
|
51
|
+
"default": "filesystem",
|
|
52
|
+
"description": "Storage backend type (Neo4j is no longer supported)"
|
|
53
|
+
},
|
|
54
|
+
"outputPath": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"default": ".codemap/storage",
|
|
57
|
+
"description": "Filesystem storage directory"
|
|
58
|
+
},
|
|
59
|
+
"databasePath": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "KùzuDB database directory relative to project root"
|
|
62
|
+
},
|
|
63
|
+
"autoThresholds": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"description": "Thresholds for auto backend selection",
|
|
66
|
+
"properties": {
|
|
67
|
+
"useGraphDBWhenFileCount": {
|
|
68
|
+
"type": "number",
|
|
69
|
+
"description": "Prefer graph DB when file count reaches this threshold"
|
|
70
|
+
},
|
|
71
|
+
"useGraphDBWhenNodeCount": {
|
|
72
|
+
"type": "number",
|
|
73
|
+
"description": "Prefer graph DB when graph node count reaches this threshold"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"required": ["useGraphDBWhenFileCount", "useGraphDBWhenNodeCount"],
|
|
77
|
+
"additionalProperties": false
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"additionalProperties": false
|
|
81
|
+
},
|
|
82
|
+
"plugins": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"description": "Plugin loading options",
|
|
85
|
+
"properties": {
|
|
86
|
+
"builtInPlugins": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"default": true,
|
|
89
|
+
"description": "Enable built-in plugins"
|
|
90
|
+
},
|
|
91
|
+
"pluginDir": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "Additional plugin directory"
|
|
94
|
+
},
|
|
95
|
+
"plugins": {
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": {
|
|
98
|
+
"type": "string"
|
|
99
|
+
},
|
|
100
|
+
"default": [],
|
|
101
|
+
"description": "Named plugins to load explicitly"
|
|
102
|
+
},
|
|
103
|
+
"debug": {
|
|
104
|
+
"type": "boolean",
|
|
105
|
+
"default": false,
|
|
106
|
+
"description": "Enable plugin debug logging"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"additionalProperties": false
|
|
39
110
|
}
|
|
40
111
|
},
|
|
41
112
|
"additionalProperties": false
|
package/package.json
CHANGED
|
@@ -94,9 +94,19 @@ function getFileSize(filePath) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function extractVersionFromText(content) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
const patterns = [
|
|
98
|
+
/(?:version|版本)[:\s]+v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i,
|
|
99
|
+
/"version"\s*:\s*"(\d+\.\d+\.\d+(?:-[\w.]+)?)"/i
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
for (const pattern of patterns) {
|
|
103
|
+
const match = content.match(pattern);
|
|
104
|
+
if (match) {
|
|
105
|
+
return match[1];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return null;
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
function extractVersionFromYAML(content) {
|
|
@@ -238,6 +248,11 @@ async function checkVersionConsistency(failures) {
|
|
|
238
248
|
versions[file] = version;
|
|
239
249
|
console.log(` 📄 ${file}: v${version}`);
|
|
240
250
|
} else {
|
|
251
|
+
failures.push({
|
|
252
|
+
type: 'missing_version_in_file',
|
|
253
|
+
file,
|
|
254
|
+
message: `${file} 中未找到可解析的版本号`,
|
|
255
|
+
});
|
|
241
256
|
console.log(yellow(` ⚠️ ${file}: 未找到版本号`));
|
|
242
257
|
}
|
|
243
258
|
}
|
|
@@ -655,7 +670,10 @@ async function runPreReleaseChecks() {
|
|
|
655
670
|
f.type === 'missing_required_file' ||
|
|
656
671
|
f.type === 'missing_llms_txt' ||
|
|
657
672
|
f.type === 'version_mismatch' ||
|
|
673
|
+
f.type === 'missing_version_in_file' ||
|
|
674
|
+
f.type === 'invalid_semver' ||
|
|
658
675
|
f.type === 'llms_txt_standard_violation' ||
|
|
676
|
+
f.type === 'changelog_not_synced' ||
|
|
659
677
|
f.type === 'missing_release_file'
|
|
660
678
|
);
|
|
661
679
|
|