@helm-ai/cli 0.15.0 → 0.17.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/dist/cli.js +73 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -25,7 +25,7 @@ function renderSplash(ctx) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// src/version.ts
|
|
28
|
-
var version = "0.
|
|
28
|
+
var version = "0.17.0";
|
|
29
29
|
|
|
30
30
|
// src/commands/auth.ts
|
|
31
31
|
import prompts from "prompts";
|
|
@@ -302,7 +302,7 @@ var HelmClient = class _HelmClient {
|
|
|
302
302
|
},
|
|
303
303
|
get: async (dealId) => {
|
|
304
304
|
const data = await this.request("get_deal", "GET", { deal_id: dealId });
|
|
305
|
-
return data.deal;
|
|
305
|
+
return { ...data.deal, revenue: data.revenue };
|
|
306
306
|
},
|
|
307
307
|
create: async (input) => {
|
|
308
308
|
const data = await this.request("add_deal", "POST", input);
|
|
@@ -392,6 +392,16 @@ var HelmClient = class _HelmClient {
|
|
|
392
392
|
return data.invoice;
|
|
393
393
|
}
|
|
394
394
|
};
|
|
395
|
+
payments = {
|
|
396
|
+
list: async (filters = {}) => {
|
|
397
|
+
const data = await this.request("get_payments", "GET", filters);
|
|
398
|
+
return data.payments ?? [];
|
|
399
|
+
},
|
|
400
|
+
record: async (input) => {
|
|
401
|
+
const data = await this.request("record_payment", "POST", input);
|
|
402
|
+
return data.payment;
|
|
403
|
+
}
|
|
404
|
+
};
|
|
395
405
|
estimates = {
|
|
396
406
|
list: async (filters = {}) => {
|
|
397
407
|
const data = await this.request("get_estimates", "GET", filters);
|
|
@@ -2078,12 +2088,13 @@ function registerTimeCommands(parent) {
|
|
|
2078
2088
|
// src/commands/invoice.ts
|
|
2079
2089
|
function registerInvoiceCommands(parent) {
|
|
2080
2090
|
const cmd = parent.command("invoice").alias("invoices").description("Manage invoices");
|
|
2081
|
-
cmd.command("list").description("List invoices").option("-s, --status <status>", "draft|
|
|
2091
|
+
cmd.command("list").description("List invoices").option("-s, --status <status>", "draft|open|partially_paid|paid|archived|cancelled").option("-a, --account <id>").option("--deal <id>", "only invoices billing against this deal").option("-l, --limit <n>", "max rows", (v) => parseInt(v, 10), 50).option("-o, --output <format>").option("-p, --profile <name>").action(async (opts) => {
|
|
2082
2092
|
try {
|
|
2083
2093
|
const client = HelmClient.fromProfile(resolveProfile(opts.profile));
|
|
2084
2094
|
const rows = await client.invoices.list({
|
|
2085
2095
|
status: opts.status,
|
|
2086
2096
|
account_id: opts.account,
|
|
2097
|
+
deal_id: opts.deal,
|
|
2087
2098
|
limit: opts.limit
|
|
2088
2099
|
});
|
|
2089
2100
|
console.log(render(rows, [
|
|
@@ -2111,13 +2122,14 @@ function registerInvoiceCommands(parent) {
|
|
|
2111
2122
|
return;
|
|
2112
2123
|
}
|
|
2113
2124
|
});
|
|
2114
|
-
cmd.command("create").description("Create an invoice").requiredOption("-t, --title <title>", "invoice title (required)").option("-d, --description <text>").option("-a, --account <id>").option("--tax-rate <pct>", "tax rate %", parseFloat).option("--issue-date <date>", "ISO 8601").option("--due-date <date>", "ISO 8601").option("--notes <text>", "client-visible notes").option("--internal-notes <text>").option("-p, --profile <name>").action(async (opts) => {
|
|
2125
|
+
cmd.command("create").description("Create an invoice").requiredOption("-t, --title <title>", "invoice title (required)").option("-d, --description <text>").option("-a, --account <id>").option("--deal <id>", "deal this invoice bills against").option("--tax-rate <pct>", "tax rate %", parseFloat).option("--issue-date <date>", "ISO 8601").option("--due-date <date>", "ISO 8601").option("--notes <text>", "client-visible notes").option("--internal-notes <text>").option("-p, --profile <name>").action(async (opts) => {
|
|
2115
2126
|
try {
|
|
2116
2127
|
const client = HelmClient.fromProfile(resolveProfile(opts.profile));
|
|
2117
2128
|
const invoice = await client.invoices.create({
|
|
2118
2129
|
title: opts.title,
|
|
2119
2130
|
description: opts.description,
|
|
2120
2131
|
account_id: opts.account,
|
|
2132
|
+
deal_id: opts.deal,
|
|
2121
2133
|
tax_rate: opts.taxRate,
|
|
2122
2134
|
issue_date: opts.issueDate,
|
|
2123
2135
|
due_date: opts.dueDate,
|
|
@@ -2131,12 +2143,13 @@ function registerInvoiceCommands(parent) {
|
|
|
2131
2143
|
return;
|
|
2132
2144
|
}
|
|
2133
2145
|
});
|
|
2134
|
-
cmd.command("update <id>").description("Update an invoice").option("-t, --title <title>").option("-s, --status <status>", "draft|
|
|
2146
|
+
cmd.command("update <id>").description("Update an invoice").option("-t, --title <title>").option("-s, --status <status>", "draft|open|partially_paid|paid|archived|cancelled").option("--deal <id>", "deal this invoice bills against").option("--tax-rate <pct>", "", parseFloat).option("--due-date <date>").option("-p, --profile <name>").action(async (id, opts) => {
|
|
2135
2147
|
try {
|
|
2136
2148
|
const client = HelmClient.fromProfile(resolveProfile(opts.profile));
|
|
2137
2149
|
const invoice = await client.invoices.update(id, {
|
|
2138
2150
|
title: opts.title,
|
|
2139
2151
|
status: opts.status,
|
|
2152
|
+
deal_id: opts.deal,
|
|
2140
2153
|
tax_rate: opts.taxRate,
|
|
2141
2154
|
due_date: opts.dueDate
|
|
2142
2155
|
});
|
|
@@ -2149,6 +2162,60 @@ function registerInvoiceCommands(parent) {
|
|
|
2149
2162
|
});
|
|
2150
2163
|
}
|
|
2151
2164
|
|
|
2165
|
+
// src/commands/payment.ts
|
|
2166
|
+
function registerPaymentCommands(parent) {
|
|
2167
|
+
const cmd = parent.command("payment").alias("payments").description("Record and review payments");
|
|
2168
|
+
cmd.command("list").description("List recorded payments").option("-s, --status <status>", "pending|completed|failed|refunded").option("-a, --account <id>").option("-i, --invoice <id>").option("-d, --deal <id>", "only payments attributed to this deal").option("--start <date>", "earliest payment date (YYYY-MM-DD)").option("--end <date>", "latest payment date (YYYY-MM-DD)").option("-l, --limit <n>", "max rows", (v) => parseInt(v, 10), 50).option("-o, --output <format>").option("-p, --profile <name>").action(async (opts) => {
|
|
2169
|
+
try {
|
|
2170
|
+
const client = HelmClient.fromProfile(resolveProfile(opts.profile));
|
|
2171
|
+
const rows = await client.payments.list({
|
|
2172
|
+
status: opts.status,
|
|
2173
|
+
account_id: opts.account,
|
|
2174
|
+
invoice_id: opts.invoice,
|
|
2175
|
+
deal_id: opts.deal,
|
|
2176
|
+
start_date: opts.start,
|
|
2177
|
+
end_date: opts.end,
|
|
2178
|
+
limit: opts.limit
|
|
2179
|
+
});
|
|
2180
|
+
console.log(render(rows, [
|
|
2181
|
+
{ header: "Date", get: (r) => r.payment_date },
|
|
2182
|
+
{ header: "Amount", get: (r) => r.amount != null ? `$${r.amount.toLocaleString()}` : "" },
|
|
2183
|
+
{ header: "Status", get: (r) => r.status },
|
|
2184
|
+
{ header: "Method", get: (r) => r.payment_method ?? "" },
|
|
2185
|
+
{ header: "Reference", get: (r) => r.reference_number ?? "", truncate: 20 },
|
|
2186
|
+
{ header: "Deal", get: (r) => r.deal_id ?? "", truncate: 8 },
|
|
2187
|
+
{ header: "ID", get: (r) => r.id, truncate: 8 }
|
|
2188
|
+
], opts.output ?? defaultFormat()));
|
|
2189
|
+
} catch (err) {
|
|
2190
|
+
console.error(formatErrorForCli(err));
|
|
2191
|
+
process.exitCode = 1;
|
|
2192
|
+
return;
|
|
2193
|
+
}
|
|
2194
|
+
});
|
|
2195
|
+
cmd.command("record").description("Record a payment received (including money captured outside Helm)").requiredOption("--amount <n>", "amount received (required)", parseFloat).option("-i, --invoice <id>", "Helm invoice this settles; totals and status update automatically").option("-d, --deal <id>", "deal to attribute the payment to (inherited from the invoice if given)").option("-a, --account <id>", "client who paid (inherited from the invoice or deal if given)").option("--date <date>", "date received (YYYY-MM-DD), defaults to today").option("-m, --method <method>", "cash|check|credit_card|bank_transfer|stripe|paypal|other").option("-r, --reference <text>", "external reference: check number, transaction id, external system id").option("--description <text>", "what the payment was for").option("--notes <text>", "internal notes").option("-s, --status <status>", "pending|completed|failed|refunded (default completed)").option("-p, --profile <name>").action(async (opts) => {
|
|
2196
|
+
try {
|
|
2197
|
+
const client = HelmClient.fromProfile(resolveProfile(opts.profile));
|
|
2198
|
+
const payment = await client.payments.record({
|
|
2199
|
+
amount: opts.amount,
|
|
2200
|
+
invoice_id: opts.invoice,
|
|
2201
|
+
deal_id: opts.deal,
|
|
2202
|
+
account_id: opts.account,
|
|
2203
|
+
payment_date: opts.date,
|
|
2204
|
+
payment_method: opts.method,
|
|
2205
|
+
reference_number: opts.reference,
|
|
2206
|
+
description: opts.description,
|
|
2207
|
+
notes: opts.notes,
|
|
2208
|
+
status: opts.status
|
|
2209
|
+
});
|
|
2210
|
+
console.log(JSON.stringify(payment, null, 2));
|
|
2211
|
+
} catch (err) {
|
|
2212
|
+
console.error(formatErrorForCli(err));
|
|
2213
|
+
process.exitCode = 1;
|
|
2214
|
+
return;
|
|
2215
|
+
}
|
|
2216
|
+
});
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2152
2219
|
// src/commands/estimate.ts
|
|
2153
2220
|
function registerEstimateCommands(parent) {
|
|
2154
2221
|
const cmd = parent.command("estimate").alias("estimates").description("Manage estimates");
|
|
@@ -3966,6 +4033,7 @@ registerPipelineCommands(program);
|
|
|
3966
4033
|
registerTaskCommands(program);
|
|
3967
4034
|
registerTimeCommands(program);
|
|
3968
4035
|
registerInvoiceCommands(program);
|
|
4036
|
+
registerPaymentCommands(program);
|
|
3969
4037
|
registerEstimateCommands(program);
|
|
3970
4038
|
registerProductCommands(program);
|
|
3971
4039
|
registerFormCommands(program);
|