@hisaabo/cli 0.7.5 → 0.8.6

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 (210) hide show
  1. package/LICENSE +31 -0
  2. package/README.md +9 -0
  3. package/dist/bin/{audit-trail-DLSSSM4T.js → audit-trail-IJ6SKACR.js} +2 -2
  4. package/dist/bin/{categories-63QR6WCV.js → categories-O6TODPAH.js} +2 -2
  5. package/dist/bin/{check-slug-NXO55WKH.js → check-slug-P7RFU6OP.js} +2 -2
  6. package/dist/bin/chunk-NO4FIFMS.js +0 -0
  7. package/dist/bin/{chunk-7MJDOL6B.js → chunk-QUITS2FE.js} +28 -0
  8. package/dist/bin/{chunk-M42SETRZ.js → chunk-WDN7RIE3.js} +23 -2
  9. package/dist/bin/chunk-ZPYC767N.js +0 -0
  10. package/dist/bin/{client-T32CIZA3.js → client-36JX5MR3.js} +1 -1
  11. package/dist/bin/{collection-efficiency-T6PWNTZO.js → collection-efficiency-DA5RWG3V.js} +2 -2
  12. package/dist/bin/{config-V4QFCONN.js → config-4LLNT4SH.js} +3 -1
  13. package/dist/bin/{create-NUKHDWLK.js → create-C5INBPQO.js} +2 -2
  14. package/dist/bin/{default-account-JWFPHMRF.js → default-account-2GMQ7ZA4.js} +2 -2
  15. package/dist/bin/{expenses-2UWUZVLI.js → expenses-S2YVA5UT.js} +2 -2
  16. package/dist/bin/{export-XSX7WQH7.js → export-YOOODNVX.js} +2 -2
  17. package/dist/bin/export-ZA43MLWO.js +191 -0
  18. package/dist/bin/{factory-BWOKRIP4.js → factory-6MUCSXTL.js} +2 -2
  19. package/dist/bin/{get-CHNTG3IM.js → get-GMQRROK2.js} +2 -2
  20. package/dist/bin/{get-ZSZ6SL3N.js → get-ZV3SC2VY.js} +2 -2
  21. package/dist/bin/hisaabo.js +100 -57
  22. package/dist/bin/import-UUHMLCKX.js +267 -0
  23. package/dist/bin/{invitations-H2SL3XAD.js → invitations-OVORTTMF.js} +2 -2
  24. package/dist/bin/{invite-EW73UIBE.js → invite-GGHBZY4U.js} +2 -2
  25. package/dist/bin/{invoice-breakdown-XP4QATCF.js → invoice-breakdown-32XXAZDP.js} +2 -2
  26. package/dist/bin/{items-DPD6EFTP.js → items-6NOIMH6B.js} +2 -2
  27. package/dist/bin/{items-toggle-R4OPSE4W.js → items-toggle-L6W6QKQD.js} +2 -2
  28. package/dist/bin/{list-PKHBE475.js → list-FC5JHKHD.js} +2 -2
  29. package/dist/bin/{list-KLEHBMQ2.js → list-OXAVDXH7.js} +2 -2
  30. package/dist/bin/{list-UR7OOJVF.js → list-RAR56EMQ.js} +2 -2
  31. package/dist/bin/{members-XA3TF4IQ.js → members-Y6XJVHHR.js} +2 -2
  32. package/dist/bin/{monthly-comparison-OLVS5HEY.js → monthly-comparison-IAUZ6SBJ.js} +2 -2
  33. package/dist/bin/{order-cancel-MXMJFFRR.js → order-cancel-QRTCNART.js} +2 -2
  34. package/dist/bin/{order-confirm-IXU45Q4L.js → order-confirm-LGQOMC4O.js} +2 -2
  35. package/dist/bin/{order-get-RDXMHLJ7.js → order-get-4XAQCRYV.js} +2 -2
  36. package/dist/bin/{order-update-KGIPBEJX.js → order-update-KZY4H2UR.js} +2 -2
  37. package/dist/bin/output-NUOL7KJW.js +0 -0
  38. package/dist/bin/{payment-modes-CZL35SVS.js → payment-modes-DY2ZEMK7.js} +2 -2
  39. package/dist/bin/{profit-loss-M332OSC5.js → profit-loss-5GJBG3PL.js} +2 -2
  40. package/dist/bin/{receivables-aging-OXRHGMBF.js → receivables-aging-6A7XJKDT.js} +2 -2
  41. package/dist/bin/{remove-I5HD2Y4K.js → remove-ZBX34TIQ.js} +2 -2
  42. package/dist/bin/{revoke-OC6AOMIZ.js → revoke-XDNOA2GJ.js} +2 -2
  43. package/dist/bin/{revoke-MFLWGCMP.js → revoke-ZTAMW2Q2.js} +2 -2
  44. package/dist/bin/{revoke-all-FSAPBB3P.js → revoke-all-365NRBOA.js} +2 -2
  45. package/dist/bin/{revoke-invitation-JXDPXTOW.js → revoke-invitation-PQH7XNYA.js} +2 -2
  46. package/dist/bin/{sales-trend-KK63WNDL.js → sales-trend-D6PQ7MHY.js} +2 -2
  47. package/dist/bin/{sequence-IQ4HUJ3W.js → sequence-KZWADVD7.js} +2 -2
  48. package/dist/bin/{store-6QT6HKG2.js → store-SVRZBUFO.js} +2 -2
  49. package/dist/bin/{summary-3FTF5B4A.js → summary-H6U7O5GJ.js} +2 -2
  50. package/dist/bin/{top-customers-HNYGXBQZ.js → top-customers-ATBN6RDI.js} +2 -2
  51. package/dist/bin/{top-items-JUDG3BVW.js → top-items-XXU6KYTC.js} +2 -2
  52. package/dist/bin/{top-outstanding-WK26ZNE5.js → top-outstanding-JTQNGGW4.js} +2 -2
  53. package/dist/bin/{unpaid-invoices-RYFIIIK7.js → unpaid-invoices-BTNQFWCH.js} +2 -2
  54. package/dist/bin/{untracked-FAFS3KCK.js → untracked-PAMEDJ6Y.js} +2 -2
  55. package/dist/bin/{update-5YSPXIWO.js → update-6ZMX2OYX.js} +2 -2
  56. package/dist/bin/{update-I46XLU77.js → update-EGHPFXLK.js} +2 -2
  57. package/dist/bin/{update-NAW2JWZS.js → update-EK4NJWU4.js} +2 -2
  58. package/dist/bin/{update-role-5GV42MSN.js → update-role-24PDTNFK.js} +2 -2
  59. package/dist/bin/{update-settings-KYSQDIEO.js → update-settings-AASI6WZX.js} +2 -2
  60. package/package.json +35 -9
  61. package/.turbo/turbo-build.log +0 -13
  62. package/.turbo/turbo-typecheck.log +0 -4
  63. package/CLI-UX-ARCHITECTURE.md +0 -1269
  64. package/src/auth.ts +0 -221
  65. package/src/bin/hisaabo.ts +0 -74
  66. package/src/bin/registrars/api-key.ts +0 -44
  67. package/src/bin/registrars/auth.ts +0 -222
  68. package/src/bin/registrars/automated-invoice.ts +0 -167
  69. package/src/bin/registrars/bank-recon.ts +0 -34
  70. package/src/bin/registrars/bank.ts +0 -124
  71. package/src/bin/registrars/business.ts +0 -120
  72. package/src/bin/registrars/dashboard.ts +0 -225
  73. package/src/bin/registrars/document.ts +0 -184
  74. package/src/bin/registrars/einvoice.ts +0 -46
  75. package/src/bin/registrars/ewb.ts +0 -37
  76. package/src/bin/registrars/expense.ts +0 -87
  77. package/src/bin/registrars/gst.ts +0 -57
  78. package/src/bin/registrars/import.ts +0 -49
  79. package/src/bin/registrars/invoice.ts +0 -117
  80. package/src/bin/registrars/itc.ts +0 -56
  81. package/src/bin/registrars/item.ts +0 -112
  82. package/src/bin/registrars/journal.ts +0 -47
  83. package/src/bin/registrars/party.ts +0 -81
  84. package/src/bin/registrars/payment.ts +0 -128
  85. package/src/bin/registrars/report.ts +0 -186
  86. package/src/bin/registrars/session.ts +0 -32
  87. package/src/bin/registrars/shipment.ts +0 -74
  88. package/src/bin/registrars/store.ts +0 -128
  89. package/src/bin/registrars/target.ts +0 -46
  90. package/src/bin/registrars/tenant.ts +0 -73
  91. package/src/client.ts +0 -2071
  92. package/src/commands/api-key/create.ts +0 -72
  93. package/src/commands/api-key/list.ts +0 -71
  94. package/src/commands/api-key/revoke.ts +0 -46
  95. package/src/commands/automated-invoice/create.ts +0 -85
  96. package/src/commands/automated-invoice/delete.ts +0 -42
  97. package/src/commands/automated-invoice/get.ts +0 -113
  98. package/src/commands/automated-invoice/history.ts +0 -65
  99. package/src/commands/automated-invoice/index.ts +0 -11
  100. package/src/commands/automated-invoice/list.ts +0 -91
  101. package/src/commands/automated-invoice/pause.ts +0 -29
  102. package/src/commands/automated-invoice/resume.ts +0 -29
  103. package/src/commands/automated-invoice/run-now.ts +0 -29
  104. package/src/commands/automated-invoice/suggestions.ts +0 -68
  105. package/src/commands/automated-invoice/update.ts +0 -54
  106. package/src/commands/automated-invoice/usage.ts +0 -68
  107. package/src/commands/bank/gateway-config.ts +0 -61
  108. package/src/commands/bank/index.ts +0 -244
  109. package/src/commands/bank/update-gateway.ts +0 -84
  110. package/src/commands/bank-recon/index.ts +0 -127
  111. package/src/commands/business/audit-trail.ts +0 -79
  112. package/src/commands/business/export.ts +0 -52
  113. package/src/commands/business/get.ts +0 -55
  114. package/src/commands/business/sequence.ts +0 -65
  115. package/src/commands/business/update.ts +0 -64
  116. package/src/commands/dashboard/collection-efficiency.ts +0 -164
  117. package/src/commands/dashboard/expenses.ts +0 -76
  118. package/src/commands/dashboard/invoice-breakdown.ts +0 -89
  119. package/src/commands/dashboard/monthly-comparison.ts +0 -193
  120. package/src/commands/dashboard/payment-modes.ts +0 -121
  121. package/src/commands/dashboard/profit-loss.ts +0 -146
  122. package/src/commands/dashboard/receivables-aging.ts +0 -169
  123. package/src/commands/dashboard/sales-trend.ts +0 -68
  124. package/src/commands/dashboard/summary.ts +0 -105
  125. package/src/commands/dashboard/top-customers.ts +0 -70
  126. package/src/commands/dashboard/top-items.ts +0 -74
  127. package/src/commands/dashboard/top-outstanding.ts +0 -61
  128. package/src/commands/dashboard.ts +0 -105
  129. package/src/commands/document/factory.ts +0 -590
  130. package/src/commands/einvoice/index.ts +0 -109
  131. package/src/commands/ewb/index.ts +0 -108
  132. package/src/commands/expense/categories.ts +0 -40
  133. package/src/commands/expense/create.ts +0 -51
  134. package/src/commands/expense/delete.ts +0 -45
  135. package/src/commands/expense/list.ts +0 -65
  136. package/src/commands/expense/update.ts +0 -58
  137. package/src/commands/gst/index.ts +0 -194
  138. package/src/commands/import/index.ts +0 -168
  139. package/src/commands/invoice/create.ts +0 -262
  140. package/src/commands/invoice/delete.ts +0 -44
  141. package/src/commands/invoice/get.ts +0 -113
  142. package/src/commands/invoice/list.ts +0 -126
  143. package/src/commands/invoice/pdf.ts +0 -75
  144. package/src/commands/invoice/status.ts +0 -41
  145. package/src/commands/itc/index.ts +0 -163
  146. package/src/commands/item/categories.ts +0 -40
  147. package/src/commands/item/create.ts +0 -98
  148. package/src/commands/item/delete.ts +0 -44
  149. package/src/commands/item/list.ts +0 -81
  150. package/src/commands/item/low-stock-count.ts +0 -32
  151. package/src/commands/item/merge.ts +0 -53
  152. package/src/commands/item/price-history.ts +0 -59
  153. package/src/commands/item/rename-unit.ts +0 -39
  154. package/src/commands/item/sales-stats.ts +0 -44
  155. package/src/commands/item/stock-history.ts +0 -70
  156. package/src/commands/item/stock.ts +0 -46
  157. package/src/commands/item/switch-base-unit.ts +0 -42
  158. package/src/commands/item/update.ts +0 -59
  159. package/src/commands/item/variants-create.ts +0 -58
  160. package/src/commands/item/variants-delete.ts +0 -47
  161. package/src/commands/item/variants-list.ts +0 -63
  162. package/src/commands/item/variants-update.ts +0 -61
  163. package/src/commands/journal/index.ts +0 -156
  164. package/src/commands/party/create.ts +0 -88
  165. package/src/commands/party/delete.ts +0 -44
  166. package/src/commands/party/get.ts +0 -42
  167. package/src/commands/party/ledger-report.ts +0 -81
  168. package/src/commands/party/ledger.ts +0 -63
  169. package/src/commands/party/list.ts +0 -69
  170. package/src/commands/party/merge.ts +0 -50
  171. package/src/commands/party/stats.ts +0 -40
  172. package/src/commands/party/top-items.ts +0 -57
  173. package/src/commands/party/update.ts +0 -65
  174. package/src/commands/payment/create.ts +0 -131
  175. package/src/commands/payment/default-account.ts +0 -56
  176. package/src/commands/payment/delete.ts +0 -46
  177. package/src/commands/payment/get.ts +0 -59
  178. package/src/commands/payment/list.ts +0 -66
  179. package/src/commands/payment/unpaid-invoices.ts +0 -69
  180. package/src/commands/payment/untracked.ts +0 -70
  181. package/src/commands/payment/update.ts +0 -54
  182. package/src/commands/report/index.ts +0 -736
  183. package/src/commands/session/list.ts +0 -91
  184. package/src/commands/session/revoke-all.ts +0 -20
  185. package/src/commands/session/revoke.ts +0 -32
  186. package/src/commands/shipment/index.ts +0 -170
  187. package/src/commands/store/check-slug.ts +0 -48
  188. package/src/commands/store/index.ts +0 -77
  189. package/src/commands/store/items-toggle.ts +0 -41
  190. package/src/commands/store/items.ts +0 -61
  191. package/src/commands/store/order-cancel.ts +0 -48
  192. package/src/commands/store/order-confirm.ts +0 -45
  193. package/src/commands/store/order-get.ts +0 -66
  194. package/src/commands/store/order-update.ts +0 -52
  195. package/src/commands/store/update-settings.ts +0 -52
  196. package/src/commands/target/index.ts +0 -118
  197. package/src/commands/tenant/invitations.ts +0 -62
  198. package/src/commands/tenant/invite.ts +0 -57
  199. package/src/commands/tenant/list.ts +0 -46
  200. package/src/commands/tenant/members.ts +0 -55
  201. package/src/commands/tenant/remove.ts +0 -47
  202. package/src/commands/tenant/revoke-invitation.ts +0 -32
  203. package/src/commands/tenant/update-role.ts +0 -41
  204. package/src/config.ts +0 -120
  205. package/src/error-handler.ts +0 -53
  206. package/src/format.ts +0 -181
  207. package/src/output.ts +0 -228
  208. package/src/spinner.ts +0 -39
  209. package/tsconfig.json +0 -22
  210. package/tsup.config.ts +0 -18
