agileflow 2.84.2 → 2.86.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.
@@ -80,8 +80,9 @@ Parse the JSON result. Display:
80
80
  ```
81
81
  ✓ Created Session {id}
82
82
 
83
- Workspace: {path}
84
- Branch: {branch}
83
+ Workspace: {path}
84
+ Branch: {branch}
85
+ Thread Type: parallel
85
86
 
86
87
  ┌─────────────────────────────────────────────────────────┐
87
88
  │ To start working in this session, run: │
@@ -91,6 +92,8 @@ Parse the JSON result. Display:
91
92
  └─────────────────────────────────────────────────────────┘
92
93
  ```
93
94
 
95
+ Note: Worktree sessions default to "parallel" thread type. See docs/02-practices/thread-based-engineering.md for thread type definitions.
96
+
94
97
  ### Step 4b: If "Name this session" Selected
95
98
 
96
99
  Use AskUserQuestion to get the name:
@@ -133,26 +136,39 @@ Then create with specified branch:
133
136
  node .agileflow/scripts/session-manager.js create --branch {branch_name}
134
137
  ```
135
138
 
136
- ### Step 5: Display Success Message
139
+ ### Step 5: Display Success with Switch Command
137
140
 
138
- Show the created session details and the command to start working:
141
+ After session creation succeeds:
139
142
 
143
+ 1. First, activate boundary protection for the new session:
144
+ ```bash
145
+ node .agileflow/scripts/session-manager.js switch {new_session_id}
140
146
  ```
141
- ✓ Created Session {id} "{nickname}"
142
147
 
143
- Workspace: ../project-{name}
144
- Branch: session-{id}-{name}
148
+ 2. Then show the `/add-dir` command for the user to switch:
145
149
 
146
- ┌─────────────────────────────────────────────────────────┐
147
- To start working in this session, run: │
148
- │ │
149
- │ cd ../project-{name} && claude │
150
-
151
- └─────────────────────────────────────────────────────────┘
150
+ ```
151
+ Created Session {id} "{nickname}"
152
+
153
+ ┌────────────┬────────────────────────────────────────────┐
154
+ Session {id} "{nickname}" │
155
+ │ Workspace │ {path} │
156
+ │ Branch │ {branch} │
157
+ │ Thread │ parallel │
158
+ └────────────┴────────────────────────────────────────────┘
159
+
160
+ To switch to this session, run:
161
+
162
+ /add-dir {path}
152
163
 
153
- 💡 Tip: Use /agileflow:session:resume to see all sessions
164
+ 💡 Use /agileflow:session:resume to list all sessions
154
165
  ```
155
166
 
167
+ **WHY /add-dir instead of cd && claude:**
168
+ - Stays in the same terminal and conversation
169
+ - One short command to type
170
+ - Immediately enables file access to the new session directory
171
+
156
172
  ## Error Handling
157
173
 
158
174
  - **Directory exists**: Suggest different name or manual cleanup
@@ -228,21 +244,27 @@ If user selects "Auto-create":
228
244
  node .agileflow/scripts/session-manager.js create
229
245
  ```
230
246
 
231
- Display:
247
+ Parse JSON result, then activate boundary protection:
248
+ ```bash
249
+ node .agileflow/scripts/session-manager.js switch {new_id}
232
250
  ```
233
- ✓ Created Session {id}
234
251
 
235
- Workspace: ../project-{id}
236
- Branch: session-{id}
252
+ Then display:
253
+ ```
254
+ ✅ Created Session {id}
237
255
 
238
- ┌─────────────────────────────────────────────────────────┐
239
- To start working in this session, run:
240
-
241
- cd ../project-{id} && claude
242
-
243
- └─────────────────────────────────────────────────────────┘
256
+ ┌────────────┬────────────────────────────────────────────┐
257
+ Session │ {id}
258
+ Workspace {path} │
259
+ Branch │ {branch}
260
+ Thread parallel │
261
+ └────────────┴────────────────────────────────────────────┘
262
+
263
+ To switch to this session, run:
244
264
 
245
- 💡 Tip: Use /agileflow:session:resume to see all sessions
265
+ /add-dir {path}
266
+
267
+ 💡 Use /agileflow:session:resume to list all sessions
246
268
  ```
247
269
 
248
270
  ---
@@ -274,21 +296,27 @@ Then create:
274
296
  node .agileflow/scripts/session-manager.js create --nickname {name}
