golem-cc 0.1.16 → 0.1.17

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.
Files changed (3) hide show
  1. package/bin/golem +265 -91
  2. package/bin/install.cjs +11 -5
  3. package/package.json +1 -1
package/bin/golem CHANGED
@@ -14,6 +14,12 @@
14
14
  #
15
15
  set -euo pipefail
16
16
 
17
+ # Exit codes for scripting
18
+ readonly EXIT_COMPLETE=0
19
+ readonly EXIT_INCOMPLETE=1
20
+ readonly EXIT_NO_PLAN=2
21
+ readonly EXIT_ERROR=3
22
+
17
23
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
24
  # When installed globally, GOLEM_DIR is ~/.golem
19
25
  # When run from source, it's the parent of bin/
@@ -29,9 +35,103 @@ GREEN='\033[0;32m'
29
35
  YELLOW='\033[0;33m'
30
36
  BLUE='\033[0;34m'
31
37
  CYAN='\033[0;36m'
38
+ BOLD='\033[1m'
32
39
  DIM='\033[2m'
33
40
  NC='\033[0m'
34
41
 
42
+ # Terminal width for consistent formatting
43
+ TERM_WIDTH=60
44
+
45
+ # Helper: print a horizontal rule
46
+ hr() {
47
+ local char="${1:-━}"
48
+ local color="${2:-$CYAN}"
49
+ printf "${color}"
50
+ printf '%*s' "$TERM_WIDTH" '' | tr ' ' "$char"
51
+ printf "${NC}\n"
52
+ }
53
+
54
+ # Helper: print centered text
55
+ center() {
56
+ local text="$1"
57
+ local color="${2:-$NC}"
58
+ local text_len=${#text}
59
+ local padding=$(( (TERM_WIDTH - text_len) / 2 ))
60
+ printf "${color}%*s%s%*s${NC}\n" "$padding" '' "$text" "$padding" ''
61
+ }
62
+
63
+ # Helper: print a header box
64
+ header_box() {
65
+ local title="$1"
66
+ local color="${2:-$CYAN}"
67
+ echo ""
68
+ hr "━" "$color"
69
+ center "$title" "$color"
70
+ hr "━" "$color"
71
+ }
72
+
73
+ # Helper: print status line with icon
74
+ status_line() {
75
+ local icon="$1"
76
+ local color="$2"
77
+ local text="$3"
78
+ echo -e " ${color}${icon}${NC} ${text}"
79
+ }
80
+
81
+ # Helper: print a key-value line
82
+ kv_line() {
83
+ local key="$1"
84
+ local value="$2"
85
+ local key_color="${3:-$DIM}"
86
+ printf " ${key_color}%-12s${NC} %s\n" "$key" "$value"
87
+ }
88
+
89
+ # Audit logging
90
+ log_event() {
91
+ local event="$1"
92
+ local details="${2:-}"
93
+ local log_file=".golem/golem.log"
94
+ [[ -d ".golem" ]] && echo "[$(date -Iseconds)] $event: $details" >> "$log_file"
95
+ }
96
+
97
+ # Robust completion detection
98
+ is_plan_complete() {
99
+ local plan=".golem/IMPLEMENTATION_PLAN.md"
100
+ [[ ! -f "$plan" ]] && return $EXIT_NO_PLAN
101
+
102
+ # Count unchecked boxes (any format: - [ ], * [ ], ### [ ], etc.)
103
+ # Note: grep -c returns exit 1 when count is 0, so we need || true to prevent pipefail exit
104
+ local unchecked
105
+ unchecked=$(grep -ciE '\[ \]' "$plan" 2>/dev/null | tr -d '[:space:]' || true)
106
+ [[ -z "$unchecked" ]] && unchecked=0
107
+
108
+ # Count checked boxes to verify plan isn't empty
109
+ local checked
110
+ checked=$(grep -ciE '\[[xX]\]' "$plan" 2>/dev/null | tr -d '[:space:]' || true)
111
+ [[ -z "$checked" ]] && checked=0
112
+
113
+ if [[ "$unchecked" -eq 0 ]] && [[ "$checked" -gt 0 ]]; then
114
+ return $EXIT_COMPLETE
115
+ fi
116
+ return $EXIT_INCOMPLETE
117
+ }
118
+
119
+ # Get task counts for display
120
+ get_task_counts() {
121
+ local plan=".golem/IMPLEMENTATION_PLAN.md"
122
+ local unchecked=0
123
+ local checked=0
124
+
125
+ if [[ -f "$plan" ]]; then
126
+ unchecked=$(grep -ciE '\[ \]' "$plan" 2>/dev/null | tr -d '[:space:]' || true)
127
+ checked=$(grep -ciE '\[[xX]\]' "$plan" 2>/dev/null | tr -d '[:space:]' || true)
128
+ [[ -z "$unchecked" ]] && unchecked=0
129
+ [[ -z "$checked" ]] && checked=0
130
+ fi
131
+
132
+ echo "$unchecked $checked"
133
+ }
134
+
35
135
  print_banner() {
36
136
  echo ""
37
137
  echo -e "${CYAN}"
@@ -54,6 +154,7 @@ print_usage() {
54
154
  echo " run build Run autonomous build loop"
55
155
  echo " simplify [path] Run code simplifier"
56
156
  echo " status Show project status"
157
+ echo " status --check Exit 0 if complete, 1 if incomplete, 2 if no plan"
57
158
  echo ""
58
159
  echo -e "${BLUE}Options:${NC}"
59
160
  echo " --install Install golem to current project"
@@ -65,13 +166,21 @@ print_usage() {
65
166
  echo " 1. claude → /golem:spec Define requirements (interactive)"
66
167
  echo " 2. golem run plan Generate implementation plan"
67
168
  echo " 3. golem run build Autonomous build loop"
169
+ echo ""
170
+ echo -e "${BLUE}Scripting:${NC}"
171
+ echo " golem status --check && echo 'Done!' # Check completion"
172
+ echo " while ! golem status --check; do # Loop until complete"
173
+ echo " golem run build --iterations 1"
174
+ echo " done"
68
175
  }
69
176
 
70
177
  # Check if golem is installed in current project
71
178
  check_installed() {
72
179
  if [[ ! -d ".golem" ]]; then
73
- echo -e "${RED}Error: Golem not installed in this project.${NC}"
74
- echo -e "Run: ${CYAN}golem --install${NC}"
180
+ echo ""
181
+ status_line "✗" "$RED" "Golem not installed in this project"
182
+ echo -e " ${DIM}Run: golem --install${NC}"
183
+ echo ""
75
184
  exit 1
76
185
  fi
77
186
  }
@@ -79,13 +188,13 @@ check_installed() {
79
188
  # Install golem to current project
80
189
  cmd_install() {
81
190
  print_banner
82
- echo -e "${BLUE}Installing golem...${NC}"
191
+ header_box "INSTALLING" "$BLUE"
83
192
  echo ""
84
193
 
85
194
  # Create directories
86
195
  mkdir -p .golem/prompts
87
196
  mkdir -p .golem/agents
88
- mkdir -p specs
197
+ mkdir -p .golem/specs
89
198
 
90
199
  # Copy prompts and agents
91
200
  local copied_agents=false
@@ -105,8 +214,8 @@ cmd_install() {
105
214
  fi
106
215
 
107
216
  # Create AGENTS.md if it doesn't exist
108
- if [[ ! -f "AGENTS.md" ]]; then
109
- cat > AGENTS.md << 'EOF'
217
+ if [[ ! -f ".golem/AGENTS.md" ]]; then
218
+ cat > .golem/AGENTS.md << 'EOF'
110
219
  # Operational Guide
111
220
 
112
221
  ## Commands
@@ -134,14 +243,14 @@ npm run build
134
243
  ## Learnings
135
244
  <!-- Updated during build iterations -->
136
245
  EOF
137
- echo -e "${GREEN}✓${NC} Created AGENTS.md"
246
+ echo -e "${GREEN}✓${NC} Created .golem/AGENTS.md"
138
247
  fi
139
248
 
140
249
  # Auto-detect project type
141
250
  detect_project
142
251
 
143
252
  echo -e "${GREEN}✓${NC} Created .golem/ directory"
144
- echo -e "${GREEN}✓${NC} Created specs/ directory"
253
+ echo -e "${GREEN}✓${NC} Created .golem/specs/ directory"
145
254
  echo ""
146
255
  echo -e "${BLUE}Next steps:${NC}"
147
256
  echo -e " 1. Run ${CYAN}claude${NC} then ${CYAN}/golem:spec${NC} to define requirements"
@@ -168,7 +277,7 @@ detect_project() {
168
277
  fi
169
278
 
170
279
  # Update AGENTS.md with detected commands
171
- cat > AGENTS.md << EOF
280
+ cat > .golem/AGENTS.md << EOF
172
281
  # Operational Guide
173
282
 
174
283
  ## Commands
@@ -178,28 +287,28 @@ detect_project() {
178
287
  ${test_cmd}
179
288
  \`\`\`
180
289
  EOF
181
- [[ -n "$typecheck_cmd" ]] && cat >> AGENTS.md << EOF
290
+ [[ -n "$typecheck_cmd" ]] && cat >> .golem/AGENTS.md << EOF
182
291
 
183
292
  ### Type Checking
184
293
  \`\`\`bash
185
294
  ${typecheck_cmd}
186
295
  \`\`\`
187
296
  EOF
188
- [[ -n "$lint_cmd" ]] && cat >> AGENTS.md << EOF
297
+ [[ -n "$lint_cmd" ]] && cat >> .golem/AGENTS.md << EOF
189
298
 
190
299
  ### Linting
191
300
  \`\`\`bash
192
301
  ${lint_cmd}
193
302
  \`\`\`
194
303
  EOF
195
- [[ -n "$build_cmd" ]] && cat >> AGENTS.md << EOF
304
+ [[ -n "$build_cmd" ]] && cat >> .golem/AGENTS.md << EOF
196
305
 
197
306
  ### Build
198
307
  \`\`\`bash
199
308
  ${build_cmd}
200
309
  \`\`\`
201
310
  EOF
202
- cat >> AGENTS.md << 'EOF'
311
+ cat >> .golem/AGENTS.md << 'EOF'
203
312
 
204
313
  ## Learnings
205
314
  <!-- Updated during build iterations -->
@@ -214,16 +323,16 @@ EOF
214
323
  # Show spec workflow hint
215
324
  cmd_spec() {
216
325
  print_banner
217
- echo -e "${BLUE}Spec Builder${NC}"
326
+ header_box "SPEC BUILDER" "$BLUE"
218
327
  echo ""
219
- echo -e "To build specs, run ${CYAN}claude${NC} and use the ${CYAN}/golem:spec${NC} command."
328
+ echo -e " To build specs, run ${CYAN}claude${NC} and use ${CYAN}/golem:spec${NC}"
220
329
  echo ""
221
- echo -e "${DIM}Workflow:${NC}"
222
- echo -e " 1. ${CYAN}claude${NC} - Start Claude Code"
223
- echo -e " 2. ${CYAN}/golem:spec${NC} - Build specs through conversation"
224
- echo -e " 3. ${CYAN}exit${NC} - Exit when done"
225
- echo -e " 4. ${CYAN}golem run plan${NC} - Generate implementation plan"
226
- echo -e " 5. ${CYAN}golem run build${NC} - Run autonomous build loop"
330
+ echo -e " ${BOLD}Workflow${NC}"
331
+ echo -e " ${DIM}1.${NC} claude ${DIM}Start Claude Code${NC}"
332
+ echo -e " ${DIM}2.${NC} /golem:spec ${DIM}Build specs interactively${NC}"
333
+ echo -e " ${DIM}3.${NC} exit ${DIM}Exit when done${NC}"
334
+ echo -e " ${DIM}4.${NC} golem run plan ${DIM}Generate implementation plan${NC}"
335
+ echo -e " ${DIM}5.${NC} golem run build ${DIM}Run autonomous build loop${NC}"
227
336
  echo ""
228
337
  }
229
338
 
@@ -271,8 +380,9 @@ cmd_run() {
271
380
 
272
381
  run_plan_mode() {
273
382
  print_banner
274
- echo -e "${BLUE}Running planning mode...${NC}"
275
- echo -e "${DIM}Analyzing specs and creating implementation plan.${NC}"
383
+ header_box "PLANNING" "$BLUE"
384
+ echo ""
385
+ echo -e " ${DIM}Analyzing specs and creating implementation plan...${NC}"
276
386
  echo ""
277
387
 
278
388
  # Find prompt file (uses @file references for context)
@@ -282,20 +392,22 @@ run_plan_mode() {
282
392
  elif [[ -f "$GOLEM_DIR/golem/prompts/PROMPT_plan.md" ]]; then
283
393
  prompt_file="$GOLEM_DIR/golem/prompts/PROMPT_plan.md"
284
394
  else
285
- echo -e "${RED}No PROMPT_plan.md found. Run golem --install first.${NC}"
395
+ status_line "✗" "$RED" "No PROMPT_plan.md found. Run golem --install first."
286
396
  exit 1
287
397
  fi
288
398
 
289
399
  # Ralph pattern: cat PROMPT | claude -p
290
400
  cat "$prompt_file" | claude -p \
291
401
  --dangerously-skip-permissions \
292
- --output-format stream-json \
293
402
  --model opus \
294
403
  --verbose
295
404
 
296
405
  echo ""
297
- echo -e "${GREEN}Planning complete.${NC}"
298
- echo -e "Run ${CYAN}golem run build${NC} to start implementation."
406
+ header_box "PLANNING COMPLETE" "$GREEN"
407
+ echo ""
408
+ status_line "✓" "$GREEN" "Implementation plan created"
409
+ echo -e " ${DIM}Next:${NC} golem run build"
410
+ echo ""
299
411
  }
300
412
 
301
413
  run_build_loop() {
@@ -305,16 +417,22 @@ run_build_loop() {
305
417
  print_banner
306
418
 
307
419
  # Verify prerequisites
308
- if [[ ! -f "IMPLEMENTATION_PLAN.md" ]]; then
309
- echo -e "${YELLOW}No implementation plan found.${NC}"
310
- echo -e "Run ${CYAN}golem run plan${NC} first."
311
- exit 1
420
+ if [[ ! -f ".golem/IMPLEMENTATION_PLAN.md" ]]; then
421
+ echo ""
422
+ status_line "!" "$YELLOW" "No implementation plan found"
423
+ echo -e " ${DIM}Run: golem run plan${NC}"
424
+ echo ""
425
+ log_event "BUILD_ABORT" "No implementation plan found"
426
+ exit $EXIT_NO_PLAN
312
427
  fi
313
428
 
314
- if [[ ! -d "specs" ]] || [[ -z "$(ls -A specs/*.md 2>/dev/null)" ]]; then
315
- echo -e "${YELLOW}No specs found.${NC}"
316
- echo -e "Run ${CYAN}/golem:spec${NC} in Claude first."
317
- exit 1
429
+ if [[ ! -d ".golem/specs" ]] || [[ -z "$(ls -A .golem/specs/*.md 2>/dev/null)" ]]; then
430
+ echo ""
431
+ status_line "!" "$YELLOW" "No specs found"
432
+ echo -e " ${DIM}Run: /golem:spec in Claude first${NC}"
433
+ echo ""
434
+ log_event "BUILD_ABORT" "No specs found"
435
+ exit $EXIT_ERROR
318
436
  fi
319
437
 
320
438
  # Find prompt file
@@ -324,53 +442,71 @@ run_build_loop() {
324
442
  elif [[ -f "$GOLEM_DIR/golem/prompts/PROMPT_build.md" ]]; then
325
443
  build_prompt="$GOLEM_DIR/golem/prompts/PROMPT_build.md"
326
444
  else
327
- echo -e "${RED}No PROMPT_build.md found. Run golem --install first.${NC}"
328
- exit 1
445
+ status_line "✗" "$RED" "No PROMPT_build.md found"
446
+ echo -e " ${DIM}Run: golem --install${NC}"
447
+ log_event "BUILD_ABORT" "No PROMPT_build.md found"
448
+ exit $EXIT_ERROR
329
449
  fi
330
450
 
331
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
332
- echo -e "${CYAN} BUILD LOOP STARTED${NC}"
333
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
451
+ header_box "BUILD LOOP" "$CYAN"
334
452
 
335
453
  local iteration=0
336
454
  local start_time=$(date +%s)
455
+ log_event "BUILD_START" "max_iterations=${max_iterations:-unlimited} simplify=$simplify"
337
456
 
338
457
  # Ralph loop: while :; do cat PROMPT | claude -p; done
339
458
  while true; do
459
+ # Check completion BEFORE incrementing iteration
460
+ if is_plan_complete; then
461
+ log_event "BUILD_COMPLETE" "All tasks done after $iteration iterations"
462
+ break
463
+ fi
464
+
340
465
  iteration=$((iteration + 1))
341
466
 
342
467
  # Check iteration limit
343
468
  if [[ -n "$max_iterations" ]] && [[ $iteration -gt $max_iterations ]]; then
344
- echo -e "${YELLOW}Reached iteration limit ($max_iterations). Stopping.${NC}"
469
+ echo ""
470
+ status_line "◦" "$YELLOW" "Reached iteration limit ($max_iterations)"
471
+ log_event "BUILD_LIMIT" "Stopped at iteration $iteration (limit: $max_iterations)"
345
472
  break
346
473
  fi
347
474
 
348
- # Check remaining tasks
349
- local remaining=$(grep -c '^\- \[ \]' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0")
350
- if [[ "$remaining" == "0" ]]; then
351
- echo -e "${GREEN}All tasks completed!${NC}"
352
- break
353
- fi
475
+ # Get task counts for display
476
+ read -r remaining checked <<< "$(get_task_counts)"
354
477
 
355
478
  echo ""
356
- echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
357
- echo -e "${BLUE} ITERATION $iteration │ $remaining tasks remaining${NC}"
358
- echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
479
+ hr "─" "$BLUE"
480
+ local total=$((remaining + checked))
481
+ local progress_pct=0
482
+ [[ $total -gt 0 ]] && progress_pct=$((checked * 100 / total))
483
+ echo -e "${BLUE} ▸ Iteration ${BOLD}$iteration${NC}${BLUE} Tasks: ${GREEN}$checked${BLUE}/${total} ${DIM}($progress_pct%)${NC}"
484
+ hr "─" "$BLUE"
485
+
486
+ local iter_start=$(date +%s)
487
+ log_event "ITERATION_START" "iteration=$iteration remaining=$remaining"
359
488
 
360
489
  # Ralph pattern: cat PROMPT | claude -p
490
+ local claude_exit=0
361
491
  cat "$build_prompt" | claude -p \
362
492
  --dangerously-skip-permissions \
363
- --output-format stream-json \
364
493
  --model opus \
365
- --verbose
494
+ --verbose || claude_exit=$?
366
495
 
367
- local exit_code=$?
368
- if [[ $exit_code -ne 0 ]]; then
369
- echo -e "${RED}Build step exited with error code $exit_code${NC}"
370
- fi
496
+ local iter_end=$(date +%s)
497
+ local iter_duration=$((iter_end - iter_start))
498
+ log_event "ITERATION_END" "iteration=$iteration exit_code=$claude_exit duration=${iter_duration}s"
499
+
500
+ # Push changes after each iteration (like Ralph)
501
+ local current_branch=$(git branch --show-current)
502
+ git push origin "$current_branch" 2>/dev/null || {
503
+ echo -e " ${DIM}Creating remote branch...${NC}"
504
+ git push -u origin "$current_branch" 2>/dev/null || true
505
+ }
371
506
 
372
- # Brief pause between iterations
373
- sleep 2
507
+ echo ""
508
+ echo -e "${DIM} ─────────────────────────────────────────────────────────${NC}"
509
+ echo ""
374
510
  done
375
511
 
376
512
  local end_time=$(date +%s)
@@ -378,18 +514,25 @@ run_build_loop() {
378
514
  local minutes=$((duration / 60))
379
515
  local seconds=$((duration % 60))
380
516
 
517
+ read -r remaining checked <<< "$(get_task_counts)"
518
+ local total=$((remaining + checked))
519
+
381
520
  echo ""
382
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
383
- echo -e "${CYAN} BUILD LOOP COMPLETE${NC}"
384
- echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
385
- echo -e " Iterations: $iteration"
386
- echo -e " Duration: ${minutes}m ${seconds}s"
387
-
388
- if [[ -f "IMPLEMENTATION_PLAN.md" ]]; then
389
- local total=$(grep -c '^\- \[' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0")
390
- local done=$(grep -c '^\- \[x\]' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0")
391
- echo -e " Tasks: $done / $total completed"
521
+ header_box "BUILD COMPLETE" "$GREEN"
522
+ echo ""
523
+ kv_line "Iterations" "$iteration"
524
+ kv_line "Duration" "${minutes}m ${seconds}s"
525
+ kv_line "Tasks" "$checked / $total completed"
526
+
527
+ if [[ $remaining -eq 0 ]]; then
528
+ echo ""
529
+ status_line "✓" "$GREEN" "All tasks completed successfully"
530
+ else
531
+ echo ""
532
+ status_line "◦" "$YELLOW" "$remaining tasks remaining"
392
533
  fi
534
+
535
+ log_event "BUILD_SUMMARY" "iterations=$iteration duration=${duration}s completed=$checked remaining=$remaining"
393
536
  echo ""
394
537
  }
395
538
 
@@ -397,7 +540,9 @@ cmd_simplify() {
397
540
  local target="${1:-.}"
398
541
  check_installed
399
542
  print_banner
400
- echo -e "${BLUE}Running code simplifier on: $target${NC}"
543
+ header_box "SIMPLIFY" "$BLUE"
544
+ echo ""
545
+ echo -e " ${DIM}Target:${NC} $target"
401
546
  echo ""
402
547
 
403
548
  if [[ -f ".golem/agents/code-simplifier.md" ]]; then
@@ -410,44 +555,72 @@ cmd_simplify() {
410
555
  }
411
556
 
412
557
  cmd_status() {
558
+ local check_only=false
559
+
560
+ # Parse options
561
+ while [[ $# -gt 0 ]]; do
562
+ case $1 in
563
+ --check)
564
+ check_only=true
565
+ shift
566
+ ;;
567
+ *)
568
+ shift
569
+ ;;
570
+ esac
571
+ done
572
+
573
+ # --check mode: just return exit code, no output
574
+ if [[ "$check_only" == "true" ]]; then
575
+ is_plan_complete
576
+ exit $?
577
+ fi
578
+
413
579
  check_installed
414
580
  print_banner
415
-
416
- echo -e "${BLUE}PROJECT STATUS${NC}"
417
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
581
+ header_box "PROJECT STATUS" "$BLUE"
418
582
  echo ""
419
583
 
420
584
  # Specs
421
- echo -e "${BLUE}Specs${NC}"
422
- if [[ -d "specs" ]]; then
423
- local count=$(ls -1 specs/*.md 2>/dev/null | wc -l | tr -d ' ')
424
- echo " Files: $count"
425
- for f in specs/*.md; do
426
- [[ -f "$f" ]] && echo " $(basename "$f" .md)"
585
+ echo -e " ${BOLD}Specs${NC}"
586
+ if [[ -d ".golem/specs" ]]; then
587
+ local count=$(ls -1 .golem/specs/*.md 2>/dev/null | wc -l | tr -d ' ')
588
+ kv_line "Files" "$count"
589
+ for f in .golem/specs/*.md; do
590
+ [[ -f "$f" ]] && echo -e " ${DIM}•${NC} $(basename "$f" .md)"
427
591
  done
428
592
  else
429
- echo " No specs/ directory"
593
+ echo -e " ${DIM}No specs directory${NC}"
430
594
  fi
431
595
  echo ""
432
596
 
433
597
  # Plan
434
- echo -e "${BLUE}Implementation Plan${NC}"
435
- if [[ -f "IMPLEMENTATION_PLAN.md" ]]; then
436
- local total=$(grep -c '^\- \[' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0")
437
- local done=$(grep -c '^\- \[x\]' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0")
438
- local remaining=$((total - done))
439
- echo " Total: $total tasks"
440
- echo " Completed: $done"
441
- echo " Remaining: $remaining"
598
+ echo -e " ${BOLD}Implementation Plan${NC}"
599
+ if [[ -f ".golem/IMPLEMENTATION_PLAN.md" ]]; then
600
+ read -r remaining checked <<< "$(get_task_counts)"
601
+ local total=$((remaining + checked))
602
+ local progress_pct=0
603
+ [[ $total -gt 0 ]] && progress_pct=$((checked * 100 / total))
604
+
605
+ kv_line "Progress" "$checked / $total tasks ($progress_pct%)"
606
+
607
+ if is_plan_complete; then
608
+ status_line "✓" "$GREEN" "Complete"
609
+ else
610
+ status_line "◦" "$YELLOW" "In progress ($remaining remaining)"
611
+ fi
442
612
  else
443
- echo " No plan yet - run 'golem run plan'"
613
+ echo -e " ${DIM}No plan yet${NC}"
614
+ echo -e " ${DIM}Run: golem run plan${NC}"
444
615
  fi
445
616
  echo ""
446
617
 
447
618
  # Git
448
619
  if git rev-parse --is-inside-work-tree &>/dev/null; then
449
- echo -e "${BLUE}Recent Commits${NC}"
450
- git log --oneline -5 2>/dev/null || echo " No commits yet"
620
+ echo -e " ${BOLD}Recent Commits${NC}"
621
+ git log --oneline -5 2>/dev/null | while read -r line; do
622
+ echo -e " ${DIM}•${NC} $line"
623
+ done || echo -e " ${DIM}No commits yet${NC}"
451
624
  fi
452
625
  echo ""
453
626
  }
@@ -480,7 +653,8 @@ main() {
480
653
  cmd_simplify "$@"
481
654
  ;;
482
655
  status)
483
- cmd_status
656
+ shift
657
+ cmd_status "$@"
484
658
  ;;
485
659
  "")
486
660
  # No command - just launch claude
package/bin/install.cjs CHANGED
@@ -127,11 +127,17 @@ golem() {
127
127
  content = fs.readFileSync(configPath, 'utf8');
128
128
  }
129
129
 
130
- // Remove old golem function/alias
131
- if (content.includes('golem()') || content.includes('# Golem alias')) {
132
- content = content.replace(/\n# Golem alias for Claude Code\ngolem\(\) \{[\s\S]*?\n\}\n/g, '');
133
- content = content.replace(/\n# Golem alias.*\nalias golem=.*\n/g, '');
134
- }
130
+ // Remove ALL old golem function/alias definitions
131
+ // Match golem() function blocks (various formats)
132
+ content = content.replace(/\n# Golem[^\n]*\n# Installed by:[^\n]*\ngolem\(\) \{[\s\S]*?\n\}\n?/g, '\n');
133
+ content = content.replace(/\n# Golem alias for Claude Code\ngolem\(\) \{[\s\S]*?\n\}\n?/g, '\n');
134
+ // Match old-style alias definitions (from golem --install)
135
+ content = content.replace(/\n# Added by: golem --install[^\n]*\n[^\n]*\nalias golem=[^\n]*\n?/g, '\n');
136
+ content = content.replace(/\n# Golem alias[^\n]*\nalias golem=[^\n]*\n?/g, '\n');
137
+ // Clean up any standalone alias golem= lines
138
+ content = content.replace(/\nalias golem=[^\n]*\n?/g, '\n');
139
+ // Clean up multiple consecutive newlines
140
+ content = content.replace(/\n{3,}/g, '\n\n');
135
141
 
136
142
  content = content.trimEnd() + '\n' + golemFunction;
137
143
  fs.writeFileSync(configPath, content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "golem-cc",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Autonomous coding loop with Claude - structured specs, ralph loop execution, code simplification",
5
5
  "bin": {
6
6
  "golem-cc": "./bin/install.cjs"