@harness-engineering/cli 1.7.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/personas/documentation-maintainer.yaml +3 -1
- package/dist/agents/personas/performance-guardian.yaml +23 -0
- package/dist/agents/skills/claude-code/align-documentation/SKILL.md +13 -0
- package/dist/agents/skills/claude-code/cleanup-dead-code/SKILL.md +25 -1
- package/dist/agents/skills/claude-code/cleanup-dead-code/skill.yaml +5 -2
- package/dist/agents/skills/claude-code/detect-doc-drift/SKILL.md +12 -0
- package/dist/agents/skills/claude-code/enforce-architecture/SKILL.md +48 -1
- package/dist/agents/skills/claude-code/enforce-architecture/skill.yaml +5 -2
- package/dist/agents/skills/claude-code/harness-accessibility/SKILL.md +7 -0
- package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +11 -3
- package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +81 -11
- package/dist/agents/skills/claude-code/harness-brainstorming/skill.yaml +2 -0
- package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +487 -234
- package/dist/agents/skills/claude-code/harness-code-review/skill.yaml +15 -2
- package/dist/agents/skills/claude-code/harness-codebase-cleanup/SKILL.md +226 -0
- package/dist/agents/skills/claude-code/harness-codebase-cleanup/skill.yaml +64 -0
- package/dist/agents/skills/claude-code/harness-dependency-health/SKILL.md +35 -6
- package/dist/agents/skills/claude-code/harness-docs-pipeline/SKILL.md +460 -0
- package/dist/agents/skills/claude-code/harness-docs-pipeline/skill.yaml +69 -0
- package/dist/agents/skills/claude-code/harness-execution/SKILL.md +73 -8
- package/dist/agents/skills/claude-code/harness-execution/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-hotspot-detector/SKILL.md +32 -6
- package/dist/agents/skills/claude-code/harness-i18n/SKILL.md +484 -0
- package/dist/agents/skills/claude-code/harness-i18n/skill.yaml +54 -0
- package/dist/agents/skills/claude-code/harness-i18n-process/SKILL.md +388 -0
- package/dist/agents/skills/claude-code/harness-i18n-process/skill.yaml +43 -0
- package/dist/agents/skills/claude-code/harness-i18n-workflow/SKILL.md +512 -0
- package/dist/agents/skills/claude-code/harness-i18n-workflow/skill.yaml +53 -0
- package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +35 -6
- package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +17 -1
- package/dist/agents/skills/claude-code/harness-knowledge-mapper/SKILL.md +46 -5
- package/dist/agents/skills/claude-code/harness-perf/SKILL.md +37 -8
- package/dist/agents/skills/claude-code/harness-perf/skill.yaml +3 -0
- package/dist/agents/skills/claude-code/harness-perf-tdd/SKILL.md +17 -4
- package/dist/agents/skills/claude-code/harness-planning/SKILL.md +59 -5
- package/dist/agents/skills/claude-code/harness-planning/skill.yaml +2 -0
- package/dist/agents/skills/claude-code/harness-release-readiness/SKILL.md +16 -0
- package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +561 -0
- package/dist/agents/skills/claude-code/harness-roadmap/skill.yaml +43 -0
- package/dist/agents/skills/claude-code/harness-security-review/SKILL.md +36 -2
- package/dist/agents/skills/claude-code/harness-security-review/skill.yaml +8 -6
- package/dist/agents/skills/claude-code/harness-soundness-review/SKILL.md +1267 -0
- package/dist/agents/skills/claude-code/harness-soundness-review/skill.yaml +48 -0
- package/dist/agents/skills/claude-code/harness-test-advisor/SKILL.md +35 -6
- package/dist/agents/skills/claude-code/harness-verification/SKILL.md +66 -0
- package/dist/agents/skills/claude-code/harness-verification/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-verify/SKILL.md +11 -0
- package/dist/agents/skills/claude-code/initialize-harness-project/SKILL.md +15 -1
- package/dist/agents/skills/claude-code/validate-context-engineering/SKILL.md +12 -0
- 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-accessibility/SKILL.md +7 -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 +11 -3
- 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-codebase-cleanup/SKILL.md +226 -0
- package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/skill.yaml +64 -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-dependency-health/SKILL.md +35 -6
- 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-docs-pipeline/SKILL.md +460 -0
- package/dist/agents/skills/gemini-cli/harness-docs-pipeline/skill.yaml +69 -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-hotspot-detector/SKILL.md +32 -6
- package/dist/agents/skills/gemini-cli/harness-i18n/SKILL.md +484 -0
- package/dist/agents/skills/gemini-cli/harness-i18n/skill.yaml +54 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-process/SKILL.md +388 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-process/skill.yaml +43 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-workflow/SKILL.md +512 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-workflow/skill.yaml +53 -0
- package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +35 -6
- 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-knowledge-mapper/SKILL.md +46 -5
- 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-perf/SKILL.md +37 -8
- package/dist/agents/skills/gemini-cli/harness-perf/skill.yaml +3 -0
- package/dist/agents/skills/gemini-cli/harness-perf-tdd/SKILL.md +17 -4
- 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-release-readiness/SKILL.md +16 -0
- package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +561 -0
- package/dist/agents/skills/gemini-cli/harness-roadmap/skill.yaml +43 -0
- package/dist/agents/skills/gemini-cli/harness-security-review/skill.yaml +8 -6
- 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-soundness-review/SKILL.md +1267 -0
- package/dist/agents/skills/gemini-cli/harness-soundness-review/skill.yaml +48 -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-test-advisor/SKILL.md +35 -6
- 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/agents/skills/shared/i18n-knowledge/accessibility/intersection.yaml +142 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/encoding.yaml +67 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/formatting.yaml +106 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/layout.yaml +80 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/pluralization.yaml +80 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/string-handling.yaml +106 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/android-resources.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/apple-strings.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/backend-patterns.yaml +50 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/flutter-intl.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/i18next.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/react-intl.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/vue-i18n.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/ecommerce.yaml +66 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/fintech.yaml +66 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/gaming.yaml +69 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/healthcare.yaml +66 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/legal.yaml +66 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/ar.yaml +41 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/de.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/en.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/es.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/fi.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/fr.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/he.yaml +41 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/hi.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/it.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/ja.yaml +38 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/ko.yaml +38 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/nl.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/pl.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/pt.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/ru.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/sv.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/th.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/tr.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hans.yaml +38 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hant.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/i18next-mcp.yaml +56 -0
- package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lingo-dev.yaml +56 -0
- package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lokalise.yaml +60 -0
- package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/tolgee.yaml +60 -0
- package/dist/agents/skills/shared/i18n-knowledge/testing/locale-testing.yaml +107 -0
- package/dist/agents/skills/shared/i18n-knowledge/testing/pseudo-localization.yaml +86 -0
- package/dist/bin/harness.js +64 -4
- package/dist/{chunk-GA6GN5J2.js → chunk-E2RTDBMG.js} +2263 -41
- package/dist/{chunk-FFIX3QVG.js → chunk-KJANDVVC.js} +141 -49
- package/dist/{chunk-4WUGOJQ7.js → chunk-RT2LYQHF.js} +1 -1
- package/dist/{dist-C4J67MPP.js → dist-CCM3L3UE.js} +95 -1
- package/dist/{dist-N4D4QWFV.js → dist-K6KTTN3I.js} +4 -4
- package/dist/index.d.ts +187 -7
- package/dist/index.js +7 -3
- package/dist/validate-cross-check-ZGKFQY57.js +7 -0
- package/package.json +9 -9
- 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-WGXQ7K62.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: []
|
|
@@ -12,8 +12,21 @@
|
|
|
12
12
|
|
|
13
13
|
## Prerequisites
|
|
14
14
|
|
|
15
|
-
A knowledge graph
|
|
16
|
-
|
|
15
|
+
A knowledge graph at `.harness/graph/` with git history enables full analysis. If no graph exists,
|
|
16
|
+
the skill uses static analysis fallbacks (see Graph Availability section).
|
|
17
|
+
Run `harness scan` to enable graph-enhanced analysis.
|
|
18
|
+
|
|
19
|
+
### Graph Availability
|
|
20
|
+
|
|
21
|
+
Before starting, check if `.harness/graph/graph.json` exists.
|
|
22
|
+
|
|
23
|
+
**If graph exists:** Use graph tools as primary strategy. (Staleness sensitivity: **Low** — never auto-refresh.
|
|
24
|
+
Git-based churn data in the graph remains useful even when slightly stale.)
|
|
25
|
+
|
|
26
|
+
**If graph exists and is fresh (or refreshed):** Use graph tools as primary strategy.
|
|
27
|
+
|
|
28
|
+
**If no graph exists:** Output "Running without graph (run `harness scan` to
|
|
29
|
+
enable full analysis)" and use fallback strategies for all subsequent steps.
|
|
17
30
|
|
|
18
31
|
## Process
|
|
19
32
|
|
|
@@ -48,6 +61,19 @@ Rank files by:
|
|
|
48
61
|
|
|
49
62
|
High churn in shared utilities or core modules = high risk.
|
|
50
63
|
|
|
64
|
+
#### Fallback (without graph)
|
|
65
|
+
|
|
66
|
+
When no graph is available, git log provides nearly all the data needed (~90% completeness):
|
|
67
|
+
|
|
68
|
+
1. **Per-file churn**: `git log --format="%H" -- <file>` for each source file (use glob to enumerate). Count commits per file. Sort descending to rank by churn.
|
|
69
|
+
2. **Recent velocity**: `git log --since="30 days ago" --format="%H" -- <file>` vs `git log --since="60 days ago" --until="30 days ago" --format="%H" -- <file>` to compare recent vs prior 30-day windows.
|
|
70
|
+
3. **Co-change detection**: `git log --format="%H %n" --name-only` to build a map of which files changed together in the same commit. File pairs that appear together in >3 commits are co-change candidates.
|
|
71
|
+
4. **Distant co-change identification**: For co-change pairs, check if they share a parent directory (co-located = normal) or are in different modules (distant = suspicious).
|
|
72
|
+
5. **Complexity proxy**: Use line count (`wc -l`) as a rough proxy for complexity when graph complexity metrics are unavailable.
|
|
73
|
+
6. **Hidden dependency detection**: Cross-reference co-change pairs against import parsing (grep for import statements). Co-change pairs with no import relationship indicate hidden dependencies.
|
|
74
|
+
|
|
75
|
+
> Fallback completeness: ~90% — git log provides nearly all the data the graph stores for this use case.
|
|
76
|
+
|
|
51
77
|
### Phase 3: COUPLING — Detect Hidden Dependencies
|
|
52
78
|
|
|
53
79
|
Cross-reference co-change data with structural data:
|
|
@@ -90,7 +116,7 @@ Use `get_relationships` to check structural edges between co-change pairs.
|
|
|
90
116
|
|
|
91
117
|
## Harness Integration
|
|
92
118
|
|
|
93
|
-
- **`harness scan`** —
|
|
119
|
+
- **`harness scan`** — Recommended before this skill for full graph-enhanced analysis. If graph is missing, skill uses git log fallbacks.
|
|
94
120
|
- **`harness validate`** — Run after acting on findings to verify project health.
|
|
95
121
|
- **Graph tools** — This skill uses `query_graph`, `get_impact`, and `get_relationships` MCP tools.
|
|
96
122
|
|
|
@@ -100,7 +126,7 @@ Use `get_relationships` to check structural edges between co-change pairs.
|
|
|
100
126
|
- Hidden dependencies identified (high co-change, no structural edge)
|
|
101
127
|
- Co-change patterns detected and classified (co-located vs distant)
|
|
102
128
|
- Report follows the structured output format
|
|
103
|
-
- All findings are backed by graph query evidence
|
|
129
|
+
- All findings are backed by graph query evidence (with graph) or git log analysis (without graph)
|
|
104
130
|
|
|
105
131
|
## Examples
|
|
106
132
|
|
|
@@ -126,8 +152,8 @@ Output:
|
|
|
126
152
|
|
|
127
153
|
## Gates
|
|
128
154
|
|
|
129
|
-
- **
|
|
130
|
-
- **
|
|
155
|
+
- **Graph preferred, fallback available.** If no graph exists, use git log for churn and co-change analysis. Do not stop — git log provides ~90% of the data needed.
|
|
156
|
+
- **Systematic analysis required.** Use graph `co_changes_with` edges when available; use `git log` commit analysis when not. Do not guess — parse actual git history.
|
|
131
157
|
|
|
132
158
|
## Escalation
|
|
133
159
|
|