gsdd-cli 0.1.0 → 0.2.0

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.
@@ -0,0 +1,232 @@
1
+ # Phase Approach Template
2
+
3
+ Template for `.planning/phases/XX-name/{phase_num}-APPROACH.md` — captures implementation decisions and validated assumptions for a phase.
4
+
5
+ **Purpose:** Document decisions that downstream agents need. Planner uses this to know WHAT choices are locked vs flexible. Plan-checker verifies plans honor these decisions.
6
+
7
+ **Key principle:** The top-level structure (`<domain>`, `<decisions>`, `<assumptions>`, `<deferred>`) is fixed. Section names WITHIN `<decisions>` emerge from what was actually discussed for THIS phase — a CLI phase has CLI-relevant sections, a UI phase has UI-relevant sections.
8
+
9
+ **Downstream consumers:**
10
+ - `planner` — Reads decisions to constrain implementation choices. Locked decisions must be implemented. Agent's Discretion items allow planner flexibility.
11
+ - `plan-checker` — Reads decisions to verify plans implement chosen approaches (approach_alignment dimension). Flags plans that contradict explicit user choices.
12
+
13
+ ---
14
+
15
+ ## File Template
16
+
17
+ ```markdown
18
+ # Phase [X]: [Name] - Approach
19
+
20
+ **Explored:** [date]
21
+ **Status:** Ready for planning
22
+
23
+ <domain>
24
+ ## Phase Boundary
25
+
26
+ [Clear statement of what this phase delivers — the scope anchor. This comes from ROADMAP.md and is fixed. Discussion clarifies implementation within this boundary.]
27
+
28
+ </domain>
29
+
30
+ <decisions>
31
+ ## Implementation Decisions
32
+
33
+ ### [Gray Area 1 that was discussed]
34
+ **Chosen approach:** [name]
35
+ **Alternatives considered:** [Option B], [Option C]
36
+ **Why this one:** [reasoning from research + user preference]
37
+ - [Specific decision from questioning]
38
+ - [Another decision if applicable]
39
+
40
+ ### [Gray Area 2 that was discussed]
41
+ **Chosen approach:** [name]
42
+ **Alternatives considered:** [Option B]
43
+ **Why this one:** [reasoning]
44
+ - [Specific decision]
45
+
46
+ ### Agent's Discretion
47
+ [Areas where user explicitly said "you decide" — the agent has flexibility here during planning/implementation]
48
+
49
+ </decisions>
50
+
51
+ <assumptions>
52
+ ## Validated Assumptions
53
+
54
+ ### Confirmed
55
+ - [confident] [assumption confirmed by user]
56
+
57
+ ### Accepted (not challenged)
58
+ - [assuming] [assumption user didn't challenge — planner should still honor but note it]
59
+
60
+ ### Corrected
61
+ - [corrected] [original assumption] → [user's correction]
62
+
63
+ </assumptions>
64
+
65
+ <deferred>
66
+ ## Deferred Ideas
67
+
68
+ [Ideas that came up during discussion but belong in other phases. Captured here so they're not lost, but explicitly out of scope for this phase.]
69
+
70
+ [If none: "None — discussion stayed within phase scope"]
71
+
72
+ </deferred>
73
+
74
+ ---
75
+
76
+ *Phase: XX-name*
77
+ *Approach explored: [date]*
78
+ ```
79
+
80
+ ## Good Examples
81
+
82
+ **Example 1: Visual feature (Dashboard)**
83
+
84
+ ```markdown
85
+ # Phase 3: Interactive Dashboard - Approach
86
+
87
+ **Explored:** 2026-03-22
88
+ **Status:** Ready for planning
89
+
90
+ <domain>
91
+ ## Phase Boundary
92
+
93
+ Build an interactive dashboard with configurable widgets. Users can view metrics and rearrange layout. Widget creation and custom data sources are separate phases.
94
+
95
+ </domain>
96
+
97
+ <decisions>
98
+ ## Implementation Decisions
99
+
100
+ ### Chart rendering
101
+ **Chosen approach:** Recharts
102
+ **Alternatives considered:** D3 + custom components, Chart.js
103
+ **Why this one:** React-native, SSR-friendly, good defaults. Matches existing React patterns. D3 would give more control but requires more code for standard charts.
104
+ - Bar charts and line charts for metrics — no pie charts in v1
105
+ - Charts should be interactive (hover tooltips) but not editable
106
+ - Responsive: charts resize with widget container
107
+
108
+ ### Widget layout
109
+ **Chosen approach:** react-grid-layout
110
+ **Alternatives considered:** CSS Grid + custom drag, @dnd-kit grid
111
+ **Why this one:** Purpose-built for dashboard grids. Layout serialization to JSON for persistence. Mature production usage.
112
+ - Drag-to-reorder enabled
113
+ - Resize handles on bottom-right corner
114
+ - 12-column grid, responsive breakpoints
115
+ - Layout persisted to localStorage (not server)
116
+
117
+ ### Agent's Discretion
118
+ - Loading skeleton design
119
+ - Exact spacing and typography within widgets
120
+ - Error state handling for failed data fetches
121
+
122
+ </decisions>
123
+
124
+ <assumptions>
125
+ ## Validated Assumptions
126
+
127
+ ### Confirmed
128
+ - [confident] Using existing Tailwind patterns from Phase 1-2
129
+
130
+ ### Accepted (not challenged)
131
+ - [assuming] Dashboard data comes from static JSON for v1 (no real API)
132
+
133
+ ### Corrected
134
+ - [corrected] Dashboard is read-only → Widgets DO need drag reorder
135
+
136
+ </assumptions>
137
+
138
+ <deferred>
139
+ ## Deferred Ideas
140
+
141
+ - Real-time data updates — future phase
142
+ - Custom widget creation — add to backlog
143
+ - Dashboard sharing/export — out of scope for v1
144
+
145
+ </deferred>
146
+
147
+ ---
148
+
149
+ *Phase: 03-dashboard*
150
+ *Approach explored: 2026-03-22*
151
+ ```
152
+
153
+ **Example 2: API feature (Authentication)**
154
+
155
+ ```markdown
156
+ # Phase 1: Authentication - Approach
157
+
158
+ **Explored:** 2026-03-22
159
+ **Status:** Ready for planning
160
+
161
+ <domain>
162
+ ## Phase Boundary
163
+
164
+ Users can register and log in with email/password. Session management via JWT. OAuth and MFA are separate phases.
165
+
166
+ </domain>
167
+
168
+ <decisions>
169
+ ## Implementation Decisions
170
+
171
+ ### Session handling
172
+ **Chosen approach:** HTTP-only cookies with JWT
173
+ **Alternatives considered:** localStorage JWT, session-based (server-side)
174
+ **Why this one:** HTTP-only cookies prevent XSS token theft. JWT avoids server-side session storage. Standard pattern for Next.js apps.
175
+ - Access token: 15-minute expiry
176
+ - Refresh token: 7-day expiry, rotation on use
177
+ - Logout clears both tokens
178
+
179
+ ### Error responses
180
+ **Chosen approach:** Structured JSON errors
181
+ **Alternatives considered:** Plain text errors, RFC 7807 Problem Details
182
+ **Why this one:** Consistent with existing API patterns. RFC 7807 is overkill for this project size.
183
+ - Always include: status code, error code, user-facing message
184
+ - Never include: stack traces, internal IDs
185
+ - Rate limit errors: include retry-after header
186
+
187
+ ### Agent's Discretion
188
+ - Password hashing library (bcrypt vs argon2)
189
+ - Exact JWT payload structure
190
+ - Email validation regex vs library
191
+
192
+ </decisions>
193
+
194
+ <assumptions>
195
+ ## Validated Assumptions
196
+
197
+ ### Confirmed
198
+ - [confident] Email/password only for v1 (no OAuth)
199
+
200
+ ### Accepted (not challenged)
201
+ - [assuming] No email verification required for v1
202
+
203
+ ### Corrected
204
+ - [corrected] Single-device sessions → Allow multi-device (don't invalidate other sessions on login)
205
+
206
+ </assumptions>
207
+
208
+ <deferred>
209
+ ## Deferred Ideas
210
+
211
+ - OAuth providers (Google, GitHub) — Phase 4
212
+ - MFA/2FA — add to backlog
213
+
214
+ </deferred>
215
+
216
+ ---
217
+
218
+ *Phase: 01-authentication*
219
+ *Approach explored: 2026-03-22*
220
+ ```
221
+
222
+ ## Guidelines
223
+
224
+ **This template captures DECISIONS for downstream agents.**
225
+
226
+ The output should answer: "What choices are locked for the planner? Where does the planner have discretion?"
227
+
228
+ **After creation:**
229
+ - File lives in phase directory: `.planning/phases/XX-name/{phase_num}-APPROACH.md`
230
+ - Planner reads decisions to constrain implementation tasks
231
+ - Plan-checker verifies approach_alignment: plans must implement chosen approaches
232
+ - Downstream agents should NOT need to ask the user again about captured decisions
@@ -0,0 +1,25 @@
1
+ **Role contract:** Read `.planning/templates/roles/approach-explorer.md` before starting. Follow its algorithm, scope, anti-patterns, and quality standards.
2
+
3
+ You are the approach explorer delegate for the plan workflow.
4
+
5
+ **Your job:** Identify gray areas in the target phase, research viable approaches for technical decisions, conduct an adaptive conversation with the user to capture locked decisions, and write APPROACH.md to the phase directory.
6
+
7
+ Read only the explicit inputs provided by the orchestrator:
8
+ - target phase goal and requirement IDs from `.planning/ROADMAP.md`
9
+ - locked decisions and deferred items from `.planning/SPEC.md`
10
+ - phase research file (if exists)
11
+ - relevant codebase files (existing patterns and conventions)
12
+ - approach template at `.planning/templates/approach.md`
13
+
14
+ ## Gray Area Classification
15
+
16
+ Classify each gray area before acting on it:
17
+ - **Taste:** Ask directly, no research needed
18
+ - **Technical:** Research 2-3 approaches first, then present with trade-offs
19
+ - **Hybrid:** Research the technical part, ask about taste
20
+
21
+ ## Output
22
+
23
+ Write `{padded_phase}-APPROACH.md` to the phase directory using the approach template.
24
+
25
+ Return structured summary: gray areas explored, decisions captured, assumptions validated/corrected, deferred ideas, path to APPROACH.md.
@@ -5,6 +5,7 @@ You are the fresh-context plan checker for `/gsdd:plan`.
5
5
  Read only the explicit inputs provided by the orchestrator:
