ventureos 1.0.7 → 1.0.9
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/install.js +82 -14
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -15,7 +15,7 @@ import { stdin as input, stdout as output } from 'process';
|
|
|
15
15
|
import fs from 'fs';
|
|
16
16
|
import path from 'path';
|
|
17
17
|
import { fileURLToPath } from 'url';
|
|
18
|
-
import { spawnSync } from 'child_process';
|
|
18
|
+
import { spawnSync, spawn } from 'child_process';
|
|
19
19
|
|
|
20
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
21
21
|
const PACKAGE_ROOT = path.dirname(__filename);
|
|
@@ -326,6 +326,19 @@ async function startChat() {
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
+
// ── If using Claude CLI, redirect to native Claude Code experience ─────────
|
|
330
|
+
if (useCLI && cliCmd === 'claude') {
|
|
331
|
+
console.log(line());
|
|
332
|
+
console.log(' Use Claude Code natively — it\'s a much better experience.\n');
|
|
333
|
+
console.log(' In Claude Code, start your VentureOS session by typing:\n');
|
|
334
|
+
console.log(' @ventureOS/venture-master.md\n');
|
|
335
|
+
console.log(' That gives you full markdown rendering, streaming, and all');
|
|
336
|
+
console.log(' native Claude Code features — no terminal wrapper needed.');
|
|
337
|
+
console.log(line() + '\n');
|
|
338
|
+
rl.close();
|
|
339
|
+
process.exit(0);
|
|
340
|
+
}
|
|
341
|
+
|
|
329
342
|
// ── Load system prompt ─────────────────────────────────────────────────────
|
|
330
343
|
const masterPath = path.join(projectRoot, 'ventureOS', 'venture-master.md');
|
|
331
344
|
let systemPrompt = fs.readFileSync(masterPath, 'utf8')
|
|
@@ -472,10 +485,50 @@ async function autoLoadAgents(response, messages, projectRoot) {
|
|
|
472
485
|
}
|
|
473
486
|
}
|
|
474
487
|
|
|
475
|
-
// ───
|
|
488
|
+
// ─── Markdown renderer (terminal-friendly, zero deps) ─────────────────────────
|
|
476
489
|
|
|
477
490
|
function indentText(text) {
|
|
478
|
-
|
|
491
|
+
const B = '\x1b[1m', D = '\x1b[2m', R = '\x1b[0m', C = '\x1b[36m';
|
|
492
|
+
let inCode = false;
|
|
493
|
+
const out = [];
|
|
494
|
+
|
|
495
|
+
for (const raw of text.split('\n')) {
|
|
496
|
+
// Code fence toggle
|
|
497
|
+
if (raw.trimStart().startsWith('```')) {
|
|
498
|
+
inCode = !inCode;
|
|
499
|
+
out.push(D + ' ' + '─'.repeat(40) + R);
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
if (inCode) { out.push(D + ' ' + raw + R); continue; }
|
|
503
|
+
|
|
504
|
+
// Horizontal rule
|
|
505
|
+
if (/^[-─]{3,}$/.test(raw.trim())) { out.push(' ' + '─'.repeat(50)); continue; }
|
|
506
|
+
|
|
507
|
+
// Headings
|
|
508
|
+
if (raw.startsWith('### ')) { out.push('\n ' + B + raw.slice(4).trim() + R); continue; }
|
|
509
|
+
if (raw.startsWith('## ')) { out.push('\n ' + B + raw.slice(3).trim() + R); continue; }
|
|
510
|
+
if (raw.startsWith('# ')) { out.push('\n ' + B + raw.slice(2).trim().toUpperCase() + R); continue; }
|
|
511
|
+
|
|
512
|
+
// Table separator — skip
|
|
513
|
+
if (/^\|[\s|:-]+\|$/.test(raw.trim())) continue;
|
|
514
|
+
|
|
515
|
+
// Table row
|
|
516
|
+
if (raw.trim().startsWith('|') && raw.trim().endsWith('|')) {
|
|
517
|
+
const cells = raw.split('|').slice(1, -1).map(c => c.trim());
|
|
518
|
+
out.push(' ' + cells.join(' │ ').replace(/\*\*(.+?)\*\*/g, B + '$1' + R));
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// Inline: bold, italic, code
|
|
523
|
+
const line = raw
|
|
524
|
+
.replace(/\*\*(.+?)\*\*/g, B + '$1' + R)
|
|
525
|
+
.replace(/\*(.+?)\*/g, '$1')
|
|
526
|
+
.replace(/`([^`]+)`/g, D + '$1' + R);
|
|
527
|
+
|
|
528
|
+
out.push(' ' + line);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
return out.join('\n');
|
|
479
532
|
}
|
|
480
533
|
|
|
481
534
|
// ─── LLM API calls — zero dependencies, native fetch ──────────────────────────
|
|
@@ -488,7 +541,9 @@ async function callLLM(provider, apiKey, model, system, messages) {
|
|
|
488
541
|
}
|
|
489
542
|
|
|
490
543
|
async function callViaCLI(cliCmd, system, messages) {
|
|
491
|
-
// Build full context: system + conversation history + latest user message
|
|
544
|
+
// Build full context: system + conversation history + latest user message.
|
|
545
|
+
// Sent via stdin to avoid ARG_MAX limits and CLI option-parsing issues
|
|
546
|
+
// (e.g. prompts that start with "---" being misread as flags).
|
|
492
547
|
let prompt = system + '\n\n';
|
|
493
548
|
|
|
494
549
|
for (const msg of messages.slice(0, -1)) {
|
|
@@ -499,17 +554,30 @@ async function callViaCLI(cliCmd, system, messages) {
|
|
|
499
554
|
const lastMsg = messages[messages.length - 1];
|
|
500
555
|
prompt += `Human: ${lastMsg.content}`;
|
|
501
556
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
});
|
|
557
|
+
return new Promise((resolve, reject) => {
|
|
558
|
+
const proc = spawn(cliCmd, ['--print', '--dangerously-skip-permissions'], {
|
|
559
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
560
|
+
});
|
|
507
561
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
562
|
+
let stdout = '';
|
|
563
|
+
let stderr = '';
|
|
564
|
+
|
|
565
|
+
proc.stdout.on('data', chunk => { stdout += chunk; });
|
|
566
|
+
proc.stderr.on('data', chunk => { stderr += chunk; });
|
|
567
|
+
|
|
568
|
+
proc.on('close', code => {
|
|
569
|
+
if (code !== 0) {
|
|
570
|
+
reject(new Error(stderr.trim() || `${cliCmd} CLI exited with code ${code}`));
|
|
571
|
+
} else {
|
|
572
|
+
resolve(stdout.trim());
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
proc.on('error', reject);
|
|
577
|
+
|
|
578
|
+
proc.stdin.write(prompt, 'utf8');
|
|
579
|
+
proc.stdin.end();
|
|
580
|
+
});
|
|
513
581
|
}
|
|
514
582
|
|
|
515
583
|
async function callAnthropic(apiKey, model, system, messages) {
|