@geminilight/mindos 0.1.6 → 0.1.7
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/package.json +1 -1
- package/scripts/setup.js +36 -22
package/package.json
CHANGED
package/scripts/setup.js
CHANGED
|
@@ -490,6 +490,42 @@ async function applyTemplate(tpl, mindDir) {
|
|
|
490
490
|
async function main() {
|
|
491
491
|
console.log(`\n${c.bold(t('title'))}\n\n${c.dim(t('langHint'))}\n`);
|
|
492
492
|
|
|
493
|
+
// ── Early overwrite check ─────────────────────────────────────────────────
|
|
494
|
+
if (existsSync(CONFIG_PATH)) {
|
|
495
|
+
let existing = {};
|
|
496
|
+
try { existing = JSON.parse(readFileSync(CONFIG_PATH, 'utf-8')); } catch {}
|
|
497
|
+
|
|
498
|
+
const mask = (s) => s ? s.slice(0, 4) + '••••••••' + s.slice(-2) : c.dim('(not set)');
|
|
499
|
+
const row = (label, val) => ` ${c.dim(label.padEnd(18))} ${val}`;
|
|
500
|
+
const providers = existing.ai?.providers;
|
|
501
|
+
const anthropicKey = providers?.anthropic?.apiKey || existing.ai?.anthropicApiKey || '';
|
|
502
|
+
const openaiKey = providers?.openai?.apiKey || existing.ai?.openaiApiKey || '';
|
|
503
|
+
|
|
504
|
+
console.log(c.bold('\nExisting config:'));
|
|
505
|
+
console.log(row('Knowledge base:', c.cyan(existing.mindRoot || '(not set)')));
|
|
506
|
+
console.log(row('Web port:', c.cyan(String(existing.port || '3000'))));
|
|
507
|
+
console.log(row('MCP port:', c.cyan(String(existing.mcpPort || '8787'))));
|
|
508
|
+
console.log(row('Auth token:', existing.authToken ? mask(existing.authToken) : c.dim('(not set)')));
|
|
509
|
+
console.log(row('Web password:', existing.webPassword ? '••••••••' : c.dim('(none)')));
|
|
510
|
+
console.log(row('AI provider:', c.cyan(existing.ai?.provider || '(not set)')));
|
|
511
|
+
if (anthropicKey) console.log(row('Anthropic key:', mask(anthropicKey)));
|
|
512
|
+
if (openaiKey) console.log(row('OpenAI key:', mask(openaiKey)));
|
|
513
|
+
write('\n');
|
|
514
|
+
|
|
515
|
+
const overwrite = await askYesNo('cfgExists', CONFIG_PATH);
|
|
516
|
+
if (!overwrite) {
|
|
517
|
+
const existingMode = existing.startMode || 'start';
|
|
518
|
+
const existingMcpPort = existing.mcpPort || 8787;
|
|
519
|
+
const existingAuth = existing.authToken || '';
|
|
520
|
+
const existingMindRoot = existing.mindRoot || resolve(MINDOS_DIR, 'my-mind');
|
|
521
|
+
console.log(`\n${c.green(t('cfgKept'))} ${c.dim(CONFIG_PATH)}`);
|
|
522
|
+
write(c.dim(t('cfgKeptNote') + '\n'));
|
|
523
|
+
const installDaemon = process.argv.includes('--install-daemon');
|
|
524
|
+
finish(existingMindRoot, existingMode, existingMcpPort, existingAuth, installDaemon);
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
493
529
|
// ── Step 1: Knowledge base path ───────────────────────────────────────────
|
|
494
530
|
stepHeader(1);
|
|
495
531
|
|
|
@@ -559,28 +595,6 @@ async function main() {
|
|
|
559
595
|
write('\n');
|
|
560
596
|
stepHeader(6);
|
|
561
597
|
|
|
562
|
-
// if config exists, ask about overwrite first
|
|
563
|
-
if (existsSync(CONFIG_PATH)) {
|
|
564
|
-
const overwrite = await askYesNo('cfgExists', CONFIG_PATH);
|
|
565
|
-
if (!overwrite) {
|
|
566
|
-
let existingMode = 'start';
|
|
567
|
-
let existingMcpPort = 8787;
|
|
568
|
-
let existingAuth = '';
|
|
569
|
-
let existingMindRoot = mindDir;
|
|
570
|
-
try {
|
|
571
|
-
const existing = JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));
|
|
572
|
-
existingMode = existing.startMode || 'start';
|
|
573
|
-
existingMcpPort = existing.mcpPort || 8787;
|
|
574
|
-
existingAuth = existing.authToken || '';
|
|
575
|
-
existingMindRoot = existing.mindRoot || mindDir;
|
|
576
|
-
} catch { /* ignore */ }
|
|
577
|
-
console.log(`\n${c.green(t('cfgKept'))} ${c.dim(CONFIG_PATH)}`);
|
|
578
|
-
write(c.dim(t('cfgKeptNote') + '\n'));
|
|
579
|
-
finish(existingMindRoot, existingMode, existingMcpPort, existingAuth);
|
|
580
|
-
return;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
|
|
584
598
|
const provider = await select('providerPrompt', 'providerOpts', 'providerVals');
|
|
585
599
|
const isSkip = provider === 'skip';
|
|
586
600
|
const isAnthropic = provider === 'anthropic';
|