@eventmodelers/cli 1.0.84 → 1.0.86

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.
@@ -1,107 +0,0 @@
1
- #!/usr/bin/env node
2
- // Ralph loop + board poller using Claude Code as the executor.
3
- // Usage: node ralph-claude.js [project_dir]
4
-
5
- import { startRalph, loadLocalConfig } from './lib/ralph.js';
6
- import { spawn } from 'child_process';
7
- import { dirname, resolve } from 'path';
8
- import { fileURLToPath } from 'url';
9
-
10
- const kitDir = dirname(fileURLToPath(import.meta.url));
11
- const projectDir = process.argv[2] ? resolve(process.argv[2]) : resolve(kitDir, '..');
12
-
13
- const cfg = loadLocalConfig(kitDir);
14
- const localOnly = process.env.RALPH_LOCAL === '1';
15
- // --local must mean zero board contact — never hand Claude live board
16
- // credentials via the inline header, even if config.json has them, or it'll
17
- // treat them as already-connected and skip straight to board sync.
18
- const inlineHeader = !localOnly && cfg.boardId
19
- ? `board=${cfg.boardId} token=${cfg.token} org=${cfg.organizationId} baseUrl=${cfg.baseUrl}\n\n`
20
- : '';
21
-
22
- // --verbose here (set via `eventmodelers run --verbose`, passed down as RALPH_VERBOSE)
23
- // logs full tool input and assistant reasoning text; the default (condensed) mode logs
24
- // only the high-level step — a skill name, or a bare tool name — mirroring `run --modeling`'s
25
- // own two-tier logging in cli.js.
26
- const verbose = process.env.RALPH_VERBOSE === '1';
27
-
28
- const claudeArgs = ['--dangerously-skip-permissions', '--output-format', 'stream-json', '--verbose'];
29
- if (cfg.model) claudeArgs.push('--model', cfg.model);
30
- const claudeEnv = {
31
- ...process.env,
32
- ...(cfg.anthropicBaseUrl ? { ANTHROPIC_BASE_URL: cfg.anthropicBaseUrl } : {}),
33
- ...(cfg.token ? { EVENTMODELERS_TOKEN: cfg.token } : {}),
34
- };
35
-
36
- // Collapses whitespace/newlines to a single line and truncates past `max` chars — a long
37
- // multi-line curl command wrapped across many terminal lines is just as unreadable as no
38
- // detail at all. Keeps one tool call to one log line.
39
- function oneLine(s, max) {
40
- const collapsed = String(s ?? '').replace(/\s+/g, ' ').trim();
41
- return collapsed.length > max ? `${collapsed.slice(0, max)}…` : collapsed;
42
- }
43
-
44
- function describeToolUse(block) {
45
- const input = block.input ?? {};
46
- switch (block.name) {
47
- case 'Bash': return `Bash: ${oneLine(input.command, 100)}`;
48
- case 'Skill': return `Skill: ${input.skill}${input.args ? ` ${oneLine(input.args, 60)}` : ''}`;
49
- case 'Read': return `Read: ${input.file_path}`;
50
- case 'Edit': return `Edit: ${input.file_path}`;
51
- case 'Write': return `Write: ${input.file_path}`;
52
- case 'Grep': return `Grep: ${oneLine(input.pattern, 60)}`;
53
- case 'Glob': return `Glob: ${input.pattern}`;
54
- case 'WebFetch': return `WebFetch: ${input.url}`;
55
- case 'Agent': return `Agent: ${oneLine(input.description ?? input.subagent_type ?? '', 60)}`;
56
- default: return block.name;
57
- }
58
- }
59
-
60
- function runClaude(prompt) {
61
- return new Promise((resolve, reject) => {
62
- const proc = spawn('claude', [...claudeArgs, '-p', inlineHeader + prompt], {
63
- cwd: projectDir,
64
- stdio: ['inherit', 'pipe', 'inherit'],
65
- env: claudeEnv,
66
- });
67
-
68
- let buffer = '';
69
- proc.stdout.on('data', (chunk) => {
70
- buffer += chunk.toString();
71
- const lines = buffer.split('\n');
72
- buffer = lines.pop();
73
- for (const line of lines) {
74
- if (!line.trim()) continue;
75
- let msg;
76
- try { msg = JSON.parse(line); } catch { continue; }
77
-
78
- if (msg.type === 'assistant') {
79
- for (const block of msg.message?.content ?? []) {
80
- if (block.type === 'text' && block.text && verbose) console.log(block.text);
81
- if (block.type === 'tool_use') {
82
- if (verbose) console.log(`→ ${describeToolUse(block)}`);
83
- else if (block.name === 'Skill') console.log(`→ Skill: ${block.input?.skill ?? ''}`);
84
- else console.log(`→ ${block.name}`);
85
- }
86
- }
87
- } else if (msg.type === 'result') {
88
- console.log(`done (${msg.duration_ms}ms${msg.total_cost_usd ? `, $${msg.total_cost_usd.toFixed(4)}` : ''})`);
89
- }
90
- }
91
- });
92
-
93
- proc.on('close', (code) => (code === 0 ? resolve() : reject(new Error(`Claude exited ${code}`))));
94
- proc.on('error', reject);
95
- });
96
- }
97
-
98
- startRalph({
99
- kitDir,
100
- projectDir,
101
- onTask: runClaude,
102
- onPlannedSlice: runClaude,
103
- localOnly,
104
- }).catch((err) => {
105
- console.error('[ralph] Fatal:', err);
106
- process.exit(1);
107
- });
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env node
2
- // Ralph loop + board poller using a local AI model as the executor.
3
- // Backend is selected by dialect, not by a separate runner: Ollama (native
4
- // /api/chat) or any OpenAI-compatible server (vLLM, LM Studio, llama.cpp, TGI).
5
- //
6
- // Usage: node ralph-local-ai.js [project_dir]
7
- // LOCAL_AI_TARGET=ollama node ralph-local-ai.js # run `ollama serve` first
8
- // LOCAL_AI_TARGET=vllm node ralph-local-ai.js
9
- // LOCAL_AI_URL=http://gpu-box:8000/v1 LOCAL_AI_MODEL=Qwen/Qwen3-8B node ralph-local-ai.js
10
- import { startRalph } from './lib/ralph.js';
11
- import { spawn } from 'child_process';
12
- import { dirname, join, resolve } from 'path';
13
- import { fileURLToPath } from 'url';
14
-
15
- const kitDir = dirname(fileURLToPath(import.meta.url));
16
- const projectDir = process.argv[2] ? resolve(process.argv[2]) : resolve(kitDir, '..');
17
-
18
-
19
- function runLocalAi() {
20
- return new Promise((resolve, reject) => {
21
- const proc = spawn('node', [join(kitDir, 'lib', 'local-ai-agent.js')], {
22
- cwd: projectDir,
23
- stdio: 'inherit',
24
- env: process.env,
25
- });
26
- proc.on('close', (code) => (code === 0 ? resolve() : reject(new Error(`local-ai-agent exited ${code}`))));
27
- proc.on('error', reject);
28
- });
29
- }
30
-
31
- startRalph({
32
- kitDir,
33
- projectDir,
34
- onTask: runLocalAi,
35
- // onPlannedSlice omitted — local-ai-agent manages its own task queue
36
- localOnly: process.env.RALPH_LOCAL === '1',
37
- }).catch((err) => {
38
- console.error('[ralph] Fatal:', err);
39
- process.exit(1);
40
- });