275
297
  ```
276
298
 
277
- Display:
299
+ Parse JSON result, then activate boundary protection:
300
+ ```bash
301
+ node .agileflow/scripts/session-manager.js switch {new_id}
278
302
  ```
279
- ✓ Created Session {id} "{name}"
280
303
 
281
- Workspace: ../project-{name}
282
- Branch: session-{id}-{name}
304
+ Then display:
305
+ ```
306
+ ✅ Created Session {id} "{name}"
283
307
 
284
- ┌─────────────────────────────────────────────────────────┐
285
- To start working in this session, run:
286
-
287
- cd ../project-{name} && claude
288
-
289
- └─────────────────────────────────────────────────────────┘
308
+ ┌────────────┬────────────────────────────────────────────┐
309
+ Session │ {id} "{name}"
310
+ Workspace {path} │
311
+ Branch │ {branch}
312
+ Thread parallel │
313
+ └────────────┴────────────────────────────────────────────┘
314
+
315
+ To switch to this session, run:
316
+
317
+ /add-dir {path}
290
318
 
291
- 💡 Tip: Use /agileflow:session:resume to see all sessions
319
+ 💡 Use /agileflow:session:resume to list all sessions
292
320
  ```
293
321
 
294
322
  ---
@@ -327,7 +355,12 @@ git branch --format='%(refname:short)'
327
355
  node .agileflow/scripts/session-manager.js create --branch {branch_name}
328
356
  ```
329
357
 
330
- Display success as above.
358
+ 5. Parse JSON result, then activate boundary protection:
359
+ ```bash
360
+ node .agileflow/scripts/session-manager.js switch {new_id}
361
+ ```
362
+
363
+ 6. Display success as above with `/add-dir` command.
331
364
 
332
365
  ---
333
366
 
@@ -365,21 +398,25 @@ Try running: git status
365
398
 
366
399
  All three options show same format:
367
400
  ```
368
- Created Session {id} ["{nickname}" OR empty]
401
+ Created Session {id} ["{nickname}" OR empty]
369
402
 
370
- Workspace: ../project-{path}
371
- Branch: {branch_name}
403
+ ┌────────────┬────────────────────────────────────────────┐
404
+ │ Session {id} ["{nickname}" or empty] │
405
+ │ Workspace │ {path} │
406
+ │ Branch │ {branch} │
407
+ │ Thread │ parallel │
408
+ └────────────┴────────────────────────────────────────────┘
372
409
 
373
- ┌─────────────────────────────────────────────────────────┐
374
- │ To start working in this session, run: │
375
- │ │
376
- │ {cd_command} │
377
- │ │
378
- └─────────────────────────────────────────────────────────┘
410
+ To switch to this session, run:
379
411
 
380
- 💡 Tip: Use /agileflow:session:resume to see all sessions
412
+ /add-dir {path}
413
+
414
+ 💡 Use /agileflow:session:resume to list all sessions
381
415
  ```
382
416
 
417
+ **Use /add-dir instead of cd && claude** - stays in same terminal/conversation.
418
+ **Thread type**: Worktree sessions default to "parallel". See [Thread-Based Engineering](../../02-practices/thread-based-engineering.md).
419
+
383
420
  ---
384
421
 
385
422
  ### KEY FILES TO REMEMBER
@@ -400,7 +437,8 @@ All three options show same format:
400
437
  4. **User selects** → Option 1, 2, or 3
401
438
  5. **Handle selection** → Different flow for each
402
439
  6. **Create session** → Call manager script
403
- 7. **Show success** → Display cd command
440
+ 7. **Activate boundary** → `session-manager.js switch {new_id}`
441
+ 8. **Show success** → Display `/add-dir {path}` command for user to run
404
442
 
405
443
  ---
406
444
 
@@ -420,7 +458,7 @@ All three options show same format:
420
458
  ❌ Don't show more/fewer than 3 initial options
421
459
  ❌ Don't create session without explicit user choice
422
460
  ❌ Don't skip error handling (directory exists, branch conflict)
423
- ❌ Don't forget cd command in success message
461
+ ❌ Don't show old "cd && claude" command - use /add-dir instead
424
462
  ❌ Show different success formats for different methods
425
463
 
426
464
  ### DO THESE INSTEAD
@@ -429,7 +467,7 @@ All three options show same format:
429
467
  ✅ Always show exactly 3 options
430
468
  ✅ Wait for user to select before creating
431
469
  ✅ Handle all error cases gracefully
