@harness-engineering/cli 1.6.2 → 1.8.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 (180) hide show
  1. package/dist/agents/personas/documentation-maintainer.yaml +3 -1
  2. package/dist/agents/personas/performance-guardian.yaml +23 -0
  3. package/dist/agents/personas/planner.yaml +27 -0
  4. package/dist/agents/personas/verifier.yaml +30 -0
  5. package/dist/agents/skills/claude-code/align-documentation/SKILL.md +13 -0
  6. package/dist/agents/skills/claude-code/cleanup-dead-code/SKILL.md +25 -1
  7. package/dist/agents/skills/claude-code/cleanup-dead-code/skill.yaml +5 -2
  8. package/dist/agents/skills/claude-code/detect-doc-drift/SKILL.md +12 -0
  9. package/dist/agents/skills/claude-code/enforce-architecture/SKILL.md +67 -1
  10. package/dist/agents/skills/claude-code/enforce-architecture/skill.yaml +5 -2
  11. package/dist/agents/skills/claude-code/harness-accessibility/SKILL.md +281 -0
  12. package/dist/agents/skills/claude-code/harness-accessibility/skill.yaml +51 -0
  13. package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +119 -72
  14. package/dist/agents/skills/claude-code/harness-autopilot/skill.yaml +4 -2
  15. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +76 -4
  16. package/dist/agents/skills/claude-code/harness-brainstorming/skill.yaml +2 -0
  17. package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +487 -234
  18. package/dist/agents/skills/claude-code/harness-code-review/skill.yaml +15 -2
  19. package/dist/agents/skills/claude-code/harness-codebase-cleanup/SKILL.md +226 -0
  20. package/dist/agents/skills/claude-code/harness-codebase-cleanup/skill.yaml +64 -0
  21. package/dist/agents/skills/claude-code/harness-dependency-health/SKILL.md +35 -6
  22. package/dist/agents/skills/claude-code/harness-dependency-health/skill.yaml +1 -1
  23. package/dist/agents/skills/claude-code/harness-design/SKILL.md +265 -0
  24. package/dist/agents/skills/claude-code/harness-design/skill.yaml +53 -0
  25. package/dist/agents/skills/claude-code/harness-design-mobile/SKILL.md +336 -0
  26. package/dist/agents/skills/claude-code/harness-design-mobile/skill.yaml +49 -0
  27. package/dist/agents/skills/claude-code/harness-design-system/SKILL.md +282 -0
  28. package/dist/agents/skills/claude-code/harness-design-system/skill.yaml +50 -0
  29. package/dist/agents/skills/claude-code/harness-design-web/SKILL.md +360 -0
  30. package/dist/agents/skills/claude-code/harness-design-web/skill.yaml +52 -0
  31. package/dist/agents/skills/claude-code/harness-docs-pipeline/SKILL.md +460 -0
  32. package/dist/agents/skills/claude-code/harness-docs-pipeline/skill.yaml +69 -0
  33. package/dist/agents/skills/claude-code/harness-execution/SKILL.md +73 -8
  34. package/dist/agents/skills/claude-code/harness-execution/skill.yaml +1 -0
  35. package/dist/agents/skills/claude-code/harness-hotspot-detector/SKILL.md +32 -6
  36. package/dist/agents/skills/claude-code/harness-hotspot-detector/skill.yaml +1 -1
  37. package/dist/agents/skills/claude-code/harness-i18n/SKILL.md +484 -0
  38. package/dist/agents/skills/claude-code/harness-i18n/skill.yaml +54 -0
  39. package/dist/agents/skills/claude-code/harness-i18n-process/SKILL.md +388 -0
  40. package/dist/agents/skills/claude-code/harness-i18n-process/skill.yaml +43 -0
  41. package/dist/agents/skills/claude-code/harness-i18n-workflow/SKILL.md +512 -0
  42. package/dist/agents/skills/claude-code/harness-i18n-workflow/skill.yaml +53 -0
  43. package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +51 -6
  44. package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +35 -1
  45. package/dist/agents/skills/claude-code/harness-knowledge-mapper/SKILL.md +46 -5
  46. package/dist/agents/skills/claude-code/harness-knowledge-mapper/skill.yaml +1 -1
  47. package/dist/agents/skills/claude-code/harness-onboarding/SKILL.md +19 -1
  48. package/dist/agents/skills/claude-code/harness-perf/SKILL.md +37 -8
  49. package/dist/agents/skills/claude-code/harness-perf/skill.yaml +3 -0
  50. package/dist/agents/skills/claude-code/harness-perf-tdd/SKILL.md +17 -4
  51. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +57 -3
  52. package/dist/agents/skills/claude-code/harness-planning/skill.yaml +2 -0
  53. package/dist/agents/skills/claude-code/harness-release-readiness/SKILL.md +29 -9
  54. package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +562 -0
  55. package/dist/agents/skills/claude-code/harness-roadmap/skill.yaml +43 -0
  56. package/dist/agents/skills/claude-code/harness-security-review/SKILL.md +36 -2
  57. package/dist/agents/skills/claude-code/harness-security-review/skill.yaml +8 -6
  58. package/dist/agents/skills/claude-code/harness-security-scan/skill.yaml +1 -1
  59. package/dist/agents/skills/claude-code/harness-soundness-review/SKILL.md +1267 -0
  60. package/dist/agents/skills/claude-code/harness-soundness-review/skill.yaml +48 -0
  61. package/dist/agents/skills/claude-code/harness-test-advisor/SKILL.md +35 -6
  62. package/dist/agents/skills/claude-code/harness-verification/SKILL.md +66 -0
  63. package/dist/agents/skills/claude-code/harness-verification/skill.yaml +1 -0
  64. package/dist/agents/skills/claude-code/harness-verify/SKILL.md +37 -0
  65. package/dist/agents/skills/claude-code/initialize-harness-project/SKILL.md +15 -1
  66. package/dist/agents/skills/claude-code/validate-context-engineering/SKILL.md +12 -0
  67. package/dist/agents/skills/gemini-cli/harness-accessibility/SKILL.md +281 -0
  68. package/dist/agents/skills/gemini-cli/harness-accessibility/skill.yaml +51 -0
  69. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +119 -72
  70. package/dist/agents/skills/gemini-cli/harness-autopilot/skill.yaml +4 -2
  71. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/SKILL.md +226 -0
  72. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/skill.yaml +64 -0
  73. package/dist/agents/skills/gemini-cli/harness-dependency-health/SKILL.md +35 -6
  74. package/dist/agents/skills/gemini-cli/harness-dependency-health/skill.yaml +1 -1
  75. package/dist/agents/skills/gemini-cli/harness-design/SKILL.md +265 -0
  76. package/dist/agents/skills/gemini-cli/harness-design/skill.yaml +53 -0
  77. package/dist/agents/skills/gemini-cli/harness-design-mobile/SKILL.md +336 -0
  78. package/dist/agents/skills/gemini-cli/harness-design-mobile/skill.yaml +49 -0
  79. package/dist/agents/skills/gemini-cli/harness-design-system/SKILL.md +282 -0
  80. package/dist/agents/skills/gemini-cli/harness-design-system/skill.yaml +50 -0
  81. package/dist/agents/skills/gemini-cli/harness-design-web/SKILL.md +360 -0
  82. package/dist/agents/skills/gemini-cli/harness-design-web/skill.yaml +52 -0
  83. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/SKILL.md +460 -0
  84. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/skill.yaml +69 -0
  85. package/dist/agents/skills/gemini-cli/harness-hotspot-detector/SKILL.md +32 -6
  86. package/dist/agents/skills/gemini-cli/harness-hotspot-detector/skill.yaml +1 -1
  87. package/dist/agents/skills/gemini-cli/harness-i18n/SKILL.md +484 -0
  88. package/dist/agents/skills/gemini-cli/harness-i18n/skill.yaml +54 -0
  89. package/dist/agents/skills/gemini-cli/harness-i18n-process/SKILL.md +388 -0
  90. package/dist/agents/skills/gemini-cli/harness-i18n-process/skill.yaml +43 -0
  91. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/SKILL.md +512 -0
  92. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/skill.yaml +53 -0
  93. package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +51 -6
  94. package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/SKILL.md +46 -5
  95. package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/skill.yaml +1 -1
  96. package/dist/agents/skills/gemini-cli/harness-perf/SKILL.md +37 -8
  97. package/dist/agents/skills/gemini-cli/harness-perf/skill.yaml +3 -0
  98. package/dist/agents/skills/gemini-cli/harness-perf-tdd/SKILL.md +17 -4
  99. package/dist/agents/skills/gemini-cli/harness-release-readiness/SKILL.md +29 -9
  100. package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +562 -0
  101. package/dist/agents/skills/gemini-cli/harness-roadmap/skill.yaml +43 -0
  102. package/dist/agents/skills/gemini-cli/harness-security-review/skill.yaml +8 -6
  103. package/dist/agents/skills/gemini-cli/harness-security-scan/skill.yaml +1 -1
  104. package/dist/agents/skills/gemini-cli/harness-soundness-review/SKILL.md +1267 -0
  105. package/dist/agents/skills/gemini-cli/harness-soundness-review/skill.yaml +48 -0
  106. package/dist/agents/skills/gemini-cli/harness-test-advisor/SKILL.md +35 -6
  107. package/dist/agents/skills/node_modules/.bin/vitest +2 -2
  108. package/dist/agents/skills/shared/design-knowledge/anti-patterns/color.yaml +106 -0
  109. package/dist/agents/skills/shared/design-knowledge/anti-patterns/layout.yaml +109 -0
  110. package/dist/agents/skills/shared/design-knowledge/anti-patterns/motion.yaml +109 -0
  111. package/dist/agents/skills/shared/design-knowledge/anti-patterns/typography.yaml +112 -0
  112. package/dist/agents/skills/shared/design-knowledge/industries/creative.yaml +80 -0
  113. package/dist/agents/skills/shared/design-knowledge/industries/ecommerce.yaml +80 -0
  114. package/dist/agents/skills/shared/design-knowledge/industries/emerging-tech.yaml +83 -0
  115. package/dist/agents/skills/shared/design-knowledge/industries/fintech.yaml +80 -0
  116. package/dist/agents/skills/shared/design-knowledge/industries/healthcare.yaml +80 -0
  117. package/dist/agents/skills/shared/design-knowledge/industries/lifestyle.yaml +80 -0
  118. package/dist/agents/skills/shared/design-knowledge/industries/saas.yaml +80 -0
  119. package/dist/agents/skills/shared/design-knowledge/industries/services.yaml +80 -0
  120. package/dist/agents/skills/shared/design-knowledge/palettes/curated.yaml +234 -0
  121. package/dist/agents/skills/shared/design-knowledge/platform-rules/android.yaml +125 -0
  122. package/dist/agents/skills/shared/design-knowledge/platform-rules/flutter.yaml +144 -0
  123. package/dist/agents/skills/shared/design-knowledge/platform-rules/ios.yaml +106 -0
  124. package/dist/agents/skills/shared/design-knowledge/platform-rules/web.yaml +102 -0
  125. package/dist/agents/skills/shared/design-knowledge/typography/pairings.yaml +274 -0
  126. package/dist/agents/skills/shared/i18n-knowledge/accessibility/intersection.yaml +142 -0
  127. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/encoding.yaml +67 -0
  128. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/formatting.yaml +106 -0
  129. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/layout.yaml +80 -0
  130. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/pluralization.yaml +80 -0
  131. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/string-handling.yaml +106 -0
  132. package/dist/agents/skills/shared/i18n-knowledge/frameworks/android-resources.yaml +47 -0
  133. package/dist/agents/skills/shared/i18n-knowledge/frameworks/apple-strings.yaml +47 -0
  134. package/dist/agents/skills/shared/i18n-knowledge/frameworks/backend-patterns.yaml +50 -0
  135. package/dist/agents/skills/shared/i18n-knowledge/frameworks/flutter-intl.yaml +47 -0
  136. package/dist/agents/skills/shared/i18n-knowledge/frameworks/i18next.yaml +47 -0
  137. package/dist/agents/skills/shared/i18n-knowledge/frameworks/react-intl.yaml +47 -0
  138. package/dist/agents/skills/shared/i18n-knowledge/frameworks/vue-i18n.yaml +47 -0
  139. package/dist/agents/skills/shared/i18n-knowledge/industries/ecommerce.yaml +66 -0
  140. package/dist/agents/skills/shared/i18n-knowledge/industries/fintech.yaml +66 -0
  141. package/dist/agents/skills/shared/i18n-knowledge/industries/gaming.yaml +69 -0
  142. package/dist/agents/skills/shared/i18n-knowledge/industries/healthcare.yaml +66 -0
  143. package/dist/agents/skills/shared/i18n-knowledge/industries/legal.yaml +66 -0
  144. package/dist/agents/skills/shared/i18n-knowledge/locales/ar.yaml +41 -0
  145. package/dist/agents/skills/shared/i18n-knowledge/locales/de.yaml +35 -0
  146. package/dist/agents/skills/shared/i18n-knowledge/locales/en.yaml +32 -0
  147. package/dist/agents/skills/shared/i18n-knowledge/locales/es.yaml +35 -0
  148. package/dist/agents/skills/shared/i18n-knowledge/locales/fi.yaml +35 -0
  149. package/dist/agents/skills/shared/i18n-knowledge/locales/fr.yaml +35 -0
  150. package/dist/agents/skills/shared/i18n-knowledge/locales/he.yaml +41 -0
  151. package/dist/agents/skills/shared/i18n-knowledge/locales/hi.yaml +35 -0
  152. package/dist/agents/skills/shared/i18n-knowledge/locales/it.yaml +32 -0
  153. package/dist/agents/skills/shared/i18n-knowledge/locales/ja.yaml +38 -0
  154. package/dist/agents/skills/shared/i18n-knowledge/locales/ko.yaml +38 -0
  155. package/dist/agents/skills/shared/i18n-knowledge/locales/nl.yaml +32 -0
  156. package/dist/agents/skills/shared/i18n-knowledge/locales/pl.yaml +35 -0
  157. package/dist/agents/skills/shared/i18n-knowledge/locales/pt.yaml +32 -0
  158. package/dist/agents/skills/shared/i18n-knowledge/locales/ru.yaml +35 -0
  159. package/dist/agents/skills/shared/i18n-knowledge/locales/sv.yaml +32 -0
  160. package/dist/agents/skills/shared/i18n-knowledge/locales/th.yaml +35 -0
  161. package/dist/agents/skills/shared/i18n-knowledge/locales/tr.yaml +35 -0
  162. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hans.yaml +38 -0
  163. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hant.yaml +35 -0
  164. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/i18next-mcp.yaml +56 -0
  165. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lingo-dev.yaml +56 -0
  166. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lokalise.yaml +60 -0
  167. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/tolgee.yaml +60 -0
  168. package/dist/agents/skills/shared/i18n-knowledge/testing/locale-testing.yaml +107 -0
  169. package/dist/agents/skills/shared/i18n-knowledge/testing/pseudo-localization.yaml +86 -0
  170. package/dist/bin/harness.js +64 -4
  171. package/dist/{chunk-UDWGSL3T.js → chunk-3JWCBVUZ.js} +3 -3
  172. package/dist/{chunk-IUFFBBYV.js → chunk-LNI4T7R6.js} +179 -61
  173. package/dist/{chunk-USEYPS7F.js → chunk-SJECMKSS.js} +2250 -40
  174. package/dist/{dist-4MYPT3OE.js → dist-BDO5GFEM.js} +295 -14
  175. package/dist/{dist-RBZXXJHG.js → dist-NT3GXHQZ.js} +95 -1
  176. package/dist/index.d.ts +266 -7
  177. package/dist/index.js +7 -3
  178. package/dist/validate-cross-check-2OPGCGGU.js +7 -0
  179. package/package.json +7 -7
  180. package/dist/validate-cross-check-CPEPNLOD.js +0 -7
