vralphy 0.5.5 → 0.6.0
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/dist/commands/build.d.ts +0 -3
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +16 -50
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/init.d.ts +0 -7
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +12 -77
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/plan.d.ts +0 -3
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +16 -50
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/spec.d.ts +0 -3
- package/dist/commands/spec.d.ts.map +1 -1
- package/dist/commands/spec.js +15 -77
- package/dist/commands/spec.js.map +1 -1
- package/dist/index.js +20 -72
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +0 -23
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +4 -63
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/engines/base.d.ts +8 -59
- package/dist/lib/engines/base.d.ts.map +1 -1
- package/dist/lib/engines/base.js +5 -58
- package/dist/lib/engines/base.js.map +1 -1
- package/dist/lib/engines/claude.d.ts +2 -6
- package/dist/lib/engines/claude.d.ts.map +1 -1
- package/dist/lib/engines/claude.js +15 -121
- package/dist/lib/engines/claude.js.map +1 -1
- package/dist/lib/engines/codex.d.ts +2 -5
- package/dist/lib/engines/codex.d.ts.map +1 -1
- package/dist/lib/engines/codex.js +15 -61
- package/dist/lib/engines/codex.js.map +1 -1
- package/dist/lib/engines/index.d.ts +1 -11
- package/dist/lib/engines/index.d.ts.map +1 -1
- package/dist/lib/engines/index.js +0 -16
- package/dist/lib/engines/index.js.map +1 -1
- package/dist/lib/engines/opencode.d.ts +2 -6
- package/dist/lib/engines/opencode.d.ts.map +1 -1
- package/dist/lib/engines/opencode.js +14 -114
- package/dist/lib/engines/opencode.js.map +1 -1
- package/dist/lib/init.d.ts +1 -17
- package/dist/lib/init.d.ts.map +1 -1
- package/dist/lib/init.js +55 -245
- package/dist/lib/init.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,46 +10,38 @@ import { specCommand } from './commands/spec.js';
|
|
|
10
10
|
import { initCommand } from './commands/init.js';
|
|
11
11
|
import { cleanupCommand } from './commands/cleanup.js';
|
|
12
12
|
import { detectEngines } from './lib/engines/index.js';
|
|
13
|
-
import { listSkills } from './lib/skills.js';
|
|
14
|
-
import { listAgents } from './lib/agents.js';
|
|
15
|
-
import { getSkillsDir, getAgentsDir } from './lib/config.js';
|
|
16
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
14
|
const __dirname = dirname(__filename);
|
|
18
15
|
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
19
16
|
const program = new Command();
|
|
20
17
|
program
|
|
21
18
|
.name('vralphy')
|
|
22
|
-
.description('
|
|
19
|
+
.description('Ralph Playbook loop runner for Claude, OpenCode, and Codex')
|
|
23
20
|
.version(packageJson.version);
|
|
24
21
|
program
|
|
25
|
-
.option('--engine <engine>', 'Engine
|
|
26
|
-
.option('--model <model>', '
|
|
27
|
-
.option('--
|
|
28
|
-
.option('--
|
|
29
|
-
.option('--agents <path>', 'Agents directory')
|
|
30
|
-
.option('--config <path>', 'Config file (default: vralphy.config.json)')
|
|
31
|
-
.option('--reasoning-effort <level>', 'Reasoning effort level (e.g., high, xhigh)')
|
|
32
|
-
.option('--verbose', 'Verbose output', false)
|
|
33
|
-
.option('--dry-run', 'Show what would execute without running', false);
|
|
22
|
+
.option('--engine <engine>', 'Engine: claude, opencode, codex')
|
|
23
|
+
.option('--model <model>', 'Model to use')
|
|
24
|
+
.option('--verbose', 'Verbose output')
|
|
25
|
+
.option('--dry-run', 'Show prompt without running');
|
|
34
26
|
program
|
|
35
|
-
.command('
|
|
36
|
-
.description('Run
|
|
27
|
+
.command('plan [iterations]')
|
|
28
|
+
.description('Run planning loop')
|
|
37
29
|
.action(async (iterations) => {
|
|
38
30
|
const opts = program.opts();
|
|
39
31
|
const config = await resolveConfig(opts);
|
|
40
|
-
await
|
|
32
|
+
await planCommand(config, { iterations: iterations ? parseInt(iterations, 10) : undefined });
|
|
41
33
|
});
|
|
42
34
|
program
|
|
43
|
-
.command('
|
|
44
|
-
.description('Run
|
|
35
|
+
.command('build [iterations]')
|
|
36
|
+
.description('Run build loop')
|
|
45
37
|
.action(async (iterations) => {
|
|
46
38
|
const opts = program.opts();
|
|
47
39
|
const config = await resolveConfig(opts);
|
|
48
|
-
await
|
|
40
|
+
await buildCommand(config, { iterations: iterations ? parseInt(iterations, 10) : undefined });
|
|
49
41
|
});
|
|
50
42
|
program
|
|
51
43
|
.command('spec [topic]')
|
|
52
|
-
.description('
|
|
44
|
+
.description('Run spec session')
|
|
53
45
|
.action(async (topic) => {
|
|
54
46
|
const opts = program.opts();
|
|
55
47
|
const config = await resolveConfig(opts);
|
|
@@ -57,23 +49,16 @@ program
|
|
|
57
49
|
});
|
|
58
50
|
program
|
|
59
51
|
.command('init')
|
|
60
|
-
.description('Initialize project
|
|
61
|
-
.option('--from <path>', 'Initialize from
|
|
62
|
-
.option('--no-ai', 'Skip AI generation, use template fallback')
|
|
63
|
-
.option('--approve', 'Review AGENTS.md before saving')
|
|
64
|
-
.option('--engine <engine>', 'Specify engine for AI generation (claude|opencode|codex)')
|
|
52
|
+
.description('Initialize project')
|
|
53
|
+
.option('--from <path>', 'Initialize from path')
|
|
65
54
|
.action(async (cmdOpts) => {
|
|
66
|
-
|
|
67
|
-
// Commander parses --no-ai as ai: false, so we convert to noAi: true
|
|
68
|
-
const noAi = cmdOpts.ai === false;
|
|
69
|
-
await initCommand({ ...cmdOpts, noAi, verbose: globalOpts.verbose });
|
|
55
|
+
await initCommand(cmdOpts);
|
|
70
56
|
});
|
|
71
57
|
program
|
|
72
58
|
.command('cleanup')
|
|
73
59
|
.description('Remove vralphy from project')
|
|
74
|
-
.option('--from <path>', 'Clean up from
|
|
75
|
-
.option('--
|
|
76
|
-
.option('--force', 'Skip confirmation prompt')
|
|
60
|
+
.option('--from <path>', 'Clean up from path')
|
|
61
|
+
.option('--force', 'Skip confirmation')
|
|
77
62
|
.action(async (cmdOpts) => {
|
|
78
63
|
await cleanupCommand(cmdOpts);
|
|
79
64
|
});
|
|
@@ -87,48 +72,11 @@ program
|
|
|
87
72
|
console.log(` - ${engine}`);
|
|
88
73
|
}
|
|
89
74
|
if (available.length === 0) {
|
|
90
|
-
console.log(' (none
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
program
|
|
94
|
-
.command('skills')
|
|
95
|
-
.description('List available skills')
|
|
96
|
-
.action(async () => {
|
|
97
|
-
const opts = program.opts();
|
|
98
|
-
const config = await resolveConfig(opts);
|
|
99
|
-
const skillsDir = getSkillsDir(config.engine, config.skillsDir);
|
|
100
|
-
const skills = await listSkills(skillsDir);
|
|
101
|
-
if (skills.length === 0) {
|
|
102
|
-
console.log(`No skills found in: ${skillsDir}`);
|
|
103
|
-
console.log('Create .md files with frontmatter to add skills.');
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
console.log('Available skills:');
|
|
107
|
-
for (const skill of skills) {
|
|
108
|
-
console.log(` - ${skill.name}${skill.description ? `: ${skill.description}` : ''}`);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
program
|
|
112
|
-
.command('agents')
|
|
113
|
-
.description('List available agents')
|
|
114
|
-
.action(async () => {
|
|
115
|
-
const opts = program.opts();
|
|
116
|
-
const config = await resolveConfig(opts);
|
|
117
|
-
const agentsDir = getAgentsDir(config.engine, config.agentsDir);
|
|
118
|
-
const agents = await listAgents(agentsDir);
|
|
119
|
-
if (agents.length === 0) {
|
|
120
|
-
console.log(`No agents found in: ${agentsDir}`);
|
|
121
|
-
console.log('Create .md files with frontmatter to add agents.');
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
console.log('Available agents:');
|
|
125
|
-
for (const agent of agents) {
|
|
126
|
-
const model = agent.model ? ` (${agent.model})` : '';
|
|
127
|
-
console.log(` - ${agent.name}${model}${agent.description ? `: ${agent.description}` : ''}`);
|
|
75
|
+
console.log(' (none - install claude, opencode, or codex)');
|
|
128
76
|
}
|
|
129
77
|
});
|
|
130
|
-
|
|
131
|
-
|
|
78
|
+
// Default: run build
|
|
79
|
+
program.action(async () => {
|
|
132
80
|
const opts = program.opts();
|
|
133
81
|
const config = await resolveConfig(opts);
|
|
134
82
|
await buildCommand(config, {});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAiB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,E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AAC,SAAS,CAAC;KAClB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,eAAe,EAAE,oBAAoB,CAAC;KAC7C,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAC;KACtC,MAAM,CAAC,KAAK,EAAE,OAA2C,EAAE,EAAE;IAC5D,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,SAAS,GAAG,MAAM,aAAa,EAAE,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,OAAO,MAAM,EAAE,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,qBAAqB;AACrB,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IACxB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAmB,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -2,39 +2,16 @@ import { EngineName } from './engines/index.js';
|
|
|
2
2
|
export interface VralphyConfig {
|
|
3
3
|
engine: EngineName;
|
|
4
4
|
model: string;
|
|
5
|
-
executor: string;
|
|
6
|
-
skillsDir: string;
|
|
7
|
-
agentsDir: string;
|
|
8
5
|
verbose: boolean;
|
|
9
6
|
dryRun: boolean;
|
|
10
|
-
reasoningEffort?: string;
|
|
11
7
|
}
|
|
12
8
|
export interface ConfigOptions {
|
|
13
9
|
engine?: string;
|
|
14
10
|
model?: string;
|
|
15
|
-
executor?: string;
|
|
16
|
-
skills?: string;
|
|
17
|
-
agents?: string;
|
|
18
11
|
config?: string;
|
|
19
|
-
reasoningEffort?: string;
|
|
20
12
|
verbose?: boolean;
|
|
21
13
|
dryRun?: boolean;
|
|
22
14
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Resolve configuration from multiple sources
|
|
25
|
-
* Priority: CLI flags > env vars > config file > defaults
|
|
26
|
-
*/
|
|
27
15
|
export declare function resolveConfig(cliOptions: ConfigOptions): Promise<VralphyConfig>;
|
|
28
|
-
/**
|
|
29
|
-
* Determine skills directory based on engine
|
|
30
|
-
*/
|
|
31
|
-
export declare function getSkillsDir(engine: EngineName, customPath?: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* Determine agents directory based on engine
|
|
34
|
-
*/
|
|
35
|
-
export declare function getAgentsDir(engine: EngineName, customPath?: string): string;
|
|
36
|
-
/**
|
|
37
|
-
* Find project root by looking for common markers
|
|
38
|
-
*/
|
|
39
16
|
export declare function findProjectRoot(startDir?: string): string;
|
|
40
17
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAmBD,wBAAsB,aAAa,CAAC,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAUrF;AAED,wBAAgB,eAAe,CAAC,QAAQ,GAAE,MAAsB,GAAG,MAAM,CAYxE"}
|
package/dist/lib/config.js
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import { readFile } from 'fs/promises';
|
|
2
2
|
import { existsSync } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
|
-
import { validateModelForEngine } from './engines/base.js';
|
|
5
4
|
const DEFAULT_CONFIG = {
|
|
6
5
|
engine: 'claude',
|
|
7
|
-
model: '
|
|
8
|
-
executor: 'sonnet',
|
|
9
|
-
skillsDir: '.claude/skills',
|
|
10
|
-
agentsDir: 'agents',
|
|
6
|
+
model: 'sonnet',
|
|
11
7
|
verbose: false,
|
|
12
8
|
dryRun: false,
|
|
13
|
-
reasoningEffort: undefined,
|
|
14
9
|
};
|
|
15
|
-
/**
|
|
16
|
-
* Load config from file if it exists
|
|
17
|
-
*/
|
|
18
10
|
async function loadConfigFile(path) {
|
|
19
|
-
if (!existsSync(path))
|
|
11
|
+
if (!existsSync(path))
|
|
20
12
|
return {};
|
|
21
|
-
}
|
|
22
13
|
try {
|
|
23
14
|
const content = await readFile(path, 'utf-8');
|
|
24
15
|
return JSON.parse(content);
|
|
@@ -27,70 +18,20 @@ async function loadConfigFile(path) {
|
|
|
27
18
|
return {};
|
|
28
19
|
}
|
|
29
20
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Resolve configuration from multiple sources
|
|
32
|
-
* Priority: CLI flags > env vars > config file > defaults
|
|
33
|
-
*/
|
|
34
21
|
export async function resolveConfig(cliOptions) {
|
|
35
22
|
const configPath = cliOptions.config ?? 'vralphy.config.json';
|
|
36
23
|
const fileConfig = await loadConfigFile(configPath);
|
|
37
|
-
|
|
24
|
+
return {
|
|
38
25
|
engine: (cliOptions.engine ?? process.env.VRALPHY_ENGINE ?? fileConfig.engine ?? DEFAULT_CONFIG.engine),
|
|
39
26
|
model: cliOptions.model ?? process.env.VRALPHY_MODEL ?? fileConfig.model ?? DEFAULT_CONFIG.model,
|
|
40
|
-
executor: cliOptions.executor ?? process.env.VRALPHY_EXECUTOR ?? fileConfig.executor ?? DEFAULT_CONFIG.executor,
|
|
41
|
-
skillsDir: cliOptions.skills ?? fileConfig.skillsDir ?? DEFAULT_CONFIG.skillsDir,
|
|
42
|
-
agentsDir: cliOptions.agents ?? fileConfig.agentsDir ?? DEFAULT_CONFIG.agentsDir,
|
|
43
27
|
verbose: cliOptions.verbose ?? fileConfig.verbose ?? DEFAULT_CONFIG.verbose,
|
|
44
28
|
dryRun: cliOptions.dryRun ?? fileConfig.dryRun ?? DEFAULT_CONFIG.dryRun,
|
|
45
|
-
reasoningEffort: cliOptions.reasoningEffort ?? process.env.VRALPHY_REASONING_EFFORT ?? fileConfig.reasoningEffort ?? DEFAULT_CONFIG.reasoningEffort,
|
|
46
|
-
};
|
|
47
|
-
// Validate model is compatible with engine
|
|
48
|
-
validateModelForEngine(config.model, config.engine);
|
|
49
|
-
return config;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Determine skills directory based on engine
|
|
53
|
-
*/
|
|
54
|
-
export function getSkillsDir(engine, customPath) {
|
|
55
|
-
if (customPath)
|
|
56
|
-
return customPath;
|
|
57
|
-
const engineDirs = {
|
|
58
|
-
claude: '.claude/skills',
|
|
59
|
-
opencode: '.opencode/skills',
|
|
60
|
-
codex: '.codex/skills',
|
|
61
|
-
};
|
|
62
|
-
const engineDir = engineDirs[engine];
|
|
63
|
-
if (existsSync(engineDir))
|
|
64
|
-
return engineDir;
|
|
65
|
-
if (existsSync('skills'))
|
|
66
|
-
return 'skills';
|
|
67
|
-
return engineDir;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Determine agents directory based on engine
|
|
71
|
-
*/
|
|
72
|
-
export function getAgentsDir(engine, customPath) {
|
|
73
|
-
if (customPath)
|
|
74
|
-
return customPath;
|
|
75
|
-
const engineDirs = {
|
|
76
|
-
claude: '.claude/agents',
|
|
77
|
-
opencode: '.opencode/agents',
|
|
78
|
-
codex: '.codex/agents',
|
|
79
29
|
};
|
|
80
|
-
const engineDir = engineDirs[engine];
|
|
81
|
-
if (existsSync(engineDir))
|
|
82
|
-
return engineDir;
|
|
83
|
-
if (existsSync('agents'))
|
|
84
|
-
return 'agents';
|
|
85
|
-
return engineDir;
|
|
86
30
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Find project root by looking for common markers
|
|
89
|
-
*/
|
|
90
31
|
export function findProjectRoot(startDir = process.cwd()) {
|
|
91
32
|
let dir = startDir;
|
|
92
33
|
while (dir !== '/') {
|
|
93
|
-
const markers = ['package.json', 'Cargo.toml', 'go.mod', '.git'
|
|
34
|
+
const markers = ['package.json', 'Cargo.toml', 'go.mod', '.git'];
|
|
94
35
|
for (const marker of markers) {
|
|
95
36
|
if (existsSync(join(dir, marker))) {
|
|
96
37
|
return dir;
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,Q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U,eAAe,CAAC,WAAmB,OAAO,CAAC,GAAG,EAAE;IAC9D,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,CAAC,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;gBAClC,OAAO,GAAG,CAAC;YACb,CAAC;QACH,CAAC;QACD,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,68 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Simple engine interface - just run prompts
|
|
3
3
|
*/
|
|
4
|
-
export interface ExecuteOptions {
|
|
5
|
-
model: string;
|
|
6
|
-
executor: string;
|
|
7
|
-
headless: boolean;
|
|
8
|
-
skipPermissions: boolean;
|
|
9
|
-
outputFormat: 'stream-json' | 'text';
|
|
10
|
-
verbose: boolean;
|
|
11
|
-
skills?: string[];
|
|
12
|
-
agents?: string[];
|
|
13
|
-
reasoningEffort?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface Chunk {
|
|
16
|
-
type: 'text' | 'tool_use' | 'error' | 'done';
|
|
17
|
-
content?: string;
|
|
18
|
-
tool?: string;
|
|
19
|
-
error?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface EngineFlags {
|
|
22
|
-
model?: string;
|
|
23
|
-
skipPermissions?: boolean;
|
|
24
|
-
outputFormat?: 'stream-json' | 'text';
|
|
25
|
-
verbose?: boolean;
|
|
26
|
-
reasoningEffort?: string;
|
|
27
|
-
}
|
|
28
4
|
export interface Engine {
|
|
29
5
|
readonly name: string;
|
|
30
|
-
|
|
31
|
-
* Execute prompt with streaming output
|
|
32
|
-
*/
|
|
33
|
-
execute(prompt: string, options: ExecuteOptions): AsyncIterable<Chunk>;
|
|
34
|
-
/**
|
|
35
|
-
* Check if engine CLI is available
|
|
36
|
-
*/
|
|
6
|
+
run(prompt: string, options: RunOptions): Promise<void>;
|
|
37
7
|
isAvailable(): Promise<boolean>;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Whether engine supports interactive mode (AskUserQuestion)
|
|
44
|
-
*/
|
|
45
|
-
supportsInteractive(): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Get the CLI command name
|
|
48
|
-
*/
|
|
49
|
-
getCommand(): string;
|
|
8
|
+
}
|
|
9
|
+
export interface RunOptions {
|
|
10
|
+
model?: string;
|
|
11
|
+
skipPermissions?: boolean;
|
|
50
12
|
}
|
|
51
13
|
/**
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
export declare const MODEL_ALIASES_BY_ENGINE: Record<string, Record<string, string>>;
|
|
55
|
-
/**
|
|
56
|
-
* Backward compatibility: global aliases (Claude-only for now)
|
|
57
|
-
*/
|
|
58
|
-
export declare const MODEL_ALIASES: Record<string, string>;
|
|
59
|
-
/**
|
|
60
|
-
* Resolve model alias to full model ID
|
|
61
|
-
* Falls back to string if not found (allows full model IDs)
|
|
62
|
-
*/
|
|
63
|
-
export declare function resolveModel(model: string, engine?: string): string;
|
|
64
|
-
/**
|
|
65
|
-
* Validate that a model is compatible with the specified engine
|
|
14
|
+
* Check if a command exists
|
|
66
15
|
*/
|
|
67
|
-
export declare function
|
|
16
|
+
export declare function commandExists(cmd: string): boolean;
|
|
68
17
|
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/lib/engines/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/lib/engines/base.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGlD"}
|
package/dist/lib/engines/base.js
CHANGED
|
@@ -1,62 +1,9 @@
|
|
|
1
|
+
import { spawnSync } from 'child_process';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Check if a command exists
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const MODEL_ALIASES_BY_ENGINE = {
|
|
8
|
-
claude: {
|
|
9
|
-
opus: 'opus',
|
|
10
|
-
sonnet: 'sonnet',
|
|
11
|
-
haiku: 'haiku',
|
|
12
|
-
},
|
|
13
|
-
opencode: {
|
|
14
|
-
// OpenAI models
|
|
15
|
-
'gpt-4o': 'gpt-4o',
|
|
16
|
-
'gpt-4': 'gpt-4-turbo',
|
|
17
|
-
'o1': 'o1', // Reasoning model
|
|
18
|
-
'o1-mini': 'o1-mini', // Smaller reasoning model
|
|
19
|
-
'o1-preview': 'o1-preview',
|
|
20
|
-
},
|
|
21
|
-
codex: {
|
|
22
|
-
// Codex/DeepSeek models
|
|
23
|
-
'deepseek-chat': 'deepseek-chat',
|
|
24
|
-
'deepseek-r1': 'deepseek-r1', // Reasoning model
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Backward compatibility: global aliases (Claude-only for now)
|
|
29
|
-
*/
|
|
30
|
-
export const MODEL_ALIASES = MODEL_ALIASES_BY_ENGINE.claude;
|
|
31
|
-
/**
|
|
32
|
-
* Resolve model alias to full model ID
|
|
33
|
-
* Falls back to string if not found (allows full model IDs)
|
|
34
|
-
*/
|
|
35
|
-
export function resolveModel(model, engine = 'claude') {
|
|
36
|
-
const engineAliases = MODEL_ALIASES_BY_ENGINE[engine];
|
|
37
|
-
if (engineAliases) {
|
|
38
|
-
return engineAliases[model.toLowerCase()] ?? model;
|
|
39
|
-
}
|
|
40
|
-
return model;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Validate that a model is compatible with the specified engine
|
|
44
|
-
*/
|
|
45
|
-
export function validateModelForEngine(model, engine) {
|
|
46
|
-
const engineAliases = MODEL_ALIASES_BY_ENGINE[engine];
|
|
47
|
-
if (!engineAliases) {
|
|
48
|
-
return; // Unknown engine, skip validation
|
|
49
|
-
}
|
|
50
|
-
const normalizedModel = model.toLowerCase();
|
|
51
|
-
const isFullModelId = model.includes('/') || model.includes('-');
|
|
52
|
-
// Error if it looks like an alias for a different engine
|
|
53
|
-
for (const [otherEngine, aliases] of Object.entries(MODEL_ALIASES_BY_ENGINE)) {
|
|
54
|
-
if (otherEngine === engine)
|
|
55
|
-
continue;
|
|
56
|
-
if (normalizedModel in aliases) {
|
|
57
|
-
throw new Error(`Model '${model}' is a ${otherEngine} alias but you're using engine '${engine}'. ` +
|
|
58
|
-
`Use --engine ${otherEngine} or choose a compatible model.`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
5
|
+
export function commandExists(cmd) {
|
|
6
|
+
const result = spawnSync('which', [cmd], { stdio: 'ignore' });
|
|
7
|
+
return result.status === 0;
|
|
61
8
|
}
|
|
62
9
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/lib/engines/base.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/lib/engines/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAgB1C;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9D,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { Engine,
|
|
1
|
+
import { Engine, RunOptions } from './base.js';
|
|
2
2
|
export declare class ClaudeEngine implements Engine {
|
|
3
3
|
readonly name = "claude";
|
|
4
|
-
|
|
5
|
-
private parseStreamJson;
|
|
4
|
+
run(prompt: string, options: RunOptions): Promise<void>;
|
|
6
5
|
isAvailable(): Promise<boolean>;
|
|
7
|
-
getFlags(options: EngineFlags): string[];
|
|
8
|
-
supportsInteractive(): boolean;
|
|
9
|
-
getCommand(): string;
|
|
10
6
|
}
|
|
11
7
|
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/lib/engines/claude.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/lib/engines/claude.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAC;AAE9D,qBAAa,YAAa,YAAW,MAAM;IACzC,QAAQ,CAAC,IAAI,YAAY;IAEnB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BvD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAGtC"}
|