@hisaabo/cli 0.7.5 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,184 +0,0 @@
1
- import { Command } from "commander";
2
- import type { DocTypeConfig } from "../../commands/document/factory.js";
3
-
4
- const DOC_TYPES: DocTypeConfig[] = [
5
- {
6
- cmd: "quotation",
7
- label: "Quotation",
8
- nsKey: "quotation",
9
- statuses: ["draft", "sent", "accepted", "rejected", "expired", "cancelled"],
10
- },
11
- {
12
- cmd: "credit-note",
13
- label: "Credit Note",
14
- nsKey: "creditNote",
15
- statuses: ["draft", "confirmed", "cancelled"],
16
- },
17
- {
18
- cmd: "debit-note",
19
- label: "Debit Note",
20
- nsKey: "debitNote",
21
- statuses: ["draft", "confirmed", "cancelled"],
22
- },
23
- {
24
- cmd: "delivery-challan",
25
- label: "Delivery Challan",
26
- nsKey: "deliveryChallan",
27
- statuses: ["draft", "dispatched", "delivered", "cancelled"],
28
- },
29
- {
30
- cmd: "proforma",
31
- label: "Proforma Invoice",
32
- nsKey: "proforma",
33
- statuses: ["draft", "sent", "accepted", "rejected", "expired", "converted", "cancelled"],
34
- },
35
- {
36
- cmd: "sales-return",
37
- label: "Sales Return",
38
- nsKey: "salesReturn",
39
- statuses: ["draft", "confirmed", "cancelled"],
40
- },
41
- {
42
- cmd: "purchase-return",
43
- label: "Purchase Return",
44
- nsKey: "purchaseReturn",
45
- statuses: ["draft", "confirmed", "cancelled"],
46
- },
47
- ];
48
-
49
- export function registerDocumentCommands(program: Command): void {
50
- for (const dt of DOC_TYPES) {
51
- const parent = program.command(dt.cmd).description(`${dt.label} management`);
52
-
53
- parent
54
- .command("list")
55
- .description(`List ${dt.label.toLowerCase()}s`)
56
- .option("--json", "JSON output")
57
- .option("--format <format>", "Output format: table, tsv, csv, ids")
58
- .option("--status <status>", `Filter by status: ${dt.statuses.join(", ")}`)
59
- .option("--party <search>", "Filter by party name")
60
- .option("--from <date>", "Start date (YYYY-MM-DD)")
61
- .option("--to <date>", "End date (YYYY-MM-DD)")
62
- .option("--this-month", "Current month")
63
- .option("--this-fy", "Current financial year")
64
- .option("--page <n>", "Page number", parseInt)
65
- .option("--limit <n>", "Items per page", parseInt)
66
- .action(async (opts) => {
67
- const { docListCommand } = await import("../../commands/document/factory.js");
68
- await docListCommand(dt, opts);
69
- });
70
-
71
- parent
72
- .command("get <id>")
73
- .description(`Get ${dt.label.toLowerCase()} details`)
74
- .option("--json", "JSON output")
75
- .action(async (id, opts) => {
76
- const { docGetCommand } = await import("../../commands/document/factory.js");
77
- await docGetCommand(dt, id, opts);
78
- });
79
-
80
- parent
81
- .command("create")
82
- .description(`Create a new ${dt.label.toLowerCase()}`)
83
- .option("--json", "JSON output")
84
- .option("--party-id <id>", "Party UUID")
85
- .option("--party <name>", "Party search name")
86
- .option("--date <date>", "Document date (YYYY-MM-DD)")
87
- .option("--due-date <date>", "Due date (YYYY-MM-DD)")
88
- .option("--item <desc>", "Item description (repeatable)", (v, a: string[]) => [...a, v], [] as string[])
89
- .option("--qty <n>", "Quantity per item (repeatable)", (v, a: string[]) => [...a, v], [] as string[])
90
- .option("--rate <n>", "Rate per item (repeatable)", (v, a: string[]) => [...a, v], [] as string[])
91
- .option("--notes <text>", "Notes")
92
- .option("--discount <pct>", "Discount percent")
93
- .option("-y, --yes", "Skip confirmation")
94
- .action(async (opts) => {
95
- const { docCreateCommand } = await import("../../commands/document/factory.js");
96
- await docCreateCommand(dt, opts);
97
- });
98
-
99
- parent
100
- .command("update-status <id> <status>")
101
- .description(`Update ${dt.label.toLowerCase()} status (${dt.statuses.join(", ")})`)
102
- .option("--json", "JSON output")
103
- .action(async (id, status, opts) => {
104
- const { docStatusCommand } = await import("../../commands/document/factory.js");
105
- await docStatusCommand(dt, id, status, opts);
106
- });
107
-
108
- parent
109
- .command("delete <id>")
110
- .description(`Delete a ${dt.label.toLowerCase()}`)
111
- .option("-y, --yes", "Skip confirmation")
112
- .option("--json", "JSON output")
113
- .action(async (id, opts) => {
114
- const { docDeleteCommand } = await import("../../commands/document/factory.js");
115
- await docDeleteCommand(dt, id, opts);
116
- });
117
- }
118
-
119
- // ── document convert ──────────────────────────────────────────────────────
120
-
121
- program
122
- .command("document")
123
- .description("Document conversion operations")
124
- .command("convert")
125
- .description("Convert one document type to another")
126
- .requiredOption("--from-type <type>", "Source type (quotation, proforma, delivery-challan, etc.)")
127
- .requiredOption("--from-id <id>", "Source document ID")
128
- .requiredOption("--to-type <type>", "Target type (invoice, credit-note, etc.)")
129
- .option("--json", "JSON output")
130
- .option("-y, --yes", "Skip confirmation")
131
- .action(async (opts) => {
132
- const { HisaaboClient, HisaaboApiError } = await import("../../client.js");
133
- const { requireAuth } = await import("../../config.js");
134
- const { fatalError, outputJSON, success, EXIT } = await import("../../output.js");
135
-
136
- const cfg = requireAuth();
137
- const client = new HisaaboClient(cfg);
138
-
139
- if (!opts.yes && process.stdin.isTTY) {
140
- const readline = await import("readline");
141
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
142
- const answer = await new Promise<string>((resolve) => {
143
- rl.question(
144
- ` Convert ${opts.fromType} ${opts.fromId} → ${opts.toType}? (y/N): `,
145
- resolve,
146
- );
147
- });
148
- rl.close();
149
- if (answer.trim().toLowerCase() !== "y") {
150
- console.log(" Cancelled.");
151
- process.exit(EXIT.SUCCESS);
152
- }
153
- }
154
-
155
- try {
156
- const result = await client.document.convert({
157
- fromType: opts.fromType,
158
- fromId: opts.fromId,
159
- toType: opts.toType,
160
- });
161
-
162
- if (opts.json) {
163
- outputJSON(result);
164
- return;
165
- }
166
-
167
- const newId = result.id ?? result.documentId ?? "(unknown)";
168
- const newNum = result.documentNumber ?? result.number ?? newId;
169
- success(`Converted: ${opts.fromType} → ${opts.toType} ${newNum}`);
170
- console.log(` New ID: ${newId}\n`);
171
-
172
- } catch (e) {
173
- if (e instanceof HisaaboApiError) {
174
- const err = e.hisaaboError;
175
- if (err.code === "not_found") fatalError(`Source document not found: ${opts.fromId}`, EXIT.NOT_FOUND);
176
- if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
177
- if (err.code === "forbidden") fatalError(err.message, EXIT.FORBIDDEN);
178
- if (err.code === "validation_failed") fatalError(e.message, EXIT.VALIDATION);
179
- if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
180
- }
181
- fatalError(String(e instanceof Error ? e.message : e));
182
- }
183
- });
184
- }
@@ -1,46 +0,0 @@
1
- import { Command } from "commander";
2
- import {
3
- eInvoiceDashboardCommand,
4
- eInvoiceGenerateCommand,
5
- eInvoiceCancelCommand,
6
- eInvoiceRetryCommand,
7
- } from "../../commands/einvoice/index.js";
8
-
9
- export function registerEInvoiceCommands(program: Command): void {
10
- const einvoice = program.command("einvoice").description("E-Invoice (IRP) management");
11
-
12
- einvoice
13
- .command("dashboard")
14
- .description("E-invoice generation summary")
15
- .option("--json", "JSON output")
16
- .option("--from <date>", "From date")
17
- .option("--to <date>", "To date")
18
- .action(async (opts) => {
19
- await eInvoiceDashboardCommand(opts);
20
- });
21
-
22
- einvoice
23
- .command("generate <invoiceId>")
24
- .description("Generate an e-invoice (get IRN from IRP)")
25
- .option("--json", "JSON output")
26
- .action(async (invoiceId: string, opts) => {
27
- await eInvoiceGenerateCommand(invoiceId, { json: opts.json });
28
- });
29
-
30
- einvoice
31
- .command("cancel <invoiceId>")
32
- .description("Cancel an e-invoice")
33
- .option("--json", "JSON output")
34
- .option("--reason <code>", "Cancel reason code (1-4)")
35
- .action(async (invoiceId: string, opts) => {
36
- await eInvoiceCancelCommand(invoiceId, { json: opts.json, reason: opts.reason });
37
- });
38
-
39
- einvoice
40
- .command("retry <invoiceId>")
41
- .description("Retry a failed e-invoice generation")
42
- .option("--json", "JSON output")
43
- .action(async (invoiceId: string, opts) => {
44
- await eInvoiceRetryCommand(invoiceId, { json: opts.json });
45
- });
46
- }
@@ -1,37 +0,0 @@
1
- import { Command } from "commander";
2
- import {
3
- ewbDashboardCommand,
4
- ewbGenerateCommand,
5
- ewbExpiringCommand,
6
- } from "../../commands/ewb/index.js";
7
-
8
- export function registerEwbCommands(program: Command): void {
9
- const ewb = program.command("ewb").description("E-Way Bill management");
10
-
11
- ewb
12
- .command("dashboard")
13
- .description("E-way bill summary dashboard")
14
- .option("--json", "JSON output")
15
- .option("--from <date>", "From date")
16
- .option("--to <date>", "To date")
17
- .action(async (opts) => {
18
- await ewbDashboardCommand(opts);
19
- });
20
-
21
- ewb
22
- .command("generate <invoiceId>")
23
- .description("Generate an e-way bill for an invoice")
24
- .option("--json", "JSON output")
25
- .action(async (invoiceId: string, opts) => {
26
- await ewbGenerateCommand(invoiceId, { json: opts.json });
27
- });
28
-
29
- ewb
30
- .command("expiring")
31
- .description("List e-way bills expiring soon")
32
- .option("--json", "JSON output")
33
- .option("--days <n>", "Within N days (default: 3)", parseInt)
34
- .action(async (opts) => {
35
- await ewbExpiringCommand({ json: opts.json, days: opts.days });
36
- });
37
- }
@@ -1,87 +0,0 @@
1
- import { Command } from "commander";
2
- import { expenseListCommand } from "../../commands/expense/list.js";
3
- import { expenseCreateCommand } from "../../commands/expense/create.js";
4
- import { expenseDeleteCommand } from "../../commands/expense/delete.js";
5
-
6
- export function registerExpenseCommands(program: Command): void {
7
- // ── expense ───────────────────────────────────────────────────────────────
8
-
9
- const expense = program.command("expense").description("Expense tracking");
10
-
11
- expense
12
- .command("list")
13
- .description("List expenses")
14
- .option("--json", "JSON output")
15
- .option("--format <format>", "Output format: table, tsv, csv, ids")
16
- .option("--category <cat>", "Filter by category")
17
- .option("--from <date>", "From date")
18
- .option("--to <date>", "To date")
19
- .option("--page <n>", "Page number", parseInt)
20
- .option("--limit <n>", "Items per page", parseInt)
21
- .action(async (opts) => {
22
- await expenseListCommand(opts);
23
- });
24
-
25
- expense
26
- .command("create")
27
- .description("Create a new expense")
28
- .option("--json", "JSON output")
29
- .option("--category <cat>", "Expense category")
30
- .option("--amount <amount>", "Amount")
31
- .option("--mode <mode>", "cash/bank/upi/cheque/other")
32
- .option("--description <text>", "Description")
33
- .option("--date <date>", "Expense date")
34
- .option("--reference <ref>", "Reference number")
35
- .action(async (opts) => {
36
- await expenseCreateCommand({
37
- json: opts.json,
38
- category: opts.category,
39
- amount: opts.amount,
40
- mode: opts.mode,
41
- description: opts.description,
42
- date: opts.date,
43
- reference: opts.reference,
44
- });
45
- });
46
-
47
- expense
48
- .command("delete <id>")
49
- .description("Delete an expense")
50
- .option("-y, --yes", "Skip confirmation")
51
- .option("--json", "JSON output")
52
- .action(async (id, opts) => {
53
- await expenseDeleteCommand(id, { yes: opts.yes, json: opts.json });
54
- });
55
-
56
- expense
57
- .command("update <id>")
58
- .description("Update an expense")
59
- .option("--amount <amount>", "New amount")
60
- .option("--category <cat>", "Expense category")
61
- .option("--date <YYYY-MM-DD>", "Expense date")
62
- .option("--description <text>", "Description")
63
- .option("--payment-mode <mode>", "Payment mode: cash, upi, bank, cheque, other")
64
- .option("--reference <ref>", "Reference number")
65
- .option("--json", "JSON output")
66
- .action(async (id, opts) => {
67
- const { expenseUpdateCommand } = await import("../../commands/expense/update.js");
68
- await expenseUpdateCommand(id, {
69
- json: opts.json,
70
- amount: opts.amount,
71
- category: opts.category,
72
- date: opts.date,
73
- description: opts.description,
74
- paymentMode: opts.paymentMode,
75
- reference: opts.reference,
76
- });
77
- });
78
-
79
- expense
80
- .command("categories")
81
- .description("List all expense categories")
82
- .option("--json", "JSON output")
83
- .action(async (opts) => {
84
- const { expenseCategoriesCommand } = await import("../../commands/expense/categories.js");
85
- await expenseCategoriesCommand({ json: opts.json });
86
- });
87
- }
@@ -1,57 +0,0 @@
1
- import { Command } from "commander";
2
- import { gstR1Command, gstR3bCommand, gstR1CsvCommand, gstR9Command, gstr2bUploadsCommand } from "../../commands/gst/index.js";
3
-
4
- export function registerGstCommands(program: Command): void {
5
- // ── gst ───────────────────────────────────────────────────────────────────
6
-
7
- const gst = program.command("gst").description("GST reports");
8
-
9
- gst
10
- .command("r1")
11
- .description("GSTR-1 report")
12
- .option("--json", "JSON output")
13
- .option("--quarter <q>", "Quarter: Q1, Q2, Q3, Q4")
14
- .option("--month <n>", "Month number (1-12)", parseInt)
15
- .option("--year <n>", "Year", parseInt)
16
- .action(async (opts) => {
17
- await gstR1Command({ json: opts.json, quarter: opts.quarter, month: opts.month, year: opts.year });
18
- });
19
-
20
- gst
21
- .command("r3b")
22
- .description("GSTR-3B report")
23
- .option("--json", "JSON output")
24
- .option("--quarter <q>", "Quarter: Q1, Q2, Q3, Q4")
25
- .option("--month <n>", "Month number (1-12)", parseInt)
26
- .option("--year <n>", "Year", parseInt)
27
- .action(async (opts) => {
28
- await gstR3bCommand({ json: opts.json, quarter: opts.quarter, month: opts.month, year: opts.year });
29
- });
30
-
31
- gst
32
- .command("r1-csv")
33
- .description("Download GSTR-1 as GSTN-compatible CSV")
34
- .option("--quarter <q>", "Quarter")
35
- .option("--month <n>", "Month", parseInt)
36
- .option("--year <n>", "Year", parseInt)
37
- .option("--output <path>", "Output file path")
38
- .action(async (opts) => {
39
- await gstR1CsvCommand({ quarter: opts.quarter, month: opts.month, year: opts.year, output: opts.output });
40
- });
41
-
42
- gst
43
- .command("gstr9 <fy>")
44
- .description("GSTR-9 annual return (e.g. 2023-24)")
45
- .option("--json", "JSON output")
46
- .action(async (fy: string, opts) => {
47
- await gstR9Command(fy, { json: opts.json });
48
- });
49
-
50
- gst
51
- .command("gstr2b-uploads")
52
- .description("List GSTR-2B uploaded periods")
53
- .option("--json", "JSON output")
54
- .action(async (opts) => {
55
- await gstr2bUploadsCommand({ json: opts.json });
56
- });
57
- }
@@ -1,49 +0,0 @@
1
- import { Command } from "commander";
2
- import {
3
- importPartiesCommand,
4
- importItemsCommand,
5
- importInvoicesCommand,
6
- importPaymentsCommand,
7
- } from "../../commands/import/index.js";
8
-
9
- export function registerImportCommands(program: Command): void {
10
- // ── import ────────────────────────────────────────────────────────────────
11
-
12
- const importCmd = program.command("import").description("Bulk import data");
13
-
14
- importCmd
15
- .command("parties <file>")
16
- .description("Import parties from JSON or CSV file")
17
- .option("--json", "JSON output")
18
- .option("--format <format>", "json or csv (auto-detected from extension)")
19
- .action(async (file, opts) => {
20
- await importPartiesCommand(file, { json: opts.json, format: opts.format });
21
- });
22
-
23
- importCmd
24
- .command("items <file>")
25
- .description("Import items from JSON or CSV file")
26
- .option("--json", "JSON output")
27
- .option("--format <format>", "json or csv (auto-detected from extension)")
28
- .action(async (file, opts) => {
29
- await importItemsCommand(file, { json: opts.json, format: opts.format });
30
- });
31
-
32
- importCmd
33
- .command("invoices <file>")
34
- .description("Import invoices from JSON or CSV file")
35
- .option("--json", "JSON output")
36
- .option("--format <format>", "json or csv (auto-detected from extension)")
37
- .action(async (file, opts) => {
38
- await importInvoicesCommand(file, { json: opts.json, format: opts.format });
39
- });
40
-
41
- importCmd
42
- .command("payments <file>")
43
- .description("Import payments from JSON or CSV file")
44
- .option("--json", "JSON output")
45
- .option("--format <format>", "json or csv (auto-detected from extension)")
46
- .action(async (file, opts) => {
47
- await importPaymentsCommand(file, { json: opts.json, format: opts.format });
48
- });
49
- }
@@ -1,117 +0,0 @@
1
- import { Command } from "commander";
2
- import { invoiceListCommand } from "../../commands/invoice/list.js";
3
- import { invoiceGetCommand } from "../../commands/invoice/get.js";
4
- import { invoiceCreateCommand } from "../../commands/invoice/create.js";
5
- import { invoiceStatusCommand } from "../../commands/invoice/status.js";
6
- import { invoicePdfCommand } from "../../commands/invoice/pdf.js";
7
- import { invoiceDeleteCommand } from "../../commands/invoice/delete.js";
8
-
9
- export function registerInvoiceCommands(program: Command): void {
10
- // ── invoice ───────────────────────────────────────────────────────────────
11
-
12
- const invoice = program.command("invoice").description("Invoice management");
13
-
14
- invoice
15
- .command("list")
16
- .description("List invoices")
17
- .option("--json", "JSON output")
18
- .option("--format <format>", "Output format: table, tsv, csv, ids")
19
- .option("--type <type>", "sale or purchase")
20
- .option("--status <status>", "Filter by status")
21
- .option("--party <name>", "Filter by party name")
22
- .option("--party-id <id>", "Filter by party ID")
23
- .option("--from <date>", "From date (YYYY-MM-DD)")
24
- .option("--to <date>", "To date (YYYY-MM-DD)")
25
- .option("--this-month", "Filter to current month")
26
- .option("--this-quarter", "Filter to current quarter")
27
- .option("--this-fy", "Filter to current financial year")
28
- .option("--page <n>", "Page number", parseInt)
29
- .option("--limit <n>", "Items per page", parseInt)
30
- .option("--search <q>", "Search invoices")
31
- .option("--sort-by <field>", "Sort field: date, amount, number")
32
- .option("--sort-dir <dir>", "Sort direction: asc, desc")
33
- .action(async (opts) => {
34
- await invoiceListCommand({
35
- json: opts.json,
36
- format: opts.format,
37
- type: opts.type,
38
- status: opts.status,
39
- party: opts.party,
40
- partyId: opts.partyId,
41
- from: opts.from,
42
- to: opts.to,
43
- thisMonth: opts.thisMonth,
44
- thisQuarter: opts.thisQuarter,
45
- thisFy: opts.thisFy,
46
- page: opts.page,
47
- limit: opts.limit,
48
- search: opts.search,
49
- sortBy: opts.sortBy,
50
- sortDir: opts.sortDir,
51
- });
52
- });
53
-
54
- invoice
55
- .command("get <id>")
56
- .description("Get invoice details")
57
- .option("--json", "JSON output")
58
- .action(async (id, opts) => {
59
- await invoiceGetCommand(id, { json: opts.json });
60
- });
61
-
62
- invoice
63
- .command("create")
64
- .description("Create a new invoice")
65
- .option("--json", "JSON output")
66
- .option("--party <name>", "Party name")
67
- .option("--party-id <id>", "Party UUID")
68
- .option("--type <type>", "sale or purchase")
69
- .option("--item <name>", "Item (repeatable)", (v, a: string[]) => [...a, v], [] as string[])
70
- .option("--qty <n>", "Quantity (per --item)", (v, a: string[]) => [...a, v], [] as string[])
71
- .option("--rate <n>", "Unit price (per --item)", (v, a: string[]) => [...a, v], [] as string[])
72
- .option("--delivery <method>", "Delivery method")
73
- .option("--notes <text>", "Invoice notes")
74
- .option("--terms <text>", "Terms and conditions")
75
- .option("-y, --yes", "Skip confirmation prompts")
76
- .action(async (opts) => {
77
- await invoiceCreateCommand({
78
- json: opts.json,
79
- party: opts.party,
80
- partyId: opts.partyId,
81
- type: opts.type,
82
- items: opts.item,
83
- qty: opts.qty,
84
- rate: opts.rate,
85
- delivery: opts.delivery,
86
- notes: opts.notes,
87
- terms: opts.terms,
88
- yes: opts.yes,
89
- });
90
- });
91
-
92
- invoice
93
- .command("status <id> <status>")
94
- .description("Update invoice status")
95
- .option("--json", "JSON output")
96
- .action(async (id, status, opts) => {
97
- await invoiceStatusCommand(id, status, { json: opts.json });
98
- });
99
-
100
- invoice
101
- .command("pdf <id>")
102
- .description("Download invoice as PDF")
103
- .option("--output <path>", "Output path or directory")
104
- .option("--open", "Open after download")
105
- .action(async (id, opts) => {
106
- await invoicePdfCommand(id, { output: opts.output, open: opts.open });
107
- });
108
-
109
- invoice
110
- .command("delete <id>")
111
- .description("Delete an invoice")
112
- .option("-y, --yes", "Skip confirmation")
113
- .option("--json", "JSON output")
114
- .action(async (id, opts) => {
115
- await invoiceDeleteCommand(id, { yes: opts.yes, json: opts.json });
116
- });
117
- }
@@ -1,56 +0,0 @@
1
- import { Command } from "commander";
2
- import {
3
- itcDashboardCommand,
4
- itcLedgerCommand,
5
- itcAgingCommand,
6
- itcBlockCommand,
7
- itcUnblockCommand,
8
- } from "../../commands/itc/index.js";
9
-
10
- export function registerItcCommands(program: Command): void {
11
- const itc = program.command("itc").description("Input Tax Credit tracking");
12
-
13
- itc
14
- .command("dashboard")
15
- .description("ITC summary dashboard")
16
- .option("--json", "JSON output")
17
- .option("--from <date>", "From date")
18
- .option("--to <date>", "To date")
19
- .action(async (opts) => {
20
- await itcDashboardCommand(opts);
21
- });
22
-
23
- itc
24
- .command("ledger")
25
- .description("ITC ledger — all eligible purchase credits")
26
- .option("--json", "JSON output")
27
- .option("--from <date>", "From date")
28
- .option("--to <date>", "To date")
29
- .action(async (opts) => {
30
- await itcLedgerCommand(opts);
31
- });
32
-
33
- itc
34
- .command("aging")
35
- .description("ITC aging alerts — credits at risk of reversal")
36
- .option("--json", "JSON output")
37
- .action(async (opts) => {
38
- await itcAgingCommand({ json: opts.json });
39
- });
40
-
41
- itc
42
- .command("block <invoiceId>")
43
- .description("Mark ITC for an invoice as blocked")
44
- .option("--json", "JSON output")
45
- .action(async (invoiceId: string, opts) => {
46
- await itcBlockCommand(invoiceId, { json: opts.json });
47
- });
48
-
49
- itc
50
- .command("unblock <invoiceId>")
51
- .description("Mark ITC for an invoice as eligible")
52
- .option("--json", "JSON output")
53
- .action(async (invoiceId: string, opts) => {
54
- await itcUnblockCommand(invoiceId, { json: opts.json });
55
- });
56
- }