vralphy 0.5.6 → 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 -133
- 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/commands/build.d.ts
CHANGED
|
@@ -2,8 +2,5 @@ import { VralphyConfig } from '../lib/config.js';
|
|
|
2
2
|
export interface BuildOptions {
|
|
3
3
|
iterations?: number;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* Execute build mode
|
|
7
|
-
*/
|
|
8
5
|
export declare function buildCommand(config: VralphyConfig, options: BuildOptions): Promise<void>;
|
|
9
6
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAiD9F"}
|
package/dist/commands/build.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { existsSync } from 'fs';
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
2
|
import { getEngine } from '../lib/engines/index.js';
|
|
3
|
-
import { loadPrompt, interpolatePrompt, DEFAULT_BUILD_PROMPT } from '../lib/prompts.js';
|
|
4
|
-
/**
|
|
5
|
-
* Execute build mode
|
|
6
|
-
*/
|
|
7
3
|
export async function buildCommand(config, options) {
|
|
8
4
|
const engine = getEngine(config.engine);
|
|
9
5
|
if (!(await engine.isAvailable())) {
|
|
@@ -12,58 +8,28 @@ export async function buildCommand(config, options) {
|
|
|
12
8
|
}
|
|
13
9
|
const maxIterations = options.iterations ?? 0;
|
|
14
10
|
let iteration = 0;
|
|
15
|
-
console.log(
|
|
16
|
-
console.log(`
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
console.log(`\n=== vralphy build | ${config.engine} | ${config.model} ===`);
|
|
12
|
+
console.log(`Max iterations: ${maxIterations || 'unlimited'}\n`);
|
|
13
|
+
// Find prompt file
|
|
14
|
+
const promptPaths = ['.vralphy/prompts/build.md', 'PROMPT_build.md'];
|
|
15
|
+
const promptPath = promptPaths.find(p => existsSync(p));
|
|
16
|
+
if (!promptPath) {
|
|
17
|
+
console.error('No build prompt found. Create .vralphy/prompts/build.md or PROMPT_build.md');
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
23
20
|
while (true) {
|
|
24
21
|
if (maxIterations > 0 && iteration >= maxIterations) {
|
|
25
|
-
console.log(
|
|
22
|
+
console.log(`\nReached max iterations (${maxIterations})`);
|
|
26
23
|
break;
|
|
27
24
|
}
|
|
28
|
-
console.log(`\n
|
|
29
|
-
|
|
30
|
-
const promptContext = {
|
|
31
|
-
model: config.model,
|
|
32
|
-
executor: config.executor,
|
|
33
|
-
engine: config.engine,
|
|
34
|
-
};
|
|
35
|
-
// Find first existing prompt file
|
|
36
|
-
const existingPromptPath = promptPaths.find(p => existsSync(p));
|
|
37
|
-
if (existingPromptPath) {
|
|
38
|
-
prompt = await loadPrompt(existingPromptPath, promptContext);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// Use default prompt with lazy loading section already included
|
|
42
|
-
prompt = interpolatePrompt(DEFAULT_BUILD_PROMPT, promptContext);
|
|
43
|
-
}
|
|
25
|
+
console.log(`\n--- Iteration ${iteration + 1} ---\n`);
|
|
26
|
+
const prompt = readFileSync(promptPath, 'utf-8');
|
|
44
27
|
if (config.dryRun) {
|
|
45
|
-
console.log('
|
|
46
|
-
console.log(prompt.slice(0, 500) + '...');
|
|
47
|
-
console.log('--- END DRY RUN ---');
|
|
28
|
+
console.log('DRY RUN:', prompt.slice(0, 200) + '...');
|
|
48
29
|
break;
|
|
49
30
|
}
|
|
50
31
|
try {
|
|
51
|
-
|
|
52
|
-
model: config.model,
|
|
53
|
-
executor: config.executor,
|
|
54
|
-
headless: true,
|
|
55
|
-
skipPermissions: true,
|
|
56
|
-
outputFormat: 'stream-json',
|
|
57
|
-
verbose: config.verbose,
|
|
58
|
-
reasoningEffort: config.reasoningEffort,
|
|
59
|
-
})) {
|
|
60
|
-
if (chunk.type === 'text' && chunk.content) {
|
|
61
|
-
process.stdout.write(chunk.content);
|
|
62
|
-
}
|
|
63
|
-
else if (chunk.type === 'error') {
|
|
64
|
-
console.error('Error:', chunk.error);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
32
|
+
await engine.run(prompt, { model: config.model });
|
|
67
33
|
}
|
|
68
34
|
catch (e) {
|
|
69
35
|
console.error('Execution failed:', e);
|
|
@@ -71,6 +37,6 @@ export async function buildCommand(config, options) {
|
|
|
71
37
|
}
|
|
72
38
|
iteration++;
|
|
73
39
|
}
|
|
74
|
-
console.log(`\
|
|
40
|
+
console.log(`\nDone after ${iteration} iteration(s)`);
|
|
75
41
|
}
|
|
76
42
|
//# sourceMappingURL=build.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMpD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAqB,EAAE,OAAqB;IAC7E,MA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,CAAC;YAClB,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;YACtD,MAAM;QACR,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,SAAS,EAAE,CAAC;IACd,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,gBAAgB,SAAS,eAAe,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
export interface InitCommandOptions {
|
|
2
2
|
from?: string;
|
|
3
|
-
noAi?: boolean;
|
|
4
|
-
approve?: boolean;
|
|
5
|
-
engine?: string;
|
|
6
|
-
verbose?: boolean;
|
|
7
3
|
}
|
|
8
|
-
/**
|
|
9
|
-
* Execute init command
|
|
10
|
-
*/
|
|
11
4
|
export declare function initCommand(options: InitCommandOptions): Promise<void>;
|
|
12
5
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2B5E"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,91 +1,26 @@
|
|
|
1
|
-
import { createInterface } from 'readline';
|
|
2
1
|
import { initProject } from '../lib/init.js';
|
|
3
|
-
/**
|
|
4
|
-
* Prompt user for confirmation
|
|
5
|
-
*/
|
|
6
|
-
async function confirm(message) {
|
|
7
|
-
const rl = createInterface({
|
|
8
|
-
input: process.stdin,
|
|
9
|
-
output: process.stdout,
|
|
10
|
-
});
|
|
11
|
-
return new Promise((resolve) => {
|
|
12
|
-
rl.question(`${message} [y/N] `, (answer) => {
|
|
13
|
-
rl.close();
|
|
14
|
-
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Execute init command
|
|
20
|
-
*/
|
|
21
2
|
export async function initCommand(options) {
|
|
22
3
|
const dir = options.from ?? process.cwd();
|
|
23
|
-
console.log(`Initializing vralphy in: ${dir}`);
|
|
24
|
-
// Build init options
|
|
25
|
-
const initOptions = {
|
|
26
|
-
noAi: options.noAi,
|
|
27
|
-
approve: options.approve,
|
|
28
|
-
verbose: options.verbose,
|
|
29
|
-
};
|
|
30
|
-
// Validate engine if specified
|
|
31
|
-
if (options.engine) {
|
|
32
|
-
const validEngines = ['claude', 'opencode', 'codex'];
|
|
33
|
-
if (!validEngines.includes(options.engine)) {
|
|
34
|
-
console.error(`Invalid engine: ${options.engine}. Valid options: ${validEngines.join(', ')}`);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
initOptions.engine = options.engine;
|
|
38
|
-
}
|
|
4
|
+
console.log(`Initializing vralphy in: ${dir}\n`);
|
|
39
5
|
try {
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
console.log('\n--- Generated AGENTS.md Preview ---\n');
|
|
46
|
-
console.log(result.agentsMdContent);
|
|
47
|
-
console.log('\n--- End Preview ---\n');
|
|
48
|
-
const approved = await confirm('Save this AGENTS.md?');
|
|
49
|
-
if (!approved) {
|
|
50
|
-
console.log('Initialization cancelled.');
|
|
51
|
-
process.exit(0);
|
|
52
|
-
}
|
|
6
|
+
const { created, skipped } = await initProject(dir);
|
|
7
|
+
if (created.length > 0) {
|
|
8
|
+
console.log('Created:');
|
|
9
|
+
for (const file of created) {
|
|
10
|
+
console.log(` + ${file}`);
|
|
53
11
|
}
|
|
54
|
-
// Report results
|
|
55
|
-
reportResults(result.created, result.skipped);
|
|
56
12
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
13
|
+
if (skipped.length > 0) {
|
|
14
|
+
console.log('\nSkipped (already exist):');
|
|
15
|
+
for (const file of skipped) {
|
|
16
|
+
console.log(` - ${file}`);
|
|
17
|
+
}
|
|
61
18
|
}
|
|
62
|
-
console.log('\
|
|
63
|
-
console.log('\nNext steps:');
|
|
64
|
-
console.log(' 1. Review and customize .vralphy/AGENTS.md');
|
|
65
|
-
console.log(' 2. Create specs in specs/ directory');
|
|
66
|
-
console.log(' 3. Run: vralphy plan');
|
|
67
|
-
console.log(' 4. Run: vralphy build');
|
|
19
|
+
console.log('\nDone! Edit .vralphy/prompts/ and run: vralphy plan');
|
|
68
20
|
}
|
|
69
21
|
catch (e) {
|
|
70
22
|
console.error('Initialization failed:', e);
|
|
71
23
|
process.exit(1);
|
|
72
24
|
}
|
|
73
25
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Report created and skipped files
|
|
76
|
-
*/
|
|
77
|
-
function reportResults(created, skipped) {
|
|
78
|
-
if (created.length > 0) {
|
|
79
|
-
console.log('\nCreated:');
|
|
80
|
-
for (const file of created) {
|
|
81
|
-
console.log(` + ${file}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (skipped.length > 0) {
|
|
85
|
-
console.log('\nSkipped (already exist):');
|
|
86
|
-
for (const file of skipped) {
|
|
87
|
-
console.log(` - ${file}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
26
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAM7C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAA2B;IAC3D,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1C,OAAO,CAAC,GAAG,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAAC;IAEjD,IAAI,CAAC;QACH,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;QAEpD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACxB,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;gBAC3B,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAC1C,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;gBAC3B,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/commands/plan.d.ts
CHANGED
|
@@ -2,8 +2,5 @@ import { VralphyConfig } from '../lib/config.js';
|
|
|
2
2
|
export interface PlanOptions {
|
|
3
3
|
iterations?: number;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* Execute plan mode
|
|
7
|
-
*/
|
|
8
5
|
export declare function planCommand(config: VralphyConfig, options: PlanOptions): Promise<void>;
|
|
9
6
|
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiD5F"}
|
package/dist/commands/plan.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { existsSync } from 'fs';
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
2
|
import { getEngine } from '../lib/engines/index.js';
|
|
3
|
-
import { loadPrompt, interpolatePrompt, DEFAULT_PLAN_PROMPT } from '../lib/prompts.js';
|
|
4
|
-
/**
|
|
5
|
-
* Execute plan mode
|
|
6
|
-
*/
|
|
7
3
|
export async function planCommand(config, options) {
|
|
8
4
|
const engine = getEngine(config.engine);
|
|
9
5
|
if (!(await engine.isAvailable())) {
|
|
@@ -12,58 +8,28 @@ export async function planCommand(config, options) {
|
|
|
12
8
|
}
|
|
13
9
|
const maxIterations = options.iterations ?? 0;
|
|
14
10
|
let iteration = 0;
|
|
15
|
-
console.log(
|
|
16
|
-
console.log(`
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
console.log(`\n=== vralphy plan | ${config.engine} | ${config.model} ===`);
|
|
12
|
+
console.log(`Max iterations: ${maxIterations || 'unlimited'}\n`);
|
|
13
|
+
// Find prompt file
|
|
14
|
+
const promptPaths = ['.vralphy/prompts/plan.md', 'PROMPT_plan.md'];
|
|
15
|
+
const promptPath = promptPaths.find(p => existsSync(p));
|
|
16
|
+
if (!promptPath) {
|
|
17
|
+
console.error('No plan prompt found. Create .vralphy/prompts/plan.md or PROMPT_plan.md');
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
23
20
|
while (true) {
|
|
24
21
|
if (maxIterations > 0 && iteration >= maxIterations) {
|
|
25
|
-
console.log(
|
|
22
|
+
console.log(`\nReached max iterations (${maxIterations})`);
|
|
26
23
|
break;
|
|
27
24
|
}
|
|
28
|
-
console.log(`\n
|
|
29
|
-
|
|
30
|
-
const promptContext = {
|
|
31
|
-
model: config.model,
|
|
32
|
-
executor: config.executor,
|
|
33
|
-
engine: config.engine,
|
|
34
|
-
};
|
|
35
|
-
// Find first existing prompt file
|
|
36
|
-
const existingPromptPath = promptPaths.find(p => existsSync(p));
|
|
37
|
-
if (existingPromptPath) {
|
|
38
|
-
prompt = await loadPrompt(existingPromptPath, promptContext);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// Use default prompt with lazy loading section already included
|
|
42
|
-
prompt = interpolatePrompt(DEFAULT_PLAN_PROMPT, promptContext);
|
|
43
|
-
}
|
|
25
|
+
console.log(`\n--- Iteration ${iteration + 1} ---\n`);
|
|
26
|
+
const prompt = readFileSync(promptPath, 'utf-8');
|
|
44
27
|
if (config.dryRun) {
|
|
45
|
-
console.log('
|
|
46
|
-
console.log(prompt.slice(0, 500) + '...');
|
|
47
|
-
console.log('--- END DRY RUN ---');
|
|
28
|
+
console.log('DRY RUN:', prompt.slice(0, 200) + '...');
|
|
48
29
|
break;
|
|
49
30
|
}
|
|
50
31
|
try {
|
|
51
|
-
|
|
52
|
-
model: config.model,
|
|
53
|
-
executor: config.executor,
|
|
54
|
-
headless: true,
|
|
55
|
-
skipPermissions: true,
|
|
56
|
-
outputFormat: 'stream-json',
|
|
57
|
-
verbose: config.verbose,
|
|
58
|
-
reasoningEffort: config.reasoningEffort,
|
|
59
|
-
})) {
|
|
60
|
-
if (chunk.type === 'text' && chunk.content) {
|
|
61
|
-
process.stdout.write(chunk.content);
|
|
62
|
-
}
|
|
63
|
-
else if (chunk.type === 'error') {
|
|
64
|
-
console.error('Error:', chunk.error);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
32
|
+
await engine.run(prompt, { model: config.model });
|
|
67
33
|
}
|
|
68
34
|
catch (e) {
|
|
69
35
|
console.error('Execution failed:', e);
|
|
@@ -71,6 +37,6 @@ export async function planCommand(config, options) {
|
|
|
71
37
|
}
|
|
72
38
|
iteration++;
|
|
73
39
|
}
|
|
74
|
-
console.log(`\
|
|
40
|
+
console.log(`\nDone after ${iteration} iteration(s)`);
|
|
75
41
|
}
|
|
76
42
|
//# sourceMappingURL=plan.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMpD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAqB,EAAE,OAAoB;IAC3E,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC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AU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;YACtD,MAAM;QACR,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,SAAS,EAAE,CAAC;IACd,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,gBAAgB,SAAS,eAAe,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/commands/spec.d.ts
CHANGED
|
@@ -2,8 +2,5 @@ import { VralphyConfig } from '../lib/config.js';
|
|
|
2
2
|
export interface SpecOptions {
|
|
3
3
|
topic?: string;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* Execute spec mode
|
|
7
|
-
*/
|
|
8
5
|
export declare function specCommand(config: VralphyConfig, options: SpecOptions): Promise<void>;
|
|
9
6
|
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/commands/spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/commands/spec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AASD,wBAAsB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C5F"}
|
package/dist/commands/spec.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { existsSync } from 'fs';
|
|
2
|
-
import { readdir
|
|
3
|
-
import { join } from 'path';
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { readdir } from 'fs/promises';
|
|
4
3
|
import { getEngine } from '../lib/engines/index.js';
|
|
5
|
-
import { loadPrompt, interpolatePrompt, DEFAULT_SPEC_PROMPT } from '../lib/prompts.js';
|
|
6
|
-
import { findProjectRoot } from '../lib/config.js';
|
|
7
|
-
/**
|
|
8
|
-
* List existing specs
|
|
9
|
-
*/
|
|
10
4
|
async function listSpecs() {
|
|
11
5
|
const specsDir = 'specs';
|
|
12
6
|
if (!existsSync(specsDir))
|
|
@@ -14,9 +8,6 @@ async function listSpecs() {
|
|
|
14
8
|
const files = await readdir(specsDir);
|
|
15
9
|
return files.filter((f) => f.endsWith('.md')).map((f) => f.replace('.md', ''));
|
|
16
10
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Execute spec mode
|
|
19
|
-
*/
|
|
20
11
|
export async function specCommand(config, options) {
|
|
21
12
|
const engine = getEngine(config.engine);
|
|
22
13
|
if (!(await engine.isAvailable())) {
|
|
@@ -30,84 +21,31 @@ export async function specCommand(config, options) {
|
|
|
30
21
|
for (const spec of existingSpecs) {
|
|
31
22
|
console.log(` - ${spec}`);
|
|
32
23
|
}
|
|
33
|
-
console.log('\nUsage: vralphy spec <topic>');
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
console.log('No specs found. Create one with: vralphy spec <topic>');
|
|
37
24
|
}
|
|
25
|
+
console.log('\nUsage: vralphy spec <topic>');
|
|
38
26
|
return;
|
|
39
27
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (!
|
|
45
|
-
console.
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
const projectRoot = findProjectRoot();
|
|
49
|
-
const projectName = projectRoot.split('/').pop() ?? 'project';
|
|
50
|
-
// Prompt locations in order of preference
|
|
51
|
-
const promptPaths = [
|
|
52
|
-
'.vralphy/prompts/spec.md', // New location
|
|
53
|
-
'PROMPT_spec.md', // Legacy location (backwards compat)
|
|
54
|
-
];
|
|
55
|
-
const promptContext = {
|
|
56
|
-
model: config.model,
|
|
57
|
-
executor: config.executor,
|
|
58
|
-
engine: config.engine,
|
|
59
|
-
topic,
|
|
60
|
-
projectName,
|
|
61
|
-
existingSpecs,
|
|
62
|
-
};
|
|
63
|
-
// Find first existing prompt file
|
|
64
|
-
const existingPromptPath = promptPaths.find(p => existsSync(p));
|
|
65
|
-
let prompt;
|
|
66
|
-
if (existingPromptPath) {
|
|
67
|
-
prompt = await loadPrompt(existingPromptPath, promptContext);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
prompt = interpolatePrompt(DEFAULT_SPEC_PROMPT, promptContext);
|
|
28
|
+
console.log(`\n=== vralphy spec | ${config.engine} | ${options.topic} ===\n`);
|
|
29
|
+
// Find prompt file
|
|
30
|
+
const promptPaths = ['.vralphy/prompts/spec.md', 'PROMPT_spec.md'];
|
|
31
|
+
const promptPath = promptPaths.find(p => existsSync(p));
|
|
32
|
+
if (!promptPath) {
|
|
33
|
+
console.error('No spec prompt found. Create .vralphy/prompts/spec.md or PROMPT_spec.md');
|
|
34
|
+
process.exit(1);
|
|
71
35
|
}
|
|
36
|
+
const prompt = readFileSync(promptPath, 'utf-8')
|
|
37
|
+
.replace('${topic}', options.topic);
|
|
72
38
|
if (config.dryRun) {
|
|
73
|
-
console.log('
|
|
74
|
-
console.log(prompt);
|
|
75
|
-
console.log('--- END DRY RUN ---');
|
|
39
|
+
console.log('DRY RUN:', prompt.slice(0, 200) + '...');
|
|
76
40
|
return;
|
|
77
41
|
}
|
|
78
|
-
let specContent = '';
|
|
79
42
|
try {
|
|
80
|
-
|
|
81
|
-
model: config.model,
|
|
82
|
-
executor: config.executor,
|
|
83
|
-
headless: false,
|
|
84
|
-
skipPermissions: false,
|
|
85
|
-
outputFormat: 'text',
|
|
86
|
-
verbose: config.verbose,
|
|
87
|
-
reasoningEffort: config.reasoningEffort,
|
|
88
|
-
})) {
|
|
89
|
-
if (chunk.type === 'text' && chunk.content) {
|
|
90
|
-
process.stdout.write(chunk.content);
|
|
91
|
-
specContent += chunk.content;
|
|
92
|
-
}
|
|
93
|
-
else if (chunk.type === 'error') {
|
|
94
|
-
console.error('Error:', chunk.error);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
43
|
+
await engine.run(prompt, { model: config.model });
|
|
97
44
|
}
|
|
98
45
|
catch (e) {
|
|
99
46
|
console.error('Execution failed:', e);
|
|
100
47
|
process.exit(1);
|
|
101
48
|
}
|
|
102
|
-
if
|
|
103
|
-
const specsDir = 'specs';
|
|
104
|
-
if (!existsSync(specsDir)) {
|
|
105
|
-
const { mkdir } = await import('fs/promises');
|
|
106
|
-
await mkdir(specsDir, { recursive: true });
|
|
107
|
-
}
|
|
108
|
-
const specPath = join(specsDir, `${topic}.md`);
|
|
109
|
-
await writeFile(specPath, specContent);
|
|
110
|
-
console.log(`\nSpec saved to: ${specPath}`);
|
|
111
|
-
}
|
|
49
|
+
console.log('\nSpec session complete. Save output to specs/ directory manually if needed.');
|
|
112
50
|
}
|
|
113
51
|
//# sourceMappingURL=spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/commands/spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/commands/spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMpD,KAAK,UAAU,SAAS;IACtB,MAAM,QAAQ,GAAG,OAAO,CAAC;IACzB,IAAI,CAAC,UAAU,CAA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