## Workstream Context (pre-injected by WXP)
**Subcommand:**
**Name:**
**Active workstream:**
**Workstream list:**
**State:**
---
Manage GSD workstreams — isolated parallel tracks of work within a project.
Each workstream has its own ROADMAP.md, STATE.md, and phase history.
Subcommands: list, create <name>, switch <name>, status [name], complete <name>
Parse `subcommand` and `name` from injected variables.
**Route by subcommand:**
| Subcommand | Action |
|------------|--------|
| `list` (or empty) | → **list_workstreams** |
| `create ` | → **create_workstream** |
| `switch ` | → **switch_workstream** |
| `status [name]` | → **show_status** |
| `complete ` | → **complete_workstream** |
**If subcommand is unrecognised:** Show help (see offer_help step).
Parse `ws-list` JSON for workstream entries. Display:
```
## Workstreams
Active: {ws-active || "(none — on main planning root)"}
| Name | Status | Phases | Progress |
|------|--------|--------|---------|
| {name} | {active|inactive} | {phase_count} | {pct}% |
| ... | ... | ... | ... |
---
/gsd-workstreams create - create a new workstream
/gsd-workstreams switch - switch to a workstream
/gsd-workstreams status - detailed workstream status
/gsd-workstreams complete - close a workstream
```
**If no workstreams exist:**
```
No workstreams yet. You're working in the main planning root.
Create a workstream to isolate parallel work:
/gsd-workstreams create
```
**Require `name`:**
If `name` is empty, ask: "Workstream name? (lowercase, no spaces — e.g. mobile-app, api-v2)"
Validate: lowercase alphanumeric with hyphens/underscores only.
```bash
pi-gsd-tools workstream create {name}
```
Confirm:
```
✓ Workstream '{name}' created
To switch to it: /gsd-workstreams switch {name}
```
**Require `name`:** If empty, list available workstreams and ask user to choose.
```bash
pi-gsd-tools workstream set {name}
```
Confirm:
```
✓ Switched to workstream: {name}
All subsequent GSD commands will operate within this workstream.
To return to main: /gsd-workstreams switch main
```
**Target:** `name` if provided, otherwise the active workstream.
```bash
pi-gsd-tools workstream status {name}
```
Display the full status output including phase progress, open todos, and blockers.
**Require `name`:** If empty, ask which workstream to complete.
Confirm before completing:
```
Complete workstream '{name}'?
This will:
- Mark all phases as complete
- Archive the workstream planning files
Continue? (yes / no)
```
If yes:
```bash
pi-gsd-tools workstream complete {name}
```
Confirm:
```
✓ Workstream '{name}' completed and archived.
```
```
## /gsd-workstreams
Manage parallel tracks of work within a project.
Usage:
/gsd-workstreams - list all workstreams
/gsd-workstreams create - create a new workstream
/gsd-workstreams switch - activate a workstream
/gsd-workstreams status [name] - show workstream details
/gsd-workstreams complete - close a finished workstream
Current: {ws-active || "main planning root"}
```
- [ ] Active workstream pre-injected (no runtime read needed)
- [ ] Workstream list pre-injected
- [ ] Subcommand routed correctly
- [ ] Each action calls the appropriate CLI command
- [ ] Confirmations displayed after mutations