@hisaabo/cli 0.3.2 → 0.4.0

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 (84) hide show
  1. package/.turbo/turbo-typecheck.log +1 -1
  2. package/README.md +1 -1
  3. package/dist/bin/{audit-trail-2YGXGUXW.js → audit-trail-5LOCJ7XZ.js} +4 -4
  4. package/dist/bin/{categories-P5VFWD5F.js → categories-64WWZTND.js} +3 -3
  5. package/dist/bin/{check-slug-4TMOTWUJ.js → check-slug-FLHHUDYS.js} +3 -3
  6. package/dist/bin/{chunk-FTOBDKMO.js → chunk-4MEL44QX.js} +54 -10
  7. package/dist/bin/chunk-FIMJZAS4.js +84 -0
  8. package/dist/bin/{chunk-EYNDY7RB.js → chunk-NO4FIFMS.js} +2 -1
  9. package/dist/bin/{chunk-FFBG6RU4.js → chunk-T63VQXNM.js} +1 -1
  10. package/dist/bin/{client-QNJ2H5CW.js → client-5NZ23GML.js} +1 -1
  11. package/dist/bin/{collection-efficiency-WMKEGS6U.js → collection-efficiency-U56XNVEE.js} +4 -4
  12. package/dist/bin/{config-UKVQYPPR.js → config-335MN4I7.js} +2 -2
  13. package/dist/bin/{create-Y22FAVOW.js → create-RPDEORDD.js} +3 -3
  14. package/dist/bin/{default-account-SA56M66A.js → default-account-AE6EXZZR.js} +3 -3
  15. package/dist/bin/{expenses-VZAOLYUW.js → expenses-5N2QSG54.js} +4 -4
  16. package/dist/bin/{export-QZ6WT6PJ.js → export-QICOQK34.js} +3 -3
  17. package/dist/bin/{factory-2DCU3B5T.js → factory-KOCW2AQM.js} +4 -4
  18. package/dist/bin/{get-EXL44I2X.js → get-A43QCI2S.js} +3 -3
  19. package/dist/bin/{get-6UYP6UVD.js → get-GWH6S5SJ.js} +4 -4
  20. package/dist/bin/hisaabo.js +280 -67
  21. package/dist/bin/invitations-P3EEN5WI.js +66 -0
  22. package/dist/bin/{invite-O26SAL72.js → invite-T3CKX53E.js} +3 -3
  23. package/dist/bin/{invoice-breakdown-XEATXVMR.js → invoice-breakdown-FN5BEFJD.js} +4 -4
  24. package/dist/bin/{items-3U5USBVG.js → items-2OOCQKVF.js} +4 -4
  25. package/dist/bin/{items-toggle-YEKMI2CM.js → items-toggle-SKZWCGJH.js} +3 -3
  26. package/dist/bin/{list-VBAHY72W.js → list-A2RKI3ZG.js} +4 -4
  27. package/dist/bin/list-NRMBMKMI.js +90 -0
  28. package/dist/bin/{list-FX2C3NCL.js → list-T74SN6IR.js} +3 -3
  29. package/dist/bin/{members-5FPRUAB6.js → members-W2GW3ODT.js} +4 -4
  30. package/dist/bin/{monthly-comparison-JEJ3TTY2.js → monthly-comparison-T34ZFOHL.js} +4 -4
  31. package/dist/bin/{order-cancel-XI2LKYXV.js → order-cancel-TI27JYYD.js} +3 -3
  32. package/dist/bin/{order-confirm-HUFCU6MO.js → order-confirm-VMRAMNTD.js} +3 -3
  33. package/dist/bin/{order-get-NSDMPUZR.js → order-get-C2RBUR4O.js} +4 -4
  34. package/dist/bin/{order-update-C7QYSD5R.js → order-update-RE3HATNF.js} +4 -4
  35. package/dist/bin/{output-QFLEKG5W.js → output-NUOL7KJW.js} +1 -1
  36. package/dist/bin/{payment-modes-WI3AWSES.js → payment-modes-WOOT22I7.js} +4 -4
  37. package/dist/bin/{profit-loss-5RIEOBKP.js → profit-loss-T4RESJ32.js} +4 -4
  38. package/dist/bin/{receivables-aging-L6DIQCNE.js → receivables-aging-6XMENEWS.js} +4 -4
  39. package/dist/bin/{remove-M2B4TZ37.js → remove-6QZI4JCY.js} +3 -3
  40. package/dist/bin/revoke-AVEMPAC7.js +40 -0
  41. package/dist/bin/{revoke-H3V2GNCD.js → revoke-YUCFZFNR.js} +3 -3
  42. package/dist/bin/revoke-all-LFW5WBHO.js +33 -0
  43. package/dist/bin/revoke-invitation-DTGQRJR4.js +40 -0
  44. package/dist/bin/{sales-trend-TICB3KGF.js → sales-trend-ZYBRUDUU.js} +4 -4
  45. package/dist/bin/{sequence-XUD6FAKY.js → sequence-FPOJTI2P.js} +3 -3
  46. package/dist/bin/{store-UQ2DDQ5I.js → store-IOB4Y67C.js} +4 -4
  47. package/dist/bin/{summary-BPNFC7I2.js → summary-5KYBA4ZO.js} +4 -4
  48. package/dist/bin/{top-customers-WGGJWKCN.js → top-customers-WSQ2UEJL.js} +4 -4
  49. package/dist/bin/{top-items-C7ZDDJMR.js → top-items-RWQPDGLN.js} +4 -4
  50. package/dist/bin/{top-outstanding-MOGWJIQS.js → top-outstanding-QAMO2E7Y.js} +4 -4
  51. package/dist/bin/{unpaid-invoices-ZUPNMQJP.js → unpaid-invoices-WB3TK5B4.js} +4 -4
  52. package/dist/bin/{untracked-BCJEVDW4.js → untracked-H733MYJL.js} +4 -4
  53. package/dist/bin/{update-IG565YIN.js → update-H6LPO2Z4.js} +3 -3
  54. package/dist/bin/{update-HIU4PANX.js → update-JU2X3XU5.js} +4 -4
  55. package/dist/bin/{update-PVLAX7T3.js → update-TLBUIC5J.js} +4 -4
  56. package/dist/bin/{update-role-Q4ZYJRYT.js → update-role-QST7BVFX.js} +3 -3
  57. package/dist/bin/{update-settings-XPC6L5WM.js → update-settings-Q2EGRLKZ.js} +3 -3
  58. package/package.json +2 -6
  59. package/src/auth.ts +12 -3
  60. package/src/bin/hisaabo.ts +6 -1
  61. package/src/bin/registrars/auth.ts +79 -10
  62. package/src/bin/registrars/bank.ts +34 -0
  63. package/src/bin/registrars/session.ts +32 -0
  64. package/src/bin/registrars/tenant.ts +18 -0
  65. package/src/client.ts +94 -11
  66. package/src/commands/bank/gateway-config.ts +61 -0
  67. package/src/commands/bank/update-gateway.ts +84 -0
  68. package/src/commands/session/list.ts +91 -0
  69. package/src/commands/session/revoke-all.ts +20 -0
  70. package/src/commands/session/revoke.ts +32 -0
  71. package/src/commands/tenant/invitations.ts +62 -0
  72. package/src/commands/tenant/revoke-invitation.ts +32 -0
  73. package/src/config.ts +51 -2
  74. package/src/error-handler.ts +53 -0
  75. package/src/output.ts +1 -0
  76. package/src/spinner.ts +39 -0
  77. package/tsup.config.ts +6 -1
  78. package/dist/bin/chunk-2P35S2C3.js +0 -46
  79. package/src/components/ErrorDisplay.tsx +0 -16
  80. package/src/components/Header.tsx +0 -26
  81. package/src/components/MoneyCell.tsx +0 -16
  82. package/src/components/Spinner.tsx +0 -12
  83. package/src/components/StatusBadge.tsx +0 -39
  84. package/src/components/Table.tsx +0 -63
