coding-agent-harness 1.0.8 → 1.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 (232) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/CONTRIBUTING.md +8 -4
  3. package/README.md +12 -2
  4. package/README.zh-CN.md +10 -2
  5. package/SKILL.md +14 -3
  6. package/dist/build-dist.mjs +19 -6
  7. package/dist/check-dist-observation.mjs +57 -29
  8. package/dist/check-harness.mjs +0 -1
  9. package/dist/check-import-graph.mjs +44 -27
  10. package/dist/check-lite-forbidden-surfaces.mjs +121 -0
  11. package/dist/check-no-ts-nocheck.mjs +7 -7
  12. package/dist/check-runtime-emit.mjs +10 -3
  13. package/dist/check-type-boundaries.mjs +51 -9
  14. package/dist/commands/dashboard-command.mjs +52 -14
  15. package/dist/commands/migration-command.mjs +18 -8
  16. package/dist/commands/module-command.mjs +142 -0
  17. package/dist/commands/preset-command.mjs +51 -12
  18. package/dist/commands/registry.mjs +483 -0
  19. package/dist/commands/task-command.mjs +109 -52
  20. package/dist/harness.mjs +6 -304
  21. package/dist/lib/capability-registry.mjs +229 -53
  22. package/dist/lib/check-module-parallel.mjs +1 -6
  23. package/dist/lib/check-profiles.mjs +39 -46
  24. package/dist/lib/check-task-contracts.mjs +6 -4
  25. package/dist/lib/command-registry.mjs +248 -0
  26. package/dist/lib/core-shared.mjs +78 -3
  27. package/dist/lib/dashboard-data.mjs +203 -22
  28. package/dist/lib/dashboard-workbench.mjs +245 -21
  29. package/dist/lib/dashboard-writer.mjs +4 -1
  30. package/dist/lib/git-status-summary.mjs +0 -1
  31. package/dist/lib/governance-index-generator.mjs +7 -5
  32. package/dist/lib/governance-sync.mjs +46 -121
  33. package/dist/lib/governance-table-boundary.mjs +1 -14
  34. package/dist/lib/harness-core.mjs +4 -1
  35. package/dist/lib/harness-paths.mjs +115 -1
  36. package/dist/lib/impact-classifier.mjs +420 -0
  37. package/dist/lib/lesson-maintenance.mjs +1 -2
  38. package/dist/lib/markdown-utils.mjs +50 -1
  39. package/dist/lib/migration-planner.mjs +31 -16
  40. package/dist/lib/migration-support.mjs +5 -4
  41. package/dist/lib/module-registry.mjs +296 -0
  42. package/dist/lib/preset-audit-contracts.mjs +24 -1
  43. package/dist/lib/preset-engine.mjs +67 -29
  44. package/dist/lib/preset-registry.mjs +361 -71
  45. package/dist/lib/preset-runner.mjs +292 -26
  46. package/dist/lib/review-confirm-git-gate.mjs +73 -19
  47. package/dist/lib/status-builder.mjs +23 -8
  48. package/dist/lib/structure-migration.mjs +6 -4
  49. package/dist/lib/subagent-authorization-audit.mjs +8 -2
  50. package/dist/lib/task-archive-eligibility.mjs +65 -0
  51. package/dist/lib/task-audit-metadata.mjs +25 -11
  52. package/dist/lib/task-audit-migration.mjs +21 -14
  53. package/dist/lib/task-discovery-contract.mjs +32 -0
  54. package/dist/lib/task-index.mjs +3 -2
  55. package/dist/lib/task-lesson-candidates.mjs +1 -2
  56. package/dist/lib/task-lesson-sedimentation.mjs +310 -9
  57. package/dist/lib/task-lifecycle/create-task-helpers.mjs +6 -3
  58. package/dist/lib/task-lifecycle/phase-sync.mjs +0 -1
  59. package/dist/lib/task-lifecycle/preset-interop.mjs +16 -0
  60. package/dist/lib/task-lifecycle/review-confirm.mjs +34 -2
  61. package/dist/lib/task-lifecycle/review-gates.mjs +12 -5
  62. package/dist/lib/task-lifecycle/review-submission.mjs +1 -2
  63. package/dist/lib/task-lifecycle/scaffold-provenance.mjs +0 -1
  64. package/dist/lib/task-lifecycle/template-files.mjs +2 -5
  65. package/dist/lib/task-lifecycle.mjs +116 -160
  66. package/dist/lib/task-metadata.mjs +10 -5
  67. package/dist/lib/task-preset-contract-drift.mjs +45 -0
  68. package/dist/lib/task-repository.mjs +192 -0
  69. package/dist/lib/task-review-model.mjs +36 -17
  70. package/dist/lib/task-scanner.mjs +74 -23
  71. package/dist/lib/task-template-materials.mjs +131 -0
  72. package/dist/lib/task-tombstone-commands.mjs +186 -29
  73. package/dist/lib/types/check-profiles.js +1 -0
  74. package/dist/lib/types/impact.js +1 -0
  75. package/dist/lib/types/preset.js +1 -0
  76. package/dist/lib/types/task-lifecycle.js +1 -0
  77. package/dist/lib/types/task-scanner.js +1 -0
  78. package/dist/postinstall.mjs +2 -2
  79. package/dist/run-built-tests.mjs +10 -3
  80. package/docs-release/README.md +1 -0
  81. package/docs-release/architecture/document-contract-kernel/README.md +150 -0
  82. package/docs-release/architecture/document-contract-kernel/products/full-skill-overlay.md +29 -0
  83. package/docs-release/architecture/document-contract-kernel/products/lite-forbidden-surfaces.txt +26 -0
  84. package/docs-release/architecture/document-contract-kernel/products/lite-skill-overlay.md +37 -0
  85. package/docs-release/architecture/overview.md +2 -2
  86. package/docs-release/architecture/overview.zh-CN.md +2 -2
  87. package/docs-release/architecture/system-explainer/01-system-overview.md +11 -7
  88. package/docs-release/architecture/system-explainer/02-module-dependency.md +4 -4
  89. package/docs-release/architecture/system-explainer/03-task-lifecycle.md +17 -12
  90. package/docs-release/architecture/system-explainer/05-data-flow.md +6 -6
  91. package/docs-release/architecture/system-explainer/06-preset-and-migration.md +2 -2
  92. package/docs-release/architecture/system-explainer/README.md +1 -1
  93. package/docs-release/architecture/system-explainer/en-US/01-system-overview.md +12 -8
  94. package/docs-release/architecture/system-explainer/en-US/02-module-dependency.md +5 -5
  95. package/docs-release/architecture/system-explainer/en-US/03-task-lifecycle.md +19 -11
  96. package/docs-release/architecture/system-explainer/en-US/05-data-flow.md +5 -5
  97. package/docs-release/architecture/system-explainer/en-US/06-preset-and-migration.md +2 -2
  98. package/docs-release/architecture/system-explainer/en-US/README.md +1 -1
  99. package/docs-release/guides/agent-installation.en-US.md +4 -6
  100. package/docs-release/guides/agent-installation.md +11 -8
  101. package/docs-release/guides/contributing.md +10 -3
  102. package/docs-release/guides/contributing.zh-CN.md +10 -3
  103. package/docs-release/guides/legacy-migration-agent-prompt.md +1 -1
  104. package/docs-release/guides/legacy-migration-agent-prompt.zh-CN.md +1 -1
  105. package/docs-release/guides/migration-playbook.en-US.md +9 -6
  106. package/docs-release/guides/migration-playbook.md +9 -6
  107. package/docs-release/guides/preset-development.md +68 -2
  108. package/docs-release/guides/task-state-machine.en-US.md +8 -8
  109. package/docs-release/guides/task-state-machine.md +7 -7
  110. package/docs-release/guides/typescript-runtime-migration-closeout.md +17 -13
  111. package/package.json +16 -12
  112. package/postinstall.mjs +37 -0
  113. package/presets/legacy-migration/preset.yaml +5 -5
  114. package/presets/legacy-migration/templates/execution_strategy.append.md +1 -1
  115. package/presets/lesson-sedimentation/preset.yaml +3 -3
  116. package/presets/module/preset.yaml +2 -2
  117. package/presets/module/templates/execution_strategy.append.md +1 -1
  118. package/presets/module/templates/task_plan.append.md +3 -3
  119. package/presets/release-closeout/checks/check-release-package.mjs +6 -1
  120. package/presets/release-closeout/preset.yaml +9 -9
  121. package/presets/release-closeout/scripts/generate-release-package.mjs +387 -25
  122. package/presets/release-closeout/templates/task_plan.append.md +5 -5
  123. package/presets/standard-task/preset.yaml +2 -2
  124. package/references/agents-md-pattern.md +23 -17
  125. package/references/lessons-governance.md +2 -2
  126. package/references/module-parallel-standard.md +3 -6
  127. package/references/ssot-governance.md +2 -2
  128. package/references/taskr-gap-analysis.md +3 -3
  129. package/run-dist.mjs +34 -0
  130. package/skills/preset-creator/SKILL.md +40 -8
  131. package/skills/preset-creator/references/complex-task-skeleton/brief.md +32 -8
  132. package/skills/preset-creator/references/preset-package-skeleton.md +15 -5
  133. package/skills/preset-creator/references/structure-aware-paths.md +112 -0
  134. package/templates/AGENTS.md.template +28 -26
  135. package/templates/architecture/README.md +2 -2
  136. package/templates/architecture/service-catalog.md +2 -2
  137. package/templates/architecture/services/service-template.md +1 -1
  138. package/templates/dashboard/assets/app-src/00-state.js +5 -1
  139. package/templates/dashboard/assets/app-src/10-router.js +7 -0
  140. package/templates/dashboard/assets/app-src/20-overview.js +8 -8
  141. package/templates/dashboard/assets/app-src/30-tasks.js +132 -40
  142. package/templates/dashboard/assets/app-src/32-task-swimlane.js +314 -0
  143. package/templates/dashboard/assets/app-src/35-task-detail.js +35 -5
  144. package/templates/dashboard/assets/app-src/40-modules.js +257 -41
  145. package/templates/dashboard/assets/app-src/45-review.js +127 -1
  146. package/templates/dashboard/assets/app-src/90-bindings.js +185 -2
  147. package/templates/dashboard/assets/app.css +928 -53
  148. package/templates/dashboard/assets/app.css.manifest.json +2 -0
  149. package/templates/dashboard/assets/app.js +1071 -98
  150. package/templates/dashboard/assets/app.manifest.json +1 -0
  151. package/templates/dashboard/assets/css-src/00-foundation.css +12 -6
  152. package/templates/dashboard/assets/css-src/10-panels-flow.css +2 -2
  153. package/templates/dashboard/assets/css-src/30-task-index.css +21 -13
  154. package/templates/dashboard/assets/css-src/31-archive.css +94 -0
  155. package/templates/dashboard/assets/css-src/32-task-swimlane.css +487 -0
  156. package/templates/dashboard/assets/css-src/35-review-workspace.css +78 -0
  157. package/templates/dashboard/assets/css-src/40-detail-modules-migration.css +191 -14
  158. package/templates/dashboard/assets/css-src/50-responsive-overrides.css +23 -0
  159. package/templates/dashboard/assets/i18n.js +166 -2
  160. package/templates/development/README.md +9 -9
  161. package/templates/development/cross-repo-debugging.md +3 -3
  162. package/templates/development/external-context/service-template.md +1 -1
  163. package/templates/development/external-source-packs/README.md +2 -2
  164. package/templates/integrations/README.md +4 -4
  165. package/templates/integrations/api-contract.md +1 -1
  166. package/templates/integrations/event-contract.md +1 -1
  167. package/templates/integrations/third-party/vendor-template.md +1 -1
  168. package/templates/integrations/webhook-contract.md +1 -1
  169. package/templates/ledger/Harness-Ledger.md +1 -1
  170. package/templates/modules/module_brief.md +50 -0
  171. package/templates/modules/module_plan.md +49 -0
  172. package/templates/modules/registry_view.md +9 -0
  173. package/templates/modules/session_prompt_pack.md +55 -0
  174. package/templates/planning/brief.md +32 -8
  175. package/templates/planning/module_brief.md +28 -3
  176. package/templates/planning/module_plan.md +26 -11
  177. package/templates/planning/module_session_prompt.md +11 -2
  178. package/templates/planning/optional/slices/_slice-template/brief.md +28 -0
  179. package/templates/planning/review.md +1 -1
  180. package/templates/planning/visual_map.md +1 -1
  181. package/templates/reference/docs-library-standard.md +7 -7
  182. package/templates/reference/execution-workflow-standard.md +13 -0
  183. package/templates/reference/external-source-intake-standard.md +10 -10
  184. package/templates/reference/repo-governance-standard.md +1 -1
  185. package/templates/reference/review-routing-standard.md +4 -0
  186. package/templates/ssot/Module-Registry.md +4 -38
  187. package/templates/walkthrough/walkthrough-template.md +1 -1
  188. package/templates-zh-CN/AGENTS.md.template +27 -25
  189. package/templates-zh-CN/CLAUDE.md.template +1 -1
  190. package/templates-zh-CN/architecture/README.md +2 -2
  191. package/templates-zh-CN/architecture/service-catalog.md +2 -2
  192. package/templates-zh-CN/architecture/services/service-template.md +1 -1
  193. package/templates-zh-CN/development/README.md +9 -9
  194. package/templates-zh-CN/development/cross-repo-debugging.md +3 -3
  195. package/templates-zh-CN/development/external-context/service-template.md +1 -1
  196. package/templates-zh-CN/development/external-source-packs/README.md +2 -2
  197. package/templates-zh-CN/integrations/README.md +4 -4
  198. package/templates-zh-CN/integrations/api-contract.md +1 -1
  199. package/templates-zh-CN/integrations/event-contract.md +1 -1
  200. package/templates-zh-CN/integrations/third-party/vendor-template.md +1 -1
  201. package/templates-zh-CN/integrations/webhook-contract.md +1 -1
  202. package/templates-zh-CN/ledger/Harness-Ledger.md +1 -1
  203. package/templates-zh-CN/lessons/lesson-arch-process-change.md +1 -1
  204. package/templates-zh-CN/lessons/lesson-new-doc.md +3 -3
  205. package/templates-zh-CN/lessons/lesson-ref-change.md +4 -4
  206. package/templates-zh-CN/modules/module_brief.md +47 -0
  207. package/templates-zh-CN/modules/module_plan.md +48 -0
  208. package/templates-zh-CN/modules/registry_view.md +9 -0
  209. package/templates-zh-CN/modules/session_prompt_pack.md +50 -0
  210. package/templates-zh-CN/planning/INDEX.md +1 -0
  211. package/templates-zh-CN/planning/brief.md +26 -7
  212. package/templates-zh-CN/planning/module_brief.md +24 -2
  213. package/templates-zh-CN/planning/module_plan.md +35 -29
  214. package/templates-zh-CN/planning/module_session_prompt.md +15 -11
  215. package/templates-zh-CN/planning/optional/slices/_slice-template/brief.md +28 -11
  216. package/templates-zh-CN/planning/review.md +1 -1
  217. package/templates-zh-CN/reference/adversarial-review-standard.md +1 -1
  218. package/templates-zh-CN/reference/delivery-operating-model-standard.md +3 -3
  219. package/templates-zh-CN/reference/docs-library-standard.md +27 -27
  220. package/templates-zh-CN/reference/execution-workflow-standard.md +12 -2
  221. package/templates-zh-CN/reference/external-source-intake-standard.md +10 -10
  222. package/templates-zh-CN/reference/harness-ledger-standard.md +3 -3
  223. package/templates-zh-CN/reference/regression-ssot-governance.md +2 -2
  224. package/templates-zh-CN/reference/repo-governance-standard.md +1 -1
  225. package/templates-zh-CN/reference/review-routing-standard.md +3 -0
  226. package/templates-zh-CN/reference/walkthrough-standard.md +2 -2
  227. package/templates-zh-CN/reference/worktree-standard.md +1 -1
  228. package/templates-zh-CN/regression/Cadence-Ledger.md +2 -2
  229. package/templates-zh-CN/ssot/Delivery-SSoT.md +2 -2
  230. package/templates-zh-CN/ssot/Module-Registry.md +5 -44
  231. package/templates-zh-CN/ssot/Regression-SSoT.md +2 -2
  232. package/templates-zh-CN/walkthrough/walkthrough-template.md +4 -4
