@mycodemap/mycodemap 0.5.1 → 1.9.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 +26 -0
- package/README.md +84 -10
- package/dist/cli/commands/init.d.ts +7 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +22 -34
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/publish-status.d.ts +31 -0
- package/dist/cli/commands/publish-status.d.ts.map +1 -0
- package/dist/cli/commands/publish-status.js +101 -0
- package/dist/cli/commands/publish-status.js.map +1 -0
- package/dist/cli/commands/readiness-gate.d.ts +25 -0
- package/dist/cli/commands/readiness-gate.d.ts.map +1 -0
- package/dist/cli/commands/readiness-gate.js +197 -0
- package/dist/cli/commands/readiness-gate.js.map +1 -0
- package/dist/cli/commands/ship/checker.d.ts +4 -9
- package/dist/cli/commands/ship/checker.d.ts.map +1 -1
- package/dist/cli/commands/ship/checker.js +60 -22
- package/dist/cli/commands/ship/checker.js.map +1 -1
- package/dist/cli/commands/ship/monitor.d.ts +6 -1
- package/dist/cli/commands/ship/monitor.d.ts.map +1 -1
- package/dist/cli/commands/ship/monitor.js +223 -46
- 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 +14 -5
- package/dist/cli/commands/ship/pipeline.js.map +1 -1
- package/dist/cli/commands/ship/rules/quality-rules.d.ts +12 -8
- package/dist/cli/commands/ship/rules/quality-rules.d.ts.map +1 -1
- package/dist/cli/commands/ship/rules/quality-rules.js +49 -34
- package/dist/cli/commands/ship/rules/quality-rules.js.map +1 -1
- package/dist/cli/config-loader.js +1 -1
- package/dist/cli/config-loader.js.map +1 -1
- package/dist/cli/first-run-guide.d.ts.map +1 -1
- package/dist/cli/first-run-guide.js +10 -12
- package/dist/cli/first-run-guide.js.map +1 -1
- package/dist/cli/index.js +8 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/hooks.d.ts +17 -0
- package/dist/cli/init/hooks.d.ts.map +1 -0
- package/dist/cli/init/hooks.js +220 -0
- package/dist/cli/init/hooks.js.map +1 -0
- package/dist/cli/init/receipt.d.ts +4 -0
- package/dist/cli/init/receipt.d.ts.map +1 -0
- package/dist/cli/init/receipt.js +117 -0
- package/dist/cli/init/receipt.js.map +1 -0
- package/dist/cli/init/reconciler.d.ts +44 -0
- package/dist/cli/init/reconciler.d.ts.map +1 -0
- package/dist/cli/init/reconciler.js +377 -0
- package/dist/cli/init/reconciler.js.map +1 -0
- package/dist/cli/init/rule-templates.d.ts +9 -0
- package/dist/cli/init/rule-templates.d.ts.map +1 -0
- package/dist/cli/init/rule-templates.js +105 -0
- package/dist/cli/init/rule-templates.js.map +1 -0
- package/dist/cli/init/rules.d.ts +13 -0
- package/dist/cli/init/rules.d.ts.map +1 -0
- package/dist/cli/init/rules.js +113 -0
- package/dist/cli/init/rules.js.map +1 -0
- package/dist/cli/paths.d.ts +4 -2
- package/dist/cli/paths.d.ts.map +1 -1
- package/dist/cli/paths.js +13 -5
- package/dist/cli/paths.js.map +1 -1
- package/dist/orchestrator/test-linker.d.ts.map +1 -1
- package/dist/orchestrator/test-linker.js +5 -36
- package/dist/orchestrator/test-linker.js.map +1 -1
- package/docs/AI_ASSISTANT_SETUP.md +4 -2
- package/docs/PUBLISHING.md +41 -12
- package/docs/SETUP_GUIDE.md +12 -12
- package/docs/agents/domain.md +36 -0
- package/docs/agents/issue-tracker.md +22 -0
- package/docs/agents/triage-labels.md +15 -0
- package/docs/ai-guide/COMMANDS.md +57 -3
- package/docs/ai-guide/INTEGRATION.md +1 -1
- package/docs/ai-guide/PATTERNS.md +3 -3
- package/docs/ai-guide/QUICKSTART.md +13 -4
- package/docs/ai-guide/README.md +7 -7
- package/docs/archive/ideation/2026-04-22-harness-rules-entry-docs-optimization-ideation.md +102 -0
- package/docs/archive/ideation/2026-04-22-rules-claude-agents-optimization-ideation.md +107 -0
- package/docs/brainstorms/2026-04-22-rules-entry-docs-phase1-structure-consolidation-requirements.md +110 -0
- package/docs/brainstorms/999.1-mycodemap-init-enhancements-requirements.md +166 -0
- package/docs/exec-plans/README.md +3 -0
- package/docs/ideation/2026-04-20-mycodemap-init-enhancements-ideation.md +96 -0
- package/docs/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation.md +119 -0
- package/docs/lesson-learn/2026-04-19-prerelease-trusted-publishing-fix.md +119 -0
- package/docs/lesson-learn/image.png +0 -0
- package/docs/rules/README.md +4 -1
- package/docs/rules/deployment.md +7 -0
- package/docs/rules/engineering-with-codex-openai.md +47 -8
- package/docs/rules/pre-release-checklist.md +53 -37
- package/docs/rules/release.md +303 -0
- package/docs/rules/testing.md +19 -0
- package/docs/rules/validation.md +18 -8
- package/mycodemap.config.schema.json +1 -1
- package/package.json +3 -3
- package/scripts/hooks/templates/commit-msg +38 -0
- package/scripts/hooks/templates/pre-commit +224 -0
- package/scripts/pre-release-check.js +6 -6
- package/scripts/release.sh +1 -1
- package/scripts/validate-docs.js +283 -14
- package/dist/ai/claude.d.ts +0 -38
- package/dist/ai/claude.d.ts.map +0 -1
- package/dist/ai/claude.js +0 -169
- package/dist/ai/claude.js.map +0 -1
- package/dist/ai/codex.d.ts +0 -38
- package/dist/ai/codex.d.ts.map +0 -1
- package/dist/ai/codex.js +0 -169
- package/dist/ai/codex.js.map +0 -1
- package/dist/ai/factory.d.ts +0 -48
- package/dist/ai/factory.d.ts.map +0 -1
- package/dist/ai/factory.js +0 -95
- package/dist/ai/factory.js.map +0 -1
- package/dist/ai/index.d.ts +0 -12
- package/dist/ai/index.d.ts.map +0 -1
- package/dist/ai/index.js +0 -29
- package/dist/ai/index.js.map +0 -1
- package/dist/ai/provider.d.ts +0 -70
- package/dist/ai/provider.d.ts.map +0 -1
- package/dist/ai/provider.js +0 -31
- package/dist/ai/provider.js.map +0 -1
- package/dist/ai/subagent-caller.d.ts +0 -90
- package/dist/ai/subagent-caller.d.ts.map +0 -1
- package/dist/ai/subagent-caller.js +0 -280
- package/dist/ai/subagent-caller.js.map +0 -1
- package/dist/ai/types.d.ts +0 -70
- package/dist/ai/types.d.ts.map +0 -1
- package/dist/ai/types.js +0 -5
- package/dist/ai/types.js.map +0 -1
- 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 -65
- 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 -90
- package/dist/cli-new/commands/server.js.map +0 -1
- package/dist/generator/ai-overview.d.ts +0 -51
- package/dist/generator/ai-overview.d.ts.map +0 -1
- package/dist/generator/ai-overview.js +0 -160
- package/dist/generator/ai-overview.js.map +0 -1
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts +0 -41
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts.map +0 -1
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js +0 -162
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js.map +0 -1
- package/dist/orchestrator/ai-feed-generator.d.ts +0 -210
- package/dist/orchestrator/ai-feed-generator.d.ts.map +0 -1
- package/dist/orchestrator/ai-feed-generator.js +0 -377
- package/dist/orchestrator/ai-feed-generator.js.map +0 -1
- package/docs/archive/test-report-symbol-search.md +0 -384
- package/docs/archive/test-scenario-4-complexity-analysis.md +0 -460
- package/docs/archive/test_report_scenario5.md +0 -615
- package/docs/archive/test_scenario_3_impact_analysis_report.md +0 -520
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
1. **T0-地图层**(始终提供):架构说明、类型定义、关键约束文件
|
|
27
27
|
- `AGENTS.md`(仓库级强约束)
|
|
28
|
-
- `CLAUDE.md
|
|
28
|
+
- `CLAUDE.md`(入口路由)
|
|
29
29
|
- `src/types/index.ts`(核心类型)
|
|
30
30
|
|
|
31
31
|
2. **T1-任务相关层**(动态检索):通过 CodeMap CLI 或文件路径匹配提供
|
|
@@ -64,13 +64,20 @@
|
|
|
64
64
|
- 若涉及机器输出,`--json` 与 `--structured --json` 仍保持纯 JSON 契约。
|
|
65
65
|
- 修改 `README.md`、`AI_GUIDE.md`、`docs/ai-guide/OUTPUT.md`、`ARCHITECTURE.md` 这类入口文档时,必须明确区分“目标产品基线”和“当前 CLI 现实”,尤其是 `Server Layer` / `mycodemap server` 的命名边界。
|
|
66
66
|
- 修改 `docs/product-specs/*` 现行规格时,必须同步 `docs/product-specs/README.md` 与 `scripts/validate-docs.js` 的高信号断言,避免规格正文和目录索引分叉;`docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md` 也属于这一约束。
|
|
67
|
-
-
|
|
67
|
+
- 若改动会影响入口路由、README 示例、测试事实或 AI / agent 的文档发现路径,先执行 `npm run docs:check`。
|
|
68
68
|
- 若希望通过统一 CLI 护栏入口执行同一检查,使用 `node dist/cli/index.js ci check-docs-sync`;该命令会同时执行 docs guardrail 与 `sync-analyze-docs.js --check`。
|
|
69
69
|
- 若改动涉及 repo-root contract 或 CI gate,确认 `.github/workflows/ci-gateway.yml` 中的 `node dist/cli/index.js check --contract mycodemap.design.md --against src` 仍保持 PR 显式 base / push full scan 语义。
|
|
70
70
|
- `ci check-branch --allow` 支持 `*` 通配;在 CI / PR 环境中,分支识别会回退到 `GITHUB_HEAD_REF` / `GITHUB_REF_NAME`。
|
|
71
71
|
- `generate`、`analyze` 与 `ci check-headers -d` 共享 `.gitignore` 感知文件发现模块;没有 `.gitignore` 时回退到统一默认 `exclude`。
|
|
72
72
|
- 涉及发布边界时,再补 `npm run build` 与 `npm run validate-pack`;不要把本地临时产物当成发布事实。
|
|
73
73
|
|
|
74
|
+
## 4.1 Validation quick truth
|
|
75
|
+
|
|
76
|
+
- 文档/入口变更先跑 `npm run docs:check`。
|
|
77
|
+
- 统一 docs/AI guardrail 入口:`node dist/cli/index.js ci check-docs-sync`(产品命令等价于 `mycodemap ci check-docs-sync`)。
|
|
78
|
+
- repo-local rules 预检:`python3 scripts/validate-rules.py code --report-only` 只报告,不阻断。
|
|
79
|
+
- CI / PR 超窗、fallback 或 false-positive 漂移时,`warn-only / fallback` 不是 hard gate success。
|
|
80
|
+
|
|
74
81
|
## 5. 当前项目的 CI 护栏
|
|
75
82
|
|
|
76
83
|
- 本地护栏:
|
|
@@ -80,9 +87,9 @@
|
|
|
80
87
|
- `.githooks/commit-msg` 只校验 `[TAG] scope: message` 格式;单次 commit 文件数量限制只保留在 `.githooks/pre-commit`。
|
|
81
88
|
- 服务端护栏:
|
|
82
89
|
- `.github/workflows/ci-gateway.yml` 包含固定命名的 `Rule validation backstop` step;即使本地使用 `git commit --no-verify` 绕过 hooks,CI 仍会运行 `python3 scripts/validate-rules.py code`,并仅在退出码 `1` 或 `4` 时 fail,`2/3` 只输出 warn-only / notice-only。
|
|
83
|
-
- `.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 同步检查。
|
|
90
|
+
- `.github/workflows/ci-gateway.yml` 会执行 `npm run docs:check`、`npm run typecheck`、`npm test`、`npm run test:e2e`、`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 同步检查。
|
|
84
91
|
- `check-working-tree`、`check-branch`、`check-scripts` 作为共享发布前 gate checks,由本地 `ci` 命令提供,`ship` 的 CHECK 阶段直接复用它们。
|
|
85
|
-
- `.github/workflows/publish.yml` 会在发布前执行 `npm test` 与 `npm run build`。
|
|
92
|
+
- `.github/workflows/publish.yml` 会在发布前执行 `npm test`、`npm run test:e2e` 与 `npm run build`。
|
|
86
93
|
- 禁止依赖 `git commit --no-verify` 作为解决方案;它只能跳过本地 hooks,不能绕过 CI 中的 `Rule validation backstop`。
|
|
87
94
|
- 仓库协议仍然禁止通过 `--no-verify`、关闭 hook、放宽阈值、删除检查项来"修复"问题。
|
|
88
95
|
|
|
@@ -199,25 +206,57 @@ import type { IStorage } from '../interface/types/storage'; // 正确:只依
|
|
|
199
206
|
|
|
200
207
|
| 你的改动 | 必须更新的文档 |
|
|
201
208
|
|---------|--------------|
|
|
202
|
-
| 新增/修改 CLI 命令或参数 | `
|
|
209
|
+
| 新增/修改 CLI 命令或参数 | `AI_GUIDE.md`、`docs/ai-guide/COMMANDS.md`、必要时同步 `CLAUDE.md` 路由 |
|
|
203
210
|
| 新增/修改配置项或 Schema | `README.md`、`docs/SETUP_GUIDE.md`、`docs/AI_ASSISTANT_SETUP.md`、相关配置示例 |
|
|
204
211
|
| 修改类型定义/公共接口 | 接口注释、`docs/rules/` 中相关文档 |
|
|
205
212
|
| 修改 CI/CD 流程 | `docs/rules/validation.md`、`.github/workflows/` |
|
|
206
213
|
| 修改 Git Hooks | `docs/rules/validation.md` |
|
|
207
214
|
| 修改测试规则/覆盖率要求 | `docs/rules/testing.md` |
|
|
208
|
-
| 修改架构分层或依赖规则 | `ARCHITECTURE.md`、`docs/rules/architecture-guardrails.md` |
|
|
215
|
+
| 修改架构分层或依赖规则 | `ARCHITECTURE.md`、`docs/rules/architecture-guardrails.md`、必要时同步 `CLAUDE.md` / `AI_GUIDE.md` 导航 |
|
|
209
216
|
| 新增代码质量红线 | `docs/rules/code-quality-redlines.md` |
|
|
210
|
-
|
|
|
217
|
+
| 修改输出格式 / 机器契约 | `AI_GUIDE.md`、`docs/ai-guide/OUTPUT.md` |
|
|
218
|
+
| 新增使用模式 / 工作流模式 | `AI_GUIDE.md`、`docs/ai-guide/PATTERNS.md` |
|
|
219
|
+
| 修改提交格式规范或仓库级底线 | `AGENTS.md` |
|
|
211
220
|
| 发现文档与代码不符 | 立即修复对应文档 |
|
|
212
221
|
|
|
213
222
|
**原则**:若改动会影响其他开发者或 AI 的行为,就必须更新文档。
|
|
214
223
|
|
|
224
|
+
### 10.3 任务初始化最小模板
|
|
225
|
+
|
|
226
|
+
当入口路由把你导向本文件时,默认用下面这份最小模板启动任务;不要再把模板写回 `CLAUDE.md` 或 `.claude/CLAUDE.md`。
|
|
227
|
+
|
|
228
|
+
```markdown
|
|
229
|
+
## 任务分析
|
|
230
|
+
- 目标:一句话说明要交付什么
|
|
231
|
+
- 类型:新增 / 修复 / 重构 / 文档 / 其他
|
|
232
|
+
- 等级:L0 / L1 / L2 / L3
|
|
233
|
+
- 验收:最小可验证结果
|
|
234
|
+
|
|
235
|
+
## 执行计划
|
|
236
|
+
1. [Plan] 明确边界与影响范围 → verify: 最小相关检查
|
|
237
|
+
2. [Build] 落地改动 → verify: 定点验证
|
|
238
|
+
3. [Verify] 扩大验证 → verify: docs / typecheck / lint / test / build
|
|
239
|
+
4. [Report] 说明变更、验证、风险、文档同步
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### 10.4 AI 友好文档补充
|
|
243
|
+
|
|
244
|
+
更新或创建面向 AI / agent 的文档时,至少满足以下约束:
|
|
245
|
+
|
|
246
|
+
- 结构清晰:使用稳定标题层级,避免把多个主题混在一个巨段里。
|
|
247
|
+
- 决策可路由:复杂流程优先提供表格、决策树或“场景 → 文档 / 命令”映射。
|
|
248
|
+
- 示例可复制:命令块和 JSON / TypeScript 示例必须能直接复用,不写伪代码占位。
|
|
249
|
+
- 契约可解析:机器输出变更时同步更新 `docs/ai-guide/OUTPUT.md`,必要时补 TypeScript 接口。
|
|
250
|
+
- 模式可发现:新增典型工作流时同步更新 `docs/ai-guide/PATTERNS.md` 或 `PROMPTS.md`。
|
|
251
|
+
- 错误可恢复:常见失败模式必须给出排查入口或恢复方式。
|
|
252
|
+
- 链接可导航:入口文档负责指路,规则正文只在 authoritative docs 维护一次。
|
|
253
|
+
|
|
215
254
|
## 11. 参考来源
|
|
216
255
|
|
|
217
256
|
- OpenAI Engineering: https://openai.com/engineering/codex/
|
|
218
257
|
- Harness Engineering 方法论:`docs/references/tmp.md`
|
|
219
258
|
- 仓库入口协议:`AGENTS.md`
|
|
220
|
-
-
|
|
259
|
+
- 入口路由:`CLAUDE.md`
|
|
221
260
|
- 架构地图:`ARCHITECTURE.md`
|
|
222
261
|
- 当前验证规则:`docs/rules/validation.md`
|
|
223
262
|
- 当前发布规则:`docs/rules/deployment.md`
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
- 所有文件版本号必须完全一致
|
|
79
79
|
- 必须符合语义化版本规范 (`x.x.x`)
|
|
80
80
|
- 预发布版本可包含后缀 (`0.2.0-beta.1`)
|
|
81
|
+
- 预发布版本发布到 npm 时必须显式传 dist-tag(例如 `0.2.0-beta.1 -> --tag beta`)
|
|
81
82
|
|
|
82
83
|
**版本同步清单**:
|
|
83
84
|
|
|
@@ -158,24 +159,31 @@
|
|
|
158
159
|
- [ ] 远程 tag 是否已推送
|
|
159
160
|
- [ ] 当前分支是否为 main/master
|
|
160
161
|
|
|
161
|
-
|
|
162
|
+
**推荐发布入口**:
|
|
162
163
|
|
|
163
164
|
```bash
|
|
164
|
-
#
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
#
|
|
168
|
-
# 1.
|
|
169
|
-
|
|
165
|
+
# milestone-bound release 的推荐方式只有 `/release vX.Y`
|
|
166
|
+
/release v1.9
|
|
167
|
+
|
|
168
|
+
# `/release` 会负责:
|
|
169
|
+
# 1. 检查 milestone readiness / 工作区 / 分支 / tag 冲突
|
|
170
|
+
# 2. 运行 milestone closeout 或确认已归档状态
|
|
171
|
+
# 3. 展示 Confirmation Gate #1 与 #2
|
|
172
|
+
# 4. 在最终确认后委托机械 helper
|
|
173
|
+
```
|
|
170
174
|
|
|
171
|
-
|
|
172
|
-
git push origin main --tags
|
|
175
|
+
**手动例外(仅限人工受控且已完成等价 closeout + 双确认门)**:
|
|
173
176
|
|
|
174
|
-
|
|
175
|
-
#
|
|
176
|
-
#
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
```bash
|
|
178
|
+
# 只有在完成与 `/release` 等价的 closeout / Gate #1 / Gate #2 后
|
|
179
|
+
# 才允许调用机械 helper
|
|
180
|
+
rtk ./scripts/release.sh 1.9.0
|
|
181
|
+
|
|
182
|
+
# tag push 后由 GitHub Actions 自动完成:
|
|
183
|
+
# - 构建项目
|
|
184
|
+
# - 运行测试
|
|
185
|
+
# - 发布到 NPM (通过 OIDC)
|
|
186
|
+
# - 创建 GitHub Release
|
|
179
187
|
```
|
|
180
188
|
|
|
181
189
|
**Tag 命名规范**:
|
|
@@ -202,8 +210,8 @@ git push origin main --tags
|
|
|
202
210
|
- Workflow Name: `publish.yml`
|
|
203
211
|
|
|
204
212
|
2. **GitHub Secrets 检查**:
|
|
205
|
-
- [ ]
|
|
206
|
-
- [ ] 如果需要
|
|
213
|
+
- [ ] 默认可不设置 `NPM_TOKEN`,优先走 OIDC Trusted Publishing
|
|
214
|
+
- [ ] 如果需要 token fallback,使用 `NPM_TOKEN` 并确保是 **Automation** 类型
|
|
207
215
|
|
|
208
216
|
3. **Workflow 权限配置**:
|
|
209
217
|
```yaml
|
|
@@ -214,9 +222,13 @@ git push origin main --tags
|
|
|
214
222
|
|
|
215
223
|
4. **发布命令**:
|
|
216
224
|
```yaml
|
|
217
|
-
#
|
|
225
|
+
# 正确:stable 版本发布到 latest
|
|
226
|
+
- name: Publish to NPM
|
|
227
|
+
run: npm publish --access public --tag latest
|
|
228
|
+
|
|
229
|
+
# 正确:prerelease 版本显式发布到 preid 对应 tag
|
|
218
230
|
- name: Publish to NPM
|
|
219
|
-
run: npm publish --access public --
|
|
231
|
+
run: npm publish --access public --tag beta
|
|
220
232
|
|
|
221
233
|
# 错误:设置 NODE_AUTH_TOKEN 会干扰 OIDC
|
|
222
234
|
# env:
|
|
@@ -285,25 +297,22 @@ npm run docs:check:pre-release 2>&1 | less
|
|
|
285
297
|
|
|
286
298
|
### 发布前准备
|
|
287
299
|
|
|
288
|
-
**推荐方式:
|
|
300
|
+
**推荐方式: 使用 `/release vX.Y` 统一编排**
|
|
289
301
|
|
|
290
302
|
```bash
|
|
291
|
-
#
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
#
|
|
298
|
-
#
|
|
299
|
-
# 2. 更新 package.json 版本
|
|
300
|
-
# 3. 创建 git commit
|
|
301
|
-
# 4. 创建 git tag
|
|
302
|
-
# 5. 推送到远程仓库
|
|
303
|
-
# 6. 触发 GitHub Actions 发布 (OIDC)
|
|
303
|
+
# milestone-bound release 的统一入口
|
|
304
|
+
/release v1.9
|
|
305
|
+
|
|
306
|
+
# `/release` 会负责:
|
|
307
|
+
# 1. 检查 milestone readiness / 工作区 / 分支 / tag 冲突
|
|
308
|
+
# 2. 运行 milestone closeout 或确认已归档状态
|
|
309
|
+
# 3. 展示 Confirmation Gate #1 与 #2
|
|
310
|
+
# 4. 在最终确认后委托 `rtk ./scripts/release.sh 1.9.0`
|
|
304
311
|
```
|
|
305
312
|
|
|
306
|
-
|
|
313
|
+
`scripts/release.sh` 是 Gate #2 之后的机械 helper,不是绕过 `/release` 的主入口。
|
|
314
|
+
|
|
315
|
+
**手动方式(仅限人工受控的例外流)**
|
|
307
316
|
|
|
308
317
|
```bash
|
|
309
318
|
# 1. 确保工作区干净
|
|
@@ -312,17 +321,24 @@ git status
|
|
|
312
321
|
# 2. 运行发布前检查
|
|
313
322
|
npm run docs:check:pre-release
|
|
314
323
|
|
|
315
|
-
# 3.
|
|
324
|
+
# 3. 完成 milestone readiness 与双确认门
|
|
325
|
+
# - Confirmation Gate #1: closeout 摘要确认
|
|
326
|
+
# - Confirmation Gate #2: 版本 bump / tag / push 前最终确认
|
|
327
|
+
|
|
328
|
+
# 4. 构建和测试
|
|
316
329
|
npm run check:all
|
|
317
330
|
|
|
318
|
-
#
|
|
331
|
+
# 5. 仅在确认后调用机械 helper
|
|
332
|
+
rtk ./scripts/release.sh 1.9.0
|
|
333
|
+
|
|
334
|
+
# 6. 或者手动更新版本号(会自动创建 tag)
|
|
319
335
|
npm version patch|minor|major
|
|
320
336
|
|
|
321
|
-
#
|
|
337
|
+
# 7. 推送代码和 tag
|
|
322
338
|
git push origin main
|
|
323
339
|
git push origin --tags
|
|
324
340
|
|
|
325
|
-
#
|
|
341
|
+
# 8. GitHub Actions 自动完成发布
|
|
326
342
|
```
|
|
327
343
|
|
|
328
344
|
---
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# 版本发布工作流程
|
|
2
|
+
|
|
3
|
+
> 本文档定义 `/release` 命令的完整操作流程。
|
|
4
|
+
> 它是 milestone closeout 与 npm 发布的统一编排入口,也是 `/release` 的单一权威文档。
|
|
5
|
+
>
|
|
6
|
+
> **适用对象**:执行发布的 AI 助手或人类操作者。
|
|
7
|
+
> **前置阅读**:`docs/rules/pre-release-checklist.md`、`docs/rules/deployment.md`。
|
|
8
|
+
|
|
9
|
+
> **Runtime adapters**:`.claude/skills/release/SKILL.md` 与 `.agents/skills/release/SKILL.md` 只允许作为运行时薄适配器存在。它们必须回指本文档,不能替代这里的单一权威流程。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 核心原则
|
|
14
|
+
|
|
15
|
+
1. **1:1 绑定**:每个 milestone 对应一个 npm release。
|
|
16
|
+
2. **版本统一**:milestone 版本即 npm 版本(`vX.Y → X.Y.0`,例如 `v1.9 → 1.9.0`)。
|
|
17
|
+
3. **二次确认**:在触发任何不可逆操作(版本 bump、tag 创建、远程推送)之前,必须等待用户显式确认。
|
|
18
|
+
4. **Thin orchestrator**:`/release` 只做编排和确认门,实际工作委托给现有工具链(`$gsd-complete-milestone`、`scripts/release.sh`、`.github/workflows/publish.yml`)。
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 角色分级
|
|
23
|
+
|
|
24
|
+
发布操作在 `AGENTS.md` 中定义为 **L3-禁止** 等级:
|
|
25
|
+
|
|
26
|
+
- AI **不得**自主执行版本号变更、tag 创建、远程推送。
|
|
27
|
+
- AI **可以**运行验证检查、准备方案、展示摘要、等待用户确认后执行。
|
|
28
|
+
- 用户确认是**必需**的,不是可选的。
|
|
29
|
+
- 本流程必须严格经过两道确认门;任何缺少显式确认的发布都视为无效。
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 触发条件
|
|
34
|
+
|
|
35
|
+
运行 `/release v{X.Y}` 命令必须同时满足:
|
|
36
|
+
|
|
37
|
+
1. 当前存在 **已完成且可 closeout** 的 milestone;如果 milestone 已归档,`/release` 只可在做版本发布补步骤时继续,不能跳过 readiness 检查。
|
|
38
|
+
2. 用户显式提供了目标版本号(如 `/release v1.9`)。
|
|
39
|
+
3. 当前工作区干净(无未提交修改)。
|
|
40
|
+
4. 当前分支为 `main`(或仓库定义的发布分支)。
|
|
41
|
+
5. 本地与远程都不存在冲突的目标 tag(例如 `v1.9.0`)。
|
|
42
|
+
|
|
43
|
+
如果以上任一不满足,`/release` 应拒绝执行并说明原因。
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 工作流程
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
/release v{X.Y}
|
|
51
|
+
↓
|
|
52
|
+
① 验证触发条件
|
|
53
|
+
② 检查 milestone readiness
|
|
54
|
+
③ 运行 `$gsd-complete-milestone v{X.Y}`
|
|
55
|
+
④ 【Confirmation Gate #1】展示归档摘要
|
|
56
|
+
⑤ 计算并展示版本映射
|
|
57
|
+
⑥ 【Confirmation Gate #2】展示发布摘要
|
|
58
|
+
⑦ 委托机械发布 helper
|
|
59
|
+
⑧ 验证 GitHub Actions 触发
|
|
60
|
+
⑨ 完成报告
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 步骤详解
|
|
64
|
+
|
|
65
|
+
#### ① 验证触发条件
|
|
66
|
+
|
|
67
|
+
检查以下项目,任一失败则终止并报告:
|
|
68
|
+
|
|
69
|
+
- [ ] 用户提供了明确的目标版本号(`v{X.Y}` 格式)
|
|
70
|
+
- [ ] `git status --porcelain` 为空(工作区干净)
|
|
71
|
+
- [ ] 当前分支为 `main`(或项目配置的 base branch)
|
|
72
|
+
- [ ] milestone 已完成并具备 closeout/readiness 证据
|
|
73
|
+
- [ ] 本地不存在目标 tag,远程也不存在同名发布 tag
|
|
74
|
+
- [ ] `package.json` 当前版本已读出,可计算目标版本映射
|
|
75
|
+
|
|
76
|
+
#### ② 检查 Milestone Readiness
|
|
77
|
+
|
|
78
|
+
运行以下检查,收集状态信息用于后续确认门:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 运行 readiness gate(hard / warn-only / fallback 三层语义)
|
|
82
|
+
mycodemap readiness-gate
|
|
83
|
+
|
|
84
|
+
# 或结构化输出
|
|
85
|
+
mycodemap readiness-gate --json --structured
|
|
86
|
+
|
|
87
|
+
# 检查开放工件
|
|
88
|
+
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" audit-open 2>/dev/null
|
|
89
|
+
|
|
90
|
+
# 验证 roadmap 状态
|
|
91
|
+
# (roadmap analyze 输出)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
要求:
|
|
95
|
+
- 所有 phase 有 `SUMMARY.md`
|
|
96
|
+
- 所有 requirement 已勾选(或已记录为 deferred)
|
|
97
|
+
- 无未解决的 blocker
|
|
98
|
+
- readiness gate 无 `fallback` 状态(若存在 fallback,需人工判断后方可继续)
|
|
99
|
+
|
|
100
|
+
如果有开放项目,展示给用户并要求选择:
|
|
101
|
+
- [R] 解决 — 停止,修复后重新运行 `/release`
|
|
102
|
+
- [A] 确认延期 — 记录到 `STATE.md` Deferred Items,继续
|
|
103
|
+
- [C] 取消 — 退出
|
|
104
|
+
|
|
105
|
+
#### ③ 运行 GSD Milestone Closeout
|
|
106
|
+
|
|
107
|
+
委托给现有 GSD 工具链:
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
$gsd-complete-milestone v{X.Y}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
此步骤自动完成:
|
|
114
|
+
- 归档 ROADMAP.md → `milestones/v{X.Y}-ROADMAP.md`
|
|
115
|
+
- 归档 REQUIREMENTS.md → `milestones/v{X.Y}-REQUIREMENTS.md`
|
|
116
|
+
- 更新 MILESTONES.md、PROJECT.md、STATE.md
|
|
117
|
+
- 更新 RETROSPECTIVE.md
|
|
118
|
+
- 创建安全 commit
|
|
119
|
+
|
|
120
|
+
等待此步骤完全完成后,继续下一步。
|
|
121
|
+
|
|
122
|
+
#### ④ 【Confirmation Gate #1】Milestone 归档摘要
|
|
123
|
+
|
|
124
|
+
展示:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
Milestone v{X.Y} [{Name}] 归档完成
|
|
128
|
+
|
|
129
|
+
已归档:
|
|
130
|
+
- milestones/v{X.Y}-ROADMAP.md
|
|
131
|
+
- milestones/v{X.Y}-REQUIREMENTS.md
|
|
132
|
+
- MILESTONES.md 已更新
|
|
133
|
+
- PROJECT.md 已演进
|
|
134
|
+
- STATE.md 已更新
|
|
135
|
+
|
|
136
|
+
Phase 统计:{N} phases, {M} plans, {P} tasks
|
|
137
|
+
关键交付:
|
|
138
|
+
- {accomplishment 1}
|
|
139
|
+
- {accomplishment 2}
|
|
140
|
+
- ...
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
用户确认后继续(默认 N)。如果用户不确认,则流程停止,不进入任何发布准备步骤。
|
|
144
|
+
|
|
145
|
+
#### ⑤ 计算并展示版本映射
|
|
146
|
+
|
|
147
|
+
从 `package.json` 读取当前版本,计算新版本:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
版本映射:
|
|
151
|
+
- Milestone: v{X.Y}
|
|
152
|
+
- NPM 当前: {current_version}
|
|
153
|
+
- NPM 目标: {X.Y}.0
|
|
154
|
+
- 变更类型: {major/minor/patch}
|
|
155
|
+
|
|
156
|
+
⚠️ 警告:当前版本 {current_version} → {X.Y}.0 是 {major} 版本跳跃。
|
|
157
|
+
请确认这是预期行为。
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
当前仓库的已知映射示例:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
v1.9 → 1.9.0
|
|
164
|
+
0.5.2-beta.1 → 1.9.0
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
如果版本跳跃跨越 major 边界(0.x → 1.x 或 1.x → 2.x),额外高亮警告并要求操作者重新确认。
|
|
168
|
+
|
|
169
|
+
#### ⑥ 【Confirmation Gate #2】发布摘要
|
|
170
|
+
|
|
171
|
+
在触发任何不可逆操作之前,完整展示:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
═══════════════════════════════════════════════════════
|
|
175
|
+
即将执行以下操作(不可撤销):
|
|
176
|
+
═══════════════════════════════════════════════════════
|
|
177
|
+
|
|
178
|
+
1. 更新 package.json version: {current} → {X.Y}.0
|
|
179
|
+
2. 创建 git commit: "[RELEASE] bump version to v{X.Y}.0"
|
|
180
|
+
3. 创建 git tag: v{X.Y}.0
|
|
181
|
+
4. 推送到远程 origin
|
|
182
|
+
5. 触发 GitHub Actions: publish.yml
|
|
183
|
+
→ 构建、测试、NPM 发布、GitHub Release
|
|
184
|
+
|
|
185
|
+
确认后,以上操作将自动执行。
|
|
186
|
+
|
|
187
|
+
确认发布 v{X.Y}.0? (y/N):
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
用户必须输入 `y` 或 `Y` 才继续。任何其他输入都终止流程。未经过此 gate,不得执行 `npm version`、git commit、git tag、`git push` 或任何会触发 `.github/workflows/publish.yml` 的动作。
|
|
191
|
+
|
|
192
|
+
#### ⑦ 委托机械发布 helper
|
|
193
|
+
|
|
194
|
+
用户确认后,`/release` 默认**委托**给现有机械 helper,而不是在 skill 里重写版本 bump / tag / push 逻辑:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
rtk ./scripts/release.sh {X.Y}.0
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
委托边界如下:
|
|
201
|
+
|
|
202
|
+
- `/release` 负责前置检查、milestone closeout、版本映射、major 跳跃高亮与 **Confirmation Gate #2**
|
|
203
|
+
- `scripts/release.sh` 负责执行既有的 `npm run check:all`、版本写入、git commit、git tag、`git push`
|
|
204
|
+
- `.github/workflows/publish.yml` 负责 tag push 后的构建、测试、NPM 发布与 GitHub Release
|
|
205
|
+
|
|
206
|
+
> 说明:`scripts/release.sh` 当前自带交互确认;它只能作为 `/release` 已通过 **Confirmation Gate #2** 之后的机械 helper,不能替代 `/release` 的安全门。
|
|
207
|
+
>
|
|
208
|
+
> 说明:Phase 31 / Phase 32 / Phase 33 只定义和验证该流程,不会在当前 milestone 内真的执行这些命令。
|
|
209
|
+
|
|
210
|
+
如需理解 helper 将触发的底层动作,可参考 `scripts/release.sh` 当前事实:它会写入 `package.json` / `package-lock.json` 版本、创建 `[RELEASE]` commit、创建 `v{X.Y}.0` tag,并推送分支与 tag 到远程。
|
|
211
|
+
|
|
212
|
+
#### ⑧ 验证 GitHub Actions 触发
|
|
213
|
+
|
|
214
|
+
推送后,验证 Actions 已触发:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# 给出 Actions 页面链接
|
|
218
|
+
echo "GitHub Actions 发布状态:"
|
|
219
|
+
echo "https://github.com/{owner}/{repo}/actions/workflows/publish.yml"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
如需做**只读 follow-up observability**,统一使用独立命令:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
mycodemap publish-status --tag v{X.Y}.0 --sha {headSha}
|
|
226
|
+
mycodemap publish-status --tag v{X.Y}.0 --sha {headSha} --json --structured
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
约束:
|
|
230
|
+
|
|
231
|
+
- `publish-status` 只读取 `.github/workflows/publish.yml` 的 snapshot truth
|
|
232
|
+
- 它必须依赖 `--tag + --sha` 做精确匹配;无法精确确认时返回 `unavailable` / `ambiguous`
|
|
233
|
+
- 它**不是**第二条发布路径;`/release` 仍是单一权威,`publish-status` 不得 rerun workflow、不得 dispatch、不得 publish、不得 push
|
|
234
|
+
- 默认只做一次 snapshot;是否继续跟进由人类或上层 agent 自主决定
|
|
235
|
+
|
|
236
|
+
可选:使用 `publish-status` 做非阻塞状态复核,但不要把它当成发布 authority 的一部分。
|
|
237
|
+
|
|
238
|
+
#### ⑨ 完成报告
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
✅ Release v{X.Y}.0 已触发
|
|
242
|
+
|
|
243
|
+
Milestone: v{X.Y} — 已归档
|
|
244
|
+
NPM 版本: {X.Y}.0 — 已推送 tag
|
|
245
|
+
GitHub Actions: 运行中
|
|
246
|
+
|
|
247
|
+
查看状态:
|
|
248
|
+
- Actions: https://github.com/{owner}/{repo}/actions
|
|
249
|
+
- NPM: https://www.npmjs.com/package/@mycodemap/mycodemap
|
|
250
|
+
- Release: https://github.com/{owner}/{repo}/releases
|
|
251
|
+
- Follow-up: `mycodemap publish-status --tag v{X.Y}.0 --sha {headSha}`
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 错误处理与回滚
|
|
257
|
+
|
|
258
|
+
### 中途失败
|
|
259
|
+
|
|
260
|
+
如果在步骤 ③(GSD closeout)之前失败:无持久化副作用,直接终止。
|
|
261
|
+
|
|
262
|
+
如果在步骤 ③ 完成后、步骤 ⑦ 之前失败:milestone 已归档,但 npm 未发布。可以修复问题后重新运行 `/release`(GSD closeout 部分会检测到已归档并跳过)。
|
|
263
|
+
|
|
264
|
+
如果在步骤 ⑦ 中失败(如 push 被拒绝):
|
|
265
|
+
- 若 commit 已创建但 push 失败:修复远程冲突后手动推送。
|
|
266
|
+
- 若 tag 已创建但 push 失败:手动 `git push origin v{X.Y}.0`。
|
|
267
|
+
- 若 package.json 已修改但 commit 未创建:`git checkout package.json package-lock.json` 回滚。
|
|
268
|
+
|
|
269
|
+
### 版本冲突
|
|
270
|
+
|
|
271
|
+
如果本地或远程已存在 `v{X.Y}.0` tag:
|
|
272
|
+
- 拒绝执行,报告冲突。
|
|
273
|
+
- 建议用户检查是否重复运行 `/release`。
|
|
274
|
+
|
|
275
|
+
如果 package.json 中版本已经是 `{X.Y}.0`:
|
|
276
|
+
- 跳过版本 bump,只创建 tag 和推送。
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## 禁止事项
|
|
281
|
+
|
|
282
|
+
- **不得**在二次确认门之前执行任何 git 写操作(commit、tag、push)。
|
|
283
|
+
- **不得**跳过 GSD milestone closeout 直接执行 `scripts/release.sh`。
|
|
284
|
+
- **不得**在存在未解决 blocker 时继续发布(除非用户显式选择 [A] 确认延期)。
|
|
285
|
+
- **不得**将 `NPM_TOKEN` 硬编码到任何脚本或文档中。
|
|
286
|
+
- **不得**绕过 `docs:check:pre-release` 检查。
|
|
287
|
+
- **不得**把 `/release` 文档写成第二套 closeout 或 publish 实现;它必须是 thin orchestrator。
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 文档同步触发条件
|
|
292
|
+
|
|
293
|
+
以下变更会触发本文档需要更新:
|
|
294
|
+
|
|
295
|
+
- GSD closeout 工作流变更(步骤或顺序变化)
|
|
296
|
+
- `scripts/release.sh` 行为变更(参数、交互方式变化)
|
|
297
|
+
- `.github/workflows/publish.yml` 触发条件变化
|
|
298
|
+
- 版本映射规则变化
|
|
299
|
+
- 确认门内容或格式变化
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
*版本: 1.0.0 | 最后更新: 2026-04-22*
|
package/docs/rules/testing.md
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
| 类型 | 路径 |
|
|
18
18
|
|------|------|
|
|
19
19
|
| 常规测试 | `src/**/*.test.ts` |
|
|
20
|
+
| Workflow E2E | `tests/e2e/**/*.test.ts` |
|
|
20
21
|
| 集成测试 | `tests/` 目录(如存在单独集成测试编排) |
|
|
21
22
|
| 基准测试 | `refer/benchmark-quality.test.ts` |
|
|
22
23
|
|
|
@@ -37,6 +38,21 @@ export default defineConfig({
|
|
|
37
38
|
});
|
|
38
39
|
```
|
|
39
40
|
|
|
41
|
+
```typescript
|
|
42
|
+
// vitest.e2e.config.ts
|
|
43
|
+
export default defineConfig({
|
|
44
|
+
test: {
|
|
45
|
+
globals: true,
|
|
46
|
+
environment: 'node',
|
|
47
|
+
include: ['tests/e2e/**/*.test.ts'],
|
|
48
|
+
exclude: ['node_modules', 'dist', 'refer/**/*.test.ts'],
|
|
49
|
+
testTimeout: 10000,
|
|
50
|
+
hookTimeout: 10000,
|
|
51
|
+
pool: 'threads'
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
40
56
|
## 测试要求
|
|
41
57
|
|
|
42
58
|
- 所有新功能必须附带测试
|
|
@@ -59,6 +75,9 @@ export default defineConfig({
|
|
|
59
75
|
npm test
|
|
60
76
|
npx vitest run
|
|
61
77
|
|
|
78
|
+
# 运行 workflow E2E 护栏
|
|
79
|
+
npm run test:e2e
|
|
80
|
+
|
|
62
81
|
# 运行特定测试文件
|
|
63
82
|
npx vitest run src/orchestrator/__tests__/confidence.test.ts
|
|
64
83
|
|
package/docs/rules/validation.md
CHANGED
|
@@ -10,7 +10,14 @@
|
|
|
10
10
|
| 改 repo-local 规则控制脚本或 hook 路由 | `python3 scripts/validate-rules.py code --report-only` | 先看 contract,不先硬阻断 |
|
|
11
11
|
| 改 CLI 文档入口或统一 guardrail | `node dist/cli/index.js ci check-docs-sync` | 同时验证 docs guardrail 与 analyze generated block |
|
|
12
12
|
| 改实现代码 | `npm run typecheck` → `npm run lint` → `npm test` | 从最小相关验证扩到基础回归 |
|
|
13
|
-
| 改发布/打包边界 | `npm run build` → `npm run validate-pack` |
|
|
13
|
+
| 改发布/打包边界 | `npm run docs:check:pre-release` → `npm run build` → `npm run validate-pack` | 先锁版本/发布契约,再确认 shipped artifact 仍成立 |
|
|
14
|
+
|
|
15
|
+
## Validation quick truth
|
|
16
|
+
|
|
17
|
+
- 文档/入口变更先跑 `npm run docs:check`。
|
|
18
|
+
- 统一 docs/AI guardrail 入口:`node dist/cli/index.js ci check-docs-sync`(产品命令等价于 `mycodemap ci check-docs-sync`)。
|
|
19
|
+
- repo-local rules 预检:`python3 scripts/validate-rules.py code --report-only` 只报告,不阻断。
|
|
20
|
+
- CI / PR 超窗、fallback 或 false-positive 漂移时,`warn-only / fallback` 不是 hard gate success。
|
|
14
21
|
|
|
15
22
|
## Repo-local rule validator
|
|
16
23
|
|
|
@@ -39,18 +46,19 @@
|
|
|
39
46
|
| 1 | `npm run docs:check` | 文档护栏 |
|
|
40
47
|
| 2 | `npm run typecheck` | 类型检查 |
|
|
41
48
|
| 3 | `npm run lint` | lint |
|
|
42
|
-
| 4 | `npm test` |
|
|
43
|
-
| 5 | `npm run
|
|
44
|
-
| 6 | `
|
|
45
|
-
| 7 | `node
|
|
46
|
-
| 8 | `node dist/cli/index.js
|
|
47
|
-
| 9 | `node dist/cli/index.js ci
|
|
49
|
+
| 4 | `npm test` | 默认 `src/**/*.test.ts` 回归 |
|
|
50
|
+
| 5 | `npm run test:e2e` | `tests/e2e/**/*.test.ts` workflow E2E 护栏 |
|
|
51
|
+
| 6 | `npm run build` | 构建验证 |
|
|
52
|
+
| 7 | `node scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10` | 设计 contract 校准;`changed files <= 10` 才可能进入 hard gate |
|
|
53
|
+
| 8 | `node dist/cli/index.js check --contract mycodemap.design.md --against src --base origin/main --annotation-format github` | PR 注解与 contract gate |
|
|
54
|
+
| 9 | `node dist/cli/index.js ci check-docs-sync` | 统一 docs/AI guardrail |
|
|
55
|
+
| 10 | `node dist/cli/index.js ci assess-risk --threshold=0.7` | 风险评估 |
|
|
48
56
|
|
|
49
57
|
> PR 超窗、`diff-scope-fallback` 或 `false-positive rate >10%` 时,workflow 必须明确标为 `warn-only / fallback`。
|
|
50
58
|
|
|
51
59
|
## 需要特别补跑的场景
|
|
52
60
|
|
|
53
|
-
- 若改动涉及
|
|
61
|
+
- 若改动涉及 `.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 脚本同步。
|
|
54
62
|
- 若改动涉及 `check` / `ci assess-risk` / `history` / `analyze --include-git-history` 的统一 risk truth,至少补跑 `node dist/cli/index.js history --symbol createCheckCommand`、`node scripts/report-high-risk-files.mjs --top 3`、`npm run build`。
|
|
55
63
|
- 若改动涉及产品定位、输出契约、共享文件发现规则或 `Server Layer` / `mycodemap server` 边界,确认 README、AI 文档、架构文档和 guardrail 脚本使用同一套措辞。
|
|
56
64
|
|
|
@@ -73,6 +81,7 @@
|
|
|
73
81
|
| 失败模式 | 先看哪里 | 恢复方式 |
|
|
74
82
|
|---|---|---|
|
|
75
83
|
| `schema / README / AI 文档没同步` | `npm run docs:check` | 先修文档真相,再重跑 |
|
|
84
|
+
| prerelease 发布卡在 npm publish | `.github/workflows/publish.yml` / `package.json version` | 确认 prerelease 版本显式传了 `--tag <preid>`;例如 `0.5.2-beta.1` 必须走 `--tag beta` |
|
|
76
85
|
| 文档继续把历史设计写成当前现实 | `npm run docs:check` | 把 shipped baseline 与 future intent 分开 |
|
|
77
86
|
| 旧的 `neo4j` / `kuzudb` 配置已经不受支持,但文档还把它写成正式 backend | `README.md` / `AI_GUIDE.md` / schema | 改回 `filesystem` / `sqlite` / `memory` / `auto` 真实 contract |
|
|
78
87
|
| `storage.type="sqlite"` 运行时不满足要求 | Node.js `>=20`、`better-sqlite3`、`STORAGE_BACKEND_MIGRATED`、`SQLITE_NOT_AVAILABLE` | 修运行时或改配置,不要静默 fallback |
|
|
@@ -95,6 +104,7 @@ node scripts/report-high-risk-files.mjs --top 3
|
|
|
95
104
|
npm run typecheck
|
|
96
105
|
npm run lint
|
|
97
106
|
npm test
|
|
107
|
+
npm run test:e2e
|
|
98
108
|
npm run build
|
|
99
109
|
npm run validate-pack
|
|
100
110
|
```
|