claude-fsd 1.4.9 → 1.5.1

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
@@ -25,16 +25,18 @@ save_editor_preference() {
25
25
 
26
26
  # Function to determine default choice based on existing docs
27
27
  get_default_choice() {
28
- if [ ! -f BRIEF.md ]; then
28
+ # Use find_brief_file function to check for BRIEF.md
29
+ source "$(dirname "$0")/claudefsd-find-brief"
30
+ if ! find_brief_file >/dev/null 2>&1; then
29
31
  echo "0"
30
32
  elif [ ! -f docs/REQUIREMENTS.md ] && [ ! -f docs/QUESTIONS.md ]; then
31
- echo "1" # Interactive interview (recommended)
33
+ echo "1" # Interactive interview
32
34
  elif [ -f docs/REQUIREMENTS.md ] && [ ! -f docs/PLAN.md ]; then
33
- echo "3" # Create plan from requirements
35
+ echo "2" # Create plan from requirements
34
36
  elif [ -f docs/QUESTIONS.md ] && [ ! -f docs/PLAN.md ]; then
35
- echo "3" # Create plan from questions
37
+ echo "2" # Create plan from questions
36
38
  else
37
- echo "4" # Development mode
39
+ echo "3" # Development mode
38
40
  fi
39
41
  }
40
42
 
@@ -50,7 +52,9 @@ show_menu() {
50
52
 
51
53
  local default_choice=$(get_default_choice)
52
54
 
53
- if [ ! -f BRIEF.md ]; then
55
+ # Check for BRIEF.md using find_brief_file
56
+ source "$(dirname "$0")/claudefsd-find-brief"
57
+ if ! find_brief_file >/dev/null 2>&1; then
54
58
  echo " 0) Create project brief - Start your project with a BRIEF.md file"
55
59
  fi
56
60
 
@@ -58,32 +62,38 @@ show_menu() {
58
62
  if [ -f docs/INTERVIEW-SESSION.json ]; then
59
63
  local session_status=$(jq -r '.status' docs/INTERVIEW-SESSION.json 2>/dev/null || echo "unknown")
60
64
  if [ "$session_status" = "in_progress" ]; then
61
- echo " 1) Interactive interview - Resume existing interview session"
65
+ echo " 1) Interview - Resume existing interview session"
62
66
  else
63
- echo " 1) Interactive interview - Gather requirements through expert Q&A"
67
+ echo " 1) Interview - Gather requirements through expert Q&A"
64
68
  fi
65
69
  else
66
- echo " 1) Interactive interview - Gather requirements through expert Q&A [RECOMMENDED]"
70
+ echo " 1) Interview - Gather requirements through expert Q&A"
67
71
  fi
68
72
 
69
- echo " 2) Batch questions - Generate all questions at once (alternative to interview)"
70
-
71
73
  # Show create plan option based on what exists
72
74
  if [ -f docs/REQUIREMENTS.md ]; then
73
- echo " 3) Create plan - Generate development plan from requirements"
75
+ echo " 2) Create plan - Generate development plan from requirements"
74
76
  elif [ -f docs/QUESTIONS.md ]; then
75
- echo " 3) Create plan - Generate plan from answered questions"
77
+ echo " 2) Create plan - Generate plan from answered questions"
76
78
  else
77
- echo " 3) [Requires interview or questions first]"
79
+ echo " 2) [Requires interview first]"
78
80
  fi
79
81
 
80
- echo " 4) Development mode - AI agents work on coding tasks"
81
- echo " 5) Exit"
82
+ echo " 3) Development - Choose development approach:"
83
+ echo " 3a) Direct execution - Single-context parallel agents (small-medium projects)"
84
+ echo " 3b) Iterative development - Multi-cycle planning loop (large projects)"
85
+ echo " 4) Exit"
82
86
  echo
83
87
 
84
88
  # Show status of required files
85
89
  echo "Current status:"
86
- [ -f BRIEF.md ] && echo " BRIEF.md exists" || echo " ✗ BRIEF.md missing"
90
+ source "$(dirname "$0")/claudefsd-find-brief"
91
+ local brief_file=$(find_brief_file 2>/dev/null || echo "")
92
+ if [ -n "$brief_file" ]; then
93
+ echo " ✓ $brief_file exists"
94
+ else
95
+ echo " ✗ BRIEF.md missing"
96
+ fi
87
97
 
88
98
  # Show interview session status if exists
89
99
  if [ -f docs/INTERVIEW-SESSION.json ]; then
@@ -190,27 +200,29 @@ if [ $# -eq 0 ]; then
190
200
 
191
201
  case $choice in
192
202
  0)
193
- if [ ! -f BRIEF.md ]; then
203
+ # Create BRIEF.md in docs/ directory (preferred location)
204
+ if ! find_brief_file >/dev/null 2>&1; then
194
205
  echo -e "${GREEN}Creating project brief...${NC}"
195
206
  echo
196
- echo "# Project Brief" > BRIEF.md
197
- echo "" >> BRIEF.md
198
- echo "## Vision" >> BRIEF.md
199
- echo "Describe the big picture vision and what you want to achieve..." >> BRIEF.md
200
- echo "" >> BRIEF.md
201
- echo "## Core Requirements" >> BRIEF.md
202
- echo "- Core requirement 1" >> BRIEF.md
203
- echo "- Core requirement 2" >> BRIEF.md
204
- echo "" >> BRIEF.md
205
- echo "## Key Features" >> BRIEF.md
206
- echo "- Feature 1" >> BRIEF.md
207
- echo "- Feature 2" >> BRIEF.md
208
- echo "" >> BRIEF.md
209
- echo "## Success Criteria" >> BRIEF.md
210
- echo "- Success criterion 1" >> BRIEF.md
211
- echo "- Success criterion 2" >> BRIEF.md
207
+ mkdir -p docs
208
+ echo "# Project Brief" > docs/BRIEF.md
209
+ echo "" >> docs/BRIEF.md
210
+ echo "## Vision" >> docs/BRIEF.md
211
+ echo "Describe the big picture vision and what you want to achieve..." >> docs/BRIEF.md
212
+ echo "" >> docs/BRIEF.md
213
+ echo "## Core Requirements" >> docs/BRIEF.md
214
+ echo "- Core requirement 1" >> docs/BRIEF.md
215
+ echo "- Core requirement 2" >> docs/BRIEF.md
216
+ echo "" >> docs/BRIEF.md
217
+ echo "## Key Features" >> docs/BRIEF.md
218
+ echo "- Feature 1" >> docs/BRIEF.md
219
+ echo "- Feature 2" >> docs/BRIEF.md
220
+ echo "" >> docs/BRIEF.md
221
+ echo "## Success Criteria" >> docs/BRIEF.md
222
+ echo "- Success criterion 1" >> docs/BRIEF.md
223
+ echo "- Success criterion 2" >> docs/BRIEF.md
212
224
 
213
- open_with_editor "BRIEF.md"
225
+ open_with_editor "docs/BRIEF.md"
214
226
  echo
215
227
  echo -e "${GREEN}Brief created! Run claudefsd again to start the interview.${NC}"
216
228
  else
@@ -220,49 +232,46 @@ if [ $# -eq 0 ]; then
220
232
  ;;
221
233
  1)
222
234
  # Interactive interview
223
- if [ ! -f BRIEF.md ]; then
235
+ source "$(dirname "$0")/claudefsd-find-brief"
236
+ local brief_file=$(find_brief_file 2>/dev/null || echo "")
237
+ if [ -z "$brief_file" ]; then
224
238
  echo -e "${RED}No BRIEF.md found. Please create a project brief first.${NC}"
225
239
  exit 1
226
240
  fi
227
- echo -e "${GREEN}Starting interactive interview...${NC}"
241
+ echo -e "${GREEN}Starting interview...${NC}"
228
242
  echo
229
243
  exec "$(dirname "$0")/claudefsd-interview"
230
244
  ;;
231
245
  2)
232
- # Batch questions
233
- echo -e "${GREEN}Analyzing brief and generating questions (batch mode)...${NC}"
234
- echo
235
- "$(dirname "$0")/claudefsd-analyze-brief"
236
-
237
- if [ $? -eq 0 ]; then
238
- echo
239
- echo -e "${GREEN}Questions generated in docs/QUESTIONS.md${NC}"
240
- echo "Please answer the questions, then run claudefsd again to create the plan."
241
- echo
242
-
243
- open_with_editor "docs/QUESTIONS.md"
244
-
245
- echo
246
- echo -e "${GREEN}Questions saved. After answering them, run 'claudefsd' again and select option 3 to create the plan.${NC}"
247
- fi
248
- ;;
249
- 3)
250
246
  # Create plan - check what source to use
251
247
  if [ -f docs/REQUIREMENTS.md ] || [ -f docs/QUESTIONS.md ]; then
252
248
  echo -e "${GREEN}Creating plan from project inputs...${NC}"
253
249
  echo
254
250
  exec "$(dirname "$0")/claudefsd-create-plan"
255
251
  else
256
- echo -e "${RED}No requirements or questions found. Please run the interview or generate questions first.${NC}"
252
+ echo -e "${RED}No requirements or questions found. Please run the interview first.${NC}"
257
253
  exit 1
258
254
  fi
259
255
  ;;
260
- 4)
261
- echo -e "${GREEN}Starting development mode...${NC}"
256
+ 3)
257
+ # Auto-detect development mode
258
+ echo -e "${GREEN}Auto-detecting development approach...${NC}"
262
259
  echo
