@helm-ai/cli 1.3.0 → 1.5.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 +25 -4
- 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 = "1.
|
|
28
|
+
var version = "1.5.0";
|
|
29
29
|
|
|
30
30
|
// src/commands/auth.ts
|
|
31
31
|
import prompts from "prompts";
|
|
@@ -67,6 +67,16 @@ var HelmModuleDisabledError = class extends HelmError {
|
|
|
67
67
|
}
|
|
68
68
|
module;
|
|
69
69
|
};
|
|
70
|
+
var HelmAccessDeniedError = class extends HelmError {
|
|
71
|
+
constructor(area, level, message) {
|
|
72
|
+
super(message);
|
|
73
|
+
this.area = area;
|
|
74
|
+
this.level = level;
|
|
75
|
+
this.name = "HelmAccessDeniedError";
|
|
76
|
+
}
|
|
77
|
+
area;
|
|
78
|
+
level;
|
|
79
|
+
};
|
|
70
80
|
var HelmValidationError = class extends HelmError {
|
|
71
81
|
constructor(message) {
|
|
72
82
|
super(message);
|
|
@@ -81,6 +91,14 @@ var HelmNetworkError = class extends HelmError {
|
|
|
81
91
|
};
|
|
82
92
|
function parseApiError(status, body) {
|
|
83
93
|
const errMsg = body?.error || body?.message || `Request failed with status ${status}`;
|
|
94
|
+
const accessMatch = errMsg.match(/^ACCESS_DENIED:(\w+):(\w+)(?: - (.*))?/s);
|
|
95
|
+
if (accessMatch) {
|
|
96
|
+
return new HelmAccessDeniedError(
|
|
97
|
+
accessMatch[1],
|
|
98
|
+
accessMatch[2],
|
|
99
|
+
accessMatch[3] || "You don't have access to that part of this workspace."
|
|
100
|
+
);
|
|
101
|
+
}
|
|
84
102
|
if (status === 401 || status === 403) {
|
|
85
103
|
return new HelmAuthError(errMsg);
|
|
86
104
|
}
|
|
@@ -2671,11 +2689,13 @@ function registerInvoiceCommands(parent) {
|
|
|
2671
2689
|
return;
|
|
2672
2690
|
}
|
|
2673
2691
|
});
|
|
2674
|
-
cmd.command("create").description("Create an invoice").requiredOption("-t, --title <title>", "invoice title (required)").option("-d, --description <text>").option("-C, --company <id>").option("--deal <id>", "deal this invoice bills against").option("-i, --item <item>", LINE_ITEM_HELP, collectLineItem).option("--items <path>", LINE_ITEMS_FILE_HELP).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>").addHelpText("after", `
|
|
2692
|
+
cmd.command("create").description("Create an invoice").requiredOption("-t, --title <title>", "invoice title (required)").option("-d, --description <text>").option("-C, --company <id>").option("--deal <id>", "deal this invoice bills against").option("-i, --item <item>", LINE_ITEM_HELP, collectLineItem).option("--items <path>", LINE_ITEMS_FILE_HELP).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("--already-billed", "record a bill the client already got another way (text, paper); saved as open, so it counts as owed. Nothing is sent").option("-p, --profile <name>").addHelpText("after", `
|
|
2675
2693
|
Examples:
|
|
2676
2694
|
helm-ai invoice create -t "October retainer" -C <company-id> \\
|
|
2677
2695
|
--item "Development|10|150" --item "Hosting|49"
|
|
2678
|
-
helm-ai invoice create -t "October retainer" -C <company-id> --items items.json
|
|
2696
|
+
helm-ai invoice create -t "October retainer" -C <company-id> --items items.json
|
|
2697
|
+
helm-ai invoice create -t "October pool service" -C <company-id> \\
|
|
2698
|
+
--item "Weekly service|1|180" --due-date 2026-11-01 --already-billed`).action(async (opts) => {
|
|
2679
2699
|
try {
|
|
2680
2700
|
const client = HelmClient.fromProfile(resolveProfile(opts.profile));
|
|
2681
2701
|
const invoice = await client.invoices.create({
|
|
@@ -2688,7 +2708,8 @@ Examples:
|
|
|
2688
2708
|
issue_date: opts.issueDate,
|
|
2689
2709
|
due_date: opts.dueDate,
|
|
2690
2710
|
notes: opts.notes,
|
|
2691
|
-
internal_notes: opts.internalNotes
|
|
2711
|
+
internal_notes: opts.internalNotes,
|
|
2712
|
+
...opts.alreadyBilled ? { already_billed: true } : {}
|
|
2692
2713
|
});
|
|
2693
2714
|
console.log(JSON.stringify(invoice, null, 2));
|
|
2694
2715
|
} catch (err) {
|