ai-phase-builder 1.0.10 → 1.2.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.
Files changed (35) hide show
  1. package/README.md +289 -289
  2. package/dist/cli/commands/init.js +110 -110
  3. package/dist/cli/commands/refine.d.ts.map +1 -1
  4. package/dist/cli/commands/refine.js +34 -12
  5. package/dist/cli/commands/refine.js.map +1 -1
  6. package/dist/cli/commands/rollback.js +20 -20
  7. package/dist/cli/commands/run.d.ts.map +1 -1
  8. package/dist/cli/commands/run.js +203 -64
  9. package/dist/cli/commands/run.js.map +1 -1
  10. package/dist/cli/commands/sync.js +9 -9
  11. package/dist/cli/index.js +1 -1
  12. package/dist/core/auto-fix.d.ts +23 -0
  13. package/dist/core/auto-fix.d.ts.map +1 -0
  14. package/dist/core/auto-fix.js +219 -0
  15. package/dist/core/auto-fix.js.map +1 -0
  16. package/dist/core/config-manager.d.ts.map +1 -1
  17. package/dist/core/config-manager.js +59 -30
  18. package/dist/core/config-manager.js.map +1 -1
  19. package/dist/core/cursor-cli.d.ts +22 -3
  20. package/dist/core/cursor-cli.d.ts.map +1 -1
  21. package/dist/core/cursor-cli.js +122 -21
  22. package/dist/core/cursor-cli.js.map +1 -1
  23. package/dist/core/docs-provider.d.ts +29 -0
  24. package/dist/core/docs-provider.d.ts.map +1 -0
  25. package/dist/core/docs-provider.js +425 -0
  26. package/dist/core/docs-provider.js.map +1 -0
  27. package/dist/core/preflight-checks.d.ts +21 -0
  28. package/dist/core/preflight-checks.d.ts.map +1 -0
  29. package/dist/core/preflight-checks.js +293 -0
  30. package/dist/core/preflight-checks.js.map +1 -0
  31. package/dist/core/prompt-builder.d.ts.map +1 -1
  32. package/dist/core/prompt-builder.js +273 -265
  33. package/dist/core/prompt-builder.js.map +1 -1
  34. package/dist/core/state-manager.js +38 -38
  35. package/package.json +63 -64
