coding-agent-harness 1.0.4 → 1.0.6

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 (279) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/CONTRIBUTING.md +2 -2
  3. package/LICENSE +661 -21
  4. package/LICENSE-EXCEPTION.md +37 -0
  5. package/README.md +96 -4
  6. package/README.zh-CN.md +75 -4
  7. package/SKILL.md +52 -51
  8. package/dist/build-dist.mjs +189 -0
  9. package/dist/check-dist-observation.mjs +428 -0
  10. package/dist/check-harness.mjs +489 -0
  11. package/dist/check-import-graph.mjs +511 -0
  12. package/dist/check-runtime-emit.mjs +304 -0
  13. package/dist/check-type-boundaries.mjs +139 -0
  14. package/dist/commands/dashboard-command.mjs +80 -0
  15. package/dist/commands/migration-command.mjs +152 -0
  16. package/dist/commands/preset-command.mjs +91 -0
  17. package/dist/commands/task-command.mjs +324 -0
  18. package/dist/harness.mjs +304 -0
  19. package/dist/lib/capability-registry.mjs +643 -0
  20. package/dist/lib/check-module-parallel.mjs +227 -0
  21. package/dist/lib/check-profiles.mjs +414 -0
  22. package/dist/lib/check-task-contracts.mjs +54 -0
  23. package/dist/lib/core-shared.mjs +254 -0
  24. package/dist/lib/dashboard-data.mjs +608 -0
  25. package/dist/lib/dashboard-workbench.mjs +334 -0
  26. package/dist/lib/dashboard-writer.mjs +200 -0
  27. package/dist/lib/git-status-summary.mjs +45 -0
  28. package/dist/lib/governance-index-generator.mjs +236 -0
  29. package/dist/lib/governance-sync.mjs +617 -0
  30. package/dist/lib/governance-table-boundary.mjs +161 -0
  31. package/{scripts → dist}/lib/harness-core.mjs +3 -0
  32. package/dist/lib/harness-paths.mjs +338 -0
  33. package/dist/lib/lesson-maintenance.mjs +139 -0
  34. package/dist/lib/markdown-utils.mjs +193 -0
  35. package/dist/lib/migration-planner.mjs +439 -0
  36. package/dist/lib/migration-support.mjs +317 -0
  37. package/dist/lib/phase-kind.mjs +46 -0
  38. package/dist/lib/preset-audit-contracts.mjs +40 -0
  39. package/dist/lib/preset-engine.mjs +516 -0
  40. package/dist/lib/preset-registry.mjs +831 -0
  41. package/dist/lib/preset-resource-contracts.mjs +83 -0
  42. package/dist/lib/review-confirm-git-gate.mjs +244 -0
  43. package/dist/lib/status-builder.mjs +87 -0
  44. package/{scripts → dist}/lib/status-dashboard-renderer.mjs +48 -47
  45. package/dist/lib/structure-migration.mjs +404 -0
  46. package/dist/lib/subagent-authorization-audit.mjs +198 -0
  47. package/dist/lib/task-audit-metadata.mjs +376 -0
  48. package/dist/lib/task-audit-migration.mjs +355 -0
  49. package/dist/lib/task-completion-consistency.mjs +29 -0
  50. package/dist/lib/task-index.mjs +133 -0
  51. package/dist/lib/task-lesson-candidates.mjs +239 -0
  52. package/dist/lib/task-lesson-sedimentation.mjs +300 -0
  53. package/dist/lib/task-lifecycle/create-task-helpers.mjs +84 -0
  54. package/dist/lib/task-lifecycle/phase-sync.mjs +82 -0
  55. package/dist/lib/task-lifecycle/review-confirm.mjs +93 -0
  56. package/dist/lib/task-lifecycle/review-gates.mjs +62 -0
  57. package/dist/lib/task-lifecycle/review-submission.mjs +52 -0
  58. package/dist/lib/task-lifecycle/scaffold-provenance.mjs +54 -0
  59. package/dist/lib/task-lifecycle/template-files.mjs +52 -0
  60. package/dist/lib/task-lifecycle/text-utils.mjs +26 -0
  61. package/dist/lib/task-lifecycle.mjs +611 -0
  62. package/dist/lib/task-metadata.mjs +116 -0
  63. package/dist/lib/task-review-model.mjs +474 -0
  64. package/dist/lib/task-scanner.mjs +439 -0
  65. package/dist/lib/task-tombstone-commands.mjs +125 -0
  66. package/dist/postinstall.mjs +14 -0
  67. package/dist/run-built-tests.mjs +84 -0
  68. package/docs-release/README.md +1 -0
  69. package/docs-release/architecture/overview.md +13 -13
  70. package/docs-release/architecture/overview.zh-CN.md +13 -13
  71. package/docs-release/architecture/system-explainer/01-system-overview.md +218 -0
  72. package/docs-release/architecture/system-explainer/02-module-dependency.md +257 -0
  73. package/docs-release/architecture/system-explainer/03-task-lifecycle.md +304 -0
  74. package/docs-release/architecture/system-explainer/04-check-and-governance.md +241 -0
  75. package/docs-release/architecture/system-explainer/05-data-flow.md +276 -0
  76. package/docs-release/architecture/system-explainer/06-preset-and-migration.md +300 -0
  77. package/docs-release/architecture/system-explainer/README.md +67 -0
  78. package/docs-release/architecture/system-explainer/en-US/01-system-overview.md +227 -0
  79. package/docs-release/architecture/system-explainer/en-US/02-module-dependency.md +263 -0
  80. package/docs-release/architecture/system-explainer/en-US/03-task-lifecycle.md +319 -0
  81. package/docs-release/architecture/system-explainer/en-US/04-check-and-governance.md +252 -0
  82. package/docs-release/architecture/system-explainer/en-US/05-data-flow.md +290 -0
  83. package/docs-release/architecture/system-explainer/en-US/06-preset-and-migration.md +320 -0
  84. package/docs-release/architecture/system-explainer/en-US/README.md +70 -0
  85. package/docs-release/guides/agent-installation.en-US.md +22 -15
  86. package/docs-release/guides/agent-installation.md +23 -15
  87. package/docs-release/guides/contributing.md +3 -3
  88. package/docs-release/guides/contributing.zh-CN.md +3 -3
  89. package/docs-release/guides/document-audience-and-surfaces.en-US.md +10 -10
  90. package/docs-release/guides/document-audience-and-surfaces.md +10 -10
  91. package/docs-release/guides/legacy-migration-agent-prompt.md +25 -2
  92. package/docs-release/guides/legacy-migration-agent-prompt.zh-CN.md +25 -2
  93. package/docs-release/guides/migration-playbook.en-US.md +63 -1
  94. package/docs-release/guides/migration-playbook.md +59 -1
  95. package/docs-release/guides/parent-control-repository-pattern.en-US.md +25 -25
  96. package/docs-release/guides/parent-control-repository-pattern.md +25 -25
  97. package/docs-release/guides/preset-development.md +28 -4
  98. package/docs-release/guides/repository-operating-models.en-US.md +21 -21
  99. package/docs-release/guides/repository-operating-models.md +21 -21
  100. package/docs-release/guides/task-state-machine.en-US.md +35 -18
  101. package/docs-release/guides/task-state-machine.md +35 -18
  102. package/docs-release/guides/typescript-runtime-migration-closeout.md +96 -0
  103. package/examples/minimal-project/AGENTS.md +2 -2
  104. package/examples/minimal-project/coding-agent-harness/harness.yaml +14 -0
  105. package/examples/minimal-project/coding-agent-harness/planning/tasks/demo-task/INDEX.md +60 -0
  106. package/examples/minimal-project/coding-agent-harness/planning/tasks/demo-task/progress.md +11 -0
  107. package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/review.md +1 -1
  108. package/package.json +22 -13
  109. package/presets/legacy-migration/preset.yaml +5 -5
  110. package/presets/legacy-migration/templates/execution_strategy.append.md +1 -1
  111. package/presets/lesson-sedimentation/preset.yaml +3 -3
  112. package/presets/module/preset.yaml +2 -2
  113. package/presets/module/templates/execution_strategy.append.md +1 -1
  114. package/presets/module/templates/task_plan.append.md +3 -3
  115. package/presets/standard-task/preset.yaml +2 -2
  116. package/references/adversarial-review-standard.md +2 -2
  117. package/references/agents-md-pattern.md +14 -14
  118. package/references/cadence-ledger.md +1 -1
  119. package/references/ci-cd-standard.md +1 -1
  120. package/references/delivery-operating-model-standard.md +4 -4
  121. package/references/docs-directory-standard.md +65 -159
  122. package/references/external-source-intake-standard.md +10 -10
  123. package/references/harness-ledger.md +6 -6
  124. package/references/legacy-12-phase-bootstrap.md +2 -2
  125. package/references/lessons-governance.md +15 -15
  126. package/references/long-running-task-standard.md +6 -6
  127. package/references/module-parallel-standard.md +34 -34
  128. package/references/planning-loop.md +6 -6
  129. package/references/project-onboarding-audit.md +4 -4
  130. package/references/regression-system.md +2 -2
  131. package/references/repo-governance-standard.md +4 -4
  132. package/references/review-routing-standard.md +1 -1
  133. package/references/ssot-governance.md +19 -19
  134. package/references/taskr-gap-analysis.md +5 -5
  135. package/references/walkthrough-closeout.md +14 -14
  136. package/references/worktree-parallel.md +3 -3
  137. package/skills/preset-creator/references/complex-task-skeleton/brief.md +11 -0
  138. package/skills/preset-creator/references/complex-task-skeleton/task_plan.md +1 -1
  139. package/skills/preset-creator/references/preset-package-skeleton.md +5 -5
  140. package/templates/AGENTS.md.template +31 -29
  141. package/templates/architecture/README.md +4 -4
  142. package/templates/architecture/service-catalog.md +2 -2
  143. package/templates/architecture/services/service-template.md +1 -1
  144. package/templates/dashboard/assets/app-src/00-state.js +12 -0
  145. package/templates/dashboard/assets/app-src/10-router.js +3 -0
  146. package/templates/dashboard/assets/app-src/20-overview.js +13 -3
  147. package/templates/dashboard/assets/app-src/35-task-detail.js +46 -6
  148. package/templates/dashboard/assets/app-src/40-modules.js +1 -1
  149. package/templates/dashboard/assets/app-src/55-presets.js +375 -0
  150. package/templates/dashboard/assets/app-src/60-shared.js +3 -1
  151. package/templates/dashboard/assets/app-src/90-bindings.js +131 -0
  152. package/templates/dashboard/assets/app.css +583 -0
  153. package/templates/dashboard/assets/app.css.manifest.json +1 -0
  154. package/templates/dashboard/assets/app.js +585 -11
  155. package/templates/dashboard/assets/app.manifest.json +1 -0
  156. package/templates/dashboard/assets/css-src/00-foundation.css +4 -0
  157. package/templates/dashboard/assets/css-src/40-detail-modules-migration.css +62 -0
  158. package/templates/dashboard/assets/css-src/45-presets.css +516 -0
  159. package/templates/dashboard/assets/i18n.js +144 -4
  160. package/templates/development/README.md +10 -10
  161. package/templates/development/cross-repo-debugging.md +3 -3
  162. package/templates/development/external-context/service-template.md +2 -2
  163. package/templates/development/external-source-packs/README.md +4 -4
  164. package/templates/integrations/README.md +4 -4
  165. package/templates/integrations/api-contract.md +2 -2
  166. package/templates/integrations/event-contract.md +2 -2
  167. package/templates/integrations/third-party/vendor-template.md +2 -2
  168. package/templates/integrations/webhook-contract.md +2 -2
  169. package/templates/ledger/Harness-Ledger.md +1 -1
  170. package/templates/planning/INDEX.md +88 -0
  171. package/templates/planning/brief.md +1 -1
  172. package/templates/planning/module_session_prompt.md +2 -1
  173. package/templates/planning/review.md +0 -18
  174. package/templates/planning/task_plan.md +5 -44
  175. package/templates/planning/visual_map.md +13 -9
  176. package/templates/planning/visual_map.simple.md +52 -0
  177. package/templates/planning/walkthrough.md +47 -0
  178. package/templates/reference/docs-library-standard.md +8 -8
  179. package/templates/reference/execution-workflow-standard.md +29 -2
  180. package/templates/reference/external-source-intake-standard.md +15 -15
  181. package/templates/reference/repo-governance-standard.md +1 -1
  182. package/templates/ssot/Module-Registry.md +1 -1
  183. package/templates/walkthrough/walkthrough-template.md +2 -2
  184. package/templates-zh-CN/AGENTS.md.template +31 -29
  185. package/templates-zh-CN/CLAUDE.md.template +1 -1
  186. package/templates-zh-CN/architecture/README.md +4 -4
  187. package/templates-zh-CN/architecture/service-catalog.md +2 -2
  188. package/templates-zh-CN/architecture/services/service-template.md +1 -1
  189. package/templates-zh-CN/development/README.md +10 -10
  190. package/templates-zh-CN/development/cross-repo-debugging.md +3 -3
  191. package/templates-zh-CN/development/external-context/service-template.md +2 -2
  192. package/templates-zh-CN/development/external-source-packs/README.md +4 -4
  193. package/templates-zh-CN/integrations/README.md +4 -4
  194. package/templates-zh-CN/integrations/api-contract.md +2 -2
  195. package/templates-zh-CN/integrations/event-contract.md +2 -2
  196. package/templates-zh-CN/integrations/third-party/vendor-template.md +2 -2
  197. package/templates-zh-CN/integrations/webhook-contract.md +2 -2
  198. package/templates-zh-CN/ledger/Harness-Ledger.md +1 -1
  199. package/templates-zh-CN/lessons/lesson-arch-process-change.md +1 -1
  200. package/templates-zh-CN/lessons/lesson-new-doc.md +3 -3
  201. package/templates-zh-CN/lessons/lesson-ref-change.md +4 -4
  202. package/templates-zh-CN/planning/INDEX.md +87 -0
  203. package/templates-zh-CN/planning/brief.md +1 -1
  204. package/templates-zh-CN/planning/module_session_prompt.md +12 -11
  205. package/templates-zh-CN/planning/review.md +0 -18
  206. package/templates-zh-CN/planning/task_plan.md +3 -63
  207. package/templates-zh-CN/planning/visual_map.md +14 -7
  208. package/templates-zh-CN/planning/visual_map.simple.md +48 -0
  209. package/templates-zh-CN/planning/walkthrough.md +47 -0
  210. package/templates-zh-CN/reference/adversarial-review-standard.md +2 -2
  211. package/templates-zh-CN/reference/delivery-operating-model-standard.md +3 -3
  212. package/templates-zh-CN/reference/docs-library-standard.md +28 -28
  213. package/templates-zh-CN/reference/execution-workflow-standard.md +32 -7
  214. package/templates-zh-CN/reference/external-source-intake-standard.md +16 -16
  215. package/templates-zh-CN/reference/harness-ledger-standard.md +6 -6
  216. package/templates-zh-CN/reference/regression-ssot-governance.md +2 -2
  217. package/templates-zh-CN/reference/repo-governance-standard.md +1 -1
  218. package/templates-zh-CN/reference/review-routing-standard.md +1 -1
  219. package/templates-zh-CN/reference/walkthrough-standard.md +7 -7
  220. package/templates-zh-CN/reference/worktree-standard.md +1 -1
  221. package/templates-zh-CN/regression/Cadence-Ledger.md +2 -2
  222. package/templates-zh-CN/ssot/Delivery-SSoT.md +3 -3
  223. package/templates-zh-CN/ssot/Module-Registry.md +3 -3
  224. package/templates-zh-CN/ssot/Regression-SSoT.md +2 -2
  225. package/templates-zh-CN/walkthrough/walkthrough-template.md +5 -5
  226. package/tsconfig.dist.json +16 -0
  227. package/tsconfig.json +25 -0
  228. package/tsconfig.runtime.json +24 -0
  229. package/examples/minimal-project/.harness-capabilities.json +0 -8
  230. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/progress.md +0 -11
  231. package/scripts/check-harness.mjs +0 -508
  232. package/scripts/commands/dashboard-command.mjs +0 -67
  233. package/scripts/commands/migration-command.mjs +0 -96
  234. package/scripts/commands/preset-command.mjs +0 -73
  235. package/scripts/commands/task-command.mjs +0 -327
  236. package/scripts/harness.mjs +0 -287
  237. package/scripts/lib/capability-registry.mjs +0 -591
  238. package/scripts/lib/check-module-parallel.mjs +0 -237
  239. package/scripts/lib/check-profiles.mjs +0 -418
  240. package/scripts/lib/check-task-contracts.mjs +0 -47
  241. package/scripts/lib/core-shared.mjs +0 -196
  242. package/scripts/lib/dashboard-data.mjs +0 -412
  243. package/scripts/lib/dashboard-workbench.mjs +0 -257
  244. package/scripts/lib/dashboard-writer.mjs +0 -198
  245. package/scripts/lib/git-status-summary.mjs +0 -46
  246. package/scripts/lib/governance-index-generator.mjs +0 -174
  247. package/scripts/lib/governance-sync.mjs +0 -514
  248. package/scripts/lib/governance-table-boundary.mjs +0 -175
  249. package/scripts/lib/lesson-maintenance.mjs +0 -152
  250. package/scripts/lib/markdown-utils.mjs +0 -158
  251. package/scripts/lib/migration-planner.mjs +0 -478
  252. package/scripts/lib/migration-support.mjs +0 -312
  253. package/scripts/lib/preset-audit-contracts.mjs +0 -37
  254. package/scripts/lib/preset-engine.mjs +0 -497
  255. package/scripts/lib/preset-registry.mjs +0 -627
  256. package/scripts/lib/preset-resource-contracts.mjs +0 -83
  257. package/scripts/lib/review-confirm-git-gate.mjs +0 -248
  258. package/scripts/lib/subagent-authorization-audit.mjs +0 -196
  259. package/scripts/lib/task-completion-consistency.mjs +0 -16
  260. package/scripts/lib/task-index.mjs +0 -93
  261. package/scripts/lib/task-lesson-candidates.mjs +0 -242
  262. package/scripts/lib/task-lesson-sedimentation.mjs +0 -326
  263. package/scripts/lib/task-lifecycle/review-confirm.mjs +0 -101
  264. package/scripts/lib/task-lifecycle/review-gates.mjs +0 -70
  265. package/scripts/lib/task-lifecycle/text-utils.mjs +0 -24
  266. package/scripts/lib/task-lifecycle.mjs +0 -649
  267. package/scripts/lib/task-review-model.mjs +0 -469
  268. package/scripts/lib/task-scanner.mjs +0 -576
  269. package/scripts/lib/task-tombstone-commands.mjs +0 -140
  270. package/scripts/postinstall.mjs +0 -14
  271. package/templates/walkthrough/Closeout-SSoT.md +0 -43
  272. package/templates-zh-CN/walkthrough/Closeout-SSoT.md +0 -42
  273. /package/examples/minimal-project/{docs → coding-agent-harness/governance/generated}/Harness-Ledger.md +0 -0
  274. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/brief.md +0 -0
  275. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/execution_strategy.md +0 -0
  276. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/findings.md +0 -0
  277. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/lesson_candidates.md +0 -0
  278. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/task_plan.md +0 -0
  279. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/visual_map.md +0 -0
