know-thy-build 0.5.0 → 0.6.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/bin/cli.js +15 -10
- package/package.json +1 -1
- package/templates/know-thy-build/architect.md +38 -0
- package/templates/know-thy-build/designer.md +36 -0
- package/templates/know-thy-build/feature.md +127 -6
- package/templates/know-thy-build/finish.md +258 -0
- package/templates/know-thy-build/project.md +111 -53
- package/templates/know-thy-build/qa.md +492 -81
package/bin/cli.js
CHANGED
|
@@ -122,13 +122,17 @@ function install(lang, global) {
|
|
|
122
122
|
Define (once):
|
|
123
123
|
/know-thy-build:project Define your project (What & Why)
|
|
124
124
|
/know-thy-build:technical Define technical foundation (How)
|
|
125
|
-
/know-thy-build:qa Set up QA framework (environment + test axes)
|
|
126
125
|
|
|
127
|
-
Per feature (
|
|
128
|
-
/know-thy-build:feature Design
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
Per feature (worktree workflow):
|
|
127
|
+
/know-thy-build:feature Design feature spec (main) → create worktree → dispatch sub-agent
|
|
128
|
+
|
|
129
|
+
Sub-agent orchestrates in worktree:
|
|
130
|
+
Define:
|
|
131
|
+
/know-thy-build:architect Code structure (stubs, tests)
|
|
132
|
+
/know-thy-build:designer UX design intent (UI features)
|
|
133
|
+
/know-thy-build:qa Test cases (what "done" means)
|
|
134
|
+
Implement → Review → Gate check
|
|
135
|
+
/know-thy-build:finish Merge gate + squash merge + cleanup
|
|
132
136
|
|
|
133
137
|
Start with /know-thy-build:project
|
|
134
138
|
`);
|
|
@@ -148,12 +152,13 @@ if (args.includes("--help") || args.includes("-h")) {
|
|
|
148
152
|
npx know-thy-build --lang ko Skip language prompt
|
|
149
153
|
|
|
150
154
|
Commands installed:
|
|
151
|
-
:project Define what and why → docs/PROJECT.md
|
|
155
|
+
:project Define what and why → docs/PROJECT.md + CLAUDE.md + hooks
|
|
152
156
|
:technical Define how to build → docs/TECHNICAL.md
|
|
157
|
+
:feature Design feature + worktree + agent → docs/features/NNN.md + worktree
|
|
158
|
+
:architect Code structure (stubs, tests) → scaffold + signature tests
|
|
159
|
+
:designer UX design intent (UI features) → design intent in feature spec
|
|
153
160
|
:qa QA framework + test the product → docs/QA.md
|
|
154
|
-
:
|
|
155
|
-
:designer UX deep dive (optional) → ## Design in feature spec
|
|
156
|
-
:architect Implementation design (optional) → Code stubs + tests
|
|
161
|
+
:finish Merge gate + squash merge → main branch + cleanup
|
|
157
162
|
|
|
158
163
|
Options:
|
|
159
164
|
--global, -g Install to ~/.claude/commands/ (available in all projects)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "know-thy-build",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Multi-agent project definition & QA framework for Claude Code — Socratic dialogue, behavioral testing axes, design intent, orchestrated review",
|
|
5
5
|
"bin": {
|
|
6
6
|
"know-thy-build": "./bin/cli.js"
|
|
@@ -48,6 +48,21 @@ State your chosen granularity and why. The user can override.
|
|
|
48
48
|
|
|
49
49
|
## Before You Begin
|
|
50
50
|
|
|
51
|
+
### 0. Worktree detection
|
|
52
|
+
|
|
53
|
+
Check if you're working in the correct worktree:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
REPO=$(basename $(git rev-parse --show-toplevel))
|
|
57
|
+
BRANCH=$(git branch --show-current)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**If the branch starts with `feature/`:** You're in the worktree. Proceed.
|
|
61
|
+
**If the branch is `main` or `master`:**
|
|
62
|
+
- Check if `../${REPO}-wt` exists
|
|
63
|
+
- If yes: "You should be working in the worktree at `../${REPO}-wt`. Switch there before proceeding."
|
|
64
|
+
- If no: "No worktree found. Run `/know-thy-build:feature` first to create the feature spec and worktree."
|
|
65
|
+
|
|
51
66
|
### 1. Read all context
|
|
52
67
|
|
|
53
68
|
```bash
|
|
@@ -596,3 +611,26 @@ Documented for future implementation when usage data confirms which constraints
|
|
|
596
611
|
2. If editing a stub file and changing lines with `PRE:` or `POST:`: exit 2 with "Contract comments are protected"
|
|
597
612
|
|
|
598
613
|
**When to implement:** When real-world usage shows sub-agents modifying signature tests or contract comments despite explicit instructions.
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## Gate Update
|
|
618
|
+
|
|
619
|
+
After all verification passes (Phase 4 complete), update the feature spec's gate:
|
|
620
|
+
|
|
621
|
+
1. Find the active feature spec:
|
|
622
|
+
```bash
|
|
623
|
+
FEATURE_NUM=$(git branch --show-current | grep -oE '[0-9]+' | head -1)
|
|
624
|
+
FEATURE_FILE="docs/features/$(printf '%03d' $FEATURE_NUM).md"
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
2. Update gate status in the frontmatter:
|
|
628
|
+
Change `architect: pending` to `architect: passed` in the `gate:` section.
|
|
629
|
+
|
|
630
|
+
3. Add the current date next to the status:
|
|
631
|
+
```yaml
|
|
632
|
+
gate:
|
|
633
|
+
architect: passed # {{date}}
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
This gate update is recorded in the worktree. It will be merged to main with the rest of the feature's changes via `/know-thy-build:finish`.
|
|
@@ -108,6 +108,21 @@ Does this match what you're imagining? Anything that feels off?
|
|
|
108
108
|
|
|
109
109
|
## Before You Begin
|
|
110
110
|
|
|
111
|
+
### 0. Worktree detection
|
|
112
|
+
|
|
113
|
+
Check if you're working in the correct worktree:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
REPO=$(basename $(git rev-parse --show-toplevel))
|
|
117
|
+
BRANCH=$(git branch --show-current)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**If the branch starts with `feature/`:** You're in the worktree. Proceed.
|
|
121
|
+
**If the branch is `main` or `master`:**
|
|
122
|
+
- Check if `../${REPO}-wt` exists
|
|
123
|
+
- If yes: "You should be working in the worktree at `../${REPO}-wt`. Switch there before proceeding."
|
|
124
|
+
- If no: "No worktree found. Run `/know-thy-build:feature` first to create the feature spec and worktree."
|
|
125
|
+
|
|
111
126
|
### 1. Read all context
|
|
112
127
|
|
|
113
128
|
```bash
|
|
@@ -634,3 +649,24 @@ Append to the feature's `## Changes` section:
|
|
|
634
649
|
- Design section has been updated with affected changes
|
|
635
650
|
- QA Checklist items updated to match
|
|
636
651
|
- Changes recorded in the feature spec
|
|
652
|
+
|
|
653
|
+
## Gate Update
|
|
654
|
+
|
|
655
|
+
After design work is complete and documented, update the feature spec's gate:
|
|
656
|
+
|
|
657
|
+
1. Find the active feature spec:
|
|
658
|
+
```bash
|
|
659
|
+
FEATURE_NUM=$(git branch --show-current | grep -oE '[0-9]+' | head -1)
|
|
660
|
+
FEATURE_FILE="docs/features/$(printf '%03d' $FEATURE_NUM).md"
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
2. Update gate status in the frontmatter:
|
|
664
|
+
Change `designer: pending` to `designer: passed` in the `gate:` section.
|
|
665
|
+
|
|
666
|
+
3. Add the current date next to the status:
|
|
667
|
+
```yaml
|
|
668
|
+
gate:
|
|
669
|
+
designer: passed # {{date}}
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
This gate update is recorded in the worktree. It will be merged to main with the rest of the feature's changes via `/know-thy-build:finish`.
|
|
@@ -367,8 +367,14 @@ id: {{number}}
|
|
|
367
367
|
title: {{short_title}}
|
|
368
368
|
status: complete
|
|
369
369
|
priority: {{P0|P1|P2}}
|
|
370
|
+
class: {{Spike|Bounded|Architectural}}
|
|
370
371
|
depends_on: [{{feature_ids}}]
|
|
371
372
|
persona: {{primary_persona_name from PROJECT.md}}
|
|
373
|
+
gate:
|
|
374
|
+
worktree: null
|
|
375
|
+
architect: pending
|
|
376
|
+
designer: pending # set to 'skipped' for non-UI features
|
|
377
|
+
qa: pending
|
|
372
378
|
assumptions:
|
|
373
379
|
- "{{assumption}}"
|
|
374
380
|
date: {{date}}
|
|
@@ -376,6 +382,12 @@ generatedBy: know-thy-build-feature
|
|
|
376
382
|
---
|
|
377
383
|
```
|
|
378
384
|
|
|
385
|
+
**Gate initialization rules:**
|
|
386
|
+
- **Spike**: No gate field. Spikes produce answers, not implementations.
|
|
387
|
+
- **Bounded (non-UI)**: `architect: pending`, `designer: skipped`, `qa: pending`
|
|
388
|
+
- **Bounded (UI)**: `architect: pending`, `designer: pending`, `qa: pending`
|
|
389
|
+
- **Architectural**: All `pending`
|
|
390
|
+
|
|
379
391
|
**Priority guide:**
|
|
380
392
|
- **P0**: Must-have for MVP. Without this, the project doesn't deliver its core value.
|
|
381
393
|
- **P1**: Important. Significantly improves the experience but the project works without it.
|
|
@@ -573,14 +585,123 @@ This keeps PROJECT.md as the single entry point for the full project picture.
|
|
|
573
585
|
|
|
574
586
|
## Closing
|
|
575
587
|
|
|
576
|
-
**After CREATE:**
|
|
588
|
+
**After CREATE (Spike):**
|
|
589
|
+
- No worktree, no gate, no implementation. The spike's output is an answer.
|
|
590
|
+
- Run `/know-thy-build:feature` again if the spike reveals something worth building.
|
|
591
|
+
|
|
592
|
+
**After CREATE (Bounded / Architectural):**
|
|
577
593
|
- Feature spec has been saved to `docs/features/{{NNN}}.md`
|
|
578
594
|
- Feature Registry in `docs/PROJECT.md` has been updated
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
595
|
+
|
|
596
|
+
### Worktree Setup
|
|
597
|
+
|
|
598
|
+
1. Detect the repo name:
|
|
599
|
+
```bash
|
|
600
|
+
REPO=$(basename $(git rev-parse --show-toplevel))
|
|
601
|
+
WT_PATH="../${REPO}-wt"
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
2. Check for existing worktree:
|
|
605
|
+
```bash
|
|
606
|
+
git worktree list
|
|
607
|
+
ls -d "$WT_PATH" 2>/dev/null
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
3. **If `$WT_PATH` already exists:**
|
|
611
|
+
> "Worktree `$WT_PATH` already exists (branch: {{branch}}). Options:"
|
|
612
|
+
> 1. Continue with existing worktree (previous feature is in progress)
|
|
613
|
+
> 2. Remove existing worktree and create new one
|
|
614
|
+
> 3. Skip worktree (work in main)
|
|
615
|
+
|
|
616
|
+
If user chooses option 1 or 3, skip creation. If option 2, run `git worktree remove "$WT_PATH"` first.
|
|
617
|
+
|
|
618
|
+
4. **Create worktree:**
|
|
619
|
+
```bash
|
|
620
|
+
git worktree add "$WT_PATH" -b "feature/{{NNN}}-{{short_title_kebab}}"
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
5. Confirm:
|
|
624
|
+
> "Worktree created at `$WT_PATH` on branch `feature/{{NNN}}-{{short_title_kebab}}`."
|
|
625
|
+
|
|
626
|
+
6. Update feature spec frontmatter:
|
|
627
|
+
```yaml
|
|
628
|
+
gate:
|
|
629
|
+
worktree: feature/{{NNN}}-{{short_title_kebab}}
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
### Sub-agent Dispatch
|
|
633
|
+
|
|
634
|
+
After worktree creation, dispatch a sub-agent to orchestrate the entire feature lifecycle in the worktree.
|
|
635
|
+
|
|
636
|
+
Use the **Agent tool** with `isolation: "worktree"` is NOT needed here — the worktree is already created manually above. Instead, dispatch the sub-agent with an explicit working directory.
|
|
637
|
+
|
|
638
|
+
**Sub-agent prompt:**
|
|
639
|
+
|
|
640
|
+
```
|
|
641
|
+
You are the feature orchestrator for Feature {{NNN}}: {{title}}.
|
|
642
|
+
Your working directory is: {{WT_PATH}}
|
|
643
|
+
|
|
644
|
+
Read these files first:
|
|
645
|
+
- docs/PROJECT.md — project principles
|
|
646
|
+
- docs/TECHNICAL.md — technical decisions
|
|
647
|
+
- docs/features/{{NNN}}.md — this feature's spec and gate status
|
|
648
|
+
|
|
649
|
+
## Your job: Define → Implement → Review → Finish
|
|
650
|
+
|
|
651
|
+
### Phase 1: Define
|
|
652
|
+
Run each role to define their criteria for this feature:
|
|
653
|
+
|
|
654
|
+
1. Run /know-thy-build:architect
|
|
655
|
+
- Reads the feature spec
|
|
656
|
+
- Designs structure: CRC cards, scaffolds, signature tests
|
|
657
|
+
- Creates stub files with PRE/POST/WHY/EXAMPLE comments
|
|
658
|
+
- Creates signature contract tests
|
|
659
|
+
|
|
660
|
+
2. Run /know-thy-build:designer (skip if gate.designer is 'skipped')
|
|
661
|
+
- Reads the feature spec
|
|
662
|
+
- Defines design intent map, state catalog, micro-interactions
|
|
663
|
+
- Updates the feature spec with detailed design intent
|
|
664
|
+
|
|
665
|
+
3. Run /know-thy-build:qa in REVIEW mode
|
|
666
|
+
- Reads the feature spec + architect scaffolds + design intent
|
|
667
|
+
- Defines concrete test cases in docs/QA.md
|
|
668
|
+
- Each test case has verification method and expected evidence
|
|
669
|
+
|
|
670
|
+
### Phase 2: Implement
|
|
671
|
+
Fill the scaffolds:
|
|
672
|
+
- Read all stub files with // IMPLEMENT markers
|
|
673
|
+
- Implement each stub following PRE/POST/WHY contracts
|
|
674
|
+
- Run tests after each implementation to verify
|
|
675
|
+
- Do NOT modify signature contract tests (DO NOT MODIFY markers)
|
|
676
|
+
|
|
677
|
+
### Phase 3: Review
|
|
678
|
+
Submit implementation for review by each role:
|
|
679
|
+
|
|
680
|
+
1. Architect review:
|
|
681
|
+
- Verify code follows scaffolds, conventions, and TECHNICAL.md
|
|
682
|
+
- Check all signature tests pass
|
|
683
|
+
- Check no // IMPLEMENT markers remain
|
|
684
|
+
- Update docs/features/{{NNN}}.md: gate.architect → passed
|
|
685
|
+
|
|
686
|
+
2. Designer review (skip if gate.designer is 'skipped'):
|
|
687
|
+
- Verify UI matches design intent map
|
|
688
|
+
- Check all states are handled (empty, error, loading, success)
|
|
689
|
+
- Update docs/features/{{NNN}}.md: gate.designer → passed
|
|
690
|
+
|
|
691
|
+
3. QA TEST:
|
|
692
|
+
- Actually run the product
|
|
693
|
+
- Execute every test case from docs/QA.md for this feature
|
|
694
|
+
- Capture evidence (screenshots, console output, state checks)
|
|
695
|
+
- Update docs/features/{{NNN}}.md: gate.qa → passed
|
|
696
|
+
|
|
697
|
+
If any review fails → fix and re-submit. Loop until all gates pass.
|
|
698
|
+
|
|
699
|
+
### Phase 4: Finish
|
|
700
|
+
When all gates are passed/skipped, run /know-thy-build:finish.
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
> "Sub-agent dispatched to worktree. It will run define → implement → review → finish automatically."
|
|
704
|
+
> "You can continue working on other things in main, or run `/know-thy-build:feature` for the next feature."
|
|
584
705
|
|
|
585
706
|
**After EDIT:**
|
|
586
707
|
- Feature spec has been updated
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Merge a completed feature — checks all review gates, squash merges to main, cleans up worktree. The final step in the feature lifecycle.
|
|
3
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Know Thy Build — Finish
|
|
7
|
+
|
|
8
|
+
You are the **release gate**. Your job is to verify that all review gates have passed, then merge the feature to main and clean up.
|
|
9
|
+
|
|
10
|
+
You do NOT implement, review, or test. You only verify the gate and execute the merge.
|
|
11
|
+
|
|
12
|
+
## Language
|
|
13
|
+
|
|
14
|
+
**All conversation and output MUST be in: {{LANG}}**
|
|
15
|
+
|
|
16
|
+
Technical terms (e.g. merge, squash, worktree, gate) stay in English. Everything else uses the specified language.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Before You Begin
|
|
21
|
+
|
|
22
|
+
### 1. Verify worktree context
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
REPO=$(basename $(git rev-parse --show-toplevel))
|
|
26
|
+
BRANCH=$(git branch --show-current)
|
|
27
|
+
WT_PATH="../${REPO}-wt"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**If the branch does NOT start with `feature/`:**
|
|
31
|
+
> "This command must be run from a feature worktree. Current branch: `{{branch}}`."
|
|
32
|
+
→ Stop here.
|
|
33
|
+
|
|
34
|
+
### 2. Identify the feature
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
FEATURE_NUM=$(echo "$BRANCH" | grep -oE '[0-9]+' | head -1)
|
|
38
|
+
FEATURE_FILE="docs/features/$(printf '%03d' $FEATURE_NUM).md"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Read the feature spec and extract the gate section from frontmatter.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Gate Check
|
|
46
|
+
|
|
47
|
+
Read the `gate:` section from the feature spec's YAML frontmatter.
|
|
48
|
+
|
|
49
|
+
### Display gate status
|
|
50
|
+
|
|
51
|
+
Present a clear gate status report:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
🚦 Gate Check — Feature {{NNN}}: {{title}}
|
|
55
|
+
|
|
56
|
+
Architect: {{status}} {{date if passed}}
|
|
57
|
+
Designer: {{status}} {{date if passed}}
|
|
58
|
+
QA: {{status}} {{date if passed}}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Evaluate
|
|
62
|
+
|
|
63
|
+
**All gates `passed` or `skipped`:**
|
|
64
|
+
> "All gates passed. Ready to merge."
|
|
65
|
+
→ Proceed to Pre-merge Verification.
|
|
66
|
+
|
|
67
|
+
**Any gate is `pending`:**
|
|
68
|
+
> "Cannot merge — pending reviews:"
|
|
69
|
+
> - `{{role}}`: pending — run `/know-thy-build:{{role}}` to complete
|
|
70
|
+
|
|
71
|
+
→ Stop here. Do NOT proceed with merge.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Pre-merge Verification
|
|
76
|
+
|
|
77
|
+
Before merging, verify the worktree is in a clean, mergeable state:
|
|
78
|
+
|
|
79
|
+
### 1. Check for uncommitted changes
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
git status --porcelain
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
If there are uncommitted changes:
|
|
86
|
+
> "Uncommitted changes detected. Commit or stash before merging."
|
|
87
|
+
→ Offer to commit with a descriptive message.
|
|
88
|
+
|
|
89
|
+
### 2. Verify no IMPLEMENT markers remain
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
grep -rn "// IMPLEMENT\|# IMPLEMENT\|throw new Error('Not implemented')" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" --include="*.rs" . 2>/dev/null
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If any remain:
|
|
96
|
+
> "Implementation markers found — the feature is not fully implemented."
|
|
97
|
+
→ Stop here.
|
|
98
|
+
|
|
99
|
+
### 3. Verify tests pass
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Detect test runner from package.json, pyproject.toml, etc.
|
|
103
|
+
# Run appropriate test command
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
If tests fail:
|
|
107
|
+
> "Tests are failing. Fix before merge."
|
|
108
|
+
→ Stop here.
|
|
109
|
+
|
|
110
|
+
### 4. Verify artifacts exist
|
|
111
|
+
|
|
112
|
+
Check that each role left its artifacts in the worktree:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Architect artifacts: scaffold files, signature tests
|
|
116
|
+
grep -rn "DO NOT MODIFY" --include="*.test.*" --include="*_test.*" . 2>/dev/null | head -5
|
|
117
|
+
|
|
118
|
+
# QA artifacts: test cases in QA.md
|
|
119
|
+
grep -c "Feature {{NNN}}" docs/QA.md 2>/dev/null
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Report what will be merged to main:
|
|
123
|
+
> "The following artifacts from this feature will be merged to main:"
|
|
124
|
+
> - Code: {{list of modified/new source files}}
|
|
125
|
+
> - Architect: scaffold structure, signature tests
|
|
126
|
+
> - Designer: design intent updates in feature spec (if applicable)
|
|
127
|
+
> - QA: test cases in `docs/QA.md`
|
|
128
|
+
> - Feature spec: gate statuses updated
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Merge
|
|
133
|
+
|
|
134
|
+
### 1. Switch to main and merge
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Ensure main is up to date
|
|
138
|
+
git checkout main
|
|
139
|
+
git pull --ff-only origin main 2>/dev/null || true
|
|
140
|
+
|
|
141
|
+
# Squash merge
|
|
142
|
+
git merge --squash "feature/{{NNN}}-{{title_kebab}}"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 2. Create commit
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
git commit -m "feat({{NNN}}): {{title}}
|
|
149
|
+
|
|
150
|
+
- Architect: {{brief summary of structure decisions}}
|
|
151
|
+
- Designer: {{brief summary of design decisions, or 'skipped'}}
|
|
152
|
+
- QA: {{number}} test cases passed
|
|
153
|
+
|
|
154
|
+
Feature spec: docs/features/{{NNN}}.md
|
|
155
|
+
Gate: architect ✓ | designer ✓/skipped | qa ✓"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 3. Update feature spec status
|
|
159
|
+
|
|
160
|
+
Switch back briefly or edit from main — update the feature spec frontmatter:
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
status: complete
|
|
164
|
+
gate:
|
|
165
|
+
worktree: null # worktree removed
|
|
166
|
+
architect: passed
|
|
167
|
+
designer: passed # or skipped
|
|
168
|
+
qa: passed
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 4. Update Feature Registry
|
|
172
|
+
|
|
173
|
+
In `docs/PROJECT.md`, update the Feature Registry row for this feature:
|
|
174
|
+
```
|
|
175
|
+
| {{NNN}} | [{{title}}](features/{{NNN}}.md) | {{priority}} | {{depends_on}} | complete |
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Cleanup
|
|
181
|
+
|
|
182
|
+
### 1. Remove worktree
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
git worktree remove "$WT_PATH"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
If removal fails (dirty worktree):
|
|
189
|
+
```bash
|
|
190
|
+
git worktree remove --force "$WT_PATH"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 2. Delete feature branch
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
git branch -d "feature/{{NNN}}-{{title_kebab}}"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 3. Prune stale worktree metadata
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
git worktree prune
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Report
|
|
208
|
+
|
|
209
|
+
Present the final summary:
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
✅ Feature {{NNN}}: {{title}} — merged to main
|
|
213
|
+
|
|
214
|
+
Commit: {{short hash}} feat({{NNN}}): {{title}}
|
|
215
|
+
Branch: feature/{{NNN}}-{{title_kebab}} — deleted
|
|
216
|
+
Worktree: {{WT_PATH}} — removed
|
|
217
|
+
|
|
218
|
+
Artifacts merged:
|
|
219
|
+
- Code changes: {{file count}} files
|
|
220
|
+
- Architect structure: preserved in code + signature tests
|
|
221
|
+
- Designer intent: preserved in docs/features/{{NNN}}.md
|
|
222
|
+
- QA test cases: preserved in docs/QA.md
|
|
223
|
+
- Gate history: preserved in docs/features/{{NNN}}.md frontmatter
|
|
224
|
+
|
|
225
|
+
Next: /know-thy-build:feature for the next feature
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Edge Cases
|
|
231
|
+
|
|
232
|
+
### Merge conflicts
|
|
233
|
+
|
|
234
|
+
If `git merge --squash` produces conflicts:
|
|
235
|
+
|
|
236
|
+
1. List conflicting files
|
|
237
|
+
2. For each conflict, show the conflict markers
|
|
238
|
+
3. Offer resolution options:
|
|
239
|
+
- Accept worktree version (ours)
|
|
240
|
+
- Accept main version (theirs)
|
|
241
|
+
- Manual resolution
|
|
242
|
+
4. After resolution, continue with commit
|
|
243
|
+
|
|
244
|
+
### Abandoned feature
|
|
245
|
+
|
|
246
|
+
If the user explicitly wants to abandon the feature without merging:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
git checkout main
|
|
250
|
+
git worktree remove --force "$WT_PATH"
|
|
251
|
+
git branch -D "feature/{{NNN}}-{{title_kebab}}"
|
|
252
|
+
git worktree prune
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Update feature spec: `status: abandoned`, clear gate.
|
|
256
|
+
Update Feature Registry: status → `abandoned`.
|
|
257
|
+
|
|
258
|
+
> "Feature {{NNN}} abandoned. Worktree and branch removed. Spec preserved for reference."
|