apiblaze 0.19.13 → 0.19.15

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 +33 -15
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -933,7 +933,7 @@ var import_commander = require("commander");
933
933
  var import_chalk44 = __toESM(require("chalk"));
934
934
 
935
935
  // package.json
936
- var version = "0.19.13";
936
+ var version = "0.19.15";
937
937
 
938
938
  // src/index.ts
939
939
  init_types();
@@ -953,7 +953,7 @@ function decodeJWTPayload(token) {
953
953
  const part = token.split(".")[1];
954
954
  return JSON.parse(Buffer.from(part, "base64url").toString());
955
955
  }
956
- async function runLogin() {
956
+ async function runLogin(opts = {}) {
957
957
  console.log(import_chalk2.default.bold("\nLogging in to APIblaze...\n"));
958
958
  const codeRes = await fetch(`${DASHBOARD_BASE2}/api/device/code`, { method: "POST" });
959
959
  if (!codeRes.ok) {
@@ -1018,15 +1018,28 @@ async function runLogin() {
1018
1018
  }
1019
1019
  let teamId = defaultTeamId ?? void 0;
1020
1020
  let teamName;
1021
- const linked = await resolveLinkedTeam({
1022
- preferredId: defaultTeamId ?? void 0,
1023
- interactive: !!process.stdin.isTTY,
1024
- // >1 team ASK, with the account default as the cursor (one Enter accepts
1025
- // it). One team → link silently. Jay 2026-07-26: silent default was tried
1026
- // and reverted landing in the wrong team unnoticed is worse than the
1027
- // extra Enter when you have several teams.
1028
- promptWhenMultiple: true
1029
- });
1021
+ let linked = null;
1022
+ if (opts.team && opts.team !== "default") {
1023
+ const { getTeams: getTeams2 } = await Promise.resolve().then(() => (init_api(), api_exports));
1024
+ const teams = await getTeams2();
1025
+ const want = opts.team.toLowerCase();
1026
+ const hit = teams.find((t) => t.teamId === opts.team || (t.name ?? "").toLowerCase() === want);
1027
+ if (!hit) {
1028
+ throw new Error(`--team "${opts.team}" doesn't match any of your teams: ${teams.map((t) => t.name || t.teamId).join(", ") || "(none)"}`);
1029
+ }
1030
+ linked = { teamId: hit.teamId, teamName: hit.name };
1031
+ } else {
1032
+ linked = await resolveLinkedTeam({
1033
+ preferredId: defaultTeamId ?? void 0,
1034
+ // --team default = take the account default silently, no picker.
1035
+ interactive: !opts.team && !!process.stdin.isTTY,
1036
+ // >1 team → ASK, with the account default as the cursor (one Enter accepts
1037
+ // it). One team → link silently. Jay 2026-07-26: silent default was tried
1038
+ // and reverted — landing in the wrong team unnoticed is worse than the
1039
+ // extra Enter when you have several teams.
1040
+ promptWhenMultiple: true
1041
+ });
1042
+ }
1030
1043
  if (linked) {
1031
1044
  teamId = linked.teamId;
1032
1045
  teamName = linked.teamName;
@@ -2671,8 +2684,13 @@ async function runAgentChatRepl(opts) {
2671
2684
  ctx.proposal = data.proposal;
2672
2685
  const summary = summarizeProposal?.(data);
2673
2686
  if (summary) console.log(import_chalk16.default.yellow(" " + summary));
2674
- const ready = commands.filter((c) => c.needsProposal).map((c) => `/${c.name}`).join(" or ");
2675
- if (ready) console.log(import_chalk16.default.dim(` Ready \u2014 ${ready} to make it official, or keep refining.`));
2687
+ const applies = commands.filter((c) => c.needsProposal);
2688
+ const primary = applies[applies.length - 1];
2689
+ if (primary) {
2690
+ console.log(import_chalk16.default.bold.green(" \u279C Next: type ") + import_chalk16.default.bold.cyan(`/${primary.name}`) + import_chalk16.default.bold.green(" to apply this, then ") + import_chalk16.default.bold.cyan("/exit") + import_chalk16.default.bold.green(" to leave."));
2691
+ const rest = applies.slice(0, -1).map((c) => `/${c.name} = ${c.describe}`).join(" \xB7 ");
2692
+ console.log(import_chalk16.default.dim(` (or keep chatting to refine${rest ? ` \xB7 ${rest}` : ""} \xB7 /show = inspect)`));
2693
+ }
2676
2694
  console.log();
2677
2695
  }
2678
2696
  const line = formatBilling(data.billing);
@@ -7390,9 +7408,9 @@ function action(fn) {
7390
7408
  }
7391
7409
  };
7392
7410
  }
7393
- program.command("login").description("Authenticate with APIblaze").action(async () => {
7411
+ program.command("login").description("Authenticate with APIblaze").option("--team <idOrName>", 'Link this team without prompting ("default" = accept the account default) \u2014 for scripted runs').action(async (opts) => {
7394
7412
  try {
7395
- await runLogin();
7413
+ await runLogin(opts);
7396
7414
  } catch (err) {
7397
7415
  await printError(err);
7398
7416
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.19.13",
3
+ "version": "0.19.15",
4
4
  "description": "APIblaze CLI — Chat with your APIs, Manage your API keys, users and groups with the APIblaze serverless proxy",
5
5
  "keywords": [
6
6
  "apiblaze",
@@ -77,10 +77,10 @@
77
77
  "devDependencies": {
78
78
  "@types/inquirer": "^8.2.10",
79
79
  "@types/node": "^20.0.0",
80
+ "@types/react": "^18.2.0",
80
81
  "@types/ws": "^8.5.10",
81
82
  "tsup": "^8.0.0",
82
- "typescript": "^5.4.0",
83
- "@types/react": "^18.2.0"
83
+ "typescript": "^5.4.0"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "react": ">=17"