@@ -1,47 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import {
4
- lessonCandidatesFile,
5
- readFileSafe,
6
- toPosix,
7
- visualMapFile,
8
- } from "./core-shared.mjs";
9
- import {
10
- listTaskPlanPaths,
11
- parseTaskBudget,
12
- parseTaskContractInfo,
13
- } from "./task-scanner.mjs";
14
-
15
- export function validatePlanContracts(target, { strict = true } = {}) {
16
- const failures = [];
17
- const warnings = [];
18
- const report = (message) => {
19
- if (strict) failures.push(message);
20
- else warnings.push(`adoption-needed: ${message}`);
21
- };
22
- for (const taskPlanPath of listTaskPlanPaths(target)) {
23
- const taskDir = path.dirname(taskPlanPath);
24
- const relativeDir = toPosix(path.relative(target.projectRoot, taskDir));
25
- const taskPlanContent = readFileSafe(taskPlanPath);
26
- const budget = parseTaskBudget(taskPlanContent);
27
- const taskContract = parseTaskContractInfo(taskPlanContent);
28
- if (!taskContract.generated) {
29
- warnings.push(`adoption-needed: ${relativeDir} missing Task Contract: harness-task/v1 marker`);
30
- }
31
- for (const fileName of requiredTaskFilesForBudget(budget)) {
32
- if (!fs.existsSync(path.join(taskDir, fileName))) {
33
- if (taskContract.generated) failures.push(`${relativeDir} missing ${fileName}`);
34
- else report(`${relativeDir} missing ${fileName}`);
35
- }
36
- }
37
- }
38
- return { failures, warnings };
39
- }
40
-
41
- function requiredTaskFilesForBudget(budget) {
42
- const simpleFiles = ["brief.md", "task_plan.md", visualMapFile, "progress.md"];
43
- if (budget === "simple") return simpleFiles;
44
- const standardFiles = [...simpleFiles, "execution_strategy.md", "findings.md", lessonCandidatesFile, "review.md"];
45
- if (budget === "complex") return [...standardFiles, "references/INDEX.md", "artifacts/INDEX.md"];
46
- return standardFiles;
47
- }
@@ -1,196 +0,0 @@
1
- import fs from "node:fs";
2
- import os from "node:os";
3
- import path from "node:path";
4
- import { fileURLToPath } from "node:url";
5
-
6
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
- export const repoRoot = path.resolve(__dirname, "../..");
8
- export const legacyChecker = path.join(repoRoot, "scripts/check-harness.mjs");
9
- export const visualMapFile = "visual_map.md";
10
- export const legacyVisualRoadmapFile = "visual_roadmap.md";
11
- export const lessonCandidatesFile = "lesson_candidates.md";
12
- export const longRunningTaskContractFile = "long-running-task-contract.md";
13
- export const taskContractMarker = "Task Contract: harness-task/v1";
14
- export const builtinPresetRoot = path.join(repoRoot, "presets");
15
- export function userPresetRootForHome(home = "") {
16
- return path.join(path.resolve(home || os.homedir()), ".coding-agent-harness/presets");
17
- }
18
- export const userPresetRoot = userPresetRootForHome();
19
-
20
-
21
- export const supportedLocales = new Set(["zh-CN", "en-US"]);
22
- export const allowedReviewDispositions = new Set([
23
- "open",
24
- "mitigated",
25
- "closed",
26
- "deferred",
27
- "accepted-risk",
28
- "not-reproducible",
29
- "out-of-scope",
30
- ]);
31
- export const allowedTaskStates = new Set(["not_started", "planned", "in_progress", "review", "blocked", "done"]);
32
- export const allowedTaskBudgets = new Set(["simple", "standard", "complex"]);
33
- export const allowedPhaseStates = new Set(["planned", "in_progress", "review", "blocked", "done", "skipped"]);
34
- export const allowedEvidenceStatus = new Set(["missing", "partial", "present", "waived"]);
35
-
36
- export function normalizeTarget(input = ".") {
37
- const target = path.resolve(input);
38
- const isDocsRoot =
39
- path.basename(target) === "docs" &&
40
- (fs.existsSync(path.join(target, "09-PLANNING")) || fs.existsSync(path.join(target, "11-REFERENCE")));
41
- return {
42
- input: target,
43
- projectRoot: isDocsRoot ? path.dirname(target) : target,
44
- docsRoot: isDocsRoot ? target : path.join(target, "docs"),
45
- docsOnly: isDocsRoot,
46
- };
47
- }
48
-
49
- export function projectPresetRoot(targetInput = ".") {
50
- return path.join(normalizeTarget(targetInput).projectRoot, ".coding-agent-harness/presets");
51
- }
52
-
53
- export function toPosix(value) {
54
- return value.split(path.sep).join("/");
55
- }
56
-
57
- export function exists(target, relativePath) {
58
- return fs.existsSync(path.join(target.projectRoot, relativePath));
59
- }
60
-
61
- export function existsInDocs(target, relativePath) {
62
- return fs.existsSync(path.join(target.docsRoot, relativePath));
63
- }
64
-
65
- export function readFileSafe(filePath) {
66
- try {
67
- return fs.readFileSync(filePath, "utf8");
68
- } catch {
69
- return "";
70
- }
71
- }
72
-
73
- export function readBundledTemplate(source) {
74
- const sourcePath = path.join(repoRoot, source);
75
- if (!fs.existsSync(sourcePath)) throw new Error(`Bundled template missing: ${source}`);
76
- const content = fs.readFileSync(sourcePath, "utf8");
77
- if (!content.trim()) throw new Error(`Bundled template is empty: ${source}`);
78
- return content;
79
- }
80
-
81
- export function walkFiles(root) {
82
- const results = [];
83
- if (!fs.existsSync(root)) return results;
84
- function walk(dir) {
85
- for (const entry of fs.readdirSync(dir)) {
86
- const full = path.join(dir, entry);
87
- const stat = fs.statSync(full);
88
- if (stat.isDirectory()) {
89
- if ([".git", "node_modules", "tmp"].includes(entry)) continue;
90
- walk(full);
91
- } else {
92
- results.push(full);
93
- }
94
- }
95
- }
96
- walk(root);
97
- return results;
98
- }
99
-
100
- export function normalizeLocale(locale = "en-US") {
101
- return supportedLocales.has(locale) ? locale : "en-US";
102
- }
103
-
104
- export function inferProjectLocale(target, fallback = "en-US") {
105
- const candidates = [
106
- path.join(target.projectRoot, "AGENTS.md"),
107
- path.join(target.projectRoot, "CLAUDE.md"),
108
- path.join(target.docsRoot, "AGENTS.md"),
109
- path.join(target.docsRoot, "Harness-Ledger.md"),
110
- ];
111
- for (const file of candidates) {
112
- const content = readFileSafe(file);
113
- if (/\p{Script=Han}/u.test(content)) return "zh-CN";
114
- }
115
- return normalizeLocale(fallback);
116
- }
117
-
118
- export function slug(value) {
119
- return String(value || "item")
120
- .toLowerCase()
121
- .replace(/[^a-z0-9]+/g, "-")
122
- .replace(/^-+|-+$/g, "")
123
- .slice(0, 80) || "item";
124
- }
125
-
126
- export function prefixedPath(target, filePath) {
127
- return `TARGET:${toPosix(path.relative(target.projectRoot, filePath))}`;
128
- }
129
-
130
- export function sanitizeText(value) {
131
- return String(value ?? "")
132
- .replace(/file:\/\/\/[^\s)"'`<>\]]+/g, "LOCAL_FILE_URL_REDACTED")
133
- .replaceAll("file://", "LOCAL_FILE_URL_REDACTED")
134
- .replace(/\/Users\/[^/\s)"'`<>\]]+(?:\/[^\s)"'`<>\]]*)*/g, "LOCAL_PATH_REDACTED")
135
- .replace(/\/Volumes\/[^\s)"'`<>\]]+(?:\/[^\s)"'`<>\]]*)*/g, "LOCAL_PATH_REDACTED")
136
- .replace(/\/(?:private\/)?tmp\/[^\s)"'`<>\]]+(?:\/[^\s)"'`<>\]]*)*/g, "LOCAL_PATH_REDACTED")
137
- .replace(/\/var\/folders\/[^\s)"'`<>\]]+(?:\/[^\s)"'`<>\]]*)*/g, "LOCAL_PATH_REDACTED")
138
- .replace(/\/home\/[^/\s)"'`<>\]]+(?:\/[^\s)"'`<>\]]*)*/g, "LOCAL_PATH_REDACTED")
139
- .replace(/[A-Za-z]:\\[^\s)"'`<>\]]+(?:\\[^\s)"'`<>\]]*)*/g, "LOCAL_PATH_REDACTED");
140
- }
141
-
142
- export function sanitizeDeep(value) {
143
- if (typeof value === "string") return sanitizeText(value);
144
- if (Array.isArray(value)) return value.map(sanitizeDeep);
145
- if (value && typeof value === "object") {
146
- return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, sanitizeDeep(entry)]));
147
- }
148
- return value;
149
- }
150
-
151
- export function titleFromMarkdown(content, fallback) {
152
- const match = content.match(/^#\s+(.+)$/m);
153
- return match ? match[1].trim() : fallback;
154
- }
155
-
156
- export function localizedTemplateSource(source, locale) {
157
- const localeSource = normalizeLocale(locale) === "zh-CN" ? source.replace(/^templates\//, "templates-zh-CN/") : source;
158
- return fs.existsSync(path.join(repoRoot, localeSource)) ? localeSource : source;
159
- }
160
-
161
- export function todayDate() {
162
- return localDate();
163
- }
164
-
165
- export function localDate() {
166
- const now = new Date();
167
- const year = now.getFullYear();
168
- const month = String(now.getMonth() + 1).padStart(2, "0");
169
- const day = String(now.getDate()).padStart(2, "0");
170
- return `${year}-${month}-${day}`;
171
- }
172
-
173
- export const datePrefix = /^\d{4}-\d{2}-\d{2}-/;
174
-
175
- export function nowTimestamp() {
176
- return new Date().toISOString().replace("T", " ").slice(0, 16);
177
- }
178
-
179
- export function normalizeTaskId(value) {
180
- return slug(value || "task");
181
- }
182
-
183
- export function renderTaskTemplate(content, { taskId, title, locale, budget = "standard" }) {
184
- const date = todayDate();
185
- return String(content)
186
- .replaceAll("{{TASK_ID}}", taskId)
187
- .replaceAll("{{TASK_TITLE}}", title)
188
- .replaceAll("{{DATE}}", date)
189
- .replaceAll("{{LOCALE}}", normalizeLocale(locale))
190
- .replaceAll("{{TASK_BUDGET}}", budget)
191
- .replaceAll("[simple / standard / complex]", budget)
192
- .replaceAll("[simple / standard / long-running / module-parallel]", budget)
193
- .replaceAll("[simple / complex]", budget)
194
- .replaceAll("[Task Name]", title)
195
- .replaceAll("[任务名称]", title);
196
- }
@@ -1,412 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import {
4
- repoRoot,
5
- normalizeTarget,
6
- readFileSafe,
7
- sanitizeText,
8
- sanitizeDeep,
9
- slug,
10
- titleFromMarkdown,
11
- prefixedPath,
12
- toPosix,
13
- walkFiles,
14
- visualMapFile,
15
- legacyVisualRoadmapFile,
16
- lessonCandidatesFile,
17
- longRunningTaskContractFile,
18
- } from "./core-shared.mjs";
19
- import {
20
- parseAllMarkdownTables,
21
- getCell,
22
- splitDependencies,
23
- } from "./markdown-utils.mjs";
24
- import { readCapabilityRegistry } from "./capability-registry.mjs";
25
- import { buildStatus } from "./check-profiles.mjs";
26
- import {
27
- listTaskPlanPaths,
28
- parseTaskState,
29
- isActiveTaskState,
30
- } from "./task-scanner.mjs";
31
- import { writeDashboardDirectory, writeDashboardFile } from "./dashboard-writer.mjs";
32
-
33
- export function collectMarkdownDocuments(target) {
34
- const docs = collectDashboardDocumentPaths(target);
35
- return docs.map((file, index) => {
36
- const content = sanitizeText(readFileSafe(file));
37
- const source = prefixedPath(target, file);
38
- return {
39
- id: `doc-${String(index + 1).padStart(4, "0")}-${slug(path.basename(file, ".md"))}`,
40
- path: source,
41
- title: titleFromMarkdown(content, path.basename(file)),
42
- type: documentKind(source),
43
- content,
44
- };
45
- });
46
- }
47
-
48
- function collectDashboardDocumentPaths(target) {
49
- const selected = new Set();
50
- const addDocsPath = (relativePath) => {
51
- const file = path.join(target.docsRoot, relativePath);
52
- if (fs.existsSync(file)) selected.add(file);
53
- };
54
- for (const relativePath of [
55
- "Harness-Ledger.md",
56
- "09-PLANNING/Module-Registry.md",
57
- "05-TEST-QA/Regression-SSoT.md",
58
- "05-TEST-QA/Cadence-Ledger.md",
59
- "10-WALKTHROUGH/Closeout-SSoT.md",
60
- ]) {
61
- addDocsPath(relativePath);
62
- }
63
- for (const file of walkFiles(path.join(target.docsRoot, "10-WALKTHROUGH"))) {
64
- if (!file.endsWith(".md")) continue;
65
- if (file.includes(`${path.sep}_archive${path.sep}`)) continue;
66
- if (path.basename(file).startsWith("_")) continue;
67
- selected.add(file);
68
- }
69
- for (const taskPlanPath of listTaskPlanPaths(target)) {
70
- const taskDir = path.dirname(taskPlanPath);
71
- const progress = readFileSafe(path.join(taskDir, "progress.md"));
72
- const state = parseTaskState(progress);
73
- const active = isActiveTaskState(state);
74
- const documentNames = active
75
- ? ["brief.md", "task_plan.md", "execution_strategy.md", visualMapFile, legacyVisualRoadmapFile, lessonCandidatesFile, longRunningTaskContractFile, "progress.md", "review.md", "findings.md"]
76
- : ["brief.md", "task_plan.md", "execution_strategy.md", visualMapFile, legacyVisualRoadmapFile, lessonCandidatesFile, longRunningTaskContractFile, "progress.md", "review.md", "findings.md"];
77
- for (const fileName of documentNames) {
78
- const file = path.join(taskDir, fileName);
79
- if (fs.existsSync(file)) selected.add(file);
80
- }
81
- for (const indexFile of ["references/INDEX.md", "artifacts/INDEX.md"]) {
82
- const file = path.join(taskDir, indexFile);
83
- if (fs.existsSync(file)) selected.add(file);
84
- }
85
- }
86
- for (const file of walkFiles(path.join(target.docsRoot, "09-PLANNING/MODULES"))) {
87
- if (file.endsWith("module_plan.md")) selected.add(file);
88
- if (/09-PLANNING[\\/]+MODULES[\\/]+[^\\/]+[\\/]brief\.md$/.test(file)) selected.add(file);
89
- }
90
- for (const file of walkFiles(path.join(target.docsRoot, "01-GOVERNANCE/lessons"))) {
91
- if (file.endsWith(".md")) selected.add(file);
92
- }
93
- return [...selected]
94
- .filter((file) => !file.includes(`${path.sep}_archive${path.sep}`))
95
- .filter((file) => !file.includes(`${path.sep}_task-template${path.sep}`))
96
- .filter((file) => !file.includes(`${path.sep}_optional-structures${path.sep}`))
97
- .sort();
98
- }
99
-
100
- function documentKind(source) {
101
- const lower = source.toLowerCase();
102
- if (lower.includes("harness-ledger.md")) return "harness-ledger";
103
- if (lower.includes("module-registry.md")) return "module-registry";
104
- if (lower.includes("regression-ssot.md")) return "regression-ssot";
105
- if (lower.includes("cadence-ledger.md")) return "cadence-ledger";
106
- if (/\/01-governance\/lessons\/[^/]+\.md$/i.test(lower)) return "lesson-detail";
107
- if (lower.endsWith("/progress.md")) return "task-progress";
108
- if (lower.endsWith("/brief.md")) return "task-brief";
109
- if (lower.endsWith("/review.md")) return "task-review";
110
- if (lower.endsWith("/lesson_candidates.md")) return "lesson-candidates";
111
- if (lower.endsWith("/long-running-task-contract.md")) return "long-running-contract";
112
- if (lower.endsWith("/references/index.md")) return "task-references";
113
- if (lower.endsWith("/artifacts/index.md")) return "task-artifacts";
114
- if (lower.endsWith("/execution_strategy.md")) return "execution-strategy";
115
- if (lower.endsWith("/visual_map.md")) return "visual-map";
116
- if (lower.endsWith("/visual_roadmap.md")) return "legacy-visual-roadmap";
117
- if (lower.endsWith("/module_plan.md")) return "module-plan";
118
- return "markdown-table";
119
- }
120
-
121
- export function collectTables(documents) {
122
- return {
123
- tables: documents.flatMap((document) => parseAllMarkdownTables(document.content, document.path, documentKind(document.path))),
124
- };
125
- }
126
-
127
- export function collectGraph(status, tables = { tables: [] }) {
128
- const nodes = [];
129
- const edges = [];
130
- const seenNodes = new Map();
131
- const addNode = (node) => {
132
- const existing = seenNodes.get(node.id);
133
- if (existing) {
134
- Object.assign(existing, node);
135
- return;
136
- }
137
- seenNodes.set(node.id, node);
138
- nodes.push(node);
139
- };
140
- const addEdge = (edge) => {
141
- if (!edge.from || !edge.to || edge.from === edge.to) return;
142
- edges.push(edge);
143
- };
144
- for (const task of status.tasks) {
145
- addNode({ id: `task:${task.id}`, type: "task", label: task.title, state: task.state, completion: task.completion });
146
- for (const phase of task.phases || []) {
147
- const phaseId = `phase:${task.id}:${phase.id}`;
148
- addNode({ id: phaseId, type: "phase", label: phase.id, state: phase.state, completion: phase.completion, taskId: task.id });
149
- addEdge({ from: `task:${task.id}`, to: phaseId, type: "contains" });
150
- for (const dependency of phase.dependsOn || []) {
151
- addEdge({ from: `phase:${task.id}:${dependency}`, to: phaseId, type: "depends_on" });
152
- }
153
- }
154
- for (const handoff of task.handoffs || []) {
155
- const handoffId = `handoff:${handoff.id}`;
156
- addNode({ id: handoffId, type: "handoff", label: handoff.summary, state: handoff.state });
157
- addEdge({ from: `task:${task.id}`, to: handoffId, type: "handoff" });
158
- }
159
- }
160
- for (const table of tables.tables || []) {
161
- if (table.kind === "module-registry") {
162
- for (const row of table.rows) {
163
- const key = getCell(row.cells, ["Key", "Module", "模块 Key", "模块"]) || "";
164
- if (!key) continue;
165
- const moduleId = `module:${key}`;
166
- const status = getCell(row.cells, ["Status", "状态"], "unknown");
167
- const currentStep = getCell(row.cells, ["Current Step", "当前步骤"], "");
168
- addNode({ id: moduleId, type: "module", label: getCell(row.cells, ["Name", "Module", "模块名称", "模块"], key), state: status, currentStep });
169
- if (currentStep) {
170
- const stepId = `step:${currentStep}`;
171
- if (!seenNodes.has(stepId)) addNode({ id: stepId, type: "step", label: currentStep, state: status, module: key });
172
- addEdge({ from: moduleId, to: stepId, type: "current_step" });
173
- }
174
- }
175
- }
176
- if (table.kind === "module-plan") {
177
- const moduleMatch = table.source.match(/MODULES\/([^/]+)\/module_plan\.md$/);
178
- const moduleKey = moduleMatch ? moduleMatch[1] : slug(table.source);
179
- const moduleId = `module:${moduleKey}`;
180
- addNode({ id: moduleId, type: "module", label: moduleKey, state: "planned" });
181
- for (const row of table.rows) {
182
- const step = getCell(row.cells, ["Step ID", "步骤 ID"]);
183
- if (!step) continue;
184
- const stepId = `step:${step}`;
185
- addNode({ id: stepId, type: "step", label: `${step} ${getCell(row.cells, ["Name", "名称"]) || ""}`.trim(), state: getCell(row.cells, ["Status", "状态"], "unknown"), module: moduleKey });
186
- addEdge({ from: moduleId, to: stepId, type: "contains" });
187
- for (const dependency of splitDependencies(getCell(row.cells, ["Depends On", "依赖"]) || "")) {
188
- addEdge({ from: `step:${dependency}`, to: stepId, type: "depends_on" });
189
- }
190
- }
191
- }
192
- }
193
- for (const edge of edges) {
194
- if (edge.type === "depends_on" && !seenNodes.has(edge.from)) {
195
- addNode({ id: edge.from, type: "external-dependency", label: edge.from.replace(/^(phase:[^:]+:|step:)/, ""), state: "external" });
196
- }
197
- }
198
- return { nodes, edges: edges.filter((edge) => seenNodes.has(edge.from) && seenNodes.has(edge.to)) };
199
- }
200
-
201
- export function categorizeWarning(message) {
202
- if (/governance-table-entropy/i.test(message)) return "Governance Table Boundary";
203
- if (/missing execution_strategy\.md|missing visual_(?:map|roadmap)\.md|Visual (?:Map|Roadmap)/i.test(message)) return "Plan Contract Missing";
204
- if (/legacy-compat|adoption-needed|legacy check/i.test(message)) return "Adoption Advice";
205
- if (/Evidence|evidence/i.test(message)) return "Missing Evidence";
206
- if (/schema|missing .*columns|invalid/i.test(message)) return "Schema Drift";
207
- return "Review Finding";
208
- }
209
-
210
- function warningType(message) {
211
- if (/missing brief\.md|briefSource|brief/i.test(message) && /missing|缺少/i.test(message)) return "missing-brief";
212
- if (/missing execution_strategy\.md/i.test(message)) return "missing-execution-strategy";
213
- if (/missing visual_map\.md|Visual Map/i.test(message)) return "missing-visual-map";
214
- if (/missing visual_roadmap\.md|Visual Roadmap/i.test(message)) return "missing-visual-roadmap";
215
- if (/Reviewer Identity|Confidence Challenge|Final Confidence Basis|Evidence Checked/i.test(message)) return "review-schema-gap";
216
- if (/governance-table-entropy/i.test(message)) return "governance-table-entropy";
217
- if (/Evidence|evidence/i.test(message)) return "missing-evidence";
218
- if (/missing required file/i.test(message)) return "legacy-reference-gap";
219
- if (/legacy-compat|legacy check|adoption-needed/i.test(message)) return "capability-adoption";
220
- if (/schema|missing .*columns|invalid/i.test(message)) return "schema-drift";
221
- return "review-finding";
222
- }
223
-
224
- function warningScope(message) {
225
- if (/docs\/09-PLANNING\/TASKS\//i.test(message)) return "task";
226
- if (/docs\/09-PLANNING\/MODULES\//i.test(message)) return "module";
227
- if (/review\.md|findings table/i.test(message)) return "review";
228
- if (/docs\/11-REFERENCE\//i.test(message)) return "reference";
229
- if (/\.harness-capabilities\.json|capability|legacy-compat/i.test(message)) return "capability";
230
- return "project";
231
- }
232
-
233
- function warningPhase(type, scope) {
234
- if (type === "capability-adoption") return "baseline";
235
- if (type === "governance-table-entropy") return "global-table-boundary";
236
- if (type === "missing-brief" || type === "missing-execution-strategy" || type === "missing-visual-map" || type === "missing-visual-roadmap") return "active-task-contracts";
237
- if (scope === "module") return "module-classification";
238
- if (type === "review-schema-gap" || type === "missing-evidence") return "review-evidence";
239
- if (type === "legacy-reference-gap" || type === "schema-drift") return "strict-cutover";
240
- return "triage";
241
- }
242
-
243
- function warningFixability(type, scope) {
244
- if (["missing-brief", "missing-execution-strategy", "missing-visual-map", "missing-visual-roadmap"].includes(type)) return "guided";
245
- if (type === "governance-table-entropy") return "manual";
246
- if (type === "legacy-reference-gap" || scope === "reference") return "template";
247
- if (type === "capability-adoption") return "decision";
248
- if (type === "review-schema-gap" || type === "missing-evidence") return "human-evidence";
249
- return "manual";
250
- }
251
-
252
- function warningPriority(type, scope, message) {
253
- if (/fail|invalid|blocked/i.test(message) || type === "schema-drift") return "P1";
254
- if (type === "governance-table-entropy") return /legacy-report-only/i.test(message) ? "P3" : "P2";
255
- if (["missing-brief", "missing-execution-strategy", "missing-visual-map", "missing-visual-roadmap"].includes(type) && scope === "task") return "P2";
256
- if (type === "review-schema-gap" || type === "missing-evidence") return "P2";
257
- if (type === "capability-adoption") return "P3";
258
- return "P3";
259
- }
260
-
261
- function warningConfidence(message) {
262
- if (/legacy|unknown|fallback/i.test(message)) return "medium";
263
- return "high";
264
- }
265
-
266
- function warningAffectedPaths(message) {
267
- const matches = String(message).match(/(?:docs|\.harness-private)\/[^\s:]+|\.harness-capabilities\.json|AGENTS\.md|CLAUDE\.md/g) || [];
268
- return [...new Set(matches.map((item) => item.replace(/[),.;]+$/, "")))];
269
- }
270
-
271
- function summarizeWarnings(warnings) {
272
- const countBy = (field) =>
273
- warnings.reduce((acc, warning) => {
274
- const key = warning[field] || "unknown";
275
- acc[key] = (acc[key] || 0) + 1;
276
- return acc;
277
- }, {});
278
- return {
279
- total: warnings.length,
280
- byCategory: countBy("category"),
281
- byType: countBy("type"),
282
- byPriority: countBy("priority"),
283
- byPhase: countBy("phase"),
284
- byFixability: countBy("fixability"),
285
- activeTaskWarnings: warnings.filter((warning) => warning.scope === "task" && warning.phase === "active-task-contracts").length,
286
- strictCutoverWarnings: warnings.filter((warning) => warning.phase === "strict-cutover").length,
287
- };
288
- }
289
-
290
- export function collectAdoption(status) {
291
- const dashboardMessages = [
292
- ...(status.checkState.details.warnings || []),
293
- ...(status.checkState.details.failures || []).filter((message) => /governance-table-entropy/i.test(message)),
294
- ];
295
- const warnings = dashboardMessages.flatMap((message) => splitWarningMessage(message)).map((message, index) => {
296
- const type = warningType(message);
297
- const scope = warningScope(message);
298
- const affectedPaths = warningAffectedPaths(message);
299
- const stableSuffix = type === "governance-table-entropy" ? `-${stableWarningIdPart(governanceWarningRowKey(message))}` : "";
300
- return {
301
- id: `AD-${String(index + 1).padStart(3, "0")}${stableSuffix}`,
302
- category: categorizeWarning(message),
303
- type,
304
- scope,
305
- priority: warningPriority(type, scope, message),
306
- phase: warningPhase(type, scope),
307
- fixability: warningFixability(type, scope),
308
- status: /legacy-report-only/i.test(message) ? "legacy-report-only" : "open",
309
- confidence: warningConfidence(message),
310
- severity: status.mode === "legacy-compat" ? "advice" : "warning",
311
- title: warningTitle(message),
312
- affected: affectedPaths[0] || warningAffected(message),
313
- affectedPaths,
314
- requiredAction: warningAction(message),
315
- detail: sanitizeText(message),
316
- };
317
- });
318
- return {
319
- mode: status.mode,
320
- project: status.project,
321
- summary: {
322
- blockers: status.checkState.failures,
323
- advice: warnings.length,
324
- ...summarizeWarnings(warnings),
325
- },
326
- warnings,
327
- manualSteps: {
328
- zh: [
329
- "先查看升级建议,决定当前项目要采用哪些 v1.0 能力合同。",
330
- "为仍在活跃的任务手工补齐 execution_strategy.md 和 visual_map.md。",
331
- "只有在项目明确声明 v1.0 capability 后,再把 strict check 当成阻塞门禁。",
332
- ],
333
- en: [
334
- "Review adoption advice and decide which v1.0 capability contracts should be adopted.",
335
- "Manually add execution_strategy.md and visual_map.md for active tasks.",
336
- "Treat strict check as blocking only after the project intentionally declares v1.0 capabilities.",
337
- ],
338
- },
339
- };
340
- }
341
-
342
- function governanceWarningRowKey(message) {
343
- const match = String(message || "").match(/\brow\s+([^:]+)/i);
344
- return match ? match[1].trim() : "global-table";
345
- }
346
-
347
- function stableWarningIdPart(value) {
348
- return String(value || "global-table")
349
- .replace(/[^A-Za-z0-9_-]+/g, "-")
350
- .replace(/^-+|-+$/g, "")
351
- .slice(0, 80) || "global-table";
352
- }
353
-
354
- export function splitWarningMessage(message) {
355
- return String(message || "")
356
- .split(/\n-\s+/)
357
- .map((item, index) => (index === 0 ? item : `- ${item}`))
358
- .filter(Boolean);
359
- }
360
-
361
- function warningTitle(message) {
362
- if (/governance-table-entropy/i.test(message)) return "Global table boundary";
363
- if (/missing execution_strategy\.md/i.test(message)) return "Missing execution strategy";
364
- if (/missing visual_map\.md|Visual Map/i.test(message)) return "Missing visual map";
365
- if (/missing visual_roadmap\.md|Visual Roadmap/i.test(message)) return "Missing legacy visual roadmap";
366
- if (/legacy-compat/i.test(message)) return "Legacy compatibility mode";
367
- if (/legacy check failed/i.test(message)) return "Legacy checker finding";
368
- if (/review\.md missing/i.test(message)) return "Review schema gap";
369
- if (/findings table missing/i.test(message)) return "Review findings schema gap";
370
- return String(message).split(":")[0].slice(0, 96);
371
- }
372
-
373
- function warningAffected(message) {
374
- const target = String(message).match(/(?:docs|\.harness-private)\/[^\s:]+/);
375
- return target ? target[0] : "project";
376
- }
377
-
378
- function warningAction(message) {
379
- if (/governance-table-entropy/i.test(message)) return "Move local detail to module/task docs; keep the global row to summary, state, route, and audit result.";
380
- if (/execution_strategy\.md/i.test(message)) return "Add standalone execution strategy file.";
381
- if (/visual_map\.md|Visual Map/i.test(message)) return "Add standalone visual map file.";
382
- if (/visual_roadmap\.md|Visual Roadmap/i.test(message)) return "Rewrite legacy visual_roadmap.md into canonical visual_map.md.";
383
- if (/review\.md missing/i.test(message)) return "Update review.md to v1 review schema.";
384
- if (/legacy/i.test(message)) return "Review manually; do not auto-migrate.";
385
- return "Inspect source document and decide whether to adopt v1 contract.";
386
- }
387
-
388
- export function buildDashboardBundle(targetInput, options = {}) {
389
- const status = buildStatus(targetInput, options);
390
- const target = normalizeTarget(targetInput);
391
- const documents = { documents: collectMarkdownDocuments(target) };
392
- const tables = collectTables(documents.documents);
393
- const graph = collectGraph(status, tables);
394
- const adoption = collectAdoption(status);
395
- return sanitizeDeep({ status, tables, documents, graph, adoption });
396
- }
397
-
398
- export function writeDashboardFolder(outDir, targetInput, options = {}) {
399
- const target = normalizeTarget(targetInput);
400
- const registry = readCapabilityRegistry(target);
401
- const locale = options.localeOverride || registry.locale;
402
- const bundle = buildDashboardBundle(targetInput, options);
403
- return writeDashboardDirectory(outDir, bundle, { repoRoot, projectRoot: target.projectRoot, docsRoot: target.docsRoot, locale, workbenchRuntime: options.workbenchRuntime === true, recoverGeneratedDashboard: options.recoverGeneratedDashboard === true });
404
- }
405
-
406
- export function writeDashboardSingleFile(outFile, targetInput, options = {}) {
407
- const target = normalizeTarget(targetInput);
408
- const registry = readCapabilityRegistry(target);
409
- const locale = options.localeOverride || registry.locale;
410
- const bundle = buildDashboardBundle(targetInput, options);
411
- return writeDashboardFile(outFile, bundle, { repoRoot, projectRoot: target.projectRoot, docsRoot: target.docsRoot, locale });
412
- }