singularity-forge/.plans/workflow-templates.md
Jeremy McSpadden b0c3ab5781 feat: workflow templates — right-sized workflows for every task type (#1185)
* feat: add workflow templates — named workflow shapes for different types of work

Introduces `/gsd start <template>` and `/gsd templates` commands with 8 built-in
workflow templates: bugfix, small-feature, spike, hotfix, refactor, security-audit,
dep-upgrade, and full-project. Each template defines purpose-specific phases so
work gets the right level of ceremony instead of forcing everything through the
full milestone pipeline or /gsd quick.

Includes auto-detection from natural language, --dry-run preview, state tracking
for resume support, git branch management, and artifact directory organization.

* fix: guard workflow templates against concurrent auto-mode sessions

Block /gsd start when auto-mode is active to prevent git branch conflicts
and competing message dispatch. When auto-mode is paused, allow templates
to run with an informational notice.

* feat: add workflow resume and in-progress detection

- /gsd start resume — resumes the most recent in-progress workflow
- /gsd start (no args) — shows in-progress workflow if one exists
- STATE.json tracks artifactDir and completedAt for lifecycle management
- Scans .gsd/workflows/*/STATE.json to find unfinished workflows

* chore: remove copyright headers per project conventions
2026-03-18 12:25:28 -06:00

77 lines
3.5 KiB
Markdown

# GSD Workflow Templates — Implementation Plan (Updated)
**Date:** 2026-03-18
**Branch:** `feat/workflow-templates`
**Status:** In Progress — Phase 1
---
## Architecture Mapping (Plan → Actual Codebase)
The original plan referenced `gsd-tools.cjs`, `lib/init.cjs`, `lib/core.cjs` — these don't exist.
The actual architecture is a TypeScript extension system:
| Plan Reference | Actual Location |
|---|---|
| `gsd-tools.cjs` command routing | `src/resources/extensions/gsd/commands.ts` |
| `lib/workflow-template.cjs` | `src/resources/extensions/gsd/workflow-templates.ts` (new) |
| `lib/init.cjs` | No separate init; logic lives in handler module |
| `lib/core.cjs` | Utilities spread across `paths.ts`, `state.ts`, etc. |
| `~/.claude/get-shit-done/workflow-templates/` | `src/resources/extensions/gsd/workflow-templates/` (new dir) |
| `/gsd:start`, `/gsd:templates` | `/gsd start`, `/gsd templates` subcommands |
| Prompt templates | `src/resources/extensions/gsd/prompts/` |
---
## Phase 1: Foundation (Core Infrastructure)
### Files to Create
1. **`src/resources/extensions/gsd/workflow-templates/registry.json`**
- Template metadata: name, description, phases, triggers, artifact_dir, complexity, agents
2. **`src/resources/extensions/gsd/workflow-templates.ts`**
- `loadRegistry()` — parse registry.json from extension dir
- `resolveTemplate(nameOrTrigger)` — match by name, alias, or trigger keywords
- `autoDetect(context)` — analyze user input + project state for best template match
- `listTemplates()` — formatted template list for display
- `getTemplateInfo(name)` — detailed template metadata
3. **`src/resources/extensions/gsd/commands-workflow-templates.ts`**
- `handleStart(args, ctx, pi)``/gsd start [template] [args]`
- `handleTemplates(args, ctx)``/gsd templates [info <name>]`
4. **Wire into `commands.ts`**:
- Add `start` and `templates` to subcommand completions
- Add handler routing for both commands
### Files to Create (Phase 2 — Templates)
5. **`src/resources/extensions/gsd/workflow-templates/bugfix.md`**
6. **`src/resources/extensions/gsd/workflow-templates/small-feature.md`**
7. **`src/resources/extensions/gsd/workflow-templates/spike.md`**
8. **`src/resources/extensions/gsd/workflow-templates/hotfix.md`**
9. **`src/resources/extensions/gsd/workflow-templates/refactor.md`**
10. **`src/resources/extensions/gsd/workflow-templates/security-audit.md`**
11. **`src/resources/extensions/gsd/workflow-templates/dep-upgrade.md`**
12. **`src/resources/extensions/gsd/workflow-templates/full-project.md`**
### Prompt Templates
13. **`src/resources/extensions/gsd/prompts/workflow-start.md`** — dispatched when `/gsd start` resolves a template
14. **`src/resources/extensions/gsd/prompts/workflow-bugfix.md`** — bugfix-specific dispatch prompt
15. **`src/resources/extensions/gsd/prompts/workflow-small-feature.md`**
16. **`src/resources/extensions/gsd/prompts/workflow-spike.md`**
17. **`src/resources/extensions/gsd/prompts/workflow-hotfix.md`**
---
## Success Criteria
- [ ] `/gsd start bugfix` resolves template and dispatches workflow prompt
- [ ] `/gsd start` with no args auto-detects from context or shows choices
- [ ] `/gsd templates` lists all available templates
- [ ] `/gsd templates info bugfix` shows detailed template info
- [ ] All existing `/gsd *` commands work unchanged (zero regression)
- [ ] Registry validates (all referenced template files exist)
- [ ] Templates reuse existing agents and prompt patterns