@great-arrow/cli 0.10.5 → 0.11.2

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 +128 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10011,7 +10011,7 @@ async function clearStoredCredential() {
10011
10011
 
10012
10012
  // src/lib/version.ts
10013
10013
  var CLI_PACKAGE_NAME = "@great-arrow/cli";
10014
- var CLI_VERSION = "0.10.5";
10014
+ var CLI_VERSION = "0.11.2";
10015
10015
  var GAD_INSTALL_VERSION = "2026.08.08";
10016
10016
  var GAD_INSTALL_MIN_VERSION = "2026.06.22";
10017
10017
  var GAD_INSTALL_HEADER = "X-GAD-Install-Version";
@@ -53356,6 +53356,130 @@ function boardCommand() {
53356
53356
  return new Command("board").description("Clear the board: tidy cards and run the safe ones").addCommand(clear).addCommand(boardRunCommand());
53357
53357
  }
53358
53358
 
53359
+ // src/commands/bill.ts
53360
+ var BILL_COLUMNS = [
53361
+ { key: "vendor", header: "Vendor", width: 24 },
53362
+ { key: "amount", header: "Amount", width: 12 },
53363
+ { key: "status", header: "Status", width: 11 },
53364
+ { key: "id", header: "ID", width: 36 }
53365
+ ];
53366
+ function money(amountMinor, currency) {
53367
+ if (typeof amountMinor !== "number") return "\u2014";
53368
+ const cur = typeof currency === "string" ? currency.toUpperCase() : "";
53369
+ return `${(amountMinor / 100).toFixed(2)} ${cur}`.trim();
53370
+ }
53371
+ function billRow(bill) {
53372
+ return {
53373
+ id: bill.id,
53374
+ vendor: bill.vendor,
53375
+ status: bill.status,
53376
+ amount: money(bill.amountMinor, bill.currency)
53377
+ };
53378
+ }
53379
+ function payMessage(r) {
53380
+ if (r.approved) {
53381
+ const attempt = r.attempt ?? {};
53382
+ return attempt.testMode ? "Approved in Link. Test mode: no money moved. The bill stays paying until you run gad bill cancel." : "Approved in Link.";
53383
+ }
53384
+ if (r.ended) return `Link ended this attempt: ${String(r.ended)}.`;
53385
+ if (r.proposed) {
53386
+ return "Proposal recorded. The owner must tap Pay in Great Arrow to send it; nothing was charged.";
53387
+ }
53388
+ if (typeof r.approvalUrl === "string" && r.approvalUrl) {
53389
+ return `Payment sent to Link and waiting for approval. Approve it here: ${r.approvalUrl}`;
53390
+ }
53391
+ return "Payment sent to Link and waiting for approval in the Link app.";
53392
+ }
53393
+ async function makeClient2() {
53394
+ const auth = await resolveAuth();
53395
+ return new GadClient({
53396
+ token: auth.token,
53397
+ getToken: auth.getToken,
53398
+ apiUrl: auth.apiUrl
53399
+ });
53400
+ }
53401
+ function formatterFor(options, cmd) {
53402
+ const parent = cmd.optsWithGlobals();
53403
+ return createFormatter({
53404
+ json: options.json || parent.json || false,
53405
+ quiet: parent.quiet || false,
53406
+ isTTY: isTTY(),
53407
+ noColor: parent.noColor || false
53408
+ });
53409
+ }
53410
+ var listCommand4 = new Command("list").description("List bills").option("--status <status>", "Filter by status").option("--json", "Output as JSON").action(
53411
+ async (options, cmd) => {
53412
+ const fmt = formatterFor(options, cmd);
53413
+ const client2 = await makeClient2();
53414
+ const result = await client2.get(
53415
+ "/api/bills",
53416
+ options.status ? { status: options.status } : void 0
53417
+ );
53418
+ const bills = result.bills ?? [];
53419
+ fmt.table(
53420
+ cmd.optsWithGlobals().json || options.json ? bills : bills.map(billRow),
53421
+ BILL_COLUMNS
53422
+ );
53423
+ }
53424
+ );
53425
+ var getCommand2 = new Command("get").description("Show one bill with its payment attempts and wallet status").argument("<id>", "Bill ID").option("--json", "Output as JSON").action(async (id, options, cmd) => {
53426
+ const fmt = formatterFor(options, cmd);
53427
+ const client2 = await makeClient2();
53428
+ const detail = await client2.get(
53429
+ `/api/bills/${encodeURIComponent(id)}`
53430
+ );
53431
+ if (options.json || cmd.optsWithGlobals().json) {
53432
+ fmt.detail(detail, [{ key: "bill", header: "Bill" }]);
53433
+ return;
53434
+ }
53435
+ const lines = [
53436
+ `${String(detail.bill.vendor)} \xB7 ${money(detail.bill.amountMinor, detail.bill.currency)} \xB7 ${String(detail.bill.status)}`,
53437
+ `Wallet: ${detail.wallet.connected ? "connected" : "not connected"}`,
53438
+ `Attempts: ${detail.attempts.length}`,
53439
+ ...detail.attempts.map(
53440
+ (a) => ` ${String(a.outcome)} \xB7 ${String(a.linkStatus ?? "\u2014")}`
53441
+ )
53442
+ ];
53443
+ process.stdout.write(`${brandedBlock("Bill", lines)}
53444
+ `);
53445
+ });
53446
+ var payCommand = new Command("pay").description("Pay a bill from your Link wallet").argument("<id>", "Bill ID").action(async (id) => {
53447
+ const client2 = await makeClient2();
53448
+ const path10 = `/api/bills/${encodeURIComponent(id)}`;
53449
+ const detail = await client2.get(path10);
53450
+ const result = await client2.post(`${path10}/pay`, {
53451
+ expectedVersion: detail.bill.version
53452
+ });
53453
+ process.stdout.write(`${brandedBlock("Bill pay", [payMessage(result)])}
53454
+ `);
53455
+ });
53456
+ var cancelCommand = new Command("cancel").description("Cancel a bill's payment in progress (waiting or approved)").argument("<id>", "Bill ID").action(async (id) => {
53457
+ const client2 = await makeClient2();
53458
+ const path10 = `/api/bills/${encodeURIComponent(id)}`;
53459
+ const detail = await client2.get(path10);
53460
+ const live = (detail.attempts ?? []).find(
53461
+ (a) => a.outcome === "pending" || a.outcome === "approved"
53462
+ );
53463
+ if (!live || typeof live.id !== "string") {
53464
+ process.stdout.write(
53465
+ `${brandedBlock("Bill pay", ["No payment in progress for this bill; nothing to cancel."])}
53466
+ `
53467
+ );
53468
+ return;
53469
+ }
53470
+ await client2.post(
53471
+ `${path10}/attempts/${encodeURIComponent(live.id)}/cancel`,
53472
+ {}
53473
+ );
53474
+ process.stdout.write(
53475
+ `${brandedBlock("Bill pay", ["Payment cancelled. The bill is unpaid; nothing was charged."])}
53476
+ `
53477
+ );
53478
+ });
53479
+ function billCommand() {
53480
+ return new Command("bill").description("List, read, pay and cancel bills").addCommand(listCommand4).addCommand(getCommand2).addCommand(payCommand).addCommand(cancelCommand);
53481
+ }
53482
+
53359
53483
  // src/commands/keys.ts
53360
53484
  import { createInterface as createInterface5 } from "node:readline";
53361
53485
  import { Writable } from "node:stream";
@@ -54028,7 +54152,7 @@ function err(line) {
54028
54152
  process.stderr.write(`${line}
54029
54153
  `);
54030
54154
  }
54031
- function listCommand4() {
54155
+ function listCommand5() {
54032
54156
  return new Command("list").description("List the credentials registered for key rotation").action(async (_opts, command) => {
54033
54157
  const g = globalOutputOpts(command);
54034
54158
  const { client: client2 } = await keysContext();
@@ -54408,7 +54532,7 @@ function approveCommand() {
54408
54532
  });
54409
54533
  }
54410
54534
  function keysCommand() {
54411
- return new Command("keys").description("Rotate leaked or expiring keys (GreatArrow.ai key rotation)").addCommand(listCommand4()).addCommand(statusCommand4()).addCommand(enrollCommand()).addCommand(pendingCommand()).addCommand(applyCommand()).addCommand(pasteCommand()).addCommand(approveCommand());
54535
+ return new Command("keys").description("Rotate leaked or expiring keys (GreatArrow.ai key rotation)").addCommand(listCommand5()).addCommand(statusCommand4()).addCommand(enrollCommand()).addCommand(pendingCommand()).addCommand(applyCommand()).addCommand(pasteCommand()).addCommand(approveCommand());
54412
54536
  }
54413
54537
 
54414
54538
  // src/lib/completions.ts
@@ -58099,6 +58223,7 @@ program2.addCommand(nextCommand());
58099
58223
  program2.addCommand(discoverCommand());
58100
58224
  program2.addCommand(callCommand());
58101
58225
  program2.addCommand(boardCommand());
58226
+ program2.addCommand(billCommand());
58102
58227
  program2.addCommand(claim_default);
58103
58228
  program2.addCommand(work_default());
58104
58229
  program2.addCommand(worktree_default);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-arrow/cli",
3
- "version": "0.10.5",
3
+ "version": "0.11.2",
4
4
  "description": "GreatArrow.ai CLI tool",
5
5
  "type": "module",
6
6
  "bin": {