@@ -13,8 +13,35 @@
13
13
 
14
14
  ## Prerequisites
15
15
 
16
- A knowledge graph must exist at `.harness/graph/`. Run `harness scan` if no graph is available.
17
- If the graph exists but code has changed since the last scan, re-run `harness scan` first — stale graph data leads to inaccurate results.
16
+ A knowledge graph at `.harness/graph/` enables full analysis. If no graph exists,
17
+ the skill uses static analysis fallbacks (see Graph Availability section).
18
+ Run `harness scan` to enable graph-enhanced analysis.
19
+
20
+ ### Graph Availability
21
+
22
+ Before starting, check if `.harness/graph/graph.json` exists.
23
+
24
+ **If graph exists:** Check staleness — compare `.harness/graph/metadata.json`
25
+ scanTimestamp against `git log -1 --format=%ct` (latest commit timestamp).
26
+ If graph is more than 10 commits behind (`git log --oneline <scanTimestamp>..HEAD | wc -l`),
27
+ run `harness scan` to refresh before proceeding. (Staleness sensitivity: **Medium**)
28
+
29
+ **If graph exists and is fresh (or refreshed):** Use graph tools as primary strategy.
30
+
31
+ **If no graph exists:** Output "Running without graph (run `harness scan` to
32
+ enable full analysis)" and use fallback strategies for all subsequent steps.
33
+
34
+ ### Pipeline Context (when orchestrated)
35
+
36
+ When invoked by `harness-docs-pipeline`, check for a `pipeline` field in `.harness/handoff.json`:
37
+
38
+ - If `pipeline` field exists: read `DocPipelineContext` from it
39
+ - If `pipeline.bootstrapped === true`, this is a bootstrap invocation — generate full AGENTS.md without confirmation prompt
40
+ - Write any generated documentation back as `DocFix[]` to `pipeline.fillsApplied`
41
+ - This enables the orchestrator to track what was generated and verify it
42
+ - If `pipeline` field does not exist: behave exactly as today (standalone mode)
43
+
44
+ No changes to the skill's interface or output format — the pipeline field is purely additive.
18
45
 
