@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
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { invoiceListCommand } from "../../commands/invoice/list.js";
|
|
3
|
+
import { invoiceGetCommand } from "../../commands/invoice/get.js";
|
|
4
|
+
import { invoiceCreateCommand } from "../../commands/invoice/create.js";
|
|
5
|
+
import { invoiceStatusCommand } from "../../commands/invoice/status.js";
|
|
6
|
+
import { invoicePdfCommand } from "../../commands/invoice/pdf.js";
|
|
7
|
+
import { invoiceDeleteCommand } from "../../commands/invoice/delete.js";
|
|
8
|
+
|
|
9
|
+
export function registerInvoiceCommands(program: Command): void {
|
|
10
|
+
// ── invoice ───────────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
const invoice = program.command("invoice").description("Invoice management");
|
|
13
|
+
|
|
14
|
+
invoice
|
|
15
|
+
.command("list")
|
|
16
|
+
.description("List invoices")
|
|
17
|
+
.option("--json", "JSON output")
|
|
18
|
+
.option("--format <format>", "Output format: table, tsv, csv, ids")
|
|
19
|
+
.option("--type <type>", "sale or purchase")
|
|
20
|
+
.option("--status <status>", "Filter by status")
|
|
21
|
+
.option("--party <name>", "Filter by party name")
|
|
22
|
+
.option("--party-id <id>", "Filter by party ID")
|
|
23
|
+
.option("--from <date>", "From date (YYYY-MM-DD)")
|
|
24
|
+
.option("--to <date>", "To date (YYYY-MM-DD)")
|
|
25
|
+
.option("--this-month", "Filter to current month")
|
|
26
|
+
.option("--this-quarter", "Filter to current quarter")
|
|
27
|
+
.option("--this-fy", "Filter to current financial year")
|
|
28
|
+
.option("--page <n>", "Page number", parseInt)
|
|
29
|
+
.option("--limit <n>", "Items per page", parseInt)
|
|
30
|
+
.option("--search <q>", "Search invoices")
|
|
31
|
+
.option("--sort-by <field>", "Sort field: date, amount, number")
|
|
32
|
+
.option("--sort-dir <dir>", "Sort direction: asc, desc")
|
|
33
|
+
.action(async (opts) => {
|
|
34
|
+
await invoiceListCommand({
|
|
35
|
+
json: opts.json,
|
|
36
|
+
format: opts.format,
|
|
37
|
+
type: opts.type,
|
|
38
|
+
status: opts.status,
|
|
39
|
+
party: opts.party,
|
|
40
|
+
partyId: opts.partyId,
|
|
41
|
+
from: opts.from,
|
|
42
|
+
to: opts.to,
|
|
43
|
+
thisMonth: opts.thisMonth,
|
|
44
|
+
thisQuarter: opts.thisQuarter,
|
|
45
|
+
thisFy: opts.thisFy,
|
|
46
|
+
page: opts.page,
|
|
47
|
+
limit: opts.limit,
|
|
48
|
+
search: opts.search,
|
|
49
|
+
sortBy: opts.sortBy,
|
|
50
|
+
sortDir: opts.sortDir,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
invoice
|
|
55
|
+
.command("get <id>")
|
|
56
|
+
.description("Get invoice details")
|
|
57
|
+
.option("--json", "JSON output")
|
|
58
|
+
.action(async (id, opts) => {
|
|
59
|
+
await invoiceGetCommand(id, { json: opts.json });
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
invoice
|
|
63
|
+
.command("create")
|
|
64
|
+
.description("Create a new invoice")
|
|
65
|
+
.option("--json", "JSON output")
|
|
66
|
+
.option("--party <name>", "Party name")
|
|
67
|
+
.option("--party-id <id>", "Party UUID")
|
|
68
|
+
.option("--type <type>", "sale or purchase")
|
|
69
|
+
.option("--item <name>", "Item (repeatable)", (v, a: string[]) => [...a, v], [] as string[])
|
|
70
|
+
.option("--qty <n>", "Quantity (per --item)", (v, a: string[]) => [...a, v], [] as string[])
|
|
71
|
+
.option("--rate <n>", "Unit price (per --item)", (v, a: string[]) => [...a, v], [] as string[])
|
|
72
|
+
.option("--delivery <method>", "Delivery method")
|
|
73
|
+
.option("--notes <text>", "Invoice notes")
|
|
74
|
+
.option("--terms <text>", "Terms and conditions")
|
|
75
|
+
.option("-y, --yes", "Skip confirmation prompts")
|
|
76
|
+
.action(async (opts) => {
|
|
77
|
+
await invoiceCreateCommand({
|
|
78
|
+
json: opts.json,
|
|
79
|
+
party: opts.party,
|
|
80
|
+
partyId: opts.partyId,
|
|
81
|
+
type: opts.type,
|
|
82
|
+
items: opts.item,
|
|
83
|
+
qty: opts.qty,
|
|
84
|
+
rate: opts.rate,
|
|
85
|
+
delivery: opts.delivery,
|
|
86
|
+
notes: opts.notes,
|
|
87
|
+
terms: opts.terms,
|
|
88
|
+
yes: opts.yes,
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
invoice
|
|
93
|
+
.command("status <id> <status>")
|
|
94
|
+
.description("Update invoice status")
|
|
95
|
+
.option("--json", "JSON output")
|
|
96
|
+
.action(async (id, status, opts) => {
|
|
97
|
+
await invoiceStatusCommand(id, status, { json: opts.json });
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
invoice
|
|
101
|
+
.command("pdf <id>")
|
|
102
|
+
.description("Download invoice as PDF")
|
|
103
|
+
.option("--output <path>", "Output path or directory")
|
|
104
|
+
.option("--open", "Open after download")
|
|
105
|
+
.action(async (id, opts) => {
|
|
106
|
+
await invoicePdfCommand(id, { output: opts.output, open: opts.open });
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
invoice
|
|
110
|
+
.command("delete <id>")
|
|
111
|
+
.description("Delete an invoice")
|
|
112
|
+
.option("-y, --yes", "Skip confirmation")
|
|
113
|
+
.option("--json", "JSON output")
|
|
114
|
+
.action(async (id, opts) => {
|
|
115
|
+
await invoiceDeleteCommand(id, { yes: opts.yes, json: opts.json });
|
|
116
|
+
});
|
|
117
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { requireAuth } from "../../config.js";
|
|
3
|
+
import { HisaaboClient, HisaaboApiError } from "../../client.js";
|
|
4
|
+
import { fatalError, EXIT, outputJSON } from "../../output.js";
|
|
5
|
+
import { itemListCommand } from "../../commands/item/list.js";
|
|
6
|
+
import { itemCreateCommand } from "../../commands/item/create.js";
|
|
7
|
+
import { itemDeleteCommand } from "../../commands/item/delete.js";
|
|
8
|
+
import { itemStockCommand } from "../../commands/item/stock.js";
|
|
9
|
+
|
|
10
|
+
export function registerItemCommands(program: Command): void {
|
|
11
|
+
// ── item ──────────────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
const item = program.command("item").description("Item / product management");
|
|
14
|
+
|
|
15
|
+
item
|
|
16
|
+
.command("list")
|
|
17
|
+
.description("List items")
|
|
18
|
+
.option("--json", "JSON output")
|
|
19
|
+
.option("--format <format>", "Output format: table, tsv, csv, ids")
|
|
20
|
+
.option("--search <q>", "Search")
|
|
21
|
+
.option("--category <cat>", "Filter by category")
|
|
22
|
+
.option("--type <type>", "product or service")
|
|
23
|
+
.option("--low-stock", "Show only low-stock items")
|
|
24
|
+
.option("--page <n>", "Page number", parseInt)
|
|
25
|
+
.option("--limit <n>", "Items per page", parseInt)
|
|
26
|
+
.action(async (opts) => {
|
|
27
|
+
await itemListCommand({
|
|
28
|
+
json: opts.json,
|
|
29
|
+
format: opts.format,
|
|
30
|
+
search: opts.search,
|
|
31
|
+
category: opts.category,
|
|
32
|
+
type: opts.type,
|
|
33
|
+
lowStock: opts.lowStock,
|
|
34
|
+
page: opts.page,
|
|
35
|
+
limit: opts.limit,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
item
|
|
40
|
+
.command("get <id>")
|
|
41
|
+
.description("Get item details")
|
|
42
|
+
.option("--json", "JSON output")
|
|
43
|
+
.action(async (id, opts) => {
|
|
44
|
+
const cfg = requireAuth();
|
|
45
|
+
const client = new HisaaboClient(cfg);
|
|
46
|
+
try {
|
|
47
|
+
const it = await client.item.get(id);
|
|
48
|
+
if (opts.json) { outputJSON(it); return; }
|
|
49
|
+
console.log(`\n ${it.name} (${it.itemType})`);
|
|
50
|
+
console.log(" " + "─".repeat(40));
|
|
51
|
+
if (it.sku) console.log(` SKU: ${it.sku}`);
|
|
52
|
+
if (it.hsn) console.log(` HSN: ${it.hsn}`);
|
|
53
|
+
console.log(` Unit: ${it.unit}`);
|
|
54
|
+
if (it.salePrice) console.log(` Sale: ₹${it.salePrice}`);
|
|
55
|
+
if (it.purchasePrice) console.log(` Purchase: ₹${it.purchasePrice}`);
|
|
56
|
+
console.log(` Tax: ${it.taxPercent}%`);
|
|
57
|
+
if (it.itemType === "product") console.log(` Stock: ${it.stockQuantity}`);
|
|
58
|
+
console.log();
|
|
59
|
+
} catch (e) {
|
|
60
|
+
if (e instanceof HisaaboApiError && e.hisaaboError.code === "not_found") fatalError(`Item not found: ${id}`, EXIT.NOT_FOUND);
|
|
61
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
item
|
|
66
|
+
.command("create")
|
|
67
|
+
.description("Create a new item")
|
|
68
|
+
.option("--json", "JSON output")
|
|
69
|
+
.option("--name <name>", "Item name")
|
|
70
|
+
.option("--unit <unit>", "Unit (pcs, kg, etc.)")
|
|
71
|
+
.option("--sale-price <price>", "Sale price")
|
|
72
|
+
.option("--purchase-price <price>", "Purchase price")
|
|
73
|
+
.option("--tax <percent>", "Tax percentage")
|
|
74
|
+
.option("--stock <qty>", "Opening stock quantity")
|
|
75
|
+
.option("--hsn <code>", "HSN code")
|
|
76
|
+
.option("--category <cat>", "Category")
|
|
77
|
+
.option("--type <type>", "product or service")
|
|
78
|
+
.option("-y, --yes", "Skip confirmation")
|
|
79
|
+
.action(async (opts) => {
|
|
80
|
+
await itemCreateCommand({
|
|
81
|
+
json: opts.json,
|
|
82
|
+
name: opts.name,
|
|
83
|
+
unit: opts.unit,
|
|
84
|
+
salePrice: opts.salePrice,
|
|
85
|
+
purchasePrice: opts.purchasePrice,
|
|
86
|
+
taxPercent: opts.tax,
|
|
87
|
+
stock: opts.stock,
|
|
88
|
+
hsn: opts.hsn,
|
|
89
|
+
category: opts.category,
|
|
90
|
+
type: opts.type,
|
|
91
|
+
yes: opts.yes,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
item
|
|
96
|
+
.command("delete <id>")
|
|
97
|
+
.description("Delete an item")
|
|
98
|
+
.option("-y, --yes", "Skip confirmation")
|
|
99
|
+
.option("--json", "JSON output")
|
|
100
|
+
.action(async (id, opts) => {
|
|
101
|
+
await itemDeleteCommand(id, { yes: opts.yes, json: opts.json });
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
item
|
|
105
|
+
.command("stock <id> <adjustment>")
|
|
106
|
+
.description("Adjust item stock (+10, -5, 100)")
|
|
107
|
+
.option("--json", "JSON output")
|
|
108
|
+
.option("--reason <text>", "Reason for adjustment")
|
|
109
|
+
.action(async (id, adjustment, opts) => {
|
|
110
|
+
await itemStockCommand(id, adjustment, { json: opts.json, reason: opts.reason });
|
|
111
|
+
});
|
|
112
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { partyListCommand } from "../../commands/party/list.js";
|
|
3
|
+
import { partyGetCommand } from "../../commands/party/get.js";
|
|
4
|
+
import { partyCreateCommand } from "../../commands/party/create.js";
|
|
5
|
+
import { partyDeleteCommand } from "../../commands/party/delete.js";
|
|
6
|
+
import { partyLedgerCommand } from "../../commands/party/ledger.js";
|
|
7
|
+
|
|
8
|
+
export function registerPartyCommands(program: Command): void {
|
|
9
|
+
// ── party ─────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
const party = program.command("party").description("Party (customer/supplier) management");
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
party
|
|
15
|
+
.command("list")
|
|
16
|
+
.description("List parties")
|
|
17
|
+
.option("--json", "JSON output")
|
|
18
|
+
.option("--format <format>", "Output format: table, tsv, csv, ids")
|
|
19
|
+
.option("--type <type>", "customer or supplier")
|
|
20
|
+
.option("--search <q>", "Search")
|
|
21
|
+
.option("--category <cat>", "Filter by category")
|
|
22
|
+
.option("--page <n>", "Page number", parseInt)
|
|
23
|
+
.option("--limit <n>", "Items per page", parseInt)
|
|
24
|
+
.action(async (opts) => {
|
|
25
|
+
await partyListCommand({
|
|
26
|
+
json: opts.json,
|
|
27
|
+
format: opts.format,
|
|
28
|
+
type: opts.type,
|
|
29
|
+
search: opts.search,
|
|
30
|
+
category: opts.category,
|
|
31
|
+
page: opts.page,
|
|
32
|
+
limit: opts.limit,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
party
|
|
37
|
+
.command("get <id>")
|
|
38
|
+
.description("Get party details")
|
|
39
|
+
.option("--json", "JSON output")
|
|
40
|
+
.action(async (id, opts) => {
|
|
41
|
+
await partyGetCommand(id, { json: opts.json });
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
party
|
|
45
|
+
.command("create")
|
|
46
|
+
.description("Create a new party")
|
|
47
|
+
.option("--json", "JSON output")
|
|
48
|
+
.option("--type <type>", "customer or supplier")
|
|
49
|
+
.option("--name <name>", "Party name")
|
|
50
|
+
.option("--phone <phone>", "Phone number")
|
|
51
|
+
.option("--email <email>", "Email address")
|
|
52
|
+
.option("--gstin <gstin>", "GSTIN")
|
|
53
|
+
.option("--city <city>", "City")
|
|
54
|
+
.option("--category <cat>", "Category")
|
|
55
|
+
.option("-y, --yes", "Skip confirmation")
|
|
56
|
+
.action(async (opts) => {
|
|
57
|
+
await partyCreateCommand(opts);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
party
|
|
61
|
+
.command("delete <id>")
|
|
62
|
+
.description("Delete a party")
|
|
63
|
+
.option("-y, --yes", "Skip confirmation")
|
|
64
|
+
.option("--json", "JSON output")
|
|
65
|
+
.action(async (id, opts) => {
|
|
66
|
+
await partyDeleteCommand(id, { yes: opts.yes, json: opts.json });
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
party
|
|
70
|
+
.command("ledger <partyId>")
|
|
71
|
+
.description("Show party ledger (debit/credit history)")
|
|
72
|
+
.option("--json", "JSON output")
|
|
73
|
+
.option("--format <format>", "Output format: table, tsv, csv")
|
|
74
|
+
.option("--from <date>", "From date")
|
|
75
|
+
.option("--to <date>", "To date")
|
|
76
|
+
.option("--page <n>", "Page number", parseInt)
|
|
77
|
+
.option("--limit <n>", "Items per page", parseInt)
|
|
78
|
+
.action(async (partyId, opts) => {
|
|
79
|
+
await partyLedgerCommand(partyId, opts);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { paymentListCommand } from "../../commands/payment/list.js";
|
|
3
|
+
import { paymentCreateCommand } from "../../commands/payment/create.js";
|
|
4
|
+
import { paymentDeleteCommand } from "../../commands/payment/delete.js";
|
|
5
|
+
|
|
6
|
+
export function registerPaymentCommands(program: Command): void {
|
|
7
|
+
// ── payment ───────────────────────────────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
const payment = program.command("payment").description("Payment recording");
|
|
10
|
+
|
|
11
|
+
payment
|
|
12
|
+
.command("list")
|
|
13
|
+
.description("List payments")
|
|
14
|
+
.option("--json", "JSON output")
|
|
15
|
+
.option("--format <format>", "Output format: table, tsv, csv, ids")
|
|
16
|
+
.option("--party-id <id>", "Filter by party")
|
|
17
|
+
.option("--from <date>", "From date")
|
|
18
|
+
.option("--to <date>", "To date")
|
|
19
|
+
.option("--page <n>", "Page number", parseInt)
|
|
20
|
+
.option("--limit <n>", "Items per page", parseInt)
|
|
21
|
+
.action(async (opts) => {
|
|
22
|
+
await paymentListCommand(opts);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
payment
|
|
26
|
+
.command("create")
|
|
27
|
+
.description("Record a payment")
|
|
28
|
+
.option("--json", "JSON output")
|
|
29
|
+
.option("--party-id <id>", "Party UUID")
|
|
30
|
+
.option("--party <name>", "Party name")
|
|
31
|
+
.option("--amount <amount>", "Payment amount")
|
|
32
|
+
.option("--mode <mode>", "cash/bank/upi/cheque/other")
|
|
33
|
+
.option("--invoice-id <id>", "Link to invoice")
|
|
34
|
+
.option("--reference <ref>", "Reference number")
|
|
35
|
+
.option("--date <date>", "Payment date")
|
|
36
|
+
.option("--notes <text>", "Notes")
|
|
37
|
+
.option("-y, --yes", "Skip confirmation")
|
|
38
|
+
.action(async (opts) => {
|
|
39
|
+
await paymentCreateCommand({
|
|
40
|
+
json: opts.json,
|
|
41
|
+
partyId: opts.partyId,
|
|
42
|
+
party: opts.party,
|
|
43
|
+
amount: opts.amount,
|
|
44
|
+
mode: opts.mode,
|
|
45
|
+
invoiceId: opts.invoiceId,
|
|
46
|
+
reference: opts.reference,
|
|
47
|
+
date: opts.date,
|
|
48
|
+
notes: opts.notes,
|
|
49
|
+
yes: opts.yes,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
payment
|
|
54
|
+
.command("delete <id>")
|
|
55
|
+
.description("Delete a payment")
|
|
56
|
+
.option("-y, --yes", "Skip confirmation")
|
|
57
|
+
.option("--json", "JSON output")
|
|
58
|
+
.action(async (id, opts) => {
|
|
59
|
+
await paymentDeleteCommand(id, { yes: opts.yes, json: opts.json });
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
payment
|
|
63
|
+
.command("get <id>")
|
|
64
|
+
.description("Get payment details")
|
|
65
|
+
.option("--json", "JSON output")
|
|
66
|
+
.action(async (id, opts) => {
|
|
67
|
+
const { paymentGetCommand } = await import("../../commands/payment/get.js");
|
|
68
|
+
await paymentGetCommand(id, { json: opts.json });
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
payment
|
|
72
|
+
.command("update <id>")
|
|
73
|
+
.description("Update a payment")
|
|
74
|
+
.option("--amount <amount>", "New amount")
|
|
75
|
+
.option("--mode <mode>", "Payment mode: cash, upi, bank, cheque, other")
|
|
76
|
+
.option("--date <YYYY-MM-DD>", "Payment date")
|
|
77
|
+
.option("--reference <ref>", "Reference number (empty string to clear)")
|
|
78
|
+
.option("--notes <text>", "Notes (empty string to clear)")
|
|
79
|
+
.option("--json", "JSON output")
|
|
80
|
+
.action(async (id, opts) => {
|
|
81
|
+
const { paymentUpdateCommand } = await import("../../commands/payment/update.js");
|
|
82
|
+
await paymentUpdateCommand(id, {
|
|
83
|
+
json: opts.json,
|
|
84
|
+
amount: opts.amount,
|
|
85
|
+
mode: opts.mode,
|
|
86
|
+
date: opts.date,
|
|
87
|
+
reference: opts.reference,
|
|
88
|
+
notes: opts.notes,
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
payment
|
|
93
|
+
.command("unpaid-invoices <partyId>")
|
|
94
|
+
.description("List unpaid invoices for a party")
|
|
95
|
+
.option("--json", "JSON output")
|
|
96
|
+
.option("--format <format>", "Output format: table, tsv, csv")
|
|
97
|
+
.action(async (partyId, opts) => {
|
|
98
|
+
const { paymentUnpaidInvoicesCommand } = await import("../../commands/payment/unpaid-invoices.js");
|
|
99
|
+
await paymentUnpaidInvoicesCommand(partyId, { json: opts.json, format: opts.format });
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
payment
|
|
103
|
+
.command("untracked")
|
|
104
|
+
.description("List payments not linked to a bank account")
|
|
105
|
+
.option("--page <n>", "Page number", parseInt)
|
|
106
|
+
.option("--limit <n>", "Items per page", parseInt)
|
|
107
|
+
.option("--json", "JSON output")
|
|
108
|
+
.option("--format <format>", "Output format: table, tsv, csv")
|
|
109
|
+
.action(async (opts) => {
|
|
110
|
+
const { paymentUntrackedCommand } = await import("../../commands/payment/untracked.js");
|
|
111
|
+
await paymentUntrackedCommand({
|
|
112
|
+
json: opts.json,
|
|
113
|
+
format: opts.format,
|
|
114
|
+
page: opts.page,
|
|
115
|
+
limit: opts.limit,
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
payment
|
|
120
|
+
.command("default-account")
|
|
121
|
+
.description("Show recommended bank account for payments")
|
|
122
|
+
.option("--party-id <id>", "Party UUID to scope recommendation")
|
|
123
|
+
.option("--json", "JSON output")
|
|
124
|
+
.action(async (opts) => {
|
|
125
|
+
const { paymentDefaultAccountCommand } = await import("../../commands/payment/default-account.js");
|
|
126
|
+
await paymentDefaultAccountCommand({ json: opts.json, partyId: opts.partyId });
|
|
127
|
+
});
|
|
128
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import {
|
|
3
|
+
reportDaybookCommand, reportOutstandingCommand, reportTaxSummaryCommand,
|
|
4
|
+
reportItemSalesCommand, reportStockSummaryCommand,
|
|
5
|
+
reportSalesRegisterCommand, reportPurchaseRegisterCommand,
|
|
6
|
+
reportPartyStatementCommand, reportPaymentSummaryCommand,
|
|
7
|
+
reportCashFlowCommand, reportCollectionEfficiencyCommand,
|
|
8
|
+
} from "../../commands/report/index.js";
|
|
9
|
+
|
|
10
|
+
export function registerReportCommands(program: Command): void {
|
|
11
|
+
// ── report ────────────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
const report = program.command("report").description("Business reports");
|
|
14
|
+
|
|
15
|
+
report
|
|
16
|
+
.command("daybook")
|
|
17
|
+
.description("Day book report (all transactions)")
|
|
18
|
+
.option("--json", "JSON output")
|
|
19
|
+
.option("--format <format>", "tsv or csv")
|
|
20
|
+
.option("--from <date>", "From date")
|
|
21
|
+
.option("--to <date>", "To date")
|
|
22
|
+
.option("--this-month", "Current month")
|
|
23
|
+
.option("--this-fy", "Current financial year")
|
|
24
|
+
.action(async (opts) => {
|
|
25
|
+
await reportDaybookCommand(opts);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
report
|
|
29
|
+
.command("outstanding")
|
|
30
|
+
.description("Outstanding receivables and payables")
|
|
31
|
+
.option("--json", "JSON output")
|
|
32
|
+
.option("--type <type>", "receivable, payable, or both")
|
|
33
|
+
.action(async (opts) => {
|
|
34
|
+
await reportOutstandingCommand({ json: opts.json, type: opts.type });
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
report
|
|
38
|
+
.command("tax-summary")
|
|
39
|
+
.description("Tax summary by rate")
|
|
40
|
+
.option("--json", "JSON output")
|
|
41
|
+
.option("--from <date>", "From date")
|
|
42
|
+
.option("--to <date>", "To date")
|
|
43
|
+
.option("--this-fy", "Current financial year")
|
|
44
|
+
.action(async (opts) => {
|
|
45
|
+
await reportTaxSummaryCommand(opts);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
report
|
|
49
|
+
.command("item-sales")
|
|
50
|
+
.description("Item sales report")
|
|
51
|
+
.option("--json", "JSON output")
|
|
52
|
+
.option("--from <date>", "From date")
|
|
53
|
+
.option("--to <date>", "To date")
|
|
54
|
+
.option("--this-fy", "Current financial year")
|
|
55
|
+
.action(async (opts) => {
|
|
56
|
+
await reportItemSalesCommand(opts);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
report
|
|
60
|
+
.command("stock")
|
|
61
|
+
.description("Stock summary report")
|
|
62
|
+
.option("--json", "JSON output")
|
|
63
|
+
.option("--category <cat>", "Filter by category")
|
|
64
|
+
.action(async (opts) => {
|
|
65
|
+
await reportStockSummaryCommand({ json: opts.json, category: opts.category });
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
report
|
|
69
|
+
.command("sales-register")
|
|
70
|
+
.description("Sales invoice listing")
|
|
71
|
+
.option("--json", "JSON output")
|
|
72
|
+
.option("--format <format>", "table, tsv or csv")
|
|
73
|
+
.option("--from <date>", "From date")
|
|
74
|
+
.option("--to <date>", "To date")
|
|
75
|
+
.option("--this-month", "Current month")
|
|
76
|
+
.option("--this-fy", "Current financial year")
|
|
77
|
+
.option("--party-id <id>", "Filter by party ID")
|
|
78
|
+
.action(async (opts) => {
|
|
79
|
+
await reportSalesRegisterCommand(opts);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
report
|
|
83
|
+
.command("purchase-register")
|
|
84
|
+
.description("Purchase invoice listing")
|
|
85
|
+
.option("--json", "JSON output")
|
|
86
|
+
.option("--format <format>", "table, tsv or csv")
|
|
87
|
+
.option("--from <date>", "From date")
|
|
88
|
+
.option("--to <date>", "To date")
|
|
89
|
+
.option("--this-month", "Current month")
|
|
90
|
+
.option("--this-fy", "Current financial year")
|
|
91
|
+
.option("--party-id <id>", "Filter by party ID")
|
|
92
|
+
.action(async (opts) => {
|
|
93
|
+
await reportPurchaseRegisterCommand(opts);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
report
|
|
97
|
+
.command("party-statement <partyId>")
|
|
98
|
+
.description("Party transaction statement")
|
|
99
|
+
.option("--json", "JSON output")
|
|
100
|
+
.option("--format <format>", "table, tsv or csv")
|
|
101
|
+
.option("--from <date>", "From date")
|
|
102
|
+
.option("--to <date>", "To date")
|
|
103
|
+
.option("--this-month", "Current month")
|
|
104
|
+
.option("--this-fy", "Current financial year")
|
|
105
|
+
.action(async (partyId: string, opts) => {
|
|
106
|
+
await reportPartyStatementCommand(partyId, opts);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
report
|
|
110
|
+
.command("payment-summary")
|
|
111
|
+
.description("Payment summary by mode")
|
|
112
|
+
.option("--json", "JSON output")
|
|
113
|
+
.option("--format <format>", "table, tsv or csv")
|
|
114
|
+
.option("--from <date>", "From date")
|
|
115
|
+
.option("--to <date>", "To date")
|
|
116
|
+
.option("--this-month", "Current month")
|
|
117
|
+
.option("--this-fy", "Current financial year")
|
|
118
|
+
.option("--type <type>", "received, made, or both")
|
|
119
|
+
.action(async (opts) => {
|
|
120
|
+
await reportPaymentSummaryCommand(opts);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
report
|
|
124
|
+
.command("cash-flow")
|
|
125
|
+
.description("Cash flow forecast")
|
|
126
|
+
.option("--json", "JSON output")
|
|
127
|
+
.action(async (opts) => {
|
|
128
|
+
await reportCashFlowCommand({ json: opts.json });
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
report
|
|
132
|
+
.command("collection-efficiency")
|
|
133
|
+
.description("Collection efficiency metrics")
|
|
134
|
+
.option("--json", "JSON output")
|
|
135
|
+
.option("--from <date>", "From date")
|
|
136
|
+
.option("--to <date>", "To date")
|
|
137
|
+
.option("--this-month", "Current month")
|
|
138
|
+
.option("--this-fy", "Current financial year")
|
|
139
|
+
.action(async (opts) => {
|
|
140
|
+
await reportCollectionEfficiencyCommand(opts);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
export function registerSessionCommands(program: Command): void {
|
|
4
|
+
const session = program.command("session").description("Manage active sessions");
|
|
5
|
+
|
|
6
|
+
session
|
|
7
|
+
.command("list")
|
|
8
|
+
.description("List active sessions")
|
|
9
|
+
.option("--expired", "Show expired sessions instead")
|
|
10
|
+
.option("--json", "JSON output")
|
|
11
|
+
.action(async (opts) => {
|
|
12
|
+
const { listSessionsCommand } = await import("../../commands/session/list.js");
|
|
13
|
+
await listSessionsCommand(opts);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
session
|
|
17
|
+
.command("revoke <sessionId>")
|
|
18
|
+
.description("Revoke a specific session")
|
|
19
|
+
.option("--json", "JSON output")
|
|
20
|
+
.action(async (sessionId, opts) => {
|
|
21
|
+
const { revokeSessionCommand } = await import("../../commands/session/revoke.js");
|
|
22
|
+
await revokeSessionCommand(sessionId, opts);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
session
|
|
26
|
+
.command("revoke-all")
|
|
27
|
+
.description("Sign out from all devices")
|
|
28
|
+
.action(async () => {
|
|
29
|
+
const { revokeAllSessionsCommand } = await import("../../commands/session/revoke-all.js");
|
|
30
|
+
await revokeAllSessionsCommand();
|
|
31
|
+
});
|
|
32
|
+
}
|