jaz-clio 5.47.4 → 5.47.5

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-api
3
- version: 5.47.4
3
+ version: 5.47.5
4
4
  description: >-
5
5
  Use this skill whenever you call, debug, or review code that touches the Jaz
6
6
  REST API. Covers field names, response shapes, 159 production gotchas, error
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-cli
3
- version: 5.47.4
3
+ version: 5.47.5
4
4
  description: >-
5
5
  Use this skill when running Clio CLI commands, building shell scripts with
6
6
  Clio, debugging auth issues, understanding --json output, paginating results,
@@ -267,7 +267,7 @@ Sending `lineItems[]` to the FLAT endpoint silently ignores them and creates a $
267
267
 
268
268
  **Reports & Exports**: `reports` (16 report types), `exports`
269
269
 
270
- **AI & Automation**: `magic` (create, status, search, split), `quick-fix`, `capsules`, `capsule-transaction` (alias: `ct`, 13 recipe types)
270
+ **AI & Automation**: `magic` (create, status), `quick-fix`, `capsules`, `capsule-transaction` (alias: `ct`, 13 recipe types)
271
271
 
272
272
  **Judgment journal**: `jots` (create, recall, dispose). Every write command also takes `--jot "<one line>"` to log the judgment behind that specific write inline, no extra call (see `--jot` in Common Flags).
273
273
 
@@ -11,13 +11,13 @@ Complete reference for all 66 command groups. Organized by domain.
11
11
  |------------|-----------|
12
12
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
13
13
  | `get <id>` | `--json` |
14
- | `search` | `--ref`, `--contact`, `--status`, `--from`, `--to`, `--tag`, `--sort`, `--order` |
15
- | `create` | `--contact`, `--date`, `--due`, `--ref`, `--currency`, `--rate`, `--lines`, `--tax-profile`, `--finalize`, `--input` |
16
- | `update <id>` | `--contact`, `--date`, `--due`, `--ref`, `--lines`, `--input` |
14
+ | `search` | `--reference`, `--contact-name`, `--status`, `--from`, `--to`, `--tag`, `--sort`, `--order` |
15
+ | `create` | `--contact`, `--date`, `--due`, `--ref`, `--currency`, `--exchange-rate`, `--lines`, `--finalize`, `--input` |
16
+ | `update <id>` | `--date`, `--due`, `--ref`, `--lines`, `--input` |
17
17
  | `delete <id>` | |
18
- | `pay <id>` | `--amount`, `--tx-amount`, `--account`, `--method`, `--ref`, `--date` |
18
+ | `pay <id>` | `--amount`, `--transaction-amount`, `--account`, `--method`, `--ref`, `--date` |
19
19
  | `apply-credits <id>` | `--credit-note`, `--amount` |
20
- | `download <id>` | `--output` (PDF download) |
20
+ | `download <id>` | `--json` — returns the PDF URL; writes no file |
21
21
  | `draft list` | `--max-rows N`, `--ids`, `--json` — ⚠️ fans out 1 attachment lookup per draft (5 in flight); pass `--max-rows 10` for spot checks |
22
22
  | `draft finalize <id>` | `--account`, `--input` |
23
23
  | `bulk-upsert` | `--input <file>`, `--json` — **FLAT** shape (one line per row via `itemDescription`+`totalAmount`+`invoiceAccountResourceId`). Async → jobId. `currencyCode` REQUIRED |
@@ -28,11 +28,11 @@ Complete reference for all 66 command groups. Organized by domain.
28
28
  |------------|-----------|
29
29
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
30
30
  | `get <id>` | `--json` |
31
- | `search` | `--ref`, `--contact`, `--status`, `--from`, `--to`, `--tag`, `--sort`, `--order` |
32
- | `create` | `--contact`, `--date`, `--due`, `--ref`, `--currency`, `--rate`, `--lines`, `--tax-profile`, `--finalize`, `--input` |
33
- | `update <id>` | `--contact`, `--date`, `--due`, `--ref`, `--lines`, `--input` |
31
+ | `search` | `--reference`, `--contact-name`, `--status`, `--from`, `--to`, `--tag`, `--sort`, `--order` |
32
+ | `create` | `--contact`, `--date`, `--due`, `--ref`, `--currency`, `--exchange-rate`, `--lines`, `--finalize`, `--input` |
33
+ | `update <id>` | `--date`, `--due`, `--ref`, `--lines`, `--input` |
34
34
  | `delete <id>` | |
35
- | `pay <id>` | `--amount`, `--tx-amount`, `--account`, `--method`, `--ref`, `--date` |
35
+ | `pay <id>` | `--amount`, `--transaction-amount`, `--account`, `--method`, `--ref`, `--date` |
36
36
  | `apply-credits <id>` | `--credit-note`, `--amount` |
37
37
  | `draft list` | `--max-rows N`, `--ids`, `--json` — same attachment fan-out warning as invoices |
38
38
  | `draft finalize <id>` | `--account`, `--input` |
@@ -44,13 +44,13 @@ Complete reference for all 66 command groups. Organized by domain.
44
44
  |------------|-----------|
45
45
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
46
46
  | `get <id>` | `--json` |
47
- | `search` | `--ref`, `--contact`, `--status`, `--from`, `--to`, `--tag`, `--sort`, `--order` |
48
- | `create` | `--contact`, `--date`, `--ref`, `--currency`, `--rate`, `--lines`, `--tax-profile`, `--finalize`, `--input` |
49
- | `update <id>` | `--contact`, `--date`, `--ref`, `--lines`, `--input` |
47
+ | `search` | `--reference`, `--contact-name`, `--status`, `--from`, `--to`, `--tag`, `--sort`, `--order` |
48
+ | `create` | `--contact`, `--date`, `--ref`, `--currency`, `--exchange-rate`, `--lines`, `--finalize`, `--input` |
49
+ | `update <id>` | `--date`, `--ref`, `--lines`, `--input` |
50
50
  | `delete <id>` | |
51
51
  | `refund <id>` | `--amount`, `--account`, `--method`, `--ref`, `--date` |
52
52
  | `refunds <id>` | List refunds for a credit note |
53
- | `download <id>` | `--output` (PDF download) |
53
+ | `download <id>` | `--json` — returns the PDF URL; writes no file |
54
54
  | `draft list` | `--max-rows N`, `--ids`, `--json` |
55
55
  | `bulk-upsert` | `--input <file>`, `--json` — Nested `lineItems[]`. Async → jobId. `currencyCode` REQUIRED |
56
56
 
@@ -59,9 +59,9 @@ Complete reference for all 66 command groups. Organized by domain.
59
59
  |------------|-----------|
60
60
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
61
61
  | `get <id>` | `--json` |
62
- | `search` | `--ref`, `--contact`, `--status`, `--from`, `--to`, `--tag`, `--sort`, `--order` |
63
- | `create` | `--contact`, `--date`, `--ref`, `--currency`, `--rate`, `--lines`, `--tax-profile`, `--finalize`, `--input` |
64
- | `update <id>` | `--contact`, `--date`, `--ref`, `--lines`, `--input` |
62
+ | `search` | `--reference`, `--contact-name`, `--status`, `--from`, `--to`, `--tag`, `--sort`, `--order` |
63
+ | `create` | `--contact`, `--date`, `--ref`, `--currency`, `--exchange-rate`, `--lines`, `--finalize`, `--input` |
64
+ | `update <id>` | `--date`, `--ref`, `--lines`, `--input` |
65
65
  | `delete <id>` | |
66
66
  | `refund <id>` | `--amount`, `--account`, `--method`, `--ref`, `--date` |
67
67
  | `refunds <id>` | List refunds for a credit note |
@@ -73,11 +73,11 @@ Complete reference for all 66 command groups. Organized by domain.
73
73
  |------------|-----------|
74
74
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
75
75
  | `get <id>` | `--json` |
76
- | `search` | `--ref`, `--from`, `--to`, `--status`, `--tag`, `--type`, `--sort`, `--order` |
77
- | `create` | `--date`, `--ref`, `--entries`, `--currency`, `--rate`, `--finalize`, `--input` |
76
+ | `search` | `--reference`, `--from`, `--to`, `--status`, `--tag`, `--type`, `--sort`, `--order` |
77
+ | `create` | `--date`, `--ref`, `--entries`, `--finalize`, `--input` |
78
78
  | `update <id>` | `--date`, `--ref`, `--entries`, `--input` |
79
79
  | `delete <id>` | |
80
- | `transfer-trial-balance` (alias: `ttb`) | `--from-date`, `--to-date`, `--target-date` |
80
+ | `transfer-trial-balance` (alias: `ttb`) | `--date`, `--entries`, `--input`, `--currency`, `--exchange-rate`, `--rate-direction` |
81
81
  | `draft list` | `--max-rows N`, `--ids`, `--json` |
82
82
  | `bulk-upsert` | `--input <file>`, `--json` — ⚠️ Natural key is `journalReference` (NOT `reference`); legs use `journalEntries[]` (NOT `entries[]`); each leg is `organizationAccountResourceId` (NOT `accountResourceId`) + exactly one of `debitAmount`/`creditAmount` (NOT `amount`+`type`), omitting the unused side. No `currencyCode` on journal rows. Async → jobId |
83
83
 
@@ -100,7 +100,7 @@ Same subcommands and flags as `cash-in`.
100
100
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
101
101
  | `get <id>` | `--json` |
102
102
  | `search` | `--ref`, `--from`, `--to`, `--status` |
103
- | `create` | `--from-account`, `--to-account`, `--amount`, `--date`, `--ref`, `--rate`, `--input` |
103
+ | `create` | `--from-account`, `--to-account`, `--amount`, `--date`, `--ref`, `--input` |
104
104
  | `delete <id>` | |
105
105
 
106
106
  ### `clio payments` — Cashflow transactions (read-only)
@@ -109,14 +109,13 @@ Same subcommands and flags as `cash-in`.
109
109
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
110
110
  | `search` | `--from`, `--to`, `--type`, `--direction`, `--ref`, `--sort`, `--order` |
111
111
  | `get <id>` | `--json` |
112
- | `update <id>` | `--date`, `--ref`, `--input` |
112
+ | `update <id>` | `--date`, `--reference`, `--input` |
113
113
  | `delete <id>` | |
114
114
 
115
115
  ### `clio cashflow` — Cashflow search
116
116
  | Subcommand | Key flags |
117
117
  |------------|-----------|
118
118
  | `search` | `--from`, `--to`, `--type`, `--direction`, `--ref`, `--sort`, `--order`, `--limit`, `--offset`, `--all` |
119
- | `delete <id>` | |
120
119
 
121
120
  ---
122
121
 
@@ -139,8 +138,8 @@ Same subcommands and flags as `cash-in`.
139
138
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
140
139
  | `get <id>` | `--json` |