@@ -24,6 +24,10 @@ Use Node.js 24 or newer. CI should run on the minimum supported LTS line.
24
24
  npm install
25
25
  ```
26
26
 
27
+ The source repository ignores `dist/`. `npm install`, Git/source `prepare`,
28
+ `prepack`, and the root npm scripts regenerate it when needed. The npm package
29
+ still publishes `dist/` and excludes `scripts/` and `tests/`.
30
+
27
31
  If your change touches the GUI submodule:
28
32
 
29
33
  ```bash
@@ -39,8 +43,8 @@ the full root suite.
39
43
  | Change type | Minimum local checks |
40
44
  | --- | --- |
41
45
  | Docs only | `git diff --check` |
42
- | CLI/runtime | `npm test`, `npm run check`, `git diff --check` |
43
- | Templates or examples | `npm test`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
46
+ | CLI/runtime | `npm run typecheck`, `npm run typecheck:guards`, `npm test`, `npm run check`, `git diff --check` |
47
+ | Templates or examples | `npm test`, `npm run build:runtime`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
44
48
  | Dashboard | `npm test`, `npm run smoke:dashboard`, `git diff --check` |
45
49
  | Package surface | `npm test`, `npm run pack:dry-run`, `git diff --check` |
46
50
  | GUI submodule | `cd harness-gui && npm ci && npm run typecheck && npm test && npm run build` |
