@harness-engineering/cli 1.26.0 → 1.26.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 (179) hide show
  1. package/dist/agents/skills/README.md +1 -0
  2. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +33 -5
  3. package/dist/agents/skills/claude-code/harness-execution/SKILL.md +6 -0
  4. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +25 -1
  5. package/dist/agents/skills/claude-code/initialize-harness-project/SKILL.md +22 -6
  6. package/dist/agents/skills/claude-code/initialize-harness-project/skill.yaml +2 -1
  7. package/dist/agents/skills/claude-code/initialize-test-suite-project/SKILL.md +415 -0
  8. package/dist/agents/skills/claude-code/initialize-test-suite-project/skill.yaml +35 -0
  9. package/dist/agents/skills/codex/harness-brainstorming/SKILL.md +33 -5
  10. package/dist/agents/skills/codex/harness-execution/SKILL.md +6 -0
  11. package/dist/agents/skills/codex/harness-planning/SKILL.md +25 -1
  12. package/dist/agents/skills/codex/initialize-harness-project/SKILL.md +22 -6
  13. package/dist/agents/skills/codex/initialize-harness-project/skill.yaml +2 -1
  14. package/dist/agents/skills/codex/initialize-test-suite-project/SKILL.md +415 -0
  15. package/dist/agents/skills/codex/initialize-test-suite-project/skill.yaml +35 -0
  16. package/dist/agents/skills/cursor/harness-brainstorming/SKILL.md +33 -5
  17. package/dist/agents/skills/cursor/harness-execution/SKILL.md +6 -0
  18. package/dist/agents/skills/cursor/harness-planning/SKILL.md +25 -1
  19. package/dist/agents/skills/cursor/initialize-harness-project/SKILL.md +22 -6
  20. package/dist/agents/skills/cursor/initialize-harness-project/skill.yaml +2 -1
  21. package/dist/agents/skills/cursor/initialize-test-suite-project/SKILL.md +415 -0
  22. package/dist/agents/skills/cursor/initialize-test-suite-project/skill.yaml +35 -0
  23. package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +33 -5
  24. package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +6 -0
  25. package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +25 -1
  26. package/dist/agents/skills/gemini-cli/initialize-harness-project/SKILL.md +22 -6
  27. package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +2 -1
  28. package/dist/agents/skills/gemini-cli/initialize-test-suite-project/SKILL.md +415 -0
  29. package/dist/agents/skills/gemini-cli/initialize-test-suite-project/skill.yaml +35 -0
  30. package/dist/agents/skills/tests/initialize-test-suite-project.test.ts +152 -0
  31. package/dist/{agents-md-OPOZA5L7.js → agents-md-VI3HLR7E.js} +3 -3
  32. package/dist/{architecture-PMVMO6SF.js → architecture-ZDDKEVID.js} +4 -4
  33. package/dist/{assess-project-ZW7EKNIT.js → assess-project-Y6W7YDUA.js} +1 -1
  34. package/dist/bin/harness-mcp.js +16 -15
  35. package/dist/bin/harness.js +27 -27
  36. package/dist/{check-phase-gate-NTLAU3LO.js → check-phase-gate-CXR3VM22.js} +4 -4
  37. package/dist/{chunk-CAS3TS4Y.js → chunk-2BPPS6YQ.js} +793 -94
  38. package/dist/{chunk-VV2PJT4K.js → chunk-2FPUPRCY.js} +777 -598
  39. package/dist/{chunk-IFHAUFJX.js → chunk-3AMQYWGT.js} +2 -2
  40. package/dist/{chunk-FI3D6D7U.js → chunk-56A6OXVA.js} +9 -9
  41. package/dist/{chunk-QYSWNPXZ.js → chunk-7GY6WNEI.js} +1 -1
  42. package/dist/{chunk-ZBQ3ZY75.js → chunk-AMRC4FU2.js} +44 -41
  43. package/dist/{chunk-JZ6GORAK.js → chunk-B66LRB5M.js} +1 -1
  44. package/dist/{chunk-KFE2X7LG.js → chunk-BK4DJIIY.js} +4 -4
  45. package/dist/{chunk-G6SYTGOH.js → chunk-DBIX3X4H.js} +2 -2
  46. package/dist/{chunk-KXIAHHHP.js → chunk-FUND5WJR.js} +2 -2
  47. package/dist/{chunk-JWSVLC4I.js → chunk-JV4Y2U5F.js} +1 -1
  48. package/dist/{chunk-RNAGPTKF.js → chunk-K56DTX7G.js} +6 -6
  49. package/dist/{chunk-EXTWTJRF.js → chunk-N6B6RKQQ.js} +1 -1
  50. package/dist/{chunk-JBJ4AVE4.js → chunk-NY7DTZ6K.js} +3 -3
  51. package/dist/{chunk-Z2JORLRT.js → chunk-OLW7BJ5N.js} +1 -1
  52. package/dist/{chunk-HAOBHL3W.js → chunk-ORNEK65Y.js} +1 -1
  53. package/dist/{chunk-7JNZXJKY.js → chunk-PNNFCVW4.js} +5 -5
  54. package/dist/{chunk-NIOB6FTG.js → chunk-Q3ZLVMQM.js} +1 -1
  55. package/dist/{chunk-NVGQO4VM.js → chunk-RAVD7QLY.js} +8 -8
  56. package/dist/{chunk-J3O64D2A.js → chunk-TSVYBDDE.js} +1 -1
  57. package/dist/{chunk-KSFUJT5B.js → chunk-TY2ESLVL.js} +1 -1
  58. package/dist/{chunk-4KSKV5MK.js → chunk-VKS3F46M.js} +1 -1
  59. package/dist/{chunk-UBRD5FH4.js → chunk-WZ7UHPT3.js} +9 -9
  60. package/dist/{chunk-77EZGPSR.js → chunk-YC4EYIER.js} +8 -2
  61. package/dist/{chunk-6SCA4NEZ.js → chunk-ZN6ROTYP.js} +1 -1
  62. package/dist/{ci-workflow-H52EMCL6.js → ci-workflow-EW37KVPS.js} +3 -3
  63. package/dist/{create-skill-6QWJHQYS.js → create-skill-4T5CBSJ2.js} +2 -2
  64. package/dist/{dist-TG63OKA5.js → dist-CJDGASPP.js} +2 -2
  65. package/dist/{dist-PGQ32ZI7.js → dist-NCNAXUFD.js} +1 -1
  66. package/dist/{docs-GP4VUSIB.js → docs-4XI2FQW2.js} +4 -4
  67. package/dist/{engine-KQG5RVXX.js → engine-4L4CDTHU.js} +3 -3
  68. package/dist/{entropy-RXESIYKC.js → entropy-PBYSIQYS.js} +3 -3
  69. package/dist/{feedback-HS7ZYXOU.js → feedback-OTIFW5MK.js} +1 -1
  70. package/dist/{generate-agent-definitions-I4B7CVOB.js → generate-agent-definitions-CZGUXIIN.js} +4 -4
  71. package/dist/{graph-loader-TIVI6NQ7.js → graph-loader-RDXSEBD7.js} +1 -1
  72. package/dist/index.js +27 -27
  73. package/dist/{loader-CWAH6B4H.js → loader-UZOXCWFC.js} +3 -3
  74. package/dist/{mcp-KHK5KYER.js → mcp-GWVVV6LH.js} +16 -15
  75. package/dist/{performance-WDW5WS3J.js → performance-5UQPP3XX.js} +4 -4
  76. package/dist/{review-pipeline-QOZGWCTY.js → review-pipeline-65V4EO6O.js} +3 -3
  77. package/dist/{runtime-SFEFRPLX.js → runtime-PXX7HNB3.js} +3 -3
  78. package/dist/{scan-IJ7EYTF7.js → scan-WM7XDUF7.js} +1 -1
  79. package/dist/{security-2K7UUK6T.js → security-CAYDRZIZ.js} +1 -1
  80. package/dist/{validate-HXM6DXRZ.js → validate-CWGXR7QM.js} +4 -4
  81. package/dist/{validate-cross-check-ULQLEOME.js → validate-cross-check-BKCNLZYG.js} +3 -3
  82. package/package.json +4 -4
  83. package/dist/agents/commands/claude-code/harness/harness.md +0 -36
  84. package/dist/agents/commands/codex/AGENTS.md +0 -39
  85. package/dist/agents/commands/codex/harness/add-harness-component/SKILL.md +0 -204
  86. package/dist/agents/commands/codex/harness/add-harness-component/agents/openai.yaml +0 -3
  87. package/dist/agents/commands/codex/harness/cleanup-dead-code/SKILL.md +0 -257
  88. package/dist/agents/commands/codex/harness/cleanup-dead-code/agents/openai.yaml +0 -3
  89. package/dist/agents/commands/codex/harness/detect-doc-drift/SKILL.md +0 -191
  90. package/dist/agents/commands/codex/harness/detect-doc-drift/agents/openai.yaml +0 -3
  91. package/dist/agents/commands/codex/harness/enforce-architecture/SKILL.md +0 -289
  92. package/dist/agents/commands/codex/harness/enforce-architecture/agents/openai.yaml +0 -3
  93. package/dist/agents/commands/codex/harness/harness-architecture-advisor/SKILL.md +0 -442
  94. package/dist/agents/commands/codex/harness/harness-architecture-advisor/agents/openai.yaml +0 -3
  95. package/dist/agents/commands/codex/harness/harness-autopilot/SKILL.md +0 -929
  96. package/dist/agents/commands/codex/harness/harness-autopilot/agents/openai.yaml +0 -3
  97. package/dist/agents/commands/codex/harness/harness-brainstorming/SKILL.md +0 -418
  98. package/dist/agents/commands/codex/harness/harness-brainstorming/agents/openai.yaml +0 -3
  99. package/dist/agents/commands/codex/harness/harness-code-review/SKILL.md +0 -850
  100. package/dist/agents/commands/codex/harness/harness-code-review/agents/openai.yaml +0 -3
  101. package/dist/agents/commands/codex/harness/harness-codebase-cleanup/SKILL.md +0 -236
  102. package/dist/agents/commands/codex/harness/harness-codebase-cleanup/agents/openai.yaml +0 -3
  103. package/dist/agents/commands/codex/harness/harness-debugging/SKILL.md +0 -378
  104. package/dist/agents/commands/codex/harness/harness-debugging/agents/openai.yaml +0 -3
  105. package/dist/agents/commands/codex/harness/harness-dependency-health/SKILL.md +0 -190
  106. package/dist/agents/commands/codex/harness/harness-dependency-health/agents/openai.yaml +0 -3
  107. package/dist/agents/commands/codex/harness/harness-docs-pipeline/SKILL.md +0 -472
  108. package/dist/agents/commands/codex/harness/harness-docs-pipeline/agents/openai.yaml +0 -3
  109. package/dist/agents/commands/codex/harness/harness-execution/SKILL.md +0 -522
  110. package/dist/agents/commands/codex/harness/harness-execution/agents/openai.yaml +0 -3
  111. package/dist/agents/commands/codex/harness/harness-hotspot-detector/SKILL.md +0 -172
  112. package/dist/agents/commands/codex/harness/harness-hotspot-detector/agents/openai.yaml +0 -3
  113. package/dist/agents/commands/codex/harness/harness-impact-analysis/SKILL.md +0 -195
  114. package/dist/agents/commands/codex/harness/harness-impact-analysis/agents/openai.yaml +0 -3
  115. package/dist/agents/commands/codex/harness/harness-integrity/SKILL.md +0 -178
  116. package/dist/agents/commands/codex/harness/harness-integrity/agents/openai.yaml +0 -3
  117. package/dist/agents/commands/codex/harness/harness-onboarding/SKILL.md +0 -299
  118. package/dist/agents/commands/codex/harness/harness-onboarding/agents/openai.yaml +0 -3
  119. package/dist/agents/commands/codex/harness/harness-perf/SKILL.md +0 -272
  120. package/dist/agents/commands/codex/harness/harness-perf/agents/openai.yaml +0 -3
  121. package/dist/agents/commands/codex/harness/harness-planning/SKILL.md +0 -592
  122. package/dist/agents/commands/codex/harness/harness-planning/agents/openai.yaml +0 -3
  123. package/dist/agents/commands/codex/harness/harness-refactoring/SKILL.md +0 -181
  124. package/dist/agents/commands/codex/harness/harness-refactoring/agents/openai.yaml +0 -3
  125. package/dist/agents/commands/codex/harness/harness-release-readiness/SKILL.md +0 -701
  126. package/dist/agents/commands/codex/harness/harness-release-readiness/agents/openai.yaml +0 -3
  127. package/dist/agents/commands/codex/harness/harness-roadmap/SKILL.md +0 -607
  128. package/dist/agents/commands/codex/harness/harness-roadmap/agents/openai.yaml +0 -3
  129. package/dist/agents/commands/codex/harness/harness-security-scan/SKILL.md +0 -147
  130. package/dist/agents/commands/codex/harness/harness-security-scan/agents/openai.yaml +0 -3
  131. package/dist/agents/commands/codex/harness/harness-skill-authoring/SKILL.md +0 -314
  132. package/dist/agents/commands/codex/harness/harness-skill-authoring/agents/openai.yaml +0 -3
  133. package/dist/agents/commands/codex/harness/harness-soundness-review/SKILL.md +0 -1280
  134. package/dist/agents/commands/codex/harness/harness-soundness-review/agents/openai.yaml +0 -3
  135. package/dist/agents/commands/codex/harness/harness-supply-chain-audit/SKILL.md +0 -255
  136. package/dist/agents/commands/codex/harness/harness-supply-chain-audit/agents/openai.yaml +0 -3
  137. package/dist/agents/commands/codex/harness/harness-tdd/SKILL.md +0 -189
  138. package/dist/agents/commands/codex/harness/harness-tdd/agents/openai.yaml +0 -3
  139. package/dist/agents/commands/codex/harness/harness-test-advisor/SKILL.md +0 -171
  140. package/dist/agents/commands/codex/harness/harness-test-advisor/agents/openai.yaml +0 -3
  141. package/dist/agents/commands/codex/harness/harness-verification/SKILL.md +0 -433
  142. package/dist/agents/commands/codex/harness/harness-verification/agents/openai.yaml +0 -3
  143. package/dist/agents/commands/codex/harness/harness-verify/SKILL.md +0 -170
  144. package/dist/agents/commands/codex/harness/harness-verify/agents/openai.yaml +0 -3
  145. package/dist/agents/commands/codex/harness/initialize-harness-project/SKILL.md +0 -244
  146. package/dist/agents/commands/codex/harness/initialize-harness-project/agents/openai.yaml +0 -3
  147. package/dist/agents/commands/cursor/harness/add-harness-component.mdc +0 -200
  148. package/dist/agents/commands/cursor/harness/cleanup-dead-code.mdc +0 -253
  149. package/dist/agents/commands/cursor/harness/detect-doc-drift.mdc +0 -187
  150. package/dist/agents/commands/cursor/harness/enforce-architecture.mdc +0 -304
  151. package/dist/agents/commands/cursor/harness/harness-architecture-advisor.mdc +0 -457
  152. package/dist/agents/commands/cursor/harness/harness-autopilot.mdc +0 -924
  153. package/dist/agents/commands/cursor/harness/harness-brainstorming.mdc +0 -414
  154. package/dist/agents/commands/cursor/harness/harness-code-review.mdc +0 -865
  155. package/dist/agents/commands/cursor/harness/harness-codebase-cleanup.mdc +0 -232
  156. package/dist/agents/commands/cursor/harness/harness-debugging.mdc +0 -374
  157. package/dist/agents/commands/cursor/harness/harness-dependency-health.mdc +0 -187
  158. package/dist/agents/commands/cursor/harness/harness-docs-pipeline.mdc +0 -468
  159. package/dist/agents/commands/cursor/harness/harness-execution.mdc +0 -518
  160. package/dist/agents/commands/cursor/harness/harness-hotspot-detector.mdc +0 -169
  161. package/dist/agents/commands/cursor/harness/harness-impact-analysis.mdc +0 -192
  162. package/dist/agents/commands/cursor/harness/harness-integrity.mdc +0 -175
  163. package/dist/agents/commands/cursor/harness/harness-onboarding.mdc +0 -296
  164. package/dist/agents/commands/cursor/harness/harness-perf.mdc +0 -268
  165. package/dist/agents/commands/cursor/harness/harness-planning.mdc +0 -587
  166. package/dist/agents/commands/cursor/harness/harness-refactoring.mdc +0 -177
  167. package/dist/agents/commands/cursor/harness/harness-release-readiness.mdc +0 -697
  168. package/dist/agents/commands/cursor/harness/harness-roadmap.mdc +0 -603
  169. package/dist/agents/commands/cursor/harness/harness-security-scan.mdc +0 -162
  170. package/dist/agents/commands/cursor/harness/harness-skill-authoring.mdc +0 -300
  171. package/dist/agents/commands/cursor/harness/harness-soundness-review.mdc +0 -1275
  172. package/dist/agents/commands/cursor/harness/harness-supply-chain-audit.mdc +0 -252
  173. package/dist/agents/commands/cursor/harness/harness-tdd.mdc +0 -185
  174. package/dist/agents/commands/cursor/harness/harness-test-advisor.mdc +0 -168
  175. package/dist/agents/commands/cursor/harness/harness-verification.mdc +0 -429
  176. package/dist/agents/commands/cursor/harness/harness-verify.mdc +0 -167
  177. package/dist/agents/commands/cursor/harness/initialize-harness-project.mdc +0 -240
  178. package/dist/agents/commands/gemini-cli/harness/harness.toml +0 -277
  179. package/dist/{chunk-RRHUCDRD.js → chunk-ZP5E7YET.js} +3 -3