@@ -11,18 +11,18 @@ import {
11
11
  monthStart,
12
12
  quarterRange,
13
13
  todayISO
14
- } from "./chunk-FFBG6RU4.js";
14
+ } from "./chunk-T63VQXNM.js";
15
15
  import {
16
16
  HisaaboApiError,
17
17
  HisaaboClient
18
- } from "./chunk-FTOBDKMO.js";
18
+ } from "./chunk-4MEL44QX.js";
19
19
  import {
20
20
  clearConfig,
21
21
  getConfig,
22
22
  getConfigPath,
23
23
  requireAuth,
24
24
  setConfig
25
- } from "./chunk-2P35S2C3.js";
25
+ } from "./chunk-FIMJZAS4.js";
26
26
  import {
27
27
  EXIT,
28
28
  fatalError,
@@ -37,7 +37,7 @@ import {
37
37
  success,
38
38
  termWidth,
39
39
  warn
40
- } from "./chunk-EYNDY7RB.js";
40
+ } from "./chunk-NO4FIFMS.js";
41
41
 
42
42
  // src/bin/hisaabo.ts
43
43
  import { Command } from "commander";
@@ -46,8 +46,15 @@ import { Command } from "commander";
46
46
  import * as readline from "readline";
47
47
 
48
48
  // src/auth.ts
