@recur-tw/cli 0.1.3 → 0.1.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +22 -15
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -920,7 +920,7 @@ var RecurClient = class {
920
920
  }
921
921
  const headers = {
922
922
  Authorization: `Bearer ${this.secretKey}`,
923
- "User-Agent": `@recur-tw/cli/0.1.3`
923
+ "User-Agent": `@recur-tw/cli/0.1.4`
924
924
  };
925
925
  const hasBody = opts?.body !== void 0;
926
926
  if (hasBody) headers["Content-Type"] = "application/json";
@@ -1226,8 +1226,8 @@ function registerLoginCommand(program) {
1226
1226
  secretKey: key
1227
1227
  });
1228
1228
  try {
1229
- await client.get("/v1/products");
1230
- console.error(pc.green("✓ API key verified"));
1229
+ const me = await client.get("/v1/me");
1230
+ console.error(pc.green(`✓ API key verified (${me.organization.name})`));
1231
1231
  } catch {
1232
1232
  console.error(pc.yellow("⚠ Could not verify API key (saved anyway)"));
1233
1233
  }
@@ -1253,26 +1253,33 @@ function registerLoginCommand(program) {
1253
1253
  handleError(err);
1254
1254
  }
1255
1255
  });
1256
- program.command("whoami").description("Show current profile and verify API key").action(async () => {
1256
+ program.command("whoami").description("Show current profile, API key, and organization info").action(async () => {
1257
1257
  try {
1258
- const opts = program.opts();
1258
+ const globalOpts = program.opts();
1259
1259
  const active = listProfiles().find((p) => p.active);
1260
1260
  if (!active) {
1261
1261
  console.error(pc.yellow("No profiles configured. Run: recur login"));
1262
1262
  process.exit(1);
1263
1263
  }
1264
- const globalOpts = program.opts();
1265
- let maskedKey;
1264
+ const info = {
1265
+ profile: active.name,
1266
+ environment: active.environment
1267
+ };
1266
1268
  try {
1267
1269
  const key = resolveSecretKey(globalOpts);
1268
1270
  const prefixEnd = key.lastIndexOf("_") + 1;
1269
- maskedKey = key.slice(0, prefixEnd) + key.slice(prefixEnd, prefixEnd + 4) + "...";
1271
+ info["key"] = key.slice(0, prefixEnd) + key.slice(prefixEnd, prefixEnd + 4) + "...";
1272
+ try {
1273
+ const data = await new RecurClient({
1274
+ baseUrl: resolveBaseUrl(globalOpts),
1275
+ secretKey: key
1276
+ }).get("/v1/me");
1277
+ info["org"] = data.organization.name;
1278
+ info["org_id"] = data.organization.id;
1279
+ info["org_slug"] = data.organization.slug;
1280
+ } catch {}
1270
1281
  } catch {}
1271
- render({
1272
- profile: active.name,
1273
- environment: active.environment,
1274
- ...maskedKey && { key: maskedKey }
1275
- }, { format: opts.output });
1282
+ render(info, { format: globalOpts.output });
1276
1283
  } catch (err) {
1277
1284
  handleError(err);
1278
1285
  }
@@ -2557,7 +2564,7 @@ Requires a Secret Key (sk_test_* or sk_live_*) via --key, RECUR_SECRET_KEY, or r
2557
2564
  });
2558
2565
  const server = new McpServer({
2559
2566
  name: "recur",
2560
- version: "0.1.3"
2567
+ version: "0.1.4"
2561
2568
  }, { capabilities: { tools: {} } });
2562
2569
  registerTools(server, client);
2563
2570
  const transport = new StdioServerTransport();
@@ -2573,7 +2580,7 @@ Requires a Secret Key (sk_test_* or sk_live_*) via --key, RECUR_SECRET_KEY, or r
2573
2580
  //#endregion
2574
2581
  //#region src/cli.ts
2575
2582
  const program = new Command();
2576
- program.name("recur").description("Recur CLI — Taiwan subscription payment platform.\nManage products, customers, subscriptions, webhooks, and more.\nAll commands require a Secret Key (sk_test_* or sk_live_*).").version("0.1.3").option("--key <secret-key>", "API secret key (sk_test_* or sk_live_*)").option("--profile <name>", "Use a named profile from ~/.recur/credentials.json").option("--base-url <url>", "API base URL (default: https://api.recur.tw)").option("--output <format>", "Output format: json, table, csv, ndjson (default: json when piped, table otherwise)").hook("preAction", (thisCommand) => {
2583
+ program.name("recur").description("Recur CLI — Taiwan subscription payment platform.\nManage products, customers, subscriptions, webhooks, and more.\nAll commands require a Secret Key (sk_test_* or sk_live_*).").version("0.1.4").option("--key <secret-key>", "API secret key (sk_test_* or sk_live_*)").option("--profile <name>", "Use a named profile from ~/.recur/credentials.json").option("--base-url <url>", "API base URL (default: https://api.recur.tw)").option("--output <format>", "Output format: json, table, csv, ndjson (default: json when piped, table otherwise)").hook("preAction", (thisCommand) => {
2577
2584
  const opts = thisCommand.opts();
2578
2585
  if (!opts.output) opts.output = process.stdout.isTTY ? "table" : "json";
2579
2586
  if (![
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recur-tw/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "CLI for Recur - Taiwan's subscription payment platform",
5
5
  "keywords": [
6
6
  "recur",