@helm-ai/cli 0.27.0 → 0.28.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 +49 -1
- 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.28.0";
|
|
29
29
|
|
|
30
30
|
// src/commands/auth.ts
|
|
31
31
|
import prompts from "prompts";
|
|
@@ -362,6 +362,13 @@ var HelmClient = class _HelmClient {
|
|
|
362
362
|
return data.pipeline;
|
|
363
363
|
}
|
|
364
364
|
};
|
|
365
|
+
hours = {
|
|
366
|
+
/** Hour-plan balances, computed by the server. Filters are ANDed. */
|
|
367
|
+
balance: async (filters = {}) => {
|
|
368
|
+
const data = await this.request("get_hour_balance", "GET", filters);
|
|
369
|
+
return { plans: data.plans ?? [], message: data.message };
|
|
370
|
+
}
|
|
371
|
+
};
|
|
365
372
|
timeEntries = {
|
|
366
373
|
list: async (filters = {}) => {
|
|
367
374
|
const data = await this.request("get_time_entries", "GET", filters);
|
|
@@ -2222,6 +2229,46 @@ function registerTimeCommands(parent) {
|
|
|
2222
2229
|
});
|
|
2223
2230
|
}
|
|
2224
2231
|
|
|
2232
|
+
// src/commands/hours.ts
|
|
2233
|
+
var TYPE_LABELS = {
|
|
2234
|
+
monthly: "Monthly",
|
|
2235
|
+
quarterly: "Quarterly",
|
|
2236
|
+
hours_as_needed: "As needed"
|
|
2237
|
+
};
|
|
2238
|
+
function registerHoursCommands(parent) {
|
|
2239
|
+
const cmd = parent.command("hours").description("Clients' hour plans: prepaid and monthly hours");
|
|
2240
|
+
cmd.command("balance").description("Hours available, used and left on hour plans (every live plan by default)").option("--project <id>", "the plan this project draws from").option("--account <id>", "a client's plans").option("--plan <id>", "one plan, including an ended one").option("-o, --output <format>").option("-p, --profile <name>").action(async (opts) => {
|
|
2241
|
+
try {
|
|
2242
|
+
const client = HelmClient.fromProfile(resolveProfile(opts.profile));
|
|
2243
|
+
const { plans, message } = await client.hours.balance({
|
|
2244
|
+
project_id: opts.project,
|
|
2245
|
+
account_id: opts.account,
|
|
2246
|
+
plan_id: opts.plan
|
|
2247
|
+
});
|
|
2248
|
+
const format = opts.output ?? defaultFormat();
|
|
2249
|
+
if (plans.length === 0 && format === "table") {
|
|
2250
|
+
console.log(message ?? "No hour plans found.");
|
|
2251
|
+
return;
|
|
2252
|
+
}
|
|
2253
|
+
console.log(render(plans, [
|
|
2254
|
+
{ header: "Client", get: (p) => p.client.name ?? "", truncate: 28 },
|
|
2255
|
+
{ header: "Plan", get: (p) => p.name, truncate: 32 },
|
|
2256
|
+
{ header: "Type", get: (p) => TYPE_LABELS[p.type] ?? p.type },
|
|
2257
|
+
{ header: "Left", get: (p) => `${p.hours.left}h` },
|
|
2258
|
+
{ header: "Available", get: (p) => `${p.hours.available}h` },
|
|
2259
|
+
{ header: "Used", get: (p) => `${p.hours.used}h` },
|
|
2260
|
+
{ header: "Over", get: (p) => p.hours.over > 0 ? `${p.hours.over}h` : "" },
|
|
2261
|
+
{ header: "Resets", get: (p) => p.period?.resets_on ?? "" },
|
|
2262
|
+
{ header: "Status", get: (p) => p.status !== "active" ? p.status : p.out_of_hours ? "out of hours" : p.low_balance ? "low" : "" },
|
|
2263
|
+
{ header: "ID", get: (p) => p.plan_id, truncate: 8 }
|
|
2264
|
+
], format));
|
|
2265
|
+
} catch (err) {
|
|
2266
|
+
console.error(formatErrorForCli(err));
|
|
2267
|
+
process.exitCode = 1;
|
|
2268
|
+
}
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2225
2272
|
// src/lib/line-items.ts
|
|
2226
2273
|
import { readFileSync as readFileSync2 } from "fs";
|
|
2227
2274
|
import { InvalidArgumentError } from "commander";
|
|
@@ -4657,6 +4704,7 @@ registerDealCommands(program);
|
|
|
4657
4704
|
registerPipelineCommands(program);
|
|
4658
4705
|
registerTaskCommands(program);
|
|
4659
4706
|
registerTimeCommands(program);
|
|
4707
|
+
registerHoursCommands(program);
|
|
4660
4708
|
registerInvoiceCommands(program);
|
|
4661
4709
|
registerPaymentCommands(program);
|
|
4662
4710
|
registerSubscriptionCommands(program);
|