@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.
Files changed (99) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +379 -372
  3. package/bin/component-registry.js +250 -0
  4. package/bin/graph-cgc.js +510 -510
  5. package/bin/graph-indexer.js +147 -147
  6. package/bin/graph-overlay.js +195 -195
  7. package/bin/graph-parsers.js +327 -327
  8. package/bin/graph-query.js +453 -452
  9. package/bin/graph-store.js +154 -154
  10. package/bin/qa-calibrator.js +194 -0
  11. package/bin/scan-data-collector.js +153 -153
  12. package/bin/scan-diagrams-generators.js +187 -187
  13. package/bin/scan-diagrams.js +79 -79
  14. package/bin/scan-renderer.js +92 -92
  15. package/bin/scan-report-sections.js +121 -121
  16. package/bin/scan-report.js +184 -184
  17. package/bin/scan-schema-parsers.js +199 -199
  18. package/bin/scan-schema.js +103 -103
  19. package/bin/token-budget.js +246 -0
  20. package/commands/Claude-md.md +10 -10
  21. package/commands/branch.md +15 -15
  22. package/commands/checkin.md +45 -45
  23. package/commands/global-change.md +209 -209
  24. package/commands/gsd-t-audit.md +199 -0
  25. package/commands/gsd-t-backlog-add.md +94 -94
  26. package/commands/gsd-t-backlog-edit.md +111 -111
  27. package/commands/gsd-t-backlog-list.md +63 -63
  28. package/commands/gsd-t-backlog-move.md +94 -94
  29. package/commands/gsd-t-backlog-promote.md +123 -123
  30. package/commands/gsd-t-backlog-remove.md +86 -86
  31. package/commands/gsd-t-backlog-settings.md +158 -158
  32. package/commands/gsd-t-complete-milestone.md +528 -515
  33. package/commands/gsd-t-debug.md +506 -399
  34. package/commands/gsd-t-discuss.md +174 -174
  35. package/commands/gsd-t-execute.md +758 -634
  36. package/commands/gsd-t-feature.md +276 -276
  37. package/commands/gsd-t-health.md +142 -142
  38. package/commands/gsd-t-help.md +465 -457
  39. package/commands/gsd-t-impact.md +302 -302
  40. package/commands/gsd-t-init.md +320 -280
  41. package/commands/gsd-t-integrate.md +365 -249
  42. package/commands/gsd-t-milestone.md +87 -87
  43. package/commands/gsd-t-partition.md +442 -361
  44. package/commands/gsd-t-pause.md +82 -82
  45. package/commands/gsd-t-plan.md +345 -344
  46. package/commands/gsd-t-populate.md +111 -111
  47. package/commands/gsd-t-prd.md +326 -326
  48. package/commands/gsd-t-project.md +211 -211
  49. package/commands/gsd-t-promote-debt.md +123 -123
  50. package/commands/gsd-t-prompt.md +137 -137
  51. package/commands/gsd-t-qa.md +266 -266
  52. package/commands/gsd-t-quick.md +357 -234
  53. package/commands/gsd-t-reflect.md +134 -134
  54. package/commands/gsd-t-resume.md +72 -72
  55. package/commands/gsd-t-scan.md +615 -615
  56. package/commands/gsd-t-setup.md +76 -0
  57. package/commands/gsd-t-status.md +192 -166
  58. package/commands/gsd-t-test-sync.md +381 -381
  59. package/commands/gsd-t-triage-and-merge.md +171 -171
  60. package/commands/gsd-t-verify.md +382 -382
  61. package/commands/gsd-t-visualize.md +118 -118
  62. package/commands/gsd-t-wave.md +401 -378
  63. package/docs/GSD-T-README.md +425 -422
  64. package/docs/architecture.md +385 -369
  65. package/docs/harness-design-analysis.md +371 -0
  66. package/docs/infrastructure.md +205 -205
  67. package/docs/prd-graph-engine.md +398 -398
  68. package/docs/prd-gsd2-hybrid.md +559 -559
  69. package/docs/prd-harness-evolution.md +583 -0
  70. package/docs/requirements.md +14 -0
  71. package/docs/workflows.md +226 -226
  72. package/examples/.gsd-t/domains/example-domain/scope.md +13 -13
  73. package/package.json +40 -40
  74. package/scripts/gsd-t-auto-route.js +39 -39
  75. package/scripts/gsd-t-dashboard-mockup.html +1143 -1143
  76. package/scripts/gsd-t-dashboard-server.js +171 -171
  77. package/scripts/gsd-t-dashboard.html +262 -262
  78. package/scripts/gsd-t-event-writer.js +128 -128
  79. package/scripts/gsd-t-statusline.js +94 -94
  80. package/scripts/gsd-t-tools.js +175 -175
  81. package/templates/CLAUDE-global.md +639 -614
  82. package/templates/CLAUDE-project.md +24 -0
  83. package/templates/backlog-settings.md +18 -18
  84. package/templates/backlog.md +1 -1
  85. package/templates/progress.md +40 -40
  86. package/templates/shared-services-contract.md +60 -60
  87. package/templates/stacks/desktop.ini +2 -2
  88. package/bin/desktop.ini +0 -2
  89. package/commands/desktop.ini +0 -2
  90. package/docs/ci-examples/desktop.ini +0 -2
  91. package/docs/desktop.ini +0 -2
  92. package/examples/.gsd-t/contracts/desktop.ini +0 -2
  93. package/examples/.gsd-t/desktop.ini +0 -2
  94. package/examples/.gsd-t/domains/desktop.ini +0 -2
  95. package/examples/.gsd-t/domains/example-domain/desktop.ini +0 -2
  96. package/examples/desktop.ini +0 -2
  97. package/examples/rules/desktop.ini +0 -2
  98. package/scripts/desktop.ini +0 -2
  99. package/templates/desktop.ini +0 -2
