@hustle-together/api-dev-tools 3.6.5 → 3.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +5307 -258
  2. package/bin/cli.js +348 -20
  3. package/commands/README.md +459 -71
  4. package/commands/hustle-api-continue.md +158 -0
  5. package/commands/{api-create.md → hustle-api-create.md} +22 -2
  6. package/commands/{api-env.md → hustle-api-env.md} +4 -4
  7. package/commands/{api-interview.md → hustle-api-interview.md} +1 -1
  8. package/commands/{api-research.md → hustle-api-research.md} +3 -3
  9. package/commands/hustle-api-sessions.md +149 -0
  10. package/commands/{api-status.md → hustle-api-status.md} +16 -16
  11. package/commands/{api-verify.md → hustle-api-verify.md} +2 -2
  12. package/commands/hustle-combine.md +763 -0
  13. package/commands/hustle-ui-create.md +825 -0
  14. package/hooks/api-workflow-check.py +385 -19
  15. package/hooks/cache-research.py +337 -0
  16. package/hooks/check-playwright-setup.py +103 -0
  17. package/hooks/check-storybook-setup.py +81 -0
  18. package/hooks/detect-interruption.py +165 -0
  19. package/hooks/enforce-brand-guide.py +131 -0
  20. package/hooks/enforce-documentation.py +60 -8
  21. package/hooks/enforce-freshness.py +184 -0
  22. package/hooks/enforce-questions-sourced.py +146 -0
  23. package/hooks/enforce-schema-from-interview.py +248 -0
  24. package/hooks/enforce-ui-disambiguation.py +108 -0
  25. package/hooks/enforce-ui-interview.py +130 -0
  26. package/hooks/generate-manifest-entry.py +981 -0
  27. package/hooks/session-logger.py +297 -0
  28. package/hooks/session-startup.py +65 -10
  29. package/hooks/track-scope-coverage.py +220 -0
  30. package/hooks/track-tool-use.py +81 -1
  31. package/hooks/update-api-showcase.py +149 -0
  32. package/hooks/update-registry.py +352 -0
  33. package/hooks/update-ui-showcase.py +148 -0
  34. package/package.json +8 -2
  35. package/templates/BRAND_GUIDE.md +299 -0
  36. package/templates/CLAUDE-SECTION.md +56 -24
  37. package/templates/SPEC.json +640 -0
  38. package/templates/api-dev-state.json +179 -161
  39. package/templates/api-showcase/APICard.tsx +153 -0
  40. package/templates/api-showcase/APIModal.tsx +375 -0
  41. package/templates/api-showcase/APIShowcase.tsx +231 -0
  42. package/templates/api-showcase/APITester.tsx +522 -0
  43. package/templates/api-showcase/page.tsx +41 -0
  44. package/templates/component/Component.stories.tsx +172 -0
  45. package/templates/component/Component.test.tsx +237 -0
  46. package/templates/component/Component.tsx +86 -0
  47. package/templates/component/Component.types.ts +55 -0
  48. package/templates/component/index.ts +15 -0
  49. package/templates/dev-tools/_components/DevToolsLanding.tsx +320 -0
  50. package/templates/dev-tools/page.tsx +10 -0
  51. package/templates/page/page.e2e.test.ts +218 -0
  52. package/templates/page/page.tsx +42 -0
  53. package/templates/performance-budgets.json +58 -0
  54. package/templates/registry.json +13 -0
  55. package/templates/settings.json +74 -0
  56. package/templates/shared/HeroHeader.tsx +261 -0
  57. package/templates/shared/index.ts +1 -0
  58. package/templates/ui-showcase/PreviewCard.tsx +315 -0
  59. package/templates/ui-showcase/PreviewModal.tsx +676 -0
  60. package/templates/ui-showcase/UIShowcase.tsx +262 -0
  61. package/templates/ui-showcase/page.tsx +26 -0
