feat: workstream namespacing for parallel milestone work

Enable multiple Claude Code instances to work on the same codebase
simultaneously by scoping .planning/ state into workstreams.

Core changes:
- planningDir(cwd, ws?) and planningPaths(cwd, ws?) are now workstream-aware
  via GSD_WORKSTREAM env var (auto-detected from --ws flag or active-workstream file)
- All bin/lib modules use planningDir(cwd) for scoped paths (STATE.md, ROADMAP.md,
  phases/, REQUIREMENTS.md) and planningRoot(cwd) for shared paths (milestones/,
  PROJECT.md, config.json, codebase/)
- New workstream.cjs module: create, list, status, complete, set, get, progress
- gsd-tools.cjs: --ws flag parsing with priority chain
  (--ws > GSD_WORKSTREAM env > active-workstream file > flat mode)
- Collision detection: transition.md checks for other active workstreams before
  suggesting next-milestone continuation (prevents WS A from trampling WS B)
- ${GSD_WS} routing propagation across all 9 workflow files ensures workstream
  scope chains automatically through the workflow lifecycle

New files:
- get-shit-done/bin/lib/workstream.cjs (CRUD + collision detection)
- get-shit-done/commands/gsd/workstreams.md (slash command)
- get-shit-done/references/workstream-flag.md (documentation)
- tests/workstream.test.cjs (20 tests covering CRUD, env var routing, --ws flag)

All 1062 tests passing (1042 existing + 20 new workstream tests).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
SalesTeamToolbox
2026-03-20 14:20:23 -07:00
parent c152d1275e
commit c83b69bbb5
23 changed files with 1436 additions and 202 deletions

View File

@@ -142,7 +142,7 @@ Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phas
```
Phase [X] not found in roadmap.
Use /gsd:progress to see available phases.
Use /gsd:progress ${GSD_WS} to see available phases.
```
Exit workflow.
@@ -189,7 +189,7 @@ Check `has_plans` and `plan_count` from init. **If `has_plans` is true:**
- header: "Plans exist"
- question: "Phase [X] already has {plan_count} plan(s) created without user context. Your decisions here won't affect existing plans unless you replan."
- options:
- "Continue and replan after" — Capture context, then run /gsd:plan-phase {X} to replan
- "Continue and replan after" — Capture context, then run /gsd:plan-phase {X} ${GSD_WS} to replan
- "View existing plans" — Show plans before deciding
- "Cancel" — Skip discuss-phase
@@ -871,15 +871,15 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
**Phase ${PHASE}: [Name]** — [Goal from ROADMAP.md]
`/gsd:plan-phase ${PHASE}`
`/gsd:plan-phase ${PHASE} ${GSD_WS}`
<sub>`/clear` first → fresh context window</sub>
---
**Also available:**
- `/gsd:plan-phase ${PHASE} --skip-research` — plan without research
- `/gsd:ui-phase ${PHASE}` — generate UI design contract before planning (if phase has frontend work)
- `/gsd:plan-phase ${PHASE} --skip-research ${GSD_WS}` — plan without research
- `/gsd:ui-phase ${PHASE} ${GSD_WS}` — generate UI design contract before planning (if phase has frontend work)
- Review/edit CONTEXT.md before continuing
---
@@ -990,7 +990,7 @@ Context captured. Launching plan-phase...
Launch plan-phase using the Skill tool to avoid nested Task sessions (which cause runtime freezes due to deep agent nesting — see #686):
```
Skill(skill="gsd:plan-phase", args="${PHASE} --auto")
Skill(skill="gsd:plan-phase", args="${PHASE} --auto ${GSD_WS}")
```
This keeps the auto-advance chain flat — discuss, plan, and execute all run at the same nesting level rather than spawning increasingly deep Task agents.
@@ -1004,23 +1004,23 @@ This keeps the auto-advance chain flat — discuss, plan, and execute all run at
Auto-advance pipeline finished: discuss → plan → execute
Next: /gsd:discuss-phase ${NEXT_PHASE} --auto
Next: /gsd:discuss-phase ${NEXT_PHASE} --auto ${GSD_WS}
<sub>/clear first → fresh context window</sub>
```
- **PLANNING COMPLETE** → Planning done, execution didn't complete:
```
Auto-advance partial: Planning complete, execution did not finish.
Continue: /gsd:execute-phase ${PHASE}
Continue: /gsd:execute-phase ${PHASE} ${GSD_WS}
```
- **PLANNING INCONCLUSIVE / CHECKPOINT** → Stop chain:
```
Auto-advance stopped: Planning needs input.
Continue: /gsd:plan-phase ${PHASE}
Continue: /gsd:plan-phase ${PHASE} ${GSD_WS}
```
- **GAPS FOUND** → Stop chain:
```
Auto-advance stopped: Gaps found during execution.
Continue: /gsd:plan-phase ${PHASE} --gaps
Continue: /gsd:plan-phase ${PHASE} --gaps ${GSD_WS}
```
**If neither `--auto` nor config enabled:**