ai-delivery-workflow 0.2.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.
Files changed (211) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +112 -0
  3. package/bin/ai-delivery.mjs +138 -0
  4. package/bin/validate-skills.mjs +12 -0
  5. package/docs/DUAL-REPOSITORY-WORKSPACE.zh-CN.md +125 -0
  6. package/docs/EVOLUTION-MAINTENANCE.zh-CN.md +75 -0
  7. package/docs/EVOLUTION-USER-GUIDE.zh-CN.md +160 -0
  8. package/docs/FILE-REFERENCE.zh-CN.md +503 -0
  9. package/docs/PROJECT-MANUAL.zh-CN.md +931 -0
  10. package/docs/STATE-CLI-MAINTENANCE.zh-CN.md +135 -0
  11. package/docs/STATE-CLI-USER-GUIDE.zh-CN.md +186 -0
  12. package/docs/VIEWER-MAINTENANCE.zh-CN.md +373 -0
  13. package/docs/VIEWER-USER-GUIDE.zh-CN.md +235 -0
  14. package/lib/delivery-state.mjs +1220 -0
  15. package/lib/evolution.mjs +971 -0
  16. package/lib/project-bootstrap.mjs +927 -0
  17. package/lib/project-installer.mjs +1184 -0
  18. package/lib/skill-validator.mjs +154 -0
  19. package/lib/toml-hooks.mjs +97 -0
  20. package/lib/workspace.mjs +302 -0
  21. package/lib/yaml-runtime.mjs +18 -0
  22. package/package.json +39 -0
  23. package/skills/ai-delivery-assemble-release/SKILL.md +27 -0
  24. package/skills/ai-delivery-assemble-release/agents/openai.yaml +4 -0
  25. package/skills/ai-delivery-assemble-release/assets/release-candidate-manifest.yaml +22 -0
  26. package/skills/ai-delivery-assemble-release/assets/release-git-plan.yaml +9 -0
  27. package/skills/ai-delivery-assemble-release/assets/release-material-index.csv +2 -0
  28. package/skills/ai-delivery-assemble-release/assets/version-inclusion.csv +2 -0
  29. package/skills/ai-delivery-assemble-release/references/release-assembly-contract.md +7 -0
  30. package/skills/ai-delivery-assemble-release/scripts/plan-release.mjs +298 -0
  31. package/skills/ai-delivery-bootstrap/SKILL.md +59 -0
  32. package/skills/ai-delivery-bootstrap/agents/openai.yaml +4 -0
  33. package/skills/ai-delivery-bootstrap/references/bootstrap-contract.md +70 -0
  34. package/skills/ai-delivery-checkpoint-task/SKILL.md +63 -0
  35. package/skills/ai-delivery-checkpoint-task/agents/openai.yaml +4 -0
  36. package/skills/ai-delivery-checkpoint-task/assets/codex-hook-config.toml +92 -0
  37. package/skills/ai-delivery-checkpoint-task/assets/runtime-template/resume.md +15 -0
  38. package/skills/ai-delivery-checkpoint-task/assets/runtime-template/task.json +30 -0
  39. package/skills/ai-delivery-checkpoint-task/assets/runtime-template/version-archive.json +10 -0
  40. package/skills/ai-delivery-checkpoint-task/references/checkpoint-contract.md +95 -0
  41. package/skills/ai-delivery-checkpoint-task/references/checkpoint-recovery.zh-CN.md +111 -0
  42. package/skills/ai-delivery-checkpoint-task/scripts/hook-event.mjs +131 -0
  43. package/skills/ai-delivery-checkpoint-task/scripts/task-state.mjs +1073 -0
  44. package/skills/ai-delivery-close-version/SKILL.md +33 -0
  45. package/skills/ai-delivery-close-version/agents/openai.yaml +4 -0
  46. package/skills/ai-delivery-close-version/assets/line-advance-record.yaml +12 -0
  47. package/skills/ai-delivery-close-version/assets/version-lineage.yaml +12 -0
  48. package/skills/ai-delivery-close-version/assets/version-manifest.yaml +20 -0
  49. package/skills/ai-delivery-close-version/references/version-closeout-contract.md +20 -0
  50. package/skills/ai-delivery-define-product/SKILL.md +76 -0
  51. package/skills/ai-delivery-define-product/agents/openai.yaml +4 -0
  52. package/skills/ai-delivery-define-product/assets/product-template/acceptance-criteria.csv +1 -0
  53. package/skills/ai-delivery-define-product/assets/product-template/discovery-baseline.md +19 -0
  54. package/skills/ai-delivery-define-product/assets/product-template/feature-detail.md +19 -0
  55. package/skills/ai-delivery-define-product/assets/product-template/feature-terminals.csv +1 -0
  56. package/skills/ai-delivery-define-product/assets/product-template/features.csv +1 -0
  57. package/skills/ai-delivery-define-product/assets/product-template/product-baseline.yaml +8 -0
  58. package/skills/ai-delivery-define-product/assets/product-template/product-manual.md +24 -0
  59. package/skills/ai-delivery-define-product/assets/product-template/terminals.csv +1 -0
  60. package/skills/ai-delivery-define-product/assets/product-template/user-stories.csv +1 -0
  61. package/skills/ai-delivery-define-product/references/product-contract.md +57 -0
  62. package/skills/ai-delivery-deploy-production/SKILL.md +45 -0
  63. package/skills/ai-delivery-deploy-production/agents/openai.yaml +4 -0
  64. package/skills/ai-delivery-deploy-production/references/deployment-contract.md +7 -0
  65. package/skills/ai-delivery-design-architecture/SKILL.md +67 -0
  66. package/skills/ai-delivery-design-architecture/agents/openai.yaml +4 -0
  67. package/skills/ai-delivery-design-architecture/assets/architecture-template/architecture-baseline.md +25 -0
  68. package/skills/ai-delivery-design-architecture/assets/architecture-template/architecture-gate.yaml +15 -0
  69. package/skills/ai-delivery-design-architecture/assets/architecture-template/prototype-architecture-validation.yaml +58 -0
  70. package/skills/ai-delivery-design-architecture/references/architecture-contract.md +32 -0
  71. package/skills/ai-delivery-design-experience/SKILL.md +71 -0
  72. package/skills/ai-delivery-design-experience/agents/openai.yaml +4 -0
  73. package/skills/ai-delivery-design-experience/assets/experience-template/canvas-catalog.csv +1 -0
  74. package/skills/ai-delivery-design-experience/assets/experience-template/canvas-pages.csv +1 -0
  75. package/skills/ai-delivery-design-experience/assets/experience-template/component-state-matrix.csv +1 -0
  76. package/skills/ai-delivery-design-experience/assets/experience-template/design-tokens.json +19 -0
  77. package/skills/ai-delivery-design-experience/assets/experience-template/experience-baseline.yaml +17 -0
  78. package/skills/ai-delivery-design-experience/assets/experience-template/experience-change-domains.csv +1 -0
  79. package/skills/ai-delivery-design-experience/assets/experience-template/experience-change-set.csv +1 -0
  80. package/skills/ai-delivery-design-experience/assets/experience-template/feature-screen-coverage.csv +1 -0
  81. package/skills/ai-delivery-design-experience/assets/experience-template/formal-ui-confirmation.yaml +33 -0
  82. package/skills/ai-delivery-design-experience/assets/experience-template/interaction-contract.csv +1 -0
  83. package/skills/ai-delivery-design-experience/assets/experience-template/low-fidelity-confirmation.yaml +32 -0
  84. package/skills/ai-delivery-design-experience/assets/experience-template/page-catalog.csv +1 -0
  85. package/skills/ai-delivery-design-experience/assets/experience-template/page-component-map.csv +1 -0
  86. package/skills/ai-delivery-design-experience/assets/experience-template/product-prototype-reconciliation.yaml +28 -0
  87. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-adjustment-log.csv +1 -0
  88. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-confirmation.yaml +99 -0
  89. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-file-terminals.csv +1 -0
  90. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-files.csv +1 -0
  91. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-impact-assessment.yaml +25 -0
  92. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-manifest.yaml +74 -0
  93. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-product-coverage.csv +1 -0
  94. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-review-comments.csv +1 -0
  95. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-review-decision.yaml +29 -0
  96. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-review-sessions.csv +1 -0
  97. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-set.yaml +22 -0
  98. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-tool-candidates.csv +1 -0
  99. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-tool-selection.yaml +22 -0
  100. package/skills/ai-delivery-design-experience/assets/experience-template/prototype-traceability.csv +1 -0
  101. package/skills/ai-delivery-design-experience/assets/experience-template/requirement-change-set.csv +1 -0
  102. package/skills/ai-delivery-design-experience/assets/experience-template/screen-states.csv +1 -0
  103. package/skills/ai-delivery-design-experience/assets/experience-template/ui-framework-candidates.csv +1 -0
  104. package/skills/ai-delivery-design-experience/assets/experience-template/ui-framework-selection.yaml +18 -0
  105. package/skills/ai-delivery-design-experience/assets/experience-template/ui-handoff.yaml +44 -0
  106. package/skills/ai-delivery-design-experience/assets/experience-template/visual-direction.yaml +16 -0
  107. package/skills/ai-delivery-design-experience/assets/experience-template/visual-system-confirmation.yaml +31 -0
  108. package/skills/ai-delivery-design-experience/references/experience-contract.md +82 -0
  109. package/skills/ai-delivery-design-experience/references/prototype-management-contract.md +68 -0
  110. package/skills/ai-delivery-design-tests/SKILL.md +56 -0
  111. package/skills/ai-delivery-design-tests/agents/openai.yaml +4 -0
  112. package/skills/ai-delivery-design-tests/assets/test-design-template/iteration-test-contract.md +19 -0
  113. package/skills/ai-delivery-design-tests/assets/test-design-template/prototype-test-scope.csv +1 -0
  114. package/skills/ai-delivery-design-tests/assets/test-design-template/prototype-test-validation.yaml +73 -0
  115. package/skills/ai-delivery-design-tests/references/test-design-contract.md +31 -0
  116. package/skills/ai-delivery-develop-iteration/SKILL.md +66 -0
  117. package/skills/ai-delivery-develop-iteration/agents/openai.yaml +4 -0
  118. package/skills/ai-delivery-develop-iteration/assets/development-template/task-experience-change-traceability.csv +1 -0
  119. package/skills/ai-delivery-develop-iteration/assets/development-template/task-prototype-traceability.csv +1 -0
  120. package/skills/ai-delivery-develop-iteration/references/development-contract.md +39 -0
  121. package/skills/ai-delivery-evolve-workflow/SKILL.md +57 -0
  122. package/skills/ai-delivery-evolve-workflow/agents/openai.yaml +4 -0
  123. package/skills/ai-delivery-evolve-workflow/references/evolution-contract.md +42 -0
  124. package/skills/ai-delivery-execute-test/SKILL.md +34 -0
  125. package/skills/ai-delivery-execute-test/agents/openai.yaml +4 -0
  126. package/skills/ai-delivery-execute-test/references/test-execution-contract.md +7 -0
  127. package/skills/ai-delivery-execute-work-package/SKILL.md +53 -0
  128. package/skills/ai-delivery-execute-work-package/agents/openai.yaml +4 -0
  129. package/skills/ai-delivery-execute-work-package/references/work-package-contract.md +20 -0
  130. package/skills/ai-delivery-manage-git/SKILL.md +60 -0
  131. package/skills/ai-delivery-manage-git/agents/openai.yaml +4 -0
  132. package/skills/ai-delivery-manage-git/references/git-policy.md +42 -0
  133. package/skills/ai-delivery-manage-standards/SKILL.md +44 -0
  134. package/skills/ai-delivery-manage-standards/agents/openai.yaml +4 -0
  135. package/skills/ai-delivery-manage-standards/assets/standards-template/standard.md +25 -0
  136. package/skills/ai-delivery-manage-standards/references/standards-contract.md +20 -0
  137. package/skills/ai-delivery-orchestrate/SKILL.md +105 -0
  138. package/skills/ai-delivery-orchestrate/agents/openai.yaml +4 -0
  139. package/skills/ai-delivery-orchestrate/assets/project-template/.codex/config.toml +92 -0
  140. package/skills/ai-delivery-orchestrate/assets/project-template/.gitattributes +6 -0
  141. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/delivery/artifact-registry.yaml +3 -0
  142. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/delivery/project.yaml +6 -0
  143. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/delivery/standards-baseline.yaml +8 -0
  144. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/delivery/workflow-state.yaml +34 -0
  145. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/evolution/decisions/.gitkeep +0 -0
  146. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/evolution/experiments/.gitkeep +0 -0
  147. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/evolution/feedback/.gitkeep +0 -0
  148. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/evolution/index.yaml +7 -0
  149. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/evolution/promotion/.gitkeep +0 -0
  150. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/evolution/proposals/.gitkeep +0 -0
  151. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/extensions/.gitkeep +0 -0
  152. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/standards/STD-ARTIFACT-PATH-001.md +47 -0
  153. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/standards/STD-DOC-LANG-001.md +62 -0
  154. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/standards/STD-TEST-LOCATION-001.md +23 -0
  155. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/standards/index.yaml +36 -0
  156. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/bootstrap/bootstrap.mjs +33 -0
  157. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/evolution/evolve.mjs +15 -0
  158. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/hooks/hook-event.mjs +131 -0
  159. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/state/state.mjs +21 -0
  160. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/public/app.js +546 -0
  161. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/public/index.html +199 -0
  162. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/public/styles.css +529 -0
  163. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/server.mjs +780 -0
  164. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/start.cmd +4 -0
  165. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/start.ps1 +2 -0
  166. package/skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/viewer/start.sh +4 -0
  167. package/skills/ai-delivery-orchestrate/assets/project-template/AGENTS.md +44 -0
  168. package/skills/ai-delivery-orchestrate/references/formal-state-contract.md +64 -0
  169. package/skills/ai-delivery-orchestrate/references/workflow-model.md +29 -0
  170. package/skills/ai-delivery-orchestrate-release/SKILL.md +33 -0
  171. package/skills/ai-delivery-orchestrate-release/agents/openai.yaml +4 -0
  172. package/skills/ai-delivery-orchestrate-release/assets/release-request.yaml +9 -0
  173. package/skills/ai-delivery-orchestrate-release/assets/version-selection.yaml +16 -0
  174. package/skills/ai-delivery-orchestrate-release/references/release-workflow-contract.md +11 -0
  175. package/skills/ai-delivery-plan-iteration/SKILL.md +57 -0
  176. package/skills/ai-delivery-plan-iteration/agents/openai.yaml +4 -0
  177. package/skills/ai-delivery-plan-iteration/assets/planning-template/backlog.csv +1 -0
  178. package/skills/ai-delivery-plan-iteration/assets/planning-template/slice-dependencies.csv +1 -0
  179. package/skills/ai-delivery-plan-iteration/assets/planning-template/slice-experience-change-traceability.csv +1 -0
  180. package/skills/ai-delivery-plan-iteration/assets/planning-template/slice-prototype-traceability.csv +1 -0
  181. package/skills/ai-delivery-plan-iteration/assets/planning-template/slice-sources.csv +1 -0
  182. package/skills/ai-delivery-plan-iteration/assets/planning-template/vertical-slices.csv +1 -0
  183. package/skills/ai-delivery-plan-iteration/references/planning-contract.md +40 -0
  184. package/skills/ai-delivery-prepare-platform/SKILL.md +49 -0
  185. package/skills/ai-delivery-prepare-platform/agents/openai.yaml +4 -0
  186. package/skills/ai-delivery-prepare-platform/assets/platform-template/environment-ledger.csv +1 -0
  187. package/skills/ai-delivery-prepare-platform/references/platform-contract.md +18 -0
  188. package/skills/ai-delivery-prepare-release/SKILL.md +47 -0
  189. package/skills/ai-delivery-prepare-release/agents/openai.yaml +4 -0
  190. package/skills/ai-delivery-prepare-release/assets/release-template/delivery-items.csv +1 -0
  191. package/skills/ai-delivery-prepare-release/assets/release-template/release-manifest.yaml +18 -0
  192. package/skills/ai-delivery-prepare-release/references/release-contract.md +21 -0
  193. package/skills/ai-delivery-review-change/SKILL.md +40 -0
  194. package/skills/ai-delivery-review-change/agents/openai.yaml +4 -0
  195. package/skills/ai-delivery-review-change/references/review-contract.md +20 -0
  196. package/skills/ai-delivery-triage-failure/SKILL.md +45 -0
  197. package/skills/ai-delivery-triage-failure/agents/openai.yaml +4 -0
  198. package/skills/ai-delivery-triage-failure/references/failure-routing-contract.md +13 -0
  199. package/skills/ai-delivery-validate-artifacts/SKILL.md +37 -0
  200. package/skills/ai-delivery-validate-artifacts/agents/openai.yaml +4 -0
  201. package/skills/ai-delivery-validate-artifacts/references/artifact-contract.md +44 -0
  202. package/skills/ai-delivery-verify-candidate/SKILL.md +56 -0
  203. package/skills/ai-delivery-verify-candidate/agents/openai.yaml +4 -0
  204. package/skills/ai-delivery-verify-candidate/assets/verification-template/defect-artifacts.csv +1 -0
  205. package/skills/ai-delivery-verify-candidate/assets/verification-template/defects.csv +1 -0
  206. package/skills/ai-delivery-verify-candidate/assets/verification-template/test-work-packages.csv +1 -0
  207. package/skills/ai-delivery-verify-candidate/references/candidate-verification-contract.md +23 -0
  208. package/skills/ai-delivery-verify-production/SKILL.md +50 -0
  209. package/skills/ai-delivery-verify-production/agents/openai.yaml +4 -0
  210. package/skills/ai-delivery-verify-production/assets/production-verification-template/production-verification.md +15 -0
  211. package/skills/ai-delivery-verify-production/references/production-verification-contract.md +14 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AI Delivery Workflow contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # AI Delivery Workflow