@@ -1,167 +0,0 @@
1
- import { Command } from "commander";
2
- import {
3
- automatedInvoiceListCommand, automatedInvoiceGetCommand, automatedInvoiceCreateCommand,
4
- automatedInvoiceUpdateCommand,
5
- automatedInvoicePauseCommand, automatedInvoiceResumeCommand, automatedInvoiceRunNowCommand,
6
- automatedInvoiceDeleteCommand,
7
- automatedInvoiceHistoryCommand,
8
- automatedInvoiceUsageCommand,
9
- automatedInvoiceSuggestionsCommand,
10
- } from "../../commands/automated-invoice/index.js";
11
-
12
- export function registerAutomatedInvoiceCommands(program: Command): void {
13
- // ── automated-invoice ────────────────────────────────────────────────────
14
-
15
- const automatedInvoice = program.command("automated-invoice").alias("auto-inv").description("Recurring / automated invoice management");
16
-
17
- automatedInvoice
18
- .command("list")
19
- .description("List recurring invoice templates")
20
- .option("--json", "JSON output")
21
- .option("--format <format>", "Output format: table, tsv, csv, ids")
22
- .option("--status <status>", "Filter by status: active, paused, completed, expired")
23
- .option("--page <n>", "Page number", parseInt)
24
- .option("--limit <n>", "Items per page", parseInt)
25
- .action(async (opts) => {
26
- await automatedInvoiceListCommand({
27
- json: opts.json,
28
- format: opts.format,
29
- status: opts.status,
30
- page: opts.page,
31
- limit: opts.limit,
32
- });
33
- });
34
-
35
- automatedInvoice
36
- .command("get <id>")
37
- .description("Get recurring invoice template details")
38
- .option("--json", "JSON output")
39
- .action(async (id, opts) => {
40
- await automatedInvoiceGetCommand(id, { json: opts.json });
41
- });
42
-
43
- automatedInvoice
44
- .command("create")
45
- .description("Create a new recurring invoice template")
46
- .option("--json", "JSON output")
47
- .option("--party-id <id>", "Party UUID")
48
- .option("--name <name>", "Template name")
49
- .option("--type <type>", "sale or purchase")
50
- .option("--frequency <freq>", "weekly/biweekly/monthly/quarterly/half_yearly/yearly/custom")
51
- .option("--custom-interval-days <n>", "Custom interval in days (when frequency is custom)")
52
- .option("--line-item <desc>", "Line item description (repeatable)", (v: string, a: string[]) => [...a, v], [] as string[])
53
- .option("--qty <n>", "Quantity (per --line-item)", (v: string, a: string[]) => [...a, v], [] as string[])
54
- .option("--rate <n>", "Unit price (per --line-item)", (v: string, a: string[]) => [...a, v], [] as string[])
55
- .option("--tax <n>", "Tax percent (per --line-item)", (v: string, a: string[]) => [...a, v], [] as string[])
56
- .option("--discount <n>", "Discount percent (per --line-item)", (v: string, a: string[]) => [...a, v], [] as string[])
57
- .option("--start-date <date>", "Start date (YYYY-MM-DD)")
58
- .option("--end-date <date>", "End date (YYYY-MM-DD)")
59
- .option("--max-runs <n>", "Maximum number of runs")
60
- .option("--notes <text>", "Notes")
61
- .action(async (opts) => {
62
- await automatedInvoiceCreateCommand({
63
- json: opts.json,
64
- partyId: opts.partyId,
65
- name: opts.name,
66
- type: opts.type,
67
- frequency: opts.frequency,
68
- customIntervalDays: opts.customIntervalDays,
69
- lineItem: opts.lineItem,
70
- qty: opts.qty,
71
- rate: opts.rate,
72
- tax: opts.tax,
73
- discount: opts.discount,
74
- startDate: opts.startDate,
75
- endDate: opts.endDate,
76
- maxRuns: opts.maxRuns,
77
- notes: opts.notes,
78
- });
79
- });
80
-
81
- automatedInvoice
82
- .command("pause <id>")
83
- .description("Pause an active recurring invoice template")
84
- .option("--json", "JSON output")
85
- .action(async (id, opts) => {
86
- await automatedInvoicePauseCommand(id, { json: opts.json });
87
- });
88
-
89
- automatedInvoice
90
- .command("resume <id>")
91
- .description("Resume a paused recurring invoice template")
92
- .option("--json", "JSON output")
93
- .action(async (id, opts) => {
94
- await automatedInvoiceResumeCommand(id, { json: opts.json });
95
- });
96
-
97
- automatedInvoice
98
- .command("run-now <id>")
99
- .description("Manually trigger a recurring invoice template execution")
100
- .option("--json", "JSON output")
101
- .action(async (id, opts) => {
102
- await automatedInvoiceRunNowCommand(id, { json: opts.json });
103
- });
104
-
105
- automatedInvoice
106
- .command("delete <id>")
107
- .description("Delete a recurring invoice template")
108
- .option("-y, --yes", "Skip confirmation")
109
- .option("--json", "JSON output")
110
- .action(async (id, opts) => {
111
- await automatedInvoiceDeleteCommand(id, { yes: opts.yes, json: opts.json });
112
- });
113
-
114
- automatedInvoice
115
- .command("update <id>")
116
- .description("Update a recurring invoice template")
117
- .option("--name <name>", "Template name")
118
- .option("--frequency <freq>", "weekly/biweekly/monthly/quarterly/half_yearly/yearly/custom")
119
- .option("--start-date <date>", "Start date (YYYY-MM-DD)")
120
- .option("--end-date <date>", "End date (YYYY-MM-DD)")
121
- .option("--max-runs <n>", "Maximum number of runs")
122
- .option("--notes <text>", "Notes")
123
- .option("--json", "JSON output")
124
- .action(async (id, opts) => {
125
- await automatedInvoiceUpdateCommand(id, {
126
- json: opts.json,
127
- name: opts.name,
128
- frequency: opts.frequency,
129
- startDate: opts.startDate,
130
- endDate: opts.endDate,
131
- maxRuns: opts.maxRuns,
132
- notes: opts.notes,
133
- });
134
- });
135
-
136
- automatedInvoice
137
- .command("history <templateId>")
138
- .description("Show execution history for a recurring invoice template")
139
- .option("--json", "JSON output")
140
- .option("--format <format>", "Output format: table, tsv, csv")
141
- .option("--page <n>", "Page number", parseInt)
142
- .option("--limit <n>", "Items per page", parseInt)
143
- .action(async (templateId, opts) => {
144
- await automatedInvoiceHistoryCommand(templateId, {
145
- json: opts.json,
146
- format: opts.format,
147
- page: opts.page,
148
- limit: opts.limit,
149
- });
150
- });
151
-
152
- automatedInvoice
153
- .command("usage")
154
- .description("Show plan usage for recurring invoices")
155
- .option("--json", "JSON output")
156
- .action(async (opts) => {
157
- await automatedInvoiceUsageCommand({ json: opts.json });
158
- });
159
-
160
- automatedInvoice
161
- .command("suggestions")
162
- .description("Show suggested recurring invoice templates based on invoice history")
163
- .option("--json", "JSON output")
164
- .action(async (opts) => {
165
- await automatedInvoiceSuggestionsCommand({ json: opts.json });
166
- });
167
- }
@@ -1,34 +0,0 @@
1
- import { Command } from "commander";
2
- import {
3
- bankReconImportsCommand,
4
- bankReconSummaryCommand,
5
- bankReconRulesCommand,
6
- } from "../../commands/bank-recon/index.js";
7
-
8
- export function registerBankReconCommands(program: Command): void {
9
- const bankRecon = program.command("bank-recon").description("Bank reconciliation");
10
-
11
- bankRecon
12
- .command("imports")
13
- .description("List bank statement imports")
14
- .option("--json", "JSON output")
15
- .action(async (opts) => {
16
- await bankReconImportsCommand({ json: opts.json });
17
- });
18
-
19
- bankRecon
20
- .command("summary <importId>")
21
- .description("Summary for a bank statement import")
22
- .option("--json", "JSON output")
23
- .action(async (importId: string, opts) => {
24
- await bankReconSummaryCommand(importId, { json: opts.json });
25
- });
26
-
27
- bankRecon
28
- .command("rules")
29
- .description("List auto-matching rules")
30
- .option("--json", "JSON output")
31
- .action(async (opts) => {
32
- await bankReconRulesCommand({ json: opts.json });
33
- });
34
- }
@@ -1,124 +0,0 @@
1
- import { Command } from "commander";
2
- import {
3
- bankListCommand, bankGetCommand, bankCreateCommand, bankTransferCommand, bankTransactionsCommand,
4
- } from "../../commands/bank/index.js";
5
- import { bankGatewayConfigCommand } from "../../commands/bank/gateway-config.js";
6
- import { bankUpdateGatewayCommand } from "../../commands/bank/update-gateway.js";
7
-
8
- export function registerBankCommands(program: Command): void {
9
- // ── bank ─────────────────────────────────────────────────────────────────
10
-
11
- const bank = program.command("bank").description("Bank account management");
12
-
13
- bank
14
- .command("list")
15
- .description("List bank accounts with balances")
16
- .option("--json", "JSON output")
17
- .action(async (opts) => {
18
- await bankListCommand({ json: opts.json });
19
- });
20
-
21
- bank
22
- .command("get <id>")
23
- .description("Get bank account details")
24
- .option("--json", "JSON output")
25
- .action(async (id, opts) => {
26
- await bankGetCommand(id, { json: opts.json });
27
- });
28
-
29
- bank
30
- .command("create")
31
- .description("Create a new bank account")
32
- .option("--json", "JSON output")
33
- .option("--name <name>", "Account name")
34
- .option("--type <type>", "savings/current/cash/credit/other")
35
- .option("--bank <name>", "Bank name")
36
- .option("--account-number <num>", "Account number")
37
- .option("--ifsc <code>", "IFSC code")
38
- .option("--opening-balance <amount>", "Opening balance")
39
- .option("--default", "Set as default account")
40
- .option("-y, --yes", "Skip prompts")
41
- .action(async (opts) => {
42
- await bankCreateCommand({
43
- json: opts.json,
44
- name: opts.name,
45
- type: opts.type,
46
- bank: opts.bank,
47
- accountNumber: opts.accountNumber,
48
- ifsc: opts.ifsc,
49
- openingBalance: opts.openingBalance,
50
- default: opts.default,
51
- yes: opts.yes,
52
- });
53
- });
54
-
55
- bank
56
- .command("transfer")
57
- .description("Transfer between bank accounts")
58
- .option("--json", "JSON output")
59
- .option("--from <id>", "Source account ID")
60
- .option("--to <id>", "Destination account ID")
61
- .option("--amount <amount>", "Transfer amount")
62
- .option("--description <text>", "Description")
63
- .option("--date <date>", "Transfer date")
64
- .action(async (opts) => {
65
- await bankTransferCommand({
66
- json: opts.json,
67
- from: opts.from,
68
- to: opts.to,
69
- amount: opts.amount,
70
- description: opts.description,
71
- date: opts.date,
72
- });
73
- });
74
-
75
- bank
76
- .command("transactions <accountId>")
77
- .description("List transactions for a bank account")
78
- .option("--json", "JSON output")
79
- .option("--from <date>", "From date")
80
- .option("--to <date>", "To date")
81
- .option("--page <n>", "Page number", parseInt)
82
- .option("--limit <n>", "Items per page", parseInt)
83
- .action(async (accountId, opts) => {
84
- await bankTransactionsCommand(accountId, {
85
- json: opts.json,
86
- from: opts.from,
87
- to: opts.to,
88
- page: opts.page,
89
- limit: opts.limit,
90
- });
91
- });
92
-
93
- bank
94
- .command("gateway-config <accountId>")
95
- .description("Display gateway configuration (charge rates, settlement account)")
96
- .option("--json", "JSON output")
97
- .action(async (accountId, opts) => {
98
- await bankGatewayConfigCommand(accountId, { json: opts.json });
99
- });
100
-
101
- bank
102
- .command("update-gateway <accountId>")
103
- .description("Update gateway charge configuration")
104
- .option("--json", "JSON output")
105
- .option("--charge-credit-card <rate>", "Credit card charge rate (e.g. 2 for 2%, flat:20 for flat)")
106
- .option("--charge-debit-card <rate>", "Debit card charge rate")
107
- .option("--charge-upi <rate>", "UPI charge rate")
108
- .option("--charge-net-banking <rate>", "Net banking charge rate")
109
- .option("--charge-wallet <rate>", "Wallet charge rate")
110
- .option("--charge-default <rate>", "Default charge rate for unlisted modes")
111
- .option("--settlement-account <id>", "Settlement bank account ID")
112
- .action(async (accountId, opts) => {
113
- await bankUpdateGatewayCommand(accountId, {
114
- json: opts.json,
115
- chargeCreditCard: opts.chargeCreditCard,
116
- chargeDebitCard: opts.chargeDebitCard,
117
- chargeUpi: opts.chargeUpi,
118
- chargeNetBanking: opts.chargeNetBanking,
119
- chargeWallet: opts.chargeWallet,
120
- chargeDefault: opts.chargeDefault,
121
- settlementAccount: opts.settlementAccount,
122
- });
123
- });
124
- }
@@ -1,120 +0,0 @@
1
- import { Command } from "commander";
2
- import * as readline from "readline";
3
- import { setConfig, requireAuth } from "../../config.js";
4
- import { HisaaboClient, HisaaboApiError } from "../../client.js";
5
- import { fatalError, success, EXIT, outputJSON } from "../../output.js";
6
-
7
- export function registerBusinessCommands(program: Command): void {
8
- // ── business (alias) ──────────────────────────────────────────────────────
9
-
10
- const business = program.command("business").description("Business management");
11
-
12
- business
13
- .command("list")
14
- .description("List all businesses")
15
- .option("--json", "JSON output")
16
- .action(async (opts) => {
17
- const cfg = requireAuth();
18
- const client = new HisaaboClient(cfg);
19
- try {
20
- const businesses = await client.business.list();
21
- if (opts.json) { outputJSON(businesses); return; }
22
- businesses.forEach((b, i) => {
23
- const active = b.id === cfg.businessId ? " [active]" : "";
24
- console.log(` ${i + 1} ${b.name.padEnd(30)} ${(b.gstin ?? "-").padEnd(18)} ${b.gstRegistrationType}${active}`);
25
- });
26
- console.log();
27
- } catch (e) {
28
- fatalError(String(e instanceof Error ? e.message : e));
29
- }
30
- });
31
-
32
- business
33
- .command("get")
34
- .description("Show current business details")
35
- .option("--json", "JSON output")
36
- .action(async (opts) => {
37
- const { businessGetCommand } = await import("../../commands/business/get.js");
38
- await businessGetCommand(opts);
39
- });
40
-
41
- business
42
- .command("update")
43
- .description("Update business settings")
44
- .option("--name <name>", "Business name")
45
- .option("--gstin <gstin>", "GSTIN")
46
- .option("--address <address>", "Address")
47
- .option("--state <state>", "State")
48
- .option("--phone <phone>", "Phone number")
49
- .option("--email <email>", "Email address")
50
- .option("--financial-year-start <month>", "Financial year start month (1–12)")
51
- .option("--json", "JSON output")
52
- .action(async (opts) => {
53
- const { businessUpdateCommand } = await import("../../commands/business/update.js");
54
- await businessUpdateCommand(opts);
55
- });
56
-
57
- business
58
- .command("sequence")
59
- .description("Update invoice sequence number / prefix")
60
- .requiredOption("--type <type>", "Document type: sale or purchase")
61
- .option("--prefix <prefix>", "Invoice prefix (e.g. INV-)")
62
- .option("--next-number <n>", "Next sequence number")
63
- .option("--json", "JSON output")
64
- .action(async (opts) => {
65
- const { businessSequenceCommand } = await import("../../commands/business/sequence.js");
66
- await businessSequenceCommand(opts);
67
- });
68
-
69
- business
70
- .command("audit-trail")
71
- .description("View audit log for this business")
72
- .option("--page <n>", "Page number", "1")
73
- .option("--limit <n>", "Results per page", "25")
74
- .option("--json", "JSON output")
75
- .option("--format <fmt>", "Output format: table, tsv, csv")
76
- .action(async (opts) => {
77
- const { businessAuditTrailCommand } = await import("../../commands/business/audit-trail.js");
78
- await businessAuditTrailCommand(opts);
79
- });
80
-
81
- business
82
- .command("export")
83
- .description("Export all business data")
84
- .option("--yes", "Skip confirmation prompt")
85
- .option("--json", "JSON output")
86
- .action(async (opts) => {
87
- const { businessExportCommand } = await import("../../commands/business/export.js");
88
- await businessExportCommand(opts);
89
- });
90
-
91
- business
92
- .command("switch")
93
- .description("Switch active business")
94
- .option("--json", "JSON output")
95
- .action(async (opts) => {
96
- const cfg = requireAuth();
97
- const client = new HisaaboClient(cfg);
98
- try {
99
- const businesses = await client.business.list();
100
- if (opts.json) { outputJSON(businesses); return; }
101
- businesses.forEach((b, i) => {
102
- const active = b.id === cfg.businessId ? " [active]" : "";
103
- console.log(` ${i + 1} ${b.name.padEnd(28)}${active}`);
104
- });
105
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
106
- const answer = await new Promise<string>((res) => rl.question("\n Select: ", res));
107
- rl.close();
108
- const idx = parseInt(answer.trim(), 10) - 1;
109
- const selected = businesses[Math.max(0, Math.min(idx, businesses.length - 1))];
110
- if (!selected) fatalError("Invalid selection.", EXIT.USAGE);
111
- setConfig({ businessId: selected.id, businessName: selected.name });
112
- success(`Switched to: ${selected.name}`);
113
- } catch (e) {
114
- if (e instanceof HisaaboApiError) {
115
- if (e.hisaaboError.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
116
- }
117
- fatalError(String(e instanceof Error ? e.message : e));
118
- }
119
- });
120
- }
@@ -1,225 +0,0 @@
1
- import { Command } from "commander";
2
-
3
- export function registerDashboardCommands(program: Command): void {
4
- const dash = program
5
- .command("dashboard")
6
- .alias("dash")
7
- .description("Business dashboard & analytics");
8
-
9
- // ── summary ──────────────────────────────────────────────────────────────
10
- dash
11
- .command("summary")
12
- .description("Financial summary overview (FY to date)")
13
- .option("--json", "JSON output")
14
- .action(async (opts) => {
15
- const { dashboardCommand } = await import("../../commands/dashboard/summary.js");
16
- await dashboardCommand({ json: opts.json });
17
- });
18
-
19
- // ── sales-trend ──────────────────────────────────────────────────────────
20
- dash
21
- .command("sales-trend")
22
- .description("Sales trend over time")
23
- .option("--months <n>", "Number of months to show", (v) => parseInt(v, 10))
24
- .option("--from <date>", "Start date (YYYY-MM-DD)")
25
- .option("--to <date>", "End date (YYYY-MM-DD)")
26
- .option("--granularity <g>", "daily | weekly | monthly")
27
- .option("--json", "JSON output")
28
- .option("--format <format>", "table | tsv | csv")
29
- .action(async (opts) => {
30
- const { dashboardSalesTrendCommand } = await import("../../commands/dashboard/sales-trend.js");
31
- await dashboardSalesTrendCommand(opts);
32
- });
33
-
34
- // ── top-outstanding ───────────────────────────────────────────────────────
35
- dash
36
- .command("top-outstanding")
37
- .description("Parties with highest outstanding balances")
38
- .option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10))
39
- .option("--json", "JSON output")
40
- .option("--format <format>", "table | tsv | csv")
41
- .action(async (opts) => {
42
- const { dashboardTopOutstandingCommand } = await import("../../commands/dashboard/top-outstanding.js");
43
- await dashboardTopOutstandingCommand(opts);
44
- });
45
-
46
- // ── top-customers ─────────────────────────────────────────────────────────
47
- dash
48
- .command("top-customers")
49
- .description("Top customers by revenue")
50
- .option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10))
51
- .option("--from <date>", "Start date (YYYY-MM-DD)")
52
- .option("--to <date>", "End date (YYYY-MM-DD)")
53
- .option("--this-month", "Filter to current calendar month")
54
- .option("--this-fy", "Filter to current financial year")
55
- .option("--json", "JSON output")
56
- .option("--format <format>", "table | tsv | csv")
57
- .action(async (opts) => {
58
- const { dashboardTopCustomersCommand } = await import("../../commands/dashboard/top-customers.js");
59
- await dashboardTopCustomersCommand({
60
- limit: opts.limit,
61
- from: opts.from,
62
- to: opts.to,
63
- thisMonth: opts.thisMonth,
64
- thisFy: opts.thisFy,
65
- json: opts.json,
66
- format: opts.format,
67
- });
68
- });
69
-
70
- // ── top-items ─────────────────────────────────────────────────────────────
71
- dash
72
- .command("top-items")
73
- .description("Top selling items by revenue and quantity")
74
- .option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10))
75
- .option("--type <type>", "Item type filter (product | service)")
76
- .option("--from <date>", "Start date (YYYY-MM-DD)")
77
- .option("--to <date>", "End date (YYYY-MM-DD)")
78
- .option("--this-month", "Filter to current calendar month")
79
- .option("--this-fy", "Filter to current financial year")
80
- .option("--json", "JSON output")
81
- .option("--format <format>", "table | tsv | csv")
82
- .action(async (opts) => {
83
- const { dashboardTopItemsCommand } = await import("../../commands/dashboard/top-items.js");
84
- await dashboardTopItemsCommand({
85
- limit: opts.limit,
86
- type: opts.type,
87
- from: opts.from,
88
- to: opts.to,
89
- thisMonth: opts.thisMonth,
90
- thisFy: opts.thisFy,
91
- json: opts.json,
92
- format: opts.format,
93
- });
94
- });
95
-
96
- // ── expenses (alias: expenses-by-category) ───────────────────────────────
97
- const expensesCmd = dash
98
- .command("expenses")
99
- .description("Expenses broken down by category")
100
- .option("--from <date>", "Start date (YYYY-MM-DD)")
101
- .option("--to <date>", "End date (YYYY-MM-DD)")
102
- .option("--this-month", "Filter to current calendar month")
103
- .option("--this-fy", "Filter to current financial year")
104
- .option("--json", "JSON output")
105
- .option("--format <format>", "table | tsv | csv")
106
- .action(async (opts) => {
107
- const { dashboardExpensesCommand } = await import("../../commands/dashboard/expenses.js");
108
- await dashboardExpensesCommand({
109
- from: opts.from,
110
- to: opts.to,
111
- thisMonth: opts.thisMonth,
112
- thisFy: opts.thisFy,
113
- json: opts.json,
114
- format: opts.format,
115
- });
116
- });
117
- expensesCmd.alias("expenses-by-category");
118
-
119
- // ── invoice-breakdown ─────────────────────────────────────────────────────
120
- dash
121
- .command("invoice-breakdown")
122
- .description("Invoice count and amounts by status")
123
- .option("--from <date>", "Start date (YYYY-MM-DD)")
124
- .option("--to <date>", "End date (YYYY-MM-DD)")
125
- .option("--this-month", "Filter to current calendar month")
126
- .option("--this-fy", "Filter to current financial year")
127
- .option("--json", "JSON output")
128
- .action(async (opts) => {
129
- const { dashboardInvoiceBreakdownCommand } = await import("../../commands/dashboard/invoice-breakdown.js");
130
- await dashboardInvoiceBreakdownCommand({
131
- from: opts.from,
132
- to: opts.to,
133
- thisMonth: opts.thisMonth,
134
- thisFy: opts.thisFy,
135
- json: opts.json,
136
- });
137
- });
138
-
139
- // ── profit-loss (alias: pl) ───────────────────────────────────────────────
140
- const plCmd = dash
141
- .command("profit-loss")
142
- .description("Profit & Loss statement")
143
- .option("--from <date>", "Start date (YYYY-MM-DD, default: FY start)")
144
- .option("--to <date>", "End date (YYYY-MM-DD, default: today)")
145
- .option("--this-month", "Scope to current calendar month")
146
- .option("--this-fy", "Scope to current financial year")
147
- .option("--json", "JSON output")
148
- .action(async (opts) => {
149
- const { dashboardProfitLossCommand } = await import("../../commands/dashboard/profit-loss.js");
150
- await dashboardProfitLossCommand({
151
- from: opts.from,
152
- to: opts.to,
153
- thisMonth: opts.thisMonth,
154
- thisFy: opts.thisFy,
155
- json: opts.json,
156
- });
157
- });
158
- plCmd.alias("pl");
159
-
160
- // ── receivables-aging ─────────────────────────────────────────────────────
161
- dash
162
- .command("receivables-aging")
163
- .description("Receivables aging buckets (current / 1-30 / 31-60 / 61-90 / 90+)")
164
- .option("--json", "JSON output")
165
- .option("--format <format>", "table | tsv | csv")
166
- .action(async (opts) => {
167
- const { dashboardReceivablesAgingCommand } = await import("../../commands/dashboard/receivables-aging.js");
168
- await dashboardReceivablesAgingCommand({ json: opts.json, format: opts.format });
169
- });
170
-
171
- // ── payment-modes ─────────────────────────────────────────────────────────
172
- dash
173
- .command("payment-modes")
174
- .description("Payment mode breakdown (cash / UPI / bank transfer / etc.)")
175
- .option("--from <date>", "Start date (YYYY-MM-DD)")
176
- .option("--to <date>", "End date (YYYY-MM-DD)")
177
- .option("--this-month", "Filter to current calendar month")
178
- .option("--this-fy", "Filter to current financial year")
179
- .option("--json", "JSON output")
180
- .option("--format <format>", "table | tsv | csv")
181
- .action(async (opts) => {
182
- const { dashboardPaymentModesCommand } = await import("../../commands/dashboard/payment-modes.js");
183
- await dashboardPaymentModesCommand({
184
- from: opts.from,
185
- to: opts.to,
186
- thisMonth: opts.thisMonth,
187
- thisFy: opts.thisFy,
188
- json: opts.json,
189
- format: opts.format,
190
- });
191
- });
192
-
193
- // ── collection-efficiency ─────────────────────────────────────────────────
194
- dash
195
- .command("collection-efficiency")
196
- .description("Collection rate, DSO, and aging breakdown")
197
- .option("--from <date>", "Start date (YYYY-MM-DD)")
198
- .option("--to <date>", "End date (YYYY-MM-DD)")
199
- .option("--this-month", "Filter to current calendar month")
200
- .option("--this-fy", "Filter to current financial year")
201
- .option("--json", "JSON output")
202
- .option("--format <format>", "table | tsv | csv")
203
- .action(async (opts) => {
204
- const { dashboardCollectionEfficiencyCommand } = await import("../../commands/dashboard/collection-efficiency.js");
205
- await dashboardCollectionEfficiencyCommand({
206
- from: opts.from,
207
- to: opts.to,
208
- thisMonth: opts.thisMonth,
209
- thisFy: opts.thisFy,
210
- json: opts.json,
211
- format: opts.format,
212
- });
213
- });
214
-
215
- // ── monthly-comparison ────────────────────────────────────────────────────
216
- dash
217
- .command("monthly-comparison")
218
- .description("Month-over-month comparison of sales, expenses, profit, and collections")
219
- .option("--json", "JSON output")
220
- .option("--format <format>", "table | tsv | csv")
221
- .action(async (opts) => {
222
- const { dashboardMonthlyComparisonCommand } = await import("../../commands/dashboard/monthly-comparison.js");
223
- await dashboardMonthlyComparisonCommand({ json: opts.json, format: opts.format });
224
- });
225
- }