6
6
  - target phase goal and requirement IDs
7
7
  - relevant locked decisions or deferred items from `.planning/SPEC.md`
8
+ - approach decisions from `.planning/phases/*-APPROACH.md` (if provided)
8
9
  - any relevant phase research file
9
10
  - the produced `.planning/phases/*-PLAN.md` file(s)
10
11
 
@@ -21,6 +22,11 @@ Verify these dimensions:
21
22
  - `scope_sanity`: plans are sized so an executor can complete them without context collapse
22
23
  - `must_have_quality`: success criteria and must-haves are specific, observable, and reflected in tasks
23
24
  - `context_compliance`: locked decisions are honored and deferred ideas stay out of scope
25
+ - `approach_alignment`: when APPROACH.md is provided, verify that plan tasks implement the chosen approaches from the user's decisions. Check:
26
+ - **Chosen honored?** Does each plan task align with the approach chosen in APPROACH.md for its gray area? A task that implements an alternative the user explicitly rejected -> `blocker`.
27
+ - **Discretion respected?** "Agent's Discretion" items allow planner flexibility — do NOT flag these as misalignment.
28
+ - **Deferred excluded?** Deferred ideas from APPROACH.md must not appear in plan tasks -> `blocker` if found.
29
+ - If no APPROACH.md was provided, skip this dimension entirely.
24
30
 
