agileflow 2.79.0 → 2.81.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.
@@ -1,30 +1,32 @@
1
1
  ---
2
- description: Cleanly end session and record summary
2
+ description: Cleanly end session with optional merge to main
3
3
  argument-hint: (no arguments)
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
7
7
  - "ACTIVE COMMAND: /agileflow:session:end - Terminate current session"
8
- - "Gets current session, prompts for end/delete/cancel options"
9
- - "Only deletes worktree if not main session (is_main: false)"
10
- - "Updates registry to mark session inactive, removes lock file"
11
- - "Main session can only be marked inactive, not deleted"
12
- - "Use AskUserQuestion to let user choose option"
8
+ - "For NON-MAIN sessions: 4 options (merge/end/delete/cancel)"
9
+ - "For MAIN sessions: 2 options (end/cancel)"
10
+ - "Merge flow: check uncommitted preview check conflicts → strategy → confirm → execute"
11
+ - "Main session can only be marked inactive, not deleted or merged"
12
+ - "Use AskUserQuestion for all user choices"
13
13
  state_fields:
14
14
  - current_session
15
15
  - is_main_session
16
16
  - user_choice
17
+ - merge_strategy
17
18
  ---
18
19
 
19
20
  # /agileflow:session:end
20
21
 
21
- End the current session and optionally clean up the worktree.
22
+ End the current session and optionally merge your work back to main.
22
23
 
23
24
  ---
24
25
 
25
26
  ## Purpose
26
27
 
27
28
  When you're done with a session, this command:
29
+ - **Merges your changes** to main (recommended for non-main sessions)
28
30
  - Removes the session's lock file (marks it inactive)
29
31
  - Optionally removes the git worktree directory
30
32
  - Updates the registry with last active timestamp
@@ -41,12 +43,30 @@ If no current session is registered, display message and exit.
41
43
 
42
44
  ### Step 2: Present Options with AskUserQuestion
43
45
 
46
+ **For MAIN session** (2 options - cannot merge main into itself):
47
+
48
+ ```
49
+ AskUserQuestion:
50
+ question: "End Session 1 (main)?"
51
+ header: "End session"
52
+ multiSelect: false
53
+ options:
54
+ - label: "Yes, end session"
55
+ description: "Mark session inactive (keep project for later)"
56
+ - label: "Cancel"
57
+ description: "Keep session active"
58
+ ```
59
+
60
+ **For NON-MAIN session** (4 options):
61
+
44
62
  ```
45
63
  AskUserQuestion:
46
64
  question: "End Session {id}?"
47
65
  header: "End session"
48
66
  multiSelect: false
49
67
  options:
68
+ - label: "Complete & merge to main (Recommended)"
69
+ description: "Merge your changes to main and clean up"
50
70
  - label: "Yes, end session"
51
71
  description: "Mark session inactive (keep worktree for later)"
52
72
  - label: "End and delete worktree"
@@ -55,9 +75,11 @@ AskUserQuestion:
55
75
  description: "Keep session active"
56
76
  ```
57
77
 
58
- Note: Don't show "delete worktree" option for main session (is_main: true).
78
+ ### Step 3a: If "Complete & merge to main" Selected
79
+
80
+ Follow the **MERGE FLOW** below.
59
81
 
60
- ### Step 3a: If "End session" Selected
82
+ ### Step 3b: If "End session" Selected
61
83
 
62
84
  ```bash
63
85
  node .agileflow/scripts/session-manager.js unregister {session_id}
@@ -74,7 +96,7 @@ Display:
74
96
  To resume later: cd {path} && claude
75
97
  ```
76
98
 
77
- ### Step 3b: If "End and delete worktree" Selected
99
+ ### Step 3c: If "End and delete worktree" Selected
78
100
 
79
101
  ```bash
80
102
  node .agileflow/scripts/session-manager.js delete {session_id} --remove-worktree
@@ -91,23 +113,219 @@ Display:
91
113
  git branch -d {branch}
92
114
  ```
93
115
 
94
- ### Step 3c: If "Cancel" Selected
116
+ ### Step 3d: If "Cancel" Selected
95
117
 
