@hustle-together/api-dev-tools 3.12.3 → 4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/adr-requests/.gitkeep +10 -0
- package/.claude/agents/adr-researcher.md +109 -0
- package/.claude/agents/visual-analyzer.md +183 -0
- package/.claude/api-dev-state.json +7 -463
- package/.claude/documentation-audit.json +114 -0
- package/.claude/registry.json +289 -0
- package/.claude/settings.json +45 -1
- package/.claude/workflow-logs/None.json +49 -0
- package/.claude/workflow-logs/session-20251230-143727.json +106 -0
- package/.skills/adr-deep-research/SKILL.md +351 -0
- package/.skills/api-create/SKILL.md +116 -17
- package/.skills/api-research/SKILL.md +130 -0
- package/.skills/docs-sync/SKILL.md +260 -0
- package/.skills/docs-update/SKILL.md +205 -0
- package/.skills/hustle-brand/SKILL.md +368 -0
- package/.skills/hustle-build/SKILL.md +786 -0
- package/.skills/hustle-build-review/SKILL.md +518 -0
- package/.skills/parallel-spawn/SKILL.md +212 -0
- package/.skills/ralph-continue/SKILL.md +151 -0
- package/.skills/ralph-loop/SKILL.md +341 -0
- package/.skills/ralph-status/SKILL.md +87 -0
- package/.skills/refactor/SKILL.md +59 -0
- package/.skills/shadcn/SKILL.md +522 -0
- package/.skills/test-all/SKILL.md +210 -0
- package/.skills/test-builds/SKILL.md +208 -0
- package/.skills/test-debug/SKILL.md +212 -0
- package/.skills/test-e2e/SKILL.md +168 -0
- package/.skills/test-review/SKILL.md +707 -0
- package/.skills/test-unit/SKILL.md +143 -0
- package/.skills/test-visual/SKILL.md +301 -0
- package/.skills/token-report/SKILL.md +132 -0
- package/CHANGELOG.md +575 -0
- package/README.md +426 -56
- package/bin/cli.js +1538 -88
- package/commands/hustle-api-create.md +22 -0
- package/commands/hustle-build.md +259 -0
- package/commands/hustle-combine.md +81 -2
- package/commands/hustle-ui-create-page.md +84 -2
- package/commands/hustle-ui-create.md +82 -2
- package/hooks/__pycache__/api-workflow-check.cpython-314.pyc +0 -0
- package/hooks/__pycache__/auto-answer.cpython-314.pyc +0 -0
- package/hooks/__pycache__/cache-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-api-routes.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-playwright-setup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-storybook-setup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-update.cpython-314.pyc +0 -0
- package/hooks/__pycache__/completion-promise-detector.cpython-314.pyc +0 -0
- package/hooks/__pycache__/context-capacity-warning.cpython-314.pyc +0 -0
- package/hooks/__pycache__/detect-interruption.cpython-314.pyc +0 -0
- package/hooks/__pycache__/docs-update-check.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-a11y-audit.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-brand-guide.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-component-type-confirm.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-deep-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-disambiguation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-documentation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-dry-run.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-environment.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-external-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-freshness.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-page-components.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-page-data-schema.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-questions-sourced.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-refactor.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-schema-from-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-schema.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-scope.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-tdd-red.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-ui-disambiguation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-ui-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-verify.cpython-314.pyc +0 -0
- package/hooks/__pycache__/generate-adr-options.cpython-314.pyc +0 -0
- package/hooks/__pycache__/generate-manifest-entry.cpython-314.pyc +0 -0
- package/hooks/__pycache__/hook_utils.cpython-314.pyc +0 -0
- package/hooks/__pycache__/notify-input-needed.cpython-314.pyc +0 -0
- package/hooks/__pycache__/notify-phase-complete.cpython-314.pyc +0 -0
- package/hooks/__pycache__/ntfy-on-question.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-completion.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-handoff.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-session-startup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/parallel-orchestrator.cpython-314.pyc +0 -0
- package/hooks/__pycache__/periodic-reground.cpython-314.pyc +0 -0
- package/hooks/__pycache__/project-document-prompt.cpython-314.pyc +0 -0
- package/hooks/__pycache__/remote-question-proxy.cpython-314.pyc +0 -0
- package/hooks/__pycache__/remote-question-server.cpython-314.pyc +0 -0
- package/hooks/__pycache__/run-code-review.cpython-314.pyc +0 -0
- package/hooks/__pycache__/run-visual-qa.cpython-314.pyc +0 -0
- package/hooks/__pycache__/session-logger.cpython-314.pyc +0 -0
- package/hooks/__pycache__/session-startup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-scope-coverage.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-token-usage.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-tool-use.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-adr-decision.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-api-showcase.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-registry.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-ui-showcase.cpython-314.pyc +0 -0
- package/hooks/__pycache__/verify-after-green.cpython-314.pyc +0 -0
- package/hooks/__pycache__/verify-implementation.cpython-314.pyc +0 -0
- package/hooks/api-workflow-check.py +34 -0
- package/hooks/auto-answer.py +305 -0
- package/hooks/check-update.py +132 -0
- package/hooks/completion-promise-detector.py +293 -0
- package/hooks/context-capacity-warning.py +171 -0
- package/hooks/docs-update-check.py +120 -0
- package/hooks/enforce-dry-run.py +134 -0
- package/hooks/enforce-external-research.py +25 -0
- package/hooks/enforce-interview.py +20 -0
- package/hooks/generate-adr-options.py +282 -0
- package/hooks/hook_utils.py +609 -0
- package/hooks/lib/__pycache__/__init__.cpython-314.pyc +0 -0
- package/hooks/lib/__pycache__/greptile.cpython-314.pyc +0 -0
- package/hooks/lib/__pycache__/ntfy.cpython-314.pyc +0 -0
- package/hooks/ntfy-on-question.py +240 -0
- package/hooks/orchestrator-completion.py +313 -0
- package/hooks/orchestrator-handoff.py +267 -0
- package/hooks/orchestrator-session-startup.py +146 -0
- package/hooks/parallel-orchestrator.py +451 -0
- package/hooks/periodic-reground.py +270 -67
- package/hooks/project-document-prompt.py +302 -0
- package/hooks/remote-question-proxy.py +284 -0
- package/hooks/remote-question-server.py +1224 -0
- package/hooks/run-code-review.py +176 -29
- package/hooks/run-visual-qa.py +338 -0
- package/hooks/session-logger.py +27 -1
- package/hooks/session-startup.py +113 -0
- package/hooks/update-adr-decision.py +236 -0
- package/hooks/update-api-showcase.py +13 -1
- package/hooks/update-testing-checklist.py +195 -0
- package/hooks/update-ui-showcase.py +13 -1
- package/package.json +7 -3
- package/scripts/extract-schema-docs.cjs +322 -0
- package/templates/.skills/hustle-interview/SKILL.md +174 -0
- package/templates/CLAUDE-SECTION.md +89 -64
- package/templates/adr-viewer/_components/ADRViewer.tsx +326 -0
- package/templates/api-dev-state.json +33 -1
- package/templates/api-showcase/_components/APIModal.tsx +100 -8
- package/templates/api-showcase/_components/APIShowcase.tsx +36 -4
- package/templates/api-showcase/_components/APITester.tsx +367 -58
- package/templates/brand-page/page.tsx +645 -0
- package/templates/component/Component.visual.spec.ts +30 -24
- package/templates/docs/page.tsx +230 -0
- package/templates/eslint-plugin-zod-schema/index.js +446 -0
- package/templates/eslint-plugin-zod-schema/package.json +26 -0
- package/templates/github-workflows/security.yml +274 -0
- package/templates/hustle-build-defaults.json +136 -0
- package/templates/hustle-dev-dashboard/page.tsx +365 -0
- package/templates/page/page.e2e.test.ts +30 -26
- package/templates/performance-budgets.json +63 -5
- package/templates/playwright-report/page.tsx +258 -0
- package/templates/registry.json +279 -3
- package/templates/review-dashboard/page.tsx +510 -0
- package/templates/settings.json +155 -7
- package/templates/test-results/page.tsx +237 -0
- package/templates/typedoc.json +19 -0
- package/templates/ui-showcase/_components/UIShowcase.tsx +48 -1
- package/templates/ui-showcase/_components/VisualTestingDashboard.tsx +579 -0
- package/templates/ui-showcase/page.tsx +1 -1
|
@@ -0,0 +1,786 @@
|
|
|
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.6.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 --parallel [description]
|
|
24
|
+
/hustle-build --resume [build-id]
|
|
25
|
+
/hustle-build --dry-run [description]
|
|
26
|
+
/hustle-build --max-iterations [N] [description]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Arguments
|
|
30
|
+
|
|
31
|
+
- `$ARGUMENTS` - Natural language description of what to build
|
|
32
|
+
- `--auto` - Fully autonomous mode, auto-answers questions
|
|
33
|
+
- `--parallel` - Run up to 5 Opus agents in parallel (requires worktrees)
|
|
34
|
+
- `--resume [id]` - Resume an interrupted build
|
|
35
|
+
- `--dry-run` - Show what would be created without executing
|
|
36
|
+
- `--max-iterations [N]` - Max retry iterations per phase (default: 5)
|
|
37
|
+
- `--skip-document` - Skip the project document prompt
|
|
38
|
+
- `--from-document [path]` - Use specified file as project document (PRD, spec)
|
|
39
|
+
|
|
40
|
+
## Parallel Execution (Recommended for Large Builds)
|
|
41
|
+
|
|
42
|
+
When `--parallel` is used, the orchestrator:
|
|
43
|
+
|
|
44
|
+
1. **Creates git worktrees** for each independent workflow
|
|
45
|
+
2. **Spawns up to 5 Opus agents** simultaneously
|
|
46
|
+
3. **Injects shared decisions** into each agent
|
|
47
|
+
4. **Merges results** when all complete
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
51
|
+
│ PARALLEL ORCHESTRATOR │
|
|
52
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
53
|
+
│ │
|
|
54
|
+
│ Shared Context (from Interview) │
|
|
55
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
56
|
+
│ │ Auth: JWT | Errors: partial-success | Brand: yes │ │
|
|
57
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
58
|
+
│ │ │
|
|
59
|
+
│ ┌───────────────┼───────────────┐ │
|
|
60
|
+
│ ▼ ▼ ▼ │
|
|
61
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
|
62
|
+
│ │ Agent #1 │ │ Agent #2 │ │ Agent #3 │ │
|
|
63
|
+
│ │ /api-create │ │ /api-create │ │ /hustle-ui │ │
|
|
64
|
+
│ │ user-stats │ │ chart-data │ │ StatCard │ │
|
|
65
|
+
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
|
66
|
+
│ │ │ │ │
|
|
67
|
+
│ └───────────────┼───────────────┘ │
|
|
68
|
+
│ ▼ │
|
|
69
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
70
|
+
│ │ MERGE COORDINATOR │ │
|
|
71
|
+
│ │ • Combines registry entries │ │
|
|
72
|
+
│ │ • Resolves conflicts │ │
|
|
73
|
+
│ │ • Creates unified PR │ │
|
|
74
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
75
|
+
│ │
|
|
76
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
See [PARALLEL_AUTONOMOUS_WORKFLOW.md](../../docs/PARALLEL_AUTONOMOUS_WORKFLOW.md) for details.
|
|
80
|
+
|
|
81
|
+
## Max Iterations
|
|
82
|
+
|
|
83
|
+
Each phase has a maximum iteration count to prevent infinite loops:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"max_iterations": {
|
|
88
|
+
"default": 5,
|
|
89
|
+
"phases": {
|
|
90
|
+
"disambiguation": 2,
|
|
91
|
+
"research": 3,
|
|
92
|
+
"interview": 1,
|
|
93
|
+
"schema": 3,
|
|
94
|
+
"tdd_red": 5,
|
|
95
|
+
"tdd_green": 10,
|
|
96
|
+
"verify": 3,
|
|
97
|
+
"code_review": 3,
|
|
98
|
+
"refactor": 5
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Override with `--max-iterations`:
|
|
105
|
+
```bash
|
|
106
|
+
# Allow more retries for complex builds
|
|
107
|
+
/hustle-build --max-iterations 10 --auto complex e-commerce system
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
When max iterations reached:
|
|
111
|
+
1. Log issue to `session_archives.interrupted`
|
|
112
|
+
2. Create partial PR with work completed
|
|
113
|
+
3. Notify via NTFY
|
|
114
|
+
4. Continue with other workflows
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Phase 1: Document Intake & Parsing (Optional)
|
|
119
|
+
|
|
120
|
+
At the start of `/hustle-build`, the `project-document-prompt.py` hook asks if you have a comprehensive project document.
|
|
121
|
+
|
|
122
|
+
**Supported Document Types:**
|
|
123
|
+
- PRD (Product Requirements Document)
|
|
124
|
+
- Technical specifications
|
|
125
|
+
- Deep research outputs (from `/plan` or `/spike`)
|
|
126
|
+
- API definitions (OpenAPI, JSON specs)
|
|
127
|
+
|
|
128
|
+
**How to provide:**
|
|
129
|
+
```
|
|
130
|
+
# When prompted, you can:
|
|
131
|
+
1. Provide a file path: ./docs/my-prd.md
|
|
132
|
+
2. Paste content directly
|
|
133
|
+
3. Provide a URL to fetch
|
|
134
|
+
4. Say "no document" to skip
|
|
135
|
+
|
|
136
|
+
# Or skip the prompt entirely:
|
|
137
|
+
/hustle-build --skip-document [description]
|
|
138
|
+
|
|
139
|
+
# Or provide a document directly:
|
|
140
|
+
/hustle-build --from-document ./docs/spec.md [description]
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The document is stored in `state.project_spec.raw_content` for parsing.
|
|
144
|
+
|
|
145
|
+
### Document Parsing (When project_spec exists)
|
|
146
|
+
|
|
147
|
+
If a project document was provided, analyze it to extract structured elements.
|
|
148
|
+
|
|
149
|
+
**Extraction Targets:**
|
|
150
|
+
|
|
151
|
+
| Element Type | Keywords to Find | What to Extract |
|
|
152
|
+
|-------------|------------------|-----------------|
|
|
153
|
+
| Pages | "page", "screen", "route", "/path", "view" | name, route, description, features |
|
|
154
|
+
| Components | "component", "widget", "card", "form", "button" | name, type (display/input/composite), props, variants |
|
|
155
|
+
| APIs | "API", "endpoint", "/api/", "fetch", "GET", "POST" | name, method, path, request/response schemas |
|
|
156
|
+
| Data Models | "model", "schema", "type", "interface", "entity" | name, fields, relationships |
|
|
157
|
+
| Integrations | service names (Stripe, Supabase, Auth0) | service, features used, env vars |
|
|
158
|
+
|
|
159
|
+
**Dependency Graph Construction:**
|
|
160
|
+
- APIs = Tier 1 (no dependencies)
|
|
161
|
+
- Components = Tier 2 (depend on APIs for types)
|
|
162
|
+
- Pages = Tier 3 (depend on components)
|
|
163
|
+
|
|
164
|
+
**Store extracted data in state:**
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"project_spec": {
|
|
169
|
+
"source": "file|paste|url",
|
|
170
|
+
"file_path": "./docs/my-prd.md",
|
|
171
|
+
"raw_content": "[original document]",
|
|
172
|
+
"format": "markdown|json|text",
|
|
173
|
+
"parsed_at": "[timestamp]",
|
|
174
|
+
"word_count": 2500,
|
|
175
|
+
"extracted": {
|
|
176
|
+
"summary": "E-commerce dashboard with user stats and order tracking",
|
|
177
|
+
"pages": [
|
|
178
|
+
{
|
|
179
|
+
"name": "Dashboard",
|
|
180
|
+
"route": "/dashboard",
|
|
181
|
+
"description": "Main user dashboard",
|
|
182
|
+
"features": ["stats display", "order list", "notifications"],
|
|
183
|
+
"uses_components": ["StatCard", "OrderTable"],
|
|
184
|
+
"uses_apis": ["user-stats", "orders"]
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"components": [
|
|
188
|
+
{
|
|
189
|
+
"name": "StatCard",
|
|
190
|
+
"type": "display",
|
|
191
|
+
"description": "Display individual statistic with trend",
|
|
192
|
+
"props": ["title", "value", "trend", "icon"],
|
|
193
|
+
"variants": ["primary", "secondary", "success", "warning"]
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"apis": [
|
|
197
|
+
{
|
|
198
|
+
"name": "user-stats",
|
|
199
|
+
"method": "GET",
|
|
200
|
+
"path": "/api/v2/user-stats",
|
|
201
|
+
"description": "User statistics endpoint",
|
|
202
|
+
"response_fields": ["totalOrders", "revenue", "growth"]
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"data_models": [
|
|
206
|
+
{
|
|
207
|
+
"name": "UserStats",
|
|
208
|
+
"fields": ["totalOrders: number", "revenue: number", "growth: number"]
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"integrations": [
|
|
212
|
+
{
|
|
213
|
+
"service": "supabase",
|
|
214
|
+
"features": ["auth", "database"],
|
|
215
|
+
"env_vars": ["SUPABASE_URL", "SUPABASE_ANON_KEY"]
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
"user_modifications": {
|
|
220
|
+
"added": [],
|
|
221
|
+
"removed": [],
|
|
222
|
+
"modified": []
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Present decomposition for approval:**
|
|
229
|
+
|
|
230
|
+
Use AskUserQuestion:
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
Based on your project document, I've identified:
|
|
234
|
+
|
|
235
|
+
**Pages (2):**
|
|
236
|
+
- Dashboard (/dashboard) - Main user dashboard
|
|
237
|
+
- Orders (/orders) - Order management
|
|
238
|
+
|
|
239
|
+
**Components (4):**
|
|
240
|
+
- StatCard (display) - Display statistic with trend
|
|
241
|
+
- OrderTable (composite) - Order listing
|
|
242
|
+
- OrderRow (display) - Single order row
|
|
243
|
+
- StatusBadge (display) - Order status indicator
|
|
244
|
+
|
|
245
|
+
**APIs (3):**
|
|
246
|
+
- user-stats (GET /api/v2/user-stats)
|
|
247
|
+
- orders (GET /api/v2/orders)
|
|
248
|
+
- order-detail (GET /api/v2/orders/[id])
|
|
249
|
+
|
|
250
|
+
**Data Models (2):**
|
|
251
|
+
- UserStats, Order
|
|
252
|
+
|
|
253
|
+
**Integrations (1):**
|
|
254
|
+
- Supabase (auth, database)
|
|
255
|
+
|
|
256
|
+
Is this decomposition correct?
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Options:
|
|
260
|
+
- "Yes, proceed with this plan (Recommended)"
|
|
261
|
+
- "Add missing elements"
|
|
262
|
+
- "Remove elements"
|
|
263
|
+
- "Re-parse document"
|
|
264
|
+
- "Skip document, use description instead"
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Phase 2: Parse Request
|
|
269
|
+
|
|
270
|
+
Parse the user's natural language request to identify required elements.
|
|
271
|
+
|
|
272
|
+
**Note:** If `project_spec.extracted` exists from Phase 1, use it as the primary decomposition source and skip manual parsing.
|
|
273
|
+
|
|
274
|
+
**Input:** $ARGUMENTS
|
|
275
|
+
|
|
276
|
+
**Look for:**
|
|
277
|
+
- Data requirements (implies APIs)
|
|
278
|
+
- UI elements mentioned (implies components)
|
|
279
|
+
- Page/route requirements (implies pages)
|
|
280
|
+
- Integration patterns (implies combined APIs)
|
|
281
|
+
|
|
282
|
+
**Output:** Initial decomposition with element types and names.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Phase 3: Decompose Into Workflows
|
|
287
|
+
|
|
288
|
+
For each identified element, determine:
|
|
289
|
+
|
|
290
|
+
1. **Element Type:**
|
|
291
|
+
- `api` - Data fetching, external service integration
|
|
292
|
+
- `component` - Reusable UI building block
|
|
293
|
+
- `combined_api` - Aggregation of multiple APIs
|
|
294
|
+
- `page` - Full page with route
|
|
295
|
+
|
|
296
|
+
2. **Dependencies:**
|
|
297
|
+
- APIs have no dependencies (execute first)
|
|
298
|
+
- Components may depend on APIs (for types)
|
|
299
|
+
- Combined APIs depend on source APIs
|
|
300
|
+
- Pages depend on components and APIs
|
|
301
|
+
|
|
302
|
+
3. **Execution Order:**
|
|
303
|
+
- Build dependency graph
|
|
304
|
+
- Topological sort for execution order
|
|
305
|
+
- Group into tiers for potential parallelism
|
|
306
|
+
|
|
307
|
+
**Present decomposition to user:**
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
I've analyzed your request and identified these elements:
|
|
311
|
+
|
|
312
|
+
APIs (Tier 1):
|
|
313
|
+
- user-stats: User statistics endpoint
|
|
314
|
+
- chart-data: Chart data endpoint
|
|
315
|
+
|
|
316
|
+
Components (Tier 2):
|
|
317
|
+
- StatCard: Display individual stat (uses user-stats types)
|
|
318
|
+
- ChartWidget: Render chart (uses chart-data types)
|
|
319
|
+
|
|
320
|
+
Pages (Tier 3):
|
|
321
|
+
- Dashboard: Main dashboard page (uses all components)
|
|
322
|
+
|
|
323
|
+
Does this look correct?
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Use AskUserQuestion with options:
|
|
327
|
+
- "Yes, proceed with this plan (Recommended)"
|
|
328
|
+
- "Add more elements"
|
|
329
|
+
- "Remove elements"
|
|
330
|
+
- "Let me describe differently"
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Phase 4: Orchestrator Interview
|
|
335
|
+
|
|
336
|
+
Ask HIGH-LEVEL questions that apply to ALL sub-workflows.
|
|
337
|
+
|
|
338
|
+
**These questions are asked ONCE and shared:**
|
|
339
|
+
|
|
340
|
+
### Q1: Authentication
|
|
341
|
+
"What's the authentication requirement for this feature?"
|
|
342
|
+
- Protected (requires login) (Recommended)
|
|
343
|
+
- Public (no auth)
|
|
344
|
+
- Mixed (specify per element)
|
|
345
|
+
|
|
346
|
+
### Q2: Error Handling
|
|
347
|
+
"How should errors be handled across APIs?"
|
|
348
|
+
- Partial success (show what works) (Recommended)
|
|
349
|
+
- Fail-fast (one fails = all fail)
|
|
350
|
+
- Retry with fallback
|
|
351
|
+
|
|
352
|
+
### Q3: Brand Guide
|
|
353
|
+
"Use project brand guide for styling?"
|
|
354
|
+
- Yes, use .claude/BRAND_GUIDE.md (Recommended)
|
|
355
|
+
- No, custom theme
|
|
356
|
+
- Match existing page
|
|
357
|
+
|
|
358
|
+
### Q4: Testing Level
|
|
359
|
+
"What level of testing?"
|
|
360
|
+
- Full TDD (all 14 phases per element) (Recommended)
|
|
361
|
+
- Essential tests only
|
|
362
|
+
- Smoke tests only
|
|
363
|
+
|
|
364
|
+
Store all answers in `shared_decisions` - these will be injected into sub-workflows.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Phase 5: Create Orchestration State
|
|
369
|
+
|
|
370
|
+
Create `.claude/hustle-build-state.json`:
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{
|
|
374
|
+
"version": "4.6.0",
|
|
375
|
+
"build_id": "build-[timestamp]-[name]",
|
|
376
|
+
"status": "in_progress",
|
|
377
|
+
"mode": "interactive|auto",
|
|
378
|
+
"created_at": "[ISO timestamp]",
|
|
379
|
+
|
|
380
|
+
"request": {
|
|
381
|
+
"original": "[user's original request]",
|
|
382
|
+
"parsed_at": "[timestamp]"
|
|
383
|
+
},
|
|
384
|
+
|
|
385
|
+
"project_spec": {
|
|
386
|
+
"source": "file|paste|url|none",
|
|
387
|
+
"file_path": "[optional - path to document]",
|
|
388
|
+
"raw_content": "[document content if provided]",
|
|
389
|
+
"format": "markdown|json|text",
|
|
390
|
+
"parsed_at": "[timestamp]",
|
|
391
|
+
"extracted": {
|
|
392
|
+
"summary": "[AI-generated summary]",
|
|
393
|
+
"pages": [],
|
|
394
|
+
"components": [],
|
|
395
|
+
"apis": [],
|
|
396
|
+
"data_models": [],
|
|
397
|
+
"integrations": []
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
|
|
401
|
+
"orchestrator_interview": {
|
|
402
|
+
"status": "complete",
|
|
403
|
+
"decisions": {
|
|
404
|
+
"auth_required": true,
|
|
405
|
+
"error_handling": "partial-success",
|
|
406
|
+
"brand_guide": true,
|
|
407
|
+
"testing_level": "full"
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
|
|
411
|
+
"decomposition": {
|
|
412
|
+
"apis": [
|
|
413
|
+
{"name": "user-stats", "status": "pending", "depends_on": [], "from_project_spec": true}
|
|
414
|
+
],
|
|
415
|
+
"components": [
|
|
416
|
+
{"name": "StatCard", "status": "pending", "depends_on": ["user-stats"], "from_project_spec": true}
|
|
417
|
+
],
|
|
418
|
+
"combined_apis": [],
|
|
419
|
+
"pages": [
|
|
420
|
+
{"name": "Dashboard", "status": "pending", "depends_on": ["StatCard"], "from_project_spec": true}
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
|
|
424
|
+
"shared_decisions": {
|
|
425
|
+
"auth_required": true,
|
|
426
|
+
"error_handling": "partial-success",
|
|
427
|
+
"brand_guide": true,
|
|
428
|
+
"testing_level": "full"
|
|
429
|
+
},
|
|
430
|
+
|
|
431
|
+
"active_sub_workflow": null,
|
|
432
|
+
"completed_sub_workflows": []
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
**Note:** Elements with `from_project_spec: true` were extracted from the project document. This helps track provenance and allows referencing the original spec during implementation.
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## Phase 6: Execute Workflows
|
|
441
|
+
|
|
442
|
+
For each workflow in execution order:
|
|
443
|
+
|
|
444
|
+
### 6.1 Set Active Workflow
|
|
445
|
+
|
|
446
|
+
Update state:
|
|
447
|
+
```json
|
|
448
|
+
"active_sub_workflow": {
|
|
449
|
+
"type": "api",
|
|
450
|
+
"name": "user-stats",
|
|
451
|
+
"workflow_id": "wf-001",
|
|
452
|
+
"started_at": "[timestamp]"
|
|
453
|
+
}
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### 6.2 Invoke Sub-Workflow
|
|
457
|
+
|
|
458
|
+
The orchestrator hooks will automatically:
|
|
459
|
+
1. Inject `shared_decisions` into `api-dev-state.json`
|
|
460
|
+
2. Mark workflow as `orchestrated: true`
|
|
461
|
+
3. Pass mode (interactive/auto)
|
|
462
|
+
|
|
463
|
+
Run the appropriate skill:
|
|
464
|
+
|
|
465
|
+
| Element Type | Skill to Run |
|
|
466
|
+
|--------------|--------------|
|
|
467
|
+
| api | `/api-create [name]` |
|
|
468
|
+
| component | `/hustle-ui-create [name]` |
|
|
469
|
+
| combined_api | `/hustle-combine api` |
|
|
470
|
+
| page | `/hustle-ui-create-page [name]` |
|
|
471
|
+
|
|
472
|
+
### 6.3 Sub-Workflow Behavior
|
|
473
|
+
|
|
474
|
+
When `orchestrated: true`:
|
|
475
|
+
- Skip questions answered in `shared_decisions`
|
|
476
|
+
- Only ask element-specific questions
|
|
477
|
+
- Report completion back to orchestrator
|
|
478
|
+
|
|
479
|
+
### 6.4 On Completion
|
|
480
|
+
|
|
481
|
+
When a sub-workflow completes:
|
|
482
|
+
|
|
483
|
+
1. **Mark Complete:** Update state with `"status": "complete"`
|
|
484
|
+
2. **Find Next:** Identify next pending workflow in decomposition
|
|
485
|
+
|
|
486
|
+
3. **⚠️ CRITICAL: Use AskUserQuestion for Transitions**
|
|
487
|
+
|
|
488
|
+
You MUST use `AskUserQuestion` tool (not plain text) to ask about continuing:
|
|
489
|
+
|
|
490
|
+
```json
|
|
491
|
+
{
|
|
492
|
+
"questions": [{
|
|
493
|
+
"question": "✅ Completed [workflow-name]. Next: [next-name]. Continue?",
|
|
494
|
+
"header": "Continue",
|
|
495
|
+
"multiSelect": false,
|
|
496
|
+
"options": [
|
|
497
|
+
{"label": "Yes, proceed (Recommended)", "description": "Continue to next workflow"},
|
|
498
|
+
{"label": "Review first", "description": "Show me what was created"},
|
|
499
|
+
{"label": "Stop here", "description": "Pause build for review"}
|
|
500
|
+
]
|
|
501
|
+
}]
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**Why:** The `auto-answer.py` hook only intercepts `AskUserQuestion` tool calls.
|
|
506
|
+
If you use plain text like "Should I continue?", auto-mode will halt.
|
|
507
|
+
|
|
508
|
+
4. **Inject Context:** Pass shared_decisions and completed element info to next workflow
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
## Phase 7: Cross-Workflow Wiring
|
|
513
|
+
|
|
514
|
+
After all workflows complete, wire them together:
|
|
515
|
+
|
|
516
|
+
### 7.1 Import Generation
|
|
517
|
+
|
|
518
|
+
For pages that use components and APIs:
|
|
519
|
+
|
|
520
|
+
```typescript
|
|
521
|
+
// Auto-generated imports based on registry
|
|
522
|
+
import { UserStatsResponse } from '@/lib/schemas/user-stats.schema';
|
|
523
|
+
import { StatCard } from '@/components/StatCard';
|
|
524
|
+
import { ChartWidget } from '@/components/ChartWidget';
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### 7.2 Prop Wiring
|
|
528
|
+
|
|
529
|
+
Wire component props to API response types:
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
interface DashboardProps {
|
|
533
|
+
stats: UserStatsResponse;
|
|
534
|
+
chartData: ChartDataResponse;
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### 7.3 Registry Updates
|
|
539
|
+
|
|
540
|
+
Update `.claude/registry.json` with all created elements and their relationships.
|
|
541
|
+
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
## Phase 8: Final Verification
|
|
545
|
+
|
|
546
|
+
Run comprehensive test suite:
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
# Run all API tests
|
|
550
|
+
pnpm test src/app/api/v2/[endpoints]
|
|
551
|
+
|
|
552
|
+
# Run component tests
|
|
553
|
+
pnpm test src/components/[components]
|
|
554
|
+
|
|
555
|
+
# Run page E2E tests
|
|
556
|
+
pnpm playwright test src/app/[pages]
|
|
557
|
+
|
|
558
|
+
# Run integration tests
|
|
559
|
+
pnpm test:integration
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
Report results:
|
|
563
|
+
- Total tests passed/failed
|
|
564
|
+
- Coverage percentage
|
|
565
|
+
- Performance metrics
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
## Phase 9: Documentation Rollup
|
|
570
|
+
|
|
571
|
+
Generate unified documentation:
|
|
572
|
+
|
|
573
|
+
1. **Feature Doc:** `docs/features/[feature-name].md`
|
|
574
|
+
- Overview from request
|
|
575
|
+
- Architecture diagram
|
|
576
|
+
- API reference links
|
|
577
|
+
- Component guide
|
|
578
|
+
- Testing commands
|
|
579
|
+
|
|
580
|
+
2. **Registry Updates:**
|
|
581
|
+
- All elements with relationships
|
|
582
|
+
- Execution timeline
|
|
583
|
+
- Decision log
|
|
584
|
+
|
|
585
|
+
3. **TypeDoc Generation:**
|
|
586
|
+
- Run `pnpm typedoc` for new types
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
## Phase 10: Completion
|
|
591
|
+
|
|
592
|
+
Mark build as complete:
|
|
593
|
+
|
|
594
|
+
```json
|
|
595
|
+
{
|
|
596
|
+
"status": "complete",
|
|
597
|
+
"completed_at": "[timestamp]",
|
|
598
|
+
"summary": {
|
|
599
|
+
"elements_created": 8,
|
|
600
|
+
"total_tests": 47,
|
|
601
|
+
"tests_passed": 47,
|
|
602
|
+
"duration_minutes": 135
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
**Output:**
|
|
608
|
+
|
|
609
|
+
```
|
|
610
|
+
BUILD COMPLETE: [Feature Name]
|
|
611
|
+
|
|
612
|
+
Created:
|
|
613
|
+
APIs: 3 new + 1 combined
|
|
614
|
+
Components: 3 new
|
|
615
|
+
Pages: 1 new
|
|
616
|
+
|
|
617
|
+
Quick Links:
|
|
618
|
+
- View page: /[page-route]
|
|
619
|
+
- API Showcase: /api-showcase
|
|
620
|
+
- UI Showcase: /ui-showcase
|
|
621
|
+
- Dashboard: /hustle-dev-dashboard
|
|
622
|
+
|
|
623
|
+
Next Steps:
|
|
624
|
+
- /commit - Commit all changes
|
|
625
|
+
- /pr - Create pull request
|
|
626
|
+
- /hustle-build-review [build-id] - Review decisions
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
---
|
|
630
|
+
|
|
631
|
+
## Auto Mode Behavior (Test Mode)
|
|
632
|
+
|
|
633
|
+
When `--auto` flag is used, the workflow runs end-to-end without prompts:
|
|
634
|
+
|
|
635
|
+
```bash
|
|
636
|
+
# Full autonomous build - perfect for testing
|
|
637
|
+
/hustle-build --auto "photo gallery with search and favorites"
|
|
638
|
+
|
|
639
|
+
# Autonomous with parallel execution
|
|
640
|
+
/hustle-build --auto --parallel "e-commerce checkout flow"
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
### How It Works
|
|
644
|
+
|
|
645
|
+
1. **No Interactive Questions:**
|
|
646
|
+
- All questions auto-answered with comprehensive defaults
|
|
647
|
+
- Uses `.claude/hustle-build-defaults.json` for overrides
|
|
648
|
+
- Selects "recommended" option for every choice
|
|
649
|
+
- Uses `AskUserQuestion` tool for all prompts (auto-answer.py intercepts)
|
|
650
|
+
|
|
651
|
+
2. **ALL Phases Execute:**
|
|
652
|
+
- Auto mode ONLY auto-answers questions, it does NOT skip phases
|
|
653
|
+
- Every sub-workflow runs all 14 phases
|
|
654
|
+
- If a phase can't fully complete (missing API key), mark as "partial" not "skipped"
|
|
655
|
+
|
|
656
|
+
3. **Error Handling:**
|
|
657
|
+
- Test failures: Retry 3x, then fix issues
|
|
658
|
+
- Verification gaps: Add tests for gaps, then fix
|
|
659
|
+
- Missing API keys: Mark phase "partial", continue
|
|
660
|
+
|
|
661
|
+
4. **Notifications:**
|
|
662
|
+
- Single NTFY notification at completion
|
|
663
|
+
- Includes summary and review link
|
|
664
|
+
|
|
665
|
+
5. **Logging:**
|
|
666
|
+
- All decisions logged to `.claude/workflow-logs/[build-id].json`
|
|
667
|
+
- Review with `/hustle-build-review [build-id]`
|
|
668
|
+
|
|
669
|
+
### Customizing Defaults
|
|
670
|
+
|
|
671
|
+
Copy the template and customize for your project:
|
|
672
|
+
|
|
673
|
+
```bash
|
|
674
|
+
cp templates/hustle-build-defaults.json .claude/hustle-build-defaults.json
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
Then edit `.claude/hustle-build-defaults.json`:
|
|
678
|
+
|
|
679
|
+
```json
|
|
680
|
+
{
|
|
681
|
+
"orchestrator": {
|
|
682
|
+
"auth_required": true, // Change to false for public APIs
|
|
683
|
+
"error_handling": "partial-success",
|
|
684
|
+
"brand_guide": true,
|
|
685
|
+
"testing_level": "essential" // Change from "full" for faster runs
|
|
686
|
+
},
|
|
687
|
+
"testing": {
|
|
688
|
+
"coverage_threshold": 80,
|
|
689
|
+
"e2e_tests": false // Skip E2E for faster testing
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
### Use Cases
|
|
695
|
+
|
|
696
|
+
| Scenario | Command |
|
|
697
|
+
|----------|---------|
|
|
698
|
+
| Full end-to-end test | `/hustle-build --auto "feature"` |
|
|
699
|
+
| Quick test (skip E2E) | Edit defaults, then `--auto` |
|
|
700
|
+
| CI/CD integration | `/hustle-build --auto --dry-run` first |
|
|
701
|
+
| Demo mode | `/hustle-build --auto --parallel` |
|
|
702
|
+
|
|
703
|
+
---
|
|
704
|
+
|
|
705
|
+
## Resume Behavior
|
|
706
|
+
|
|
707
|
+
When `--resume [build-id]` is used:
|
|
708
|
+
|
|
709
|
+
1. Load state from `.claude/hustle-build-state.json`
|
|
710
|
+
2. Find last incomplete workflow
|
|
711
|
+
3. Continue from that point
|
|
712
|
+
4. Preserve all previous decisions
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
716
|
+
## Dry Run Behavior
|
|
717
|
+
|
|
718
|
+
When `--dry-run` is used:
|
|
719
|
+
|
|
720
|
+
1. Parse and decompose request
|
|
721
|
+
2. Show execution plan
|
|
722
|
+
3. No actual file writes
|
|
723
|
+
4. Exit after showing plan
|
|
724
|
+
|
|
725
|
+
---
|
|
726
|
+
|
|
727
|
+
## Error Recovery
|
|
728
|
+
|
|
729
|
+
If a workflow fails:
|
|
730
|
+
|
|
731
|
+
1. **Retry Logic:**
|
|
732
|
+
- Automatic retry up to 3 times
|
|
733
|
+
- Exponential backoff
|
|
734
|
+
|
|
735
|
+
2. **Skip and Continue:**
|
|
736
|
+
- If still failing, mark as failed
|
|
737
|
+
- Continue with non-dependent workflows
|
|
738
|
+
- Log for review
|
|
739
|
+
|
|
740
|
+
3. **Resume Point:**
|
|
741
|
+
- State preserved for `/hustle-build --resume`
|
|
742
|
+
- Can fix issue and continue
|
|
743
|
+
|
|
744
|
+
---
|
|
745
|
+
|
|
746
|
+
## Integration Points
|
|
747
|
+
|
|
748
|
+
### Hooks Used:
|
|
749
|
+
- `orchestrator-session-startup.py` - Inject build context
|
|
750
|
+
- `orchestrator-handoff.py` - Pass shared decisions
|
|
751
|
+
- `orchestrator-completion.py` - Track progress
|
|
752
|
+
- `auto-answer.py` - Auto-answer in auto mode
|
|
753
|
+
- `ntfy-on-question.py` - Push notifications
|
|
754
|
+
|
|
755
|
+
### State Files:
|
|
756
|
+
- `.claude/hustle-build-state.json` - Orchestration state
|
|
757
|
+
- `.claude/api-dev-state.json` - Sub-workflow state
|
|
758
|
+
- `.claude/registry.json` - Completed elements
|
|
759
|
+
|
|
760
|
+
### Log Files:
|
|
761
|
+
- `.claude/workflow-logs/[build-id].json` - Build log
|
|
762
|
+
- `.claude/workflow-logs/ntfy-log.json` - Notification log
|
|
763
|
+
|
|
764
|
+
---
|
|
765
|
+
|
|
766
|
+
## Example Usage
|
|
767
|
+
|
|
768
|
+
**Interactive:**
|
|
769
|
+
```
|
|
770
|
+
/hustle-build dashboard page with user stats, activity charts, and notifications
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
**Autonomous:**
|
|
774
|
+
```
|
|
775
|
+
/hustle-build --auto e-commerce checkout flow with Stripe payments
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
**Resume:**
|
|
779
|
+
```
|
|
780
|
+
/hustle-build --resume build-2025-12-28-dashboard
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
**Dry Run:**
|
|
784
|
+
```
|
|
785
|
+
/hustle-build --dry-run blog system with posts, comments, and author profiles
|
|
786
|
+
```
|