@cachly-dev/mcp-server 0.10.87 → 0.10.89
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/README.md +15 -24
- package/dist/src/handlers/brain.js +16 -1
- package/dist/src/handlers/brain.js.map +1 -1
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +79 -33
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { tokenize, splitMultiQuery, levenshtein, recencyBoost, extractTimestamp, STOPWORDS, katakanaToRomaji, arabicLightStem, expandCrossLingual, CROSS_LINGUAL_MAP } from './search.js';
|
|
3
3
|
export { tokenize, splitMultiQuery, levenshtein, recencyBoost, extractTimestamp, STOPWORDS, katakanaToRomaji, arabicLightStem, expandCrossLingual, CROSS_LINGUAL_MAP };
|
|
4
|
+
export declare const EDITOR_FILES: Record<string, string>;
|
|
5
|
+
export declare const CLAUDE_MD_MARKER_START = "<!-- cachly-brain-start -->";
|
|
6
|
+
export declare const CLAUDE_MD_MARKER_END = "<!-- cachly-brain-end -->";
|
|
7
|
+
export declare function buildServerEnv(apiKey: string, instanceId: string): Record<string, string>;
|
|
8
|
+
export declare function buildMcpConfig(apiKey: string, instanceId: string, editor: string): string;
|
|
9
|
+
export declare function mergeMcpConfig(configPath: string, apiKey: string, instanceId: string, editor: string, fsOps: {
|
|
10
|
+
readFile: (p: string, enc: BufferEncoding) => Promise<string>;
|
|
11
|
+
existsSync: (p: string) => boolean;
|
|
12
|
+
}): Promise<string>;
|
|
13
|
+
export declare function buildClaudeMdBlock(instanceId: string): string;
|
package/dist/src/index.js
CHANGED
|
@@ -65,7 +65,7 @@ import { Redis } from 'ioredis';
|
|
|
65
65
|
let API_URL = process.env.CACHLY_API_URL ?? 'https://api.cachly.dev';
|
|
66
66
|
let JWT = process.env.CACHLY_JWT ?? '';
|
|
67
67
|
const _EMBED_MODEL = process.env.CACHLY_EMBED_MODEL ?? '';
|
|
68
|
-
const CURRENT_VERSION = '0.10.
|
|
68
|
+
const CURRENT_VERSION = '0.10.88';
|
|
69
69
|
// Max time to wait for a freshly-provisioned instance to become "running" before
|
|
70
70
|
// giving up. Free-tier provisioning in high-latency regions can take 45–90s, so the
|
|
71
71
|
// old hard-coded 25s caused spurious "instance_not_reachable" on first run.
|
|
@@ -792,7 +792,7 @@ async function handleTool(name, args) {
|
|
|
792
792
|
'',
|
|
793
793
|
'Run the setup wizard once in your terminal:',
|
|
794
794
|
' ```',
|
|
795
|
-
' npx @cachly-dev/mcp-server@latest
|
|
795
|
+
' npx @cachly-dev/mcp-server@latest autopilot',
|
|
796
796
|
' ```',
|
|
797
797
|
'',
|
|
798
798
|
'Or get your API key at: https://cachly.dev/setup-ai',
|
|
@@ -1213,7 +1213,7 @@ process.on('unhandledRejection', (reason) => {
|
|
|
1213
1213
|
process.stderr.write(`[cachly-mcp] unhandledRejection: ${msg}\n`);
|
|
1214
1214
|
});
|
|
1215
1215
|
// ── CLI helpers ───────────────────────────────────────────────────────────────
|
|
1216
|
-
const EDITOR_FILES = {
|
|
1216
|
+
export const EDITOR_FILES = {
|
|
1217
1217
|
claude: '.mcp.json',
|
|
1218
1218
|
cursor: '.cursor/mcp.json',
|
|
1219
1219
|
windsurf: '.windsurf/mcp.json',
|
|
@@ -1222,8 +1222,8 @@ const EDITOR_FILES = {
|
|
|
1222
1222
|
cline: '.vscode/mcp.json', // Cline respects VS Code project MCP config
|
|
1223
1223
|
zed: '.zed/settings.json', // Zed project-level context_servers
|
|
1224
1224
|
};
|
|
1225
|
-
const CLAUDE_MD_MARKER_START = '<!-- cachly-brain-start -->';
|
|
1226
|
-
const CLAUDE_MD_MARKER_END = '<!-- cachly-brain-end -->';
|
|
1225
|
+
export const CLAUDE_MD_MARKER_START = '<!-- cachly-brain-start -->';
|
|
1226
|
+
export const CLAUDE_MD_MARKER_END = '<!-- cachly-brain-end -->';
|
|
1227
1227
|
const DEFAULT_API_URL = 'https://api.cachly.dev';
|
|
1228
1228
|
// Build the env block written into an editor's MCP config. Self-hosting is
|
|
1229
1229
|
// first-class: if the operator runs setup/init against their own backend
|
|
@@ -1231,13 +1231,13 @@ const DEFAULT_API_URL = 'https://api.cachly.dev';
|
|
|
1231
1231
|
// the editor-launched server talks to the self-hosted instance — not api.cachly.dev.
|
|
1232
1232
|
// For the default cloud backend we OMIT CACHLY_API_URL to keep configs clean (the
|
|
1233
1233
|
// binary already defaults to it).
|
|
1234
|
-
function buildServerEnv(apiKey, instanceId) {
|
|
1234
|
+
export function buildServerEnv(apiKey, instanceId) {
|
|
1235
1235
|
const env = { CACHLY_JWT: apiKey, CACHLY_BRAIN_INSTANCE_ID: instanceId };
|
|
1236
1236
|
if (API_URL && API_URL !== DEFAULT_API_URL)
|
|
1237
1237
|
env.CACHLY_API_URL = API_URL;
|
|
1238
1238
|
return env;
|
|
1239
1239
|
}
|
|
1240
|
-
function buildMcpConfig(apiKey, instanceId, editor) {
|
|
1240
|
+
export function buildMcpConfig(apiKey, instanceId, editor) {
|
|
1241
1241
|
if (editor === 'continue') {
|
|
1242
1242
|
return JSON.stringify({
|
|
1243
1243
|
experimental: {
|
|
@@ -1274,7 +1274,7 @@ function buildMcpConfig(apiKey, instanceId, editor) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
// mergeMcpConfig reads an existing config file (if any), merges the cachly entry,
|
|
1276
1276
|
// and returns the updated JSON string — preserving all other MCP servers and settings.
|
|
1277
|
-
async function mergeMcpConfig(configPath, apiKey, instanceId, editor, fsOps) {
|
|
1277
|
+
export async function mergeMcpConfig(configPath, apiKey, instanceId, editor, fsOps) {
|
|
1278
1278
|
const cachlyEntry = {
|
|
1279
1279
|
command: 'npx',
|
|
1280
1280
|
args: ['-y', '@cachly-dev/mcp-server@latest'],
|
|
@@ -1320,7 +1320,7 @@ async function mergeMcpConfig(configPath, apiKey, instanceId, editor, fsOps) {
|
|
|
1320
1320
|
existing['mcpServers'] = servers;
|
|
1321
1321
|
return JSON.stringify(existing, null, 2);
|
|
1322
1322
|
}
|
|
1323
|
-
function buildClaudeMdBlock(instanceId) {
|
|
1323
|
+
export function buildClaudeMdBlock(instanceId) {
|
|
1324
1324
|
return `${CLAUDE_MD_MARKER_START}
|
|
1325
1325
|
## Cachly AI Brain — Always Active
|
|
1326
1326
|
|
|
@@ -1406,7 +1406,7 @@ if (process.argv[2] === 'digest') {
|
|
|
1406
1406
|
const instanceId = process.env.CACHLY_BRAIN_INSTANCE_ID ?? '';
|
|
1407
1407
|
if (!apiKey || !instanceId) {
|
|
1408
1408
|
console.log('\n⚠️ CACHLY_JWT and CACHLY_BRAIN_INSTANCE_ID must be set.');
|
|
1409
|
-
console.log(' Run: npx @cachly-dev/mcp-server@latest
|
|
1409
|
+
console.log(' Run: npx @cachly-dev/mcp-server@latest autopilot\n');
|
|
1410
1410
|
process.exit(1);
|
|
1411
1411
|
}
|
|
1412
1412
|
process.stdout.write('\n🧠 Fetching your weekly Brain digest...\n\n');
|
|
@@ -1495,7 +1495,7 @@ if (process.argv[2] === 'invite') {
|
|
|
1495
1495
|
const apiKey = process.env.CACHLY_JWT ?? '';
|
|
1496
1496
|
if (!apiKey) {
|
|
1497
1497
|
console.log('\n⚠️ CACHLY_JWT must be set.');
|
|
1498
|
-
console.log(' Run: npx @cachly-dev/mcp-server@latest
|
|
1498
|
+
console.log(' Run: npx @cachly-dev/mcp-server@latest autopilot\n');
|
|
1499
1499
|
process.exit(1);
|
|
1500
1500
|
}
|
|
1501
1501
|
try {
|
|
@@ -1742,7 +1742,7 @@ if (process.argv[2] === 'upgrade') {
|
|
|
1742
1742
|
console.log('');
|
|
1743
1743
|
console.log(' Update your editor configs to pick up the new version:');
|
|
1744
1744
|
console.log('');
|
|
1745
|
-
console.log(' \x1b[32m npx @cachly-dev/mcp-server@latest
|
|
1745
|
+
console.log(' \x1b[32m npx @cachly-dev/mcp-server@latest autopilot\x1b[0m');
|
|
1746
1746
|
console.log('');
|
|
1747
1747
|
console.log(' \x1b[2m(npx always fetches the latest when @latest is specified)\x1b[0m');
|
|
1748
1748
|
console.log('');
|
|
@@ -1905,7 +1905,7 @@ if (process.argv[2] === 'demo') {
|
|
|
1905
1905
|
});
|
|
1906
1906
|
const previewURL = `https://cachly.dev/preview?${previewParams.toString()}`;
|
|
1907
1907
|
console.log(' \x1b[1mMake this permanent (free, 1–5 minutes):\x1b[0m');
|
|
1908
|
-
console.log(' \x1b[32m$ npx @cachly-dev/mcp-server@latest
|
|
1908
|
+
console.log(' \x1b[32m$ npx @cachly-dev/mcp-server@latest autopilot\x1b[0m');
|
|
1909
1909
|
console.log('');
|
|
1910
1910
|
console.log(` \x1b[90m🔗 Shareable preview:\x1b[0m \x1b[36m${previewURL}\x1b[0m`);
|
|
1911
1911
|
console.log('');
|
|
@@ -1922,7 +1922,7 @@ if (process.argv[2] === 'share') {
|
|
|
1922
1922
|
const instanceId = process.env.CACHLY_BRAIN_INSTANCE_ID ?? '';
|
|
1923
1923
|
if (!apiKey || !instanceId) {
|
|
1924
1924
|
console.log('\n⚠️ CACHLY_JWT and CACHLY_BRAIN_INSTANCE_ID must be set.');
|
|
1925
|
-
console.log(' Run: npx @cachly-dev/mcp-server@latest
|
|
1925
|
+
console.log(' Run: npx @cachly-dev/mcp-server@latest autopilot (takes 1–5 minutes)\n');
|
|
1926
1926
|
process.exit(1);
|
|
1927
1927
|
}
|
|
1928
1928
|
process.stdout.write('\n🧠 Fetching your Brain stats...\n');
|
|
@@ -1954,7 +1954,7 @@ if (process.argv[2] === 'share') {
|
|
|
1954
1954
|
console.log('├─────────────────────────────────────────────────────────────┤');
|
|
1955
1955
|
console.log('│ Works with: Claude Code · Cursor · Windsurf · Copilot │');
|
|
1956
1956
|
console.log('│ Free · GDPR · German servers │');
|
|
1957
|
-
console.log('│ \x1b[35mnpx @cachly-dev/mcp-server@latest
|
|
1957
|
+
console.log('│ \x1b[35mnpx @cachly-dev/mcp-server@latest autopilot\x1b[0m │');
|
|
1958
1958
|
console.log('└─────────────────────────────────────────────────────────────┘');
|
|
1959
1959
|
console.log('');
|
|
1960
1960
|
// Tweet text
|
|
@@ -1984,7 +1984,7 @@ if (process.argv[2] === 'publish') {
|
|
|
1984
1984
|
const instanceId = process.env.CACHLY_BRAIN_INSTANCE_ID ?? '';
|
|
1985
1985
|
if (!apiKey || !instanceId) {
|
|
1986
1986
|
console.log('\n⚠️ CACHLY_JWT and CACHLY_BRAIN_INSTANCE_ID must be set.');
|
|
1987
|
-
console.log(' Run: npx @cachly-dev/mcp-server@latest
|
|
1987
|
+
console.log(' Run: npx @cachly-dev/mcp-server@latest autopilot\n');
|
|
1988
1988
|
process.exit(1);
|
|
1989
1989
|
}
|
|
1990
1990
|
const titleIdx = process.argv.indexOf('--title');
|
|
@@ -2079,7 +2079,7 @@ if (process.argv[2] === 'badge') {
|
|
|
2079
2079
|
const instanceId = process.env.CACHLY_BRAIN_INSTANCE_ID ?? '';
|
|
2080
2080
|
if (!instanceId) {
|
|
2081
2081
|
console.log('\n⚠️ CACHLY_BRAIN_INSTANCE_ID must be set.');
|
|
2082
|
-
console.log(' Run: npx @cachly-dev/mcp-server@latest
|
|
2082
|
+
console.log(' Run: npx @cachly-dev/mcp-server@latest autopilot (takes 1–5 minutes)\n');
|
|
2083
2083
|
process.exit(1);
|
|
2084
2084
|
}
|
|
2085
2085
|
const badgeUrl = `${API_URL}/api/v1/badge/${instanceId}`;
|
|
@@ -2176,7 +2176,7 @@ if (process.argv[2] === 'init') {
|
|
|
2176
2176
|
}
|
|
2177
2177
|
if (!instanceId || !apiKey) {
|
|
2178
2178
|
console.error('\nUsage: npx @cachly-dev/mcp-server@latest init --instance-id <uuid> --api-key <cky_live_...> [--editor claude|cursor|windsurf|copilot|continue] [--project-dir /path] [--api-url https://your-self-hosted-backend]\n');
|
|
2179
|
-
console.error('First time? Run the zero-config wizard (signs you in, auto-provisions): npx @cachly-dev/mcp-server@latest
|
|
2179
|
+
console.error('First time? Run the zero-config wizard (signs you in, auto-provisions): npx @cachly-dev/mcp-server@latest autopilot\n');
|
|
2180
2180
|
console.error('Get your credentials from: https://cachly.dev/setup-ai\n');
|
|
2181
2181
|
process.exit(1);
|
|
2182
2182
|
}
|
|
@@ -2259,7 +2259,7 @@ if (process.argv[2] === 'status') {
|
|
|
2259
2259
|
const instanceId = process.env.CACHLY_BRAIN_INSTANCE_ID ?? '';
|
|
2260
2260
|
if (!apiKey || !instanceId) {
|
|
2261
2261
|
console.log('\n⚠️ CACHLY_JWT and CACHLY_BRAIN_INSTANCE_ID must be set.');
|
|
2262
|
-
console.log(' Run: npx @cachly-dev/mcp-server@latest
|
|
2262
|
+
console.log(' Run: npx @cachly-dev/mcp-server@latest autopilot\n');
|
|
2263
2263
|
process.exit(1);
|
|
2264
2264
|
}
|
|
2265
2265
|
try {
|
|
@@ -2337,7 +2337,7 @@ if (process.argv[2] === 'health') {
|
|
|
2337
2337
|
console.log('🔑 Auth token');
|
|
2338
2338
|
const jwt = process.env.CACHLY_JWT ?? '';
|
|
2339
2339
|
if (!jwt) {
|
|
2340
|
-
fail('CACHLY_JWT not set — run: npx @cachly-dev/mcp-server@latest
|
|
2340
|
+
fail('CACHLY_JWT not set — run: npx @cachly-dev/mcp-server@latest autopilot');
|
|
2341
2341
|
}
|
|
2342
2342
|
else if (jwt.startsWith('cky_')) {
|
|
2343
2343
|
// Long-lived API key (the credential `setup` provisions). It is not a JWT and
|
|
@@ -2486,7 +2486,7 @@ if (process.argv[2] === 'health') {
|
|
|
2486
2486
|
}
|
|
2487
2487
|
}
|
|
2488
2488
|
if (configsFound === 0) {
|
|
2489
|
-
fail('No editor MCP configs found — run: npx @cachly-dev/mcp-server@latest
|
|
2489
|
+
fail('No editor MCP configs found — run: npx @cachly-dev/mcp-server@latest autopilot');
|
|
2490
2490
|
}
|
|
2491
2491
|
// ── 5. Git hook ─────────────────────────────────────────────────────────────
|
|
2492
2492
|
console.log('\n🪝 Git hook (ambient learning)');
|
|
@@ -2509,7 +2509,7 @@ if (process.argv[2] === 'health') {
|
|
|
2509
2509
|
}
|
|
2510
2510
|
}
|
|
2511
2511
|
else {
|
|
2512
|
-
warn('.git/hooks/post-commit not found — run: npx @cachly-dev/mcp-server@latest
|
|
2512
|
+
warn('.git/hooks/post-commit not found — run: npx @cachly-dev/mcp-server@latest autopilot');
|
|
2513
2513
|
}
|
|
2514
2514
|
// ── 6. Embedding provider (BYOK) ─────────────────────────────────────────────
|
|
2515
2515
|
console.log('\n🧬 Embedding provider (semantic search)');
|
|
@@ -2542,7 +2542,7 @@ if (process.argv[2] === 'health') {
|
|
|
2542
2542
|
}
|
|
2543
2543
|
else {
|
|
2544
2544
|
console.log(`❌ ${failed} check(s) failed, ${passed} passed\n`);
|
|
2545
|
-
console.log(`💡 Fix issues with: npx @cachly-dev/mcp-server@latest
|
|
2545
|
+
console.log(`💡 Fix issues with: npx @cachly-dev/mcp-server@latest autopilot\n`);
|
|
2546
2546
|
process.exit(1);
|
|
2547
2547
|
}
|
|
2548
2548
|
process.exit(0);
|
|
@@ -2732,7 +2732,7 @@ if (process.argv[2] === 'setup' || _isAutopilotCli) {
|
|
|
2732
2732
|
sendFunnelEvent('device_flow_failed', { reason: 'non_interactive_no_key' });
|
|
2733
2733
|
console.error('\n ⚠️ This terminal is non-interactive, so the key cannot be pasted here.');
|
|
2734
2734
|
console.error(' Get your key at the URL above, then set it and re-run setup:\n');
|
|
2735
|
-
console.error(' \x1b[1mCACHLY_JWT=cky_live_xxx npx @cachly-dev/mcp-server@latest
|
|
2735
|
+
console.error(' \x1b[1mCACHLY_JWT=cky_live_xxx npx @cachly-dev/mcp-server@latest autopilot\x1b[0m\n');
|
|
2736
2736
|
console.error(' Or add it to your editor\'s MCP config under env.CACHLY_JWT.\n');
|
|
2737
2737
|
rl.close();
|
|
2738
2738
|
process.exit(1);
|
|
@@ -2899,6 +2899,10 @@ if (process.argv[2] === 'setup' || _isAutopilotCli) {
|
|
|
2899
2899
|
// Uses mergeMcpConfig to preserve all existing MCP servers — only adds/updates
|
|
2900
2900
|
// the cachly entry without touching filesystem, github, or other servers.
|
|
2901
2901
|
const { existsSync: exSetup } = await import('node:fs');
|
|
2902
|
+
// Track config-write failures so the final summary tells the truth instead of
|
|
2903
|
+
// always claiming "Brain is ready" even when a config never got written.
|
|
2904
|
+
const configWriteFailures = [];
|
|
2905
|
+
let configWriteSuccesses = 0;
|
|
2902
2906
|
for (const editor of editorsToSetup) {
|
|
2903
2907
|
const configFile = EDITOR_FILES[editor] ?? '.mcp.json';
|
|
2904
2908
|
const configPath = resolve(cwd, configFile);
|
|
@@ -2908,10 +2912,13 @@ if (process.argv[2] === 'setup' || _isAutopilotCli) {
|
|
|
2908
2912
|
const merged = await mergeMcpConfig(configPath, token, instance.id, editor, { readFile, existsSync: exSetup });
|
|
2909
2913
|
await writeFile(configPath, merged, 'utf-8');
|
|
2910
2914
|
console.log(`✅ ${wasExisting ? 'Updated' : 'Written'}: ${configFile}`);
|
|
2915
|
+
configWriteSuccesses++;
|
|
2911
2916
|
}
|
|
2912
2917
|
catch (writeErr) {
|
|
2913
|
-
|
|
2918
|
+
const reason = writeErr.message;
|
|
2919
|
+
console.log(`⚠️ Could not write ${configFile}: ${reason}`);
|
|
2914
2920
|
console.log(` Fix permissions or run with sudo, then re-run setup.`);
|
|
2921
|
+
configWriteFailures.push({ file: configFile, reason });
|
|
2915
2922
|
}
|
|
2916
2923
|
}
|
|
2917
2924
|
// ── Step 4b: Write global Claude Code config (~/.claude/mcp.json) ─────────
|
|
@@ -2935,9 +2942,12 @@ if (process.argv[2] === 'setup' || _isAutopilotCli) {
|
|
|
2935
2942
|
};
|
|
2936
2943
|
await writeFile(globalClaudePath, JSON.stringify(globalConfig, null, 2), 'utf-8');
|
|
2937
2944
|
console.log(`✅ Written: ~/.claude/mcp.json (global — works in every project)`);
|
|
2945
|
+
configWriteSuccesses++;
|
|
2938
2946
|
}
|
|
2939
2947
|
catch (e) {
|
|
2940
|
-
|
|
2948
|
+
const reason = e.message;
|
|
2949
|
+
console.log(`⚠️ Could not write ~/.claude/mcp.json: ${reason}`);
|
|
2950
|
+
configWriteFailures.push({ file: '~/.claude/mcp.json', reason });
|
|
2941
2951
|
}
|
|
2942
2952
|
// ── Step 5: CLAUDE.md (always — idempotent) ───────────────────────────────
|
|
2943
2953
|
const mdResult = await writeClaudeMd(cwd, instance.id);
|
|
@@ -3135,15 +3145,51 @@ if (process.argv[2] === 'setup' || _isAutopilotCli) {
|
|
|
3135
3145
|
}
|
|
3136
3146
|
}
|
|
3137
3147
|
catch { /* non-critical */ }
|
|
3138
|
-
// Setup reached the end
|
|
3148
|
+
// Setup reached the end — close the funnel. Report config-write outcome so the
|
|
3149
|
+
// weekly funnel can spot permission/path problems blocking activation.
|
|
3139
3150
|
JWT = token;
|
|
3140
3151
|
const setupElapsedS = Math.round((Date.now() - setupStartMs) / 1000);
|
|
3141
|
-
|
|
3152
|
+
if (configWriteFailures.length > 0) {
|
|
3153
|
+
sendFunnelEvent('setup_config_write_failed', {
|
|
3154
|
+
instance_id: instance.id,
|
|
3155
|
+
failed: configWriteFailures.length,
|
|
3156
|
+
succeeded: configWriteSuccesses,
|
|
3157
|
+
});
|
|
3158
|
+
}
|
|
3159
|
+
sendFunnelEvent('setup_completed', {
|
|
3160
|
+
instance_id: instance.id,
|
|
3161
|
+
elapsed_s: setupElapsedS,
|
|
3162
|
+
config_failures: configWriteFailures.length,
|
|
3163
|
+
});
|
|
3164
|
+
if (configWriteFailures.length > 0 && configWriteSuccesses === 0) {
|
|
3165
|
+
// Nothing got written — be honest, this is NOT "ready".
|
|
3166
|
+
console.log('\n╔══════════════════════════════════════════════════════╗');
|
|
3167
|
+
console.log('║ ⚠️ Setup incomplete — no editor config was written ║');
|
|
3168
|
+
console.log('╚══════════════════════════════════════════════════════╝');
|
|
3169
|
+
console.log('\n Your Brain instance exists, but no editor knows about it yet.');
|
|
3170
|
+
console.log(' Failed writes:');
|
|
3171
|
+
for (const f of configWriteFailures)
|
|
3172
|
+
console.log(` • ${f.file} — ${f.reason}`);
|
|
3173
|
+
console.log('\n Fix the permissions above and re-run, or configure manually:');
|
|
3174
|
+
console.log(` CACHLY_JWT=${token.slice(0, 12)}… CACHLY_BRAIN_INSTANCE_ID=${instance.id}`);
|
|
3175
|
+
console.log(` Docs: https://cachly.dev/docs/mcp\n`);
|
|
3176
|
+
rl.close();
|
|
3177
|
+
await new Promise(r => setTimeout(r, 300));
|
|
3178
|
+
process.exit(1);
|
|
3179
|
+
}
|
|
3142
3180
|
console.log('\n╔══════════════════════════════════════════════════════╗');
|
|
3143
3181
|
console.log('║ 🚀 Brain is ready. ║');
|
|
3144
3182
|
console.log(`║ ⏱️ Setup completed in ${String(setupElapsedS + 's').padEnd(5)} — restart your editor ║`);
|
|
3145
3183
|
console.log('║ and your AI arrives pre-briefed every session. ║');
|
|
3146
|
-
console.log('
|
|
3184
|
+
console.log('╚══════════════════════════════════════════════════════╝');
|
|
3185
|
+
if (configWriteFailures.length > 0) {
|
|
3186
|
+
// Partial success — some editors configured, some not. Tell the truth.
|
|
3187
|
+
console.log('\n ⚠️ Some editor configs could not be written (others succeeded):');
|
|
3188
|
+
for (const f of configWriteFailures)
|
|
3189
|
+
console.log(` • ${f.file} — ${f.reason}`);
|
|
3190
|
+
console.log(' Fix the permissions above and re-run setup to configure them too.');
|
|
3191
|
+
}
|
|
3192
|
+
console.log('');
|
|
3147
3193
|
rl.close();
|
|
3148
3194
|
// Give the fire-and-forget telemetry a moment to flush before exit.
|
|
3149
3195
|
await new Promise(r => setTimeout(r, 300));
|
|
@@ -3281,9 +3327,9 @@ if (!JWT && !_cliNoAuthCommands.includes(process.argv[2] ?? '')) {
|
|
|
3281
3327
|
'║ ║\n' +
|
|
3282
3328
|
'║ 👉 https://cachly.dev/setup-ai ║\n' +
|
|
3283
3329
|
'║ ║\n' +
|
|
3284
|
-
'║ Then run the
|
|
3330
|
+
'║ Then run the one-command setup wizard: ║\n' +
|
|
3285
3331
|
'║ ║\n' +
|
|
3286
|
-
'║ npx @cachly-dev/mcp-server@latest
|
|
3332
|
+
'║ npx @cachly-dev/mcp-server@latest autopilot ║\n' +
|
|
3287
3333
|
'║ ║\n' +
|
|
3288
3334
|
'║ Free tier — no credit card required. ║\n' +
|
|
3289
3335
|
'╚══════════════════════════════════════════════════════════════════╝\n' +
|
|
@@ -3297,7 +3343,7 @@ if (!JWT && !_cliNoAuthCommands.includes(process.argv[2] ?? '')) {
|
|
|
3297
3343
|
// hint to stderr (shown in the editor's MCP log) and fall through so the
|
|
3298
3344
|
// server starts and the zero-credential device flow can run on first tool call.
|
|
3299
3345
|
process.stderr.write('\n🧠 cachly: no CACHLY_JWT set yet — call any cachly tool and a 10-second browser sign-in starts automatically.\n' +
|
|
3300
|
-
' (Or run once: npx @cachly-dev/mcp-server@latest
|
|
3346
|
+
' (Or run once: npx @cachly-dev/mcp-server@latest autopilot)\n\n');
|
|
3301
3347
|
}
|
|
3302
3348
|
}
|
|
3303
3349
|
else {
|
|
@@ -3327,7 +3373,7 @@ if (!process.env.CACHLY_NO_UPDATE_CHECK) {
|
|
|
3327
3373
|
const latest = data?.version ?? '';
|
|
3328
3374
|
if (latest && latest !== CURRENT_VERSION) {
|
|
3329
3375
|
process.stderr.write(`\n⚡ cachly update available: ${CURRENT_VERSION} → ${latest}\n` +
|
|
3330
|
-
` Run: npx @cachly-dev/mcp-server@latest
|
|
3376
|
+
` Run: npx @cachly-dev/mcp-server@latest autopilot\n\n`);
|
|
3331
3377
|
}
|
|
3332
3378
|
}
|
|
3333
3379
|
}
|