@@ -48,6 +52,9 @@ the full root suite.
48
52
  Full root suite:
49
53
 
50
54
  ```bash
55
+ npm run build:runtime
56
+ npm run typecheck
57
+ npm run typecheck:guards
51
58
  npm test
52
59
  npm run smoke:dashboard
53
60
  npm run check
@@ -97,4 +104,4 @@ GitHub Actions runs the same broad gates contributors should run locally:
97
104
  - npm package dry run
98
105
  - GUI submodule typecheck, tests, and build
99
106
 
100
- Repository owners manage branch protection and required checks in GitHub. Contributors only need to keep their PRs focused, documented, and verified.
107
+ Repository owners manage branch protection and required checks in GitHub. The root CI includes the enforced TypeScript integrity gate: `npm run typecheck` plus `npm run typecheck:guards`, including the no-`@ts-nocheck` regression check. Contributors only need to keep their PRs focused, documented, and verified.
@@ -24,6 +24,10 @@ PR 尽量聚焦在一类改动上。文档、CLI 行为、目标项目模板、p
24
24
  npm install
25
25
  ```
26
26
 
27
+ 源码仓忽略 `dist/`。`npm install`、Git/source `prepare`、`prepack` 和根仓
28
+ npm scripts 会按需重新生成它。npm 包仍然发布 `dist/`,并排除 `scripts/` 和
29
+ `tests/`。
30
+
27
31
  如果改动涉及 GUI 子模块:
28
32
 
29
33
  ```bash
@@ -38,8 +42,8 @@ npm ci
38
42
  | 改动类型 | 最小本地检查 |
39
43
  | --- | --- |
40
44
  | 仅文档 | `git diff --check` |
41
- | CLI / runtime | `npm test`, `npm run check`, `git diff --check` |
42
- | 模板或示例 | `npm test`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
45
+ | CLI / runtime | `npm run typecheck`, `npm run typecheck:guards`, `npm test`, `npm run check`, `git diff --check` |
46
+ | 模板或示例 | `npm test`, `npm run build:runtime`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
43
47
  | Dashboard | `npm test`, `npm run smoke:dashboard`, `git diff --check` |
44
48
  | Package surface | `npm test`, `npm run pack:dry-run`, `git diff --check` |
45
49
  | GUI 子模块 | `cd harness-gui && npm ci && npm run typecheck && npm test && npm run build` |
@@ -47,6 +51,9 @@ npm ci
47
51
  完整根仓检查:
48
52
 
49
53
  ```bash
54
+ npm run build:runtime
55
+ npm run typecheck
56
+ npm run typecheck:guards
50
57
  npm test
51
58
  npm run smoke:dashboard
52
59
  npm run check
@@ -96,4 +103,4 @@ GitHub Actions 会运行贡献者本地也应覆盖的主要 gate:
96
103
  - npm package dry run
97
104
  - GUI 子模块 typecheck、测试和 build
98
105
 