19
46
  ## Process
20
47
 
@@ -40,6 +67,20 @@ If the graph exists but code has changed since the last scan, re-run `harness sc
40
67
  get_relationships(nodeId=<module>, direction="outbound", depth=1)
41
68
  ```
42
69
 
70
+ #### Fallback (without graph)
71
+
72
+ When no graph is available, use directory structure and file analysis:
73
+
74
+ 1. **Module hierarchy from directories**: Use the directory structure as the module hierarchy — each directory represents a module. Glob for all source files to build the tree.
75
+ 2. **Entry points**: Check `package.json` for `main` and `exports` fields. Glob for `src/index.*` and `index.*` patterns. These are the entry points.
76
+ 3. **Source file inventory**: Glob for all source files (`**/*.ts`, `**/*.tsx`, `**/*.js`, `**/*.jsx`, etc.).
77
+ 4. **Documentation inventory**: Glob for all doc files (`**/*.md`, `docs/**/*`).
78
+ 5. **Undocumented module detection**: Diff the source directory set against the doc directory set. Source directories with no corresponding docs (no README.md, no matching doc file) are undocumented.
79
+ 6. **Existing knowledge map**: Read existing AGENTS.md if present for current knowledge map state.
80
+ 7. **Dependency flow (approximate)**: Parse import statements in each module's files to determine which modules depend on which others.
81
+
82
+ > Fallback completeness: ~50% — no semantic grouping; modules grouped by directory only; no cross-cutting concern detection.
83
+
43
84
  ### Phase 2: GENERATE — Build Knowledge Map