432
- Always show cd command in success
470
+ Show `/add-dir {path}` command for user to switch
433
471
  ✅ Use consistent success format
434
472
 
435
473
  ---
@@ -442,7 +480,8 @@ All three options show same format:
442
480
  - Each option leads to different flow
443
481
  - Use AskUserQuestion for user selections
444
482
  - Handle all error cases (directory, branch, git)
445
- - Return success with cd command
483
+ - **Run `session-manager.js switch {new_id}` AFTER creating session** (enables boundary protection)
484
+ - Show `/add-dir {path}` command for user to switch (NOT cd && claude)
446
485
  - Show tip to use /agileflow:session:resume
447
486
 
448
487
  <!-- COMPACT_SUMMARY_END -->
@@ -71,18 +71,25 @@ AskUserQuestion:
71
71
 
72
72
  **If user selects a different session:**
73
73
 
74
- Display the command to switch:
74
+ First, update the active session context for boundary protection:
75
75
 
76
+ ```bash
77
+ node .agileflow/scripts/session-manager.js switch {session_id}
76
78
  ```
77
- To resume Session 2 "auth":
78
79
 
79
- ┌─────────────────────────────────────────────────────────┐
80
- │ cd ../project-auth && claude --resume │
81
- └─────────────────────────────────────────────────────────┘
80
+ Then display the `/add-dir` command to switch:
81
+
82
+ ```
83
+ To switch to Session 2 "auth":
84
+
85
+ /add-dir ../project-auth
82
86
 
83
87
  Session info:
84
- Branch: session-2
85
- Story: US-0038 (in-progress)
88
+ ┌──────────┬──────────────────────────┐
89
+ Branch │ session-2 │
90
+ │ Story │ US-0038 (in-progress) │
91
+ │ Path │ ../project-auth │
92
+ └──────────┴──────────────────────────┘
86
93
  ```
87
94
 
88
95
  **If user selects current session:**
@@ -97,6 +104,11 @@ You're already in Session 1!
97
104
  Run /agileflow:session:new to create a new parallel workspace.
98
105
  ```
99
106
 
107
+ **WHY /add-dir instead of cd && claude:**
108
+ - Stays in the same terminal and conversation
109
+ - One short command to type
110
+ - Immediately enables file access to the session directory
111
+
100
112
  ## Related Commands
101
113
 
102
114
  - `/agileflow:session:new` - Create new session
@@ -109,7 +121,7 @@ Run /agileflow:session:new to create a new parallel workspace.
109
121
 
110
122
  ## ⚠️ COMPACT SUMMARY - /agileflow:session:resume IS ACTIVE
111
123
 
112
- **CRITICAL**: This command is the primary way to **switch between parallel sessions**. User selects, you display the cd command.
124
+ **CRITICAL**: This command is the primary way to **switch between parallel sessions**. User selects, you display the `/add-dir` command.
113
125
 
114
126
  ---
115
127
 
@@ -152,16 +164,24 @@ You're already in Session 1!
152
164
  ```
153
165
 
154
166
  **If user selects different session:**
167
+
168
+ 1. First, run switch command (enables boundary protection):
169
+ ```bash
170
+ node .agileflow/scripts/session-manager.js switch {session_id}
155
171
  ```
156
- To resume Session 2 "auth":
157
172
 
158
- ┌─────────────────────────────────────────────────────────┐
159
- │ cd ../project-auth && claude --resume │
160
- └─────────────────────────────────────────────────────────┘
173
+ 2. Then show the /add-dir command:
174
+ ```
175
+ To switch to Session 2 "auth":
176
+
177
+ /add-dir ../project-auth
161
178
 
162
179
  Session info:
163
- Branch: session-2
164
- Story: US-0038 (in-progress)
180
+ ┌──────────┬──────────────────────────┐
181
+ Branch │ session-2 │
182
+ │ Story │ US-0038 (in-progress) │
183
+ │ Path │ ../project-auth │
184
+ └──────────┴──────────────────────────┘
165
185
  ```
166
186
 
167
187
  **If user selects "Create new session":**
@@ -169,6 +189,8 @@ Session info:
169
189
  Run /agileflow:session:new to create a new parallel workspace.
