@nxuss/lemma 0.7.7 → 0.7.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.
@@ -8,6 +8,7 @@ import { ChromaClient } from 'chromadb';
8
8
  import https from 'https';
9
9
  import http from 'http';
10
10
  import axios from 'axios';
11
+ import readline from 'readline';
11
12
  function getVersion() {
12
13
  const paths = [
13
14
  path.join(__dirname, '../../package.json'),
@@ -27,6 +28,10 @@ function getVersion() {
27
28
  return '0.5.4';
28
29
  }
29
30
  const VERSION = getVersion();
31
+ function ask(query) {
32
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
33
+ return new Promise(resolve => rl.question(query, ans => { rl.close(); resolve(ans); }));
34
+ }
30
35
  import ComplexityRouter from '../proxy/ComplexityRouter';
31
36
  import SemanticScrubber from '../security/SemanticScrubber';
32
37
  import CloudSyncClient from '../cloud/CloudSyncClient';
@@ -262,6 +267,49 @@ function autoConfigureAll(project, opts) {
262
267
  }
263
268
  }
264
269
  }
270
+ // Register lemma MCP server in VS Code config (.vscode/mcp.json)
271
+ const vscodeConfigFile = path.join(process.cwd(), '.vscode', 'mcp.json');
272
+ const vscodeConfigDir = path.dirname(vscodeConfigFile);
273
+ if (fs.existsSync(vscodeConfigDir)) {
274
+ let vscodeConfig = { servers: {} };
275
+ try {
276
+ if (fs.existsSync(vscodeConfigFile)) {
277
+ vscodeConfig = JSON.parse(fs.readFileSync(vscodeConfigFile, 'utf8'));
278
+ }
279
+ }
280
+ catch { }
281
+ if (!vscodeConfig.servers)
282
+ vscodeConfig.servers = {};
283
+ if (!vscodeConfig.servers.lemma) {
284
+ vscodeConfig.servers.lemma = {
285
+ type: 'stdio',
286
+ command: 'lemma',
287
+ args: ['mcp'],
288
+ };
289
+ try {
290
+ fs.writeFileSync(vscodeConfigFile, JSON.stringify(vscodeConfig, null, 2));
291
+ console.log('✅ [VS Code] Registered lemma MCP server in .vscode/mcp.json');
292
+ }
293
+ catch { }
294
+ }
295
+ }
296
+ else {
297
+ try {
298
+ fs.mkdirSync(path.join(process.cwd(), '.vscode'), { recursive: true });
299
+ const vscodeConfig = {
300
+ servers: {
301
+ lemma: {
302
+ type: 'stdio',
303
+ command: 'lemma',
304
+ args: ['mcp'],
305
+ },
306
+ },
307
+ };
308
+ fs.writeFileSync(path.join(process.cwd(), '.vscode', 'mcp.json'), JSON.stringify(vscodeConfig, null, 2));
309
+ console.log('✅ [VS Code] Registered lemma MCP server in .vscode/mcp.json');
310
+ }
311
+ catch { }
312
+ }
265
313
  // Register lemma MCP server in Codex CLI config (~/.codex/config.toml)
266
314
  const codexConfigFile = path.join(process.env.HOME || '~', '.codex', 'config.toml');
267
315
  const codexConfigDir = path.dirname(codexConfigFile);
@@ -1317,7 +1365,7 @@ class LemmaServer {
1317
1365
  const responseObj = JSON.parse(meta.response);
1318
1366
  const contentText = responseObj.choices?.[0]?.message?.content || responseObj.content?.[0]?.text || '';
1319
1367
  const promptText = typeof meta.prompt === 'string' ? meta.prompt : 'Architecture Note';
1320
- archMemoriesText += `#### 📌 Decisión: ${promptText}\n${contentText.substring(0, 500)}${contentText.length > 500 ? '...' : ''}\n\n`;
1368
+ archMemoriesText += `#### 📌 Decision: ${promptText}\n${contentText.substring(0, 500)}${contentText.length > 500 ? '...' : ''}\n\n`;
1321
1369
  }