49
+ function validateApiUrl(url) {
50
+ const parsed = new URL(url);
51
+ if (!["http:", "https:"].includes(parsed.protocol)) {
52
+ fatalError("API URL must use http:// or https://", EXIT.USAGE);
53
+ }
54
+ return parsed.origin + parsed.pathname.replace(/\/$/, "");
55
+ }
49
56
  async function loginWithToken(apiUrl, token) {
50
- const base = apiUrl.replace(/\/$/, "");
57
+ const base = validateApiUrl(apiUrl);
51
58
  const client = new HisaaboClient({
52
59
  apiUrl: base,
53
60
  token,
@@ -108,14 +115,15 @@ async function loginWithToken(apiUrl, token) {
108
115
  setConfig({
109
116
  businessId: selected.id,
110
117
  businessName: selected.name,
111
- tenantId: selected.id
118
+ tenantId: selected.id,
119
+ tokenCreatedAt: Date.now()
112
120
  });
113
121
  success(`Authenticated as ${user.name ?? user.email} (${user.email}) via API key`);
114
122
  console.log(" Active business: " + selected.name);
115
123
  console.log(" Config saved to " + getConfigPath() + "\n");
116
124
  }
117
125
  async function login(apiUrl, email, password) {
118
- const base = apiUrl.replace(/\/$/, "");
126
+ const base = validateApiUrl(apiUrl);
119
127
  const client = new HisaaboClient({
120
128
  apiUrl: base,
121
129
  token: "",
@@ -164,8 +172,9 @@ async function login(apiUrl, email, password) {
164
172
  setConfig({
165
173
  businessId: selected.id,
166
174
  businessName: selected.name,
167
- tenantId: selected.id
175
+ tenantId: selected.id,
168
176
  // fallback; real tenantId may differ
177
+ tokenCreatedAt: Date.now()
169
178
  });
170
179
  success(`Active business: ${selected.name}`);
171
180
  console.log(" Config saved to " + getConfigPath());
@@ -218,15 +227,70 @@ async function whoami(jsonMode) {
218
227
  }
219
228
 
220
229
  // src/bin/registrars/auth.ts
230
+ function ask(rl, q) {
231
+ return new Promise((res) => rl.question(q, res));
232
+ }
233
+ function askSecret(prompt6) {
234
+ return new Promise((resolve2) => {
235
+ const rl = readline.createInterface({ input: process.stdin, terminal: true });
236
+ process.stdout.write(prompt6);
237
+ const chars = [];
238
+ const cleanup = () => {
239
+ process.stdin.removeListener("data", onData);
240
+ process.stdin.setRawMode?.(false);
241
+ process.stdin.pause();
242
+ };
243
+ const onSignal = () => {
244
+ cleanup();
245
+ process.exit(130);
246
+ };
247
+ process.once("SIGTERM", onSignal);
248
+ process.once("SIGHUP", onSignal);
249
+ const onData = (key) => {
250
+ const ch = key.toString();
251
+ if (ch === "\n" || ch === "\r") {
252
+ process.removeListener("SIGTERM", onSignal);
253
+ process.removeListener("SIGHUP", onSignal);
254
+ cleanup();
255
+ process.stdout.write("\n");
256
+ rl.close();
257
+ const result = chars.join("");
258
+ chars.length = 0;
259
+ resolve2(result);
260
+ } else if (ch === "\x7F" || ch === "\b") {
261
+ if (chars.length > 0) {
262
+ chars.pop();
263
+ process.stdout.write("\b \b");
264
+ }
265
+ } else if (ch === "") {
266
+ cleanup();
267
+ process.stdout.write("\n");
268
+ process.exit(130);
269
+ } else if (ch.charCodeAt(0) >= 32) {
270
+ chars.push(ch);
271
+ process.stdout.write("*");
272
+ }
273
+ };
274
+ if (process.stdin.isTTY) {
275
+ process.stdin.setRawMode?.(true);
276
+ process.stdin.resume();
277
+ process.stdin.on("data", onData);
278
+ } else {
279
+ rl.question("", (answer) => {
280
+ rl.close();
281
+ resolve2(answer.trim());
282
+ });
283
+ }
284
+ });
285
+ }
221
286
  function registerAuthCommands(program2) {
222
- program2.command("login").description("Authenticate and configure your Hisaabo server").option("--api-url <url>", "Server URL").option("--email <email>", "Email address").option("--password <password>", "Password").option("--token <token>", "API key (hisaabo_key_...) for passwordless auth").action(async (opts) => {
287
+ program2.command("login").description("Authenticate and configure your Hisaabo server").option("--api-url <url>", "Server URL").option("--email <email>", "Email address").option("--password <password>", "Password (visible in shell history \u2014 prefer interactive prompt)").option("--token <token>", "API key (visible in shell history \u2014 prefer HISAABO_TOKEN env var)").action(async (opts) => {
223
288
  let apiUrl = opts.apiUrl;
224
289
  if (opts.token) {
225
290
  if (!apiUrl) {
226
291
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
227
- const ask = (q) => new Promise((res) => rl.question(q, res));
228
292
  console.log("\n Hisaabo CLI\n " + "\u2500".repeat(11) + "\n");
229
- const u = await ask(" Server URL [http://localhost:3000]: ");
293
+ const u = await ask(rl, " Server URL [http://localhost:3000]: ");
230
294
  rl.close();
231
295
  apiUrl = u.trim() || "http://localhost:3000";
232
296
  }
@@ -237,17 +301,16 @@ function registerAuthCommands(program2) {
237
301
  let password = opts.password;
238
302
  if (!apiUrl || !email || !password) {
239
303
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
240
- const ask = (q) => new Promise((res) => rl.question(q, res));
241
304
  console.log("\n Hisaabo CLI\n " + "\u2500".repeat(11) + "\n");
242
305
  if (!apiUrl) {
243
- const u = await ask(" Server URL [http://localhost:3000]: ");
306
+ const u = await ask(rl, " Server URL [http://localhost:3000]: ");
244
307
  apiUrl = u.trim() || "http://localhost:3000";
245
308
  }
246
- if (!email) email = (await ask(" Email: ")).trim();
309
+ if (!email) email = (await ask(rl, " Email: ")).trim();
310
+ rl.close();
247
311
  if (!password) {
248
- password = (await ask(" Password: ")).trim();
312
+ password = await askSecret(" Password: ");
249
313
  }
250
- rl.close();
251
314
  console.log("\n Tip: Generate an API key at Settings \u2192 API Keys for passwordless CLI access.\n");
252
315
  }
253
316
  await login(apiUrl, email, password);
@@ -327,19 +390,19 @@ function registerAuthCommands(program2) {
327
390
  function registerDashboardCommands(program2) {
328
391
  const dash = program2.command("dashboard").alias("dash").description("Business dashboard & analytics");
329
392
  dash.command("summary").description("Financial summary overview (FY to date)").option("--json", "JSON output").action(async (opts) => {
330
- const { dashboardCommand } = await import("./summary-BPNFC7I2.js");
393
+ const { dashboardCommand } = await import("./summary-5KYBA4ZO.js");
331
394
  await dashboardCommand({ json: opts.json });
332
395
  });
333
396
  dash.command("sales-trend").description("Sales trend over time").option("--months <n>", "Number of months to show", (v) => parseInt(v, 10)).option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--granularity <g>", "daily | weekly | monthly").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
334
- const { dashboardSalesTrendCommand } = await import("./sales-trend-TICB3KGF.js");
397
+ const { dashboardSalesTrendCommand } = await import("./sales-trend-ZYBRUDUU.js");
335
398
  await dashboardSalesTrendCommand(opts);
336
399
  });
337
400
  dash.command("top-outstanding").description("Parties with highest outstanding balances").option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10)).option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
338
- const { dashboardTopOutstandingCommand } = await import("./top-outstanding-MOGWJIQS.js");
401
+ const { dashboardTopOutstandingCommand } = await import("./top-outstanding-QAMO2E7Y.js");
339
402
  await dashboardTopOutstandingCommand(opts);
340
403
  });
341
404
  dash.command("top-customers").description("Top customers by revenue").option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10)).option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
342
- const { dashboardTopCustomersCommand } = await import("./top-customers-WGGJWKCN.js");
405
+ const { dashboardTopCustomersCommand } = await import("./top-customers-WSQ2UEJL.js");
343
406
  await dashboardTopCustomersCommand({
344
407
  limit: opts.limit,
345
408
  from: opts.from,
@@ -351,7 +414,7 @@ function registerDashboardCommands(program2) {
351
414
  });
352
415
  });
353
416
  dash.command("top-items").description("Top selling items by revenue and quantity").option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10)).option("--type <type>", "Item type filter (product | service)").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
354
- const { dashboardTopItemsCommand } = await import("./top-items-C7ZDDJMR.js");
417
+ const { dashboardTopItemsCommand } = await import("./top-items-RWQPDGLN.js");
355
418
  await dashboardTopItemsCommand({
356
419
  limit: opts.limit,
357
420
  type: opts.type,
@@ -364,7 +427,7 @@ function registerDashboardCommands(program2) {
364
427
  });
365
428
  });
366
429
  const expensesCmd = dash.command("expenses").description("Expenses broken down by category").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
367
- const { dashboardExpensesCommand } = await import("./expenses-VZAOLYUW.js");
430
+ const { dashboardExpensesCommand } = await import("./expenses-5N2QSG54.js");
368
431
  await dashboardExpensesCommand({
369
432
  from: opts.from,
370
433
  to: opts.to,
@@ -376,7 +439,7 @@ function registerDashboardCommands(program2) {
376
439
  });
377
440
  expensesCmd.alias("expenses-by-category");
378
441
  dash.command("invoice-breakdown").description("Invoice count and amounts by status").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").action(async (opts) => {
379
- const { dashboardInvoiceBreakdownCommand } = await import("./invoice-breakdown-XEATXVMR.js");
442
+ const { dashboardInvoiceBreakdownCommand } = await import("./invoice-breakdown-FN5BEFJD.js");
380
443
  await dashboardInvoiceBreakdownCommand({
381
444
  from: opts.from,
382
445
  to: opts.to,
@@ -386,7 +449,7 @@ function registerDashboardCommands(program2) {
386
449
  });
387
450
  });
388
451
  const plCmd = dash.command("profit-loss").description("Profit & Loss statement").option("--from <date>", "Start date (YYYY-MM-DD, default: FY start)").option("--to <date>", "End date (YYYY-MM-DD, default: today)").option("--this-month", "Scope to current calendar month").option("--this-fy", "Scope to current financial year").option("--json", "JSON output").action(async (opts) => {
389
- const { dashboardProfitLossCommand } = await import("./profit-loss-5RIEOBKP.js");
452
+ const { dashboardProfitLossCommand } = await import("./profit-loss-T4RESJ32.js");
390
453
  await dashboardProfitLossCommand({
391
454
  from: opts.from,
392
455
  to: opts.to,
@@ -397,11 +460,11 @@ function registerDashboardCommands(program2) {
397
460
  });
398
461
  plCmd.alias("pl");
399
462
  dash.command("receivables-aging").description("Receivables aging buckets (current / 1-30 / 31-60 / 61-90 / 90+)").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
400
- const { dashboardReceivablesAgingCommand } = await import("./receivables-aging-L6DIQCNE.js");
463
+ const { dashboardReceivablesAgingCommand } = await import("./receivables-aging-6XMENEWS.js");
401
464
  await dashboardReceivablesAgingCommand({ json: opts.json, format: opts.format });
402
465
  });
403
466
  dash.command("payment-modes").description("Payment mode breakdown (cash / UPI / bank transfer / etc.)").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
404
- const { dashboardPaymentModesCommand } = await import("./payment-modes-WI3AWSES.js");
467
+ const { dashboardPaymentModesCommand } = await import("./payment-modes-WOOT22I7.js");
405
468
  await dashboardPaymentModesCommand({
406
469
  from: opts.from,
407
470
  to: opts.to,
@@ -412,7 +475,7 @@ function registerDashboardCommands(program2) {
412
475
  });
413
476
  });
414
477
  dash.command("collection-efficiency").description("Collection rate, DSO, and aging breakdown").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
415
- const { dashboardCollectionEfficiencyCommand } = await import("./collection-efficiency-WMKEGS6U.js");
478
+ const { dashboardCollectionEfficiencyCommand } = await import("./collection-efficiency-U56XNVEE.js");
416
479
  await dashboardCollectionEfficiencyCommand({
417
480
  from: opts.from,
418
481
  to: opts.to,
@@ -423,7 +486,7 @@ function registerDashboardCommands(program2) {
423
486
  });
424
487
  });
425
488
  dash.command("monthly-comparison").description("Month-over-month comparison of sales, expenses, profit, and collections").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
426
- const { dashboardMonthlyComparisonCommand } = await import("./monthly-comparison-JEJ3TTY2.js");
489
+ const { dashboardMonthlyComparisonCommand } = await import("./monthly-comparison-T34ZFOHL.js");
427
490
  await dashboardMonthlyComparisonCommand({ json: opts.json, format: opts.format });
428
491
  });
429
492
  }