170
190
  ```
171
191
 
192
+ **Use /add-dir instead of cd && claude** - stays in same terminal/conversation.
193
+
172
194
  ---
173
195
 
174
196
  ### 🚨 RULE #3: FORMATTING LABELS & DESCRIPTIONS
@@ -223,7 +245,8 @@ Use these fields to build readable labels.
223
245
  2. **Parse JSON** → Extract id, branch, nickname, status, path
224
246
  3. **Build options** → Create readable labels with status
225
247
  4. **Show AskUserQuestion** → Let user select
226
- 5. **Handle selection** → Show cd command or appropriate response
248
+ 5. **Activate boundary** → `session-manager.js switch {selected_id}` (if different session)
249
+ 6. **Handle selection** → Show `/add-dir` command or appropriate response
227
250
 
228
251
  ---
229
252
 
@@ -252,6 +275,7 @@ Use these fields to build readable labels.
252
275
  - Format labels clearly: `Session {id}: {nickname/branch} {(current)}`
253
276
  - Show status in description: `Active now` OR `Inactive (N days ago)`
254
277
  - Handle each case: current / different / create new
255
- - Return cd command when user selects different session
278
+ - **Run `session-manager.js switch {id}` BEFORE showing /add-dir** (enables boundary protection)
279
+ - Show `/add-dir {path}` command when user selects different session (NOT cd && claude)
256
280
 
257
281
  <!-- COMPACT_SUMMARY_END -->
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: View current session state and activity
3
- argument-hint: (no arguments)
3
+ argument-hint: [--kanban]
4
4
  compact_context:
5
5
  priority: medium
6
6
  preserve_rules:
@@ -9,6 +9,7 @@ compact_context:
9
9
  - "Shows current session, then table of other sessions"
10
10
  - "Marks active sessions with ● bullet, inactive with ○"
11
11
  - "Returns session count and active count"
12
+ - "--kanban flag shows Kanban-style board with phases (TO DO, CODING, REVIEW, MERGED)"
12
13
  state_fields:
13
14
  - current_session
14
15
  - all_sessions
@@ -26,16 +27,29 @@ Quick view of all sessions and their status.
26
27
 
27
28
  Display a compact overview of all registered sessions without prompting for action.
28
29
 
30
+ ## Arguments
31
+
32
+ | Argument | Required | Description |
33
+ |----------|----------|-------------|
34
+ | `--kanban` | No | Show Kanban-style board with phases instead of table |
35
+
29
36
  ## IMMEDIATE ACTIONS
30
37
 
31
38
  ### Step 1: Get Session Data
32
39
 
40
+ **Standard view:**
33
41
  ```bash
34
42
  node .agileflow/scripts/session-manager.js list --json
35
43
  ```
36
44
 
37
- ### Step 2: Display Formatted Table
45
+ **Kanban view (if --kanban flag):**
46
+ ```bash
47
+ node .agileflow/scripts/session-manager.js list --kanban
48
+ ```
49
+
50
+ ### Step 2: Display Formatted Output
38
51
 
52
+ **Standard Table View:**
39
53
  ```
40
54
  📊 Session Status
41
55
 
@@ -53,6 +67,25 @@ Other Sessions:
53
67
  Total: 3 sessions │ 2 active
54
68
  ```
55
69
 
70
+ **Kanban Board View (--kanban):**
71
+ ```
72
+ Sessions (Kanban View):
73
+
74
+ TO DO CODING REVIEW MERGED
75
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
76
+ │ │ │[2] auth │ │[3] payments │ │[1] main │
77
+ │ │ │US-0038 │ │US-0042 │ │- │
78
+ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
79
+
80
+ To Do: 0 │ Coding: 1 │ Review: 1 │ Merged: 1
81
+ ```
82
+
83
+ **Phase Detection Logic:**
84
+ - **TO DO**: No commits since branch creation
85
+ - **CODING**: Has commits, still has uncommitted changes
86
+ - **REVIEW**: Has commits, no uncommitted changes (ready to merge)
87
+ - **MERGED**: Main branch or merged sessions
88
+
56
89
  ### Step 3: Show Quick Actions
57
90
 
58
91
  ```
@@ -1,15 +1,20 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft-07/schema#",
3
3
  "description": "AgileFlow session state tracking",
4
- "schema_version": 2,
4
+ "schema_version": 3,
5
5
  "current_session": {
6
6
  "id": "sess-20251206-100000",
7
7
  "started_at": "2025-12-06T10:00:00Z",
8
8
  "baseline_verified": false,
9
9
  "initial_test_status": "not_run",
10
10
  "current_story": null,
11
- "active_agent": null
11
+ "active_agent": null,
12
+ "thread_type": "base",
13
+ "thread_complexity": "routine",
14
+ "expected_duration_minutes": null
12
15
  },