96
118
  ```
97
119
  Session remains active.
98
120
  ```
99
121
 
122
+ ---
123
+
124
+ ## MERGE FLOW (for "Complete & merge to main")
125
+
126
+ ### Merge Step 1: Check for Uncommitted Changes
127
+
128
+ ```bash
129
+ node .agileflow/scripts/session-manager.js check-merge {session_id}
130
+ ```
131
+
132
+ If response contains `reason: "uncommitted_changes"`:
133
+
134
+ ```
135
+ ⚠️ You have uncommitted changes in this session.
136
+
137
+ Please commit your changes before merging:
138
+ git add .
139
+ git commit -m "your message"
140
+
141
+ Or discard changes:
142
+ git checkout -- .
143
+
144
+ Then run /agileflow:session:end again.
145
+ ```
146
+
147
+ **Exit the flow here.** Do not continue to merge.
148
+
149
+ ### Merge Step 2: Get Merge Preview
150
+
151
+ ```bash
152
+ node .agileflow/scripts/session-manager.js merge-preview {session_id}
153
+ ```
154
+
155
+ Display preview:
156
+
157
+ ```
158
+ 📊 Merge Preview
159
+
160
+ Session {id} "{nickname}" → {mainBranch}
161
+
162
+ Commits to merge: {commitCount}
163
+ ┌─────────────────────────────────────────────────────────────┐
164
+ │ {commit_1} │
165
+ │ {commit_2} │
166
+ │ ... │
167
+ └─────────────────────────────────────────────────────────────┘
168
+
169
+ Files changed: {fileCount}
170
+ {file_1}
171
+ {file_2}
172
+ ...
173
+ ```
174
+
175
+ If `commitCount: 0`:
176
+ ```
177
+ ℹ️ No commits to merge. Your branch is already up to date with main.
178
+
179
+ Would you like to just end the session instead?
180
+ ```
181
+
182
+ Then show simplified options (end/delete/cancel).
183
+
184
+ ### Merge Step 3: Check Mergeability
185
+
186
+ From the `check-merge` response, check `hasConflicts`:
187
+
188
+ If `hasConflicts: true`:
189
+
190
+ ```
191
+ ⚠️ Merge conflicts detected!
192
+
193
+ This branch has conflicts with {mainBranch} that need to be resolved manually.
194
+ ```
195
+
196
+ Then show conflict options:
197
+
198
+ ```
199
+ AskUserQuestion:
200
+ question: "How would you like to proceed?"
201
+ header: "Merge conflicts"
202
+ multiSelect: false
203
+ options:
204
+ - label: "Resolve manually"
205
+ description: "Keep session active and resolve conflicts yourself"
206
+ - label: "End session without merging"
207
+ description: "Keep worktree for later resolution"
208
+ - label: "Cancel"
209
+ description: "Keep session as-is"
210
+ ```
211
+
212
+ If "Resolve manually" selected, show instructions:
213
+ ```
214
+ To resolve conflicts manually:
215
+
216
+ 1. Make sure you're on main:
217
+ cd {mainPath}
218
+ git checkout {mainBranch}
219
+
220
+ 2. Start the merge:
221
+ git merge {branchName}
222
+
223
+ 3. Resolve conflicts in your editor
224
+
225
+ 4. Complete the merge:
226
+ git add .
227
+ git commit
228
+
229
+ 5. Then delete the session worktree:
230
+ git worktree remove {sessionPath}
231
+
232
+ Session remains active for now.
233
+ ```
234
+
235
+ ### Merge Step 4: Choose Merge Strategy (if clean)
236
+
237
+ If `mergeable: true`:
238
+
239
+ ```
240
+ AskUserQuestion:
241
+ question: "How should the commits be merged?"
242
+ header: "Merge strategy"
243
+ multiSelect: false
244
+ options:
245
+ - label: "Squash into single commit (Recommended)"
246
+ description: "Combines all {commitCount} commits into one clean commit"
247
+ - label: "Merge with commit history"
248
+ description: "Preserves all {commitCount} individual commits"
249
+ ```
250
+
251
+ ### Merge Step 5: Confirm and Choose Cleanup
252
+
253
+ ```
254
+ AskUserQuestion:
255
+ question: "Merge session to {mainBranch}?"
256
+ header: "Confirm merge"
257
+ multiSelect: false
258
+ options:
259
+ - label: "Yes, merge and clean up (Recommended)"
260
+ description: "Merge changes, delete branch and worktree"
261
+ - label: "Merge but keep branch"
262
+ description: "Merge changes but preserve the branch for reference"
263
+ - label: "Cancel"
264
+ description: "Don't merge"
265
+ ```
266
+
267
+ ### Merge Step 6: Execute Merge
268
+
269
+ Based on user choices:
270
+
271
+ ```bash
272
+ # If "merge and clean up":
273
+ node .agileflow/scripts/session-manager.js integrate {session_id} --strategy={squash|merge} --deleteBranch=true --deleteWorktree=true
274
+
275
+ # If "merge but keep branch":
276
+ node .agileflow/scripts/session-manager.js integrate {session_id} --strategy={squash|merge} --deleteBranch=false --deleteWorktree=true
277
+ ```
278
+
279
+ ### Merge Step 7: Display Result
280
+
281
+ If successful:
282
+
283
+ ```
284
+ ✓ Session {id} "{nickname}" merged to {mainBranch}!
285
+
286
+ Summary:
287
+ Strategy: {Squash|Merge} ({commitCount} commits → 1)
288
+ Message: {commitMessage}
289
+ Branch: {branchName} (deleted|kept)
290
+ Worktree: {sessionPath} (removed)
291
+
292
+ ┌─────────────────────────────────────────────────────────────┐
293
+ │ You're now back on {mainBranch}. Your changes are live! │
294
+ │ │
295
+ │ cd {mainPath} │
296
+ │ │
297
+ └─────────────────────────────────────────────────────────────┘
298
+
299
+ 💡 To push your changes: git push
300
+ ```
301
+
302
+ If failed:
303
+
304
+ ```
305
+ ✗ Merge failed
306
+
307
+ Error: {error_message}
308
+
309
+ Your session is still active. Try:
310
+ • Resolve conflicts manually
311
+ • Run /agileflow:session:end again after fixing issues
312
+ ```
313
+
314
+ ---
315
+
100
316
  ## Main Session Warning
