golem-cc 0.1.26 → 0.1.28
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 +36 -8
- package/bin/install.cjs +9 -0
- package/bin/render-md.cjs +50 -0
- package/package.json +1 -1
package/bin/golem
CHANGED
|
@@ -476,10 +476,24 @@ run_plan_mode() {
|
|
|
476
476
|
fi
|
|
477
477
|
|
|
478
478
|
# Ralph pattern: cat PROMPT | claude -p
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
479
|
+
# Pipe through markdown renderer for pretty output
|
|
480
|
+
local render_md="$GOLEM_DIR/bin/render-md.cjs"
|
|
481
|
+
if [[ -x "$render_md" ]]; then
|
|
482
|
+
cat "$prompt_file" | claude -p \
|
|
483
|
+
--dangerously-skip-permissions \
|
|
484
|
+
--model opus \
|
|
485
|
+
--verbose 2>&1 | "$render_md"
|
|
486
|
+
elif command -v glow &>/dev/null; then
|
|
487
|
+
cat "$prompt_file" | claude -p \
|
|
488
|
+
--dangerously-skip-permissions \
|
|
489
|
+
--model opus \
|
|
490
|
+
--verbose 2>&1 | glow -s dark -
|
|
491
|
+
else
|
|
492
|
+
cat "$prompt_file" | claude -p \
|
|
493
|
+
--dangerously-skip-permissions \
|
|
494
|
+
--model opus \
|
|
495
|
+
--verbose
|
|
496
|
+
fi
|
|
483
497
|
|
|
484
498
|
echo ""
|
|
485
499
|
header_box "PLANNING COMPLETE" "$GREEN"
|
|
@@ -571,11 +585,25 @@ run_build_loop() {
|
|
|
571
585
|
log_event "ITERATION_START" "iteration=$iteration remaining=$remaining"
|
|
572
586
|
|
|
573
587
|
# Ralph pattern: cat PROMPT | claude -p
|
|
588
|
+
# Pipe through markdown renderer for pretty output
|
|
574
589
|
local claude_exit=0
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
590
|
+
local render_md="$GOLEM_DIR/bin/render-md.cjs"
|
|
591
|
+
if [[ -x "$render_md" ]]; then
|
|
592
|
+
cat "$build_prompt" | claude -p \
|
|
593
|
+
--dangerously-skip-permissions \
|
|
594
|
+
--model opus \
|
|
595
|
+
--verbose 2>&1 | "$render_md" || claude_exit=${PIPESTATUS[0]}
|
|
596
|
+
elif command -v glow &>/dev/null; then
|
|
597
|
+
cat "$build_prompt" | claude -p \
|
|
598
|
+
--dangerously-skip-permissions \
|
|
599
|
+
--model opus \
|
|
600
|
+
--verbose 2>&1 | glow -s dark - || claude_exit=${PIPESTATUS[0]}
|
|
601
|
+
else
|
|
602
|
+
cat "$build_prompt" | claude -p \
|
|
603
|
+
--dangerously-skip-permissions \
|
|
604
|
+
--model opus \
|
|
605
|
+
--verbose || claude_exit=$?
|
|
606
|
+
fi
|
|
579
607
|
|
|
580
608
|
local iter_end=$(date +%s)
|
|
581
609
|
local iter_duration=$((iter_end - iter_start))
|
package/bin/install.cjs
CHANGED
|
@@ -235,6 +235,15 @@ function install(isGlobal) {
|
|
|
235
235
|
fs.chmodSync(golemScriptDest, 0o755);
|
|
236
236
|
console.log(` ${green}✓${reset} Installed golem CLI to ~/.golem/bin/`);
|
|
237
237
|
|
|
238
|
+
// Copy markdown renderer
|
|
239
|
+
const renderMdSrc = path.join(src, 'bin', 'render-md.cjs');
|
|
240
|
+
const renderMdDest = path.join(binDir, 'render-md.cjs');
|
|
241
|
+
if (fs.existsSync(renderMdSrc)) {
|
|
242
|
+
fs.copyFileSync(renderMdSrc, renderMdDest);
|
|
243
|
+
fs.chmodSync(renderMdDest, 0o755);
|
|
244
|
+
console.log(` ${green}✓${reset} Installed markdown renderer`);
|
|
245
|
+
}
|
|
246
|
+
|
|
238
247
|
// Also copy golem directory for the CLI to reference
|
|
239
248
|
const golemDataSrc = path.join(src, 'golem');
|
|
240
249
|
const golemDataDest = path.join(golemHomeDir, 'golem');
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Simple markdown-to-terminal renderer
|
|
4
|
+
* No dependencies - just basic ANSI formatting
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const RESET = '\x1b[0m';
|
|
8
|
+
const BOLD = '\x1b[1m';
|
|
9
|
+
const DIM = '\x1b[2m';
|
|
10
|
+
const ITALIC = '\x1b[3m';
|
|
11
|
+
const CYAN = '\x1b[36m';
|
|
12
|
+
const GREEN = '\x1b[32m';
|
|
13
|
+
const YELLOW = '\x1b[33m';
|
|
14
|
+
const MAGENTA = '\x1b[35m';
|
|
15
|
+
|
|
16
|
+
function renderMarkdown(text) {
|
|
17
|
+
return text
|
|
18
|
+
// Headers
|
|
19
|
+
.replace(/^### (.+)$/gm, `${BOLD}${CYAN} $1${RESET}`)
|
|
20
|
+
.replace(/^## (.+)$/gm, `${BOLD}${CYAN} $1${RESET}`)
|
|
21
|
+
.replace(/^# (.+)$/gm, `${BOLD}${CYAN}$1${RESET}`)
|
|
22
|
+
// Bold
|
|
23
|
+
.replace(/\*\*(.+?)\*\*/g, `${BOLD}$1${RESET}`)
|
|
24
|
+
// Italic
|
|
25
|
+
.replace(/\*(.+?)\*/g, `${ITALIC}$1${RESET}`)
|
|
26
|
+
// Inline code
|
|
27
|
+
.replace(/`([^`]+)`/g, `${YELLOW}$1${RESET}`)
|
|
28
|
+
// Code blocks (simple - just dim them)
|
|
29
|
+
.replace(/```[\s\S]*?```/g, (match) => {
|
|
30
|
+
const code = match.replace(/```\w*\n?/g, '').replace(/```/g, '');
|
|
31
|
+
return `${DIM}${code}${RESET}`;
|
|
32
|
+
})
|
|
33
|
+
// Bullet points
|
|
34
|
+
.replace(/^(\s*)[-*] /gm, '$1• ')
|
|
35
|
+
// Checkboxes
|
|
36
|
+
.replace(/\[ \]/g, `${DIM}☐${RESET}`)
|
|
37
|
+
.replace(/\[x\]/gi, `${GREEN}☑${RESET}`)
|
|
38
|
+
// Horizontal rules
|
|
39
|
+
.replace(/^---+$/gm, `${DIM}────────────────────────────────────────${RESET}`)
|
|
40
|
+
// Links [text](url) - just show text
|
|
41
|
+
.replace(/\[([^\]]+)\]\([^)]+\)/g, `${CYAN}$1${RESET}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Read from stdin
|
|
45
|
+
let input = '';
|
|
46
|
+
process.stdin.setEncoding('utf8');
|
|
47
|
+
process.stdin.on('data', (chunk) => { input += chunk; });
|
|
48
|
+
process.stdin.on('end', () => {
|
|
49
|
+
console.log(renderMarkdown(input));
|
|
50
|
+
});
|