@@ -1752,11 +1815,11 @@ function registerPaymentCommands(program2) {
1752
1815
  await paymentDeleteCommand(id, { yes: opts.yes, json: opts.json });
1753
1816
  });
1754
1817
  payment.command("get <id>").description("Get payment details").option("--json", "JSON output").action(async (id, opts) => {
1755
- const { paymentGetCommand } = await import("./get-6UYP6UVD.js");
1818
+ const { paymentGetCommand } = await import("./get-GWH6S5SJ.js");
1756
1819
  await paymentGetCommand(id, { json: opts.json });
1757
1820
  });
1758
1821
  payment.command("update <id>").description("Update a payment").option("--amount <amount>", "New amount").option("--mode <mode>", "Payment mode: cash, upi, bank, cheque, other").option("--date <YYYY-MM-DD>", "Payment date").option("--reference <ref>", "Reference number (empty string to clear)").option("--notes <text>", "Notes (empty string to clear)").option("--json", "JSON output").action(async (id, opts) => {
1759
- const { paymentUpdateCommand } = await import("./update-HIU4PANX.js");
1822
+ const { paymentUpdateCommand } = await import("./update-JU2X3XU5.js");
1760
1823
  await paymentUpdateCommand(id, {
1761
1824
  json: opts.json,
1762
1825
  amount: opts.amount,
@@ -1767,11 +1830,11 @@ function registerPaymentCommands(program2) {
1767
1830
  });
1768
1831
  });
1769
1832
  payment.command("unpaid-invoices <partyId>").description("List unpaid invoices for a party").option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (partyId, opts) => {
1770
- const { paymentUnpaidInvoicesCommand } = await import("./unpaid-invoices-ZUPNMQJP.js");
1833
+ const { paymentUnpaidInvoicesCommand } = await import("./unpaid-invoices-WB3TK5B4.js");
1771
1834
  await paymentUnpaidInvoicesCommand(partyId, { json: opts.json, format: opts.format });
1772
1835
  });
1773
1836
  payment.command("untracked").description("List payments not linked to a bank account").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Items per page", parseInt).option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (opts) => {
1774
- const { paymentUntrackedCommand } = await import("./untracked-BCJEVDW4.js");
1837
+ const { paymentUntrackedCommand } = await import("./untracked-H733MYJL.js");
1775
1838
  await paymentUntrackedCommand({
1776
1839
  json: opts.json,
1777
1840
  format: opts.format,
@@ -1780,7 +1843,7 @@ function registerPaymentCommands(program2) {
1780
1843
  });
1781
1844
  });
1782
1845
  payment.command("default-account").description("Show recommended bank account for payments").option("--party-id <id>", "Party UUID to scope recommendation").option("--json", "JSON output").action(async (opts) => {
1783
- const { paymentDefaultAccountCommand } = await import("./default-account-SA56M66A.js");
1846
+ const { paymentDefaultAccountCommand } = await import("./default-account-AE6EXZZR.js");
1784
1847
  await paymentDefaultAccountCommand({ json: opts.json, partyId: opts.partyId });
1785
1848
  });
1786
1849
  }
@@ -1919,7 +1982,7 @@ function registerExpenseCommands(program2) {
1919
1982
  await expenseDeleteCommand(id, { yes: opts.yes, json: opts.json });
1920
1983
  });
1921
1984
  expense.command("update <id>").description("Update an expense").option("--amount <amount>", "New amount").option("--category <cat>", "Expense category").option("--date <YYYY-MM-DD>", "Expense date").option("--description <text>", "Description").option("--payment-mode <mode>", "Payment mode: cash, upi, bank, cheque, other").option("--reference <ref>", "Reference number").option("--json", "JSON output").action(async (id, opts) => {
1922
- const { expenseUpdateCommand } = await import("./update-PVLAX7T3.js");
1985
+ const { expenseUpdateCommand } = await import("./update-TLBUIC5J.js");
1923
1986
  await expenseUpdateCommand(id, {
1924
1987
  json: opts.json,
1925
1988
  amount: opts.amount,
@@ -1931,7 +1994,7 @@ function registerExpenseCommands(program2) {
1931
1994
  });
1932
1995
  });
1933
1996
  expense.command("categories").description("List all expense categories").option("--json", "JSON output").action(async (opts) => {
1934
- const { expenseCategoriesCommand } = await import("./categories-P5VFWD5F.js");
1997
+ const { expenseCategoriesCommand } = await import("./categories-64WWZTND.js");
1935
1998
  await expenseCategoriesCommand({ json: opts.json });
1936
1999
  });
1937
2000
  }
