agent-mgr 0.2.0 → 0.2.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.
- package/dist/index.js +23 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -379,40 +379,43 @@ var opencodeAdapter = {
|
|
|
379
379
|
return join5(projectRoot, ".opencode", "commands");
|
|
380
380
|
},
|
|
381
381
|
getMcpConfigPath(scope, projectRoot) {
|
|
382
|
-
if (scope === "global") return join5(homedir4(), ".config", "opencode", "opencode.json");
|
|
383
|
-
return join5(projectRoot, "opencode.json");
|
|
382
|
+
if (scope === "global") return join5(homedir4(), ".config", "opencode", ".opencode.json");
|
|
383
|
+
return join5(projectRoot, ".opencode.json");
|
|
384
384
|
},
|
|
385
385
|
async readMcpConfig(scope, projectRoot) {
|
|
386
386
|
const path = this.getMcpConfigPath(scope, projectRoot);
|
|
387
387
|
const data = readJson(path);
|
|
388
|
-
const
|
|
388
|
+
const mcpServers = data.mcpServers ?? {};
|
|
389
389
|
const result = {};
|
|
390
|
-
for (const [name, cfg] of Object.entries(
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
args: cmd.slice(1),
|
|
397
|
-
env: cfg.environment ?? {}
|
|
398
|
-
};
|
|
390
|
+
for (const [name, cfg] of Object.entries(mcpServers)) {
|
|
391
|
+
const envArray = cfg.env ?? [];
|
|
392
|
+
const envMap = {};
|
|
393
|
+
for (const entry of envArray) {
|
|
394
|
+
const [k, ...v] = entry.split("=");
|
|
395
|
+
if (k) envMap[k] = v.join("=");
|
|
399
396
|
}
|
|
397
|
+
result[name] = {
|
|
398
|
+
name,
|
|
399
|
+
command: cfg.command ?? "",
|
|
400
|
+
args: cfg.args ?? [],
|
|
401
|
+
env: envMap
|
|
402
|
+
};
|
|
400
403
|
}
|
|
401
404
|
return result;
|
|
402
405
|
},
|
|
403
406
|
async writeMcpConfig(servers, scope, projectRoot) {
|
|
404
407
|
const path = this.getMcpConfigPath(scope, projectRoot);
|
|
405
408
|
const existing = readJson(path);
|
|
406
|
-
const
|
|
409
|
+
const mcpServers = existing.mcpServers ?? {};
|
|
407
410
|
for (const [name, server] of Object.entries(servers)) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
command:
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
const envArray = Object.entries(server.env ?? {}).map(([k, v]) => `${k}=${v}`);
|
|
412
|
+
mcpServers[name] = {
|
|
413
|
+
command: server.command,
|
|
414
|
+
args: server.args ?? [],
|
|
415
|
+
env: envArray.length > 0 ? envArray : void 0
|
|
413
416
|
};
|
|
414
417
|
}
|
|
415
|
-
existing.
|
|
418
|
+
existing.mcpServers = mcpServers;
|
|
416
419
|
writeJson(path, existing);
|
|
417
420
|
}
|
|
418
421
|
};
|
|
@@ -1449,7 +1452,7 @@ function syncRepoRemoveCommand(url) {
|
|
|
1449
1452
|
// src/index.ts
|
|
1450
1453
|
program.name("agent-mgr").description(
|
|
1451
1454
|
"Write commands once, sync everywhere. Manage AI agent commands, prompts, and MCP configs."
|
|
1452
|
-
).version("0.2.
|
|
1455
|
+
).version("0.2.1");
|
|
1453
1456
|
program.command("init").description("Initialize agent-mgr in this repo or globally").option("-g, --global", "Initialize global config at ~/.agent-mgr/").option("-t, --targets <targets>", "Comma-separated list of targets (claude-code,cursor,codex,opencode)").option("-a, --all", "Select all available targets").option("--gitignore", "Add generated dirs to .git/info/exclude").option("--no-gitignore", "Skip gitignoring generated dirs").action(initCommand);
|
|
1454
1457
|
program.command("add <name>").description("Create a new command template").option("-g, --global", "Add to global commands").option("-f, --from <path>", "Import command from an existing .md file").option("-c, --content <text>", "Set the command content inline").action(addCommand);
|
|
1455
1458
|
program.command("remove <name>").description("Remove a command from source and all targets").option("-g, --global", "Remove from global commands").action(removeCommand);
|