claude-fsd 1.5.7 → 1.5.9

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/bin/claudefsd CHANGED
@@ -173,7 +173,7 @@ open_with_editor() {
173
173
  # Check dependencies first
174
174
  check_dependencies
175
175
 
176
- # Function to check for updates (non-blocking)
176
+ # Function to check for updates and auto-update if needed
177
177
  check_for_updates() {
178
178
  # Only check if we can reach npm registry quickly
179
179
  if timeout 2 npm view claude-fsd version >/dev/null 2>&1; then
@@ -182,8 +182,16 @@ check_for_updates() {
182
182
 
183
183
  if [ -n "$current_version" ] && [ -n "$latest_version" ] && [ "$current_version" != "$latest_version" ]; then
184
184
  echo -e "${YELLOW}📦 Update available: claude-fsd $current_version → $latest_version${NC}"
185
- echo -e "${YELLOW} Run: npm update -g claude-fsd${NC}"
186
- echo
185
+ echo -e "${GREEN}🔄 Auto-updating claude-fsd...${NC}"
186
+
187
+ # Attempt automatic update
188
+ if npm update -g claude-fsd >/dev/null 2>&1; then
189
+ echo -e "${GREEN}✅ Successfully updated to claude-fsd $latest_version${NC}"
190
+ echo
191
+ else
192
+ echo -e "${YELLOW}⚠️ Auto-update failed. Please run manually: npm update -g claude-fsd${NC}"
193
+ echo
194
+ fi
187
195
  fi
188
196
  fi
189
197
  }
@@ -57,10 +57,12 @@ The CLAUDE-NOTES.md should contain:
57
57
  - Areas that may need future clarification
58
58
 
59
59
  The PLAN.md should contain:
60
- - Ordered list of development tasks with [ ] checkboxes
61
- - Each task should be specific and actionable
60
+ - Master plan limited to 100 lines maximum
61
+ - High-level sections with [ ] checkboxes for completion tracking
62
+ - For complex projects, reference detailed sub-plans in separate files (docs/plan-section1.md, docs/plan-section2.md, etc.)
62
63
  - Include proportional infrastructure setup (basic linting + pre-commit hooks)
63
64
  - Group related tasks into logical phases
65
+ - If the plan would exceed 100 lines, create a master plan with section references and detailed sub-plans
64
66
 
65
67
  INFRASTRUCTURE PROPORTIONALITY RULES:
66
68
  - Basic linter + pre-commit hooks: Always include for any project
@@ -112,8 +114,10 @@ Using your deep strategic reasoning, create a comprehensive project architecture
112
114
  - Long-term maintainability strategy
113
115
 
114
116
  2. IMPLEMENTATION PLAN (docs/PLAN.md):
117
+ - Master plan limited to 100 lines maximum with high-level sections
118
+ - For complex projects, create detailed sub-plans in separate files (docs/plan-section1.md, etc.)
115
119
  - Phased development approach with clear milestones
116
- - Detailed task breakdown with dependencies
120
+ - Task breakdown with dependencies (detailed in sub-plans if needed)
117
121
  - Risk assessment for each phase
118
122
  - Testing strategy integrated into each phase
119
123
  - Infrastructure needs (proportional to project size)
package/bin/claudefsd-dev CHANGED
@@ -1,63 +1,69 @@
1
1
  #!/bin/bash
2
2
  #
3
- # Main development dispatcher - routes to appropriate development mode
4
- # Usage: claudefsd-dev [direct|iterative]
3
+ # Main development dispatcher - now uses unified development mode by default
4
+ # Usage: claudefsd-dev [direct|iterative|legacy-direct|legacy-iterative]
5
5
  #
6
6
  # Modes:
7
- # direct: Single-context parallel execution (small to medium projects)
8
- # iterative: Multi-iteration loop development (large projects)
7
+ # (default): Unified mode combining best of both approaches
8
+ # direct: Legacy single-context parallel execution (deprecated)
9
+ # iterative: Legacy multi-iteration loop development (deprecated)
10
+ # legacy-direct: Force legacy direct execution mode
11
+ # legacy-iterative: Force legacy iterative loop mode
9
12
  #
10
13
  # Examples:
11
- # claudefsd-dev # Auto-detect mode from project brief
12
- # claudefsd-dev direct # Force direct execution mode
13
- # claudefsd-dev iterative # Force iterative loop mode
14
+ # claudefsd-dev # Use unified development mode (recommended)
15
+ # claudefsd-dev legacy-direct # Force legacy direct execution mode
16
+ # claudefsd-dev legacy-iterative # Force legacy iterative loop mode
14
17
 
15
18
  set -e
16
19
 
17
- # Parse command line arguments or auto-detect mode
20
+ # Parse command line arguments
18
21
  DEV_MODE="$1"
22
+
23
+ # Default to unified mode
19
24
  if [ -z "$DEV_MODE" ]; then
20
- # Auto-detect mode from BRIEF.md
21
- if [ -f "BRIEF.md" ] || [ -f "docs/BRIEF.md" ]; then
22
- BRIEF_FILE="BRIEF.md"
23
- [ -f "docs/BRIEF.md" ] && BRIEF_FILE="docs/BRIEF.md"
24
-
25
- # Look for indicators of small/medium vs large projects
26
- if grep -qi "simple\|small\|quick\|prototype\|poc\|minimal\|script\|tool\|utility\|feature\|module" "$BRIEF_FILE"; then
27
- DEV_MODE="direct"
28
- else
29
- DEV_MODE="iterative"
30
- fi
31
- else
32
- DEV_MODE="iterative" # Default to iterative for safety
33
- fi
25
+ DEV_MODE="unified"
34
26
  fi
35
27
 
36
28
  echo "Development mode: $DEV_MODE"
37
29
 
38
30
  # Route to appropriate development script
39
31
  case "$DEV_MODE" in
32
+ unified)
33
+ echo "Launching unified development mode (recommended)..."
34
+ exec "$(dirname "$0")/claudefsd-dev-unified"
35
+ ;;
40
36
  direct)