@@ -1,191 +0,0 @@
1
- <!-- Generated by harness generate-slash-commands. Do not edit. -->
2
-
3
- # Detect Doc Drift
4
-
5
- > Detect documentation that has drifted from code. Find stale docs before they mislead developers and AI agents.
6
-
7
- ## When to Use
8
-
9
- - After completing a feature, bug fix, or refactoring
10
- - During code review — check if the changed files have associated docs that need updating
11
- - As a periodic hygiene check (weekly or per-sprint)
12
- - When `on_post_feature` or `on_doc_check` triggers fire
13
- - When onboarding reveals confusion caused by outdated documentation
14
- - NOT during active development — wait until the code is stable before checking docs
15
- - NOT for writing new documentation from scratch (use align-documentation instead)
16
-
17
- ## Process
18
-
19
- ### Phase 1: Scan — Run Drift Detection
20
-
21
- 1. **Run `harness check-docs`** to identify all documentation issues. Capture the full output.
22
-
23
- 2. **Run `harness cleanup --type drift`** for a deeper analysis that cross-references code changes against documentation references.
24
-
25
- 3. **Optionally, run `git diff` against a baseline** (last release, last sprint, etc.) to identify which code files changed. This helps prioritize — docs for recently changed files are most likely to be drifted.
26
-
27
- ### Graph-Enhanced Context (when available)
28
-
29
- When a knowledge graph exists at `.harness/graph/`, use graph queries for faster, more accurate drift detection:
30
-
31
- - `query_graph` — find `documents` edges where the target code node has changed since the doc node was last updated
32
-
33
- When a graph is available, drift is simply stale edges: doc-to-code edges where the code side has been modified more recently than the doc side. This replaces regex pattern matching and catches semantic drift that text search misses. Fall back to file-based commands if no graph is available.
34
-
35
- ### Pipeline Context (when orchestrated)
36
-
37
- When invoked by `harness-docs-pipeline`, check for a `pipeline` field in `.harness/handoff.json`:
38
-
39
- - If `pipeline` field exists: read `DocPipelineContext` from it
40
- - Use `pipeline.exclusions` to skip findings that were already addressed in a previous phase
41
- - Write `DriftFinding[]` results back to `pipeline.driftFindings` in handoff.json
42
- - This enables the orchestrator to track findings across phases and avoid double-counting
43
- - If `pipeline` field does not exist: behave exactly as today (standalone mode)
44
-
45
- No changes to the skill's interface or output format — the pipeline field is purely additive.
46
-
47
- ### Phase 2: Identify — Classify Drift Types
48
-
49
- Categorize each finding into one of these drift types:
50
-
51
- **Renamed but not updated:**
52
- A function, class, variable, or file was renamed in code, but documentation still references the old name. This is the most common type of drift.
53
-
54
- - Example: `calculateShipping()` was renamed to `computeShippingCost()`, but AGENTS.md and three inline comments still say `calculateShipping`.
55
-
56
- **New code with no docs:**
57
- A new module, function, or API was added but no documentation entry exists. This is not "drift" in the strict sense but a gap that grows into drift over time.
58
-
59
- - Example: `src/services/notification-service.ts` was added two sprints ago. It has 5 public exports. No AGENTS.md section, no doc page, no inline doc comments beyond basic JSDoc.
60
-
61
- **Deleted code still referenced:**
62
- A file, function, or feature was removed, but documentation still describes it as if it exists. This actively misleads readers.
63
-
64
- - Example: `src/utils/legacy-parser.ts` was deleted. The architecture doc still includes it in the data flow diagram. AGENTS.md still warns about its quirks.
65
-
66
- **Changed behavior not reflected:**
67
- A function's signature, return type, error handling, or side effects changed, but the documentation describes the old behavior.
68
-
69
- - Example: `createUser()` now throws `ValidationError` instead of returning `null` on invalid input. The API docs still say "returns null if validation fails."
70
-
71
- **Moved code with stale paths:**
72
- A file or module was moved to a different directory, but documentation references the old path.
73
-
74
- - Example: `src/helpers/format.ts` was moved to `src/utils/format.ts`. Three doc files and AGENTS.md reference the old path.
75
-
76
- ### Phase 3: Prioritize — Rank by Impact
77
-
78
- Not all drift is equally harmful. Prioritize fixes:
79
-
80
- **Critical (fix immediately):**
81
-
82
- - Public API documentation that describes wrong behavior — external consumers will write broken code
83
- - AGENTS.md sections that reference deleted files — AI agents will hallucinate about non-existent code
84
- - README getting-started guides with wrong commands — new developers cannot onboard
85
-
86
- **High (fix before next release):**
87
-
88
- - Internal API docs with wrong signatures — developers waste time debugging
89
- - Architecture docs with stale diagrams — wrong mental models lead to wrong decisions
90
- - Frequently accessed docs with broken links — high-traffic pages with dead ends
91
-
92
- **Medium (fix in next sprint):**
93
-
94
- - Internal docs for stable code — low change rate means low confusion rate
95
- - Comments in rarely modified files — few people read them
96
- - Edge case documentation — affects few users
97
-
98
- **Low (fix when convenient):**
99
-
100
- - Stylistic inconsistencies in docs (capitalization, formatting)
101
- - Redundant documentation that says the same thing in multiple places
102
- - Historical notes that are outdated but clearly marked as historical
103
-
104
- ### Phase 4: Report — Generate Actionable Output
105
-
106
- For each drift finding, provide:
107
-
108
- 1. **File and line number** of the drifted documentation
109
- 2. **The specific stale content** (quote the exact text that is wrong)
110
- 3. **What changed in code** (the commit, file, and nature of the change)
111
- 4. **Suggested fix** (the replacement text or action needed)
112
- 5. **Priority tier** (Critical / High / Medium / Low)
113
-
114
- Group findings by documentation file so that fixes can be applied file-by-file.
115
-
116
- ## Harness Integration
117
-
118
- - **`harness check-docs`** — Primary tool. Scans all documentation files for broken references, stale paths, and missing entries.
119
- - **`harness cleanup --type drift`** — Deeper analysis that cross-references git history with documentation references to detect semantic drift.
120
- - **`harness cleanup --type drift --json`** — Machine-readable output for automated pipelines.
121
- - **`harness fix-drift`** — Auto-fix simple drift issues after review (use align-documentation skill for applying fixes).
122
-
123
- ## Success Criteria
124
-
125
- - `harness check-docs` reports zero errors
126
- - All file paths referenced in documentation resolve to existing files
127
- - All function/class names referenced in documentation match current code
128
- - All API documentation matches current function signatures and behavior
129
- - No documentation references deleted files, functions, or features
130
- - Drift findings are prioritized and assigned to the appropriate fix cycle
131
-
132
- ## Examples
133
-
134
- ### Example: Renamed function detected
135
-
136
- **Drift finding:**
137
-
138
- ```
139
- DRIFT: Renamed reference detected
140
- Doc: AGENTS.md:47
141
- Stale text: "Use `calculateShipping()` to compute shipping costs"
142
- Code change: calculateShipping renamed to computeShippingCost (commit a1b2c3d)
143
- File: src/services/shipping.ts:24
144
- Priority: High
145
- Suggested fix: Replace `calculateShipping()` with `computeShippingCost()`
146
- ```
147
-
148
- ### Example: Deleted file still documented
149
-
150
- **Drift finding:**
151
-
152
- ```
153
- DRIFT: Reference to deleted file
154
- Doc: docs/architecture.md:112
155
- Stale text: "The legacy parser (src/utils/legacy-parser.ts) handles XML input"
156
- Code change: File deleted in commit d4e5f6g, functionality merged into unified-parser.ts
157
- Priority: Critical
158
- Suggested fix: Update section to reference unified-parser.ts, remove legacy parser description
159
- ```
160
-
161
- ### Example: New module with no documentation
162
-
163
- **Drift finding:**
164
-
165
- ```
166
- GAP: Undocumented module
167
- File: src/services/notification-service.ts
168
- Created: commit h7i8j9k (3 weeks ago)
169
- Public exports: NotificationService, NotificationType, sendNotification
170
- Imported by: 4 modules
171
- Documentation references: 0
172
- Priority: High
173
- Suggested fix: Add AGENTS.md section describing purpose, constraints, and public API
174
- ```
175
-
176
- ## Rationalizations to Reject
177
-
178
- | Rationalization | Reality |
179
- | --- | --- |
180
- | "The docs are close enough -- a renamed function is obvious from context" | Renamed references in AGENTS.md cause AI agents to hallucinate about non-existent code. Precision matters. |
181
- | "We only changed internal code, so the docs do not need checking" | Internal API docs with wrong signatures waste developer debugging time. Changed-behavior-not-reflected drift is High priority. |
182
- | "There are too many findings to deal with right now, so skip the scan" | The escalation protocol exists for this case: focus on Critical and High items, create a tracking issue for the rest. |
183
- | "We can rely on code review to catch stale docs" | Code reviewers focus on code correctness, not documentation cross-references. harness check-docs catches what humans routinely miss. |
184
-
185
- ## Escalation
186
-
187
- - **When drift is extensive (>30 findings):** Do not try to fix everything. Focus on Critical and High priority items. Create a tracking issue for the remaining items and schedule them across sprints.
188
- - **When you cannot determine the correct replacement text:** The code change may have been complex. Check the commit message and PR description for context. If still unclear, flag the finding for the original author to resolve.
189
- - **When documentation is in a format you cannot parse:** Some docs may be in wiki pages, Confluence, or other external systems. Report the finding with a link and flag it for manual review.
190
- - **When drift reveals a deeper problem (code changed but nobody knew):** This suggests a process gap. Recommend adding `harness check-docs` to the CI pipeline or pre-merge hooks to catch drift at the source.
191
-
@@ -1,3 +0,0 @@
1
- # Reserved for Phase B native integration
2
- name: detect-doc-drift
3
- version: "1.0.0"
@@ -1,289 +0,0 @@
1
- <!-- Generated by harness generate-slash-commands. Do not edit. -->
2
-
3
- # Enforce Architecture
4
-
5
- > Validate architectural layer boundaries and detect dependency violations. No code may violate layer constraints — this is a hard gate, not a suggestion.
6
-
7
- ## When to Use
8
-
9
- - Before approving any pull request or merge
10
- - After writing new imports or module references
11
- - When adding a new module or package to the project
12
- - When `on_pre_commit` or `on_architecture_check` triggers fire
13
- - After refactoring that moves code between layers or modules
14
- - NOT when editing documentation, configuration, or non-code files
15
- - NOT when the violation is intentional and requires a constraint update (escalate instead)
16
-
17
- ## Process
18
-
19
- ### Phase 1: Load Constraints
20
-
21
- 1. **Read `harness.config.json`** to understand the project's architectural constraints. The config defines:
22
- - **Layers** — ordered list of architectural layers (e.g., `ui -> service -> repository -> domain`)
23
- - **Dependency rules** — which layers may import from which (typically: layers may only import from layers below them)
24
- - **Forbidden imports** — specific import paths that are never allowed in certain contexts
25
- - **Boundary definitions** — which directories/packages belong to which layer
26
-
27
- - **Design constraints** — when `design` config exists, also load design constraint rules:
28
- - Token compliance — components must reference design tokens, not hardcoded values
29
- - Accessibility compliance — color pairs must meet WCAG contrast ratios
30
- - Anti-pattern enforcement — project-specific anti-patterns from `design-system/DESIGN.md`
31
- - Platform binding — tokens must have appropriate platform bindings for enabled platforms
32
-
33
- 2. **Understand the layer model.** In a typical layered architecture:
34
- - Higher layers depend on lower layers (UI depends on Service, Service depends on Repository)
35
- - Lower layers NEVER depend on higher layers (Repository must not import from UI)
36
- - Same-layer imports may or may not be allowed depending on project config
37
- - Cross-cutting concerns (logging, config) have their own rules
38
-
39
- ### Graph-Enhanced Context (when available)
40
-
41
- When a knowledge graph exists at `.harness/graph/`, use graph queries for faster, more accurate violation detection:
42
-
43
- - `query_graph` — traverse `imports` edges against layer constraint nodes to find all violations in a single query
44
- - `get_relationships` — find all code dependent on a violation target to show the full scope of impact
45
-
46
- Graph queries show the complete violation scope (not just the first occurrence per file) and reveal transitive violations that single-file analysis misses. Fall back to file-based commands if no graph is available.
47
-
48
- ### Phase 2: Run Dependency Checks
49
-
50
- 1. **Run `harness check-deps`** to analyze all import statements against the constraint model. Capture the full JSON output.
51
-
52
- 1b. **Optionally run `harness check-arch`** for comprehensive architecture analysis beyond dependency checking. This covers circular dependencies, complexity, coupling, module size, and dependency depth in addition to layer violations.
53
-
54
- 2. **Parse the results.** Each violation includes:
55
- - The violating file and line number
56
- - The forbidden import target
57
- - The source layer and target layer
58
- - The specific rule being violated
59
-
60
- ### Phase 3: Analyze Violations
61
-
62
- For each violation, determine:
63
-
64
- 1. **Which layers are involved.** Identify the source file's layer and the imported module's layer. Map them to the constraint model.
65
-
66
- 2. **What rule is violated.** Common violation types:
67
- - **Upward dependency** — a lower layer imports from a higher layer (e.g., repository importing from UI). This is the most serious type. It creates coupling that makes the lower layer untestable in isolation.
68
- - **Skip-layer dependency** — a layer reaches past its immediate neighbor (e.g., UI importing directly from Repository, bypassing Service). This breaks encapsulation and makes the middle layer pointless.
69
- - **Circular dependency** — two modules or layers depend on each other. This creates fragile coupling where changing either module risks breaking the other.
70
- - **Forbidden import** — a specific import that is explicitly banned (e.g., importing a database driver outside the repository layer). This prevents implementation details from leaking.
71
- - **Design constraint violation** — a component uses hardcoded values instead of design tokens, or violates a declared anti-pattern. Severity depends on `design.strictness` in config. These violations surface as DESIGN-xxx codes:
72
- - `DESIGN-001` [warn] — Hardcoded color/font/spacing instead of token reference
73
- - `DESIGN-002` [warn] — Value matches a project anti-pattern
74
- - `DESIGN-003` [error] — WCAG contrast ratio failure (error in strict mode)
75
- - `DESIGN-004` [info] — Missing platform binding for enabled platform
76
-
77
- 3. **Explain the impact.** For each violation, state:
78
- - WHY the constraint exists (what architectural property it protects)
79
- - WHAT would happen if the violation were allowed to persist
80
- - HOW it affects testability, maintainability, and changeability
81
-
82
- ### Phase 3.5: Apply Safe Architecture Fixes
83
-
84
- Some architecture violations can be auto-fixed. Apply these before surfacing remaining violations.
85
-
86
- **Import ordering violations:**
87
-
88
- 1. Identify files where imports are not ordered according to the project's layer convention.
89
- 2. Reorder imports: external packages first, then by layer (lowest to highest), then relative imports.
90
- 3. Verify with lint + typecheck. This is a safe, mechanical fix.
91
-
92
- **Forbidden import replacement (with configured alternative):**
93
-
94
- 1. Check `harness.config.json` for `forbiddenImports` entries that include an `alternative` field.
95
- 2. For each violation where an alternative exists, replace the import path with the alternative.
96
- 3. Verify with typecheck + test. This is "probably safe" -- present as a diff for approval in interactive mode, apply silently in CI mode.
97
-
98
- **Design token substitution (unambiguous mapping):**
99
-
100
- 1. When a hardcoded value has exactly one matching design token, replace the literal with the token reference.
101
- 2. Verify with typecheck + test.
102
- 3. If the mapping is ambiguous (multiple candidate tokens), surface to user.
103
-
104
- **Never auto-fix these (always surface to user):**
105
-
106
- - Upward dependencies
107
- - Skip-layer dependencies
108
- - Circular dependencies
109
- - Forbidden imports without a configured alternative
110
-
111
- ### Phase 3.6: Convergence Loop (Standalone)
112
-
113
- When running standalone (not through the orchestrator), apply a single-concern convergence loop:
114
-
115
- 1. **Re-run detection.** After applying all safe/probably-safe fixes, run `harness check-deps` again.
116
- 2. **Check if violation count decreased.** Compare the new count to the previous count.
117
- 3. **If decreased: loop.** Fixing one violation can resolve others (e.g., replacing a forbidden import may eliminate a transitive skip-layer violation). Go back to Phase 2 with the new results.
118
- 4. **If unchanged: stop.** Proceed to Phase 4 (Guide Resolution) for remaining violations.
119
- 5. **Maximum iterations: 5.** To prevent infinite loops.
120
-
121
- **Verification gate:** After each fix batch, run:
122
-
123
- ```
124
- pnpm lint && pnpm tsc --noEmit && pnpm test
125
- ```
126
-
127
- If any command fails, revert the batch and reclassify those findings as unsafe.
128
-
129
- ### Phase 4: Guide Resolution
130
-
131
- For each violation, provide a specific fix:
132
-
133
- - **Upward dependency:** Introduce an interface or abstraction in the lower layer. The higher layer implements it; the lower layer depends only on the abstraction. Alternatively, use dependency injection.
134
- - **Skip-layer dependency:** Route the call through the intermediate layer. Add a method to the Service layer that delegates to the Repository, then have the UI call the Service.
135
- - **Circular dependency:** Break the cycle by extracting shared types into a common module that both can depend on, or restructure so the dependency flows in one direction only.
136
- - **Forbidden import:** Check `harness.config.json` for an `alternative` field. If present, this should have been auto-fixed in Phase 3.5. If not present, replace the forbidden import with the approved alternative or restructure the code.
137
- - **Design constraint violation:** Replace hardcoded values with token references from `design-system/tokens.json`. For anti-pattern violations, consult `design-system/DESIGN.md` for the project's aesthetic intent and approved alternatives. For contrast failures, use `harness-accessibility` to find compliant color pairs.
138
-
139
- ## Common Violation Patterns
140
-
141
- ### Pattern: "I just need one thing from that layer"
142
-
143
- A UI component imports a repository function directly because "it is just one query." Fix: add the query to the Service layer. The extra indirection is the architecture working correctly.
144
-
145
- ### Pattern: "Shared types across layers"
146
-
147
- Two layers both need the same type definition. Fix: place shared types in the lowest layer that both depend on, or create a dedicated `types` or `shared` module at the bottom of the layer stack.
148
-
149
- ### Pattern: "Test utilities importing production code from wrong layer"
150
-
151
- Test helpers import across layer boundaries for convenience. Fix: each layer's tests should only import from that layer and below. Test utilities should follow the same constraints as production code.
152
-
153
- ### Pattern: "Hardcoded colors in components"
154
-
155
- A component uses `#3b82f6` directly instead of referencing `color.primary` from the design token system. Fix: import and reference the token. In Tailwind: use the token-mapped utility class. In CSS: use the custom property `var(--color-primary)`.
156
-
157
- ### Pattern: "Circular dependency through re-exports"
158
-
159
- Module A re-exports from Module B, and Module B imports from Module A. The circular dependency is hidden by the re-export. Fix: identify the true dependency direction and remove the reverse path.
160
-
161
- ## Harness Integration
162
-
163
- - **`harness check-deps`** — Primary tool. Analyzes all imports against the layer model defined in `harness.config.json`. Returns structured violation data including file, line, source layer, target layer, and rule violated.
164
- - **`harness check-deps --json`** — Machine-readable output for automated pipelines. Use this when parsing results programmatically.
165
- - **`harness validate`** — Includes dependency checking as part of full project validation. Use when you want a complete health check, not just architecture.
166
- - **`harness-design-system`** — Provides the design token source of truth (`tokens.json`) that constraints validate against.
167
- - **`harness-accessibility`** — Provides WCAG contrast validation used by DESIGN-003 constraints.
168
- - **Design constraint category** — Controlled by `design.strictness` in `harness.config.json`. Design violations surface alongside architectural violations in the same report.
169
- - **`harness check-arch`** — Architecture assertion framework. Runs all 7 metric collectors against baseline and thresholds. Use for comprehensive structural health checks beyond layer dependencies. Supports `--update-baseline` to capture current state and `--json` for machine-readable output.
170
- - **`harness check-arch --module <path>`** — Scoped architecture check for a single module. Use when validating a specific subsystem.
171
-
172
- ## Success Criteria
173
-
174
- - `harness check-deps` reports zero violations
175
- - All imports flow downward through the layer stack (or follow explicitly configured exceptions)
176
- - No circular dependencies exist between modules or layers
177
- - No forbidden imports are present anywhere in the codebase
178
- - Every new module is assigned to the correct layer in the config
179
- - The layer model in `harness.config.json` accurately reflects the intended architecture
180
-
181
- ## Examples
182
-
183
- ### Example: Service layer importing from UI layer
184
-
185
- **Violation from `harness check-deps`:**
186
-
187
- ```
188
- VIOLATION: Upward dependency
189
- File: src/services/user-service.ts:12
190
- Import: import { UserForm } from '../components/UserForm'
191
- Source layer: service (level 2)
192
- Target layer: ui (level 3)
193
- Rule: service layer must not depend on ui layer
194
- ```
195
-
196
- **Impact:** The UserService now depends on a React component. It cannot be used in a CLI tool, a background job, or tested without a DOM. The service layer should be framework-agnostic.
197
-
198
- **Resolution:**
199
-
200
- ```typescript
201
- // BEFORE (violating)
202
- import { UserForm } from '../components/UserForm';
203
- const data = UserForm.defaultValues; // using UI defaults in service
204
-
205
- // AFTER (fixed)
206
- // Define the defaults where they belong — in the service layer
207
- const DEFAULT_USER_DATA: UserInput = { name: '', email: '' };
208
- ```
209
-
210
- ### Example: Circular dependency between modules
211
-
212
- **Violation from `harness check-deps`:**
213
-
214
- ```
215
- VIOLATION: Circular dependency detected
216
- Cycle: src/services/order-service.ts -> src/services/inventory-service.ts -> src/services/order-service.ts
217
- order-service imports checkStock from inventory-service
218
- inventory-service imports getOrderQuantity from order-service
219
- ```
220
-
221
- **Resolution:** Extract the shared concern into a new module:
222
-
223
- ```typescript
224
- // src/services/stock-calculator.ts (new, shared module)
225
- export function calculateRequiredStock(quantity: number, reserved: number): number {
226
- return quantity - reserved;
227
- }
228
- ```
229
-
230
- Both services import from `stock-calculator` instead of from each other. The cycle is broken.
231
-
232
- ## Gates
233
-
234
- These are hard stops. Architecture violations are not warnings — they are errors.
235
-
236
- - **No code with layer violations may be approved or merged.** If `harness check-deps` reports violations, the code must be fixed before it proceeds.
237
- - **No new modules without layer assignment.** Every new directory or package must be mapped to a layer in `harness.config.json` before code is written in it.
238
- - **No "temporary" violations.** There is no TODO for architecture. Either the code respects the constraints or it does not ship.
239
- - **No suppressing violations without team approval.** If a violation needs to be allowed, the constraint in `harness.config.json` must be explicitly updated with a comment explaining why.
240
-
241
- ## Evidence Requirements
242
-
243
- When this skill makes claims about existing code, architecture, or behavior,
244
- it MUST cite evidence using one of:
245
-
246
- 1. **File reference:** `file:line` format (e.g., `src/auth.ts:42`)
247
- 2. **Code pattern reference:** `file` with description (e.g., `src/utils/hash.ts` —
248
- "existing bcrypt wrapper")
249
- 3. **Test/command output:** Inline or referenced output from a test run or CLI command
250
- 4. **Session evidence:** Write to the `evidence` session section via `manage_state`
251
-
252
- **Uncited claims:** Technical assertions without citations MUST be prefixed with
253
- `[UNVERIFIED]`. Example: `[UNVERIFIED] The auth middleware supports refresh tokens`.
254
-
255
- ## Red Flags
256
-
257
- ### Universal
258
-
259
- These apply to ALL skills. If you catch yourself doing any of these, STOP.
260
-
261
- - **"I believe the codebase does X"** — Stop. Read the code and cite a file:line
262
- reference. Belief is not evidence.
263
- - **"Let me recommend [pattern] for this"** without checking existing patterns — Stop.
264
- Search the codebase first. The project may already have a convention.
265
- - **"While we're here, we should also [unrelated improvement]"** — Stop. Flag the idea
266
- but do not expand scope beyond the stated task.
267
-
268
- ### Domain-Specific
269
-
270
- - **"Auto-fixing this import to use the correct layer"** without verifying the replacement module exists — Stop. Verify the target exists and exports the needed symbol before rewriting an import.
271
- - **"This file is in a test directory, skipping violation"** — Stop. Test directories have architectural rules too. Check the constraint definition before assuming tests are exempt.
272
- - **"Removing this circular dependency by moving the import"** without tracing downstream effects — Stop. Moving imports can break consumers. Trace the dependency chain first.
273
- - **"This violation is from generated code, ignoring"** — Stop. Generated files can still violate architecture if the generator is misconfigured. Check the source template.
274
-
275
- ## Rationalizations to Reject
276
-
277
- | Rationalization | Reality |
278
- | --- | --- |
279
- | "The violation is minor — just one import" | One violation sets a precedent. Enforce the constraint or document an explicit exception with rationale. |
280
- | "It works, so the architecture must be fine" | Working code with bad architecture is technical debt with compound interest. Correct function does not excuse structural violations. |
281
- | "This is a legacy module, different rules apply" | Legacy does not mean exempt. Either the constraint applies or it needs an explicit documented exception. |
282
-
283
- ## Escalation
284
-
285
- - **When a violation seems impossible to fix within the current architecture:** The architecture may need to evolve. Escalate to the human with a clear explanation of the constraint, the use case, and why they conflict. Propose options: update the constraint, restructure the code, or add a new layer.
286
- - **When `harness check-deps` reports false positives:** Verify the layer assignments in `harness.config.json` are correct. If a file is assigned to the wrong layer, fix the config. If the tool is genuinely wrong, report the issue.
287
- - **When fixing one violation creates another:** This usually indicates a deeper structural issue. Step back and look at the dependency graph as a whole rather than fixing violations one at a time.
288
- - **When the team wants to change the layer model:** This is a significant architectural decision. All existing code must be migrated to the new model. Plan this as a dedicated refactoring effort, not a side task.
289
-
@@ -1,3 +0,0 @@
1
- # Reserved for Phase B native integration
2
- name: enforce-architecture
3
- version: "1.0.0"