make-laten 1.0.1 → 1.0.3
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 +299 -260
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +299 -260
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.js +352 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +352 -69
- package/dist/index.mjs.map +1 -1
- package/dist/mcp/server.js +402 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/server.mjs +379 -0
- package/dist/mcp/server.mjs.map +1 -0
- package/package.json +12 -5
- package/shell/init.sh +62 -0
package/dist/index.js
CHANGED
|
@@ -1085,22 +1085,361 @@ var RulesAdapter = class {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
};
|
|
1087
1087
|
|
|
1088
|
-
// src/adapter/
|
|
1089
|
-
var import_child_process = require("child_process");
|
|
1090
|
-
var import_util = require("util");
|
|
1088
|
+
// src/adapter/installer.ts
|
|
1091
1089
|
var import_promises3 = __toESM(require("fs/promises"));
|
|
1092
1090
|
var import_path3 = __toESM(require("path"));
|
|
1091
|
+
var import_child_process = require("child_process");
|
|
1092
|
+
var import_util = require("util");
|
|
1093
1093
|
var execAsync = (0, import_util.promisify)(import_child_process.exec);
|
|
1094
|
+
var RULES_CONTENT = `
|
|
1095
|
+
# make-laten efficiency rules
|
|
1096
|
+
|
|
1097
|
+
## Token Optimization
|
|
1098
|
+
- When reading files, use \`make-laten read <file>\` for compressed output
|
|
1099
|
+
- When searching code, use \`make-laten grep <pattern>\` for grouped results
|
|
1100
|
+
- When checking git, use \`make-laten git diff\` for condensed output
|
|
1101
|
+
- When fetching web, use \`make-laten fetch <url>\` for compressed content
|
|
1102
|
+
|
|
1103
|
+
## Quick Commands
|
|
1104
|
+
- \`mread <file>\` \u2014 alias for make-laten read
|
|
1105
|
+
- \`mgrep <pattern>\` \u2014 alias for make-laten grep
|
|
1106
|
+
- \`mdiff\` \u2014 alias for make-laten git diff
|
|
1107
|
+
- \`msearch <query>\` \u2014 alias for make-laten search
|
|
1108
|
+
- \`mfetch <url>\` \u2014 alias for make-laten fetch
|
|
1109
|
+
`;
|
|
1110
|
+
function getHome() {
|
|
1111
|
+
return process.env.HOME || process.env.USERPROFILE || "";
|
|
1112
|
+
}
|
|
1113
|
+
async function commandExists(cmd) {
|
|
1114
|
+
try {
|
|
1115
|
+
await execAsync(`which ${cmd}`, { timeout: 3e3 });
|
|
1116
|
+
return true;
|
|
1117
|
+
} catch {
|
|
1118
|
+
return false;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
var agents = [
|
|
1122
|
+
{
|
|
1123
|
+
name: "terminal (shell aliases)",
|
|
1124
|
+
detected: async () => true,
|
|
1125
|
+
install: async () => {
|
|
1126
|
+
const shellInit = await execAsync("echo $SHELL").then((r) => r.stdout.trim());
|
|
1127
|
+
const rcFile = shellInit.includes("zsh") ? ".zshrc" : ".bashrc";
|
|
1128
|
+
const rcPath = import_path3.default.join(getHome(), rcFile);
|
|
1129
|
+
const marker = "make-laten shell";
|
|
1130
|
+
let existing = "";
|
|
1131
|
+
try {
|
|
1132
|
+
existing = await import_promises3.default.readFile(rcPath, "utf-8");
|
|
1133
|
+
} catch {
|
|
1134
|
+
}
|
|
1135
|
+
if (!existing.includes(marker)) {
|
|
1136
|
+
const npmRoot = await execAsync("npm root -g").then((r) => r.stdout.trim());
|
|
1137
|
+
const initScript = `
|
|
1138
|
+
# make-laten shell integration
|
|
1139
|
+
source ${npmRoot}/make-laten/shell/init.sh
|
|
1140
|
+
`;
|
|
1141
|
+
await import_promises3.default.appendFile(rcPath, initScript);
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
uninstall: async () => {
|
|
1145
|
+
const shellInit = await execAsync("echo $SHELL").then((r) => r.stdout.trim());
|
|
1146
|
+
const rcFile = shellInit.includes("zsh") ? ".zshrc" : ".bashrc";
|
|
1147
|
+
const rcPath = import_path3.default.join(getHome(), rcFile);
|
|
1148
|
+
try {
|
|
1149
|
+
let content = await import_promises3.default.readFile(rcPath, "utf-8");
|
|
1150
|
+
content = content.replace(/\n# make-laten shell integration\nsource .*\/make-laten\/shell\/init\.sh\n/g, "");
|
|
1151
|
+
await import_promises3.default.writeFile(rcPath, content);
|
|
1152
|
+
} catch {
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
name: "claude-code",
|
|
1158
|
+
detected: async () => commandExists("claude"),
|
|
1159
|
+
install: async () => {
|
|
1160
|
+
const hooksDir = import_path3.default.join(getHome(), ".claude", "hooks");
|
|
1161
|
+
await import_promises3.default.mkdir(hooksDir, { recursive: true });
|
|
1162
|
+
const preHook = `#!/usr/bin/env node
|
|
1163
|
+
const { readFileSync } = require('fs');
|
|
1164
|
+
const input = JSON.parse(readFileSync('/dev/stdin', 'utf-8'));
|
|
1165
|
+
if (input.tool === 'Read' || input.tool === 'Bash') {
|
|
1166
|
+
process.env.MAKE_LATEN_INTERCEPT = '1';
|
|
1167
|
+
}
|
|
1168
|
+
process.stdout.write(JSON.stringify(input));`;
|
|
1169
|
+
const postHook = `#!/usr/bin/env node
|
|
1170
|
+
const { readFileSync } = require('fs');
|
|
1171
|
+
const input = JSON.parse(readFileSync('/dev/stdin', 'utf-8'));
|
|
1172
|
+
if (input.output && input.output.length > 10000) {
|
|
1173
|
+
input.output = input.output.slice(0, 10000) + '\\n... (truncated by make-laten)';
|
|
1174
|
+
}
|
|
1175
|
+
process.stdout.write(JSON.stringify(input));`;
|
|
1176
|
+
await import_promises3.default.writeFile(import_path3.default.join(hooksDir, "pre-tool-use.js"), preHook);
|
|
1177
|
+
await import_promises3.default.writeFile(import_path3.default.join(hooksDir, "post-tool-use.js"), postHook);
|
|
1178
|
+
},
|
|
1179
|
+
uninstall: async () => {
|
|
1180
|
+
const hooksDir = import_path3.default.join(getHome(), ".claude", "hooks");
|
|
1181
|
+
try {
|
|
1182
|
+
await import_promises3.default.rm(import_path3.default.join(hooksDir, "pre-tool-use.js"), { force: true });
|
|
1183
|
+
} catch {
|
|
1184
|
+
}
|
|
1185
|
+
try {
|
|
1186
|
+
await import_promises3.default.rm(import_path3.default.join(hooksDir, "post-tool-use.js"), { force: true });
|
|
1187
|
+
} catch {
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
name: "cursor",
|
|
1193
|
+
detected: async () => {
|
|
1194
|
+
try {
|
|
1195
|
+
await import_promises3.default.access(import_path3.default.join(getHome(), ".cursor"));
|
|
1196
|
+
return true;
|
|
1197
|
+
} catch {
|
|
1198
|
+
return false;
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
install: async () => {
|
|
1202
|
+
const rulesDir = import_path3.default.join(getHome(), ".cursor", "rules");
|
|
1203
|
+
await import_promises3.default.mkdir(rulesDir, { recursive: true });
|
|
1204
|
+
const ruleFile = import_path3.default.join(rulesDir, "make-laten.mdc");
|
|
1205
|
+
const content = `---
|
|
1206
|
+
description: make-laten efficiency rules
|
|
1207
|
+
globs:
|
|
1208
|
+
---
|
|
1209
|
+
${RULES_CONTENT}`;
|
|
1210
|
+
await import_promises3.default.writeFile(ruleFile, content);
|
|
1211
|
+
},
|
|
1212
|
+
uninstall: async () => {
|
|
1213
|
+
try {
|
|
1214
|
+
await import_promises3.default.rm(import_path3.default.join(getHome(), ".cursor", "rules", "make-laten.mdc"), { force: true });
|
|
1215
|
+
} catch {
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
name: "codex",
|
|
1221
|
+
detected: async () => commandExists("codex"),
|
|
1222
|
+
install: async () => {
|
|
1223
|
+
const agentsMd = import_path3.default.join(process.cwd(), "AGENTS.md");
|
|
1224
|
+
let existing = "";
|
|
1225
|
+
try {
|
|
1226
|
+
existing = await import_promises3.default.readFile(agentsMd, "utf-8");
|
|
1227
|
+
} catch {
|
|
1228
|
+
}
|
|
1229
|
+
if (!existing.includes("make-laten")) {
|
|
1230
|
+
const content = existing + "\n\n## make-laten Integration\n" + RULES_CONTENT;
|
|
1231
|
+
await import_promises3.default.writeFile(agentsMd, content);
|
|
1232
|
+
}
|
|
1233
|
+
},
|
|
1234
|
+
uninstall: async () => {
|
|
1235
|
+
try {
|
|
1236
|
+
let content = await import_promises3.default.readFile(import_path3.default.join(process.cwd(), "AGENTS.md"), "utf-8");
|
|
1237
|
+
content = content.replace(/\n## make-laten Integration[\s\S]*$/, "");
|
|
1238
|
+
await import_promises3.default.writeFile(import_path3.default.join(process.cwd(), "AGENTS.md"), content.trim() + "\n");
|
|
1239
|
+
} catch {
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
name: "windsurf",
|
|
1245
|
+
detected: async () => {
|
|
1246
|
+
try {
|
|
1247
|
+
await import_promises3.default.access(import_path3.default.join(process.cwd(), ".windsurf"));
|
|
1248
|
+
return true;
|
|
1249
|
+
} catch {
|
|
1250
|
+
try {
|
|
1251
|
+
await import_promises3.default.access(import_path3.default.join(getHome(), ".windsurf"));
|
|
1252
|
+
return true;
|
|
1253
|
+
} catch {
|
|
1254
|
+
return false;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
},
|
|
1258
|
+
install: async () => {
|
|
1259
|
+
const rulesPath = import_path3.default.join(process.cwd(), ".windsurfrules");
|
|
1260
|
+
let existing = "";
|
|
1261
|
+
try {
|
|
1262
|
+
existing = await import_promises3.default.readFile(rulesPath, "utf-8");
|
|
1263
|
+
} catch {
|
|
1264
|
+
}
|
|
1265
|
+
if (!existing.includes("make-laten")) {
|
|
1266
|
+
await import_promises3.default.writeFile(rulesPath, existing + "\n\n" + RULES_CONTENT);
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1269
|
+
uninstall: async () => {
|
|
1270
|
+
try {
|
|
1271
|
+
let content = await import_promises3.default.readFile(import_path3.default.join(process.cwd(), ".windsurfrules"), "utf-8");
|
|
1272
|
+
content = content.replace(/\n# make-laten efficiency rules[\s\S]*$/, "");
|
|
1273
|
+
await import_promises3.default.writeFile(import_path3.default.join(process.cwd(), ".windsurfrules"), content.trim() + "\n");
|
|
1274
|
+
} catch {
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
name: "cline",
|
|
1280
|
+
detected: async () => {
|
|
1281
|
+
try {
|
|
1282
|
+
await import_promises3.default.access(import_path3.default.join(process.cwd(), ".clinerules"));
|
|
1283
|
+
return true;
|
|
1284
|
+
} catch {
|
|
1285
|
+
try {
|
|
1286
|
+
await import_promises3.default.access(import_path3.default.join(getHome(), ".cline"));
|
|
1287
|
+
return true;
|
|
1288
|
+
} catch {
|
|
1289
|
+
return false;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
install: async () => {
|
|
1294
|
+
const rulesPath = import_path3.default.join(process.cwd(), ".clinerules");
|
|
1295
|
+
let existing = "";
|
|
1296
|
+
try {
|
|
1297
|
+
existing = await import_promises3.default.readFile(rulesPath, "utf-8");
|
|
1298
|
+
} catch {
|
|
1299
|
+
}
|
|
1300
|
+
if (!existing.includes("make-laten")) {
|
|
1301
|
+
await import_promises3.default.writeFile(rulesPath, existing + "\n\n" + RULES_CONTENT);
|
|
1302
|
+
}
|
|
1303
|
+
},
|
|
1304
|
+
uninstall: async () => {
|
|
1305
|
+
try {
|
|
1306
|
+
let content = await import_promises3.default.readFile(import_path3.default.join(process.cwd(), ".clinerules"), "utf-8");
|
|
1307
|
+
content = content.replace(/\n# make-laten efficiency rules[\s\S]*$/, "");
|
|
1308
|
+
await import_promises3.default.writeFile(import_path3.default.join(process.cwd(), ".clinerules"), content.trim() + "\n");
|
|
1309
|
+
} catch {
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
name: "copilot",
|
|
1315
|
+
detected: async () => {
|
|
1316
|
+
try {
|
|
1317
|
+
await import_promises3.default.access(import_path3.default.join(process.cwd(), ".github"));
|
|
1318
|
+
return true;
|
|
1319
|
+
} catch {
|
|
1320
|
+
return false;
|
|
1321
|
+
}
|
|
1322
|
+
},
|
|
1323
|
+
install: async () => {
|
|
1324
|
+
const dir = import_path3.default.join(process.cwd(), ".github");
|
|
1325
|
+
await import_promises3.default.mkdir(dir, { recursive: true });
|
|
1326
|
+
const instructionsPath = import_path3.default.join(dir, "copilot-instructions.md");
|
|
1327
|
+
let existing = "";
|
|
1328
|
+
try {
|
|
1329
|
+
existing = await import_promises3.default.readFile(instructionsPath, "utf-8");
|
|
1330
|
+
} catch {
|
|
1331
|
+
}
|
|
1332
|
+
if (!existing.includes("make-laten")) {
|
|
1333
|
+
await import_promises3.default.writeFile(instructionsPath, existing + "\n\n## make-laten Efficiency\n" + RULES_CONTENT);
|
|
1334
|
+
}
|
|
1335
|
+
},
|
|
1336
|
+
uninstall: async () => {
|
|
1337
|
+
try {
|
|
1338
|
+
let content = await import_promises3.default.readFile(import_path3.default.join(process.cwd(), ".github", "copilot-instructions.md"), "utf-8");
|
|
1339
|
+
content = content.replace(/\n## make-laten Efficiency[\s\S]*$/, "");
|
|
1340
|
+
await import_promises3.default.writeFile(import_path3.default.join(process.cwd(), ".github", "copilot-instructions.md"), content.trim() + "\n");
|
|
1341
|
+
} catch {
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
name: "opencode",
|
|
1347
|
+
detected: async () => {
|
|
1348
|
+
try {
|
|
1349
|
+
await import_promises3.default.access(import_path3.default.join(getHome(), ".config", "opencode"));
|
|
1350
|
+
return true;
|
|
1351
|
+
} catch {
|
|
1352
|
+
return false;
|
|
1353
|
+
}
|
|
1354
|
+
},
|
|
1355
|
+
install: async () => {
|
|
1356
|
+
const skillsDir = import_path3.default.join(getHome(), ".config", "opencode", "skills", "make-laten");
|
|
1357
|
+
await import_promises3.default.mkdir(skillsDir, { recursive: true });
|
|
1358
|
+
const npmRoot = await execAsync("npm root -g").then((r) => r.stdout.trim());
|
|
1359
|
+
const skillSrc = import_path3.default.join(npmRoot, "make-laten", "skills", "SKILL.md");
|
|
1360
|
+
try {
|
|
1361
|
+
const skillContent = await import_promises3.default.readFile(skillSrc, "utf-8");
|
|
1362
|
+
await import_promises3.default.writeFile(import_path3.default.join(skillsDir, "SKILL.md"), skillContent);
|
|
1363
|
+
} catch {
|
|
1364
|
+
await import_promises3.default.writeFile(import_path3.default.join(skillsDir, "SKILL.md"), `---
|
|
1365
|
+
name: make-laten
|
|
1366
|
+
description: Token optimization toolkit
|
|
1367
|
+
---
|
|
1368
|
+
|
|
1369
|
+
# make-laten Skill
|
|
1370
|
+
|
|
1371
|
+
Use make-laten CLI commands for all file/code/git operations.
|
|
1372
|
+
`);
|
|
1373
|
+
}
|
|
1374
|
+
},
|
|
1375
|
+
uninstall: async () => {
|
|
1376
|
+
try {
|
|
1377
|
+
await import_promises3.default.rm(import_path3.default.join(getHome(), ".config", "opencode", "skills", "make-laten"), { recursive: true, force: true });
|
|
1378
|
+
} catch {
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
];
|
|
1383
|
+
var Installer = class {
|
|
1384
|
+
async install() {
|
|
1385
|
+
const installed = [];
|
|
1386
|
+
const skipped = [];
|
|
1387
|
+
for (const agent of agents) {
|
|
1388
|
+
try {
|
|
1389
|
+
const detected = await agent.detected();
|
|
1390
|
+
if (detected) {
|
|
1391
|
+
await agent.install();
|
|
1392
|
+
installed.push(agent.name);
|
|
1393
|
+
} else {
|
|
1394
|
+
skipped.push(agent.name);
|
|
1395
|
+
}
|
|
1396
|
+
} catch {
|
|
1397
|
+
skipped.push(agent.name);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return { installed, skipped };
|
|
1401
|
+
}
|
|
1402
|
+
async uninstall() {
|
|
1403
|
+
const removed = [];
|
|
1404
|
+
for (const agent of agents) {
|
|
1405
|
+
try {
|
|
1406
|
+
await agent.uninstall();
|
|
1407
|
+
removed.push(agent.name);
|
|
1408
|
+
} catch {
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
return { removed };
|
|
1412
|
+
}
|
|
1413
|
+
async status() {
|
|
1414
|
+
const result = [];
|
|
1415
|
+
for (const agent of agents) {
|
|
1416
|
+
try {
|
|
1417
|
+
const detected = await agent.detected();
|
|
1418
|
+
result.push({ name: agent.name, detected, installed: false });
|
|
1419
|
+
} catch {
|
|
1420
|
+
result.push({ name: agent.name, detected: false, installed: false });
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
return result;
|
|
1424
|
+
}
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
// src/adapter/detector.ts
|
|
1428
|
+
var import_child_process2 = require("child_process");
|
|
1429
|
+
var import_util2 = require("util");
|
|
1430
|
+
var import_promises4 = __toESM(require("fs/promises"));
|
|
1431
|
+
var import_path4 = __toESM(require("path"));
|
|
1432
|
+
var execAsync2 = (0, import_util2.promisify)(import_child_process2.exec);
|
|
1094
1433
|
var AgentDetector = class {
|
|
1095
1434
|
async detectAgents() {
|
|
1096
|
-
const
|
|
1435
|
+
const agents2 = [];
|
|
1097
1436
|
for (const [name, config] of Object.entries(AGENT_CONFIGS)) {
|
|
1098
1437
|
const detected = await this.detectAgent(name, config.type);
|
|
1099
1438
|
if (detected) {
|
|
1100
|
-
|
|
1439
|
+
agents2.push(detected);
|
|
1101
1440
|
}
|
|
1102
1441
|
}
|
|
1103
|
-
return
|
|
1442
|
+
return agents2;
|
|
1104
1443
|
}
|
|
1105
1444
|
async detectAgent(name, type) {
|
|
1106
1445
|
const commands = {
|
|
@@ -1110,7 +1449,7 @@ var AgentDetector = class {
|
|
|
1110
1449
|
};
|
|
1111
1450
|
if (commands[name]) {
|
|
1112
1451
|
try {
|
|
1113
|
-
const { stdout } = await
|
|
1452
|
+
const { stdout } = await execAsync2(commands[name], { timeout: 5e3 });
|
|
1114
1453
|
const version = stdout.trim().split("\n")[0];
|
|
1115
1454
|
const agentPath = await this.getAgentPath(name);
|
|
1116
1455
|
return { name, type, path: agentPath, version, detected: true };
|
|
@@ -1122,7 +1461,7 @@ var AgentDetector = class {
|
|
|
1122
1461
|
const rulesPath = AGENT_CONFIGS[name]?.rulesFile;
|
|
1123
1462
|
if (rulesPath) {
|
|
1124
1463
|
try {
|
|
1125
|
-
await
|
|
1464
|
+
await import_promises4.default.access(import_path4.default.join(process.cwd(), rulesPath));
|
|
1126
1465
|
return { name, type, path: process.cwd(), version: null, detected: true };
|
|
1127
1466
|
} catch {
|
|
1128
1467
|
return null;
|
|
@@ -1134,15 +1473,15 @@ var AgentDetector = class {
|
|
|
1134
1473
|
async getAgentPath(name) {
|
|
1135
1474
|
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
1136
1475
|
const paths = {
|
|
1137
|
-
"claude-code":
|
|
1138
|
-
"codex":
|
|
1139
|
-
"gemini-cli":
|
|
1476
|
+
"claude-code": import_path4.default.join(home, ".claude"),
|
|
1477
|
+
"codex": import_path4.default.join(home, ".codex"),
|
|
1478
|
+
"gemini-cli": import_path4.default.join(home, ".gemini")
|
|
1140
1479
|
};
|
|
1141
|
-
return paths[name] ||
|
|
1480
|
+
return paths[name] || import_path4.default.join(home, `.${name}`);
|
|
1142
1481
|
}
|
|
1143
1482
|
async hasCommand(cmd) {
|
|
1144
1483
|
try {
|
|
1145
|
-
await
|
|
1484
|
+
await execAsync2(`which ${cmd}`, { timeout: 3e3 });
|
|
1146
1485
|
return true;
|
|
1147
1486
|
} catch {
|
|
1148
1487
|
return false;
|
|
@@ -1150,62 +1489,6 @@ var AgentDetector = class {
|
|
|
1150
1489
|
}
|
|
1151
1490
|
};
|
|
1152
1491
|
|
|
1153
|
-
// src/adapter/installer.ts
|
|
1154
|
-
var Installer = class {
|
|
1155
|
-
detector = new AgentDetector();
|
|
1156
|
-
async install() {
|
|
1157
|
-
const agents = await this.detector.detectAgents();
|
|
1158
|
-
const installed = [];
|
|
1159
|
-
const skipped = [];
|
|
1160
|
-
for (const agent of agents) {
|
|
1161
|
-
try {
|
|
1162
|
-
const adapter = this.createAdapter(agent);
|
|
1163
|
-
if (adapter.install) {
|
|
1164
|
-
await adapter.install(agent.path);
|
|
1165
|
-
installed.push(agent.name);
|
|
1166
|
-
} else {
|
|
1167
|
-
skipped.push(agent.name);
|
|
1168
|
-
}
|
|
1169
|
-
} catch {
|
|
1170
|
-
skipped.push(agent.name);
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
return { installed, skipped };
|
|
1174
|
-
}
|
|
1175
|
-
async uninstall() {
|
|
1176
|
-
const agents = await this.detector.detectAgents();
|
|
1177
|
-
const removed = [];
|
|
1178
|
-
for (const agent of agents) {
|
|
1179
|
-
try {
|
|
1180
|
-
const adapter = this.createAdapter(agent);
|
|
1181
|
-
if (adapter.uninstall) {
|
|
1182
|
-
await adapter.uninstall(agent.path);
|
|
1183
|
-
removed.push(agent.name);
|
|
1184
|
-
}
|
|
1185
|
-
} catch {
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
return { removed };
|
|
1189
|
-
}
|
|
1190
|
-
async status() {
|
|
1191
|
-
const agents = await this.detector.detectAgents();
|
|
1192
|
-
for (const agent of agents) {
|
|
1193
|
-
const adapter = this.createAdapter(agent);
|
|
1194
|
-
if (adapter.isInstalled) {
|
|
1195
|
-
agent.detected = await adapter.isInstalled(agent.path);
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
return agents;
|
|
1199
|
-
}
|
|
1200
|
-
createAdapter(agent) {
|
|
1201
|
-
const config = AGENT_CONFIGS[agent.name];
|
|
1202
|
-
if (config?.type === "rules") {
|
|
1203
|
-
return new RulesAdapter(agent.name);
|
|
1204
|
-
}
|
|
1205
|
-
return new HookAdapter(agent.name);
|
|
1206
|
-
}
|
|
1207
|
-
};
|
|
1208
|
-
|
|
1209
1492
|
// src/adapter/index.ts
|
|
1210
1493
|
var adapters = /* @__PURE__ */ new Map();
|
|
1211
1494
|
adapters.set("claude-code", new ClaudeCodeAdapter());
|