@agentvalet/register 0.5.2 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +28 -13
  2. package/package.json +9 -10
package/dist/index.js CHANGED
@@ -1369,6 +1369,7 @@ import path6 from "path";
1369
1369
  import { writeFile as writeFile5 } from "fs/promises";
1370
1370
  async function runOnboard(opts = {}) {
1371
1371
  const scope = opts.scope ?? "user";
1372
+ const presetName = opts.name?.trim() || void 0;
1372
1373
  console.log("");
1373
1374
  console.log(chalk7.bold(" AgentValet \u2014 Agent Registration"));
1374
1375
  console.log(chalk7.dim(" app.agentvalet.ai"));
@@ -1400,7 +1401,7 @@ async function runOnboard(opts = {}) {
1400
1401
  console.log(chalk7.dim(" Signed out. Run again to re-authenticate."));
1401
1402
  return;
1402
1403
  }
1403
- await registerAgentFlow(stored.cliToken, stored.ownerId, scope);
1404
+ await registerAgentFlow(stored.cliToken, stored.ownerId, scope, presetName);
1404
1405
  return;
1405
1406
  }
1406
1407
  let credentials;
@@ -1420,20 +1421,27 @@ async function runOnboard(opts = {}) {
1420
1421
  email: credentials.email ?? "",
1421
1422
  cliToken: credentials.cliToken
1422
1423
  });
1423
- await registerAgentFlow(credentials.cliToken, credentials.ownerId, scope);
1424
+ await registerAgentFlow(credentials.cliToken, credentials.ownerId, scope, presetName);
1424
1425
  }
1425
- async function registerAgentFlow(apiKey, ownerId, scope = "user") {
1426
+ async function registerAgentFlow(apiKey, ownerId, scope = "user", presetName) {
1426
1427
  const hostname = os3.hostname().split(".")[0];
1427
1428
  const dirName = process.cwd().split("/").pop() ?? process.cwd().split("\\").pop() ?? "agent";
1428
- const { agentName } = await prompts3({
1429
- type: "text",
1430
- name: "agentName",
1431
- message: "Name for this agent:",
1432
- initial: `${hostname} \u2014 ${dirName}`,
1433
- validate: (v) => v.trim().length > 0 || "Agent name is required"
1434
- });
1435
- if (agentName === void 0) {
1436
- process.exit(0);
1429
+ let agentName;
1430
+ if (presetName) {
1431
+ agentName = presetName;
1432
+ console.log(chalk7.dim(` Agent name: ${chalk7.bold(agentName)}`));
1433
+ } else {
1434
+ const answer = await prompts3({
1435
+ type: "text",
1436
+ name: "agentName",
1437
+ message: "Name for this agent:",
1438
+ initial: `${hostname} \u2014 ${dirName}`,
1439
+ validate: (v) => v.trim().length > 0 || "Agent name is required"
1440
+ });
1441
+ if (answer.agentName === void 0) {
1442
+ process.exit(0);
1443
+ }
1444
+ agentName = answer.agentName;
1437
1445
  }
1438
1446
  const spinner = ora(" Registering agent...").start();
1439
1447
  let agent;
@@ -2266,9 +2274,16 @@ program.name("agentvalet-register").description("Self-register an AI agent with
2266
2274
  let description = opts.description ?? "";
2267
2275
  let scopes = opts.scope;
2268
2276
  if (!ownerId && !isAuthenticated()) {
2269
- await runOnboard({ scope: opts.project ? "project" : "user" });
2277
+ await runOnboard({ scope: opts.project ? "project" : "user", name: agentName || void 0 });
2270
2278
  return;
2271
2279
  }
2280
+ if (!ownerId && isAuthenticated()) {
2281
+ const stored = getStoredConfig();
2282
+ if (stored.ownerId && stored.cliToken) {
2283
+ await runOnboard({ scope: opts.project ? "project" : "user", name: agentName || void 0 });
2284
+ return;
2285
+ }
2286
+ }
2272
2287
  if (!agentName) {
2273
2288
  if (isJson) {
2274
2289
  console.error(JSON.stringify({ error: "--name is required in non-interactive mode" }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvalet/register",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Self-register AI agents with AgentValet",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,13 +10,6 @@
10
10
  "dist",
11
11
  "README.md"
12
12
  ],
13
- "scripts": {
14
- "build": "tsup src/index.ts --format esm --dts --clean --shims",
15
- "dev": "tsx src/index.ts",
16
- "test": "vitest run",
17
- "typecheck": "tsc --noEmit",
18
- "prepublishOnly": "pnpm build"
19
- },
20
13
  "dependencies": {
21
14
  "@agentvalet/mcp-server": "^0.2.0",
22
15
  "@modelcontextprotocol/sdk": "^1.29.0",
@@ -55,5 +48,11 @@
55
48
  "valet",
56
49
  "agentvalet"
57
50
  ],
58
- "license": "MIT"
59
- }
51
+ "license": "MIT",
52
+ "scripts": {
53
+ "build": "tsup src/index.ts --format esm --dts --clean --shims",
54
+ "dev": "tsx src/index.ts",
55
+ "test": "vitest run",
56
+ "typecheck": "tsc --noEmit"
57
+ }
58
+ }