1322
1370
  catch { }
1323
1371
  }
@@ -1351,7 +1399,7 @@ class LemmaServer {
1351
1399
  `1. **Respect Core Stack:** Adhere strictly to the codebase structure and libraries listed above.`,
1352
1400
  `2. **Leverage the Brain:** Use Lemma MCP tools (\`search_memory\` and \`store_memory\`) to retrieve past solutions and register key architectural changes.`,
1353
1401
  `3. **Optimize Context:** Keep conversations focused. Lemma transparently compresses repetitive logs and file blocks to protect context window limits.`,
1354
- `4. **Cortafuegos Local:** Do not worry about API key exposures. Lemma automatically masks local private variables and credentials.`
1402
+ ` 4. **Privacy Firewall:** Do not worry about API key exposures. Lemma automatically masks local private variables and credentials.`
1355
1403
  ].filter(Boolean).join('\n');
1356
1404
  res.json({ success: true, markdown: mentalModel });
1357
1405
  }
@@ -1995,7 +2043,7 @@ program
1995
2043
  .version(VERSION)
1996
2044
  .addHelpText('after', `
1997
2045
  \x1b[1mPlan Comparison\x1b[0m
1998
- \x1b[32mFree\x1b[0m 500 req/mo · Exact cache · Privacy firewall · MCP tools
2046
+ \x1b[32mFree\x1b[0m ${FREE_LIMIT} req/mo · Exact cache · Privacy firewall · MCP tools
1999
2047
  \x1b[35mPro\x1b[0m Unlimited · Semantic cache · Cloud sync · Autopilot · Heal
2000
2048
  \x1b[36mhttps://lemma.nxus.studio/upgrade\x1b[0m
2001
2049
 
@@ -2247,6 +2295,7 @@ program.command('activate <key>')
2247
2295
  program.command('init')
2248
2296
  .description('Initialize Lemma in the current project (auto-discovery)')
2249
2297
  .option('--no-configure', 'Skip automatic configuration of editors, shell overrides, and Claude Desktop')
2298
+ .option('--yes', 'Skip prompts and accept defaults')
2250
2299
  .action(async (opts) => {
2251
2300
  const project = detectProject();
2252
2301
  console.log(`\n🛠️ Initializing Lemma for [${project}]...`);
@@ -2276,8 +2325,23 @@ program.command('init')
2276
2325
  fs.writeFileSync(envFile, lemmaConfig);
2277
2326
  console.log('✅ Created .env with Lemma configuration');
2278
2327
  }
2279
- console.log('\n🧠 \x1b[35mAuto-Setup MCP and redirection overrides for AI IDEs...\x1b[0m');
2280
- autoConfigureAll(project, { configure: opts.configure });
2328
+ // Prompt before modifying IDE configs unless --yes or --no-configure
2329
+ if (opts.configure !== false) {
2330
+ if (opts.yes) {
2331
+ console.log('\n🧠 \x1b[35mAuto-configuring MCP for AI IDEs...\x1b[0m');
2332
+ }
2333
+ else {
2334
+ const ans = await ask('\n🧠 Configure MCP servers for your IDEs (Claude, Cursor, Windsurf, VS Code, Kiro, Codex)? (Y/n): ');
2335
+ if (ans.toLowerCase() === 'n' || ans.toLowerCase() === 'no') {
2336
+ opts.configure = false;
2337
+ console.log('⏭️ Skipping IDE auto-configuration');
2338
+ }
2339
+ else {
2340
+ console.log(' Auto-configuring...');
2341
+ }
2342
+ }
2343
+ }
2344
+ autoConfigureAll(project, { configure: opts.configure !== false });
2281
2345
  injectIdeRules(project);
2282
2346
  console.log('\n✨ Project initialized for the Agentic Era!\n');
2283
2347
  console.log('\x1b[1mNext steps:\x1b[0m');