44
85
 
45
86
  Generate markdown sections following AGENTS.md conventions:
@@ -109,7 +150,7 @@ This ensures subsequent graph queries (impact analysis, drift detection) include
109
150
 
110
151
  ## Harness Integration
111
152
 
112
- - **`harness scan`** — Must run before this skill to ensure graph is current.
153
+ - **`harness scan`** — Recommended before this skill for full graph-enhanced analysis. If graph is missing, skill uses directory structure fallbacks.
113
154
  - **`harness validate`** — Run after acting on findings to verify project health.
114
155
  - **Graph tools** — This skill uses `query_graph`, `get_relationships`, and `check_docs` MCP tools.
115
156
 
@@ -119,7 +160,7 @@ This ensures subsequent graph queries (impact analysis, drift detection) include
119
160
  - Coverage gaps identified (undocumented modules, missing descriptions, stale references)
120
161
  - Output written to AGENTS.md (or specified path) in proper markdown format
121
162
  - Report follows the structured output format
122
- - All findings are backed by graph query evidence, not heuristics
163
+ - All findings are backed by graph query evidence (with graph) or directory/file analysis (without graph)
123
164
 
124
165
  ## Examples
125
166
 
@@ -145,7 +186,7 @@ Output:
145
186
 
146
187
  ## Gates
