@harness-engineering/cli 1.7.0 → 1.8.1

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 (187) 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/skills/claude-code/align-documentation/SKILL.md +13 -0
  4. package/dist/agents/skills/claude-code/cleanup-dead-code/SKILL.md +25 -1
  5. package/dist/agents/skills/claude-code/cleanup-dead-code/skill.yaml +5 -2
  6. package/dist/agents/skills/claude-code/detect-doc-drift/SKILL.md +12 -0
  7. package/dist/agents/skills/claude-code/enforce-architecture/SKILL.md +48 -1
  8. package/dist/agents/skills/claude-code/enforce-architecture/skill.yaml +5 -2
  9. package/dist/agents/skills/claude-code/harness-accessibility/SKILL.md +7 -0
  10. package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +11 -3
  11. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +81 -11
  12. package/dist/agents/skills/claude-code/harness-brainstorming/skill.yaml +2 -0
  13. package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +487 -234
  14. package/dist/agents/skills/claude-code/harness-code-review/skill.yaml +15 -2
  15. package/dist/agents/skills/claude-code/harness-codebase-cleanup/SKILL.md +226 -0
  16. package/dist/agents/skills/claude-code/harness-codebase-cleanup/skill.yaml +64 -0
  17. package/dist/agents/skills/claude-code/harness-dependency-health/SKILL.md +35 -6
  18. package/dist/agents/skills/claude-code/harness-docs-pipeline/SKILL.md +460 -0
  19. package/dist/agents/skills/claude-code/harness-docs-pipeline/skill.yaml +69 -0
  20. package/dist/agents/skills/claude-code/harness-execution/SKILL.md +73 -8
  21. package/dist/agents/skills/claude-code/harness-execution/skill.yaml +1 -0
  22. package/dist/agents/skills/claude-code/harness-hotspot-detector/SKILL.md +32 -6
  23. package/dist/agents/skills/claude-code/harness-i18n/SKILL.md +484 -0
  24. package/dist/agents/skills/claude-code/harness-i18n/skill.yaml +54 -0
  25. package/dist/agents/skills/claude-code/harness-i18n-process/SKILL.md +388 -0
  26. package/dist/agents/skills/claude-code/harness-i18n-process/skill.yaml +43 -0
  27. package/dist/agents/skills/claude-code/harness-i18n-workflow/SKILL.md +512 -0
  28. package/dist/agents/skills/claude-code/harness-i18n-workflow/skill.yaml +53 -0
  29. package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +35 -6
  30. package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +17 -1
  31. package/dist/agents/skills/claude-code/harness-knowledge-mapper/SKILL.md +46 -5
  32. package/dist/agents/skills/claude-code/harness-perf/SKILL.md +37 -8
  33. package/dist/agents/skills/claude-code/harness-perf/skill.yaml +3 -0
  34. package/dist/agents/skills/claude-code/harness-perf-tdd/SKILL.md +17 -4
  35. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +59 -5
  36. package/dist/agents/skills/claude-code/harness-planning/skill.yaml +2 -0
  37. package/dist/agents/skills/claude-code/harness-release-readiness/SKILL.md +16 -0
  38. package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +561 -0
  39. package/dist/agents/skills/claude-code/harness-roadmap/skill.yaml +43 -0
  40. package/dist/agents/skills/claude-code/harness-security-review/SKILL.md +36 -2
  41. package/dist/agents/skills/claude-code/harness-security-review/skill.yaml +8 -6
  42. package/dist/agents/skills/claude-code/harness-soundness-review/SKILL.md +1267 -0
  43. package/dist/agents/skills/claude-code/harness-soundness-review/skill.yaml +48 -0
  44. package/dist/agents/skills/claude-code/harness-test-advisor/SKILL.md +35 -6
  45. package/dist/agents/skills/claude-code/harness-verification/SKILL.md +66 -0
  46. package/dist/agents/skills/claude-code/harness-verification/skill.yaml +1 -0
  47. package/dist/agents/skills/claude-code/harness-verify/SKILL.md +11 -0
  48. package/dist/agents/skills/claude-code/initialize-harness-project/SKILL.md +15 -1
  49. package/dist/agents/skills/claude-code/validate-context-engineering/SKILL.md +12 -0
  50. package/dist/agents/skills/gemini-cli/add-harness-component/SKILL.md +192 -0
  51. package/dist/agents/skills/gemini-cli/add-harness-component/skill.yaml +32 -0
  52. package/dist/agents/skills/gemini-cli/align-documentation/SKILL.md +213 -0
  53. package/dist/agents/skills/gemini-cli/align-documentation/skill.yaml +31 -0
  54. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/SKILL.md +191 -0
  55. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/skill.yaml +32 -0
  56. package/dist/agents/skills/gemini-cli/cleanup-dead-code/SKILL.md +245 -0
  57. package/dist/agents/skills/gemini-cli/cleanup-dead-code/skill.yaml +33 -0
  58. package/dist/agents/skills/gemini-cli/detect-doc-drift/SKILL.md +179 -0
  59. package/dist/agents/skills/gemini-cli/detect-doc-drift/skill.yaml +30 -0
  60. package/dist/agents/skills/gemini-cli/enforce-architecture/SKILL.md +240 -0
  61. package/dist/agents/skills/gemini-cli/enforce-architecture/skill.yaml +34 -0
  62. package/dist/agents/skills/gemini-cli/harness-accessibility/SKILL.md +7 -0
  63. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/SKILL.md +397 -0
  64. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/skill.yaml +48 -0
  65. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +11 -3
  66. package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +317 -0
  67. package/dist/agents/skills/gemini-cli/harness-brainstorming/skill.yaml +49 -0
  68. package/dist/agents/skills/gemini-cli/harness-code-review/SKILL.md +681 -0
  69. package/dist/agents/skills/gemini-cli/harness-code-review/skill.yaml +45 -0
  70. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/SKILL.md +226 -0
  71. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/skill.yaml +64 -0
  72. package/dist/agents/skills/gemini-cli/harness-debugging/SKILL.md +366 -0
  73. package/dist/agents/skills/gemini-cli/harness-debugging/skill.yaml +47 -0
  74. package/dist/agents/skills/gemini-cli/harness-dependency-health/SKILL.md +35 -6
  75. package/dist/agents/skills/gemini-cli/harness-diagnostics/SKILL.md +318 -0
  76. package/dist/agents/skills/gemini-cli/harness-diagnostics/skill.yaml +50 -0
  77. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/SKILL.md +460 -0
  78. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/skill.yaml +69 -0
  79. package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +382 -0
  80. package/dist/agents/skills/gemini-cli/harness-execution/skill.yaml +51 -0
  81. package/dist/agents/skills/gemini-cli/harness-git-workflow/SKILL.md +268 -0
  82. package/dist/agents/skills/gemini-cli/harness-git-workflow/skill.yaml +31 -0
  83. package/dist/agents/skills/gemini-cli/harness-hotspot-detector/SKILL.md +32 -6
  84. package/dist/agents/skills/gemini-cli/harness-i18n/SKILL.md +484 -0
  85. package/dist/agents/skills/gemini-cli/harness-i18n/skill.yaml +54 -0
  86. package/dist/agents/skills/gemini-cli/harness-i18n-process/SKILL.md +388 -0
  87. package/dist/agents/skills/gemini-cli/harness-i18n-process/skill.yaml +43 -0
  88. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/SKILL.md +512 -0
  89. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/skill.yaml +53 -0
  90. package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +35 -6
  91. package/dist/agents/skills/gemini-cli/harness-integrity/SKILL.md +167 -0
  92. package/dist/agents/skills/gemini-cli/harness-integrity/skill.yaml +47 -0
  93. package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/SKILL.md +46 -5
  94. package/dist/agents/skills/gemini-cli/harness-onboarding/SKILL.md +288 -0
  95. package/dist/agents/skills/gemini-cli/harness-onboarding/skill.yaml +30 -0
  96. package/dist/agents/skills/gemini-cli/harness-parallel-agents/SKILL.md +171 -0
  97. package/dist/agents/skills/gemini-cli/harness-parallel-agents/skill.yaml +33 -0
  98. package/dist/agents/skills/gemini-cli/harness-perf/SKILL.md +37 -8
  99. package/dist/agents/skills/gemini-cli/harness-perf/skill.yaml +3 -0
  100. package/dist/agents/skills/gemini-cli/harness-perf-tdd/SKILL.md +17 -4
  101. package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +389 -0
  102. package/dist/agents/skills/gemini-cli/harness-planning/skill.yaml +49 -0
  103. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/SKILL.md +262 -0
  104. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/skill.yaml +33 -0
  105. package/dist/agents/skills/gemini-cli/harness-refactoring/SKILL.md +169 -0
  106. package/dist/agents/skills/gemini-cli/harness-refactoring/skill.yaml +33 -0
  107. package/dist/agents/skills/gemini-cli/harness-release-readiness/SKILL.md +16 -0
  108. package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +561 -0
  109. package/dist/agents/skills/gemini-cli/harness-roadmap/skill.yaml +43 -0
  110. package/dist/agents/skills/gemini-cli/harness-security-review/skill.yaml +8 -6
  111. package/dist/agents/skills/gemini-cli/harness-skill-authoring/SKILL.md +292 -0
  112. package/dist/agents/skills/gemini-cli/harness-skill-authoring/skill.yaml +32 -0
  113. package/dist/agents/skills/gemini-cli/harness-soundness-review/SKILL.md +1267 -0
  114. package/dist/agents/skills/gemini-cli/harness-soundness-review/skill.yaml +48 -0
  115. package/dist/agents/skills/gemini-cli/harness-state-management/SKILL.md +309 -0
  116. package/dist/agents/skills/gemini-cli/harness-state-management/skill.yaml +32 -0
  117. package/dist/agents/skills/gemini-cli/harness-tdd/SKILL.md +177 -0
  118. package/dist/agents/skills/gemini-cli/harness-tdd/skill.yaml +48 -0
  119. package/dist/agents/skills/gemini-cli/harness-test-advisor/SKILL.md +35 -6
  120. package/dist/agents/skills/gemini-cli/harness-verification/SKILL.md +328 -0
  121. package/dist/agents/skills/gemini-cli/harness-verification/skill.yaml +42 -0
  122. package/dist/agents/skills/gemini-cli/harness-verify/SKILL.md +159 -0
  123. package/dist/agents/skills/gemini-cli/harness-verify/skill.yaml +40 -0
  124. package/dist/agents/skills/gemini-cli/initialize-harness-project/SKILL.md +224 -0
  125. package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +31 -0
  126. package/dist/agents/skills/gemini-cli/validate-context-engineering/SKILL.md +150 -0
  127. package/dist/agents/skills/gemini-cli/validate-context-engineering/skill.yaml +31 -0
  128. package/dist/agents/skills/shared/i18n-knowledge/accessibility/intersection.yaml +142 -0
  129. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/encoding.yaml +67 -0
  130. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/formatting.yaml +106 -0
  131. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/layout.yaml +80 -0
  132. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/pluralization.yaml +80 -0
  133. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/string-handling.yaml +106 -0
  134. package/dist/agents/skills/shared/i18n-knowledge/frameworks/android-resources.yaml +47 -0
  135. package/dist/agents/skills/shared/i18n-knowledge/frameworks/apple-strings.yaml +47 -0
  136. package/dist/agents/skills/shared/i18n-knowledge/frameworks/backend-patterns.yaml +50 -0
  137. package/dist/agents/skills/shared/i18n-knowledge/frameworks/flutter-intl.yaml +47 -0
  138. package/dist/agents/skills/shared/i18n-knowledge/frameworks/i18next.yaml +47 -0
  139. package/dist/agents/skills/shared/i18n-knowledge/frameworks/react-intl.yaml +47 -0
  140. package/dist/agents/skills/shared/i18n-knowledge/frameworks/vue-i18n.yaml +47 -0
  141. package/dist/agents/skills/shared/i18n-knowledge/industries/ecommerce.yaml +66 -0
  142. package/dist/agents/skills/shared/i18n-knowledge/industries/fintech.yaml +66 -0
  143. package/dist/agents/skills/shared/i18n-knowledge/industries/gaming.yaml +69 -0
  144. package/dist/agents/skills/shared/i18n-knowledge/industries/healthcare.yaml +66 -0
  145. package/dist/agents/skills/shared/i18n-knowledge/industries/legal.yaml +66 -0
  146. package/dist/agents/skills/shared/i18n-knowledge/locales/ar.yaml +41 -0
  147. package/dist/agents/skills/shared/i18n-knowledge/locales/de.yaml +35 -0
  148. package/dist/agents/skills/shared/i18n-knowledge/locales/en.yaml +32 -0
  149. package/dist/agents/skills/shared/i18n-knowledge/locales/es.yaml +35 -0
  150. package/dist/agents/skills/shared/i18n-knowledge/locales/fi.yaml +35 -0
  151. package/dist/agents/skills/shared/i18n-knowledge/locales/fr.yaml +35 -0
  152. package/dist/agents/skills/shared/i18n-knowledge/locales/he.yaml +41 -0
  153. package/dist/agents/skills/shared/i18n-knowledge/locales/hi.yaml +35 -0
  154. package/dist/agents/skills/shared/i18n-knowledge/locales/it.yaml +32 -0
  155. package/dist/agents/skills/shared/i18n-knowledge/locales/ja.yaml +38 -0
  156. package/dist/agents/skills/shared/i18n-knowledge/locales/ko.yaml +38 -0
  157. package/dist/agents/skills/shared/i18n-knowledge/locales/nl.yaml +32 -0
  158. package/dist/agents/skills/shared/i18n-knowledge/locales/pl.yaml +35 -0
  159. package/dist/agents/skills/shared/i18n-knowledge/locales/pt.yaml +32 -0
  160. package/dist/agents/skills/shared/i18n-knowledge/locales/ru.yaml +35 -0
  161. package/dist/agents/skills/shared/i18n-knowledge/locales/sv.yaml +32 -0
  162. package/dist/agents/skills/shared/i18n-knowledge/locales/th.yaml +35 -0
  163. package/dist/agents/skills/shared/i18n-knowledge/locales/tr.yaml +35 -0
  164. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hans.yaml +38 -0
  165. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hant.yaml +35 -0
  166. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/i18next-mcp.yaml +56 -0
  167. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lingo-dev.yaml +56 -0
  168. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lokalise.yaml +60 -0
  169. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/tolgee.yaml +60 -0
  170. package/dist/agents/skills/shared/i18n-knowledge/testing/locale-testing.yaml +107 -0
  171. package/dist/agents/skills/shared/i18n-knowledge/testing/pseudo-localization.yaml +86 -0
  172. package/dist/bin/harness.js +64 -4
  173. package/dist/{chunk-GA6GN5J2.js → chunk-E2RTDBMG.js} +2263 -41
  174. package/dist/{chunk-FFIX3QVG.js → chunk-KJANDVVC.js} +141 -49
  175. package/dist/{chunk-4WUGOJQ7.js → chunk-RT2LYQHF.js} +1 -1
  176. package/dist/{dist-C4J67MPP.js → dist-CCM3L3UE.js} +95 -1
  177. package/dist/{dist-N4D4QWFV.js → dist-K6KTTN3I.js} +4 -4
  178. package/dist/index.d.ts +187 -7
  179. package/dist/index.js +7 -3
  180. package/dist/validate-cross-check-ZGKFQY57.js +7 -0
  181. package/package.json +9 -9
  182. package/dist/agents/skills/node_modules/.bin/glob +0 -17
  183. package/dist/agents/skills/node_modules/.bin/vitest +0 -17
  184. package/dist/agents/skills/node_modules/.bin/yaml +0 -17
  185. package/dist/templates/advanced/docs/specs/.gitkeep +0 -0
  186. package/dist/templates/intermediate/docs/specs/.gitkeep +0 -0
  187. package/dist/validate-cross-check-WGXQ7K62.js +0 -7