101
317
 
102
318
  If current session is the main project (is_main: true):
103
319
 
104
320
  ```
105
- ⚠️ This is the main project session.
321
+ ℹ️ This is the main project session.
106
322
 
107
- You can only end this session (mark inactive), not delete the directory.
108
- The main project is not a worktree and cannot be removed.
323
+ You can only end this session (mark inactive), not merge or delete.
324
+ The main project is not a worktree.
109
325
  ```
110
326
 
327
+ Then show the 2-option prompt (end or cancel).
328
+
111
329
  ## Related Commands
112
330
 
113
331
  - `/agileflow:session:new` - Create new session
@@ -120,24 +338,23 @@ The main project is not a worktree and cannot be removed.
120
338
 
121
339
  ## ⚠️ COMPACT SUMMARY - /agileflow:session:end IS ACTIVE
122
340
 
123
- **CRITICAL**: This command terminates the current session. It MUST handle three cases: main session / non-main session / cancel.
341
+ **CRITICAL**: This command terminates the current session. For non-main sessions, offers merge to main as the recommended option.
124
342
 
125
343
  ---
126
344
 
127
345
  ### 🚨 RULE #1: CHECK IF MAIN SESSION FIRST
128
346
 
129
- Before doing anything, determine if current session is main:
130
347
  ```bash
131
348
  node .agileflow/scripts/session-manager.js status
132
- # If is_main: true → can only mark inactive
133
- # If is_main: false → can delete worktree
349
+ # If is_main: true → 2 options (end / cancel)
350
+ # If is_main: false → 4 options (merge / end / delete / cancel)
134
351
  ```
135
352
 
136
353
  ---
137
354
 
