@tekyzinc/gsd-t 2.50.12 → 2.53.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +379 -372
- package/bin/component-registry.js +250 -0
- package/bin/graph-cgc.js +510 -510
- package/bin/graph-indexer.js +147 -147
- package/bin/graph-overlay.js +195 -195
- package/bin/graph-parsers.js +327 -327
- package/bin/graph-query.js +453 -452
- package/bin/graph-store.js +154 -154
- package/bin/qa-calibrator.js +194 -0
- package/bin/scan-data-collector.js +153 -153
- package/bin/scan-diagrams-generators.js +187 -187
- package/bin/scan-diagrams.js +79 -79
- package/bin/scan-renderer.js +92 -92
- package/bin/scan-report-sections.js +121 -121
- package/bin/scan-report.js +184 -184
- package/bin/scan-schema-parsers.js +199 -199
- package/bin/scan-schema.js +103 -103
- package/bin/token-budget.js +246 -0
- package/commands/Claude-md.md +10 -10
- package/commands/branch.md +15 -15
- package/commands/checkin.md +45 -45
- package/commands/global-change.md +209 -209
- package/commands/gsd-t-audit.md +199 -0
- package/commands/gsd-t-backlog-add.md +94 -94
- package/commands/gsd-t-backlog-edit.md +111 -111
- package/commands/gsd-t-backlog-list.md +63 -63
- package/commands/gsd-t-backlog-move.md +94 -94
- package/commands/gsd-t-backlog-promote.md +123 -123
- package/commands/gsd-t-backlog-remove.md +86 -86
- package/commands/gsd-t-backlog-settings.md +158 -158
- package/commands/gsd-t-complete-milestone.md +528 -515
- package/commands/gsd-t-debug.md +506 -399
- package/commands/gsd-t-discuss.md +174 -174
- package/commands/gsd-t-execute.md +758 -634
- package/commands/gsd-t-feature.md +276 -276
- package/commands/gsd-t-health.md +142 -142
- package/commands/gsd-t-help.md +465 -457
- package/commands/gsd-t-impact.md +302 -302
- package/commands/gsd-t-init.md +320 -280
- package/commands/gsd-t-integrate.md +365 -249
- package/commands/gsd-t-milestone.md +87 -87
- package/commands/gsd-t-partition.md +442 -361
- package/commands/gsd-t-pause.md +82 -82
- package/commands/gsd-t-plan.md +345 -344
- package/commands/gsd-t-populate.md +111 -111
- package/commands/gsd-t-prd.md +326 -326
- package/commands/gsd-t-project.md +211 -211
- package/commands/gsd-t-promote-debt.md +123 -123
- package/commands/gsd-t-prompt.md +137 -137
- package/commands/gsd-t-qa.md +266 -266
- package/commands/gsd-t-quick.md +357 -234
- package/commands/gsd-t-reflect.md +134 -134
- package/commands/gsd-t-resume.md +72 -72
- package/commands/gsd-t-scan.md +615 -615
- package/commands/gsd-t-setup.md +76 -0
- package/commands/gsd-t-status.md +192 -166
- package/commands/gsd-t-test-sync.md +381 -381
- package/commands/gsd-t-triage-and-merge.md +171 -171
- package/commands/gsd-t-verify.md +382 -382
- package/commands/gsd-t-visualize.md +118 -118
- package/commands/gsd-t-wave.md +401 -378
- package/docs/GSD-T-README.md +425 -422
- package/docs/architecture.md +385 -369
- package/docs/harness-design-analysis.md +371 -0
- package/docs/infrastructure.md +205 -205
- package/docs/prd-graph-engine.md +398 -398
- package/docs/prd-gsd2-hybrid.md +559 -559
- package/docs/prd-harness-evolution.md +583 -0
- package/docs/requirements.md +14 -0
- package/docs/workflows.md +226 -226
- package/examples/.gsd-t/domains/example-domain/scope.md +13 -13
- package/package.json +40 -40
- package/scripts/gsd-t-auto-route.js +39 -39
- package/scripts/gsd-t-dashboard-mockup.html +1143 -1143
- package/scripts/gsd-t-dashboard-server.js +171 -171
- package/scripts/gsd-t-dashboard.html +262 -262
- package/scripts/gsd-t-event-writer.js +128 -128
- package/scripts/gsd-t-statusline.js +94 -94
- package/scripts/gsd-t-tools.js +175 -175
- package/templates/CLAUDE-global.md +639 -614
- package/templates/CLAUDE-project.md +24 -0
- package/templates/backlog-settings.md +18 -18
- package/templates/backlog.md +1 -1
- package/templates/progress.md +40 -40
- package/templates/shared-services-contract.md +60 -60
- package/templates/stacks/desktop.ini +2 -2
- package/bin/desktop.ini +0 -2
- package/commands/desktop.ini +0 -2
- package/docs/ci-examples/desktop.ini +0 -2
- package/docs/desktop.ini +0 -2
- package/examples/.gsd-t/contracts/desktop.ini +0 -2
- package/examples/.gsd-t/desktop.ini +0 -2
- package/examples/.gsd-t/domains/desktop.ini +0 -2
- package/examples/.gsd-t/domains/example-domain/desktop.ini +0 -2
- package/examples/desktop.ini +0 -2
- package/examples/rules/desktop.ini +0 -2
- package/scripts/desktop.ini +0 -2
- package/templates/desktop.ini +0 -2
package/docs/workflows.md
CHANGED
|
@@ -1,226 +1,226 @@
|
|
|
1
|
-
# Workflows — GSD-T Framework (@tekyzinc/gsd-t)
|
|
2
|
-
|
|
3
|
-
## Last Updated: 2026-03-09 (Scan #9, Post-M17)
|
|
4
|
-
|
|
5
|
-
## User Workflows
|
|
6
|
-
|
|
7
|
-
### Install GSD-T
|
|
8
|
-
1. Run `npx @tekyzinc/gsd-t install`
|
|
9
|
-
2. CLI copies 45 commands to `~/.claude/commands/`
|
|
10
|
-
3. CLI sets up global CLAUDE.md if missing (appends with separator if exists)
|
|
11
|
-
4. CLI installs heartbeat script to `~/.claude/scripts/`
|
|
12
|
-
5. CLI configures 9 hooks in `~/.claude/settings.json`
|
|
13
|
-
6. CLI saves version to `~/.claude/.gsd-t-version`
|
|
14
|
-
7. User starts Claude Code in their project
|
|
15
|
-
|
|
16
|
-
**Entry point**: `npx @tekyzinc/gsd-t install`
|
|
17
|
-
5b. CLI installs gsd-t-tools.js and gsd-t-statusline.js to `~/.claude/scripts/` (M13)
|
|
18
|
-
**Success**: 45 commands available in Claude Code
|
|
19
|
-
**Failure**: CLI reports missing Node.js or permission errors
|
|
20
|
-
|
|
21
|
-
### Initialize a Project
|
|
22
|
-
1. User runs `/gsd-t-init [name]` in Claude Code (or `gsd-t init [name]` CLI)
|
|
23
|
-
2. Init creates `.gsd-t/` directory with progress.md, backlog.md, backlog-settings.md, contracts/, domains/
|
|
24
|
-
3. Init creates or updates CLAUDE.md (project-level) using template with token replacement
|
|
25
|
-
4. Init creates `docs/` living documents (requirements, architecture, workflows, infrastructure) if missing
|
|
26
|
-
5. Init auto-registers project in `~/.claude/.gsd-t-projects`
|
|
27
|
-
6. All file creation uses `{ flag: "wx" }` — never overwrites existing files
|
|
28
|
-
|
|
29
|
-
**Entry point**: `/gsd-t-init` slash command or `gsd-t init` CLI
|
|
30
|
-
**Success**: Project ready for milestone definition
|
|
31
|
-
**Failure**: Reports what couldn't be created (existing files preserved)
|
|
32
|
-
|
|
33
|
-
### Full Wave Cycle
|
|
34
|
-
1. User defines milestone via `/gsd-t-milestone`
|
|
35
|
-
2. **Partition**: Decompose into domains + contracts (file ownership, interfaces)
|
|
36
|
-
3. **Discuss**: Explore design decisions (always pauses, even Level 3) — SKIPPABLE via structured 3-condition check: single domain, no open questions in Decision Log, all cross-domain contracts exist (M7)
|
|
37
|
-
4. **Plan**: Create atomic task lists per domain with dependencies
|
|
38
|
-
5. **Impact**: Analyze downstream effects (PROCEED / CAUTION / BLOCK verdicts)
|
|
39
|
-
6. **Execute**: Implement tasks (solo or team mode based on domain count)
|
|
40
|
-
7. **Test-Sync**: Align tests with code changes, verify coverage
|
|
41
|
-
8. **Integrate**: Wire domains at boundaries, verify contracts honored
|
|
42
|
-
9. **Verify**: Run 7 quality gate dimensions (functional, contracts, quality, tests, E2E, security, integration)
|
|
43
|
-
10. **Complete**: Archive to `.gsd-t/milestones/`, bump version, git tag
|
|
44
|
-
|
|
45
|
-
Additional wave behaviors (M10-M12):
|
|
46
|
-
- **M10**: QA removed from partition/plan; execute/integrate spawn QA as Task subagent; test-sync/verify/complete run QA inline
|
|
47
|
-
- **M11**: Per-task commits (`feat({domain}/task-{N})`) enforced; between-phase spot-check (status + git + filesystem); Deviation Rules in execute (4-rule protocol, 3-attempt limit)
|
|
48
|
-
- **M12**: discuss creates CONTEXT.md (Locked Decisions); plan reads CONTEXT.md + runs plan validation subagent (max 3 iterations); REQ traceability table in requirements.md; verify marks requirements complete
|
|
49
|
-
|
|
50
|
-
**Entry point**: `/gsd-t-wave` (auto-advances) or manual phase-by-phase
|
|
51
|
-
**Success**: Milestone completed, version bumped, git tagged
|
|
52
|
-
**Failure**: Wave pauses at failing phase; spot-check re-spawns phase agent once before stopping
|
|
53
|
-
|
|
54
|
-
### Autonomy Levels
|
|
55
|
-
| Level | Behavior |
|
|
56
|
-
|-------|----------|
|
|
57
|
-
| Level 1 (Supervised) | Pause at each phase for confirmation |
|
|
58
|
-
| Level 2 (Standard) | Pause only at milestones |
|
|
59
|
-
| Level 3 (Full Auto) | Auto-advance; only stop for Destructive Guard, Impact BLOCK, errors after 2 attempts, Discuss |
|
|
60
|
-
|
|
61
|
-
### Error Recovery (2-Attempt Rule)
|
|
62
|
-
| Failure | Recovery | After 2 Failures |
|
|
63
|
-
|---------|----------|-------------------|
|
|
64
|
-
| Impact BLOCK | Add remediation tasks, re-run | STOP and report |
|
|
65
|
-
| Test failures | Fix and re-run | STOP and report |
|
|
66
|
-
| Verify failure | Remediate and re-verify | STOP and report |
|
|
67
|
-
| Gap analysis gaps | Auto-fix and re-analyze | STOP and report |
|
|
68
|
-
|
|
69
|
-
## Technical Workflows
|
|
70
|
-
|
|
71
|
-
### CLI Update Check
|
|
72
|
-
1. CLI reads cached version from `~/.claude/.gsd-t-update-check` (JSON: `{ latest, timestamp }`)
|
|
73
|
-
2. If cache is fresh (<1 hour): show notice if cached latest > installed
|
|
74
|
-
3. If no cache: synchronous fetch to npm registry (8s timeout), cache result
|
|
75
|
-
4. If cache stale (>1 hour): spawn detached background `scripts/npm-update-check.js`
|
|
76
|
-
5. Compare versions using `isNewerVersion()` semver comparison
|
|
77
|
-
|
|
78
|
-
**Trigger**: Every CLI invocation (except install/update/update-all)
|
|
79
|
-
**Also**: `/gsd-t-status` slash command checks independently
|
|
80
|
-
|
|
81
|
-
### Heartbeat Event Logging
|
|
82
|
-
1. Claude Code hook fires (9 events: SessionStart, PostToolUse, SubagentStart, SubagentStop, TaskCompleted, TeammateIdle, Notification, Stop, SessionEnd)
|
|
83
|
-
2. `settings.json` hook calls `node ~/.claude/scripts/gsd-t-heartbeat.js`
|
|
84
|
-
3. Script reads JSON from stdin (capped at 1MB)
|
|
85
|
-
4. Validates session_id (alphanumeric regex), validates path is absolute and within `.gsd-t/`
|
|
86
|
-
5. Builds structured event with timestamp, type-specific data (tool summaries, file paths)
|
|
87
|
-
6. Appends JSONL to `.gsd-t/heartbeat-{session_id}.jsonl`
|
|
88
|
-
7. Runs cleanup: removes heartbeat files older than 7 days
|
|
89
|
-
|
|
90
|
-
**Trigger**: Claude Code hooks (9 event types)
|
|
91
|
-
**Frequency**: On every hooked event during a session
|
|
92
|
-
|
|
93
|
-
### Version Bump Rules
|
|
94
|
-
| Context | Change Type | Bump |
|
|
95
|
-
|---------|-------------|------|
|
|
96
|
-
| Complete-milestone | Breaking changes, major rework | Major |
|
|
97
|
-
| Complete-milestone | New features, feature milestones | Minor |
|
|
98
|
-
| Complete-milestone | Bug fixes, cleanup | Patch |
|
|
99
|
-
| Checkin | New features, new commands | Minor |
|
|
100
|
-
| Checkin | Bug fixes, docs, refactors | Patch (default) |
|
|
101
|
-
| Checkin | Breaking changes | Major |
|
|
102
|
-
|
|
103
|
-
Updated in: package.json, .gsd-t/progress.md, CHANGELOG.md, git tag
|
|
104
|
-
|
|
105
|
-
### Pre-Commit Gate
|
|
106
|
-
Every commit must pass applicable checks:
|
|
107
|
-
1. Branch guard (correct branch?)
|
|
108
|
-
2. Contract updates (API, schema, component)
|
|
109
|
-
3. Scope updates (new files → domain scope.md)
|
|
110
|
-
4. Documentation updates (requirements, architecture)
|
|
111
|
-
5. Decision Log entry (timestamped in progress.md)
|
|
112
|
-
6. Tech debt tracking (discovered/fixed?)
|
|
113
|
-
7. Test execution (affected tests pass?)
|
|
114
|
-
|
|
115
|
-
### Pause and Resume (M13)
|
|
116
|
-
|
|
117
|
-
**Pause workflow** (`/gsd-t-pause`):
|
|
118
|
-
1. Command reads progress.md + domains/*/tasks.md to identify exact position
|
|
119
|
-
2. Creates `.gsd-t/continue-here-{YYYYMMDDTHHMMSS}.md` with: milestone, phase, version, last completed action, next action, open items, user note
|
|
120
|
-
3. File persists until consumed by resume
|
|
121
|
-
4. Multiple pauses create multiple files; resume reads most recent by timestamp
|
|
122
|
-
|
|
123
|
-
**Resume workflow** (`/gsd-t-resume`):
|
|
124
|
-
1. Same-session: skip file reads, use conversation context
|
|
125
|
-
2. Cross-session: glob `.gsd-t/continue-here-*.md`, read most recent
|
|
126
|
-
3. Resume from "Next Action" field in continue-here file (more precise than progress.md alone)
|
|
127
|
-
4. Delete continue-here file after reading
|
|
128
|
-
|
|
129
|
-
### CONTEXT.md Workflow (M12)
|
|
130
|
-
|
|
131
|
-
1. `discuss` phase completes design decisions
|
|
132
|
-
2. Writes `.gsd-t/CONTEXT.md`:
|
|
133
|
-
- **Locked Decisions**: specific decisions the plan MUST implement
|
|
134
|
-
- **Deferred Ideas**: good ideas NOT in scope (plan must NOT implement)
|
|
135
|
-
- **Claude's Discretion**: implementation details left open
|
|
136
|
-
3. `plan` reads CONTEXT.md; every Locked Decision must map to at least one task
|
|
137
|
-
4. Plan validation subagent (Task tool) verifies mapping before finalizing plan
|
|
138
|
-
5. CONTEXT.md persists after plan phase; deleted manually if desired
|
|
139
|
-
6. If discuss is skipped (structured skip), CONTEXT.md is not created; plan handles gracefully
|
|
140
|
-
|
|
141
|
-
### Project Health Check (M13)
|
|
142
|
-
|
|
143
|
-
1. User invokes `/gsd-t-health [--repair]`
|
|
144
|
-
2. Health spawns as Task subagent (fresh context)
|
|
145
|
-
3. Checks 12 items: 5 root files, 3 directories, 4 docs, active milestone domains, version consistency, status validity, Decision Log, contract integrity
|
|
146
|
-
4. Reports status as HEALTHY (0 issues), DEGRADED (1-3), or BROKEN (4+ or critical missing)
|
|
147
|
-
5. With `--repair`: creates missing files from templates (MISSING items only; INVALID items flagged for user)
|
|
148
|
-
|
|
149
|
-
## Integration Workflows
|
|
150
|
-
|
|
151
|
-
### npm Publish
|
|
152
|
-
- **Trigger**: Manual `npm publish` after milestone completion
|
|
153
|
-
- **Pre-publish gate**: `prepublishOnly: "npm test"` runs 125 tests before publish (M8)
|
|
154
|
-
- **Flow**: Version bumped → CHANGELOG updated → git tagged → `npm publish` → tests run automatically → published
|
|
155
|
-
- **Verification**: `npx @tekyzinc/gsd-t status` on fresh install
|
|
156
|
-
|
|
157
|
-
### Update All Projects
|
|
158
|
-
- **Trigger**: `gsd-t update-all` CLI command
|
|
159
|
-
- **Flow**: Global update → iterate registered projects → inject Destructive Action Guard → create CHANGELOG → health check (Playwright, Swagger)
|
|
160
|
-
- **Registry**: `~/.claude/.gsd-t-projects` (newline-separated absolute paths)
|
|
161
|
-
|
|
162
|
-
### Real-Time Agent Dashboard (M14)
|
|
163
|
-
|
|
164
|
-
**Launch workflow** (`/gsd-t-visualize`):
|
|
165
|
-
1. Check if server is running: `GET http://localhost:7433/ping`
|
|
166
|
-
2. If not running: spawn `gsd-t-dashboard-server.js --detach` as background process; write PID to `.gsd-t/dashboard.pid`
|
|
167
|
-
3. Open browser to `http://localhost:7433`
|
|
168
|
-
4. Dashboard connects to `GET /events` (Server-Sent Events stream)
|
|
169
|
-
|
|
170
|
-
**Event stream flow**:
|
|
171
|
-
1. Claude Code hook fires (any hook event)
|
|
172
|
-
2. `gsd-t-event-writer.js` validates event fields and appends JSON line to `.gsd-t/events/YYYY-MM-DD.jsonl`
|
|
173
|
-
3. Dashboard server (`gsd-t-dashboard-server.js`) detects file change via `fs.watchFile()`
|
|
174
|
-
4. New event lines are broadcast as SSE: `data: {event-json}\n\n`
|
|
175
|
-
5. Dashboard HTML (React app via CDN) renders event feed with agent hierarchy
|
|
176
|
-
|
|
177
|
-
**Stop workflow**:
|
|
178
|
-
1. User runs `/gsd-t-visualize stop` or `GET /stop`
|
|
179
|
-
2. Server reads PID file, sends SIGTERM, deletes PID file
|
|
180
|
-
|
|
181
|
-
**Note:** Server watches only the newest JSONL file at startup. Date rollover (midnight UTC) requires server restart to pick up new file (TD-085).
|
|
182
|
-
|
|
183
|
-
### Auto-Update Workflow (M15)
|
|
184
|
-
|
|
185
|
-
1. Claude Code SessionStart hook fires
|
|
186
|
-
2. `gsd-t-update-check.js` reads `~/.claude/.gsd-t-version` (installed version)
|
|
187
|
-
3. Reads cached version from `~/.claude/.gsd-t-update-check` (JSON: `{latest, timestamp}`)
|
|
188
|
-
4. If cached version newer than installed: auto-runs `npm install -g @tekyzinc/gsd-t@{latest}` + `gsd-t update-all`
|
|
189
|
-
5. Outputs `[GSD-T AUTO-UPDATE]`, `[GSD-T UPDATE]`, or `[GSD-T] v{ver}` to stdout
|
|
190
|
-
6. Claude agent reads hook output from context and shows update status in first response
|
|
191
|
-
|
|
192
|
-
**Cache TTL**: 1 hour. After TTL, background `npm-update-check.js` refreshes async.
|
|
193
|
-
|
|
194
|
-
### Auto-Route Workflow (M16)
|
|
195
|
-
|
|
196
|
-
1. User types plain text in Claude Code in a GSD-T project directory
|
|
197
|
-
2. `gsd-t-auto-route.js` UserPromptSubmit hook fires
|
|
198
|
-
3. Script checks if `.gsd-t/progress.md` exists in cwd
|
|
199
|
-
4. If yes: injects `[GSD-T AUTO-ROUTE]` signal into prompt context
|
|
200
|
-
5. Claude agent sees signal and routes the plain text message through `/user:gsd {message}`
|
|
201
|
-
6. Smart router interprets intent and launches appropriate GSD-T command
|
|
202
|
-
|
|
203
|
-
**Note:** Only fires in GSD-T projects (`.gsd-t/progress.md` must exist). Silently passes through in all other directories.
|
|
204
|
-
|
|
205
|
-
### Scan Visual Output Workflow (M17)
|
|
206
|
-
|
|
207
|
-
1. User runs `/gsd-t-scan` — scan subagent analyzes codebase (Steps 1-2)
|
|
208
|
-
2. **Schema extraction** (Step 2.5): `bin/scan-schema.js` detects ORM/schema files
|
|
209
|
-
- Tries Prisma → TypeORM → Drizzle → Mongoose → Sequelize → SQLAlchemy → raw SQL
|
|
210
|
-
- Returns `SchemaData { detected, ormType, entities[], parseWarnings[] }`
|
|
211
|
-
3. **Diagram generation** (Step 3.5): `bin/scan-diagrams.js` generates 6 Mermaid diagrams
|
|
212
|
-
- Types: system-architecture, app-architecture, workflow, data-flow, sequence, database-schema
|
|
213
|
-
- Renderer chain: mmdc (CLI) → d2 (CLI) → placeholder HTML
|
|
214
|
-
4. **HTML report generation** (Step 8): `bin/scan-report.js` produces self-contained HTML
|
|
215
|
-
- Sidebar navigation with scrollspy, metric cards, domain health bars
|
|
216
|
-
- 6 diagram sections with expand-to-modal button
|
|
217
|
-
- Tech debt table, key findings
|
|
218
|
-
- Written to project root as `scan-report.html`
|
|
219
|
-
5. **Export** (optional `--export` flag): `bin/scan-export.js` handles docx/pdf (stubs in v2.34.10)
|
|
220
|
-
|
|
221
|
-
**No external dependencies**: HTML report is fully self-contained (no CDN). All CSS/JS inlined.
|
|
222
|
-
|
|
223
|
-
### npm Pre-Publish Gate (Updated)
|
|
224
|
-
- **Trigger**: `npm publish` (via `prepublishOnly`)
|
|
225
|
-
- **Gate**: `npm test` runs 205 tests (8 files including verify-gates.js)
|
|
226
|
-
- **Verify-gates checks**: file size compliance (all bin/*.js ≤ 200 lines), no CDN references in scan-report.html, has DOCTYPE, has 6 diagram sections, export format validation
|
|
1
|
+
# Workflows — GSD-T Framework (@tekyzinc/gsd-t)
|
|
2
|
+
|
|
3
|
+
## Last Updated: 2026-03-09 (Scan #9, Post-M17)
|
|
4
|
+
|
|
5
|
+
## User Workflows
|
|
6
|
+
|
|
7
|
+
### Install GSD-T
|
|
8
|
+
1. Run `npx @tekyzinc/gsd-t install`
|
|
9
|
+
2. CLI copies 45 commands to `~/.claude/commands/`
|
|
10
|
+
3. CLI sets up global CLAUDE.md if missing (appends with separator if exists)
|
|
11
|
+
4. CLI installs heartbeat script to `~/.claude/scripts/`
|
|
12
|
+
5. CLI configures 9 hooks in `~/.claude/settings.json`
|
|
13
|
+
6. CLI saves version to `~/.claude/.gsd-t-version`
|
|
14
|
+
7. User starts Claude Code in their project
|
|
15
|
+
|
|
16
|
+
**Entry point**: `npx @tekyzinc/gsd-t install`
|
|
17
|
+
5b. CLI installs gsd-t-tools.js and gsd-t-statusline.js to `~/.claude/scripts/` (M13)
|
|
18
|
+
**Success**: 45 commands available in Claude Code
|
|
19
|
+
**Failure**: CLI reports missing Node.js or permission errors
|
|
20
|
+
|
|
21
|
+
### Initialize a Project
|
|
22
|
+
1. User runs `/gsd-t-init [name]` in Claude Code (or `gsd-t init [name]` CLI)
|
|
23
|
+
2. Init creates `.gsd-t/` directory with progress.md, backlog.md, backlog-settings.md, contracts/, domains/
|
|
24
|
+
3. Init creates or updates CLAUDE.md (project-level) using template with token replacement
|
|
25
|
+
4. Init creates `docs/` living documents (requirements, architecture, workflows, infrastructure) if missing
|
|
26
|
+
5. Init auto-registers project in `~/.claude/.gsd-t-projects`
|
|
27
|
+
6. All file creation uses `{ flag: "wx" }` — never overwrites existing files
|
|
28
|
+
|
|
29
|
+
**Entry point**: `/gsd-t-init` slash command or `gsd-t init` CLI
|
|
30
|
+
**Success**: Project ready for milestone definition
|
|
31
|
+
**Failure**: Reports what couldn't be created (existing files preserved)
|
|
32
|
+
|
|
33
|
+
### Full Wave Cycle
|
|
34
|
+
1. User defines milestone via `/gsd-t-milestone`
|
|
35
|
+
2. **Partition**: Decompose into domains + contracts (file ownership, interfaces)
|
|
36
|
+
3. **Discuss**: Explore design decisions (always pauses, even Level 3) — SKIPPABLE via structured 3-condition check: single domain, no open questions in Decision Log, all cross-domain contracts exist (M7)
|
|
37
|
+
4. **Plan**: Create atomic task lists per domain with dependencies
|
|
38
|
+
5. **Impact**: Analyze downstream effects (PROCEED / CAUTION / BLOCK verdicts)
|
|
39
|
+
6. **Execute**: Implement tasks (solo or team mode based on domain count)
|
|
40
|
+
7. **Test-Sync**: Align tests with code changes, verify coverage
|
|
41
|
+
8. **Integrate**: Wire domains at boundaries, verify contracts honored
|
|
42
|
+
9. **Verify**: Run 7 quality gate dimensions (functional, contracts, quality, tests, E2E, security, integration)
|
|
43
|
+
10. **Complete**: Archive to `.gsd-t/milestones/`, bump version, git tag
|
|
44
|
+
|
|
45
|
+
Additional wave behaviors (M10-M12):
|
|
46
|
+
- **M10**: QA removed from partition/plan; execute/integrate spawn QA as Task subagent; test-sync/verify/complete run QA inline
|
|
47
|
+
- **M11**: Per-task commits (`feat({domain}/task-{N})`) enforced; between-phase spot-check (status + git + filesystem); Deviation Rules in execute (4-rule protocol, 3-attempt limit)
|
|
48
|
+
- **M12**: discuss creates CONTEXT.md (Locked Decisions); plan reads CONTEXT.md + runs plan validation subagent (max 3 iterations); REQ traceability table in requirements.md; verify marks requirements complete
|
|
49
|
+
|
|
50
|
+
**Entry point**: `/gsd-t-wave` (auto-advances) or manual phase-by-phase
|
|
51
|
+
**Success**: Milestone completed, version bumped, git tagged
|
|
52
|
+
**Failure**: Wave pauses at failing phase; spot-check re-spawns phase agent once before stopping
|
|
53
|
+
|
|
54
|
+
### Autonomy Levels
|
|
55
|
+
| Level | Behavior |
|
|
56
|
+
|-------|----------|
|
|
57
|
+
| Level 1 (Supervised) | Pause at each phase for confirmation |
|
|
58
|
+
| Level 2 (Standard) | Pause only at milestones |
|
|
59
|
+
| Level 3 (Full Auto) | Auto-advance; only stop for Destructive Guard, Impact BLOCK, errors after 2 attempts, Discuss |
|
|
60
|
+
|
|
61
|
+
### Error Recovery (2-Attempt Rule)
|
|
62
|
+
| Failure | Recovery | After 2 Failures |
|
|
63
|
+
|---------|----------|-------------------|
|
|
64
|
+
| Impact BLOCK | Add remediation tasks, re-run | STOP and report |
|
|
65
|
+
| Test failures | Fix and re-run | STOP and report |
|
|
66
|
+
| Verify failure | Remediate and re-verify | STOP and report |
|
|
67
|
+
| Gap analysis gaps | Auto-fix and re-analyze | STOP and report |
|
|
68
|
+
|
|
69
|
+
## Technical Workflows
|
|
70
|
+
|
|
71
|
+
### CLI Update Check
|
|
72
|
+
1. CLI reads cached version from `~/.claude/.gsd-t-update-check` (JSON: `{ latest, timestamp }`)
|
|
73
|
+
2. If cache is fresh (<1 hour): show notice if cached latest > installed
|
|
74
|
+
3. If no cache: synchronous fetch to npm registry (8s timeout), cache result
|
|
75
|
+
4. If cache stale (>1 hour): spawn detached background `scripts/npm-update-check.js`
|
|
76
|
+
5. Compare versions using `isNewerVersion()` semver comparison
|
|
77
|
+
|
|
78
|
+
**Trigger**: Every CLI invocation (except install/update/update-all)
|
|
79
|
+
**Also**: `/gsd-t-status` slash command checks independently
|
|
80
|
+
|
|
81
|
+
### Heartbeat Event Logging
|
|
82
|
+
1. Claude Code hook fires (9 events: SessionStart, PostToolUse, SubagentStart, SubagentStop, TaskCompleted, TeammateIdle, Notification, Stop, SessionEnd)
|
|
83
|
+
2. `settings.json` hook calls `node ~/.claude/scripts/gsd-t-heartbeat.js`
|
|
84
|
+
3. Script reads JSON from stdin (capped at 1MB)
|
|
85
|
+
4. Validates session_id (alphanumeric regex), validates path is absolute and within `.gsd-t/`
|
|
86
|
+
5. Builds structured event with timestamp, type-specific data (tool summaries, file paths)
|
|
87
|
+
6. Appends JSONL to `.gsd-t/heartbeat-{session_id}.jsonl`
|
|
88
|
+
7. Runs cleanup: removes heartbeat files older than 7 days
|
|
89
|
+
|
|
90
|
+
**Trigger**: Claude Code hooks (9 event types)
|
|
91
|
+
**Frequency**: On every hooked event during a session
|
|
92
|
+
|
|
93
|
+
### Version Bump Rules
|
|
94
|
+
| Context | Change Type | Bump |
|
|
95
|
+
|---------|-------------|------|
|
|
96
|
+
| Complete-milestone | Breaking changes, major rework | Major |
|
|
97
|
+
| Complete-milestone | New features, feature milestones | Minor |
|
|
98
|
+
| Complete-milestone | Bug fixes, cleanup | Patch |
|
|
99
|
+
| Checkin | New features, new commands | Minor |
|
|
100
|
+
| Checkin | Bug fixes, docs, refactors | Patch (default) |
|
|
101
|
+
| Checkin | Breaking changes | Major |
|
|
102
|
+
|
|
103
|
+
Updated in: package.json, .gsd-t/progress.md, CHANGELOG.md, git tag
|
|
104
|
+
|
|
105
|
+
### Pre-Commit Gate
|
|
106
|
+
Every commit must pass applicable checks:
|
|
107
|
+
1. Branch guard (correct branch?)
|
|
108
|
+
2. Contract updates (API, schema, component)
|
|
109
|
+
3. Scope updates (new files → domain scope.md)
|
|
110
|
+
4. Documentation updates (requirements, architecture)
|
|
111
|
+
5. Decision Log entry (timestamped in progress.md)
|
|
112
|
+
6. Tech debt tracking (discovered/fixed?)
|
|
113
|
+
7. Test execution (affected tests pass?)
|
|
114
|
+
|
|
115
|
+
### Pause and Resume (M13)
|
|
116
|
+
|
|
117
|
+
**Pause workflow** (`/gsd-t-pause`):
|
|
118
|
+
1. Command reads progress.md + domains/*/tasks.md to identify exact position
|
|
119
|
+
2. Creates `.gsd-t/continue-here-{YYYYMMDDTHHMMSS}.md` with: milestone, phase, version, last completed action, next action, open items, user note
|
|
120
|
+
3. File persists until consumed by resume
|
|
121
|
+
4. Multiple pauses create multiple files; resume reads most recent by timestamp
|
|
122
|
+
|
|
123
|
+
**Resume workflow** (`/gsd-t-resume`):
|
|
124
|
+
1. Same-session: skip file reads, use conversation context
|
|
125
|
+
2. Cross-session: glob `.gsd-t/continue-here-*.md`, read most recent
|
|
126
|
+
3. Resume from "Next Action" field in continue-here file (more precise than progress.md alone)
|
|
127
|
+
4. Delete continue-here file after reading
|
|
128
|
+
|
|
129
|
+
### CONTEXT.md Workflow (M12)
|
|
130
|
+
|
|
131
|
+
1. `discuss` phase completes design decisions
|
|
132
|
+
2. Writes `.gsd-t/CONTEXT.md`:
|
|
133
|
+
- **Locked Decisions**: specific decisions the plan MUST implement
|
|
134
|
+
- **Deferred Ideas**: good ideas NOT in scope (plan must NOT implement)
|
|
135
|
+
- **Claude's Discretion**: implementation details left open
|
|
136
|
+
3. `plan` reads CONTEXT.md; every Locked Decision must map to at least one task
|
|
137
|
+
4. Plan validation subagent (Task tool) verifies mapping before finalizing plan
|
|
138
|
+
5. CONTEXT.md persists after plan phase; deleted manually if desired
|
|
139
|
+
6. If discuss is skipped (structured skip), CONTEXT.md is not created; plan handles gracefully
|
|
140
|
+
|
|
141
|
+
### Project Health Check (M13)
|
|
142
|
+
|
|
143
|
+
1. User invokes `/gsd-t-health [--repair]`
|
|
144
|
+
2. Health spawns as Task subagent (fresh context)
|
|
145
|
+
3. Checks 12 items: 5 root files, 3 directories, 4 docs, active milestone domains, version consistency, status validity, Decision Log, contract integrity
|
|
146
|
+
4. Reports status as HEALTHY (0 issues), DEGRADED (1-3), or BROKEN (4+ or critical missing)
|
|
147
|
+
5. With `--repair`: creates missing files from templates (MISSING items only; INVALID items flagged for user)
|
|
148
|
+
|
|
149
|
+
## Integration Workflows
|
|
150
|
+
|
|
151
|
+
### npm Publish
|
|
152
|
+
- **Trigger**: Manual `npm publish` after milestone completion
|
|
153
|
+
- **Pre-publish gate**: `prepublishOnly: "npm test"` runs 125 tests before publish (M8)
|
|
154
|
+
- **Flow**: Version bumped → CHANGELOG updated → git tagged → `npm publish` → tests run automatically → published
|
|
155
|
+
- **Verification**: `npx @tekyzinc/gsd-t status` on fresh install
|
|
156
|
+
|
|
157
|
+
### Update All Projects
|
|
158
|
+
- **Trigger**: `gsd-t update-all` CLI command
|
|
159
|
+
- **Flow**: Global update → iterate registered projects → inject Destructive Action Guard → create CHANGELOG → health check (Playwright, Swagger)
|
|
160
|
+
- **Registry**: `~/.claude/.gsd-t-projects` (newline-separated absolute paths)
|
|
161
|
+
|
|
162
|
+
### Real-Time Agent Dashboard (M14)
|
|
163
|
+
|
|
164
|
+
**Launch workflow** (`/gsd-t-visualize`):
|
|
165
|
+
1. Check if server is running: `GET http://localhost:7433/ping`
|
|
166
|
+
2. If not running: spawn `gsd-t-dashboard-server.js --detach` as background process; write PID to `.gsd-t/dashboard.pid`
|
|
167
|
+
3. Open browser to `http://localhost:7433`
|
|
168
|
+
4. Dashboard connects to `GET /events` (Server-Sent Events stream)
|
|
169
|
+
|
|
170
|
+
**Event stream flow**:
|
|
171
|
+
1. Claude Code hook fires (any hook event)
|
|
172
|
+
2. `gsd-t-event-writer.js` validates event fields and appends JSON line to `.gsd-t/events/YYYY-MM-DD.jsonl`
|
|
173
|
+
3. Dashboard server (`gsd-t-dashboard-server.js`) detects file change via `fs.watchFile()`
|
|
174
|
+
4. New event lines are broadcast as SSE: `data: {event-json}\n\n`
|
|
175
|
+
5. Dashboard HTML (React app via CDN) renders event feed with agent hierarchy
|
|
176
|
+
|
|
177
|
+
**Stop workflow**:
|
|
178
|
+
1. User runs `/gsd-t-visualize stop` or `GET /stop`
|
|
179
|
+
2. Server reads PID file, sends SIGTERM, deletes PID file
|
|
180
|
+
|
|
181
|
+
**Note:** Server watches only the newest JSONL file at startup. Date rollover (midnight UTC) requires server restart to pick up new file (TD-085).
|
|
182
|
+
|
|
183
|
+
### Auto-Update Workflow (M15)
|
|
184
|
+
|
|
185
|
+
1. Claude Code SessionStart hook fires
|
|
186
|
+
2. `gsd-t-update-check.js` reads `~/.claude/.gsd-t-version` (installed version)
|
|
187
|
+
3. Reads cached version from `~/.claude/.gsd-t-update-check` (JSON: `{latest, timestamp}`)
|
|
188
|
+
4. If cached version newer than installed: auto-runs `npm install -g @tekyzinc/gsd-t@{latest}` + `gsd-t update-all`
|
|
189
|
+
5. Outputs `[GSD-T AUTO-UPDATE]`, `[GSD-T UPDATE]`, or `[GSD-T] v{ver}` to stdout
|
|
190
|
+
6. Claude agent reads hook output from context and shows update status in first response
|
|
191
|
+
|
|
192
|
+
**Cache TTL**: 1 hour. After TTL, background `npm-update-check.js` refreshes async.
|
|
193
|
+
|
|
194
|
+
### Auto-Route Workflow (M16)
|
|
195
|
+
|
|
196
|
+
1. User types plain text in Claude Code in a GSD-T project directory
|
|
197
|
+
2. `gsd-t-auto-route.js` UserPromptSubmit hook fires
|
|
198
|
+
3. Script checks if `.gsd-t/progress.md` exists in cwd
|
|
199
|
+
4. If yes: injects `[GSD-T AUTO-ROUTE]` signal into prompt context
|
|
200
|
+
5. Claude agent sees signal and routes the plain text message through `/user:gsd {message}`
|
|
201
|
+
6. Smart router interprets intent and launches appropriate GSD-T command
|
|
202
|
+
|
|
203
|
+
**Note:** Only fires in GSD-T projects (`.gsd-t/progress.md` must exist). Silently passes through in all other directories.
|
|
204
|
+
|
|
205
|
+
### Scan Visual Output Workflow (M17)
|
|
206
|
+
|
|
207
|
+
1. User runs `/gsd-t-scan` — scan subagent analyzes codebase (Steps 1-2)
|
|
208
|
+
2. **Schema extraction** (Step 2.5): `bin/scan-schema.js` detects ORM/schema files
|
|
209
|
+
- Tries Prisma → TypeORM → Drizzle → Mongoose → Sequelize → SQLAlchemy → raw SQL
|
|
210
|
+
- Returns `SchemaData { detected, ormType, entities[], parseWarnings[] }`
|
|
211
|
+
3. **Diagram generation** (Step 3.5): `bin/scan-diagrams.js` generates 6 Mermaid diagrams
|
|
212
|
+
- Types: system-architecture, app-architecture, workflow, data-flow, sequence, database-schema
|
|
213
|
+
- Renderer chain: mmdc (CLI) → d2 (CLI) → placeholder HTML
|
|
214
|
+
4. **HTML report generation** (Step 8): `bin/scan-report.js` produces self-contained HTML
|
|
215
|
+
- Sidebar navigation with scrollspy, metric cards, domain health bars
|
|
216
|
+
- 6 diagram sections with expand-to-modal button
|
|
217
|
+
- Tech debt table, key findings
|
|
218
|
+
- Written to project root as `scan-report.html`
|
|
219
|
+
5. **Export** (optional `--export` flag): `bin/scan-export.js` handles docx/pdf (stubs in v2.34.10)
|
|
220
|
+
|
|
221
|
+
**No external dependencies**: HTML report is fully self-contained (no CDN). All CSS/JS inlined.
|
|
222
|
+
|
|
223
|
+
### npm Pre-Publish Gate (Updated)
|
|
224
|
+
- **Trigger**: `npm publish` (via `prepublishOnly`)
|
|
225
|
+
- **Gate**: `npm test` runs 205 tests (8 files including verify-gates.js)
|
|
226
|
+
- **Verify-gates checks**: file size compliance (all bin/*.js ≤ 200 lines), no CDN references in scan-report.html, has DOCTYPE, has 6 diagram sections, export format validation
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# Domain: auth — Example
|
|
2
|
-
|
|
3
|
-
## Responsibility
|
|
4
|
-
Handles all authentication and authorization: user registration, login, JWT token generation and verification, password hashing, and auth middleware for protecting routes.
|
|
5
|
-
|
|
6
|
-
## Owned Files/Directories
|
|
7
|
-
- `src/auth/` — all auth service code
|
|
8
|
-
- `src/middleware/auth.py` — auth middleware
|
|
9
|
-
- `tests/auth/` — auth tests
|
|
10
|
-
|
|
11
|
-
## NOT Owned (do not modify)
|
|
12
|
-
- `src/db/` — owned by data-layer domain
|
|
13
|
-
- `src/api/` — owned by api domain (except auth endpoints)
|
|
1
|
+
# Domain: auth — Example
|
|
2
|
+
|
|
3
|
+
## Responsibility
|
|
4
|
+
Handles all authentication and authorization: user registration, login, JWT token generation and verification, password hashing, and auth middleware for protecting routes.
|
|
5
|
+
|
|
6
|
+
## Owned Files/Directories
|
|
7
|
+
- `src/auth/` — all auth service code
|
|
8
|
+
- `src/middleware/auth.py` — auth middleware
|
|
9
|
+
- `tests/auth/` — auth tests
|
|
10
|
+
|
|
11
|
+
## NOT Owned (do not modify)
|
|
12
|
+
- `src/db/` — owned by data-layer domain
|
|
13
|
+
- `src/api/` — owned by api domain (except auth endpoints)
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tekyzinc/gsd-t",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "GSD-T: Contract-Driven Development for Claude Code — 51 slash commands with headless CI/CD mode, graph-powered code analysis, real-time agent dashboard, execution intelligence, task telemetry, doc-ripple enforcement, backlog management, impact analysis, test sync, milestone archival, and PRD generation",
|
|
5
|
-
"author": "Tekyz, Inc.",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/Tekyz-Inc/get-stuff-done-teams.git"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://github.com/Tekyz-Inc/get-stuff-done-teams#readme",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"claude-code",
|
|
14
|
-
"gsd",
|
|
15
|
-
"ai-development",
|
|
16
|
-
"agent-teams",
|
|
17
|
-
"contract-driven-development",
|
|
18
|
-
"slash-commands"
|
|
19
|
-
],
|
|
20
|
-
"main": "bin/gsd-t.js",
|
|
21
|
-
"bin": {
|
|
22
|
-
"gsd-t": "bin/gsd-t.js"
|
|
23
|
-
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"test": "node --test",
|
|
26
|
-
"prepublishOnly": "npm test"
|
|
27
|
-
},
|
|
28
|
-
"files": [
|
|
29
|
-
"bin/",
|
|
30
|
-
"commands/",
|
|
31
|
-
"scripts/",
|
|
32
|
-
"templates/",
|
|
33
|
-
"examples/",
|
|
34
|
-
"docs/",
|
|
35
|
-
"CHANGELOG.md"
|
|
36
|
-
],
|
|
37
|
-
"engines": {
|
|
38
|
-
"node": ">=16.0.0"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tekyzinc/gsd-t",
|
|
3
|
+
"version": "2.53.10",
|
|
4
|
+
"description": "GSD-T: Contract-Driven Development for Claude Code — 51 slash commands with headless CI/CD mode, graph-powered code analysis, real-time agent dashboard, execution intelligence, task telemetry, doc-ripple enforcement, backlog management, impact analysis, test sync, milestone archival, and PRD generation",
|
|
5
|
+
"author": "Tekyz, Inc.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Tekyz-Inc/get-stuff-done-teams.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Tekyz-Inc/get-stuff-done-teams#readme",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"claude-code",
|
|
14
|
+
"gsd",
|
|
15
|
+
"ai-development",
|
|
16
|
+
"agent-teams",
|
|
17
|
+
"contract-driven-development",
|
|
18
|
+
"slash-commands"
|
|
19
|
+
],
|
|
20
|
+
"main": "bin/gsd-t.js",
|
|
21
|
+
"bin": {
|
|
22
|
+
"gsd-t": "bin/gsd-t.js"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "node --test",
|
|
26
|
+
"prepublishOnly": "npm test"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"bin/",
|
|
30
|
+
"commands/",
|
|
31
|
+
"scripts/",
|
|
32
|
+
"templates/",
|
|
33
|
+
"examples/",
|
|
34
|
+
"docs/",
|
|
35
|
+
"CHANGELOG.md"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=16.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* GSD-T UserPromptSubmit hook — auto-routes plain text prompts through /gsd.
|
|
4
|
-
*
|
|
5
|
-
* Receives JSON on stdin: { "prompt": "...", "cwd": "...", "session_id": "..." }
|
|
6
|
-
* Outputs to stdout: injected as system context before Claude processes the prompt.
|
|
7
|
-
*
|
|
8
|
-
* Logic:
|
|
9
|
-
* - Not a GSD-T project (no .gsd-t/progress.md in cwd) → exit silently
|
|
10
|
-
* - Prompt starts with "/" → exit silently (user typed a command, pass through)
|
|
11
|
-
* - Prompt is plain text → emit [GSD-T AUTO-ROUTE] signal so Claude routes via /gsd
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const fs = require("fs");
|
|
15
|
-
const path = require("path");
|
|
16
|
-
|
|
17
|
-
let input = "";
|
|
18
|
-
process.stdin.setEncoding("utf8");
|
|
19
|
-
process.stdin.on("data", (chunk) => { input += chunk; });
|
|
20
|
-
process.stdin.on("end", () => {
|
|
21
|
-
try {
|
|
22
|
-
const data = JSON.parse(input);
|
|
23
|
-
// Guard: only activate in GSD-T projects
|
|
24
|
-
const cwd = typeof data.cwd === "string" ? data.cwd : process.cwd();
|
|
25
|
-
if (!fs.existsSync(path.join(cwd, ".gsd-t", "progress.md"))) process.exit(0);
|
|
26
|
-
const prompt = (typeof data.prompt === "string" ? data.prompt : "").trimStart();
|
|
27
|
-
if (prompt.startsWith("/")) process.exit(0); // slash command — pass through
|
|
28
|
-
if (!prompt) process.exit(0); // empty prompt — pass through
|
|
29
|
-
// Plain text prompt in a GSD-T project — inject routing signal
|
|
30
|
-
process.stdout.write(
|
|
31
|
-
"[GSD-T AUTO-ROUTE] The user typed a plain text message (no leading /). " +
|
|
32
|
-
"Route it automatically through the /gsd smart router — execute the /user:gsd " +
|
|
33
|
-
"command with the user's full message as the argument."
|
|
34
|
-
);
|
|
35
|
-
} catch {
|
|
36
|
-
// JSON parse error or any other failure — never block the prompt
|
|
37
|
-
}
|
|
38
|
-
process.exit(0);
|
|
39
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* GSD-T UserPromptSubmit hook — auto-routes plain text prompts through /gsd.
|
|
4
|
+
*
|
|
5
|
+
* Receives JSON on stdin: { "prompt": "...", "cwd": "...", "session_id": "..." }
|
|
6
|
+
* Outputs to stdout: injected as system context before Claude processes the prompt.
|
|
7
|
+
*
|
|
8
|
+
* Logic:
|
|
9
|
+
* - Not a GSD-T project (no .gsd-t/progress.md in cwd) → exit silently
|
|
10
|
+
* - Prompt starts with "/" → exit silently (user typed a command, pass through)
|
|
11
|
+
* - Prompt is plain text → emit [GSD-T AUTO-ROUTE] signal so Claude routes via /gsd
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
const path = require("path");
|
|
16
|
+
|
|
17
|
+
let input = "";
|
|
18
|
+
process.stdin.setEncoding("utf8");
|
|
19
|
+
process.stdin.on("data", (chunk) => { input += chunk; });
|
|
20
|
+
process.stdin.on("end", () => {
|
|
21
|
+
try {
|
|
22
|
+
const data = JSON.parse(input);
|
|
23
|
+
// Guard: only activate in GSD-T projects
|
|
24
|
+
const cwd = typeof data.cwd === "string" ? data.cwd : process.cwd();
|
|
25
|
+
if (!fs.existsSync(path.join(cwd, ".gsd-t", "progress.md"))) process.exit(0);
|
|
26
|
+
const prompt = (typeof data.prompt === "string" ? data.prompt : "").trimStart();
|
|
27
|
+
if (prompt.startsWith("/")) process.exit(0); // slash command — pass through
|
|
28
|
+
if (!prompt) process.exit(0); // empty prompt — pass through
|
|
29
|
+
// Plain text prompt in a GSD-T project — inject routing signal
|
|
30
|
+
process.stdout.write(
|
|
31
|
+
"[GSD-T AUTO-ROUTE] The user typed a plain text message (no leading /). " +
|
|
32
|
+
"Route it automatically through the /gsd smart router — execute the /user:gsd " +
|
|
33
|
+
"command with the user's full message as the argument."
|
|
34
|
+
);
|
|
35
|
+
} catch {
|
|
36
|
+
// JSON parse error or any other failure — never block the prompt
|
|
37
|
+
}
|
|
38
|
+
process.exit(0);
|
|
39
|
+
});
|