147
188
 
148
- - **No generation without graph.** If no graph exists, stop and instruct to run `harness scan`.
189
+ - **Graph preferred, fallback available.** If no graph exists, use directory structure and file analysis to build the knowledge map. Do not stop — produce the best map possible.
149
190
  - **Never overwrite without confirmation.** If AGENTS.md exists, show the diff and ask before replacing.
150
191
 
151
192
  ## Escalation
@@ -5,7 +5,7 @@ cognitive_mode: constructive-architect
5
5
  triggers:
6
6
  - manual
7
7
  - on_commit
8
- - scheduled
8
+ - on_milestone
9
9
  platforms:
10
10
  - claude-code
11
11
  - gemini-cli
@@ -45,34 +45,62 @@ Tier 1 violations are non-negotiable blockers. If a Tier 1 violation is detected
45
45
 
46
46
  ---
47
47
 
48
+ ### Graph Availability
49
+
50
+ Hotspot scoring and coupling analysis benefit from the knowledge graph but work without it.
51
+
52
+ **Staleness sensitivity:** Medium -- auto-refresh if >10 commits stale. Hotspot scoring uses churn data which does not change rapidly.
53
+
54
+ | Feature | With Graph | Without Graph |
55
+ | ------------------------------------ | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
56
+ | Hotspot scoring (churn x complexity) | `GraphComplexityAdapter` computes from graph nodes | `git log --format="%H" -- <file>` for per-file commit count; complexity from `check-perf --structural` output; multiply manually |
57
+ | Coupling ratio | `GraphCouplingAdapter` computes from graph edges | Parse import statements, count fan-out/fan-in per file |
58
+ | Critical path resolution | Graph inference (high fan-in) + `@perf-critical` annotations | `@perf-critical` annotations only; grep for decorator/comment |
59
+ | Transitive dep depth | Graph BFS depth | Import chain follow, 2 levels deep |
60
+
61
+ **Notice when running without graph:** "Running without graph (run `harness scan` to enable hotspot scoring and coupling analysis)"
62
+
63
+ **Impact on tiers:** Without graph, Tier 1 hotspot detection is degraded. Hotspot scoring falls back to churn-only (no complexity multiplication). This limitation is documented in the performance report output.
64
+
65
+ ---
66
+
48
67
  ### Phase 2: BENCHMARK — Runtime Performance
