get-shit-done-cc 1.2.13 → 1.3.1
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/README.md +3 -4
- package/commands/gsd/create-roadmap.md +3 -40
- package/commands/gsd/help.md +21 -25
- package/commands/gsd/map-codebase.md +85 -0
- package/commands/gsd/new-project.md +36 -8
- package/commands/gsd/plan-phase.md +3 -0
- package/get-shit-done/templates/codebase/architecture.md +249 -0
- package/get-shit-done/templates/codebase/concerns.md +299 -0
- package/get-shit-done/templates/codebase/conventions.md +307 -0
- package/get-shit-done/templates/codebase/integrations.md +280 -0
- package/get-shit-done/templates/codebase/stack.md +187 -0
- package/get-shit-done/templates/codebase/structure.md +285 -0
- package/get-shit-done/templates/codebase/testing.md +480 -0
- package/get-shit-done/workflows/create-roadmap.md +0 -105
- package/get-shit-done/workflows/execute-phase.md +47 -0
- package/get-shit-done/workflows/map-codebase.md +397 -0
- package/get-shit-done/workflows/plan-phase.md +48 -0
- package/package.json +1 -1
- package/commands/gsd/research-project.md +0 -195
- package/get-shit-done/references/research-subagent-prompts.md +0 -451
- package/get-shit-done/templates/project-research.md +0 -243
- package/get-shit-done/workflows/research-project.md +0 -223
package/README.md
CHANGED
|
@@ -52,14 +52,13 @@ That's what this is. No enterprise roleplay bullshit. Just an incredibly effecti
|
|
|
52
52
|
|
|
53
53
|
The system asks questions. Keeps asking until it has everything — your goals, constraints, tech preferences, edge cases. You go back and forth until the idea is fully captured. Creates **PROJECT.md**.
|
|
54
54
|
|
|
55
|
-
### 2.
|
|
55
|
+
### 2. Create roadmap
|
|
56
56
|
|
|
57
57
|
```
|
|
58
|
-
/gsd:research-project # For niche domains (3D, audio, shaders)
|
|
59
58
|
/gsd:create-roadmap # Create phases and state tracking
|
|
60
59
|
```
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
Roadmap creation produces:
|
|
63
62
|
|
|
64
63
|
- **ROADMAP.md** - Phases from start to finish
|
|
65
64
|
- **STATE.md** - Living memory that persists across sessions
|
|
@@ -156,8 +155,8 @@ You're never locked in. The system adapts.
|
|
|
156
155
|
| Command | What it does |
|
|
157
156
|
| --------------------------------- | ------------------------------------------------------------- |
|
|
158
157
|
| `/gsd:new-project` | Extract your idea through questions, create PROJECT.md |
|
|
159
|
-
| `/gsd:research-project` | Research domain ecosystem before roadmap (optional) |
|
|
160
158
|
| `/gsd:create-roadmap` | Create roadmap and state tracking |
|
|
159
|
+
| `/gsd:map-codebase` | Map existing codebase for brownfield projects |
|
|
161
160
|
| `/gsd:plan-phase [N]` | Generate task plans for phase |
|
|
162
161
|
| `/gsd:execute-plan` | Run plan via subagent |
|
|
163
162
|
| `/gsd:progress` | Where am I? What's next? |
|
|
@@ -9,11 +9,9 @@ allowed-tools:
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
<objective>
|
|
12
|
-
Create project roadmap
|
|
12
|
+
Create project roadmap with phase breakdown.
|
|
13
13
|
|
|
14
|
-
Roadmaps define
|
|
15
|
-
1. After /gsd:new-project (without research)
|
|
16
|
-
2. After /gsd:research-project (with domain research incorporated)
|
|
14
|
+
Roadmaps define what work happens in what order. Run after /gsd:new-project.
|
|
17
15
|
</objective>
|
|
18
16
|
|
|
19
17
|
<execution_context>
|
|
@@ -57,46 +55,12 @@ If "Cancel": Exit
|
|
|
57
55
|
If "Replace": Continue with workflow
|
|
58
56
|
</step>
|
|
59
57
|
|
|
60
|
-
<step name="check_research">
|
|
61
|
-
Check for project research:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
ls .planning/research/*.md 2>/dev/null
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
**If research found:**
|
|
68
|
-
Load and summarize each research file:
|
|
69
|
-
- ecosystem.md → Key libraries/frameworks recommended
|
|
70
|
-
- architecture.md → Architectural patterns to follow
|
|
71
|
-
- pitfalls.md → Top 2-3 critical pitfalls to avoid
|
|
72
|
-
- standards.md → Standards and conventions to follow
|
|
73
|
-
|
|
74
|
-
Present summary:
|
|
75
|
-
```
|
|
76
|
-
Found project research:
|
|
77
|
-
|
|
78
|
-
Ecosystem: [key libraries/frameworks]
|
|
79
|
-
Architecture: [key patterns]
|
|
80
|
-
Pitfalls: [top 2-3 to avoid]
|
|
81
|
-
Standards: [key conventions]
|
|
82
|
-
|
|
83
|
-
This will inform phase structure.
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**If no research found:**
|
|
87
|
-
```
|
|
88
|
-
No project research found.
|
|
89
|
-
Creating roadmap based on PROJECT.md alone.
|
|
90
|
-
(Optional: Run /gsd:research-project first for niche/complex domains)
|
|
91
|
-
```
|
|
92
|
-
</step>
|
|
93
|
-
|
|
94
58
|
<step name="create_roadmap">
|
|
95
59
|
Follow the create-roadmap.md workflow starting from detect_domain step.
|
|
96
60
|
|
|
97
61
|
The workflow handles:
|
|
98
62
|
- Domain expertise detection
|
|
99
|
-
- Phase identification
|
|
63
|
+
- Phase identification
|
|
100
64
|
- Research flags for each phase
|
|
101
65
|
- Confirmation gates (respecting config mode)
|
|
102
66
|
- ROADMAP.md creation
|
|
@@ -145,7 +109,6 @@ Roadmap created:
|
|
|
145
109
|
|
|
146
110
|
<success_criteria>
|
|
147
111
|
- [ ] PROJECT.md validated
|
|
148
|
-
- [ ] Research incorporated if present
|
|
149
112
|
- [ ] ROADMAP.md created with phases
|
|
150
113
|
- [ ] STATE.md initialized
|
|
151
114
|
- [ ] Phase directories created
|
package/commands/gsd/help.md
CHANGED
|
@@ -21,10 +21,9 @@ Output ONLY the reference content below. Do NOT add:
|
|
|
21
21
|
## Quick Start
|
|
22
22
|
|
|
23
23
|
1. `/gsd:new-project` - Initialize project with brief
|
|
24
|
-
2. `/gsd:
|
|
25
|
-
3. `/gsd:
|
|
26
|
-
4. `/gsd:plan
|
|
27
|
-
5. `/gsd:execute-plan <path>` - Execute the plan
|
|
24
|
+
2. `/gsd:create-roadmap` - Create roadmap and phases
|
|
25
|
+
3. `/gsd:plan-phase <number>` - Create detailed plan for first phase
|
|
26
|
+
4. `/gsd:execute-plan <path>` - Execute the plan
|
|
28
27
|
|
|
29
28
|
## Core Workflow
|
|
30
29
|
|
|
@@ -44,26 +43,25 @@ Initialize new project with brief and configuration.
|
|
|
44
43
|
|
|
45
44
|
Usage: `/gsd:new-project`
|
|
46
45
|
|
|
47
|
-
**`/gsd:research-project`**
|
|
48
|
-
Research domain ecosystem before creating roadmap.
|
|
49
|
-
|
|
50
|
-
- Spawns batched subagents to research domain patterns
|
|
51
|
-
- Creates `.planning/research/` with ecosystem findings
|
|
52
|
-
- Optional step for niche/complex domains
|
|
53
|
-
- Run after new-project, before create-roadmap
|
|
54
|
-
|
|
55
|
-
Usage: `/gsd:research-project`
|
|
56
|
-
|
|
57
46
|
**`/gsd:create-roadmap`**
|
|
58
47
|
Create roadmap and state tracking for initialized project.
|
|
59
48
|
|
|
60
49
|
- Creates `.planning/ROADMAP.md` (phase breakdown)
|
|
61
50
|
- Creates `.planning/STATE.md` (project memory)
|
|
62
51
|
- Creates `.planning/phases/` directories
|
|
63
|
-
- Incorporates research findings if present
|
|
64
52
|
|
|
65
53
|
Usage: `/gsd:create-roadmap`
|
|
66
54
|
|
|
55
|
+
**`/gsd:map-codebase`**
|
|
56
|
+
Map an existing codebase for brownfield projects.
|
|
57
|
+
|
|
58
|
+
- Analyzes codebase with parallel Explore agents
|
|
59
|
+
- Creates `.planning/codebase/` with 7 focused documents
|
|
60
|
+
- Covers stack, architecture, structure, conventions, testing, integrations, concerns
|
|
61
|
+
- Use before `/gsd:new-project` on existing codebases
|
|
62
|
+
|
|
63
|
+
Usage: `/gsd:map-codebase`
|
|
64
|
+
|
|
67
65
|
### Phase Planning
|
|
68
66
|
|
|
69
67
|
**`/gsd:discuss-phase <number>`**
|
|
@@ -229,6 +227,14 @@ Show this command reference.
|
|
|
229
227
|
├── STATE.md # Project memory & context
|
|
230
228
|
├── ISSUES.md # Deferred enhancements (created when needed)
|
|
231
229
|
├── config.json # Workflow mode & gates
|
|
230
|
+
├── codebase/ # Codebase map (brownfield projects)
|
|
231
|
+
│ ├── STACK.md # Languages, frameworks, dependencies
|
|
232
|
+
│ ├── ARCHITECTURE.md # Patterns, layers, data flow
|
|
233
|
+
│ ├── STRUCTURE.md # Directory layout, key files
|
|
234
|
+
│ ├── CONVENTIONS.md # Coding standards, naming
|
|
235
|
+
│ ├── TESTING.md # Test setup, patterns
|
|
236
|
+
│ ├── INTEGRATIONS.md # External services, APIs
|
|
237
|
+
│ └── CONCERNS.md # Tech debt, known issues
|
|
232
238
|
└── phases/
|
|
233
239
|
├── 01-foundation/
|
|
234
240
|
│ ├── 01-01-PLAN.md
|
|
@@ -267,16 +273,6 @@ Change anytime by editing `.planning/config.json`
|
|
|
267
273
|
/gsd:execute-plan .planning/phases/01-foundation/01-01-PLAN.md
|
|
268
274
|
```
|
|
269
275
|
|
|
270
|
-
**Building something in a niche domain (3D, games, audio, shaders):**
|
|
271
|
-
|
|
272
|
-
```
|
|
273
|
-
/gsd:new-project
|
|
274
|
-
/gsd:research-project # Research domain ecosystem before roadmap
|
|
275
|
-
/gsd:create-roadmap # Roadmap incorporates research findings
|
|
276
|
-
/gsd:plan-phase 1
|
|
277
|
-
/gsd:execute-plan .planning/phases/01-foundation/01-01-PLAN.md
|
|
278
|
-
```
|
|
279
|
-
|
|
280
276
|
**Resuming work after a break:**
|
|
281
277
|
|
|
282
278
|
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze codebase with parallel Explore agents to produce .planning/codebase/ documents
|
|
3
|
+
argument-hint: "[optional: specific area to map, e.g., 'api' or 'auth']"
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Bash
|
|
7
|
+
- Glob
|
|
8
|
+
- Grep
|
|
9
|
+
- Write
|
|
10
|
+
- Task
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<objective>
|
|
14
|
+
Analyze existing codebase using parallel Explore agents to produce structured codebase documents.
|
|
15
|
+
|
|
16
|
+
This command spawns multiple Explore agents to analyze different aspects of the codebase in parallel, each with fresh context. Each agent produces focused documentation under 100 lines.
|
|
17
|
+
|
|
18
|
+
Output: .planning/codebase/ folder with 7 structured documents about the codebase state.
|
|
19
|
+
</objective>
|
|
20
|
+
|
|
21
|
+
<execution_context>
|
|
22
|
+
@~/.claude/get-shit-done/workflows/map-codebase.md
|
|
23
|
+
@~/.claude/get-shit-done/templates/codebase/stack.md
|
|
24
|
+
@~/.claude/get-shit-done/templates/codebase/architecture.md
|
|
25
|
+
@~/.claude/get-shit-done/templates/codebase/structure.md
|
|
26
|
+
@~/.claude/get-shit-done/templates/codebase/conventions.md
|
|
27
|
+
@~/.claude/get-shit-done/templates/codebase/testing.md
|
|
28
|
+
@~/.claude/get-shit-done/templates/codebase/integrations.md
|
|
29
|
+
@~/.claude/get-shit-done/templates/codebase/concerns.md
|
|
30
|
+
</execution_context>
|
|
31
|
+
|
|
32
|
+
<context>
|
|
33
|
+
Focus area: $ARGUMENTS (optional - if provided, tells agents to focus on specific subsystem)
|
|
34
|
+
|
|
35
|
+
**Load project state if exists:**
|
|
36
|
+
Check for .planning/STATE.md - loads context if project already initialized
|
|
37
|
+
|
|
38
|
+
**This command can run:**
|
|
39
|
+
- Before /gsd:new-project (brownfield codebases) - creates codebase map first
|
|
40
|
+
- After /gsd:new-project (greenfield codebases) - updates codebase map as code evolves
|
|
41
|
+
- Anytime to refresh codebase understanding
|
|
42
|
+
</context>
|
|
43
|
+
|
|
44
|
+
<when_to_use>
|
|
45
|
+
**Use map-codebase for:**
|
|
46
|
+
- Brownfield projects before initialization (understand existing code first)
|
|
47
|
+
- Refreshing codebase map after significant changes
|
|
48
|
+
- Onboarding to an unfamiliar codebase
|
|
49
|
+
- Before major refactoring (understand current state)
|
|
50
|
+
- When STATE.md references outdated codebase info
|
|
51
|
+
|
|
52
|
+
**Skip map-codebase for:**
|
|
53
|
+
- Greenfield projects with no code yet (nothing to map)
|
|
54
|
+
- Trivial codebases (<5 files)
|
|
55
|
+
</when_to_use>
|
|
56
|
+
|
|
57
|
+
<process>
|
|
58
|
+
1. Check if .planning/codebase/ already exists (offer to refresh or skip)
|
|
59
|
+
2. Create .planning/codebase/ directory structure
|
|
60
|
+
3. Spawn 4 parallel Explore agents to analyze codebase:
|
|
61
|
+
- Agent 1: Stack + Integrations (technology focus)
|
|
62
|
+
- Agent 2: Architecture + Structure (organization focus)
|
|
63
|
+
- Agent 3: Conventions + Testing (quality focus)
|
|
64
|
+
- Agent 4: Concerns (issues focus)
|
|
65
|
+
4. Wait for all agents to complete, collect findings
|
|
66
|
+
5. Write 7 codebase documents using templates:
|
|
67
|
+
- STACK.md - Languages, frameworks, key dependencies
|
|
68
|
+
- ARCHITECTURE.md - System design, patterns, data flow
|
|
69
|
+
- STRUCTURE.md - Directory layout, module organization
|
|
70
|
+
- CONVENTIONS.md - Code style, naming, patterns
|
|
71
|
+
- TESTING.md - Test structure, coverage, practices
|
|
72
|
+
- INTEGRATIONS.md - APIs, databases, external services
|
|
73
|
+
- CONCERNS.md - Technical debt, risks, issues
|
|
74
|
+
6. Verify each document is under 100 lines (summarize if needed)
|
|
75
|
+
7. Offer next steps (typically: /gsd:new-project or /gsd:plan-phase)
|
|
76
|
+
</process>
|
|
77
|
+
|
|
78
|
+
<success_criteria>
|
|
79
|
+
- [ ] .planning/codebase/ directory created
|
|
80
|
+
- [ ] All 7 codebase documents written
|
|
81
|
+
- [ ] Each document under 100 lines
|
|
82
|
+
- [ ] Documents follow template structure
|
|
83
|
+
- [ ] Parallel agents completed without errors
|
|
84
|
+
- [ ] User knows next steps
|
|
85
|
+
</success_criteria>
|
|
@@ -44,7 +44,40 @@ Creates `.planning/` with PROJECT.md and config.json.
|
|
|
44
44
|
fi
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
3. **Detect existing code (brownfield detection):**
|
|
48
|
+
```bash
|
|
49
|
+
# Check for existing code files
|
|
50
|
+
CODE_FILES=$(find . -name "*.ts" -o -name "*.js" -o -name "*.py" -o -name "*.go" -o -name "*.rs" -o -name "*.swift" -o -name "*.java" 2>/dev/null | grep -v node_modules | grep -v .git | head -20)
|
|
51
|
+
HAS_PACKAGE=$([ -f package.json ] || [ -f requirements.txt ] || [ -f Cargo.toml ] || [ -f go.mod ] || [ -f Package.swift ] && echo "yes")
|
|
52
|
+
HAS_CODEBASE_MAP=$([ -d .planning/codebase ] && echo "yes")
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**You MUST run all bash commands above using the Bash tool before proceeding.**
|
|
56
|
+
</step>
|
|
57
|
+
|
|
58
|
+
<step name="brownfield_offer">
|
|
59
|
+
**If existing code detected and .planning/codebase/ doesn't exist:**
|
|
60
|
+
|
|
61
|
+
Check the results from setup step:
|
|
62
|
+
- If `CODE_FILES` is non-empty OR `HAS_PACKAGE` is "yes"
|
|
63
|
+
- AND `HAS_CODEBASE_MAP` is NOT "yes"
|
|
64
|
+
|
|
65
|
+
Use AskUserQuestion:
|
|
66
|
+
- header: "Existing Code"
|
|
67
|
+
- question: "I detected existing code in this directory. Would you like to map the codebase first?"
|
|
68
|
+
- options:
|
|
69
|
+
- "Map codebase first" - Run /gsd:map-codebase to understand existing architecture (Recommended)
|
|
70
|
+
- "Skip mapping" - Proceed with project initialization
|
|
71
|
+
|
|
72
|
+
**If "Map codebase first":**
|
|
73
|
+
```
|
|
74
|
+
Run `/gsd:map-codebase` first, then return to `/gsd:new-project`
|
|
75
|
+
```
|
|
76
|
+
Exit command.
|
|
77
|
+
|
|
78
|
+
**If "Skip mapping":** Continue to question step.
|
|
79
|
+
|
|
80
|
+
**If no existing code detected OR codebase already mapped:** Continue to question step.
|
|
48
81
|
</step>
|
|
49
82
|
|
|
50
83
|
<step name="question">
|
|
@@ -140,19 +173,14 @@ Project initialized:
|
|
|
140
173
|
|
|
141
174
|
- Project: .planning/PROJECT.md
|
|
142
175
|
- Config: .planning/config.json (mode: [chosen mode])
|
|
176
|
+
[If .planning/codebase/ exists:] - Codebase: .planning/codebase/ (7 documents)
|
|
143
177
|
|
|
144
178
|
---
|
|
145
179
|
|
|
146
180
|
## ▶ Next Up
|
|
147
181
|
|
|
148
|
-
**[Project Name]** —
|
|
149
|
-
|
|
150
|
-
**Research first (recommended for niche/complex domains):**
|
|
151
|
-
```
|
|
152
|
-
/gsd:research-project
|
|
153
|
-
```
|
|
182
|
+
**[Project Name]** — create roadmap
|
|
154
183
|
|
|
155
|
-
**Create roadmap directly:**
|
|
156
184
|
```
|
|
157
185
|
/gsd:create-roadmap
|
|
158
186
|
```
|
|
@@ -39,6 +39,9 @@ Phase number: $ARGUMENTS (optional - auto-detects next unplanned phase if not pr
|
|
|
39
39
|
|
|
40
40
|
**Load phase context if exists (created by /gsd:discuss-phase):**
|
|
41
41
|
Check for and read `.planning/phases/XX-name/{phase}-CONTEXT.md` - contains research findings, clarifications, and decisions from phase discussion.
|
|
42
|
+
|
|
43
|
+
**Load codebase context if exists:**
|
|
44
|
+
Check for `.planning/codebase/` and load relevant documents based on phase type.
|
|
42
45
|
</context>
|
|
43
46
|
|
|
44
47
|
<process>
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Architecture Template
|
|
2
|
+
|
|
3
|
+
Template for `.planning/codebase/ARCHITECTURE.md` - captures conceptual code organization.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Document how the code is organized at a conceptual level. Complements STRUCTURE.md (which shows physical file locations).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## File Template
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
# Architecture
|
|
13
|
+
|
|
14
|
+
**Analysis Date:** [YYYY-MM-DD]
|
|
15
|
+
|
|
16
|
+
## Pattern Overview
|
|
17
|
+
|
|
18
|
+
**Overall:** [Pattern name: e.g., "Monolithic CLI", "Serverless API", "Full-stack MVC"]
|
|
19
|
+
|
|
20
|
+
**Key Characteristics:**
|
|
21
|
+
- [Characteristic 1: e.g., "Single executable"]
|
|
22
|
+
- [Characteristic 2: e.g., "Stateless request handling"]
|
|
23
|
+
- [Characteristic 3: e.g., "Event-driven"]
|
|
24
|
+
|
|
25
|
+
## Layers
|
|
26
|
+
|
|
27
|
+
[Describe the conceptual layers and their responsibilities]
|
|
28
|
+
|
|
29
|
+
**[Layer Name]:**
|
|
30
|
+
- Purpose: [What this layer does]
|
|
31
|
+
- Contains: [Types of code: e.g., "route handlers", "business logic"]
|
|
32
|
+
- Depends on: [What it uses: e.g., "data layer only"]
|
|
33
|
+
- Used by: [What uses it: e.g., "API routes"]
|
|
34
|
+
|
|
35
|
+
**[Layer Name]:**
|
|
36
|
+
- Purpose: [What this layer does]
|
|
37
|
+
- Contains: [Types of code]
|
|
38
|
+
- Depends on: [What it uses]
|
|
39
|
+
- Used by: [What uses it]
|
|
40
|
+
|
|
41
|
+
## Data Flow
|
|
42
|
+
|
|
43
|
+
[Describe the typical request/execution lifecycle]
|
|
44
|
+
|
|
45
|
+
**[Flow Name] (e.g., "HTTP Request", "CLI Command", "Event Processing"):**
|
|
46
|
+
|
|
47
|
+
1. [Entry point: e.g., "User runs command"]
|
|
48
|
+
2. [Processing step: e.g., "Router matches path"]
|
|
49
|
+
3. [Processing step: e.g., "Controller validates input"]
|
|
50
|
+
4. [Processing step: e.g., "Service executes logic"]
|
|
51
|
+
5. [Output: e.g., "Response returned"]
|
|
52
|
+
|
|
53
|
+
**State Management:**
|
|
54
|
+
- [How state is handled: e.g., "Stateless - no persistent state", "Database per request", "In-memory cache"]
|
|
55
|
+
|
|
56
|
+
## Key Abstractions
|
|
57
|
+
|
|
58
|
+
[Core concepts/patterns used throughout the codebase]
|
|
59
|
+
|
|
60
|
+
**[Abstraction Name]:**
|
|
61
|
+
- Purpose: [What it represents]
|
|
62
|
+
- Examples: [e.g., "UserService, ProjectService"]
|
|
63
|
+
- Pattern: [e.g., "Singleton", "Factory", "Repository"]
|
|
64
|
+
|
|
65
|
+
**[Abstraction Name]:**
|
|
66
|
+
- Purpose: [What it represents]
|
|
67
|
+
- Examples: [Concrete examples]
|
|
68
|
+
- Pattern: [Pattern used]
|
|
69
|
+
|
|
70
|
+
## Entry Points
|
|
71
|
+
|
|
72
|
+
[Where execution begins]
|
|
73
|
+
|
|
74
|
+
**[Entry Point]:**
|
|
75
|
+
- Location: [Brief: e.g., "src/index.ts", "API Gateway triggers"]
|
|
76
|
+
- Triggers: [What invokes it: e.g., "CLI invocation", "HTTP request"]
|
|
77
|
+
- Responsibilities: [What it does: e.g., "Parse args, route to command"]
|
|
78
|
+
|
|
79
|
+
## Error Handling
|
|
80
|
+
|
|
81
|
+
**Strategy:** [How errors are handled: e.g., "Exception bubbling to top-level handler", "Per-route error middleware"]
|
|
82
|
+
|
|
83
|
+
**Patterns:**
|
|
84
|
+
- [Pattern: e.g., "try/catch at controller level"]
|
|
85
|
+
- [Pattern: e.g., "Error codes returned to user"]
|
|
86
|
+
|
|
87
|
+
## Cross-Cutting Concerns
|
|
88
|
+
|
|
89
|
+
[Aspects that affect multiple layers]
|
|
90
|
+
|
|
91
|
+
**Logging:**
|
|
92
|
+
- [Approach: e.g., "Winston logger, injected per-request"]
|
|
93
|
+
|
|
94
|
+
**Validation:**
|
|
95
|
+
- [Approach: e.g., "Zod schemas at API boundary"]
|
|
96
|
+
|
|
97
|
+
**Authentication:**
|
|
98
|
+
- [Approach: e.g., "JWT middleware on protected routes"]
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
*Architecture analysis: [date]*
|
|
103
|
+
*Update when major patterns change*
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
<good_examples>
|
|
107
|
+
```markdown
|
|
108
|
+
# Architecture
|
|
109
|
+
|
|
110
|
+
**Analysis Date:** 2025-01-20
|
|
111
|
+
|
|
112
|
+
## Pattern Overview
|
|
113
|
+
|
|
114
|
+
**Overall:** CLI Application with Plugin System
|
|
115
|
+
|
|
116
|
+
**Key Characteristics:**
|
|
117
|
+
- Single executable with subcommands
|
|
118
|
+
- Plugin-based extensibility
|
|
119
|
+
- File-based state (no database)
|
|
120
|
+
- Synchronous execution model
|
|
121
|
+
|
|
122
|
+
## Layers
|
|
123
|
+
|
|
124
|
+
**Command Layer:**
|
|
125
|
+
- Purpose: Parse user input and route to appropriate handler
|
|
126
|
+
- Contains: Command definitions, argument parsing, help text
|
|
127
|
+
- Depends on: Service layer for business logic
|
|
128
|
+
- Used by: CLI entry point (src/index.ts)
|
|
129
|
+
|
|
130
|
+
**Service Layer:**
|
|
131
|
+
- Purpose: Core business logic
|
|
132
|
+
- Contains: FileService, TemplateService, InstallService
|
|
133
|
+
- Depends on: File system utilities, external tools
|
|
134
|
+
- Used by: Command handlers
|
|
135
|
+
|
|
136
|
+
**Utility Layer:**
|
|
137
|
+
- Purpose: Shared helpers and abstractions
|
|
138
|
+
- Contains: File I/O wrappers, path resolution, string formatting
|
|
139
|
+
- Depends on: Node.js built-ins only
|
|
140
|
+
- Used by: Service layer
|
|
141
|
+
|
|
142
|
+
## Data Flow
|
|
143
|
+
|
|
144
|
+
**CLI Command Execution:**
|
|
145
|
+
|
|
146
|
+
1. User runs: `gsd new-project`
|
|
147
|
+
2. Commander parses args and flags
|
|
148
|
+
3. Command handler invoked (commands/new-project.ts)
|
|
149
|
+
4. Handler calls service methods (e.g., ProjectService.create())
|
|
150
|
+
5. Service reads templates, processes files, writes output
|
|
151
|
+
6. Results logged to console
|
|
152
|
+
7. Process exits with status code
|
|
153
|
+
|
|
154
|
+
**State Management:**
|
|
155
|
+
- File-based: All state lives in `.planning/` directory
|
|
156
|
+
- No persistent in-memory state
|
|
157
|
+
- Each command execution is independent
|
|
158
|
+
|
|
159
|
+
## Key Abstractions
|
|
160
|
+
|
|
161
|
+
**Service:**
|
|
162
|
+
- Purpose: Encapsulate business logic for a domain
|
|
163
|
+
- Examples: FileService, TemplateService, ProjectService
|
|
164
|
+
- Pattern: Singleton-like (imported as modules, not instantiated)
|
|
165
|
+
|
|
166
|
+
**Command:**
|
|
167
|
+
- Purpose: CLI command definition
|
|
168
|
+
- Examples: new-project, plan-phase, execute-plan
|
|
169
|
+
- Pattern: Commander.js command registration
|
|
170
|
+
|
|
171
|
+
**Template:**
|
|
172
|
+
- Purpose: Reusable document structures
|
|
173
|
+
- Examples: PROJECT.md, PLAN.md templates
|
|
174
|
+
- Pattern: Markdown files with substitution variables
|
|
175
|
+
|
|
176
|
+
## Entry Points
|
|
177
|
+
|
|
178
|
+
**CLI Entry:**
|
|
179
|
+
- Location: src/index.ts
|
|
180
|
+
- Triggers: User runs `gsd <command>`
|
|
181
|
+
- Responsibilities: Register commands, parse args, display help
|
|
182
|
+
|
|
183
|
+
**Commands:**
|
|
184
|
+
- Location: src/commands/*.ts
|
|
185
|
+
- Triggers: Matched command from CLI
|
|
186
|
+
- Responsibilities: Validate input, call services, format output
|
|
187
|
+
|
|
188
|
+
## Error Handling
|
|
189
|
+
|
|
190
|
+
**Strategy:** Throw exceptions, catch at command level, log and exit
|
|
191
|
+
|
|
192
|
+
**Patterns:**
|
|
193
|
+
- Services throw Error with descriptive messages
|
|
194
|
+
- Command handlers catch, log error to stderr, exit(1)
|
|
195
|
+
- Validation errors shown before execution (fail fast)
|
|
196
|
+
|
|
197
|
+
## Cross-Cutting Concerns
|
|
198
|
+
|
|
199
|
+
**Logging:**
|
|
200
|
+
- Console.log for normal output
|
|
201
|
+
- Console.error for errors
|
|
202
|
+
- Chalk for colored output
|
|
203
|
+
|
|
204
|
+
**Validation:**
|
|
205
|
+
- Zod schemas for config file parsing
|
|
206
|
+
- Manual validation in command handlers
|
|
207
|
+
- Fail fast on invalid input
|
|
208
|
+
|
|
209
|
+
**File Operations:**
|
|
210
|
+
- FileService abstraction over fs-extra
|
|
211
|
+
- All paths validated before operations
|
|
212
|
+
- Atomic writes (temp file + rename)
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
*Architecture analysis: 2025-01-20*
|
|
217
|
+
*Update when major patterns change*
|
|
218
|
+
```
|
|
219
|
+
</good_examples>
|
|
220
|
+
|
|
221
|
+
<guidelines>
|
|
222
|
+
**What belongs in ARCHITECTURE.md:**
|
|
223
|
+
- Overall architectural pattern (monolith, microservices, layered, etc.)
|
|
224
|
+
- Conceptual layers and their relationships
|
|
225
|
+
- Data flow / request lifecycle
|
|
226
|
+
- Key abstractions and patterns
|
|
227
|
+
- Entry points
|
|
228
|
+
- Error handling strategy
|
|
229
|
+
- Cross-cutting concerns (logging, auth, validation)
|
|
230
|
+
|
|
231
|
+
**What does NOT belong here:**
|
|
232
|
+
- Specific file paths (that's STRUCTURE.md)
|
|
233
|
+
- Technology choices (that's STACK.md)
|
|
234
|
+
- Line-by-line code walkthrough (defer to code reading)
|
|
235
|
+
- Implementation details of specific features
|
|
236
|
+
|
|
237
|
+
**When filling this template:**
|
|
238
|
+
- Read main entry points (index, server, main)
|
|
239
|
+
- Identify layers by reading imports/dependencies
|
|
240
|
+
- Trace a typical request/command execution
|
|
241
|
+
- Note recurring patterns (services, controllers, repositories)
|
|
242
|
+
- Keep descriptions conceptual, not mechanical
|
|
243
|
+
|
|
244
|
+
**Useful for phase planning when:**
|
|
245
|
+
- Adding new features (where does it fit in the layers?)
|
|
246
|
+
- Refactoring (understanding current patterns)
|
|
247
|
+
- Identifying where to add code (which layer handles X?)
|
|
248
|
+
- Understanding dependencies between components
|
|
249
|
+
</guidelines>
|