263
260
  exec "$(dirname "$0")/claudefsd-dev"
264
261
  ;;
265
- 5)
262
+ 3a)
263
+ # Direct execution mode
264
+ echo -e "${GREEN}Starting direct execution mode...${NC}"
265
+ echo
266
+ exec "$(dirname "$0")/claudefsd-dev" direct
267
+ ;;
268
+ 3b)
269
+ # Iterative development mode
270
+ echo -e "${GREEN}Starting iterative development mode...${NC}"
271
+ echo
272
+ exec "$(dirname "$0")/claudefsd-dev" iterative
273
+ ;;
274
+ 4)
266
275
  echo "Goodbye!"
267
276
  exit 0
268
277
  ;;
@@ -282,24 +291,36 @@ else
282
291
  shift
283
292
  exec "$(dirname "$0")/claudefsd-dev" "$@"
284
293
  ;;
285
- analyze-brief)
286
- shift
287
- exec "$(dirname "$0")/claudefsd-analyze-brief" "$@"
288
- ;;
289
294
  create-plan)
290
295
  shift
291
296
  exec "$(dirname "$0")/claudefsd-create-plan" "$@"
292
297
  ;;
298
+ dev-direct)
299
+ # Direct CLI access to direct mode
300
+ shift
301
+ exec "$(dirname "$0")/claudefsd-dev" direct "$@"
302
+ ;;
303
+ dev-iterative)
304
+ # Direct CLI access to iterative mode
305
+ shift
306
+ exec "$(dirname "$0")/claudefsd-dev" iterative "$@"
307
+ ;;
308
+ dev-mini)
309
+ # Legacy support - redirect to direct mode
310
+ shift
311
+ exec "$(dirname "$0")/claudefsd-dev" direct "$@"
312
+ ;;
293
313
  *)