@@ -2718,6 +2781,114 @@ async function bankTransactionsCommand(accountId, opts) {
2718
2781
  }
2719
2782
  }
2720
2783
 
2784
+ // src/commands/bank/gateway-config.ts
2785
+ function formatChargeRate(rate) {
2786
+ if (!rate) return "-";
2787
+ return rate.type === "percentage" ? `${rate.value}%` : `Flat ${rate.value}`;
2788
+ }
2789
+ async function bankGatewayConfigCommand(accountId, opts) {
2790
+ const cfg = requireAuth();
2791
+ const client = new HisaaboClient(cfg);
2792
+ try {
2793
+ const config = await client.bankAccount.getGatewayConfig(accountId);
2794
+ if (!config) {
2795
+ fatalError(`No gateway configuration found for account: ${accountId}`, EXIT.NOT_FOUND);
2796
+ }
2797
+ if (opts.json) {
2798
+ outputJSON(config);
2799
+ return;
2800
+ }
2801
+ console.log(`
2802
+ Gateway Configuration`);
2803
+ console.log(" " + "\u2500".repeat(45));
2804
+ console.log(` Account: ${accountId}`);
2805
+ console.log(` Settlement Account: ${config.settlementAccountId}`);
2806
+ console.log(` Expense Category: ${config.expenseCategory}`);
2807
+ console.log(` Auto Settle: ${config.autoSettle ? "Yes" : "No"}`);
2808
+ console.log(` Active: ${config.isActive ? "Yes" : "No"}`);
2809
+ console.log();
2810
+ const modes = ["credit_card", "debit_card", "upi", "net_banking", "wallet", "default"];
2811
+ const rows = modes.map((mode) => ({
2812
+ mode,
2813
+ rate: formatChargeRate(config.chargeConfig[mode])
2814
+ }));
2815
+ const cols = [
2816
+ { key: "mode", header: "Payment Mode", width: 18 },
2817
+ { key: "rate", header: "Charge Rate", width: 16 }
2818
+ ];
2819
+ console.log(" Charge Rates:\n");
2820
+ outputTable(rows, cols);
2821
+ console.log();
2822
+ } catch (e) {
2823
+ if (e instanceof HisaaboApiError) {
2824
+ const err = e.hisaaboError;
2825
+ if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
2826
+ if (err.code === "not_found") fatalError(`Bank account not found: ${accountId}`, EXIT.NOT_FOUND);
2827
+ if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
2828
+ }
2829
+ fatalError(String(e instanceof Error ? e.message : e));
2830
+ }
2831
+ }
2832
+
2833
+ // src/commands/bank/update-gateway.ts
2834
+ function parseChargeRate(value) {
2835
+ if (value.toLowerCase().startsWith("flat:")) {
2836
+ return { type: "flat", value: value.slice(5) };
2837
+ }
2838
+ return { type: "percentage", value };
2839
+ }
2840
+ async function bankUpdateGatewayCommand(accountId, opts) {
2841
+ const cfg = requireAuth();
2842
+ const client = new HisaaboClient(cfg);
2843
+ try {
2844
+ const existing = await client.bankAccount.getGatewayConfig(accountId);
2845
+ const chargeConfig = existing?.chargeConfig ?? {};
2846
+ if (opts.chargeCreditCard !== void 0) {
2847
+ chargeConfig.credit_card = parseChargeRate(opts.chargeCreditCard);
2848
+ }
2849
+ if (opts.chargeDebitCard !== void 0) {
2850
+ chargeConfig.debit_card = parseChargeRate(opts.chargeDebitCard);
2851
+ }
2852
+ if (opts.chargeUpi !== void 0) {
2853
+ chargeConfig.upi = parseChargeRate(opts.chargeUpi);
2854
+ }
2855
+ if (opts.chargeNetBanking !== void 0) {
2856
+ chargeConfig.net_banking = parseChargeRate(opts.chargeNetBanking);
2857
+ }
2858
+ if (opts.chargeWallet !== void 0) {
2859
+ chargeConfig.wallet = parseChargeRate(opts.chargeWallet);
2860
+ }
2861
+ if (opts.chargeDefault !== void 0) {
2862
+ chargeConfig.default = parseChargeRate(opts.chargeDefault);
2863
+ }
2864
+ const settlementAccountId = opts.settlementAccount ?? existing?.settlementAccountId;
2865
+ if (!settlementAccountId) {
2866
+ fatalError("--settlement-account is required when creating a new gateway config", EXIT.USAGE);
2867
+ }
2868
+ const result = await client.bankAccount.upsertGatewayConfig({
2869
+ bankAccountId: accountId,
2870
+ settlementAccountId,
2871
+ chargeConfig
2872
+ });
2873
+ if (opts.json) {
2874
+ outputJSON(result);
2875
+ return;
2876
+ }
2877
+ success(`Gateway configuration updated for account: ${accountId}`);
2878
+ console.log(` Settlement Account: ${result.settlementAccountId}
2879
+ `);
2880
+ } catch (e) {
2881
+ if (e instanceof HisaaboApiError) {
2882
+ const err = e.hisaaboError;
2883
+ if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
2884
+ if (err.code === "validation_failed") fatalError(e.message, EXIT.VALIDATION);
2885
+ if (err.code === "not_found") fatalError(`Bank account not found: ${accountId}`, EXIT.NOT_FOUND);
2886
+ if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
2887
+ }
2888
+ fatalError(String(e instanceof Error ? e.message : e));
2889
+ }
2890
+ }
2891
+
2721
2892
  // src/bin/registrars/bank.ts
2722
2893
  function registerBankCommands(program2) {
2723
2894
  const bank = program2.command("bank").description("Bank account management");
@@ -2759,6 +2930,21 @@ function registerBankCommands(program2) {
2759
2930
  limit: opts.limit
2760
2931
  });
2761
2932
  });
2933
+ bank.command("gateway-config <accountId>").description("Display gateway configuration (charge rates, settlement account)").option("--json", "JSON output").action(async (accountId, opts) => {
2934
+ await bankGatewayConfigCommand(accountId, { json: opts.json });
2935
+ });
2936
+ bank.command("update-gateway <accountId>").description("Update gateway charge configuration").option("--json", "JSON output").option("--charge-credit-card <rate>", "Credit card charge rate (e.g. 2 for 2%, flat:20 for flat)").option("--charge-debit-card <rate>", "Debit card charge rate").option("--charge-upi <rate>", "UPI charge rate").option("--charge-net-banking <rate>", "Net banking charge rate").option("--charge-wallet <rate>", "Wallet charge rate").option("--charge-default <rate>", "Default charge rate for unlisted modes").option("--settlement-account <id>", "Settlement bank account ID").action(async (accountId, opts) => {
2937
+ await bankUpdateGatewayCommand(accountId, {
2938
+ json: opts.json,
2939
+ chargeCreditCard: opts.chargeCreditCard,
2940
+ chargeDebitCard: opts.chargeDebitCard,
2941
+ chargeUpi: opts.chargeUpi,
2942
+ chargeNetBanking: opts.chargeNetBanking,
2943
+ chargeWallet: opts.chargeWallet,
2944
+ chargeDefault: opts.chargeDefault,
2945
+ settlementAccount: opts.settlementAccount
2946
+ });
2947
+ });
2762
2948
  }