@@ -0,0 +1,213 @@
1
+ # Align Documentation
2
+
3
+ > Sync documentation with code after implementation changes. Keep AGENTS.md, API docs, and architecture docs accurate by mapping code changes to their documentation impact.
4
+
5
+ ## When to Use
6
+
7
+ - After completing a feature implementation (post-merge or post-commit)
8
+ - After fixing a bug that changes observable behavior
9
+ - After a refactoring that renames, moves, or restructures code
10
+ - When detect-doc-drift reports findings that need fixing
11
+ - When `on_post_feature` or `on_post_merge` triggers fire
12
+ - NOT during active development — wait until the code is stable
13
+ - NOT for creating documentation for a brand-new project (use validate-context-engineering for initial setup)
14
+ - NOT for fixing code — this skill only changes documentation
15
+
16
+ ## Process
17
+
18
+ ### Phase 1: Detect — Identify What Changed
19
+
20
+ 1. **Run `git diff` against the appropriate baseline.** Choose the baseline based on context:
21
+ - After a feature: diff against the branch point (`git diff main...HEAD`)
22
+ - After a bug fix: diff against the commit before the fix
23
+ - After a refactoring: diff against the commit before refactoring started
24
+ - Periodic sync: diff against the last documentation sync commit
25
+
26
+ 2. **Extract the list of changed files.** For each changed file, note:
27
+ - File path (current and previous if renamed/moved)
28
+ - Nature of change (added, modified, deleted, renamed)
29
+ - Changed exports (new, removed, renamed, signature changed)
30
+ - Changed behavior (different return values, new error types, new side effects)
31
+
32
+ 3. **Run `harness check-docs`** to identify any documentation that already has broken references due to the changes.
33
+
34
+ ### Graph-Enhanced Context (when available)
35
+
36
+ When a knowledge graph exists at `.harness/graph/`, use graph queries for faster, more accurate context:
37
+
38
+ - `query_graph` — find `documents` edges pointing to nodes changed in this diff
39
+ - `get_impact` — auto-suggest which docs need updating after code changes
40
+
41
+ Replaces manual doc-to-code correlation. Fall back to file-based commands if no graph is available.
42
+
43
+ ### Pipeline Context (when orchestrated)
44
+
45
+ When invoked by `harness-docs-pipeline`, check for a `pipeline` field in `.harness/handoff.json`:
46
+
47
+ - If `pipeline` field exists: read `DocPipelineContext` from it
48
+ - Read `pipeline.driftFindings` to know which fixes to apply (pre-classified by safety)
49
+ - If `pipeline.fixBatch` is set, apply only those specific fixes rather than running full detection
50
+ - Write applied fixes as `DocFix[]` back to `pipeline.fixesApplied`
51
+ - This enables the convergence loop to track fix verification status
52
+ - If `pipeline` field does not exist: behave exactly as today (standalone mode)
53
+
54
+ No changes to the skill's interface or output format — the pipeline field is purely additive.
55
+
56
+ ### Phase 2: Map — Connect Code Changes to Documentation
57
+
58
+ For each changed file, identify all documentation that references it:
59
+
60
+ **AGENTS.md sections:**
61
+
62
+ - Knowledge map entries that reference the file path
63
+ - Architecture descriptions that mention the module
64
+ - Constraint documentation that references the file's layer or patterns
65
+ - Onboarding guides that walk through the file
66
+
67
+ **API documentation:**
68
+
69
+ - JSDoc/TSDoc comments in the changed files themselves
70
+ - Generated API doc pages that pull from the changed files
71
+ - README examples that demonstrate the changed functions
72
+ - Tutorial or guide pages that use the changed code
73
+
74
+ **Architecture documentation:**
75
+
76
+ - Diagrams that include the changed module
77
+ - Data flow descriptions that reference the changed functions
78
+ - Layer descriptions that list the changed file
79
+ - Dependency documentation that references the changed imports
80
+
81
+ **Inline code comments:**
82
+
83
+ - Comments in OTHER files that reference the changed file or function
84
+ - TODO comments that reference the changed behavior
85
+ - Workaround comments that may no longer apply after the change
86
+
87
+ ### Phase 3: Generate — Draft Documentation Updates
88
+
89
+ For each affected documentation location:
90
+
91
+ 1. **Draft the specific text change.** Show the old text and the new text. Keep the existing style and tone — documentation updates should be invisible in terms of voice.
92
+
93
+ 2. **Preserve context.** When updating a section, do not just change the specific reference — read the surrounding paragraph and ensure it still makes sense. A renamed function may require updating the explanatory text around it, not just the function name.
94
+
95
+ 3. **Handle deletions carefully.** When code is deleted, do not just delete the documentation reference. Consider whether the section should be removed entirely, replaced with information about the replacement, or noted as deprecated.
96
+
97
+ 4. **Add new sections when needed.** If a new module was added, draft a complete documentation section following the existing AGENTS.md structure and style.
98
+
99
+ ### Phase 4: Validate — Verify Documentation Accuracy
100
+
101
+ 1. **Run `harness check-docs`** to verify all links and references resolve correctly after the updates.
102
+
103
+ 2. **Cross-check each update against the actual code.** Read the updated documentation and verify every claim by looking at the code. Documentation that is wrong is worse than documentation that is missing.
104
+
105
+ 3. **Verify no orphaned references remain.** Search documentation files for any remaining references to old names, old paths, or deleted features.
106
+
107
+ 4. **Run `harness fix-drift`** to catch any remaining simple drift issues that manual review missed.
108
+
109
+ ### Graph Refresh
110
+
111
+ If a knowledge graph exists at `.harness/graph/`, refresh it after code changes to keep graph queries accurate:
112
+
113
+ ```
114
+ harness scan [path]
115
+ ```
116
+
117
+ Skipping this step means subsequent graph queries (impact analysis, dependency health, test advisor) may return stale results.
118
+
119
+ 5. **Commit the documentation update.** Use a commit message that references the original change: "docs: update AGENTS.md for notification service refactoring" or "docs: sync API docs after auth module rename."
120
+
121
+ ## What to Update
122
+
123
+ ### AGENTS.md Knowledge Map
124
+
125
+ - File paths and module names (renamed or moved files)
126
+ - Module purpose descriptions (changed responsibilities)
127
+ - Constraint descriptions (new or changed rules)
128
+ - Relationship descriptions (new or changed dependencies)
129
+ - Gotcha sections (resolved gotchas, new gotchas)
130
+
131
+ ### Inline Code Comments
132
+
133
+ - Function/class doc comments in the changed files (JSDoc, TSDoc)
134
+ - Comments in other files that reference the changed code
135
+ - TODO comments that reference completed or changed work
136
+ - Workaround comments for issues that may now be resolved
137
+
138
+ ### Documentation Pages (docs/)
139
+
140
+ - API reference pages that describe changed functions
141
+ - Architecture pages that diagram changed modules
142
+ - Tutorial and guide pages that demonstrate changed code
143
+ - Getting-started guides if entry points changed
144
+ - Changelog entries for user-facing changes
145
+
146
+ ## Harness Integration
147
+
148
+ - **`harness check-docs`** — Run before and after updates. Identifies broken references and validates that all documentation links resolve.
149
+ - **`harness fix-drift`** — Auto-fix simple drift issues (broken file paths, renamed references) after manual review confirms correctness.
150
+ - **`harness fix-drift --json`** — Machine-readable output for tracking what was auto-fixed.
151
+ - **`harness validate`** — Run after documentation changes to verify overall project health is maintained.
152
+
153
+ ## Success Criteria
154
+
155
+ - `harness check-docs` passes with zero errors after documentation updates
156
+ - Every code change from the diff has been mapped to its documentation impact
157
+ - All file paths in documentation match current file locations
158
+ - All function/class names in documentation match current code
159
+ - All behavioral descriptions in documentation match current implementation
160
+ - Documentation updates are committed with clear references to the triggering code change
161
+ - No orphaned references to old names, paths, or deleted features remain
162
+
163
+ ## Examples
164
+
165
+ ### Example: Syncing docs after a module rename
166
+
167
+ **Code change:** `src/services/mailer.ts` renamed to `src/services/email-service.ts`. Functions `sendMail()` and `formatMailBody()` renamed to `sendEmail()` and `formatEmailBody()`.
168
+
169
+ **Documentation impact map:**
170
+
171
+ ```
172
+ AGENTS.md:34 — "mailer.ts handles email delivery" → update path and description
173
+ AGENTS.md:78 — "Use sendMail() for all outbound email" → update function name
174
+ docs/api.md:156 — sendMail() API reference → update name and import path
175
+ docs/arch.md:45 — architecture diagram lists "mailer" → update to "email-service"
176
+ src/controllers/user-controller.ts:12 — comment "// delegates to mailer" → update
177
+ ```
178
+
179
+ **Updates applied:**
180
+
181
+ - AGENTS.md: updated two sections with new file path and function names
182
+ - docs/api.md: updated function reference and import example
183
+ - docs/arch.md: updated module name in architecture description
184
+ - src/controllers/user-controller.ts: updated inline comment
185
+
186
+ **Validation:** `harness check-docs` passes. All references resolve. Commit: "docs: sync documentation after mailer rename to email-service"
187
+
188
+ ### Example: Syncing docs after adding error handling
189
+
190
+ **Code change:** `createUser()` in `src/services/user-service.ts` now throws `ValidationError` instead of returning `null` on invalid input.
191
+
192
+ **Documentation impact map:**
193
+
194
+ ```
195
+ docs/api.md:89 — "Returns null if validation fails" → update to describe thrown error
196
+ AGENTS.md:52 — No mention of error handling → add note about ValidationError
197
+ src/services/user-service.ts:15 — JSDoc @returns tag → update, add @throws tag
198
+ ```
199
+
200
+ **Updates applied:**
201
+
202
+ - docs/api.md: replaced "returns null" with "throws ValidationError" and added example
203
+ - AGENTS.md: added note about error handling pattern in user-service section
204
+ - JSDoc: updated @returns, added @throws ValidationError
205
+
206
+ **Validation:** `harness check-docs` passes. Commit: "docs: update documentation for createUser error handling change"
207
+
208
+ ## Escalation
209
+
210
+ - **When you cannot determine what documentation is affected:** Run `harness check-docs` for automated detection. For manual analysis, search all `.md` files and code comments for the old name/path. If the change is large, use detect-doc-drift first to get a complete inventory.
211
+ - **When documentation is in an external system (wiki, Confluence):** Document the needed change and flag it for manual update. Include the specific text that needs changing and the correct replacement.
212
+ - **When the code change is so large that documentation needs a rewrite:** Break the documentation update into sections. Update one section at a time, validating after each. Do not attempt a full rewrite in one pass.
213
+ - **When you disagree with the existing documentation style:** Follow the existing style. Documentation alignment is about accuracy, not style improvement. Style changes should be a separate, deliberate effort.
@@ -0,0 +1,31 @@
1
+ name: align-documentation
2
+ version: "1.0.0"
3
+ description: Auto-fix documentation drift issues
4
+ cognitive_mode: meticulous-verifier
5
+ triggers:
6
+ - manual
7
+ platforms:
8
+ - claude-code
9
+ - gemini-cli
10
+ tools:
11
+ - Bash
12
+ - Read
13
+ - Write
14
+ - Edit
15
+ cli:
16
+ command: harness skill run align-documentation
17
+ args:
18
+ - name: path
19
+ description: Project root path
20
+ required: false
21
+ mcp:
22
+ tool: run_skill
23
+ input:
24
+ skill: align-documentation
25
+ path: string
26
+ type: flexible
27
+ state:
28
+ persistent: false
29
+ files: []
30
+ depends_on:
31
+ - detect-doc-drift
@@ -0,0 +1,191 @@
1
+ # Check Mechanical Constraints
2
+
3
+ > Run all mechanical constraint checks: linter rules, boundary schemas, and forbidden imports. These are automated, enforceable rules — if it can be checked by a machine, it must be.
4
+
5
+ ## When to Use
6
+
7
+ - Before every commit (ideally via pre-commit hook)
8
+ - Before submitting a pull request for review
9
+ - After any code generation or automated refactoring
10
+ - When `on_pre_commit` or `on_validate` triggers fire
11
+ - After resolving merge conflicts (constraints may have been silently violated)
12
+ - NOT as a substitute for code review — mechanical constraints catch structural issues, not logic errors
13
+ - NOT when only editing non-code files (docs, config) unless those files have their own schema constraints
14
+
15
+ ## Process
16
+
17
+ ### Phase 1: Run All Checks
18
+
19
+ 1. **Run `harness validate`** to check project-wide constraints: file structure, naming conventions, required files, and configuration validity.
20
+
21
+ 2. **Run `harness linter validate`** to check all linter rules: code style, import restrictions, forbidden patterns, and boundary schemas.
22
+
23
+ 3. **Run `harness check-deps`** to check architectural layer boundaries. This is included here because dependency violations are mechanical — they can be detected purely from import statements and the constraint config.
24
+
25
+ 4. **Capture all output.** Combine results from all three commands into a single violation list for triage.
26
+
27
+ ### Phase 2: Categorize Violations by Severity
28
+
29
+ Organize violations into three tiers:
30
+
31
+ **Tier 1 — Errors (must fix before commit):**
32
+
33
+ - Forbidden imports (importing banned modules)
34
+ - Layer boundary violations (importing across architectural boundaries)
35
+ - Schema violations (config files that do not match required schema)
36
+ - Missing required files (every package must have index.ts, etc.)
37
+
38
+ **Tier 2 — Warnings (must fix before merge):**
39
+
40
+ - Naming convention violations (wrong casing, wrong prefix)
41
+ - Import ordering issues
42
+ - Unused exports detected by linter
43
+ - Documentation file references that do not resolve
44
+
45
+ **Tier 3 — Info (fix when convenient):**
46
+
47
+ - Style suggestions (formatting that does not affect behavior)
48
+ - Complexity warnings (functions exceeding thresholds)
49
+ - Minor inconsistencies with project conventions
50
+
51
+ ### Phase 3: Auto-Fix Where Safe
52
+
53
+ Some violations can be fixed automatically without risk:
54
+
55
+ - **Import ordering** — reorder imports to match the configured convention. This never changes behavior.
56
+ - **Formatting** — apply the project's formatter (prettier, etc.). Pure whitespace and style changes.
57
+ - **Simple forbidden imports** — when a forbidden import has a known replacement (e.g., `import lodash` to `import lodash-es`), apply the substitution.
58
+ - **Missing trailing commas, semicolons** — mechanical formatting fixes.
59
+
60
+ **Rules for auto-fix:**
61
+
62
+ - ONLY auto-fix violations that cannot change runtime behavior
63
+ - Run the test suite after auto-fixing to confirm nothing broke
64
+ - Present the auto-fix diff to the user for awareness (do not silently change code)
65
+ - If unsure whether a fix is safe, do NOT auto-fix — report it for manual resolution
66
+
67
+ ### Phase 4: Report Remaining Violations
68
+
69
+ For each violation that was not auto-fixed, report:
70
+
71
+ 1. **File and line number** — exact location of the violation
72
+ 2. **Rule name** — which constraint was violated
73
+ 3. **What it protects against** — why this rule exists (see reference below)
74
+ 4. **How to fix** — specific guidance for resolving this type of violation
75
+ 5. **Severity tier** — whether it blocks commit, merge, or is informational
76
+
77
+ ## What Each Constraint Type Protects Against
78
+
79
+ ### Forbidden Imports
80
+
81
+ **Protects against:** Implementation detail leakage and unwanted coupling. When a library is forbidden in a layer, it is because using it there would create a dependency that makes the layer harder to test, replace, or maintain. Example: forbidding `fs` in the UI layer ensures UI code never directly accesses the filesystem.
82
+
83
+ ### Layer Boundaries
84
+
85
+ **Protects against:** Architectural erosion. Without enforced boundaries, codebases gradually become a tangle where everything depends on everything. Layer boundaries ensure changes in one area do not ripple unpredictably through the whole system.
86
+
87
+ ### Boundary Schemas
88
+
89
+ **Protects against:** Configuration drift and invalid state. When config files must match a schema, you catch invalid configurations at lint time rather than at runtime. This prevents deployment failures and hard-to-debug runtime errors.
90
+
91
+ ### Naming Conventions
92
+
93
+ **Protects against:** Cognitive overhead and inconsistency. Consistent naming means developers (human and AI) can predict file locations, function names, and module structure without searching. It also ensures automated tools that rely on naming patterns continue to work.
94
+
95
+ ### Required File Rules
96
+
97
+ **Protects against:** Incomplete modules. When every package must have an `index.ts` or every component must have a test file, you ensure that the project structure remains complete and navigable.
98
+
99
+ ### Import Ordering
100
+
101
+ **Protects against:** Merge conflicts and readability issues. Consistent import ordering reduces git conflicts when multiple developers add imports to the same file. It also makes imports scannable at a glance.
102
+
103
+ ## Harness Integration
104
+
105
+ - **`harness validate`** — Project-wide structural validation. Checks file structure, naming conventions, required files, and configuration schemas.
106
+ - **`harness validate --json`** — Machine-readable output for parsing and categorization.
107
+ - **`harness linter validate`** — Runs all configured linter rules. Checks code patterns, import restrictions, and style conventions.
108
+ - **`harness check-deps`** — Architectural boundary enforcement. Checks all imports against the layer model.
109
+ - **`harness check-deps --json`** — Machine-readable dependency check output.
110
+
111
+ ## Success Criteria
112
+
113
+ - All three commands (`harness validate`, `harness linter validate`, `harness check-deps`) pass with zero errors
114
+ - All Tier 1 violations are resolved before any commit
115
+ - All Tier 2 violations are resolved before any merge to main
116
+ - Auto-fixed changes are verified by running the test suite
117
+ - No violations are suppressed without explicit team approval and a documented reason
118
+
119
+ ## Examples
120
+
121
+ ### Example: Forbidden import detected
122
+
123
+ **Violation:**
124
+
125
+ ```
126
+ ERROR [forbidden-import] src/components/Dashboard.tsx:3
127
+ Import 'pg' is forbidden in layer 'ui'
128
+ Rule: ui layer must not import database drivers
129
+ ```
130
+
131
+ **What it protects against:** The UI layer importing a PostgreSQL driver means UI code could execute raw SQL queries, bypassing the service and repository layers entirely. This breaks testability (tests need a real database) and security (SQL injection risk from UI layer).
132
+
133
+ **Fix:** Remove the direct database call. Add the needed query to the appropriate repository, expose it through the service layer, and call the service from the UI component.
134
+
135
+ ### Example: Auto-fixable import ordering
136
+
137
+ **Violation:**
138
+
139
+ ```
140
+ WARNING [import-order] src/services/auth-service.ts:1-8
141
+ Imports are not in the configured order
142
+ Expected: builtin -> external -> internal -> relative
143
+ Found: relative -> external -> builtin
144
+ ```
145
+
146
+ **Auto-fix applied:**
147
+
148
+ ```typescript
149
+ // BEFORE
150
+ import { hashPassword } from './utils';
151
+ import bcrypt from 'bcrypt';
152
+ import { createHash } from 'crypto';
153
+
154
+ // AFTER (auto-fixed)
155
+ import { createHash } from 'crypto';
156
+ import bcrypt from 'bcrypt';
157
+ import { hashPassword } from './utils';
158
+ ```
159
+
160
+ Tests re-run: all passing. No behavioral change.
161
+
162
+ ### Example: Schema violation in config
163
+
164
+ **Violation:**
165
+
166
+ ```
167
+ ERROR [schema-violation] harness.config.json:24
168
+ Property 'layers[2].allowedImports' must be an array of strings
169
+ Found: number (42)
170
+ Schema: harness-config-schema.json#/properties/layers/items/properties/allowedImports
171
+ ```
172
+
173
+ **What it protects against:** An invalid config means `harness check-deps` will either crash or silently skip validation. The layer constraints would not be enforced, allowing violations to slip through undetected.
174
+
175
+ **Fix:** Correct the config value to be a valid string array: `"allowedImports": ["@shared/types", "@shared/utils"]`.
176
+
177
+ ## Gates
178
+
179
+ These are hard stops. Mechanical constraints are non-negotiable.
180
+
181
+ - **No commits with Tier 1 violations.** Errors must be resolved before the code is committed. No exceptions.
182
+ - **No merges with Tier 2 violations.** Warnings must be resolved before merging to the main branch.
183
+ - **No suppressing rules without documentation.** If a rule must be disabled for a specific line or file, the suppression comment must explain WHY (not just disable the rule).
184
+ - **No auto-fix without test verification.** Every auto-fix must be followed by a test run to confirm no behavioral change.
185
+
186
+ ## Escalation
187
+
188
+ - **When a rule seems wrong for the project:** Rules are configured in `harness.config.json` and linter configs. If a rule does not fit, propose a config change with justification. Do not disable the rule inline.
189
+ - **When a violation cannot be fixed without a larger refactor:** Document the violation, create a task for the refactor, and get team approval for a temporary inline suppression with a TODO linking to the task.
190
+ - **When auto-fix produces unexpected changes:** Undo the auto-fix, report the issue, and fix manually. Auto-fix tools are not infallible.
191
+ - **When multiple constraints conflict:** The stricter constraint wins. If `harness validate` says a file is required but `harness linter validate` says its contents violate a rule, fix the contents to satisfy both. Escalate if truly irreconcilable.
@@ -0,0 +1,32 @@
1
+ name: check-mechanical-constraints
2
+ version: "1.0.0"
3
+ description: Run all mechanical constraint checks (context validation + architecture)
4
+ cognitive_mode: meticulous-verifier
5
+ triggers:
6
+ - manual
7
+ - on_pr
8
+ platforms:
9
+ - claude-code
10
+ - gemini-cli
11
+ tools:
12
+ - Bash
13
+ - Read
14
+ - Glob
15
+ cli:
16
+ command: harness skill run check-mechanical-constraints
17
+ args:
18
+ - name: path
19
+ description: Project root path
20
+ required: false
21
+ mcp:
22
+ tool: run_skill
23
+ input:
24
+ skill: check-mechanical-constraints
25
+ path: string
26
+ type: rigid
27
+ state:
28
+ persistent: false
29
+ files: []
30
+ depends_on:
31
+ - validate-context-engineering
32
+ - enforce-architecture