138
- ### 🚨 RULE #2: USE AskUserQuestion FOR OPTIONS
355
+ ### 🚨 RULE #2: OPTIONS BY SESSION TYPE
139
356
 
140
- **For MAIN session** (only 2 options):
357
+ **MAIN session** (2 options):
141
358
  ```xml
142
359
  <invoke name="AskUserQuestion">
143
360
  <parameter name="questions">[{
@@ -154,7 +371,7 @@ node .agileflow/scripts/session-manager.js status
154
371
  </invoke>
155
372
  ```
156
373
 
157
- **For NON-MAIN session** (3 options):
374
+ **NON-MAIN session** (4 options):
158
375
  ```xml
159
376
  <invoke name="AskUserQuestion">
160
377
  <parameter name="questions">[{
@@ -162,6 +379,8 @@ node .agileflow/scripts/session-manager.js status
162
379
  "header": "End session",
163
380
  "multiSelect": false,
164
381
  "options": [
382
+ {"label": "Complete & merge to main (Recommended)",
383
+ "description": "Merge your changes to main and clean up"},
165
384
  {"label": "Yes, end session",
166
385
  "description": "Mark session inactive (keep worktree for later)"},
167
386
  {"label": "End and delete worktree",
@@ -175,137 +394,147 @@ node .agileflow/scripts/session-manager.js status
175
394
 
176
395
  ---
177
396
 
178
- ### 🚨 RULE #3: HANDLE EACH USER CHOICE
397
+ ### 🚨 RULE #3: MERGE FLOW (if "Complete & merge" selected)
179
398
 
180
- **If "Yes, end session" selected:**
399
+ **Step 1: Check uncommitted changes**
181
400
  ```bash
182
- node .agileflow/scripts/session-manager.js unregister {session_id}
401
+ node .agileflow/scripts/session-manager.js check-merge {session_id}
183
402
  ```
184
- Display:
403
+ If `reason: "uncommitted_changes"` → Show commit instructions → EXIT
404
+
405
+ **Step 2: Get preview**
406
+ ```bash
407
+ node .agileflow/scripts/session-manager.js merge-preview {session_id}
185
408
  ```
186
- Session {id} ended
409
+ Display commits and files to be merged.
187
410
 
188
- Branch: {branch}
189
- Story: {story_id} (status unchanged)
190
- Worktree kept at: {path}
411
+ **Step 3: Check conflicts**
412
+ If `hasConflicts: true` → Show conflict options → EXIT or manual resolution
191
413
 
192
- To resume later: cd {path} && claude
414
+ **Step 4: Choose strategy**
415
+ ```xml
416
+ <invoke name="AskUserQuestion">
417
+ <parameter name="questions">[{
418
+ "question": "How should the commits be merged?",
419
+ "header": "Merge strategy",
420
+ "multiSelect": false,
421
+ "options": [
422
+ {"label": "Squash into single commit (Recommended)",
423
+ "description": "Combines all commits into one clean commit"},
424
+ {"label": "Merge with commit history",
425
+ "description": "Preserves all individual commits"}
426
+ ]
427
+ }]</parameter>
428
+ </invoke>
193
429
  ```
194
430
 
195
- **If "End and delete worktree" selected** (non-main only):
196
- ```bash
197
- node .agileflow/scripts/session-manager.js delete {session_id} --remove-worktree
198
- ```
199
- Display:
431
+ **Step 5: Confirm cleanup**
432
+ ```xml
433
+ <invoke name="AskUserQuestion">
434
+ <parameter name="questions">[{
435
+ "question": "Merge session to main?",
436
+ "header": "Confirm merge",
437
+ "multiSelect": false,
438
+ "options": [
439
+ {"label": "Yes, merge and clean up (Recommended)",
440
+ "description": "Merge changes, delete branch and worktree"},
441
+ {"label": "Merge but keep branch",
442
+ "description": "Merge changes but preserve the branch"},
443
+ {"label": "Cancel",
444
+ "description": "Don't merge"}
445
+ ]
446
+ }]</parameter>
447
+ </invoke>
200
448
  ```
201
- ✓ Session {id} ended and removed
202
449
 
203
- Branch: {branch}
204
- Worktree removed: {path}
205
-
206
- 💡 The branch still exists. To delete it:
207
- git branch -d {branch}
450
+ **Step 6: Execute**
451
+ ```bash
452
+ node .agileflow/scripts/session-manager.js integrate {id} --strategy={squash|merge} --deleteBranch={true|false} --deleteWorktree=true
208
453
  ```
209
454
 
210
- **If "Cancel" selected:**
455
+ **Step 7: Display success**
211
456
  ```