2763
2949
 
2764
2950
  // src/commands/shipment/index.ts
@@ -3037,11 +3223,11 @@ function registerTargetCommands(program2) {
3037
3223
  function registerStoreCommands(program2) {
3038
3224
  const store = program2.command("store").description("Online store management");
3039
3225
  store.command("settings").description("Show store settings").option("--json", "JSON output").action(async (opts) => {
3040
- const { storeSettingsCommand } = await import("./store-UQ2DDQ5I.js");
3226
+ const { storeSettingsCommand } = await import("./store-IOB4Y67C.js");
3041
3227
  await storeSettingsCommand({ json: opts.json });
3042
3228
  });
3043
3229
  store.command("update-settings").description("Update store settings").option("--slug <slug>", "Store URL slug").option("--tagline <text>", "Store tagline / description").option("--enabled <bool>", "Enable or disable store (true/false)").option("--json", "JSON output").action(async (opts) => {
3044
- const { storeUpdateSettingsCommand } = await import("./update-settings-XPC6L5WM.js");
3230
+ const { storeUpdateSettingsCommand } = await import("./update-settings-Q2EGRLKZ.js");
3045
3231
  await storeUpdateSettingsCommand({
3046
3232
  slug: opts.slug,
3047
3233
  tagline: opts.tagline,
@@ -3050,11 +3236,11 @@ function registerStoreCommands(program2) {
3050
3236
  });
3051
3237
  });
3052
3238
  store.command("items").description("List items available in the store").option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (opts) => {
3053
- const { storeItemsCommand } = await import("./items-3U5USBVG.js");
3239
+ const { storeItemsCommand } = await import("./items-2OOCQKVF.js");
3054
3240
  await storeItemsCommand({ json: opts.json, format: opts.format });
3055
3241
  });
3056
3242
  store.command("items-toggle").description("Bulk enable / disable store items").option("--enable <ids>", "Comma-separated item IDs to enable").option("--disable <ids>", "Comma-separated item IDs to disable").option("--json", "JSON output").action(async (opts) => {
3057
- const { storeItemsToggleCommand } = await import("./items-toggle-YEKMI2CM.js");
3243
+ const { storeItemsToggleCommand } = await import("./items-toggle-SKZWCGJH.js");
3058
3244
  await storeItemsToggleCommand({
3059
3245
  enable: opts.enable,
3060
3246
  disable: opts.disable,
@@ -3062,7 +3248,7 @@ function registerStoreCommands(program2) {
3062
3248
  });
3063
3249
  });
3064
3250
  store.command("orders").description("List store orders").option("--json", "JSON output").option("--status <status>", "Filter by order status").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Items per page", parseInt).action(async (opts) => {
3065
- const { storeOrdersCommand } = await import("./store-UQ2DDQ5I.js");
3251
+ const { storeOrdersCommand } = await import("./store-IOB4Y67C.js");
3066
3252
  await storeOrdersCommand({
3067
3253
  json: opts.json,
3068
3254
  status: opts.status,
@@ -3071,15 +3257,15 @@ function registerStoreCommands(program2) {
3071
3257
  });
3072
3258
  });
3073
3259
  store.command("order-get <id>").description("Get order details").option("--json", "JSON output").action(async (id, opts) => {
3074
- const { storeOrderGetCommand } = await import("./order-get-NSDMPUZR.js");
3260
+ const { storeOrderGetCommand } = await import("./order-get-C2RBUR4O.js");
3075
3261
  await storeOrderGetCommand(id, { json: opts.json });
3076
3262
  });
3077
3263
  store.command("order-confirm <id>").description("Confirm a pending order").option("-y, --yes", "Skip confirmation prompt").option("--json", "JSON output").action(async (id, opts) => {
3078
- const { storeOrderConfirmCommand } = await import("./order-confirm-HUFCU6MO.js");
3264
+ const { storeOrderConfirmCommand } = await import("./order-confirm-VMRAMNTD.js");
3079
3265
  await storeOrderConfirmCommand(id, { json: opts.json, yes: opts.yes });
3080
3266
  });
3081
3267
  store.command("order-cancel <id>").description("Cancel an order").option("-y, --yes", "Skip confirmation prompt").option("--reason <text>", "Cancellation reason").option("--json", "JSON output").action(async (id, opts) => {
3082
- const { storeOrderCancelCommand } = await import("./order-cancel-XI2LKYXV.js");
3268
+ const { storeOrderCancelCommand } = await import("./order-cancel-TI27JYYD.js");
3083
3269
  await storeOrderCancelCommand(id, {
3084
3270
  json: opts.json,
3085
3271
  yes: opts.yes,
@@ -3087,11 +3273,11 @@ function registerStoreCommands(program2) {
3087
3273
  });
3088
3274
  });
3089
3275
  store.command("order-update <id>").description("Update order status").option("--status <status>", "New status: preparing, ready, delivered").option("--json", "JSON output").action(async (id, opts) => {
3090
- const { storeOrderUpdateCommand } = await import("./order-update-C7QYSD5R.js");
3276
+ const { storeOrderUpdateCommand } = await import("./order-update-RE3HATNF.js");
3091
3277
  await storeOrderUpdateCommand(id, { json: opts.json, status: opts.status });
3092
3278
  });
3093
3279
  store.command("check-slug <slug>").description("Check store slug availability").option("--json", "JSON output").action(async (slug, opts) => {
3094
- const { storeCheckSlugCommand } = await import("./check-slug-4TMOTWUJ.js");
3280
+ const { storeCheckSlugCommand } = await import("./check-slug-FLHHUDYS.js");
3095
3281
  await storeCheckSlugCommand(slug, { json: opts.json });
3096
3282
  });
3097
3283
  }
@@ -3858,23 +4044,23 @@ function registerBusinessCommands(program2) {
3858
4044
  }
3859
4045
  });
3860
4046
  business.command("get").description("Show current business details").option("--json", "JSON output").action(async (opts) => {
3861
- const { businessGetCommand } = await import("./get-EXL44I2X.js");
4047
+ const { businessGetCommand } = await import("./get-A43QCI2S.js");
3862
4048
  await businessGetCommand(opts);
3863
4049
  });
