@chenmk/superflow 0.1.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.
Files changed (198) hide show
  1. package/INSTALL.en.md +106 -0
  2. package/INSTALL.md +664 -0
  3. package/LICENSE +21 -0
  4. package/README.md +142 -0
  5. package/README.zh-CN.md +117 -0
  6. package/assets/context-templates/business-rules.md +98 -0
  7. package/assets/context-templates/decisions.md +153 -0
  8. package/assets/context-templates/external-systems.md +166 -0
  9. package/assets/context-templates/incidents.md +89 -0
  10. package/assets/manifest.json +53 -0
  11. package/assets/prompts/superflow-archive.md +9 -0
  12. package/assets/prompts/superflow-clarify.md +10 -0
  13. package/assets/prompts/superflow-design.md +10 -0
  14. package/assets/prompts/superflow-docs.md +10 -0
  15. package/assets/prompts/superflow-implement.md +10 -0
  16. package/assets/prompts/superflow-pipeline.md +13 -0
  17. package/assets/prompts/superflow-verify.md +10 -0
  18. package/assets/rules/superflow-phase-guard.md +50 -0
  19. package/assets/scripts/claude-auto-backup-hook.sh +313 -0
  20. package/assets/scripts/codex-auto-backup-hook.sh +361 -0
  21. package/assets/scripts/install-sql-pre-commit.sh +44 -0
  22. package/assets/scripts/superflow-contract-hooks.sh +744 -0
  23. package/assets/scripts/superflow-delivery-check.sh +315 -0
  24. package/assets/scripts/superflow-dependency-update-hook.sh +161 -0
  25. package/assets/scripts/superflow-enforce-hook.sh +70 -0
  26. package/assets/scripts/superflow-hook-guard.sh +132 -0
  27. package/assets/scripts/superflow-integration-evidence-hook.sh +80 -0
  28. package/assets/scripts/superflow-sql-sync-hook.py +950 -0
  29. package/assets/scripts/superflow-test-report-lint.py +433 -0
  30. package/assets/scripts/superflow-verify-integration.sh +90 -0
  31. package/assets/scripts/sync-settings-json.py +52 -0
  32. package/assets/skills/api-doc-changelog/SKILL.md +193 -0
  33. package/assets/skills/openspec-apply-change/SKILL.md +156 -0
  34. package/assets/skills/openspec-archive-change/SKILL.md +114 -0
  35. package/assets/skills/openspec-explore/SKILL.md +288 -0
  36. package/assets/skills/openspec-propose/SKILL.md +110 -0
  37. package/assets/skills/superflow-archive/SKILL.md +61 -0
  38. package/assets/skills/superflow-clarify/SKILL.md +146 -0
  39. package/assets/skills/superflow-clarify/agents/openai.yaml +4 -0
  40. package/assets/skills/superflow-design/SKILL.md +83 -0
  41. package/assets/skills/superflow-design/agents/openai.yaml +4 -0
  42. package/assets/skills/superflow-docs/SKILL.md +316 -0
  43. package/assets/skills/superflow-docs/agents/openai.yaml +4 -0
  44. package/assets/skills/superflow-hotfix/SKILL.md +48 -0
  45. package/assets/skills/superflow-implement/SKILL.md +461 -0
  46. package/assets/skills/superflow-implement/agents/openai.yaml +4 -0
  47. package/assets/skills/superflow-pipeline/SKILL.md +844 -0
  48. package/assets/skills/superflow-pipeline/agents/openai.yaml +4 -0
  49. package/assets/skills/superflow-pipeline/references/api-design-template.md +431 -0
  50. package/assets/skills/superflow-pipeline/references/architecture-design-template.md +119 -0
  51. package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +536 -0
  52. package/assets/skills/superflow-pipeline/references/batch-split-guide.md +140 -0
  53. package/assets/skills/superflow-pipeline/references/decision-point.md +30 -0
  54. package/assets/skills/superflow-pipeline/references/dirty-worktree.md +35 -0
  55. package/assets/skills/superflow-pipeline/references/document-templates.md +123 -0
  56. package/assets/skills/superflow-pipeline/references/feature-gated-workflow.md +124 -0
  57. package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +1056 -0
  58. package/assets/skills/superflow-pipeline/references/mock-strategy-guide.md +86 -0
  59. package/assets/skills/superflow-pipeline/references/openspec-format.md +57 -0
  60. package/assets/skills/superflow-pipeline/references/orchestration.md +639 -0
  61. package/assets/skills/superflow-pipeline/references/p0-baseline-template.md +174 -0
  62. package/assets/skills/superflow-pipeline/references/project-config.md +40 -0
  63. package/assets/skills/superflow-pipeline/references/prompt-usage-template.md +152 -0
  64. package/assets/skills/superflow-pipeline/references/quality-gate.md +299 -0
  65. package/assets/skills/superflow-pipeline/references/quality-standards.md +190 -0
  66. package/assets/skills/superflow-pipeline/references/reviewer-checklist.md +154 -0
  67. package/assets/skills/superflow-pipeline/references/sql-risk-review-checklist.md +323 -0
  68. package/assets/skills/superflow-pipeline/references/subagent-progress.md +90 -0
  69. package/assets/skills/superflow-pipeline/references/superpower-technical-design-template.md +125 -0
  70. package/assets/skills/superflow-pipeline/references/test-execution-template.md +220 -0
  71. package/assets/skills/superflow-pipeline/references/test-guide.md +30 -0
  72. package/assets/skills/superflow-pipeline/references/traceability-matrix.md +106 -0
  73. package/assets/skills/superflow-pipeline/references/validation-integrity.md +134 -0
  74. package/assets/skills/superflow-pipeline/scripts/superflow-archive.sh +178 -0
  75. package/assets/skills/superflow-pipeline/scripts/superflow-env.sh +118 -0
  76. package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +428 -0
  77. package/assets/skills/superflow-pipeline/scripts/superflow-handoff.sh +296 -0
  78. package/assets/skills/superflow-pipeline/scripts/superflow-state.sh +574 -0
  79. package/assets/skills/superflow-pipeline/scripts/superflow-status.sh +172 -0
  80. package/assets/skills/superflow-pipeline/scripts/superflow-yaml-validate.sh +138 -0
  81. package/assets/skills/superflow-table-impact-analysis/SKILL.md +77 -0
  82. package/assets/skills/superflow-tweak/SKILL.md +46 -0
  83. package/assets/skills/superflow-verify/SKILL.md +112 -0
  84. package/assets/skills-en/api-doc-changelog/SKILL.md +193 -0
  85. package/assets/skills-en/openspec-apply-change/SKILL.md +156 -0
  86. package/assets/skills-en/openspec-archive-change/SKILL.md +114 -0
  87. package/assets/skills-en/openspec-explore/SKILL.md +288 -0
  88. package/assets/skills-en/openspec-propose/SKILL.md +110 -0
  89. package/assets/skills-en/superflow-archive/SKILL.md +61 -0
  90. package/assets/skills-en/superflow-clarify/SKILL.md +146 -0
  91. package/assets/skills-en/superflow-clarify/agents/openai.yaml +4 -0
  92. package/assets/skills-en/superflow-design/SKILL.md +83 -0
  93. package/assets/skills-en/superflow-design/agents/openai.yaml +4 -0
  94. package/assets/skills-en/superflow-docs/SKILL.md +316 -0
  95. package/assets/skills-en/superflow-docs/agents/openai.yaml +4 -0
  96. package/assets/skills-en/superflow-hotfix/SKILL.md +48 -0
  97. package/assets/skills-en/superflow-implement/SKILL.md +461 -0
  98. package/assets/skills-en/superflow-implement/agents/openai.yaml +4 -0
  99. package/assets/skills-en/superflow-pipeline/SKILL.md +844 -0
  100. package/assets/skills-en/superflow-pipeline/agents/openai.yaml +4 -0
  101. package/assets/skills-en/superflow-pipeline/references/api-design-template.md +431 -0
  102. package/assets/skills-en/superflow-pipeline/references/architecture-design-template.md +119 -0
  103. package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +536 -0
  104. package/assets/skills-en/superflow-pipeline/references/batch-split-guide.md +140 -0
  105. package/assets/skills-en/superflow-pipeline/references/decision-point.md +30 -0
  106. package/assets/skills-en/superflow-pipeline/references/dirty-worktree.md +35 -0
  107. package/assets/skills-en/superflow-pipeline/references/document-templates.md +123 -0
  108. package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +124 -0
  109. package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +1056 -0
  110. package/assets/skills-en/superflow-pipeline/references/mock-strategy-guide.md +86 -0
  111. package/assets/skills-en/superflow-pipeline/references/openspec-format.md +57 -0
  112. package/assets/skills-en/superflow-pipeline/references/orchestration.md +639 -0
  113. package/assets/skills-en/superflow-pipeline/references/p0-baseline-template.md +174 -0
  114. package/assets/skills-en/superflow-pipeline/references/project-config.md +40 -0
  115. package/assets/skills-en/superflow-pipeline/references/prompt-usage-template.md +152 -0
  116. package/assets/skills-en/superflow-pipeline/references/quality-gate.md +299 -0
  117. package/assets/skills-en/superflow-pipeline/references/quality-standards.md +190 -0
  118. package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +154 -0
  119. package/assets/skills-en/superflow-pipeline/references/sql-risk-review-checklist.md +323 -0
  120. package/assets/skills-en/superflow-pipeline/references/subagent-progress.md +90 -0
  121. package/assets/skills-en/superflow-pipeline/references/superpower-technical-design-template.md +125 -0
  122. package/assets/skills-en/superflow-pipeline/references/test-execution-template.md +220 -0
  123. package/assets/skills-en/superflow-pipeline/references/test-guide.md +30 -0
  124. package/assets/skills-en/superflow-pipeline/references/traceability-matrix.md +106 -0
  125. package/assets/skills-en/superflow-pipeline/references/validation-integrity.md +134 -0
  126. package/assets/skills-en/superflow-pipeline/scripts/superflow-archive.sh +178 -0
  127. package/assets/skills-en/superflow-pipeline/scripts/superflow-env.sh +118 -0
  128. package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +428 -0
  129. package/assets/skills-en/superflow-pipeline/scripts/superflow-handoff.sh +296 -0
  130. package/assets/skills-en/superflow-pipeline/scripts/superflow-state.sh +574 -0
  131. package/assets/skills-en/superflow-pipeline/scripts/superflow-status.sh +172 -0
  132. package/assets/skills-en/superflow-pipeline/scripts/superflow-yaml-validate.sh +138 -0
  133. package/assets/skills-en/superflow-table-impact-analysis/SKILL.md +77 -0
  134. package/assets/skills-en/superflow-tweak/SKILL.md +46 -0
  135. package/assets/skills-en/superflow-verify/SKILL.md +112 -0
  136. package/dist/cli/index.js +186 -0
  137. package/dist/cli/index.js.map +1 -0
  138. package/dist/commands/archive.js +6 -0
  139. package/dist/commands/archive.js.map +1 -0
  140. package/dist/commands/clarify.js +6 -0
  141. package/dist/commands/clarify.js.map +1 -0
  142. package/dist/commands/design.js +6 -0
  143. package/dist/commands/design.js.map +1 -0
  144. package/dist/commands/docs.js +6 -0
  145. package/dist/commands/docs.js.map +1 -0
  146. package/dist/commands/doctor.js +473 -0
  147. package/dist/commands/doctor.js.map +1 -0
  148. package/dist/commands/implement.js +6 -0
  149. package/dist/commands/implement.js.map +1 -0
  150. package/dist/commands/init.js +471 -0
  151. package/dist/commands/init.js.map +1 -0
  152. package/dist/commands/pipeline.js +6 -0
  153. package/dist/commands/pipeline.js.map +1 -0
  154. package/dist/commands/scan.js +59 -0
  155. package/dist/commands/scan.js.map +1 -0
  156. package/dist/commands/status.js +173 -0
  157. package/dist/commands/status.js.map +1 -0
  158. package/dist/commands/uninstall.js +213 -0
  159. package/dist/commands/uninstall.js.map +1 -0
  160. package/dist/commands/update.js +187 -0
  161. package/dist/commands/update.js.map +1 -0
  162. package/dist/commands/verify.js +6 -0
  163. package/dist/commands/verify.js.map +1 -0
  164. package/dist/core/assets.js +27 -0
  165. package/dist/core/assets.js.map +1 -0
  166. package/dist/core/context.js +100 -0
  167. package/dist/core/context.js.map +1 -0
  168. package/dist/core/dependencies.js +146 -0
  169. package/dist/core/dependencies.js.map +1 -0
  170. package/dist/core/detect.js +71 -0
  171. package/dist/core/detect.js.map +1 -0
  172. package/dist/core/i18n.js +103 -0
  173. package/dist/core/i18n.js.map +1 -0
  174. package/dist/core/integrity.js +46 -0
  175. package/dist/core/integrity.js.map +1 -0
  176. package/dist/core/manifest.js +18 -0
  177. package/dist/core/manifest.js.map +1 -0
  178. package/dist/core/prompts.js +20 -0
  179. package/dist/core/prompts.js.map +1 -0
  180. package/dist/core/registry.js +134 -0
  181. package/dist/core/registry.js.map +1 -0
  182. package/dist/core/rules.js +17 -0
  183. package/dist/core/rules.js.map +1 -0
  184. package/dist/core/scripts.js +40 -0
  185. package/dist/core/scripts.js.map +1 -0
  186. package/dist/core/skill-check.js +31 -0
  187. package/dist/core/skill-check.js.map +1 -0
  188. package/dist/core/skills.js +56 -0
  189. package/dist/core/skills.js.map +1 -0
  190. package/dist/core/state.js +43 -0
  191. package/dist/core/state.js.map +1 -0
  192. package/dist/types.js +2 -0
  193. package/dist/types.js.map +1 -0
  194. package/dist/utils/path.js +11 -0
  195. package/dist/utils/path.js.map +1 -0
  196. package/dist/utils/shell.js +29 -0
  197. package/dist/utils/shell.js.map +1 -0
  198. package/package.json +60 -0
