golem-cc 0.2.2 → 0.2.5

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 CHANGED
@@ -52,7 +52,7 @@ Golem is an autonomous coding loop that implements features while you watch (or
52
52
  │ └────────────────────┘ │
53
53
  │ │ │
54
54
  │ ▼ │
55
- specs/*.md
55
+ .golem/specs/*.md
56
56
  │ │ │
57
57
  ├──────────────────────────────┼──────────────────────────────────┤
58
58
  │ GOLEM │
@@ -63,7 +63,7 @@ Golem is an autonomous coding loop that implements features while you watch (or
63
63
  │ └────────────────┘ vs. codebase │
64
64
  │ │ │
65
65
  │ ▼ │
66
- IMPLEMENTATION_PLAN.md
66
+ .golem/IMPLEMENTATION_PLAN.md
67
67
  │ │ │
68
68
  │ ▼ │
69
69
  │ ┌─────────────────┐ │
@@ -126,7 +126,7 @@ golem run build
126
126
  Each iteration runs two separate sessions with fresh context:
127
127
 
128
128
  **Step 1: Implement**
129
- - Picks the next task from `IMPLEMENTATION_PLAN.md`
129
+ - Picks the next task from `.golem/IMPLEMENTATION_PLAN.md`
130
130
  - Implements the feature/fix
131
131
  - Runs tests until they pass
132
132
  - Updates the plan
@@ -176,18 +176,18 @@ After running `golem --init`:
176
176
 
177
177
  ```
178
178
  my-project/
179
- ├── .golem/
180
- ├── prompts/ # Loop instructions (customizable)
181
- ├── PROMPT_build.md
182
- └── PROMPT_plan.md
183
- │ └── agents/ # AI agent definitions
184
- ├── spec-builder.md
185
- └── code-simplifier.md
186
- ├── specs/ # Your requirements (one file per topic)
187
- │ ├── authentication.md
188
- │ └── task-api.md
189
- ├── AGENTS.md # Test/build/lint commands
190
- └── IMPLEMENTATION_PLAN.md # Generated task list
179
+ └── .golem/
180
+ ├── prompts/ # Loop instructions (customizable)
181
+ │ ├── PROMPT_build.md
182
+ │ └── PROMPT_plan.md
183
+ ├── agents/ # AI agent definitions
184
+ ├── spec-builder.md
185
+ └── code-simplifier.md
186
+ ├── specs/ # Your requirements (one file per topic)
187
+ │ ├── authentication.md
188
+ │ └── task-api.md
189
+ ├── AGENTS.md # Test/build/lint commands
190
+ └── IMPLEMENTATION_PLAN.md # Generated task list
191
191
  ```
192
192
 
193
193
  ## Writing Specs
@@ -223,7 +223,7 @@ User authentication for the API.
223
223
 
224
224
  ## Backpressure
225
225
 
226
- The loop uses your test suite as a quality gate. Configure in `AGENTS.md`:
226
+ The loop uses your test suite as a quality gate. Configure in `.golem/AGENTS.md`:
227
227
 
228
228
  ```markdown
229
229
  # Operational Guide
@@ -256,7 +256,7 @@ If tests fail, it fixes and retries. If they pass, it moves on. Your tests are t
256
256
 
257
257
  **Simplification is not optional.** AI-written code tends toward verbosity. The simplifier pass keeps it clean.
258
258
 
259
- **You steer via specs, not prompts.** Change what you want by editing `specs/*.md`, not by micromanaging the AI.
259
+ **You steer via specs, not prompts.** Change what you want by editing `.golem/specs/*.md`, not by micromanaging the AI.
260
260
 
261
261
  ## Based On
262
262
 
package/bin/golem CHANGED
@@ -11,6 +11,7 @@
11
11
  # golem run build Run autonomous build loop
12
12
  # golem simplify [path] Run code simplifier
13
13
  # golem status Show project status
14
+ # golem doctor Check installation health
14
15
  #
15
16
  set -euo pipefail
16
17
 
@@ -115,6 +116,119 @@ get_version() {
115
116
  fi
116
117
  }
117
118
 
119
+ # Update checker - checks npm registry for newer version with caching
120
+ # Cache file: ~/.golem/.update-check (JSON format)
121
+ # Returns: latest version if update available, empty string otherwise
122
+ check_for_update() {
123
+ local current_version="$1"
124
+ local cache_file="$HOME/.golem/.update-check"
125
+ local cache_max_age=86400 # 24 hours in seconds
126
+ local timeout_secs=3
127
+ local npm_registry="https://registry.npmjs.org/golem-cc/latest"
128
+
129
+ # Skip if current version is unknown
130
+ [[ "$current_version" == "unknown" ]] && return
131
+
132
+ # Check cache first
133
+ if [[ -f "$cache_file" ]]; then
134
+ local cache_time=""
135
+ local cached_version=""
136
+
137
+ if command -v jq &>/dev/null; then
138
+ cache_time=$(jq -r '.checked // 0' "$cache_file" 2>/dev/null)
139
+ cached_version=$(jq -r '.version // ""' "$cache_file" 2>/dev/null)
140
+ else
141
+ # Parse JSON without jq
142
+ cache_time=$(grep -o '"checked"[[:space:]]*:[[:space:]]*[0-9]*' "$cache_file" 2>/dev/null | grep -o '[0-9]*$')
143
+ cached_version=$(grep -o '"version"[[:space:]]*:[[:space:]]*"[^"]*"' "$cache_file" 2>/dev/null | sed 's/.*"\([^"]*\)"$/\1/')
144
+ fi
145
+
146
+ local now
147
+ now=$(date +%s)
148
+ local age=$((now - ${cache_time:-0}))
149
+
150
+ # Use cached result if still fresh
151
+ if [[ $age -lt $cache_max_age ]] && [[ -n "$cached_version" ]]; then
152
+ # Compare versions - only output if update available
153
+ if version_gt "$cached_version" "$current_version"; then
154
+ echo "$cached_version"
155
+ fi
156
+ return
157
+ fi
158
+ fi
159
+
160
+ # Fetch latest version from npm registry (with timeout, background-friendly)
161
+ local latest_version=""
162
+ local response=""
163
+
164
+ # Use curl with timeout (available on all Unix systems)
165
+ if command -v curl &>/dev/null; then
166
+ response=$(curl -s --max-time "$timeout_secs" "$npm_registry" 2>/dev/null) || return
167
+ elif command -v wget &>/dev/null; then
168
+ response=$(wget -q -O - --timeout="$timeout_secs" "$npm_registry" 2>/dev/null) || return
169
+ else
170
+ # No curl or wget available
171
+ return
172
+ fi
173
+
174
+ # Parse version from response
175
+ if [[ -n "$response" ]]; then
176
+ if command -v jq &>/dev/null; then
177
+ latest_version=$(echo "$response" | jq -r '.version // ""' 2>/dev/null)
178
+ else
179
+ latest_version=$(echo "$response" | grep -o '"version"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"\([^"]*\)"$/\1/')
180
+ fi
181
+ fi
182
+
183
+ # Update cache (create directory if needed)
184
+ if [[ -n "$latest_version" ]]; then
185
+ mkdir -p "$(dirname "$cache_file")"
186
+ local now
187
+ now=$(date +%s)
188
+ cat > "$cache_file" << EOF
189
+ {"version":"$latest_version","checked":$now}
190
+ EOF
191
+
192
+ # Compare versions and output if update available
193
+ if version_gt "$latest_version" "$current_version"; then
194
+ echo "$latest_version"
195
+ fi
196
+ fi
197
+ }
198
+
199
+ # Compare two semver versions - returns 0 if v1 > v2
200
+ version_gt() {
201
+ local v1="$1"
202
+ local v2="$2"
203
+
204
+ # Use sort -V if available (GNU coreutils)
205
+ if printf '%s\n' "$v1" "$v2" | sort -V &>/dev/null; then
206
+ local highest
207
+ highest=$(printf '%s\n' "$v1" "$v2" | sort -V | tail -1)
208
+ [[ "$highest" == "$v1" ]] && [[ "$v1" != "$v2" ]]
209
+ return $?
210
+ fi
211
+
212
+ # Fallback: simple numeric comparison for x.y.z format
213
+ local v1_major v1_minor v1_patch
214
+ local v2_major v2_minor v2_patch
215
+
216
+ IFS='.' read -r v1_major v1_minor v1_patch <<< "$v1"
217
+ IFS='.' read -r v2_major v2_minor v2_patch <<< "$v2"
218
+
219
+ # Default to 0 if empty
220
+ v1_major=${v1_major:-0}; v1_minor=${v1_minor:-0}; v1_patch=${v1_patch:-0}
221
+ v2_major=${v2_major:-0}; v2_minor=${v2_minor:-0}; v2_patch=${v2_patch:-0}
222
+
223
+ # Compare major.minor.patch
224
+ if [[ $v1_major -gt $v2_major ]]; then return 0; fi
225
+ if [[ $v1_major -lt $v2_major ]]; then return 1; fi
226
+ if [[ $v1_minor -gt $v2_minor ]]; then return 0; fi
227
+ if [[ $v1_minor -lt $v2_minor ]]; then return 1; fi
228
+ if [[ $v1_patch -gt $v2_patch ]]; then return 0; fi
229
+ return 1
230
+ }
231
+
118
232
  # Audit logging
119
233
  log_event() {
120
234
  local event="$1"
@@ -192,6 +306,10 @@ print_usage() {
192
306
  echo " simplify [path] Run code simplifier"
193
307
  echo " status Show project status"
194
308
  echo " status --check Exit 0 if complete, 1 if incomplete, 2 if no plan"
309
+ echo " status --skip-update-check Skip checking for updates"
310
+ echo " doctor Check installation health"
311
+ echo " doctor --fix Auto-fix detected issues"
312
+ echo " doctor --json Output results as JSON (for CI/scripting)"
195
313
  echo ""
196
314
  echo -e "${BLUE}Options:${NC}"
197
315
  echo " --init Initialize golem in current project"
@@ -681,8 +799,376 @@ cmd_simplify() {
681
799
  fi
682
800
  }
683
801
 
802
+ # Doctor command - verify installation health
803
+ cmd_doctor() {
804
+ local all_passed=true
805
+ local fix_mode=false
806
+ local json_mode=false
807
+ local fixes_applied=0
808
+ local fixes_available=0
809
+
810
+ # JSON output accumulator (array of check results)
811
+ local json_checks=()
812
+
813
+ # Parse options
814
+ while [[ $# -gt 0 ]]; do
815
+ case $1 in
816
+ --fix)
817
+ fix_mode=true
818
+ shift
819
+ ;;
820
+ --json)
821
+ json_mode=true
822
+ shift
823
+ ;;
824
+ *)
825
+ shift
826
+ ;;
827
+ esac
828
+ done
829
+
830
+ if [[ "$json_mode" == "false" ]]; then
831
+ print_banner
832
+ header_box "DOCTOR" "$BLUE"
833
+ echo ""
834
+ if [[ "$fix_mode" == "true" ]]; then
835
+ echo -e " ${DIM}Checking installation health (auto-fix enabled)...${NC}"
836
+ else
837
+ echo -e " ${DIM}Checking golem installation health...${NC}"
838
+ fi
839
+ echo ""
840
+ fi
841
+
842
+ # Track check results for summary
843
+ local checks_passed=0
844
+ local checks_failed=0
845
+
846
+ # Helper: prompt user to apply a fix (or auto-apply in fix mode)
847
+ # Always returns 0 to avoid triggering set -e
848
+ apply_fix() {
849
+ local description="$1"
850
+ local fix_cmd="$2"
851
+
852
+ fixes_available=$((fixes_available + 1))
853
+
854
+ if [[ "$fix_mode" == "true" ]]; then
855
+ # Auto-fix mode: apply without prompting
856
+ [[ "$json_mode" == "false" ]] && echo -e " ${CYAN}→ Applying fix: $description${NC}"
857
+ if eval "$fix_cmd" 2>/dev/null; then
858
+ [[ "$json_mode" == "false" ]] && echo -e " ${GREEN}✓ Fixed${NC}"
859
+ fixes_applied=$((fixes_applied + 1))
860
+ else
861
+ [[ "$json_mode" == "false" ]] && echo -e " ${RED}✗ Fix failed${NC}"
862
+ fi
863
+ else
864
+ # Interactive mode: prompt user (only if stdin is a terminal and not json mode)
865
+ if [[ -t 0 ]] && [[ "$json_mode" == "false" ]]; then
866
+ echo -ne " ${YELLOW}Fix this? [y/N]${NC} "
867
+ local response=""
868
+ read -r response
869
+ if [[ "$response" =~ ^[Yy]$ ]]; then
870
+ echo -e " ${CYAN}→ Applying fix: $description${NC}"
871
+ if eval "$fix_cmd" 2>/dev/null; then
872
+ echo -e " ${GREEN}✓ Fixed${NC}"
873
+ fixes_applied=$((fixes_applied + 1))
874
+ else
875
+ echo -e " ${RED}✗ Fix failed${NC}"
876
+ fi
877
+ else
878
+ echo -e " ${DIM}Skipped${NC}"
879
+ fi
880
+ elif [[ "$json_mode" == "false" ]]; then
881
+ # Non-interactive: just show the hint
882
+ echo -e " ${DIM}Fix: $description${NC}"
883
+ fi
884
+ fi
885
+ return 0 # Always return 0 to continue script execution
886
+ }
887
+
888
+ # Helper function to run a check with optional auto-fix
889
+ # Always returns 0 to avoid triggering set -e; tracks failures internally
890
+ run_check() {
891
+ local name="$1"
892
+ local check_cmd="$2"
893
+ local fix_hint="$3"
894
+ local fix_cmd="${4:-}"
895
+ local check_status="pass"
896
+ local fixed=false
897
+
898
+ if eval "$check_cmd" 2>/dev/null; then
899
+ [[ "$json_mode" == "false" ]] && status_line "✓" "$GREEN" "$name"
900
+ checks_passed=$((checks_passed + 1))
901
+ check_status="pass"
902
+ else
903
+ [[ "$json_mode" == "false" ]] && status_line "✗" "$RED" "$name"
904
+ checks_failed=$((checks_failed + 1))
905
+ all_passed=false
906
+ check_status="fail"
907
+
908
+ # Attempt to fix if fix_cmd is provided
909
+ if [[ -n "$fix_cmd" ]]; then
910
+ apply_fix "$fix_hint" "$fix_cmd"
911
+ # Re-check after fix attempt
912
+ if eval "$check_cmd" 2>/dev/null; then
913
+ checks_passed=$((checks_passed + 1))
914
+ checks_failed=$((checks_failed - 1))
915
+ check_status="fixed"
916
+ fixed=true
917
+ fi
918
+ elif [[ -n "$fix_hint" ]] && [[ "$json_mode" == "false" ]]; then
919
+ echo -e " ${DIM}Fix: $fix_hint${NC}"
920
+ fi
921
+ fi
922
+
923
+ # Add to JSON checks array
924
+ local fix_available="false"
925
+ [[ -n "$fix_cmd" ]] && fix_available="true"
926
+ local escaped_name="${name//\"/\\\"}"
927
+ local escaped_hint="${fix_hint//\"/\\\"}"
928
+ json_checks+=("{\"name\":\"$escaped_name\",\"status\":\"$check_status\",\"fixable\":$fix_available,\"fix_hint\":\"$escaped_hint\"}")
929
+
930
+ return 0 # Always return 0 to continue script execution
931
+ }
932
+
933
+ # === Global Installation Checks ===
934
+ [[ "$json_mode" == "false" ]] && echo -e " ${BOLD}Global Installation (~/.golem/)${NC}"
935
+ [[ "$json_mode" == "false" ]] && echo ""
936
+
937
+ # Check ~/.golem directory exists
938
+ run_check "~/.golem/ directory exists" \
939
+ "[[ -d \"$HOME/.golem\" ]]" \
940
+ "Create directory" \
941
+ "mkdir -p \"$HOME/.golem\""
942
+
943
+ # Check ~/.golem/bin/golem exists and is executable
944
+ run_check "~/.golem/bin/golem is executable" \
945
+ "[[ -x \"$HOME/.golem/bin/golem\" ]]" \
946
+ "Fix permissions" \
947
+ "[[ -f \"$HOME/.golem/bin/golem\" ]] && chmod +x \"$HOME/.golem/bin/golem\""
948
+
949
+ # Check ~/.golem/bin/render-md.cjs exists
950
+ run_check "~/.golem/bin/render-md.cjs exists" \
951
+ "[[ -f \"$HOME/.golem/bin/render-md.cjs\" ]]" \
952
+ "npx golem-cc (reinstall)" \
953
+ ""
954
+
955
+ # Check ~/.golem/golem/prompts directory
956
+ run_check "~/.golem/golem/prompts/ exists" \
957
+ "[[ -d \"$HOME/.golem/golem/prompts\" ]]" \
958
+ "Create directory" \
959
+ "mkdir -p \"$HOME/.golem/golem/prompts\""
960
+
961
+ # Check ~/.golem/golem/agents directory
962
+ run_check "~/.golem/golem/agents/ exists" \
963
+ "[[ -d \"$HOME/.golem/golem/agents\" ]]" \
964
+ "Create directory" \
965
+ "mkdir -p \"$HOME/.golem/golem/agents\""
966
+
967
+ # Check VERSION file
968
+ run_check "~/.golem/VERSION file exists" \
969
+ "[[ -f \"$HOME/.golem/VERSION\" ]]" \
970
+ "npx golem-cc (reinstall)" \
971
+ ""
972
+
973
+ [[ "$json_mode" == "false" ]] && echo ""
974
+
975
+ # === Claude Code Integration Checks ===
976
+ [[ "$json_mode" == "false" ]] && echo -e " ${BOLD}Claude Code Integration (~/.claude/)${NC}"
977
+ [[ "$json_mode" == "false" ]] && echo ""
978
+
979
+ # Check ~/.claude/golem directory
980
+ run_check "~/.claude/golem/ directory exists" \
981
+ "[[ -d \"$HOME/.claude/golem\" ]]" \
982
+ "Create directory" \
983
+ "mkdir -p \"$HOME/.claude/golem\""
984
+
985
+ # Check ~/.claude/commands/golem directory with slash commands
986
+ run_check "~/.claude/commands/golem/ exists" \
987
+ "[[ -d \"$HOME/.claude/commands/golem\" ]]" \
988
+ "Create directory" \
989
+ "mkdir -p \"$HOME/.claude/commands/golem\""
990
+
991
+ # Check for key slash command files
992
+ run_check "Slash commands installed (build.md)" \
993
+ "[[ -f \"$HOME/.claude/commands/golem/build.md\" ]]" \
994
+ "npx golem-cc (reinstall)" \
995
+ ""
996
+
997
+ # Check ~/.claude/golem/prompts directory
998
+ run_check "~/.claude/golem/prompts/ exists" \
999
+ "[[ -d \"$HOME/.claude/golem/prompts\" ]]" \
1000
+ "Create directory" \
1001
+ "mkdir -p \"$HOME/.claude/golem/prompts\""
1002
+
1003
+ # Check ~/.claude/golem/agents directory
1004
+ run_check "~/.claude/golem/agents/ exists" \
1005
+ "[[ -d \"$HOME/.claude/golem/agents\" ]]" \
1006
+ "Create directory" \
1007
+ "mkdir -p \"$HOME/.claude/golem/agents\""
1008
+
1009
+ [[ "$json_mode" == "false" ]] && echo ""
1010
+
1011
+ # === Shell Integration Checks ===
1012
+ [[ "$json_mode" == "false" ]] && echo -e " ${BOLD}Shell Integration${NC}"
1013
+ [[ "$json_mode" == "false" ]] && echo ""
1014
+
1015
+ # Determine user's shell and config file
1016
+ local user_shell
1017
+ user_shell=$(basename "${SHELL:-/bin/bash}")
1018
+ local shell_config=""
1019
+ case "$user_shell" in
1020
+ zsh) shell_config="$HOME/.zshrc" ;;
1021
+ bash)
1022
+ if [[ -f "$HOME/.bash_profile" ]]; then
1023
+ shell_config="$HOME/.bash_profile"
1024
+ else
1025
+ shell_config="$HOME/.bashrc"
1026
+ fi
1027
+ ;;
1028
+ *) shell_config="$HOME/.profile" ;;
1029
+ esac
1030
+
1031
+ # Check if golem is in PATH (the function/alias should work)
1032
+ run_check "golem command available in PATH" \
1033
+ "command -v golem &>/dev/null" \
1034
+ "Add PATH to $shell_config" \
1035
+ "grep -q '.golem/bin' \"$shell_config\" 2>/dev/null || echo 'export PATH=\"\$HOME/.golem/bin:\$PATH\"' >> \"$shell_config\""
1036
+
1037
+ # Check shell config files for golem setup
1038
+ local shell_config_found=false
1039
+ local shell_configs=("$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.profile")
1040
+ for config in "${shell_configs[@]}"; do
1041
+ if [[ -f "$config" ]] && grep -q "golem" "$config" 2>/dev/null; then
1042
+ shell_config_found=true
1043
+ break
1044
+ fi
1045
+ done
1046
+ run_check "Shell config contains golem setup" \
1047
+ "$shell_config_found" \
1048
+ "Add PATH to $shell_config" \
1049
+ "grep -q '.golem/bin' \"$shell_config\" 2>/dev/null || echo 'export PATH=\"\$HOME/.golem/bin:\$PATH\"' >> \"$shell_config\""
1050
+
1051
+ [[ "$json_mode" == "false" ]] && echo ""
1052
+
1053
+ # === Optional Checks ===
1054
+ [[ "$json_mode" == "false" ]] && echo -e " ${BOLD}Optional Dependencies${NC}"
1055
+ [[ "$json_mode" == "false" ]] && echo ""
1056
+
1057
+ # Check if Claude Code CLI is installed
1058
+ if command -v claude &>/dev/null; then
1059
+ local claude_version
1060
+ claude_version=$(claude --version 2>/dev/null | head -1 || echo "unknown")
1061
+ [[ "$json_mode" == "false" ]] && status_line "✓" "$GREEN" "Claude Code CLI installed ($claude_version)"
1062
+ checks_passed=$((checks_passed + 1))
1063
+ json_checks+=("{\"name\":\"Claude Code CLI installed\",\"status\":\"pass\",\"fixable\":false,\"fix_hint\":\"npm install -g @anthropic-ai/claude-code\",\"version\":\"$claude_version\"}")
1064
+ else
1065
+ [[ "$json_mode" == "false" ]] && status_line "◦" "$YELLOW" "Claude Code CLI not found (required for golem)"
1066
+ [[ "$json_mode" == "false" ]] && echo -e " ${DIM}Install: npm install -g @anthropic-ai/claude-code${NC}"
1067
+ # This is critical, so count as failure
1068
+ checks_failed=$((checks_failed + 1))
1069
+ all_passed=false
1070
+ json_checks+=("{\"name\":\"Claude Code CLI installed\",\"status\":\"fail\",\"fixable\":false,\"fix_hint\":\"npm install -g @anthropic-ai/claude-code\"}")
1071
+ fi
1072
+
1073
+ [[ "$json_mode" == "false" ]] && echo ""
1074
+
1075
+ # === Project-Level Checks (if in a golem project) ===
1076
+ if [[ -d ".golem" ]]; then
1077
+ [[ "$json_mode" == "false" ]] && echo -e " ${BOLD}Project-Level (.golem/)${NC}"
1078
+ [[ "$json_mode" == "false" ]] && echo ""
1079
+
1080
+ run_check ".golem/ directory exists" \
1081
+ "[[ -d \".golem\" ]]" \
1082
+ "Create directory" \
1083
+ "mkdir -p .golem"
1084
+
1085
+ run_check ".golem/AGENTS.md exists" \
1086
+ "[[ -f \".golem/AGENTS.md\" ]]" \
1087
+ "Run golem --init" \
1088
+ ""
1089
+
1090
+ run_check ".golem/specs/ directory exists" \
1091
+ "[[ -d \".golem/specs\" ]]" \
1092
+ "Create directory" \
1093
+ "mkdir -p .golem/specs"
1094
+
1095
+ run_check ".golem/prompts/ directory exists" \
1096
+ "[[ -d \".golem/prompts\" ]]" \
1097
+ "Create directory" \
1098
+ "mkdir -p .golem/prompts"
1099
+
1100
+ run_check ".golem/agents/ directory exists" \
1101
+ "[[ -d \".golem/agents\" ]]" \
1102
+ "Create directory" \
1103
+ "mkdir -p .golem/agents"
1104
+
1105
+ [[ "$json_mode" == "false" ]] && echo ""
1106
+ fi
1107
+
1108
+ # === Summary ===
1109
+ local total=$((checks_passed + checks_failed))
1110
+ local version
1111
+ version=$(get_version)
1112
+
1113
+ # JSON output mode
1114
+ if [[ "$json_mode" == "true" ]]; then
1115
+ local json_checks_str
1116
+ json_checks_str=$(IFS=,; echo "${json_checks[*]}")
1117
+ local success="true"
1118
+ [[ $checks_failed -gt 0 ]] && success="false"
1119
+
1120
+ cat <<EOF
1121
+ {
1122
+ "success": $success,
1123
+ "version": "$version",
1124
+ "checks_passed": $checks_passed,
1125
+ "checks_failed": $checks_failed,
1126
+ "checks_total": $total,
1127
+ "fixes_applied": $fixes_applied,
1128
+ "fixes_available": $fixes_available,
1129
+ "checks": [$json_checks_str]
1130
+ }
1131
+ EOF
1132
+ if [[ $checks_failed -eq 0 ]]; then
1133
+ exit 0
1134
+ else
1135
+ exit 1
1136
+ fi
1137
+ fi
1138
+
1139
+ hr "━" "$CYAN"
1140
+ echo ""
1141
+
1142
+ # Show fixes applied if any
1143
+ if [[ $fixes_applied -gt 0 ]]; then
1144
+ status_line "⚡" "$CYAN" "$fixes_applied fix(es) applied"
1145
+ fi
1146
+
1147
+ # Recalculate pass status (fixes may have resolved issues)
1148
+ if [[ $checks_failed -eq 0 ]]; then
1149
+ status_line "✓" "$GREEN" "All checks passed ($checks_passed/$total)"
1150
+ echo ""
1151
+ if [[ $fixes_applied -gt 0 ]]; then
1152
+ echo -e " ${DIM}Note: You may need to restart your shell for PATH changes${NC}"
1153
+ echo ""
1154
+ fi
1155
+ exit 0
1156
+ else
1157
+ status_line "✗" "$RED" "$checks_failed check(s) failed ($checks_passed/$total passed)"
1158
+ echo ""
1159
+ if [[ "$fix_mode" == "false" ]] && [[ $fixes_available -gt 0 ]]; then
1160
+ echo -e " ${DIM}Run 'golem doctor --fix' to auto-fix issues${NC}"
1161
+ else
1162
+ echo -e " ${DIM}Run 'npx golem-cc' to reinstall golem${NC}"
1163
+ fi
1164
+ echo ""
1165
+ exit 1
1166
+ fi
1167
+ }
1168
+
684
1169
  cmd_status() {
685
1170
  local check_only=false
1171
+ local skip_update_check=false
686
1172
 
687
1173
  # Parse options
688
1174
  while [[ $# -gt 0 ]]; do
@@ -691,6 +1177,10 @@ cmd_status() {
691
1177
  check_only=true
692
1178
  shift
693
1179
  ;;
1180
+ --skip-update-check)
1181
+ skip_update_check=true
1182
+ shift
1183
+ ;;
694
1184
  *)
695
1185
  shift
696
1186
  ;;
@@ -750,6 +1240,19 @@ cmd_status() {
750
1240
  done || echo -e " ${DIM}No commits yet${NC}"
751
1241
  fi
752
1242
  echo ""
1243
+
1244
+ # Check for updates (non-blocking, cached)
1245
+ if [[ "$skip_update_check" == "false" ]]; then
1246
+ local current_version
1247
+ current_version=$(get_version)
1248
+ local latest_version
1249
+ latest_version=$(check_for_update "$current_version")
1250
+
1251
+ if [[ -n "$latest_version" ]]; then
1252
+ echo -e " ${YELLOW}Update available:${NC} ${DIM}$current_version${NC} → ${GREEN}$latest_version${NC} ${DIM}(run: npx golem-cc)${NC}"
1253
+ echo ""
1254
+ fi
1255
+ fi
753
1256
  }
754
1257
 
755
1258
  # Main entry point
@@ -783,6 +1286,10 @@ main() {
783
1286
  shift
784
1287
  cmd_status "$@"
785
1288
  ;;
1289
+ doctor)
1290
+ shift
1291
+ cmd_doctor "$@"
1292
+ ;;
786
1293
  "")
787
1294
  # No command - just launch claude
788
1295
  claude
@@ -16,22 +16,22 @@ Execute the autonomous build loop: select a task, implement it, validate with te
16
16
  <context>
17
17
  Load specs:
18
18
  ```bash
19
- for f in specs/*.md; do echo "=== $f ==="; cat "$f"; echo; done 2>/dev/null
19
+ for f in .golem/specs/*.md; do echo "=== $f ==="; cat "$f"; echo; done 2>/dev/null
20
20
  ```
21
21
 
22
22
  Load operational guide:
23
23
  ```bash
24
- cat AGENTS.md 2>/dev/null || echo "No AGENTS.md - run /golem:spec first"
24
+ cat .golem/AGENTS.md 2>/dev/null || echo "No AGENTS.md - run /golem:spec first"
25
25
  ```
26
26
 
27
27
  Load implementation plan:
28
28
  ```bash
29
- cat IMPLEMENTATION_PLAN.md 2>/dev/null || echo "No plan - run /golem:plan first"
29
+ cat .golem/IMPLEMENTATION_PLAN.md 2>/dev/null || echo "No plan - run /golem:plan first"
30
30
  ```
31
31
 
32
32
  Check remaining tasks:
33
33
  ```bash
34
- grep -c '^\- \[ \]' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0"
34
+ grep -c '^\- \[ \]' .golem/IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0"
35
35
  ```
36
36
  </context>
37
37
 
@@ -39,9 +39,9 @@ grep -c '^\- \[ \]' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0"
39
39
 
40
40
  ## Pre-flight Checks
41
41
 
42
- 1. Verify IMPLEMENTATION_PLAN.md exists
43
- 2. Verify specs/ directory has files
44
- 3. Verify AGENTS.md has test commands
42
+ 1. Verify .golem/IMPLEMENTATION_PLAN.md exists
43
+ 2. Verify .golem/specs/ directory has files
44
+ 3. Verify .golem/AGENTS.md has test commands
45
45
  4. Check for remaining tasks
46
46
 
47
47
  If missing prerequisites, instruct user to run appropriate command first.
@@ -51,7 +51,7 @@ If missing prerequisites, instruct user to run appropriate command first.
51
51
  For each iteration:
52
52
 
53
53
  ### 1. Orient
54
- - Read the current IMPLEMENTATION_PLAN.md
54
+ - Read the current .golem/IMPLEMENTATION_PLAN.md
55
55
  - Review relevant specs for context
56
56
 
57
57
  ### 2. Select Task
@@ -71,17 +71,17 @@ For each iteration:
71
71
  - Keep changes minimal and focused
72
72
 
73
73
  ### 5. Validate (Backpressure)
74
- Run ALL gates from AGENTS.md. ALL must pass:
74
+ Run ALL gates from .golem/AGENTS.md. ALL must pass:
75
75
 
76
76
  ```bash
77
77
  # Run test command
78
- {test_command from AGENTS.md}
78
+ {test_command from .golem/AGENTS.md}
79
79
 
80
80
  # Run typecheck if configured
81
- {typecheck_command from AGENTS.md}
81
+ {typecheck_command from .golem/AGENTS.md}
82
82
 
83
83
  # Run lint if configured
84
- {lint_command from AGENTS.md}
84
+ {lint_command from .golem/AGENTS.md}
85
85
  ```
86
86
 
87
87
  If any gate fails:
@@ -103,7 +103,7 @@ Use the code-simplifier agent principles:
103
103
  Then re-run tests to confirm no regressions.
104
104
 
105
105
  ### 7. Update Plan
106
- Edit `IMPLEMENTATION_PLAN.md`:
106
+ Edit `.golem/IMPLEMENTATION_PLAN.md`:
107
107
  - Change `[ ]` to `[x]` for completed task
108
108
  - Update status counts
109
109
  - Add notes about discoveries
@@ -33,7 +33,7 @@ WORKFLOW
33
33
 
34
34
  1. /golem:spec Define requirements through conversation
35
35
  2. exit claude
36
- 3. golem run plan Generate IMPLEMENTATION_PLAN.md (headless)
36
+ 3. golem run plan Generate .golem/IMPLEMENTATION_PLAN.md (headless)
37
37
  4. golem run build Start autonomous coding loop (headless)
38
38
 
39
39
  Each build iteration:
@@ -43,12 +43,12 @@ Each build iteration:
43
43
  • Simplifies code
44
44
  • Commits and loops
45
45
 
46
- FILES
46
+ FILES (all in .golem/ directory)
47
47
 
48
- specs/ Requirement files (one per topic)
49
- AGENTS.md Operational commands (test, build, lint)
50
- IMPLEMENTATION_PLAN.md Task list with priorities
51
- .golem/ Configuration and prompts
48
+ .golem/specs/ Requirement files (one per topic)
49
+ .golem/AGENTS.md Operational commands (test, build, lint)
50
+ .golem/IMPLEMENTATION_PLAN.md Task list with priorities
51
+ .golem/prompts/ Configuration and prompts
52
52
 
53
53
  CLI USAGE (outside Claude)
54
54
 
@@ -5,7 +5,7 @@ allowed-tools: [Read, Write, Glob, Grep, Bash]
5
5
  ---
6
6
 
7
7
  <objective>
8
- Analyze specs versus existing code and create/update IMPLEMENTATION_PLAN.md with prioritized tasks.
8
+ Analyze specs versus existing code and create/update .golem/IMPLEMENTATION_PLAN.md with prioritized tasks.
9
9
  </objective>
10
10
 
11
11
  <execution_context>
@@ -15,17 +15,17 @@ Analyze specs versus existing code and create/update IMPLEMENTATION_PLAN.md with
15
15
  <context>
16
16
  Load all specs:
17
17
  ```bash
18
- for f in specs/*.md; do echo "=== $f ==="; cat "$f"; echo; done 2>/dev/null || echo "No specs found - run /golem:spec first"
18
+ for f in .golem/specs/*.md; do echo "=== $f ==="; cat "$f"; echo; done 2>/dev/null || echo "No specs found - run /golem:spec first"
19
19
  ```
20
20
 
21
21
  Load operational guide:
22
22
  ```bash
23
- cat AGENTS.md 2>/dev/null || echo "No AGENTS.md found"
23
+ cat .golem/AGENTS.md 2>/dev/null || echo "No AGENTS.md found"
24
24
  ```
25
25
 
26
26
  Existing plan (if any):
27
27
  ```bash
28
- cat IMPLEMENTATION_PLAN.md 2>/dev/null || echo "No existing plan"
28
+ cat .golem/IMPLEMENTATION_PLAN.md 2>/dev/null || echo "No existing plan"
29
29
  ```
30
30
  </context>
31
31
 
@@ -33,7 +33,7 @@ cat IMPLEMENTATION_PLAN.md 2>/dev/null || echo "No existing plan"
33
33
 
34
34
  ## 1. Read All Specs
35
35
 
36
- Read each file in `specs/` completely. Extract:
36
+ Read each file in `.golem/specs/` completely. Extract:
37
37
  - Concrete requirements (must have, should have)
38
38
  - Acceptance criteria
39
39
  - Technical constraints
@@ -76,13 +76,13 @@ Order tasks by:
76
76
 
77
77
  ## 6. Write Plan
78
78
 
79
- Create or update `IMPLEMENTATION_PLAN.md`:
79
+ Create or update `.golem/IMPLEMENTATION_PLAN.md`:
80
80
 
81
81
  ```markdown
82
82
  # Implementation Plan
83
83
 
84
84
  Generated: {ISO timestamp}
85
- Based on: specs/*.md
85
+ Based on: .golem/specs/*.md
86
86
 
87
87
  ## Status
88
88
  - Total tasks: N
@@ -112,14 +112,14 @@ Notes: {notes}
112
112
  - [ ] Gap analysis completed
113
113
  - [ ] Tasks are atomic and testable
114
114
  - [ ] Dependencies mapped correctly
115
- - [ ] IMPLEMENTATION_PLAN.md written
115
+ - [ ] .golem/IMPLEMENTATION_PLAN.md written
116
116
  - [ ] No code changes made (planning only)
117
117
  </success_criteria>
118
118
 
119
119
  <important>
120
120
  - Do NOT implement anything in planning mode
121
121
  - Do NOT modify source code
122
- - ONLY create/update IMPLEMENTATION_PLAN.md
122
+ - ONLY create/update .golem/IMPLEMENTATION_PLAN.md
123
123
  - Be thorough - missing tasks cause problems later
124
124
  - Tasks should be achievable in one iteration
125
125
  </important>
@@ -21,23 +21,23 @@ echo ""
21
21
  # Specs
22
22
  echo "SPECS"
23
23
  echo "─────"
24
- if [ -d "specs" ]; then
25
- count=$(ls -1 specs/*.md 2>/dev/null | wc -l | tr -d ' ')
24
+ if [ -d ".golem/specs" ]; then
25
+ count=$(ls -1 .golem/specs/*.md 2>/dev/null | wc -l | tr -d ' ')
26
26
  echo " Files: $count"
27
- for f in specs/*.md; do
27
+ for f in .golem/specs/*.md; do
28
28
  [ -f "$f" ] && echo " • $(basename "$f" .md)"
29
29
  done
30
30
  else
31
- echo " No specs/ directory - run /golem:spec"
31
+ echo " No .golem/specs/ directory - run /golem:spec"
32
32
  fi
33
33
  echo ""
34
34
 
35
35
  # Plan
36
36
  echo "IMPLEMENTATION PLAN"
37
37
  echo "───────────────────"
38
- if [ -f "IMPLEMENTATION_PLAN.md" ]; then
39
- total=$(grep -c '^\- \[' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0")
40
- done=$(grep -c '^\- \[x\]' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0")
38
+ if [ -f ".golem/IMPLEMENTATION_PLAN.md" ]; then
39
+ total=$(grep -c '^\- \[' .golem/IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0")
40
+ done=$(grep -c '^\- \[x\]' .golem/IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0")
41
41
  remaining=$((total - done))
42
42
  pct=$((done * 100 / (total > 0 ? total : 1)))
43
43
 
@@ -49,7 +49,7 @@ if [ -f "IMPLEMENTATION_PLAN.md" ]; then
49
49
 
50
50
  # Show next few tasks
51
51
  echo " Next tasks:"
52
- grep '^\- \[ \]' IMPLEMENTATION_PLAN.md 2>/dev/null | head -3 | while read line; do
52
+ grep '^\- \[ \]' .golem/IMPLEMENTATION_PLAN.md 2>/dev/null | head -3 | while read line; do
53
53
  echo " $line"
54
54
  done
55
55
  else
@@ -60,12 +60,12 @@ echo ""
60
60
  # AGENTS.md
61
61
  echo "OPERATIONAL GUIDE"
62
62
  echo "─────────────────"
63
- if [ -f "AGENTS.md" ]; then
64
- echo " ✓ AGENTS.md exists"
65
- test_cmd=$(grep -A1 '### Testing' AGENTS.md 2>/dev/null | tail -1 | tr -d '`')
63
+ if [ -f ".golem/AGENTS.md" ]; then
64
+ echo " ✓ .golem/AGENTS.md exists"
65
+ test_cmd=$(grep -A1 '### Testing' .golem/AGENTS.md 2>/dev/null | tail -1 | tr -d '`')
66
66
  [ -n "$test_cmd" ] && echo " Test: $test_cmd"
67
67
  else
68
- echo " No AGENTS.md - run /golem:spec"
68
+ echo " No .golem/AGENTS.md - run /golem:spec"
69
69
  fi
70
70
  echo ""
71
71
 
@@ -41,7 +41,7 @@ You simplify code and create a single, well-documented commit that covers both t
41
41
  - `*.test.ts`, `*.spec.ts` - test files
42
42
  - `*.d.ts` - type definitions
43
43
  - `*.config.*` - configuration
44
- - `IMPLEMENTATION_PLAN.md` - just stage it, don't simplify
44
+ - `.golem/IMPLEMENTATION_PLAN.md` - just stage it, don't simplify
45
45
 
46
46
  ## Commit Message Format
47
47
 
@@ -95,7 +95,7 @@ Simplified:
95
95
 
96
96
  3. Run tests to verify:
97
97
  ```bash
98
- {test_command from AGENTS.md}
98
+ {test_command from .golem/AGENTS.md}
99
99
  ```
100
100
 
101
101
  4. Stage any simplification changes:
@@ -5,13 +5,13 @@ You are in BUILD MODE. Implement ONE task from the plan, then exit.
5
5
  ## Phase 0: Orient
6
6
 
7
7
  Study these files to understand context:
8
- - @specs/* - All specification files
9
- - @AGENTS.md - Operational commands (test/build/lint)
10
- - @IMPLEMENTATION_PLAN.md - Current task list
8
+ - @.golem/specs/* - All specification files
9
+ - @.golem/AGENTS.md - Operational commands (test/build/lint)
10
+ - @.golem/IMPLEMENTATION_PLAN.md - Current task list
11
11
 
12
12
  ## Phase 1: Select Task
13
13
 
14
- 1. Read IMPLEMENTATION_PLAN.md
14
+ 1. Read .golem/IMPLEMENTATION_PLAN.md
15
15
  2. Pick the first incomplete task (marked `- [ ]`)
16
16
  3. Do NOT assume something is not implemented - search first
17
17
 
@@ -24,7 +24,7 @@ Study these files to understand context:
24
24
 
25
25
  ## Phase 3: Validate (Backpressure)
26
26
 
27
- Run commands from AGENTS.md in order. ALL must pass:
27
+ Run commands from .golem/AGENTS.md in order. ALL must pass:
28
28
  1. Tests
29
29
  2. Type check (if configured)
30
30
  3. Lint (if configured)
@@ -33,8 +33,8 @@ If ANY fails: fix the issue, then re-run ALL validation from the beginning.
33
33
 
34
34
  ## Phase 4: Complete
35
35
 
36
- 1. Update IMPLEMENTATION_PLAN.md - mark task `- [x]`
37
- 2. Update AGENTS.md learnings if you discovered something useful
36
+ 1. Update .golem/IMPLEMENTATION_PLAN.md - mark task `- [x]`
37
+ 2. Update .golem/AGENTS.md learnings if you discovered something useful
38
38
  3. Commit changes with descriptive message
39
39
  4. Exit
40
40
 
@@ -1,13 +1,13 @@
1
1
  # Planning Mode
2
2
 
3
- You are in PLANNING MODE. Analyze specs vs existing code and create IMPLEMENTATION_PLAN.md.
3
+ You are in PLANNING MODE. Analyze specs vs existing code and create .golem/IMPLEMENTATION_PLAN.md.
4
4
 
5
5
  ## Phase 0: Orient
6
6
 
7
7
  Study these files first:
8
- - @specs/* - All specification files
9
- - @AGENTS.md - Operational commands
10
- - @IMPLEMENTATION_PLAN.md - Current plan (if exists)
8
+ - @.golem/specs/* - All specification files
9
+ - @.golem/AGENTS.md - Operational commands
10
+ - @.golem/IMPLEMENTATION_PLAN.md - Current plan (if exists)
11
11
 
12
12
  ## Phase 1: Gap Analysis
13
13
 
@@ -19,7 +19,7 @@ Study these files first:
19
19
 
20
20
  ## Phase 2: Create Plan
21
21
 
22
- Write `IMPLEMENTATION_PLAN.md` with prioritized tasks:
22
+ Write `.golem/IMPLEMENTATION_PLAN.md` with prioritized tasks:
23
23
 
24
24
  ```markdown
25
25
  # Implementation Plan
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "golem-cc",
3
- "version": "0.2.2",
3
+ "version": "0.2.5",
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"