3864
4050
  business.command("update").description("Update business settings").option("--name <name>", "Business name").option("--gstin <gstin>", "GSTIN").option("--address <address>", "Address").option("--state <state>", "State").option("--phone <phone>", "Phone number").option("--email <email>", "Email address").option("--financial-year-start <month>", "Financial year start month (1\u201312)").option("--json", "JSON output").action(async (opts) => {
3865
- const { businessUpdateCommand } = await import("./update-IG565YIN.js");
4051
+ const { businessUpdateCommand } = await import("./update-H6LPO2Z4.js");
3866
4052
  await businessUpdateCommand(opts);
3867
4053
  });
3868
4054
  business.command("sequence").description("Update invoice sequence number / prefix").requiredOption("--type <type>", "Document type: sale or purchase").option("--prefix <prefix>", "Invoice prefix (e.g. INV-)").option("--next-number <n>", "Next sequence number").option("--json", "JSON output").action(async (opts) => {
3869
- const { businessSequenceCommand } = await import("./sequence-XUD6FAKY.js");
4055
+ const { businessSequenceCommand } = await import("./sequence-FPOJTI2P.js");
3870
4056
  await businessSequenceCommand(opts);
3871
4057
  });
3872
4058
  business.command("audit-trail").description("View audit log for this business").option("--page <n>", "Page number", "1").option("--limit <n>", "Results per page", "25").option("--json", "JSON output").option("--format <fmt>", "Output format: table, tsv, csv").action(async (opts) => {
3873
- const { businessAuditTrailCommand } = await import("./audit-trail-2YGXGUXW.js");
4059
+ const { businessAuditTrailCommand } = await import("./audit-trail-5LOCJ7XZ.js");
3874
4060
  await businessAuditTrailCommand(opts);
3875
4061
  });
3876
4062
  business.command("export").description("Export all business data").option("--yes", "Skip confirmation prompt").option("--json", "JSON output").action(async (opts) => {
3877
- const { businessExportCommand } = await import("./export-QZ6WT6PJ.js");
4063
+ const { businessExportCommand } = await import("./export-QICOQK34.js");
3878
4064
  await businessExportCommand(opts);
3879
4065
  });
3880
4066
  business.command("switch").description("Switch active business").option("--json", "JSON output").action(async (opts) => {
@@ -3956,30 +4142,30 @@ function registerDocumentCommands(program2) {
3956
4142
  for (const dt of DOC_TYPES) {
3957
4143
  const parent = program2.command(dt.cmd).description(`${dt.label} management`);
3958
4144
  parent.command("list").description(`List ${dt.label.toLowerCase()}s`).option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv, ids").option("--status <status>", `Filter by status: ${dt.statuses.join(", ")}`).option("--party <search>", "Filter by party name").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Current month").option("--this-fy", "Current financial year").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Items per page", parseInt).action(async (opts) => {
3959
- const { docListCommand } = await import("./factory-2DCU3B5T.js");
4145
+ const { docListCommand } = await import("./factory-KOCW2AQM.js");
3960
4146
  await docListCommand(dt, opts);
3961
4147
  });
3962
4148
  parent.command("get <id>").description(`Get ${dt.label.toLowerCase()} details`).option("--json", "JSON output").action(async (id, opts) => {
3963
- const { docGetCommand } = await import("./factory-2DCU3B5T.js");
4149
+ const { docGetCommand } = await import("./factory-KOCW2AQM.js");
3964
4150
  await docGetCommand(dt, id, opts);
3965
4151
  });
3966
4152
  parent.command("create").description(`Create a new ${dt.label.toLowerCase()}`).option("--json", "JSON output").option("--party-id <id>", "Party UUID").option("--party <name>", "Party search name").option("--date <date>", "Document date (YYYY-MM-DD)").option("--due-date <date>", "Due date (YYYY-MM-DD)").option("--item <desc>", "Item description (repeatable)", (v, a) => [...a, v], []).option("--qty <n>", "Quantity per item (repeatable)", (v, a) => [...a, v], []).option("--rate <n>", "Rate per item (repeatable)", (v, a) => [...a, v], []).option("--notes <text>", "Notes").option("--discount <pct>", "Discount percent").option("-y, --yes", "Skip confirmation").action(async (opts) => {
3967
- const { docCreateCommand } = await import("./factory-2DCU3B5T.js");
4153
+ const { docCreateCommand } = await import("./factory-KOCW2AQM.js");
3968
4154
  await docCreateCommand(dt, opts);
3969
4155
  });
3970
4156
  parent.command("update-status <id> <status>").description(`Update ${dt.label.toLowerCase()} status (${dt.statuses.join(", ")})`).option("--json", "JSON output").action(async (id, status, opts) => {
3971
- const { docStatusCommand } = await import("./factory-2DCU3B5T.js");
4157
+ const { docStatusCommand } = await import("./factory-KOCW2AQM.js");
3972
4158
  await docStatusCommand(dt, id, status, opts);
3973
4159
  });
3974
4160
  parent.command("delete <id>").description(`Delete a ${dt.label.toLowerCase()}`).option("-y, --yes", "Skip confirmation").option("--json", "JSON output").action(async (id, opts) => {
3975
- const { docDeleteCommand } = await import("./factory-2DCU3B5T.js");
4161
+ const { docDeleteCommand } = await import("./factory-KOCW2AQM.js");
3976
4162
  await docDeleteCommand(dt, id, opts);
3977
4163
  });
3978
4164
  }