99
- GitHub branch protection 和 required checks 由仓库 owner 在 GitHub 上管理。贡献者只需要让 PR 聚焦、说明清楚并附上验证证据。
106
+ GitHub branch protection 和 required checks 由仓库 owner 在 GitHub 上管理。根仓 CI 已包含 enforced TypeScript integrity gate:`npm run typecheck` 和 `npm run typecheck:guards`,其中包括 no-`@ts-nocheck` 防回归检查。贡献者只需要让 PR 聚焦、说明清楚并附上验证证据。
@@ -83,7 +83,7 @@ If the user provides external source material, first use `docs/11-REFERENCE/exte
83
83
 
84
84
  ## Step 1: Baseline
85
85
 
86
- First check whether the target environment has the `harness` command. If it does not, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, use `npx --yes coding-agent-harness <command>` for Harness CLI calls. If you are debugging from the source checkout, replace `harness` with `node dist/harness.mjs`.
86
+ First check whether the target environment has the `harness` command. If it does not, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, use `npx --yes coding-agent-harness <command>` for Harness CLI calls. If you are debugging from the source checkout, run `npm install` or `npm run build:runtime` first, then replace `harness` with `node dist/harness.mjs`.
87
87
 
88
88
  After user confirmation, run or reuse:
89
89
 
@@ -83,7 +83,7 @@ Agent 应推荐下面三种模式之一,而不是让用户自己先懂这些
83
83
 
84
84
  ## Step 1: Baseline
85
85
 
86
- 先检查目标环境是否有 `harness` 命令。如果没有,不要静默全局安装。先询问用户是否允许运行 `npm install -g coding-agent-harness`。只有用户明确同意后才执行全局安装。用户不同意或未回复时,Harness CLI 都用 `npx --yes coding-agent-harness <command>` 临时执行。如果你在源码仓调试,把 `harness` 替换为 `node dist/harness.mjs`。
86
+ 先检查目标环境是否有 `harness` 命令。如果没有,不要静默全局安装。先询问用户是否允许运行 `npm install -g coding-agent-harness`。只有用户明确同意后才执行全局安装。用户不同意或未回复时,Harness CLI 都用 `npx --yes coding-agent-harness <command>` 临时执行。如果你在源码仓调试,先运行 `npm install` 或 `npm run build:runtime` 生成 `dist/`,再把 `harness` 替换为 `node dist/harness.mjs`。
87
87
 
88
88
  用户确认迁移模式后再运行或复用:
89
89
 
@@ -11,7 +11,7 @@ If another agent will execute the migration, first give it:
11
11
  - `docs-release/guides/full-legacy-migration-subagent-strategy.md`
12
12
  - `docs-release/guides/full-legacy-migration-subagent-strategy.zh-CN.md`
13
13
 
14
- This guide assumes the installed `harness` command. The executing agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Install globally only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace it with `node dist/harness.mjs`.
14
+ This guide assumes the installed `harness` command. The executing agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Install globally only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace it with `node dist/harness.mjs` after `npm install` or `npm run build:runtime` has generated `dist/`.
15
15
 
16
16
  ## Target Path And v2 Structure
17
17
 
@@ -105,7 +105,9 @@ migration destination is `coding-agent-harness/`, and the old `docs/` root is
105
105
  archived under `coding-agent-harness/governance/archive/legacy-docs/`. Legacy
106
106
  `planning/**/_task-template` and `planning/**/_module-template` directories are
107
107
  generated copies of npm-package templates, so migration removes them from the
108
- target project when present:
108
+ target project when present. New module templates live in bundled
109
+ `templates/modules/**`; target projects keep only real module documents and YAML
110
+ registration data:
109
111
 
110
112
  ```bash
111
113
  harness migrate-structure --plan --json /path/to/project
@@ -222,7 +224,7 @@ In baseline mode, only `current-active` tasks or tasks still referenced by SSoT
222
224
 
223
225
  In status-aware rewrite mode, an existing `brief.md`, `execution_strategy.md`, or `visual_map.md` is not automatically preserved. If evidence shows it is an old template, parser residue, wrong language, or too weak for a human to judge current state, rewrite it. Historical tasks may become readable index cards or residuals, but that decision must be evidence-backed.
224
226
 
225
- Global table and module index migration is not manual refilling. Current Harness versions generate task lifecycle summaries into `Harness-Ledger.md` only; legacy `Feature-SSoT.md` and `Private-Feature-SSoT.md` files are archived during cutover and are not regenerated. Module `module_plan.md` Steps tables and module `visual_map.md` topology tables are still generated from module task files. Humans should inspect current state through the Dashboard; agents can use `task-list` / `task-index` queries for fast lookup. Before cutting over an older project, archive the legacy lifecycle tables and rebuild current indexes from task files:
227
+ Global table and module index migration is not manual refilling. Current Harness versions generate task lifecycle summaries into `Harness-Ledger.md` only; legacy `Feature-SSoT.md` and `Private-Feature-SSoT.md` files are archived during cutover and are not regenerated. Module registration data lives in root `harness.yaml` `modules.items`; `Module-Registry.md` is a generated view. Module roots own only `brief.md` and `module_plan.md` by default; `execution_strategy.md`, `visual_map.md`, `review.md`, and `walkthrough.md` belong under concrete task directories. Humans should inspect current state through the Dashboard; agents can use `task-list` / `task-index` queries for fast lookup. Before cutting over an older project, archive the legacy lifecycle tables and rebuild current indexes from task files:
226
228
 
227
229
  ```bash
228
230
  harness governance rebuild --dry-run --archive /path/to/project
@@ -251,7 +253,8 @@ Do not turn many historical tasks into modules automatically. Adopt `module-para
251
253
  - the project has two or more independently evolving product or engineering domains;
252
254
  - every module has an owner, write scope, dependency model, and integration rule;
253
255
  - shared files are owned by the coordinator and worker changes flow through handoff;
254
- - `Module-Registry.md` and each `module_plan.md` can be maintained after migration.
256
+ - root `harness.yaml` `modules.items` can remain the maintained registry, with `Module-Registry.md` only as its generated reading view;
257
+ - each module root needs only real `brief.md` and `module_plan.md`; do not batch-create module-level task contract files just to enable modules.
255
258
 
256
259
  If the project merely has many historical tasks without stable module boundaries, keep `safe-adoption`, use `migrate-plan` as the action list, and add module capability later.
257
260
 
@@ -372,11 +375,11 @@ Treat any FAIL as valid until disproven with evidence. After fixing, regenerate
372
375
 
373
376
  Module classification has three levels and must not skip levels:
374
377
 
375
- 1. `explicit module`: tasks already live under `docs/09-PLANNING/MODULES/<module>/`, or a maintained `Module-Registry.md` exists.
378
+ 1. `explicit module`: tasks already live under v2 `planning/modules/<module>/tasks/`, or root `harness.yaml` `modules.items` registers the module.
376
379
  2. `inferred module`: dashboard temporary grouping from task path/title/ID keywords, for browsing and triage only. It does not mean the project adopted `module-parallel`.
377
380
  3. `legacy-unclassified`: historical tasks that cannot be classified reliably. Preserve history and do not batch-rewrite them.
378
381
 
379
- Before creating `Module-Registry.md`, produce a classification summary:
382
+ Before registering modules, produce a classification summary:
380
383
 
381
384
  - candidate module name;
382
385
  - why this is a product/engineering domain rather than a folder or date range;
@@ -15,7 +15,8 @@ English mirror: `docs-release/guides/migration-playbook.en-US.md`
15
15
  如果目标环境没有 `harness`,不得静默全局安装;先询问用户是否允许运行
16
16
  `npm install -g coding-agent-harness`。用户明确同意后才能安装。用户不同意或未回复时,
17
17
  用 `npx --yes coding-agent-harness <command>` 运行同一条 CLI。维护者在本源码仓调试时,
18
- 可以把同一命令替换为 `node dist/harness.mjs`。
18
+ 可以在 `npm install` 或 `npm run build:runtime` 生成 `dist/` 后,把同一命令替换为
19
+ `node dist/harness.mjs`。
19
20
 
20
21
  ## 目标路径和 v2 结构
21
22
 
@@ -105,7 +106,8 @@ Agent 必须记录具体判断证据,例如 `AGENTS.md`、`CLAUDE.md`、`READM
105
106
  `--apply`。默认迁移目标是 `coding-agent-harness/`,并会把旧 `docs/` 归档到
106
107
  `coding-agent-harness/governance/archive/legacy-docs/`。旧版本遗留的
107
108
  `planning/**/_task-template` 和 `planning/**/_module-template` 是 npm 包内模板的生成副本,
108
- 迁移时会从目标项目中移除:
109
+ 迁移时会从目标项目中移除。新模块模板来自 npm 包内的 `templates/modules/**`;
110
+ 目标项目只保留真实模块文档和 YAML 注册数据:
109
111
 
110
112
  ```bash
111
113
  harness migrate-structure --plan --json /path/to/project
@@ -222,7 +224,7 @@ Baseline 模式下,只有 `current-active` 或 “仍被 SSoT 引用为当前
222
224
 
223
225
  Status-aware rewrite 模式下,已有 `brief.md`、`execution_strategy.md`、`visual_map.md` 不是自动保留;如果证据显示它们只是旧模板、解析残留、语言错误或不能让人判断当前状态,就重写。历史任务可以只写可读索引卡或 residual,但这个判断必须有证据。
224
226
 
225
- 全局表和模块索引迁移不是人工重填。新版本只把任务生命周期汇总生成到 `Harness-Ledger.md`;旧的 `Feature-SSoT.md` 和 `Private-Feature-SSoT.md` 是 legacy 生命周期投影,切换时应先归档,不再重建。模块 `module_plan.md` 的 Steps 表和模块 `visual_map.md` 的拓扑表仍由模块任务文件生成。人看当前状态应优先看 Dashboard,Agent 需要快速定位时用 `task-list` / `task-index` 查询。旧项目切换前,先把旧生命周期表归档,再用生成器从任务文件重建当前索引:
227
+ 全局表和模块索引迁移不是人工重填。新版本只把任务生命周期汇总生成到 `Harness-Ledger.md`;旧的 `Feature-SSoT.md` 和 `Private-Feature-SSoT.md` 是 legacy 生命周期投影,切换时应先归档,不再重建。模块注册数据写在根 `harness.yaml` 的 `modules.items`,`Module-Registry.md` 是生成视图。模块根目录默认只维护 `brief.md` 和 `module_plan.md`;`execution_strategy.md`、`visual_map.md`、`review.md`、`walkthrough.md` 属于具体任务目录。人看当前状态应优先看 Dashboard,Agent 需要快速定位时用 `task-list` / `task-index` 查询。旧项目切换前,先把旧生命周期表归档,再用生成器从任务文件重建当前索引:
226
228
 
227
229
  ```bash
228
230
  harness governance rebuild --dry-run --archive /path/to/project
@@ -251,7 +253,8 @@ Full semantic rewrite 模式下,所有任务都需要 standalone `brief.md`,
251
253
  - 项目存在两个以上可独立演进的产品或工程域。
252
254
  - 每个模块有 owner、write scope、依赖关系和集成规则。
253
255
  - 共享文件由 coordinator 维护,worker 通过 handoff 请求更新。
254
- - `Module-Registry.md` 和每个 `module_plan.md` 能被持续维护。
256
+ - `harness.yaml` `modules.items` 能作为注册表持续维护,生成的 `Module-Registry.md` 只作为视图阅读。
257
+ - 每个模块根目录只需要真实的 `brief.md` 和 `module_plan.md`;不要为了启用模块而批量创建模块级任务合同文件。
255
258
 
256
259
  如果只是历史 task 很多,但没有稳定模块边界,先保持 `safe-adoption`,用 `migrate-plan` 输出 action list,等模块边界明确后再加 capability。
257
260
 
@@ -372,11 +375,11 @@ Capability registry 必须由一个 worker 顺序写,不能多个 worker 并
372
375
 
373
376
  模块分类有三个层级,不能跳级:
374
377
 
375
- 1. `explicit module`:任务已经在 `docs/09-PLANNING/MODULES/<module>/` 下,或已有明确 `Module-Registry.md` 维护。
378
+ 1. `explicit module`:任务已经在 v2 `planning/modules/<module>/tasks/` 下,或根 `harness.yaml` 的 `modules.items` 已注册该模块。
376
379
  2. `inferred module`:dashboard 根据任务路径、标题、ID 关键字临时分组,仅用于浏览和分诊,不代表项目已经采用 `module-parallel`。
377
380
  3. `legacy-unclassified`:无法稳定归类的历史任务,保持历史状态,不要批量改写。
378
381
 
379
- 创建 `Module-Registry.md` 前,必须先输出分类摘要:
382
+ 注册模块前,必须先输出分类摘要:
380
383
 
381
384
  - 候选模块名。
382
385
  - 为什么这是产品/工程域,而不是文件夹或时间段。
@@ -27,6 +27,24 @@ and `harness install-user` seed them into the user preset root, while
27
27
  `harness init` seeds them into the project preset root. Re-run
28
28
  `harness preset seed` for the user root or `harness preset seed --project <target>`
29
29
  for the project root when a preset root is missing or incomplete.
30
+ Use `harness preset audit --json` or `harness preset audit --project --json <target>`
31
+ to compare installed preset manifest hashes with bundled presets before deciding
32
+ whether to re-seed with `--force`.
33
+
34
+ ## Task Provenance Drift
35
+
36
+ Preset audit hashes on a task are creation-time provenance. After a task is
37
+ created, the task directory is an independent document record, so later changes
38
+ to the currently discovered preset do not invalidate historical tasks by
39
+ default. Target checks report manifest, version, and resource drift as
40
+ `preset-drift-warning` messages so maintainers can see that a task came from an
41
+ older preset shape without treating that history as a release-blocking failure.
42
+
43
+ Current preset execution remains stricter. `harness preset check`,
44
+ `harness preset install`, `harness new-task --preset`, and
45
+ `harness preset action` still validate the current preset package and require an
46
+ explicit current-preset opt-in for sensitive reruns when a task's stored audit
47
+ no longer matches the preset being executed.
30
48
 
31
49
  ## Dashboard Management
32
50
 
@@ -78,7 +96,7 @@ task:
78
96
  entrypoints:
79
97
  newTask:
80
98
  type: template
81
- writes: [coding-agent-harness/planning/tasks/**]
99
+ writes: [{{paths.tasksRoot}}/**]
82
100
  audit: true
83
101
  templates:
84
102
  taskPlanAppend: templates/task_plan.append.md
@@ -106,10 +124,47 @@ audit:
106
124
  evidenceFiles: [preset-audit.json, preset-manifest.json, write-scope.json]
107
125
  writeScopes:
108
126
  taskDocs:
109
- path: coding-agent-harness/planning/tasks/**
127
+ path: {{paths.tasksRoot}}/**
110
128
  access: write
111
129
  ```
112
130
 
131
+ ## Task Actions
132
+
133
+ Use `actions` when a preset needs task-level commands after task creation, such
134
+ as closing a workflow stage or generating a preset-owned artifact. Actions run
135
+ through the namespaced CLI entrypoint:
136
+
137
+ ```bash
138
+ harness preset action custom-review close-stage --task custom-review-task --stage PLAN /path/to/project
139
+ ```
140
+
141
+ Action scripts are trusted local Node.js code, not a sandbox. Non-bundled
142
+ script actions require explicit trust when installed:
143
+
144
+ ```bash
145
+ harness preset install ./custom-review --project --allow-scripts /path/to/project
146
+ ```
147
+
148
+ ```yaml
149
+ actions:
150
+ close-stage:
151
+ type: script
152
+ command: scripts/close-stage.mjs
153
+ taskRequired: true
154
+ inputs:
155
+ stage:
156
+ type: text
157
+ flag: --stage
158
+ required: true
159
+ reads: [{{task.paths.taskPlan}}, {{task.paths.artifacts}}/**]
160
+ writes: [{{task.paths.artifacts}}/stages/**, {{task.paths.progress}}]
161
+ audit: true
162
+ ```
163
+
164
+ Action commands must be package-local `.mjs` files. Inputs are schema-only
165
+ (`text`, `flag`, or `json-file`), and writes should use `{{task.paths.*}}`
166
+ tokens so the action stays scoped to the current task.
167
+
113
168
  ## Reference Bundles
114
169
 
115
170
  Use `resources.references` when a family of tasks shares the same outside context, such as another microservice, API contract, migration packet, reviewer input, or local verification runbook. Harness copies or renders these files into each created task directory, appends `references/INDEX.md` rows, and can add a required-read section to `task_plan.md`.
@@ -160,6 +215,12 @@ resources:
160
215
 
161
216
  Templates use `{{valueName}}` placeholders from `templateValues`. `templateValues` and `metadata` support literal `value`, `default`, and dot-path `from` references such as `inputs.subject` or `task.title`; they do not evaluate arbitrary expressions.
162
217
 
218
+ Runtime paths must use the structure-aware `{{paths.*}}` context instead of
219
+ hard-coded `coding-agent-harness/...` strings. Supported path fields include
220
+ `harnessRoot`, `planningRoot`, `tasksRoot`, `modulesRoot`, `externalRoot`,
221
+ `governanceRoot`, `generatedRoot`, `regressionRoot`, `ledgerPath`, and
222
+ `closeoutIndexPath`. Harness resolves them from the target `harness.yaml`.
223
+
163
224
  `metadata` entries render first-class task plan lines such as `Review Subject: API contracts`.
164
225
 
165
226
  ```md
@@ -212,6 +273,9 @@ harness preset install ./my-preset --project /path/to/project
212
273
  harness preset install legacy-migration --force
213
274
  harness preset seed
214
275
  harness preset seed --project /path/to/project
276
+ harness preset audit --json
277
+ harness templates audit --json /path/to/project
278
+ harness templates refresh --apply --json /path/to/project
215
279
  harness preset list --json /path/to/project
216
280
  harness preset inspect custom-review --json /path/to/project
217
281
  harness new-task --title "Custom review task" --preset custom-review --subject "API contracts" /path/to/project
@@ -233,6 +297,8 @@ For every preset, prove both the manifest and downstream task behavior:
233
297
 
234
298
  - Presets cannot write outside declared `writeScopes`.
235
299
  - Presets do not run arbitrary JavaScript during `new-task`.
300
+ - Preset actions may run trusted `.mjs` scripts, but only through
301
+ `harness preset action <preset> <action>` and task-local materialization.
236
302
  - Reference bundles are task-local snapshots. If the shared upstream context changes later, create a new preset version or a follow-up task rather than silently mutating historical tasks.
237
303
  - Script and check entrypoints may exist in bundled packages, but the task creation path is YAML + templates + built-in processors.
238
304
  - Use a new built-in processor only when multiple presets need the same capability and the behavior can be tested centrally.
@@ -28,12 +28,12 @@ stateDiagram-v2
28
28
  review_submitted --> missing_materials: returned for materials
29
29
  missing_materials --> in_progress: repair materials
30
30
  review_submitted --> blocked: blocking finding
31
- review_submitted --> human_confirmed: review-confirm
31
+ review_submitted --> human_confirmed: Dashboard workbench confirmation
32
32
  human_confirmed --> finalized: task-complete + closeout
33
33
  finalized --> [*]
34
34
  ```
35
35
 
36
- `task-review` means the agent submitted a review packet. It does not mean human approval. `review-confirm` is the human confirmation gate and writes its audit fields to `INDEX.md`. `task-complete` / closeout is not a substitute for review confirmation.
36
+ `task-review` means the agent submitted a review packet. It does not mean human approval. Dashboard workbench human confirmation is the human confirmation gate and writes its audit fields to `INDEX.md`. `task-complete` / closeout is not a substitute for review confirmation.
37
37
 
38
38
  ## Phase Kind Map
39
39
 
@@ -43,12 +43,12 @@ stateDiagram-v2
43
43
  | --- | --- | --- | --- |
44
44
  | `init` | Scope, context, budget, and execution strategy. | no | `harness task-start <task-id>` |
45
45
  | `execution` | Implementation, documentation, and verification slices. | yes | `harness task-phase <task-id> <phase-id> --state done --completion 100 --evidence present` |
46
- | `gate` | Agent review submission, human confirmation, lesson routing, walkthrough, and closeout. | no | `harness task-review`, `harness review-confirm`, or `harness task-complete` |
46
+ | `gate` | Agent review submission, human confirmation, lesson routing, walkthrough, and closeout. | no | `harness task-review`, Dashboard workbench human confirmation, or `harness task-complete` |
47
47
 
48
48
  Older phase tables without `Kind` remain valid and are treated as `execution`.
49
49
  The Dashboard implementation score uses non-skipped `execution` phases only.
50
50
  Gate phases explain the next lifecycle action and owner; they do not make a finished implementation look incomplete.
51
- Agents may run `Exit Command` values with `Actor: agent`. `Actor: human` gates, especially `review-confirm`, require explicit human action.
51
+ Agents may run `Exit Command` values with `Actor: agent`. `Actor: human` gates, especially Dashboard workbench human confirmation, require explicit human action.
52
52
 
53
53
  ## Derived State
54
54
 
@@ -91,7 +91,7 @@ flowchart TB
91
91
 
92
92
  | Condition | `lifecycleState` | Meaning |
93
93
  | --- | --- | --- |
94
- | Tombstone, superseded-by, archive, or abandoned marker exists | `soft-deleted-superseded` | Hidden by default, but preserved for audit and replacement tracing. |
94
+ | Tombstone, superseded-by, or archive marker exists | `soft-deleted-superseded` | Hidden by default, but preserved for audit, reason, and replacement tracing; abandoned, duplicate, and requirement-change semantics live in `Reason`. |
95
95
  | Open P0-P2 finding, invalid transition, audit failure, or failed human-review gate | `blocked` | Cannot enter human confirmation until the blocker is fixed or waived. |
96
96
  | Standard / complex task is missing required files, sections, evidence, lesson decision, or review submission | `missing-materials` | Needs agent repair; not part of the human review queue. |
97
97
  | `task-review` was submitted, materials are ready, and `INDEX.md` does not show human confirmation | `review-submitted` | Truly waiting for human review. |
@@ -111,7 +111,7 @@ flowchart TB
111
111
  | `blocked-open-findings` | There is an open P0-P2 finding or a finding that blocks release / confirmation. |
112
112
  | `confirmed` | `INDEX.md` Task Audit Metadata has `Human Review Status: confirmed` and committed audit fields. |
113
113
 
114
- Agent self-review, subagent review, and coordinator review can only move a task toward `submitted`. Only `review-confirm` or an explicit Dashboard Workbench human confirmation writes the confirmation audit fields in `INDEX.md`.
114
+ Agent self-review, subagent review, and coordinator review can only move a task toward `submitted`. Only an explicit Dashboard Workbench human confirmation writes the confirmation audit fields in `INDEX.md`.
115
115
 
116
116
  ## Lifecycle Queues
117
117
 
@@ -143,7 +143,7 @@ flowchart TD
143
143
  | Blocked | Blocking finding, state conflict, Git audit failure, completion gate failure, or human waiver required. | agent + human | Fixed, closed, or explicitly waived. |
144
144
  | Lessons | Lesson candidate needs decision, task-local retention, rejection, dry-run promotion, or a sedimentation task. | human + agent | Decision is complete, or a traceable sedimentation task exists. |
145
145
  | Confirmed / Finalized | Human-confirmed, or finalized and ready for read-only tracing. | coordinator | Closeout, ledger, and lesson routing are complete; then read-only. |
146
- | Soft-deleted / Superseded | Task was soft-deleted, replaced, merged, archived, or abandoned. | coordinator | Read-only tracing; reopen only when needed. |
146
+ | Soft-deleted / Superseded | Task was soft-deleted, replaced, merged, or archived; abandoned / duplicate / requirement-change semantics are tombstone reasons. | coordinator | Read-only tracing; reopen only when needed. |
147
147
 
148
148
  The Review queue only waits for human confirmation. Missing materials, blockers, lesson sedimentation, confirmed-but-not-finalized work, and historical superseded tasks must not masquerade as Review queue items.
149
149
 
@@ -195,7 +195,7 @@ sequenceDiagram
195
195
 
196
196
  Strict rule: an agent can prepare review evidence and submit the task for review, but the task is not human-confirmed until the task `INDEX.md` contains committed confirmation audit fields. Confirmation must use gated auto-commit: the CLI and Workbench reject dirty Git state, missing commit identity, hook/preflight failure, or writes outside the current task `INDEX.md` allowlist, and return recovery guidance.
197
197
 
198
- CLI-owned mechanical writes and agent-owned manual slices have different boundaries. `new-task`, `task-*`, `task-phase`, `module-step`, `review-confirm`, `lesson-sediment`, and `lesson-promote --apply` acquire a lock, restrict writes to an allowlist, and auto-commit in a clean Git root. When an agent manually edits code, templates, or task docs, it still needs to proactively commit after verification; if it cannot commit, it must record the no-commit reason, owner, and next step, and must not mix unrelated dirty changes into the task commit.
198
+ CLI-owned mechanical writes, Workbench human confirmation, and agent-owned manual slices have different boundaries. `new-task`, `task-*`, `task-phase`, `module-step`, `lesson-sediment`, and `lesson-promote --apply` acquire a lock, restrict writes to an allowlist, and auto-commit in a clean Git root; human confirmation runs only through the local Workbench. When an agent manually edits code, templates, or task docs, it still needs to proactively commit after verification; if it cannot commit, it must record the no-commit reason, owner, and next step, and must not mix unrelated dirty changes into the task commit.
199
199
 
200
200
  ## Lesson Sedimentation
201
201
 
@@ -28,12 +28,12 @@ stateDiagram-v2
28
28
  review_submitted --> missing_materials: returned for materials
29
29
  missing_materials --> in_progress: repair materials
30
30
  review_submitted --> blocked: blocking finding
31
- review_submitted --> human_confirmed: review-confirm
31
+ review_submitted --> human_confirmed: Dashboard workbench confirmation
32
32
  human_confirmed --> finalized: task-complete + closeout
33
33
  finalized --> [*]
34
34
  ```
35
35
 
36
- `task-review` 表示 Agent 提交审查材料包,不表示人工批准。`review-confirm` 才表示人工确认门禁,并把审计字段写入 `INDEX.md`。`task-complete` / closeout 也不是 review confirmation 的替代品。
36
+ `task-review` 表示 Agent 提交审查材料包,不表示人工批准。Dashboard workbench 人工确认才表示人工确认门禁,并把审计字段写入 `INDEX.md`。`task-complete` / closeout 也不是 review confirmation 的替代品。
37
37
 
38
38
  ## 阶段类型地图
39
39
 
@@ -43,12 +43,12 @@ stateDiagram-v2
43
43
  | --- | --- | --- | --- |
44
44
  | `init` | 范围、上下文、预算和执行策略。 | 否 | `harness task-start <task-id>` |
45
45
  | `execution` | 实现、文档和验证切片。 | 是 | `harness task-phase <task-id> <phase-id> --state done --completion 100 --evidence present` |
46
- | `gate` | Agent 提交审查、人工确认、lesson routing、walkthrough 和 closeout。 | 否 | `harness task-review`、`harness review-confirm` `harness task-complete` |
46
+ | `gate` | Agent 提交审查、人工确认、lesson routing、walkthrough 和 closeout。 | 否 | `harness task-review`、Dashboard workbench 人工确认,或 `harness task-complete` |
47
47
 
48
48
  旧阶段表没有 `Kind` 也继续有效,默认按 `execution` 处理。
49
49
  Dashboard 实现完成度只计算非 skipped 的 `execution` 阶段。
50
50
  Gate 阶段用于解释下一步生命周期动作和责任人,不会让已完成的实现看起来未完成。
51
- Agent 只能执行 `Actor: agent` 的 `Exit Command`。`Actor: human` 的 gate,尤其是 `review-confirm`,必须由人工明确执行。
51
+ Agent 只能执行 `Actor: agent` 的 `Exit Command`。`Actor: human` 的 gate,尤其是 Dashboard workbench 人工确认,必须由人工明确执行。
52
52
 
53
53
  ## 派生状态
54
54
 
@@ -91,7 +91,7 @@ flowchart TB
91
91
 
92
92
  | 条件 | `lifecycleState` | 含义 |
93
93
  | --- | --- | --- |
94
- | 有 tombstone、superseded-by、archiveabandoned 标记 | `soft-deleted-superseded` | 默认隐藏,但保留审计和替代链。 |
94
+ | 有 tombstone、superseded-by 或 archive 标记 | `soft-deleted-superseded` | 默认隐藏,但保留审计、原因和替代链;废弃、重复、需求变更写入 `Reason`。 |
95
95
  | 有 open P0-P2 finding、非法状态转换、审计失败或人审门禁失败 | `blocked` | 不能进入人工确认,必须先修 blocker 或记录 waiver。 |
96
96
  | 标准/复杂任务缺必需文件、章节、证据、lesson decision 或 review submission | `missing-materials` | 需要 Agent 补材料,不属于人审队列。 |
97
97
  | 已执行 `task-review`,材料齐全,且 `INDEX.md` 尚未显示人工确认 | `review-submitted` | 真正等待人审。 |
@@ -111,7 +111,7 @@ flowchart TB
111
111
  | `blocked-open-findings` | 有 open P0-P2 finding,或 finding 阻塞发布 / 确认。 |
112
112
  | `confirmed` | `INDEX.md` Task Audit Metadata 包含 `Human Review Status: confirmed` 和已提交审计字段。 |
113
113
 
114
- Agent 自查、subagent 审查和 coordinator 审查都只能让任务接近 `submitted`。只有 `review-confirm` 或 Workbench 的明确人工确认动作会把确认审计字段写入 `INDEX.md`。
114
+ Agent 自查、subagent 审查和 coordinator 审查都只能让任务接近 `submitted`。只有 Workbench 的明确人工确认动作会把确认审计字段写入 `INDEX.md`。
115
115
 
116
116
  ## 生命周期队列
117
117
 
@@ -202,7 +202,7 @@ sequenceDiagram
202
202
 
203
203
  严格规则:Agent 可以准备 review evidence,也可以提交审查;但任务只有在任务 `INDEX.md` 包含已提交的确认审计字段后,才算人工确认。确认动作必须通过 gated auto-commit:Git 状态不干净、提交身份缺失、hook/preflight 失败,或待写文件超出当前任务 `INDEX.md` 白名单时,CLI 和 Workbench 都会拒绝并返回恢复建议。
204
204
 
205
- CLI-owned 机械写入和 agent-owned 手工切片是两条边界。`new-task`、`task-*`、`task-phase`、`module-step`、`review-confirm`、`lesson-sediment` 和 `lesson-promote --apply` 会在干净 Git root 中加锁、限制写入范围并自动提交。Agent 手工编辑代码、模板或任务文档时仍要在验证后主动提交;无法提交时必须记录 no-commit reason、owner 和下一步,不能把 unrelated dirty changes 混入任务提交。
205
+ CLI-owned 机械写入、Workbench 人工确认和 agent-owned 手工切片是三条边界。`new-task`、`task-*`、`task-phase`、`module-step`、`lesson-sediment` 和 `lesson-promote --apply` 会在干净 Git root 中加锁、限制写入范围并自动提交;人工确认只通过本地 Workbench 执行。Agent 手工编辑代码、模板或任务文档时仍要在验证后主动提交;无法提交时必须记录 no-commit reason、owner 和下一步,不能把 unrelated dirty changes 混入任务提交。
206
206
 
207
207
  ## Lesson 沉淀
208
208
 
@@ -1,25 +1,26 @@
1
1
  # TypeScript Runtime Migration Closeout
2
2
 
3
3
  This closeout records the public package rule after the progressive JavaScript to
4
- TypeScript runtime migration. The package now executes committed
5
- `dist/**/*.mjs` artifacts, while `scripts/**/*.mts` and `tests/**/*.mts` are the
6
- source ownership surfaces. Historical checked-in `scripts/**/*.mjs` and
7
- `tests/**/*.mjs` shims have been removed after the dist observation gates passed.
4
+ TypeScript runtime migration. The package executes generated `dist/**/*.mjs`
5
+ artifacts, while `scripts/**/*.mts` and `tests/**/*.mts` are the source ownership
6
+ surfaces. Historical checked-in `scripts/**/*.mjs` and `tests/**/*.mjs` shims
7
+ have been removed after the dist observation gates passed.
8
8
 
9
9
  ## Current State
10
10
 
11
11
  All Node runtime and test sources under `scripts/` and `tests/` are now
12
12
  TypeScript-first:
13
13
 
14
- - `scripts/**/*.mts` builds to committed `dist/**/*.mjs` artifacts.
14
+ - `scripts/**/*.mts` builds to generated `dist/**/*.mjs` artifacts.
15
15
  - `tests/**/*.mts` runs through the built test runner.
16
- - `dist/**/*.mjs` is the package runtime surface for npm bin, npm scripts, and
17
- postinstall.
16
+ - `dist/**/*.mjs` is the package runtime surface for npm bin and installed
17
+ execution. Source checkout npm scripts refresh it before running.
18
18
  - `scripts/**/*.mjs` and `tests/**/*.mjs` have a final inventory of zero.
19
19
 
20
- The npm package publishes `dist/` and no longer publishes `scripts/` or `tests/`.
21
- This keeps installed execution independent from TypeScript source files and from
22
- the deleted historical shims.
20
+ The source repository ignores `dist/`, but the npm package publishes generated
21
+ `dist/` and no longer publishes `scripts/` or `tests/`. This keeps installed
22
+ execution independent from TypeScript source files and from the deleted
23
+ historical shims.
23
24
 
24
25
  ## Final Closeout Evidence
25
26
 
@@ -42,12 +43,15 @@ dashboard exceptions below.
42
43
  ## Runtime Contract
43
44
 
44
45
  The package is an ESM package and its current public runtime contract points at
45
- the committed dist build output:
46
+ generated dist build output:
46
47
 
47
48
  - `package.json` maps the `harness` executable to `dist/harness.mjs`.
48
- - npm postinstall runs `dist/postinstall.mjs`.
49
+ - npm postinstall runs the source-safe `postinstall.mjs` bootstrap, which
50
+ delegates to `dist/postinstall.mjs` after generating `dist/` in a source
51
+ checkout.
49
52
  - npm helper scripts such as `check`, `status`, and dashboard generation run
50
- through `dist/harness.mjs`.
53
+ through `run-dist.mjs`, which refreshes `dist/` in a source checkout and then
54
+ runs the relevant dist entrypoint.
51
55
  - Runtime modules import sibling `.mjs` files inside `dist/`, so installed
52
56
  package execution does not depend on TypeScript loaders.
53
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coding-agent-harness",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "Document governance kernel for long-running coding agents.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -26,21 +26,23 @@
26
26
  "harness": "dist/harness.mjs"
27
27
  },
28
28
  "scripts": {
29
- "check": "node dist/harness.mjs check --profile source-package .",
30
- "check:private": "node dist/harness.mjs check --profile private-harness .harness-private",
29
+ "check": "node run-dist.mjs harness.mjs check --profile source-package .",
30
+ "check:private": "node run-dist.mjs harness.mjs check --profile private-harness .harness-private",
31
31
  "build:runtime": "node scripts/build-dist.mts",
32
32
  "prepack": "node scripts/build-dist.mts --quiet",
33
+ "prepublishOnly": "node run-dist.mjs check-dist-observation.mjs --skip-install-smoke",
34
+ "prepare": "node postinstall.mjs --build-only",
33
35
  "typecheck": "npm exec --yes --package typescript@5.9.3 -- tsc -p tsconfig.json",
34
- "typecheck:guards": "node dist/check-type-boundaries.mjs && node dist/check-no-ts-nocheck.mjs",
35
- "check:nocheck": "node dist/check-no-ts-nocheck.mjs",
36
- "status": "node dist/harness.mjs status --json .",
37
- "dashboard": "node dist/harness.mjs dashboard --out tmp/harness-dashboard.html examples/minimal-project",
38
- "dashboard:folder": "node dist/harness.mjs dashboard --out-dir tmp/harness-dashboard examples/minimal-project",
36
+ "typecheck:guards": "node run-dist.mjs check-type-boundaries.mjs && node run-dist.mjs check-no-ts-nocheck.mjs",
37
+ "check:nocheck": "node run-dist.mjs check-no-ts-nocheck.mjs",
38
+ "status": "node run-dist.mjs harness.mjs status --json .",
39
+ "dashboard": "node run-dist.mjs harness.mjs dashboard --out tmp/harness-dashboard.html examples/minimal-project",
40
+ "dashboard:folder": "node run-dist.mjs harness.mjs dashboard --out-dir tmp/harness-dashboard examples/minimal-project",
39
41
  "pack:dry-run": "npm pack --dry-run --json",
40
- "postinstall": "node dist/postinstall.mjs",
41
- "observe:dist": "node dist/check-dist-observation.mjs --skip-pack --skip-install-smoke",
42
- "smoke:dashboard": "node dist/run-built-tests.mjs --test tests/smoke-dashboard.mjs",
43
- "test": "node dist/run-built-tests.mjs"
42
+ "postinstall": "node postinstall.mjs",
43
+ "observe:dist": "node run-dist.mjs check-dist-observation.mjs --skip-pack --skip-install-smoke",
44
+ "smoke:dashboard": "node run-dist.mjs run-built-tests.mjs --test tests/smoke-dashboard.mjs",
45
+ "test": "node run-dist.mjs run-built-tests.mjs"
44
46
  },
45
47
  "files": [
46
48
  "README.md",
@@ -49,6 +51,8 @@
49
51
  "CONTRIBUTING.md",
50
52
  "CHANGELOG.md",
51
53
  "SKILL.md",
54
+ "postinstall.mjs",
55
+ "run-dist.mjs",
52
56
  "tsconfig.json",
53
57
  "tsconfig.dist.json",
54
58
  "tsconfig.runtime.json",
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { spawnSync } from "node:child_process";
5
+ import { fileURLToPath, pathToFileURL } from "node:url";
6
+
7
+ const root = path.dirname(fileURLToPath(import.meta.url));
8
+ const buildScript = path.join(root, "scripts/build-dist.mts");
9
+ const distPostinstall = path.join(root, "dist/postinstall.mjs");
10
+ const buildOnly = process.argv.includes("--build-only");
11
+ const skipPostinstall = process.env.CODING_AGENT_HARNESS_SKIP_POSTINSTALL === "1";
12
+
13
+ function runBuild() {
14
+ if (!fs.existsSync(buildScript)) return false;
15
+ const result = spawnSync(process.execPath, [buildScript, "--quiet"], {
16
+ cwd: root,
17
+ stdio: "inherit",
18
+ });
19
+ if (result.status !== 0) process.exit(result.status ?? 1);
20
+ return true;
21
+ }
22
+
23
+ if (!fs.existsSync(distPostinstall)) {
24
+ runBuild();
25
+ }
26
+
27
+ if (buildOnly || skipPostinstall) {
28
+ process.exit(0);
29
+ }
30
+
31
+ if (!fs.existsSync(distPostinstall)) {
32
+ console.error("coding-agent-harness postinstall failed: missing dist/postinstall.mjs");
33
+ console.error("Run npm run build:runtime from a source checkout, or reinstall a complete package.");
34
+ process.exit(1);
35
+ }
36
+
37
+ await import(pathToFileURL(distPostinstall).href);