@vectorize-io/self-driving-agents 0.0.2 → 0.0.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 +9 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -62,27 +62,23 @@ async function resolveAgentDir(input, spinner) {
|
|
|
62
62
|
const dir = resolve(input.replace(/^~/, homedir()));
|
|
63
63
|
if (!existsSync(dir))
|
|
64
64
|
throw new Error(`Directory not found: ${dir}`);
|
|
65
|
-
return { dir, source: dir };
|
|
65
|
+
return { dir, source: dir, defaultName: basename(dir) };
|
|
66
66
|
}
|
|
67
67
|
// Parse GitHub reference: "name" or "org/repo/path/to/agent"
|
|
68
68
|
const parts = input.split("/");
|
|
69
69
|
let org, repo, subpath;
|
|
70
|
-
if (parts.length
|
|
71
|
-
//
|
|
70
|
+
if (parts.length <= 2) {
|
|
71
|
+
// "name" or "name/subpath" → default repo
|
|
72
72
|
org = "vectorize-io";
|
|
73
73
|
repo = "self-driving-agents";
|
|
74
|
-
subpath =
|
|
74
|
+
subpath = input;
|
|
75
75
|
}
|
|
76
|
-
else
|
|
76
|
+
else {
|
|
77
77
|
// org/repo/path...
|
|
78
78
|
org = parts[0];
|
|
79
79
|
repo = parts[1];
|
|
80
80
|
subpath = parts.slice(2).join("/");
|
|
81
81
|
}
|
|
82
|
-
else {
|
|
83
|
-
throw new Error(`Invalid agent reference: '${input}'\n` +
|
|
84
|
-
` Use: <name>, <org>/<repo>/<path>, or a local path (./dir)`);
|
|
85
|
-
}
|
|
86
82
|
spinner.start(`Fetching ${color.cyan(`${org}/${repo}/${subpath}`)} from GitHub...`);
|
|
87
83
|
const tmp = join(tmpdir(), `sda-${Date.now()}`);
|
|
88
84
|
mkdirSync(tmp, { recursive: true });
|
|
@@ -102,8 +98,9 @@ async function resolveAgentDir(input, spinner) {
|
|
|
102
98
|
throw new Error(`Path '${subpath}' not found in ${org}/${repo}`);
|
|
103
99
|
}
|
|
104
100
|
const source = `github.com/${org}/${repo}/${subpath}`;
|
|
101
|
+
const defaultName = subpath.replace(/\//g, "-");
|
|
105
102
|
spinner.stop(`Fetched ${color.cyan(source)}`);
|
|
106
|
-
return { dir, source, cleanup: () => rmSync(tmp, { recursive: true, force: true }) };
|
|
103
|
+
return { dir, source, defaultName, cleanup: () => rmSync(tmp, { recursive: true, force: true }) };
|
|
107
104
|
}
|
|
108
105
|
// ── Skill ───────────────────────────────────────────────
|
|
109
106
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -274,9 +271,9 @@ async function main() {
|
|
|
274
271
|
p.intro(color.bgCyan(color.black(` self-driving-agents `)));
|
|
275
272
|
// Step 0: Resolve agent directory (local or GitHub)
|
|
276
273
|
const spin = p.spinner();
|
|
277
|
-
const { dir, source, cleanup } = await resolveAgentDir(dirArg, spin);
|
|
274
|
+
const { dir, source, defaultName, cleanup } = await resolveAgentDir(dirArg, spin);
|
|
278
275
|
try {
|
|
279
|
-
const agentId = agentName ||
|
|
276
|
+
const agentId = agentName || defaultName;
|
|
280
277
|
// Step 1: Ensure plugin
|
|
281
278
|
if (harness === "openclaw") {
|
|
282
279
|
await ensurePlugin();
|