2
+
3
+ 本仓库是 `ai-delivery-workflow` 的维护与发行源码仓库,不是安装后的业务工作区,也不按双仓项目进行初始化。`bin/`、`lib/`、`skills/`、`docs/`、`verification/` 和 `audit/` 都是工作流实现或直接物料;`.tmp/` 统一保存可丢弃的本地运行物料。
4
+
5
+ 本仓库发布的工作流在安装到业务项目后,固定采用“工作流控制仓库 + 嵌套代码仓库”的双仓工作区:工作流仓库跟踪 `.workflow/` 和共享 checkpoint,独立的 `code/` Git 仓库跟踪应用源码、测试、分支和 Tag。详见 [双仓工作区说明](docs/DUAL-REPOSITORY-WORKSPACE.zh-CN.md)。
6
+
7
+ 一套只安装到当前项目的 AI 全流程研发 Skills、Hook、产物契约和 checkpoint 机制。研发版本可以持续递进并归档为 `release-ready`;生产发布由用户独立触发并选择累计截止版本。
8
+
9
+ 体验设计采用分阶段可运行原型:先交付可实际操作的低保真原型并通过人工 `UX-LF`,再确认视觉系统和 UI 框架(`UX-VS`),最后交付可运行正式 UI(`UX-UI`)。每次调整立即记录;全部候选确认后统一与产品需求双向核对。下游只消费 `ui-handoff.yaml` 和结构化 `experience_change_id`,不从截图或视觉差异猜测新增、修改与停用内容。
10
+
11
+ ## 文档
12
+
13
+ - [维护仓库 AI 边界](AGENTS.md)
14
+ - [完整中文项目手册](docs/PROJECT-MANUAL.zh-CN.md)
15
+ - [双仓工作区使用与维护说明](docs/DUAL-REPOSITORY-WORKSPACE.zh-CN.md)
16
+ - [逐文件参考](docs/FILE-REFERENCE.zh-CN.md)
17
+ - [工作流物料查看器使用指南](docs/VIEWER-USER-GUIDE.zh-CN.md)
18
+ - [工作流物料查看器维护指南](docs/VIEWER-MAINTENANCE.zh-CN.md)
19
+ - [正式状态 CLI 使用指南](docs/STATE-CLI-USER-GUIDE.zh-CN.md)
20
+ - [正式状态 CLI 维护指南](docs/STATE-CLI-MAINTENANCE.zh-CN.md)
21
+ - [审计物料:历史 V1、当前契约 V2 与五版本发布列车示例](audit/README.md)
22
+ - [审计物料逐文件用途](audit/FILE-GUIDE.zh-CN.md)
23
+ - [永久验证源码说明](verification/README.zh-CN.md)
24
+
25
+ ## 快速开始
26
+
27
+ 在目标项目根目录安装,不修改用户全局 Codex 或 agent skill 目录:
28
+
29
+ ```bash
30
+ npx ai-delivery-workflow@latest init <workspace> --code-path code --code-id app
31
+ npx ai-delivery-workflow@latest doctor <workspace>
32
+ ```
33
+
34
+ 安装器会把 25 个 Skills 写入 `.agents/skills/`,把项目 Hook 合并到 `.codex/config.toml`,安装本地 Hook 记录器,并创建 `.workflow/iterations/`、`.workflow/releases/` 与项目级自进化控制环。所有研发流程文档默认写入 `.workflow/`;源码、自动化测试源码、仓库配置、镜像和二进制制品保留在各自原位置。安装器会保留既有项目配置,并在受管文件冲突时停止。
35
+
36
+ 安装器会在需要跨 Git clone 保留的空工作流目录中写入 `.gitkeep`,包括产品、架构、体验、迭代、发布及共享控制分片目录。删除这些占位文件会导致空目录不进入 Git,重新克隆后的 `doctor` 将判定核心结构缺失。
37
+
38
+ 安装器还会内置 Bootstrap 与正式状态 CLI。任务状态只能由 `task-state.mjs` 修改;正式流程、物料和 Gate 状态只能由项目内状态脚本修改:
39
+
40
+ ```bash
41
+ node .workflow/tools/bootstrap/bootstrap.mjs inspect
42
+ node .workflow/tools/state/state.mjs inspect
43
+ node .workflow/tools/state/state.mjs verify
44
+ ```
45
+
46
+ 安装器会合并根 `.gitattributes`,把工作流受控文本固定为 LF,避免 Windows checkout 改变正式物料字节并触发 checksum 误报;该规则不进入嵌套代码仓。
47
+
48
+ 日常使用无需记忆这些命令。用户在项目根目录对 AI 说“开始”“继续”“下一步”或直接描述需求即可;AI 根据项目内 `AGENTS.md` 和 Skills 自主调用 Bootstrap、Checkpoint、专业节点与发布流程,用户只负责业务回答和人工 Gate。中断任务通过 `next_action_owner` 区分 AI、用户和外部责任方;等待用户或外部输入时只读恢复,不得重复增加 attempt、revision、evidence 或 checkpoint。
49
+
50
+ 正式状态 schema 2 将研发与发布拆成 `development_state` 和 `release_state`。研发使用 `iteration-started`,用户明确发起发布后使用 `release-started`;两者分别维护 scope、节点、Gate 和局部 revision,可并行推进且互不重置。状态 CLI 同时强制节点依赖、成功证据和当前节点尝试的必需 Gate。
51
+
52
+ 版本归档的可携带权威位置是 `.workflow/control/archives/versions/<version-id>/`。归档成功后,对应任务和 checkpoint 会从活动集合移出,后续 `recover` 不再加载它们。`doctor` 使用发行包固定的 25 个 Skill 与受管 Hook、Bootstrap、状态和 Evolution 运行时摘要进行完整性检查,并实际执行只读 `inspect/verify` 冒烟验证;查看器仍是可选工具。
53
+
54
+ 安装后的工作流通过 `$ai-delivery-evolve-workflow` 在安全点记录反馈、聚合重复信号、试运行项目级扩展并按指标自动启用或回退。扩展只存在于 `.workflow/extensions/`,不能修改受管核心、正式状态、人工 Gate 或已批准规范。完整用法见[自进化使用指南](docs/EVOLUTION-USER-GUIDE.zh-CN.md)。
55
+
56
+ 禁止直接编辑正式状态 YAML、审计 JSONL 或 runtime 任务状态。命令失败时应处理 revision 冲突或输入问题,不得手工绕过。
57
+
58
+ 累计研发版本、当前生产版本和当前生产 release ID 的权威来源是 `.workflow/delivery/workflow-state.yaml` 中经审计事件写入的 `latest_line_version_id`、`production_version_id` 和 `production_release_id`。版本收尾使用 `version-closed`,发布归档使用 `release-archived`;`project.yaml` 中的同名旧字段只作兼容回退。
59
+
60
+ 安装完成后直接启动项目内的工作流物料查看器:
61
+
62
+ ```powershell
63
+ .\.workflow\tools\viewer\start.cmd
64
+ ```
65
+
66
+ 查看器默认打开 `http://127.0.0.1:4173`,实时扫描当前项目 `.workflow/`,分别展示研发和发布轨道、生产版本、累计研发版本、发布范围、物料关系、checksum 与文档预览。它不修改正式产物。
67
+ 查看器是 `.workflow/tools/` 下的可选只读工具;删除 `.workflow/tools/viewer/` 不影响状态 CLI、Checkpoint、恢复、研发或发布,再次执行 `init` 可重装查看器。
68
+
69
+ 研发完成不会自动上线。用户需要发布时明确选择截止版本:
70
+
71
+ ```text
72
+ 请发布至 VER-0005。
73
+ ```
74
+
75
+ 系统会计算当前生产版本之后到 `VER-0005` 的连续版本范围。同版本重新发布也会生成新 release ID,并重新进行环境快照、验证和生产审批。
76
+
77
+ 只读检查陌生项目:
78
+
79
+ ```bash
80
+ npx ai-delivery-workflow@latest inspect .
81
+ ```
82
+
83
+ 识别并初始化空项目或存量代码项目,或者把中断工作流路由到 checkpoint 恢复:
84
+
85
+ ```bash
86
+ npx ai-delivery-workflow@latest bootstrap .
87
+ ```
88
+
89
+ 预览或明确替换冲突的受管文件:
90
+
91
+ ```bash
92
+ npx ai-delivery-workflow@latest init . --dry-run
93
+ npx ai-delivery-workflow@latest init . --force
94
+ ```
95
+
96
+ `--force` 会先备份到 `.workflow/delivery/runtime/backups/`。初始化完成后请新建 Codex 任务,使项目级 skills 和 Hook 信任状态重新加载。
97
+
98
+ 旧项目如仍使用根目录 `delivery/` 和 `standards/`,需先迁移为 `.workflow/delivery/` 和 `.workflow/standards/`,同步更新产物引用与 checksum 后再执行 `init`。安装器不会在新旧两套状态之间自动选择权威来源。
99
+
100
+ ## 仓库内容边界
101
+
102
+ 本工作流维护仓库把长期资产分为源码、永久验证源码和审计物料。安装器、状态 CLI、Hook、Skill、查看器等通用自动化验证统一位于 `verification/` 并纳入 Git;可重建的全流程交付证据与历史快照位于 `audit/` 并纳入 Git,但不会被 `init` 安装到业务项目。
103
+
104
+ 所有测试工作区、缓存、日志、报告、临时 Git 仓库、npm cache、打包产物、认证辅助文件和绑定单次演练的脚本统一放入 `.tmp/`。根 `.gitignore` 整体忽略 `/.tmp/`,其中任何内容都不得作为权威源码或审计证据。`audit/` 候选包、部署副本和历史快照内嵌的应用测试属于审计物料,可保留原路径;执行这些校验的维护入口位于 `verification/`。
105
+
106
+ ```bash
107
+ npm test
108
+ npm run skills:validate
109
+ npm run audit:verify
110
+ ```
111
+
112
+ `npm run skills:validate` 使用项目已有的 Node.js `yaml` 依赖校验全部 25 个 Skill,无需 Python 或 `PyYAML`。它检查 `SKILL.md` frontmatter、目录名称、`agents/openai.yaml` 界面元数据,以及项目手册和文件参考中的 Skill 覆盖关系;任一错误都会返回非零退出码。该校验只属于本维护仓库,不会安装到业务项目。
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
7
+ import { executeDeliveryStateCommand } from "../lib/delivery-state.mjs";
8
+ import { dispatchEvolutionHookEvent, executeEvolutionCommand } from "../lib/evolution.mjs";
9
+ import { doctorProject, initProject } from "../lib/project-installer.mjs";
10
+ import { bootstrapProject, inspectProjectState } from "../lib/project-bootstrap.mjs";
11
+
12
+ const packageRoot = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
13
+ const packageJson = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
14
+
15
+ function usage() {
16
+ return `ai-delivery ${packageJson.version}
17
+
18
+ Usage:
19
+ ai-delivery init [workspace-directory] [--workspace-id id] [--code-path code] [--code-id app] [--code-remote <url>] [--workflow-remote <url>] [--shared-remote <url>] [--dry-run] [--force]
20
+ ai-delivery inspect [workspace-directory]
21
+ ai-delivery bootstrap [workspace-directory] [--dry-run] [--force]
22
+ ai-delivery doctor [workspace-directory]
23
+ ai-delivery state <state-command> [options]
24
+ ai-delivery evolve <evolution-command> [options]
25
+ ai-delivery --version
26
+
27
+ Commands:
28
+ init Create a workflow repository and bind or create one nested code repository
29
+ inspect Detect workspace, code repository, workflow, and runtime state without writes
30
+ bootstrap Initialize missing workflow context or route recovery safely
31
+ doctor Validate the current project-scoped installation
32
+ state Inspect, verify, and mutate formal workflow state through the guarded CLI
33
+ evolve Record feedback and govern project-local workflow extensions
34
+
35
+ Options:
36
+ --dry-run Show planned changes without writing files
37
+ --force Back up and replace conflicting managed files
38
+ --code-path Nested code repository directory (default: code)
39
+ --code-id Stable code repository identifier (default: app)
40
+ --code-remote Clone this remote when the code directory does not exist
41
+ --workflow-remote Configure the workflow repository origin
42
+ --shared-remote Configure both independent repositories with the same origin
43
+ --workspace-id Stable ID used by workflow/<workspace-id>
44
+ `;
45
+ }
46
+
47
+ function parseArgs(argv) {
48
+ const flags = new Set();
49
+ const options = new Map();
50
+ const positional = [];
51
+ const booleanOptions = new Set(["--dry-run", "--force", "--help", "--version"]);
52
+ const valueOptions = new Set([
53
+ "--code-path", "--code-id", "--code-remote", "--workflow-remote", "--shared-remote", "--workspace-id",
54
+ ]);
55
+ for (let index = 0; index < argv.length; index += 1) {
56
+ const value = argv[index];
57
+ if (booleanOptions.has(value)) {
58
+ flags.add(value);
59
+ } else if (valueOptions.has(value)) {
60
+ const optionValue = argv[index + 1];
61
+ if (!optionValue || optionValue.startsWith("--")) throw new Error(`Missing value for ${value}`);
62
+ options.set(value, optionValue);
63
+ index += 1;
64
+ } else if (value.startsWith("--")) {
65
+ throw new Error(`Unknown option: ${value}`);
66
+ } else {
67
+ positional.push(value);
68
+ }
69
+ }
70
+ return { flags, options, positional };
71
+ }
72
+
73
+ try {
74
+ const rawArgs = process.argv.slice(2);
75
+ if (rawArgs[0] === "state" || rawArgs[0] === "evolve") {
76
+ const execute = rawArgs[0] === "state" ? executeDeliveryStateCommand : executeEvolutionCommand;
77
+ const yaml = {
78
+ parse: parseYaml,
79
+ stringify: (value) => stringifyYaml(value, { lineWidth: 0 }),
80
+ };
81
+ const result = execute(rawArgs.slice(1), {
82
+ yaml,
83
+ onLifecycleEvent: rawArgs[0] === "state"
84
+ ? (event) => dispatchEvolutionHookEvent(event.scope.project_root, event, { yaml })
85
+ : undefined,
86
+ });
87
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
88
+ if (rawArgs[0] === "evolve" && result?.ok === false) process.exitCode = 1;
89
+ } else {
90
+ const { flags, options, positional } = parseArgs(rawArgs);
91
+ if (flags.has("--help") || positional[0] === "help") {
92
+ process.stdout.write(usage());
93
+ } else if (flags.has("--version")) {
94
+ process.stdout.write(`${packageJson.version}\n`);
95
+ } else {
96
+ const command = positional[0] || "init";
97
+ const target = path.resolve(positional[1] || process.cwd());
98
+ if (command === "init") {
99
+ const report = initProject(packageRoot, target, {
100
+ dryRun: flags.has("--dry-run"),
101
+ force: flags.has("--force"),
102
+ packageVersion: packageJson.version,
103
+ codePath: options.get("--code-path"),
104
+ codeId: options.get("--code-id"),
105
+ codeRemote: options.get("--code-remote") || null,
106
+ workflowRemote: options.get("--workflow-remote") || null,
107
+ sharedRemote: options.get("--shared-remote") || null,
108
+ workspaceId: options.get("--workspace-id") || null,
109
+ });
110
+ process.stdout.write(`${report.summary}\n`);
111
+ for (const item of report.actions) process.stdout.write(`- ${item}\n`);
112
+ } else if (command === "inspect") {
113
+ const report = inspectProjectState(target);
114
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
115
+ } else if (command === "bootstrap") {
116
+ const report = bootstrapProject(packageRoot, target, {
117
+ dryRun: flags.has("--dry-run"),
118
+ force: flags.has("--force"),
119
+ packageVersion: packageJson.version,
120
+ initProject,
121
+ });
122
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
123
+ } else if (command === "doctor") {
124
+ const report = doctorProject(target);
125
+ for (const check of report.checks) {
126
+ const outcome = check.ok ? "PASS" : check.required === false ? "WARN" : "FAIL";
127
+ process.stdout.write(`${outcome} ${check.message}\n`);
128
+ }
129
+ if (!report.ok) process.exitCode = 1;
130
+ } else {
131
+ throw new Error(`Unknown command: ${command}\n\n${usage()}`);
132
+ }
133
+ }
134
+ }
135
+ } catch (error) {
136
+ process.stderr.write(`ai-delivery: ${error.message}\n`);
137
+ process.exitCode = 1;
138
+ }
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { validateSkillRepository } from "../lib/skill-validator.mjs";
4
+
5
+ const report = validateSkillRepository(process.cwd());
6
+ if (report.valid) {
7
+ console.log(`Skill validation passed: ${report.skillCount}/${report.skillCount}`);
8
+ } else {
9
+ console.error(`Skill validation failed with ${report.errors.length} error(s):`);
10
+ for (const error of report.errors) console.error(`- ${error}`);
11
+ process.exitCode = 1;
12
+ }
@@ -0,0 +1,125 @@
1
+ # 双仓工作区使用与维护说明
2
+
3
+ ## 1. 目录与职责
4
+
5
+ AI Delivery 固定使用两个彼此独立的 Git 仓库:
6
+
7
+ ```text
8
+ workspace/
9
+ ├─ .git/ # 工作流 Git
10
+ ├─ .agents/ # 25 个项目级 Skills
11
+ ├─ .codex/ # 项目 Hook 配置
12
+ ├─ .workflow/config/workspace.yaml # 双仓唯一绑定配置
13
+ ├─ .workflow/ # 流程物料、共享任务与 checkpoint
14
+ ├─ .gitignore # 精确忽略 /code/
15
+ ├─ .gitattributes # 固定工作流受控文本为 LF
16
+ └─ code/
17
+ ├─ .git/ # 代码 Git
18
+ ├─ src/
19
+ └─ test/
20
+ ```
21
+
22
+ 工作流仓库的 `workflow/<workspace-id>` 是已经共享的流程事实分支,不表示生产代码。代码仓库的 `main` 才表示生产验证成功的应用历史。代码目录不是 Git submodule:根仓库通过精确的 `/code/` 忽略规则完全不跟踪它,代码仓库也不跟踪父目录。
23
+
24
+ ## 2. 初始化
25
+
26
+ 创建新工作区和空代码仓库:
27
+
28
+ ```powershell
29
+ node bin/ai-delivery.mjs init C:\work\tasklite --code-path code --code-id tasklite-app
30
+ node bin/ai-delivery.mjs doctor C:\work\tasklite
31
+ ```
32
+
33
+ 从已有 remote 创建代码仓库:
34
+
35
+ ```powershell
36
+ node bin/ai-delivery.mjs init C:\work\tasklite --code-path code --code-id tasklite-app --code-remote <url>
37
+ ```
38
+
39
+ 两个独立本地 Git 使用同一个远程仓库、不同分支命名空间时:
40
+
41
+ ```powershell
42
+ node bin/ai-delivery.mjs init C:\work\tasklite --workspace-id tasklite --code-path code --code-id tasklite-app --shared-remote <url>
43
+ ```
44
+
45
+ 工作流仓库使用 `workflow/tasklite`,代码仓库使用 `main` 及各研发、发布分支;两者虽然 origin 相同,但 Git 根和提交历史职责独立。
46
+
47
+ 升级仍含 `.ai-delivery/` 的旧项目时,`init` 会先把旧目录完整备份到 `.workflow/delivery/runtime/backups/<timestamp>/legacy-ai-delivery/`,再迁移配置、状态 CLI、Hook 和查看器。只有新核心文件验证完成后才删除旧目录;失败时保留旧目录和备份。迁移成功后 `.workflow/config/workspace.yaml` 是唯一权威配置,不再双写或回退读取旧路径。
48
+
49
+ 如果 `code/` 已是独立 Git 仓库,初始化器会绑定它。以下情况会拒绝:非空但不是 Git 的代码目录、绝对路径或多层路径、越界路径、符号链接、与工作流仓库相同的 Git 根。
50
+
51
+ `.workflow/config/workspace.yaml` 是代码仓库位置和 `repo_id` 的唯一来源。不要在 Skill、脚本或文档中另行猜测代码根目录。
52
+
53
+ 已有项目再次执行 `init` 时,未显式提供 `--code-path` 或 `--code-id` 必须沿用该文件中的现有值;只有用户显式传入对应参数时才允许改变稳定代码仓身份。
54
+
55
+ ## 3. 状态分层
56
+
57
+ Git 跟踪、可由其他工作区接管的状态:
58
+
59
+ ```text
60
+ .workflow/control/
61
+ tasks/<task-id>.yaml
62
+ checkpoints/<task-id>/<checkpoint-id>.yaml
63
+ artifacts/
64
+ gates/
65
+ versions/
66
+ releases/
67
+ ```
68
+
69
+ 本机临时状态位于 `.workflow/delivery/runtime/`,只保存 PID、心跳、临时锁、原始 Hook 事件和未共享上下文。每次任务状态变化都要通过 `task-state.mjs` 更新共享分片;高频心跳只写 runtime。
70
+
71
+ 本机 runtime 被删除后,`agent` 责任态由 `recover` 从最新共享任务与 checkpoint 重建;`user/external` 等待态保持只读,收到输入后由 `activate` 原子重建并转交。本机和共享 `shared_revision` 或语义 checksum 不一致时必须停止处理冲突,不能按最后写入者覆盖。
72
+
73
+ Git 不跟踪空目录。安装器会在 `.workflow/product/`、`architecture/`、`experience/`、`iterations/`、`releases/` 和 `.workflow/control/` 各分片目录中创建 `.gitkeep`。这些文件确保工作流分支被重新克隆后仍保留 Doctor 所需结构;不得把它们当作无用测试产物删除。
74
+
75
+ 只提交一个任务范围:
76
+
77
+ ```powershell
78
+ node .agents/skills/ai-delivery-checkpoint-task/scripts/task-state.mjs publish --task-id TASK-001
79
+ ```
80
+
81
+ 该命令发现无关脏文件时拒绝提交。默认不推送,只有用户明确要求时才使用 `--push`。
82
+
83
+ ## 4. 两套 Git 的操作边界
84
+
85
+ 只在代码仓库存在:`main`、`line/*`、`version/*`、`work/*`、`release/*`、`release-fix/*`、`hotfix/*`、`version-ready/*` 和 release Tag。
86
+
87
+ 只在工作流仓库存在:`.workflow/` 中的需求、架构、原型、测试、审批、部署和回滚记录,共享任务分片和 checkpoint,以及 `workflow-ready/<version-id>/rN`。
88
+
89
+ 每个代码引用至少记录:`repo_id`、`code_commit`、可选 `code_tag`、`source_path` 和 SHA-256。
90
+
91
+ ## 5. 版本收尾与发布身份
92
+
93
+ 版本收尾顺序不可调整:
94
+
95
+ 1. 在代码仓库验证候选;
96
+ 2. 创建代码 `version-ready/<version-id>/rN`;
97
+ 3. 生成最终版本 Manifest;
98
+ 4. 提交版本工作流物料;
99
+ 5. 在该提交创建工作流 `workflow-ready/<version-id>/rN`。
100
+
101
+ `release-ready` 身份由代码 Tag、工作流 Tag 和 Manifest SHA-256 三者组成。发布闭包同时检查代码 ancestry、两个 Tag、Manifest checksum、连续版本关系和 `repo_id`。任一项缺失或漂移都阻止发布。
102
+
103
+ `workflow-state.yaml` 是累计研发和生产身份的权威审计视图。schema 2 分别使用 `development_state` 和 `release_state` 保存两条可并行轨道,发布不得重置累计研发状态。版本收尾在完成节点和登记 `release-ready` 物料后执行 `version-closed`;发布归档在完成 R10 和登记 `released` 物料后执行 `release-archived`。不得直接修改这些字段,也不得从代码分支当前位置反推生产事实。
104
+
105
+ 多版本发布必须逐一校验相邻版本的代码提交和工作流提交 ancestry,不能只证明当前生产提交可到达最终目标。版本任务的跨 clone 归档位于 `.workflow/control/archives/versions/<version-id>/`;归档后活动 task/checkpoint 分片被移除,普通恢复不会重新加载历史版本。
106
+
107
+ 同版本重发复用原版本三方身份,但必须创建新 release ID,并重新生成环境快照、发布索引、验证和审批。生产回滚只部署历史镜像 digest,不创建 rollback 分支,不改写任一 Git 历史。
108
+
109
+ ## 6. 检查与查看
110
+
111
+ ```powershell
112
+ node <workspace>/.workflow/tools/bootstrap/bootstrap.mjs inspect
113
+ node bin/ai-delivery.mjs doctor <workspace>
114
+ node bin/ai-delivery.mjs state verify --project <workspace>
115
+ ```
116
+
117
+ 安装后,用户只需在项目根对 AI 说“开始”“继续”“下一步”或直接描述需求;AI 自主调用项目内 Bootstrap、Checkpoint 和后续 Skills。项目内 `inspect` 同时报告工作流 Git 和代码 Git 的 branch、head、dirty paths、upstream 同步状态,以及共享任务/checkpoint 恢复建议。查看器展示两套 Git、未提交或未推送警告、研发和发布双轨,以及代码 Tag、工作流 Tag、Manifest checksum 的追踪关系。
118
+
119
+ ## 7. 全流程样本
120
+
121
+ ```powershell
122
+ node audit/generate-dual-repo.mjs
123
+ ```
124
+
125
+ 真实 Git 元数据位于被根 `.gitignore` 排除的 `.tmp/dual-repo-e2e/`。可审阅快照位于 `audit/DUAL-REPO-FULL-FLOW/`,不包含任何 `.git` 目录,也不会被安装到业务项目。
@@ -0,0 +1,75 @@
1
+ # 项目级工作流自进化维护指南
2
+
3
+ ## 1. 权威源码
4
+
5
+ | 位置 | 职责 |
6
+ | --- | --- |
7
+ | `lib/evolution.mjs` | 状态机、风险、checksum、trial、Hook 调度和导出实现 |
8
+ | `skills/ai-delivery-orchestrate/assets/project-template/.workflow/tools/evolution/evolve.mjs` | 安装后自包含 wrapper |
9
+ | `skills/ai-delivery-evolve-workflow/` | AI 交互、证据门槛和治理契约 |
10
+ | `lib/project-installer.mjs` | 运行时复制、manifest schema 5、升级和 doctor |
11
+ | `verification/evolution.test.mjs` | 公共 CLI 行为测试 |
12
+
13
+ 不要修改临时安装项目中的 `.workflow/tools/evolution/` 后再复制回维护仓库。`lib/evolution.mjs` 是行为权威,安装副本由 `init` 生成。
14
+
15
+ ## 2. 安装模型
16
+
17
+ 安装器把 wrapper 和 `lib/evolution.mjs` 复制为:
18
+
19
+ ```text
20
+ .workflow/tools/evolution/evolve.mjs
21
+ .workflow/tools/evolution/evolution-runtime.mjs
22
+ ```
23
+
24
+ 它复用 `.workflow/tools/state/vendor/yaml/`,不修改业务项目 `package.json`。安装清单 schema 5 保存 Evolution CLI 路径、Hook 协议版本和运行时 SHA-256。schema 4 项目重新执行 `init` 时升级受管运行时,同时保留既有工作流物料。
25
+
26
+ ## 3. 数据一致性
27
+
28
+ - 所有治理状态转换必须经过 `executeEvolutionCommand`。
29
+ - 写入采用临时文件加原子 rename。
30
+ - 扩展版本复制到 `.workflow/extensions/<id>/versions/<version>/` 后不可原地修改。
31
+ - 批准绑定扩展 checksum;内容变化必须注册新版本。
32
+ - runtime 事件按 `idempotency_key` 去重,正式反馈按同一来源幂等。
33
+ - 扩展损坏只隔离扩展,不使核心研发、Checkpoint 和发布运行时不可用。
34
+
35
+ ## 4. 风险引擎
36
+
37
+ 风险顺序固定为 `low < medium < high`。requested risk 只能被派生风险抬升;未登记的 capability 默认按 `high` 处理。新增 capability 时必须同步:
38
+
39
+ 1. `HIGH_CAPABILITIES` 或 `MEDIUM_CAPABILITIES`;
40
+ 2. Skill 契约和用户指南;
41
+ 3. 风险抬升测试;
42
+ 4. 查看器展示需要的新状态。
43
+
44
+ `block` 或 `.mjs` entrypoint 永远派生为 high。Node 18 没有可依赖的强安全沙箱,因此不要在文档或代码中宣称脚本被完全隔离。
45
+
46
+ ## 5. Hook 协议
47
+
48
+ Hook schema 1 要求 `event_id`、`idempotency_key`、`event_type`、时间、scope 和脱敏 payload。结果只允许 `pass`、`warn`、`block`;`block` 仅允许声明在 `before` 事件。Hook 输出必须经过 `normalizeHookOutcome` 的类型、数量、长度和脱敏处理后才能返回或写入正式审计物料。
49
+
50
+ `skills/ai-delivery-checkpoint-task/scripts/hook-event.mjs` 是安装源;项目模板内同名文件是审阅副本,两者必须保持一致。Checkpoint 的 `task-state.mjs` 和正式状态 CLI 会主动发出业务协议事件;Codex 原生生命周期事件只记录 heartbeat。带 `schema_version: 1` 和 `event_type` 的 Evolution 事件才会进入扩展调度。
51
+
52
+ ## 6. 查看器
53
+
54
+ 查看器只解析 `.workflow/evolution/index.yaml` 和 Git 跟踪的 evolution 文件。不得扫描 `.workflow/delivery/runtime/evolution/`,不得新增写 API。修改自进化摘要时同步验证桌面和移动端布局。
55
+
56
+ ## 7. 验证
57
+
58
+ 定向验证:
59
+
60
+ ```bash
61
+ node --test verification/evolution.test.mjs
62
+ node --test verification/project-installer.test.mjs
63
+ node --test verification/workflow-viewer.test.mjs
64
+ npm run skills:validate
65
+ ```
66
+
67
+ 交付前执行:
68
+
69
+ ```bash
70
+ npm test
71
+ npm run audit:verify
72
+ npm run pack:check
73
+ ```
74
+
75
+ 还应在隔离项目执行 `init`、项目内 `evolve inspect/verify`、`doctor`,删除查看器和扩展后复核核心工作流仍可运行。
@@ -0,0 +1,160 @@
1
+ # 项目级工作流自进化使用指南
2
+
3
+ ## 1. 能力边界
4
+
5
+ 自进化控制环记录工作流使用中的明确意见和客观问题,在任务、版本或显式 review 安全点评估证据,通过项目级扩展改善后续执行。它不是第三条研发状态机,也不能修改安装器管理的 Skill、正式状态 CLI、Hook、人工 Gate 或已批准项目规范。
6
+
7
+ 删除 `.workflow/extensions/` 不会破坏核心研发、Checkpoint 或发布流程。`doctor` 会报告扩展问题,但核心检查仍可运行。
8
+
9
+ ## 2. 文件位置
10
+
11
+ ```text
12
+ .workflow/evolution/ # 纳入工作流 Git
13
+ feedback/ # 脱敏反馈
14
+ proposals/ # 提案
15
+ experiments/ # trial 与 Hook 结果
16
+ decisions/ # 启停、批准、回退和冲突证据
17
+ promotion/ # 仅本地生成的脱敏导出包
18
+ .workflow/extensions/ # 已注册的不可变扩展版本
19
+ .workflow/delivery/runtime/evolution/ # 被忽略的事件、pending 和 staging
20
+ ```
21
+
22
+ `.workflow/evolution/index.yaml` 是治理索引,只能由 Evolution CLI 修改。
23
+
24
+ 公共命令如下:
25
+
26
+ | 命令 | 作用 |
27
+ | --- | --- |
28
+ | `feedback record` | 记录脱敏反馈或客观信号 |
29
+ | `inspect` | 读取治理索引 |
30
+ | `evaluate` | 在安全点计算提案资格或记录 trial 指标 |
31
+ | `propose --spec <file>` | 校验提案证据并登记提案 |
32
+ | `register --proposal-id <id> --source <dir>` | 校验、复制并 checksum 一个扩展版本 |
33
+ | `approve` / `reject` | 记录明确人工批准或拒绝 |
34
+ | `enable` / `disable` / `rollback` | 启动 trial、稳定启用、禁用或回退 |
35
+ | `verify` | 校验 schema、manifest、扩展和批准 checksum |
36
+ | `export` | 生成仅限本地的脱敏 promotion bundle |
37
+
38
+ ## 3. 反馈
39
+
40
+ 当用户明确表达“以后应当”“这里不合理”“建议调整”等改进意图时,AI 自动记录反馈并返回 `FDB-*`。反馈只保存分类、摘要、影响、来源事件、关联任务或版本、脱敏片段和 SHA-256。
41
+
42
+ ```bash
43
+ node .workflow/tools/evolution/evolve.mjs feedback record \
44
+ --category workflow-usability \
45
+ --summary "状态更新应统一通过脚本" \
46
+ --impact "避免状态文件错乱" \
47
+ --source-kind user \
48
+ --source-event-id TURN-001 \
49
+ --signal-key state-mutation-bypass \
50
+ --idempotency-key feedback-turn-001 \
51
+ --explicit-user
52
+ ```
53
+
54
+ 禁止保存完整对话、密钥、敏感配置和 chain-of-thought。单次 AI 推测使用 `ai-observation`,不能单独形成提案。
55
+
56
+ ## 4. 证据门槛与安全点
57
+
58
+ 以下情况可以进入提案:
59
+
60
+ - 用户明确建议;
61
+ - 一次明确 Gate 阻断或版本失败;
62
+ - 同类客观问题出现三个不同事件;
63
+ - 同类客观问题影响两个不同任务。
64
+
65
+ 只在以下安全点评估:
66
+
67
+ ```bash
68
+ node .workflow/tools/evolution/evolve.mjs evaluate --safe-point task
69
+ node .workflow/tools/evolution/evolve.mjs evaluate --safe-point version --iteration-id VER-05
70
+ node .workflow/tools/evolution/evolve.mjs evaluate --safe-point review
71
+ ```
72
+
73
+ 评估产生的扩展从下一任务或下一版本生效,不改变执行中的任务。
74
+
75
+ ## 5. 风险与批准
76
+
77
+ | 风险 | 能力 | 自动权限 |
78
+ | --- | --- | --- |
79
+ | `low` | 提示、清单、展示、非阻断声明式检查 | 验证后可自动 trial,最多 `warn` |
80
+ | `medium` | 路由、模板、工作包、物料生成或校验行为 | 必须人工批准 |
81
+ | `high` | `block`、Node 脚本、Git、部署、安全、权限、环境或外部系统 | 必须人工批准 |
82
+
83
+ AI 可以建议风险,CLI 只能把风险提高。批准必须先形成一条明确用户确认回执,再绑定扩展 ID、版本、SHA-256 和来源事件:
84
+
85
+ ```bash
86
+ node .workflow/tools/evolution/evolve.mjs feedback record \
87
+ --category extension-approval \
88
+ --summary "批准已审阅的阻断扩展" \
89
+ --impact "允许该版本进入试运行" \
90
+ --source-kind user \
91
+ --source-event-id TURN-APPROVE-001 \
92
+ --signal-key approve-ext-gate-check \
93
+ --explicit-user \
94
+ --confirmation-subject EXT-GATE-CHECK@1.0.0 \
95
+ --confirmation-checksum <sha256>
96
+
97
+ node .workflow/tools/evolution/evolve.mjs approve \
98
+ --extension-id EXT-GATE-CHECK \
99
+ --version 1.0.0 \
100
+ --checksum <sha256> \
101
+ --confirmation-feedback-id FDB-0004
102
+
103
+ node .workflow/tools/evolution/evolve.mjs enable \
104
+ --extension-id EXT-GATE-CHECK \
105
+ --version 1.0.0 \
106
+ --checksum <sha256> \
107
+ --safe-point review
108
+ ```
109
+
110
+ `enable` 和 trial 评估必须声明 `task`、`version` 或 `review` 安全点;存在活动任务标记时 CLI 会拒绝生效。扩展只能按 `proposed -> trial -> active` 前进,已禁用、回退、替代或过期的版本不能复活,内容调整必须注册新版本。仅把文件放入 `.workflow/extensions/` 不会执行。
111
+
112
+ ## 6. Trial 与回退
113
+
114
+ 每个提案必须包含假设、基线、指标、范围和回退条件。默认观察窗口是三次适用执行或一个完整迭代,以先到者为准。
115
+
116
+ ```bash
117
+ node .workflow/tools/evolution/evolve.mjs evaluate \
118
+ --safe-point task \
119
+ --extension-id EXT-DOC-WARN \
120
+ --version 1.0.0 \
121
+ --metric-result improved \
122
+ --event-id TASK-RESULT-003
123
+ ```
124
+
125
+ 低风险 trial 达标后自动进入 `active`。`worsened` 或 `failure` 会自动进入 `rolled-back`。中高风险即使 trial 达标,也必须明确批准后才能稳定启用。
126
+
127
+ 生命周期为:
128
+
129
+ ```text
130
+ observed → proposed → trial → active
131
+ ├→ rejected
132
+ ├→ disabled
133
+ ├→ rolled-back
134
+ ├→ superseded
135
+ └→ expired
136
+ ```
137
+
138
+ 系统不会按日期或版本数量自动过期提案。`expired` 只表示用户明确关闭或适用对象已客观消失。
139
+
140
+ ## 7. Hook
141
+
142
+ Hook 输入和输出使用 schema 1 JSON。Checkpoint 任务脚本与正式状态 CLI 会自动产生任务、节点、Gate、物料、版本和发布的 `before`、`after`、`failed`,另支持 `feedback-recorded`、`evaluation-due` 和 `extension-state-changed`。
143
+
144
+ `block` 只允许用于 `before`,避免状态写入后再阻断。自动 trial 的错误或超时以 `warn` 继续;已批准阻断 Hook 失败时停止本次转换并隔离扩展。Hook 输出会先做类型、数量、长度和脱敏检查,再返回或写入审计物料。Node 18 下的导入检查、最小环境变量、路径校验和超时不是安全沙箱;可执行 Hook 始终按高风险处理。
145
+
146
+ ## 8. 检查、禁用和导出
147
+
148
+ ```bash
149
+ node .workflow/tools/evolution/evolve.mjs inspect
150
+ node .workflow/tools/evolution/evolve.mjs verify
151
+ node .workflow/tools/evolution/evolve.mjs disable --extension-id EXT-001 --version 1.0.0 --checksum <sha256> --reason "与项目规范冲突"
152
+ node .workflow/tools/evolution/evolve.mjs rollback --extension-id EXT-001 --version 1.0.0 --checksum <sha256> --reason "指标恶化"
153
+ node .workflow/tools/evolution/evolve.mjs export --extension-id EXT-001 --version 1.0.0
154
+ ```
155
+
156
+ `export` 只在 `.workflow/evolution/promotion/` 生成脱敏、本地 bundle,不会上传或发送到维护仓库、其他项目或外部服务。
157
+
158
+ ## 9. 查看器
159
+
160
+ 查看器的“自进化控制环”区域展示反馈、待处理提案、trial、active、高风险生效、回退和 Hook 结果数量。所有治理物料仍可在物料表中筛选和预览。查看器没有批准、启用、回退或导出接口。