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 +233 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +233 -2
- package/dist/cli/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1300,9 +1300,239 @@ 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 detectAllAgents() {
|
|
1330
|
+
const home = getHome2();
|
|
1331
|
+
const agents2 = [];
|
|
1332
|
+
const claudeConfig = path2.join(home, ".claude", "mcp.json");
|
|
1333
|
+
const claudeDir = path2.join(home, ".claude");
|
|
1334
|
+
agents2.push({
|
|
1335
|
+
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
|
|
1344
|
+
});
|
|
1345
|
+
const cursorMcp = path2.join(home, ".cursor", "mcp.json");
|
|
1346
|
+
const cursorDir = path2.join(home, ".cursor");
|
|
1347
|
+
agents2.push({
|
|
1348
|
+
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
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
const codexMcp = path2.join(home, ".codex", "config.json");
|
|
1358
|
+
const codexDir = path2.join(home, ".codex");
|
|
1359
|
+
agents2.push({
|
|
1360
|
+
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
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
const windsurfMcp = path2.join(home, ".codeium", "windsurf", "mcp_config.json");
|
|
1370
|
+
const windsurfDir = path2.join(home, ".codeium", "windsurf");
|
|
1371
|
+
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
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
const openCodeConfig = path2.join(home, ".config", "opencode", "opencode.json");
|
|
1382
|
+
const openCodeDir = path2.join(home, ".config", "opencode");
|
|
1383
|
+
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
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
const clineDir = path2.join(home, ".cline");
|
|
1394
|
+
const clineMcp = path2.join(home, ".cline", "mcp_settings.json");
|
|
1395
|
+
agents2.push({
|
|
1396
|
+
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
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
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
|
+
agents2.push({
|
|
1414
|
+
name: "Gemini CLI",
|
|
1415
|
+
detected: await commandExists2("gemini") || await directoryExists(geminiDir),
|
|
1416
|
+
configPath: path2.join(home, ".gemini", "settings.json"),
|
|
1417
|
+
mcpConfig: {
|
|
1418
|
+
mcpServers: {
|
|
1419
|
+
"make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
});
|
|
1423
|
+
return agents2;
|
|
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
|
+
function askQuestion(rl, question) {
|
|
1449
|
+
return new Promise((resolve) => rl.question(question, resolve));
|
|
1450
|
+
}
|
|
1451
|
+
async function initCommand(options) {
|
|
1452
|
+
console.log("");
|
|
1453
|
+
console.log(" make-laten setup wizard");
|
|
1454
|
+
console.log(" ======================");
|
|
1455
|
+
console.log("");
|
|
1456
|
+
const agents2 = await detectAllAgents();
|
|
1457
|
+
const detected = agents2.filter((a) => a.detected);
|
|
1458
|
+
const notDetected = agents2.filter((a) => !a.detected);
|
|
1459
|
+
console.log(" Detected agents:");
|
|
1460
|
+
for (const agent of detected) {
|
|
1461
|
+
const ver = agent.version ? ` v${agent.version}` : "";
|
|
1462
|
+
console.log(` \u2713 ${agent.name}${ver}`);
|
|
1463
|
+
}
|
|
1464
|
+
if (notDetected.length > 0) {
|
|
1465
|
+
console.log("");
|
|
1466
|
+
console.log(" Not detected (skipped):");
|
|
1467
|
+
for (const agent of notDetected) {
|
|
1468
|
+
console.log(` \u25CB ${agent.name}`);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
console.log("");
|
|
1472
|
+
if (options.all) {
|
|
1473
|
+
for (const agent of detected) {
|
|
1474
|
+
const success = await writeMCPConfig(agent);
|
|
1475
|
+
if (success) {
|
|
1476
|
+
console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
|
|
1477
|
+
} else {
|
|
1478
|
+
console.log(` \u2717 ${agent.name} \u2192 failed`);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
} else if (options.project) {
|
|
1482
|
+
const cwd = process.cwd();
|
|
1483
|
+
const mcpConfig = {
|
|
1484
|
+
mcpServers: {
|
|
1485
|
+
"make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
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));
|
|
1503
|
+
console.log(` \u2713 .mcp.json created in ${cwd}`);
|
|
1504
|
+
} else {
|
|
1505
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
1506
|
+
for (const agent of detected) {
|
|
1507
|
+
const answer = await askQuestion(rl, ` Configure ${agent.name}? (Y/n) `);
|
|
1508
|
+
if (answer.toLowerCase() !== "n") {
|
|
1509
|
+
const success = await writeMCPConfig(agent);
|
|
1510
|
+
if (success) {
|
|
1511
|
+
console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
|
|
1512
|
+
} else {
|
|
1513
|
+
console.log(` \u2717 ${agent.name} \u2192 failed`);
|
|
1514
|
+
}
|
|
1515
|
+
} else {
|
|
1516
|
+
console.log(` \u25CB ${agent.name} \u2192 skipped`);
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
rl.close();
|
|
1520
|
+
}
|
|
1521
|
+
console.log("");
|
|
1522
|
+
console.log(" Setup complete!");
|
|
1523
|
+
console.log("");
|
|
1524
|
+
console.log(" make-laten provides:");
|
|
1525
|
+
console.log(" \u2022 MCP server \u2192 auto-compress for all AI agents");
|
|
1526
|
+
console.log(" \u2022 CLI commands \u2192 mread, mgrep, mdiff, msearch, mfetch");
|
|
1527
|
+
console.log(" \u2022 Shell aliases \u2192 auto-load in new terminals");
|
|
1528
|
+
console.log("");
|
|
1529
|
+
console.log(" Restart your agent to activate MCP tools.");
|
|
1530
|
+
console.log("");
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1303
1533
|
// src/cli/index.ts
|
|
1304
1534
|
var program = new Command();
|
|
1305
|
-
program.name("make-laten").description("Universal efficiency
|
|
1535
|
+
program.name("make-laten").description("Universal efficiency toolkit for AI coding agents").version("1.0.3");
|
|
1306
1536
|
program.command("read").description("Compressed file read").argument("<file>", "File path").action(readCommand);
|
|
1307
1537
|
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
1538
|
var gitCmd = program.command("git").description("Git operations");
|
|
@@ -1313,6 +1543,7 @@ cacheCmd.command("stats").description("Show cache statistics").action(cacheStats
|
|
|
1313
1543
|
cacheCmd.command("clear").description("Clear cache").action(cacheClearCommand);
|
|
1314
1544
|
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
1545
|
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
|
|
1546
|
+
program.command("install").description("Install make-laten across all detected platforms").option("-u, --uninstall", "Remove adapters").option("-s, --status", "Show installation status").action(installCommand);
|
|
1547
|
+
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
1548
|
program.parse();
|
|
1318
1549
|
//# sourceMappingURL=index.mjs.map
|