feat: add context-optimizing parsing commands to gsd-tools (#473)

Add three new commands that extract structured data from GSD files,
reducing context usage by returning only parsed fields instead of
raw file content:

- phase-plan-index: Plans grouped by wave with metadata (id, wave,
  autonomous, objective, files_modified, task_count, has_summary)
- state-snapshot: Parsed STATE.md fields (current phase, decisions,
  blockers, session info)
- summary-extract: Frontmatter extraction with optional --fields filter

Update workflows to use new commands:
- execute-phase: Use phase-plan-index instead of ls + grep loop
- plan-phase: Use state-snapshot for decisions
- research-phase: Use state-snapshot for decisions
- complete-milestone: Use summary-extract for one-liners

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
TÂCHES
2026-02-08 01:08:19 -06:00
committed by GitHub
parent 64373a8f36
commit 6c537373c6
6 changed files with 751 additions and 26 deletions

View File

@@ -47,31 +47,16 @@ From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
</step>
<step name="discover_plans">
<step name="discover_and_group_plans">
Load plan inventory with wave grouping in one call:
```bash
ls -1 "$PHASE_DIR"/*-PLAN.md 2>/dev/null | sort
ls -1 "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null | sort
PLAN_INDEX=$(node ~/.claude/get-shit-done/bin/gsd-tools.js phase-plan-index "${PHASE_NUMBER}")
```
For each plan, read frontmatter: `wave`, `autonomous`, `gap_closure`.
Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
Build inventory: path, plan ID, wave, autonomous flag, gap_closure flag, completion (SUMMARY exists = complete).
**Filtering:** Skip completed plans. If `--gaps-only`: also skip non-gap_closure plans. If all filtered: "No matching incomplete plans" → exit.
</step>
<step name="group_by_wave">
```bash
for plan in $PHASE_DIR/*-PLAN.md; do
wave=$(grep "^wave:" "$plan" | cut -d: -f2 | tr -d ' ')
autonomous=$(grep "^autonomous:" "$plan" | cut -d: -f2 | tr -d ' ')
echo "$plan:$wave:$autonomous"
done
```
Group by wave number. **No dependency analysis needed** — waves pre-computed during `/gsd:plan-phase`.
**Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If all filtered: "No matching incomplete plans" → exit.
Report:
```