@@ -0,0 +1,158 @@
1
+ # API Continue Command
2
+
3
+ Resume an interrupted API development workflow from where it left off.
4
+
5
+ ## Usage
6
+ ```
7
+ /hustle-api-continue [endpoint-name]
8
+ ```
9
+
10
+ ## Arguments
11
+ - `endpoint-name` (optional): The endpoint to resume. If not provided, will show available interrupted workflows.
12
+
13
+ ## What This Command Does
14
+
15
+ 1. **Check for Interrupted Workflows**
16
+ - Read `.claude/api-dev-state.json`
17
+ - Find endpoints with `status: "in_progress"`
18
+ - Identify the last completed phase
19
+
20
+ 2. **Restore Context**
21
+ - Load all interview decisions
22
+ - Load research cache from `.claude/research/{endpoint}/`
23
+ - Inject phase-specific context
24
+
25
+ 3. **Resume Workflow**
26
+ - Set `active_endpoint` to the resumed endpoint
27
+ - Continue from the interrupted phase
28
+ - Re-inject any needed context
29
+
30
+ ## Example
31
+
32
+ ```bash
33
+ # List interrupted workflows
34
+ /hustle-api-continue
35
+
36
+ # Resume specific workflow
37
+ /hustle-api-continue brandfetch
38
+ ```
39
+
40
+ ## Output
41
+
42
+ When resuming, you'll see:
43
+ - Summary of completed phases
44
+ - Current phase to resume
45
+ - Key interview decisions
46
+ - Research cache status
47
+
48
+ ---
49
+
50
+ ## Implementation
51
+
52
+ When user runs `/hustle-api-continue [endpoint]`:
53
+
54
+ ### Step 1: Load State and Find Workflow
55
+
56
+ ```
57
+ READ .claude/api-dev-state.json
58
+ IF endpoint argument provided:
59
+ FIND endpoint in state.endpoints
60
+ ELSE:
61
+ LIST all endpoints with status == "in_progress"
62
+ ASK user which to resume
63
+ ```
64
+
65
+ ### Step 2: Validate Workflow Can Resume
66
+
67
+ ```
68
+ CHECK endpoint exists
69
+ CHECK endpoint.status == "in_progress"
70
+ FIND last completed phase
71
+ IDENTIFY next phase to run
72
+ ```
73
+
74
+ ### Step 3: Restore Context
75
+
76
+ ```
77
+ SET state.active_endpoint = endpoint
78
+ LOAD .claude/research/{endpoint}/CURRENT.md if exists
79
+ LOAD .claude/research/{endpoint}/interview.json if exists
80
+ INJECT context into Claude's memory:
81
+ - Endpoint name and purpose
82
+ - Completed phases summary
83
+ - Interview decisions
84
+ - Research findings
85
+ - Current phase requirements
86
+ ```
87
+
88
+ ### Step 4: Resume
89
+
90
+ ```
91
+ SHOW resume summary to user:
92
+ ┌────────────────────────────────────────────────────────┐
93
+ │ RESUMING: {endpoint} │
94
+ │ │
95
+ │ Completed: Phase 1-5 │
96
+ │ Resuming at: Phase 6 (Schema Creation) │
97
+ │ │
98
+ │ Interview Decisions Loaded: │
99
+ │ • format: json │
100
+ │ • authentication: api_key │
101
+ │ • rate_limiting: yes │
102
+ │ │
103
+ │ Research Cache: │
104
+ │ • .claude/research/{endpoint}/CURRENT.md (fresh) │
105
+ │ │
106
+ │ Continue with Phase 6? [Y/n] │
107
+ └────────────────────────────────────────────────────────┘
108
+
109
+ IF user confirms:
110
+ TRIGGER next phase workflow
111
+ ```
112
+
113
+ ### Step 5: Clear Interruption State
114
+
115
+ ```
116
+ UPDATE state.endpoints[endpoint].session:
117
+ interrupted_at = null
118
+ interrupted_phase = null
119
+ recovery_checkpoint = null
120
+ SAVE state
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Phase Order for Reference
126
+
127
+ 1. Disambiguation
128
+ 2. Scope
129
+ 3. Initial Research
130
+ 4. Interview
131
+ 5. Deep Research
132
+ 6. Schema Creation
133
+ 7. Environment Check
134
+ 8. TDD Red
135
+ 9. TDD Green
136
+ 10. Verify
137
+ 11. TDD Refactor
138
+ 12. Documentation
139
+ 13. Completion
140
+
141
+ ---
142
+
143
+ ## Error Handling
144
+
145
+ | Error | Resolution |
146
+ |-------|------------|
147
+ | No interrupted workflows | Show message: "No interrupted workflows found. Use /hustle-api-create to start a new one." |
148
+ | Endpoint not found | Show available endpoints and ask user to choose |
149
+ | Research cache stale | Warn user and offer to re-run research phases |
150
+ | State file missing | Error: "No state file found. Use /hustle-api-create to start a new workflow." |
151
+
152
+ ---
153
+
154
+ ## Related Commands
155
+
156
+ - `/hustle-api-create [endpoint]` - Start new workflow
157
+ - `/hustle-api-status [endpoint]` - Check workflow progress
158
+ - `/hustle-api-sessions --list` - View saved session logs
@@ -1,6 +1,6 @@
1
1
  # API Create - Comprehensive API Development Workflow v3.0
2
2
 
3
- **Usage:** `/api-create [endpoint-name]`
3
+ **Usage:** `/hustle-api-create [endpoint-name]`
4
4
 
5
5
  **Purpose:** Orchestrates the complete API development workflow using interview-driven, research-first, test-first methodology with continuous verification loops.
6
6
 
@@ -98,7 +98,7 @@ Both conditions must be true for the flag to be set.
98
98
  ## Complete Phase Flow
99
99
 
100
100
  ```
101
- /api-create [endpoint]
101
+ /hustle-api-create [endpoint]
102
102
 
103
103
 
104
104
  ┌─ PHASE 0: DISAMBIGUATION ─────────────────────────────────┐
@@ -421,9 +421,29 @@ Both conditions must be true for the flag to be set.
421
421
  │ • State file shows all phases complete │
422
422
  │ │
423
423
  │ Run /commit to create semantic commit. │
424
+ │ │
425
+ │ API Showcase: http://localhost:3000/api-showcase │
426
+ │ Your API is now available for interactive testing! │
424
427
  └───────────────────────────────────────────────────────────┘
425
428
  ```
426
429
 
430
+ ### Showcase Redirect
431
+
432
+ After successful API creation, output:
433
+
434
+ ```
435
+ Your API has been added to the showcase!
436
+
437
+ View it at: http://localhost:3000/api-showcase
438
+
439
+ Or run `pnpm dev` and navigate to /api-showcase to:
440
+ - Test your API interactively
441
+ - View auto-generated curl examples
442
+ - See request/response schemas
443
+ ```
444
+
445
+ Registry is automatically updated with the new API entry.
446
+
427
447
  ## State File Tracking
428
448
 
429
449
  All phases are tracked in `.claude/api-dev-state.json`:
@@ -1,6 +1,6 @@
1
1
  # API Environment - Check API Keys & Configuration
2
2
 
3
- **Usage:** `/api-env [endpoint-name]`
3
+ **Usage:** `/hustle-api-env [endpoint-name]`
4
4
 
5
5
  **Purpose:** Quick check for required API keys and environment setup before implementation.
6
6
 
@@ -32,9 +32,9 @@ Status: BLOCKED - Cannot proceed without FIRECRAWL_API_KEY
32
32
 
33
33
  ```bash
34
34
  # Before starting implementation
35
- /api-interview generate-css
36
- /api-research firecrawl
37
- /api-env generate-css ← Check keys
35
+ /hustle-api-interview generate-css
36
+ /hustle-api-research firecrawl
37
+ /hustle-api-env generate-css ← Check keys
38
38
  /red ← Start TDD if ready
39
39
  ```
40
40
 
@@ -1,6 +1,6 @@
1
1
  # API Interview - Research-Driven Dynamic Discovery v3.0
2
2
 
3
- **Usage:** `/api-interview [endpoint-name]`
3
+ **Usage:** `/hustle-api-interview [endpoint-name]`
4
4
 
5
5
  **Purpose:** Conduct structured interview where questions are GENERATED FROM research findings, not generic templates. Every question is specific to the discovered API capabilities.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # API Research - Adaptive Documentation Discovery v3.0
2
2
 
3
- **Usage:** `/api-research [library-or-service-name]`
3
+ **Usage:** `/hustle-api-research [library-or-service-name]`
4
4
 
5
5
  **Purpose:** Research external APIs and SDKs using an adaptive, propose-approve flow (not shotgun searches).
6
6
 
@@ -302,7 +302,7 @@ All research is tracked in `.claude/api-dev-state.json`:
302
302
 
303
303
  ### Research with full flow
304
304
  ```bash
305
- /api-research brandfetch
305
+ /hustle-api-research brandfetch
306
306
  # → Initial search (2-3 queries)
307
307
  # → Present summary, ask to proceed
308
308
  # → Interview happens (separate phase)
@@ -324,7 +324,7 @@ All research is tracked in `.claude/api-dev-state.json`:
324
324
 
325
325
  ## Integration with API Development
326
326
 
327
- - Phase 3 of `/api-create` uses this for initial research
327
+ - Phase 3 of `/hustle-api-create` uses this for initial research
328
328
  - Phase 5 uses adaptive proposal flow
329
329
  - Phase 10 (Verify) triggers re-research
330
330
  - Freshness check prevents stale data
