make-laten 1.1.0 → 1.1.1

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.
@@ -1326,125 +1326,102 @@ async function directoryExists(dirPath) {
1326
1326
  return false;
1327
1327
  }
1328
1328
  }
1329
+ async function readJSON(filePath) {
1330
+ try {
1331
+ const raw = await fs3.readFile(filePath, "utf-8");
1332
+ return JSON.parse(raw);
1333
+ } catch {
1334
+ return {};
1335
+ }
1336
+ }
1337
+ async function writeJSON(filePath, data) {
1338
+ try {
1339
+ const dir = path2.dirname(filePath);
1340
+ await fs3.mkdir(dir, { recursive: true });
1341
+ await fs3.writeFile(filePath, JSON.stringify(data, null, 2));
1342
+ return true;
1343
+ } catch {
1344
+ return false;
1345
+ }
1346
+ }
1347
+ var MCP_CMD = ["npx", "-y", "make-laten-mcp", "server"];
1329
1348
  async function detectAllAgents() {
1330
1349
  const home = getHome2();
1331
1350
  const agents2 = [];
1332
- const claudeConfig = path2.join(home, ".claude", "mcp.json");
1333
- const claudeDir = path2.join(home, ".claude");
1334
1351
  agents2.push({
1335
1352
  name: "Claude Code",
1336
- detected: await commandExists2("claude") || await directoryExists(claudeDir),
1337
- configPath: claudeConfig,
1338
- mcpConfig: {
1339
- mcpServers: {
1340
- "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1341
- }
1342
- },
1343
- version: await commandExists2("claude") ? await execAsync4("claude --version", { timeout: 3e3 }).then((r) => r.stdout.trim().split("\n")[0]).catch(() => "unknown") : void 0
1353
+ detected: await commandExists2("claude") || await directoryExists(path2.join(home, ".claude")),
1354
+ configPath: path2.join(home, ".claude", "mcp.json"),
1355
+ version: await commandExists2("claude") ? await execAsync4("claude --version", { timeout: 3e3 }).then((r) => r.stdout.trim().split("\n")[0]).catch(() => "unknown") : void 0,
1356
+ writeConfig: async (p) => {
1357
+ const data = await readJSON(p);
1358
+ data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
1359
+ return writeJSON(p, data);
1360
+ }
1344
1361
  });
1345
- const cursorMcp = path2.join(home, ".cursor", "mcp.json");
1346
- const cursorDir = path2.join(home, ".cursor");
1347
1362
  agents2.push({
1348
1363
  name: "Cursor",
1349
- detected: await directoryExists(cursorDir),
1350
- configPath: cursorMcp,
1351
- mcpConfig: {
1352
- mcpServers: {
1353
- "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1354
- }
1364
+ detected: await directoryExists(path2.join(home, ".cursor")),
1365
+ configPath: path2.join(home, ".cursor", "mcp.json"),
1366
+ writeConfig: async (p) => {
1367
+ const data = await readJSON(p);
1368
+ data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
1369
+ return writeJSON(p, data);
1355
1370
  }
1356
1371
  });
1357
- const codexMcp = path2.join(home, ".codex", "config.json");
1358
- const codexDir = path2.join(home, ".codex");
1359
1372
  agents2.push({
1360
1373
  name: "Codex",
1361
- detected: await commandExists2("codex") || await directoryExists(codexDir),
1362
- configPath: codexMcp,
1363
- mcpConfig: {
1364
- mcpServers: {
1365
- "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1366
- }
1374
+ detected: await commandExists2("codex") || await directoryExists(path2.join(home, ".codex")),
1375
+ configPath: path2.join(home, ".codex", "config.json"),
1376
+ writeConfig: async (p) => {
1377
+ const data = await readJSON(p);
1378
+ data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
1379
+ return writeJSON(p, data);
1367
1380
  }
1368
1381
  });
1369
- const windsurfMcp = path2.join(home, ".codeium", "windsurf", "mcp_config.json");
1370
- const windsurfDir = path2.join(home, ".codeium", "windsurf");
1371
1382
  agents2.push({
1372
- name: "Windsurf",
1373
- detected: await directoryExists(windsurfDir),
1374
- configPath: windsurfMcp,
1375
- mcpConfig: {
1376
- mcpServers: {
1377
- "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1378
- }
1383
+ name: "OpenCode",
1384
+ detected: await directoryExists(path2.join(home, ".config", "opencode")),
1385
+ configPath: path2.join(home, ".config", "opencode", "opencode.json"),
1386
+ writeConfig: async (p) => {
1387
+ const data = await readJSON(p);
1388
+ data.mcp = { ...data.mcp || {}, "make-laten": { type: "local", command: MCP_CMD, enabled: true } };
1389
+ delete data.mcpServers;
1390
+ return writeJSON(p, data);
1379
1391
  }
1380
1392
  });
1381
- const openCodeConfig = path2.join(home, ".config", "opencode", "opencode.json");
1382
- const openCodeDir = path2.join(home, ".config", "opencode");
1383
1393
  agents2.push({
1384
- name: "OpenCode",
1385
- detected: await directoryExists(openCodeDir),
1386
- configPath: openCodeConfig,
1387
- mcpConfig: {
1388
- mcpServers: {
1389
- "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1390
- }
1394
+ name: "Windsurf",
1395
+ detected: await directoryExists(path2.join(home, ".codeium", "windsurf")),
1396
+ configPath: path2.join(home, ".codeium", "windsurf", "mcp_config.json"),
1397
+ writeConfig: async (p) => {
1398
+ const data = await readJSON(p);
1399
+ data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
1400
+ return writeJSON(p, data);
1391
1401
  }
1392
1402
  });
1393
- const clineDir = path2.join(home, ".cline");
1394
- const clineMcp = path2.join(home, ".cline", "mcp_settings.json");
1395
1403
  agents2.push({
1396
1404
  name: "Cline",
1397
- detected: await directoryExists(clineDir),
1398
- configPath: clineMcp,
1399
- mcpConfig: {
1400
- mcpServers: {
1401
- "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1402
- }
1405
+ detected: await directoryExists(path2.join(home, ".cline")),
1406
+ configPath: path2.join(home, ".cline", "mcp_settings.json"),
1407
+ writeConfig: async (p) => {
1408
+ const data = await readJSON(p);
1409
+ data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
1410
+ return writeJSON(p, data);
1403
1411
  }
1404
1412
  });
1405
- const vscodeDir = path2.join(home, "Library", "Application Support", "Code", "User", "globalStorage");
1406
- agents2.push({
1407
- name: "GitHub Copilot (VS Code)",
1408
- detected: await directoryExists(vscodeDir),
1409
- configPath: "",
1410
- mcpConfig: {}
1411
- });
1412
- const geminiDir = path2.join(home, ".gemini");
1413
1413
  agents2.push({
1414
1414
  name: "Gemini CLI",
1415
- detected: await commandExists2("gemini") || await directoryExists(geminiDir),
1415
+ detected: await commandExists2("gemini") || await directoryExists(path2.join(home, ".gemini")),
1416
1416
  configPath: path2.join(home, ".gemini", "settings.json"),
1417
- mcpConfig: {
1418
- mcpServers: {
1419
- "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1420
- }
1417
+ writeConfig: async (p) => {
1418
+ const data = await readJSON(p);
1419
+ data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
1420
+ return writeJSON(p, data);
1421
1421
  }
1422
1422
  });
1423
1423
  return agents2;
1424
1424
  }
1425
- async function writeMCPConfig(agent) {
1426
- try {
1427
- const dir = path2.dirname(agent.configPath);
1428
- await fs3.mkdir(dir, { recursive: true });
1429
- let existing = {};
1430
- try {
1431
- const raw = await fs3.readFile(agent.configPath, "utf-8");
1432
- existing = JSON.parse(raw);
1433
- } catch {
1434
- }
1435
- const merged = {
1436
- ...existing,
1437
- mcpServers: {
1438
- ...existing.mcpServers || {},
1439
- ...agent.mcpConfig.mcpServers
1440
- }
1441
- };
1442
- await fs3.writeFile(agent.configPath, JSON.stringify(merged, null, 2));
1443
- return true;
1444
- } catch {
1445
- return false;
1446
- }
1447
- }
1448
1425
  function askQuestion(rl, question) {
1449
1426
  return new Promise((resolve) => rl.question(question, resolve));
1450
1427
  }
@@ -1471,42 +1448,25 @@ async function initCommand(options) {
1471
1448
  console.log("");
1472
1449
  if (options.all) {
1473
1450
  for (const agent of detected) {
1474
- const success = await writeMCPConfig(agent);
1451
+ const success = await agent.writeConfig(agent.configPath);
1475
1452
  if (success) {
1476
1453
  console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
1477
1454
  } else {
1478
- console.log(` \u2717 ${agent.name} \u2192 failed`);
1455
+ console.log(` \u2717 ${agent.name} \u2192 failed to write config`);
1479
1456
  }
1480
1457
  }
1481
1458
  } else if (options.project) {
1482
1459
  const cwd = process.cwd();
1483
- const mcpConfig = {
1484
- mcpServers: {
1485
- "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1486
- }
1487
- };
1488
1460
  const configPath = path2.join(cwd, ".mcp.json");
1489
- let existing = {};
1490
- try {
1491
- const raw = await fs3.readFile(configPath, "utf-8");
1492
- existing = JSON.parse(raw);
1493
- } catch {
1494
- }
1495
- const merged = {
1496
- ...existing,
1497
- mcpServers: {
1498
- ...existing.mcpServers || {},
1499
- ...mcpConfig.mcpServers
1500
- }
1501
- };
1502
- await fs3.writeFile(configPath, JSON.stringify(merged, null, 2));
1461
+ const data = { mcpServers: { "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } } };
1462
+ await writeJSON(configPath, data);
1503
1463
  console.log(` \u2713 .mcp.json created in ${cwd}`);
1504
1464
  } else {
1505
1465
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
1506
1466
  for (const agent of detected) {
1507
1467
  const answer = await askQuestion(rl, ` Configure ${agent.name}? (Y/n) `);
1508
1468
  if (answer.toLowerCase() !== "n") {
1509
- const success = await writeMCPConfig(agent);
1469
+ const success = await agent.writeConfig(agent.configPath);
1510
1470
  if (success) {
1511
1471
  console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
1512
1472
  } else {