vipcare 0.3.23 → 0.3.24

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.
Files changed (2) hide show
  1. package/lib/synthesizer.js +33 -14
  2. package/package.json +1 -1
@@ -34,21 +34,40 @@ function copilotAvailable() {
34
34
  }
35
35
 
36
36
  function callClaudeCli(prompt, timeout = 120000) {
37
- // Pipe prompt via stdin to avoid OS arg length limits on long prompts
38
- const result = spawnSync('claude', ['--print'], {
39
- input: prompt,
40
- encoding: 'utf-8',
41
- timeout,
42
- stdio: ['pipe', 'pipe', 'pipe'],
43
- maxBuffer: 1024 * 1024 * 10,
44
- });
45
- if (result.error) {
46
- throw new Error(result.error.message);
47
- }
48
- if (result.status !== 0) {
49
- throw new Error(result.stderr?.trim() || 'Claude CLI failed');
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vipcare",
3
- "version": "0.3.23",
3
+ "version": "0.3.24",
4
4
  "description": "Auto-build VIP person profiles from Twitter/LinkedIn public data",
5
5
  "type": "module",
6
6
  "bin": {