212
- Session remains active.
457
+ Session {id} merged to main!
458
+ cd {mainPath}
459
+ 💡 To push: git push
213
460
  ```
214
461
 
215
462
  ---
216
463
 
217
- ### 🚨 RULE #4: MAIN SESSION WARNING
464
+ ### 🚨 RULE #4: HANDLE OTHER OPTIONS
218
465
 
219
- If session is main (is_main: true):
466
+ **"End session":**
467
+ ```bash
468
+ node .agileflow/scripts/session-manager.js unregister {session_id}
220
469
  ```
221
- ⚠️ This is the main project session.
222
470
 
223
- You can only end this session (mark inactive), not delete the directory.
224
- The main project is not a worktree and cannot be removed.
471
+ **"End and delete worktree":**
472
+ ```bash
473
+ node .agileflow/scripts/session-manager.js delete {session_id} --remove-worktree
225
474
  ```
226
475
 
227
- Then show the 2-option prompt (end or cancel).
228
-
229
- ---
230
-
231
- ### 🚨 RULE #5: BRANCH MANAGEMENT NOTE
232
-
233
- When deleting worktree, remind user the branch persists:
476
+ **"Cancel":**
234
477
  ```
235
- 💡 The branch still exists. To delete it:
236
- git branch -d {branch}
478
+ Session remains active.
237
479
  ```
238
480
 
239
- This is important because users might want to keep branch history.
240
-
241
481
  ---
242
482
 
243
- ### KEY FILES TO REMEMBER
483
+ ### KEY FILES
244
484
 
245
485
  | File | Purpose |
246
486
  |------|---------|
247
487
  | `.agileflow/sessions/registry.json` | Session registry |
248
488
  | `.agileflow/sessions/{id}.lock` | Removed when session ends |
249
- | `.agileflow/scripts/session-manager.js` | Unregister and delete |
489
+ | `.agileflow/scripts/session-manager.js` | All session operations |
250
490
 
251
491
  ---
252
492
 
253
- ### WORKFLOW
493
+ ### WORKFLOW SUMMARY
254
494
 
255
- 1. **Get current session** → `session-manager.js status`
256
- 2. **Check is_main** → Determine option set
257
- 3. **If main** → Show warning + 2 options
258
- 4. **If not main** Show no warning + 3 options
259
- 5. **User selects** → Handle choice
260
- 6. **Execute**Call manager script
261
- 7. **Display result** → Show success/failure
262
-
263
- ---
264
-
265
- ### SESSION DATA STRUCTURE
266
-
267
- From `session-manager.js status`:
268
- ```json
269
- {
270
- "id": 1,
271
- "path": "/home/user/project",
272
- "branch": "main",
273
- "status": "active",
274
- "is_main": true,
275
- "is_current": true,
276
- "created": "2025-12-20T10:00:00Z",
277
- "last_active": "2025-12-20T10:30:00Z"
278
- }
495
+ ```
496
+ 1. Get session status
497
+ 2. Check is_main
498
+ 3. Show options (4 for non-main, 2 for main)
499
+ 4. If merge selected:
500
+ a. Check uncommitted block if dirty
501
+ b. Preview commits/files
502
+ c. Check conflicts → offer alternatives if conflicts
503
+ d. Choose strategy (squash/merge)
504
+ e. Confirm cleanup
505
+ f. Execute integrate
506
+ g. Show success with cd command
507
+ 5. If end/delete → Execute and show result
279
508
  ```
280
509
 
281
510
  ---
282
511
 
