agents-anywhere 0.7.3 → 0.7.4
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 +41 -17
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1217,6 +1217,42 @@ async function promptPrimaryAgent(installed) {
|
|
|
1217
1217
|
});
|
|
1218
1218
|
return candidates.find((c) => c.definition.id === chosen);
|
|
1219
1219
|
}
|
|
1220
|
+
function resolveSourcePath(sourcePath, configDir, item) {
|
|
1221
|
+
const isSymlink = lstatExists(sourcePath) && fs4.lstatSync(sourcePath).isSymbolicLink();
|
|
1222
|
+
if (isSymlink) {
|
|
1223
|
+
try {
|
|
1224
|
+
const realPath = fs4.realpathSync(sourcePath);
|
|
1225
|
+
if (fs4.existsSync(realPath)) return realPath;
|
|
1226
|
+
} catch {
|
|
1227
|
+
}
|
|
1228
|
+
const backup = findBackup(configDir, item);
|
|
1229
|
+
if (backup) {
|
|
1230
|
+
const backupPath = import_node_path5.default.join(configDir, backup);
|
|
1231
|
+
if (lstatExists(backupPath) && fs4.lstatSync(backupPath).isSymbolicLink()) {
|
|
1232
|
+
try {
|
|
1233
|
+
const realBackup = fs4.realpathSync(backupPath);
|
|
1234
|
+
if (fs4.existsSync(realBackup)) return realBackup;
|
|
1235
|
+
} catch {
|
|
1236
|
+
return null;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (fs4.existsSync(backupPath)) return backupPath;
|
|
1240
|
+
}
|
|
1241
|
+
return null;
|
|
1242
|
+
}
|
|
1243
|
+
if (fs4.existsSync(sourcePath)) return sourcePath;
|
|
1244
|
+
return null;
|
|
1245
|
+
}
|
|
1246
|
+
function findBackup(dir, item) {
|
|
1247
|
+
try {
|
|
1248
|
+
const entries = fs4.readdirSync(dir);
|
|
1249
|
+
const prefix = `${item}.backup.`;
|
|
1250
|
+
const backups = entries.filter((e) => e.startsWith(prefix)).sort().reverse();
|
|
1251
|
+
return backups[0];
|
|
1252
|
+
} catch {
|
|
1253
|
+
return void 0;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1220
1256
|
function copyPortableFiles(installed, repoDir) {
|
|
1221
1257
|
heading("Copying portable files...");
|
|
1222
1258
|
for (const agent of installed) {
|
|
@@ -1234,26 +1270,14 @@ function copyPortableFiles(installed, repoDir) {
|
|
|
1234
1270
|
if (ignoreRoots.has(item) || credBasenames.has(item)) continue;
|
|
1235
1271
|
const sourcePath = import_node_path5.default.join(configDir, item);
|
|
1236
1272
|
const destPath = import_node_path5.default.join(agentRepoDir, item);
|
|
1237
|
-
|
|
1238
|
-
if (
|
|
1239
|
-
|
|
1240
|
-
if (!fs4.existsSync(realPath)) continue;
|
|
1241
|
-
const stat2 = fs4.statSync(realPath);
|
|
1242
|
-
if (stat2.isDirectory()) {
|
|
1243
|
-
fs4.cpSync(realPath, destPath, { recursive: true });
|
|
1244
|
-
} else {
|
|
1245
|
-
fs4.mkdirSync(import_node_path5.default.dirname(destPath), { recursive: true });
|
|
1246
|
-
fs4.copyFileSync(realPath, destPath);
|
|
1247
|
-
}
|
|
1248
|
-
copied++;
|
|
1249
|
-
continue;
|
|
1250
|
-
}
|
|
1251
|
-
const stat = fs4.statSync(sourcePath);
|
|
1273
|
+
const resolvedSource = resolveSourcePath(sourcePath, configDir, item);
|
|
1274
|
+
if (!resolvedSource) continue;
|
|
1275
|
+
const stat = fs4.statSync(resolvedSource);
|
|
1252
1276
|
if (stat.isDirectory()) {
|
|
1253
|
-
fs4.cpSync(
|
|
1277
|
+
fs4.cpSync(resolvedSource, destPath, { recursive: true, dereference: true });
|
|
1254
1278
|
} else {
|
|
1255
1279
|
fs4.mkdirSync(import_node_path5.default.dirname(destPath), { recursive: true });
|
|
1256
|
-
fs4.copyFileSync(
|
|
1280
|
+
fs4.copyFileSync(resolvedSource, destPath);
|
|
1257
1281
|
}
|
|
1258
1282
|
copied++;
|
|
1259
1283
|
}
|
package/package.json
CHANGED