golem-cc 0.1.27 → 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 +16 -4
- package/bin/install.cjs +9 -0
- package/bin/render-md.cjs +50 -0
- package/package.json +1 -1
package/bin/golem
CHANGED
|
@@ -476,8 +476,14 @@ run_plan_mode() {
|
|
|
476
476
|
fi
|
|
477
477
|
|
|
478
478
|
# Ralph pattern: cat PROMPT | claude -p
|
|
479
|
-
# Pipe through
|
|
480
|
-
|
|
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
|
|
481
487
|
cat "$prompt_file" | claude -p \
|
|
482
488
|
--dangerously-skip-permissions \
|
|
483
489
|
--model opus \
|
|
@@ -579,9 +585,15 @@ run_build_loop() {
|
|
|
579
585
|
log_event "ITERATION_START" "iteration=$iteration remaining=$remaining"
|
|
580
586
|
|
|
581
587
|
# Ralph pattern: cat PROMPT | claude -p
|
|
582
|
-
# Pipe through
|
|
588
|
+
# Pipe through markdown renderer for pretty output
|
|
583
589
|
local claude_exit=0
|
|
584
|
-
|
|
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
|
|
585
597
|
cat "$build_prompt" | claude -p \
|
|
586
598
|
--dangerously-skip-permissions \
|
|
587
599
|
--model opus \
|
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
|
+
});
|