chore(repo): add parallel worktree hygiene guardrail
This commit is contained in:
@@ -9,7 +9,9 @@
|
||||
|---|---|---|
|
||||
| AI excellence due diligence | [ai-excellence-due-diligence-roadmap.md](/home/hartmut/Documents/Copilot/capakraken/docs/ai-excellence-due-diligence-roadmap.md) | Frank quality assessment and cleanup roadmap toward a showcase AI-built project |
|
||||
| Showcase quality backlog | [showcase-quality-backlog.md](/home/hartmut/Documents/Copilot/capakraken/docs/showcase-quality-backlog.md) | Consolidated working backlog for the current quality and maintainability north star |
|
||||
| Parallel worktree hygiene | [parallel-worktree-hygiene.md](/home/hartmut/Documents/Copilot/capakraken/docs/parallel-worktree-hygiene.md) | Keep parallel worker slices isolated and the worktree reviewable |
|
||||
| Target CI/CD architecture | [cicd-target-architecture.md](/home/hartmut/Documents/Copilot/capakraken/docs/cicd-target-architecture.md) | Canonical image-based build, deploy, and rollback flow |
|
||||
| Parallel worktree hygiene | [parallel-worktree-hygiene.md](/home/hartmut/Documents/Copilot/capakraken/docs/parallel-worktree-hygiene.md) | Lightweight guardrail for shared dirty worktrees and parallel worker scopes |
|
||||
| Active roadmap and open gaps | [product-roadmap.md](/home/hartmut/Documents/Copilot/capakraken/docs/product-roadmap.md) | Primary backlog and current delivery order |
|
||||
| Estimating system design | [estimating-extension-design.md](/home/hartmut/Documents/Copilot/capakraken/docs/estimating-extension-design.md) | Workbook analysis, field mapping, and implementation plan |
|
||||
| Dispo import implementation | [dispo-import-implementation.md](/home/hartmut/Documents/Copilot/capakraken/docs/dispo-import-implementation.md) | Clean-slate Dispo v2 import design, mapping rules, staging flow, and commit policy |
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# Parallel Worktree Hygiene
|
||||
|
||||
This repository is now opinionated about keeping the worktree reviewable during parallel AI-worker runs.
|
||||
|
||||
## Goal
|
||||
|
||||
Keep every slice narrow, make unrelated drift visible immediately, and avoid "who touched what?" cleanup phases before reviews or commits.
|
||||
|
||||
## Command
|
||||
|
||||
Use the root helper:
|
||||
|
||||
```bash
|
||||
pnpm worktree:hygiene
|
||||
```
|
||||
|
||||
It prints the current worktree and, when scopes are declared, splits dirty files into:
|
||||
|
||||
- `staged`
|
||||
- `unstaged`
|
||||
- `untracked`
|
||||
- `in scope`
|
||||
- `outside scope`
|
||||
|
||||
## Recommended Flow
|
||||
|
||||
Before starting a slice:
|
||||
|
||||
```bash
|
||||
pnpm worktree:hygiene
|
||||
```
|
||||
|
||||
When you intentionally work in a narrow area:
|
||||
|
||||
```bash
|
||||
pnpm worktree:hygiene -- --scope apps/web/e2e --scope apps/web/src/components/timeline --fail-outside-scope
|
||||
```
|
||||
|
||||
If the worktree is intentionally shared for a moment, keep the signal but suppress the hard failure:
|
||||
|
||||
```bash
|
||||
pnpm worktree:hygiene -- --scope docs --scope scripts --allow-outside-scope
|
||||
```
|
||||
|
||||
Before committing:
|
||||
|
||||
```bash
|
||||
pnpm worktree:hygiene -- --fail-on-dirty
|
||||
```
|
||||
|
||||
Use `--json` when another tool or agent should consume the output programmatically.
|
||||
|
||||
## Parallel-Worker Rules
|
||||
|
||||
1. Pick an explicit ownership scope before editing files.
|
||||
2. Run the scoped hygiene check before and after each slice.
|
||||
3. Do not mix unrelated files into a commit just because they are already dirty.
|
||||
4. If `outside-scope` is non-empty, either hand off that scope or finish and commit your own slice first.
|
||||
5. Prefer multiple small commits over one shared dirty worktree.
|
||||
|
||||
## Notes
|
||||
|
||||
- `git status --short` remains the fastest human spot check.
|
||||
- `pnpm worktree:hygiene` is the stricter guard when multiple workers operate in parallel.
|
||||
Reference in New Issue
Block a user