@@ -0,0 +1,193 @@
1
+ ---
2
+ name: api-doc-changelog
3
+ description: >
4
+ 规范 API 联调文档(api.md)的变更标注格式。当编写或更新前后端联调接口文档时,
5
+ 自动在接口和字段级别标注变更类型,让前端 agent 一眼看出两个版本之间改了什么。
6
+ 适用于:写 api.md、更新 api.md、推送飞书前检查文档、SuperBridge Flow 流程生成接口设计。
7
+ 触发词:api文档变更、接口变更标记、changelog、联调文档更新、接口变更标注、
8
+ 变更追踪、接口diff、版本变更、提测文档。
9
+ ---
10
+
11
+ # API 文档变更标注规范
12
+
13
+ ## 为什么需要这个规范
14
+
15
+ 每次提测新版本时,前端 agent 需要快速回答三个问题:
16
+ 1. 这次新增了哪些接口?
17
+ 2. 哪些接口的参数/返回值改了?改了哪个字段?
18
+ 3. 哪些接口被废弃或删除了?
19
+
20
+ 如果这些信息藏在 2000+ 行的文档底部一个概要表格里,前端 agent 基本找不到。
21
+ 本规范通过**文档顶部的变更概览 + 接口内联标注**,让变更信息对前端 agent 零门槛可见。
22
+
23
+ ---
24
+
25
+ ## 一、文档顶部变更概览
26
+
27
+ 在 `## 1. 通用约定` 之前,插入变更概览节。格式如下:
28
+
29
+ ```markdown
30
+ ## 0. 变更概览(本次提测变更)
31
+
32
+ > 基线版本:v1.0 | 当前版本:v1.1 | 变更日期:2026-05-22
33
+
34
+ ### 新增接口
35
+
36
+ | 接口 | 说明 |
37
+ |------|------|
38
+ | `POST /api/xxx` | 新增 xxx 功能 |
39
+
40
+ ### 修改接口
41
+
42
+ | 接口 | 变更摘要 |
43
+ |------|----------|
44
+ | `GET /api/yyy` | 新增 query 参数 `keyword`;响应增加 `tag` 字段 |
45
+ | `PUT /api/zzz/{id}` | 入参 `status` 枚举值新增 `3=待审核` |
46
+
47
+ ### 废弃接口
48
+
49
+ | 接口 | 替代方案 | 移除计划 |
50
+ |------|----------|----------|
51
+ | `GET /api/old` | 使用 `GET /api/new` | v2.0 移除 |
52
+ ```
53
+
54
+ ### 规则
55
+
56
+ 1. **每次提测必须更新**:推送飞书前,必须刷新变更概览节的内容和日期。
57
+ 2. **只写本次变更**:变更概览只记录"上一版基线 → 当前版本"的差量,不是完整历史。
58
+ 3. **完整历史在第 8 节**:文档末尾的"接口变更记录"表保留完整历史,格式不变。
59
+ 4. **无变更也要写**:如果没有变更,写"本次提测无接口变更,仅修复已知问题"。
60
+
61
+ ---
62
+
63
+ ## 二、接口级别内联标注
64
+
65
+ 每个接口的标题行后紧跟变更标签,用方括号标注变更类型:
66
+
67
+ ```markdown
68
+ #### `GET /api/charging-package/templates` `[新增]`
69
+
70
+ #### `PUT /api/parking-guns/{id}` `[修改]`
71
+
72
+ #### `DELETE /api/old-endpoint` `[废弃]`
73
+ ```
74
+
75
+ ### 标签类型
76
+
77
+ | 标签 | 含义 | 使用场景 |
78
+ |------|------|----------|
79
+ | `[新增]` | 本次新增的接口 | 全新开发的接口 |
80
+ | `[修改]` | 本次有改动的接口 | 参数、响应、行为有任何变化 |
81
+ | `[废弃]` | 已废弃但暂未移除 | 已有替代方案,但保留兼容 |
82
+ | 无标签 | 本次无变更 | 上个版本就存在且未修改的接口 |
83
+
84
+ ### 规则
85
+
86
+ 1. **只有本次变更的接口才加标签**,稳定接口不加。
87
+ 2. 下次提测时,上一轮的标签要**清除**(上一轮的变更已不再是"新"变更)。
88
+ 3. 接口标题和标签之间用空格分隔。
89
+
90
+ ---
91
+
92
+ ## 三、字段级别内联标注
93
+
94
+ 在参数表和响应字段表中,变更的字段在"说明"列末尾追加标注:
95
+
96
+ ### 参数/响应表的标注方式
97
+
98
+ ```markdown
99
+ | 字段 | 类型 | 必填 | 说明 |
100
+ |------|------|------|------|
101
+ | name | String | 是 | 套餐名称 |
102
+ | keyword | String | 否 | 搜索关键词 `【本次新增】` |
103
+ | status | Integer | 否 | 状态:1 上架,2 下架,3 待审核 `【枚举值变更:新增 3】` |
104
+ | oldField | String | 否 | ~~已废弃,使用 newField~~ `【本次废弃】` |
105
+ ```
106
+
107
+ ### 字段标注类型
108
+
109
+ | 标注 | 含义 | 在说明列中的写法 |
110
+ |------|------|-----------------|
111
+ | 新增字段 | 本次新增的入参或返回字段 | 追加 `【本次新增】` |
112
+ | 字段修改 | 类型、校验规则、枚举值等有变化 | 追加 `【本次变更:具体改了什么】` |
113
+ | 字段废弃 | 仍在返回但已不推荐使用 | 用删除线 + 追加 `【本次废弃】` |
114
+ | 字段移除 | 不再返回或不再接受 | 从表中移除,在变更概览中说明 |
115
+
116
+ ### 规则
117
+
118
+ 1. 标注追加在说明文字末尾,用 `【】` 包裹,与正常说明文字区分。
119
+ 2. 变更描述要**具体**:写"枚举值新增 3=待审核",不要只写"有变更"。
120
+ 3. 下次提测时清除上一轮标注。
121
+ 4. JSON 响应示例中不需要标注,以字段表为准。
122
+
123
+ ---
124
+
125
+ ## 四、操作流程
126
+
127
+ ### 4.1 首次编写 api.md(新模块)
128
+
129
+ 首次编写时不需要任何变更标注,因为没有"上一版"做对比。
130
+ 文档正常编写即可,变更概览节写:
131
+
132
+ ```markdown
133
+ ## 0. 变更概览(本次提测变更)
134
+
135
+ > 首个版本,全部接口为新增。详见接口列表。
136
+ ```
137
+
138
+ ### 4.2 更新已有 api.md(迭代开发)
139
+
140
+ 1. **读取当前 api.md**,识别所有接口和字段。
141
+ 2. **对比代码变更**(git diff、接口实现变化、DTO 字段变化)确定变更范围。
142
+ 3. **更新变更概览**:在 `## 0. 变更概览` 节中列出新增/修改/废弃的接口。
143
+ 4. **添加接口级标签**:在变更接口的标题行后追加 `[新增]`/`[修改]`/`[废弃]`。
144
+ 5. **添加字段级标注**:在变更字段的说明列末尾追加 `【本次新增】`/`【本次变更:...】`。
145
+ 6. **清除上一轮标注**:删除上一轮提测的变更标签和字段标注。
146
+ 7. **更新第 8 节历史表**:在文档末尾的变更记录表中追加一行。
147
+
148
+ ### 4.3 推送飞书前检查
149
+
150
+ 推送前确认:
151
+ - [ ] 变更概览节的版本号和日期已更新
152
+ - [ ] 所有变更接口有标签
153
+ - [ ] 所有变更字段有标注
154
+ - [ ] 上一轮的标注已清除
155
+ - [ ] 第 8 节历史表已追加
156
+
157
+ ---
158
+
159
+ ## 五、变更判定标准
160
+
161
+ 以下情况算"变更",必须标注:
162
+
163
+ | 变更类型 | 示例 |
164
+ |----------|------|
165
+ | 新增接口 | 新增 POST /api/xxx |
166
+ | 删除接口 | 移除 GET /api/old |
167
+ | 新增参数/字段 | 入参增加 keyword 字段 |
168
+ | 删除参数/字段 | 不再返回 oldField |
169
+ | 修改字段类型 | String → Long |
170
+ | 修改枚举值 | status 新增值 3 |
171
+ | 修改校验规则 | 长度限制从 64 改为 128 |
172
+ | 修改必填状态 | 可选 → 必填 |
173
+ | 修改行为逻辑 | 排序规则改变、权限逻辑变更 |
174
+ | 修改错误码 | 新增错误码或修改错误码含义 |
175
+
176
+ 以下情况**不算变更**,不需要标注:
177
+ - 修正错别字
178
+ - 调整文档格式
179
+ - 补充边界说明(不改变接口行为)
180
+ - curl 示例调整(不改变接口契约)
181
+
182
+ ---
183
+
184
+ ## 六、与 SuperBridge Flow 流程的集成
185
+
186
+ 本规范是 SuperBridge Flow 流程的一部分。在 `superflow-docs` 阶段生成 `api.md` 时:
187
+
188
+ 1. **首次生成**:按本规范第四条第 4.1 款处理,写首个版本标记。
189
+ 2. **迭代更新**:按第四条第 4.2 款处理,对比已有 api.md 标注变更。
190
+ 3. **推送飞书前**:按第四条第 4.3 款检查清单验证。
191
+
192
+ SDD 的 `api-design-template.md` 中"第 8 节 接口变更记录"继续保留作为完整历史记录。
193
+ 本规范新增的"第 0 节 变更概览"是提测时的增量视图,两者互补。
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: openspec-apply-change
3
+ description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: openspec
8
+ version: "1.0"
9
+ generatedBy: "1.3.1"
10
+ ---
11
+
12
+ Implement tasks from an OpenSpec change.
13
+
14
+ **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
15
+
16
+ **Steps**
17
+
18
+ 1. **Select the change**
19
+
20
+ If a name is provided, use it. Otherwise:
21
+ - Infer from conversation context if the user mentioned a change
22
+ - Auto-select if only one active change exists
23
+ - If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
24
+
25
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
26
+
27
+ 2. **Check status to understand the schema**
28
+ ```bash
29
+ openspec status --change "<name>" --json
30
+ ```
31
+ Parse the JSON to understand:
32
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
33
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
34
+
35
+ 3. **Get apply instructions**
36
+
37
+ ```bash
38
+ openspec instructions apply --change "<name>" --json
39
+ ```
40
+
41
+ This returns:
42
+ - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
43
+ - Progress (total, complete, remaining)
44
+ - Task list with status
45
+ - Dynamic instruction based on current state
46
+
47
+ **Handle states:**
48
+ - If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
49
+ - If `state: "all_done"`: congratulate, suggest archive
50
+ - Otherwise: proceed to implementation
51
+
52
+ 4. **Read context files**
53
+
54
+ Read every file path listed under `contextFiles` from the apply instructions output.
55
+ The files depend on the schema being used:
56
+ - **spec-driven**: proposal, specs, design, tasks
57
+ - Other schemas: follow the contextFiles from CLI output
58
+
59
+ 5. **Show current progress**
60
+
61
+ Display:
62
+ - Schema being used
63
+ - Progress: "N/M tasks complete"
64
+ - Remaining tasks overview
65
+ - Dynamic instruction from CLI
66
+
67
+ 6. **Implement tasks (loop until done or blocked)**
68
+
69
+ For each pending task:
70
+ - Show which task is being worked on
71
+ - Make the code changes required
72
+ - Keep changes minimal and focused
73
+ - Mark task complete in the tasks file: `- [ ]` → `- [x]`
74
+ - Continue to next task
75
+
76
+ **Pause if:**
77
+ - Task is unclear → ask for clarification
78
+ - Implementation reveals a design issue → suggest updating artifacts
79
+ - Error or blocker encountered → report and wait for guidance
80
+ - User interrupts
81
+
82
+ 7. **On completion or pause, show status**
83
+
84
+ Display:
85
+ - Tasks completed this session
86
+ - Overall progress: "N/M tasks complete"
87
+ - If all done: suggest archive
88
+ - If paused: explain why and wait for guidance
89
+
90
+ **Output During Implementation**
91
+
92
+ ```
93
+ ## Implementing: <change-name> (schema: <schema-name>)
94
+
95
+ Working on task 3/7: <task description>
96
+ [...implementation happening...]
97
+ ✓ Task complete
98
+
99
+ Working on task 4/7: <task description>
100
+ [...implementation happening...]
101
+ ✓ Task complete
102
+ ```
103
+
104
+ **Output On Completion**
105
+
106
+ ```
107
+ ## Implementation Complete
108
+
109
+ **Change:** <change-name>
110
+ **Schema:** <schema-name>
111
+ **Progress:** 7/7 tasks complete ✓
112
+
113
+ ### Completed This Session
114
+ - [x] Task 1
115
+ - [x] Task 2
116
+ ...
117
+
118
+ All tasks complete! Ready to archive this change.
119
+ ```
120
+
121
+ **Output On Pause (Issue Encountered)**
122
+
123
+ ```
124
+ ## Implementation Paused
125
+
126
+ **Change:** <change-name>
127
+ **Schema:** <schema-name>
128
+ **Progress:** 4/7 tasks complete
129
+
130
+ ### Issue Encountered
131
+ <description of the issue>
132
+
133
+ **Options:**
134
+ 1. <option 1>
135
+ 2. <option 2>
136
+ 3. Other approach
137
+
138
+ What would you like to do?
139
+ ```
140
+
141
+ **Guardrails**
142
+ - Keep going through tasks until done or blocked
143
+ - Always read context files before starting (from the apply instructions output)
144
+ - If task is ambiguous, pause and ask before implementing
145
+ - If implementation reveals issues, pause and suggest artifact updates
146
+ - Keep code changes minimal and scoped to each task
147
+ - Update task checkbox immediately after completing each task
148
+ - Pause on errors, blockers, or unclear requirements - don't guess
149
+ - Use contextFiles from CLI output, don't assume specific file names
150
+
151
+ **Fluid Workflow Integration**
152
+
153
+ This skill supports the "actions on a change" model:
154
+
155
+ - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
156
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: openspec-archive-change
3
+ description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: openspec
8
+ version: "1.0"
9
+ generatedBy: "1.3.1"
10
+ ---
11
+
12
+ Archive a completed change in the experimental workflow.
13
+
14
+ **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
15
+
16
+ **Steps**
17
+
18
+ 1. **If no change name provided, prompt for selection**
19
+
20
+ Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
21
+
22
+ Show only active changes (not already archived).
23
+ Include the schema used for each change if available.
24
+
25
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
26
+
27
+ 2. **Check artifact completion status**
28
+
29
+ Run `openspec status --change "<name>" --json` to check artifact completion.
30
+
31
+ Parse the JSON to understand:
32
+ - `schemaName`: The workflow being used
33
+ - `artifacts`: List of artifacts with their status (`done` or other)
34
+
35
+ **If any artifacts are not `done`:**
36
+ - Display warning listing incomplete artifacts
37
+ - Use **AskUserQuestion tool** to confirm user wants to proceed
38
+ - Proceed if user confirms
39
+
40
+ 3. **Check task completion status**
41
+
42
+ Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
43
+
44
+ Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
45
+
46
+ **If incomplete tasks found:**
47
+ - Display warning showing count of incomplete tasks
48
+ - Use **AskUserQuestion tool** to confirm user wants to proceed
49
+ - Proceed if user confirms
50
+
51
+ **If no tasks file exists:** Proceed without task-related warning.
52
+
53
+ 4. **Assess delta spec sync state**
54
+
55
+ Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
56
+
57
+ **If delta specs exist:**
58
+ - Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
59
+ - Determine what changes would be applied (adds, modifications, removals, renames)
60
+ - Show a combined summary before prompting
61
+
62
+ **Prompt options:**
63
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
64
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
65
+
66
+ If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
67
+
68
+ 5. **Perform the archive**
69
+
70
+ Create the archive directory if it doesn't exist:
71
+ ```bash
72
+ mkdir -p openspec/changes/archive
73
+ ```
74
+
75
+ Generate target name using current date: `YYYY-MM-DD-<change-name>`
76
+
77
+ **Check if target already exists:**
78
+ - If yes: Fail with error, suggest renaming existing archive or using different date
79
+ - If no: Move the change directory to archive
80
+
81
+ ```bash
82
+ mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
83
+ ```
84
+
85
+ 6. **Display summary**
86
+
87
+ Show archive completion summary including:
88
+ - Change name
89
+ - Schema that was used
90
+ - Archive location
91
+ - Whether specs were synced (if applicable)
92
+ - Note about any warnings (incomplete artifacts/tasks)
93
+
94
+ **Output On Success**
95
+
96
+ ```
97
+ ## Archive Complete
98
+
99
+ **Change:** <change-name>
100
+ **Schema:** <schema-name>
101
+ **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
102
+ **Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
103
+
104
+ All artifacts complete. All tasks complete.
105
+ ```
106
+
107
+ **Guardrails**
108
+ - Always prompt for change selection if not provided
109
+ - Use artifact graph (openspec status --json) for completion checking
110
+ - Don't block archive on warnings - just inform and confirm
111
+ - Preserve .openspec.yaml when moving to archive (it moves with the directory)
112
+ - Show clear summary of what happened
113
+ - If sync is requested, use openspec-sync-specs approach (agent-driven)
114
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting