@hustle-together/api-dev-tools 3.12.3 → 3.12.16

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 (96) hide show
  1. package/.claude/commands/hustle-build.md +259 -0
  2. package/.claude/commands/hustle-combine.md +1089 -0
  3. package/.claude/commands/hustle-ui-create-page.md +1078 -0
  4. package/.claude/commands/hustle-ui-create.md +1058 -0
  5. package/.claude/hooks/auto-answer.py +305 -0
  6. package/.claude/hooks/cache-research.py +337 -0
  7. package/.claude/hooks/check-api-routes.py +168 -0
  8. package/.claude/hooks/check-playwright-setup.py +103 -0
  9. package/.claude/hooks/check-storybook-setup.py +81 -0
  10. package/.claude/hooks/check-update.py +132 -0
  11. package/.claude/hooks/completion-promise-detector.py +293 -0
  12. package/.claude/hooks/context-capacity-warning.py +171 -0
  13. package/.claude/hooks/detect-interruption.py +165 -0
  14. package/.claude/hooks/docs-update-check.py +120 -0
  15. package/.claude/hooks/enforce-a11y-audit.py +202 -0
  16. package/.claude/hooks/enforce-brand-guide.py +241 -0
  17. package/.claude/hooks/enforce-component-type-confirm.py +97 -0
  18. package/.claude/hooks/enforce-dry-run.py +134 -0
  19. package/.claude/hooks/enforce-freshness.py +184 -0
  20. package/.claude/hooks/enforce-page-components.py +186 -0
  21. package/.claude/hooks/enforce-page-data-schema.py +155 -0
  22. package/.claude/hooks/enforce-questions-sourced.py +146 -0
  23. package/.claude/hooks/enforce-schema-from-interview.py +248 -0
  24. package/.claude/hooks/enforce-ui-disambiguation.py +108 -0
  25. package/.claude/hooks/enforce-ui-interview.py +130 -0
  26. package/.claude/hooks/generate-adr-options.py +282 -0
  27. package/.claude/hooks/generate-manifest-entry.py +1161 -0
  28. package/.claude/hooks/hook_utils.py +609 -0
  29. package/.claude/hooks/lib/__init__.py +1 -0
  30. package/.claude/hooks/lib/__pycache__/__init__.cpython-314.pyc +0 -0
  31. package/.claude/hooks/lib/__pycache__/greptile.cpython-314.pyc +0 -0
  32. package/.claude/hooks/lib/__pycache__/ntfy.cpython-314.pyc +0 -0
  33. package/.claude/hooks/lib/greptile.py +355 -0
  34. package/.claude/hooks/lib/ntfy.py +209 -0
  35. package/.claude/hooks/notify-input-needed.py +73 -0
  36. package/.claude/hooks/notify-phase-complete.py +90 -0
  37. package/.claude/hooks/ntfy-on-question.py +240 -0
  38. package/.claude/hooks/orchestrator-completion.py +313 -0
  39. package/.claude/hooks/orchestrator-handoff.py +267 -0
  40. package/.claude/hooks/orchestrator-session-startup.py +146 -0
  41. package/.claude/hooks/parallel-orchestrator.py +451 -0
  42. package/.claude/hooks/project-document-prompt.py +302 -0
  43. package/.claude/hooks/remote-question-proxy.py +284 -0
  44. package/.claude/hooks/remote-question-server.py +1224 -0
  45. package/.claude/hooks/run-code-review.py +393 -0
  46. package/.claude/hooks/run-visual-qa.py +338 -0
  47. package/.claude/hooks/session-logger.py +323 -0
  48. package/.claude/hooks/test-orchestrator-reground.py +248 -0
  49. package/.claude/hooks/track-scope-coverage.py +220 -0
  50. package/.claude/hooks/track-token-usage.py +121 -0
  51. package/.claude/hooks/update-adr-decision.py +236 -0
  52. package/.claude/hooks/update-api-showcase.py +161 -0
  53. package/.claude/hooks/update-registry.py +352 -0
  54. package/.claude/hooks/update-testing-checklist.py +195 -0
  55. package/.claude/hooks/update-ui-showcase.py +224 -0
  56. package/.claude/settings.local.json +7 -1
  57. package/.claude/test-auto-answer-bot.py +183 -0
  58. package/.claude/test-completion-detector.py +263 -0
  59. package/.claude/test-orchestrator-state.json +20 -0
  60. package/.claude/test-orchestrator.sh +271 -0
  61. package/.skills/api-create/SKILL.md +88 -3
  62. package/.skills/docs-sync/SKILL.md +260 -0
  63. package/.skills/hustle-build/SKILL.md +459 -0
  64. package/.skills/hustle-build-review/SKILL.md +518 -0
  65. package/CHANGELOG.md +87 -0
  66. package/README.md +86 -9
  67. package/bin/cli.js +1302 -88
  68. package/commands/hustle-api-create.md +22 -0
  69. package/commands/hustle-combine.md +81 -2
  70. package/commands/hustle-ui-create-page.md +84 -2
  71. package/commands/hustle-ui-create.md +82 -2
  72. package/hooks/auto-answer.py +228 -0
  73. package/hooks/check-update.py +132 -0
  74. package/hooks/ntfy-on-question.py +227 -0
  75. package/hooks/orchestrator-completion.py +313 -0
  76. package/hooks/orchestrator-handoff.py +189 -0
  77. package/hooks/orchestrator-session-startup.py +146 -0
  78. package/hooks/periodic-reground.py +230 -67
  79. package/hooks/update-api-showcase.py +13 -1
  80. package/hooks/update-ui-showcase.py +13 -1
  81. package/package.json +7 -3
  82. package/scripts/extract-schema-docs.cjs +322 -0
  83. package/templates/CLAUDE-SECTION.md +89 -64
  84. package/templates/api-showcase/_components/APIModal.tsx +100 -8
  85. package/templates/api-showcase/_components/APIShowcase.tsx +36 -4
  86. package/templates/api-showcase/_components/APITester.tsx +367 -58
  87. package/templates/docs/page.tsx +230 -0
  88. package/templates/hustle-build-defaults.json +84 -0
  89. package/templates/hustle-dev-dashboard/page.tsx +365 -0
  90. package/templates/playwright-report/page.tsx +258 -0
  91. package/templates/settings.json +88 -7
  92. package/templates/test-results/page.tsx +237 -0
  93. package/templates/typedoc.json +19 -0
  94. package/templates/ui-showcase/_components/UIShowcase.tsx +1 -1
  95. package/templates/ui-showcase/page.tsx +1 -1
  96. package/.claude/api-dev-state.json +0 -466
@@ -0,0 +1,459 @@
1
+ ---
2
+ name: hustle-build
3
+ description: Build complete features from natural language. Orchestrates API, component, page, and combined workflows automatically.
4
+ license: MIT
5
+ compatibility: Requires Claude Code with hooks and MCP servers configured
6
+ metadata:
7
+ version: "4.0.0"
8
+ category: "orchestration"
9
+ tags: ["build", "workflow", "orchestrator", "autonomous"]
10
+ author: "Hustle Together"
11
+ allowed-tools: WebSearch WebFetch mcp__context7 mcp__github AskUserQuestion Read Write Edit Bash Task TodoWrite Skill
12
+ ---
13
+
14
+ # Hustle Build - Master Orchestrator
15
+
16
+ Build complete features from natural language descriptions. This skill orchestrates multiple workflows (API, Component, Page, Combined) in the correct order with shared decisions.
17
+
18
+ ## Usage
19
+
20
+ ```
21
+ /hustle-build [description]
22
+ /hustle-build --auto [description]
23
+ /hustle-build --resume [build-id]
24
+ /hustle-build --dry-run [description]
25
+ ```
26
+
27
+ ## Arguments
28
+
29
+ - `$ARGUMENTS` - Natural language description of what to build
30
+ - `--auto` - Fully autonomous mode, auto-answers questions
31
+ - `--resume [id]` - Resume an interrupted build
32
+ - `--dry-run` - Show what would be created without executing
33
+
34
+ ---
35
+
36
+ ## Phase 1: Parse Request
37
+
38
+ Parse the user's natural language request to identify required elements.
39
+
40
+ **Input:** $ARGUMENTS
41
+
42
+ **Look for:**
43
+ - Data requirements (implies APIs)
44
+ - UI elements mentioned (implies components)
45
+ - Page/route requirements (implies pages)
46
+ - Integration patterns (implies combined APIs)
47
+
48
+ **Output:** Initial decomposition with element types and names.
49
+
50
+ ---
51
+
52
+ ## Phase 2: Decompose Into Workflows
53
+
54
+ For each identified element, determine:
55
+
56
+ 1. **Element Type:**
57
+ - `api` - Data fetching, external service integration
58
+ - `component` - Reusable UI building block
59
+ - `combined_api` - Aggregation of multiple APIs
60
+ - `page` - Full page with route
61
+
62
+ 2. **Dependencies:**
63
+ - APIs have no dependencies (execute first)
64
+ - Components may depend on APIs (for types)
65
+ - Combined APIs depend on source APIs
66
+ - Pages depend on components and APIs
67
+
68
+ 3. **Execution Order:**
69
+ - Build dependency graph
70
+ - Topological sort for execution order
71
+ - Group into tiers for potential parallelism
72
+
73
+ **Present decomposition to user:**
74
+
75
+ ```
76
+ I've analyzed your request and identified these elements:
77
+
78
+ APIs (Tier 1):
79
+ - user-stats: User statistics endpoint
80
+ - chart-data: Chart data endpoint
81
+
82
+ Components (Tier 2):
83
+ - StatCard: Display individual stat (uses user-stats types)
84
+ - ChartWidget: Render chart (uses chart-data types)
85
+
86
+ Pages (Tier 3):
87
+ - Dashboard: Main dashboard page (uses all components)
88
+
89
+ Does this look correct?
90
+ ```
91
+
92
+ Use AskUserQuestion with options:
93
+ - "Yes, proceed with this plan"
94
+ - "Add more elements"
95
+ - "Remove elements"
96
+ - "Let me describe differently"
97
+
98
+ ---
99
+
100
+ ## Phase 3: Orchestrator Interview
101
+
102
+ Ask HIGH-LEVEL questions that apply to ALL sub-workflows.
103
+
104
+ **These questions are asked ONCE and shared:**
105
+
106
+ ### Q1: Authentication
107
+ "What's the authentication requirement for this feature?"
108
+ - Protected (requires login) - DEFAULT
109
+ - Public (no auth)
110
+ - Mixed (specify per element)
111
+
112
+ ### Q2: Error Handling
113
+ "How should errors be handled across APIs?"
114
+ - Partial success (show what works) - DEFAULT
115
+ - Fail-fast (one fails = all fail)
116
+ - Retry with fallback
117
+
118
+ ### Q3: Brand Guide
119
+ "Use project brand guide for styling?"
120
+ - Yes, use .claude/BRAND_GUIDE.md - DEFAULT
121
+ - No, custom theme
122
+ - Match existing page
123
+
124
+ ### Q4: Testing Level
125
+ "What level of testing?"
126
+ - Full TDD (all 14 phases per element) - DEFAULT
127
+ - Essential tests only
128
+ - Smoke tests only
129
+
130
+ Store all answers in `shared_decisions` - these will be injected into sub-workflows.
131
+
132
+ ---
133
+
134
+ ## Phase 4: Create Orchestration State
135
+
136
+ Create `.claude/hustle-build-state.json`:
137
+
138
+ ```json
139
+ {
140
+ "version": "4.0.0",
141
+ "build_id": "build-[timestamp]-[name]",
142
+ "status": "in_progress",
143
+ "mode": "interactive|auto",
144
+ "created_at": "[ISO timestamp]",
145
+
146
+ "request": {
147
+ "original": "[user's original request]",
148
+ "parsed_at": "[timestamp]"
149
+ },
150
+
151
+ "orchestrator_interview": {
152
+ "status": "complete",
153
+ "decisions": {
154
+ "auth_required": true,
155
+ "error_handling": "partial-success",
156
+ "brand_guide": true,
157
+ "testing_level": "full"
158
+ }
159
+ },
160
+
161
+ "decomposition": {
162
+ "apis": [
163
+ {"name": "user-stats", "status": "pending", "depends_on": []}
164
+ ],
165
+ "components": [
166
+ {"name": "StatCard", "status": "pending", "depends_on": ["user-stats"]}
167
+ ],
168
+ "combined_apis": [],
169
+ "pages": [
170
+ {"name": "Dashboard", "status": "pending", "depends_on": ["StatCard"]}
171
+ ]
172
+ },
173
+
174
+ "shared_decisions": {
175
+ "auth_required": true,
176
+ "error_handling": "partial-success",
177
+ "brand_guide": true,
178
+ "testing_level": "full"
179
+ },
180
+
181
+ "active_sub_workflow": null,
182
+ "completed_sub_workflows": []
183
+ }
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Phase 5: Execute Workflows
189
+
190
+ For each workflow in execution order:
191
+
192
+ ### 5.1 Set Active Workflow
193
+
194
+ Update state:
195
+ ```json
196
+ "active_sub_workflow": {
197
+ "type": "api",
198
+ "name": "user-stats",
199
+ "workflow_id": "wf-001",
200
+ "started_at": "[timestamp]"
201
+ }
202
+ ```
203
+
204
+ ### 5.2 Invoke Sub-Workflow
205
+
206
+ The orchestrator hooks will automatically:
207
+ 1. Inject `shared_decisions` into `api-dev-state.json`
208
+ 2. Mark workflow as `orchestrated: true`
209
+ 3. Pass mode (interactive/auto)
210
+
211
+ Run the appropriate skill:
212
+
213
+ | Element Type | Skill to Run |
214
+ |--------------|--------------|
215
+ | api | `/api-create [name]` |
216
+ | component | `/hustle-ui-create [name]` |
217
+ | combined_api | `/hustle-combine api` |
218
+ | page | `/hustle-ui-create-page [name]` |
219
+
220
+ ### 5.3 Sub-Workflow Behavior
221
+
222
+ When `orchestrated: true`:
223
+ - Skip questions answered in `shared_decisions`
224
+ - Only ask element-specific questions
225
+ - Report completion back to orchestrator
226
+
227
+ ### 5.4 On Completion
228
+
229
+ The `orchestrator-completion.py` hook will:
230
+ 1. Mark workflow as complete in state
231
+ 2. Find next pending workflow
232
+ 3. Inject context for next workflow
233
+
234
+ ---
235
+
236
+ ## Phase 6: Cross-Workflow Wiring
237
+
238
+ After all workflows complete, wire them together:
239
+
240
+ ### 6.1 Import Generation
241
+
242
+ For pages that use components and APIs:
243
+
244
+ ```typescript
245
+ // Auto-generated imports based on registry
246
+ import { UserStatsResponse } from '@/lib/schemas/user-stats.schema';
247
+ import { StatCard } from '@/components/StatCard';
248
+ import { ChartWidget } from '@/components/ChartWidget';
249
+ ```
250
+
251
+ ### 6.2 Prop Wiring
252
+
253
+ Wire component props to API response types:
254
+
255
+ ```typescript
256
+ interface DashboardProps {
257
+ stats: UserStatsResponse;
258
+ chartData: ChartDataResponse;
259
+ }
260
+ ```
261
+
262
+ ### 6.3 Registry Updates
263
+
264
+ Update `.claude/registry.json` with all created elements and their relationships.
265
+
266
+ ---
267
+
268
+ ## Phase 7: Final Verification
269
+
270
+ Run comprehensive test suite:
271
+
272
+ ```bash
273
+ # Run all API tests
274
+ pnpm test src/app/api/v2/[endpoints]
275
+
276
+ # Run component tests
277
+ pnpm test src/components/[components]
278
+
279
+ # Run page E2E tests
280
+ pnpm playwright test src/app/[pages]
281
+
282
+ # Run integration tests
283
+ pnpm test:integration
284
+ ```
285
+
286
+ Report results:
287
+ - Total tests passed/failed
288
+ - Coverage percentage
289
+ - Performance metrics
290
+
291
+ ---
292
+
293
+ ## Phase 8: Documentation Rollup
294
+
295
+ Generate unified documentation:
296
+
297
+ 1. **Feature Doc:** `docs/features/[feature-name].md`
298
+ - Overview from request
299
+ - Architecture diagram
300
+ - API reference links
301
+ - Component guide
302
+ - Testing commands
303
+
304
+ 2. **Registry Updates:**
305
+ - All elements with relationships
306
+ - Execution timeline
307
+ - Decision log
308
+
309
+ 3. **TypeDoc Generation:**
310
+ - Run `pnpm typedoc` for new types
311
+
312
+ ---
313
+
314
+ ## Phase 9: Completion
315
+
316
+ Mark build as complete:
317
+
318
+ ```json
319
+ {
320
+ "status": "complete",
321
+ "completed_at": "[timestamp]",
322
+ "summary": {
323
+ "elements_created": 8,
324
+ "total_tests": 47,
325
+ "tests_passed": 47,
326
+ "duration_minutes": 135
327
+ }
328
+ }
329
+ ```
330
+
331
+ **Output:**
332
+
333
+ ```
334
+ BUILD COMPLETE: [Feature Name]
335
+
336
+ Created:
337
+ APIs: 3 new + 1 combined
338
+ Components: 3 new
339
+ Pages: 1 new
340
+
341
+ Quick Links:
342
+ - View page: /[page-route]
343
+ - API Showcase: /api-showcase
344
+ - UI Showcase: /ui-showcase
345
+ - Dashboard: /hustle-dev-dashboard
346
+
347
+ Next Steps:
348
+ - /commit - Commit all changes
349
+ - /pr - Create pull request
350
+ - /hustle-build-review [build-id] - Review decisions
351
+ ```
352
+
353
+ ---
354
+
355
+ ## Auto Mode Behavior
356
+
357
+ When `--auto` flag is used:
358
+
359
+ 1. **No Interactive Questions:**
360
+ - All questions auto-answered with comprehensive defaults
361
+ - Uses `.claude/hustle-build-defaults.json` for overrides
362
+
363
+ 2. **Error Handling:**
364
+ - Test failures: Retry 3x, then log and continue
365
+ - Verification gaps: Log, continue
366
+ - Missing API keys: Skip element, log warning
367
+
368
+ 3. **Notifications:**
369
+ - Single NTFY notification at completion
370
+ - Includes summary and review link
371
+
372
+ 4. **Logging:**
373
+ - All decisions logged to `.claude/workflow-logs/[build-id].json`
374
+ - Review with `/hustle-build-review [build-id]`
375
+
376
+ ---
377
+
378
+ ## Resume Behavior
379
+
380
+ When `--resume [build-id]` is used:
381
+
382
+ 1. Load state from `.claude/hustle-build-state.json`
383
+ 2. Find last incomplete workflow
384
+ 3. Continue from that point
385
+ 4. Preserve all previous decisions
386
+
387
+ ---
388
+
389
+ ## Dry Run Behavior
390
+
391
+ When `--dry-run` is used:
392
+
393
+ 1. Parse and decompose request
394
+ 2. Show execution plan
395
+ 3. No actual file writes
396
+ 4. Exit after showing plan
397
+
398
+ ---
399
+
400
+ ## Error Recovery
401
+
402
+ If a workflow fails:
403
+
404
+ 1. **Retry Logic:**
405
+ - Automatic retry up to 3 times
406
+ - Exponential backoff
407
+
408
+ 2. **Skip and Continue:**
409
+ - If still failing, mark as failed
410
+ - Continue with non-dependent workflows
411
+ - Log for review
412
+
413
+ 3. **Resume Point:**
414
+ - State preserved for `/hustle-build --resume`
415
+ - Can fix issue and continue
416
+
417
+ ---
418
+
419
+ ## Integration Points
420
+
421
+ ### Hooks Used:
422
+ - `orchestrator-session-startup.py` - Inject build context
423
+ - `orchestrator-handoff.py` - Pass shared decisions
424
+ - `orchestrator-completion.py` - Track progress
425
+ - `auto-answer.py` - Auto-answer in auto mode
426
+ - `ntfy-on-question.py` - Push notifications
427
+
428
+ ### State Files:
429
+ - `.claude/hustle-build-state.json` - Orchestration state
430
+ - `.claude/api-dev-state.json` - Sub-workflow state
431
+ - `.claude/registry.json` - Completed elements
432
+
433
+ ### Log Files:
434
+ - `.claude/workflow-logs/[build-id].json` - Build log
435
+ - `.claude/workflow-logs/ntfy-log.json` - Notification log
436
+
437
+ ---
438
+
439
+ ## Example Usage
440
+
441
+ **Interactive:**
442
+ ```
443
+ /hustle-build dashboard page with user stats, activity charts, and notifications
444
+ ```
445
+
446
+ **Autonomous:**
447
+ ```
448
+ /hustle-build --auto e-commerce checkout flow with Stripe payments
449
+ ```
450
+
451
+ **Resume:**
452
+ ```
453
+ /hustle-build --resume build-2025-12-28-dashboard
454
+ ```
455
+
456
+ **Dry Run:**
457
+ ```
458
+ /hustle-build --dry-run blog system with posts, comments, and author profiles
459
+ ```