@taodigital/agent-cli 1.2.0 → 1.2.1

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 CHANGED
@@ -7583,6 +7583,19 @@ async function runPostman(message, send, signal) {
7583
7583
  var _pkg = (0, import_node_module2.createRequire)(__filename)("../package.json");
7584
7584
  var PKG_VERSION = _pkg.version;
7585
7585
  var API_URL = process.env.ZETA_API_URL ?? "https://zeta.taodigitalsolutions.com/api";
7586
+ var PROFILE_API_URLS = {
7587
+ default: "https://zeta.taodigitalsolutions.com/api",
7588
+ prod: "https://zeta.taodigitalsolutions.com/api",
7589
+ dev: "https://dev.zeta.taodigitalsolutions.com/api",
7590
+ preview: "https://pre.zeta.taodigitalsolutions.com/api",
7591
+ pre: "https://pre.zeta.taodigitalsolutions.com/api",
7592
+ local: "http://localhost:3001/api"
7593
+ };
7594
+ function resolveApiUrl(explicitFlag, profile) {
7595
+ if (explicitFlag)
7596
+ return explicitFlag;
7597
+ return PROFILE_API_URLS[profile] ?? API_URL;
7598
+ }
7586
7599
  var DEFAULT_MAX_SCREENS = process.env.ZETA_DEFAULT_MAX_SCREENS ?? "50";
7587
7600
  var DEFAULT_STRATEGY = process.env.ZETA_DEFAULT_STRATEGY ?? "BFS";
7588
7601
  var LOGIN_TIMEOUT_MS = parseInt(process.env.ZETA_LOGIN_TIMEOUT_MS ?? "") || 1e4;
@@ -7615,17 +7628,79 @@ var TERMINAL_JOB_STATUSES = /* @__PURE__ */ new Set([
7615
7628
  var IDENTITY_PATH = "/workspace/settings/identity";
7616
7629
  var CREDS_DIR = (0, import_node_path2.join)((0, import_node_os2.homedir)(), ".config", "zeta");
7617
7630
  var CREDS_FILE = (0, import_node_path2.join)(CREDS_DIR, "credentials.json");
7618
- async function loadCreds() {
7631
+ function resolveProfile(explicit) {
7632
+ return explicit ?? process.env.ZETA_PROFILE ?? "default";
7633
+ }
7634
+ async function loadCreds(profile) {
7619
7635
  try {
7620
7636
  const raw = await (0, import_promises2.readFile)(CREDS_FILE, "utf-8");
7621
- return JSON.parse(raw);
7637
+ const data = JSON.parse(raw);
7638
+ if (data._version === 2) {
7639
+ const name = resolveProfile(profile) === "default" && !profile && !process.env.ZETA_PROFILE ? data._default ?? "default" : resolveProfile(profile);
7640
+ return data.profiles?.[name] ?? null;
7641
+ }
7642
+ if (profile && profile !== "default")
7643
+ return null;
7644
+ return data;
7622
7645
  } catch {
7623
7646
  return null;
7624
7647
  }
7625
7648
  }
7626
- async function saveCreds(creds) {
7649
+ async function listAllProfiles() {
7650
+ try {
7651
+ const raw = await (0, import_promises2.readFile)(CREDS_FILE, "utf-8");
7652
+ const data = JSON.parse(raw);
7653
+ if (data._version === 2)
7654
+ return data.profiles ?? {};
7655
+ return { default: data };
7656
+ } catch {
7657
+ return {};
7658
+ }
7659
+ }
7660
+ async function saveCreds(creds, profile) {
7627
7661
  await (0, import_promises2.mkdir)(CREDS_DIR, { recursive: true });
7628
- await (0, import_promises2.writeFile)(CREDS_FILE, JSON.stringify(creds, null, 2), { encoding: "utf-8", mode: 384 });
7662
+ let data = { _version: 2, _default: "default", profiles: {} };
7663
+ try {
7664
+ const existing = JSON.parse(await (0, import_promises2.readFile)(CREDS_FILE, "utf-8"));
7665
+ if (existing._version === 2) {
7666
+ data = existing;
7667
+ } else {
7668
+ data.profiles.default = existing;
7669
+ }
7670
+ } catch {
7671
+ }
7672
+ const name = resolveProfile(profile);
7673
+ data.profiles[name] = creds;
7674
+ if (!data._default)
7675
+ data._default = name;
7676
+ await (0, import_promises2.writeFile)(CREDS_FILE, JSON.stringify(data, null, 2), { encoding: "utf-8", mode: 384 });
7677
+ }
7678
+ async function deleteCredsProfile(profile) {
7679
+ try {
7680
+ const raw = await (0, import_promises2.readFile)(CREDS_FILE, "utf-8");
7681
+ const data = JSON.parse(raw);
7682
+ if (data._version === 2) {
7683
+ const name = resolveProfile(profile);
7684
+ if (!data.profiles[name])
7685
+ return false;
7686
+ delete data.profiles[name];
7687
+ if (data._default === name) {
7688
+ const remaining = Object.keys(data.profiles);
7689
+ data._default = remaining[0] ?? "default";
7690
+ }
7691
+ if (Object.keys(data.profiles).length === 0) {
7692
+ await (0, import_promises2.unlink)(CREDS_FILE).catch(() => {
7693
+ });
7694
+ } else {
7695
+ await (0, import_promises2.writeFile)(CREDS_FILE, JSON.stringify(data, null, 2), { encoding: "utf-8", mode: 384 });
7696
+ }
7697
+ return true;
7698
+ }
7699
+ await (0, import_promises2.unlink)(CREDS_FILE);
7700
+ return true;
7701
+ } catch {
7702
+ return false;
7703
+ }
7629
7704
  }
7630
7705
  function executeCommand(command, logger, timeoutMs) {
7631
7706
  return new Promise((resolve, reject) => {
@@ -7821,13 +7896,15 @@ function parseEnvironmentOptions(value) {
7821
7896
  }
7822
7897
  var program2 = new Command();
7823
7898
  program2.version(PKG_VERSION).description("ZeTa-AI Local Agent \u2014 run tests and crawls on private networks").enablePositionalOptions();
7824
- program2.command("login").description("Authenticate with ZeTa and store credentials locally (~/.config/zeta/credentials.json)").argument("[token]", "Agent token (zeta_...) \u2014 skip interactive prompt").option("-a, --api <url>", "ZeTa API URL").option("-t, --token <token>", "ZeTa Agent Token (zeta_...)").action(async (tokenArg, options) => {
7899
+ program2.command("login").description("Authenticate with ZeTa and store credentials locally (~/.config/zeta/credentials.json)").argument("[token]", "Agent token (zeta_...) \u2014 skip interactive prompt").option("-a, --api <url>", "ZeTa API URL").option("-t, --token <token>", "ZeTa Agent Token (zeta_...)").option("--profile <name>", 'Credential profile to save under (default: $ZETA_PROFILE or "default")').action(async (tokenArg, options) => {
7900
+ const profile = resolveProfile(options.profile);
7825
7901
  const iface = rl.createInterface({ input: process.stdin, output: process.stdout });
7902
+ const profileDefault = resolveApiUrl(void 0, profile);
7826
7903
  let apiUrl = options.api ?? "";
7827
7904
  if (!apiUrl) {
7828
- apiUrl = (await iface.question(`API URL [${API_URL}]: `)).trim();
7905
+ apiUrl = (await iface.question(`API URL [${profileDefault}]: `)).trim();
7829
7906
  if (!apiUrl)
7830
- apiUrl = API_URL;
7907
+ apiUrl = profileDefault;
7831
7908
  }
7832
7909
  let token = tokenArg ?? options.token ?? "";
7833
7910
  if (!token) {
@@ -7871,9 +7948,9 @@ program2.command("login").description("Authenticate with ZeTa and store credenti
7871
7948
  }
7872
7949
  } catch {
7873
7950
  }
7874
- await saveCreds({ apiUrl, token, workspaceId, workspaceName, projects });
7951
+ await saveCreds({ apiUrl, token, workspaceId, workspaceName, projects }, profile);
7875
7952
  console.log(`
7876
- [ZeTa] \u2713 Logged in to "${workspaceName ?? workspaceId}"`);
7953
+ [ZeTa] \u2713 Logged in to "${workspaceName ?? workspaceId}" (profile: ${profile})`);
7877
7954
  console.log(`[ZeTa] Credentials stored: ${CREDS_FILE}`);
7878
7955
  if (projects.length > 0) {
7879
7956
  console.log(`
@@ -7883,32 +7960,64 @@ Projects (${projects.length}):`);
7883
7960
  const serviceProject = projects[0];
7884
7961
  if (serviceProject) {
7885
7962
  console.log(`
7886
- [ZeTa] Installing background service for "${serviceProject.name}"...`);
7963
+ [ZeTa] Installing background service for "${serviceProject.name}" (profile: ${profile})...`);
7887
7964
  try {
7888
- await serviceInstall(serviceProject.id);
7965
+ await serviceInstall(serviceProject.id, profile);
7889
7966
  if (projects.length > 1) {
7890
7967
  console.log(`[ZeTa] \u2139 To switch project: zeta service uninstall && zeta service install -p <project-id>`);
7891
7968
  }
7892
7969
  } catch (e) {
7893
7970
  console.warn(`[ZeTa] \u26A0 Background service install failed: ${e instanceof Error ? e.message : String(e)}`);
7894
- console.warn(`[ZeTa] Start manually: zeta -p ${serviceProject.id}`);
7971
+ console.warn(`[ZeTa] Start manually: zeta --profile ${profile} -p ${serviceProject.id}`);
7895
7972
  }
7896
7973
  }
7897
7974
  });
7898
- program2.command("logout").description("Remove stored ZeTa credentials").action(async () => {
7899
- try {
7900
- await (0, import_promises2.unlink)(CREDS_FILE);
7901
- console.log("[ZeTa] \u2713 Logged out. Credentials removed.");
7902
- } catch {
7903
- console.log("[ZeTa] No stored credentials found.");
7975
+ program2.command("logout").description("Remove stored ZeTa credentials").option("--profile <name>", 'Remove only this profile (default: $ZETA_PROFILE or "default"); use --all to remove everything').option("--all", "Remove all profiles and the credentials file").action(async (options) => {
7976
+ if (options.all) {
7977
+ try {
7978
+ await (0, import_promises2.unlink)(CREDS_FILE);
7979
+ console.log("[ZeTa] \u2713 All credentials removed.");
7980
+ } catch {
7981
+ console.log("[ZeTa] No stored credentials found.");
7982
+ }
7983
+ return;
7984
+ }
7985
+ const profile = resolveProfile(options.profile);
7986
+ const removed = await deleteCredsProfile(profile);
7987
+ if (removed) {
7988
+ console.log(`[ZeTa] \u2713 Profile "${profile}" removed.`);
7989
+ } else {
7990
+ console.log(`[ZeTa] Profile "${profile}" not found.`);
7904
7991
  }
7905
7992
  });
7906
- program2.command("whoami").description("Show currently stored credentials").action(async () => {
7907
- const creds = await loadCreds();
7993
+ program2.command("whoami").description("Show currently stored credentials").option("--profile <name>", 'Profile to inspect (default: $ZETA_PROFILE or "default")').option("--all", "Show all configured profiles").action(async (options) => {
7994
+ if (options.all) {
7995
+ const all = await listAllProfiles();
7996
+ const names = Object.keys(all);
7997
+ if (names.length === 0) {
7998
+ console.log("[ZeTa] No profiles configured. Run `zeta login`.");
7999
+ process.exit(1);
8000
+ }
8001
+ names.forEach((name) => {
8002
+ const c = all[name];
8003
+ console.log(`
8004
+ Profile: ${name}`);
8005
+ console.log(` Workspace : ${c.workspaceName ?? c.workspaceId ?? "(unknown)"}`);
8006
+ console.log(` API : ${c.apiUrl}`);
8007
+ console.log(` Token : ${c.token.slice(0, 10)}...`);
8008
+ if (c.projects?.length) {
8009
+ console.log(` Projects : ${c.projects.map((p) => p.name).join(", ")}`);
8010
+ }
8011
+ });
8012
+ return;
8013
+ }
8014
+ const profile = resolveProfile(options.profile);
8015
+ const creds = await loadCreds(profile);
7908
8016
  if (!creds) {
7909
- console.log("[ZeTa] Not logged in. Run `zeta login`.");
8017
+ console.log(`[ZeTa] Profile "${profile}" not found. Run \`zeta login --profile ${profile}\`.`);
7910
8018
  process.exit(1);
7911
8019
  }
8020
+ console.log(`Profile : ${profile}`);
7912
8021
  console.log(`Workspace : ${creds.workspaceName ?? creds.workspaceId ?? "(unknown)"}`);
7913
8022
  console.log(`API : ${creds.apiUrl}`);
7914
8023
  console.log(`Token : ${creds.token.slice(0, 10)}...`);
@@ -7918,6 +8027,20 @@ Projects (${creds.projects.length}):`);
7918
8027
  creds.projects.forEach((p) => console.log(` ${p.id} ${p.name}`));
7919
8028
  }
7920
8029
  });
8030
+ program2.command("profiles").description("List all configured credential profiles").action(async () => {
8031
+ const all = await listAllProfiles();
8032
+ const names = Object.keys(all);
8033
+ if (names.length === 0) {
8034
+ console.log("[ZeTa] No profiles configured. Run `zeta login`.");
8035
+ return;
8036
+ }
8037
+ console.log("Configured profiles:");
8038
+ names.forEach((name) => {
8039
+ const c = all[name];
8040
+ console.log(` ${name.padEnd(12)} ${c.apiUrl} (${c.workspaceName ?? c.workspaceId ?? "unknown"})`);
8041
+ });
8042
+ console.log("\nSwitch profiles with --profile <name> or ZETA_PROFILE=<name>");
8043
+ });
7921
8044
  program2.command("crawl").description("Trigger a crawl for a ZeTa project").requiredOption("-p, --project <id>", "ZeTa Project ID").option("-t, --token <token>", "ZeTa API Token (falls back to stored credentials)").option("-a, --api <url>", "ZeTa API URL (falls back to stored credentials)").option("-u, --url <url>", "App URL to crawl (overrides project setting)").option("--max-screens <n>", "Maximum screens to crawl", DEFAULT_MAX_SCREENS).option("--strategy <s>", "Traversal strategy: BFS | DFS | BEST_FIRST", DEFAULT_STRATEGY).option("--url-filter <regex>", "Regex \u2014 only crawl matching URLs").option("--no-wait", "Start crawl and exit without waiting for completion").action(async (options) => {
7922
8045
  const creds = await loadCreds();
7923
8046
  const token = options.token ?? creds?.token;
@@ -8117,8 +8240,11 @@ var LOG_FILE = (0, import_node_path2.join)(CREDS_DIR, "agent.log");
8117
8240
  function resolveZetaBinary() {
8118
8241
  return { node: process.execPath, script: process.argv[1] };
8119
8242
  }
8120
- function getMacPlist(projectId) {
8243
+ function getMacPlist(projectId, profile) {
8121
8244
  const { node, script } = resolveZetaBinary();
8245
+ const profileEntry = profile && profile !== "default" ? `
8246
+ <key>ZETA_PROFILE</key>
8247
+ <string>${profile}</string>` : "";
8122
8248
  return `<?xml version="1.0" encoding="UTF-8"?>
8123
8249
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
8124
8250
  <plist version="1.0">
@@ -8145,13 +8271,15 @@ function getMacPlist(projectId) {
8145
8271
  <key>EnvironmentVariables</key>
8146
8272
  <dict>
8147
8273
  <key>PATH</key>
8148
- <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
8274
+ <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>${profileEntry}
8149
8275
  </dict>
8150
8276
  </dict>
8151
8277
  </plist>`;
8152
8278
  }
8153
- function getLinuxUnit(projectId) {
8279
+ function getLinuxUnit(projectId, profile) {
8154
8280
  const { node, script } = resolveZetaBinary();
8281
+ const profileEnv = profile && profile !== "default" ? `
8282
+ Environment=ZETA_PROFILE=${profile}` : "";
8155
8283
  return `[Unit]
8156
8284
  Description=ZeTa AI Local Agent (project ${projectId})
8157
8285
  After=network-online.target
@@ -8163,7 +8291,7 @@ ExecStart=${node} ${script} -p ${projectId}
8163
8291
  Restart=always
8164
8292
  RestartSec=10
8165
8293
  StandardOutput=append:${LOG_FILE}
8166
- StandardError=append:${LOG_FILE}
8294
+ StandardError=append:${LOG_FILE}${profileEnv}
8167
8295
 
8168
8296
  [Install]
8169
8297
  WantedBy=default.target
@@ -8175,12 +8303,12 @@ async function getMacPlistPath() {
8175
8303
  function getLinuxUnitPath() {
8176
8304
  return (0, import_node_path2.join)((0, import_node_os2.homedir)(), ".config", "systemd", "user", `${SERVICE_LABEL.replace(/\./g, "-")}.service`);
8177
8305
  }
8178
- async function serviceInstall(projectId) {
8306
+ async function serviceInstall(projectId, profile) {
8179
8307
  if (process.platform === "darwin") {
8180
8308
  const plistPath = await getMacPlistPath();
8181
8309
  await (0, import_promises2.mkdir)((0, import_node_path2.join)((0, import_node_os2.homedir)(), "Library", "LaunchAgents"), { recursive: true });
8182
8310
  await (0, import_promises2.mkdir)(CREDS_DIR, { recursive: true });
8183
- await (0, import_promises2.writeFile)(plistPath, getMacPlist(projectId), { encoding: "utf-8", mode: 420 });
8311
+ await (0, import_promises2.writeFile)(plistPath, getMacPlist(projectId, profile), { encoding: "utf-8", mode: 420 });
8184
8312
  await new Promise((resolve, reject) => {
8185
8313
  (0, import_node_child_process2.exec)(`launchctl unload "${plistPath}" 2>/dev/null; launchctl load -w "${plistPath}"`, (err) => {
8186
8314
  if (err)
@@ -8197,7 +8325,7 @@ async function serviceInstall(projectId) {
8197
8325
  const unitPath = getLinuxUnitPath();
8198
8326
  await (0, import_promises2.mkdir)((0, import_node_path2.join)((0, import_node_os2.homedir)(), ".config", "systemd", "user"), { recursive: true });
8199
8327
  await (0, import_promises2.mkdir)(CREDS_DIR, { recursive: true });
8200
- await (0, import_promises2.writeFile)(unitPath, getLinuxUnit(projectId), { encoding: "utf-8", mode: 420 });
8328
+ await (0, import_promises2.writeFile)(unitPath, getLinuxUnit(projectId, profile), { encoding: "utf-8", mode: 420 });
8201
8329
  await new Promise((resolve, reject) => {
8202
8330
  (0, import_node_child_process2.exec)("systemctl --user daemon-reload", (err) => {
8203
8331
  if (err)
@@ -8306,12 +8434,13 @@ async function serviceStatus() {
8306
8434
  }
8307
8435
  }
8308
8436
  program2.command("service").description("Manage the ZeTa agent as a background system service").addCommand(
8309
- new Command("install").description("Install and start the agent as a service (auto-starts on login)").option("-p, --project <id>", "ZeTa Project ID (uses stored credentials if omitted)").action(async (opts) => {
8310
- const creds = await loadCreds();
8437
+ new Command("install").description("Install and start the agent as a service (auto-starts on login)").option("-p, --project <id>", "ZeTa Project ID (uses stored credentials if omitted)").option("--profile <name>", 'Credential profile to use (default: $ZETA_PROFILE or "default")').action(async (opts) => {
8438
+ const profile = resolveProfile(opts.profile);
8439
+ const creds = await loadCreds(profile);
8311
8440
  let projectId = opts.project;
8312
8441
  if (!projectId) {
8313
8442
  if (!creds?.projects?.length) {
8314
- console.error("[ZeTa Service] No project ID. Run `zeta <api-key>` first, then `zeta service install -p <project-id>`");
8443
+ console.error(`[ZeTa Service] No project ID. Run \`zeta <api-key> --profile ${profile}\` first, then \`zeta service install -p <project-id>\``);
8315
8444
  process.exit(1);
8316
8445
  }
8317
8446
  if (creds.projects.length === 1) {
@@ -8324,11 +8453,11 @@ program2.command("service").description("Manage the ZeTa agent as a background s
8324
8453
  }
8325
8454
  }
8326
8455
  if (!creds?.token) {
8327
- console.error("[ZeTa Service] No credentials. Run `zeta <api-key>` first.");
8456
+ console.error(`[ZeTa Service] No credentials. Run \`zeta <api-key> --profile ${profile}\` first.`);
8328
8457
  process.exit(1);
8329
8458
  }
8330
8459
  try {
8331
- await serviceInstall(projectId);
8460
+ await serviceInstall(projectId, profile);
8332
8461
  } catch (e) {
8333
8462
  console.error(`[ZeTa Service] Install failed: ${e instanceof Error ? e.message : String(e)}`);
8334
8463
  process.exitCode = 1;
@@ -8437,9 +8566,10 @@ program2.command("run_postman").description("Run a local Postman collection and
8437
8566
  process.exitCode = 1;
8438
8567
  }
8439
8568
  });
8440
- program2.argument("[apiKey]", "API key from the ZeTa dashboard \u2014 saves credentials and exits (run `zeta -p <id>` afterwards)").option("-p, --project <id>", "ZeTa Project ID").option("-t, --token <token>", "ZeTa Agent Token (starts with zeta_)").option("-a, --api <url>", "ZeTa API base URL", process.env.ZETA_API_URL ?? "").action(async (apiKey, opts) => {
8569
+ program2.argument("[apiKey]", "API key from the ZeTa dashboard \u2014 saves credentials and exits (run `zeta -p <id>` afterwards)").option("-p, --project <id>", "ZeTa Project ID").option("-t, --token <token>", "ZeTa Agent Token (starts with zeta_)").option("-a, --api <url>", "ZeTa API base URL", process.env.ZETA_API_URL ?? "").option("--profile <name>", 'Credential profile to use/save (default: $ZETA_PROFILE or "default")').action(async (apiKey, opts) => {
8570
+ const profile = resolveProfile(opts.profile);
8441
8571
  if (apiKey) {
8442
- const api2 = opts.api || API_URL;
8572
+ const api2 = resolveApiUrl(opts.api || void 0, profile);
8443
8573
  const token2 = apiKey;
8444
8574
  console.log("[ZeTa] Validating token...");
8445
8575
  const headers = { Authorization: `Bearer ${token2}` };
@@ -8474,9 +8604,9 @@ program2.argument("[apiKey]", "API key from the ZeTa dashboard \u2014 saves cred
8474
8604
  }
8475
8605
  } catch {
8476
8606
  }
8477
- await saveCreds({ apiUrl: api2, token: token2, workspaceId, workspaceName, projects });
8607
+ await saveCreds({ apiUrl: api2, token: token2, workspaceId, workspaceName, projects }, profile);
8478
8608
  console.log(`
8479
- [ZeTa] \u2713 API key saved for "${workspaceName ?? workspaceId}"`);
8609
+ [ZeTa] \u2713 API key saved for "${workspaceName ?? workspaceId}" (profile: ${profile})`);
8480
8610
  console.log(`[ZeTa] Credentials stored: ${CREDS_FILE}`);
8481
8611
  if (projects.length > 0) {
8482
8612
  console.log(`
@@ -8486,16 +8616,16 @@ Projects (${projects.length}):`);
8486
8616
  const serviceProject = projects[0];
8487
8617
  if (serviceProject) {
8488
8618
  console.log(`
8489
- [ZeTa] Installing background service for "${serviceProject.name}"...`);
8619
+ [ZeTa] Installing background service for "${serviceProject.name}" (profile: ${profile})...`);
8490
8620
  try {
8491
- await serviceInstall(serviceProject.id);
8621
+ await serviceInstall(serviceProject.id, profile);
8492
8622
  if (projects.length > 1) {
8493
8623
  console.log(`[ZeTa] \u2139 Multiple projects found. Service running for "${serviceProject.name}".`);
8494
8624
  console.log(`[ZeTa] To switch: zeta service uninstall && zeta service install -p <project-id>`);
8495
8625
  }
8496
8626
  } catch (e) {
8497
8627
  console.warn(`[ZeTa] \u26A0 Background service install failed: ${e instanceof Error ? e.message : String(e)}`);
8498
- console.warn(`[ZeTa] Start manually: zeta -p ${serviceProject.id}`);
8628
+ console.warn(`[ZeTa] Start manually: zeta --profile ${profile} -p ${serviceProject.id}`);
8499
8629
  }
8500
8630
  } else {
8501
8631
  console.log(`
@@ -8504,13 +8634,13 @@ Projects (${projects.length}):`);
8504
8634
  }
8505
8635
  return;
8506
8636
  }
8507
- const creds = await loadCreds();
8637
+ const creds = await loadCreds(profile);
8508
8638
  const token = opts.token ?? creds?.token;
8509
- const api = opts.api || creds?.apiUrl || API_URL;
8639
+ const api = resolveApiUrl(opts.api || creds?.apiUrl || void 0, profile);
8510
8640
  const project = opts.project;
8511
8641
  if (!token) {
8512
8642
  console.error("[ZeTa Agent] No API key found.");
8513
- console.error(" Configure once: zeta <your-api-key>");
8643
+ console.error(` Configure once: zeta <your-api-key>${profile !== "default" ? ` --profile ${profile}` : ""}`);
8514
8644
  console.error(" Or pass inline: zeta -t <token> -p <project-id>");
8515
8645
  process.exit(1);
8516
8646
  }