3979
4165
  program2.command("document").description("Document conversion operations").command("convert").description("Convert one document type to another").requiredOption("--from-type <type>", "Source type (quotation, proforma, delivery-challan, etc.)").requiredOption("--from-id <id>", "Source document ID").requiredOption("--to-type <type>", "Target type (invoice, credit-note, etc.)").option("--json", "JSON output").option("-y, --yes", "Skip confirmation").action(async (opts) => {
3980
- const { HisaaboClient: HisaaboClient2, HisaaboApiError: HisaaboApiError2 } = await import("./client-QNJ2H5CW.js");
3981
- const { requireAuth: requireAuth2 } = await import("./config-UKVQYPPR.js");
3982
- const { fatalError: fatalError2, outputJSON: outputJSON2, success: success2, EXIT: EXIT2 } = await import("./output-QFLEKG5W.js");
4166
+ const { HisaaboClient: HisaaboClient2, HisaaboApiError: HisaaboApiError2 } = await import("./client-5NZ23GML.js");
4167
+ const { requireAuth: requireAuth2 } = await import("./config-335MN4I7.js");
4168
+ const { fatalError: fatalError2, outputJSON: outputJSON2, success: success2, EXIT: EXIT2 } = await import("./output-NUOL7KJW.js");
3983
4169
  const cfg = requireAuth2();
3984
4170
  const client = new HisaaboClient2(cfg);
3985
4171
  if (!opts.yes && process.stdin.isTTY) {
@@ -4030,47 +4216,73 @@ function registerDocumentCommands(program2) {
4030
4216
  function registerTenantCommands(program2) {
4031
4217
  const tenant = program2.command("tenant").description("Tenant / workspace management");
4032
4218
  tenant.command("list").description("List tenants / organizations you belong to").option("--json", "JSON output").action(async (opts) => {
4033
- const { tenantListCommand } = await import("./list-FX2C3NCL.js");
4219
+ const { tenantListCommand } = await import("./list-T74SN6IR.js");
4034
4220
  await tenantListCommand({ json: opts.json });
4035
4221
  });
4036
4222
  tenant.command("members").description("List members of the current tenant").option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (opts) => {
4037
- const { tenantMembersCommand } = await import("./members-5FPRUAB6.js");
4223
+ const { tenantMembersCommand } = await import("./members-W2GW3ODT.js");
4038
4224
  await tenantMembersCommand({ json: opts.json, format: opts.format });
4039
4225
  });
4040
4226
  tenant.command("invite <email>").description("Invite a user to the tenant").option("--role <role>", "Role: admin, seller_manager, seller, accountant (default: seller)").option("--json", "JSON output").action(async (email, opts) => {
4041
- const { tenantInviteCommand } = await import("./invite-O26SAL72.js");
4227
+ const { tenantInviteCommand } = await import("./invite-T3CKX53E.js");
4042
4228
  await tenantInviteCommand(email, { role: opts.role, json: opts.json });
4043
4229
  });
4044
4230
  tenant.command("remove <userId>").description("Remove a member from the tenant").option("-y, --yes", "Skip confirmation").option("--json", "JSON output").action(async (userId, opts) => {
4045
- const { tenantRemoveCommand } = await import("./remove-M2B4TZ37.js");
4231
+ const { tenantRemoveCommand } = await import("./remove-6QZI4JCY.js");
4046
4232
  await tenantRemoveCommand(userId, { yes: opts.yes, json: opts.json });
4047
4233
  });
4048
4234
  tenant.command("update-role <userId> <role>").description("Update a member's role (admin, seller_manager, seller, accountant)").option("--json", "JSON output").action(async (userId, role, opts) => {
4049
- const { tenantUpdateRoleCommand } = await import("./update-role-Q4ZYJRYT.js");
4235
+ const { tenantUpdateRoleCommand } = await import("./update-role-QST7BVFX.js");
4050
4236
  await tenantUpdateRoleCommand(userId, role, { json: opts.json });
4051
4237
  });
4238
+ tenant.command("invitations").description("List pending invitations").option("--json", "JSON output").action(async (opts) => {
4239
+ const { listInvitationsCommand } = await import("./invitations-P3EEN5WI.js");
4240
+ await listInvitationsCommand(opts);
4241
+ });
4242
+ tenant.command("revoke-invitation <invitationId>").description("Revoke a pending invitation").option("--json", "JSON output").action(async (invitationId, opts) => {
4243
+ const { revokeInvitationCommand } = await import("./revoke-invitation-DTGQRJR4.js");
4244
+ await revokeInvitationCommand(invitationId, opts);
4245
+ });
4052
4246
  }
4053
4247
 
4054
4248
  // src/bin/registrars/api-key.ts
4055
4249
  function registerApiKeyCommands(program2) {
4056
4250
  const apiKey = program2.command("api-key").alias("key").description("API key management");
4057
4251
  apiKey.command("list").description("List all API keys").option("--json", "JSON output").option("--format <fmt>", "Output format: table, tsv, csv").action(async (opts) => {
4058
- const { apiKeyListCommand } = await import("./list-VBAHY72W.js");
4252
+ const { apiKeyListCommand } = await import("./list-A2RKI3ZG.js");
4059
4253
  await apiKeyListCommand(opts);
4060
4254
  });
4061
4255
  apiKey.command("create").description("Create a new API key").requiredOption("--name <name>", "Name / label for this key").option("--json", "JSON output").action(async (opts) => {
4062
- const { apiKeyCreateCommand } = await import("./create-Y22FAVOW.js");
4256
+ const { apiKeyCreateCommand } = await import("./create-RPDEORDD.js");
4063
4257
  await apiKeyCreateCommand(opts);
4064
4258
  });
4065
4259
  apiKey.command("revoke <id>").description("Revoke an API key by ID").option("--yes", "Skip confirmation prompt").option("--json", "JSON output").action(async (id, opts) => {
4066
- const { apiKeyRevokeCommand } = await import("./revoke-H3V2GNCD.js");
4260
+ const { apiKeyRevokeCommand } = await import("./revoke-YUCFZFNR.js");
4067
4261
  await apiKeyRevokeCommand(id, opts);
4068
4262
  });
4069
4263
  }
4070
4264
 
4265
+ // src/bin/registrars/session.ts
4266
+ function registerSessionCommands(program2) {
4267
+ const session = program2.command("session").description("Manage active sessions");
4268
+ session.command("list").description("List active sessions").option("--expired", "Show expired sessions instead").option("--json", "JSON output").action(async (opts) => {
4269
+ const { listSessionsCommand } = await import("./list-NRMBMKMI.js");
4270
+ await listSessionsCommand(opts);
4271
+ });
4272
+ session.command("revoke <sessionId>").description("Revoke a specific session").option("--json", "JSON output").action(async (sessionId, opts) => {
4273
+ const { revokeSessionCommand } = await import("./revoke-AVEMPAC7.js");
4274
+ await revokeSessionCommand(sessionId, opts);
4275
+ });
4276
+ session.command("revoke-all").description("Sign out from all devices").action(async () => {
4277
+ const { revokeAllSessionsCommand } = await import("./revoke-all-LFW5WBHO.js");
4278
+ await revokeAllSessionsCommand();
4279
+ });
4280
+ }
4281
+
4071
4282
  // src/bin/hisaabo.ts
4072
4283
  var program = new Command();
4073
- program.name("hisaabo").description("Hisaabo CLI \u2014 Invoicing and business management").version("0.1.0");
4284
+ var cliVersion = true ? "0.4.0" : "dev";
4285
+ program.name("hisaabo").description("Hisaabo CLI \u2014 Invoicing and business management").version(cliVersion);
4074
4286
  registerAuthCommands(program);
4075
4287
  registerDashboardCommands(program);
4076
4288
  registerInvoiceCommands(program);
@@ -4090,6 +4302,7 @@ registerBusinessCommands(program);
4090
4302
  registerDocumentCommands(program);
4091
4303
  registerTenantCommands(program);
4092
4304
  registerApiKeyCommands(program);
4305
+ registerSessionCommands(program);
4093
4306
  program.parseAsync(process.argv).catch((err) => {
4094
4307
  fatalError(String(err instanceof Error ? err.message : err));
4095
4308
  });