-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-ai.js
More file actions
47 lines (36 loc) · 1.18 KB
/
test-ai.js
File metadata and controls
47 lines (36 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env node
/**
* Test script to verify the AI agent works correctly with opencode SDK
*/
import { ConfigManager } from './dist/modules/config.js';
import { AiAgent } from './dist/modules/aiAgent.js';
async function test() {
console.log('Testing AI Agent integration with opencode SDK...\n');
const configManager = new ConfigManager();
const config = configManager.loadConfig();
if (!config.ai?.enabled) {
console.error('Error: AI is not enabled. Run "codevf init" first.');
process.exit(1);
}
console.log('Config loaded successfully.');
console.log('AI enabled:', config.ai.enabled);
console.log('Provider:', config.ai.provider);
console.log();
const aiAgent = new AiAgent(configManager);
try {
console.log('Sending prompt: "hi"\n');
const result = await aiAgent.run('hi', {
verbose: true,
startServer: true
});
console.log('\n\nSuccess!');
console.log('Output length:', result.output.length);
console.log('Transcript entries:', result.transcript.length);
process.exit(0);
} catch (error) {
console.error('\nError:', error.message);
console.error('Stack:', error.stack);
process.exit(1);
}
}
test();