know-thy-build 0.5.0 → 0.7.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
|
@@ -901,70 +901,128 @@ This project follows the principles defined in [PROJECT.md](./docs/PROJECT.md).
|
|
|
901
901
|
AI agents MUST read docs/PROJECT.md before starting any work.
|
|
902
902
|
NON-NEGOTIABLE rules in PROJECT.md cannot be overridden.
|
|
903
903
|
|
|
904
|
-
##
|
|
904
|
+
## Worktree Workflow
|
|
905
|
+
|
|
906
|
+
### Principle
|
|
907
|
+
- Feature specs (`docs/`) are defined **only in main**.
|
|
908
|
+
- Implementation code is modified **only in the worktree**. Worktree path: `../<repo>-wt`
|
|
909
|
+
- If a spec change is needed, edit it in main and sync to worktree via `git merge main` (one-way flow).
|
|
910
|
+
- Merge strategy: **squash merge** — `feat(NNN): title` format.
|
|
911
|
+
- On feature completion: `git worktree remove` + `git branch -d` automatic cleanup.
|
|
912
|
+
|
|
913
|
+
### Feature Lifecycle
|
|
914
|
+
|
|
915
|
+
```
|
|
916
|
+
main:
|
|
917
|
+
/know-thy-build:feature → spec finalized → worktree created → sub-agent dispatched
|
|
918
|
+
|
|
919
|
+
worktree (sub-agent orchestrates the entire lifecycle):
|
|
920
|
+
Phase 1 — Define:
|
|
921
|
+
/know-thy-build:architect → scaffold, signature tests
|
|
922
|
+
/know-thy-build:designer → design intent (UI features only)
|
|
923
|
+
/know-thy-build:qa REVIEW → test cases
|
|
924
|
+
|
|
925
|
+
Phase 2 — Implement:
|
|
926
|
+
Sub-agent fills scaffolds and implements code
|
|
927
|
+
|
|
928
|
+
Phase 3 — Review:
|
|
929
|
+
Architect review → gate.architect ✓
|
|
930
|
+
Designer review → gate.designer ✓
|
|
931
|
+
QA TEST → gate.qa ✓
|
|
932
|
+
|
|
933
|
+
Phase 4 — Finish:
|
|
934
|
+
All gates passed → /know-thy-build:finish → squash merge + cleanup
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
### Gate (Merge Prerequisite)
|
|
938
|
+
The `gate` field in the feature spec frontmatter tracks review status.
|
|
939
|
+
Merge is allowed only when all gates are `passed` or `skipped`.
|
|
940
|
+
|
|
941
|
+
| Role | Gate Status | Updated When |
|
|
942
|
+
|------|-----------|--------------|
|
|
943
|
+
| architect | pending → passed | Architect review passes |
|
|
944
|
+
| designer | pending → passed / skipped | Designer review passes (skipped for non-UI) |
|
|
945
|
+
| qa | pending → passed | All QA test cases pass |
|
|
905
946
|
|
|
906
947
|
### Orchestrator Model
|
|
907
948
|
The user session acts as **orchestrator only** — it does NOT implement directly.
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
###
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
The sub-agent confirms its understanding of scope and goal before proceeding.
|
|
923
|
-
|
|
924
|
-
3. **Implementation sub-agent — Execution**
|
|
925
|
-
Implements within the defined scope. Does not expand beyond the goal.
|
|
926
|
-
|
|
927
|
-
4. **Post-implementation review (mandatory)**
|
|
928
|
-
After implementation, the sub-agent dispatches **three review agents**:
|
|
929
|
-
|
|
930
|
-
**Designer Review Agent:**
|
|
931
|
-
- Reads the feature's Design Intent Map (if present)
|
|
932
|
-
- Verifies every design intent step is correctly reflected in implementation
|
|
933
|
-
- Checks all UI states are handled (empty, loading, error, success)
|
|
934
|
-
- Adopts the most critical stance — assumes implementation is wrong until proven otherwise
|
|
935
|
-
- Produces checklist: `- [x]` passed or `- [ ]` failed with specific reason
|
|
936
|
-
|
|
937
|
-
**Architect Review Agent:**
|
|
938
|
-
- Reads `docs/TECHNICAL.md` and the feature spec
|
|
939
|
-
- Verifies code follows technical decisions, patterns, and constraints
|
|
940
|
-
- Checks code structure, naming, boundaries, and error handling
|
|
941
|
-
- Adopts the most critical stance — looks for what will break, not what looks nice
|
|
942
|
-
- Produces checklist: `- [x]` passed or `- [ ]` failed with specific reason
|
|
943
|
-
|
|
944
|
-
5. **Designer + Architect must both pass before QA begins.**
|
|
945
|
-
|
|
946
|
-
6. **QA Review Agent (mandatory — runs the product)**
|
|
947
|
-
- Actually starts the application and tests it as a real user
|
|
948
|
-
- Executes every acceptance criterion from the feature spec step by step
|
|
949
|
-
- Tests edge cases: interruption (refresh, back, cancel), concurrency (multi-tab), boundary (empty, max, special chars), state corruption (expired session, deleted resource)
|
|
950
|
-
- Captures evidence for every test: screenshots, console output, state checks
|
|
951
|
-
- Adopts the most paranoid, impatient, careless user persona
|
|
952
|
-
- Produces checklist: `- [x]` passed with evidence or `- [ ]` failed with reproduction steps
|
|
953
|
-
|
|
954
|
-
7. **Review loop**
|
|
955
|
-
- If ANY criterion is `[ ]` (failed): implementer fixes and re-submits
|
|
956
|
-
- Designer + Architect re-review if changes are structural
|
|
957
|
-
- QA re-tests failed scenarios + regression check on happy path
|
|
958
|
-
- Loop continues until ALL reviewers' criteria are `[x]`
|
|
959
|
-
- Only when all three reviewers fully pass does the orchestrator accept the work
|
|
949
|
+
After defining the feature spec, it dispatches a sub-agent to the worktree to handle define → implement → review → finish end-to-end.
|
|
950
|
+
|
|
951
|
+
### Sub-agent Pre-work (mandatory)
|
|
952
|
+
Before any work, the sub-agent MUST read:
|
|
953
|
+
- `docs/PROJECT.md` — project principles and boundaries
|
|
954
|
+
- `docs/TECHNICAL.md` — technical decisions and patterns
|
|
955
|
+
- `docs/features/NNN.md` — feature spec, acceptance criteria, design intent
|
|
956
|
+
|
|
957
|
+
### Review Loop
|
|
958
|
+
- If ANY criterion is `[ ]` (failed): implementer fixes and re-submits
|
|
959
|
+
- Architect + Designer re-review if changes are structural
|
|
960
|
+
- QA re-tests failed scenarios + regression check on happy path
|
|
961
|
+
- Loop continues until ALL reviewers' criteria are `[x]`
|
|
962
|
+
- Only when all three gates pass does `/know-thy-build:finish` proceed
|
|
960
963
|
|
|
961
964
|
### Document References
|
|
962
965
|
- Project definition: `docs/PROJECT.md`
|
|
963
966
|
- Technical foundation: `docs/TECHNICAL.md`
|
|
964
967
|
- Feature specs: `docs/features/NNN.md`
|
|
968
|
+
- QA test cases: `docs/QA.md`
|
|
965
969
|
- Feature registry: `docs/PROJECT.md` → Feature Registry section
|
|
966
970
|
```
|
|
967
971
|
|
|
972
|
+
## Setup Merge Gate Hook
|
|
973
|
+
|
|
974
|
+
After generating CLAUDE.md, set up the merge gate hook in `.claude/settings.json`.
|
|
975
|
+
|
|
976
|
+
**If `.claude/settings.json` does not exist**, create it. If it exists, merge the hook into the existing `hooks` section.
|
|
977
|
+
|
|
978
|
+
**Hook script to generate** at `.claude/hooks/check-merge-gate.sh`:
|
|
979
|
+
|
|
980
|
+
```bash
|
|
981
|
+
#!/usr/bin/env bash
|
|
982
|
+
# know-thy-build merge gate — blocks git merge when feature gate is not fully passed
|
|
983
|
+
|
|
984
|
+
# Only check if the command contains git merge
|
|
985
|
+
if ! echo "$TOOL_INPUT" | grep -qE 'git\s+merge'; then
|
|
986
|
+
exit 0
|
|
987
|
+
fi
|
|
988
|
+
|
|
989
|
+
# Find the active feature spec with gate
|
|
990
|
+
FEATURE_FILE=$(ls -t docs/features/*.md 2>/dev/null | head -1)
|
|
991
|
+
if [ -z "$FEATURE_FILE" ]; then
|
|
992
|
+
exit 0
|
|
993
|
+
fi
|
|
994
|
+
|
|
995
|
+
# Check gate statuses
|
|
996
|
+
PENDING=$(grep -cE '^\s+(architect|designer|qa):\s*pending' "$FEATURE_FILE" 2>/dev/null || echo "0")
|
|
997
|
+
|
|
998
|
+
if [ "$PENDING" -gt 0 ]; then
|
|
999
|
+
echo "❌ Merge gate blocked — pending reviews exist:"
|
|
1000
|
+
grep -E '^\s+(architect|designer|qa):' "$FEATURE_FILE" 2>/dev/null
|
|
1001
|
+
echo ""
|
|
1002
|
+
echo "Run /know-thy-build:finish to check gate status."
|
|
1003
|
+
exit 2
|
|
1004
|
+
fi
|
|
1005
|
+
|
|
1006
|
+
exit 0
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
**Settings to add to `.claude/settings.json`:**
|
|
1010
|
+
|
|
1011
|
+
```json
|
|
1012
|
+
{
|
|
1013
|
+
"hooks": {
|
|
1014
|
+
"PreToolUse": [
|
|
1015
|
+
{
|
|
1016
|
+
"matcher": "Bash",
|
|
1017
|
+
"command": "bash .claude/hooks/check-merge-gate.sh"
|
|
1018
|
+
}
|
|
1019
|
+
]
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
Make the hook script executable: `chmod +x .claude/hooks/check-merge-gate.sh`
|
|
1025
|
+
|
|
968
1026
|
## Closing
|
|
969
1027
|
|
|
970
1028
|
**After CREATE:**
|