283
- ### ANTI-PATTERNS (DON'T DO THESE)
512
+ ### ANTI-PATTERNS
284
513
 
285
- ❌ Show delete option for main session
286
- Unregister without checking is_main
287
- Don't warn about main session status
288
- Don't mention branch deletion after worktree removal
289
- Use different prompts for main vs non-main
514
+ ❌ Show merge option for main session
515
+ Skip uncommitted check before merge
516
+ Merge without showing preview
517
+ Merge when conflicts exist without warning
518
+ Delete worktree before merge completes
290
519
 
291
- ### DO THESE INSTEAD
520
+ ### DO THESE
292
521
 
293
522
  ✅ Always check is_main first
294
- Show appropriate options (2 for main, 3 for non-main)
295
- Warn if main session
296
- Remind about branch deletion
297
- Use consistent prompt format
523
+ Check uncommitted changes before anything
524
+ Show preview before merge
525
+ Handle conflicts gracefully
526
+ Squash as default strategy
527
+ ✅ Show cd command after successful merge
298
528
 
299
529
  ---
300
530
 
301
531
  ### REMEMBER AFTER COMPACTION
302
532
 
303
533
  - `/agileflow:session:end` IS ACTIVE
304
- - ALWAYS check is_main before prompting
305
- - Main: 2 options (end / cancel)
306
- - Non-main: 3 options (end / delete / cancel)
307
- - Warn if main session
308
- - Remind about branch deletion after worktree removal
309
- - Use AskUserQuestion for all options
534
+ - Non-main: 4 options (merge first!)
535
+ - Main: 2 options only
536
+ - Merge flow: uncommitted preview conflicts strategy → confirm → execute
537
+ - Default strategy: squash
538
+ - Always show cd command to return to main
310
539
 
311
540
  <!-- COMPACT_SUMMARY_END -->
@@ -150,3 +150,28 @@ learnings:
150
150
  total_lines: 2009
151
151
  source: "packages/cli/src/core/commands/*.md"
152
152
  notes: "All files follow consistent documentation template: frontmatter, quick start, purpose, parameters table, examples with explanations, workflow steps, output/files, and related commands"
153
+
154
+ - date: 2026-01-09
155
+ context: "Created IDE Integrations documentation for AgileFlow"
156
+ insight: "IDE handler system supports 4 IDEs (Claude Code, Cursor, Windsurf, Codex CLI) through plugin architecture. Each IDE has custom config directory (.claude/, .cursor/, .windsurf/, .codex/) and different installation models. Claude Code most advanced (damage control, spawnable agents), Codex CLI unique (per-repo skills, user-level prompts, AGENTS.md instructions)"
157
+ created_files:
158
+ - "apps/docs/content/docs/features/ide-integrations.mdx (700+ lines)"
159
+ - "apps/docs/content/docs/features/index.mdx (updated with IDE section)"
160
+ total_lines: 700
161
+ source: "packages/cli/tools/cli/installers/ide/ (_base-ide.js, claude-code.js, cursor.js, windsurf.js, codex.js, manager.js)"
162
+ coverage:
163
+ - "IDE overview table with config dirs, types, status"
164
+ - "Quick start for Claude Code (default IDE)"
165
+ - "Multi-IDE installation instructions"
166
+ - "Detailed setup for each IDE with directory structure"
167
+ - "Command access patterns by IDE"
168
+ - "Claude Code subagent spawning, damage control hooks"
169
+ - "Cursor unique features, differences from Claude Code"
170
+ - "Windsurf workflow management, VSCode integration"
171
+ - "Codex CLI dual installation model (per-repo skills, user-level prompts, AGENTS.md)"
172
+ - "Dynamic IDE handler system, extensibility guide"
173
+ - "Content injection system explanation"
174
+ - "Troubleshooting guide for common issues"
175
+ - "Best practices for IDE selection and multi-IDE usage"
176
+ - "Configuration management and version control"
177
+ notes: "Comprehensive 700+ line documentation covering all 4 IDEs with detailed setup, command access, and unique features. Includes handler architecture for IDE developers extending with new IDEs."