@namewta/speculo 0.2.16 → 0.3.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/package.json +1 -1
- package/template/canonical/README.md +1 -0
- package/template/canonical/canonical-specdev-grill-with-docs.md +36 -45
- package/template/canonical/canonical-specdev-spec.md +9 -7
- package/template/canonical/canonical-specdev-tickets.md +91 -45
- package/template/canonical/canonical-specdev-wayfinder.md +28 -30
- package/template/commands/archive-and-consolidate.md +3 -3
- package/template/commands/docs-sync.md +3 -5
- package/template/commands/handoff.md +8 -6
- package/template/commands/retro.md +6 -9
- package/template/commands/status.md +1 -1
- package/template/skills/agents-md-builder/references/claude-redirect.md +10 -14
- package/template/skills/agents-md-builder/references/manifest-discovery.md +1 -6
- package/template/skills/agents-md-builder/references/role-classification.md +0 -12
- package/template/skills/archive-and-consolidate/SKILL.md +1 -1
- package/template/skills/docs-sync/references/agents-contract.md +4 -4
- package/template/skills/github-npm-ops/references/failure-recovery.md +4 -16
- package/template/skills/github-npm-ops/references/preflight-checklist.md +7 -7
- package/template/skills/github-npm-ops/references/release-notes-injection.md +8 -8
- package/template/skills/github-npm-ops/references/troubleshooting-playbook.md +5 -19
- package/template/skills/github-npm-ops/references/version-bump-flow.md +8 -28
- package/template/skills/github-npm-ops/references/workflow-yaml-reference.md +8 -8
- package/template/skills/writing-great-skills/SKILL.md +2 -0
- package/template/workflows/person/M-mao-zedong-cognitive-os/_templates/mao-consultation-output-template.md +32 -0
- package/template/workflows/specdev/A-archive-and-consolidate/consolidation-rules.md +4 -2
- package/template/workflows/specdev/A-archive-and-consolidate/knowledge-graduation.md +1 -1
- package/template/workflows/specdev/D-diagnose-bugs/D-diagnose-bugs.md +2 -2
- package/template/workflows/specdev/D-diagnose-bugs/cleanup-postmortem.md +2 -2
- package/template/workflows/specdev/D-diagnose-bugs/feedback-loop-techniques.md +1 -1
- package/template/workflows/specdev/G-grill-with-docs/G-grill-with-docs.md +1 -5
- package/template/workflows/specdev/G-grill-with-docs/adr-format.md +2 -0
- package/template/workflows/specdev/G-grill-with-docs/domain-modeling-rules.md +3 -13
- package/template/workflows/specdev/I-implement/I-implement.md +3 -3
- package/template/workflows/specdev/I-implement/codebase-design-glossary.md +9 -9
- package/template/workflows/specdev/I-implement/tdd-examples.md +1 -1
- package/template/workflows/specdev/I-init-setup/I-init-setup.md +1 -1
- package/template/workflows/specdev/I-init-setup/domain-layout.md +18 -53
- package/template/workflows/specdev/I-init-setup/status-labels.md +4 -5
- package/template/workflows/specdev/I-init-setup/tracking-convention.md +22 -35
- package/template/workflows/specdev/INDEX.md +7 -1
- package/template/workflows/specdev/P-goal-plan/execution-sections.md +2 -2
- package/template/workflows/specdev/P-goal-plan/governance-sections.md +3 -3
- package/template/workflows/specdev/P-goal-plan/lead-orchestration-protocol.md +5 -8
- package/template/workflows/specdev/P-goal-plan/vision-sections.md +1 -1
- package/template/workflows/specdev/R-review-architecture/R-review-architecture.md +77 -0
- package/template/workflows/specdev/R-review-architecture/exploration-guide.md +103 -0
- package/template/workflows/specdev/R-review-architecture/html-report-template.md +124 -0
- package/template/workflows/specdev/T-tickets/T-tickets.md +4 -4
- package/template/workflows/specdev/W-wayfinder/W-wayfinder.md +14 -18
- package/template/workflows/specdev/common/dev-worktree/SKILL.md +16 -106
- package/template/workflows/specdev/common/handoff/SKILL.md +42 -0
- package/template/workflows/specdev/common/triage/OUT-OF-SCOPE.md +2 -2
- package/template/workflows/specdev/common/triage/SKILL.md +3 -3
- package/template/workflows/specdev/common/improve-codebase-architecture/HTML-REPORT.md +0 -125
- package/template/workflows/specdev/common/improve-codebase-architecture/SKILL.md +0 -66
|
@@ -3,8 +3,8 @@ id: archive-and-consolidate
|
|
|
3
3
|
type: command
|
|
4
4
|
name: Archive and Consolidate
|
|
5
5
|
description: >
|
|
6
|
-
归档已完成 change,从归档中提取知识合并到
|
|
7
|
-
并清理过时/重复知识。默认 dry-run
|
|
6
|
+
归档已完成 change,从归档中提取知识合并到 workflow 声明的知识 store(如 adr/、context/),
|
|
7
|
+
并清理过时/重复知识。默认 dry-run,需用户确认后执行。
|
|
8
8
|
keywords: [archive, consolidate, knowledge, cleanup, adr, 归档, 知识合并, 清理, 收尾]
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ keywords: [archive, consolidate, knowledge, cleanup, adr, 归档, 知识合并,
|
|
|
12
12
|
|
|
13
13
|
## 报告
|
|
14
14
|
|
|
15
|
-
统一写入:`speculo/.speculo/commands/archive-and-consolidate/<YYYY-MM-DD>-<
|
|
15
|
+
统一写入:`speculo/.speculo/commands/archive-and-consolidate/<YYYY-MM-DD>-<scope>-<topic>[-NN].md`(`<scope>` 为目标 workflow 名,`<topic>` 为 change 名或 `batch`)。
|
|
16
16
|
|
|
17
17
|
报告必须记录:`mode`(dry-run 或 executed)、选中的 workflow、归档计划、合并计划、清理候选、用户确认状态和最终结果。
|
|
18
18
|
|
|
@@ -19,10 +19,8 @@ keywords: [docs-sync, readme, changelog, agents, documentation]
|
|
|
19
19
|
## 执行
|
|
20
20
|
|
|
21
21
|
1. 读取 `../skills/docs-sync/SKILL.md`,解析 `speculo/config.json` 与 `speculo/.speculo/workspace.json`(不存在时以默认值静默降级),获取全部已安装 workflow/state 根。
|
|
22
|
-
2.
|
|
23
|
-
3.
|
|
24
|
-
4.
|
|
25
|
-
5. 运行项目与文档校验,原子写入报告、state 和 sidecar,再显式暂存本次产物并创建同步或 no-op commit。
|
|
26
|
-
6. 重新读取 Git、state、报告与 sidecar;只有工作区干净、节点可复现且所有文件已提交时完成。
|
|
22
|
+
2. 将 runtime context、报告路径、全局 state 路径与 Git 副作用责任传给 skill,按 skill 流程执行(清理工作区 → 确认范围 → 生命周期审计 → 同步文档 → 验证)。
|
|
23
|
+
3. 整文件/目录删除和受保护知识仍逐次确认;skill 返回原子写入内容后,由本命令显式暂存并创建同步或 no-op commit。
|
|
24
|
+
4. 重新读取 Git、state、报告与 sidecar;只有工作区干净、节点可复现且所有文件已提交时完成。
|
|
27
25
|
|
|
28
26
|
完成标准:报告含输入节点、checkpoint、确认范围、生命周期动作和验证;全局 state 与每个 workflow sidecar 有效;`git status --short` 为空。
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
+
id: handoff
|
|
3
|
+
type: command
|
|
2
4
|
name: handoff
|
|
3
5
|
description: 将当前对话压缩为一份交接文档,供另一个 agent 接手继续工作。
|
|
6
|
+
keywords: [handoff, 交接, 移交, 上下文压缩]
|
|
4
7
|
argument-hint: "下一个会话将用于什么?"
|
|
5
8
|
disable-model-invocation: true
|
|
6
9
|
---
|
|
@@ -20,8 +23,7 @@ speculo/.speculo/commands/handoff/<YYYY-MM-DD>-<scope>-<topic>[-NN].md
|
|
|
20
23
|
- **<topic>** — 从交接范围或用户主题提取,使用小写 kebab-case;无法判断时使用 `speculo`。
|
|
21
24
|
- **[-NN]** — 同日同 scope 同 topic 的多份报告,从 `-01` 开始递增;仅首份可省略后缀。
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
> **禁止**将命令报告写入 `temp/`、系统临时目录或工作区内其他非规范位置。
|
|
26
|
+
- 禁止将命令报告写入 `temp/`、系统临时目录或工作区内其他非规范位置。
|
|
25
27
|
|
|
26
28
|
## 内容要求
|
|
27
29
|
|
|
@@ -37,10 +39,10 @@ speculo/.speculo/commands/handoff/<YYYY-MM-DD>-<scope>-<topic>[-NN].md
|
|
|
37
39
|
|
|
38
40
|
文档中所有文件/文件夹引用必须使用**项目根目录**的相对路径。
|
|
39
41
|
|
|
40
|
-
- ✅ `
|
|
41
|
-
- ✅ `
|
|
42
|
-
- ✅ `speculo/.speculo/specdev/changes
|
|
42
|
+
- ✅ `src/modules/auth/`
|
|
43
|
+
- ✅ `scripts/migrate/2024-add-index.sql`
|
|
44
|
+
- ✅ `speculo/.speculo/specdev/changes/<YYYY-MM-DD>-<topic>/spec.md`
|
|
43
45
|
- ❌ `../../specdev/changes/...` — 相对于 handoff 文件,脱离目录后不可定位
|
|
44
|
-
- ❌ `
|
|
46
|
+
- ❌ `auth` — 裸名,无法判断是目录/文件/子模块
|
|
45
47
|
|
|
46
48
|
例外:skills 名称属于逻辑标识而非文件路径,不适用此规则。
|
|
@@ -8,9 +8,7 @@ keywords: [retro, 复盘, 痛点, feedback, issue, 优化, 反馈]
|
|
|
8
8
|
|
|
9
9
|
# Retro 命令
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
🔒 **目标仓库已写死:`NAMEWTA/Speculo`。** 本命令专为 Speculo 框架自身反馈而设计。不论 retro 在哪个项目仓库中被激活,issue 一律提交到 `NAMEWTA/Speculo`。不允许用户或 AI 覆盖此目标仓库。
|
|
11
|
+
**外部写操作 + 目标仓库写死。** 本命令最后一步会通过 `gh` 向 `NAMEWTA/Speculo` 创建 issue——不论在哪个项目仓库中激活,目标仓库一律不可覆盖。确认前只输出计划,不调用 `gh`。
|
|
14
12
|
|
|
15
13
|
## 归档路径模式
|
|
16
14
|
|
|
@@ -30,11 +28,10 @@ keywords: [retro, 复盘, 痛点, feedback, issue, 优化, 反馈]
|
|
|
30
28
|
1. 读取 `../skills/speculo-retro/SKILL.md`,解析 `speculo/config.json` 与 `speculo/.speculo/workspace.json`(不存在时以默认值静默降级),采集对话、command 报告、change 状态以及各 `INDEX.md` 声明的知识 store。
|
|
31
29
|
2. 用该 skill 产出规范化复盘结论:去重、分级、根因化的 issue-ready 提案清单,附丢弃/合并说明与每条处置建议。
|
|
32
30
|
3. 创建 command 专属目录 `speculo/.speculo/commands/retro/`,把复盘结论写入带 scope 的 Markdown 报告。
|
|
33
|
-
4.
|
|
34
|
-
5.
|
|
35
|
-
6.
|
|
36
|
-
7.
|
|
37
|
-
8. 把每条提案的最终 issue 编号/URL 回写进本次报告的「提交结果」小节;返回报告路径、3-5 条复盘摘要和已创建 issue 链接清单。
|
|
31
|
+
4. **去重**:读取 `../skills/github-npm-ops/SKILL.md` 的 `references/issue-pr-triage.md`,对每条 `disposition: file-issue` 的提案用 `gh issue list --repo NAMEWTA/Speculo --search "<关键词>" --state all --limit 20` 检索;命中语义重复的默认跳过并记录 `dup_of`,仅当用户明确要求才补提。
|
|
32
|
+
5. **外部写操作边界**:向用户展示将要创建的 issue 清单(标题、类型/优先级标签、正文摘要、目标仓库 `NAMEWTA/Speculo`)与去重结果,等待用户明确确认。没有确认时只输出计划,不调用 `gh`。
|
|
33
|
+
6. 用户确认后,按优先级倒序逐条执行 `gh issue create --repo NAMEWTA/Speculo --title "<title>" --body "<body>" --label "<type>,<priority>[,<area>]"`(多行正文可用 `--body-file` 指向不保留的临时文件)。任一条失败时停止后续创建,报告已建/未建清单,不重复创建同一条。
|
|
34
|
+
7. 把每条提案的最终 issue 编号/URL 回写进本次报告的「提交结果」小节;返回报告路径、3-5 条复盘摘要和已创建 issue 链接清单。
|
|
38
35
|
|
|
39
36
|
## 产物模板
|
|
40
37
|
|
|
@@ -66,7 +63,7 @@ generated_at: [TODO: ISO-8601]
|
|
|
66
63
|
[TODO: 列出被合并、丢弃或降级为「仅记教训」的项及原因。]
|
|
67
64
|
|
|
68
65
|
## 目标仓库
|
|
69
|
-
`NAMEWTA/Speculo
|
|
66
|
+
`NAMEWTA/Speculo`
|
|
70
67
|
|
|
71
68
|
## 用户确认记录
|
|
72
69
|
[TODO: 记录用户对 issue 清单的确认原文摘要。]
|
|
@@ -11,6 +11,6 @@ keywords: [status, 状态, active, blocked]
|
|
|
11
11
|
1. 读取 `speculo/.speculo/workspace.json`,解析 `speculo/config.json`(不存在时以默认值静默降级),获取全部已安装 workflow/state 根。
|
|
12
12
|
2. 扫描 `speculo/workflows/*/INDEX.md`,得到已安装 workflow ids。
|
|
13
13
|
3. 对每个 id 读取 `speculo/.speculo/<workflow>/status.json`,再读取 `changes/<change>/.status.json`。
|
|
14
|
-
4. 报告 active
|
|
14
|
+
4. 报告 active 数量、各 change 的 `current_work` 与 `works_run`、最近更新时间、停滞 change(`.status.json` 超过 14 天未更新)与 malformed 目录。
|
|
15
15
|
5. 报告没有 workflow 资产的孤立状态根,以及缺少状态根的已安装 workflow;不自动修复。
|
|
16
16
|
6. 用户要求持久化时写入 `speculo/.speculo/commands/status/<YYYY-MM-DD>-workspace-<topic>[-NN].md`,并在报告中列出本次扫描的 workflow 选择。
|
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## 规则
|
|
4
4
|
|
|
5
|
-
每个 manifest 目录的 `CLAUDE.md`
|
|
5
|
+
每个 manifest 目录的 `CLAUDE.md` 是轻量重定向文件,内容固定为:
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
|
|
8
|
+
# CLAUDE.md
|
|
9
|
+
|
|
10
|
+
Speculo agent handbook: see [AGENTS.md](./AGENTS.md).
|
|
9
11
|
```
|
|
10
12
|
|
|
13
|
+
此格式与 `../../docs-sync/references/agents-contract.md` 的规定一致(该契约为权威):`AGENTS.md` 始终是唯一的权威代理手册,`CLAUDE.md` 永远只是入口指针。
|
|
14
|
+
|
|
11
15
|
## 设计缘由
|
|
12
16
|
|
|
13
17
|
- Claude Code 会读取 `CLAUDE.md` 获取项目/模块级指令。
|
|
14
|
-
- 如果 `CLAUDE.md` 已有内容,不应覆盖。
|
|
15
|
-
- 如果 `CLAUDE.md` 不存在,生成一行重定向。
|
|
16
18
|
- 内容全部在 `AGENTS.md` 中,`CLAUDE.md` 只是入口指针。
|
|
17
19
|
- 零维护成本:`AGENTS.md` 更新时不需要同步 `CLAUDE.md`。
|
|
18
20
|
|
|
@@ -20,8 +22,8 @@
|
|
|
20
22
|
|
|
21
23
|
- 目录有 manifest 文件 → 生成 `CLAUDE.md`
|
|
22
24
|
- 目录是 scripts-docs → 生成 `CLAUDE.md`
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
+
- 目录已有多行非重定向 `CLAUDE.md` → 向用户确认后改写为重定向,原内容全量迁移到 `AGENTS.md`(处置与 agents-contract 一致)
|
|
26
|
+
- 目录已有重定向 `CLAUDE.md` → 可覆盖(保持最新格式)
|
|
25
27
|
|
|
26
28
|
## 不生成 CLAUDE.md 的目录
|
|
27
29
|
|
|
@@ -32,12 +34,6 @@
|
|
|
32
34
|
|
|
33
35
|
## 文件格式
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
- 无 frontmatter
|
|
40
|
-
- 无标题
|
|
41
|
-
- 无额外内容
|
|
42
|
-
- 无换行(只有一行文本)
|
|
37
|
+
- 三行:`# CLAUDE.md` 标题、空行、一句英文重定向
|
|
38
|
+
- 无 frontmatter、无额外内容
|
|
43
39
|
- 文件以换行符结尾(POSIX 约定)
|
|
@@ -54,12 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
1. **确定扫描起点**:`scan_root = root / target_subdir`,若未指定则为 `root`。
|
|
56
56
|
2. **递归遍历**:从 `scan_root` 递归遍历所有子目录。
|
|
57
|
-
3.
|
|
58
|
-
- `.git`、`node_modules`、`dist`、`target`、`.turbo`
|
|
59
|
-
- `coverage`、`__pycache__`、`.idea`、`.vscode`
|
|
60
|
-
- `build`、`out`、`.next`、`.nuxt`
|
|
61
|
-
- `vendor`、`bower_components`
|
|
62
|
-
- 任何在 `.gitignore` 中且非被跟踪的目录
|
|
57
|
+
3. **跳过忽略目录**:见文末「忽略目录完整清单」;另跳过任何在 `.gitignore` 中且非被跟踪的目录。
|
|
63
58
|
4. **检测 manifest**:对每个非忽略目录,检查是否存在任何 manifest 文件。
|
|
64
59
|
5. **选择主 manifest**:按优先级选择。
|
|
65
60
|
6. **应用过滤**:若用户指定了 `manifest_filter`,仅保留匹配该类型的目录。
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
- 路径等于 `scan_root`
|
|
20
20
|
- 通常包含 `.git`、顶层 CI 配置、workspace 声明等
|
|
21
21
|
|
|
22
|
-
**模板**:`templates/repo-root-AGENTS.md`
|
|
23
|
-
|
|
24
22
|
### 优先级 2:`scripts-docs`
|
|
25
23
|
|
|
26
24
|
**判定条件**:目录是特批的脚本/文档目录。
|
|
@@ -35,8 +33,6 @@
|
|
|
35
33
|
- 必须显式说明“这是特批文档例外,不是 manifest 模块”
|
|
36
34
|
- 必须区分“可执行脚本”“SQL 资产”“配置模板”“运行时数据目录”
|
|
37
35
|
|
|
38
|
-
**模板**:`templates/scripts-docs-AGENTS.md`
|
|
39
|
-
|
|
40
36
|
### 优先级 3:`aggregator`
|
|
41
37
|
|
|
42
38
|
**判定条件**:manifest 声明了子模块、子项目或 workspace 成员。
|
|
@@ -60,8 +56,6 @@
|
|
|
60
56
|
- 必须写清“哪些问题必须进入哪个子模块继续调查”
|
|
61
57
|
- 聚合层只说编排,不展开子模块实现
|
|
62
58
|
|
|
63
|
-
**模板**:`templates/aggregator-AGENTS.md`
|
|
64
|
-
|
|
65
59
|
### 优先级 4:`runnable-app`
|
|
66
60
|
|
|
67
61
|
**判定条件**:无子模块声明,但有明确的运行入口。
|
|
@@ -85,8 +79,6 @@
|
|
|
85
79
|
- 必须写清内部依赖模块如何接入到当前应用
|
|
86
80
|
- 不改写成叶子模块的膨胀版
|
|
87
81
|
|
|
88
|
-
**模板**:`templates/runnable-app-AGENTS.md`
|
|
89
|
-
|
|
90
82
|
### 优先级 5:`contract-module`
|
|
91
83
|
|
|
92
84
|
**判定条件**:无子模块、无运行入口,主要职责是暴露类型、契约、配置或依赖约束。
|
|
@@ -108,8 +100,6 @@
|
|
|
108
100
|
- 没有 `src/` 时,显式说明这是约束层而非实现层
|
|
109
101
|
- 不要误写成运行时代码模块
|
|
110
102
|
|
|
111
|
-
**模板**:`templates/contract-module-AGENTS.md`
|
|
112
|
-
|
|
113
103
|
### 优先级 6:`capability-module`
|
|
114
104
|
|
|
115
105
|
**判定条件**:以上都不匹配的其余所有 manifest 目录。
|
|
@@ -125,8 +115,6 @@
|
|
|
125
115
|
- 必须写清内部依赖与上游消费方
|
|
126
116
|
- 区分它是更偏能力模块、业务模块还是集成模块
|
|
127
117
|
|
|
128
|
-
**模板**:`templates/capability-module-AGENTS.md`
|
|
129
|
-
|
|
130
118
|
## 角色判定流程图
|
|
131
119
|
|
|
132
120
|
```
|
|
@@ -119,7 +119,7 @@ description: >
|
|
|
119
119
|
3. 显式标注所有破坏性动作(移动、删除、改写)。
|
|
120
120
|
4. 报告摘要:待归档 change 数、待合并知识项数、待清理候选数、需确认项数。
|
|
121
121
|
5. 呈现给用户并显式声明:**"未修改任何文件。此为 dry-run 计划,请确认后执行。"**
|
|
122
|
-
6. dry-run 到此完成;调用方负责将报告写入 `commands_root/archive-and-consolidate/<YYYY-MM-DD>-<
|
|
122
|
+
6. dry-run 到此完成;调用方负责将报告写入 `commands_root/archive-and-consolidate/<YYYY-MM-DD>-<scope>-<topic>[-NN].md`(`<scope>` 为目标 workflow 名,`<topic>` 为 change 名或 `batch`)。
|
|
123
123
|
|
|
124
124
|
### Step 7:执行已确认动作
|
|
125
125
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
## AGENTS 与 CLAUDE
|
|
22
22
|
|
|
23
|
-
-
|
|
23
|
+
- `AGENTS.md` 是唯一的权威代理手册;`CLAUDE.md` 只能是轻量重定向,内容固定为:
|
|
24
24
|
|
|
25
25
|
```
|
|
26
26
|
# CLAUDE.md
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
Speculo agent handbook: see [AGENTS.md](./AGENTS.md).
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
-
|
|
32
|
-
- 现有多行 `CLAUDE.md`
|
|
33
|
-
-
|
|
31
|
+
- 所有代理指令、事实和规则写入 `AGENTS.md`,不把 `CLAUDE.md` 当作权威内容载体。
|
|
32
|
+
- 现有多行 `CLAUDE.md` 经用户确认后改写为重定向,原内容全量迁移到 `AGENTS.md`。
|
|
33
|
+
- `AGENTS.md` 不得被缩减为指向 `CLAUDE.md` 的重定向——发现即修复。
|
|
34
34
|
- Monorepo 使用就近手册覆盖;父级只导航,不复制子模块细节。
|
|
35
35
|
|
|
36
36
|
## 验证
|
|
@@ -18,7 +18,7 @@ git push origin :refs/tags/vX.Y.Z
|
|
|
18
18
|
# 修复完后落新的非 release commit,保持 release commit 干净
|
|
19
19
|
|
|
20
20
|
# 3. (若 release commit 已被 push)amend / 追加修复 commit 都可
|
|
21
|
-
# 重要:若需要修改 package.json 或
|
|
21
|
+
# 重要:若需要修改 package.json 或 CHANGELOG.md,最好新落一个 fix commit
|
|
22
22
|
# 再用 --amend 合并到 release commit 后 force-push(仅个人分支或本地未推时)
|
|
23
23
|
|
|
24
24
|
# 4. 重新打 tag 指向(可能更新过的)release commit
|
|
@@ -37,26 +37,14 @@ git push origin vX.Y.Z
|
|
|
37
37
|
**恢复**:**不要**重发 npm(同版本号永久不可重发),仅手动补 GitHub Release。
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
|
|
41
|
-
trap 'rm -f "$notes_file"' EXIT
|
|
42
|
-
|
|
43
|
-
# 1. 抽取 CHANGELOG 段落作为 Release notes
|
|
44
|
-
awk -v v="X.Y.Z" '
|
|
45
|
-
$0 ~ "^## \\["v"\\]" { found=1; print; next }
|
|
46
|
-
found && /^## \[/ { exit }
|
|
47
|
-
found && /^---[[:space:]]*$/ { next }
|
|
48
|
-
found { print }
|
|
49
|
-
' CHANGELOGS.md > "$notes_file"
|
|
50
|
-
|
|
40
|
+
# 1. 按 release-notes-injection.md 的抽取片段从 CHANGELOG.md 得到 notes_file
|
|
51
41
|
# 2. 手动创建 GitHub Release
|
|
52
42
|
gh release create vX.Y.Z \
|
|
53
43
|
--title "Release vX.Y.Z" \
|
|
54
44
|
--notes-file "$notes_file" \
|
|
55
45
|
--latest
|
|
56
46
|
|
|
57
|
-
# 3.
|
|
58
|
-
npm view <pkg> version # 应 == X.Y.Z
|
|
59
|
-
gh release view vX.Y.Z --json body,isDraft,isPrerelease
|
|
47
|
+
# 3. 三端再次校验——见 release-pipeline.md Phase 5
|
|
60
48
|
```
|
|
61
49
|
|
|
62
50
|
**错误码映射**:通常是基础设施层错误(GitHub API 抖动 / token 权限缺 `contents: write`),不计入项目业务错误字典。
|
|
@@ -118,7 +106,7 @@ git push origin vX.Y.Z
|
|
|
118
106
|
> 反重复失败原则:同根因连续失败时,必须先声明新尝试与上次的差异。
|
|
119
107
|
|
|
120
108
|
- **同根因连续失败 ≥ 2 次** → 必须先停手,**书面声明**本次重试与上次的差异
|
|
121
|
-
- 未声明差异即重试 → 触发 `E010_repeatedFailurePattern
|
|
109
|
+
- 未声明差异即重试 → 触发 `E010_repeatedFailurePattern`,发布编排流程应主动暂停,等待用户输入差异声明
|
|
122
110
|
|
|
123
111
|
例:场景 C 中 NPM_TOKEN 失效连续两次 fail,第二次失败后必须先确认 token 已真正更新(粘贴新 token 的尾 4 位摘要 / GitHub Secrets 更新时间),再继续。
|
|
124
112
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Phase 0 — 前置检测完整清单
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 本文件是发布编排流程([release-pipeline.md](release-pipeline.md))Phase 0 的「展开形态」。编排正文只列出核心前置;这里给出 11 项完整探测、失败信号与建议修复。
|
|
4
4
|
> 全部探测都是**只读**的,不会修改任何文件。任一项不通过 → 命令终止,输出修复建议;不要尝试自动跳过。
|
|
5
5
|
|
|
6
6
|
## 探测矩阵
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
- 探测项 10:影响 Phase 2 是否进入 docs-sync 主流程
|
|
29
29
|
- 探测项 11:直接关系到能否打 tag,必须在 Phase 0 阶段就排除
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## 与后续 Phase 的边界
|
|
32
32
|
|
|
33
|
-
Phase 0
|
|
33
|
+
Phase 0 只做**只读探测**,不执行任何修复 SOP:
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
35
|
+
- 提交与版本操作在 Phase 1 / Phase 3(见 [version-bump-flow.md](version-bump-flow.md))
|
|
36
|
+
- 文档同步在 Phase 2 / Phase 6(由调用方执行 `docs-sync` command)
|
|
37
|
+
- 发布监控、验证与恢复在 Phase 4 / 5(见 [release-pipeline.md](release-pipeline.md)、[failure-recovery.md](failure-recovery.md))
|
|
38
38
|
|
|
39
|
-
如果 Phase 0
|
|
39
|
+
如果 Phase 0 嗅探到的状态需要某个修复 SOP(如 release.yml 缺失),明确转交对应 reference,不要在前置检测阶段现场修复。
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
| 直 push main(无 PR 流程) | 仅 `Full Changelog: vA...vB` 一行 | 生成器没有 PR 可分类,只能给 compare 链接 |
|
|
14
14
|
| 有 PR 但仓库没有 `.github/release.yml` | 全部 PR 都被塞进 "What's Changed" 一节 | 没有 label → 章节映射 |
|
|
15
15
|
|
|
16
|
-
而仓库通常已经维护了 `
|
|
16
|
+
而仓库通常已经维护了 `CHANGELOG.md`(Keep a Changelog 格式)。**正确做法是把 CHANGELOG 段落作为 Release 正文的事实来源**,自动生成器仅作为补充链接。
|
|
17
17
|
|
|
18
18
|
## 2. 注入方案
|
|
19
19
|
|
|
20
|
-
核心思路:在 workflow 里加一步,从 `
|
|
20
|
+
核心思路:在 workflow 里加一步,从 `CHANGELOG.md` 抽取当前 tag 对应的版本段落,写到 `release-notes.md`,再通过 `softprops/action-gh-release` 的 `body_path` 注入。
|
|
21
21
|
|
|
22
22
|
### 2.1 完整 workflow 步骤
|
|
23
23
|
|
|
24
24
|
加到 `Verify bin entry` 之后、`Publish to npm` 之前(也可以放 publish 之后,只要在 Create GitHub Release 之前):
|
|
25
25
|
|
|
26
26
|
```yaml
|
|
27
|
-
- name: Extract release notes from
|
|
27
|
+
- name: Extract release notes from CHANGELOG.md
|
|
28
28
|
run: |
|
|
29
29
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
30
30
|
awk -v v="$VERSION" '
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
found && /^## \[/ { exit }
|
|
33
33
|
found && /^---[[:space:]]*$/ { next }
|
|
34
34
|
found { print }
|
|
35
|
-
'
|
|
35
|
+
' CHANGELOG.md > release-notes.md
|
|
36
36
|
|
|
37
37
|
if [ ! -s release-notes.md ]; then
|
|
38
|
-
echo "::warning::
|
|
39
|
-
echo "See [
|
|
38
|
+
echo "::warning::CHANGELOG.md 中未找到 [$VERSION] 段落,回退到自动生成。"
|
|
39
|
+
echo "See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details." > release-notes.md
|
|
40
40
|
fi
|
|
41
41
|
|
|
42
42
|
echo "--- Release notes preview ---"
|
|
@@ -100,7 +100,7 @@ awk -v v="$VERSION" '
|
|
|
100
100
|
found && /^## \[/ { exit }
|
|
101
101
|
found && /^---[[:space:]]*$/ { next }
|
|
102
102
|
found { print }
|
|
103
|
-
'
|
|
103
|
+
' CHANGELOG.md > "$notes_file" && \
|
|
104
104
|
gh release edit "v$VERSION" --notes-file "$notes_file"
|
|
105
105
|
```
|
|
106
106
|
|
|
@@ -120,7 +120,7 @@ for v in 0.0.7 0.0.8 0.0.9; do
|
|
|
120
120
|
found && /^## \[/ { exit }
|
|
121
121
|
found && /^---[[:space:]]*$/ { next }
|
|
122
122
|
found { print }
|
|
123
|
-
'
|
|
123
|
+
' CHANGELOG.md > "$notes_file"
|
|
124
124
|
|
|
125
125
|
if [ -s "$notes_file" ]; then
|
|
126
126
|
gh release edit "v$v" --notes-file "$notes_file"
|
|
@@ -210,23 +210,9 @@ Full Changelog: v0.0.9...v0.0.10
|
|
|
210
210
|
|
|
211
211
|
**原因**:`softprops/action-gh-release@v2` 只设了 `generate_release_notes: true`,而 GitHub 自动生成器从 PR 标题 + label 抽取 changelog。直 push main 的仓库没有 PR 流量,生成器只剩 compare 链接可写。
|
|
212
212
|
|
|
213
|
-
**修复(workflow 改造)**:在 Create GitHub Release 之前加一步从 `
|
|
213
|
+
**修复(workflow 改造)**:在 Create GitHub Release 之前加一步从 `CHANGELOG.md` 抽取段落,再用 `body_path` 注入。完整 YAML 见 [workflow-yaml-reference.md](workflow-yaml-reference.md) 的 `Extract release notes from CHANGELOG.md` 步骤;模式说明见 [release-notes-injection.md](release-notes-injection.md)。
|
|
214
214
|
|
|
215
|
-
**修复(事后回填历史 Release
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
VERSION="0.0.10"
|
|
219
|
-
notes_file="$(mktemp -t speculo-release-notes.XXXXXX)"
|
|
220
|
-
trap 'rm -f "$notes_file"' EXIT
|
|
221
|
-
|
|
222
|
-
awk -v v="$VERSION" '
|
|
223
|
-
$0 ~ "^## \\["v"\\]" { found=1; print; next }
|
|
224
|
-
found && /^## \[/ { exit }
|
|
225
|
-
found && /^---[[:space:]]*$/ { next }
|
|
226
|
-
found { print }
|
|
227
|
-
' CHANGELOGS.md > "$notes_file" && \
|
|
228
|
-
gh release edit "v$VERSION" --notes-file "$notes_file"
|
|
229
|
-
```
|
|
215
|
+
**修复(事后回填历史 Release,无需重发版)**:按 [release-notes-injection.md](release-notes-injection.md) 抽取 CHANGELOG 段落,再 `gh release edit "v$VERSION" --notes-file "$notes_file"`。
|
|
230
216
|
|
|
231
217
|
**诊断**:
|
|
232
218
|
|
|
@@ -247,7 +233,7 @@ gh run view <run-id> --json jobs \
|
|
|
247
233
|
|
|
248
234
|
```bash
|
|
249
235
|
# 实际 CHANGELOG 标题
|
|
250
|
-
grep '^## \['
|
|
236
|
+
grep '^## \[' CHANGELOG.md | head -5
|
|
251
237
|
|
|
252
238
|
# 当前 tag 应当对应的标题
|
|
253
239
|
echo "## [${GITHUB_REF_NAME#v}]"
|
|
@@ -303,5 +289,5 @@ npm deprecate @scope/my-cli@0.0.2 "Security issue, use 0.0.3+"
|
|
|
303
289
|
6. [ ] Workflow 触发器是 `on.push.tags: ['v*']`,没写 branches
|
|
304
290
|
7. [ ] `bin` 路径以 `./` 开头
|
|
305
291
|
8. [ ] `files` 字段不排除构建产物
|
|
306
|
-
9. [ ] **Workflow 包含 `Extract release notes from
|
|
307
|
-
10. [ ] **
|
|
292
|
+
9. [ ] **Workflow 包含 `Extract release notes from CHANGELOG.md` 步骤,且 `Create GitHub Release` 设了 `body_path: release-notes.md`**
|
|
293
|
+
10. [ ] **CHANGELOG.md 顶部有当前版本对应的 `## [X.Y.Z]` 段落(半角中括号)**
|
|
@@ -15,14 +15,14 @@ git log origin/main..HEAD --oneline
|
|
|
15
15
|
git tag --sort=-version:refname | head -3
|
|
16
16
|
|
|
17
17
|
# 4. CHANGELOG 顶部 [Unreleased] 段落已写好本次内容
|
|
18
|
-
head -30
|
|
18
|
+
head -30 CHANGELOG.md
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
任意一项异常先解决再发版:工作区不干净 → 先提交,或调用 docs-sync 按其清洁契约处理;`[Unreleased]` 为空 → 先做 docs-sync。禁止用 stash 隐藏待发布改动。
|
|
22
22
|
|
|
23
23
|
## 1. 维护 CHANGELOG
|
|
24
24
|
|
|
25
|
-
`
|
|
25
|
+
`CHANGELOG.md` 顶部必须始终保留 `[Unreleased]` 段落。新版本发布时:
|
|
26
26
|
|
|
27
27
|
1. 把 `[Unreleased]` 内容**整段迁移**到新建的 `## [X.Y.Z] — YYYY-MM-DD` 标题下
|
|
28
28
|
2. 重新插入空的 `[Unreleased]` 段落
|
|
@@ -67,10 +67,10 @@ npm version 0.0.10 --no-git-tag-version
|
|
|
67
67
|
|
|
68
68
|
## 3. release commit(原子提交)
|
|
69
69
|
|
|
70
|
-
把 `package.json` + `
|
|
70
|
+
把 `package.json` + `CHANGELOG.md` 一并提交,使用 Conventional Commits 的 `chore(release):` 前缀。
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
|
-
git add package.json
|
|
73
|
+
git add package.json CHANGELOG.md
|
|
74
74
|
git commit -m "chore(release): v0.0.10" \
|
|
75
75
|
-m "迁移 [Unreleased] 段落到 0.0.10:<一两句关键变更摘要>"
|
|
76
76
|
```
|
|
@@ -129,33 +129,13 @@ gh run list --workflow release.yml --limit 3 \
|
|
|
129
129
|
6. Run tests
|
|
130
130
|
7. Build
|
|
131
131
|
8. **Verify bin entry**
|
|
132
|
-
9. **Extract release notes from
|
|
132
|
+
9. **Extract release notes from CHANGELOG.md** ← v1.1.0 新增
|
|
133
133
|
10. **Publish to npm**
|
|
134
134
|
11. **Create GitHub Release**
|
|
135
135
|
|
|
136
136
|
## 7. 三端验证
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
# 1. npm 包已上线(CDN 30–60 秒延迟)
|
|
140
|
-
npm view @scope/pkg version
|
|
141
|
-
npm view @scope/pkg dist-tags
|
|
142
|
-
|
|
143
|
-
# 2. GitHub Release 存在 + 正文非空
|
|
144
|
-
gh release view v0.0.10 --json name,tagName,isDraft,isPrerelease,body \
|
|
145
|
-
--jq '{name, tagName, isDraft, isPrerelease, body_length: (.body | length), body_preview: (.body | .[0:200])}'
|
|
146
|
-
|
|
147
|
-
# 3. workflow conclusion=success 且所有步骤 success
|
|
148
|
-
gh run view <run-id> --json conclusion,jobs \
|
|
149
|
-
--jq '{conclusion, steps: [.jobs[].steps[] | {name, conclusion}]}'
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
任一缺失视为发布残次品:
|
|
153
|
-
|
|
154
|
-
| 缺失项 | 修复 |
|
|
155
|
-
|--------|------|
|
|
156
|
-
| npm 包查不到 | 等 60 秒再查;仍无 → 看 workflow `Publish to npm` 步骤日志 |
|
|
157
|
-
| Release 正文为空 / 仅一行 Full Changelog | 跑 [release-notes-injection.md](release-notes-injection.md) §3 的事后修复 |
|
|
158
|
-
| workflow `Extract release notes` 失败 | CHANGELOG 标题与 tag 不匹配,核对 `## [X.Y.Z]` 是否存在 |
|
|
138
|
+
完整命令与判定见 [release-pipeline.md](release-pipeline.md) Phase 5(`npm view` / `gh release view` / `gh run view`)。任一缺失视为发布残次品;Release 正文为空时按 [release-notes-injection.md](release-notes-injection.md) 事后修复。
|
|
159
139
|
|
|
160
140
|
## 8. 失败回滚
|
|
161
141
|
|
|
@@ -187,7 +167,7 @@ notes_file="$(mktemp -t speculo-release-notes.XXXXXX)"
|
|
|
187
167
|
trap 'rm -f "$notes_file"' EXIT
|
|
188
168
|
|
|
189
169
|
# 抽取 CHANGELOG 段落
|
|
190
|
-
awk -v v="0.0.10" '...'
|
|
170
|
+
awk -v v="0.0.10" '...' CHANGELOG.md > "$notes_file"
|
|
191
171
|
|
|
192
172
|
# 手动创建 GitHub Release
|
|
193
173
|
gh release create v0.0.10 --notes-file "$notes_file" --latest
|
|
@@ -213,7 +193,7 @@ npm view @scope/pkg@0.0.10 version
|
|
|
213
193
|
```bash
|
|
214
194
|
# bump 到下一个补丁
|
|
215
195
|
npm version 0.0.11 --no-git-tag-version
|
|
216
|
-
git add package.json
|
|
196
|
+
git add package.json CHANGELOG.md
|
|
217
197
|
git commit -m "chore(release): v0.0.11"
|
|
218
198
|
git push origin main
|
|
219
199
|
git tag v0.0.11
|
|
@@ -52,7 +52,7 @@ jobs:
|
|
|
52
52
|
- name: Verify bin entry
|
|
53
53
|
run: node scripts/verify-bin.mjs
|
|
54
54
|
|
|
55
|
-
- name: Extract release notes from
|
|
55
|
+
- name: Extract release notes from CHANGELOG.md
|
|
56
56
|
run: |
|
|
57
57
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
58
58
|
awk -v v="$VERSION" '
|
|
@@ -60,11 +60,11 @@ jobs:
|
|
|
60
60
|
found && /^## \[/ { exit }
|
|
61
61
|
found && /^---[[:space:]]*$/ { next }
|
|
62
62
|
found { print }
|
|
63
|
-
'
|
|
63
|
+
' CHANGELOG.md > release-notes.md
|
|
64
64
|
|
|
65
65
|
if [ ! -s release-notes.md ]; then
|
|
66
|
-
echo "::warning::
|
|
67
|
-
echo "See [
|
|
66
|
+
echo "::warning::CHANGELOG.md 中未找到 [$VERSION] 段落,回退到自动生成。"
|
|
67
|
+
echo "See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details." > release-notes.md
|
|
68
68
|
fi
|
|
69
69
|
|
|
70
70
|
- name: Publish to npm
|
|
@@ -173,10 +173,10 @@ permissions:
|
|
|
173
173
|
|
|
174
174
|
CLI 包专有:确认 `dist/cli/index.js` 存在、有 shebang、可执行。防止 tsconfig 出问题导致产物不完整。
|
|
175
175
|
|
|
176
|
-
### Extract release notes from
|
|
176
|
+
### Extract release notes from CHANGELOG.md
|
|
177
177
|
|
|
178
178
|
```yaml
|
|
179
|
-
- name: Extract release notes from
|
|
179
|
+
- name: Extract release notes from CHANGELOG.md
|
|
180
180
|
run: |
|
|
181
181
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
182
182
|
awk -v v="$VERSION" '
|
|
@@ -184,11 +184,11 @@ CLI 包专有:确认 `dist/cli/index.js` 存在、有 shebang、可执行。
|
|
|
184
184
|
found && /^## \[/ { exit }
|
|
185
185
|
found && /^---[[:space:]]*$/ { next }
|
|
186
186
|
found { print }
|
|
187
|
-
'
|
|
187
|
+
' CHANGELOG.md > release-notes.md
|
|
188
188
|
|
|
189
189
|
if [ ! -s release-notes.md ]; then
|
|
190
190
|
echo "::warning::..." >&2
|
|
191
|
-
echo "See [
|
|
191
|
+
echo "See [CHANGELOG.md](...) for details." > release-notes.md
|
|
192
192
|
fi
|
|
193
193
|
```
|
|
194
194
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# 咨询输出:<问题一句话概括>
|
|
2
|
+
|
|
3
|
+
<!-- 由 deliver 阶段整合四阶段产物填写。保持教员第一人称,正文为连贯的咨询答复。 -->
|
|
4
|
+
|
|
5
|
+
## 答复
|
|
6
|
+
|
|
7
|
+
<!-- 连贯的第一人称咨询答复正文。五拍论证节奏可辨识:
|
|
8
|
+
拍1【破题】用定义或反问点出根本问题 → 拍2【切割】"不是A而是B"剥掉表象 →
|
|
9
|
+
拍3【定向】抓主要矛盾分清主次 → 拍4【点睛】落一句比喻/古语/史例 → 拍5【收尾】给方法+给信心 -->
|
|
10
|
+
|
|
11
|
+
<正文>
|
|
12
|
+
|
|
13
|
+
<!-- 收尾四动作(必须齐全,融入正文结尾):
|
|
14
|
+
1. 给方向——点明主要矛盾与战略判断
|
|
15
|
+
2. 给步骤——2–3 步具体行动,"一仗一仗打"
|
|
16
|
+
3. 给检验——如何验证,"做了再看"
|
|
17
|
+
4. 给信心——战略乐观,承认"道路是曲折的" -->
|
|
18
|
+
|
|
19
|
+
## 内在张力
|
|
20
|
+
|
|
21
|
+
<!-- 若答复涉及以下张力(理论与实践 / 群众路线与精英决策 / 持久与速决 / 团结与斗争),逐条坦诚标注处理方式;无则写"无"。 -->
|
|
22
|
+
|
|
23
|
+
- <张力名称>:<本次答复中如何处理>
|
|
24
|
+
|
|
25
|
+
## 引用索引
|
|
26
|
+
|
|
27
|
+
<!-- 每条引用一行。逐字直引加引号;概括转述标"转述"。篇目编号对应 books/src/NNN-*.md。 -->
|
|
28
|
+
|
|
29
|
+
| 引用 | 篇目 | 形式 |
|
|
30
|
+
|------|------|------|
|
|
31
|
+
| "<金句原文>" | 《篇目名》(NNN) | 直引 |
|
|
32
|
+
| <概括内容> | 《篇目名》 | 转述 |
|