49
68
 
50
69
  This phase runs only when `.bench.ts` files exist in the project. If none are found, skip to Phase 3.
51
70
 
52
- 1. **Check for benchmark files.** Scan the project for `*.bench.ts` files. If none exist, skip this phase entirely.
71
+ 1. **Check baseline lock-in.** Before running benchmarks, verify baselines are kept in sync:
72
+ - List all `.bench.ts` files changed in this PR: `git diff --name-only | grep '.bench.ts'`
73
+ - If any `.bench.ts` files are new or modified:
74
+ - Check if `.harness/perf/baselines.json` is also modified in this PR
75
+ - If NOT modified: flag as Tier 2 warning: "Benchmark files changed but baselines not updated. Run `harness perf baselines update` and commit the result."
76
+ - If modified: verify the updated baselines include entries for all changed benchmarks
77
+ - If no `.bench.ts` files changed: skip this check
78
+ - This check also runs standalone via `--check-baselines` flag
79
+
80
+ 2. **Check for benchmark files.** Scan the project for `*.bench.ts` files. If none exist, skip this phase entirely.
53
81
 
54
- 2. **Verify clean working tree.** Run `git status --porcelain`. If there are uncommitted changes, STOP. Benchmarks on dirty trees produce unreliable results.
82
+ 3. **Verify clean working tree.** Run `git status --porcelain`. If there are uncommitted changes, STOP. Benchmarks on dirty trees produce unreliable results.
55
83
 
56
- 3. **Run benchmarks.** Execute `harness perf bench` to run all benchmark suites.
84
+ 4. **Run benchmarks.** Execute `harness perf bench` to run all benchmark suites.
57
85
 
58
- 4. **Load baselines.** Read `.harness/perf/baselines.json` for previous benchmark results. If no baselines exist, treat this as a baseline-capture run.
86
+ 5. **Load baselines.** Read `.harness/perf/baselines.json` for previous benchmark results. If no baselines exist, treat this as a baseline-capture run.
59
87
 
60
- 5. **Compare results against baselines** using the `RegressionDetector`:
88
+ 6. **Compare results against baselines** using the `RegressionDetector`:
61
89
  - Calculate percentage change for each benchmark
62
90
  - Apply noise margin (default: 3%) before flagging regressions
63
91
  - Distinguish between critical-path and non-critical-path benchmarks
64
92
 
65
- 6. **Resolve critical paths** via `CriticalPathResolver`:
93
+ 7. **Resolve critical paths** via `CriticalPathResolver`:
66
94
  - Check `@perf-critical` annotations in source files
67
95
  - Check graph fan-in data (functions called by many consumers)
68
96
  - Functions in the critical path set have stricter thresholds
69
97
 
70
- 7. **Flag regressions by tier:**
98
+ 8. **Flag regressions by tier:**
71
99
  - **Tier 1:** >5% regression on a critical path benchmark
72
100
  - **Tier 2:** >10% regression on a non-critical-path benchmark
73
101
  - **Tier 3:** >5% regression on a non-critical-path benchmark (within noise margin consideration)
74
102
 
75
- 8. **If this is a baseline-capture run,** report results without regression comparison. Recommend running `harness perf baselines update` to persist.
103
+ 9. **If this is a baseline-capture run,** report results without regression comparison. Recommend running `harness perf baselines update` to persist.
76
104
 