@@ -0,0 +1,149 @@
1
+ # API Sessions Command
2
+
3
+ Browse and export saved session logs from previous API development workflows.
4
+
5
+ ## Usage
6
+ ```
7
+ /hustle-api-sessions [options]
8
+ ```
9
+
10
+ ## Options
11
+
12
+ | Option | Description |
13
+ |--------|-------------|
14
+ | `--list` | List all saved sessions |
15
+ | `--view [endpoint]` | View a specific session |
16
+ | `--export [endpoint] [format]` | Export session to PDF/HTML/MD |
17
+ | `--search [term]` | Search across all sessions |
18
+ | `--cleanup` | Remove old sessions (>30 days) |
19
+
20
+ ## Examples
21
+
22
+ ```bash
23
+ # List all sessions
24
+ /hustle-api-sessions --list
25
+
26
+ # View most recent brandfetch session
27
+ /hustle-api-sessions --view brandfetch
28
+
29
+ # Export to markdown
30
+ /hustle-api-sessions --export brandfetch md
31
+
32
+ # Search for "rate limit"
33
+ /hustle-api-sessions --search "rate limit"
34
+ ```
35
+
36
+ ## Session Storage Structure
37
+
38
+ Sessions are stored in `.claude/hustle-api-sessions/`:
39
+
40
+ ```
41
+ .claude/hustle-api-sessions/
42
+ ├── brandfetch_2025-12-11_15-30-00/
43
+ │ ├── state-snapshot.json # State at completion
44
+ │ ├── files-created.txt # List of files made
45
+ │ ├── summary.md # Executive summary
46
+ │ └── research-cache/ # Copy of research files
47
+ │ ├── sources.json
48
+ │ ├── interview.json
49
+ │ └── CURRENT.md
50
+ ├── elevenlabs_2025-12-11_18-45-00/
51
+ │ └── ...
52
+ └── index.json # Session index
53
+ ```
54
+
55
+ ## Output Examples
56
+
57
+ ### --list
58
+
59
+ ```
60
+ SAVED SESSIONS
61
+ ═══════════════════════════════════════════════════
62
+
63
+ # │ Endpoint │ Date │ Phases │ Status
64
+ ───┼─────────────┼────────────┼────────┼──────────
65
+ 1 │ brandfetch │ 2025-12-11 │ 13/13 │ complete
66
+ 2 │ elevenlabs │ 2025-12-10 │ 8/13 │ in_progress
67
+ 3 │ stripe │ 2025-12-09 │ 13/13 │ complete
68
+
69
+ Total: 3 sessions
70
+ ```
71
+
72
+ ### --view [endpoint]
73
+
74
+ ```
75
+ SESSION: brandfetch
76
+ ═══════════════════════════════════════════════════
77
+
78
+ Date: 2025-12-11 15:30:00
79
+ Status: complete
80
+ Phases: 13/13
81
+
82
+ Files Created:
83
+ • src/app/api/v2/brandfetch/route.ts
84
+ • src/app/api/v2/brandfetch/__tests__/brandfetch.api.test.ts
85
+ • src/lib/schemas/brandfetch.ts
86
+
87
+ Interview Decisions:
88
+ • format: json, svg
89
+ • authentication: api_key
90
+ • rate_limiting: yes
91
+
92
+ Research Sources:
93
+ • https://docs.brandfetch.com/reference/
94
+ • https://brandfetch.com/developers/
95
+
96
+ Session Path: .claude/hustle-api-sessions/brandfetch_2025-12-11_15-30-00/
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Implementation
102
+
103
+ When user runs `/hustle-api-sessions`:
104
+
105
+ ### --list
106
+
107
+ ```
108
+ READ .claude/hustle-api-sessions/index.json
109
+ FOR each session in index:
110
+ SHOW endpoint, date, phases completed, status
111
+ SORT by date descending
112
+ ```
113
+
114
+ ### --view [endpoint]
115
+
116
+ ```
117
+ FIND most recent session for endpoint
118
+ READ summary.md from session folder
119
+ DISPLAY formatted summary
120
+ OFFER to open session folder
121
+ ```
122
+
123
+ ### --export [endpoint] [format]
124
+
125
+ ```
126
+ FIND session folder
127
+ LOAD all session files
128
+ FORMAT to requested output (md/html/pdf)
129
+ WRITE to output file
130
+ SHOW output path
131
+ ```
132
+
133
+ ### --search [term]
134
+
135
+ ```
136
+ FOR each session folder:
137
+ SEARCH summary.md for term
138
+ SEARCH state-snapshot.json for term
139
+ SEARCH research-cache/* for term
140
+ SHOW matching sessions with context
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Related Commands
146
+
147
+ - `/hustle-api-create [endpoint]` - Start new workflow
148
+ - `/hustle-api-continue [endpoint]` - Resume interrupted workflow
149
+ - `/hustle-api-status [endpoint]` - Check current workflow progress
@@ -1,6 +1,6 @@
1
1
  # API Status - Track Implementation Progress
2
2
 
3
- **Usage:** `/api-status [endpoint-name]` or `/api-status --all`
3
+ **Usage:** `/hustle-api-status [endpoint-name]` or `/hustle-api-status --all`
4
4
 
5
5
  **Purpose:** View and update API implementation status, track progress, and manage V2 migration.
6
6
 
@@ -123,14 +123,14 @@ Last updated: 2025-12-06
123
123
 
124
124
  ### View Status
125
125
  ```bash
126
- /api-status generate-css # Specific endpoint
127
- /api-status --all # All endpoints
126
+ /hustle-api-status generate-css # Specific endpoint
127
+ /hustle-api-status --all # All endpoints
128
128
  ```
129
129
 
130
130
  ### Update Status
131
131
  ```bash
132
- /api-status generate-css --phase=testing
133
- /api-status generate-css --complete
132
+ /hustle-api-status generate-css --phase=testing
133
+ /hustle-api-status generate-css --complete
134
134
  ```
135
135
 
136
136
  ## Status Tracking File
@@ -176,32 +176,32 @@ Updates: `/src/v2/docs/v2-api-implementation-status.md`
176
176
 
177
177
  ### After Interview
178
178
  ```bash
179
- /api-interview generate-css
180
- /api-status generate-css --phase=interview-complete
179
+ /hustle-api-interview generate-css
180
+ /hustle-api-status generate-css --phase=interview-complete
181
181
  ```
182
182
 
183
183
  ### After Research
184
184
  ```bash
185
- /api-research gemini-flash
186
- /api-status generate-css --phase=research-complete
185
+ /hustle-api-research gemini-flash
186
+ /hustle-api-status generate-css --phase=research-complete
187
187
  ```
188
188
 
189
189
  ### After TDD Cycle
190
190
  ```bash
191
191
  /cycle generate CSS with Gemini
192
- /api-status generate-css --complete
192
+ /hustle-api-status generate-css --complete
193
193
  ```
194
194
 
195
195
  ### Before Commit
196
196
  ```bash
197
197
  pnpm test:run
198
- /api-status --all # Verify all green
198
+ /hustle-api-status --all # Verify all green
199
199
  /commit
200
200
  ```
201
201
 
202
202
  ## Automatic Updates
203
203
 
204
- The `/api-create` command automatically updates status:
204
+ The `/hustle-api-create` command automatically updates status:
205
205
  - Interview phase → "Interview Complete"
206
206
  - Red phase → "Tests Written"
207
207
  - Green phase → "Implementation Complete"
@@ -225,19 +225,19 @@ The `/api-create` command automatically updates status:
225
225
 
226
226
  ### Coverage Report
227
227
  ```bash
228
- /api-status --coverage
228
+ /hustle-api-status --coverage
229
229
  ```
230
230
  Shows test coverage for all V2 endpoints.
231
231
 
232
232
  ### Migration Report
233
233
  ```bash
234
- /api-status --migration
234
+ /hustle-api-status --migration
235
235
  ```
236
236
  Shows progress from legacy to V2.
237
237
 
238
238
  ### Blockers Report
239
239
  ```bash
240
- /api-status --blocked
240
+ /hustle-api-status --blocked
241
241
  ```
242
242
  Shows endpoints blocked by missing keys, dependencies, etc.
243
243
 
@@ -252,7 +252,7 @@ Shows endpoints blocked by missing keys, dependencies, etc.
252
252
 
253
253
  ## Integration Points
254
254
 
255
- - Used by /api-create to track progress
255
+ - Used by /hustle-api-create to track progress
256
256
  - Used by /commit to verify readiness
257
257
  - Used by team to see what's done
258
258
  - Used for planning future work
@@ -1,6 +1,6 @@
1
1
  # API Verify - Implementation Verification (Phase 10) v3.0
2
2
 
3
- **Usage:** `/api-verify [endpoint-name]`
3
+ **Usage:** `/hustle-api-verify [endpoint-name]`
4
4
 
5
5
  **Purpose:** Manually trigger Phase 10 verification - re-research documentation and compare to implementation to catch memory-based errors.
6
6
 
@@ -203,7 +203,7 @@ Phase 8: TDD Red (write tests)
203
203
  Phase 9: TDD Green (implementation)
204
204
 
205
205
 
206
- Phase 10: VERIFY ← /api-verify triggers this
206
+ Phase 10: VERIFY ← /hustle-api-verify triggers this
207
207
 
208
208
  ├─► Gaps found? → Loop back to Phase 8
209
209