agileflow 2.51.0 → 2.55.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 +82 -460
- package/package.json +18 -3
- package/scripts/agileflow-configure.js +134 -63
- package/scripts/agileflow-welcome.js +161 -31
- package/scripts/generators/agent-registry.js +2 -2
- package/scripts/generators/command-registry.js +6 -6
- package/scripts/generators/index.js +2 -6
- package/scripts/generators/inject-babysit.js +9 -2
- package/scripts/generators/inject-help.js +3 -1
- package/scripts/generators/inject-readme.js +7 -3
- package/scripts/generators/skill-registry.js +5 -5
- package/scripts/get-env.js +13 -12
- package/scripts/obtain-context.js +79 -26
- package/scripts/session-coordinator.sh +232 -0
- package/scripts/session-manager.js +512 -0
- package/src/core/agents/orchestrator.md +275 -0
- package/src/core/commands/adr.md +38 -16
- package/src/core/commands/agent.md +39 -22
- package/src/core/commands/assign.md +17 -0
- package/src/core/commands/auto.md +60 -46
- package/src/core/commands/babysit.md +302 -637
- package/src/core/commands/baseline.md +20 -0
- package/src/core/commands/blockers.md +33 -48
- package/src/core/commands/board.md +19 -0
- package/src/core/commands/changelog.md +20 -0
- package/src/core/commands/ci.md +17 -0
- package/src/core/commands/context.md +43 -40
- package/src/core/commands/debt.md +76 -45
- package/src/core/commands/deploy.md +20 -0
- package/src/core/commands/deps.md +40 -46
- package/src/core/commands/diagnose.md +24 -18
- package/src/core/commands/docs.md +18 -0
- package/src/core/commands/epic.md +31 -0
- package/src/core/commands/feedback.md +33 -21
- package/src/core/commands/handoff.md +29 -0
- package/src/core/commands/help.md +16 -7
- package/src/core/commands/impact.md +31 -61
- package/src/core/commands/metrics.md +17 -35
- package/src/core/commands/packages.md +21 -0
- package/src/core/commands/pr.md +15 -0
- package/src/core/commands/readme-sync.md +42 -9
- package/src/core/commands/research.md +58 -11
- package/src/core/commands/retro.md +42 -50
- package/src/core/commands/review.md +22 -27
- package/src/core/commands/session/end.md +53 -297
- package/src/core/commands/session/history.md +38 -257
- package/src/core/commands/session/init.md +44 -446
- package/src/core/commands/session/new.md +152 -0
- package/src/core/commands/session/resume.md +51 -447
- package/src/core/commands/session/status.md +32 -244
- package/src/core/commands/sprint.md +33 -0
- package/src/core/commands/status.md +18 -0
- package/src/core/commands/story-validate.md +32 -0
- package/src/core/commands/story.md +21 -6
- package/src/core/commands/template.md +18 -0
- package/src/core/commands/tests.md +22 -0
- package/src/core/commands/update.md +72 -58
- package/src/core/commands/validate-expertise.md +25 -37
- package/src/core/commands/velocity.md +33 -74
- package/src/core/commands/verify.md +16 -0
- package/src/core/experts/documentation/expertise.yaml +16 -2
- package/src/core/skills/agileflow-retro-facilitator/SKILL.md +57 -219
- package/src/core/skills/agileflow-retro-facilitator/cookbook/4ls.md +86 -0
- package/src/core/skills/agileflow-retro-facilitator/cookbook/glad-sad-mad.md +79 -0
- package/src/core/skills/agileflow-retro-facilitator/cookbook/start-stop-continue.md +142 -0
- package/src/core/skills/agileflow-retro-facilitator/prompts/action-items.md +83 -0
- package/src/core/skills/writing-skills/SKILL.md +352 -0
- package/src/core/skills/writing-skills/testing-skills-with-subagents.md +232 -0
- package/tools/cli/agileflow-cli.js +4 -2
- package/tools/cli/commands/config.js +20 -13
- package/tools/cli/commands/doctor.js +25 -9
- package/tools/cli/commands/list.js +10 -6
- package/tools/cli/commands/setup.js +54 -3
- package/tools/cli/commands/status.js +6 -8
- package/tools/cli/commands/uninstall.js +5 -5
- package/tools/cli/commands/update.js +51 -7
- package/tools/cli/installers/core/installer.js +8 -4
- package/tools/cli/installers/ide/_base-ide.js +3 -1
- package/tools/cli/installers/ide/claude-code.js +3 -7
- package/tools/cli/installers/ide/codex.js +440 -0
- package/tools/cli/installers/ide/manager.js +2 -6
- package/tools/cli/lib/content-injector.js +3 -3
- package/tools/cli/lib/docs-setup.js +3 -2
- package/tools/cli/lib/npm-utils.js +3 -3
- package/tools/cli/lib/ui.js +7 -7
- package/tools/cli/lib/version-checker.js +3 -3
- package/tools/postinstall.js +2 -3
|
@@ -3,484 +3,82 @@ description: Initialize session harness with test verification
|
|
|
3
3
|
argument-hint: (no arguments)
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# /agileflow:session:init
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Initialize or verify the session management system.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
**Execute these steps NOW in order:**
|
|
13
|
-
|
|
14
|
-
### Step 1: Check if already initialized
|
|
15
|
-
```bash
|
|
16
|
-
ls docs/00-meta/environment.json 2>/dev/null && echo "Already initialized" || echo "Not initialized"
|
|
17
|
-
ls docs/09-agents/session-state.json 2>/dev/null
|
|
18
|
-
```
|
|
19
|
-
If both files exist, ask user if they want to reinitialize.
|
|
20
|
-
|
|
21
|
-
### Step 2: Detect project type
|
|
22
|
-
```bash
|
|
23
|
-
ls package.json pyproject.toml Cargo.toml go.mod 2>/dev/null
|
|
24
|
-
```
|
|
25
|
-
Identify: nodejs (package.json), python (pyproject.toml), rust (Cargo.toml), go (go.mod)
|
|
26
|
-
|
|
27
|
-
### Step 3: Detect test command
|
|
28
|
-
For Node.js:
|
|
29
|
-
```bash
|
|
30
|
-
jq -r '.scripts.test // "npm test"' package.json 2>/dev/null
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Step 4: Create environment.json
|
|
34
|
-
Use Write tool to create `docs/00-meta/environment.json`:
|
|
35
|
-
```json
|
|
36
|
-
{
|
|
37
|
-
"project_type": "{detected}",
|
|
38
|
-
"test_command": "{detected}",
|
|
39
|
-
"test_timeout_ms": 60000,
|
|
40
|
-
"created_at": "{now}",
|
|
41
|
-
"updated_at": "{now}"
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Step 5: Ensure session-state.json exists
|
|
46
|
-
Check if `docs/09-agents/session-state.json` exists. If not, create it with the MVP schema.
|
|
47
|
-
|
|
48
|
-
### Step 6: Display summary
|
|
49
|
-
Output what was created and next steps.
|
|
50
|
-
|
|
51
|
-
## TODO LIST TRACKING
|
|
52
|
-
|
|
53
|
-
**CRITICAL**: Immediately create a todo list using TodoWrite tool:
|
|
54
|
-
```
|
|
55
|
-
1. Check if already initialized
|
|
56
|
-
2. Detect project type
|
|
57
|
-
3. Detect test command
|
|
58
|
-
4. Create docs/00-meta/environment.json
|
|
59
|
-
5. Ensure session-state.json exists
|
|
60
|
-
6. Display summary
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Mark each step complete as you finish it.
|
|
64
|
-
|
|
65
|
-
## Prerequisites
|
|
66
|
-
|
|
67
|
-
- AgileFlow must be initialized (`/agileflow:setup` must have been run)
|
|
68
|
-
- Project must have a test suite configured
|
|
69
|
-
- Must be in project root directory
|
|
70
|
-
|
|
71
|
-
## Execution Flow
|
|
72
|
-
|
|
73
|
-
### 1. Pre-flight Checks
|
|
10
|
+
---
|
|
74
11
|
|
|
75
|
-
|
|
76
|
-
# Verify AgileFlow is initialized
|
|
77
|
-
if [ ! -f "docs/09-agents/status.json" ]; then
|
|
78
|
-
echo "❌ AgileFlow not initialized"
|
|
79
|
-
echo ""
|
|
80
|
-
echo "Run /agileflow:setup first to create the docs structure"
|
|
81
|
-
exit 1
|
|
82
|
-
fi
|
|
12
|
+
## Purpose
|
|
83
13
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
echo ""
|
|
90
|
-
echo "Options:"
|
|
91
|
-
echo " 1. Continue (overwrite existing configuration)"
|
|
92
|
-
echo " 2. Skip initialization"
|
|
93
|
-
echo ""
|
|
94
|
-
read -p "Choice [1/2]: " choice
|
|
14
|
+
Sets up session tracking infrastructure:
|
|
15
|
+
- Creates `.agileflow/sessions/` directory
|
|
16
|
+
- Initializes `registry.json` if missing
|
|
17
|
+
- Registers the current session
|
|
18
|
+
- Displays session status
|
|
95
19
|
|
|
96
|
-
|
|
97
|
-
echo "Skipping initialization"
|
|
98
|
-
exit 0
|
|
99
|
-
fi
|
|
100
|
-
fi
|
|
101
|
-
```
|
|
20
|
+
This command is typically called automatically by the SessionStart hook.
|
|
102
21
|
|
|
103
|
-
|
|
22
|
+
## IMMEDIATE ACTIONS
|
|
104
23
|
|
|
105
|
-
|
|
24
|
+
### Step 1: Ensure Session Infrastructure
|
|
106
25
|
|
|
107
|
-
**Node.js Detection:**
|
|
108
26
|
```bash
|
|
109
|
-
|
|
110
|
-
PROJECT_TYPE="nodejs"
|
|
111
|
-
|
|
112
|
-
# Detect test command from package.json
|
|
113
|
-
if grep -q '"test":' package.json; then
|
|
114
|
-
TEST_COMMAND=$(jq -r '.scripts.test // "npm test"' package.json)
|
|
115
|
-
else
|
|
116
|
-
TEST_COMMAND="npm test"
|
|
117
|
-
fi
|
|
118
|
-
|
|
119
|
-
# Detect dev server
|
|
120
|
-
if grep -q '"dev":' package.json; then
|
|
121
|
-
DEV_COMMAND=$(jq -r '.scripts.dev // "npm run dev"' package.json)
|
|
122
|
-
fi
|
|
123
|
-
fi
|
|
27
|
+
node .agileflow/scripts/session-manager.js register
|
|
124
28
|
```
|
|
125
29
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
# Detect test framework
|
|
132
|
-
if grep -q pytest requirements.txt 2>/dev/null; then
|
|
133
|
-
TEST_COMMAND="pytest"
|
|
134
|
-
elif grep -q unittest requirements.txt 2>/dev/null; then
|
|
135
|
-
TEST_COMMAND="python -m unittest discover"
|
|
136
|
-
else
|
|
137
|
-
TEST_COMMAND="pytest"
|
|
138
|
-
fi
|
|
139
|
-
fi
|
|
140
|
-
```
|
|
30
|
+
This will:
|
|
31
|
+
- Create `.agileflow/sessions/` if missing
|
|
32
|
+
- Create `registry.json` with schema if missing
|
|
33
|
+
- Register current directory as a session
|
|
34
|
+
- Create lock file with current PID
|
|
141
35
|
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
if [ -f "Cargo.toml" ]; then
|
|
145
|
-
PROJECT_TYPE="rust"
|
|
146
|
-
TEST_COMMAND="cargo test"
|
|
147
|
-
DEV_COMMAND="cargo run"
|
|
148
|
-
fi
|
|
149
|
-
```
|
|
36
|
+
### Step 2: Check for Other Active Sessions
|
|
150
37
|
|
|
151
|
-
**Go Detection:**
|
|
152
38
|
```bash
|
|
153
|
-
|
|
154
|
-
PROJECT_TYPE="go"
|
|
155
|
-
TEST_COMMAND="go test ./..."
|
|
156
|
-
DEV_COMMAND="go run ."
|
|
157
|
-
fi
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
**Detection Summary:**
|
|
161
|
-
```
|
|
162
|
-
🔍 Project Detection Results
|
|
163
|
-
|
|
164
|
-
Project type: nodejs
|
|
165
|
-
Test command: npm test
|
|
166
|
-
Dev server: npm run dev (port 3000)
|
|
39
|
+
node .agileflow/scripts/session-manager.js count
|
|
167
40
|
```
|
|
168
41
|
|
|
169
|
-
|
|
42
|
+
If `count > 0`, there are other active sessions.
|
|
170
43
|
|
|
171
|
-
|
|
44
|
+
### Step 3: Display Status
|
|
172
45
|
|
|
46
|
+
**If no other sessions:**
|
|
173
47
|
```
|
|
174
|
-
|
|
175
|
-
Project Type: nodejs
|
|
176
|
-
Test Command: npm test
|
|
177
|
-
Dev Server: npm run dev
|
|
48
|
+
✓ Session initialized
|
|
178
49
|
|
|
179
|
-
|
|
180
|
-
|
|
50
|
+
Session ID: 1
|
|
51
|
+
Path: /home/user/project
|
|
52
|
+
Branch: main
|
|
181
53
|
|
|
182
|
-
|
|
183
|
-
```
|
|
184
|
-
Enter test command (or press Enter to skip): _
|
|
185
|
-
Enter dev server command (or press Enter to skip): _
|
|
186
|
-
Enter dev server port (default 3000): _
|
|
187
|
-
Enter ready pattern (default "Ready"): _
|
|
54
|
+
No other active sessions detected.
|
|
188
55
|
```
|
|
189
56
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
Generate `docs/00-meta/environment.json` from template:
|
|
193
|
-
|
|
194
|
-
```json
|
|
195
|
-
{
|
|
196
|
-
"$schema": "https://json-schema.org/draft-07/schema#",
|
|
197
|
-
"description": "AgileFlow session harness environment configuration",
|
|
198
|
-
"project_type": "nodejs",
|
|
199
|
-
"init_script": "./docs/00-meta/init.sh",
|
|
200
|
-
"test_command": "npm test",
|
|
201
|
-
"test_timeout_ms": 60000,
|
|
202
|
-
"dev_server": {
|
|
203
|
-
"command": "npm run dev",
|
|
204
|
-
"port": 3000,
|
|
205
|
-
"ready_pattern": "Ready on"
|
|
206
|
-
},
|
|
207
|
-
"verification_policy": "warn",
|
|
208
|
-
"baseline_commit": null,
|
|
209
|
-
"baseline_established": null,
|
|
210
|
-
"created_at": "2025-12-06T10:00:00Z",
|
|
211
|
-
"updated_at": "2025-12-06T10:00:00Z"
|
|
212
|
-
}
|
|
57
|
+
**If other sessions active:**
|
|
213
58
|
```
|
|
59
|
+
✓ Session initialized
|
|
214
60
|
|
|
215
|
-
|
|
61
|
+
Session ID: 1 (current)
|
|
62
|
+
Path: /home/user/project
|
|
63
|
+
Branch: main
|
|
216
64
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
cp templates/init.sh docs/00-meta/init.sh
|
|
221
|
-
chmod +x docs/00-meta/init.sh
|
|
222
|
-
|
|
223
|
-
# Customize based on project type
|
|
224
|
-
sed -i "s/{{PROJECT_TYPE}}/$PROJECT_TYPE/g" docs/00-meta/init.sh
|
|
65
|
+
⚠️ {count} other session(s) active in this repo.
|
|
66
|
+
Run /agileflow:session:status to see all sessions.
|
|
67
|
+
Run /agileflow:session:new to create isolated workspace.
|
|
225
68
|
```
|
|
226
69
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
Initialize session state file:
|
|
70
|
+
## Already Initialized Case
|
|
230
71
|
|
|
231
|
-
|
|
232
|
-
{
|
|
233
|
-
"$schema": "https://json-schema.org/draft-07/schema#",
|
|
234
|
-
"description": "AgileFlow session state tracking",
|
|
235
|
-
"current_session": {
|
|
236
|
-
"id": "sess-20251206-100000",
|
|
237
|
-
"started_at": "2025-12-06T10:00:00Z",
|
|
238
|
-
"baseline_verified": false,
|
|
239
|
-
"initial_test_status": "not_run",
|
|
240
|
-
"current_story": null,
|
|
241
|
-
"active_agent": null
|
|
242
|
-
},
|
|
243
|
-
"last_session": {
|
|
244
|
-
"id": null,
|
|
245
|
-
"ended_at": null,
|
|
246
|
-
"stories_completed": [],
|
|
247
|
-
"final_test_status": "not_run",
|
|
248
|
-
"commits": []
|
|
249
|
-
},
|
|
250
|
-
"session_history": []
|
|
251
|
-
}
|
|
72
|
+
If session is already registered:
|
|
252
73
|
```
|
|
74
|
+
✓ Session already active
|
|
253
75
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
```
|
|
259
|
-
🧪 Running initial test verification...
|
|
260
|
-
|
|
261
|
-
Command: npm test
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
**If tests pass:**
|
|
265
|
-
```
|
|
266
|
-
✅ Tests passed (42/42)
|
|
267
|
-
|
|
268
|
-
Baseline test status: passing
|
|
269
|
-
All systems ready for session tracking
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
**If tests fail:**
|
|
273
|
-
```
|
|
274
|
-
⚠️ Tests failed (40/42)
|
|
275
|
-
|
|
276
|
-
Failed tests:
|
|
277
|
-
❌ auth.test.ts:42 - Expected redirect
|
|
278
|
-
❌ auth.test.ts:67 - Session not persisting
|
|
279
|
-
|
|
280
|
-
Recommendation: Fix failing tests before proceeding
|
|
281
|
-
Continue anyway? [y/N]: _
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### 8. Create Baseline Tag (Optional)
|
|
285
|
-
|
|
286
|
-
If tests are passing, offer to create baseline:
|
|
287
|
-
|
|
288
|
-
```
|
|
289
|
-
Create baseline git tag? [Y/n]: _
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
If yes:
|
|
293
|
-
```bash
|
|
294
|
-
TAG_NAME="agileflow-baseline-$(date +%Y%m%d-%H%M%S)"
|
|
295
|
-
git tag -a "$TAG_NAME" -m "AgileFlow baseline: all tests passing"
|
|
296
|
-
|
|
297
|
-
# Update environment.json
|
|
298
|
-
COMMIT_SHA=$(git rev-parse HEAD)
|
|
299
|
-
# Update baseline_commit and baseline_established fields
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
### 9. Configure SessionStart Hook
|
|
303
|
-
|
|
304
|
-
Offer to add automatic session resumption:
|
|
305
|
-
|
|
306
|
-
```
|
|
307
|
-
Enable automatic session resumption on startup? [Y/n]: _
|
|
308
|
-
|
|
309
|
-
This will:
|
|
310
|
-
- Run session resume script on every Claude Code session start
|
|
311
|
-
- Verify tests and load context automatically
|
|
312
|
-
- Show session summary with recent activity
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
If yes:
|
|
316
|
-
```bash
|
|
317
|
-
# Copy resume script from AgileFlow plugin
|
|
318
|
-
cp ~/.claude-code/plugins/AgileFlow/templates/resume-session.sh docs/00-meta/resume-session.sh
|
|
319
|
-
chmod +x docs/00-meta/resume-session.sh
|
|
320
|
-
|
|
321
|
-
# Create or update .claude/settings.json
|
|
322
|
-
mkdir -p .claude
|
|
323
|
-
|
|
324
|
-
if [ -f ".claude/settings.json" ]; then
|
|
325
|
-
# Merge with existing settings using jq
|
|
326
|
-
echo "Updating existing .claude/settings.json..."
|
|
327
|
-
|
|
328
|
-
# Add SessionStart hook if it doesn't exist
|
|
329
|
-
jq '.hooks.SessionStart += [{
|
|
330
|
-
"matcher": "",
|
|
331
|
-
"hooks": [{
|
|
332
|
-
"type": "command",
|
|
333
|
-
"command": "bash docs/00-meta/resume-session.sh"
|
|
334
|
-
}]
|
|
335
|
-
}]' .claude/settings.json > .claude/settings.json.tmp && mv .claude/settings.json.tmp .claude/settings.json
|
|
336
|
-
else
|
|
337
|
-
# Create new settings.json
|
|
338
|
-
cat > .claude/settings.json <<'EOF'
|
|
339
|
-
{
|
|
340
|
-
"hooks": {
|
|
341
|
-
"SessionStart": [{
|
|
342
|
-
"matcher": "",
|
|
343
|
-
"hooks": [{
|
|
344
|
-
"type": "command",
|
|
345
|
-
"command": "bash docs/00-meta/resume-session.sh"
|
|
346
|
-
}]
|
|
347
|
-
}]
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
EOF
|
|
351
|
-
fi
|
|
352
|
-
|
|
353
|
-
echo "✅ SessionStart hook configured"
|
|
354
|
-
echo "✅ docs/00-meta/resume-session.sh created"
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
**IMPORTANT**: The hook calls a **shell script** (`bash docs/00-meta/resume-session.sh`), NOT the slash command `/agileflow:session:resume`. This is because:
|
|
358
|
-
- Hooks execute shell commands, not Claude Code slash commands
|
|
359
|
-
- The shell script replicates `/agileflow:session:resume` functionality
|
|
360
|
-
- This enables true automatic session resumption
|
|
361
|
-
|
|
362
|
-
### 10. Final Summary
|
|
363
|
-
|
|
364
|
-
Display setup completion summary:
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
✅ Session Harness Initialized
|
|
368
|
-
|
|
369
|
-
Files Created:
|
|
370
|
-
✅ docs/00-meta/environment.json
|
|
371
|
-
✅ docs/00-meta/init.sh
|
|
372
|
-
✅ docs/00-meta/resume-session.sh (auto-resume script)
|
|
373
|
-
✅ docs/09-agents/session-state.json
|
|
374
|
-
✅ .claude/settings.json (hook configured)
|
|
375
|
-
|
|
376
|
-
Baseline Status:
|
|
377
|
-
✅ Tests: 42/42 passing
|
|
378
|
-
✅ Git tag: agileflow-baseline-20251206-103000
|
|
379
|
-
✅ Commit: abc123def456
|
|
380
|
-
|
|
381
|
-
Configuration:
|
|
382
|
-
Project Type: nodejs
|
|
383
|
-
Test Command: npm test
|
|
384
|
-
Verification Policy: warn
|
|
385
|
-
Auto-Resume: enabled (via shell script hook)
|
|
386
|
-
|
|
387
|
-
Next Steps:
|
|
388
|
-
1. Restart Claude Code to activate SessionStart hook
|
|
389
|
-
2. Run /agileflow:verify to check tests anytime
|
|
390
|
-
3. Run /agileflow:baseline to mark new baselines
|
|
391
|
-
4. Run /agileflow:session:resume manually or let the hook run it
|
|
392
|
-
|
|
393
|
-
On Next Session:
|
|
394
|
-
- Hook will automatically run: bash docs/00-meta/resume-session.sh
|
|
395
|
-
- Init script executes, tests verify, context loads
|
|
396
|
-
- You'll see session summary and be ready to code!
|
|
397
|
-
|
|
398
|
-
Session harness is ready! 🚀
|
|
76
|
+
Session ID: 1
|
|
77
|
+
Path: /home/user/project
|
|
78
|
+
Branch: main
|
|
399
79
|
```
|
|
400
80
|
|
|
401
81
|
## Related Commands
|
|
402
82
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
| `/agileflow:session:resume` | Start session with verification and context loading |
|
|
406
|
-
| `/agileflow:session:status` | View current session state and activity |
|
|
407
|
-
| `/agileflow:session:end` | Cleanly end session and record summary |
|
|
408
|
-
| `/agileflow:session:history` | View past session history and metrics |
|
|
409
|
-
|
|
410
|
-
## Error Handling
|
|
411
|
-
|
|
412
|
-
### No Test Command Found
|
|
413
|
-
```
|
|
414
|
-
⚠️ Could not detect test command
|
|
415
|
-
|
|
416
|
-
Please specify test command manually:
|
|
417
|
-
Test command: _
|
|
418
|
-
|
|
419
|
-
Or skip test verification:
|
|
420
|
-
Skip tests? [y/N]: _
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
### Test Command Fails
|
|
424
|
-
```
|
|
425
|
-
❌ Test command failed: npm test
|
|
426
|
-
Error: npm: command not found
|
|
427
|
-
|
|
428
|
-
Possible causes:
|
|
429
|
-
1. Dependencies not installed
|
|
430
|
-
2. Test command incorrect
|
|
431
|
-
3. Node.js not in PATH
|
|
432
|
-
|
|
433
|
-
Would you like to:
|
|
434
|
-
1. Run init script (install dependencies)
|
|
435
|
-
2. Specify different test command
|
|
436
|
-
3. Skip test verification
|
|
437
|
-
|
|
438
|
-
Choice [1/2/3]: _
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
### Init Script Execution Fails
|
|
442
|
-
```
|
|
443
|
-
❌ Init script failed
|
|
444
|
-
Error: ...
|
|
445
|
-
|
|
446
|
-
The init script at docs/00-meta/init.sh encountered an error.
|
|
447
|
-
|
|
448
|
-
Review the script and try again, or continue without running init.
|
|
449
|
-
|
|
450
|
-
Continue without init? [y/N]: _
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
### Git Not Available
|
|
454
|
-
```
|
|
455
|
-
⚠️ Git not found - baseline tagging unavailable
|
|
456
|
-
|
|
457
|
-
Session harness will be created without git baseline tracking.
|
|
458
|
-
|
|
459
|
-
This is optional - you can add baseline tags manually later using:
|
|
460
|
-
git tag -a agileflow-baseline-YYYYMMDD -m "Baseline"
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
## Integration Points
|
|
464
|
-
|
|
465
|
-
### Called By
|
|
466
|
-
- `/agileflow:setup` - Optionally runs session:init during initial setup
|
|
467
|
-
|
|
468
|
-
### Calls
|
|
469
|
-
- `/agileflow:verify` - For initial test verification
|
|
470
|
-
- Template system - Uses templates/environment.json, templates/init.sh
|
|
471
|
-
|
|
472
|
-
### Creates
|
|
473
|
-
- `docs/00-meta/environment.json` - Session harness config
|
|
474
|
-
- `docs/00-meta/init.sh` - Environment initialization script
|
|
475
|
-
- `docs/09-agents/session-state.json` - Session state tracking
|
|
476
|
-
- `.claude/settings.json` - SessionStart hook (if enabled)
|
|
477
|
-
- Git tag (optional) - Baseline marker
|
|
478
|
-
|
|
479
|
-
## Implementation Notes
|
|
480
|
-
|
|
481
|
-
1. **Idempotent**: Safe to run multiple times (asks before overwriting)
|
|
482
|
-
2. **Interactive**: Confirms all detected settings before creating files
|
|
483
|
-
3. **Graceful Degradation**: Works even if tests fail or git unavailable
|
|
484
|
-
4. **User Control**: Every optional feature requires explicit consent
|
|
485
|
-
5. **Clear Output**: Step-by-step progress with clear status indicators
|
|
486
|
-
6. **Error Recovery**: Provides options to retry, skip, or fix issues
|
|
83
|
+
- `/agileflow:session:status` - View all sessions
|
|
84
|
+
- `/agileflow:session:new` - Create parallel session
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create a new parallel session with git worktree
|
|
3
|
+
argument-hint: (no arguments)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /agileflow:session:new
|
|
7
|
+
|
|
8
|
+
Create a new isolated session for parallel Claude Code work.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Purpose
|
|
13
|
+
|
|
14
|
+
When you need to work on multiple things simultaneously in the same repo, this command creates a new session with:
|
|
15
|
+
- A separate git worktree (isolated directory)
|
|
16
|
+
- Its own branch
|
|
17
|
+
- Independent session tracking
|
|
18
|
+
|
|
19
|
+
## IMMEDIATE ACTIONS
|
|
20
|
+
|
|
21
|
+
Upon invocation, execute these steps:
|
|
22
|
+
|
|
23
|
+
### Step 1: Check Prerequisites
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Verify git is available and we're in a git repo
|
|
27
|
+
git rev-parse --is-inside-work-tree
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If not in a git repo, display error and exit.
|
|
31
|
+
|
|
32
|
+
### Step 2: Run Session Manager to Get Current State
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
node .agileflow/scripts/session-manager.js status
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Parse the JSON output to understand current sessions.
|
|
39
|
+
|
|
40
|
+
### Step 3: Present Options with AskUserQuestion
|
|
41
|
+
|
|
42
|
+
Use AskUserQuestion to let user choose how to create the session:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
AskUserQuestion:
|
|
46
|
+
question: "How would you like to create your new session?"
|
|
47
|
+
header: "New session"
|
|
48
|
+
multiSelect: false
|
|
49
|
+
options:
|
|
50
|
+
- label: "Auto-create Session {next_id} (Recommended)"
|
|
51
|
+
description: "Creates ../project-{next_id} with new branch session-{next_id}"
|
|
52
|
+
- label: "Name this session"
|
|
53
|
+
description: "Give it a memorable name like 'auth' or 'bugfix'"
|
|
54
|
+
- label: "Use existing branch"
|
|
55
|
+
description: "Create session from one of your existing branches"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Step 4a: If "Auto-create" Selected
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
node .agileflow/scripts/session-manager.js create
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Parse the JSON result. Display:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
✓ Created Session {id}
|
|
68
|
+
|
|
69
|
+
Workspace: {path}
|
|
70
|
+
Branch: {branch}
|
|
71
|
+
|
|
72
|
+
┌─────────────────────────────────────────────────────────┐
|
|
73
|
+
│ To start working in this session, run: │
|
|
74
|
+
│ │
|
|
75
|
+
│ {command} │
|
|
76
|
+
│ │
|
|
77
|
+
└─────────────────────────────────────────────────────────┘
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Step 4b: If "Name this session" Selected
|
|
81
|
+
|
|
82
|
+
Use AskUserQuestion to get the name:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
AskUserQuestion:
|
|
86
|
+
question: "What should this session be called?"
|
|
87
|
+
header: "Session name"
|
|
88
|
+
multiSelect: false
|
|
89
|
+
options:
|
|
90
|
+
- label: "auth"
|
|
91
|
+
description: "Working on authentication"
|
|
92
|
+
- label: "bugfix"
|
|
93
|
+
description: "Fixing bugs"
|
|
94
|
+
- label: "feature"
|
|
95
|
+
description: "New feature work"
|
|
96
|
+
- label: "experiment"
|
|
97
|
+
description: "Trying something out"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Then create with nickname:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
node .agileflow/scripts/session-manager.js create --nickname {name}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Step 4c: If "Use existing branch" Selected
|
|
107
|
+
|
|
108
|
+
List branches:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
git branch --format='%(refname:short)'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Use AskUserQuestion to present branch options (limit to 4-5 most recent).
|
|
115
|
+
|
|
116
|
+
Then create with specified branch:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
node .agileflow/scripts/session-manager.js create --branch {branch_name}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Step 5: Display Success Message
|
|
123
|
+
|
|
124
|
+
Show the created session details and the command to start working:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
✓ Created Session {id} "{nickname}"
|
|
128
|
+
|
|
129
|
+
Workspace: ../project-{name}
|
|
130
|
+
Branch: session-{id}-{name}
|
|
131
|
+
|
|
132
|
+
┌─────────────────────────────────────────────────────────┐
|
|
133
|
+
│ To start working in this session, run: │
|
|
134
|
+
│ │
|
|
135
|
+
│ cd ../project-{name} && claude │
|
|
136
|
+
│ │
|
|
137
|
+
└─────────────────────────────────────────────────────────┘
|
|
138
|
+
|
|
139
|
+
💡 Tip: Use /agileflow:session:resume to see all sessions
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Error Handling
|
|
143
|
+
|
|
144
|
+
- **Directory exists**: Suggest different name or manual cleanup
|
|
145
|
+
- **Branch conflict**: Offer to use existing branch or create new one
|
|
146
|
+
- **Git errors**: Display error message and suggest manual resolution
|
|
147
|
+
|
|
148
|
+
## Related Commands
|
|
149
|
+
|
|
150
|
+
- `/agileflow:session:resume` - Switch between sessions
|
|
151
|
+
- `/agileflow:session:status` - View all sessions
|
|
152
|
+
- `/agileflow:session:end` - End current session
|