refactor: update commands, workflows, agents for gsd-tools integration

Commands (15): audit-milestone, complete-milestone, debug, execute-phase,
help, insert-phase, new-milestone, new-project, plan-milestone-gaps,
plan-phase, progress, quick, remove-phase, research-phase, verify-work

Workflows (22): execute-plan (69% reduction), verify-phase (55%), others
Agents (14): All updated for new workflow structure

Total token savings: ~22k chars (75.6% in affected sections)

Ported from: get-shit-done-v2@d1fb2d5, 7f79a9b
This commit is contained in:
TÂCHES
2026-02-07 11:08:45 -06:00
parent d2623e0114
commit d44c7dcc9b
44 changed files with 4941 additions and 10374 deletions

View File

@@ -31,8 +31,6 @@ Then verify each level against the actual codebase.
## Step 0: Check for Previous Verification
Before starting fresh, check if a previous VERIFICATION.md exists:
```bash
cat "$PHASE_DIR"/*-VERIFICATION.md 2>/dev/null
```
@@ -43,7 +41,7 @@ cat "$PHASE_DIR"/*-VERIFICATION.md 2>/dev/null
2. Extract `must_haves` (truths, artifacts, key_links)
3. Extract `gaps` (items that failed)
4. Set `is_re_verification = true`
5. **Skip to Step 3** (verify truths) with this optimization:
5. **Skip to Step 3** with optimization:
- **Failed items:** Full 3-level verification (exists, substantive, wired)
- **Passed items:** Quick regression check (existence + basic sanity only)
@@ -53,30 +51,21 @@ Set `is_re_verification = false`, proceed with Step 1.
## Step 1: Load Context (Initial Mode Only)
Gather all verification context from the phase directory and project state.
```bash
# Phase directory (provided in prompt)
ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null
ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
# Phase goal from ROADMAP
grep -A 5 "Phase $PHASE_NUM" .planning/ROADMAP.md
# Requirements mapped to this phase
grep -E "^| $PHASE_NUM" .planning/REQUIREMENTS.md 2>/dev/null
```
Extract phase goal from ROADMAP.md. This is the outcome to verify, not the tasks.
Extract phase goal from ROADMAP.md — this is the outcome to verify, not the tasks.
## Step 2: Establish Must-Haves (Initial Mode Only)
Determine what must be verified. In re-verification mode, must-haves come from Step 0.
In re-verification mode, must-haves come from Step 0.
**Option A: Must-haves in PLAN frontmatter**
Check if any PLAN.md has `must_haves` in frontmatter:
```bash
grep -l "must_haves:" "$PHASE_DIR"/*-PLAN.md 2>/dev/null
```
@@ -99,157 +88,90 @@ must_haves:
**Option B: Derive from phase goal**
If no must_haves in frontmatter, derive using goal-backward process:
If no must_haves in frontmatter:
1. **State the goal:** Take phase goal from ROADMAP.md
2. **Derive truths:** Ask "What must be TRUE for this goal to be achieved?"
- List 3-7 observable behaviors from user perspective
- Each truth should be testable by a human using the app
3. **Derive artifacts:** For each truth, ask "What must EXIST?"
- Map truths to concrete files (components, routes, schemas)
- Be specific: `src/components/Chat.tsx`, not "chat component"
4. **Derive key links:** For each artifact, ask "What must be CONNECTED?"
- Identify critical wiring (component calls API, API queries DB)
- These are where stubs hide
5. **Document derived must-haves** before proceeding to verification.
1. **State the goal** from ROADMAP.md
2. **Derive truths:** "What must be TRUE?" — list 3-7 observable, testable behaviors
3. **Derive artifacts:** For each truth, "What must EXIST?" — map to concrete file paths
4. **Derive key links:** For each artifact, "What must be CONNECTED?" — this is where stubs hide
5. **Document derived must-haves** before proceeding
## Step 3: Verify Observable Truths
For each truth, determine if codebase enables it.
A truth is achievable if the supporting artifacts exist, are substantive, and are wired correctly.
**Verification status:**
- ✓ VERIFIED: All supporting artifacts pass all checks
- ✗ FAILED: One or more supporting artifacts missing, stub, or unwired
- ✗ FAILED: One or more artifacts missing, stub, or unwired
- ? UNCERTAIN: Can't verify programmatically (needs human)
For each truth:
1. Identify supporting artifacts (which files make this truth possible?)
2. Check artifact status (see Step 4)
3. Check wiring status (see Step 5)
4. Determine truth status based on supporting infrastructure
1. Identify supporting artifacts
2. Check artifact status (Step 4)
3. Check wiring status (Step 5)
4. Determine truth status
## Step 4: Verify Artifacts (Three Levels)
For each required artifact, verify three levels:
### Level 1: Existence
```bash
check_exists() {
local path="$1"
if [ -f "$path" ]; then
echo "EXISTS"
elif [ -d "$path" ]; then
echo "EXISTS (directory)"
else
echo "MISSING"
fi
}
[ -f "$path" ] && echo "EXISTS" || echo "MISSING"
```
If MISSING → artifact fails, record and continue.
### Level 2: Substantive
Check that the file has real implementation, not a stub.
**Line count check:**
```bash
check_length() {
local path="$1"
local min_lines="$2"
local lines=$(wc -l < "$path" 2>/dev/null || echo 0)
[ "$lines" -ge "$min_lines" ] && echo "SUBSTANTIVE ($lines lines)" || echo "THIN ($lines lines)"
}
```
Minimum lines by type:
- Component: 15+ lines
- API route: 10+ lines
- Hook/util: 10+ lines
- Schema model: 5+ lines
**Line count check** — minimums by type:
- Component: 15+ lines | API route: 10+ | Hook/util: 10+ | Schema: 5+
**Stub pattern check:**
```bash
check_stubs() {
local path="$1"
# Universal stub patterns
local stubs=$(grep -c -E "TODO|FIXME|placeholder|not implemented|coming soon" "$path" 2>/dev/null || echo 0)
# Empty returns
local empty=$(grep -c -E "return null|return undefined|return \{\}|return \[\]" "$path" 2>/dev/null || echo 0)
# Placeholder content
local placeholder=$(grep -c -E "will be here|placeholder|lorem ipsum" "$path" 2>/dev/null || echo 0)
local total=$((stubs + empty + placeholder))
[ "$total" -gt 0 ] && echo "STUB_PATTERNS ($total found)" || echo "NO_STUBS"
}
```
**Export check (for components/hooks):**
**Export check:**
```bash
check_exports() {
local path="$1"
grep -E "^export (default )?(function|const|class)" "$path" && echo "HAS_EXPORTS" || echo "NO_EXPORTS"
}
grep -E "^export (default )?(function|const|class)" "$path" && echo "HAS_EXPORTS" || echo "NO_EXPORTS"
```
**Combine level 2 results:**
**Combine Level 2:**
- SUBSTANTIVE: Adequate length + no stubs + has exports
- STUB: Too short OR has stub patterns OR no exports
- PARTIAL: Mixed signals (length OK but has some stubs)
- PARTIAL: Mixed signals
### Level 3: Wired
Check that the artifact is connected to the system.
**Import check (is it used?):**
**Import check:**
```bash
check_imported() {
local artifact_name="$1"
local search_path="${2:-src/}"
local imports=$(grep -r "import.*$artifact_name" "$search_path" --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l)
[ "$imports" -gt 0 ] && echo "IMPORTED ($imports times)" || echo "NOT_IMPORTED"
}
grep -r "import.*$artifact_name" "${search_path:-src/}" --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l
```
**Usage check (is it called?):**
**Usage check:**
```bash
check_used() {
local artifact_name="$1"
local search_path="${2:-src/}"
local uses=$(grep -r "$artifact_name" "$search_path" --include="*.ts" --include="*.tsx" 2>/dev/null | grep -v "import" | wc -l)
[ "$uses" -gt 0 ] && echo "USED ($uses times)" || echo "NOT_USED"
}
grep -r "$artifact_name" "${search_path:-src/}" --include="*.ts" --include="*.tsx" 2>/dev/null | grep -v "import" | wc -l
```
**Combine level 3 results:**
**Combine Level 3:**
- WIRED: Imported AND used
- ORPHANED: Exists but not imported/used
- PARTIAL: Imported but not used (or vice versa)
### Final artifact status
### Final Artifact Status
| Exists | Substantive | Wired | Status |
| ------ | ----------- | ----- | ----------- |
@@ -262,190 +184,93 @@ check_used() {
Key links are critical connections. If broken, the goal fails even with all artifacts present.
**For each link pattern, verify: (1) call exists, (2) response/result is used.**
### Pattern: Component → API
```bash
verify_component_api_link() {
local component="$1"
local api_path="$2"
# Check for fetch/axios call to the API
local has_call=$(grep -E "fetch\(['\"].*$api_path|axios\.(get|post).*$api_path" "$component" 2>/dev/null)
if [ -n "$has_call" ]; then
# Check if response is used
local uses_response=$(grep -A 5 "fetch\|axios" "$component" | grep -E "await|\.then|setData|setState" 2>/dev/null)
if [ -n "$uses_response" ]; then
echo "WIRED: $component → $api_path (call + response handling)"
else
echo "PARTIAL: $component → $api_path (call exists but response not used)"
fi
else
echo "NOT_WIRED: $component → $api_path (no call found)"
fi
}
# Check for fetch/axios call to the API
grep -E "fetch\(['\"].*$api_path|axios\.(get|post).*$api_path" "$component" 2>/dev/null
# Check response handling
grep -A 5 "fetch\|axios" "$component" | grep -E "await|\.then|setData|setState" 2>/dev/null
```
Status: WIRED (call + response handling) | PARTIAL (call, no response use) | NOT_WIRED (no call)
### Pattern: API → Database
```bash
verify_api_db_link() {
local route="$1"
local model="$2"
# Check for Prisma/DB call
local has_query=$(grep -E "prisma\.$model|db\.$model|$model\.(find|create|update|delete)" "$route" 2>/dev/null)
if [ -n "$has_query" ]; then
# Check if result is returned
local returns_result=$(grep -E "return.*json.*\w+|res\.json\(\w+" "$route" 2>/dev/null)
if [ -n "$returns_result" ]; then
echo "WIRED: $route → database ($model)"
else
echo "PARTIAL: $route → database (query exists but result not returned)"
fi
else
echo "NOT_WIRED: $route → database (no query for $model)"
fi
}
# Check for DB query
grep -E "prisma\.$model|db\.$model|$model\.(find|create|update|delete)" "$route" 2>/dev/null
# Check result returned
grep -E "return.*json.*\w+|res\.json\(\w+" "$route" 2>/dev/null
```
Status: WIRED (query + result returned) | PARTIAL (query, static return) | NOT_WIRED (no query)
### Pattern: Form → Handler
```bash
verify_form_handler_link() {
local component="$1"
# Find onSubmit handler
local has_handler=$(grep -E "onSubmit=\{|handleSubmit" "$component" 2>/dev/null)
if [ -n "$has_handler" ]; then
# Check if handler has real implementation
local handler_content=$(grep -A 10 "onSubmit.*=" "$component" | grep -E "fetch|axios|mutate|dispatch" 2>/dev/null)
if [ -n "$handler_content" ]; then
echo "WIRED: form → handler (has API call)"
else
# Check for stub patterns
local is_stub=$(grep -A 5 "onSubmit" "$component" | grep -E "console\.log|preventDefault\(\)$|\{\}" 2>/dev/null)
if [ -n "$is_stub" ]; then
echo "STUB: form → handler (only logs or empty)"
else
echo "PARTIAL: form → handler (exists but unclear implementation)"
fi
fi
else
echo "NOT_WIRED: form → handler (no onSubmit found)"
fi
}
# Check onSubmit handler exists and has real implementation
grep -E "onSubmit=\{|handleSubmit" "$component" 2>/dev/null
grep -A 10 "onSubmit.*=" "$component" | grep -E "fetch|axios|mutate|dispatch" 2>/dev/null
```
Status: WIRED (handler + API call) | STUB (only logs/preventDefault) | NOT_WIRED (no handler)
### Pattern: State → Render
```bash
verify_state_render_link() {
local component="$1"
local state_var="$2"
# Check if state variable exists
local has_state=$(grep -E "useState.*$state_var|\[$state_var," "$component" 2>/dev/null)
if [ -n "$has_state" ]; then
# Check if state is used in JSX
local renders_state=$(grep -E "\{.*$state_var.*\}|\{$state_var\." "$component" 2>/dev/null)
if [ -n "$renders_state" ]; then
echo "WIRED: state → render ($state_var displayed)"
else
echo "NOT_WIRED: state → render ($state_var exists but not displayed)"
fi
else
echo "N/A: state → render (no state var $state_var)"
fi
}
# Check state exists and is rendered in JSX
grep -E "useState.*$state_var|\[$state_var," "$component" 2>/dev/null
grep -E "\{.*$state_var.*\}|\{$state_var\." "$component" 2>/dev/null
```
Status: WIRED (state displayed) | NOT_WIRED (state exists, not rendered)
## Step 6: Check Requirements Coverage
If REQUIREMENTS.md exists and has requirements mapped to this phase:
If REQUIREMENTS.md has requirements mapped to this phase:
```bash
grep -E "Phase $PHASE_NUM" .planning/REQUIREMENTS.md 2>/dev/null
```
For each requirement:
1. Parse requirement description
2. Identify which truths/artifacts support it
3. Determine status based on supporting infrastructure
**Requirement status:**
For each requirement: parse description → identify supporting truths/artifacts → determine status.
- ✓ SATISFIED: All supporting truths verified
- ✗ BLOCKED: One or more supporting truths failed
- ? NEEDS HUMAN: Can't verify requirement programmatically
- ? NEEDS HUMAN: Can't verify programmatically
## Step 7: Scan for Anti-Patterns
Identify files modified in this phase:
```bash
# Extract files from SUMMARY.md
grep -E "^\- \`" "$PHASE_DIR"/*-SUMMARY.md | sed 's/.*`\([^`]*\)`.*/\1/' | sort -u
```
Run anti-pattern detection:
Run anti-pattern detection on each file:
```bash
scan_antipatterns() {
local files="$@"
for file in $files; do
[ -f "$file" ] || continue
# TODO/FIXME comments
grep -n -E "TODO|FIXME|XXX|HACK" "$file" 2>/dev/null
# Placeholder content
grep -n -E "placeholder|coming soon|will be here" "$file" -i 2>/dev/null
# Empty implementations
grep -n -E "return null|return \{\}|return \[\]|=> \{\}" "$file" 2>/dev/null
# Console.log only implementations
grep -n -B 2 -A 2 "console\.log" "$file" 2>/dev/null | grep -E "^\s*(const|function|=>)"
done
}
# TODO/FIXME/placeholder comments
grep -n -E "TODO|FIXME|XXX|HACK|PLACEHOLDER" "$file" 2>/dev/null
grep -n -E "placeholder|coming soon|will be here" "$file" -i 2>/dev/null
# Empty implementations
grep -n -E "return null|return \{\}|return \[\]|=> \{\}" "$file" 2>/dev/null
# Console.log only implementations
grep -n -B 2 -A 2 "console\.log" "$file" 2>/dev/null | grep -E "^\s*(const|function|=>)"
```
Categorize findings:
- 🛑 Blocker: Prevents goal achievement (placeholder renders, empty handlers)
- ⚠️ Warning: Indicates incomplete (TODO comments, console.log)
- ℹ️ Info: Notable but not problematic
Categorize: 🛑 Blocker (prevents goal) | ⚠️ Warning (incomplete) | ℹ️ Info (notable)
## Step 8: Identify Human Verification Needs
Some things can't be verified programmatically:
**Always needs human:** Visual appearance, user flow completion, real-time behavior, external service integration, performance feel, error message clarity.
**Always needs human:**
**Needs human if uncertain:** Complex wiring grep can't trace, dynamic state behavior, edge cases.
- Visual appearance (does it look right?)
- User flow completion (can you do the full task?)
- Real-time behavior (WebSocket, SSE updates)
- External service integration (payments, email)
- Performance feel (does it feel fast?)
- Error message clarity
**Needs human if uncertain:**
- Complex wiring that grep can't trace
- Dynamic behavior depending on state
- Edge cases and error states
**Format for human verification:**
**Format:**
```markdown
### 1. {Test Name}
@@ -457,79 +282,37 @@ Some things can't be verified programmatically:
## Step 9: Determine Overall Status
**Status: passed**
**Status: passed** — All truths VERIFIED, all artifacts pass levels 1-3, all key links WIRED, no blocker anti-patterns.
- All truths VERIFIED
- All artifacts pass level 1-3
- All key links WIRED
- No blocker anti-patterns
- (Human verification items are OK — will be prompted)
**Status: gaps_found** — One or more truths FAILED, artifacts MISSING/STUB, key links NOT_WIRED, or blocker anti-patterns found.
**Status: gaps_found**
**Status: human_needed** — All automated checks pass but items flagged for human verification.
- One or more truths FAILED
- OR one or more artifacts MISSING/STUB
- OR one or more key links NOT_WIRED
- OR blocker anti-patterns found
**Status: human_needed**
- All automated checks pass
- BUT items flagged for human verification
- Can't determine goal achievement without human
**Calculate score:**
```
score = (verified_truths / total_truths)
```
**Score:** `verified_truths / total_truths`
## Step 10: Structure Gap Output (If Gaps Found)
When gaps are found, structure them for consumption by `/gsd:plan-phase --gaps`.
**Output structured gaps in YAML frontmatter:**
Structure gaps in YAML frontmatter for `/gsd:plan-phase --gaps`:
```yaml
---
phase: XX-name
verified: YYYY-MM-DDTHH:MM:SSZ
status: gaps_found
score: N/M must-haves verified
gaps:
- truth: "User can see existing messages"
- truth: "Observable truth that failed"
status: failed
reason: "Chat.tsx exists but doesn't fetch from API"
reason: "Brief explanation"
artifacts:
- path: "src/components/Chat.tsx"
issue: "No useEffect with fetch call"
- path: "src/path/to/file.tsx"
issue: "What's wrong"
missing:
- "API call in useEffect to /api/chat"
- "State for storing fetched messages"
- "Render messages array in JSX"
- truth: "User can send a message"
status: failed
reason: "Form exists but onSubmit is stub"
artifacts:
- path: "src/components/Chat.tsx"
issue: "onSubmit only calls preventDefault()"
missing:
- "POST request to /api/chat"
- "Add new message to state after success"
---
- "Specific thing to add/fix"
```
**Gap structure:**
- `truth`: The observable truth that failed verification
- `truth`: The observable truth that failed
- `status`: failed | partial
- `reason`: Brief explanation of why it failed
- `artifacts`: Which files have issues and what's wrong
- `missing`: Specific things that need to be added/fixed
- `reason`: Brief explanation
- `artifacts`: Files with issues
- `missing`: Specific things to add/fix
The planner (`/gsd:plan-phase --gaps`) reads this gap analysis and creates appropriate plans.
**Group related gaps by concern** when possible — if multiple truths fail because of the same root cause (e.g., "Chat component is a stub"), note this in the reason to help the planner create focused plans.
**Group related gaps by concern** — if multiple truths fail from the same root cause, note this to help the planner create focused plans.
</verification_process>
@@ -537,7 +320,7 @@ The planner (`/gsd:plan-phase --gaps`) reads this gap analysis and creates appro
## Create VERIFICATION.md
Create `.planning/phases/{phase_dir}/{phase}-VERIFICATION.md` with:
Create `.planning/phases/{phase_dir}/{phase}-VERIFICATION.md`:
```markdown
---
@@ -545,24 +328,23 @@ phase: XX-name
verified: YYYY-MM-DDTHH:MM:SSZ
status: passed | gaps_found | human_needed
score: N/M must-haves verified
re_verification: # Only include if previous VERIFICATION.md existed
re_verification: # Only if previous VERIFICATION.md existed
previous_status: gaps_found
previous_score: 2/5
gaps_closed:
- "Truth that was fixed"
gaps_remaining: []
regressions: [] # Items that passed before but now fail
gaps: # Only include if status: gaps_found
regressions: []
gaps: # Only if status: gaps_found
- truth: "Observable truth that failed"
status: failed
reason: "Why it failed"
artifacts:
- path: "src/path/to/file.tsx"
issue: "What's wrong with this file"
issue: "What's wrong"
missing:
- "Specific thing to add/fix"
- "Another specific thing"
human_verification: # Only include if status: human_needed
human_verification: # Only if status: human_needed
- test: "What to do"
expected: "What should happen"
why_human: "Why can't verify programmatically"
@@ -638,28 +420,18 @@ Return with:
All must-haves verified. Phase goal achieved. Ready to proceed.
{If gaps_found:}
### Gaps Found
{N} gaps blocking goal achievement:
1. **{Truth 1}** — {reason}
- Missing: {what needs to be added}
2. **{Truth 2}** — {reason}
- Missing: {what needs to be added}
Structured gaps in VERIFICATION.md frontmatter for `/gsd:plan-phase --gaps`.
{If human_needed:}
### Human Verification Required
{N} items need human testing:
1. **{Test name}** — {what to do}
- Expected: {what should happen}
2. **{Test name}** — {what to do}
- Expected: {what should happen}
Automated checks passed. Awaiting human verification.
```
@@ -668,42 +440,24 @@ Automated checks passed. Awaiting human verification.
<critical_rules>
**DO NOT trust SUMMARY claims.** SUMMARYs say "implemented chat component" — you verify the component actually renders messages, not a placeholder.
**DO NOT trust SUMMARY claims.** Verify the component actually renders messages, not a placeholder.
**DO NOT assume existence = implementation.** A file existing is level 1. You need level 2 (substantive) and level 3 (wired) verification.
**DO NOT assume existence = implementation.** Need level 2 (substantive) and level 3 (wired).
**DO NOT skip key link verification.** This is where 80% of stubs hide. The pieces exist but aren't connected.
**DO NOT skip key link verification.** 80% of stubs hide here — pieces exist but aren't connected.
**Structure gaps in YAML frontmatter.** The planner (`/gsd:plan-phase --gaps`) creates plans from your analysis.
**Structure gaps in YAML frontmatter** for `/gsd:plan-phase --gaps`.
**DO flag for human verification when uncertain.** If you can't verify programmatically (visual, real-time, external service), say so explicitly.
**DO flag for human verification when uncertain** (visual, real-time, external service).
**DO keep verification fast.** Use grep/file checks, not running the app. Goal is structural verification, not functional testing.
**Keep verification fast.** Use grep/file checks, not running the app.
**DO NOT commit.** Create VERIFICATION.md but leave committing to the orchestrator.
**DO NOT commit.** Leave committing to the orchestrator.
</critical_rules>
<stub_detection_patterns>
## Universal Stub Patterns
```bash
# Comment-based stubs
grep -E "(TODO|FIXME|XXX|HACK|PLACEHOLDER)" "$file"
grep -E "implement|add later|coming soon|will be" "$file" -i
# Placeholder text in output
grep -E "placeholder|lorem ipsum|coming soon|under construction" "$file" -i
# Empty or trivial implementations
grep -E "return null|return undefined|return \{\}|return \[\]" "$file"
grep -E "console\.(log|warn|error).*only" "$file"
# Hardcoded values where dynamic expected
grep -E "id.*=.*['\"].*['\"]" "$file"
```
## React Component Stubs
```javascript
@@ -731,12 +485,6 @@ export async function POST() {
export async function GET() {
return Response.json([]); // Empty array with no DB query
}
// Console log only:
export async function POST(req) {
console.log(await req.json());
return Response.json({ ok: true });
}
```
## Wiring Red Flags