16
+ "_thread_type_enum": ["base", "parallel", "chained", "fusion", "big", "long"],
17
+ "_thread_complexity_enum": ["trivial", "routine", "complex", "exploratory"],
13
18
  "active_command": {
14
19
  "_comment": "Tracks which command (babysit, etc.) is currently active for context preservation across compacts",
15
20
  "name": null,
@@ -23,5 +28,29 @@
23
28
  "final_test_status": "not_run",
24
29
  "commits": []
25
30
  },
26
- "session_history": []
31
+ "session_history": [],
32
+ "batch_loop": {
33
+ "_comment": "State for batch pmap loop mode - iterative processing with quality gates",
34
+ "enabled": false,
35
+ "batch_id": null,
36
+ "pattern": null,
37
+ "action": null,
38
+ "quality_gate": "tests",
39
+ "current_item": null,
40
+ "items": {},
41
+ "summary": {
42
+ "total": 0,
43
+ "completed": 0,
44
+ "in_progress": 0,
45
+ "pending": 0,
46
+ "failed": 0
47
+ },
48
+ "iteration": 0,
49
+ "max_iterations": 50,
50
+ "started_at": null,
51
+ "completed_at": null,
52
+ "stopped_reason": null,
53
+ "last_failure": null
54
+ },
55
+ "_batch_item_status_enum": ["pending", "in_progress", "completed", "failed", "skipped"]
27
56
  }
@@ -11,6 +11,7 @@ const yaml = require('js-yaml');
11
11
  const { Installer } = require('../installers/core/installer');
12
12
  const { IdeManager } = require('../installers/ide/manager');
13
13
  const { displayLogo, displaySection, success, warning, error, info } = require('../lib/ui');
14
+ const { ErrorHandler } = require('../lib/error-handler');
14
15
 
15
16
  const installer = new Installer();
16
17
  const ideManager = new IdeManager();
@@ -33,9 +34,12 @@ module.exports = {
33
34
 
34
35
  if (!status.installed) {
35
36
  displayLogo();
36
- warning('No AgileFlow installation found');
37
- console.log(chalk.dim(`\nRun 'npx agileflow setup' to set up AgileFlow\n`));
38
- process.exit(1);
37
+ const handler = new ErrorHandler('config');
38
+ handler.warning(
39
+ 'No AgileFlow installation found',
40
+ 'Initialize AgileFlow first',
41
+ 'npx agileflow setup'
42
+ );
39
43
  }
40
44
 
41
45
  const manifestPath = path.join(status.path, '_cfg', 'manifest.yaml');
@@ -76,11 +80,13 @@ module.exports = {
76
80
 
77
81
  process.exit(0);
78
82
  } catch (err) {
79
- console.error(chalk.red('Error:'), err.message);
80
- if (process.env.DEBUG) {
81
- console.error(err.stack);
82
- }
83
- process.exit(1);
83
+ const handler = new ErrorHandler('config');
84
+ handler.critical(
85
+ 'Configuration operation failed',
86
+ 'Check manifest file integrity',
87
+ 'npx agileflow doctor --fix',
88
+ err
89
+ );
84
90
  }
85
91
  },
86
92
  };
