agents-anywhere 0.7.1 → 0.7.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.js +47 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1104,7 +1104,42 @@ async function initCommand(repoDir, options) {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
if (fs4.existsSync(import_node_path5.default.join(targetDir, "agents-anywhere.json"))) {
|
|
1106
1106
|
warn(`Config repo already exists at ${targetDir}`);
|
|
1107
|
-
|
|
1107
|
+
let hasRemote = false;
|
|
1108
|
+
try {
|
|
1109
|
+
const remote = (0, import_node_child_process2.execSync)("git remote get-url origin", {
|
|
1110
|
+
cwd: targetDir,
|
|
1111
|
+
encoding: "utf-8",
|
|
1112
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1113
|
+
}).trim();
|
|
1114
|
+
info(`Remote: ${remote}`);
|
|
1115
|
+
hasRemote = true;
|
|
1116
|
+
} catch {
|
|
1117
|
+
warn("No git remote configured.");
|
|
1118
|
+
}
|
|
1119
|
+
if (process.stdin.isTTY) {
|
|
1120
|
+
const shouldRelink = await (0, import_confirm.default)({
|
|
1121
|
+
message: "Re-link agents and sync MCP configs?",
|
|
1122
|
+
default: true
|
|
1123
|
+
});
|
|
1124
|
+
if (shouldRelink) {
|
|
1125
|
+
heading("Linking agent configs...");
|
|
1126
|
+
for (const agent of installed) {
|
|
1127
|
+
const results = linkAgent(agent.definition, targetDir);
|
|
1128
|
+
const linked = results.filter(
|
|
1129
|
+
(r) => r.action === "linked" || r.action === "backed-up-and-linked"
|
|
1130
|
+
);
|
|
1131
|
+
if (linked.length > 0) {
|
|
1132
|
+
success(`${agent.definition.name} \u2014 ${linked.length} item(s) linked`);
|
|
1133
|
+
} else {
|
|
1134
|
+
info(`${agent.definition.name} \u2014 already linked`);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
syncMCPToAllAgents(targetDir, installed);
|
|
1138
|
+
}
|
|
1139
|
+
if (!hasRemote) {
|
|
1140
|
+
await promptGitHubRepo(targetDir);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1108
1143
|
return;
|
|
1109
1144
|
}
|
|
1110
1145
|
const primary = await promptPrimaryAgent(installed);
|
|
@@ -1371,9 +1406,17 @@ async function promptGitHubRepo(repoDir) {
|
|
|
1371
1406
|
{ stdio: "inherit", cwd: repoDir }
|
|
1372
1407
|
);
|
|
1373
1408
|
success(`Created and pushed to private GitHub repo: ${repoName}`);
|
|
1374
|
-
} catch
|
|
1375
|
-
|
|
1376
|
-
|
|
1409
|
+
} catch {
|
|
1410
|
+
try {
|
|
1411
|
+
const ghUser = (0, import_node_child_process2.execSync)("gh api user -q .login", { encoding: "utf-8", cwd: repoDir }).trim();
|
|
1412
|
+
const remoteUrl = `https://github.com/${ghUser}/${repoName}.git`;
|
|
1413
|
+
(0, import_node_child_process2.execSync)(`git remote add origin ${remoteUrl}`, { stdio: "inherit", cwd: repoDir });
|
|
1414
|
+
(0, import_node_child_process2.execSync)("git push -u origin main", { stdio: "inherit", cwd: repoDir });
|
|
1415
|
+
success(`Connected to existing repo and pushed: ${ghUser}/${repoName}`);
|
|
1416
|
+
} catch (err2) {
|
|
1417
|
+
warn(`Failed to create or connect GitHub repo: ${err2.message}`);
|
|
1418
|
+
info("You can set it up manually: git remote add origin <url> && git push");
|
|
1419
|
+
}
|
|
1377
1420
|
}
|
|
1378
1421
|
}
|
|
1379
1422
|
async function initFromRemote(url, targetDir) {
|
package/package.json
CHANGED