make-laten 1.0.3 → 1.1.0

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/cli/index.js CHANGED
@@ -1323,9 +1323,239 @@ Done! Configured for ${installed.length} platform(s).`);
1323
1323
  console.log(" mfetch <url> web fetch + compress");
1324
1324
  }
1325
1325
 
1326
+ // src/cli/commands/init.ts
1327
+ var import_child_process4 = require("child_process");
1328
+ var import_util4 = require("util");
1329
+ var import_promises3 = __toESM(require("fs/promises"));
1330
+ var import_path2 = __toESM(require("path"));
1331
+ var import_readline = __toESM(require("readline"));
1332
+ var execAsync4 = (0, import_util4.promisify)(import_child_process4.exec);
1333
+ function getHome2() {
1334
+ return process.env.HOME || process.env.USERPROFILE || "";
1335
+ }
1336
+ async function commandExists2(cmd) {
1337
+ try {
1338
+ await execAsync4(`which ${cmd}`, { timeout: 3e3 });
1339
+ return true;
1340
+ } catch {
1341
+ return false;
1342
+ }
1343
+ }
1344
+ async function directoryExists(dirPath) {
1345
+ try {
1346
+ await import_promises3.default.access(dirPath);
1347
+ return true;
1348
+ } catch {
1349
+ return false;
1350
+ }
1351
+ }
1352
+ async function detectAllAgents() {
1353
+ const home = getHome2();
1354
+ const agents2 = [];
1355
+ const claudeConfig = import_path2.default.join(home, ".claude", "mcp.json");
1356
+ const claudeDir = import_path2.default.join(home, ".claude");
1357
+ agents2.push({
1358
+ name: "Claude Code",
1359
+ detected: await commandExists2("claude") || await directoryExists(claudeDir),
1360
+ configPath: claudeConfig,
1361
+ mcpConfig: {
1362
+ mcpServers: {
1363
+ "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1364
+ }
1365
+ },
1366
+ version: await commandExists2("claude") ? await execAsync4("claude --version", { timeout: 3e3 }).then((r) => r.stdout.trim().split("\n")[0]).catch(() => "unknown") : void 0
1367
+ });
1368
+ const cursorMcp = import_path2.default.join(home, ".cursor", "mcp.json");
1369
+ const cursorDir = import_path2.default.join(home, ".cursor");
1370
+ agents2.push({
1371
+ name: "Cursor",
1372
+ detected: await directoryExists(cursorDir),
1373
+ configPath: cursorMcp,
1374
+ mcpConfig: {
1375
+ mcpServers: {
1376
+ "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1377
+ }
1378
+ }
1379
+ });
1380
+ const codexMcp = import_path2.default.join(home, ".codex", "config.json");
1381
+ const codexDir = import_path2.default.join(home, ".codex");
1382
+ agents2.push({
1383
+ name: "Codex",
1384
+ detected: await commandExists2("codex") || await directoryExists(codexDir),
1385
+ configPath: codexMcp,
1386
+ mcpConfig: {
1387
+ mcpServers: {
1388
+ "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1389
+ }
1390
+ }
1391
+ });
1392
+ const windsurfMcp = import_path2.default.join(home, ".codeium", "windsurf", "mcp_config.json");
1393
+ const windsurfDir = import_path2.default.join(home, ".codeium", "windsurf");
1394
+ agents2.push({
1395
+ name: "Windsurf",
1396
+ detected: await directoryExists(windsurfDir),
1397
+ configPath: windsurfMcp,
1398
+ mcpConfig: {
1399
+ mcpServers: {
1400
+ "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1401
+ }
1402
+ }
1403
+ });
1404
+ const openCodeConfig = import_path2.default.join(home, ".config", "opencode", "opencode.json");
1405
+ const openCodeDir = import_path2.default.join(home, ".config", "opencode");
1406
+ agents2.push({
1407
+ name: "OpenCode",
1408
+ detected: await directoryExists(openCodeDir),
1409
+ configPath: openCodeConfig,
1410
+ mcpConfig: {
1411
+ mcpServers: {
1412
+ "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1413
+ }
1414
+ }
1415
+ });
1416
+ const clineDir = import_path2.default.join(home, ".cline");
1417
+ const clineMcp = import_path2.default.join(home, ".cline", "mcp_settings.json");
1418
+ agents2.push({
1419
+ name: "Cline",
1420
+ detected: await directoryExists(clineDir),
1421
+ configPath: clineMcp,
1422
+ mcpConfig: {
1423
+ mcpServers: {
1424
+ "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1425
+ }
1426
+ }
1427
+ });
1428
+ const vscodeDir = import_path2.default.join(home, "Library", "Application Support", "Code", "User", "globalStorage");
1429
+ agents2.push({
1430
+ name: "GitHub Copilot (VS Code)",
1431
+ detected: await directoryExists(vscodeDir),
1432
+ configPath: "",
1433
+ mcpConfig: {}
1434
+ });
1435
+ const geminiDir = import_path2.default.join(home, ".gemini");
1436
+ agents2.push({
1437
+ name: "Gemini CLI",
1438
+ detected: await commandExists2("gemini") || await directoryExists(geminiDir),
1439
+ configPath: import_path2.default.join(home, ".gemini", "settings.json"),
1440
+ mcpConfig: {
1441
+ mcpServers: {
1442
+ "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1443
+ }
1444
+ }
1445
+ });
1446
+ return agents2;
1447
+ }
1448
+ async function writeMCPConfig(agent) {
1449
+ try {
1450
+ const dir = import_path2.default.dirname(agent.configPath);
1451
+ await import_promises3.default.mkdir(dir, { recursive: true });
1452
+ let existing = {};
1453
+ try {
1454
+ const raw = await import_promises3.default.readFile(agent.configPath, "utf-8");
1455
+ existing = JSON.parse(raw);
1456
+ } catch {
1457
+ }
1458
+ const merged = {
1459
+ ...existing,
1460
+ mcpServers: {
1461
+ ...existing.mcpServers || {},
1462
+ ...agent.mcpConfig.mcpServers
1463
+ }
1464
+ };
1465
+ await import_promises3.default.writeFile(agent.configPath, JSON.stringify(merged, null, 2));
1466
+ return true;
1467
+ } catch {
1468
+ return false;
1469
+ }
1470
+ }
1471
+ function askQuestion(rl, question) {
1472
+ return new Promise((resolve) => rl.question(question, resolve));
1473
+ }
1474
+ async function initCommand(options) {
1475
+ console.log("");
1476
+ console.log(" make-laten setup wizard");
1477
+ console.log(" ======================");
1478
+ console.log("");
1479
+ const agents2 = await detectAllAgents();
1480
+ const detected = agents2.filter((a) => a.detected);
1481
+ const notDetected = agents2.filter((a) => !a.detected);
1482
+ console.log(" Detected agents:");
1483
+ for (const agent of detected) {
1484
+ const ver = agent.version ? ` v${agent.version}` : "";
1485
+ console.log(` \u2713 ${agent.name}${ver}`);
1486
+ }
1487
+ if (notDetected.length > 0) {
1488
+ console.log("");
1489
+ console.log(" Not detected (skipped):");
1490
+ for (const agent of notDetected) {
1491
+ console.log(` \u25CB ${agent.name}`);
1492
+ }
1493
+ }
1494
+ console.log("");
1495
+ if (options.all) {
1496
+ for (const agent of detected) {
1497
+ const success = await writeMCPConfig(agent);
1498
+ if (success) {
1499
+ console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
1500
+ } else {
1501
+ console.log(` \u2717 ${agent.name} \u2192 failed`);
1502
+ }
1503
+ }
1504
+ } else if (options.project) {
1505
+ const cwd = process.cwd();
1506
+ const mcpConfig = {
1507
+ mcpServers: {
1508
+ "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
1509
+ }
1510
+ };
1511
+ const configPath = import_path2.default.join(cwd, ".mcp.json");
1512
+ let existing = {};
1513
+ try {
1514
+ const raw = await import_promises3.default.readFile(configPath, "utf-8");
1515
+ existing = JSON.parse(raw);
1516
+ } catch {
1517
+ }
1518
+ const merged = {
1519
+ ...existing,
1520
+ mcpServers: {
1521
+ ...existing.mcpServers || {},
1522
+ ...mcpConfig.mcpServers
1523
+ }
1524
+ };
1525
+ await import_promises3.default.writeFile(configPath, JSON.stringify(merged, null, 2));
1526
+ console.log(` \u2713 .mcp.json created in ${cwd}`);
1527
+ } else {
1528
+ const rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
1529
+ for (const agent of detected) {
1530
+ const answer = await askQuestion(rl, ` Configure ${agent.name}? (Y/n) `);
1531
+ if (answer.toLowerCase() !== "n") {
1532
+ const success = await writeMCPConfig(agent);
1533
+ if (success) {
1534
+ console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
1535
+ } else {
1536
+ console.log(` \u2717 ${agent.name} \u2192 failed`);
1537
+ }
1538
+ } else {
1539
+ console.log(` \u25CB ${agent.name} \u2192 skipped`);
1540
+ }
1541
+ }
1542
+ rl.close();
1543
+ }
1544
+ console.log("");
1545
+ console.log(" Setup complete!");
1546
+ console.log("");
1547
+ console.log(" make-laten provides:");
1548
+ console.log(" \u2022 MCP server \u2192 auto-compress for all AI agents");
1549
+ console.log(" \u2022 CLI commands \u2192 mread, mgrep, mdiff, msearch, mfetch");
1550
+ console.log(" \u2022 Shell aliases \u2192 auto-load in new terminals");
1551
+ console.log("");
1552
+ console.log(" Restart your agent to activate MCP tools.");
1553
+ console.log("");
1554
+ }
1555
+
1326
1556
  // src/cli/index.ts
1327
1557
  var program = new import_commander.Command();
1328
- program.name("make-laten").description("Universal efficiency skill for AI coding agents").version("0.1.0");
1558
+ program.name("make-laten").description("Universal efficiency toolkit for AI coding agents").version("1.0.3");
1329
1559
  program.command("read").description("Compressed file read").argument("<file>", "File path").action(readCommand);
1330
1560
  program.command("grep").description("Compressed grep with file grouping").argument("<pattern>", "Search pattern").argument("[directory]", "Directory to search", ".").option("-i, --ignore <ext>", "File extension to ignore").action(grepCommand);
1331
1561
  var gitCmd = program.command("git").description("Git operations");
@@ -1336,6 +1566,7 @@ cacheCmd.command("stats").description("Show cache statistics").action(cacheStats
1336
1566
  cacheCmd.command("clear").description("Clear cache").action(cacheClearCommand);
1337
1567
  program.command("search").description("Search the web").argument("<query>", "Search query").option("-b, --backend <backend>", "Search backend").option("-m, --max <n>", "Max results", "5").action(searchCommand);
1338
1568
  program.command("fetch").description("Fetch and compress web content").argument("<url>", "URL to fetch").option("--no-compress", "Disable compression").option("--no-extract", "Disable semantic extraction").action(fetchCommand);
1339
- program.command("install").description("Install make-laten adapters for detected agents").option("-u, --uninstall", "Remove adapters").option("-s, --status", "Show installation status").action(installCommand);
1569
+ program.command("install").description("Install make-laten across all detected platforms").option("-u, --uninstall", "Remove adapters").option("-s, --status", "Show installation status").action(installCommand);
1570
+ program.command("init").description("Interactive setup wizard \u2014 detect agents & configure MCP").option("-a, --all", "Configure all detected agents (no prompts)").option("-p, --project", "Create .mcp.json in current directory only").action(initCommand);
1340
1571
  program.parse();
1341
1572
  //# sourceMappingURL=index.js.map