77
105
  ---
78
106
 
@@ -138,6 +166,7 @@ This phase runs only when `.bench.ts` files exist in the project. If none are fo
138
166
  - **`harness perf bench`** — Run benchmarks only. Requires clean working tree.
139
167
  - **`harness perf baselines show`** — View current benchmark baselines.
140
168
  - **`harness perf baselines update`** — Persist current benchmark results as new baselines.
169
+ - **`harness perf --check-baselines`** -- Verify baseline file is updated when benchmarks change. Runs the baseline lock-in check standalone.
141
170
  - **`harness perf critical-paths`** — View the current critical path set and how it was determined.
142
171
  - **`harness validate`** — Run after enforcement to verify overall project health.
143
172
  - **`harness graph scan`** — Refresh knowledge graph for accurate hotspot scoring.
@@ -21,6 +21,9 @@ cli:
21
21
  - name: path
22
22
  description: Project root path
23
23
  required: false
24
+ - name: check-baselines
25
+ description: Verify baseline file is updated when benchmarks change
26
+ required: false
24
27
  mcp:
25
28
  tool: run_skill
26
29
  input:
@@ -60,10 +60,23 @@ If you find yourself writing production code before both the test and the benchm
60
60
 
61
61
  2. **Run the test** — observe pass. If it fails, fix the implementation until it passes.
62
62
 
63
- 3. **Run the benchmark** capture initial results. This is the first measurement. Note:
64
- - If a performance assertion exists in the spec, verify it passes
65
- - If no assertion exists, record the result as a baseline reference
66
- - Do not optimize at this stage unless the assertion fails
63
+ 3. **Run the benchmark** -- capture initial results and apply thresholds:
64
+
65
+ **When the spec defines a performance requirement** (e.g., "< 50ms"):
66
+ - Use the spec requirement as the benchmark assertion threshold
67
+ - Verify it passes; if not, see step 4
68
+
69
+ **When the spec is vague or silent on performance:**
70
+ - Fall back to harness-perf tier thresholds:
71
+ - Critical path functions (annotated `@perf-critical` or high fan-in): must not regress >5% from baseline (Tier 1)
72
+ - Non-critical functions: must not regress >10% from baseline (Tier 2)
73
+ - Structural complexity: must stay under Tier 2 thresholds (cyclomatic <=15, nesting <=4, function length <=50 lines, params <=5)
74
+ - These thresholds give developers concrete targets even when the spec does not specify performance requirements
75
+
76
+ **When no baseline exists (new code):**
77
+ - This run captures the initial baseline
78
+ - No regression comparison on first run
79
+ - VALIDATE phase (Phase 4) ensures the captured baseline is committed via `harness perf baselines update`
67
80
 
68
81
  4. **If the performance assertion fails,** you have two options:
69
82
  - The implementation approach is fundamentally wrong (e.g., O(n^2) when O(n) is needed) — revise the algorithm
@@ -77,6 +77,8 @@ Run every check below. Record each as **pass**, **warn**, or **fail**:
77
77
  | `homepage` field exists | warn |
78
78
  | `description` field exists | warn |
79
79
  | Build succeeds: run the project's build command | fail |
80
+ | Typecheck passes: run the project's typecheck command (e.g., `pnpm typecheck`) | fail |
81
+ | Tests pass: run the project's test command (e.g., `pnpm test`) | fail |
80
82
  | `pnpm pack --dry-run` produces expected files (no test files, no src if dist exists) | warn |
81
83
 
82
84
  ##### Documentation (root level)
@@ -107,10 +109,24 @@ Run every check below. Record each as **pass**, **warn**, or **fail**:
107
109
  | CI workflow file exists (`.github/workflows/ci.yml` or similar) | fail |
108
110
  | Release/publish workflow file exists | warn |
109
111
  | `test` script exists in root `package.json` | fail |
110
- | `lint` script exists in root `package.json` | warn |
111
- | `typecheck` or `tsc` script exists in root `package.json` | warn |
112
+ | `lint` script exists in root `package.json` | fail |
113
+ | `typecheck` or `tsc` script exists in root `package.json` | fail |
112
114
  | `harness validate` passes (project-level health check) | fail |
113
115
 
