vipcare 0.3.23 → 0.3.25
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/vip.js +19 -6
- package/lib/synthesizer.js +33 -14
- package/package.json +1 -1
package/bin/vip.js
CHANGED
|
@@ -861,18 +861,31 @@ program.command('config')
|
|
|
861
861
|
.option('--json', 'Output as JSON')
|
|
862
862
|
.action((opts) => {
|
|
863
863
|
const cfg = loadConfig();
|
|
864
|
+
|
|
865
|
+
const toolStatus = {
|
|
866
|
+
bird: checkTool('bird'),
|
|
867
|
+
ddgs: (() => { try { execFileSync('python3', ['-c', 'import ddgs'], { stdio: 'ignore', timeout: 5000 }); return true; } catch { return checkTool('ddgs'); } })(),
|
|
868
|
+
claude: checkTool('claude'),
|
|
869
|
+
'yt-dlp': checkTool('yt-dlp'),
|
|
870
|
+
whisper: (() => { try { execFileSync('python3', ['-c', 'import whisper'], { stdio: 'ignore', timeout: 5000 }); return true; } catch { return checkTool('whisper'); } })(),
|
|
871
|
+
ai_backend: getBackendName(),
|
|
872
|
+
};
|
|
873
|
+
|
|
864
874
|
if (opts.json) {
|
|
865
|
-
console.log(JSON.stringify({
|
|
866
|
-
...cfg,
|
|
867
|
-
tools: { bird: checkTool('bird'), ai_backend: getBackendName() }
|
|
868
|
-
}, null, 2));
|
|
875
|
+
console.log(JSON.stringify({ ...cfg, tools: toolStatus }, null, 2));
|
|
869
876
|
return;
|
|
870
877
|
}
|
|
871
878
|
console.log(c.bold(c.cyan('Current config:')));
|
|
872
879
|
console.log(` Profiles dir: ${cfg.profiles_dir}`);
|
|
873
880
|
console.log(` Monitor interval: ${cfg.monitor_interval_hours}h`);
|
|
874
|
-
console.log(
|
|
875
|
-
|
|
881
|
+
console.log();
|
|
882
|
+
const ok = (v) => v ? c.green('available') : c.red('not found');
|
|
883
|
+
console.log(` Bird CLI: ${ok(toolStatus.bird)}`);
|
|
884
|
+
console.log(` DDGS: ${ok(toolStatus.ddgs)}`);
|
|
885
|
+
console.log(` Claude CLI: ${ok(toolStatus.claude)}`);
|
|
886
|
+
console.log(` yt-dlp: ${ok(toolStatus['yt-dlp'])}`);
|
|
887
|
+
console.log(` Whisper: ${ok(toolStatus.whisper)}`);
|
|
888
|
+
console.log(` AI backend: ${toolStatus.ai_backend !== 'none' ? c.green(toolStatus.ai_backend) : c.red('not found')}`);
|
|
876
889
|
});
|
|
877
890
|
|
|
878
891
|
// --- init ---
|
package/lib/synthesizer.js
CHANGED
|
@@ -34,21 +34,40 @@ function copilotAvailable() {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function callClaudeCli(prompt, timeout = 120000) {
|
|
37
|
-
//
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
// Write prompt to temp file, pass via -p flag reading from file
|
|
38
|
+
const tmpFile = path.join(os.tmpdir(), `vip-prompt-${Date.now()}.txt`);
|
|
39
|
+
try {
|
|
40
|
+
fs.writeFileSync(tmpFile, prompt);
|
|
41
|
+
// Try stdin pipe first
|
|
42
|
+
const result = spawnSync('claude', ['--print'], {
|
|
43
|
+
input: prompt,
|
|
44
|
+
encoding: 'utf-8',
|
|
45
|
+
timeout,
|
|
46
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
47
|
+
maxBuffer: 1024 * 1024 * 10,
|
|
48
|
+
});
|
|
49
|
+
if (result.error) {
|
|
50
|
+
throw new Error(`Claude CLI error: ${result.error.message}`);
|
|
51
|
+
}
|
|
52
|
+
if (result.status !== 0) {
|
|
53
|
+
const stderr = result.stderr?.trim() || '';
|
|
54
|
+
const stdout = result.stdout?.trim() || '';
|
|
55
|
+
// If stdin pipe failed, try with temp file
|
|
56
|
+
const result2 = spawnSync('sh', ['-c', `cat "${tmpFile}" | claude --print`], {
|
|
57
|
+
encoding: 'utf-8',
|
|
58
|
+
timeout,
|
|
59
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
60
|
+
maxBuffer: 1024 * 1024 * 10,
|
|
61
|
+
});
|
|
62
|
+
if (result2.status === 0 && result2.stdout?.trim()) {
|
|
63
|
+
return result2.stdout.trim();
|
|
64
|
+
}
|
|
65
|
+
throw new Error(`Claude CLI failed (exit ${result.status}): ${stderr || stdout || 'no output'}`);
|
|
66
|
+
}
|
|
67
|
+
return result.stdout.trim();
|
|
68
|
+
} finally {
|
|
69
|
+
try { fs.unlinkSync(tmpFile); } catch {}
|
|
50
70
|
}
|
|
51
|
-
return result.stdout.trim();
|
|
52
71
|
}
|
|
53
72
|
|
|
54
73
|
async function callAnthropicApi(prompt) {
|