claude-fsd 1.5.27 → 1.5.29
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 -0
- package/bin/claudefsd-dev +204 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,8 +83,14 @@ Runs the development agent fleet. This command:
|
|
|
83
83
|
- Updates the plan to track progress
|
|
84
84
|
- Repeats until all tasks are done
|
|
85
85
|
|
|
86
|
+
Options:
|
|
87
|
+
- `--max-time=MINUTES` - Maximum total runtime (default: 120 minutes)
|
|
88
|
+
- `--working-dir=DIR` - Directory containing BRIEF.md and PLAN.md (default: docs)
|
|
89
|
+
|
|
86
90
|
Every 4th cycle, it activates "megathinking mode" using ultrathink for deep architectural planning.
|
|
87
91
|
|
|
92
|
+
**@STOP Checkpoint**: Add `@STOP` on its own line in PLAN.md to pause when all preceding tasks complete. Useful for human review or deployment gates.
|
|
93
|
+
|
|
88
94
|
#### claudefsd-interview
|
|
89
95
|
Interactive expert Q&A session that:
|
|
90
96
|
- Analyzes your BRIEF.md with multiple AI personas (DBA, Architect, UX Expert, etc.)
|
package/bin/claudefsd-dev
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
3
|
# Main development mode - intelligent task selection with parallel execution
|
|
4
|
-
# Usage: claudefsd-dev
|
|
4
|
+
# Usage: claudefsd-dev [--working-dir=DIR] [--max-time=MINUTES]
|
|
5
|
+
#
|
|
6
|
+
# Options:
|
|
7
|
+
# --working-dir=DIR Directory containing BRIEF.md and PLAN.md (default: docs)
|
|
8
|
+
# --max-time=MINUTES Maximum total runtime in minutes (default: 120)
|
|
5
9
|
#
|
|
6
10
|
# Features:
|
|
7
11
|
# - Fail-fast loop detection and "all done" prompt from iterative mode
|
|
8
12
|
# - Direct parallel Task agent execution from direct mode
|
|
9
13
|
# - Intelligent task planning and coordination
|
|
14
|
+
# - @STOP marker support: stops when all tasks before @STOP are complete
|
|
15
|
+
# - Max runtime limit to prevent runaway sessions
|
|
10
16
|
#
|
|
11
17
|
|
|
12
18
|
#set -e
|
|
13
19
|
|
|
14
|
-
# Parse
|
|
20
|
+
# Parse command line parameters
|
|
15
21
|
WORKING_DIR="docs"
|
|
22
|
+
MAX_TIME_MINUTES=120
|
|
16
23
|
for arg in "$@"; do
|
|
17
24
|
case $arg in
|
|
18
25
|
--working-dir=*)
|
|
19
26
|
WORKING_DIR="${arg#*=}"
|
|
20
27
|
shift
|
|
21
28
|
;;
|
|
29
|
+
--max-time=*)
|
|
30
|
+
MAX_TIME_MINUTES="${arg#*=}"
|
|
31
|
+
shift
|
|
32
|
+
;;
|
|
22
33
|
esac
|
|
23
34
|
done
|
|
24
35
|
export CLAUDEFSD_WORKING_DIR="$WORKING_DIR"
|
|
25
36
|
|
|
37
|
+
# Convert max time to seconds and record start time
|
|
38
|
+
MAX_TIME_SECONDS=$((MAX_TIME_MINUTES * 60))
|
|
39
|
+
OVERALL_START_TIME=$(date +%s)
|
|
40
|
+
|
|
26
41
|
# Get the actual location of this script (resolving symlinks)
|
|
27
42
|
if command -v realpath >/dev/null 2>&1; then
|
|
28
43
|
SCRIPT_PATH="$(realpath "$0")"
|
|
@@ -168,13 +183,22 @@ You are an elite AI developer working in an automated development environment. Y
|
|
|
168
183
|
DEVELOPMENT_PROMPT="$DEVELOPMENT_PROMPT
|
|
169
184
|
- $HOME/.claude/CLAUDE.md (global development principles)"
|
|
170
185
|
fi
|
|
171
|
-
|
|
186
|
+
|
|
187
|
+
# Check for human feedback file
|
|
188
|
+
feedback_file=$(find_project_file "FEEDBACK.md" 2>/dev/null || echo "")
|
|
189
|
+
if [ -n "$feedback_file" ]; then
|
|
190
|
+
DEVELOPMENT_PROMPT="$DEVELOPMENT_PROMPT
|
|
191
|
+
- $feedback_file (URGENT: Human feedback requiring immediate attention)"
|
|
192
|
+
fi
|
|
193
|
+
|
|
172
194
|
DEVELOPMENT_PROMPT="$DEVELOPMENT_PROMPT
|
|
173
195
|
|
|
174
196
|
**IMPORTANT:** Before starting ANY work, you MUST read and understand:
|
|
175
197
|
1. The project's CLAUDE.md file (if it exists) - this contains project-specific instructions
|
|
176
|
-
2. The user's global CLAUDE.md file at
|
|
177
|
-
3.
|
|
198
|
+
2. The user's global CLAUDE.md file at \$HOME/.claude/CLAUDE.md (if it exists) - this contains general development principles
|
|
199
|
+
3. If FEEDBACK.md exists, READ IT FIRST - it contains urgent human feedback that takes priority
|
|
200
|
+
4. Read the '## Test Infrastructure' section in $plan_file for test commands
|
|
201
|
+
5. Ensure all your work follows the architectural and development guidelines from both files
|
|
178
202
|
|
|
179
203
|
**CRITICAL ANTI-PATTERNS TO AVOID (from CLAUDE.md):**
|
|
180
204
|
- NO CHEATING: Never disable tests, exclude files from compilation, or use silent fallbacks
|
|
@@ -191,23 +215,30 @@ You are an elite AI developer working in an automated development environment. Y
|
|
|
191
215
|
3. Complete tasks in the order they appear - don't skip ahead
|
|
192
216
|
4. Identify if tasks can be done in parallel
|
|
193
217
|
|
|
194
|
-
**PHASE 2: EXECUTION STRATEGY**
|
|
195
|
-
|
|
218
|
+
**PHASE 2: EXECUTION STRATEGY (TDD REQUIRED)**
|
|
219
|
+
You MUST follow Test-Driven Development:
|
|
220
|
+
|
|
221
|
+
1. **RED**: Write a failing test first that defines the expected behavior
|
|
222
|
+
2. **GREEN**: Write the minimum code to make the test pass
|
|
223
|
+
3. **REFACTOR**: Clean up the code while keeping tests passing
|
|
224
|
+
|
|
225
|
+
For each task:
|
|
226
|
+
- Write the test BEFORE writing implementation code
|
|
227
|
+
- Run tests using commands from '## Test Infrastructure' in $plan_file
|
|
228
|
+
- Only mark task complete after tests pass
|
|
196
229
|
|
|
197
230
|
**Option A: Single Focus Task** (for sequential dependencies or complex architectural work)
|
|
198
|
-
-
|
|
199
|
-
- Update $plan_file to mark task as complete with [x]
|
|
231
|
+
- Follow TDD cycle for the next task
|
|
232
|
+
- Update $plan_file to mark task as complete with [x] ONLY after tests pass
|
|
200
233
|
|
|
201
234
|
**Option B: Parallel Task Execution** (for independent tasks)
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
- Each agent brief should include full project context and specific implementation goals
|
|
205
|
-
- Coordinate the parallel work to ensure consistency
|
|
235
|
+
- Each parallel agent must also follow TDD
|
|
236
|
+
- Coordinate the parallel work to ensure test consistency
|
|
206
237
|
|
|
207
238
|
**PHASE 3: COMPLETION CHECK**
|
|
208
239
|
After completing work:
|
|
209
|
-
1.
|
|
210
|
-
2.
|
|
240
|
+
1. Run ALL tests to verify nothing is broken
|
|
241
|
+
2. Update $plan_file to reflect completed tasks (only if tests pass)
|
|
211
242
|
3. Report on what was accomplished and what remains
|
|
212
243
|
|
|
213
244
|
**EXECUTION GUIDELINES:**
|
|
@@ -250,8 +281,9 @@ IMPORTANT: You must ACTUALLY IMPLEMENT tasks, not just describe what should be d
|
|
|
250
281
|
echo -e "\033[32m== REVIEWING/VERIFYING WORK\033[0m"
|
|
251
282
|
echo -e "\033[32m==================================================================\033[0m"
|
|
252
283
|
|
|
253
|
-
# Define the verifier prompt
|
|
254
|
-
VERIFIER_PROMPT="You are an expert code reviewer
|
|
284
|
+
# Define the verifier prompt - CODE REVIEW ONLY, no test running
|
|
285
|
+
VERIFIER_PROMPT="You are an expert code reviewer. Your job is CODE REVIEW and GIT COMMITS only.
|
|
286
|
+
DO NOT run tests - a separate Tester agent will handle that.
|
|
255
287
|
|
|
256
288
|
**DEVELOPER'S OUTPUT:**
|
|
257
289
|
$DEVELOPER_OUTPUT
|
|
@@ -259,14 +291,15 @@ $DEVELOPER_OUTPUT
|
|
|
259
291
|
**YOUR TASKS:**
|
|
260
292
|
1. Review what the developer claims to have done
|
|
261
293
|
2. Verify the work was actually completed by checking files
|
|
262
|
-
3. Look for
|
|
263
|
-
4.
|
|
264
|
-
5.
|
|
294
|
+
3. Look for cheating patterns (disabled tests, silent fallbacks, mock data, etc.)
|
|
295
|
+
4. Check code quality: proper error handling, no obvious bugs
|
|
296
|
+
5. Create a git commit (see guidelines below)
|
|
265
297
|
|
|
266
|
-
**
|
|
298
|
+
**CODE REVIEW CHECKLIST:**
|
|
267
299
|
- Did the developer actually implement code (not just analyze)?
|
|
268
|
-
-
|
|
269
|
-
-
|
|
300
|
+
- Did the developer follow TDD (wrote tests before implementation)?
|
|
301
|
+
- Are there any cheating patterns or anti-patterns?
|
|
302
|
+
- Is the code well-structured and maintainable?
|
|
270
303
|
- Is the task properly marked as complete in $plan_file?
|
|
271
304
|
|
|
272
305
|
**GIT COMMIT GUIDELINES:**
|
|
@@ -276,12 +309,12 @@ $DEVELOPER_OUTPUT
|
|
|
276
309
|
- Only skip commit if changes are truly destructive/terrible
|
|
277
310
|
- Use descriptive commit messages that explain what was attempted
|
|
278
311
|
|
|
279
|
-
**IMPORTANT:**
|
|
280
|
-
-
|
|
281
|
-
- If
|
|
282
|
-
-
|
|
312
|
+
**IMPORTANT:**
|
|
313
|
+
- DO NOT run tests - the Tester agent will do that next
|
|
314
|
+
- If you find code quality issues, describe them clearly in your review AND in the commit message
|
|
315
|
+
- Focus on code review, not test verification
|
|
283
316
|
|
|
284
|
-
Be thorough but concise in your
|
|
317
|
+
Be thorough but concise in your code review."
|
|
285
318
|
|
|
286
319
|
VERIFIER_LOGFILE="${LOGFILE}-verifier"
|
|
287
320
|
echo "=== VERIFIER PROMPT ===" > $VERIFIER_LOGFILE
|
|
@@ -293,14 +326,129 @@ Be thorough but concise in your verification."
|
|
|
293
326
|
# Run verifier
|
|
294
327
|
time claude --model $CLAUDE_MODEL --dangerously-skip-permissions -p "$VERIFIER_PROMPT" 2>&1 | tee -a $VERIFIER_LOGFILE
|
|
295
328
|
|
|
296
|
-
#
|
|
297
|
-
|
|
329
|
+
# Extract verifier output for the tester
|
|
330
|
+
VERIFIER_OUTPUT=$(sed -n '/=== OUTPUT ===/,$p' $VERIFIER_LOGFILE)
|
|
331
|
+
|
|
332
|
+
echo -e "\033[32m==================================================================\033[0m"
|
|
333
|
+
echo -e "\033[32m== TESTING PHASE\033[0m"
|
|
334
|
+
echo -e "\033[32m==================================================================\033[0m"
|
|
335
|
+
|
|
336
|
+
# Determine if this is an acceptance test iteration (every 4th, with megathinking)
|
|
337
|
+
if [ $((LOOP_COUNTER % 4)) -eq 0 ]; then
|
|
338
|
+
ACCEPTANCE_TEST_MODE="
|
|
339
|
+
**ACCEPTANCE TESTS (4th iteration - run these now):**
|
|
340
|
+
Read the '## Acceptance Criteria' section in $plan_file.
|
|
341
|
+
- Run each acceptance test (may include browser tests, integration tests)
|
|
342
|
+
- Mark passing criteria with [x] in the plan file
|
|
343
|
+
- If a previously-passing criterion now FAILS, add a bug task:
|
|
344
|
+
\`- [ ] [BUG] <description of what regressed>\`
|
|
345
|
+
- Report which acceptance criteria pass/fail
|
|
346
|
+
"
|
|
347
|
+
else
|
|
348
|
+
ACCEPTANCE_TEST_MODE="
|
|
349
|
+
**ACCEPTANCE TESTS:** Skip this iteration (only run every 4th iteration).
|
|
350
|
+
"
|
|
351
|
+
fi
|
|
352
|
+
|
|
353
|
+
# Define the tester prompt
|
|
354
|
+
TESTER_PROMPT="You are an expert QA engineer. Your job is to RUN TESTS and verify the code works.
|
|
355
|
+
|
|
356
|
+
**DEVELOPER'S OUTPUT:**
|
|
357
|
+
$DEVELOPER_OUTPUT
|
|
358
|
+
|
|
359
|
+
**VERIFIER'S OUTPUT:**
|
|
360
|
+
$VERIFIER_OUTPUT
|
|
361
|
+
|
|
362
|
+
**PROJECT FILES:**
|
|
363
|
+
- $plan_file (check '## Test Infrastructure' for test commands)
|
|
364
|
+
- $plan_file (check '## Acceptance Criteria' for acceptance tests)
|
|
365
|
+
|
|
366
|
+
**YOUR TASKS:**
|
|
367
|
+
|
|
368
|
+
**1. UNIT TESTS (run every iteration):**
|
|
369
|
+
Read '## Test Infrastructure' section in $plan_file for test commands.
|
|
370
|
+
- Run the test suite (pytest, npm test, cargo test, etc.)
|
|
371
|
+
- Run linters if configured
|
|
372
|
+
- Report: which tests passed/failed
|
|
373
|
+
- If tests FAIL, development cannot continue - report the failure clearly
|
|
374
|
+
|
|
375
|
+
**2. TEST INFRASTRUCTURE CHECK:**
|
|
376
|
+
If no '## Test Infrastructure' section exists OR no tests can be found:
|
|
377
|
+
- Add task: \`- [ ] [INFRA] Set up test infrastructure\`
|
|
378
|
+
- Report that TDD cannot proceed without test infrastructure
|
|
379
|
+
$ACCEPTANCE_TEST_MODE
|
|
380
|
+
**OUTPUT FORMAT:**
|
|
381
|
+
- **<unit_tests>**: PASS or FAIL
|
|
382
|
+
- **<unit_details>**: What tests ran, any failures
|
|
383
|
+
- **<acceptance_tests>**: PASS, FAIL, SKIPPED, or NO_CRITERIA
|
|
384
|
+
- **<acceptance_details>**: Which criteria checked (if applicable)
|
|
385
|
+
- **<infrastructure>**: OK or MISSING
|
|
386
|
+
- **<bugs_added>**: List any [BUG] tasks added for regressions
|
|
387
|
+
- **<all_tests_pass>**: YES or NO
|
|
388
|
+
|
|
389
|
+
**CRITICAL:** If unit tests fail, output <TESTS_FAILED> so the loop knows to stop.
|
|
390
|
+
If ALL tasks in the plan are complete AND all tests pass, output: <VERIFIED_ALL_DONE>
|
|
391
|
+
"
|
|
392
|
+
|
|
393
|
+
TESTER_LOGFILE="${LOGFILE}-tester"
|
|
394
|
+
echo "=== TESTER PROMPT ===" > $TESTER_LOGFILE
|
|
395
|
+
echo "$TESTER_PROMPT" >> $TESTER_LOGFILE
|
|
396
|
+
echo "=== END PROMPT ===" >> $TESTER_LOGFILE
|
|
397
|
+
echo "" >> $TESTER_LOGFILE
|
|
398
|
+
echo "=== OUTPUT ===" >> $TESTER_LOGFILE
|
|
399
|
+
|
|
400
|
+
# Run tester
|
|
401
|
+
echo "Running tester with $CLAUDE_MODEL model..."
|
|
402
|
+
time claude --model $CLAUDE_MODEL --dangerously-skip-permissions -p "$TESTER_PROMPT" 2>&1 | tee -a $TESTER_LOGFILE
|
|
403
|
+
|
|
404
|
+
# Check if tests failed
|
|
405
|
+
if sed -n '/=== OUTPUT ===/,$p' $TESTER_LOGFILE | grep -q "<TESTS_FAILED>"; then
|
|
406
|
+
echo -e "\033[31m==================================================================\033[0m"
|
|
407
|
+
echo -e "\033[31m== TESTS FAILED - Review tester output above\033[0m"
|
|
408
|
+
echo -e "\033[31m==================================================================\033[0m"
|
|
409
|
+
# Continue to next iteration - developer needs to fix the tests
|
|
410
|
+
fi
|
|
411
|
+
|
|
412
|
+
# Check if all done (tester confirmed)
|
|
413
|
+
if sed -n '/=== OUTPUT ===/,$p' $TESTER_LOGFILE | grep -q "^<VERIFIED_ALL_DONE>$"; then
|
|
298
414
|
echo -e "\033[32m==================================================================\033[0m"
|
|
299
415
|
echo -e "\033[32m== PROJECT COMPLETE - ALL TASKS VERIFIED!\033[0m"
|
|
300
416
|
echo -e "\033[32m==================================================================\033[0m"
|
|
301
417
|
exit 0
|
|
302
418
|
fi
|
|
303
419
|
|
|
420
|
+
# Check for @STOP marker in plan file - if all tasks before @STOP are complete, pause for human review
|
|
421
|
+
if [ -n "$plan_file" ] && grep -q "@STOP" "$plan_file"; then
|
|
422
|
+
# Extract content before @STOP and check if any tasks are incomplete
|
|
423
|
+
BEFORE_STOP=$(sed -n '1,/@STOP/p' "$plan_file")
|
|
424
|
+
# Check for incomplete tasks ([ ] or - [ ]) before @STOP
|
|
425
|
+
if ! echo "$BEFORE_STOP" | grep -qE '\[ \]'; then
|
|
426
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
427
|
+
echo -e "\033[33m== @STOP CHECKPOINT REACHED\033[0m"
|
|
428
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
429
|
+
echo -e "\033[33mAll tasks before @STOP marker are complete.\033[0m"
|
|
430
|
+
echo -e "\033[33mPausing for human review/deployment/intervention.\033[0m"
|
|
431
|
+
echo -e "\033[33mTo continue: remove or move @STOP in $plan_file, then restart.\033[0m"
|
|
432
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
433
|
+
exit 0
|
|
434
|
+
fi
|
|
435
|
+
fi
|
|
436
|
+
|
|
437
|
+
# Check if max runtime has been exceeded
|
|
438
|
+
CURRENT_TIME=$(date +%s)
|
|
439
|
+
ELAPSED_SECONDS=$((CURRENT_TIME - OVERALL_START_TIME))
|
|
440
|
+
ELAPSED_MINUTES=$((ELAPSED_SECONDS / 60))
|
|
441
|
+
if [ $ELAPSED_SECONDS -ge $MAX_TIME_SECONDS ]; then
|
|
442
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
443
|
+
echo -e "\033[33m== MAX RUNTIME REACHED (${ELAPSED_MINUTES}m / ${MAX_TIME_MINUTES}m)\033[0m"
|
|
444
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
445
|
+
echo -e "\033[33mStopping after ${MAX_TIME_MINUTES} minutes as configured.\033[0m"
|
|
446
|
+
echo -e "\033[33mTo continue: restart with 'claudefsd dev' or increase --max-time\033[0m"
|
|
447
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
448
|
+
exit 0
|
|
449
|
+
fi
|
|
450
|
+
echo -e "\033[36mTotal runtime: ${ELAPSED_MINUTES}m / ${MAX_TIME_MINUTES}m\033[0m"
|
|
451
|
+
|
|
304
452
|
# Calculate iteration duration and check for failure patterns
|
|
305
453
|
ITERATION_END_TIME=$(date +%s)
|
|
306
454
|
ITERATION_DURATION=$((ITERATION_END_TIME - ITERATION_START_TIME))
|
|
@@ -339,5 +487,31 @@ Be thorough but concise in your verification."
|
|
|
339
487
|
echo -e "\033[32mNormal iteration timing - continuing...\033[0m"
|
|
340
488
|
fi
|
|
341
489
|
|
|
490
|
+
# Check for PAUSE file - allows human intervention
|
|
491
|
+
if [ -f "PAUSE" ]; then
|
|
492
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
493
|
+
echo -e "\033[33m== PAUSED - Human intervention requested\033[0m"
|
|
494
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
495
|
+
echo -e "\033[33mDevelopment is paused. To continue:\033[0m"
|
|
496
|
+
echo -e "\033[33m - Remove the PAUSE file: rm PAUSE\033[0m"
|
|
497
|
+
echo -e "\033[33m - Add feedback in $WORKING_DIR/FEEDBACK.md (optional)\033[0m"
|
|
498
|
+
echo -e "\033[33mWaiting...\033[0m"
|
|
499
|
+
while [ -f "PAUSE" ]; do
|
|
500
|
+
sleep 5
|
|
501
|
+
done
|
|
502
|
+
echo -e "\033[32mResuming development...\033[0m"
|
|
503
|
+
|
|
504
|
+
# Check if feedback was added
|
|
505
|
+
if [ -f "$WORKING_DIR/FEEDBACK.md" ]; then
|
|
506
|
+
echo -e "\033[36mFEEDBACK.md detected - will be processed in next iteration\033[0m"
|
|
507
|
+
fi
|
|
508
|
+
fi
|
|
509
|
+
|
|
510
|
+
# Archive FEEDBACK.md after it's been processed (move to logs)
|
|
511
|
+
if [ -n "$feedback_file" ] && [ -f "$feedback_file" ]; then
|
|
512
|
+
mv "$feedback_file" "logs/FEEDBACK-processed-$(date +%Y%m%d_%H%M%S).md"
|
|
513
|
+
echo -e "\033[36mFEEDBACK.md archived after processing\033[0m"
|
|
514
|
+
fi
|
|
515
|
+
|
|
342
516
|
sleep 1
|
|
343
517
|
done
|