@an-sdk/cli 0.0.7 → 0.0.8
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 +52 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ async function findAgentEntryPoints() {
|
|
|
81
81
|
const { existsSync, readdirSync, statSync } = await import("fs");
|
|
82
82
|
const { join: join2, basename: basename2, extname } = await import("path");
|
|
83
83
|
if (!existsSync("agents") || !statSync("agents").isDirectory()) {
|
|
84
|
-
throw new Error("No agents found.
|
|
84
|
+
throw new Error("No agents/ directory found. See https://an.dev/docs to get started.");
|
|
85
85
|
}
|
|
86
86
|
const entries = [];
|
|
87
87
|
const items = readdirSync("agents");
|
|
@@ -104,7 +104,7 @@ async function findAgentEntryPoints() {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
if (entries.length === 0) {
|
|
107
|
-
throw new Error("No agents found
|
|
107
|
+
throw new Error("No agents found in agents/ directory. See https://an.dev/docs to get started.");
|
|
108
108
|
}
|
|
109
109
|
return entries;
|
|
110
110
|
}
|
|
@@ -261,20 +261,62 @@ Deployed before failure:`);
|
|
|
261
261
|
console.log(` ${agent.slug} \u2192 ${AN_BASE}/a/${projectSlug}/${agent.slug}`);
|
|
262
262
|
}
|
|
263
263
|
console.log();
|
|
264
|
-
|
|
264
|
+
p2.log.info("Next steps:");
|
|
265
|
+
console.log(" \xB7 Open the link above to test your agent");
|
|
266
|
+
console.log(" \xB7 Run `an deploy` again after changes");
|
|
267
|
+
console.log(` \xB7 View all deployments: ${AN_BASE}/an/deployments`);
|
|
265
268
|
p2.outro("Done");
|
|
266
269
|
}
|
|
267
270
|
|
|
268
271
|
// src/index.ts
|
|
272
|
+
import { createRequire } from "module";
|
|
273
|
+
var require2 = createRequire(import.meta.url);
|
|
274
|
+
var { version } = require2("../package.json");
|
|
269
275
|
var command = process.argv[2];
|
|
276
|
+
var args = process.argv.slice(3);
|
|
277
|
+
var hasFlag = (flag) => args.includes(flag);
|
|
278
|
+
function showHelp() {
|
|
279
|
+
console.log(`AN CLI v${version} \u2014 deploy AI agents
|
|
280
|
+
`);
|
|
281
|
+
console.log("Usage: an <command>\n");
|
|
282
|
+
console.log("Commands:");
|
|
283
|
+
console.log(" an login Authenticate with AN platform");
|
|
284
|
+
console.log(" an deploy Bundle and deploy your agent");
|
|
285
|
+
console.log("\nOptions:");
|
|
286
|
+
console.log(" --help, -h Show help");
|
|
287
|
+
console.log(" --version, -v Show version");
|
|
288
|
+
console.log("\nGet started: an login");
|
|
289
|
+
console.log("Docs: https://an.dev/docs");
|
|
290
|
+
}
|
|
291
|
+
function showLoginHelp() {
|
|
292
|
+
console.log("Usage: an login\n");
|
|
293
|
+
console.log("Authenticate with the AN platform using an API key.");
|
|
294
|
+
console.log("Get your API key at https://an.dev/api-keys");
|
|
295
|
+
}
|
|
296
|
+
function showDeployHelp() {
|
|
297
|
+
console.log("Usage: an deploy\n");
|
|
298
|
+
console.log("Bundle and deploy agents from the ./agents/ directory.\n");
|
|
299
|
+
console.log("Agent structure:");
|
|
300
|
+
console.log(" agents/");
|
|
301
|
+
console.log(" my-agent/");
|
|
302
|
+
console.log(" index.ts agent entry point");
|
|
303
|
+
console.log(" another.ts single-file agent");
|
|
304
|
+
console.log("\nDocs: https://an.dev/docs");
|
|
305
|
+
}
|
|
270
306
|
if (command === "login") {
|
|
271
|
-
|
|
307
|
+
if (hasFlag("--help") || hasFlag("-h")) {
|
|
308
|
+
showLoginHelp();
|
|
309
|
+
} else {
|
|
310
|
+
await login();
|
|
311
|
+
}
|
|
272
312
|
} else if (command === "deploy") {
|
|
273
|
-
|
|
313
|
+
if (hasFlag("--help") || hasFlag("-h")) {
|
|
314
|
+
showDeployHelp();
|
|
315
|
+
} else {
|
|
316
|
+
await deploy();
|
|
317
|
+
}
|
|
318
|
+
} else if (command === "--version" || command === "-v") {
|
|
319
|
+
console.log(version);
|
|
274
320
|
} else {
|
|
275
|
-
|
|
276
|
-
console.log("Commands:");
|
|
277
|
-
console.log(" an login Authenticate with AN platform");
|
|
278
|
-
console.log(" an deploy Bundle and deploy your agent");
|
|
279
|
-
console.log("\nGet started: an login");
|
|
321
|
+
showHelp();
|
|
280
322
|
}
|