294
314
  echo -e "${RED}Unknown command: $1${NC}"
295
315
  echo
296
316
  echo "Usage: claudefsd [command]"
297
317
  echo
298
318
  echo "Commands:"
299
- echo " interview - Interactive requirements gathering"
300
- echo " analyze-brief - Analyze brief and generate questions (legacy)"
301
- echo " create-plan - Create plan from requirements or questions"
302
- echo " dev|run - Run development mode"
319
+ echo " interview - Interactive requirements gathering"
320
+ echo " create-plan - Create plan from requirements or questions"
321
+ echo " dev|run - Run development mode (auto-detects approach)"
322
+ echo " dev-direct - Force direct execution mode"
323
+ echo " dev-iterative - Force iterative development mode"
303
324
  echo
304
325
  echo "Run without arguments for interactive mode."
305
326
  exit 1
@@ -9,9 +9,11 @@ mkdir -p logs
9
9
  mkdir -p tmp
10
10
  export TMPDIR=tmp/
11
11
 
12
- # look for a brief file
13
- if [ ! -f BRIEF.md ]; then
14
- echo "No BRIEF.md file found, please create one first "
12
+ # look for a brief file (prefer docs/BRIEF.md, fallback to BRIEF.md)
13
+ source "$(dirname "$0")/claudefsd-find-brief"
14
+ BRIEF_FILE=$(find_brief_file)
15
+ if [ $? -ne 0 ]; then
16
+ echo "No BRIEF.md file found in docs/ or root directory, please create one first"
15
17
  exit 1
16
18
  fi
17
19
 
@@ -27,7 +29,7 @@ echo -e "\033[32m===============================================================
27
29
 