package/README.md CHANGED
@@ -1,289 +1,289 @@
1
- # AI Phase Builder
2
-
3
- Fully automated AI-powered project phase orchestration for Cursor IDE. Transform your ideas into structured, executable development phases that run automatically via the Cursor CLI.
4
-
5
- ## Features
6
-
7
- - **100% Hands-Off** - Just describe your idea, everything else is automated
8
- - **Auto-Run All Phases** - Phases execute sequentially without intervention
9
- - **Auto GitHub Repo** - Creates private GitHub repo and pushes automatically
10
- - **Idea Refinement Chain** - Turn rough ideas into comprehensive specs using Claude Opus
11
- - **Phase Structuring** - Break projects into logical, executable phases
12
- - **Smart Handovers** - Auto-generated context-aware transitions between phases
13
- - **Rollback Support** - Retry failed phases with learned context (max 3 attempts)
14
- - **Drift Detection** - Track manual changes made outside of phase runs
15
- - **Context7 Integration** - Always use up-to-date documentation
16
- - **Git Integration** - Auto-commit and auto-push after each phase
17
-
18
- ## Requirements
19
-
20
- - Node.js 18+
21
- - Cursor IDE with active subscription
22
- - Cursor CLI (`cursor-agent`) installed
23
- - Context7 MCP enabled (recommended)
24
-
25
- ## Installation
26
-
27
- ```bash
28
- # Install Cursor CLI first
29
- curl https://cursor.com/install -fsS | bash
30
-
31
- # Global install of AI Phase Builder
32
- npm install -g ai-phase-builder
33
-
34
- # Or run directly
35
- npx ai-phase-builder
36
- ```
37
-
38
- ## Quick Start
39
-
40
- ```bash
41
- # First time setup - opens browser for Cursor login
42
- ai-phases config --setup
43
-
44
- # Create project folder and initialize
45
- mkdir my-project && cd my-project
46
- ai-phases init
47
-
48
- # ONE COMMAND does everything:
49
- ai-phases refine "build a crypto price dashboard with real-time updates"
50
-
51
- # That's it! The tool will:
52
- # 1. Generate enhanced specification (Claude Opus)
53
- # 2. Create phase plan with tasks
54
- # 3. Create private GitHub repo
55
- # 4. Run ALL phases automatically
56
- # 5. Commit & push after each phase
57
- # 6. Generate handovers between phases
58
- ```
59
-
60
- ### Want Manual Control?
61
-
62
- ```bash
63
- # Generate plan without auto-running phases
64
- ai-phases refine "your idea" --no-auto-run
65
-
66
- # Then run phases individually
67
- ai-phases run --phase 1
68
- ai-phases run --phase 2
69
- ```
70
-
71
- ## Commands
72
-
73
- | Command | Description |
74
- |---------|-------------|
75
- | `ai-phases init` | Initialize AI Phase Builder in current project |
76
- | `ai-phases refine <idea>` | Transform idea into enhanced spec + phase plan (automated) |
77
- | `ai-phases plan` | Create or edit phase plan manually |
78
- | `ai-phases run --phase N` | Execute a specific phase (automated) |
79
- | `ai-phases status` | Show current project status |
80
- | `ai-phases handover` | Generate handover summary for current phase (automated) |
81
- | `ai-phases rollback` | Rollback a failed phase to retry |
82
- | `ai-phases sync` | Detect and reconcile manual changes |
83
- | `ai-phases config` | Manage configuration |
84
-
85
- ## How It Works
86
-
87
- ### 1. Idea Refinement Chain (Automated)
88
-
89
- Your rough idea goes through a fully automated two-stage enhancement:
90
-
91
- ```
92
- Your Idea → [Superprompt Enhancement] → [Phase Structuring] → Executable Plan
93
- Claude Opus (auto) Claude Opus (auto)
94
- ```
95
-
96
- No manual input required. The CLI runs both stages automatically via `cursor-agent`.
97
-
98
- ### 2. Model Routing
99
-
100
- - **Claude Opus** - Planning, architecture decisions, complex reasoning
101
- - **Gemini Flash** - Coding, code review, handover generation
102
-
103
- All models are accessed through your Cursor subscription via the CLI.
104
-
105
- ### 3. Phase Execution (Fully Automated)
106
-
107
- Each phase runs automatically:
108
-
109
- ```bash
110
- ai-phases run --phase 1
111
- # → cursor-agent executes the phase prompt
112
- # → Changes are applied automatically
113
- # → Handover is generated for next phase
114
- # → Git checkpoint is created
115
- ```
116
-
117
- ```
118
- Phase N Context (ONLY these):
119
- ├── Phase description + tasks
120
- ├── Validation checklist
121
- ├── Handover from Phase N-1 (summarized)
122
- ├── Context7 docs (fetched fresh)
123
- └── Failure report (if retrying)
124
-
125
- NOT included (cleared):
126
- ├── Full project specification
127
- ├── Research findings
128
- ├── Context from Phase N-2 and earlier
129
- └── Previous attempt details (except failures)
130
- ```
131
-
132
- ### 4. Failure Handling
133
-
134
- - Max 3 attempts per phase before blocking
135
- - Failure reports capture what went wrong automatically
136
- - Rollback notes guide the next attempt
137
- - Blocked phases require manual intervention
138
-
139
- ## Project Structure
140
-
141
- When initialized, creates:
142
-
143
- ```
144
- .ai-phases/
145
- ├── config.json # Project settings
146
- ├── state.json # Phase tracking state
147
- ├── context.md # Persistent project context
148
- ├── plan.md # Master phase plan
149
- ├── enhanced-spec.md # AI-enhanced specification
150
- ├── phases/
151
- │ ├── phase-1/
152
- │ │ ├── state.json
153
- │ │ ├── prompt.md
154
- │ │ ├── handover.md
155
- │ │ └── attempt-1/
156
- │ │ ├── output.md
157
- │ │ └── error.md (if failed)
158
- │ └── phase-2/
159
- │ └── ...
160
- ├── logs/
161
- │ └── drift.log
162
- └── templates/
163
- ├── handover.md
164
- ├── failure-report.md
165
- └── phase-prompt.md
166
- ```
167
-
168
- ## Configuration
169
-
170
- Global config stored at: `~/.ai-phase-builder/config.json`
171
-
172
- ```json
173
- {
174
- "cursor": {
175
- "planning_model": "opus-4.5",
176
- "execution_model": "gemini-3-flash",
177
- "context7_enabled": true
178
- },
179
- "defaults": {
180
- "ui_library": "shadcn",
181
- "design_system": "vercel",
182
- "auto_commit": true,
183
- "auto_push": true,
184
- "auto_run_phases": true,
185
- "auto_create_repo": true,
186
- "github_visibility": "private",
187
- "max_retry_attempts": 3
188
- }
189
- }
190
- ```
191
-
192
- ### Automation Options
193
-
194
- | Option | Default | Description |
195
- |--------|---------|-------------|
196
- | `auto_run_phases` | `true` | Automatically run all phases after `refine` |
197
- | `auto_create_repo` | `true` | Create GitHub repo automatically |
198
- | `github_visibility` | `private` | Repo visibility (private/public) |
199
- | `auto_commit` | `true` | Commit after each phase |
200
- | `auto_push` | `true` | Push to remote after each commit |
201
-
202
- ### Cursor CLI Authentication
203
-
204
- The tool uses Cursor's browser-based authentication - no API keys needed!
205
-
206
- During setup, you'll be prompted to login:
207
- ```bash
208
- ai-phases config --setup
209
- # → Opens browser for Cursor login (one-time)
210
- ```
211
-
212
- Or login manually anytime:
213
- ```bash
214
- cursor-agent login # Opens browser to authenticate
215
- cursor-agent status # Check if logged in
216
- cursor-agent logout # Sign out
217
- ```
218
-
219
- ## Context7 Integration
220
-
221
- Context7 MCP provides up-to-date documentation directly in Cursor. Enable it:
222
-
223
- 1. Open Cursor Settings (Cmd+,)
224
- 2. Go to: Features → MCP Servers
225
- 3. Add Context7: https://context7.com/docs/clients/cursor
226
- 4. Restart Cursor
227
-
228
- ## Example Workflow
229
-
230
- ```bash
231
- # 1. Start with an idea (runs automatically)
232
- ai-phases refine "build a task management app with drag-and-drop"
233
-
234
- # Output:
235
- # ✓ Enhanced specification generated in 45s
236
- # ✓ Phase plan generated in 32s
237
- # ✓ 5 phases created
238
- #
239
- # Ready to execute! Run:
240
- # ai-phases run --phase 1
241
-
242
- # 2. Execute phases (each runs automatically)
243
- ai-phases run --phase 1
244
- # → Phase executes via cursor-agent
245
- # → Handover auto-generated
246
- # → Git checkpoint created
247
-
248
- ai-phases run --phase 2
249
- ai-phases run --phase 3
250
- # ...
251
-
252
- # 3. If a phase fails, it auto-saves the error
253
- ai-phases rollback --phase 3
254
- ai-phases run --phase 3
255
-
256
- # 4. Check status anytime
257
- ai-phases status --verbose
258
- ```
259
-
260
- ## Dry Run Mode
261
-
262
- Preview what will be executed without running:
263
-
264
- ```bash
265
- ai-phases run --phase 1 --dry-run
266
- ```
267
-
268
- ## Troubleshooting
269
-
270
- ### "cursor-agent CLI not found"
271
- Install the Cursor CLI:
272
- ```bash
273
- curl https://cursor.com/install -fsS | bash
274
- ```
275
-
276
- ### "Not logged in to Cursor CLI"
277
- Authenticate with your browser:
278
- ```bash
279
- cursor-agent login
280
- ```
281
-
282
- ### Phase keeps failing
283
- 1. Check the error in `.ai-phases/phases/phase-N/attempt-X/error.md`
284
- 2. Use `ai-phases rollback --phase N` to reset
285
- 3. Consider simplifying the phase tasks in `plan.md`
286
-
287
- ## License
288
-
289
- MIT
1
+ # AI Phase Builder
2
+
3
+ Fully automated AI-powered project phase orchestration for Cursor IDE. Transform your ideas into structured, executable development phases that run automatically via the Cursor CLI.
4
+
5
+ ## Features
6
+
7
+ - **100% Hands-Off** - Just describe your idea, everything else is automated
8
+ - **Auto-Run All Phases** - Phases execute sequentially without intervention
9
+ - **Auto GitHub Repo** - Creates private GitHub repo and pushes automatically
10
+ - **Idea Refinement Chain** - Turn rough ideas into comprehensive specs using Claude Opus
11
+ - **Phase Structuring** - Break projects into logical, executable phases
12
+ - **Smart Handovers** - Auto-generated context-aware transitions between phases
13
+ - **Rollback Support** - Retry failed phases with learned context (max 3 attempts)
14
+ - **Drift Detection** - Track manual changes made outside of phase runs
15
+ - **Context7 Integration** - Always use up-to-date documentation
16
+ - **Git Integration** - Auto-commit and auto-push after each phase
17
+
18
+ ## Requirements
19
+
20
+ - Node.js 18+
21
+ - Cursor IDE with active subscription
22
+ - Cursor CLI (`cursor-agent`) installed
23
+ - Context7 MCP enabled (recommended)
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ # Install Cursor CLI first
29
+ curl https://cursor.com/install -fsS | bash
30
+
31
+ # Global install of AI Phase Builder
32
+ npm install -g ai-phase-builder
33
+
34
+ # Or run directly
35
+ npx ai-phase-builder
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ ```bash
41
+ # First time setup - opens browser for Cursor login
42
+ ai-phases config --setup
43
+
44
+ # Create project folder and initialize
45
+ mkdir my-project && cd my-project
46
+ ai-phases init
47
+
48
+ # ONE COMMAND does everything:
49
+ ai-phases refine "build a crypto price dashboard with real-time updates"
50
+
51
+ # That's it! The tool will:
52
+ # 1. Generate enhanced specification (Claude Opus)
53
+ # 2. Create phase plan with tasks
54
+ # 3. Create private GitHub repo
55
+ # 4. Run ALL phases automatically
56
+ # 5. Commit & push after each phase
57
+ # 6. Generate handovers between phases
58
+ ```
59
+
60
+ ### Want Manual Control?
61
+
62
+ ```bash
63
+ # Generate plan without auto-running phases
64
+ ai-phases refine "your idea" --no-auto-run
65
+
66
+ # Then run phases individually
67
+ ai-phases run --phase 1
68
+ ai-phases run --phase 2
69
+ ```
70
+
71
+ ## Commands
72
+
73
+ | Command | Description |
74
+ |---------|-------------|
75
+ | `ai-phases init` | Initialize AI Phase Builder in current project |
76
+ | `ai-phases refine <idea>` | Transform idea into enhanced spec + phase plan (automated) |
77
+ | `ai-phases plan` | Create or edit phase plan manually |
78
+ | `ai-phases run --phase N` | Execute a specific phase (automated) |
79
+ | `ai-phases status` | Show current project status |
80
+ | `ai-phases handover` | Generate handover summary for current phase (automated) |
81
+ | `ai-phases rollback` | Rollback a failed phase to retry |
82
+ | `ai-phases sync` | Detect and reconcile manual changes |
83
+ | `ai-phases config` | Manage configuration |
84
+
85
+ ## How It Works
86
+
87
+ ### 1. Idea Refinement Chain (Automated)
88
+
89
+ Your rough idea goes through a fully automated two-stage enhancement:
90
+
91
+ ```
92
+ Your Idea → [Superprompt Enhancement] → [Phase Structuring] → Executable Plan
93
+ Claude Opus (auto) Claude Opus (auto)
94
+ ```
95
+
96
+ No manual input required. The CLI runs both stages automatically via `cursor-agent`.
97
+
98
+ ### 2. Model Routing
99
+
100
+ - **Claude Opus** - Planning, architecture decisions, complex reasoning
101
+ - **Gemini Flash** - Coding, code review, handover generation
102
+
103
+ All models are accessed through your Cursor subscription via the CLI.
104
+
105
+ ### 3. Phase Execution (Fully Automated)
106
+
107
+ Each phase runs automatically:
108
+
109
+ ```bash
110
+ ai-phases run --phase 1
111
+ # → cursor-agent executes the phase prompt
112
+ # → Changes are applied automatically
113
+ # → Handover is generated for next phase
114
+ # → Git checkpoint is created
115
+ ```
116
+
117
+ ```
118
+ Phase N Context (ONLY these):
119
+ ├── Phase description + tasks
120
+ ├── Validation checklist
121
+ ├── Handover from Phase N-1 (summarized)
122
+ ├── Context7 docs (fetched fresh)
123
+ └── Failure report (if retrying)
124
+
125
+ NOT included (cleared):
126
+ ├── Full project specification
127
+ ├── Research findings
128
+ ├── Context from Phase N-2 and earlier
129
+ └── Previous attempt details (except failures)
130
+ ```
131
+
132
+ ### 4. Failure Handling
133
+
134
+ - Max 3 attempts per phase before blocking
135
+ - Failure reports capture what went wrong automatically
136
+ - Rollback notes guide the next attempt
137
+ - Blocked phases require manual intervention
138
+
139
+ ## Project Structure
140
+
141
+ When initialized, creates:
142
+
143
+ ```
144
+ .ai-phases/
145
+ ├── config.json # Project settings
146
+ ├── state.json # Phase tracking state
147
+ ├── context.md # Persistent project context
148
+ ├── plan.md # Master phase plan
149
+ ├── enhanced-spec.md # AI-enhanced specification
150
+ ├── phases/
151
+ │ ├── phase-1/
152
+ │ │ ├── state.json
153
+ │ │ ├── prompt.md
154
+ │ │ ├── handover.md
155
+ │ │ └── attempt-1/
156
+ │ │ ├── output.md
157
+ │ │ └── error.md (if failed)
158
+ │ └── phase-2/
159
+ │ └── ...
160
+ ├── logs/
161
+ │ └── drift.log
162
+ └── templates/
163
+ ├── handover.md
164
+ ├── failure-report.md
165
+ └── phase-prompt.md
166
+ ```
167
+
168
+ ## Configuration
169
+
170
+ Global config stored at: `~/.ai-phase-builder/config.json`
171
+
172
+ ```json
173
+ {
174
+ "cursor": {
175
+ "planning_model": "opus-4.5",
176
+ "execution_model": "gemini-3-flash",
177
+ "context7_enabled": true
178
+ },
179
+ "defaults": {
180
+ "ui_library": "shadcn",
181
+ "design_system": "vercel",
182
+ "auto_commit": true,
183
+ "auto_push": true,
184
+ "auto_run_phases": true,
185
+ "auto_create_repo": true,
186
+ "github_visibility": "private",
187
+ "max_retry_attempts": 3
188
+ }
189
+ }
190
+ ```
191
+
192
+ ### Automation Options
193
+
194
+ | Option | Default | Description |
195
+ |--------|---------|-------------|
196
+ | `auto_run_phases` | `true` | Automatically run all phases after `refine` |
197
+ | `auto_create_repo` | `true` | Create GitHub repo automatically |
198
+ | `github_visibility` | `private` | Repo visibility (private/public) |
199
+ | `auto_commit` | `true` | Commit after each phase |
200
+ | `auto_push` | `true` | Push to remote after each commit |
201
+
202
+ ### Cursor CLI Authentication
203
+
204
+ The tool uses Cursor's browser-based authentication - no API keys needed!
205
+
206
+ During setup, you'll be prompted to login:
207
+ ```bash
208
+ ai-phases config --setup
209
+ # → Opens browser for Cursor login (one-time)
210
+ ```
211
+
212
+ Or login manually anytime:
213
+ ```bash
214
+ cursor-agent login # Opens browser to authenticate
215
+ cursor-agent status # Check if logged in
216
+ cursor-agent logout # Sign out
217
+ ```
218
+
219
+ ## Context7 Integration
220
+
221
+ Context7 MCP provides up-to-date documentation directly in Cursor. Enable it:
222
+
223
+ 1. Open Cursor Settings (Cmd+,)
224
+ 2. Go to: Features → MCP Servers
225
+ 3. Add Context7: https://context7.com/docs/clients/cursor
226
+ 4. Restart Cursor
227
+
228
+ ## Example Workflow
229
+
230
+ ```bash
231
+ # 1. Start with an idea (runs automatically)
232
+ ai-phases refine "build a task management app with drag-and-drop"
233
+
234
+ # Output:
235
+ # ✓ Enhanced specification generated in 45s
236
+ # ✓ Phase plan generated in 32s
237
+ # ✓ 5 phases created
238
+ #
239
+ # Ready to execute! Run:
240
+ # ai-phases run --phase 1
241
+
242
+ # 2. Execute phases (each runs automatically)
243
+ ai-phases run --phase 1
244
+ # → Phase executes via cursor-agent
245
+ # → Handover auto-generated
246
+ # → Git checkpoint created
247
+
248
+ ai-phases run --phase 2
249
+ ai-phases run --phase 3
250
+ # ...
251
+
252
+ # 3. If a phase fails, it auto-saves the error
253
+ ai-phases rollback --phase 3
254
+ ai-phases run --phase 3
255
+
256
+ # 4. Check status anytime
257
+ ai-phases status --verbose
258
+ ```
259
+
260
+ ## Dry Run Mode
261
+
262
+ Preview what will be executed without running:
263
+
264
+ ```bash
265
+ ai-phases run --phase 1 --dry-run
266
+ ```
267
+
268
+ ## Troubleshooting
269
+
270
+ ### "cursor-agent CLI not found"
271
+ Install the Cursor CLI:
272
+ ```bash
273
+ curl https://cursor.com/install -fsS | bash
274
+ ```
275
+
276
+ ### "Not logged in to Cursor CLI"
277
+ Authenticate with your browser:
278
+ ```bash
279
+ cursor-agent login
280
+ ```
281
+
282
+ ### Phase keeps failing
283
+ 1. Check the error in `.ai-phases/phases/phase-N/attempt-X/error.md`
284
+ 2. Use `ai-phases rollback --phase N` to reset
285
+ 3. Consider simplifying the phase tasks in `plan.md`
286
+
287
+ ## License
288
+
289
+ MIT