make-laten 1.0.3 → 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.
@@ -1300,9 +1300,199 @@ Done! Configured for ${installed.length} platform(s).`);
1300
1300
  console.log(" mfetch <url> web fetch + compress");
1301
1301
  }
1302
1302
 
1303
+ // src/cli/commands/init.ts
1304
+ import { exec as exec4 } from "child_process";
1305
+ import { promisify as promisify4 } from "util";
1306
+ import fs3 from "fs/promises";
1307
+ import path2 from "path";
1308
+ import readline from "readline";
1309
+ var execAsync4 = promisify4(exec4);
1310
+ function getHome2() {
1311
+ return process.env.HOME || process.env.USERPROFILE || "";
1312
+ }
1313
+ async function commandExists2(cmd) {
1314
+ try {
1315
+ await execAsync4(`which ${cmd}`, { timeout: 3e3 });
1316
+ return true;
1317
+ } catch {
1318
+ return false;
1319
+ }
1320
+ }
1321
+ async function directoryExists(dirPath) {
1322
+ try {
1323
+ await fs3.access(dirPath);
1324
+ return true;
1325
+ } catch {
1326
+ return false;
1327
+ }
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"];
1348
+ async function detectAllAgents() {
1349
+ const home = getHome2();
1350
+ const agents2 = [];
1351
+ agents2.push({
1352
+ name: "Claude Code",
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
+ }
1361
+ });
1362
+ agents2.push({
1363
+ name: "Cursor",
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);
1370
+ }
1371
+ });
1372
+ agents2.push({
1373
+ name: "Codex",
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);
1380
+ }
1381
+ });
1382
+ agents2.push({
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);
1391
+ }
1392
+ });
1393
+ agents2.push({
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);
1401
+ }
1402
+ });
1403
+ agents2.push({
1404
+ name: "Cline",
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);
1411
+ }
1412
+ });
1413
+ agents2.push({
1414
+ name: "Gemini CLI",
1415
+ detected: await commandExists2("gemini") || await directoryExists(path2.join(home, ".gemini")),
1416
+ configPath: path2.join(home, ".gemini", "settings.json"),
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
+ }
1422
+ });
1423
+ return agents2;
1424
+ }
1425
+ function askQuestion(rl, question) {
1426
+ return new Promise((resolve) => rl.question(question, resolve));
1427
+ }
1428
+ async function initCommand(options) {
1429
+ console.log("");
1430
+ console.log(" make-laten setup wizard");
1431
+ console.log(" ======================");
1432
+ console.log("");
1433
+ const agents2 = await detectAllAgents();
1434
+ const detected = agents2.filter((a) => a.detected);
1435
+ const notDetected = agents2.filter((a) => !a.detected);
1436
+ console.log(" Detected agents:");
1437
+ for (const agent of detected) {
1438
+ const ver = agent.version ? ` v${agent.version}` : "";
1439
+ console.log(` \u2713 ${agent.name}${ver}`);
1440
+ }
1441
+ if (notDetected.length > 0) {
1442
+ console.log("");
1443
+ console.log(" Not detected (skipped):");
1444
+ for (const agent of notDetected) {
1445
+ console.log(` \u25CB ${agent.name}`);
1446
+ }
1447
+ }
1448
+ console.log("");
1449
+ if (options.all) {
1450
+ for (const agent of detected) {
1451
+ const success = await agent.writeConfig(agent.configPath);
1452
+ if (success) {
1453
+ console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
1454
+ } else {
1455
+ console.log(` \u2717 ${agent.name} \u2192 failed to write config`);
1456
+ }
1457
+ }
1458
+ } else if (options.project) {
1459
+ const cwd = process.cwd();
1460
+ const configPath = path2.join(cwd, ".mcp.json");
1461
+ const data = { mcpServers: { "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } } };
1462
+ await writeJSON(configPath, data);
1463
+ console.log(` \u2713 .mcp.json created in ${cwd}`);
1464
+ } else {
1465
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
1466
+ for (const agent of detected) {
1467
+ const answer = await askQuestion(rl, ` Configure ${agent.name}? (Y/n) `);
1468
+ if (answer.toLowerCase() !== "n") {
1469
+ const success = await agent.writeConfig(agent.configPath);
1470
+ if (success) {
1471
+ console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
1472
+ } else {
1473
+ console.log(` \u2717 ${agent.name} \u2192 failed`);
1474
+ }
1475
+ } else {
1476
+ console.log(` \u25CB ${agent.name} \u2192 skipped`);
1477
+ }
1478
+ }
1479
+ rl.close();
1480
+ }
1481
+ console.log("");
1482
+ console.log(" Setup complete!");
1483
+ console.log("");
1484
+ console.log(" make-laten provides:");
1485
+ console.log(" \u2022 MCP server \u2192 auto-compress for all AI agents");
1486
+ console.log(" \u2022 CLI commands \u2192 mread, mgrep, mdiff, msearch, mfetch");
1487
+ console.log(" \u2022 Shell aliases \u2192 auto-load in new terminals");
1488
+ console.log("");
1489
+ console.log(" Restart your agent to activate MCP tools.");
1490
+ console.log("");
1491
+ }
1492
+
1303
1493
  // src/cli/index.ts
1304
1494
  var program = new Command();
1305
- program.name("make-laten").description("Universal efficiency skill for AI coding agents").version("0.1.0");
1495
+ program.name("make-laten").description("Universal efficiency toolkit for AI coding agents").version("1.0.3");
1306
1496
  program.command("read").description("Compressed file read").argument("<file>", "File path").action(readCommand);
1307
1497
  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);
1308
1498
  var gitCmd = program.command("git").description("Git operations");
@@ -1313,6 +1503,7 @@ cacheCmd.command("stats").description("Show cache statistics").action(cacheStats
1313
1503
  cacheCmd.command("clear").description("Clear cache").action(cacheClearCommand);
1314
1504
  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);
1315
1505
  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);
1316
- program.command("install").description("Install make-laten adapters for detected agents").option("-u, --uninstall", "Remove adapters").option("-s, --status", "Show installation status").action(installCommand);
1506
+ program.command("install").description("Install make-laten across all detected platforms").option("-u, --uninstall", "Remove adapters").option("-s, --status", "Show installation status").action(installCommand);
1507
+ 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);
1317
1508
  program.parse();
1318
1509
  //# sourceMappingURL=index.mjs.map