@harness-engineering/cli 1.8.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.
- package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +2 -2
- package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +5 -7
- package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +2 -2
- package/dist/agents/skills/claude-code/harness-planning/SKILL.md +2 -2
- package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +4 -5
- package/dist/agents/skills/gemini-cli/add-harness-component/SKILL.md +192 -0
- package/dist/agents/skills/gemini-cli/add-harness-component/skill.yaml +32 -0
- package/dist/agents/skills/gemini-cli/align-documentation/SKILL.md +213 -0
- package/dist/agents/skills/gemini-cli/align-documentation/skill.yaml +31 -0
- package/dist/agents/skills/gemini-cli/check-mechanical-constraints/SKILL.md +191 -0
- package/dist/agents/skills/gemini-cli/check-mechanical-constraints/skill.yaml +32 -0
- package/dist/agents/skills/gemini-cli/cleanup-dead-code/SKILL.md +245 -0
- package/dist/agents/skills/gemini-cli/cleanup-dead-code/skill.yaml +33 -0
- package/dist/agents/skills/gemini-cli/detect-doc-drift/SKILL.md +179 -0
- package/dist/agents/skills/gemini-cli/detect-doc-drift/skill.yaml +30 -0
- package/dist/agents/skills/gemini-cli/enforce-architecture/SKILL.md +240 -0
- package/dist/agents/skills/gemini-cli/enforce-architecture/skill.yaml +34 -0
- package/dist/agents/skills/gemini-cli/harness-architecture-advisor/SKILL.md +397 -0
- package/dist/agents/skills/gemini-cli/harness-architecture-advisor/skill.yaml +48 -0
- package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +2 -2
- package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +317 -0
- package/dist/agents/skills/gemini-cli/harness-brainstorming/skill.yaml +49 -0
- package/dist/agents/skills/gemini-cli/harness-code-review/SKILL.md +681 -0
- package/dist/agents/skills/gemini-cli/harness-code-review/skill.yaml +45 -0
- package/dist/agents/skills/gemini-cli/harness-debugging/SKILL.md +366 -0
- package/dist/agents/skills/gemini-cli/harness-debugging/skill.yaml +47 -0
- package/dist/agents/skills/gemini-cli/harness-diagnostics/SKILL.md +318 -0
- package/dist/agents/skills/gemini-cli/harness-diagnostics/skill.yaml +50 -0
- package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +382 -0
- package/dist/agents/skills/gemini-cli/harness-execution/skill.yaml +51 -0
- package/dist/agents/skills/gemini-cli/harness-git-workflow/SKILL.md +268 -0
- package/dist/agents/skills/gemini-cli/harness-git-workflow/skill.yaml +31 -0
- package/dist/agents/skills/gemini-cli/harness-integrity/SKILL.md +167 -0
- package/dist/agents/skills/gemini-cli/harness-integrity/skill.yaml +47 -0
- package/dist/agents/skills/gemini-cli/harness-onboarding/SKILL.md +288 -0
- package/dist/agents/skills/gemini-cli/harness-onboarding/skill.yaml +30 -0
- package/dist/agents/skills/gemini-cli/harness-parallel-agents/SKILL.md +171 -0
- package/dist/agents/skills/gemini-cli/harness-parallel-agents/skill.yaml +33 -0
- package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +389 -0
- package/dist/agents/skills/gemini-cli/harness-planning/skill.yaml +49 -0
- package/dist/agents/skills/gemini-cli/harness-pre-commit-review/SKILL.md +262 -0
- package/dist/agents/skills/gemini-cli/harness-pre-commit-review/skill.yaml +33 -0
- package/dist/agents/skills/gemini-cli/harness-refactoring/SKILL.md +169 -0
- package/dist/agents/skills/gemini-cli/harness-refactoring/skill.yaml +33 -0
- package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +4 -5
- package/dist/agents/skills/gemini-cli/harness-skill-authoring/SKILL.md +292 -0
- package/dist/agents/skills/gemini-cli/harness-skill-authoring/skill.yaml +32 -0
- package/dist/agents/skills/gemini-cli/harness-state-management/SKILL.md +309 -0
- package/dist/agents/skills/gemini-cli/harness-state-management/skill.yaml +32 -0
- package/dist/agents/skills/gemini-cli/harness-tdd/SKILL.md +177 -0
- package/dist/agents/skills/gemini-cli/harness-tdd/skill.yaml +48 -0
- package/dist/agents/skills/gemini-cli/harness-verification/SKILL.md +328 -0
- package/dist/agents/skills/gemini-cli/harness-verification/skill.yaml +42 -0
- package/dist/agents/skills/gemini-cli/harness-verify/SKILL.md +159 -0
- package/dist/agents/skills/gemini-cli/harness-verify/skill.yaml +40 -0
- package/dist/agents/skills/gemini-cli/initialize-harness-project/SKILL.md +224 -0
- package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +31 -0
- package/dist/agents/skills/gemini-cli/validate-context-engineering/SKILL.md +150 -0
- package/dist/agents/skills/gemini-cli/validate-context-engineering/skill.yaml +31 -0
- package/dist/bin/harness.js +3 -3
- package/dist/{chunk-SJECMKSS.js → chunk-E2RTDBMG.js} +25 -13
- package/dist/{chunk-LNI4T7R6.js → chunk-KJANDVVC.js} +20 -18
- package/dist/{chunk-3JWCBVUZ.js → chunk-RT2LYQHF.js} +1 -1
- package/dist/{dist-NT3GXHQZ.js → dist-CCM3L3UE.js} +1 -1
- package/dist/{dist-BDO5GFEM.js → dist-K6KTTN3I.js} +3 -3
- package/dist/index.js +3 -3
- package/dist/validate-cross-check-ZGKFQY57.js +7 -0
- package/package.json +6 -6
- package/dist/agents/skills/node_modules/.bin/glob +0 -17
- package/dist/agents/skills/node_modules/.bin/vitest +0 -17
- package/dist/agents/skills/node_modules/.bin/yaml +0 -17
- package/dist/templates/advanced/docs/specs/.gitkeep +0 -0
- package/dist/templates/intermediate/docs/specs/.gitkeep +0 -0
- package/dist/validate-cross-check-2OPGCGGU.js +0 -7
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Harness Git Workflow
|
|
2
|
+
|
|
3
|
+
> Worktree setup, dependency installation, baseline verification, and branch finishing. Clean isolation for every workstream.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- When starting work that should be isolated from the main branch (new feature, experiment, multi-task plan)
|
|
8
|
+
- When finishing a branch and deciding how to land it (merge, PR, keep, discard)
|
|
9
|
+
- When `on_pr` or `on_commit` triggers fire and worktree management is needed
|
|
10
|
+
- When the human asks to "set up a branch" or "start a new workstream"
|
|
11
|
+
- NOT for simple single-file changes that do not need branch isolation
|
|
12
|
+
- NOT when work is already in progress on the correct branch
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
### Part A: Worktree Creation
|
|
17
|
+
|
|
18
|
+
#### Step 1: Choose Worktree Location
|
|
19
|
+
|
|
20
|
+
1. **Check for `.worktrees/` directory** in the project root. If it exists, use it — this is the preferred location.
|
|
21
|
+
|
|
22
|
+
2. **Check CLAUDE.md or AGENTS.md** for worktree preferences. Some projects specify a custom worktree directory or naming convention. Follow those instructions.
|
|
23
|
+
|
|
24
|
+
3. **If neither exists, ask the user:** "Where should I create the worktree? Options: (A) `.worktrees/<branch-name>` in the project root, (B) a sibling directory alongside the project, (C) a custom path."
|
|
25
|
+
|
|
26
|
+
4. **If placing worktrees in the project directory,** verify that the worktree directory is gitignored. Check `.gitignore` for `.worktrees/` or the chosen directory name. If not gitignored, add it before creating the worktree.
|
|
27
|
+
|
|
28
|
+
#### Step 2: Check for Existing Worktrees
|
|
29
|
+
|
|
30
|
+
1. **Run `git worktree list`** to see active worktrees.
|
|
31
|
+
|
|
32
|
+
2. **If a worktree already exists for the target branch,** do not create a duplicate. Ask: "A worktree for branch `<name>` already exists at `<path>`. Should I use it, or create a new branch?"
|
|
33
|
+
|
|
34
|
+
3. **If the target directory already exists** (but is not a worktree), do not overwrite. Ask the user how to proceed.
|
|
35
|
+
|
|
36
|
+
#### Step 3: Create Branch and Worktree
|
|
37
|
+
|
|
38
|
+
1. **Create the branch** from the current HEAD (or from the specified base):
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
git branch <branch-name> <base>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. **Create the worktree:**
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
git worktree add <path> <branch-name>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
3. **Verify the worktree was created.** Check that the directory exists and contains a `.git` file (not a `.git` directory — worktrees use a file pointing to the main repo).
|
|
51
|
+
|
|
52
|
+
#### Step 4: Auto-Detect and Run Setup
|
|
53
|
+
|
|
54
|
+
Inspect the worktree for project files and run the appropriate setup:
|
|
55
|
+
|
|
56
|
+
| File Found | Action |
|
|
57
|
+
| ---------------------------------- | ------------------------------------------------------------------------ |
|
|
58
|
+
| `package.json` | `npm install` (or `yarn install` / `pnpm install` if lockfile indicates) |
|
|
59
|
+
| `Cargo.toml` | `cargo build` |
|
|
60
|
+
| `go.mod` | `go mod download` |
|
|
61
|
+
| `requirements.txt` | `pip install -r requirements.txt` |
|
|
62
|
+
| `pyproject.toml` | `pip install -e .` or `poetry install` |
|
|
63
|
+
| `Gemfile` | `bundle install` |
|
|
64
|
+
| `Makefile` (with `install` target) | `make install` |
|
|
65
|
+
|
|
66
|
+
If multiple project files exist (monorepo), install at the root level. Do not guess which subpackages to install — follow the project's documented setup or ask.
|
|
67
|
+
|
|
68
|
+
#### Step 5: Verify Clean Baseline
|
|
69
|
+
|
|
70
|
+
Before any work begins, verify the worktree is in a clean, working state:
|
|
71
|
+
|
|
72
|
+
1. **Run the test suite.** All tests must pass on the fresh branch before any changes.
|
|
73
|
+
|
|
74
|
+
2. **Run `harness validate`.** Project health must be green before starting work.
|
|
75
|
+
|
|
76
|
+
3. **If tests fail or validation fails on the fresh branch,** stop. The base branch has issues. Report: "Baseline verification failed on fresh branch: [failure details]. The base branch needs to be fixed first."
|
|
77
|
+
|
|
78
|
+
4. **Record the baseline.** Note the test count and validation result. This is the comparison point for the branch finishing phase.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Part B: Branch Finishing
|
|
83
|
+
|
|
84
|
+
When work on the branch is complete, follow this protocol to land the changes.
|
|
85
|
+
|
|
86
|
+
#### Step 1: Pre-Finish Verification
|
|
87
|
+
|
|
88
|
+
1. **Run the full test suite.** All tests must pass.
|
|
89
|
+
|
|
90
|
+
2. **Run `harness validate`.** Project health must be green.
|
|
91
|
+
|
|
92
|
+
3. **Check for uncommitted changes.** Run `git status`. All changes must be committed. If there are uncommitted changes, commit or stash them before finishing.
|
|
93
|
+
|
|
94
|
+
4. **Check the branch is up to date.** If the base branch has advanced since the worktree was created:
|
|
95
|
+
```
|
|
96
|
+
git fetch origin
|
|
97
|
+
git log HEAD..origin/main --oneline
|
|
98
|
+
```
|
|
99
|
+
If there are new commits on the base, rebase or merge before finishing:
|
|
100
|
+
```
|
|
101
|
+
git rebase origin/main
|
|
102
|
+
```
|
|
103
|
+
Re-run tests after rebasing.
|
|
104
|
+
|
|
105
|
+
#### Step 2: Choose Finishing Strategy
|
|
106
|
+
|
|
107
|
+
Present 4 options to the user:
|
|
108
|
+
|
|
109
|
+
1. **Merge locally.** Merge the branch into the base branch on the local machine.
|
|
110
|
+
- Best for: small changes, solo work, when CI is not required
|
|
111
|
+
- Command: `git checkout main && git merge <branch>`
|
|
112
|
+
|
|
113
|
+
2. **Push and create PR.** Push the branch to the remote and open a pull request.
|
|
114
|
+
- Best for: team work, changes that need review, when CI must pass
|
|
115
|
+
- Command: `git push -u origin <branch>` then create PR via `gh pr create`
|
|
116
|
+
|
|
117
|
+
3. **Keep as-is.** Leave the branch and worktree in place for continued work later.
|
|
118
|
+
- Best for: work-in-progress, experiments, paused projects
|
|
119
|
+
|
|
120
|
+
4. **Discard.** Delete the branch and worktree. All changes are lost.
|
|
121
|
+
- Best for: failed experiments, abandoned approaches
|
|
122
|
+
- Safety: Confirm with the user before discarding. List the commits that will be lost.
|
|
123
|
+
|
|
124
|
+
#### Step 3: Execute Chosen Strategy
|
|
125
|
+
|
|
126
|
+
**If merge locally:**
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
cd <main-repo-path>
|
|
130
|
+
git merge <branch-name>
|
|
131
|
+
# Run tests on main after merge
|
|
132
|
+
# Run harness validate after merge
|
|
133
|
+
git worktree remove <worktree-path>
|
|
134
|
+
git branch -d <branch-name>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**If push and create PR:**
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
cd <worktree-path>
|
|
141
|
+
git push -u origin <branch-name>
|
|
142
|
+
gh pr create --title "<title>" --body "<description>"
|
|
143
|
+
# Report the PR URL to the user
|
|
144
|
+
# Leave worktree in place until PR is merged
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**If keep as-is:**
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
No action needed. Report the worktree path and branch name for future reference.
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**If discard:**
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Confirm with user first — list commits that will be lost
|
|
157
|
+
git worktree remove <worktree-path>
|
|
158
|
+
git branch -D <branch-name>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### Step 4: Clean Up
|
|
162
|
+
|
|
163
|
+
1. **Remove the worktree** (unless keeping as-is or waiting for PR merge):
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
git worktree remove <worktree-path>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
2. **Prune stale worktree references:**
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
git worktree prune
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
3. **Verify cleanup.** Run `git worktree list` and confirm the removed worktree is no longer listed.
|
|
176
|
+
|
|
177
|
+
## Harness Integration
|
|
178
|
+
|
|
179
|
+
- **`harness validate`** — Run during baseline verification (Step 5 of Part A) and pre-finish verification (Step 1 of Part B). Ensures project health is green at both boundaries.
|
|
180
|
+
- **Test runner** — Run fresh in the worktree, not in the main repo. Tests must pass both at baseline (before work) and at finish (after work).
|
|
181
|
+
- **`.gitignore`** — Verify worktree directory is gitignored if it lives inside the project tree.
|
|
182
|
+
|
|
183
|
+
## Success Criteria
|
|
184
|
+
|
|
185
|
+
- Worktree was created in the correct location (`.worktrees/` preferred, or per project convention)
|
|
186
|
+
- Dependencies were auto-detected and installed
|
|
187
|
+
- Baseline verification passed (tests green, harness validates) before any work began
|
|
188
|
+
- Branch finishing strategy was chosen by the user (not assumed)
|
|
189
|
+
- Chosen strategy was executed correctly (merge, PR, keep, or discard)
|
|
190
|
+
- Worktree was cleaned up after finishing (unless keeping for continued work)
|
|
191
|
+
- No stale worktree references remain after cleanup
|
|
192
|
+
|
|
193
|
+
## Examples
|
|
194
|
+
|
|
195
|
+
### Example: Setting Up a Worktree for a New Feature
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Check for preferred location
|
|
199
|
+
ls .worktrees/ # exists — use it
|
|
200
|
+
|
|
201
|
+
# Check gitignore
|
|
202
|
+
grep '.worktrees' .gitignore # found — good, already gitignored
|
|
203
|
+
|
|
204
|
+
# Check existing worktrees
|
|
205
|
+
git worktree list
|
|
206
|
+
# /Users/dev/project abc1234 [main]
|
|
207
|
+
# No existing worktree for this feature
|
|
208
|
+
|
|
209
|
+
# Create branch and worktree
|
|
210
|
+
git branch feat/notifications main
|
|
211
|
+
git worktree add .worktrees/notifications feat/notifications
|
|
212
|
+
|
|
213
|
+
# Auto-detect setup (found package.json)
|
|
214
|
+
cd .worktrees/notifications && npm install
|
|
215
|
+
|
|
216
|
+
# Verify baseline
|
|
217
|
+
npm test # 142 tests, all pass
|
|
218
|
+
harness validate # passes
|
|
219
|
+
|
|
220
|
+
# Ready to work. Report:
|
|
221
|
+
# "Worktree created at .worktrees/notifications on branch feat/notifications.
|
|
222
|
+
# 142 tests passing. harness validate green. Ready to start."
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Example: Finishing a Branch with PR
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Pre-finish verification
|
|
229
|
+
cd .worktrees/notifications
|
|
230
|
+
npm test # 158 tests, all pass (16 new)
|
|
231
|
+
harness validate # passes
|
|
232
|
+
git status # clean — all committed
|
|
233
|
+
|
|
234
|
+
# Check if base has advanced
|
|
235
|
+
git fetch origin
|
|
236
|
+
git log HEAD..origin/main --oneline
|
|
237
|
+
# 3 new commits on main — rebase
|
|
238
|
+
|
|
239
|
+
git rebase origin/main
|
|
240
|
+
npm test # still passes after rebase
|
|
241
|
+
|
|
242
|
+
# User chooses: Push and create PR
|
|
243
|
+
git push -u origin feat/notifications
|
|
244
|
+
gh pr create --title "feat(notifications): email and in-app notifications" \
|
|
245
|
+
--body "Implements notification service with create, list, and expiry.
|
|
246
|
+
16 new tests. All passing."
|
|
247
|
+
|
|
248
|
+
# Report: "PR created: https://github.com/org/repo/pull/42
|
|
249
|
+
# Worktree at .worktrees/notifications kept until PR merges."
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Example: Discarding a Failed Experiment
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# User says: "That approach didn't work, let's scrap it."
|
|
256
|
+
|
|
257
|
+
# Show what will be lost
|
|
258
|
+
git log main..HEAD --oneline
|
|
259
|
+
# a1b2c3d try websocket approach
|
|
260
|
+
# d4e5f6g add socket.io dependency
|
|
261
|
+
# "These 2 commits will be lost. Discard? (yes/no)"
|
|
262
|
+
# Human: "yes"
|
|
263
|
+
|
|
264
|
+
git worktree remove .worktrees/ws-experiment
|
|
265
|
+
git branch -D feat/ws-experiment
|
|
266
|
+
git worktree prune
|
|
267
|
+
git worktree list # ws-experiment no longer listed
|
|
268
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: harness-git-workflow
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
description: Git workflow best practices integrated with harness validation
|
|
4
|
+
cognitive_mode: meticulous-verifier
|
|
5
|
+
triggers:
|
|
6
|
+
- manual
|
|
7
|
+
- on_pr
|
|
8
|
+
- on_commit
|
|
9
|
+
platforms:
|
|
10
|
+
- claude-code
|
|
11
|
+
- gemini-cli
|
|
12
|
+
tools:
|
|
13
|
+
- Bash
|
|
14
|
+
- Read
|
|
15
|
+
- Glob
|
|
16
|
+
cli:
|
|
17
|
+
command: harness skill run harness-git-workflow
|
|
18
|
+
args:
|
|
19
|
+
- name: path
|
|
20
|
+
description: Project root path
|
|
21
|
+
required: false
|
|
22
|
+
mcp:
|
|
23
|
+
tool: run_skill
|
|
24
|
+
input:
|
|
25
|
+
skill: harness-git-workflow
|
|
26
|
+
path: string
|
|
27
|
+
type: flexible
|
|
28
|
+
state:
|
|
29
|
+
persistent: false
|
|
30
|
+
files: []
|
|
31
|
+
depends_on: []
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Harness Integrity
|
|
2
|
+
|
|
3
|
+
> Unified integrity gate — single invocation chains mechanical verification with AI-powered code review and produces a consolidated pass/fail report.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Before opening or merging a pull request
|
|
8
|
+
- At project milestones as a comprehensive quality check
|
|
9
|
+
- When you need a single authoritative answer: "is this code ready to ship?"
|
|
10
|
+
- NOT after every task (use `harness-verify` for quick post-task checks)
|
|
11
|
+
- NOT for deep architectural audits (use `harness-verification` for that)
|
|
12
|
+
|
|
13
|
+
## Relationship to Other Skills
|
|
14
|
+
|
|
15
|
+
| Skill | What It Does | Scope | Time |
|
|
16
|
+
| ---------------------------- | ---------------------------------------------- | ---------------------- | ----- |
|
|
17
|
+
| **harness-verify** | Mechanical only: typecheck, lint, test | Exit codes | ~30s |
|
|
18
|
+
| **harness-code-review** | AI only: change-type-aware review | LLM analysis | ~2min |
|
|
19
|
+
| **harness-integrity** (this) | Both: verify + code-review unified | Full pipeline | ~3min |
|
|
20
|
+
| **harness-verification** | Deep audit: architecture, patterns, edge cases | Thorough investigation | ~5min |
|
|
21
|
+
|
|
22
|
+
`harness-integrity` is the standard pre-PR gate. It runs the fast mechanical checks first, then layers on AI review, and produces a single consolidated report.
|
|
23
|
+
|
|
24
|
+
## Process
|
|
25
|
+
|
|
26
|
+
### Phase 1: VERIFY
|
|
27
|
+
|
|
28
|
+
Invoke `harness-verify` to run the mechanical quick gate.
|
|
29
|
+
|
|
30
|
+
1. Delegate entirely to `harness-verify` — typecheck, lint, test.
|
|
31
|
+
2. Capture the structured result (PASS/FAIL per check).
|
|
32
|
+
3. **If ALL three checks FAIL**, stop here. Do not proceed to Phase 2. The code is not in a reviewable state.
|
|
33
|
+
4. If at least one check passes (or some are skipped), proceed to Phase 2.
|
|
34
|
+
|
|
35
|
+
### Phase 1.5: SECURITY SCAN
|
|
36
|
+
|
|
37
|
+
Run the built-in security scanner as a mechanical check between verification and AI review.
|
|
38
|
+
|
|
39
|
+
1. Use `run_security_scan` MCP tool against the project root (or changed files if available).
|
|
40
|
+
2. Capture findings by severity: errors, warnings, info.
|
|
41
|
+
3. **Error-severity security findings are blocking** — they cause the overall integrity check to FAIL, same as a test failure.
|
|
42
|
+
4. Warning/info findings are included in the report but do not block.
|
|
43
|
+
|
|
44
|
+
### Phase 1.7: DESIGN HEALTH (conditional)
|
|
45
|
+
|
|
46
|
+
When the project has `design` configured in `harness.config.json`:
|
|
47
|
+
|
|
48
|
+
1. Run `harness-design` in review mode to check existing components against design intent and anti-patterns.
|
|
49
|
+
2. Run `harness-accessibility` in scan+evaluate mode to check WCAG compliance.
|
|
50
|
+
3. Combine findings into a design health summary:
|
|
51
|
+
- Error count (blocking, based on strictness)
|
|
52
|
+
- Warning count (non-blocking)
|
|
53
|
+
- Info count (advisory)
|
|
54
|
+
4. **Error-severity design findings are blocking** in `strict` mode only. In `standard` and `permissive` modes, design findings do not block.
|
|
55
|
+
5. If no `design` block exists, skip this phase entirely.
|
|
56
|
+
|
|
57
|
+
### Phase 1.8: I18N SCAN (conditional)
|
|
58
|
+
|
|
59
|
+
When the project has `i18n.enabled: true` in `harness.config.json`:
|
|
60
|
+
|
|
61
|
+
1. Run `harness-i18n` in scan mode to detect hardcoded strings, missing translations, locale-sensitive formatting issues, and RTL violations.
|
|
62
|
+
2. Combine findings into an i18n health summary:
|
|
63
|
+
- Error count (blocking, based on `i18n.strictness`)
|
|
64
|
+
- Warning count (non-blocking)
|
|
65
|
+
- Info count (advisory)
|
|
66
|
+
3. **Error-severity i18n findings are blocking** in `strict` mode only. In `standard` and `permissive` modes, i18n findings do not block.
|
|
67
|
+
4. If no `i18n` block exists or `i18n.enabled` is false, skip this phase entirely.
|
|
68
|
+
|
|
69
|
+
### Phase 2: REVIEW
|
|
70
|
+
|
|
71
|
+
Run change-type-aware AI review using `harness-code-review`.
|
|
72
|
+
|
|
73
|
+
1. Detect the change type if not provided: `feature`, `bugfix`, `refactor`, or `docs`.
|
|
74
|
+
2. Invoke `harness-code-review` with the detected change type.
|
|
75
|
+
3. Capture the review findings: suggestions, blocking issues, and notes.
|
|
76
|
+
4. A review finding is "blocking" only if it would cause a runtime error, data loss, or security vulnerability.
|
|
77
|
+
5. The AI review includes a security-focused pass that complements the mechanical scanner — checking for semantic issues like user input flowing to dangerous sinks across function boundaries.
|
|
78
|
+
|
|
79
|
+
### Phase 3: REPORT
|
|
80
|
+
|
|
81
|
+
Produce a unified integrity report in this exact format:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
Integrity Check: [PASS/FAIL]
|
|
85
|
+
- Tests: [PASS/FAIL/SKIPPED]
|
|
86
|
+
- Lint: [PASS/FAIL/SKIPPED]
|
|
87
|
+
- Types: [PASS/FAIL/SKIPPED]
|
|
88
|
+
- Security: [PASS/WARN/FAIL] ([count] errors, [count] warnings)
|
|
89
|
+
- Design: [PASS/WARN/FAIL/SKIPPED] ([count] errors, [count] warnings)
|
|
90
|
+
- i18n: [PASS/WARN/FAIL/SKIPPED] ([count] errors, [count] warnings)
|
|
91
|
+
- Review: [PASS/FAIL] ([count] suggestions, [count] blocking)
|
|
92
|
+
|
|
93
|
+
Overall: [PASS/FAIL]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Rules:
|
|
97
|
+
|
|
98
|
+
- Overall `PASS` requires: all non-skipped mechanical checks pass AND zero blocking review findings AND zero blocking design findings (strict mode only) AND zero blocking i18n findings (strict mode only).
|
|
99
|
+
- Any mechanical failure OR any blocking review finding means `FAIL`.
|
|
100
|
+
- On FAIL, include a summary section listing each failure reason.
|
|
101
|
+
- Non-blocking review suggestions are noted but do not cause FAIL.
|
|
102
|
+
|
|
103
|
+
## Deterministic Checks
|
|
104
|
+
|
|
105
|
+
- **Phase 1 is fully deterministic.** Exit codes determine pass/fail with no interpretation.
|
|
106
|
+
- **Phase 2 involves LLM judgment.** The AI review may produce different results on repeated runs. Only "blocking" findings (runtime errors, data loss, security) affect the overall result.
|
|
107
|
+
|
|
108
|
+
## Harness Integration
|
|
109
|
+
|
|
110
|
+
- Chains harness-verify (mechanical) and harness-code-review (AI) into a unified pipeline
|
|
111
|
+
- Follows Principle 7 — deterministic checks always run first
|
|
112
|
+
- Consumes change-type detection from harness-code-review for per-type checklists
|
|
113
|
+
- Output can be written to `.harness/integrity-report.md` for CI integration
|
|
114
|
+
- Invokes `harness-design` and `harness-accessibility` for design health when `design` config exists
|
|
115
|
+
- Design strictness from config controls whether design findings block the overall result
|
|
116
|
+
- Invokes `harness-i18n` for i18n compliance when `i18n.enabled` is true in config. i18n strictness controls whether findings block the overall result.
|
|
117
|
+
|
|
118
|
+
## Success Criteria
|
|
119
|
+
|
|
120
|
+
- [ ] Mechanical verification ran and produced structured results
|
|
121
|
+
- [ ] AI review ran with change-type awareness
|
|
122
|
+
- [ ] Unified report follows the exact format
|
|
123
|
+
- [ ] Overall verdict correctly reflects both mechanical and review results
|
|
124
|
+
|
|
125
|
+
## Examples
|
|
126
|
+
|
|
127
|
+
### Example: All Clear
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
Integrity Check: PASS
|
|
131
|
+
- Tests: PASS (42/42)
|
|
132
|
+
- Lint: PASS (0 warnings)
|
|
133
|
+
- Types: PASS
|
|
134
|
+
- Security: PASS (0 errors, 0 warnings)
|
|
135
|
+
- Design: PASS (0 errors, 0 warnings)
|
|
136
|
+
- i18n: PASS (0 errors, 0 warnings)
|
|
137
|
+
- Review: 1 suggestion (0 blocking)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Example: Security Blocking Issue
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
Integrity Check: FAIL
|
|
144
|
+
- Tests: PASS (42/42)
|
|
145
|
+
- Lint: PASS
|
|
146
|
+
- Types: PASS
|
|
147
|
+
- Security: FAIL (1 error, 0 warnings)
|
|
148
|
+
- [SEC-INJ-002] src/auth/login.ts:42 — SQL query built with string concatenation
|
|
149
|
+
- Design: WARN (0 errors, 2 warnings)
|
|
150
|
+
- i18n: SKIPPED
|
|
151
|
+
- Review: 3 findings (1 blocking)
|
|
152
|
+
|
|
153
|
+
Blocking: [SEC-INJ-002] SQL injection — user input passed directly to query without parameterization.
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Gates
|
|
157
|
+
|
|
158
|
+
- **Mechanical first.** Always run Phase 1 before Phase 2. If the code does not compile or pass basic checks, AI review is wasted effort (unless partial results exist).
|
|
159
|
+
- **No partial reports.** The report must include results from all phases that were executed. Do not output Phase 1 results without attempting Phase 2 (unless the all-fail early stop triggers).
|
|
160
|
+
- **Fresh execution only.** Do not reuse cached results. Run everything from scratch each time.
|
|
161
|
+
|
|
162
|
+
## Escalation
|
|
163
|
+
|
|
164
|
+
- **All checks fail:** If typecheck, lint, and test all fail in Phase 1, stop immediately. Report the failures and skip Phase 2. The code needs basic fixes before review is worthwhile.
|
|
165
|
+
- **Architectural concerns:** If the AI review identifies architectural concerns, note them in the report but do not mark them as blocking. Architectural decisions require human judgment.
|
|
166
|
+
- **Timeout:** Phase 1 inherits the 120-second per-command timeout from `harness-verify`. Phase 2 has a 180-second timeout for the AI review.
|
|
167
|
+
- **Missing dependencies:** If `harness-verify` or `harness-code-review` skills are unavailable, report the missing dependency and mark the corresponding phase as `ERROR`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: harness-integrity
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
description: Unified integrity gate — chains verify (quick gate) with AI review into a single report
|
|
4
|
+
triggers:
|
|
5
|
+
- manual
|
|
6
|
+
- on_pr
|
|
7
|
+
- on_milestone
|
|
8
|
+
platforms:
|
|
9
|
+
- claude-code
|
|
10
|
+
- gemini-cli
|
|
11
|
+
tools:
|
|
12
|
+
- Bash
|
|
13
|
+
- Read
|
|
14
|
+
- Glob
|
|
15
|
+
- Grep
|
|
16
|
+
cli:
|
|
17
|
+
command: harness skill run harness-integrity
|
|
18
|
+
args:
|
|
19
|
+
- name: path
|
|
20
|
+
description: Project root path
|
|
21
|
+
required: false
|
|
22
|
+
- name: change-type
|
|
23
|
+
description: "Type of change: feature, bugfix, refactor, docs"
|
|
24
|
+
required: false
|
|
25
|
+
mcp:
|
|
26
|
+
tool: run_skill
|
|
27
|
+
input:
|
|
28
|
+
skill: harness-integrity
|
|
29
|
+
path: string
|
|
30
|
+
type: rigid
|
|
31
|
+
cognitive_mode: meticulous-verifier
|
|
32
|
+
phases:
|
|
33
|
+
- name: verify
|
|
34
|
+
description: Run harness-verify quick gate (test, lint, typecheck)
|
|
35
|
+
required: true
|
|
36
|
+
- name: review
|
|
37
|
+
description: Run change-type-aware AI review
|
|
38
|
+
required: true
|
|
39
|
+
- name: report
|
|
40
|
+
description: Produce unified integrity report
|
|
41
|
+
required: true
|
|
42
|
+
state:
|
|
43
|
+
persistent: false
|
|
44
|
+
files: []
|
|
45
|
+
depends_on:
|
|
46
|
+
- harness-verify
|
|
47
|
+
- harness-code-review
|