@harness-engineering/cli 1.2.0 → 1.3.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.
- package/dist/bin/harness.js +1 -1
- package/dist/{chunk-IXT3KLVN.js → chunk-APYEWOCR.js} +355 -19
- package/dist/index.js +1 -1
- package/package.json +6 -4
- package/dist/agents/commands/claude-code/harness/add-component.md +0 -34
- package/dist/agents/commands/claude-code/harness/align-documentation.md +0 -33
- package/dist/agents/commands/claude-code/harness/architecture-advisor.md +0 -41
- package/dist/agents/commands/claude-code/harness/brainstorming.md +0 -42
- package/dist/agents/commands/claude-code/harness/check-mechanical-constraints.md +0 -32
- package/dist/agents/commands/claude-code/harness/cleanup-dead-code.md +0 -33
- package/dist/agents/commands/claude-code/harness/code-review.md +0 -33
- package/dist/agents/commands/claude-code/harness/debugging.md +0 -43
- package/dist/agents/commands/claude-code/harness/detect-doc-drift.md +0 -32
- package/dist/agents/commands/claude-code/harness/diagnostics.md +0 -43
- package/dist/agents/commands/claude-code/harness/enforce-architecture.md +0 -32
- package/dist/agents/commands/claude-code/harness/execution.md +0 -43
- package/dist/agents/commands/claude-code/harness/git-workflow.md +0 -32
- package/dist/agents/commands/claude-code/harness/initialize-project.md +0 -33
- package/dist/agents/commands/claude-code/harness/onboarding.md +0 -32
- package/dist/agents/commands/claude-code/harness/parallel-agents.md +0 -35
- package/dist/agents/commands/claude-code/harness/planning.md +0 -41
- package/dist/agents/commands/claude-code/harness/pre-commit-review.md +0 -38
- package/dist/agents/commands/claude-code/harness/refactoring.md +0 -35
- package/dist/agents/commands/claude-code/harness/skill-authoring.md +0 -35
- package/dist/agents/commands/claude-code/harness/state-management.md +0 -35
- package/dist/agents/commands/claude-code/harness/tdd.md +0 -42
- package/dist/agents/commands/claude-code/harness/validate-context-engineering.md +0 -32
- package/dist/agents/commands/claude-code/harness/verification.md +0 -38
- package/dist/agents/commands/gemini-cli/harness/add-component.toml +0 -240
- package/dist/agents/commands/gemini-cli/harness/align-documentation.toml +0 -238
- package/dist/agents/commands/gemini-cli/harness/architecture-advisor.toml +0 -469
- package/dist/agents/commands/gemini-cli/harness/brainstorming.toml +0 -326
- package/dist/agents/commands/gemini-cli/harness/check-mechanical-constraints.toml +0 -249
- package/dist/agents/commands/gemini-cli/harness/cleanup-dead-code.toml +0 -258
- package/dist/agents/commands/gemini-cli/harness/code-review.toml +0 -461
- package/dist/agents/commands/gemini-cli/harness/debugging.toml +0 -436
- package/dist/agents/commands/gemini-cli/harness/detect-doc-drift.toml +0 -215
- package/dist/agents/commands/gemini-cli/harness/diagnostics.toml +0 -401
- package/dist/agents/commands/gemini-cli/harness/enforce-architecture.toml +0 -222
- package/dist/agents/commands/gemini-cli/harness/execution.toml +0 -381
- package/dist/agents/commands/gemini-cli/harness/git-workflow.toml +0 -325
- package/dist/agents/commands/gemini-cli/harness/initialize-project.toml +0 -257
- package/dist/agents/commands/gemini-cli/harness/onboarding.toml +0 -316
- package/dist/agents/commands/gemini-cli/harness/parallel-agents.toml +0 -221
- package/dist/agents/commands/gemini-cli/harness/planning.toml +0 -405
- package/dist/agents/commands/gemini-cli/harness/pre-commit-review.toml +0 -294
- package/dist/agents/commands/gemini-cli/harness/refactoring.toml +0 -209
- package/dist/agents/commands/gemini-cli/harness/skill-authoring.toml +0 -350
- package/dist/agents/commands/gemini-cli/harness/state-management.toml +0 -354
- package/dist/agents/commands/gemini-cli/harness/tdd.toml +0 -247
- package/dist/agents/commands/gemini-cli/harness/validate-context-engineering.toml +0 -186
- package/dist/agents/commands/gemini-cli/harness/verification.toml +0 -334
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
## <!-- Generated by harness generate-slash-commands. Do not edit. -->
|
|
2
|
-
|
|
3
|
-
name: harness:validate-context-engineering
|
|
4
|
-
description: Validate repository context engineering practices (AGENTS.md, doc coverage, knowledge map)
|
|
5
|
-
argument-hint: "[--path <path>]"
|
|
6
|
-
allowed-tools:
|
|
7
|
-
|
|
8
|
-
- Bash
|
|
9
|
-
- Read
|
|
10
|
-
- Glob
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<context>
|
|
15
|
-
Cognitive mode: meticulous-verifier
|
|
16
|
-
Type: flexible
|
|
17
|
-
</context>
|
|
18
|
-
|
|
19
|
-
<objective>
|
|
20
|
-
Validate repository context engineering practices (AGENTS.md, doc coverage, knowledge map)
|
|
21
|
-
</objective>
|
|
22
|
-
|
|
23
|
-
<execution_context>
|
|
24
|
-
@agents/skills/claude-code/validate-context-engineering/SKILL.md
|
|
25
|
-
@agents/skills/claude-code/validate-context-engineering/skill.yaml
|
|
26
|
-
</execution_context>
|
|
27
|
-
|
|
28
|
-
<process>
|
|
29
|
-
1. Try: invoke mcp__harness__run_skill with skill: "validate-context-engineering"
|
|
30
|
-
2. If MCP unavailable: read SKILL.md and follow its workflow directly
|
|
31
|
-
3. Pass through any arguments provided by the user
|
|
32
|
-
</process>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
## <!-- Generated by harness generate-slash-commands. Do not edit. -->
|
|
2
|
-
|
|
3
|
-
name: harness:verification
|
|
4
|
-
description: Comprehensive harness verification of project health and compliance
|
|
5
|
-
argument-hint: "[--path <path>]"
|
|
6
|
-
allowed-tools:
|
|
7
|
-
|
|
8
|
-
- Bash
|
|
9
|
-
- Read
|
|
10
|
-
- Glob
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<context>
|
|
15
|
-
Cognitive mode: meticulous-verifier
|
|
16
|
-
Type: rigid
|
|
17
|
-
</context>
|
|
18
|
-
|
|
19
|
-
<objective>
|
|
20
|
-
Comprehensive harness verification of project health and compliance
|
|
21
|
-
|
|
22
|
-
Phases:
|
|
23
|
-
|
|
24
|
-
- check: Run all harness validation commands
|
|
25
|
-
- report: Summarize findings and violations
|
|
26
|
-
- remediate: Fix any critical violations
|
|
27
|
-
</objective>
|
|
28
|
-
|
|
29
|
-
<execution_context>
|
|
30
|
-
@agents/skills/claude-code/harness-verification/SKILL.md
|
|
31
|
-
@agents/skills/claude-code/harness-verification/skill.yaml
|
|
32
|
-
</execution_context>
|
|
33
|
-
|
|
34
|
-
<process>
|
|
35
|
-
1. Try: invoke mcp__harness__run_skill with skill: "harness-verification"
|
|
36
|
-
2. If MCP unavailable: read SKILL.md and follow its workflow directly
|
|
37
|
-
3. Pass through any arguments provided by the user
|
|
38
|
-
</process>
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
# Generated by harness generate-slash-commands. Do not edit.
|
|
2
|
-
description = "Add a component to an existing harness project"
|
|
3
|
-
prompt = """
|
|
4
|
-
<context>
|
|
5
|
-
Cognitive mode: constructive-architect
|
|
6
|
-
Type: flexible
|
|
7
|
-
</context>
|
|
8
|
-
|
|
9
|
-
<objective>
|
|
10
|
-
Add a component to an existing harness project
|
|
11
|
-
</objective>
|
|
12
|
-
|
|
13
|
-
<execution_context>
|
|
14
|
-
--- SKILL.md (agents/skills/claude-code/add-harness-component/SKILL.md) ---
|
|
15
|
-
# Add Harness Component
|
|
16
|
-
|
|
17
|
-
> Add layers, documentation, components, or skills to an existing harness project with proper integration. Validate against existing constraints, wire into architecture, and verify the result.
|
|
18
|
-
|
|
19
|
-
## When to Use
|
|
20
|
-
|
|
21
|
-
- Adding a new layer to the project's architecture
|
|
22
|
-
- Adding a new documentation file that harness should track
|
|
23
|
-
- Adding a new component (module, service, package) that must be wired into existing layer boundaries
|
|
24
|
-
- Adding a new skill to the project's skill library
|
|
25
|
-
- When a plan calls for introducing a new architectural boundary or module
|
|
26
|
-
- NOT when initializing a project from scratch (use initialize-harness-project)
|
|
27
|
-
- NOT when modifying an existing component (use standard editing workflows)
|
|
28
|
-
- NOT when removing components (manual process — removing requires careful dependency analysis)
|
|
29
|
-
|
|
30
|
-
## Process
|
|
31
|
-
|
|
32
|
-
### Phase 1: DETERMINE — Identify What to Add
|
|
33
|
-
|
|
34
|
-
1. **Clarify the component type.** Ask if not obvious from context:
|
|
35
|
-
- **Layer:** A new architectural boundary (e.g., adding an "infrastructure" layer to a project that only has "business" and "data")
|
|
36
|
-
- **Document:** A documentation file that harness should track for drift detection (e.g., API docs, architecture decision records)
|
|
37
|
-
- **Component:** A code module, service, or package that lives within an existing layer
|
|
38
|
-
- **Skill:** A new harness skill definition for the project's workflow
|
|
39
|
-
|
|
40
|
-
2. **Gather requirements.** For each type:
|
|
41
|
-
- **Layer:** Name, which directories belong to it, which layers it can import from, which layers can import from it
|
|
42
|
-
- **Document:** Path, what it documents, which code files it relates to
|
|
43
|
-
- **Component:** Name, which layer it belongs to, what it depends on, what will depend on it
|
|
44
|
-
- **Skill:** Name, purpose, type (rigid or flexible), triggers
|
|
45
|
-
|
|
46
|
-
3. **Check prerequisites.** The project must already be initialized with harness. If `harness.yaml` does not exist, stop and run initialize-harness-project first.
|
|
47
|
-
|
|
48
|
-
### Phase 2: VALIDATE — Check Against Existing Constraints
|
|
49
|
-
|
|
50
|
-
1. **Read the current configuration.** Load `harness.yaml` and `AGENTS.md` to understand existing layers, constraints, and architecture.
|
|
51
|
-
|
|
52
|
-
2. **Verify the new component does not conflict:**
|
|
53
|
-
- Does the layer name already exist?
|
|
54
|
-
- Does the component directory already exist?
|
|
55
|
-
- Would the new dependency relationships create circular imports?
|
|
56
|
-
- Does the component violate any existing forbidden-import rules?
|
|
57
|
-
|
|
58
|
-
3. **If conflicts are found,** report them clearly: "Adding layer X would conflict with existing layer Y because [reason]. Options: [A] rename, [B] merge into existing layer, [C] restructure. Which do you prefer?"
|
|
59
|
-
|
|
60
|
-
4. **Run `harness check-deps`** on the current state to establish a clean baseline. If it already fails, fix existing violations before adding new components.
|
|
61
|
-
|
|
62
|
-
### Phase 3: ADD — Create the Component
|
|
63
|
-
|
|
64
|
-
1. **Run `harness add` with appropriate arguments:**
|
|
65
|
-
- Layer: `harness add layer <name> --dirs <dir1,dir2> --imports <allowed-layers>`
|
|
66
|
-
- Document: `harness add doc <path> --tracks <related-code-paths>`
|
|
67
|
-
- Component: `harness add component <name> --layer <layer-name>`
|
|
68
|
-
- Skill: `harness add skill <name> --type <rigid|flexible>`
|
|
69
|
-
|
|
70
|
-
2. **Review generated files and configuration changes.** `harness add` modifies `harness.yaml` and may generate template files. Check that the changes look correct.
|
|
71
|
-
|
|
72
|
-
3. **Create the actual code or content.** `harness add` creates the configuration entry but not necessarily the implementation. Create the directories, files, and initial code as needed.
|
|
73
|
-
|
|
74
|
-
### Phase 4: WIRE — Integrate into Architecture
|
|
75
|
-
|
|
76
|
-
1. **Update imports and exports.** If the new component needs to be imported by existing code, add the imports. If existing code needs to be aware of the new layer, update barrel files or index modules.
|
|
77
|
-
|
|
78
|
-
2. **Update `AGENTS.md`.** Add the new component to the architecture section. Document its purpose, boundaries, and relationships to other components. This keeps agent instructions accurate.
|
|
79
|
-
|
|
80
|
-
3. **Update layer configuration** if the new component changes dependency relationships. Ensure `harness.yaml` reflects the actual import graph.
|
|
81
|
-
|
|
82
|
-
4. **For new skills:** Write the `skill.yaml` and `SKILL.md` files following the harness skill format. Use harness-skill-authoring for guidance on writing good skill content.
|
|
83
|
-
|
|
84
|
-
### Phase 5: VERIFY — Confirm Integration
|
|
85
|
-
|
|
86
|
-
1. **Run `harness validate`** to verify the full project configuration is still valid after the addition.
|
|
87
|
-
|
|
88
|
-
2. **Run `harness check-deps`** to verify no dependency violations were introduced. The new component's imports must respect layer boundaries.
|
|
89
|
-
|
|
90
|
-
3. **If validation fails,** fix the issues before committing. Common causes:
|
|
91
|
-
- New layer not properly registered in `harness.yaml`
|
|
92
|
-
- Component placed in wrong directory for its declared layer
|
|
93
|
-
- Imports from forbidden layers
|
|
94
|
-
- `AGENTS.md` references outdated architecture
|
|
95
|
-
|
|
96
|
-
4. **Commit the addition.** All new and modified files in a single atomic commit.
|
|
97
|
-
|
|
98
|
-
## Harness Integration
|
|
99
|
-
|
|
100
|
-
- **`harness add layer <name>`** — Register a new architectural layer with directory mappings and import rules.
|
|
101
|
-
- **`harness add doc <path>`** — Register a documentation file for drift tracking.
|
|
102
|
-
- **`harness add component <name> --layer <layer>`** — Register a new code component within an existing layer.
|
|
103
|
-
- **`harness add skill <name> --type <type>`** — Scaffold a new skill definition.
|
|
104
|
-
- **`harness validate`** — Verify project configuration after the addition.
|
|
105
|
-
- **`harness check-deps`** — Verify dependency constraints are respected after the addition.
|
|
106
|
-
|
|
107
|
-
## Success Criteria
|
|
108
|
-
|
|
109
|
-
- The new component is properly registered in `harness.yaml`
|
|
110
|
-
- The component's files exist in the correct directories for its declared layer
|
|
111
|
-
- `AGENTS.md` is updated to reflect the new component
|
|
112
|
-
- `harness validate` passes after the addition
|
|
113
|
-
- `harness check-deps` passes after the addition (no new violations)
|
|
114
|
-
- No circular dependencies were introduced
|
|
115
|
-
- The addition is committed as a single atomic commit
|
|
116
|
-
|
|
117
|
-
## Examples
|
|
118
|
-
|
|
119
|
-
### Example: Adding a New Layer
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
Human: "We need an infrastructure layer for external API clients."
|
|
123
|
-
|
|
124
|
-
DETERMINE: Adding a layer. Name: infrastructure. Dirs: src/infrastructure/.
|
|
125
|
-
Imports from: (none — infrastructure is a leaf layer, no internal dependencies).
|
|
126
|
-
Imported by: business layer (services call external APIs through infrastructure).
|
|
127
|
-
|
|
128
|
-
VALIDATE:
|
|
129
|
-
Read harness.yaml — existing layers: presentation, business, data.
|
|
130
|
-
No conflict with "infrastructure" name.
|
|
131
|
-
Run: harness check-deps — passes (clean baseline).
|
|
132
|
-
|
|
133
|
-
ADD:
|
|
134
|
-
harness add layer infrastructure --dirs src/infrastructure --imports none
|
|
135
|
-
mkdir -p src/infrastructure
|
|
136
|
-
|
|
137
|
-
WIRE:
|
|
138
|
-
Update harness.yaml: allow business → infrastructure imports.
|
|
139
|
-
Update AGENTS.md: document infrastructure layer purpose and boundaries.
|
|
140
|
-
|
|
141
|
-
VERIFY:
|
|
142
|
-
harness validate # Pass
|
|
143
|
-
harness check-deps # Pass
|
|
144
|
-
git add harness.yaml AGENTS.md src/infrastructure/
|
|
145
|
-
git commit -m "feat: add infrastructure layer for external API clients"
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Example: Adding a Document for Drift Tracking
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
Human: "Track our API specification for documentation drift."
|
|
152
|
-
|
|
153
|
-
DETERMINE: Adding a document. Path: docs/api-spec.md.
|
|
154
|
-
Tracks: src/routes/, src/models/response.ts.
|
|
155
|
-
|
|
156
|
-
ADD:
|
|
157
|
-
harness add doc docs/api-spec.md --tracks src/routes,src/models/response.ts
|
|
158
|
-
|
|
159
|
-
WIRE:
|
|
160
|
-
Update AGENTS.md: note that docs/api-spec.md is tracked for drift.
|
|
161
|
-
|
|
162
|
-
VERIFY:
|
|
163
|
-
harness validate # Pass
|
|
164
|
-
git add harness.yaml AGENTS.md
|
|
165
|
-
git commit -m "feat: track API spec for documentation drift detection"
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Example: Adding a Component to an Existing Layer
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
Human: "Add a notification service to the business layer."
|
|
172
|
-
|
|
173
|
-
DETERMINE: Adding a component. Name: notification-service. Layer: business.
|
|
174
|
-
Depends on: data layer (notification repository). Depended on by: presentation layer (routes).
|
|
175
|
-
|
|
176
|
-
VALIDATE:
|
|
177
|
-
Read harness.yaml — business layer exists, maps to src/services/.
|
|
178
|
-
No existing notification-service directory.
|
|
179
|
-
business → data is an allowed import. Presentation → business is allowed.
|
|
180
|
-
Run: harness check-deps — passes.
|
|
181
|
-
|
|
182
|
-
ADD:
|
|
183
|
-
harness add component notification-service --layer business
|
|
184
|
-
Create src/services/notification-service.ts
|
|
185
|
-
Create src/services/notification-service.test.ts
|
|
186
|
-
|
|
187
|
-
WIRE:
|
|
188
|
-
Add export to src/services/index.ts (if barrel file exists).
|
|
189
|
-
Update AGENTS.md: add notification service to business layer component list.
|
|
190
|
-
|
|
191
|
-
VERIFY:
|
|
192
|
-
harness validate # Pass
|
|
193
|
-
harness check-deps # Pass
|
|
194
|
-
git add harness.yaml AGENTS.md src/services/notification-service.*
|
|
195
|
-
git commit -m "feat: add notification service to business layer"
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
--- skill.yaml (agents/skills/claude-code/add-harness-component/skill.yaml) ---
|
|
200
|
-
name: add-harness-component
|
|
201
|
-
version: "1.0.0"
|
|
202
|
-
description: Add a component to an existing harness project
|
|
203
|
-
cognitive_mode: constructive-architect
|
|
204
|
-
triggers:
|
|
205
|
-
- manual
|
|
206
|
-
platforms:
|
|
207
|
-
- claude-code
|
|
208
|
-
- gemini-cli
|
|
209
|
-
tools:
|
|
210
|
-
- Bash
|
|
211
|
-
- Read
|
|
212
|
-
- Write
|
|
213
|
-
- Edit
|
|
214
|
-
- Glob
|
|
215
|
-
cli:
|
|
216
|
-
command: harness skill run add-harness-component
|
|
217
|
-
args:
|
|
218
|
-
- name: path
|
|
219
|
-
description: Project root path
|
|
220
|
-
required: false
|
|
221
|
-
mcp:
|
|
222
|
-
tool: run_skill
|
|
223
|
-
input:
|
|
224
|
-
skill: add-harness-component
|
|
225
|
-
path: string
|
|
226
|
-
type: flexible
|
|
227
|
-
state:
|
|
228
|
-
persistent: false
|
|
229
|
-
files: []
|
|
230
|
-
depends_on:
|
|
231
|
-
- initialize-harness-project
|
|
232
|
-
|
|
233
|
-
</execution_context>
|
|
234
|
-
|
|
235
|
-
<process>
|
|
236
|
-
1. Try: invoke mcp__harness__run_skill with skill: "add-harness-component"
|
|
237
|
-
2. If MCP unavailable: follow the SKILL.md workflow provided above directly
|
|
238
|
-
3. Pass through any arguments provided by the user
|
|
239
|
-
</process>
|
|
240
|
-
"""
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
# Generated by harness generate-slash-commands. Do not edit.
|
|
2
|
-
description = "Auto-fix documentation drift issues"
|
|
3
|
-
prompt = """
|
|
4
|
-
<context>
|
|
5
|
-
Cognitive mode: meticulous-verifier
|
|
6
|
-
Type: flexible
|
|
7
|
-
</context>
|
|
8
|
-
|
|
9
|
-
<objective>
|
|
10
|
-
Auto-fix documentation drift issues
|
|
11
|
-
</objective>
|
|
12
|
-
|
|
13
|
-
<execution_context>
|
|
14
|
-
--- SKILL.md (agents/skills/claude-code/align-documentation/SKILL.md) ---
|
|
15
|
-
# Align Documentation
|
|
16
|
-
|
|
17
|
-
> Sync documentation with code after implementation changes. Keep AGENTS.md, API docs, and architecture docs accurate by mapping code changes to their documentation impact.
|
|
18
|
-
|
|
19
|
-
## When to Use
|
|
20
|
-
|
|
21
|
-
- After completing a feature implementation (post-merge or post-commit)
|
|
22
|
-
- After fixing a bug that changes observable behavior
|
|
23
|
-
- After a refactoring that renames, moves, or restructures code
|
|
24
|
-
- When detect-doc-drift reports findings that need fixing
|
|
25
|
-
- When `on_post_feature` or `on_post_merge` triggers fire
|
|
26
|
-
- NOT during active development — wait until the code is stable
|
|
27
|
-
- NOT for creating documentation for a brand-new project (use validate-context-engineering for initial setup)
|
|
28
|
-
- NOT for fixing code — this skill only changes documentation
|
|
29
|
-
|
|
30
|
-
## Process
|
|
31
|
-
|
|
32
|
-
### Phase 1: Detect — Identify What Changed
|
|
33
|
-
|
|
34
|
-
1. **Run `git diff` against the appropriate baseline.** Choose the baseline based on context:
|
|
35
|
-
- After a feature: diff against the branch point (`git diff main...HEAD`)
|
|
36
|
-
- After a bug fix: diff against the commit before the fix
|
|
37
|
-
- After a refactoring: diff against the commit before refactoring started
|
|
38
|
-
- Periodic sync: diff against the last documentation sync commit
|
|
39
|
-
|
|
40
|
-
2. **Extract the list of changed files.** For each changed file, note:
|
|
41
|
-
- File path (current and previous if renamed/moved)
|
|
42
|
-
- Nature of change (added, modified, deleted, renamed)
|
|
43
|
-
- Changed exports (new, removed, renamed, signature changed)
|
|
44
|
-
- Changed behavior (different return values, new error types, new side effects)
|
|
45
|
-
|
|
46
|
-
3. **Run `harness check-docs`** to identify any documentation that already has broken references due to the changes.
|
|
47
|
-
|
|
48
|
-
### Phase 2: Map — Connect Code Changes to Documentation
|
|
49
|
-
|
|
50
|
-
For each changed file, identify all documentation that references it:
|
|
51
|
-
|
|
52
|
-
**AGENTS.md sections:**
|
|
53
|
-
|
|
54
|
-
- Knowledge map entries that reference the file path
|
|
55
|
-
- Architecture descriptions that mention the module
|
|
56
|
-
- Constraint documentation that references the file's layer or patterns
|
|
57
|
-
- Onboarding guides that walk through the file
|
|
58
|
-
|
|
59
|
-
**API documentation:**
|
|
60
|
-
|
|
61
|
-
- JSDoc/TSDoc comments in the changed files themselves
|
|
62
|
-
- Generated API doc pages that pull from the changed files
|
|
63
|
-
- README examples that demonstrate the changed functions
|
|
64
|
-
- Tutorial or guide pages that use the changed code
|
|
65
|
-
|
|
66
|
-
**Architecture documentation:**
|
|
67
|
-
|
|
68
|
-
- Diagrams that include the changed module
|
|
69
|
-
- Data flow descriptions that reference the changed functions
|
|
70
|
-
- Layer descriptions that list the changed file
|
|
71
|
-
- Dependency documentation that references the changed imports
|
|
72
|
-
|
|
73
|
-
**Inline code comments:**
|
|
74
|
-
|
|
75
|
-
- Comments in OTHER files that reference the changed file or function
|
|
76
|
-
- TODO comments that reference the changed behavior
|
|
77
|
-
- Workaround comments that may no longer apply after the change
|
|
78
|
-
|
|
79
|
-
### Phase 3: Generate — Draft Documentation Updates
|
|
80
|
-
|
|
81
|
-
For each affected documentation location:
|
|
82
|
-
|
|
83
|
-
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.
|
|
84
|
-
|
|
85
|
-
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.
|
|
86
|
-
|
|
87
|
-
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.
|
|
88
|
-
|
|
89
|
-
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.
|
|
90
|
-
|
|
91
|
-
### Phase 4: Validate — Verify Documentation Accuracy
|
|
92
|
-
|
|
93
|
-
1. **Run `harness check-docs`** to verify all links and references resolve correctly after the updates.
|
|
94
|
-
|
|
95
|
-
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.
|
|
96
|
-
|
|
97
|
-
3. **Verify no orphaned references remain.** Search documentation files for any remaining references to old names, old paths, or deleted features.
|
|
98
|
-
|
|
99
|
-
4. **Run `harness fix-drift`** to catch any remaining simple drift issues that manual review missed.
|
|
100
|
-
|
|
101
|
-
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."
|
|
102
|
-
|
|
103
|
-
## What to Update
|
|
104
|
-
|
|
105
|
-
### AGENTS.md Knowledge Map
|
|
106
|
-
|
|
107
|
-
- File paths and module names (renamed or moved files)
|
|
108
|
-
- Module purpose descriptions (changed responsibilities)
|
|
109
|
-
- Constraint descriptions (new or changed rules)
|
|
110
|
-
- Relationship descriptions (new or changed dependencies)
|
|
111
|
-
- Gotcha sections (resolved gotchas, new gotchas)
|
|
112
|
-
|
|
113
|
-
### Inline Code Comments
|
|
114
|
-
|
|
115
|
-
- Function/class doc comments in the changed files (JSDoc, TSDoc)
|
|
116
|
-
- Comments in other files that reference the changed code
|
|
117
|
-
- TODO comments that reference completed or changed work
|
|
118
|
-
- Workaround comments for issues that may now be resolved
|
|
119
|
-
|
|
120
|
-
### Documentation Pages (docs/)
|
|
121
|
-
|
|
122
|
-
- API reference pages that describe changed functions
|
|
123
|
-
- Architecture pages that diagram changed modules
|
|
124
|
-
- Tutorial and guide pages that demonstrate changed code
|
|
125
|
-
- Getting-started guides if entry points changed
|
|
126
|
-
- Changelog entries for user-facing changes
|
|
127
|
-
|
|
128
|
-
## Harness Integration
|
|
129
|
-
|
|
130
|
-
- **`harness check-docs`** — Run before and after updates. Identifies broken references and validates that all documentation links resolve.
|
|
131
|
-
- **`harness fix-drift`** — Auto-fix simple drift issues (broken file paths, renamed references) after manual review confirms correctness.
|
|
132
|
-
- **`harness fix-drift --json`** — Machine-readable output for tracking what was auto-fixed.
|
|
133
|
-
- **`harness validate`** — Run after documentation changes to verify overall project health is maintained.
|
|
134
|
-
|
|
135
|
-
## Success Criteria
|
|
136
|
-
|
|
137
|
-
- `harness check-docs` passes with zero errors after documentation updates
|
|
138
|
-
- Every code change from the diff has been mapped to its documentation impact
|
|
139
|
-
- All file paths in documentation match current file locations
|
|
140
|
-
- All function/class names in documentation match current code
|
|
141
|
-
- All behavioral descriptions in documentation match current implementation
|
|
142
|
-
- Documentation updates are committed with clear references to the triggering code change
|
|
143
|
-
- No orphaned references to old names, paths, or deleted features remain
|
|
144
|
-
|
|
145
|
-
## Examples
|
|
146
|
-
|
|
147
|
-
### Example: Syncing docs after a module rename
|
|
148
|
-
|
|
149
|
-
**Code change:** `src/services/mailer.ts` renamed to `src/services/email-service.ts`. Functions `sendMail()` and `formatMailBody()` renamed to `sendEmail()` and `formatEmailBody()`.
|
|
150
|
-
|
|
151
|
-
**Documentation impact map:**
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
AGENTS.md:34 — "mailer.ts handles email delivery" → update path and description
|
|
155
|
-
AGENTS.md:78 — "Use sendMail() for all outbound email" → update function name
|
|
156
|
-
docs/api.md:156 — sendMail() API reference → update name and import path
|
|
157
|
-
docs/arch.md:45 — architecture diagram lists "mailer" → update to "email-service"
|
|
158
|
-
src/controllers/user-controller.ts:12 — comment "// delegates to mailer" → update
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
**Updates applied:**
|
|
162
|
-
|
|
163
|
-
- AGENTS.md: updated two sections with new file path and function names
|
|
164
|
-
- docs/api.md: updated function reference and import example
|
|
165
|
-
- docs/arch.md: updated module name in architecture description
|
|
166
|
-
- src/controllers/user-controller.ts: updated inline comment
|
|
167
|
-
|
|
168
|
-
**Validation:** `harness check-docs` passes. All references resolve. Commit: "docs: sync documentation after mailer rename to email-service"
|
|
169
|
-
|
|
170
|
-
### Example: Syncing docs after adding error handling
|
|
171
|
-
|
|
172
|
-
**Code change:** `createUser()` in `src/services/user-service.ts` now throws `ValidationError` instead of returning `null` on invalid input.
|
|
173
|
-
|
|
174
|
-
**Documentation impact map:**
|
|
175
|
-
|
|
176
|
-
```
|
|
177
|
-
docs/api.md:89 — "Returns null if validation fails" → update to describe thrown error
|
|
178
|
-
AGENTS.md:52 — No mention of error handling → add note about ValidationError
|
|
179
|
-
src/services/user-service.ts:15 — JSDoc @returns tag → update, add @throws tag
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
**Updates applied:**
|
|
183
|
-
|
|
184
|
-
- docs/api.md: replaced "returns null" with "throws ValidationError" and added example
|
|
185
|
-
- AGENTS.md: added note about error handling pattern in user-service section
|
|
186
|
-
- JSDoc: updated @returns, added @throws ValidationError
|
|
187
|
-
|
|
188
|
-
**Validation:** `harness check-docs` passes. Commit: "docs: update documentation for createUser error handling change"
|
|
189
|
-
|
|
190
|
-
## Escalation
|
|
191
|
-
|
|
192
|
-
- **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.
|
|
193
|
-
- **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.
|
|
194
|
-
- **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.
|
|
195
|
-
- **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.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
--- skill.yaml (agents/skills/claude-code/align-documentation/skill.yaml) ---
|
|
199
|
-
name: align-documentation
|
|
200
|
-
version: "1.0.0"
|
|
201
|
-
description: Auto-fix documentation drift issues
|
|
202
|
-
cognitive_mode: meticulous-verifier
|
|
203
|
-
triggers:
|
|
204
|
-
- manual
|
|
205
|
-
platforms:
|
|
206
|
-
- claude-code
|
|
207
|
-
- gemini-cli
|
|
208
|
-
tools:
|
|
209
|
-
- Bash
|
|
210
|
-
- Read
|
|
211
|
-
- Write
|
|
212
|
-
- Edit
|
|
213
|
-
cli:
|
|
214
|
-
command: harness skill run align-documentation
|
|
215
|
-
args:
|
|
216
|
-
- name: path
|
|
217
|
-
description: Project root path
|
|
218
|
-
required: false
|
|
219
|
-
mcp:
|
|
220
|
-
tool: run_skill
|
|
221
|
-
input:
|
|
222
|
-
skill: align-documentation
|
|
223
|
-
path: string
|
|
224
|
-
type: flexible
|
|
225
|
-
state:
|
|
226
|
-
persistent: false
|
|
227
|
-
files: []
|
|
228
|
-
depends_on:
|
|
229
|
-
- detect-doc-drift
|
|
230
|
-
|
|
231
|
-
</execution_context>
|
|
232
|
-
|
|
233
|
-
<process>
|
|
234
|
-
1. Try: invoke mcp__harness__run_skill with skill: "align-documentation"
|
|
235
|
-
2. If MCP unavailable: follow the SKILL.md workflow provided above directly
|
|
236
|
-
3. Pass through any arguments provided by the user
|
|
237
|
-
</process>
|
|
238
|
-
"""
|