@hustle-together/api-dev-tools 3.6.5 → 3.10.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.
- package/README.md +5599 -258
- package/bin/cli.js +395 -20
- package/commands/README.md +459 -71
- package/commands/hustle-api-continue.md +158 -0
- package/commands/{api-create.md → hustle-api-create.md} +35 -15
- package/commands/{api-env.md → hustle-api-env.md} +4 -4
- package/commands/{api-interview.md → hustle-api-interview.md} +1 -1
- package/commands/{api-research.md → hustle-api-research.md} +3 -3
- package/commands/hustle-api-sessions.md +149 -0
- package/commands/{api-status.md → hustle-api-status.md} +16 -16
- package/commands/{api-verify.md → hustle-api-verify.md} +2 -2
- package/commands/hustle-combine.md +763 -0
- package/commands/hustle-ui-create-page.md +933 -0
- package/commands/hustle-ui-create.md +825 -0
- package/hooks/api-workflow-check.py +545 -21
- package/hooks/cache-research.py +337 -0
- package/hooks/check-api-routes.py +168 -0
- package/hooks/check-playwright-setup.py +103 -0
- package/hooks/check-storybook-setup.py +81 -0
- package/hooks/detect-interruption.py +165 -0
- package/hooks/enforce-a11y-audit.py +202 -0
- package/hooks/enforce-brand-guide.py +241 -0
- package/hooks/enforce-documentation.py +60 -8
- package/hooks/enforce-freshness.py +184 -0
- package/hooks/enforce-page-components.py +186 -0
- package/hooks/enforce-page-data-schema.py +155 -0
- package/hooks/enforce-questions-sourced.py +146 -0
- package/hooks/enforce-schema-from-interview.py +248 -0
- package/hooks/enforce-ui-disambiguation.py +108 -0
- package/hooks/enforce-ui-interview.py +130 -0
- package/hooks/generate-manifest-entry.py +1161 -0
- package/hooks/session-logger.py +297 -0
- package/hooks/session-startup.py +160 -15
- package/hooks/track-scope-coverage.py +220 -0
- package/hooks/track-tool-use.py +81 -1
- package/hooks/update-api-showcase.py +149 -0
- package/hooks/update-registry.py +352 -0
- package/hooks/update-ui-showcase.py +212 -0
- package/package.json +8 -3
- package/templates/BRAND_GUIDE.md +299 -0
- package/templates/CLAUDE-SECTION.md +56 -24
- package/templates/SPEC.json +640 -0
- package/templates/api-dev-state.json +217 -161
- package/templates/api-showcase/_components/APICard.tsx +153 -0
- package/templates/api-showcase/_components/APIModal.tsx +375 -0
- package/templates/api-showcase/_components/APIShowcase.tsx +231 -0
- package/templates/api-showcase/_components/APITester.tsx +522 -0
- package/templates/api-showcase/page.tsx +41 -0
- package/templates/component/Component.stories.tsx +172 -0
- package/templates/component/Component.test.tsx +237 -0
- package/templates/component/Component.tsx +86 -0
- package/templates/component/Component.types.ts +55 -0
- package/templates/component/index.ts +15 -0
- package/templates/dev-tools/_components/DevToolsLanding.tsx +320 -0
- package/templates/dev-tools/page.tsx +10 -0
- package/templates/page/page.e2e.test.ts +218 -0
- package/templates/page/page.tsx +42 -0
- package/templates/performance-budgets.json +58 -0
- package/templates/registry.json +13 -0
- package/templates/settings.json +90 -0
- package/templates/shared/HeroHeader.tsx +261 -0
- package/templates/shared/index.ts +1 -0
- package/templates/ui-showcase/_components/PreviewCard.tsx +315 -0
- package/templates/ui-showcase/_components/PreviewModal.tsx +676 -0
- package/templates/ui-showcase/_components/UIShowcase.tsx +262 -0
- package/templates/ui-showcase/page.tsx +26 -0
- package/demo/hustle-together/blog/gemini-vs-claude-widgets.html +0 -959
- package/demo/hustle-together/blog/interview-driven-api-development.html +0 -1146
- package/demo/hustle-together/blog/tdd-for-ai.html +0 -982
- package/demo/hustle-together/index.html +0 -1312
- package/demo/workflow-demo-v3.5-backup.html +0 -5008
- package/demo/workflow-demo.html +0 -6202
package/commands/README.md
CHANGED
|
@@ -1,64 +1,157 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Hustle Development Slash Commands v3.9.0
|
|
2
2
|
|
|
3
|
-
**Interview-driven, research-first API development workflow with continuous verification loops**
|
|
3
|
+
**Interview-driven, research-first API and UI development workflow with continuous verification loops**
|
|
4
4
|
|
|
5
|
-
## What's New in v3.0
|
|
5
|
+
## What's New in v3.9.0
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
7
|
+
- **`/hustle-ui-create`** - Create UI components and pages with 13-phase workflow
|
|
8
|
+
- **UI Showcase** - Auto-generated grid view with modal preview for all components/pages
|
|
9
|
+
- **API Showcase** - Auto-generated grid with interactive "Try It" API testing
|
|
10
|
+
- **Brand Guide** - Default `.claude/BRAND_GUIDE.md` template installed
|
|
11
|
+
- **Performance Budgets** - TDD gates for memory, re-renders, Core Web Vitals (tests FAIL if exceeded)
|
|
12
|
+
- **ShadCN Detection** - Phase 5 checks `src/components/ui/` for existing components
|
|
13
|
+
- **4-Step Verification** - Desktop/tablet/mobile + brand + tests + memory/re-renders
|
|
14
|
+
- **33 Enforcement Hooks** - Includes 6 new UI-specific hooks
|
|
13
15
|
|
|
14
|
-
##
|
|
16
|
+
## What's in v3.8.0
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
- **`/hustle-combine`** - Combine existing APIs into orchestration endpoints
|
|
19
|
+
- **Central Registry** - `.claude/registry.json` tracks all APIs, components, pages
|
|
20
|
+
- **Auto-Registry Update** - Registry populated when workflows complete
|
|
21
|
+
- **27 Enforcement Hooks** - Includes new `update-registry.py`
|
|
22
|
+
|
|
23
|
+
## What's in v3.7.0
|
|
24
|
+
|
|
25
|
+
- **Hustle Branding** - All API commands renamed to `/hustle-api-*` prefix
|
|
26
|
+
- **Session Logging** - Every workflow saved to `.claude/api-sessions/`
|
|
27
|
+
- **Session Continuation** - `/hustle-api-continue` to resume interrupted workflows
|
|
28
|
+
- **Multi-API Support** - State file supports multiple concurrent APIs
|
|
29
|
+
- **Comprehensive Manifest Generation** - Auto-generated curl examples, test cases, documentation
|
|
30
|
+
- **26 Enforcement Hooks** - Full phase-by-phase enforcement (including freshness enforcement)
|
|
31
|
+
- **Scope Tracking** - Track implemented vs deferred features
|
|
32
|
+
- **Research Cache Creation** - Automatic `sources.json`, `interview.json`, `schema.json`
|
|
33
|
+
|
|
34
|
+
## Hook Architecture (33 Hooks)
|
|
35
|
+
|
|
36
|
+
### SessionStart (2 hooks)
|
|
37
|
+
| Hook | Purpose |
|
|
38
|
+
|------|---------|
|
|
39
|
+
| `session-startup.py` | Inject state at session start |
|
|
40
|
+
| `detect-interruption.py` | Detect interrupted workflows, prompt resume |
|
|
41
|
+
|
|
42
|
+
### UserPromptSubmit (1 hook)
|
|
43
|
+
| Hook | Purpose |
|
|
44
|
+
|------|---------|
|
|
45
|
+
| `enforce-external-research.py` | Detect API terms, require research |
|
|
46
|
+
|
|
47
|
+
### PreToolUse - Write/Edit (21 hooks)
|
|
48
|
+
|
|
49
|
+
**API Workflow Hooks (15)**
|
|
50
|
+
| Hook | Phase | Purpose |
|
|
51
|
+
|------|-------|---------|
|
|
52
|
+
| `enforce-disambiguation.py` | 1 | Block until disambiguation complete |
|
|
53
|
+
| `enforce-scope.py` | 2 | Block until scope confirmed |
|
|
54
|
+
| `enforce-research.py` | 3 | Block writes until research done |
|
|
55
|
+
| `enforce-interview.py` | 4 | Inject interview decisions |
|
|
56
|
+
| `enforce-deep-research.py` | 5 | Block until deep research complete |
|
|
57
|
+
| `enforce-schema.py` | 6 | Block until schema created |
|
|
58
|
+
| `enforce-environment.py` | 7 | Block until environment verified |
|
|
59
|
+
| `enforce-tdd-red.py` | 8 | Block implementation until tests exist |
|
|
60
|
+
| `verify-implementation.py` | 9 | Require test file before route |
|
|
61
|
+
| `enforce-verify.py` | 10 | Block until verification complete |
|
|
62
|
+
| `enforce-refactor.py` | 11 | Block until refactor phase |
|
|
63
|
+
| `enforce-documentation.py` | 12 | Block until docs updated |
|
|
64
|
+
| `enforce-questions-sourced.py` | 4 | Validate questions come from research |
|
|
65
|
+
| `enforce-schema-from-interview.py` | 6 | Validate schema matches interview |
|
|
66
|
+
| `enforce-freshness.py` | * | Block if research >7 days old for active endpoint |
|
|
67
|
+
|
|
68
|
+
**UI Workflow Hooks (6)** *(NEW in v3.9.0)*
|
|
69
|
+
| Hook | Phase | Purpose |
|
|
17
70
|
|------|-------|---------|
|
|
18
|
-
| `
|
|
19
|
-
| `enforce-
|
|
20
|
-
| `enforce-
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
|
71
|
+
| `enforce-ui-disambiguation.py` | 1 | Block until component/page type clarified |
|
|
72
|
+
| `enforce-brand-guide.py` | 3 | Inject brand guide during implementation |
|
|
73
|
+
| `enforce-ui-interview.py` | 4 | Inject UI interview decisions |
|
|
74
|
+
| `check-storybook-setup.py` | 7 | Verify Storybook is configured |
|
|
75
|
+
| `check-playwright-setup.py` | 7 | Verify Playwright for pages |
|
|
76
|
+
| `update-ui-showcase.py` | 13 | Auto-create UI Showcase page |
|
|
77
|
+
|
|
78
|
+
### PostToolUse (7 hooks)
|
|
79
|
+
| Hook | Matcher | Purpose |
|
|
80
|
+
|------|---------|---------|
|
|
81
|
+
| `track-tool-use.py` | WebSearch/mcp__context7 | Log research, count turns |
|
|
82
|
+
| `periodic-reground.py` | WebSearch/mcp__context7 | Re-ground every 7 turns |
|
|
83
|
+
| `track-scope-coverage.py` | WebSearch/mcp__context7 | Track implemented vs deferred |
|
|
84
|
+
| `verify-after-green.py` | Bash | Trigger Phase 10 after test pass |
|
|
85
|
+
| `cache-research.py` | Write/Edit | Create research cache files |
|
|
86
|
+
| `generate-manifest-entry.py` | Write/Edit | Auto-generate API documentation |
|
|
87
|
+
| `update-registry.py` | Write/Edit | Update registry.json on workflow completion |
|
|
88
|
+
|
|
89
|
+
### Stop (2 hooks)
|
|
90
|
+
| Hook | Purpose |
|
|
91
|
+
|------|---------|
|
|
92
|
+
| `api-workflow-check.py` | Block if phases incomplete, generate output |
|
|
93
|
+
| `session-logger.py` | Save session to `.claude/api-sessions/` |
|
|
27
94
|
|
|
28
95
|
## Available Commands
|
|
29
96
|
|
|
30
|
-
### Complete
|
|
97
|
+
### Complete Workflows
|
|
31
98
|
|
|
32
|
-
**`/api-create [endpoint-name]`**
|
|
33
|
-
- Runs all 13 phases
|
|
99
|
+
**`/hustle-api-create [endpoint-name]`**
|
|
100
|
+
- Runs all 13 phases for NEW API development
|
|
34
101
|
- Loop-back architecture at every checkpoint
|
|
35
|
-
- See [api-create.md](api-create.md) for full flow
|
|
102
|
+
- See [hustle-api-create.md](hustle-api-create.md) for full flow
|
|
103
|
+
|
|
104
|
+
**`/hustle-ui-create`** *(NEW in v3.9.0)*
|
|
105
|
+
- Creates UI components OR pages with 13-phase workflow
|
|
106
|
+
- Mode selection: Component (Storybook) or Page (Playwright E2E)
|
|
107
|
+
- ShadCN detection and brand guide integration
|
|
108
|
+
- 4-step verification: responsive + brand + tests + memory
|
|
109
|
+
- Auto-adds to UI Showcase at `/ui-showcase`
|
|
110
|
+
- See [hustle-ui-create.md](hustle-ui-create.md) for full flow
|
|
111
|
+
|
|
112
|
+
**`/hustle-combine [api|ui]`** (v3.8.0)
|
|
113
|
+
- Combines EXISTING APIs or UI elements from registry
|
|
114
|
+
- Reads from `.claude/registry.json` to present available elements
|
|
115
|
+
- Creates orchestration endpoints
|
|
116
|
+
- See [hustle-combine.md](hustle-combine.md) for full flow
|
|
36
117
|
|
|
37
118
|
### Individual Phases
|
|
38
119
|
|
|
39
|
-
**`/api-interview [endpoint-name]`**
|
|
120
|
+
**`/hustle-api-interview [endpoint-name]`**
|
|
40
121
|
- Questions GENERATED from research findings
|
|
41
122
|
- Different question types: enum, continuous, boolean
|
|
42
|
-
- See [api-interview.md](api-interview.md)
|
|
123
|
+
- See [hustle-api-interview.md](hustle-api-interview.md)
|
|
43
124
|
|
|
44
|
-
**`/api-research [library-or-service]`**
|
|
125
|
+
**`/hustle-api-research [library-or-service]`**
|
|
45
126
|
- Adaptive propose-approve flow (not shotgun)
|
|
46
127
|
- Research cached with 7-day freshness
|
|
47
|
-
- See [api-research.md](api-research.md)
|
|
128
|
+
- See [hustle-api-research.md](hustle-api-research.md)
|
|
48
129
|
|
|
49
|
-
**`/api-verify [endpoint-name]`**
|
|
130
|
+
**`/hustle-api-verify [endpoint-name]`**
|
|
50
131
|
- Manual Phase 10 verification
|
|
51
132
|
- Re-read docs, compare to implementation
|
|
52
133
|
- Report gaps, loop back or document omissions
|
|
53
|
-
- See [api-verify.md](api-verify.md)
|
|
134
|
+
- See [hustle-api-verify.md](hustle-api-verify.md)
|
|
54
135
|
|
|
55
|
-
**`/api-env [endpoint-name]`**
|
|
136
|
+
**`/hustle-api-env [endpoint-name]`**
|
|
56
137
|
- Check API keys and environment
|
|
57
|
-
- See [api-env.md](api-env.md)
|
|
138
|
+
- See [hustle-api-env.md](hustle-api-env.md)
|
|
58
139
|
|
|
59
|
-
**`/api-status [endpoint-name]`**
|
|
140
|
+
**`/hustle-api-status [endpoint-name]`**
|
|
60
141
|
- Track progress through 13 phases
|
|
61
|
-
- See [api-status.md](api-status.md)
|
|
142
|
+
- See [hustle-api-status.md](hustle-api-status.md)
|
|
143
|
+
|
|
144
|
+
### Session Management
|
|
145
|
+
|
|
146
|
+
**`/hustle-api-continue [endpoint-name]`**
|
|
147
|
+
- Resume interrupted workflow from last completed phase
|
|
148
|
+
- Auto-detects in-progress endpoints
|
|
149
|
+
- See [hustle-api-continue.md](hustle-api-continue.md)
|
|
150
|
+
|
|
151
|
+
**`/hustle-api-sessions [--list|--view|--export]`**
|
|
152
|
+
- Browse saved session logs
|
|
153
|
+
- Export to PDF/HTML
|
|
154
|
+
- See [hustle-api-sessions.md](hustle-api-sessions.md)
|
|
62
155
|
|
|
63
156
|
### TDD Commands
|
|
64
157
|
|
|
@@ -66,9 +159,9 @@ From [@wbern/claude-instructions](https://github.com/wbern/claude-instructions):
|
|
|
66
159
|
- `/red` - Write ONE failing test
|
|
67
160
|
- `/green` - Minimal implementation to pass
|
|
68
161
|
- `/refactor` - Clean up while tests pass
|
|
69
|
-
- `/cycle [description]` - Full Red
|
|
162
|
+
- `/cycle [description]` - Full Red -> Green -> Refactor
|
|
70
163
|
|
|
71
|
-
## 13-Phase Flow
|
|
164
|
+
## 13-Phase Flow (API)
|
|
72
165
|
|
|
73
166
|
```
|
|
74
167
|
Phase 1: DISAMBIGUATION - Clarify ambiguous terms
|
|
@@ -86,32 +179,218 @@ Phase 12: DOCUMENTATION - Update manifests
|
|
|
86
179
|
Phase 13: COMPLETION - Final verification
|
|
87
180
|
```
|
|
88
181
|
|
|
182
|
+
## 13-Phase Flow (UI) *(NEW in v3.9.0)*
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
Phase 1: DISAMBIGUATION - Component type (atom/molecule/organism) or Page type
|
|
186
|
+
Phase 2: SCOPE - Confirm component/page purpose
|
|
187
|
+
Phase 3: DESIGN RESEARCH - Search patterns, ask "Use brand guide?"
|
|
188
|
+
Phase 4: INTERVIEW - Props, variants, accessibility, data fetching
|
|
189
|
+
Phase 5: COMPONENT ANALYSIS - Check src/components/ui/ for ShadCN components
|
|
190
|
+
Phase 6: PROPS SCHEMA - TypeScript interface from interview
|
|
191
|
+
Phase 7: ENVIRONMENT - Storybook (component) or Playwright (page) check
|
|
192
|
+
Phase 8: TDD RED - Story + tests (component) or E2E tests (page) - FAILING
|
|
193
|
+
Phase 9: TDD GREEN - Implement until tests PASS
|
|
194
|
+
Phase 10: VERIFY - 4-STEP: Responsive + brand + tests + memory
|
|
195
|
+
Phase 11: TDD REFACTOR - Extract hooks, optimize re-renders
|
|
196
|
+
Phase 12: DOCUMENTATION - Storybook autodocs, registry entry
|
|
197
|
+
Phase 13: COMPLETION - Output files, UI Showcase link
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 4-Step Verification (UI)
|
|
201
|
+
|
|
202
|
+
Every component/page must pass ALL 4 checks:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
Step 1: Responsive Check
|
|
206
|
+
- Desktop (1920px)
|
|
207
|
+
- Tablet (768px)
|
|
208
|
+
- Mobile (375px)
|
|
209
|
+
|
|
210
|
+
Step 2: Brand Guide Match
|
|
211
|
+
- Colors match .claude/BRAND_GUIDE.md
|
|
212
|
+
- Typography matches
|
|
213
|
+
- Spacing matches
|
|
214
|
+
|
|
215
|
+
Step 3: All Tests Passed
|
|
216
|
+
- Unit tests (component)
|
|
217
|
+
- Storybook stories render
|
|
218
|
+
- A11y audit: WCAG 2.1 AA
|
|
219
|
+
|
|
220
|
+
Step 4: Performance Metrics
|
|
221
|
+
- Memory usage logged
|
|
222
|
+
- Re-renders on mount: 1 (optimal)
|
|
223
|
+
- Re-renders on prop change: 1 (optimal)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Brand Guide
|
|
227
|
+
|
|
228
|
+
Default template installed at `.claude/BRAND_GUIDE.md`:
|
|
229
|
+
|
|
230
|
+
```markdown
|
|
231
|
+
# Project Brand Guide
|
|
232
|
+
|
|
233
|
+
## Colors
|
|
234
|
+
- Primary: #000000
|
|
235
|
+
- Accent: #0066FF
|
|
236
|
+
- Background: #FFFFFF
|
|
237
|
+
|
|
238
|
+
## Typography
|
|
239
|
+
- Headings: Inter, sans-serif
|
|
240
|
+
- Body: Inter, sans-serif
|
|
241
|
+
|
|
242
|
+
## Component Styling
|
|
243
|
+
- Border radius: 8px
|
|
244
|
+
- Focus ring: 2px solid accent
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
During Phase 3, Claude asks: "Use brand guide?" with a prompt to update NOW before proceeding.
|
|
248
|
+
|
|
249
|
+
## UI Showcase
|
|
250
|
+
|
|
251
|
+
Auto-generated at `src/app/ui-showcase/` when first component/page is created:
|
|
252
|
+
|
|
253
|
+
- Grid layout showing ALL components and pages
|
|
254
|
+
- Click any card → Modal opens with live preview
|
|
255
|
+
- Components: Inline render with variant controls
|
|
256
|
+
- Pages: Iframe preview at responsive sizes
|
|
257
|
+
- Filter tabs: [All] [Components] [Pages]
|
|
258
|
+
- Auto-updates via `update-registry.py` hook
|
|
259
|
+
|
|
260
|
+
## API Showcase *(NEW in v3.9.0)*
|
|
261
|
+
|
|
262
|
+
Auto-generated at `src/app/api-showcase/` when first API is created:
|
|
263
|
+
|
|
264
|
+
- Grid layout showing ALL APIs and combined endpoints
|
|
265
|
+
- Click any card → Modal with interactive "Try It" testing
|
|
266
|
+
- **Try It Tab** - Send real requests with editable body, method selector
|
|
267
|
+
- **Documentation Tab** - File locations, schemas, test paths
|
|
268
|
+
- **Curl Examples Tab** - Copy-paste curl commands
|
|
269
|
+
- Filter by type: [All] [Standard APIs] [Combined]
|
|
270
|
+
- Auto-updates via `update-registry.py` hook
|
|
271
|
+
|
|
272
|
+
**Features:**
|
|
273
|
+
- Reads from `registry.json` APIs and combined sections
|
|
274
|
+
- Interactive API testing from browser
|
|
275
|
+
- Shows request/response in real-time
|
|
276
|
+
- Method badges (GET=green, POST=blue, DELETE=red)
|
|
277
|
+
- Status indicators for each endpoint
|
|
278
|
+
|
|
279
|
+
## Performance Budgets *(NEW in v3.9.0)*
|
|
280
|
+
|
|
281
|
+
TDD gates that **FAIL tests** if thresholds exceeded, triggering loop-back.
|
|
282
|
+
|
|
283
|
+
Configured in `.claude/performance-budgets.json`:
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"memory": {
|
|
288
|
+
"page_max_mb": 50,
|
|
289
|
+
"component_max_mb": 10,
|
|
290
|
+
"heap_growth_max_mb": 5
|
|
291
|
+
},
|
|
292
|
+
"renders": {
|
|
293
|
+
"mount_max": 1,
|
|
294
|
+
"prop_change_max": 1,
|
|
295
|
+
"unnecessary_renders_max": 0
|
|
296
|
+
},
|
|
297
|
+
"layout": {
|
|
298
|
+
"count_max": 10,
|
|
299
|
+
"duration_max_ms": 100
|
|
300
|
+
},
|
|
301
|
+
"timing": {
|
|
302
|
+
"page_load_max_ms": 3000,
|
|
303
|
+
"first_contentful_paint_max_ms": 1500,
|
|
304
|
+
"largest_contentful_paint_max_ms": 2500
|
|
305
|
+
},
|
|
306
|
+
"dom": {
|
|
307
|
+
"nodes_max": 1500
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**How it works:**
|
|
313
|
+
- E2E tests use Chromium DevTools Protocol (CDP) for memory metrics
|
|
314
|
+
- Component tests track re-render counts via wrapper components
|
|
315
|
+
- Tests FAIL if thresholds exceeded → TDD loop-back to fix
|
|
316
|
+
- Core Web Vitals (FCP, LCP) measured via PerformanceObserver
|
|
317
|
+
|
|
318
|
+
**Example E2E test with thresholds:**
|
|
319
|
+
```typescript
|
|
320
|
+
test('should have acceptable memory usage', async ({ page }) => {
|
|
321
|
+
const client = await page.context().newCDPSession(page);
|
|
322
|
+
const metrics = await client.send('Performance.getMetrics');
|
|
323
|
+
|
|
324
|
+
const jsHeapSize = metrics.metrics.find(m => m.name === 'JSHeapUsedSize')?.value || 0;
|
|
325
|
+
const domNodes = metrics.metrics.find(m => m.name === 'Nodes')?.value || 0;
|
|
326
|
+
|
|
327
|
+
// THRESHOLD: Memory max 50MB - FAIL if exceeded
|
|
328
|
+
expect(jsHeapSize).toBeLessThan(50 * 1024 * 1024);
|
|
329
|
+
|
|
330
|
+
// THRESHOLD: DOM nodes max 1500 - FAIL if exceeded
|
|
331
|
+
expect(domNodes).toBeLessThan(1500);
|
|
332
|
+
});
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Example component test with re-render tracking:**
|
|
336
|
+
```typescript
|
|
337
|
+
it('should not re-render excessively on mount', () => {
|
|
338
|
+
let renderCount = 0;
|
|
339
|
+
|
|
340
|
+
const TestWrapper = () => {
|
|
341
|
+
renderCount++;
|
|
342
|
+
return <Button>Test</Button>;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
render(<TestWrapper />);
|
|
346
|
+
|
|
347
|
+
// THRESHOLD: Mount renders max 1 - FAIL if exceeded
|
|
348
|
+
expect(renderCount).toBeLessThanOrEqual(1);
|
|
349
|
+
});
|
|
350
|
+
```
|
|
351
|
+
|
|
89
352
|
## State File
|
|
90
353
|
|
|
91
354
|
All progress tracked in `.claude/api-dev-state.json`:
|
|
92
355
|
|
|
93
356
|
```json
|
|
94
357
|
{
|
|
95
|
-
"version": "3.
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
358
|
+
"version": "3.7.0",
|
|
359
|
+
"active_endpoint": "brandfetch",
|
|
360
|
+
"endpoints": {
|
|
361
|
+
"brandfetch": {
|
|
362
|
+
"started_at": "2025-12-11T15:30:00Z",
|
|
363
|
+
"status": "complete",
|
|
364
|
+
"turn_count": 23,
|
|
365
|
+
"phases": {
|
|
366
|
+
"disambiguation": { "status": "complete", "phase_exit_confirmed": true },
|
|
367
|
+
"scope": { "status": "complete", "phase_exit_confirmed": true },
|
|
368
|
+
"research_initial": { "status": "complete" },
|
|
369
|
+
"interview": { "status": "complete", "decisions": {} },
|
|
370
|
+
"research_deep": {
|
|
371
|
+
"proposed_searches": [],
|
|
372
|
+
"approved_searches": [],
|
|
373
|
+
"skipped_searches": []
|
|
374
|
+
},
|
|
375
|
+
"verify": {
|
|
376
|
+
"gaps_found": 2,
|
|
377
|
+
"gaps_fixed": 2,
|
|
378
|
+
"intentional_omissions": []
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
"scope": {
|
|
382
|
+
"discovered_features": [],
|
|
383
|
+
"implemented_features": [],
|
|
384
|
+
"deferred_features": [],
|
|
385
|
+
"coverage_percent": 100
|
|
386
|
+
},
|
|
387
|
+
"session": {
|
|
388
|
+
"interrupted_at": null,
|
|
389
|
+
"interrupted_phase": null
|
|
390
|
+
}
|
|
112
391
|
}
|
|
113
392
|
},
|
|
114
|
-
"reground_history": [
|
|
393
|
+
"reground_history": []
|
|
115
394
|
}
|
|
116
395
|
```
|
|
117
396
|
|
|
@@ -122,29 +401,73 @@ Research cached in `.claude/research/`:
|
|
|
122
401
|
```
|
|
123
402
|
.claude/research/
|
|
124
403
|
├── brandfetch/
|
|
125
|
-
│ ├──
|
|
126
|
-
│ ├──
|
|
127
|
-
│
|
|
128
|
-
└──
|
|
404
|
+
│ ├── CURRENT.md # Aggregated research
|
|
405
|
+
│ ├── sources.json # Research sources with freshness
|
|
406
|
+
│ ├── interview.json # Interview decisions
|
|
407
|
+
│ └── schema.json # Schema snapshot
|
|
408
|
+
└── index.json # Freshness tracking (7-day validity)
|
|
129
409
|
```
|
|
130
410
|
|
|
411
|
+
## Session Logs
|
|
412
|
+
|
|
413
|
+
Sessions saved in `.claude/api-sessions/`:
|
|
414
|
+
|
|
415
|
+
```
|
|
416
|
+
.claude/api-sessions/
|
|
417
|
+
├── brandfetch_2025-12-11_15-30-00/
|
|
418
|
+
│ ├── session.jsonl # Raw Claude conversation
|
|
419
|
+
│ ├── session.md # Human-readable markdown
|
|
420
|
+
│ ├── state-snapshot.json # api-dev-state at completion
|
|
421
|
+
│ └── summary.md # Executive summary
|
|
422
|
+
└── index.json # Session index
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## Auto-Generated Documentation
|
|
426
|
+
|
|
427
|
+
When Phase 12 completes, `generate-manifest-entry.py` automatically generates:
|
|
428
|
+
|
|
429
|
+
### Comprehensive Curl Examples
|
|
430
|
+
- **Minimal** - Required parameters only
|
|
431
|
+
- **Full** - All parameters
|
|
432
|
+
- **With Authentication** - API key headers
|
|
433
|
+
- **Enum Variations** - One example per enum value (up to 4)
|
|
434
|
+
- **Alternative Values** - Different valid inputs
|
|
435
|
+
- **Array Examples** - Multiple items
|
|
436
|
+
- **Boundary Values** - Min/max values
|
|
437
|
+
|
|
438
|
+
### Complete Test Cases
|
|
439
|
+
- **Success Cases** - Required only, all fields, alternatives
|
|
440
|
+
- **Enum Validation** - Each valid value + invalid
|
|
441
|
+
- **Required Fields** - Missing each required field
|
|
442
|
+
- **Type Validation** - Wrong types for each field
|
|
443
|
+
- **Boundary Tests** - At min, below min, at max, above max
|
|
444
|
+
- **Array Tests** - Empty, multiple items
|
|
445
|
+
- **Edge Cases** - Empty body, null values, extra fields
|
|
446
|
+
|
|
447
|
+
### Parameter Documentation
|
|
448
|
+
- All required and optional parameters
|
|
449
|
+
- Types with validation rules
|
|
450
|
+
- Enum values with descriptions
|
|
451
|
+
- Min/max constraints
|
|
452
|
+
- String length limits
|
|
453
|
+
|
|
131
454
|
## Quick Start
|
|
132
455
|
|
|
133
456
|
### Automated
|
|
134
457
|
```bash
|
|
135
|
-
/api-create my-endpoint
|
|
458
|
+
/hustle-api-create my-endpoint
|
|
136
459
|
```
|
|
137
460
|
|
|
138
461
|
### Manual Step-by-Step
|
|
139
462
|
```bash
|
|
140
|
-
/api-research [library] # Initial research
|
|
141
|
-
/api-interview [endpoint] # Questions from research
|
|
142
|
-
/api-env [endpoint] # Verify environment
|
|
143
|
-
/red
|
|
144
|
-
/green
|
|
145
|
-
/api-verify [endpoint] # Compare to docs
|
|
146
|
-
/refactor
|
|
147
|
-
/commit
|
|
463
|
+
/hustle-api-research [library] # Initial research
|
|
464
|
+
/hustle-api-interview [endpoint] # Questions from research
|
|
465
|
+
/hustle-api-env [endpoint] # Verify environment
|
|
466
|
+
/red # Failing tests
|
|
467
|
+
/green # Make tests pass
|
|
468
|
+
/hustle-api-verify [endpoint] # Compare to docs
|
|
469
|
+
/refactor # Clean up
|
|
470
|
+
/commit # Semantic commit
|
|
148
471
|
```
|
|
149
472
|
|
|
150
473
|
## Installation
|
|
@@ -154,12 +477,38 @@ npx @hustle-together/api-dev-tools --scope=project
|
|
|
154
477
|
```
|
|
155
478
|
|
|
156
479
|
Installs:
|
|
157
|
-
- Commands in `.claude/commands/`
|
|
158
|
-
- Hooks in `.claude/hooks/`
|
|
480
|
+
- Commands in `.claude/commands/` (10 hustle-* commands)
|
|
481
|
+
- Hooks in `.claude/hooks/` (33 hooks)
|
|
159
482
|
- Settings in `.claude/settings.json`
|
|
160
483
|
- State template in `.claude/api-dev-state.json`
|
|
484
|
+
- Registry in `.claude/registry.json`
|
|
485
|
+
- Brand guide in `.claude/BRAND_GUIDE.md` *(NEW in v3.9.0)*
|
|
486
|
+
- Performance budgets in `.claude/performance-budgets.json` *(NEW in v3.9.0)*
|
|
161
487
|
- Research index in `.claude/research/index.json`
|
|
162
488
|
|
|
489
|
+
### File Structures (UI)
|
|
490
|
+
|
|
491
|
+
**Component Structure:**
|
|
492
|
+
```
|
|
493
|
+
src/components/Button/
|
|
494
|
+
├── Button.tsx # Component implementation
|
|
495
|
+
├── Button.types.ts # TypeScript interfaces
|
|
496
|
+
├── Button.stories.tsx # Storybook documentation
|
|
497
|
+
├── Button.test.tsx # Unit tests
|
|
498
|
+
└── index.ts # Barrel export
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**Page Structure:**
|
|
502
|
+
```
|
|
503
|
+
src/app/dashboard/
|
|
504
|
+
├── page.tsx # Page component
|
|
505
|
+
├── layout.tsx # (optional) Layout
|
|
506
|
+
└── _components/ # Page-specific components
|
|
507
|
+
|
|
508
|
+
tests/e2e/
|
|
509
|
+
└── dashboard.spec.ts # Playwright E2E tests
|
|
510
|
+
```
|
|
511
|
+
|
|
163
512
|
### Team-Wide
|
|
164
513
|
|
|
165
514
|
Add to `package.json`:
|
|
@@ -171,6 +520,42 @@ Add to `package.json`:
|
|
|
171
520
|
}
|
|
172
521
|
```
|
|
173
522
|
|
|
523
|
+
## Central Registry
|
|
524
|
+
|
|
525
|
+
All created APIs, components, and pages are tracked in `.claude/registry.json`:
|
|
526
|
+
|
|
527
|
+
```json
|
|
528
|
+
{
|
|
529
|
+
"version": "1.0.0",
|
|
530
|
+
"apis": {
|
|
531
|
+
"brandfetch": {
|
|
532
|
+
"name": "Brandfetch",
|
|
533
|
+
"description": "Brand data extraction by domain",
|
|
534
|
+
"route": "src/app/api/v2/brandfetch/route.ts",
|
|
535
|
+
"status": "complete"
|
|
536
|
+
},
|
|
537
|
+
"elevenlabs": {
|
|
538
|
+
"name": "ElevenLabs",
|
|
539
|
+
"description": "Voice synthesis (TTS, voices, models)",
|
|
540
|
+
"route": "src/app/api/v2/elevenlabs/",
|
|
541
|
+
"status": "complete"
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
"components": {},
|
|
545
|
+
"pages": {},
|
|
546
|
+
"combined": {
|
|
547
|
+
"brand-voice": {
|
|
548
|
+
"name": "Brand Voice",
|
|
549
|
+
"combines": ["brandfetch", "elevenlabs"],
|
|
550
|
+
"flow_type": "sequential",
|
|
551
|
+
"status": "complete"
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
The registry enables `/hustle-combine` to present available elements for combination.
|
|
558
|
+
|
|
174
559
|
## Key Principles
|
|
175
560
|
|
|
176
561
|
1. **Loop Until Green** - Every verification loops back if not successful
|
|
@@ -178,8 +563,11 @@ Add to `package.json`:
|
|
|
178
563
|
3. **Adaptive Research** - Propose based on context, not shotgun
|
|
179
564
|
4. **Self-Documenting** - State file captures everything
|
|
180
565
|
5. **Verify After Green** - Re-research to catch memory errors
|
|
566
|
+
6. **Comprehensive Output** - Full documentation ready for UI consumption
|
|
567
|
+
7. **Session Persistence** - Never lose a workflow, always resume
|
|
568
|
+
8. **Registry Tracking** - All created elements tracked for combination
|
|
181
569
|
|
|
182
570
|
---
|
|
183
571
|
|
|
184
|
-
**Version:** 3.
|
|
185
|
-
**Last Updated:** 2025-12-
|
|
572
|
+
**Version:** 3.9.0
|
|
573
|
+
**Last Updated:** 2025-12-12
|