28
30
  prompt1="
29
31
  Read all of these documents if they exist:
30
- - BRIEF.md -- the project brief
32
+ - $BRIEF_FILE -- the project brief
31
33
  - docs/CLAUDE-NOTES.md -- AI's working notes and understanding
32
34
  - docs/PLAN.md -- the project plan
33
35
  - docs/QUESTIONS.md -- the project questions
@@ -34,8 +34,11 @@ fi
34
34
  mkdir -p docs
35
35
  mkdir -p logs
36
36
 
37
- if [ ! -f BRIEF.md ]; then
38
- echo "No BRIEF.md file found, please create one first"
37
+ # look for a brief file (prefer docs/BRIEF.md, fallback to BRIEF.md)
38
+ source "$(dirname "$0")/claudefsd-find-brief"
39
+ BRIEF_FILE=$(find_brief_file)
40
+ if [ $? -ne 0 ]; then
41
+ echo "No BRIEF.md file found in docs/ or root directory, please create one first"
39
42
  exit 1
40
43
  fi
41
44
 
@@ -50,7 +53,7 @@ coordinator_prompt="
50
53
  You are a Project Manager analyzing a software project brief to determine which experts should contribute questions.
51
54
 
52
55
  === PROJECT BRIEF ===
53
- $(cat BRIEF.md)
56
+ $(cat "$BRIEF_FILE")
54
57
 
55
58
  === INSTRUCTIONS ===
56
59
  Analyze the project and list which expert personas should ask questions.
@@ -144,7 +147,7 @@ for persona in "${PERSONA_ARRAY[@]}"; do
144
147
  You are a $display_name analyzing a software project brief.
145
148
 
146
149
  === PROJECT BRIEF ===
147
- $(cat BRIEF.md)
150
+ $(cat "$BRIEF_FILE")
148
151
 
149
152
  === INSTRUCTIONS ===
150
153
  Generate 3-5 essential questions that a $display_name would need answered to successfully contribute to this project.
@@ -11,9 +11,11 @@ mkdir -p logs
11
11
  mkdir -p tmp
12
12
  export TMPDIR=tmp/
13
13
 
14
- # look for required files
15
- if [ ! -f BRIEF.md ]; then
16
- echo "No BRIEF.md file found, please create one first "
14
+ # look for required files (prefer docs/BRIEF.md, fallback to BRIEF.md)
15
+ source "$(dirname "$0")/claudefsd-find-brief"
16
+ BRIEF_FILE=$(find_brief_file)
17
+ if [ $? -ne 0 ]; then
18
+ echo "No BRIEF.md file found in docs/ or root directory, please create one first"
17
19
  exit 1
18
20
  fi
19
21
 
@@ -33,7 +35,7 @@ echo -e "\033[32m===============================================================
33
35
 
34
36
  prompt2="
35
37
  Read all of these documents if they exist:
36
- - BRIEF.md -- the project brief
38
+ - $BRIEF_FILE -- the project brief
37
39
  - docs/QUESTIONS.md -- the project questions (with answers) from analyze-brief or interview
38
40
  - docs/REQUIREMENTS.md -- consolidated requirements from interview process
39
41
  - docs/CLAUDE-NOTES.md -- AI's working notes and understanding
@@ -89,7 +91,7 @@ if command -v codex >/dev/null 2>&1; then
89
91
  o3_prompt="You are an elite software architect and strategic planner using o3-pro's advanced reasoning capabilities.
90
92
 
91
93
  CONTEXT DOCUMENTS:
92
- $([ -f BRIEF.md ] && echo "=== PROJECT BRIEF ===" && cat BRIEF.md && echo "")
94
+ $([ -f "$BRIEF_FILE" ] && echo "=== PROJECT BRIEF ===" && cat "$BRIEF_FILE" && echo "")
93
95
  $([ -f docs/QUESTIONS.md ] && echo "=== QUESTIONS & ANSWERS ===" && cat docs/QUESTIONS.md && echo "")
94
96
  $([ -f docs/REQUIREMENTS.md ] && echo "=== CONSOLIDATED REQUIREMENTS ===" && cat docs/REQUIREMENTS.md && echo "")
95
97
  $([ -f docs/INTERVIEW-SESSION.json ] && echo "=== INTERVIEW METADATA ===" && cat docs/INTERVIEW-SESSION.json && echo "")