@@ -121,17 +127,24 @@ async function handleList(status) {
121
127
  * Handle get subcommand
122
128
  */
123
129
  async function handleGet(status, key) {
130
+ const handler = new ErrorHandler('config');
131
+
124
132
  if (!key) {
125
- error('Missing key. Usage: npx agileflow config get <key>');
126
- process.exit(1);
133
+ handler.warning(
134
+ 'Missing key',
135
+ 'Provide a config key to get',
136
+ 'npx agileflow config get <key>'
137
+ );
127
138
  }
128
139
 
129
140
  const validKeys = ['userName', 'ides', 'agileflowFolder', 'docsFolder', 'version'];
130
141
 
131
142
  if (!validKeys.includes(key)) {
132
- error(`Invalid key: ${key}`);
133
- console.log(chalk.dim(`Valid keys: ${validKeys.join(', ')}\n`));
134
- process.exit(1);
143
+ handler.warning(
144
+ `Invalid key: ${key}`,
145
+ `Valid keys: ${validKeys.join(', ')}`,
146
+ 'npx agileflow config list'
147
+ );
135
148
  }
136
149
 
137
150
  let value;
@@ -160,17 +173,24 @@ async function handleGet(status, key) {
160
173
  * Handle set subcommand
161
174
  */
162
175
  async function handleSet(directory, status, manifestPath, key, value) {
176
+ const handler = new ErrorHandler('config');
177
+
163
178
  if (!key || value === undefined) {
164
- error('Missing arguments. Usage: npx agileflow config set <key> <value>');
165
- process.exit(1);
179
+ handler.warning(
180
+ 'Missing arguments',
181
+ 'Provide both key and value',
182
+ 'npx agileflow config set <key> <value>'
183
+ );
166
184
  }
167
185
 
168
186
  const validKeys = ['userName', 'ides', 'agileflowFolder', 'docsFolder'];
169
187
 
170
188
  if (!validKeys.includes(key)) {
171
- error(`Invalid key: ${key}`);
172
- console.log(chalk.dim(`Valid keys: ${validKeys.join(', ')}\n`));
173
- process.exit(1);
189
+ handler.warning(
190
+ `Invalid key: ${key}`,
191
+ `Valid keys: ${validKeys.join(', ')}`,
192
+ 'npx agileflow config list'
193
+ );
174
194
  }
175
195
 
176
196
  displayLogo();
@@ -198,9 +218,11 @@ async function handleSet(directory, status, manifestPath, key, value) {
198
218
  // Validate IDEs
199
219
  for (const ide of newIdes) {
200
220
  if (!validIdes.includes(ide)) {
201
- error(`Invalid IDE: ${ide}`);
202
- console.log(chalk.dim(`Valid IDEs: ${validIdes.join(', ')}\n`));
203
- process.exit(1);
221
+ handler.warning(
222
+ `Invalid IDE: ${ide}`,
223
+ `Valid IDEs: ${validIdes.join(', ')}`,
224
+ 'npx agileflow config set ides "claude-code,cursor"'
225
+ );
204
226
  }
205
227
  }
206
228
 
@@ -20,6 +20,7 @@ const {
20
20
  } = require('../lib/ui');
21
21
  const { IdeManager } = require('../installers/ide/manager');
22
22
  const { getCurrentVersion } = require('../lib/version-checker');
23
+ const { ErrorHandler } = require('../lib/error-handler');
23
24
 
24
25
  const installer = new Installer();
25
26
 
@@ -306,11 +307,13 @@ module.exports = {
306
307
 
307
308
  process.exit(issues > 0 ? 1 : 0);
308
309
  } catch (err) {
309
- console.error(chalk.red('Error:'), err.message);
310
- if (process.env.DEBUG) {
311
- console.error(err.stack);
312
- }
313
- process.exit(1);
310
+ const handler = new ErrorHandler('doctor');
311
+ handler.critical(
312
+ 'Diagnostics failed',
313
+ 'Check permissions and installation',
314
+ 'npx agileflow setup',
315
+ err
316
+ );
314
317
  }
315
318
  },
316
319
  };
@@ -22,6 +22,7 @@ const {
22
22
  } = require('../lib/ui');
23
23
  const { createDocsStructure } = require('../lib/docs-setup');
24
24
  const { getLatestVersion } = require('../lib/npm-utils');
25
+ const { ErrorHandler } = require('../lib/error-handler');
25
26
 
26
27
  const installer = new Installer();
27
28
  const ideManager = new IdeManager();
@@ -101,8 +102,12 @@ module.exports = {
101
102
  const coreResult = await installer.install(config);
102
103
 
103
104
  if (!coreResult.success) {
104
- error('Core setup failed');
105
- process.exit(1);
105
+ const handler = new ErrorHandler('setup');
106
+ handler.warning(
107
+ 'Core setup failed',
108
+ 'Check directory permissions',
109
+ 'npx agileflow doctor'
110
+ );
106
111
  }
107
112
 
108
113
  success(`Installed ${coreResult.counts.agents} agents`);
@@ -144,11 +149,13 @@ module.exports = {
144
149
 
145
150
  process.exit(0);
146
151
  } catch (err) {
147
- console.error(chalk.red('\nSetup failed:'), err.message);
148
- if (process.env.DEBUG) {
149
- console.error(err.stack);
150
- }
151
- process.exit(1);
152
+ const handler = new ErrorHandler('setup');
153
+ handler.critical(
154
+ 'Setup failed',
155
+ 'Check directory exists and has write permissions',
156
+ 'npx agileflow doctor',
157
+ err
158
+ );
152
159
  }
153
160
  },
154
161
  };