@@ -1,280 +1,320 @@
1
- # GSD-T: Init — Initialize Project
2
-
3
- You are setting up a new project (or converting an existing one) to use the GSD-T contract-driven workflow.
4
-
5
- ## Step 1: Assess Current State
6
-
7
- Check what exists:
8
- - `CLAUDE.md` — project instructions?
9
- - `.gsd-t/` — already initialized?
10
- - `.gsd/` — legacy GSD structure?
11
- - `docs/` — existing documentation?
12
- - `src/` — existing code?
13
-
14
- ### If `.gsd-t/` already exists:
15
- Report current state and ask if user wants to reset or continue.
16
-
17
- ### If `.gsd/` exists (legacy GSD):
18
- Offer to migrate: "Found legacy GSD structure. Want me to migrate to GSD-T?"
19
- If yes, read `.gsd/` state and create equivalent `.gsd-t/` structure.
20
-
21
- ## Step 2: Copy Local Settings
22
-
23
- 1. **Ensure `~/.claude/settings.local` exists**:
24
- - If it does NOT exist, create it now with these default permissions:
25
- ```json
26
- {
27
- "permissions": {
28
- "allow": [
29
- "Edit",
30
- "Write",
31
- "Bash",
32
- "Read",
33
- "WebSearch",
34
- "WebFetch",
35
- "Skill"
36
- ]
37
- },
38
- "outputStyle": "default"
39
- }
40
- ```
41
- After creating it, log: "Created ~/.claude/settings.local with default permissions — update the allow list to match your security preferences."
42
-
43
- 2. **Copy to project**: If `.claude/settings.local.json` does NOT already exist in the project root:
44
- - Create the `.claude/` directory in the project root if it doesn't exist
45
- - Copy `~/.claude/settings.local` → `.claude/settings.local.json`
46
-
47
- Skip the copy (step 2) silently if the target already exists.
48
-
49
- ## Step 3: Create Directory Structure
50
-
51
- ```
52
- .gsd-t/
53
- ├── contracts/
54
- │ └── .gitkeep
55
- ├── domains/
56
- │ └── .gitkeep
57
- ├── stacks/
58
- │ └── README.md
59
- ├── events/
60
- ├── backlog.md
61
- ├── backlog-settings.md
62
- ├── progress.md
63
- ├── token-log.md
64
- └── qa-issues.md
65
- ```
66
-
67
- Create `.gsd-t/stacks/` directory with a `README.md` explaining the override mechanism:
68
- - This folder holds project-specific overrides of global stack rule files
69
- - If a file with the same name as a global stack file exists here, it replaces the global version
70
- - Folder stays empty until the developer explicitly adds overrides
71
-
72
- Create `.gsd-t/events/` directory (empty — populated at runtime by heartbeat and event writer).
73
-
74
- Create `token-log.md` with header row:
75
- ```
76
- | Date | Command | Step | Model | Duration(s) | Notes |
77
- |------|---------|------|-------|-------------|-------|
78
- ```
79
-
80
- Create `qa-issues.md` with header row:
81
- ```
82
- | Date | Command | Step | Model | Duration(s) | Severity | Finding |
83
- |------|---------|------|-------|-------------|----------|---------|
84
- ```
85
-
86
- ## Step 4: Initialize Backlog
87
-
88
- Create the backlog files from templates:
89
- 1. Copy `templates/backlog.md` → `.gsd-t/backlog.md`
90
- 2. Copy `templates/backlog-settings.md` → `.gsd-t/backlog-settings.md`
91
-
92
- ### Category Derivation
93
-
94
- Read the project's `CLAUDE.md` (if it exists) to auto-populate backlog settings:
95
-
96
- 1. **Apps**: Scan for app names, service names, or product names (look for headings, "Tech Stack" sections, or named components). Populate the `## Apps` section in `backlog-settings.md` with discovered names (lowercase).
97
- 2. **Categories**: Scan for domain concepts, module names, and technical areas (e.g., "authentication", "payments", "api", "database"). Populate the `## Categories` section.
98
- 3. **Default App**: Set `**Default App:**` to the most prominent app found (the one mentioned most, or the first one). If only one app is found, use it.
99
- 4. **If nothing found**: Leave the placeholder values from the template — the user can configure later via `/user:gsd-t-backlog-settings`.
100
-
101
- ## Step 5: Initialize Progress File
102
-
103
- ### Version Detection
104
-
105
- Before creating the progress file, determine the starting version:
106
-
107
- 1. **Check for an existing version** in the project's manifest file (in this priority order):
108
- - `package.json` → `version` field
109
- - `pyproject.toml` → `[project] version` or `[tool.poetry] version`
110
- - `Cargo.toml` → `[package] version`
111
- - `setup.py` → `version=` argument
112
- - `build.gradle` / `build.gradle.kts` → `version = `
113
- - `.version` file → contents as-is
114
- 2. **If a version is found**: Use it as the starting GSD-T version (the project already has its own versioning history).
115
- 3. **If no version is found**: Use `0.1.00` — the standard GSD-T starting point for a brand-new project with no prior releases. The first `gsd-t-complete-milestone` will reset the patch to `0.1.10` (or bump minor/major per milestone scope).
116
-
117
- Create `.gsd-t/progress.md`:
118
-
119
- ```markdown
120
- # GSD-T Progress
121
-
122
- ## Project: {name from CLAUDE.md or $ARGUMENTS}
123
- ## Version: {detected version, or 0.1.00}
124
- ## Status: INITIALIZED
125
- ## Date: {today}
126
-
127
- ## Milestones
128
- | # | Milestone | Status | Domains |
129
- |---|-----------|--------|---------|
130
- | 1 | {TBD} | not started | TBD |
131
-
132
- ## Domains
133
- (populated during partition phase)
134
-
135
- ## Contracts
136
- (populated during partition phase)
137
-
138
- ## Integration Checkpoints
139
- (populated during plan phase)
140
-
141
- ## Decision Log
142
- - {date}: Project initialized with GSD-T workflow
143
- ```
144
-
145
- ## Step 6: Ensure CLAUDE.md Exists
146
-
147
- If no `CLAUDE.md`:
148
- Create a starter template:
149
-
150
- ```markdown
151
- # {Project Name}
152
-
153
- ## Overview
154
- {Brief project description — fill this in}
155
-
156
- ## Tech Stack
157
- {Languages, frameworks, services — fill this in}
158
-
159
- ## Documentation
160
- - Requirements: docs/requirements.md
161
- - Architecture: docs/architecture.md
162
- - Workflows: docs/workflows.md
163
- - Infrastructure: docs/infrastructure.md
164
-
165
- ## Autonomy Level
166
- **Level 3 — Full Auto** (only pause for blockers or completion)
167
-
168
- ## Branch Guard
169
- **Expected branch**: {current branch from `git branch --show-current`}
170
-
171
- ## Conventions
172
- - {Coding style, naming patterns — fill this in}
173
-
174
- ## Workflow Preferences
175
- <!-- Override global defaults. Delete what you don't need to override. -->
176
-
177
- ## GSD-T Workflow
178
- This project uses contract-driven development.
179
- - State: .gsd-t/progress.md
180
- - Contracts: .gsd-t/contracts/
181
- - Domains: .gsd-t/domains/
182
- ```
183
-
184
- If `CLAUDE.md` exists but doesn't reference GSD-T, append the GSD-T section.
185
-
186
- ## Step 7: Create docs/ if Needed
187
-
188
- If no `docs/` directory, create it with all 4 living document templates.
189
- For each file, skip if it already exists:
190
-
191
- ```
192
- docs/
193
- ├── requirements.md — Functional, technical, and non-functional requirements
194
- ├── architecture.md — System design, components, data flow, design decisions
195
- ├── workflows.md — User journeys, technical processes, API flows
196
- └── infrastructure.md — Dev setup, DB commands, cloud provisioning, deployment, credentials
197
- ```
198
-
199
- These are the living documents that persist across milestones and keep institutional knowledge alive. The `infrastructure.md` is especially important — it captures the exact commands for provisioning cloud resources, setting up databases, managing secrets, and deploying, so this knowledge doesn't get lost between sessions.
200
-
201
- ## Step 8: Ensure README.md Exists
202
-
203
- If no `README.md` exists, create one with:
204
- - Project name and brief description
205
- - Tech stack summary
206
- - Getting started / setup instructions (from existing configs or placeholder)
207
- - Link to `docs/` for detailed documentation
208
-
209
- If `README.md` exists, leave it as-is don't overwrite user content during init.
210
-
211
- ## Step 9: Map Existing Codebase (if code exists)
212
-
213
- If there's existing source code:
214
- 1. Scan the codebase structure
215
- 2. Identify natural domain boundaries based on file organization
216
- 3. Note existing patterns and conventions
217
- 4. Add findings to CLAUDE.md
218
- 5. Log in progress.md: "Existing codebase analyzed — {summary}"
219
-
220
- ## Step 10: Document Ripple
221
-
222
- After initialization, verify all created documentation is consistent:
223
-
224
- ### Always update:
225
- 1. **`.gsd-t/progress.md`** — Already created in Step 3, verify it's complete
226
- 2. **`CLAUDE.md`** — Already handled in Step 4, verify GSD-T section is present and references all docs
227
-
228
- ### Check if affected:
229
- 3. **`docs/requirements.md`** — If existing code was scanned (Step 7), verify requirements doc reflects discovered functionality
230
- 4. **`docs/architecture.md`** — If existing code was scanned, verify architecture doc reflects the actual system structure
231
- 5. **`README.md`** — Already handled in Step 6, verify it links to docs/ and reflects project state
232
-
233
- ### Skip what's not affected init creates docs, so most ripple is about consistency verification.
234
-
235
- ## Step 11: Playwright Setup (MANDATORY)
236
-
237
- Every GSD-T project must have Playwright ready for E2E testing. If `playwright.config.*` does not exist:
238
-
239
- 1. **Detect package manager**: Check for `bun.lockb` (bun), `yarn.lock` (yarn), `pnpm-lock.yaml` (pnpm), `package-lock.json` or `package.json` (npm), `requirements.txt`/`pyproject.toml` (Python)
240
- 2. **Install Playwright**:
241
- - bun: `bun add -d @playwright/test && bunx playwright install chromium`
242
- - npm: `npm install -D @playwright/test && npx playwright install chromium`
243
- - yarn: `yarn add -D @playwright/test && yarn playwright install chromium`
244
- - pnpm: `pnpm add -D @playwright/test && pnpm exec playwright install chromium`
245
- - Python: `pip install playwright && playwright install chromium`
246
- - No package manager detected: `npm init -y && npm install -D @playwright/test && npx playwright install chromium`
247
- 3. **Create `playwright.config.ts`** (or `.js` if not using TypeScript) with sensible defaults:
248
- - `testDir: './e2e'` (or `./tests/e2e`)
249
- - `use: { baseURL: 'http://localhost:3000' }` (adjust based on project)
250
- - Chromium only (keep it fast; user can add more browsers later)
251
- - Screenshot on failure enabled
252
- 4. **Create the E2E test directory** (`e2e/` or `tests/e2e/`) with a placeholder spec
253
- 5. **Add test script** to `package.json` if it exists: `"test:e2e": "playwright test"`
254
-
255
- Skip silently if `playwright.config.*` already exists.
256
-
257
- ## Step 12: Test Verification
258
-
259
- After initialization:
260
-
261
- 1. **If existing code with tests**: Run the full test suite to establish a baseline. Document results in `.gsd-t/progress.md`
262
- 2. **If existing code without tests**: Playwright is now set up (Step 7.6) — note unit test framework should be added as part of the first milestone
263
- 3. **If greenfield**: Playwright is ready. Note that unit test infrastructure should be added in Milestone 1
264
- 4. **Verify init outputs**: Confirm all created files exist and are non-empty
265
-
266
- ## Step 13: Report
267
-
268
- Tell the user:
269
- 1. What was created (including backlog files: `.gsd-t/backlog.md` and `.gsd-t/backlog-settings.md`)
270
- 2. What they should fill in (CLAUDE.md details, requirements)
271
- 3. Backlog settings status: whether apps/categories were auto-derived from CLAUDE.md or need manual configuration via `/user:gsd-t-backlog-settings`
272
- 4. Recommended next step:
273
- - New project: "Define your milestone, then run /user:gsd-t-partition"
274
- - Existing code: "I've mapped the codebase. Ready for /user:gsd-t-partition {milestone}"
275
-
276
- $ARGUMENTS
277
-
278
- ## Auto-Clear
279
-
280
- All work is committed to project files. Execute `/clear` to free the context window for the next command.
1
+ # GSD-T: Init — Initialize Project
2
+
3
+ You are setting up a new project (or converting an existing one) to use the GSD-T contract-driven workflow.
4
+
5
+ ## Step 1: Assess Current State
6
+
7
+ Check what exists:
8
+ - `CLAUDE.md` — project instructions?
9
+ - `.gsd-t/` — already initialized?
10
+ - `.gsd/` — legacy GSD structure?
11
+ - `docs/` — existing documentation?
12
+ - `src/` — existing code?
13
+
14
+ ### If `.gsd-t/` already exists:
15
+ Report current state and ask if user wants to reset or continue.
16
+
17
+ ### If `.gsd/` exists (legacy GSD):
18
+ Offer to migrate: "Found legacy GSD structure. Want me to migrate to GSD-T?"
19
+ If yes, read `.gsd/` state and create equivalent `.gsd-t/` structure.
20
+
21
+ ## Step 2: Copy Local Settings
22
+
23
+ 1. **Ensure `~/.claude/settings.local` exists**:
24
+ - If it does NOT exist, create it now with these default permissions:
25
+ ```json
26
+ {
27
+ "permissions": {
28
+ "allow": [
29
+ "Edit",
30
+ "Write",
31
+ "Bash",
32
+ "Read",
33
+ "WebSearch",
34
+ "WebFetch",
35
+ "Skill"
36
+ ]
37
+ },
38
+ "outputStyle": "default"
39
+ }
40
+ ```
41
+ After creating it, log: "Created ~/.claude/settings.local with default permissions — update the allow list to match your security preferences."
42
+
43
+ 2. **Copy to project**: If `.claude/settings.local.json` does NOT already exist in the project root:
44
+ - Create the `.claude/` directory in the project root if it doesn't exist
45
+ - Copy `~/.claude/settings.local` → `.claude/settings.local.json`
46
+
47
+ Skip the copy (step 2) silently if the target already exists.
48
+
49
+ ## Step 3: Create Directory Structure
50
+
51
+ ```
52
+ .gsd-t/
53
+ ├── contracts/
54
+ │ └── .gitkeep
55
+ ├── domains/
56
+ │ └── .gitkeep
57
+ ├── stacks/
58
+ │ └── README.md
59
+ ├── events/
60
+ ├── backlog.md
61
+ ├── backlog-settings.md
62
+ ├── progress.md
63
+ ├── token-log.md
64
+ └── qa-issues.md
65
+ ```
66
+
67
+ Create `.gsd-t/stacks/` directory with a `README.md` explaining the override mechanism:
68
+ - This folder holds project-specific overrides of global stack rule files
69
+ - If a file with the same name as a global stack file exists here, it replaces the global version
70
+ - Folder stays empty until the developer explicitly adds overrides
71
+
72
+ Create `.gsd-t/events/` directory (empty — populated at runtime by heartbeat and event writer).
73
+
74
+ Create `token-log.md` with header row:
75
+ ```
76
+ | Date | Command | Step | Model | Duration(s) | Notes |
77
+ |------|---------|------|-------|-------------|-------|
78
+ ```
79
+
80
+ Create `qa-issues.md` with header row:
81
+ ```
82
+ | Date | Command | Step | Model | Duration(s) | Severity | Finding |
83
+ |------|---------|------|-------|-------------|----------|---------|
84
+ ```
85
+
86
+ ## Step 4: Initialize Backlog
87
+
88
+ Create the backlog files from templates:
89
+ 1. Copy `templates/backlog.md` → `.gsd-t/backlog.md`
90
+ 2. Copy `templates/backlog-settings.md` → `.gsd-t/backlog-settings.md`
91
+
92
+ ### Category Derivation
93
+
94
+ Read the project's `CLAUDE.md` (if it exists) to auto-populate backlog settings:
95
+
96
+ 1. **Apps**: Scan for app names, service names, or product names (look for headings, "Tech Stack" sections, or named components). Populate the `## Apps` section in `backlog-settings.md` with discovered names (lowercase).
97
+ 2. **Categories**: Scan for domain concepts, module names, and technical areas (e.g., "authentication", "payments", "api", "database"). Populate the `## Categories` section.
98
+ 3. **Default App**: Set `**Default App:**` to the most prominent app found (the one mentioned most, or the first one). If only one app is found, use it.
99
+ 4. **If nothing found**: Leave the placeholder values from the template — the user can configure later via `/user:gsd-t-backlog-settings`.
100
+
101
+ ## Step 5: Initialize Progress File
102
+
103
+ ### Version Detection
104
+
105
+ Before creating the progress file, determine the starting version:
106
+
107
+ 1. **Check for an existing version** in the project's manifest file (in this priority order):
108
+ - `package.json` → `version` field
109
+ - `pyproject.toml` → `[project] version` or `[tool.poetry] version`
110
+ - `Cargo.toml` → `[package] version`
111
+ - `setup.py` → `version=` argument
112
+ - `build.gradle` / `build.gradle.kts` → `version = `
113
+ - `.version` file → contents as-is
114
+ 2. **If a version is found**: Use it as the starting GSD-T version (the project already has its own versioning history).
115
+ 3. **If no version is found**: Use `0.1.00` — the standard GSD-T starting point for a brand-new project with no prior releases. The first `gsd-t-complete-milestone` will reset the patch to `0.1.10` (or bump minor/major per milestone scope).
116
+
117
+ Create `.gsd-t/progress.md`:
118
+
119
+ ```markdown
120
+ # GSD-T Progress
121
+
122
+ ## Project: {name from CLAUDE.md or $ARGUMENTS}
123
+ ## Version: {detected version, or 0.1.00}
124
+ ## Status: INITIALIZED
125
+ ## Date: {today}
126
+
127
+ ## Milestones
128
+ | # | Milestone | Status | Domains |
129
+ |---|-----------|--------|---------|
130
+ | 1 | {TBD} | not started | TBD |
131
+
132
+ ## Domains
133
+ (populated during partition phase)
134
+
135
+ ## Contracts
136
+ (populated during partition phase)
137
+
138
+ ## Integration Checkpoints
139
+ (populated during plan phase)
140
+
141
+ ## Decision Log
142
+ - {date}: Project initialized with GSD-T workflow
143
+ ```
144
+
145
+ ## Step 6: Ensure CLAUDE.md Exists
146
+
147
+ If no `CLAUDE.md`:
148
+ Create a starter template:
149
+
150
+ ```markdown
151
+ # {Project Name}
152
+
153
+ ## Overview
154
+ {Brief project description — fill this in}
155
+
156
+ ## Tech Stack
157
+ {Languages, frameworks, services — fill this in}
158
+
159
+ ## Documentation
160
+ - Requirements: docs/requirements.md
161
+ - Architecture: docs/architecture.md
162
+ - Workflows: docs/workflows.md
163
+ - Infrastructure: docs/infrastructure.md
164
+
165
+ ## Autonomy Level
166
+ **Level 3 — Full Auto** (only pause for blockers or completion)
167
+
168
+ ## Branch Guard
169
+ **Expected branch**: {current branch from `git branch --show-current`}
170
+
171
+ ## Conventions
172
+ - {Coding style, naming patterns — fill this in}
173
+
174
+ ## Workflow Preferences
175
+ <!-- Override global defaults. Delete what you don't need to override. -->
176
+
177
+ ## GSD-T Workflow
178
+ This project uses contract-driven development.
179
+ - State: .gsd-t/progress.md
180
+ - Contracts: .gsd-t/contracts/
181
+ - Domains: .gsd-t/domains/
182
+ ```
183
+
184
+ If `CLAUDE.md` exists but doesn't reference GSD-T, append the GSD-T section.
185
+
186
+ ## Step 6.5: Set Quality North Star
187
+
188
+ Detect the project type and offer a quality persona preset. This writes a `## Quality North Star` section to `CLAUDE.md` so subagents have a quality lens at execute time.
189
+
190
+ **Skip this step if `CLAUDE.md` already contains `## Quality North Star`.**
191
+
192
+ ### Auto-detect project type
193
+
194
+ Read `package.json` (if it exists) and apply the first matching rule:
195
+
196
+ | Signal | Suggested preset |
197
+ |--------|-----------------|
198
+ | `"bin"` field present | `cli` |
199
+ | `"react"`, `"next"`, or `"vue"` in `dependencies` or `devDependencies` | `web-app` |
200
+ | `"main"` field present AND no `"scripts.dev"` field | `library` |
201
+ | No strong signal | prompt user to choose |
202
+
203
+ ### Preset text
204
+
205
+ | Preset ID | Text to write |
206
+ |-----------|---------------|
207
+ | `library` | `This is a published npm library. Every public API must be intuitive, well-documented, and backward-compatible. Type safety and zero-dependency design are non-negotiable.` |
208
+ | `web-app` | `This is a user-facing web application. Every feature must be accessible, performant, and visually consistent. The user experience is the product.` |
209
+ | `cli` | `This is a developer CLI tool. Every command must be fast, predictable, and produce clear output. Error messages must explain what went wrong and how to fix it.` |
210
+ | `custom` | Ask user for a 1–3 sentence description of what "excellent" means for this project. |
211
+
212
+ ### Write to CLAUDE.md
213
+
214
+ Append (or insert before `## GSD-T Workflow` if present):
215
+
216
+ ```markdown
217
+ ## Quality North Star
218
+
219
+ {selected preset text or user-provided custom text}
220
+ ```
221
+
222
+ If no `package.json` is found and this is a non-JS project, prompt the user to choose a preset or provide custom text.
223
+
224
+ Log in `.gsd-t/progress.md` Decision Log: `- {date}: Quality North Star set — preset: {preset-id}`
225
+
226
+ ## Step 7: Create docs/ if Needed
227
+
228
+ If no `docs/` directory, create it with all 4 living document templates.
229
+ For each file, skip if it already exists:
230
+
231
+ ```
232
+ docs/
233
+ ├── requirements.md Functional, technical, and non-functional requirements
234
+ ├── architecture.md — System design, components, data flow, design decisions
235
+ ├── workflows.md — User journeys, technical processes, API flows
236
+ └── infrastructure.md — Dev setup, DB commands, cloud provisioning, deployment, credentials
237
+ ```
238
+
239
+ These are the living documents that persist across milestones and keep institutional knowledge alive. The `infrastructure.md` is especially important — it captures the exact commands for provisioning cloud resources, setting up databases, managing secrets, and deploying, so this knowledge doesn't get lost between sessions.
240
+
241
+ ## Step 8: Ensure README.md Exists
242
+
243
+ If no `README.md` exists, create one with:
244
+ - Project name and brief description
245
+ - Tech stack summary
246
+ - Getting started / setup instructions (from existing configs or placeholder)
247
+ - Link to `docs/` for detailed documentation
248
+
249
+ If `README.md` exists, leave it as-is — don't overwrite user content during init.
250
+
251
+ ## Step 9: Map Existing Codebase (if code exists)
252
+
253
+ If there's existing source code:
254
+ 1. Scan the codebase structure
255
+ 2. Identify natural domain boundaries based on file organization
256
+ 3. Note existing patterns and conventions
257
+ 4. Add findings to CLAUDE.md
258
+ 5. Log in progress.md: "Existing codebase analyzed — {summary}"
259
+
260
+ ## Step 10: Document Ripple
261
+
262
+ After initialization, verify all created documentation is consistent:
263
+
264
+ ### Always update:
265
+ 1. **`.gsd-t/progress.md`** — Already created in Step 3, verify it's complete
266
+ 2. **`CLAUDE.md`** — Already handled in Step 4, verify GSD-T section is present and references all docs
267
+
268
+ ### Check if affected:
269
+ 3. **`docs/requirements.md`** — If existing code was scanned (Step 7), verify requirements doc reflects discovered functionality
270
+ 4. **`docs/architecture.md`** If existing code was scanned, verify architecture doc reflects the actual system structure
271
+ 5. **`README.md`** Already handled in Step 6, verify it links to docs/ and reflects project state
272
+
273
+ ### Skip what's not affected — init creates docs, so most ripple is about consistency verification.
274
+
275
+ ## Step 11: Playwright Setup (MANDATORY)
276
+
277
+ Every GSD-T project must have Playwright ready for E2E testing. If `playwright.config.*` does not exist:
278
+
279
+ 1. **Detect package manager**: Check for `bun.lockb` (bun), `yarn.lock` (yarn), `pnpm-lock.yaml` (pnpm), `package-lock.json` or `package.json` (npm), `requirements.txt`/`pyproject.toml` (Python)
280
+ 2. **Install Playwright**:
281
+ - bun: `bun add -d @playwright/test && bunx playwright install chromium`
282
+ - npm: `npm install -D @playwright/test && npx playwright install chromium`
283
+ - yarn: `yarn add -D @playwright/test && yarn playwright install chromium`
284
+ - pnpm: `pnpm add -D @playwright/test && pnpm exec playwright install chromium`
285
+ - Python: `pip install playwright && playwright install chromium`
286
+ - No package manager detected: `npm init -y && npm install -D @playwright/test && npx playwright install chromium`
287
+ 3. **Create `playwright.config.ts`** (or `.js` if not using TypeScript) with sensible defaults:
288
+ - `testDir: './e2e'` (or `./tests/e2e`)
289
+ - `use: { baseURL: 'http://localhost:3000' }` (adjust based on project)
290
+ - Chromium only (keep it fast; user can add more browsers later)
291
+ - Screenshot on failure enabled
292
+ 4. **Create the E2E test directory** (`e2e/` or `tests/e2e/`) with a placeholder spec
293
+ 5. **Add test script** to `package.json` if it exists: `"test:e2e": "playwright test"`
294
+
295
+ Skip silently if `playwright.config.*` already exists.
296
+
297
+ ## Step 12: Test Verification
298
+
299
+ After initialization:
300
+
301
+ 1. **If existing code with tests**: Run the full test suite to establish a baseline. Document results in `.gsd-t/progress.md`
302
+ 2. **If existing code without tests**: Playwright is now set up (Step 7.6) — note unit test framework should be added as part of the first milestone
303
+ 3. **If greenfield**: Playwright is ready. Note that unit test infrastructure should be added in Milestone 1
304
+ 4. **Verify init outputs**: Confirm all created files exist and are non-empty
305
+
306
+ ## Step 13: Report
307
+
308
+ Tell the user:
309
+ 1. What was created (including backlog files: `.gsd-t/backlog.md` and `.gsd-t/backlog-settings.md`)
310
+ 2. What they should fill in (CLAUDE.md details, requirements)
311
+ 3. Backlog settings status: whether apps/categories were auto-derived from CLAUDE.md or need manual configuration via `/user:gsd-t-backlog-settings`
312
+ 4. Recommended next step:
313
+ - New project: "Define your milestone, then run /user:gsd-t-partition"
314
+ - Existing code: "I've mapped the codebase. Ready for /user:gsd-t-partition {milestone}"
315
+
316
+ $ARGUMENTS
317
+
318
+ ## Auto-Clear
319
+
320
+ All work is committed to project files. Execute `/clear` to free the context window for the next command.