41
- echo "Launching direct execution mode..."
37
+ echo "WARNING: Legacy direct mode is deprecated. Consider using unified mode."
38
+ echo "Launching legacy direct execution mode..."
42
39
  exec "$(dirname "$0")/claudefsd-dev-direct"
43
40
  ;;
44
41
  iterative)
45
- echo "Launching iterative development mode..."
42
+ echo "WARNING: Legacy iterative mode is deprecated. Consider using unified mode."
43
+ echo "Launching legacy iterative development mode..."
46
44
  exec "$(dirname "$0")/claudefsd-dev-iterative"
47
45
  ;;
48
- small)
49
- # Legacy support - map to direct
50
- echo "Legacy 'small' mode - redirecting to direct execution..."
46
+ legacy-direct)
47
+ echo "Launching legacy direct execution mode..."
51
48
  exec "$(dirname "$0")/claudefsd-dev-direct"
52
49
  ;;
53
- large)
54
- # Legacy support - map to iterative
55
- echo "Legacy 'large' mode - redirecting to iterative development..."
50
+ legacy-iterative)
51
+ echo "Launching legacy iterative development mode..."
56
52
  exec "$(dirname "$0")/claudefsd-dev-iterative"
57
53
  ;;
54
+ small)
55
+ # Legacy support - map to unified (was direct)
56
+ echo "Legacy 'small' mode - redirecting to unified development..."
57
+ exec "$(dirname "$0")/claudefsd-dev-unified"
58
+ ;;
59
+ large)
60
+ # Legacy support - map to unified (was iterative)
61
+ echo "Legacy 'large' mode - redirecting to unified development..."
62
+ exec "$(dirname "$0")/claudefsd-dev-unified"
63
+ ;;
58
64
  *)
59
65
  echo "Unknown development mode: $DEV_MODE"
60
- echo "Valid modes: direct, iterative"
66
+ echo "Valid modes: unified (default), direct, iterative, legacy-direct, legacy-iterative"
61
67
  exit 1
62
68
  ;;
63
69
  esac
@@ -66,7 +66,8 @@ echo
66
66
  # Go back to the project directory
67
67
  cd "$OLDPWD"
68
68
 
69
- # Build the omnibus prompt
69
+ # Build the omnibus prompt
70
+ set +e # Temporarily disable exit on error for prompt construction
70
71
  omnibus_prompt="You are an elite development team leader using Claude's Task agent capabilities for rapid parallel execution.
71
72
 
72
73
  **ANTI-GOLDPLATING DIRECTIVE**: This is direct execution mode optimized for small to medium projects. Focus on minimal viable solutions that meet requirements. Avoid over-engineering, unnecessary abstractions, or enterprise patterns unless explicitly required.
@@ -131,6 +132,8 @@ Then launch the Task agents to build this project rapidly and efficiently.
131
132
 
132
133
  Remember: This is a one-shot execution. Make it count!"
133
134
 
135
+ set -e # Re-enable exit on error
136
+
134
137
  echo "Running Claude dev-mini omnibus prompt..."