25
31
  Return JSON only as a single object with this shape:
26
32
 
@@ -30,7 +36,7 @@ Return JSON only as a single object with this shape:
30
36
  "summary": "One sentence overall assessment",
31
37
  "issues": [
32
38
  {
33
- "dimension": "requirement_coverage",
39
+ "dimension": "requirement_coverage | approach_alignment",
34
40
  "severity": "blocker",
35
41
  "description": "What is wrong",
36
42
  "plan": "01-PLAN",
@@ -10,8 +10,9 @@ Before starting, read these files:
10
10
  1. `.planning/SPEC.md` - requirements, constraints, key decisions, current state
11
11
  2. `.planning/ROADMAP.md` - find the target phase, its goal, requirements, and success criteria
12
12
  3. `.planning/research/*.md` - if research exists and is relevant to this phase
13
- 4. `.planning/phases/*-PLAN.md` - any previous plans that affect this phase
14
- 5. Relevant source code - if this phase builds on existing code, read the key files
13
+ 4. `.planning/phases/*-APPROACH.md` - approach decisions from user discussion (if exists)
14
+ 5. `.planning/phases/*-PLAN.md` - any previous plans that affect this phase
15
+ 6. Relevant source code - if this phase builds on existing code, read the key files
15
16
 
16
17
  Identify the target phase: the first phase with status `[ ]` or `[-]` in `ROADMAP.md`.
17
18
  </load_context>
@@ -20,8 +21,9 @@ Identify the target phase: the first phase with status `[ ]` or `[-]` in `ROADMA
20
21
  Before planning, acknowledge what is locked:
21
22
 
22
23
  - Decisions in `.planning/SPEC.md` "Key Decisions" - do not revisit them.
24
+ - Decisions in APPROACH.md "Implementation Decisions" - these are user-validated choices. Implement the chosen approaches, not alternatives. "Agent's Discretion" items give you flexibility.
23
25
  - Patterns from previous phases - match existing conventions. Do not introduce new patterns without cause.
24
- - Deferred items - items marked v2, nice-to-have, or out of scope. Do not plan for them.
26
+ - Deferred items - items marked v2, nice-to-have, or out of scope in SPEC.md or APPROACH.md. Do not plan for them.
25
27
 
26
28
  If you need to challenge a locked decision: stop, ask the developer, and document the new decision explicitly.
27
29
  </context_fidelity>
@@ -250,15 +252,79 @@ must_haves:
250
252
  ```
251
253
  </plan_structure>
252
254
 
253
- <clarify_approach>
254
- If there is ambiguity in how to implement:
255
+ <approach_exploration>
256
+ ### When This Runs
255
257
 
256
- 1. Ask the developer about preferences when the choice materially changes the design.
257
- 2. Surface your assumptions explicitly.
258
- 3. Present trade-offs when multiple approaches are valid.
258
+ Check `.planning/config.json` for `workflow.discuss`:
259
+ - If `workflow.discuss: false` (or key missing): skip this section, go to `<goal_backward_planning>`. Note `reduced_alignment` in the orchestration summary.
260
+ - If `workflow.discuss: true`: mandatory before planning.
259
261
 
260
- If the approach is obvious or fully defined by `.planning/SPEC.md`, skip questions and proceed.
261
- </clarify_approach>
262
+ ### Check for Existing APPROACH.md
263
+
264
+ Check if `{phase_dir}/{padded_phase}-APPROACH.md` exists.
265
+
266
+ **If exists:**
267
+ Offer the user a choice:
268
+ - "Use existing" — load decisions from APPROACH.md, skip to `<goal_backward_planning>`
269
+ - "Update it" — run the approach explorer to revise decisions
270
+ - "View it" — display APPROACH.md contents, then offer "Use existing" / "Update"
271
+
272
+ **If does not exist (or user chose "Update"):**
273
+ Run the approach explorer.
274
+
275
+ ### Running the Approach Explorer
276
+
277
+ **Primary path — inline conversation with research subagents:**
278
+
279
+ The conversation with the user runs inline in the main context. For each technical gray area, a read-only research subagent is spawned to isolate heavy codebase and documentation reads, returning only compressed summaries.
280
+
281
+ 1. Load context: read ONLY locked decisions from `.planning/SPEC.md` and the target phase goal/requirements from `.planning/ROADMAP.md`.
282
+
283
+ 2. Identify 3-4 domain-specific gray areas. Classify each as **taste** (preference, no research needed), **technical** (trade-offs, research first), or **hybrid** (both).
284
+
285
+ 3. For each **technical or hybrid** gray area, spawn a read-only research subagent.
286
+ Use the prompt template from `.planning/templates/roles/approach-explorer.md` (`<research_subagent_prompt>` section), substituting the gray area name, classification, phase context, and relevant codebase files. Each subagent returns a structured summary under 1000 tokens.
287
+
288
+ 4. Present each gray area to the user individually:
289
+ - For taste areas: ask directly
290
+ - For technical/hybrid: present the research summary, lead with recommendation
291
+ - Ask: "Discuss this, or should I use my judgment?"
292
+
293
+ 5. For each area the user chose to discuss, ask adaptive questions until the decision converges. Persist each confirmed decision to disk incrementally.
294
+
295
+ 6. Surface assumptions across 5 dimensions with confidence levels. Wait for corrections.
296
+
297
+ 7. Self-check: verify every decision is concrete enough for the planner before writing.
298
+
299
+ 8. Write `{padded_phase}-APPROACH.md` to the phase directory.
300
+
301
+ **Native agent optimization:**
302
+
303
+ If your runtime provides an interactive `gsdd-approach-explorer` agent:
304
+ - Invoke it with: target phase goal, requirement IDs, locked decisions, phase research (if exists), relevant codebase files
305
+ - The native agent runs the full exploration in its own context window
306
+ - This is an optimization — the output (APPROACH.md) is identical to the primary path
307
+
308
+ **Inline fallback (reduced alignment):**
309
+
310
+ If neither the primary path nor native agent is available (e.g., the runtime cannot spawn research subagents):
311
+ - Read the phase goal and identify 2-3 obvious gray areas
312
+ - Present them to the user with your best assessment
313
+ - Capture any decisions the user provides
314
+ - Explicitly report `reduced_alignment` — the user did not get full research-backed exploration
315
+
316
+ ### Using APPROACH.md Decisions
317
+
318
+ After approach exploration completes (or existing APPROACH.md is loaded):
319
+ - Treat decisions from APPROACH.md as locked constraints, same priority as `.planning/SPEC.md` decisions
320
+ - "Agent's Discretion" items from APPROACH.md give the planner flexibility — do not treat them as locked
321
+ - Thread the APPROACH.md file path to both the planner prompt and the plan-checker prompt
322
+ - Deferred ideas from APPROACH.md must not appear in the plan
323
+
324
+ ### Role Contract
325
+
326
+ The approach explorer's full role contract is at `.planning/templates/roles/approach-explorer.md`. The portable workflow describes the orchestration; the role contract describes the agent's behavior.
327
+ </approach_exploration>
262
328
 
263
329
  <plan_check_orchestration>
264
330
  ### How Plan Checking Works
@@ -274,6 +340,7 @@ After the planner produces a draft plan, an independent checker reviews it in fr
274
340
  5. `scope_sanity` - plans are sized so an executor can complete them without context collapse
275
341
  6. `must_have_quality` - success criteria are specific, observable, and reflected in tasks
276
342
  7. `context_compliance` - locked decisions are honored and deferred ideas stay out of scope
343
+ 8. `approach_alignment` - when APPROACH.md exists, plans implement the chosen approaches, not alternatives. Blocker if plan contradicts an explicit user choice. Warning if plan drifts from recommendation without justification. Skipped when no APPROACH.md is provided.
277
344
 
278
345
  ### Invoking the Checker
279
346
 
@@ -282,6 +349,7 @@ After the planner produces a draft plan, an independent checker reviews it in fr
282
349
  3. If a native checker agent is available, invoke it in a fresh context with only these explicit inputs:
283
350
  - target phase goal and requirement IDs
284
351
  - relevant locked decisions / deferred items from `.planning/SPEC.md`
352
+ - approach decisions from `.planning/phases/*-APPROACH.md` (if exists)
285
353
  - relevant phase research file(s)
286
354
  - produced `.planning/phases/*-PLAN.md` file(s)
287
355
  4. Require the checker to return a single JSON object:
@@ -291,7 +359,7 @@ After the planner produces a draft plan, an independent checker reviews it in fr
291
359
  "summary": "One sentence overall assessment",
292
360
  "issues": [
293
361
  {
294
- "dimension": "requirement_coverage | task_completeness | dependency_correctness | key_link_completeness | scope_sanity | must_have_quality | context_compliance",
362
+ "dimension": "requirement_coverage | task_completeness | dependency_correctness | key_link_completeness | scope_sanity | must_have_quality | context_compliance | approach_alignment",
295
363
  "severity": "blocker | warning",
296
364
  "description": "What is wrong",
297
365
  "plan": "01-PLAN",
@@ -354,6 +422,8 @@ For each task:
354
422
  Planning is done when all of these are true:
355
423
 
356
424
  - [ ] Target phase identified from `ROADMAP.md`
425
+ - [ ] Approach exploration completed or explicitly skipped with `reduced_alignment` reported
426
+ - [ ] When `workflow.discuss: true`: user alignment confirmed via APPROACH.md before planning
357
427
  - [ ] Research check completed where needed
358
428
  - [ ] Plan self-check passed
359
429
  - [ ] Success criteria from `ROADMAP.md` are represented as must-haves
@@ -362,7 +432,7 @@ Planning is done when all of these are true:
362
432
  - [ ] Every task has XML structure with `id`, `type`, `files`, `action`, `verify`, and `done`
363
433
  - [ ] Every task has at least one runnable verify command
364
434
  - [ ] Plan sizing stays within 2-5 tasks, preferring 2-3
365
- - [ ] Locked decisions from `.planning/SPEC.md` are honored
435
+ - [ ] Locked decisions from `.planning/SPEC.md` and APPROACH.md are honored
366
436
  - [ ] Any git guidance stays repo-native and follows `.planning/config.json`
367
437
  </success_criteria>
368
438
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gsdd-cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "GSDD — a portable, spec-driven development kernel for AI coding agents. Works with Claude Code, Codex CLI, OpenCode, Cursor, Copilot, and Gemini CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,14 @@
9
9
  "scripts": {
10
10
  "test:gsdd": "node tests/gsdd.init.test.cjs && node tests/gsdd.models.test.cjs && node tests/gsdd.manifest.test.cjs && node tests/gsdd.plan.adapters.test.cjs && node tests/gsdd.audit-milestone.test.cjs && node tests/gsdd.invariants.test.cjs && node tests/gsdd.guards.test.cjs && node tests/gsdd.health.test.cjs && node tests/gsdd.scenarios.test.cjs"
11
11
  },
12
+ "devDependencies": {
13
+ "semantic-release": "^24.2.3",
14
+ "@semantic-release/changelog": "^6.0.3",
15
+ "@semantic-release/git": "^10.0.1"
16
+ },
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
12
20
  "files": [
13
21
  "bin/adapters/",
14
22
  "bin/lib/",