gsd-opencode 1.3.31
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/bin/install.js +222 -0
- package/command/gsd/add-phase.md +207 -0
- package/command/gsd/complete-milestone.md +105 -0
- package/command/gsd/consider-issues.md +201 -0
- package/command/gsd/create-roadmap.md +115 -0
- package/command/gsd/discuss-milestone.md +47 -0
- package/command/gsd/discuss-phase.md +60 -0
- package/command/gsd/execute-plan.md +128 -0
- package/command/gsd/help.md +315 -0
- package/command/gsd/insert-phase.md +227 -0
- package/command/gsd/list-phase-assumptions.md +50 -0
- package/command/gsd/map-codebase.md +84 -0
- package/command/gsd/new-milestone.md +59 -0
- package/command/gsd/new-project.md +316 -0
- package/command/gsd/pause-work.md +122 -0
- package/command/gsd/plan-fix.md +205 -0
- package/command/gsd/plan-phase.md +67 -0
- package/command/gsd/progress.md +316 -0
- package/command/gsd/remove-phase.md +338 -0
- package/command/gsd/research-phase.md +91 -0
- package/command/gsd/resume-work.md +40 -0
- package/command/gsd/verify-work.md +71 -0
- package/get-shit-done/references/checkpoints.md +287 -0
- package/get-shit-done/references/continuation-format.md +255 -0
- package/get-shit-done/references/git-integration.md +254 -0
- package/get-shit-done/references/plan-format.md +428 -0
- package/get-shit-done/references/principles.md +157 -0
- package/get-shit-done/references/questioning.md +162 -0
- package/get-shit-done/references/research-pitfalls.md +215 -0
- package/get-shit-done/references/scope-estimation.md +172 -0
- package/get-shit-done/references/tdd.md +263 -0
- package/get-shit-done/templates/codebase/architecture.md +255 -0
- package/get-shit-done/templates/codebase/concerns.md +310 -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 +186 -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/templates/config.json +18 -0
- package/get-shit-done/templates/context.md +161 -0
- package/get-shit-done/templates/continue-here.md +78 -0
- package/get-shit-done/templates/discovery.md +146 -0
- package/get-shit-done/templates/issues.md +32 -0
- package/get-shit-done/templates/milestone-archive.md +123 -0
- package/get-shit-done/templates/milestone-context.md +93 -0
- package/get-shit-done/templates/milestone.md +115 -0
- package/get-shit-done/templates/phase-prompt.md +303 -0
- package/get-shit-done/templates/project.md +184 -0
- package/get-shit-done/templates/research.md +529 -0
- package/get-shit-done/templates/roadmap.md +196 -0
- package/get-shit-done/templates/state.md +210 -0
- package/get-shit-done/templates/summary.md +273 -0
- package/get-shit-done/templates/uat-issues.md +143 -0
- package/get-shit-done/workflows/complete-milestone.md +643 -0
- package/get-shit-done/workflows/create-milestone.md +416 -0
- package/get-shit-done/workflows/create-roadmap.md +481 -0
- package/get-shit-done/workflows/discovery-phase.md +293 -0
- package/get-shit-done/workflows/discuss-milestone.md +236 -0
- package/get-shit-done/workflows/discuss-phase.md +247 -0
- package/get-shit-done/workflows/execute-phase.md +1625 -0
- package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
- package/get-shit-done/workflows/map-codebase.md +434 -0
- package/get-shit-done/workflows/plan-phase.md +488 -0
- package/get-shit-done/workflows/research-phase.md +436 -0
- package/get-shit-done/workflows/resume-project.md +287 -0
- package/get-shit-done/workflows/transition.md +580 -0
- package/get-shit-done/workflows/verify-work.md +202 -0
- package/package.json +38 -0
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
# Research Template
|
|
2
|
+
|
|
3
|
+
Template for `.planning/phases/XX-name/{phase}-RESEARCH.md` - comprehensive ecosystem research before planning.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Document what Claude needs to know to implement a phase well - not just "which library" but "how do experts build this."
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## File Template
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
# Phase [X]: [Name] - Research
|
|
13
|
+
|
|
14
|
+
**Researched:** [date]
|
|
15
|
+
**Domain:** [primary technology/problem domain]
|
|
16
|
+
**Confidence:** [HIGH/MEDIUM/LOW]
|
|
17
|
+
|
|
18
|
+
<research_summary>
|
|
19
|
+
## Summary
|
|
20
|
+
|
|
21
|
+
[2-3 paragraph executive summary]
|
|
22
|
+
- What was researched
|
|
23
|
+
- What the standard approach is
|
|
24
|
+
- Key recommendations
|
|
25
|
+
|
|
26
|
+
**Primary recommendation:** [one-liner actionable guidance]
|
|
27
|
+
</research_summary>
|
|
28
|
+
|
|
29
|
+
<standard_stack>
|
|
30
|
+
## Standard Stack
|
|
31
|
+
|
|
32
|
+
The established libraries/tools for this domain:
|
|
33
|
+
|
|
34
|
+
### Core
|
|
35
|
+
| Library | Version | Purpose | Why Standard |
|
|
36
|
+
|---------|---------|---------|--------------|
|
|
37
|
+
| [name] | [ver] | [what it does] | [why experts use it] |
|
|
38
|
+
| [name] | [ver] | [what it does] | [why experts use it] |
|
|
39
|
+
|
|
40
|
+
### Supporting
|
|
41
|
+
| Library | Version | Purpose | When to Use |
|
|
42
|
+
|---------|---------|---------|-------------|
|
|
43
|
+
| [name] | [ver] | [what it does] | [use case] |
|
|
44
|
+
| [name] | [ver] | [what it does] | [use case] |
|
|
45
|
+
|
|
46
|
+
### Alternatives Considered
|
|
47
|
+
| Instead of | Could Use | Tradeoff |
|
|
48
|
+
|------------|-----------|----------|
|
|
49
|
+
| [standard] | [alternative] | [when alternative makes sense] |
|
|
50
|
+
|
|
51
|
+
**Installation:**
|
|
52
|
+
```bash
|
|
53
|
+
npm install [packages]
|
|
54
|
+
# or
|
|
55
|
+
yarn add [packages]
|
|
56
|
+
```
|
|
57
|
+
</standard_stack>
|
|
58
|
+
|
|
59
|
+
<architecture_patterns>
|
|
60
|
+
## Architecture Patterns
|
|
61
|
+
|
|
62
|
+
### Recommended Project Structure
|
|
63
|
+
```
|
|
64
|
+
src/
|
|
65
|
+
├── [folder]/ # [purpose]
|
|
66
|
+
├── [folder]/ # [purpose]
|
|
67
|
+
└── [folder]/ # [purpose]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Pattern 1: [Pattern Name]
|
|
71
|
+
**What:** [description]
|
|
72
|
+
**When to use:** [conditions]
|
|
73
|
+
**Example:**
|
|
74
|
+
```typescript
|
|
75
|
+
// [code example from Context7/official docs]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Pattern 2: [Pattern Name]
|
|
79
|
+
**What:** [description]
|
|
80
|
+
**When to use:** [conditions]
|
|
81
|
+
**Example:**
|
|
82
|
+
```typescript
|
|
83
|
+
// [code example]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Anti-Patterns to Avoid
|
|
87
|
+
- **[Anti-pattern]:** [why it's bad, what to do instead]
|
|
88
|
+
- **[Anti-pattern]:** [why it's bad, what to do instead]
|
|
89
|
+
</architecture_patterns>
|
|
90
|
+
|
|
91
|
+
<dont_hand_roll>
|
|
92
|
+
## Don't Hand-Roll
|
|
93
|
+
|
|
94
|
+
Problems that look simple but have existing solutions:
|
|
95
|
+
|
|
96
|
+
| Problem | Don't Build | Use Instead | Why |
|
|
97
|
+
|---------|-------------|-------------|-----|
|
|
98
|
+
| [problem] | [what you'd build] | [library] | [edge cases, complexity] |
|
|
99
|
+
| [problem] | [what you'd build] | [library] | [edge cases, complexity] |
|
|
100
|
+
| [problem] | [what you'd build] | [library] | [edge cases, complexity] |
|
|
101
|
+
|
|
102
|
+
**Key insight:** [why custom solutions are worse in this domain]
|
|
103
|
+
</dont_hand_roll>
|
|
104
|
+
|
|
105
|
+
<common_pitfalls>
|
|
106
|
+
## Common Pitfalls
|
|
107
|
+
|
|
108
|
+
### Pitfall 1: [Name]
|
|
109
|
+
**What goes wrong:** [description]
|
|
110
|
+
**Why it happens:** [root cause]
|
|
111
|
+
**How to avoid:** [prevention strategy]
|
|
112
|
+
**Warning signs:** [how to detect early]
|
|
113
|
+
|
|
114
|
+
### Pitfall 2: [Name]
|
|
115
|
+
**What goes wrong:** [description]
|
|
116
|
+
**Why it happens:** [root cause]
|
|
117
|
+
**How to avoid:** [prevention strategy]
|
|
118
|
+
**Warning signs:** [how to detect early]
|
|
119
|
+
|
|
120
|
+
### Pitfall 3: [Name]
|
|
121
|
+
**What goes wrong:** [description]
|
|
122
|
+
**Why it happens:** [root cause]
|
|
123
|
+
**How to avoid:** [prevention strategy]
|
|
124
|
+
**Warning signs:** [how to detect early]
|
|
125
|
+
</common_pitfalls>
|
|
126
|
+
|
|
127
|
+
<code_examples>
|
|
128
|
+
## Code Examples
|
|
129
|
+
|
|
130
|
+
Verified patterns from official sources:
|
|
131
|
+
|
|
132
|
+
### [Common Operation 1]
|
|
133
|
+
```typescript
|
|
134
|
+
// Source: [Context7/official docs URL]
|
|
135
|
+
[code]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### [Common Operation 2]
|
|
139
|
+
```typescript
|
|
140
|
+
// Source: [Context7/official docs URL]
|
|
141
|
+
[code]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### [Common Operation 3]
|
|
145
|
+
```typescript
|
|
146
|
+
// Source: [Context7/official docs URL]
|
|
147
|
+
[code]
|
|
148
|
+
```
|
|
149
|
+
</code_examples>
|
|
150
|
+
|
|
151
|
+
<sota_updates>
|
|
152
|
+
## State of the Art (2024-2025)
|
|
153
|
+
|
|
154
|
+
What's changed recently:
|
|
155
|
+
|
|
156
|
+
| Old Approach | Current Approach | When Changed | Impact |
|
|
157
|
+
|--------------|------------------|--------------|--------|
|
|
158
|
+
| [old] | [new] | [date/version] | [what it means for implementation] |
|
|
159
|
+
|
|
160
|
+
**New tools/patterns to consider:**
|
|
161
|
+
- [Tool/Pattern]: [what it enables, when to use]
|
|
162
|
+
- [Tool/Pattern]: [what it enables, when to use]
|
|
163
|
+
|
|
164
|
+
**Deprecated/outdated:**
|
|
165
|
+
- [Thing]: [why it's outdated, what replaced it]
|
|
166
|
+
</sota_updates>
|
|
167
|
+
|
|
168
|
+
<open_questions>
|
|
169
|
+
## Open Questions
|
|
170
|
+
|
|
171
|
+
Things that couldn't be fully resolved:
|
|
172
|
+
|
|
173
|
+
1. **[Question]**
|
|
174
|
+
- What we know: [partial info]
|
|
175
|
+
- What's unclear: [the gap]
|
|
176
|
+
- Recommendation: [how to handle during planning/execution]
|
|
177
|
+
|
|
178
|
+
2. **[Question]**
|
|
179
|
+
- What we know: [partial info]
|
|
180
|
+
- What's unclear: [the gap]
|
|
181
|
+
- Recommendation: [how to handle]
|
|
182
|
+
</open_questions>
|
|
183
|
+
|
|
184
|
+
<sources>
|
|
185
|
+
## Sources
|
|
186
|
+
|
|
187
|
+
### Primary (HIGH confidence)
|
|
188
|
+
- [Context7 library ID] - [topics fetched]
|
|
189
|
+
- [Official docs URL] - [what was checked]
|
|
190
|
+
|
|
191
|
+
### Secondary (MEDIUM confidence)
|
|
192
|
+
- [WebSearch verified with official source] - [finding + verification]
|
|
193
|
+
|
|
194
|
+
### Tertiary (LOW confidence - needs validation)
|
|
195
|
+
- [WebSearch only] - [finding, marked for validation during implementation]
|
|
196
|
+
</sources>
|
|
197
|
+
|
|
198
|
+
<metadata>
|
|
199
|
+
## Metadata
|
|
200
|
+
|
|
201
|
+
**Research scope:**
|
|
202
|
+
- Core technology: [what]
|
|
203
|
+
- Ecosystem: [libraries explored]
|
|
204
|
+
- Patterns: [patterns researched]
|
|
205
|
+
- Pitfalls: [areas checked]
|
|
206
|
+
|
|
207
|
+
**Confidence breakdown:**
|
|
208
|
+
- Standard stack: [HIGH/MEDIUM/LOW] - [reason]
|
|
209
|
+
- Architecture: [HIGH/MEDIUM/LOW] - [reason]
|
|
210
|
+
- Pitfalls: [HIGH/MEDIUM/LOW] - [reason]
|
|
211
|
+
- Code examples: [HIGH/MEDIUM/LOW] - [reason]
|
|
212
|
+
|
|
213
|
+
**Research date:** [date]
|
|
214
|
+
**Valid until:** [estimate - 30 days for stable tech, 7 days for fast-moving]
|
|
215
|
+
</metadata>
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
*Phase: XX-name*
|
|
220
|
+
*Research completed: [date]*
|
|
221
|
+
*Ready for planning: [yes/no]*
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Good Example
|
|
227
|
+
|
|
228
|
+
```markdown
|
|
229
|
+
# Phase 3: 3D City Driving - Research
|
|
230
|
+
|
|
231
|
+
**Researched:** 2025-01-20
|
|
232
|
+
**Domain:** Three.js 3D web game with driving mechanics
|
|
233
|
+
**Confidence:** HIGH
|
|
234
|
+
|
|
235
|
+
<research_summary>
|
|
236
|
+
## Summary
|
|
237
|
+
|
|
238
|
+
Researched the Three.js ecosystem for building a 3D city driving game. The standard approach uses Three.js with React Three Fiber for component architecture, Rapier for physics, and drei for common helpers.
|
|
239
|
+
|
|
240
|
+
Key finding: Don't hand-roll physics or collision detection. Rapier (via @react-three/rapier) handles vehicle physics, terrain collision, and city object interactions efficiently. Custom physics code leads to bugs and performance issues.
|
|
241
|
+
|
|
242
|
+
**Primary recommendation:** Use R3F + Rapier + drei stack. Start with vehicle controller from drei, add Rapier vehicle physics, build city with instanced meshes for performance.
|
|
243
|
+
</research_summary>
|
|
244
|
+
|
|
245
|
+
<standard_stack>
|
|
246
|
+
## Standard Stack
|
|
247
|
+
|
|
248
|
+
### Core
|
|
249
|
+
| Library | Version | Purpose | Why Standard |
|
|
250
|
+
|---------|---------|---------|--------------|
|
|
251
|
+
| three | 0.160.0 | 3D rendering | The standard for web 3D |
|
|
252
|
+
| @react-three/fiber | 8.15.0 | React renderer for Three.js | Declarative 3D, better DX |
|
|
253
|
+
| @react-three/drei | 9.92.0 | Helpers and abstractions | Solves common problems |
|
|
254
|
+
| @react-three/rapier | 1.2.1 | Physics engine bindings | Best physics for R3F |
|
|
255
|
+
|
|
256
|
+
### Supporting
|
|
257
|
+
| Library | Version | Purpose | When to Use |
|
|
258
|
+
|---------|---------|---------|-------------|
|
|
259
|
+
| @react-three/postprocessing | 2.16.0 | Visual effects | Bloom, DOF, motion blur |
|
|
260
|
+
| leva | 0.9.35 | Debug UI | Tweaking parameters |
|
|
261
|
+
| zustand | 4.4.7 | State management | Game state, UI state |
|
|
262
|
+
| use-sound | 4.0.1 | Audio | Engine sounds, ambient |
|
|
263
|
+
|
|
264
|
+
### Alternatives Considered
|
|
265
|
+
| Instead of | Could Use | Tradeoff |
|
|
266
|
+
|------------|-----------|----------|
|
|
267
|
+
| Rapier | Cannon.js | Cannon simpler but less performant for vehicles |
|
|
268
|
+
| R3F | Vanilla Three | Vanilla if no React, but R3F DX is much better |
|
|
269
|
+
| drei | Custom helpers | drei is battle-tested, don't reinvent |
|
|
270
|
+
|
|
271
|
+
**Installation:**
|
|
272
|
+
```bash
|
|
273
|
+
npm install three @react-three/fiber @react-three/drei @react-three/rapier zustand
|
|
274
|
+
```
|
|
275
|
+
</standard_stack>
|
|
276
|
+
|
|
277
|
+
<architecture_patterns>
|
|
278
|
+
## Architecture Patterns
|
|
279
|
+
|
|
280
|
+
### Recommended Project Structure
|
|
281
|
+
```
|
|
282
|
+
src/
|
|
283
|
+
├── components/
|
|
284
|
+
│ ├── Vehicle/ # Player car with physics
|
|
285
|
+
│ ├── City/ # City generation and buildings
|
|
286
|
+
│ ├── Road/ # Road network
|
|
287
|
+
│ └── Environment/ # Sky, lighting, fog
|
|
288
|
+
├── hooks/
|
|
289
|
+
│ ├── useVehicleControls.ts
|
|
290
|
+
│ └── useGameState.ts
|
|
291
|
+
├── stores/
|
|
292
|
+
│ └── gameStore.ts # Zustand state
|
|
293
|
+
└── utils/
|
|
294
|
+
└── cityGenerator.ts # Procedural generation helpers
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Pattern 1: Vehicle with Rapier Physics
|
|
298
|
+
**What:** Use RigidBody with vehicle-specific settings, not custom physics
|
|
299
|
+
**When to use:** Any ground vehicle
|
|
300
|
+
**Example:**
|
|
301
|
+
```typescript
|
|
302
|
+
// Source: @react-three/rapier docs
|
|
303
|
+
import { RigidBody, useRapier } from '@react-three/rapier'
|
|
304
|
+
|
|
305
|
+
function Vehicle() {
|
|
306
|
+
const rigidBody = useRef()
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<RigidBody
|
|
310
|
+
ref={rigidBody}
|
|
311
|
+
type="dynamic"
|
|
312
|
+
colliders="hull"
|
|
313
|
+
mass={1500}
|
|
314
|
+
linearDamping={0.5}
|
|
315
|
+
angularDamping={0.5}
|
|
316
|
+
>
|
|
317
|
+
<mesh>
|
|
318
|
+
<boxGeometry args={[2, 1, 4]} />
|
|
319
|
+
<meshStandardMaterial />
|
|
320
|
+
</mesh>
|
|
321
|
+
</RigidBody>
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Pattern 2: Instanced Meshes for City
|
|
327
|
+
**What:** Use InstancedMesh for repeated objects (buildings, trees, props)
|
|
328
|
+
**When to use:** >100 similar objects
|
|
329
|
+
**Example:**
|
|
330
|
+
```typescript
|
|
331
|
+
// Source: drei docs
|
|
332
|
+
import { Instances, Instance } from '@react-three/drei'
|
|
333
|
+
|
|
334
|
+
function Buildings({ positions }) {
|
|
335
|
+
return (
|
|
336
|
+
<Instances limit={1000}>
|
|
337
|
+
<boxGeometry />
|
|
338
|
+
<meshStandardMaterial />
|
|
339
|
+
{positions.map((pos, i) => (
|
|
340
|
+
<Instance key={i} position={pos} scale={[1, Math.random() * 5 + 1, 1]} />
|
|
341
|
+
))}
|
|
342
|
+
</Instances>
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Anti-Patterns to Avoid
|
|
348
|
+
- **Creating meshes in render loop:** Create once, update transforms only
|
|
349
|
+
- **Not using InstancedMesh:** Individual meshes for buildings kills performance
|
|
350
|
+
- **Custom physics math:** Rapier handles it better, every time
|
|
351
|
+
</architecture_patterns>
|
|
352
|
+
|
|
353
|
+
<dont_hand_roll>
|
|
354
|
+
## Don't Hand-Roll
|
|
355
|
+
|
|
356
|
+
| Problem | Don't Build | Use Instead | Why |
|
|
357
|
+
|---------|-------------|-------------|-----|
|
|
358
|
+
| Vehicle physics | Custom velocity/acceleration | Rapier RigidBody | Wheel friction, suspension, collisions are complex |
|
|
359
|
+
| Collision detection | Raycasting everything | Rapier colliders | Performance, edge cases, tunneling |
|
|
360
|
+
| Camera follow | Manual lerp | drei CameraControls or custom with useFrame | Smooth interpolation, bounds |
|
|
361
|
+
| City generation | Pure random placement | Grid-based with noise for variation | Random looks wrong, grid is predictable |
|
|
362
|
+
| LOD | Manual distance checks | drei <Detailed> | Handles transitions, hysteresis |
|
|
363
|
+
|
|
364
|
+
**Key insight:** 3D game development has 40+ years of solved problems. Rapier implements proper physics simulation. drei implements proper 3D helpers. Fighting these leads to bugs that look like "game feel" issues but are actually physics edge cases.
|
|
365
|
+
</dont_hand_roll>
|
|
366
|
+
|
|
367
|
+
<common_pitfalls>
|
|
368
|
+
## Common Pitfalls
|
|
369
|
+
|
|
370
|
+
### Pitfall 1: Physics Tunneling
|
|
371
|
+
**What goes wrong:** Fast objects pass through walls
|
|
372
|
+
**Why it happens:** Default physics step too large for velocity
|
|
373
|
+
**How to avoid:** Use CCD (Continuous Collision Detection) in Rapier
|
|
374
|
+
**Warning signs:** Objects randomly appearing outside buildings
|
|
375
|
+
|
|
376
|
+
### Pitfall 2: Performance Death by Draw Calls
|
|
377
|
+
**What goes wrong:** Game stutters with many buildings
|
|
378
|
+
**Why it happens:** Each mesh = 1 draw call, hundreds of buildings = hundreds of calls
|
|
379
|
+
**How to avoid:** InstancedMesh for similar objects, merge static geometry
|
|
380
|
+
**Warning signs:** GPU bound, low FPS despite simple scene
|
|
381
|
+
|
|
382
|
+
### Pitfall 3: Vehicle "Floaty" Feel
|
|
383
|
+
**What goes wrong:** Car doesn't feel grounded
|
|
384
|
+
**Why it happens:** Missing proper wheel/suspension simulation
|
|
385
|
+
**How to avoid:** Use Rapier vehicle controller or tune mass/damping carefully
|
|
386
|
+
**Warning signs:** Car bounces oddly, doesn't grip corners
|
|
387
|
+
</common_pitfalls>
|
|
388
|
+
|
|
389
|
+
<code_examples>
|
|
390
|
+
## Code Examples
|
|
391
|
+
|
|
392
|
+
### Basic R3F + Rapier Setup
|
|
393
|
+
```typescript
|
|
394
|
+
// Source: @react-three/rapier getting started
|
|
395
|
+
import { Canvas } from '@react-three/fiber'
|
|
396
|
+
import { Physics } from '@react-three/rapier'
|
|
397
|
+
|
|
398
|
+
function Game() {
|
|
399
|
+
return (
|
|
400
|
+
<Canvas>
|
|
401
|
+
<Physics gravity={[0, -9.81, 0]}>
|
|
402
|
+
<Vehicle />
|
|
403
|
+
<City />
|
|
404
|
+
<Ground />
|
|
405
|
+
</Physics>
|
|
406
|
+
</Canvas>
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### Vehicle Controls Hook
|
|
412
|
+
```typescript
|
|
413
|
+
// Source: Community pattern, verified with drei docs
|
|
414
|
+
import { useFrame } from '@react-three/fiber'
|
|
415
|
+
import { useKeyboardControls } from '@react-three/drei'
|
|
416
|
+
|
|
417
|
+
function useVehicleControls(rigidBodyRef) {
|
|
418
|
+
const [, getKeys] = useKeyboardControls()
|
|
419
|
+
|
|
420
|
+
useFrame(() => {
|
|
421
|
+
const { forward, back, left, right } = getKeys()
|
|
422
|
+
const body = rigidBodyRef.current
|
|
423
|
+
if (!body) return
|
|
424
|
+
|
|
425
|
+
const impulse = { x: 0, y: 0, z: 0 }
|
|
426
|
+
if (forward) impulse.z -= 10
|
|
427
|
+
if (back) impulse.z += 5
|
|
428
|
+
|
|
429
|
+
body.applyImpulse(impulse, true)
|
|
430
|
+
|
|
431
|
+
if (left) body.applyTorqueImpulse({ x: 0, y: 2, z: 0 }, true)
|
|
432
|
+
if (right) body.applyTorqueImpulse({ x: 0, y: -2, z: 0 }, true)
|
|
433
|
+
})
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
</code_examples>
|
|
437
|
+
|
|
438
|
+
<sota_updates>
|
|
439
|
+
## State of the Art (2024-2025)
|
|
440
|
+
|
|
441
|
+
| Old Approach | Current Approach | When Changed | Impact |
|
|
442
|
+
|--------------|------------------|--------------|--------|
|
|
443
|
+
| cannon-es | Rapier | 2023 | Rapier is faster, better maintained |
|
|
444
|
+
| vanilla Three.js | React Three Fiber | 2020+ | R3F is now standard for React apps |
|
|
445
|
+
| Manual InstancedMesh | drei <Instances> | 2022 | Simpler API, handles updates |
|
|
446
|
+
|
|
447
|
+
**New tools/patterns to consider:**
|
|
448
|
+
- **WebGPU:** Coming but not production-ready for games yet (2025)
|
|
449
|
+
- **drei Gltf helpers:** <useGLTF.preload> for loading screens
|
|
450
|
+
|
|
451
|
+
**Deprecated/outdated:**
|
|
452
|
+
- **cannon.js (original):** Use cannon-es fork or better, Rapier
|
|
453
|
+
- **Manual raycasting for physics:** Just use Rapier colliders
|
|
454
|
+
</sota_updates>
|
|
455
|
+
|
|
456
|
+
<sources>
|
|
457
|
+
## Sources
|
|
458
|
+
|
|
459
|
+
### Primary (HIGH confidence)
|
|
460
|
+
- /pmndrs/react-three-fiber - getting started, hooks, performance
|
|
461
|
+
- /pmndrs/drei - instances, controls, helpers
|
|
462
|
+
- /dimforge/rapier-js - physics setup, vehicle physics
|
|
463
|
+
|
|
464
|
+
### Secondary (MEDIUM confidence)
|
|
465
|
+
- Three.js discourse "city driving game" threads - verified patterns against docs
|
|
466
|
+
- R3F examples repository - verified code works
|
|
467
|
+
|
|
468
|
+
### Tertiary (LOW confidence - needs validation)
|
|
469
|
+
- None - all findings verified
|
|
470
|
+
</sources>
|
|
471
|
+
|
|
472
|
+
<metadata>
|
|
473
|
+
## Metadata
|
|
474
|
+
|
|
475
|
+
**Research scope:**
|
|
476
|
+
- Core technology: Three.js + React Three Fiber
|
|
477
|
+
- Ecosystem: Rapier, drei, zustand
|
|
478
|
+
- Patterns: Vehicle physics, instancing, city generation
|
|
479
|
+
- Pitfalls: Performance, physics, feel
|
|
480
|
+
|
|
481
|
+
**Confidence breakdown:**
|
|
482
|
+
- Standard stack: HIGH - verified with Context7, widely used
|
|
483
|
+
- Architecture: HIGH - from official examples
|
|
484
|
+
- Pitfalls: HIGH - documented in discourse, verified in docs
|
|
485
|
+
- Code examples: HIGH - from Context7/official sources
|
|
486
|
+
|
|
487
|
+
**Research date:** 2025-01-20
|
|
488
|
+
**Valid until:** 2025-02-20 (30 days - R3F ecosystem stable)
|
|
489
|
+
</metadata>
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
*Phase: 03-city-driving*
|
|
494
|
+
*Research completed: 2025-01-20*
|
|
495
|
+
*Ready for planning: yes*
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## Guidelines
|
|
501
|
+
|
|
502
|
+
**When to create:**
|
|
503
|
+
- Before planning phases in niche/complex domains
|
|
504
|
+
- When Claude's training data is likely stale or sparse
|
|
505
|
+
- When "how do experts do this" matters more than "which library"
|
|
506
|
+
|
|
507
|
+
**Structure:**
|
|
508
|
+
- Use XML tags for section markers (matches GSD templates)
|
|
509
|
+
- Seven core sections: summary, standard_stack, architecture_patterns, dont_hand_roll, common_pitfalls, code_examples, sources
|
|
510
|
+
- All sections required (drives comprehensive research)
|
|
511
|
+
|
|
512
|
+
**Content quality:**
|
|
513
|
+
- Standard stack: Specific versions, not just names
|
|
514
|
+
- Architecture: Include actual code examples from authoritative sources
|
|
515
|
+
- Don't hand-roll: Be explicit about what problems to NOT solve yourself
|
|
516
|
+
- Pitfalls: Include warning signs, not just "don't do this"
|
|
517
|
+
- Sources: Mark confidence levels honestly
|
|
518
|
+
|
|
519
|
+
**Integration with planning:**
|
|
520
|
+
- RESEARCH.md loaded as @context reference in PLAN.md
|
|
521
|
+
- Standard stack informs library choices
|
|
522
|
+
- Don't hand-roll prevents custom solutions
|
|
523
|
+
- Pitfalls inform verification criteria
|
|
524
|
+
- Code examples can be referenced in task actions
|
|
525
|
+
|
|
526
|
+
**After creation:**
|
|
527
|
+
- File lives in phase directory: `.planning/phases/XX-name/{phase}-RESEARCH.md`
|
|
528
|
+
- Referenced during planning workflow
|
|
529
|
+
- plan-phase loads it automatically when present
|