golem-cc 0.1.12 → 0.1.14
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/golem +106 -45
- package/commands/golem/spec.md +3 -2
- package/golem/agents/spec-builder.md +3 -2
- package/package.json +1 -1
package/bin/golem
CHANGED
|
@@ -275,30 +275,47 @@ run_plan_mode() {
|
|
|
275
275
|
echo -e "${DIM}Analyzing specs and creating implementation plan.${NC}"
|
|
276
276
|
echo ""
|
|
277
277
|
|
|
278
|
-
# Build
|
|
279
|
-
local
|
|
280
|
-
|
|
281
|
-
context+="DO NOT implement anything. Only create the plan.\n\n"
|
|
278
|
+
# Build prompt file (Ralph pattern: cat file | claude)
|
|
279
|
+
local prompt_file=$(mktemp)
|
|
280
|
+
trap "rm -f $prompt_file" EXIT
|
|
282
281
|
|
|
283
|
-
|
|
282
|
+
cat > "$prompt_file" << 'PROMPT_HEADER'
|
|
283
|
+
You are in PLANNING MODE. Your job is to analyze the specs and create IMPLEMENTATION_PLAN.md.
|
|
284
|
+
|
|
285
|
+
DO NOT implement anything. Only create the plan.
|
|
286
|
+
|
|
287
|
+
PROMPT_HEADER
|
|
288
|
+
|
|
289
|
+
# Add planning prompt if available
|
|
284
290
|
if [[ -f ".golem/prompts/PROMPT_plan.md" ]]; then
|
|
285
|
-
|
|
291
|
+
cat .golem/prompts/PROMPT_plan.md >> "$prompt_file"
|
|
292
|
+
echo "" >> "$prompt_file"
|
|
286
293
|
fi
|
|
287
294
|
|
|
288
|
-
|
|
295
|
+
echo "---" >> "$prompt_file"
|
|
296
|
+
echo "" >> "$prompt_file"
|
|
297
|
+
echo "# Specs" >> "$prompt_file"
|
|
298
|
+
echo "" >> "$prompt_file"
|
|
299
|
+
|
|
289
300
|
for spec in specs/*.md; do
|
|
290
301
|
if [[ -f "$spec" ]]; then
|
|
291
|
-
|
|
292
|
-
|
|
302
|
+
echo "## $(basename "$spec" .md)" >> "$prompt_file"
|
|
303
|
+
echo "" >> "$prompt_file"
|
|
304
|
+
cat "$spec" >> "$prompt_file"
|
|
305
|
+
echo "" >> "$prompt_file"
|
|
293
306
|
fi
|
|
294
307
|
done
|
|
295
308
|
|
|
296
309
|
if [[ -f "AGENTS.md" ]]; then
|
|
297
|
-
|
|
310
|
+
echo "---" >> "$prompt_file"
|
|
311
|
+
echo "" >> "$prompt_file"
|
|
312
|
+
echo "# Operational Guide" >> "$prompt_file"
|
|
313
|
+
echo "" >> "$prompt_file"
|
|
314
|
+
cat AGENTS.md >> "$prompt_file"
|
|
298
315
|
fi
|
|
299
316
|
|
|
300
|
-
# Run
|
|
301
|
-
|
|
317
|
+
# Run planning (Ralph pattern: cat PROMPT | claude -p)
|
|
318
|
+
cat "$prompt_file" | claude -p --allowedTools "Read,Write,Edit,Glob,Grep"
|
|
302
319
|
|
|
303
320
|
echo ""
|
|
304
321
|
echo -e "${GREEN}Planning complete.${NC}"
|
|
@@ -320,7 +337,7 @@ run_build_loop() {
|
|
|
320
337
|
|
|
321
338
|
if [[ ! -d "specs" ]] || [[ -z "$(ls -A specs/*.md 2>/dev/null)" ]]; then
|
|
322
339
|
echo -e "${YELLOW}No specs found.${NC}"
|
|
323
|
-
echo -e "Run ${CYAN}golem
|
|
340
|
+
echo -e "Run ${CYAN}/golem:spec${NC} in Claude first."
|
|
324
341
|
exit 1
|
|
325
342
|
fi
|
|
326
343
|
|
|
@@ -333,6 +350,8 @@ run_build_loop() {
|
|
|
333
350
|
|
|
334
351
|
local iteration=0
|
|
335
352
|
local start_time=$(date +%s)
|
|
353
|
+
local prompt_file=$(mktemp)
|
|
354
|
+
trap "rm -f $prompt_file" EXIT
|
|
336
355
|
|
|
337
356
|
while true; do
|
|
338
357
|
iteration=$((iteration + 1))
|
|
@@ -355,41 +374,58 @@ run_build_loop() {
|
|
|
355
374
|
echo -e "${BLUE} ITERATION $iteration │ $remaining tasks remaining${NC}"
|
|
356
375
|
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
357
376
|
|
|
358
|
-
# Get the current task (first incomplete) for context
|
|
359
|
-
local current_task=$(grep -A3 '^\- \[ \]' IMPLEMENTATION_PLAN.md 2>/dev/null | head -4)
|
|
360
|
-
|
|
361
377
|
# ═══════════════════════════════════════════════════════════
|
|
362
378
|
# STEP 1: IMPLEMENT
|
|
363
379
|
# ═══════════════════════════════════════════════════════════
|
|
364
380
|
echo ""
|
|
365
381
|
echo -e "${GREEN}▶ Step 1: Implement${NC}"
|
|
366
382
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
383
|
+
# Build prompt file (Ralph pattern)
|
|
384
|
+
cat > "$prompt_file" << 'IMPLEMENT_HEADER'
|
|
385
|
+
You are in BUILD MODE. Complete ONE task from the plan.
|
|
386
|
+
|
|
387
|
+
DO NOT commit - just implement, test, update the plan, and stage changes.
|
|
388
|
+
The commit will happen after simplification.
|
|
389
|
+
|
|
390
|
+
IMPLEMENT_HEADER
|
|
371
391
|
|
|
372
392
|
# Add build prompt if available
|
|
373
393
|
if [[ -f ".golem/prompts/PROMPT_build.md" ]]; then
|
|
374
|
-
|
|
394
|
+
cat .golem/prompts/PROMPT_build.md >> "$prompt_file"
|
|
395
|
+
echo "" >> "$prompt_file"
|
|
375
396
|
fi
|
|
376
397
|
|
|
377
|
-
|
|
398
|
+
echo "---" >> "$prompt_file"
|
|
399
|
+
echo "" >> "$prompt_file"
|
|
400
|
+
echo "# Specs" >> "$prompt_file"
|
|
401
|
+
echo "" >> "$prompt_file"
|
|
402
|
+
|
|
378
403
|
for spec in specs/*.md; do
|
|
379
404
|
if [[ -f "$spec" ]]; then
|
|
380
|
-
|
|
381
|
-
|
|
405
|
+
echo "## $(basename "$spec" .md)" >> "$prompt_file"
|
|
406
|
+
echo "" >> "$prompt_file"
|
|
407
|
+
cat "$spec" >> "$prompt_file"
|
|
408
|
+
echo "" >> "$prompt_file"
|
|
382
409
|
fi
|
|
383
410
|
done
|
|
384
411
|
|
|
385
412
|
if [[ -f "AGENTS.md" ]]; then
|
|
386
|
-
|
|
413
|
+
echo "---" >> "$prompt_file"
|
|
414
|
+
echo "" >> "$prompt_file"
|
|
415
|
+
echo "# Operational Guide" >> "$prompt_file"
|
|
416
|
+
echo "" >> "$prompt_file"
|
|
417
|
+
cat AGENTS.md >> "$prompt_file"
|
|
418
|
+
echo "" >> "$prompt_file"
|
|
387
419
|
fi
|
|
388
420
|
|
|
389
|
-
|
|
421
|
+
echo "---" >> "$prompt_file"
|
|
422
|
+
echo "" >> "$prompt_file"
|
|
423
|
+
echo "# Implementation Plan" >> "$prompt_file"
|
|
424
|
+
echo "" >> "$prompt_file"
|
|
425
|
+
cat IMPLEMENTATION_PLAN.md >> "$prompt_file"
|
|
390
426
|
|
|
391
|
-
# Run implementation
|
|
392
|
-
|
|
427
|
+
# Run implementation (Ralph pattern: cat PROMPT | claude -p)
|
|
428
|
+
cat "$prompt_file" | claude -p --allowedTools "Read,Write,Edit,Glob,Grep,Bash"
|
|
393
429
|
|
|
394
430
|
local exit_code=$?
|
|
395
431
|
if [[ $exit_code -ne 0 ]]; then
|
|
@@ -403,38 +439,63 @@ run_build_loop() {
|
|
|
403
439
|
echo -e "${GREEN}▶ Step 2: Simplify + Commit${NC}"
|
|
404
440
|
|
|
405
441
|
# Get staged files
|
|
406
|
-
local staged_files=$(git diff --cached --name-only 2>/dev/null | grep -E '\.(ts|tsx|js|jsx|py|go|rs)$' | grep -v '\.test\.' | grep -v '\.spec\.' | head -10)
|
|
442
|
+
local staged_files=$(git diff --cached --name-only 2>/dev/null | grep -E '\.(ts|tsx|js|jsx|py|go|rs|vue)$' | grep -v '\.test\.' | grep -v '\.spec\.' | head -10)
|
|
407
443
|
|
|
408
|
-
|
|
409
|
-
|
|
444
|
+
# Build simplify prompt file
|
|
445
|
+
cat > "$prompt_file" << 'SIMPLIFY_HEADER'
|
|
446
|
+
You are in SIMPLIFY + COMMIT MODE.
|
|
447
|
+
|
|
448
|
+
SIMPLIFY_HEADER
|
|
410
449
|
|
|
411
450
|
if [[ "$simplify" == "true" ]] && [[ -n "$staged_files" ]]; then
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
451
|
+
cat >> "$prompt_file" << 'SIMPLIFY_INSTRUCTIONS'
|
|
452
|
+
1. Simplify the staged source files (not tests)
|
|
453
|
+
2. Run tests to verify no regressions
|
|
454
|
+
3. Stage any changes from simplification
|
|
455
|
+
4. Create a single commit with a comprehensive message
|
|
456
|
+
|
|
457
|
+
SIMPLIFY_INSTRUCTIONS
|
|
416
458
|
|
|
417
459
|
# Add code-simplifier agent if available
|
|
418
460
|
if [[ -f ".golem/agents/code-simplifier.md" ]]; then
|
|
419
|
-
|
|
461
|
+
cat .golem/agents/code-simplifier.md >> "$prompt_file"
|
|
462
|
+
echo "" >> "$prompt_file"
|
|
420
463
|
fi
|
|
421
464
|
|
|
422
|
-
|
|
423
|
-
|
|
465
|
+
echo "---" >> "$prompt_file"
|
|
466
|
+
echo "" >> "$prompt_file"
|
|
467
|
+
echo "# Staged source files to simplify" >> "$prompt_file"
|
|
468
|
+
echo "" >> "$prompt_file"
|
|
469
|
+
echo "$staged_files" >> "$prompt_file"
|
|
470
|
+
echo "" >> "$prompt_file"
|
|
424
471
|
else
|
|
425
|
-
|
|
426
|
-
|
|
472
|
+
cat >> "$prompt_file" << 'NO_SIMPLIFY'
|
|
473
|
+
No source files to simplify. Just create the commit.
|
|
474
|
+
|
|
475
|
+
Use conventional commit format with a descriptive body.
|
|
476
|
+
|
|
477
|
+
NO_SIMPLIFY
|
|
427
478
|
fi
|
|
428
479
|
|
|
429
|
-
|
|
430
|
-
|
|
480
|
+
# Get current task for commit context
|
|
481
|
+
local current_task=$(grep -A3 '^\- \[ \]' IMPLEMENTATION_PLAN.md 2>/dev/null | head -4)
|
|
482
|
+
echo "---" >> "$prompt_file"
|
|
483
|
+
echo "" >> "$prompt_file"
|
|
484
|
+
echo "# Task that was just completed" >> "$prompt_file"
|
|
485
|
+
echo "" >> "$prompt_file"
|
|
486
|
+
echo "$current_task" >> "$prompt_file"
|
|
487
|
+
echo "" >> "$prompt_file"
|
|
431
488
|
|
|
432
489
|
if [[ -f "AGENTS.md" ]]; then
|
|
433
|
-
|
|
490
|
+
echo "---" >> "$prompt_file"
|
|
491
|
+
echo "" >> "$prompt_file"
|
|
492
|
+
echo "# Operational Guide (for running tests)" >> "$prompt_file"
|
|
493
|
+
echo "" >> "$prompt_file"
|
|
494
|
+
cat AGENTS.md >> "$prompt_file"
|
|
434
495
|
fi
|
|
435
496
|
|
|
436
|
-
# Run
|
|
437
|
-
|
|
497
|
+
# Run simplify + commit (Ralph pattern)
|
|
498
|
+
cat "$prompt_file" | claude -p --allowedTools "Read,Write,Edit,Glob,Grep,Bash"
|
|
438
499
|
|
|
439
500
|
exit_code=$?
|
|
440
501
|
if [[ $exit_code -ne 0 ]]; then
|
package/commands/golem/spec.md
CHANGED
|
@@ -145,8 +145,9 @@ When all specs and AGENTS.md are written:
|
|
|
145
145
|
```
|
|
146
146
|
Specs complete! Next steps:
|
|
147
147
|
1. Review specs/ files and adjust if needed
|
|
148
|
-
2.
|
|
149
|
-
3. Run
|
|
148
|
+
2. Exit Claude (type 'exit' or Ctrl+C)
|
|
149
|
+
3. Run 'golem run plan' in your terminal
|
|
150
|
+
4. Run 'golem run build' in your terminal
|
|
150
151
|
```
|
|
151
152
|
|
|
152
153
|
</process>
|
|
@@ -140,8 +140,9 @@ When all specs and AGENTS.md are written:
|
|
|
140
140
|
```
|
|
141
141
|
Next steps:
|
|
142
142
|
1. Review specs/ files and adjust if needed
|
|
143
|
-
2. Exit Claude
|
|
144
|
-
3. Run 'golem run
|
|
143
|
+
2. Exit Claude (type 'exit' or press Ctrl+C)
|
|
144
|
+
3. Run 'golem run plan' in your terminal to create implementation plan
|
|
145
|
+
4. Run 'golem run build' in your terminal to start autonomous coding
|
|
145
146
|
```
|
|
146
147
|
3. Ask if they want to make any changes before proceeding
|
|
147
148
|
|