@hisaabo/cli 0.1.0 → 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.
- package/.turbo/turbo-typecheck.log +1 -1
- package/README.md +332 -0
- package/dist/bin/audit-trail-5LOCJ7XZ.js +78 -0
- package/dist/bin/categories-64WWZTND.js +47 -0
- package/dist/bin/check-slug-FLHHUDYS.js +65 -0
- package/dist/bin/chunk-4MEL44QX.js +848 -0
- package/dist/bin/chunk-FIMJZAS4.js +84 -0
- package/dist/bin/chunk-NO4FIFMS.js +176 -0
- package/dist/bin/chunk-T63VQXNM.js +156 -0
- package/dist/bin/client-5NZ23GML.js +11 -0
- package/dist/bin/collection-efficiency-U56XNVEE.js +165 -0
- package/dist/bin/config-335MN4I7.js +18 -0
- package/dist/bin/create-RPDEORDD.js +83 -0
- package/dist/bin/default-account-AE6EXZZR.js +58 -0
- package/dist/bin/expenses-5N2QSG54.js +89 -0
- package/dist/bin/export-QICOQK34.js +59 -0
- package/dist/bin/factory-KOCW2AQM.js +483 -0
- package/dist/bin/get-A43QCI2S.js +66 -0
- package/dist/bin/get-GWH6S5SJ.js +71 -0
- package/dist/bin/hisaabo.js +2302 -1510
- package/dist/bin/invitations-P3EEN5WI.js +66 -0
- package/dist/bin/invite-T3CKX53E.js +53 -0
- package/dist/bin/invoice-breakdown-FN5BEFJD.js +97 -0
- package/dist/bin/items-2OOCQKVF.js +62 -0
- package/dist/bin/items-toggle-SKZWCGJH.js +46 -0
- package/dist/bin/list-A2RKI3ZG.js +79 -0
- package/dist/bin/list-NRMBMKMI.js +90 -0
- package/dist/bin/list-T74SN6IR.js +46 -0
- package/dist/bin/members-W2GW3ODT.js +55 -0
- package/dist/bin/monthly-comparison-T34ZFOHL.js +176 -0
- package/dist/bin/order-cancel-TI27JYYD.js +55 -0
- package/dist/bin/order-confirm-VMRAMNTD.js +53 -0
- package/dist/bin/order-get-C2RBUR4O.js +88 -0
- package/dist/bin/order-update-RE3HATNF.js +60 -0
- package/dist/bin/output-NUOL7KJW.js +35 -0
- package/dist/bin/payment-modes-WOOT22I7.js +126 -0
- package/dist/bin/profit-loss-T4RESJ32.js +135 -0
- package/dist/bin/receivables-aging-6XMENEWS.js +161 -0
- package/dist/bin/remove-6QZI4JCY.js +52 -0
- package/dist/bin/revoke-AVEMPAC7.js +40 -0
- package/dist/bin/revoke-YUCFZFNR.js +52 -0
- package/dist/bin/revoke-all-LFW5WBHO.js +33 -0
- package/dist/bin/revoke-invitation-DTGQRJR4.js +40 -0
- package/dist/bin/sales-trend-ZYBRUDUU.js +71 -0
- package/dist/bin/sequence-FPOJTI2P.js +66 -0
- package/dist/bin/store-IOB4Y67C.js +82 -0
- package/dist/bin/summary-5KYBA4ZO.js +113 -0
- package/dist/bin/top-customers-WSQ2UEJL.js +81 -0
- package/dist/bin/top-items-RWQPDGLN.js +84 -0
- package/dist/bin/top-outstanding-QAMO2E7Y.js +64 -0
- package/dist/bin/unpaid-invoices-WB3TK5B4.js +65 -0
- package/dist/bin/untracked-H733MYJL.js +67 -0
- package/dist/bin/update-H6LPO2Z4.js +61 -0
- package/dist/bin/update-JU2X3XU5.js +54 -0
- package/dist/bin/update-TLBUIC5J.js +57 -0
- package/dist/bin/update-role-QST7BVFX.js +45 -0
- package/dist/bin/update-settings-Q2EGRLKZ.js +56 -0
- package/package.json +7 -6
- package/src/auth.ts +12 -3
- package/src/bin/hisaabo.ts +49 -935
- package/src/bin/registrars/api-key.ts +44 -0
- package/src/bin/registrars/auth.ts +222 -0
- package/src/bin/registrars/automated-invoice.ts +167 -0
- package/src/bin/registrars/bank.ts +124 -0
- package/src/bin/registrars/business.ts +120 -0
- package/src/bin/registrars/dashboard.ts +225 -0
- package/src/bin/registrars/document.ts +184 -0
- package/src/bin/registrars/expense.ts +87 -0
- package/src/bin/registrars/gst.ts +41 -0
- package/src/bin/registrars/import.ts +49 -0
- package/src/bin/registrars/invoice.ts +117 -0
- package/src/bin/registrars/item.ts +112 -0
- package/src/bin/registrars/party.ts +81 -0
- package/src/bin/registrars/payment.ts +128 -0
- package/src/bin/registrars/report.ts +142 -0
- package/src/bin/registrars/session.ts +32 -0
- package/src/bin/registrars/shipment.ts +74 -0
- package/src/bin/registrars/store.ts +128 -0
- package/src/bin/registrars/target.ts +46 -0
- package/src/bin/registrars/tenant.ts +73 -0
- package/src/client.ts +589 -15
- package/src/commands/api-key/create.ts +72 -0
- package/src/commands/api-key/list.ts +71 -0
- package/src/commands/api-key/revoke.ts +46 -0
- package/src/commands/automated-invoice/create.ts +85 -0
- package/src/commands/automated-invoice/delete.ts +42 -0
- package/src/commands/automated-invoice/get.ts +113 -0
- package/src/commands/automated-invoice/history.ts +65 -0
- package/src/commands/automated-invoice/index.ts +11 -0
- package/src/commands/automated-invoice/list.ts +91 -0
- package/src/commands/automated-invoice/pause.ts +29 -0
- package/src/commands/automated-invoice/resume.ts +29 -0
- package/src/commands/automated-invoice/run-now.ts +29 -0
- package/src/commands/automated-invoice/suggestions.ts +68 -0
- package/src/commands/automated-invoice/update.ts +54 -0
- package/src/commands/automated-invoice/usage.ts +68 -0
- package/src/commands/bank/gateway-config.ts +61 -0
- package/src/commands/bank/update-gateway.ts +84 -0
- package/src/commands/business/audit-trail.ts +79 -0
- package/src/commands/business/export.ts +52 -0
- package/src/commands/business/get.ts +55 -0
- package/src/commands/business/sequence.ts +65 -0
- package/src/commands/business/update.ts +64 -0
- package/src/commands/dashboard/collection-efficiency.ts +164 -0
- package/src/commands/dashboard/expenses.ts +76 -0
- package/src/commands/dashboard/invoice-breakdown.ts +89 -0
- package/src/commands/dashboard/monthly-comparison.ts +193 -0
- package/src/commands/dashboard/payment-modes.ts +121 -0
- package/src/commands/dashboard/profit-loss.ts +146 -0
- package/src/commands/dashboard/receivables-aging.ts +169 -0
- package/src/commands/dashboard/sales-trend.ts +68 -0
- package/src/commands/dashboard/summary.ts +105 -0
- package/src/commands/dashboard/top-customers.ts +70 -0
- package/src/commands/dashboard/top-items.ts +74 -0
- package/src/commands/dashboard/top-outstanding.ts +61 -0
- package/src/commands/document/factory.ts +590 -0
- package/src/commands/expense/categories.ts +40 -0
- package/src/commands/expense/update.ts +58 -0
- package/src/commands/import/index.ts +68 -0
- package/src/commands/item/categories.ts +40 -0
- package/src/commands/item/low-stock-count.ts +32 -0
- package/src/commands/item/merge.ts +53 -0
- package/src/commands/item/price-history.ts +59 -0
- package/src/commands/item/rename-unit.ts +39 -0
- package/src/commands/item/sales-stats.ts +44 -0
- package/src/commands/item/stock-history.ts +70 -0
- package/src/commands/item/switch-base-unit.ts +42 -0
- package/src/commands/item/update.ts +59 -0
- package/src/commands/item/variants-create.ts +58 -0
- package/src/commands/item/variants-delete.ts +47 -0
- package/src/commands/item/variants-list.ts +63 -0
- package/src/commands/item/variants-update.ts +61 -0
- package/src/commands/party/ledger-report.ts +81 -0
- package/src/commands/party/merge.ts +50 -0
- package/src/commands/party/stats.ts +40 -0
- package/src/commands/party/top-items.ts +57 -0
- package/src/commands/party/update.ts +65 -0
- package/src/commands/payment/default-account.ts +56 -0
- package/src/commands/payment/get.ts +59 -0
- package/src/commands/payment/unpaid-invoices.ts +69 -0
- package/src/commands/payment/untracked.ts +70 -0
- package/src/commands/payment/update.ts +54 -0
- package/src/commands/report/index.ts +348 -1
- package/src/commands/session/list.ts +91 -0
- package/src/commands/session/revoke-all.ts +20 -0
- package/src/commands/session/revoke.ts +32 -0
- package/src/commands/store/check-slug.ts +48 -0
- package/src/commands/store/items-toggle.ts +41 -0
- package/src/commands/store/items.ts +61 -0
- package/src/commands/store/order-cancel.ts +48 -0
- package/src/commands/store/order-confirm.ts +45 -0
- package/src/commands/store/order-get.ts +66 -0
- package/src/commands/store/order-update.ts +52 -0
- package/src/commands/store/update-settings.ts +52 -0
- package/src/commands/tenant/invitations.ts +62 -0
- package/src/commands/tenant/invite.ts +57 -0
- package/src/commands/tenant/list.ts +46 -0
- package/src/commands/tenant/members.ts +55 -0
- package/src/commands/tenant/remove.ts +47 -0
- package/src/commands/tenant/revoke-invitation.ts +32 -0
- package/src/commands/tenant/update-role.ts +41 -0
- package/src/config.ts +51 -2
- package/src/error-handler.ts +53 -0
- package/src/output.ts +1 -0
- package/src/spinner.ts +39 -0
- package/tsup.config.ts +6 -1
- package/src/components/ErrorDisplay.tsx +0 -16
- package/src/components/Header.tsx +0 -26
- package/src/components/MoneyCell.tsx +0 -16
- package/src/components/Spinner.tsx +0 -12
- package/src/components/StatusBadge.tsx +0 -39
- package/src/components/Table.tsx +0 -63
package/README.md
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
# @hisaabo/cli
|
|
2
|
+
|
|
3
|
+
Terminal-first invoicing and business management for Indian businesses. Manage invoices, parties, items, payments, expenses, GST reports, and more -- all from the command line.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@hisaabo/cli)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
[](https://github.com/hisaabo/hisaabo/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
**What this does:** Run `hisaabo invoice list --this-month` and get a formatted table of every invoice your business issued this month. Run `hisaabo gst r3b --quarter Q4` and get your GSTR-3B numbers ready for filing. Pipe any command to `jq` or a spreadsheet with `--json`, `--format csv`, or `--format tsv`.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @hisaabo/cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Log in interactively:**
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
hisaabo login --api-url https://your-hisaabo-instance.com
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
You'll be prompted for email and password, then asked to pick a business if you have more than one.
|
|
26
|
+
|
|
27
|
+
**Log in with an API key (for scripts and CI):**
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
hisaabo login --api-url https://your-hisaabo-instance.com --token hisaabo_key_abc123...
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Generate API keys at Settings > API Keys in the Hisaabo web app.
|
|
34
|
+
|
|
35
|
+
**Verify your session:**
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
hisaabo whoami
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Command Reference
|
|
44
|
+
|
|
45
|
+
### Auth and Session
|
|
46
|
+
|
|
47
|
+
| Command | Description |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `hisaabo login` | Authenticate with email/password or API key |
|
|
50
|
+
| `hisaabo logout` | Clear saved credentials |
|
|
51
|
+
| `hisaabo whoami` | Show current user and active business |
|
|
52
|
+
| `hisaabo switch` | Switch active business |
|
|
53
|
+
|
|
54
|
+
### Business
|
|
55
|
+
|
|
56
|
+
| Command | Description |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `hisaabo business list` | List all businesses under your account |
|
|
59
|
+
| `hisaabo business switch` | Switch active business |
|
|
60
|
+
|
|
61
|
+
### Dashboard
|
|
62
|
+
|
|
63
|
+
| Command | Description |
|
|
64
|
+
|---|---|
|
|
65
|
+
| `hisaabo dashboard` | Financial summary with box-drawing UI (alias: `dash`) |
|
|
66
|
+
|
|
67
|
+
### Invoices
|
|
68
|
+
|
|
69
|
+
| Command | Description |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `invoice list` | List invoices (filterable by status, party, date range, type) |
|
|
72
|
+
| `invoice get <id>` | Get full invoice details with line items |
|
|
73
|
+
| `invoice create` | Create a new invoice (interactive or with flags) |
|
|
74
|
+
| `invoice status <id> <status>` | Update status (draft, sent, paid, cancelled) |
|
|
75
|
+
| `invoice pdf <id>` | Download invoice as PDF |
|
|
76
|
+
| `invoice delete <id>` | Delete an invoice |
|
|
77
|
+
|
|
78
|
+
### Parties (Customers and Suppliers)
|
|
79
|
+
|
|
80
|
+
| Command | Description |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `party list` | List parties (filterable by type, category, search) |
|
|
83
|
+
| `party get <id>` | Get party profile with balance |
|
|
84
|
+
| `party create` | Add a new customer or supplier |
|
|
85
|
+
| `party ledger <id>` | Debit/credit history for a party |
|
|
86
|
+
| `party delete <id>` | Delete a party |
|
|
87
|
+
|
|
88
|
+
### Items
|
|
89
|
+
|
|
90
|
+
| Command | Description |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `item list` | List items (filter by category, type, low stock) |
|
|
93
|
+
| `item get <id>` | Get item details with stock and pricing |
|
|
94
|
+
| `item create` | Add a new product or service |
|
|
95
|
+
| `item stock <id> <adjustment>` | Adjust stock (+10, -5, or set to 100) |
|
|
96
|
+
| `item delete <id>` | Delete an item |
|
|
97
|
+
|
|
98
|
+
### Payments
|
|
99
|
+
|
|
100
|
+
| Command | Description |
|
|
101
|
+
|---|---|
|
|
102
|
+
| `payment list` | List payments (filterable by party, date range) |
|
|
103
|
+
| `payment create` | Record a payment (cash, bank, UPI, cheque) |
|
|
104
|
+
| `payment delete <id>` | Delete a payment |
|
|
105
|
+
|
|
106
|
+
### Expenses
|
|
107
|
+
|
|
108
|
+
| Command | Description |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `expense list` | List expenses (filterable by category, date range) |
|
|
111
|
+
| `expense create` | Record a business expense |
|
|
112
|
+
| `expense delete <id>` | Delete an expense |
|
|
113
|
+
|
|
114
|
+
### Bank Accounts
|
|
115
|
+
|
|
116
|
+
| Command | Description |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `bank list` | List accounts with balances |
|
|
119
|
+
| `bank get <id>` | Get account details |
|
|
120
|
+
| `bank create` | Add a new bank account |
|
|
121
|
+
| `bank transfer` | Transfer between accounts |
|
|
122
|
+
| `bank transactions <id>` | List transactions for an account |
|
|
123
|
+
|
|
124
|
+
### GST
|
|
125
|
+
|
|
126
|
+
| Command | Description |
|
|
127
|
+
|---|---|
|
|
128
|
+
| `gst r1` | GSTR-1 report (by quarter or month) |
|
|
129
|
+
| `gst r3b` | GSTR-3B report (by quarter or month) |
|
|
130
|
+
| `gst r1-csv` | Download GSTR-1 as GSTN-compatible CSV for filing |
|
|
131
|
+
|
|
132
|
+
### Reports
|
|
133
|
+
|
|
134
|
+
| Command | Description |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `report daybook` | Day book -- all transactions for a period |
|
|
137
|
+
| `report outstanding` | Outstanding receivables and payables |
|
|
138
|
+
| `report tax-summary` | Tax collected and paid, grouped by rate |
|
|
139
|
+
| `report item-sales` | Item-wise sales breakdown |
|
|
140
|
+
| `report stock` | Current stock summary |
|
|
141
|
+
|
|
142
|
+
### Shipments
|
|
143
|
+
|
|
144
|
+
| Command | Description |
|
|
145
|
+
|---|---|
|
|
146
|
+
| `shipment list` | List shipments (filterable by status, invoice) |
|
|
147
|
+
| `shipment get <id>` | Get shipment details |
|
|
148
|
+
| `shipment create` | Create a shipment linked to an invoice |
|
|
149
|
+
| `shipment update <id>` | Update status or tracking info |
|
|
150
|
+
|
|
151
|
+
### Targets
|
|
152
|
+
|
|
153
|
+
| Command | Description |
|
|
154
|
+
|---|---|
|
|
155
|
+
| `target list` | List sales targets |
|
|
156
|
+
| `target my` | Show your target progress |
|
|
157
|
+
| `target create` | Set a new sales target (daily, weekly, monthly, quarterly) |
|
|
158
|
+
|
|
159
|
+
### Recurring Invoices
|
|
160
|
+
|
|
161
|
+
| Command | Description |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `automated-invoice list` | List recurring invoice templates |
|
|
164
|
+
| `automated-invoice get <id>` | Get template details |
|
|
165
|
+
| `automated-invoice create` | Create a new recurring template |
|
|
166
|
+
| `automated-invoice pause <id>` | Pause an active template |
|
|
167
|
+
| `automated-invoice resume <id>` | Resume a paused template |
|
|
168
|
+
| `automated-invoice run-now <id>` | Manually trigger invoice generation |
|
|
169
|
+
| `automated-invoice delete <id>` | Delete a template |
|
|
170
|
+
|
|
171
|
+
### Store
|
|
172
|
+
|
|
173
|
+
| Command | Description |
|
|
174
|
+
|---|---|
|
|
175
|
+
| `store settings` | Show online store settings |
|
|
176
|
+
| `store orders` | List store orders |
|
|
177
|
+
|
|
178
|
+
### Import
|
|
179
|
+
|
|
180
|
+
| Command | Description |
|
|
181
|
+
|---|---|
|
|
182
|
+
| `import parties <file>` | Bulk import parties from JSON or CSV |
|
|
183
|
+
| `import items <file>` | Bulk import items from JSON or CSV |
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Terminal Examples
|
|
188
|
+
|
|
189
|
+
**List this month's sale invoices:**
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
$ hisaabo invoice list --type sale --this-month
|
|
193
|
+
|
|
194
|
+
──────────────────────────────────────────────────────────────────────
|
|
195
|
+
# Party Amount Status Date
|
|
196
|
+
──────────────────────────────────────────────────────────────────────
|
|
197
|
+
BB-15042 Sharma Fabrics 9,450.00 [PAID] Today
|
|
198
|
+
BB-15041 Gupta Enterprises 1,24,800.00 [SENT] Yesterday
|
|
199
|
+
BB-15040 Mehta Traders 47,200.00 [DRAFT] 3d ago
|
|
200
|
+
BB-15039 Vinod & Sons 18,000.00 [OVERDUE] 12d ago
|
|
201
|
+
──────────────────────────────────────────────────────────────────────
|
|
202
|
+
|
|
203
|
+
Showing 1-4 of 4
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Check a party's outstanding balance:**
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
$ hisaabo party get f3a1...
|
|
210
|
+
|
|
211
|
+
Gupta Enterprises (customer)
|
|
212
|
+
────────────────────────────────────────
|
|
213
|
+
Phone: +91 98765 43210
|
|
214
|
+
GSTIN: 27AABCG1234A1Z5
|
|
215
|
+
City: Mumbai
|
|
216
|
+
Balance: 1,24,800.00 receivable
|
|
217
|
+
Invoices: 14 (3 unpaid)
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Pull GSTR-3B numbers for Q4 and pipe to a file:**
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
$ hisaabo gst r3b --quarter Q4 --json | jq '.taxPayable'
|
|
224
|
+
{
|
|
225
|
+
"igst": "0.00",
|
|
226
|
+
"cgst": "18420.00",
|
|
227
|
+
"sgst": "18420.00",
|
|
228
|
+
"cess": "0.00"
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Output Formats and Scripting
|
|
235
|
+
|
|
236
|
+
Every `list` command supports multiple output formats:
|
|
237
|
+
|
|
238
|
+
| Flag | Format | Use case |
|
|
239
|
+
|---|---|---|
|
|
240
|
+
| *(default)* | Colored table | Human reading in a terminal |
|
|
241
|
+
| `--json` | Pretty-printed JSON | Piping to `jq`, scripts, CI |
|
|
242
|
+
| `--format tsv` | Tab-separated values | Pasting into spreadsheets |
|
|
243
|
+
| `--format csv` | Comma-separated values | Import into Excel, Google Sheets |
|
|
244
|
+
| `--format ids` | One ID per line | Piping into `xargs` |
|
|
245
|
+
|
|
246
|
+
**Pipe invoice IDs into a loop:**
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
hisaabo invoice list --status draft --format ids | xargs -I{} hisaabo invoice status {} sent
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Export all parties to CSV:**
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
hisaabo party list --format csv > parties.csv
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Environment variables:**
|
|
259
|
+
|
|
260
|
+
- `NO_COLOR=1` -- disable colored output (also respects `FORCE_COLOR=0`)
|
|
261
|
+
- Terminal width is detected automatically. Tables adapt to narrow (<80), standard (80-120), and wide (>120) terminals.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Common Flags
|
|
266
|
+
|
|
267
|
+
Most commands accept these flags:
|
|
268
|
+
|
|
269
|
+
| Flag | Description |
|
|
270
|
+
|---|---|
|
|
271
|
+
| `--json` | Output as JSON instead of a table |
|
|
272
|
+
| `--format <fmt>` | Output format: `table`, `tsv`, `csv`, `ids` |
|
|
273
|
+
| `--page <n>` | Page number for paginated results |
|
|
274
|
+
| `--limit <n>` | Items per page |
|
|
275
|
+
| `--from <date>` | Start date filter (YYYY-MM-DD) |
|
|
276
|
+
| `--to <date>` | End date filter (YYYY-MM-DD) |
|
|
277
|
+
| `--this-month` | Filter to current calendar month |
|
|
278
|
+
| `--this-fy` | Filter to current financial year (April-March) |
|
|
279
|
+
| `-y, --yes` | Skip confirmation prompts |
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Multi-Business Support
|
|
284
|
+
|
|
285
|
+
If you manage multiple businesses under one account, list and switch between them from the CLI:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# List all businesses on your account
|
|
289
|
+
hisaabo business list
|
|
290
|
+
|
|
291
|
+
# Switch the active business (interactive picker)
|
|
292
|
+
hisaabo switch
|
|
293
|
+
|
|
294
|
+
# Or switch via the business subcommand
|
|
295
|
+
hisaabo business switch
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
All subsequent commands operate on the active business. The `dashboard`, `invoice`, `party`, and every other command scopes data to whichever business is currently selected. Switching resets all cached data so you always see numbers for the correct business.
|
|
299
|
+
|
|
300
|
+
**Web and mobile UI:** Business switching is also available without the CLI. In the web app, tap the business name in the sidebar to open a popover listing all your businesses plus a "Create New Business" option. On mobile, tap the business name on the home dashboard to open a bottom sheet with the same options.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Development
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# From the monorepo root
|
|
308
|
+
pnpm install
|
|
309
|
+
|
|
310
|
+
# Run the CLI in dev mode (no build step needed)
|
|
311
|
+
pnpm --filter @hisaabo/cli dev -- invoice list
|
|
312
|
+
|
|
313
|
+
# Build
|
|
314
|
+
pnpm --filter @hisaabo/cli build
|
|
315
|
+
|
|
316
|
+
# Type-check
|
|
317
|
+
pnpm --filter @hisaabo/cli typecheck
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
For local development, point at your local API:
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
hisaabo login --api-url http://localhost:3000
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
The CLI stores credentials in the OS config directory (`~/.config/hisaabo-cli` on Linux, `~/Library/Preferences/hisaabo-cli` on macOS).
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Full Documentation
|
|
331
|
+
|
|
332
|
+
[docs.hisaabo.in/ai/cli/](https://docs.hisaabo.in/ai/cli/) -- Setup guide, full command reference with all flags, scripting recipes, and CI/CD integration examples.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
formatDate
|
|
4
|
+
} from "./chunk-T63VQXNM.js";
|
|
5
|
+
import {
|
|
6
|
+
HisaaboApiError,
|
|
7
|
+
HisaaboClient
|
|
8
|
+
} from "./chunk-4MEL44QX.js";
|
|
9
|
+
import {
|
|
10
|
+
requireAuth
|
|
11
|
+
} from "./chunk-FIMJZAS4.js";
|
|
12
|
+
import {
|
|
13
|
+
EXIT,
|
|
14
|
+
fatalError,
|
|
15
|
+
hasColor,
|
|
16
|
+
outputCSV,
|
|
17
|
+
outputJSON,
|
|
18
|
+
outputTSV,
|
|
19
|
+
outputTable,
|
|
20
|
+
paginationFooter
|
|
21
|
+
} from "./chunk-NO4FIFMS.js";
|
|
22
|
+
|
|
23
|
+
// src/commands/business/audit-trail.ts
|
|
24
|
+
import chalk from "chalk";
|
|
25
|
+
async function businessAuditTrailCommand(opts) {
|
|
26
|
+
const cfg = requireAuth();
|
|
27
|
+
const client = new HisaaboClient(cfg);
|
|
28
|
+
const page = opts.page ? parseInt(opts.page, 10) : 1;
|
|
29
|
+
const limit = opts.limit ? parseInt(opts.limit, 10) : 25;
|
|
30
|
+
if (isNaN(page) || page < 1) fatalError("--page must be a positive integer.", EXIT.USAGE);
|
|
31
|
+
if (isNaN(limit) || limit < 1 || limit > 100) fatalError("--limit must be between 1 and 100.", EXIT.USAGE);
|
|
32
|
+
try {
|
|
33
|
+
const data = await client.business.auditTrail({ page, limit });
|
|
34
|
+
if (opts.json) {
|
|
35
|
+
outputJSON(data);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const items = Array.isArray(data) ? data : Array.isArray(data?.items) ? data.items : Array.isArray(data?.data) ? data.data : [];
|
|
39
|
+
const total = typeof data?.total === "number" ? data.total : items.length;
|
|
40
|
+
const rows = items.map((item) => {
|
|
41
|
+
const r = item;
|
|
42
|
+
return {
|
|
43
|
+
timestamp: formatDate(String(r["createdAt"] ?? r["timestamp"] ?? "")),
|
|
44
|
+
user: String(r["userName"] ?? r["user"] ?? r["userEmail"] ?? "-"),
|
|
45
|
+
action: String(r["action"] ?? r["event"] ?? "-"),
|
|
46
|
+
details: String(r["details"] ?? r["description"] ?? r["meta"] ?? "-")
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
const columns = [
|
|
50
|
+
{ key: "timestamp", header: "Date", align: "left" },
|
|
51
|
+
{ key: "user", header: "User", align: "left", width: 28 },
|
|
52
|
+
{ key: "action", header: "Action", align: "left", width: 24 },
|
|
53
|
+
{ key: "details", header: "Details", align: "left", width: 40 }
|
|
54
|
+
];
|
|
55
|
+
if (opts.format === "tsv") {
|
|
56
|
+
outputTSV(rows, columns);
|
|
57
|
+
} else if (opts.format === "csv") {
|
|
58
|
+
outputCSV(rows, columns);
|
|
59
|
+
} else {
|
|
60
|
+
if (hasColor()) process.stdout.write("\n" + chalk.bold(" Audit Trail\n") + "\n");
|
|
61
|
+
else process.stdout.write("\n Audit Trail\n\n");
|
|
62
|
+
outputTable(rows, columns);
|
|
63
|
+
if (total > limit) paginationFooter(page, limit, total);
|
|
64
|
+
process.stdout.write("\n");
|
|
65
|
+
}
|
|
66
|
+
} catch (e) {
|
|
67
|
+
if (e instanceof HisaaboApiError) {
|
|
68
|
+
const err = e.hisaaboError;
|
|
69
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
70
|
+
if (err.code === "forbidden") fatalError(err.message, EXIT.FORBIDDEN);
|
|
71
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
72
|
+
}
|
|
73
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
businessAuditTrailCommand
|
|
78
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
HisaaboApiError,
|
|
4
|
+
HisaaboClient
|
|
5
|
+
} from "./chunk-4MEL44QX.js";
|
|
6
|
+
import {
|
|
7
|
+
requireAuth
|
|
8
|
+
} from "./chunk-FIMJZAS4.js";
|
|
9
|
+
import {
|
|
10
|
+
EXIT,
|
|
11
|
+
fatalError,
|
|
12
|
+
outputJSON
|
|
13
|
+
} from "./chunk-NO4FIFMS.js";
|
|
14
|
+
|
|
15
|
+
// src/commands/expense/categories.ts
|
|
16
|
+
async function expenseCategoriesCommand(opts) {
|
|
17
|
+
const cfg = requireAuth();
|
|
18
|
+
const client = new HisaaboClient(cfg);
|
|
19
|
+
try {
|
|
20
|
+
const categories = await client.expense.categories();
|
|
21
|
+
if (opts.json) {
|
|
22
|
+
outputJSON(categories);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!categories || categories.length === 0) {
|
|
26
|
+
console.log("\n No expense categories found.\n");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
console.log(`
|
|
30
|
+
Expense Categories (${categories.length})
|
|
31
|
+
`);
|
|
32
|
+
for (const cat of categories) {
|
|
33
|
+
console.log(` ${cat}`);
|
|
34
|
+
}
|
|
35
|
+
console.log();
|
|
36
|
+
} catch (e) {
|
|
37
|
+
if (e instanceof HisaaboApiError) {
|
|
38
|
+
const err = e.hisaaboError;
|
|
39
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
40
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
41
|
+
}
|
|
42
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
expenseCategoriesCommand
|
|
47
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
HisaaboApiError,
|
|
4
|
+
HisaaboClient
|
|
5
|
+
} from "./chunk-4MEL44QX.js";
|
|
6
|
+
import {
|
|
7
|
+
requireAuth
|
|
8
|
+
} from "./chunk-FIMJZAS4.js";
|
|
9
|
+
import {
|
|
10
|
+
EXIT,
|
|
11
|
+
fatalError,
|
|
12
|
+
hasColor,
|
|
13
|
+
outputJSON
|
|
14
|
+
} from "./chunk-NO4FIFMS.js";
|
|
15
|
+
|
|
16
|
+
// src/commands/store/check-slug.ts
|
|
17
|
+
import chalk from "chalk";
|
|
18
|
+
async function storeCheckSlugCommand(slug, opts) {
|
|
19
|
+
const cfg = requireAuth();
|
|
20
|
+
const client = new HisaaboClient(cfg);
|
|
21
|
+
try {
|
|
22
|
+
const result = await client.store.checkSlug({ slug });
|
|
23
|
+
if (opts.json) {
|
|
24
|
+
outputJSON(result);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const available = typeof result === "object" && result !== null ? result["available"] : result;
|
|
28
|
+
if (available) {
|
|
29
|
+
if (hasColor()) {
|
|
30
|
+
process.stdout.write(chalk.green(`
|
|
31
|
+
\u2713 "${slug}" is available
|
|
32
|
+
|
|
33
|
+
`));
|
|
34
|
+
} else {
|
|
35
|
+
process.stdout.write(`
|
|
36
|
+
OK: "${slug}" is available
|
|
37
|
+
|
|
38
|
+
`);
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
if (hasColor()) {
|
|
42
|
+
process.stdout.write(chalk.red(`
|
|
43
|
+
\u2717 "${slug}" is already taken
|
|
44
|
+
|
|
45
|
+
`));
|
|
46
|
+
} else {
|
|
47
|
+
process.stdout.write(`
|
|
48
|
+
TAKEN: "${slug}" is already taken
|
|
49
|
+
|
|
50
|
+
`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} catch (e) {
|
|
54
|
+
if (e instanceof HisaaboApiError) {
|
|
55
|
+
const err = e.hisaaboError;
|
|
56
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
57
|
+
if (err.code === "validation_failed") fatalError(e.message, EXIT.VALIDATION);
|
|
58
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
59
|
+
}
|
|
60
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
storeCheckSlugCommand
|
|
65
|
+
};
|