135
138
  echo "This will launch multiple parallel Task agents to complete the project..."
136
139
  echo
@@ -0,0 +1,230 @@
1
+ #!/bin/bash
2
+ #
3
+ # Unified development mode - combines best of direct and iterative approaches
4
+ # Usage: claudefsd-dev-unified
5
+ #
6
+ # Features:
7
+ # - Fail-fast loop detection and "all done" prompt from iterative mode
8
+ # - Direct parallel Task agent execution from direct mode
9
+ # - Intelligent task planning and coordination
10
+ #
11
+
12
+ set -e
13
+
14
+ # Get the actual location of this script (resolving symlinks)
15
+ if command -v realpath >/dev/null 2>&1; then
16
+ SCRIPT_PATH="$(realpath "$0")"
17
+ elif command -v readlink >/dev/null 2>&1; then
18
+ # macOS doesn't have realpath by default, but has readlink
19
+ SCRIPT_PATH="$0"
20
+ while [ -L "$SCRIPT_PATH" ]; do
21
+ SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
22
+ done
23
+ SCRIPT_PATH="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)/$(basename "$SCRIPT_PATH")"
24
+ else
25
+ # Fallback if neither command is available
26
+ SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd)/$(basename "$0")"
27
+ fi
28
+
29
+ # Get the directory containing the script
30
+ SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
31
+
32
+ # Check dependencies
33
+ "$SCRIPT_DIR/claudefsd-check-dependencies"
34
+
35
+ # Function to check for required files
36
+ check_requirements() {
37
+ # Load find_brief_file function
38
+ source "$SCRIPT_DIR/claudefsd-find-brief"
39
+ brief_file=$(find_brief_file 2>/dev/null || echo "")
40
+
41
+ if [ -z "$brief_file" ]; then
42
+ echo "No BRIEF.md file found in docs/ or root directory. Please create one first."
43
+ exit 1
44
+ fi
45
+
46
+ if [ ! -f "docs/PLAN.md" ]; then
47
+ echo "No docs/PLAN.md file found. Please run 'claudefsd create-plan' first."
48
+ exit 1
49
+ fi
50
+ }
51
+
52
+ # Check requirements
53
+ check_requirements
54
+
55
+ # Add counter for loop iterations
56
+ LOOP_COUNTER=0
57
+
58
+ # Failure detection variables
59
+ CONSECUTIVE_FAST_ITERATIONS=0
60
+ MIN_ITERATION_TIME=300 # 5 minutes in seconds
61
+
62
+ while true; do
63
+ # Record iteration start time
64
+ ITERATION_START_TIME=$(date +%s)
65
+
66
+ # Increment loop counter
67
+ LOOP_COUNTER=$((LOOP_COUNTER + 1))
68
+
69
+ mkdir -p logs
70
+ # Use a temporary directory for tmp files
71
+ mkdir -p tmp
72
+ export TMPDIR=tmp/
73
+ LOGFILE="logs/claude-unified-$(date +%Y%m%d_%H%M%S).txt"
74
+
75
+ echo "Logging to ${LOGFILE} ..."
76
+
77
+ echo -e "\033[32m==================================================================\033[0m"
78
+ echo -e "\033[32m== UNIFIED DEVELOPMENT MODE - ITERATION $LOOP_COUNTER\033[0m"
79
+ echo -e "\033[32m==================================================================\033[0m"
80
+
81
+ # Check if this is the 4th iteration for megathinking mode
82
+ if [ $((LOOP_COUNTER % 4)) -eq 0 ]; then
83
+ echo -e "\033[33m**** MEGATHINKING MODE ACTIVATED ****\033[0m"
84
+ echo -e "\033[33mThis is your 4th development cycle. Taking a step back for architectural planning.\033[0m"
85
+ MEGATHINKING_MODE="**** MEGATHINKING MODE ACTIVATED ****\nThis is your 4th development cycle. Before proceeding with the next task, please take a step back and use megathinking mode to architecturally plan the next phase of development. Consider the overall structure of the codebase, potential refactoring opportunities, design patterns, technical debt, and how the current work connects to broader project goals.\n\n"
86
+ CLAUDE_MODEL="opus"
87
+ else
88
+ MEGATHINKING_MODE=""
89
+ CLAUDE_MODEL="sonnet"
90
+ fi
91
+
92
+ # Build the unified development prompt combining best of both modes
93
+ UNIFIED_PROMPT="$MEGATHINKING_MODE
94
+ You are an elite development team leader working in an automated development environment. You combine intelligent task selection with parallel execution capabilities for maximum efficiency.
95
+
96
+ **PROJECT CONTEXT:**
97
+ $(source "$SCRIPT_DIR/claudefsd-find-brief" && brief_file=$(find_brief_file 2>/dev/null) && [ -n "$brief_file" ] && echo "=== PROJECT BRIEF ===" && cat "$brief_file" && echo "")
98
+ $([ -f "docs/PLAN.md" ] && echo "=== DEVELOPMENT PLAN ===" && cat "docs/PLAN.md" && echo "")
99
+ $([ -f "docs/REQUIREMENTS.md" ] && echo "=== REQUIREMENTS ===" && cat "docs/REQUIREMENTS.md" && echo "")
100
+ $([ -f "docs/QUESTIONS.md" ] && echo "=== QUESTIONS ===" && cat "docs/QUESTIONS.md" && echo "")
101
+ $([ -f "docs/CLAUDE-NOTES.md" ] && echo "=== TECHNICAL NOTES ===" && cat "docs/CLAUDE-NOTES.md" && echo "")
102
+ $([ -f "README.md" ] && echo "=== README ===" && cat "README.md" && echo "")
103
+
104
+ **IMPORTANT:** Before starting ANY work, you MUST read and understand:
105
+ 1. The project's CLAUDE.md file (if it exists) - this contains project-specific instructions
106
+ 2. The user's global CLAUDE.md file at ~/.claude/CLAUDE.md (if it exists) - this contains general development principles
107
+ 3. Ensure all your work follows the architectural and development guidelines from both files
108
+
109
+ **CRITICAL ANTI-PATTERNS TO AVOID (from CLAUDE.md):**
110
+ - NO CHEATING: Never disable tests, exclude files from compilation, or use silent fallbacks
111
+ - FAIL FAST: Integration failures should throw exceptions, not return mock data
112
+ - NO PRODUCTION FALLBACKS: Avoid try/catch blocks that hide errors with default values
113
+ - NO BACKUP COPIES: Use git for version control, never create backup files
114
+ - DELETE OLD CODE: Remove unused functions and scripts, keep the codebase clean
115
+
116
+ **YOUR MISSION:**
117
+
118
+ **PHASE 1: INTELLIGENT TASK ANALYSIS**
119
+ 1. Read the current docs/PLAN.md and identify all open tasks that need completion
120
+ 2. Analyze task dependencies and determine what can be done in parallel
121
+ 3. Consider the architectural implications of each task
122
+ 4. Prioritize tasks based on:
123
+ - Order in the plan (primary factor)
124
+ - Dependencies between tasks
125
+ - Risk and efficiency considerations
126
+ - Overall project architecture
127
+
128
+ **PHASE 2: EXECUTION STRATEGY**
129
+ Choose the optimal approach:
130
+
131
+ **Option A: Single Focus Task** (for sequential dependencies or complex architectural work)
132
+ - Select the highest priority open task
133
+ - Implement with deep thinking and careful consideration
134
+ - Update docs/PLAN.md to mark task as complete
135
+
136
+ **Option B: Parallel Task Execution** (for independent tasks)
137
+ - Identify 2-4 related but independent tasks that can be done simultaneously
138
+ - Launch multiple Task agents with coordinated objectives
139
+ - Each agent should understand the full project context
140
+ - Ensure consistency across all parallel work
141
+
142
+ **PHASE 3: COMPLETION CHECK**
143
+ After completing work:
144
+ 1. Update docs/PLAN.md to reflect completed tasks
145
+ 2. Run any linters or tests specified in the project
146
+ 3. If ALL tasks in docs/PLAN.md are complete, respond with: **<ALL DONE>**
147
+
148
+ **EXECUTION GUIDELINES:**
149
+ - **BUILD BULLETPROOF**: Create robust solutions that handle edge cases
150
+ - **STAY FOCUSED**: Only implement what's specified in docs/PLAN.md
151
+ - **QUALITY FIRST**: Proper error handling, testing, and documentation
152
+ - **ARCHITECTURAL THINKING**: Consider long-term maintainability
153
+
154
+ **TASK AGENT COORDINATION:**
155
+ When using parallel Task agents, ensure each one:
156
+ - Has full project context and understands the architecture
157
+ - Knows about related components they might need to integrate with
158
+ - Follows all CLAUDE.md guidelines
159
+ - Implements consistent code style and patterns
160
+ - Handles proper error checking and edge cases
161
+
162
+ **OUTPUT FORMAT:**
163
+ 1. **<task_analysis>**: List identified open tasks and selected approach
164
+ 2. **<execution>**: Details of your implementation work
165
+ 3. **<plan_updates>**: How you updated docs/PLAN.md to reflect progress
166
+ 4. **<completion_check>**: Status of remaining work, or **<ALL DONE>** if complete
167
+
168
+ Begin by analyzing the current state of docs/PLAN.md and determining your execution strategy."
169
+
170
+ # Save the prompt to the log file first
171
+ echo "=== UNIFIED DEVELOPMENT PROMPT ===" > $LOGFILE
172
+ echo "$UNIFIED_PROMPT" >> $LOGFILE
173
+ echo "=== END PROMPT ===" >> $LOGFILE
174
+ echo "" >> $LOGFILE
175
+ echo "=== OUTPUT ===" >> $LOGFILE
176
+
177
+ # Run claude and append output to the log file
178
+ echo "Running unified development with $CLAUDE_MODEL model..."
179
+ time claude --model $CLAUDE_MODEL --dangerously-skip-permissions -p "$UNIFIED_PROMPT" 2>&1 | tee -a $LOGFILE
180
+
181
+ # Check if all tasks are complete
182
+ set +e
183
+ if grep -q "<ALL DONE>" $LOGFILE; then
184
+ echo -e "\033[32m==================================================================\033[0m"
185
+ echo -e "\033[32m== PROJECT COMPLETE - ALL TASKS FINISHED!\033[0m"
186
+ echo -e "\033[32m==================================================================\033[0m"
187
+ exit 0
188
+ fi
189
+ set -e
190
+
191
+ # Calculate iteration duration and check for failure patterns
192
+ ITERATION_END_TIME=$(date +%s)
193
+ ITERATION_DURATION=$((ITERATION_END_TIME - ITERATION_START_TIME))
194
+
195
+ echo -e "\033[36mIteration $LOOP_COUNTER completed in ${ITERATION_DURATION}s\033[0m"
196
+
197
+ # Check if iteration was suspiciously fast (likely failure mode)
198
+ if [ $ITERATION_DURATION -lt $MIN_ITERATION_TIME ]; then
199
+ CONSECUTIVE_FAST_ITERATIONS=$((CONSECUTIVE_FAST_ITERATIONS + 1))
200
+ echo -e "\033[33mWarning: Fast iteration detected (${ITERATION_DURATION}s < ${MIN_ITERATION_TIME}s threshold)\033[0m"
201
+ echo -e "\033[33mConsecutive fast iterations: $CONSECUTIVE_FAST_ITERATIONS/3\033[0m"
202
+
203
+ # Exit if too many consecutive fast iterations (likely Claude API failure)
204
+ if [ $CONSECUTIVE_FAST_ITERATIONS -ge 3 ]; then
205
+ echo -e "\033[31m==================================================================\033[0m"
206
+ echo -e "\033[31m== FAILURE MODE DETECTED - THROTTLING ACTIVATED\033[0m"
207
+ echo -e "\033[31m==================================================================\033[0m"
208
+ echo -e "\033[31mDetected 3 consecutive iterations under ${MIN_ITERATION_TIME}s each.\033[0m"
209
+ echo -e "\033[31mThis usually indicates Claude API issues (token limits, etc).\033[0m"
210
+ echo -e "\033[31m\033[0m"
211
+ echo -e "\033[31mSuggested actions:\033[0m"
212
+ echo -e "\033[31m- Check your Claude API token limits\033[0m"
213
+ echo -e "\033[31m- Wait a few minutes and restart with: claudefsd dev\033[0m"
214
+ echo -e "\033[31m- Review logs in: logs/\033[0m"
215
+ echo -e "\033[31m==================================================================\033[0m"
216
+ exit 1
217
+ fi
218
+
219
+ # Add exponential backoff delay for fast iterations
220
+ BACKOFF_DELAY=$((CONSECUTIVE_FAST_ITERATIONS * 60)) # 1min, 2min, 3min
221
+ echo -e "\033[33mApplying backoff delay: ${BACKOFF_DELAY}s\033[0m"
222
+ sleep $BACKOFF_DELAY
223
+ else
224
+ # Reset counter on successful iteration
225
+ CONSECUTIVE_FAST_ITERATIONS=0
226
+ echo -e "\033[32mNormal iteration timing - continuing...\033[0m"
227
+ fi
228
+
229
+ sleep 1
230
+ done
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-fsd",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "description": "Claude Full Self Drive tools for autonomous AI-powered development",
5
5
  "bin": {
6
6
  "claude-fsd": "bin/claude-fsd",