116
+ ##### i18n Coverage (conditional)
117
+
118
+ When `i18n.enabled: true` in `harness.config.json`, run these checks:
119
+
120
+ | Check | Severity if failing |
121
+ | ---------------------------------------------------------------------------------------------- | ------------------------------- |
122
+ | Translation coverage meets `i18n.coverage.minimumPercent` for all target locales | fail (strict) / warn (standard) |
123
+ | No untranslated values (source text in target locale files) when `coverage.detectUntranslated` | warn |
124
+ | All CLDR plural forms present for target locales when `coverage.requirePlurals` | warn |
125
+ | No stale translations (source changed since last translation timestamp) | warn |
126
+ | `harness-i18n` scan passes with zero errors | fail (strict) / warn (standard) |
127
+
128
+ If `i18n.enabled` is false or the `i18n` config block is absent, skip this section entirely and report it as "N/A" in the audit output.
129
+
114
130
  #### Comprehensive Checks (only with `--comprehensive`)
115
131
 
116
132
  These checks run only when `--comprehensive` is passed. They are slower and may require network access.
@@ -158,6 +174,7 @@ Packaging: 8/12 passed, 2 warnings, 2 failures
158
174
  Docs: 5/6 passed, 1 warning, 0 failures
159
175
  Hygiene: 3/5 passed, 2 warnings, 0 failures
160
176
  CI/CD: 4/5 passed, 1 warning, 0 failures
177
+ i18n: N/N passed, N warnings, N failures (or: skipped — i18n not enabled)
161
178
  [comprehensive] API Docs: skipped (use --comprehensive)
162
179
  [comprehensive] Examples: skipped (use --comprehensive)
163
180
  [comprehensive] Dep Health: skipped (use --comprehensive)
@@ -267,13 +284,15 @@ After each batch of fixes (or after each individual fix if not batching), run `h
267
284
 
268
285
  These require human judgment and cannot be auto-fixed. List them with guidance:
269
286
 
270
- | Finding | Guidance |
271
- | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
272
- | `TODO`/`FIXME` in published source | List each location with file:line. Human must resolve or move to a tracked issue. |
273
- | README missing usage/API sections | Suggest section structure but do not generate content — only the author knows the API. |
274
- | CHANGELOG exists but has no entries (empty or template-only) | Suggest running `git log --oneline <last-tag>..HEAD` to generate entries. Unlike a missing file (auto-fixable above), an empty CHANGELOG needs human-authored content. |
275
- | CI workflow missing | Provide a starter template but flag for human review before committing. |
276
- | Build failure | Show the error output. Do not attempt to fix build issues automatically. |
287
+ | Finding | Guidance |
288
+ | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
289
+ | `TODO`/`FIXME` in published source | List each location with file:line. Human must resolve or move to a tracked issue. |
290
+ | README missing usage/API sections | Suggest section structure but do not generate content — only the author knows the API. |
291
+ | CHANGELOG exists but has no entries (empty or template-only) | Suggest running `git log --oneline <last-tag>..HEAD` to generate entries. Unlike a missing file (auto-fixable above), an empty CHANGELOG needs human-authored content. |
292
+ | CI workflow missing | Provide a starter template but flag for human review before committing. |
293
+ | Build failure | Show the error output. Do not attempt to fix build issues automatically. |
294
+ | Typecheck failure | Show the error output with file:line. Common causes: orphaned files with stale imports, missing type declarations, `exactOptionalPropertyTypes` violations. Do not auto-fix — type errors often indicate structural problems. |
295
+ | Test failure | Show the error output with failing test names. Do not attempt to fix test failures automatically — they may indicate real bugs. |
277
296
 
278
297
  #### Output
279
298
 
@@ -492,6 +511,7 @@ This framing is informational — it does not block anything. It gives the team
492
511
  - **Sub-skill invocations** — Phase 2 dispatches `detect-doc-drift`, `cleanup-dead-code`, `enforce-architecture`, and `diagnostics` as parallel agents. Phase 3 delegates fixes to `align-documentation` and `cleanup-dead-code`.
493
512
  - **State file** — `.harness/release-readiness.json` enables session resumption and progress tracking. This file is read at the start of each invocation and written at the end.
494
513
  - **Report file** — `release-readiness-report.md` is written to the project root. It is a snapshot, not a tracked artifact — regenerate it on each run.
514
+ - **i18n coverage** — When `i18n.enabled: true`, Phase 1 checks translation coverage against configured thresholds. Uses `harness-i18n` scan results and `harness-i18n-workflow` coverage tracking. Blocks release in strict mode if coverage is below `i18n.coverage.minimumPercent`.
495
515
 
496
516
  ## Success Criteria
497
517