141
140
  | `search <query>` | `--limit`, `--offset` |
142
- | `create` | `--name`, `--input` |
143
- | `update <id>` | `--name`, `--input` |
141
+ | `create` | `--name` |
142
+ | `update <id>` | `--name` |
144
143
  | `delete <id>` | |
145
144
 
146
145
  ### `clio accounts` — Chart of accounts
@@ -158,7 +157,7 @@ Same subcommands and flags as `cash-in`.
158
157
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
159
158
  | `get <id>` | `--json` |
160
159
  | `search <query>` | `--limit`, `--offset`, `--all` |
161
- | `create` | `--name`, `--sale-name`, `--purchase-name`, `--sale-price`, `--purchase-price`, `--account`, `--tax-profile`, `--input` |
160
+ | `create` | `--sale-account`, `--purchase-account`, `--sale-tax`, `--purchase-tax`, `--name`, `--sale-name`, `--purchase-name`, `--sale-price`, `--purchase-price`, `--input` |
162
161
  | `update <id>` | Same as create flags |
163
162
  | `delete <id>` | |
164
163
 
@@ -192,7 +191,7 @@ Same subcommands and flags as `cash-in`.
192
191
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
193
192
  | `get <id>` | `--json` |
194
193
  | `search <query>` | `--limit`, `--offset` |
195
- | `create` | `--name`, `--rate`, `--tax-type`, `--input` |
194
+ | `create` | `--rate`, `--name`, `--tax-type-code` |
196
195
  | `update <id>` | `--name`, `--rate` |
197
196
  | `types` | List available tax type codes |
198
197
  | `wht-codes` | List withholding tax codes |
@@ -246,7 +245,7 @@ Same subcommands and flags as `cash-in`.
246
245
  ### `clio claims` — Employee-expense claims
247
246
  | Subcommand | Key flags |
248
247
  |------------|-----------|
249
- | `search` (alias `list`) | `--status`, `--employee`, `--contact`, `--limit`, `--offset`, `--json` |
248
+ | `search` | `--status`, `--employee-resource-id`, `--contact-resource-id`, `--reference`, `--from`, `--to`, `--sort`, `--order` |
250
249
  | `get <id>` | `--json` |
251
250
  | `create` | `--value-date`*, `--currency`*, `--employee`, `--contact` / `--vendor-name` (XOR), `--items <json>`, `--custom-fields <json>`, `--tags`, `--submit` |
252
251
  | `update <id>` | partial; `--items` non-empty REPLACES all lines, `--submit` |
@@ -260,13 +259,13 @@ Same subcommands and flags as `cash-in`.
260
259
  | `preview-conversion` | `--ids`, `--posting-rule`, `--payout-flow` |
261
260
  | `convert` | `--ids`, `--value-date`*, `--posting-rule`, `--include-payout`, `--idempotency-key` |
262
261
  | `record-payout` | `--employee`, `--amount`, `--payment-account`, `--payout-for` (REIMBURSEMENT / ADVANCE) |
263
- | `payouts` (search) | `--employee`, `--reference`, `--payout-status`, `--payout-type` (DIRECT_ENTRY / DISBURSEMENT / REIMBURSEMENT_PAYOUT / ADVANCE) — list recorded payouts |
262
+ | `payouts` | `--employee-resource-id`, `--employee-name`, `--reference`, `--payout-status`, `--payout-type` |
264
263
  | `tracking-tags` / `custom-field-values` | picker arrays |
265
264
 
266
265
  ### `clio employees` — Claim members
267
266
  | Subcommand | Key flags |
268
267
  |------------|-----------|
269
- | `search` (alias `list`) | `--name`, `--status`, `--limit`, `--offset`, `--json` |
268
+ | `search` | `--name`, `--email`, `--active`, `--claim-profile-resource-id`, `--sort`, `--order` |
270
269
  | `balances` (alias `search-balances`) | per-employee, per-currency reimbursement owed |
271
270
  | `get <id>` | `--json` |
272
271
  | `create` | `--name`, `--user`* (bind login), `--claim-profile`*, `--employment-type`, `--email`, `--manager` |
