golem-cc 0.1.27 → 0.1.29
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 +24 -19
- package/bin/install.cjs +9 -0
- package/bin/render-md.cjs +50 -0
- package/package.json +1 -1
package/bin/golem
CHANGED
|
@@ -181,7 +181,6 @@ print_banner() {
|
|
|
181
181
|
echo " ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝"
|
|
182
182
|
echo -e "${NC}"
|
|
183
183
|
echo -e " ${DIM}\"Ruby's son is a doctor, and you're letting a computer write your code?\"${NC}"
|
|
184
|
-
echo ""
|
|
185
184
|
}
|
|
186
185
|
|
|
187
186
|
print_usage() {
|
|
@@ -237,20 +236,14 @@ cmd_install() {
|
|
|
237
236
|
mkdir -p .golem/specs
|
|
238
237
|
|
|
239
238
|
# Copy prompts and agents (don't overwrite existing)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if [[ "$copied_agents" == "false" ]]; then
|
|
250
|
-
echo -e "${YELLOW}⚠${NC} Could not copy agents from $GOLEM_DIR/golem/"
|
|
251
|
-
echo -e " ${DIM}Expected: $GOLEM_DIR/golem/agents/*.md${NC}"
|
|
252
|
-
echo -e " ${DIM}Spec building will use inline prompts instead${NC}"
|
|
253
|
-
echo -e " ${DIM}Try reinstalling: npx golem-cc --global${NC}"
|
|
239
|
+
if [[ -d "$GOLEM_DIR/golem/agents" ]] && [[ -d "$GOLEM_DIR/golem/prompts" ]]; then
|
|
240
|
+
# cp -n doesn't overwrite but returns error if file exists, so ignore exit code
|
|
241
|
+
cp -n "$GOLEM_DIR/golem/prompts/"*.md .golem/prompts/ 2>/dev/null || true
|
|
242
|
+
cp -n "$GOLEM_DIR/golem/agents/"*.md .golem/agents/ 2>/dev/null || true
|
|
243
|
+
echo -e "${GREEN}✓${NC} Synced prompts and agents"
|
|
244
|
+
else
|
|
245
|
+
echo -e "${YELLOW}⚠${NC} No global prompts/agents found"
|
|
246
|
+
echo -e " ${DIM}Run: npx golem-cc --global${NC}"
|
|
254
247
|
fi
|
|
255
248
|
|
|
256
249
|
# Create AGENTS.md if it doesn't exist
|
|
@@ -476,8 +469,14 @@ run_plan_mode() {
|
|
|
476
469
|
fi
|
|
477
470
|
|
|
478
471
|
# Ralph pattern: cat PROMPT | claude -p
|
|
479
|
-
# Pipe through
|
|
480
|
-
|
|
472
|
+
# Pipe through markdown renderer for pretty output
|
|
473
|
+
local render_md="$GOLEM_DIR/bin/render-md.cjs"
|
|
474
|
+
if [[ -x "$render_md" ]]; then
|
|
475
|
+
cat "$prompt_file" | claude -p \
|
|
476
|
+
--dangerously-skip-permissions \
|
|
477
|
+
--model opus \
|
|
478
|
+
--verbose 2>&1 | "$render_md"
|
|
479
|
+
elif command -v glow &>/dev/null; then
|
|
481
480
|
cat "$prompt_file" | claude -p \
|
|
482
481
|
--dangerously-skip-permissions \
|
|
483
482
|
--model opus \
|
|
@@ -579,9 +578,15 @@ run_build_loop() {
|
|
|
579
578
|
log_event "ITERATION_START" "iteration=$iteration remaining=$remaining"
|
|
580
579
|
|
|
581
580
|
# Ralph pattern: cat PROMPT | claude -p
|
|
582
|
-
# Pipe through
|
|
581
|
+
# Pipe through markdown renderer for pretty output
|
|
583
582
|
local claude_exit=0
|
|
584
|
-
|
|
583
|
+
local render_md="$GOLEM_DIR/bin/render-md.cjs"
|
|
584
|
+
if [[ -x "$render_md" ]]; then
|
|
585
|
+
cat "$build_prompt" | claude -p \
|
|
586
|
+
--dangerously-skip-permissions \
|
|
587
|
+
--model opus \
|
|
588
|
+
--verbose 2>&1 | "$render_md" || claude_exit=${PIPESTATUS[0]}
|
|
589
|
+
elif command -v glow &>/dev/null; then
|
|
585
590
|
cat "$build_prompt" | claude -p \
|
|
586
591
|
--dangerously-skip-permissions \
|
|
587
592
|
--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
|
+
});
|