agileflow 2.77.0 → 2.79.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.
- package/README.md +6 -6
- package/package.json +6 -1
- package/scripts/agileflow-configure.js +174 -2
- package/scripts/agileflow-statusline.sh +171 -78
- package/scripts/agileflow-welcome.js +88 -64
- package/scripts/auto-self-improve.js +23 -45
- package/scripts/check-update.js +35 -42
- package/scripts/damage-control/bash-tool-damage-control.js +257 -0
- package/scripts/damage-control/edit-tool-damage-control.js +279 -0
- package/scripts/damage-control/patterns.yaml +227 -0
- package/scripts/damage-control/write-tool-damage-control.js +274 -0
- package/scripts/damage-control-bash.js +232 -0
- package/scripts/damage-control-edit.js +243 -0
- package/scripts/damage-control-write.js +243 -0
- package/scripts/obtain-context.js +22 -3
- package/scripts/ralph-loop.js +191 -63
- package/scripts/screenshot-verifier.js +213 -0
- package/scripts/session-manager.js +12 -33
- package/src/core/agents/accessibility.md +124 -53
- package/src/core/agents/adr-writer.md +192 -52
- package/src/core/agents/analytics.md +139 -60
- package/src/core/agents/api.md +173 -63
- package/src/core/agents/ci.md +139 -57
- package/src/core/agents/compliance.md +159 -68
- package/src/core/agents/configuration/damage-control.md +356 -0
- package/src/core/agents/configuration-damage-control.md +248 -0
- package/src/core/agents/database.md +162 -61
- package/src/core/agents/datamigration.md +179 -66
- package/src/core/agents/design.md +179 -57
- package/src/core/agents/devops.md +160 -3
- package/src/core/agents/documentation.md +204 -60
- package/src/core/agents/epic-planner.md +147 -55
- package/src/core/agents/integrations.md +197 -69
- package/src/core/agents/mentor.md +158 -57
- package/src/core/agents/mobile.md +159 -67
- package/src/core/agents/monitoring.md +154 -65
- package/src/core/agents/multi-expert.md +115 -43
- package/src/core/agents/orchestrator.md +77 -24
- package/src/core/agents/performance.md +130 -75
- package/src/core/agents/product.md +151 -55
- package/src/core/agents/qa.md +162 -74
- package/src/core/agents/readme-updater.md +178 -76
- package/src/core/agents/refactor.md +148 -95
- package/src/core/agents/research.md +143 -72
- package/src/core/agents/security.md +154 -65
- package/src/core/agents/testing.md +176 -97
- package/src/core/agents/ui.md +170 -79
- package/src/core/commands/adr/list.md +171 -0
- package/src/core/commands/adr/update.md +235 -0
- package/src/core/commands/adr/view.md +252 -0
- package/src/core/commands/adr.md +207 -50
- package/src/core/commands/agent.md +16 -0
- package/src/core/commands/assign.md +148 -44
- package/src/core/commands/auto.md +18 -1
- package/src/core/commands/babysit.md +391 -38
- package/src/core/commands/baseline.md +14 -0
- package/src/core/commands/blockers.md +170 -51
- package/src/core/commands/board.md +144 -66
- package/src/core/commands/changelog.md +15 -0
- package/src/core/commands/ci.md +179 -69
- package/src/core/commands/compress.md +18 -0
- package/src/core/commands/configure.md +16 -0
- package/src/core/commands/context/export.md +193 -4
- package/src/core/commands/context/full.md +191 -18
- package/src/core/commands/context/note.md +248 -4
- package/src/core/commands/debt.md +17 -0
- package/src/core/commands/deploy.md +208 -65
- package/src/core/commands/deps.md +15 -0
- package/src/core/commands/diagnose.md +16 -0
- package/src/core/commands/docs.md +196 -64
- package/src/core/commands/epic/list.md +170 -0
- package/src/core/commands/epic/view.md +242 -0
- package/src/core/commands/epic.md +192 -69
- package/src/core/commands/feedback.md +191 -71
- package/src/core/commands/handoff.md +162 -48
- package/src/core/commands/help.md +9 -0
- package/src/core/commands/ideate.md +446 -0
- package/src/core/commands/impact.md +16 -0
- package/src/core/commands/metrics.md +141 -37
- package/src/core/commands/multi-expert.md +77 -0
- package/src/core/commands/packages.md +16 -0
- package/src/core/commands/pr.md +161 -67
- package/src/core/commands/readme-sync.md +16 -0
- package/src/core/commands/research/analyze.md +568 -0
- package/src/core/commands/research/ask.md +345 -20
- package/src/core/commands/research/import.md +562 -19
- package/src/core/commands/research/list.md +173 -5
- package/src/core/commands/research/view.md +181 -8
- package/src/core/commands/retro.md +135 -48
- package/src/core/commands/review.md +219 -47
- package/src/core/commands/session/end.md +209 -0
- package/src/core/commands/session/history.md +210 -0
- package/src/core/commands/session/init.md +116 -0
- package/src/core/commands/session/new.md +296 -0
- package/src/core/commands/session/resume.md +166 -0
- package/src/core/commands/session/status.md +166 -0
- package/src/core/commands/setup/visual-e2e.md +462 -0
- package/src/core/commands/skill/create.md +115 -17
- package/src/core/commands/skill/delete.md +117 -0
- package/src/core/commands/skill/edit.md +104 -0
- package/src/core/commands/skill/list.md +128 -0
- package/src/core/commands/skill/test.md +135 -0
- package/src/core/commands/skill/upgrade.md +542 -0
- package/src/core/commands/sprint.md +17 -1
- package/src/core/commands/status.md +133 -21
- package/src/core/commands/story/list.md +176 -0
- package/src/core/commands/story/view.md +265 -0
- package/src/core/commands/story-validate.md +101 -1
- package/src/core/commands/story.md +204 -51
- package/src/core/commands/template.md +16 -1
- package/src/core/commands/tests.md +226 -64
- package/src/core/commands/update.md +17 -1
- package/src/core/commands/validate-expertise.md +16 -0
- package/src/core/commands/velocity.md +140 -36
- package/src/core/commands/verify.md +14 -0
- package/src/core/commands/whats-new.md +30 -0
- package/src/core/skills/_learnings/README.md +91 -0
- package/src/core/skills/_learnings/_template.yaml +106 -0
- package/src/core/skills/_learnings/code-review.yaml +118 -0
- package/src/core/skills/_learnings/commit.yaml +69 -0
- package/src/core/skills/_learnings/story-writer.yaml +71 -0
- package/src/core/templates/damage-control-patterns.yaml +234 -0
- package/src/core/templates/skill-template.md +53 -11
- package/tools/cli/commands/start.js +180 -0
- package/tools/cli/installers/ide/claude-code.js +127 -0
- package/tools/cli/tui/Dashboard.js +66 -0
- package/tools/cli/tui/StoryList.js +69 -0
- package/tools/cli/tui/index.js +16 -0
|
@@ -1,57 +1,229 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: AI-powered code review with quality suggestions
|
|
3
3
|
argument-hint: [BRANCH=<name>] [BASE=<branch>] [FOCUS=all|security|performance|style]
|
|
4
|
+
compact_context:
|
|
5
|
+
priority: critical
|
|
6
|
+
preserve_rules:
|
|
7
|
+
- "ACTIVE COMMAND: /agileflow:ai-code-review - Code reviewer analyzing git diffs"
|
|
8
|
+
- "NEVER auto-commit fixes without explicit user approval - ALWAYS ask first"
|
|
9
|
+
- "Be constructive and helpful, never blame or criticize developers"
|
|
10
|
+
- "Show both BAD and GOOD code examples - use ❌ BAD and ✅ GOOD markers"
|
|
11
|
+
- "Prioritize by severity: CRITICAL must be fixed before merge, HIGH should be addressed"
|
|
12
|
+
- "Include 'Positive Observations' section celebrating good practices"
|
|
13
|
+
- "Provide specific code snippets as fixes, not just descriptions"
|
|
14
|
+
- "Calculate code quality score (0-100) with breakdown by category"
|
|
15
|
+
- "Save report to docs/08-project/code-reviews/<YYYYMMDD>-<BRANCH>.md"
|
|
16
|
+
state_fields:
|
|
17
|
+
- branch_name
|
|
18
|
+
- base_branch
|
|
19
|
+
- focus_area
|
|
20
|
+
- severity_filter
|
|
4
21
|
---
|
|
5
22
|
|
|
6
|
-
<!-- COMPACT_SUMMARY_START
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
###
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
23
|
+
<!-- COMPACT_SUMMARY_START -->
|
|
24
|
+
|
|
25
|
+
## ⚠️ COMPACT SUMMARY - /agileflow:ai-code-review IS ACTIVE
|
|
26
|
+
|
|
27
|
+
**CRITICAL**: You are performing AI-powered code review. This is a quality gate analysis, not punishment.
|
|
28
|
+
|
|
29
|
+
**ROLE**: Constructive Code Reviewer
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### 🚨 RULE #1: NEVER AUTO-COMMIT FIXES (NEVER)
|
|
34
|
+
|
|
35
|
+
**NEVER auto-fix code without explicit approval.**
|
|
36
|
+
|
|
37
|
+
Always ask: "Would you like me to auto-fix these issues? (YES/NO)"
|
|
38
|
+
|
|
39
|
+
Examples of auto-fixable issues:
|
|
40
|
+
- ESLint/Prettier style issues
|
|
41
|
+
- Missing imports
|
|
42
|
+
- Type annotation fixes
|
|
43
|
+
|
|
44
|
+
Examples NOT auto-fixable without approval:
|
|
45
|
+
- Logic changes
|
|
46
|
+
- Architecture refactoring
|
|
47
|
+
- Security fixes
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### 🚨 RULE #2: BE CONSTRUCTIVE, NOT CRITICAL
|
|
52
|
+
|
|
53
|
+
**Frame feedback helpfully:**
|
|
54
|
+
|
|
55
|
+
❌ WRONG: "This code is terrible and violates X pattern"
|
|
56
|
+
✅ RIGHT: "This could be improved by using X pattern because it would benefit Y"
|
|
57
|
+
|
|
58
|
+
**Include Positive Observations section:**
|
|
59
|
+
- ✅ Good use of TypeScript strict mode
|
|
60
|
+
- ✅ Well-structured error handling
|
|
61
|
+
- ✅ Clear variable naming conventions
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### 🚨 RULE #3: SHOW BAD AND GOOD CODE EXAMPLES
|
|
66
|
+
|
|
67
|
+
For every issue, provide both:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
// ❌ BAD
|
|
71
|
+
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
|
72
|
+
|
|
73
|
+
// ✅ GOOD
|
|
74
|
+
const query = "SELECT * FROM users WHERE id = ?";
|
|
75
|
+
db.query(query, [userId]);
|
|
53
76
|
```
|
|
54
77
|
|
|
78
|
+
Never just describe - show actual code.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### 🚨 RULE #4: PRIORITIZE BY SEVERITY
|
|
83
|
+
|
|
84
|
+
| Severity | Action | Blocks Merge? |
|
|
85
|
+
|----------|--------|---------------|
|
|
86
|
+
| CRITICAL | Must fix before merge | YES - fail PR check |
|
|
87
|
+
| HIGH | Should fix before merge | Warn, but reviewable |
|
|
88
|
+
| MEDIUM | Consider fixing | Optional |
|
|
89
|
+
| LOW | Nice to have | Suggest follow-up story |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### 🚨 RULE #5: CALCULATE CODE QUALITY SCORE
|
|
94
|
+
|
|
95
|
+
Calculate 0-100 score with breakdown:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Code Quality Score: 72/100
|
|
99
|
+
|
|
100
|
+
Breakdown:
|
|
101
|
+
- Security: 40/100 (2 critical issues)
|
|
102
|
+
- Performance: 75/100 (1 N+1 query)
|
|
103
|
+
- Maintainability: 80/100 (some complexity)
|
|
104
|
+
- Testing: 65/100 (coverage gaps)
|
|
105
|
+
- Style: 90/100 (mostly consistent)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### 🚨 RULE #6: SAVE REPORT TO FILE
|
|
111
|
+
|
|
112
|
+
Always save to: `docs/08-project/code-reviews/<YYYYMMDD>-<BRANCH>.md`
|
|
113
|
+
|
|
114
|
+
Include:
|
|
115
|
+
- Branch name
|
|
116
|
+
- Base branch
|
|
117
|
+
- Files changed
|
|
118
|
+
- Lines added/removed
|
|
119
|
+
- All issues grouped by severity
|
|
120
|
+
- Quality score
|
|
121
|
+
- Recommendations
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### ANTI-PATTERNS (DON'T DO THESE)
|
|
126
|
+
|
|
127
|
+
❌ Auto-fix without asking
|
|
128
|
+
❌ Use harsh language or blame
|
|
129
|
+
❌ Only show bad code examples
|
|
130
|
+
❌ Miss positive observations
|
|
131
|
+
❌ Treat MEDIUM issues as CRITICAL
|
|
132
|
+
❌ Provide feedback without code examples
|
|
133
|
+
|
|
134
|
+
### DO THESE INSTEAD
|
|
135
|
+
|
|
136
|
+
✅ Always ask before auto-fixing
|
|
137
|
+
✅ Frame feedback constructively
|
|
138
|
+
✅ Show both BAD and GOOD examples
|
|
139
|
+
✅ Celebrate good practices
|
|
140
|
+
✅ Correct severity assessment
|
|
141
|
+
✅ Include specific code snippets
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### ANALYSIS CATEGORIES
|
|
146
|
+
|
|
147
|
+
| Category | What to Check | Tools |
|
|
148
|
+
|----------|---------------|-------|
|
|
149
|
+
| **Code Quality** | Complexity, duplication, naming, function length | Cyclomatic complexity, AST analysis |
|
|
150
|
+
| **Security** | SQL injection, XSS, hardcoded secrets, input validation | Pattern matching, regex |
|
|
151
|
+
| **Performance** | N+1 queries, inefficient algorithms, memory leaks | Database query analysis |
|
|
152
|
+
| **Best Practices** | Error handling, logging, type safety, DRY | Code pattern matching |
|
|
153
|
+
| **Testing** | Coverage gaps, missing tests, flaky tests | Coverage reports, test analysis |
|
|
154
|
+
| **Documentation** | Missing JSDoc, outdated comments, API docs | Comment analysis |
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### THRESHOLDS
|
|
159
|
+
|
|
160
|
+
| Metric | Acceptable | Warning | Critical |
|
|
161
|
+
|--------|-----------|---------|----------|
|
|
162
|
+
| Cyclomatic Complexity | <10 | 10-15 | >15 |
|
|
163
|
+
| Function Length | <50 lines | 50-100 | >100 |
|
|
164
|
+
| File Length | <500 lines | 500-1000 | >1000 |
|
|
165
|
+
| Test Coverage | >80% | 60-80% | <60% |
|
|
166
|
+
| Code Quality Score | >80 | 60-80 | <60 |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### WORKFLOW
|
|
171
|
+
|
|
172
|
+
1. **Get git diff**: `git diff <BASE>...<BRANCH>` (parse changed files)
|
|
173
|
+
2. **Analyze changes**: Run 6-category analysis
|
|
174
|
+
3. **Identify issues**: Group by severity (CRITICAL/HIGH/MEDIUM/LOW)
|
|
175
|
+
4. **Generate report**: Create structured markdown with examples
|
|
176
|
+
5. **Calculate score**: 0-100 with category breakdown
|
|
177
|
+
6. **Include positives**: Celebrate good practices
|
|
178
|
+
7. **Ask about fixes**: "Auto-fix these issues? (YES/NO)"
|
|
179
|
+
8. **Save report**: To `docs/08-project/code-reviews/<YYYYMMDD>-<BRANCH>.md`
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### TOOL USAGE EXAMPLES
|
|
184
|
+
|
|
185
|
+
**TodoWrite** (to track review progress):
|
|
186
|
+
```xml
|
|
187
|
+
<invoke name="TodoWrite">
|
|
188
|
+
<parameter name="content">1. Get git diff between BASE and BRANCH
|
|
189
|
+
2. Analyze code for 6 categories
|
|
190
|
+
3. Identify issues and prioritize by severity
|
|
191
|
+
4. Generate code review report with examples
|
|
192
|
+
5. Calculate code quality score
|
|
193
|
+
6. Ask about auto-fixes
|
|
194
|
+
7. Save report to file</parameter>
|
|
195
|
+
<parameter name="status">in-progress</parameter>
|
|
196
|
+
</invoke>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**AskUserQuestion** (for auto-fix approval):
|
|
200
|
+
```xml
|
|
201
|
+
<invoke name="AskUserQuestion">
|
|
202
|
+
<parameter name="questions">[{
|
|
203
|
+
"question": "Auto-fix these issues?",
|
|
204
|
+
"header": "Code Review",
|
|
205
|
+
"multiSelect": false,
|
|
206
|
+
"options": [
|
|
207
|
+
{"label": "Auto-fix all (Recommended)", "description": "Fix 8 style issues automatically"},
|
|
208
|
+
{"label": "Review each one", "description": "Show diffs for approval"},
|
|
209
|
+
{"label": "Skip auto-fixes", "description": "Just report, no changes"}
|
|
210
|
+
]
|
|
211
|
+
}]</parameter>
|
|
212
|
+
</invoke>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### REMEMBER AFTER COMPACTION
|
|
218
|
+
|
|
219
|
+
- `/agileflow:ai-code-review` IS ACTIVE
|
|
220
|
+
- NEVER auto-fix without explicit approval
|
|
221
|
+
- Be constructive - include positive observations
|
|
222
|
+
- Show both BAD and GOOD code examples
|
|
223
|
+
- Prioritize by severity (CRITICAL blocks merge)
|
|
224
|
+
- Calculate 0-100 quality score
|
|
225
|
+
- Save report to docs/08-project/code-reviews/
|
|
226
|
+
|
|
55
227
|
<!-- COMPACT_SUMMARY_END -->
|
|
56
228
|
|
|
57
229
|
# ai-code-review
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Cleanly end session and record summary
|
|
3
3
|
argument-hint: (no arguments)
|
|
4
|
+
compact_context:
|
|
5
|
+
priority: high
|
|
6
|
+
preserve_rules:
|
|
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"
|
|
13
|
+
state_fields:
|
|
14
|
+
- current_session
|
|
15
|
+
- is_main_session
|
|
16
|
+
- user_choice
|
|
4
17
|
---
|
|
5
18
|
|
|
6
19
|
# /agileflow:session:end
|
|
@@ -100,3 +113,199 @@ The main project is not a worktree and cannot be removed.
|
|
|
100
113
|
- `/agileflow:session:new` - Create new session
|
|
101
114
|
- `/agileflow:session:resume` - Switch sessions
|
|
102
115
|
- `/agileflow:session:status` - View all sessions
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
<!-- COMPACT_SUMMARY_START -->
|
|
120
|
+
|
|
121
|
+
## ⚠️ COMPACT SUMMARY - /agileflow:session:end IS ACTIVE
|
|
122
|
+
|
|
123
|
+
**CRITICAL**: This command terminates the current session. It MUST handle three cases: main session / non-main session / cancel.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### 🚨 RULE #1: CHECK IF MAIN SESSION FIRST
|
|
128
|
+
|
|
129
|
+
Before doing anything, determine if current session is main:
|
|
130
|
+
```bash
|
|
131
|
+
node .agileflow/scripts/session-manager.js status
|
|
132
|
+
# If is_main: true → can only mark inactive
|
|
133
|
+
# If is_main: false → can delete worktree
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### 🚨 RULE #2: USE AskUserQuestion FOR OPTIONS
|
|
139
|
+
|
|
140
|
+
**For MAIN session** (only 2 options):
|
|
141
|
+
```xml
|
|
142
|
+
<invoke name="AskUserQuestion">
|
|
143
|
+
<parameter name="questions">[{
|
|
144
|
+
"question": "End Session 1 (main)?",
|
|
145
|
+
"header": "End session",
|
|
146
|
+
"multiSelect": false,
|
|
147
|
+
"options": [
|
|
148
|
+
{"label": "Yes, end session",
|
|
149
|
+
"description": "Mark session inactive (keep project for later)"},
|
|
150
|
+
{"label": "Cancel",
|
|
151
|
+
"description": "Keep session active"}
|
|
152
|
+
]
|
|
153
|
+
}]</parameter>
|
|
154
|
+
</invoke>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**For NON-MAIN session** (3 options):
|
|
158
|
+
```xml
|
|
159
|
+
<invoke name="AskUserQuestion">
|
|
160
|
+
<parameter name="questions">[{
|
|
161
|
+
"question": "End Session 2 \"auth\"?",
|
|
162
|
+
"header": "End session",
|
|
163
|
+
"multiSelect": false,
|
|
164
|
+
"options": [
|
|
165
|
+
{"label": "Yes, end session",
|
|
166
|
+
"description": "Mark session inactive (keep worktree for later)"},
|
|
167
|
+
{"label": "End and delete worktree",
|
|
168
|
+
"description": "Remove session and its directory completely"},
|
|
169
|
+
{"label": "Cancel",
|
|
170
|
+
"description": "Keep session active"}
|
|
171
|
+
]
|
|
172
|
+
}]</parameter>
|
|
173
|
+
</invoke>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### 🚨 RULE #3: HANDLE EACH USER CHOICE
|
|
179
|
+
|
|
180
|
+
**If "Yes, end session" selected:**
|
|
181
|
+
```bash
|
|
182
|
+
node .agileflow/scripts/session-manager.js unregister {session_id}
|
|
183
|
+
```
|
|
184
|
+
Display:
|
|
185
|
+
```
|
|
186
|
+
✓ Session {id} ended
|
|
187
|
+
|
|
188
|
+
Branch: {branch}
|
|
189
|
+
Story: {story_id} (status unchanged)
|
|
190
|
+
Worktree kept at: {path}
|
|
191
|
+
|
|
192
|
+
To resume later: cd {path} && claude
|
|
193
|
+
```
|
|
194
|
+
|
|
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:
|
|
200
|
+
```
|
|
201
|
+
✓ Session {id} ended and removed
|
|
202
|
+
|
|
203
|
+
Branch: {branch}
|
|
204
|
+
Worktree removed: {path}
|
|
205
|
+
|
|
206
|
+
💡 The branch still exists. To delete it:
|
|
207
|
+
git branch -d {branch}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**If "Cancel" selected:**
|
|
211
|
+
```
|
|
212
|
+
Session remains active.
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### 🚨 RULE #4: MAIN SESSION WARNING
|
|
218
|
+
|
|
219
|
+
If session is main (is_main: true):
|
|
220
|
+
```
|
|
221
|
+
⚠️ This is the main project session.
|
|
222
|
+
|
|
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.
|
|
225
|
+
```
|
|
226
|
+
|
|
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:
|
|
234
|
+
```
|
|
235
|
+
💡 The branch still exists. To delete it:
|
|
236
|
+
git branch -d {branch}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
This is important because users might want to keep branch history.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
### KEY FILES TO REMEMBER
|
|
244
|
+
|
|
245
|
+
| File | Purpose |
|
|
246
|
+
|------|---------|
|
|
247
|
+
| `.agileflow/sessions/registry.json` | Session registry |
|
|
248
|
+
| `.agileflow/sessions/{id}.lock` | Removed when session ends |
|
|
249
|
+
| `.agileflow/scripts/session-manager.js` | Unregister and delete |
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
### WORKFLOW
|
|
254
|
+
|
|
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
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
### ANTI-PATTERNS (DON'T DO THESE)
|
|
284
|
+
|
|
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
|
|
290
|
+
|
|
291
|
+
### DO THESE INSTEAD
|
|
292
|
+
|
|
293
|
+
✅ 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
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### REMEMBER AFTER COMPACTION
|
|
302
|
+
|
|
303
|
+
- `/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
|
|
310
|
+
|
|
311
|
+
<!-- COMPACT_SUMMARY_END -->
|