@@ -311,9 +310,9 @@ EmploymentType: `FULL_TIME` · `PART_TIME` · `CONTRACTOR` · `INTERN` · `TEMPO
311
310
  | `accounts` | `--limit`, `--json` |
312
311
  | `get <id>` | `--json` |
313
312
  | `records <accountId>` | `--from`, `--to`, `--status`, `--description`, `--limit`, `--offset`, `--all` |
314
- | `add-records <accountId>` | `--input` (JSON array of bank records) |
315
- | `import <accountId> <file>` | Supports CSV, OFX, XLS, XLSX |
316
- | `auto-recon` | READ-ONLY reconciliation suggestions. `--type <workflow>` and `--entries <id,...>` are both REQUIRED (per-entry; no account-wide mode). `--account` optional. |
313
+ | `add-records <accountId>` | `--records`, (JSON array of bank records) |
314
+ | `import <accountId> <file>` | `--file`, `--account`, Supports CSV, OFX, XLS, XLSX |
315
+ | `auto-recon` | `--type`, `--entries`, READ-ONLY reconciliation suggestions. `--type <workflow>` and `--entries <id,...>` are both REQUIRED (per-entry; no account-wide mode). `--account` optional. |
317
316
 
318
317
  ### `clio bank-rules` — Bank reconciliation rules
319
318
  | Subcommand | Key flags |
@@ -337,12 +336,12 @@ Dynamic strings in rules: `{{bankReference}}`, `{{bankPayee}}`, `{{bankDescripti
337
336
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
338
337
  | `get <id>` | `--json` |
339
338
  | `search <query>` | `--limit`, `--offset` |
340
- | `create` | `--name`, `--type`, `--purchase-price`, `--purchase-date`, `--input` |
339
+ | `create` | `--amount`, `--name`, `--type`, `--date`, `--input` |
341
340
  | `update <id>` | `--name`, `--input` |
342
341
  | `delete <id>` | |
343
- | `discard <id>` | `--date`, `--account` |
344
- | `sell <id>` | `--date`, `--amount`, `--account` |
345
- | `transfer <id>` | `--date`, `--to-type` |
342
+ | `discard <id>` | `--disposal-date`, `--gain-loss-account` |
343
+ | `sell <id>` | `--id`, `--depreciation-end-date`, `--sale-type`, `--gain-loss-account` |
344
+ | `transfer <id>` | `--date`, `--type` |
346
345
  | `undo-disposal <id>` | Reverse a discard or sale |
347
346
  | `bulk-upsert` | `--input <file>`, `--json` — ⚠️ Date field is `valueDate` (NOT `purchaseDate` — that's the GET response field; bulk request uses `valueDate`). `cost`/`purchaseAmount` synonyms accepted. `effectiveLife`/`usefulLifeMonths` synonyms accepted. Required: `reference`, `registrationType` ("NEW" or "TRANSFER"). Async → jobId |
348
347
 
@@ -401,9 +400,9 @@ All seven of `--item-code`, `--name`, `--unit`, `--costing-method`, `--cogs-acco
401
400
  | `list-invoices` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
402
401
  | `list-bills` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
403
402
  | `list-journals` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
404
- | `create-invoice` | `--contact`, `--ref`, `--interval`, `--start-date`, `--lines`, `--input` |
405
- | `create-bill` | `--contact`, `--ref`, `--interval`, `--start-date`, `--lines`, `--input` |
406
- | `create-journal` | `--ref`, `--interval`, `--start-date`, `--entries`, `--input` |
403
+ | `create-invoice` | `--contact`, `--reference`, `--repeat`, `--start-date`, `--line-items`, `--input` |
404
+ | `create-bill` | `--contact`, `--reference`, `--repeat`, `--start-date`, `--line-items`, `--input` |
405
+ | `create-journal` | `--reference`, `--repeat`, `--start-date`, `--entries`, `--input` |
407
406
 
408
407
  Dynamic strings in schedulers: `{{Day}}`, `{{Date}}`, `{{Date+X}}`, `{{DateRange:X}}`, `{{Month}}`, `{{Month+X}}`, `{{MonthRange:X}}`, `{{Year}}`, `{{Year+X}}`
409
408
 
@@ -442,7 +441,6 @@ Also: `clio reports pdf` — generate PDF from a message/document.
442
441
  |------------|-----------|
443
442
  | `create` | one of `--file <path>` / `--url <url>` / `--html <string\|@file>`; `--type` (invoice, bill, credit-note-customer, credit-note-supplier); `--merged` (split a multi-doc PDF). `--html` takes raw HTML (e.g. an email body), rendered to a PDF server-side. Encrypted PDFs: `name__pw__password.pdf`. |
444
443
  | `status <workflowIds>` | Comma-separated workflow IDs |
445
- | `search` | `--type`, `--status`, `--from`, `--to`, `--limit`, `--offset` |
446
444
 
447
445
  ### `clio quick-fix <entity>` — Bulk-update transactions
448
446
  Entities: `invoices`, `bills`, `customer-credit-notes`, `supplier-credit-notes`, `journals`, `cash-entries`, `sale-schedules`, `purchase-schedules`, `subscription-schedules`, `journal-schedules`
@@ -486,16 +484,16 @@ All calculators work offline (no auth). Use `--json` for structured output.
486
484
  | `loan` | `--principal`, `--rate`, `--term` |
487
485
  | `lease` | `--payment`, `--term`, `--rate` (optional: `--useful-life` for hire purchase) |
488
486
  | `depreciation` | `--cost`, `--salvage`, `--life`, `--method` |
489
- | `prepaid-expense` | `--amount`, `--start-date`, `--months` |
490
- | `deferred-revenue` | `--amount`, `--start-date`, `--months` |
487
+ | `prepaid-expense` | `--amount`, `--periods`, `--frequency`, `--start-date` |
488
+ | `deferred-revenue` | `--amount`, `--periods`, `--frequency`, `--start-date` |
491
489
  | `fx-reval` | `--amount`, `--book-rate`, `--closing-rate`, `--rate-direction`, `--currency` |
492
- | `ecl` | `--receivables`, `--aging-buckets` (via `--input`) |
493
- | `provision` | `--amount`, `--rate`, `--periods` |
490
+ | `ecl` | `--current`, `--30d`, `--60d`, `--90d`, `--120d`, `--rates`, `--existing-provision` |
491
+ | `provision` | `--amount`, `--rate`, `--term`, `--start-date` |
494
492
  | `fixed-deposit` | `--principal`, `--rate`, `--term` |
495
- | `asset-disposal` | `--cost`, `--accumulated-dep`, `--proceeds` |
496
- | `accrued-expense` | `--amount`, `--start-date`, `--months` |
497
- | `leave-accrual` | `--daily-rate`, `--days`, `--employees` (via `--input`) |
498
- | `dividend` | `--total-dividend`, `--shares` (via `--input`) |
493
+ | `asset-disposal` | `--cost`, `--salvage`, `--life`, `--acquired`, `--disposed`, `--proceeds`, `--method` |
494
+ | `accrued-expense` | `--amount`, `--periods`, `--frequency`, `--start-date` |
495
+ | `leave-accrual` | `--employees`, `--days`, `--daily-rate`, `--periods`, `--start-date` |
496
+ | `dividend` | `--amount`, `--declaration-date`, `--payment-date`, `--withholding-rate` |
499
497
 
500
498
  Common optional flags: `--start-date`, `--currency`, `--json`
501
499
 
@@ -508,21 +506,21 @@ Blueprints are offline (no auth). Tools require auth.
508
506
 
509
507
  | Subcommand | Type | Key flags |
510
508
  |------------|------|-----------|
511
- | `month-end` | Blueprint | `--month`, `--year`, `--currency` |
512
- | `quarter-end` | Blueprint | `--quarter`, `--year`, `--currency` |
513
- | `year-end` | Blueprint | `--year`, `--currency` |
514
- | `bank-recon` | Blueprint | `--bank-account`, `--month` |
509
+ | `month-end` | Blueprint | `--period`, `--currency` |
510
+ | `quarter-end` | `--period`, Blueprint | `--currency` |
511
+ | `year-end` | `--period`, Blueprint | `--currency` |
512
+ | `bank-recon` | Blueprint | `--account`, `--period`, `--currency` |
515
513
  | `match` | Tool | `--input` (bank records + transactions JSON) |
516
- | `gst-vat` | Blueprint | `--period`, `--jurisdiction` |
517
- | `payment-run` | Blueprint | `--date` |
518
- | `outstanding` | Tool | `--contact`, `--limit` (group outstanding bills) |
519
- | `credit-control` | Blueprint | `--aging-days` |
520
- | `supplier-recon` | Blueprint | `--contact` |
521
- | `audit-prep` | Blueprint | `--year` |
522
- | `fa-review` | Blueprint | `--year` |
523
- | `document-collection` | Blueprint | `--month` |
524
- | `ingest` | Tool | `<path>` (classify + upload documents) |
525
- | `statutory-filing` | Blueprint | `--jurisdiction`, `--year` |
514
+ | `gst-vat` | Blueprint | `--period` |
515
+ | `payment-run` | Blueprint | `--due-before`, `--currency` |
516
+ | `outstanding` | Tool | `--limit` (group outstanding bills) |
517
+ | `credit-control` | `--overdue-days`, Blueprint | |
518
+ | `supplier-recon` | `--supplier`, `--period`, Blueprint | |
519
+ | `audit-prep` | `--period`, Blueprint | |
520
+ | `fa-review` | `--currency`, Blueprint | |
521
+ | `document-collection` | Blueprint | `--currency` |
522
+ | `ingest` | `--source`, Tool | `<path>` (classify + upload documents) |
523
+ | `statutory-filing` | Blueprint | `--ya`, `--jurisdiction`, `--currency` |
526
524
  | `sg-cs` | Tool | `--input` (compute Singapore Form C-S) |
527
525
  | `sg-ca` | Tool | `--input` (compute Singapore capital allowances) |
528
526
 
@@ -553,8 +551,8 @@ Batch create via `--input` file or stdin (`{ "entries": [...] }`, 1-100 per call
553
551
  |------------|-----------|
554
552
  | `list` | `--limit`, `--offset`, `--all`, `--format`, `--json` |
555
553
  | `search <query>` | `--limit`, `--offset` |
556
- | `invite` | `--email`, `--first-name`, `--last-name`, `--roles`, `--input` |
557
- | `update <id>` | `--roles`, `--input` |
554
+ | `invite` | `--email`, `--first-name`, `--last-name`, `--role`, `--input` |
555
+ | `update <id>` | `--role`, `--input` |
558
556
  | `remove <id>` | |
559
557
 
560
558
  ### `clio auth` — Authentication
@@ -569,8 +567,9 @@ See SKILL.md Auth Precedence section for full details.
569
567
  |------------|-----------|
570
568
  | `list` | `--type` (invoices, bills, journals, etc.), `--id` |
571
569
  | `add` | `--type`, `--id`, `<file>` |
572
- | `delete` | `--type`, `--id`, `--attachment-id` |
573
- | `table` | `--type`, `--id` (tabular view) |
570
+ | `delete <attachmentId>` | `--type`, `--id` (the transaction; the attachment id is positional) |
571
+
572
+ `list` renders the tabular view — pass `--format table` (the default) or `--format csv`.
574
573
 
575
574
  ### `clio help-center` (alias: `hc`) — Help center search
576
575
  ```
@@ -249,7 +249,7 @@ clio magic create --html @./email-body.html --type invoice --json
249
249
  clio magic status "wf-id-1,wf-id-2,wf-id-3" --json
250
250
 
251
251
  # Search past magic workflows
252
- clio magic search --type bill --status COMPLETED --from 2026-03-01 --json
252
+ clio magic status <workflowIds> --json # comma-separated ids from `magic create`
253
253
 
254
254
  # For encrypted PDFs — embed the password in the filename via __pw__
255
255
  clio magic create --file ./encrypted-file__pw__secret123.pdf --type invoice --json
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-conversion
3
- version: 5.47.4
3
+ version: 5.47.5
4
4
  description: >-
5
5
  Use this skill when migrating accounting data into Jaz — importing from Xero,
6
6
  QuickBooks, Sage, MYOB, or Excel exports. Covers the full conversion pipeline:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-kit
3
- version: 5.47.4
3
+ version: 5.47.5
4
4
  description: >-
5
5
  Use this skill when an accountant, bookkeeper, or owner is running real books
6
6
  in Jaz across one or more organizations from the terminal — setting up a
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-pseudo-sql
3
- version: 5.47.4
3
+ version: 5.47.5
4
4
  description: >-
5
5
  Use this skill when answering ad-hoc data questions that aren't covered by
6
6
  download_export (canonical reports — anomaly, audit, aging, P&L, BS, GL,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-jobs
3
- version: 5.47.4
3
+ version: 5.47.5
4
4
  description: >-
5
5
  Use this skill for recurring accounting workflows — month/quarter/year-end
6
6
  close, bank reconciliation, GST/VAT filing, payment runs, credit control,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-recipes
3
- version: 5.47.4
3
+ version: 5.47.5
4
4
  description: >-
5
5
  Use this skill when modeling complex multi-step accounting transactions —
6
6
  anything that spans multiple periods, involves changing amounts, or requires
package/cli.mjs CHANGED
@@ -1048,7 +1048,7 @@ clio() {
1048
1048
  \u2713 Journal finalized: ${y.reference||y.resourceId}`)),console.log(R(" Status:"),y.status),C.length>0&&console.log(R(" Updated:"),C.join(", ")))})(i)),r.command("attachments <resourceId>").description("List attachments for a journal (URLs for agent inspection)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let a=(await Nl(o,n)).data,u=(await li(o,"journals",n)).data;if(i.json)console.log(JSON.stringify({journalResourceId:n,journalReference:a.reference||null,attachments:u},null,2));else{if(u.length===0){console.log(`No attachments for journal ${a.reference||n}.`);return}console.log(R(`Attachments for ${a.reference||n}:
1049
1049
  `));for(let d of u)console.log(` ${Se(d.resourceId)} ${d.fileName||"(unnamed)"}`),d.fileUrl&&console.log(` ${H(d.fileUrl)}`)}})(i)),e.command("bulk-upsert").description("Create or update manual journals in bulk (max 500). Natural key: journalReference (NOT reference). Each row carries multi-leg journalEntries[] (NOT entries[]); each leg is organizationAccountResourceId plus exactly one of debitAmount/creditAmount, omitting the unused side. Returns a jobId \u2014 poll with `clio background-jobs get <jobId>`. Dates ISO 8601 only.").option("--input <file>","Read JSON body from file (or pipe via stdin with --input -)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(n,i)=>{let o=be(i);o||(console.error('Error: --input <file> is required (JSON with { "journals": [...] } or a bare array)'),process.exit(1));let s=o.journals??o;Array.isArray(s)||(console.error('Error: expected { "journals": [...] }'),process.exit(1)),Nt(s,"journals",500,"journals");let a=await w2(n,s);i.json?console.log(JSON.stringify(a.data,null,2)):(console.log(Y(`Bulk upsert started. Job ID: ${a.data.jobId}`)),console.log(Se(` Poll progress: clio background-jobs get ${a.data.jobId}`)))}))}Fe();Mt();gB();At();_t();dr();Ut();fr();function d3(t){return!Number.isFinite(t)||t===0?"\u2014":new Date(t).toISOString().slice(0,10)}function Ffe(t){let e=En(t.transactionStatus);console.log(R("Reference:"),t.transactionReference||"(none)"),console.log(R(" ID:"),Se(t.resourceId)),console.log(R(" Status:"),e),console.log(R(" Date:"),d3(t.valueDate)),console.log(R(" Type:"),t.businessTransactionType),console.log(R(" Direction:"),t.direction),console.log(R(" Amount:"),`${t.currencySymbol}${t.totalAmount.toFixed(2)} ${t.currencyCode}`),console.log(R(" Account:"),t.account?.name||"\u2014",H(`(${t.organizationAccountResourceId})`)),t.contactResourceId&&console.log(R(" Contact:"),t.contactResourceId)}var Ust=[{key:"resourceId",header:"ID",format:Be},{key:"transactionReference",header:"Reference",format:zn},{key:"transactionStatus",header:"Status",format:t=>En(String(t))},{key:"totalAmount",header:"Amount",align:"right",format:bn},{key:"valueDate",header:"Date",format:t=>d3(Number(t))}];function Qfe(t,e){let r=t.command(e.name).description(`Manage ${e.label.toLowerCase()} entries`);r.command("list").description(`List ${e.label.toLowerCase()} entries`).option("--limit <n>","Max results (default 100)",de).option("--offset <n>","Page number offset (0-indexed)",Ye).option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)",de).option("--format <type>","Output format: table, json, csv, yaml").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(n,i)=>{let o=await He(i,s=>e.listFn(n,s),{label:`Fetching ${e.label.toLowerCase()} entries`});$e(o,Ust,i,e.label)})),r.command("get <resourceId>").description(`Get a ${e.label.toLowerCase()} entry by ID`).option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let{data:s}=await e.getFn(o,n);i.json?console.log(JSON.stringify(s,null,2)):Ffe(s)})(i)),r.command("create").description(`Create a ${e.label.toLowerCase()} entry (saves as draft by default)`).option("--jot <text>",we).option("--account <resourceId>","Bank account name or resourceId").option("--entries <json>","Entry lines as JSON array (offset entries)",fc).option("--date <YYYY-MM-DD>","Value date").option("--ref <reference>","Reference").option("--notes <text>","Notes").option("--tag <tag>","Tag").option(mc,Ac).option(gc,yc,Ko).option(Wi,Ts,Zi).option("--finalize","Finalize instead of saving as draft").option("--input <file>","Read full request body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(n,i)=>{let o=be(i),s;if(o)s=await e.createFn(n,{...o,saveAsDraft:o.saveAsDraft??!i.finalize});else{Le(i,[{flag:"--account",key:"account"},{flag:"--entries",key:"entries"},{flag:"--date",key:"date"}]);let c=await oi(n,i.account,{filter:"bank",silent:i.json});i.account=c.resourceId;let u={accountResourceId:i.account,lines:i.entries,valueDate:i.date,saveAsDraft:!i.finalize};i.ref&&(u.reference=i.ref),i.notes&&(u.internalNotes=i.notes),i.tag&&(u.tags=[i.tag]);let d=Ec(i);bc(d,i),d&&(u.currency=d),s=await e.createFn(n,u)}let a=s.data;if(i.json)console.log(JSON.stringify(a,null,2));else{let c=i.finalize?"finalized":"draft";console.log(Y(`${e.label} created (${c}): ${a.resourceId}`)),console.log(R("ID:"),a.resourceId)}ve(n,`create_${e.name.replace(/-/g,"_")}`,i,s.data)})),r.command("update <resourceId>").description(`Update a ${e.label.toLowerCase()} entry`).option("--jot <text>",we).option("--entries <json>","Entry lines as JSON array",fc).option("--date <YYYY-MM-DD>","Value date").option("--ref <reference>","Reference").option("--notes <text>","Notes").option("--tag <tag>","Tag").option("--finalize","Finalize instead of saving as draft").option("--input <file>","Read full request body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let s=be(i),a;if(s)a=await e.updateFn(o,n,{...s,saveAsDraft:s.saveAsDraft??!i.finalize});else{let u={};i.entries&&(u.lines=i.entries),i.date&&(u.valueDate=i.date),i.ref&&(u.reference=i.ref),i.notes&&(u.internalNotes=i.notes),i.tag&&(u.tags=[i.tag]),u.saveAsDraft=!i.finalize,a=await e.updateFn(o,n,u)}let c=a.data;if(i.json)console.log(JSON.stringify(c,null,2));else{let u=i.finalize?"finalized":"draft";console.log(Y(`${e.label} updated (${u}): ${c.resourceId||n}`))}ve(o,`update_${e.name.replace(/-/g,"_")}`,i,a.data)})(i)),Ve({parent:r,fields:zd,defaults:Gd,fetcher:hm,columns:Ust,label:`Searching ${e.label.toLowerCase()}`,baseFilter:{businessTransactionType:{eq:e.txnType}},preProcess:async(n,i)=>{if(i.account){let o=await oi(n,i.account,{filter:"bank",silent:!!i.json});i.accountId=o.resourceId}}}),r.command("delete <resourceId>").description(`Delete/void a ${e.label.toLowerCase()} entry`).option("--jot <text>",we).option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{await pm(o,n),i.json?console.log(JSON.stringify({deleted:!0,resourceId:n})):console.log(Y(`${e.label} ${n} deleted.`)),ve(o,`delete_${e.name.replace(/-/g,"_")}`,i,{resourceId:n})})(i))}zH();Fe();bde();gB();At();_t();dr();Ut();Mt();fr();var $st=[{key:"resourceId",header:"ID",format:Be},{key:"transactionReference",header:"Reference",format:zn},{key:"transactionStatus",header:"Status",format:t=>En(String(t))},{key:"totalAmount",header:"Amount",align:"right",format:bn},{key:"valueDate",header:"Date",format:t=>d3(Number(t))}];function qst(t){let e=t.command("cash-transfer").description("Manage cash transfer entries");e.command("list").description("List cash transfers").option("--limit <n>","Max results (default 100)",de).option("--offset <n>","Page number offset (0-indexed)",Ye).option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)",de).option("--format <type>","Output format: table, json, csv, yaml").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(r,n)=>{let i=await He(n,o=>GH(r,o),{label:"Fetching cash transfers"});$e(i,$st,n,"Cash Transfers")})),e.command("get <resourceId>").description("Get a cash transfer by ID").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{let{data:o}=await JH(i,r);n.json?console.log(JSON.stringify(o,null,2)):Ffe(o)})(n)),e.command("create").description("Create a cash transfer (saves as draft by default)").option("--jot <text>",we).option("--from-account <resourceId>","Source bank account name or resourceId (cash-out)").option("--to-account <resourceId>","Destination bank account name or resourceId (cash-in)").option("--amount <amount>","Transfer amount",ar).option("--date <YYYY-MM-DD>","Value date").option("--ref <reference>","Reference").option("--finalize","Finalize instead of saving as draft").option("--input <file>","Read full request body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(r,n)=>{let i=be(n),o;if(i)o=await uB(r,{...i,saveAsDraft:i.saveAsDraft??!n.finalize});else{Le(n,[{flag:"--from-account",key:"fromAccount"},{flag:"--to-account",key:"toAccount"},{flag:"--amount",key:"amount"},{flag:"--date",key:"date"}]);let a=await oi(r,n.fromAccount,{filter:"bank",silent:n.json});n.fromAccount=a.resourceId;let c=await oi(r,n.toAccount,{filter:"bank",silent:n.json});if(n.toAccount=c.resourceId,n.fromAccount===n.toAccount)throw new Error("--from-account and --to-account must be different");let u={valueDate:n.date,cashOut:{accountResourceId:n.fromAccount,amount:n.amount},cashIn:{accountResourceId:n.toAccount,amount:n.amount},saveAsDraft:!n.finalize};n.ref&&(u.reference=n.ref),o=await uB(r,u)}let s=o.data;if(n.json)console.log(JSON.stringify(s,null,2));else{let a=n.finalize?"finalized":"draft";console.log(Y(`Cash transfer created (${a}): ${s.resourceId}`)),console.log(R("ID:"),s.resourceId)}ve(r,"create_cash_transfer",n,s)})),Ve({parent:e,fields:zd,defaults:Gd,fetcher:hm,columns:$st,label:"Searching cash transfers",baseFilter:{businessTransactionType:{eq:"JOURNAL_CASH_TRANSFER"}},preProcess:async(r,n)=>{if(n.account){let i=await oi(r,n.account,{filter:"bank",silent:!!n.json});n.accountId=i.resourceId}}}),e.command("delete <resourceId>").description("Delete/void a cash transfer").option("--jot <text>",we).option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{await pm(i,r),n.json?console.log(JSON.stringify({deleted:!0,resourceId:r})):console.log(Y(`Cash transfer ${r} deleted.`)),ve(i,"delete_cash_transfer",n,{resourceId:r})})(n))}Fe();zde();At();_t();dr();fr();Ut();Mt();var jst=[{key:"resourceId",header:"ID",format:Be},{key:"businessTransactionReference",header:"Reference",format:zn},{key:"direction",header:"Dir",format:aP},{key:"valueDate",header:"Date",format:Qp},{key:"totalAmount",header:"Amount",align:"right"},{key:"businessTransactionType",header:"Type",format:t=>H(String(t??""))}];function Yst(t){let e=t.command("payments").description("Payment records: search, get, update, delete");e.command("list").description("List recent cashflow transactions").option("--limit <n>","Max results (default 100)",de).option("--offset <n>","Page number offset (0-indexed)",Ye).option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)",de).option("--format <type>","Output format: table, json, csv, yaml").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(r,n)=>{let i=await He(n,o=>Dz(r,o),{label:"Fetching transactions"});$e(i,jst,n,"Payments")})),Ve({parent:e,fields:dS,defaults:fS,fetcher:EB,columns:jst,label:"Searching payments"}),e.command("get <resourceId>").description("Get a specific payment record").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{let s=(await Sz(i,r)).data;n.json?console.log(JSON.stringify(s,null,2)):(console.log(R("ID:"),s.resourceId),console.log(R("Amount:"),s.paymentAmount),console.log(R("Date:"),s.valueDate),console.log(R("Method:"),s.paymentMethod),console.log(R("Reference:"),s.reference))})(n)),e.command("update <resourceId>").description("Update a payment record").option("--amount <n>","Corrected payment amount").option("--reference <ref>","Payment reference").option("--date <YYYY-MM-DD>","Payment date").option("--method <method>","Payment method (BANK_TRANSFER, CASH, CHEQUE, etc.)").option("--input <file>","Read full update body from JSON file (or pipe via stdin). Overrides flags").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{let o=be(n),s;o?s=o:(s={},n.amount&&(s.paymentAmount=parseFloat(n.amount)),n.reference&&(s.reference=n.reference),n.date&&(s.valueDate=n.date),n.method&&(s.paymentMethod=n.method));let a=await Rz(i,r,s);n.json?console.log(JSON.stringify(a.data,null,2)):console.log(Y(`Payment ${r} updated.`))})(n)),e.command("delete <resourceId>").description("Delete (void) a payment record").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{await xz(i,r),n.json?console.log(JSON.stringify({deleted:!0,resourceId:r})):console.log(Y(`Payment ${r} deleted.`))})(n))}Fe();vp();ZD();At();import{readFileSync as Uwr}from"node:fs";import{basename as $wr,extname as qwr,resolve as jwr}from"node:path";_t();fr();Mt();var Ywr=[{key:"resourceId",header:"ID",format:Be},{key:"valueDate",header:"Date"},{key:"netAmount",header:"Amount",align:"right",format:bn},{key:"description",header:"Description"},{key:"extContactName",header:"Payer/Payee"},{key:"status",header:"Status"}],Hst={".csv":"text/csv",".ofx":"application/x-ofx",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};function zst(t){let e=t.command("bank").description("Bank accounts and records");e.command("accounts").description("List bank accounts").option("--limit <n>","Max results",de).option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(n,i)=>{let o=await Yb(n,{limit:i.limit});if(i.json)console.log(JSON.stringify(o,null,2));else{console.log(R(`Bank Accounts (${o.data.length}):
1050
1050
  `));for(let s of o.data)console.log(` ${Se(s.resourceId)} ${s.name} ${H(s.currencyCode)} ${s.status}`)}})),e.command("get <resourceId>").description("Get a bank account by resourceId").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let a=(await Hb(o,n)).data;i.json?console.log(JSON.stringify(a,null,2)):(console.log(R("Name:"),a.name),console.log(R("ID:"),a.resourceId),console.log(R("Account ID:"),a.accountResourceId),console.log(R("Currency:"),a.currencyCode),console.log(R("Status:"),a.status))})(i)),Ve({parent:e,commandName:"records",fields:pS,defaults:hS,fetcher:zb,columns:Ywr,label:"Searching bank records",positionalArg:"accountResourceId",pathParam:"accountResourceId",pathParamDescription:"Bank account resourceId"}),e.command("add-records <accountResourceId>").description("Add bank records via JSON (1-100 records per call)").option("--jot <text>",we).requiredOption("--records <json>","JSON array: [{amount, transactionDate, description?, payerOrPayee?, reference?}]").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let s=JSON.parse(i.records);if(!Array.isArray(s))throw new Error("--records must be a JSON array");if(s.length<1||s.length>100)throw new Error("--records must contain 1-100 entries");for(let[u,d]of s.entries()){if(typeof d!="object"||d===null)throw new Error(`records[${u}] must be an object`);if(typeof d.amount!="number"||!Number.isFinite(d.amount))throw new Error(`records[${u}].amount must be a finite number`);if(typeof d.transactionDate!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(d.transactionDate))throw new Error(`records[${u}].transactionDate must be YYYY-MM-DD`)}let a=await WL(o,n,s),c=Array.isArray(a?.data?.errors)?a.data.errors:[];if(i.json)console.log(JSON.stringify(a.data,null,2));else if(c.length>0){console.log(ne(`${c.length} error(s):`));for(let u of c)console.log(` ${ne(String(u))}`)}else console.log(Y(`Created ${s.length} bank record(s).`));ve(o,"add_bank_records",i,a.data)})(i));let r=_P;e.command("auto-recon").description("Get auto-reconciliation recommendations for specific bank statement entries").requiredOption("--type <type>",`Recommendation type (${r.join(", ")}). RECOMMENDATIONS returns every type except MAGIC_MATCH in one ranked call and is cheaper; MAGIC_MATCH scans open transactions and is requested on its own.`).requiredOption("--entries <ids>","Comma-separated bank statement entry resourceIds. Required \u2014 there is no account-wide mode, because an unscoped scan exceeds the request timeout on high-volume accounts.").option("--account <resourceId>","Bank account resourceId").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(n,i)=>{let o=i.type.toUpperCase();r.includes(o)||(console.error(ne(`Invalid --type: ${o}`)),console.error(H(`Valid types: ${r.join(", ")}`)),process.exit(1));let s=i.entries.split(",").map(a=>a.trim()).filter(Boolean);s.length===0&&(console.error(ne("--entries must name at least one bank statement entry")),process.exit(1));try{let a=await n.post("/api/v1/search-magic-reconciliation",{bankAccountResourceId:i.account,recommendationType:o,bankStatementEntryResourceIds:s});if(i.json)console.log(JSON.stringify(a,null,2));else{let c=a.data,u=Array.isArray(c)?c.length:0;if(console.log(R(`Auto-Reconciliation Suggestions (${o}): ${u} found
1051
- `)),Array.isArray(c)){for(let d of c.slice(0,50)){let f=d,p=f.description??f.bankRecordDescription??"",h=typeof f.amount=="number"?H(` $${f.amount.toFixed(2)}`):"";console.log(` ${Se(String(f.bankRecordResourceId??f.resourceId??"?"))} ${p}${h}`)}c.length>50&&console.log(H(` ... and ${c.length-50} more (use --json for full output)`))}else console.log(JSON.stringify(a,null,2))}}catch(a){throw(a.status??a.response?.status)===404&&(console.error(ke("Auto-reconciliation endpoint not available on this server.")),process.exit(1)),a}})),e.command("import").description("Import a bank statement file (CSV, OFX, XLS, XLSX)").option("--jot <text>",we).requiredOption("--file <path>","Bank statement file path").requiredOption("--account <resourceId>","Bank account resourceId").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(n,i)=>{let o=jwr(i.file),s=qwr(o).toLowerCase(),a=Hst[s];a||(console.error(ne(`Error: unsupported file type "${s}". Supported: ${Object.keys(Hst).join(", ")}`)),process.exit(1));let c=Uwr(o),u=new Blob([c],{type:a}),d=$wr(o),f=await Gb(n,{businessTransactionType:"BANK_STATEMENT",accountResourceId:i.account,sourceFile:u,sourceFileName:d});i.json?console.log(JSON.stringify(f.data,null,2)):(console.log(Y("Bank statement uploaded \u2014 processing started.")),console.log(R("File:"),d),console.log(H("Check status: clio magic search --type bank-statement"))),ve(n,"import_bank_statement",i,f.data)}))}Fe();zX();At();_t();var Lfe=["trial-balance","balance-sheet","profit-loss","cashflow","aged-ar","aged-ap","cash-balance","general-ledger","vat-ledger","equity-movement","bank-balance-summary","bank-recon-summary","bank-recon-details","fa-summary","fa-recon-summary","ar-report","ledger-highlights"],Mfe=["ACCOUNT","CONTACT","TRANSACTION","RELATIONSHIP"],Pfe=["ACCOUNT","TYPE","CATEGORY","STATUS"];function Gst(t){t.command("reports").description("Generate financial reports").command("generate <type>").description(`Generate a report (${Lfe.join(", ")})`).option("--from <YYYY-MM-DD>","Start date (for P&L, cashflow, equity, recon)").option("--to <YYYY-MM-DD>","End/snapshot date").option("--currency <code>","Currency code override").option("--group-by <groupBy>",`Group by \u2014 general-ledger: ${Mfe.join(", ")} | fa-summary: ${Pfe.join(", ")} (default ACCOUNT)`).option("--bank-account <id>","Bank account resourceId (for bank-recon-*)").option("--aggregate","For aged-ar/aged-ap: compact aging-bucket summary instead of the full per-contact breakdown").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>(Lfe.includes(r)||(console.error(ne(`Invalid report type: ${r}`)),console.error(H(`Valid types: ${Lfe.join(", ")}`)),process.exit(1)),F(async i=>{let o=Z4(),s;switch(r){case"trial-balance":s=await _2(i,{endDate:n.to??o,currencyCode:n.currency});break;case"balance-sheet":s=await D2(i,{primarySnapshotDate:n.to??o,currencyCode:n.currency});break;case"profit-loss":s=await S2(i,{startDate:n.from??`${o.slice(0,4)}-01-01`,endDate:n.to??o,currencyCode:n.currency});break;case"cashflow":s=await R2(i,{startDate:n.from??`${o.slice(0,4)}-01-01`,endDate:n.to??o});break;case"aged-ar":{let a=await x2(i,{startDate:n.from??`${(n.to??o).slice(0,4)}-01-01`,endDate:n.to??o});s=n.aggregate?{data:DC(a,"receivables")}:a;break}case"aged-ap":{let a=await T2(i,{startDate:n.from??`${(n.to??o).slice(0,4)}-01-01`,endDate:n.to??o});s=n.aggregate?{data:DC(a,"payables")}:a;break}case"cash-balance":s=await B2(i,{endDate:n.to??o});break;case"general-ledger":{let a=(n.groupBy??"ACCOUNT").toUpperCase();Mfe.includes(a)||(console.error(ne(`Invalid --group-by: ${a}`)),console.error(H(`Valid values: ${Mfe.join(", ")}`)),process.exit(1)),s=await k2(i,{startDate:n.from??`${o.slice(0,4)}-01-01`,endDate:n.to??o,groupBy:a});break}case"vat-ledger":s=await N2(i,{startDate:n.from??`${o.slice(0,4)}-01-01`,endDate:n.to??o});break;case"equity-movement":s=await O2(i,{primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,currencyCode:n.currency});break;case"bank-balance-summary":s=await F2(i,{primarySnapshotDate:n.to??o,currencyCode:n.currency});break;case"bank-recon-summary":n.bankAccount||(console.error(ne("--bank-account is required for bank-recon-summary")),process.exit(1)),s=await Q2(i,{bankAccountResourceId:n.bankAccount,primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,currencyCode:n.currency});break;case"bank-recon-details":n.bankAccount||(console.error(ne("--bank-account is required for bank-recon-details")),process.exit(1)),s=await L2(i,{bankAccountResourceId:n.bankAccount,primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,filter:{},currencyCode:n.currency});break;case"fa-summary":{let a=(n.groupBy??"ACCOUNT").toUpperCase();Pfe.includes(a)||(console.error(ne(`Invalid --group-by: ${a}`)),console.error(H(`Valid values: ${Pfe.join(", ")}`)),process.exit(1)),s=await M2(i,{primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,groupBy:a,currencyCode:n.currency});break}case"fa-recon-summary":s=await P2(i,{primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,currencyCode:n.currency});break;case"ar-report":s=await U2(i,{endDate:n.to??o});break;case"ledger-highlights":s=await $2(i);break}n.json||console.log(R(`${r} Report:
1051
+ `)),Array.isArray(c)){for(let d of c.slice(0,50)){let f=d,p=f.description??f.bankRecordDescription??"",h=typeof f.amount=="number"?H(` $${f.amount.toFixed(2)}`):"";console.log(` ${Se(String(f.bankRecordResourceId??f.resourceId??"?"))} ${p}${h}`)}c.length>50&&console.log(H(` ... and ${c.length-50} more (use --json for full output)`))}else console.log(JSON.stringify(a,null,2))}}catch(a){throw(a.status??a.response?.status)===404&&(console.error(ke("Auto-reconciliation endpoint not available on this server.")),process.exit(1)),a}})),e.command("import").description("Import a bank statement file (CSV, OFX, XLS, XLSX)").option("--jot <text>",we).requiredOption("--file <path>","Bank statement file path").requiredOption("--account <resourceId>","Bank account resourceId").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(n,i)=>{let o=jwr(i.file),s=qwr(o).toLowerCase(),a=Hst[s];a||(console.error(ne(`Error: unsupported file type "${s}". Supported: ${Object.keys(Hst).join(", ")}`)),process.exit(1));let c=Uwr(o),u=new Blob([c],{type:a}),d=$wr(o),f=await Gb(n,{businessTransactionType:"BANK_STATEMENT",accountResourceId:i.account,sourceFile:u,sourceFileName:d});i.json?console.log(JSON.stringify(f.data,null,2)):(console.log(Y("Bank statement uploaded \u2014 processing started.")),console.log(R("File:"),d),console.log(H("Check status: clio background-jobs get <jobId>"))),ve(n,"import_bank_statement",i,f.data)}))}Fe();zX();At();_t();var Lfe=["trial-balance","balance-sheet","profit-loss","cashflow","aged-ar","aged-ap","cash-balance","general-ledger","vat-ledger","equity-movement","bank-balance-summary","bank-recon-summary","bank-recon-details","fa-summary","fa-recon-summary","ar-report","ledger-highlights"],Mfe=["ACCOUNT","CONTACT","TRANSACTION","RELATIONSHIP"],Pfe=["ACCOUNT","TYPE","CATEGORY","STATUS"];function Gst(t){t.command("reports").description("Generate financial reports").command("generate <type>").description(`Generate a report (${Lfe.join(", ")})`).option("--from <YYYY-MM-DD>","Start date (for P&L, cashflow, equity, recon)").option("--to <YYYY-MM-DD>","End/snapshot date").option("--currency <code>","Currency code override").option("--group-by <groupBy>",`Group by \u2014 general-ledger: ${Mfe.join(", ")} | fa-summary: ${Pfe.join(", ")} (default ACCOUNT)`).option("--bank-account <id>","Bank account resourceId (for bank-recon-*)").option("--aggregate","For aged-ar/aged-ap: compact aging-bucket summary instead of the full per-contact breakdown").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>(Lfe.includes(r)||(console.error(ne(`Invalid report type: ${r}`)),console.error(H(`Valid types: ${Lfe.join(", ")}`)),process.exit(1)),F(async i=>{let o=Z4(),s;switch(r){case"trial-balance":s=await _2(i,{endDate:n.to??o,currencyCode:n.currency});break;case"balance-sheet":s=await D2(i,{primarySnapshotDate:n.to??o,currencyCode:n.currency});break;case"profit-loss":s=await S2(i,{startDate:n.from??`${o.slice(0,4)}-01-01`,endDate:n.to??o,currencyCode:n.currency});break;case"cashflow":s=await R2(i,{startDate:n.from??`${o.slice(0,4)}-01-01`,endDate:n.to??o});break;case"aged-ar":{let a=await x2(i,{startDate:n.from??`${(n.to??o).slice(0,4)}-01-01`,endDate:n.to??o});s=n.aggregate?{data:DC(a,"receivables")}:a;break}case"aged-ap":{let a=await T2(i,{startDate:n.from??`${(n.to??o).slice(0,4)}-01-01`,endDate:n.to??o});s=n.aggregate?{data:DC(a,"payables")}:a;break}case"cash-balance":s=await B2(i,{endDate:n.to??o});break;case"general-ledger":{let a=(n.groupBy??"ACCOUNT").toUpperCase();Mfe.includes(a)||(console.error(ne(`Invalid --group-by: ${a}`)),console.error(H(`Valid values: ${Mfe.join(", ")}`)),process.exit(1)),s=await k2(i,{startDate:n.from??`${o.slice(0,4)}-01-01`,endDate:n.to??o,groupBy:a});break}case"vat-ledger":s=await N2(i,{startDate:n.from??`${o.slice(0,4)}-01-01`,endDate:n.to??o});break;case"equity-movement":s=await O2(i,{primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,currencyCode:n.currency});break;case"bank-balance-summary":s=await F2(i,{primarySnapshotDate:n.to??o,currencyCode:n.currency});break;case"bank-recon-summary":n.bankAccount||(console.error(ne("--bank-account is required for bank-recon-summary")),process.exit(1)),s=await Q2(i,{bankAccountResourceId:n.bankAccount,primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,currencyCode:n.currency});break;case"bank-recon-details":n.bankAccount||(console.error(ne("--bank-account is required for bank-recon-details")),process.exit(1)),s=await L2(i,{bankAccountResourceId:n.bankAccount,primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,filter:{},currencyCode:n.currency});break;case"fa-summary":{let a=(n.groupBy??"ACCOUNT").toUpperCase();Pfe.includes(a)||(console.error(ne(`Invalid --group-by: ${a}`)),console.error(H(`Valid values: ${Pfe.join(", ")}`)),process.exit(1)),s=await M2(i,{primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,groupBy:a,currencyCode:n.currency});break}case"fa-recon-summary":s=await P2(i,{primarySnapshotStartDate:n.from??`${o.slice(0,4)}-01-01`,primarySnapshotEndDate:n.to??o,currencyCode:n.currency});break;case"ar-report":s=await U2(i,{endDate:n.to??o});break;case"ledger-highlights":s=await $2(i);break}n.json||console.log(R(`${r} Report:
1052
1052
  `)),console.log(JSON.stringify(s.data,null,2))})(n)))}Fe();ac();mn();xF();An();At();Ut();_t();dr();Mt();fr();var Jst=[{key:"resourceId",header:"ID",format:Be},{key:"name",header:"Name"},{key:"saleItemName",header:"Sale Name"},{key:"purchaseItemName",header:"Purchase Name"}];function Vst(t){let e=t.command("items").description("Manage items (products & services)");e.command("list").description("List items").option("--limit <n>","Max results (default 100)",de).option("--offset <n>","Page number offset (0-indexed)",Ye).option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)",de).option("--api-key <key>","API key (overrides stored/env)").option("--format <type>","Output format: table, json, csv, yaml").addOption(new ri("--view <tier>","Payload tier: lean (summary rows) or full (default)").choices(["lean","full"])).option("--json","Output as JSON").action(F(async(r,n)=>{let i=await He(n,o=>_F(r,{...o,view:n.view}),{label:"Fetching items"});$e(i,Jst,n,"Items")})),Ve({parent:e,fields:mS,defaults:AS,fetcher:RE,columns:Jst,label:"Searching items"}),e.command("get <resourceId>").description("Get an item by resourceId").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{let s=(await SE(i,r)).data;if(n.json)console.log(JSON.stringify(s,null,2));else{console.log(R("Name:"),s.internalName),console.log(R("Code:"),s.itemCode),console.log(R("ID:"),s.resourceId);let a=[s.appliesToSale&&"Sale",s.appliesToPurchase&&"Purchase"].filter(Boolean).join(", ");a&&console.log(R("Applies to:"),a)}})(n)),e.command("create").description("Create a new item").option("--jot <text>",we).option("--name <name>","Item name (internalName)").option("--code <code>","Item code").option("--sale","Applies to sales").option("--purchase","Applies to purchases").option("--sale-name <name>","Sale display name (defaults to --name)").option("--purchase-name <name>","Purchase display name (defaults to --name)").option("--sale-price <n>","Default sale price",ar).option("--purchase-price <n>","Default purchase price",ar).option("--sale-account <resourceId>","Sale account resourceId").option("--purchase-account <resourceId>","Purchase account resourceId").option("--sale-tax <resourceId>","Sale tax profile resourceId").option("--purchase-tax <resourceId>","Purchase tax profile resourceId").option("--custom-fields <json>",'Custom field values as JSON array: [{"customFieldName":"PO Number","actualValue":"PO-123"}]').option("--input <file>","Read full request body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(r,n)=>{let i=be(n),o=i?.itemCode??n.code;if(o){let a=await g1(r,o);if(a){n.json?console.log(JSON.stringify(a,null,2)):(console.log(Se(`Item with code "${o}" already exists`)),console.log(R("ID:"),a.resourceId));return}}let s;if(i)s=await kw(r,i);else{Le(n,[{flag:"--name",key:"name"},{flag:"--code",key:"code"}]);let a=n.customFields?un(n.customFields):void 0;s=await kw(r,{internalName:n.name,itemCode:n.code,appliesToSale:n.sale??void 0,appliesToPurchase:n.purchase??void 0,saleItemName:n.sale?n.saleName??n.name:void 0,purchaseItemName:n.purchase?n.purchaseName??n.name:void 0,salePrice:n.salePrice,purchasePrice:n.purchasePrice,saleAccountResourceId:n.saleAccount,purchaseAccountResourceId:n.purchaseAccount,saleTaxProfileResourceId:n.saleTax,purchaseTaxProfileResourceId:n.purchaseTax,customFields:a})}n.json?console.log(JSON.stringify(s.data,null,2)):(console.log(Y(`Item created: ${n.name}`)),console.log(R("ID:"),s.data.resourceId)),ve(r,"create_item",n,s.data)})),e.command("update <resourceId>").description("Update an item").option("--jot <text>",we).option("--name <name>","New name").option("--code <code>","New item code").option("--sale-price <n>","New sale price",ar).option("--purchase-price <n>","New purchase price",ar).option("--custom-fields <json>","Custom field values as JSON array").option("--input <file>","Read full update body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{let o=be(n),s;o?s=o:(s={},n.name!==void 0&&(s.internalName=n.name),n.code!==void 0&&(s.itemCode=n.code),n.salePrice!==void 0&&(s.salePrice=n.salePrice),n.purchasePrice!==void 0&&(s.purchasePrice=n.purchasePrice),n.customFields&&(s.customFields=un(n.customFields)));let a=await DF(i,r,s);n.json?console.log(JSON.stringify(a.data,null,2)):console.log(Y(`Item updated: ${a.data.internalName}`)),ve(i,"update_item",n,a.data)})(n)),e.command("delete <resourceId>").description("Delete an item").option("--jot <text>",we).option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{await SF(i,r),n.json?console.log(JSON.stringify({deleted:!0,resourceId:r})):console.log(Y(`Item ${r} deleted.`)),ve(i,"delete_item",n,{resourceId:r})})(n)),e.command("bulk-upsert").description("Create or update items in bulk (max 500). Provide resourceId per item to update, omit to create.").option("--input <file>","Read JSON body from file (or pipe via stdin with --input -)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(r,n)=>{let i=be(n);i||(console.error('Error: --input <file> is required (JSON with { "items": [...] })'),process.exit(1));let o=i.items??i;Array.isArray(o)||(console.error('Error: expected { "items": [...] } or a JSON array'),process.exit(1)),Nt(o,"items",500);let s=await RF(r,o);if(n.json)console.log(JSON.stringify(s.data,null,2));else{let a=s.data;console.log(Y(`Queued ${a.totalRecords??o.length} item(s) \u2014 job ${a.jobId}`)),console.log(` Poll: clio mcp-call search_background_jobs --args '{"filter":{"resourceId":{"eq":"${a.jobId}"}}}'`)}}))}Fe();zF();An();At();Ut();_t();dr();Mt();fr();var Wst=[{key:"resourceId",header:"ID",format:Be},{key:"name",header:"Name"}];function Zst(t){let e=t.command("tags").description("Manage tags");e.command("list").description("List tags").option("--limit <n>","Max results (default 100)",de).option("--offset <n>","Page number offset (0-indexed)",Ye).option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)",de).option("--api-key <key>","API key (overrides stored/env)").option("--format <type>","Output format: table, json, csv, yaml").option("--json","Output as JSON").action(F(async(r,n)=>{let i=await He(n,o=>QE(r,o),{label:"Fetching tags"});$e(i,Wst,n,"Tags")})),e.command("get <resourceId>").description("Get a tag by resourceId").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{let s=(await qF(i,r)).data;n.json?console.log(JSON.stringify(s,null,2)):(console.log(R("Name:"),s.name),console.log(R("ID:"),s.resourceId))})(n)),Ve({parent:e,fields:qS,defaults:jS,fetcher:jF,columns:Wst,label:"Searching tags",positionalArg:"tagName",positionalFilter:r=>({tagName:{contains:r}})}),e.command("create").description("Create a new tag").option("--jot <text>",we).option("--name <name>","Tag name").option("--input <file>","Read full request body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(r,n)=>{let i=be(n),o=i?.name??n.name;i||Le(n,[{flag:"--name",key:"name"}]);let s=await C1(r,o);if(s){n.json?console.log(JSON.stringify(s,null,2)):(console.log(ke(`Tag "${o}" already exists \u2014 reusing.`)),console.log(R("ID:"),s.resourceId));return}let a=i?await Pw(r,i):await Pw(r,{name:o});n.json?console.log(JSON.stringify(a.data,null,2)):(console.log(Y(`Tag created: ${o}`)),console.log(R("ID:"),a.data.resourceId)),ve(r,"create_tag",n,a.data)})),e.command("update <resourceId>").description("Rename a tag").option("--name <name>","New tag name").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{Le(n,[{flag:"--name",key:"name"}]);let o=await YF(i,r,{name:n.name});n.json?console.log(JSON.stringify(o.data,null,2)):(console.log(Y(`Tag renamed to "${n.name}".`)),console.log(R("ID:"),o.data.resourceId))})(n)),e.command("delete <resourceId>").description("Delete a tag").option("--jot <text>",we).option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{await HF(i,r),n.json?console.log(JSON.stringify({deleted:!0,resourceId:r})):console.log(Y(`Tag ${r} deleted.`)),ve(i,"delete_tag",n,{resourceId:r})})(n))}Fe();Qw();At();Ut();_t();dr();Mt();fr();var Xst=[{key:"resourceId",header:"ID",format:Be},{key:"title",header:"Name"},{key:"status",header:"Status",format:t=>String(t)}];function Kst(t){let e=t.command("capsules").description("Manage capsules (transaction grouping)");e.command("list").description("List capsules").option("--limit <n>","Max results (default 100)",de).option("--offset <n>","Page number offset (0-indexed)",Ye).option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)",de).option("--api-key <key>","API key (overrides stored/env)").option("--format <type>","Output format: table, json, csv, yaml").option("--json","Output as JSON").action(F(async(r,n)=>{let i=await He(n,o=>OF(r,o),{label:"Fetching capsules"});$e(i,Xst,n,"Capsules")})),Ve({parent:e,fields:zS,defaults:GS,fetcher:NE,columns:Xst,label:"Searching capsules",positionalArg:"title",positionalFilter:r=>({title:{contains:r}})}),e.command("get <resourceId>").description("Get a capsule by resourceId").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{let s=(await Fw(i,r)).data;n.json?console.log(JSON.stringify(s,null,2)):(console.log(R("Title:"),s.title),s.description&&console.log(R("Description:"),s.description),console.log(R("ID:"),s.resourceId),s.type&&console.log(R("Type:"),s.type),s.capsuleType?.resourceId&&console.log(R("Type ID:"),s.capsuleType.resourceId))})(n)),e.command("create").description("Create a new capsule").option("--jot <text>",we).option("--title <title>","Capsule title").option("--type <resourceId>","Capsule type resourceId").option("--description <text>","Description").option("--input <file>","Read full request body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(r,n)=>{let i=be(n),o;i?o=await hA(r,i):(Le(n,[{flag:"--title",key:"title"},{flag:"--type",key:"type"}]),o=await hA(r,{capsuleTypeResourceId:n.type,title:n.title,description:n.description})),n.json?console.log(JSON.stringify(o.data,null,2)):(console.log(Y(`Capsule created: ${n.title}`)),console.log(R("ID:"),o.data.resourceId)),ve(r,"create_capsule",n,o.data)})),e.command("update <resourceId>").description("Update a capsule").option("--jot <text>",we).option("--title <title>","New title").option("--description <text>","New description").option("--input <file>","Read full update body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{let o=be(n),s;o?s=o:(s={},n.title!==void 0&&(s.title=n.title),n.description!==void 0&&(s.description=n.description));let a=await FF(i,r,s);n.json?console.log(JSON.stringify(a.data,null,2)):console.log(Y(`Capsule updated: ${a.data.title}`)),ve(i,"update_capsule",n,a.data)})(n)),e.command("delete <resourceId>").description("Delete a capsule").option("--jot <text>",we).option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((r,n)=>F(async i=>{await QF(i,r),n.json?console.log(JSON.stringify({deleted:!0,resourceId:r})):console.log(Y(`Capsule ${r} deleted.`)),ve(i,"delete_capsule",n,{resourceId:r})})(n)),e.command("types").description("List capsule types").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(r,n)=>{let i=await kE(r);if(n.json)console.log(JSON.stringify(i.data,null,2));else{console.log(R(`Capsule Types (${i.data.length}):
1053
1053
  `));for(let o of i.data)console.log(` ${Se(o.resourceId)} ${o.displayName}${o.description?H(` \u2014 ${o.description}`):""}`)}})),e.command("create-type").description("Create a new capsule type").option("--name <name>","Capsule type display name").option("--description <text>","Description").option("--input <file>","Read full request body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(r,n)=>{let i=be(n),o;i?o=await Ow(r,i):(Le(n,[{flag:"--name",key:"name"}]),o=await Ow(r,{displayName:n.name,description:n.description})),n.json?console.log(JSON.stringify(o.data,null,2)):(console.log(Y(`Capsule type created: ${n.name}`)),console.log(R("ID:"),o.data.resourceId))})),e.command("move").description("Move transactions from one capsule to another").requiredOption("--transactions <ids>","Comma-separated transaction resourceIds to move").requiredOption("--to <capsuleResourceId>","Destination capsule resourceId").requiredOption("--from <capsuleResourceId>","Source capsule resourceId").option("--api-key <key>","API key (overrides stored/env)").option("--json","JSON output").action(r=>F(async n=>{let i=r.transactions.split(",").map(o=>o.trim()).filter(Boolean);if(await LF(n,{businessTransactionResourceIds:i,newCapsuleResourceId:r.to,oldCapsuleResourceId:r.from}),r.json){console.log(JSON.stringify({moved:i.length,resourceIds:i,capsuleResourceId:r.to}));return}console.log(Y(`Moved ${i.length} transaction(s) to capsule ${r.to}.`))})(r))}Fe();GX();At();Ut();_t();dr();Mt();fr();var eat=[{key:"resourceId",header:"ID",format:Be},{key:"catalogName",header:"Name"},{key:"status",header:"Status"}];function tat(t){let e=be({input:t.input})??{};return{catalogName:t.name??e.catalogName,...e.description!==void 0||t.description!==void 0?{description:t.description??e.description}:{},...e.status!==void 0||t.status!==void 0?{status:t.status??e.status}:{},...e.contactGroupResourceIds?{contactGroupResourceIds:e.contactGroupResourceIds}:{},...e.items?{items:e.items}:{}}}function rat(t){let e=t.command("catalogs").description("Manage catalogs (product/service groupings)");e.command("list").description("List catalogs").option("--limit <n>","Max results (default 100)",de).option("--offset <n>","Page number offset (0-indexed)",Ye).option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)",de).option("--api-key <key>","API key (overrides stored/env)").option("--format <type>","Output format: table, json, csv, yaml").option("--json","Output as JSON").action(F(async(r,n)=>{let i=await He(n,o=>q2(r,o),{label:"Fetching catalogs"});$e(i,eat,n,"Catalogs")})),Ve({parent:e,fields:vS,defaults:wS,fetcher:Y2,columns:eat,label:"Searching catalogs"}),e.command("get <resourceId>").description("Get a catalog (with its items)").option("--api-key <key>","API key (overrides stored/env)").option("--json","JSON output").action((r,n)=>F(async i=>{let o=await j2(i,r);console.log(JSON.stringify(o.data,null,2))})(n)),e.command("create").description("Create a catalog").requiredOption("--name <name>","Catalog name").option("--description <text>","Catalog description").option("--status <status>","Record status (ACTIVE / INACTIVE \u2014 defaults INACTIVE)").option("--input <file>","JSON file with the full catalog body; items[] is mandatory (a create with no items is rejected), contactGroupResourceIds[] is optional; flags override its scalars").option("--api-key <key>","API key (overrides stored/env)").option("--json","JSON output").action(r=>F(async n=>{let i=await H2(n,tat(r));if(r.json){console.log(JSON.stringify(i.data,null,2));return}console.log(Y(`Catalog created: ${i.data.resourceId}`))})(r)),e.command("update <resourceId>").description("Update a catalog. FULL REPLACEMENT \u2014 pass --input with the complete body (get it first); omitting items / contactGroupResourceIds drops them").option("--name <name>","Catalog name").option("--description <text>","Catalog description").option("--status <status>","Record status (ACTIVE / INACTIVE)").option("--input <file>","JSON file with the full catalog body; flags override its scalars").option("--api-key <key>","API key (overrides stored/env)").option("--json","JSON output").action((r,n)=>F(async i=>{let o=await z2(i,r,tat(n));if(n.json){console.log(JSON.stringify(o.data,null,2));return}console.log(Y(`Catalog ${r} updated.`))})(n)),e.command("delete <resourceId>").description("Delete a catalog").option("--api-key <key>","API key (overrides stored/env)").option("--json","JSON output").action((r,n)=>F(async i=>{if(await G2(i,r),n.json){console.log(JSON.stringify({deleted:!0,resourceId:r}));return}console.log(Y(`Catalog ${r} deleted.`))})(n))}Fe();mn();ac();Mt();fr();eU();mm();At();_t();dr();Ut();var nat=[{key:"resourceId",header:"ID",format:Be},{key:"reference",header:"Reference",format:zn},{key:"status",header:"Status",format:t=>En(String(t))},{key:"totalAmount",header:"Amount",align:"right",format:bn},{key:"valueDate",header:"Date",format:t=>Pt(String(t))??"-"}];function iat(t){let e=t.command("customer-credit-notes").description("Manage customer credit notes");e.command("list").description("List customer credit notes").option("--limit <n>","Max results (default 100)",de).option("--offset <n>","Page number offset (0-indexed)",Ye).option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)",de).option("--format <type>","Output format: table, json, csv, yaml").option("--api-key <key>","API key (overrides stored/env)").addOption(new ri("--view <tier>","Payload tier: lean (summary rows) or full (default)").choices(["lean","full"])).option("--json","Output as JSON").action(F(async(n,i)=>{let o=await He(i,s=>J2(n,{...s,view:i.view}),{label:"Fetching customer credit notes"});$e(o,nat,i,"Customer Credit Notes")})),e.command("get <resourceId>").description("Get a customer credit note by resourceId").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let a=(await Ol(o,n)).data;if(i.json)console.log(JSON.stringify(a,null,2));else{if(console.log(R("Reference:"),a.reference||"(none)"),console.log(R("ID:"),a.resourceId),console.log(R("Status:"),a.status),console.log(R("Date:"),Pt(a.valueDate)),a.totalAmount!==void 0&&console.log(R("Total:"),a.totalAmount.toFixed(2)),a.lineItems?.length){console.log(R("Line Items:"));for(let c of a.lineItems){let u=c.quantity??1,d=c.unitPrice??0;console.log(` - ${c.name} qty: ${u} price: ${d.toFixed(2)}`)}}a.invoiceNotes&&console.log(R("Notes:"),a.invoiceNotes)}})(i)),Ve({parent:e,fields:$p,defaults:vC,fetcher:pR,columns:nat,label:"Searching customer credit notes"}),e.command("create").description("Create a customer credit note (saves as draft by default)").option("--jot <text>",we).option("--contact <resourceId>","Contact name or resourceId").option("--lines <json>","Line items as JSON array",$n).option("--date <YYYY-MM-DD>","Credit note date (valueDate)").option("--ref <reference>","Credit note reference/number").option("--notes <text>","Notes").option("--tag <tag>","Tag").option("--custom-fields <json>",'Custom field values as JSON array: [{"customFieldName":"PO Number","actualValue":"PO-123"}]').option(mc,Ac).option(gc,yc,Ko).option(Wi,Ts,Zi).option("--finalize","Finalize instead of saving as draft").option("--input <file>","Read full request body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(n,i)=>{let o=be(i),s;if(o)s=await hR(n,{...o,saveAsDraft:o.saveAsDraft??!i.finalize});else{Le(i,[{flag:"--contact",key:"contact"},{flag:"--lines",key:"lines"},{flag:"--date",key:"date"}]);let a=await Ci(n,i.contact,{silent:i.json});i.contact=a.resourceId;let c=Ec(i);bc(c,i);let u=i.customFields?un(i.customFields):void 0;s=await hR(n,{contactResourceId:i.contact,lineItems:i.lines,valueDate:i.date,reference:i.ref,invoiceNotes:i.notes,tags:i.tag?[i.tag]:void 0,customFields:u,currency:c,saveAsDraft:!i.finalize})}if(tp(s,i),i.json)console.log(JSON.stringify(s.appliedRate?{...s.data,appliedRate:s.appliedRate}:s.data,null,2));else{let a=i.finalize?"finalized":"draft";console.log(Y(`Customer credit note created (${a}): ${s.data.reference||s.data.resourceId}`)),console.log(R("ID:"),s.data.resourceId)}ve(n,"create_customer_credit_note",i,s.data)})),e.command("update <resourceId>").description("Update a draft customer credit note").option("--jot <text>",we).option("--ref <reference>","New reference").option("--date <YYYY-MM-DD>","New credit note date").option("--lines <json>","New line items as JSON array",$n).option("--notes <text>","New notes").option("--tag <tag>","New tag").option("--custom-fields <json>","Custom field values as JSON array").option("--input <file>","Read full update body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let s=be(i),a;s?a=s:(a={},i.ref!==void 0&&(a.reference=i.ref),i.date!==void 0&&(a.valueDate=i.date),i.lines!==void 0&&(a.lineItems=i.lines),i.notes!==void 0&&(a.notes=i.notes),i.tag!==void 0&&(a.tag=i.tag),i.customFields!==void 0&&(a.customFields=un(i.customFields)));let c=await V2(o,n,a);i.json?console.log(JSON.stringify(c.data,null,2)):console.log(Y(`Customer credit note updated: ${c.data.reference||c.data.resourceId}`)),ve(o,"update_customer_credit_note",i,c.data)})(i)),e.command("delete <resourceId>").description("Delete/void a customer credit note").option("--jot <text>",we).option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{await W2(o,n),i.json?console.log(JSON.stringify({deleted:!0,resourceId:n})):console.log(Y(`Customer credit note ${n} deleted.`)),ve(o,"delete_customer_credit_note",i,{resourceId:n})})(i)),e.command("refund <resourceId>").description("Record a refund against a customer credit note").option("--jot <text>",we).option("--amount <n>","Refund amount (bank currency)",ar).option("--account <resourceId>","Refund account name or resourceId (any chart-of-accounts account)").option("--date <YYYY-MM-DD>","Refund date (valueDate)").option("--transaction-amount <n>","Transaction amount (CN currency, if different from bank)",ar).option("--method <method>","Refund method (BANK_TRANSFER, CASH, CHEQUE, etc.)","BANK_TRANSFER").option("--ref <reference>","Refund reference").option("--draft","Save as draft instead of finalizing").option("--input <file>","Read full refund body from JSON file (or pipe via stdin)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let s=be(i),a;if(s)a=await AR(o,n,{...s,saveAsDraft:s.saveAsDraft??i.draft??!1});else{Le(i,[{flag:"--amount",key:"amount"},{flag:"--account",key:"account"},{flag:"--date",key:"date"}]);let u=new Set(["BANK_TRANSFER","CASH","CHEQUE"]).has(i.method)?"bank":"any",d=await oi(o,i.account,{filter:u,silent:i.json});i.account=d.resourceId,a=await AR(o,n,{paymentAmount:i.amount,transactionAmount:i.transactionAmount??i.amount,accountResourceId:i.account,valueDate:i.date,dueDate:i.date,paymentMethod:i.method,reference:i.ref??"",saveAsDraft:i.draft??!1})}i.json?console.log(JSON.stringify(a.data,null,2)):console.log(Y(`Refund recorded for customer credit note ${n}`)),ve(o,"create_customer_credit_note_refund",i,a.data)})(i)),e.command("refunds <resourceId>").description("List refunds for a customer credit note").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let a=(await Z2(o,n)).data;if(i.json)console.log(JSON.stringify(a,null,2));else{if(!a?.length){console.log("No refunds found.");return}console.log(R(`Refunds (${a.length}):
1054
1054
  `));for(let c of a)console.log(` ${Se(c.resourceId)} ${c.reference||"(no ref)"} ${c.status} ${c.refundAmount} ${Pt(c.valueDate)}`)}})(i)),e.command("download <resourceId>").description("Download a customer credit note as PDF (returns URL)").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action((n,i)=>F(async o=>{let s=await X2(o,n);i.json?console.log(JSON.stringify(s.data,null,2)):(console.log(Y("PDF download ready:")),console.log(H(s.data.fileUrl)))})(i));let r=e.command("draft").description("Manage draft customer credit notes (inspect, finalize, attachments)");r.command("list").description("List all draft customer credit notes with per-field validation status").option("--ids <ids>","Comma-separated IDs to inspect (instead of all drafts)").option("--max-rows <n>","Max drafts to fetch (default 1000)",de).option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON").action(F(async(n,i)=>{let o;if(i.ids){let c=i.ids.split(",").map(u=>u.trim()).filter(Boolean);o=await Promise.all(c.map(async u=>(await Ol(n,u)).data)),o=o.filter(u=>u.status==="DRAFT")}else o=(await He({all:!0,json:!0,maxRows:i.maxRows},({limit:u,offset:d})=>pR(n,{filter:{status:{eq:"DRAFT"}},limit:u,offset:d,sort:{sortBy:["valueDate"],order:"DESC"}}),{label:"Fetching draft customer credit notes"})).data;let s=5,a=[];for(let c=0;c<o.length;c+=s){let u=o.slice(c,c+s),d=await Promise.all(u.map(async f=>{let p=0;try{p=(await li(n,"customer-credit-notes",f.resourceId)).data.length}catch{}return $o(f,oo,p)}));a.push(...d)}if(i.json){let c=a.filter(u=>u.ready).length;console.log(JSON.stringify({totalDrafts:a.length,readyCount:c,needsAttentionCount:a.length-c,drafts:a},null,2))}else sd("Customer Credit Notes",a)})),ym(r.command("finalize <resourceId>").description("Fill missing fields and convert a draft customer credit note to APPROVED").option("--jot <text>",we)).action((n,i)=>F(async o=>{let s=be(i),c=(await Ol(o,n)).data;if(c.status!=="DRAFT"){let E=`Customer credit note ${n} is ${c.status}, not DRAFT.`;i.json?console.log(JSON.stringify({finalized:!1,error:E})):console.error(ne(E)),process.exit(1)}let u={...i};if(i.contact){let E=await Ci(o,i.contact,{silent:i.json});u.contact=E.resourceId}if(i.account){let E=await oi(o,i.account,{filter:"line-item",silent:i.json});u.account=E.resourceId}if(i.taxProfile){let E=await xu(o,i.taxProfile,{silent:i.json});u.taxProfile=E.resourceId}let d;s?d=s:d=td(c,u);let f=Object.keys(d),p={...c,...d};d.lineItems&&(p.lineItems=d.lineItems);let{missingFields:h,missingCount:m,ready:A}=Ys(p,oo);if(!s){let E={reference:p.reference||void 0,contactResourceId:p.contactResourceId,valueDate:Pt(d.valueDate)||Pt(c.valueDate)},I=d.lineItems??c.lineItems??[];E.lineItems=I.map(v=>Wc(v)),(d.isTaxVatApplicable!=null||c.isTaxVATApplicable!=null)&&(E.isTaxVATApplicable=d.isTaxVatApplicable??c.isTaxVATApplicable),(d.taxInclusion!=null||c.taxInclusion!=null)&&(E.taxInclusion=d.taxInclusion??c.taxInclusion),d.notes&&(E.notes=d.notes),d.tag&&(E.tag=d.tag),d=E}if(i.dryRun){let E=Co(p,oo);if(i.json)console.log(JSON.stringify({finalized:!1,dryRun:!0,resourceId:n,reference:p.reference||null,ready:A,missingCount:m,missingFields:h,validation:E},null,2));else if(A)console.log(Y(`\u2713 ${p.reference||n} is ready to finalize.`));else{console.error(ke(`\u2717 ${p.reference||n} \u2014 ${m} issue${m>1?"s":""} remaining:`));for(let I of h){let v=oo.find(x=>I===x.field||I.endsWith(`.${x.field}`));console.log(` ${I}: ${ne("MISSING")} \u2014 ${v?.hint??""}`)}}return}if(!A){let E=Co(p,oo);if(i.json)console.log(JSON.stringify({finalized:!1,resourceId:n,reference:p.reference||null,ready:!1,missingCount:m,missingFields:h,validation:E},null,2));else{console.error(ne(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaz-clio",
3
- "version": "5.47.4",
3
+ "version": "5.47.5",
4
4
  "description": "Clio: Command Line Interface Operator for Jaz AI.",
5
5
  "type": "module",
6
6
  "bin": {