@cachly-dev/mcp-server 0.8.1 → 0.8.3
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/dist/index.js +41 -43
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/server.json +3 -3
- package/src/index.ts +40 -41
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ import { Redis } from 'ioredis';
|
|
|
47
47
|
const API_URL = process.env.CACHLY_API_URL ?? 'https://api.cachly.dev';
|
|
48
48
|
const JWT = process.env.CACHLY_JWT ?? '';
|
|
49
49
|
const EMBED_MODEL = process.env.CACHLY_EMBED_MODEL ?? '';
|
|
50
|
-
const CURRENT_VERSION = '0.8.
|
|
50
|
+
const CURRENT_VERSION = '0.8.3';
|
|
51
51
|
/**
|
|
52
52
|
* ┌──────────────────────────────────────────────────────────────────────┐
|
|
53
53
|
* │ EMBEDDING PROVIDER — pluggable, client-side first │
|
|
@@ -7475,9 +7475,17 @@ if (process.argv[2] === 'setup') {
|
|
|
7475
7475
|
const { existsSync } = await import('node:fs');
|
|
7476
7476
|
const { resolve, dirname } = await import('node:path');
|
|
7477
7477
|
const { createInterface } = await import('node:readline');
|
|
7478
|
+
// --yes / -y → non-interactive mode (skips all prompts, picks defaults)
|
|
7479
|
+
const nonInteractive = process.argv.includes('--yes') || process.argv.includes('-y');
|
|
7478
7480
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
7479
|
-
const ask = (q
|
|
7480
|
-
|
|
7481
|
+
const ask = (q, defaultVal = '') => {
|
|
7482
|
+
if (nonInteractive) {
|
|
7483
|
+
console.log(`${q}${defaultVal}`);
|
|
7484
|
+
return Promise.resolve(defaultVal);
|
|
7485
|
+
}
|
|
7486
|
+
return new Promise(res => rl.question(q, ans => res(ans.trim() || defaultVal)));
|
|
7487
|
+
};
|
|
7488
|
+
console.log('\n🧠 cachly AI Brain — Setup');
|
|
7481
7489
|
console.log('────────────────────────────────────────\n');
|
|
7482
7490
|
// ── Step 1: Authenticate via OAuth Device Flow ────────────────────────────
|
|
7483
7491
|
let token = process.env.CACHLY_JWT ?? '';
|
|
@@ -7672,13 +7680,11 @@ if (process.argv[2] === 'setup') {
|
|
|
7672
7680
|
process.exit(1);
|
|
7673
7681
|
}
|
|
7674
7682
|
}
|
|
7675
|
-
|
|
7683
|
+
// Auto-pick the most recently created running instance — no prompt.
|
|
7684
|
+
const instance = instances[0];
|
|
7676
7685
|
if (instances.length > 1) {
|
|
7677
|
-
console.log(
|
|
7678
|
-
|
|
7679
|
-
const raw = await ask(`\n Pick [1-${instances.length}] (Enter = 1): `);
|
|
7680
|
-
const idx = parseInt(raw || '1', 10) - 1;
|
|
7681
|
-
instance = instances[Math.max(0, Math.min(instances.length - 1, idx))];
|
|
7686
|
+
console.log(`ℹ️ Multiple instances found — using most recent: ${instance.name}`);
|
|
7687
|
+
console.log(` (Run with --instance-id <id> to use a different one)\n`);
|
|
7682
7688
|
}
|
|
7683
7689
|
console.log(`✓ Instance: ${instance.name} (${instance.id.slice(0, 8)}…)\n`);
|
|
7684
7690
|
// ── Step 3: Detect editors ────────────────────────────────────────────────
|
|
@@ -7711,32 +7717,10 @@ if (process.argv[2] === 'setup') {
|
|
|
7711
7717
|
if (existsSync(zedDir))
|
|
7712
7718
|
detected.push('zed');
|
|
7713
7719
|
const editorLabel = (e) => ({ claude: 'Claude Code', cursor: 'Cursor', windsurf: 'Windsurf', copilot: 'GitHub Copilot', continue: 'Continue.dev', cline: 'Cline (VSCode)', zed: 'Zed' })[e] ?? e;
|
|
7714
|
-
|
|
7715
|
-
const
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
: editorsRaw.split(/[,\s]+/).map(s => s.toLowerCase()).filter(s => EDITOR_FILES[s]);
|
|
7719
|
-
console.log('');
|
|
7720
|
-
// ── Step 4: Email opt-in ──────────────────────────────────────────────────
|
|
7721
|
-
console.log('Step 4: Stay in the loop (optional)');
|
|
7722
|
-
const email = await ask(' Email for release notes & tips? [Enter to skip]: ');
|
|
7723
|
-
if (email && email.includes('@')) {
|
|
7724
|
-
try {
|
|
7725
|
-
await fetch(`${API_URL}/api/newsletter/subscribe`, {
|
|
7726
|
-
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
7727
|
-
body: JSON.stringify({ email: email.trim().toLowerCase(), source: 'mcp-setup' }),
|
|
7728
|
-
signal: AbortSignal.timeout(5000),
|
|
7729
|
-
});
|
|
7730
|
-
console.log('✅ Subscribed — you\'ll only hear from us when it matters.\n');
|
|
7731
|
-
}
|
|
7732
|
-
catch {
|
|
7733
|
-
console.log('⚠️ Could not subscribe (no internet?). Continuing...\n');
|
|
7734
|
-
}
|
|
7735
|
-
}
|
|
7736
|
-
else {
|
|
7737
|
-
console.log(' Skipped.\n');
|
|
7738
|
-
}
|
|
7739
|
-
// ── Step 5: Write editor configs ──────────────────────────────────────────
|
|
7720
|
+
// Auto-configure all detected editors — no prompt needed.
|
|
7721
|
+
const editorsToSetup = detected;
|
|
7722
|
+
console.log(`Step 3: Configuring for: ${editorsToSetup.map(editorLabel).join(', ')}\n`);
|
|
7723
|
+
// ── Step 4: Write editor configs ──────────────────────────────────────────
|
|
7740
7724
|
for (const editor of editorsToSetup) {
|
|
7741
7725
|
const configFile = EDITOR_FILES[editor] ?? '.mcp.json';
|
|
7742
7726
|
const configPath = resolve(cwd, configFile);
|
|
@@ -7744,14 +7728,11 @@ if (process.argv[2] === 'setup') {
|
|
|
7744
7728
|
await writeFile(configPath, buildMcpConfig(token, instance.id, editor), 'utf-8');
|
|
7745
7729
|
console.log(`✅ Written: ${configFile}`);
|
|
7746
7730
|
}
|
|
7747
|
-
// ── Step
|
|
7731
|
+
// ── Step 5: CLAUDE.md (always — idempotent) ───────────────────────────────
|
|
7748
7732
|
const mdResult = await writeClaudeMd(cwd, instance.id);
|
|
7749
7733
|
const mdLabel = mdResult === 'updated' ? '✅ Updated' : mdResult === 'appended' ? '✅ Appended to' : '✅ Written';
|
|
7750
|
-
console.log(`${mdLabel}: CLAUDE.md`);
|
|
7751
|
-
|
|
7752
|
-
console.log(`\n🧠 Done! Restart your editor — the \`cachly\` MCP tools will appear.`);
|
|
7753
|
-
console.log(` Your AI now has persistent memory across every session.\n`);
|
|
7754
|
-
// ── Step 7: Show first session_start preview (Aha moment) ────────────────
|
|
7734
|
+
console.log(`${mdLabel}: CLAUDE.md\n`);
|
|
7735
|
+
// ── Step 6: Show Brain health (Aha moment) ────────────────────────────────
|
|
7755
7736
|
// Fetch brain health from the API to show the user what their agent will see.
|
|
7756
7737
|
process.stdout.write('\n⏳ Fetching your Brain health preview...');
|
|
7757
7738
|
try {
|
|
@@ -7792,8 +7773,25 @@ if (process.argv[2] === 'setup') {
|
|
|
7792
7773
|
catch {
|
|
7793
7774
|
console.log(' (skipped)');
|
|
7794
7775
|
}
|
|
7795
|
-
console.log(`\n
|
|
7796
|
-
console.log(`
|
|
7776
|
+
console.log(`\n🧠 Done! Restart your editor — the \`cachly\` MCP tools will appear.`);
|
|
7777
|
+
console.log(` Your AI now has persistent memory across every session.\n`);
|
|
7778
|
+
console.log(` Dashboard: https://cachly.dev/instances/${instance.id}\n`);
|
|
7779
|
+
// ── Step 7: Email opt-in (non-blocking — at the very end) ────────────────
|
|
7780
|
+
if (!nonInteractive) {
|
|
7781
|
+
const email = await ask(' 📬 Stay in the loop? Email for release notes [Enter to skip]: ');
|
|
7782
|
+
if (email && email.includes('@')) {
|
|
7783
|
+
try {
|
|
7784
|
+
await fetch(`${API_URL}/api/newsletter/subscribe`, {
|
|
7785
|
+
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
7786
|
+
body: JSON.stringify({ email: email.trim().toLowerCase(), source: 'mcp-setup' }),
|
|
7787
|
+
signal: AbortSignal.timeout(5000),
|
|
7788
|
+
});
|
|
7789
|
+
console.log(' ✅ Subscribed — you\'ll only hear from us when it matters.\n');
|
|
7790
|
+
}
|
|
7791
|
+
catch { /* fire and forget */ }
|
|
7792
|
+
}
|
|
7793
|
+
}
|
|
7794
|
+
rl.close();
|
|
7797
7795
|
process.exit(0);
|
|
7798
7796
|
}
|
|
7799
7797
|
// ── CLI: cachly index <dir> ───────────────────────────────────────────────────
|