@nodaro/cli 1.42.0 → 1.45.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/index.js +70 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ var require_package = __commonJS({
|
|
|
41
41
|
"package.json"(exports$1, module) {
|
|
42
42
|
module.exports = {
|
|
43
43
|
name: "@nodaro/cli",
|
|
44
|
-
version: "1.
|
|
44
|
+
version: "1.45.0",
|
|
45
45
|
description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
|
|
46
46
|
type: "module",
|
|
47
47
|
license: "Apache-2.0",
|
|
@@ -82,11 +82,11 @@ var require_package = __commonJS({
|
|
|
82
82
|
"@inquirer/confirm": "^6.0.12",
|
|
83
83
|
"@inquirer/input": "^5.0.12",
|
|
84
84
|
"@inquirer/select": "^5.1.4",
|
|
85
|
-
"@nodaro/sdk": "^2.
|
|
86
|
-
"@nodaro/shared": "^3.
|
|
85
|
+
"@nodaro/sdk": "^2.51.0",
|
|
86
|
+
"@nodaro/shared": "^3.45.0",
|
|
87
87
|
commander: "^12.1.0",
|
|
88
88
|
picocolors: "^1.1.1",
|
|
89
|
-
"@nodaro/prompts": "^1.
|
|
89
|
+
"@nodaro/prompts": "^1.43.0"
|
|
90
90
|
},
|
|
91
91
|
devDependencies: {
|
|
92
92
|
tsup: "^8.5.0",
|
|
@@ -413,7 +413,7 @@ function saveWorkspace(profileName, workspaceId) {
|
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
// src/client.ts
|
|
416
|
-
var CLI_VERSION = "1.
|
|
416
|
+
var CLI_VERSION = "1.45.0" ;
|
|
417
417
|
function buildPublicClient(opts = {}) {
|
|
418
418
|
const { profile } = getProfile(opts.profile);
|
|
419
419
|
return createClient({
|
|
@@ -6098,8 +6098,8 @@ function addRunFlags(cmd) {
|
|
|
6098
6098
|
"--example <n>",
|
|
6099
6099
|
"1-based example whose pictures fill the optional slots you leave empty (default 1); leave it out on a trend with no example, whose empty optional slots stay as in the original"
|
|
6100
6100
|
).option("--details <text>", "your own words (at most 1,000 characters); mention a slot as {slot:<key>}").option("--preview", "a 4-second preview run (only when the trend offers one)").addOption(
|
|
6101
|
-
new Option("--resolution <r>", "one the trend offers (`trends get`); default its first: 480p, or 720p on a Nodaro Motion
|
|
6102
|
-
).option("--no-draft", "a full run instead of a draft (a draft is 480p only, and the default there; a Nodaro Motion
|
|
6101
|
+
new Option("--resolution <r>", "one the trend offers (`trends get`); default its first: 480p, or 720p on a Nodaro Motion Pulse trend").choices([...RESOLUTIONS])
|
|
6102
|
+
).option("--no-draft", "a full run instead of a draft (a draft is 480p only, and the default there; a Nodaro Motion Pulse trend has none)");
|
|
6103
6103
|
}
|
|
6104
6104
|
function checkSlotKey(flag, spec, key2) {
|
|
6105
6105
|
if (!SLOT_KEY_RE.test(key2) || key2 === "__proto__") {
|
|
@@ -6308,7 +6308,7 @@ function trendsCommand() {
|
|
|
6308
6308
|
}
|
|
6309
6309
|
function fullQualityCommand() {
|
|
6310
6310
|
const cmd = new Command("full-quality").description(
|
|
6311
|
-
"finish a run (Nodaro Motion or trend) at Full Quality at 1080p, as a new job: a draft's same take, or a new take of a Nodaro Motion
|
|
6311
|
+
"finish a run (Nodaro Motion or trend) at Full Quality at 1080p, as a new job: a draft's same take, or a new take of a Nodaro Motion Pulse 720p run \u2014 `estimate` quotes it (free), `run` SPENDS CREDITS"
|
|
6312
6312
|
);
|
|
6313
6313
|
cmd.command("estimate <jobId>").description("quote finishing the run at Full Quality (free): same or new take, the credits, and until when it can be finished").option("--profile <name>").option("--json").action(async (jobId, opts) => {
|
|
6314
6314
|
try {
|
|
@@ -8166,6 +8166,26 @@ function editCommand() {
|
|
|
8166
8166
|
);
|
|
8167
8167
|
return cmd;
|
|
8168
8168
|
}
|
|
8169
|
+
var SUMMARY_BUCKETS = ["day", "week", "month"];
|
|
8170
|
+
var HISTORY_KINDS = ["usage", "purchase", "grant", "refund", "app", "adjustment", "expiry"];
|
|
8171
|
+
function historyRow(e) {
|
|
8172
|
+
return {
|
|
8173
|
+
at: e.at.replace("T", " ").slice(0, 16),
|
|
8174
|
+
kind: e.kind,
|
|
8175
|
+
what: e.model ?? e.description ?? e.source,
|
|
8176
|
+
credits: e.kind === "usage" ? e.charge ?? e.amount : e.amount,
|
|
8177
|
+
status: e.status ?? "",
|
|
8178
|
+
balance: e.balanceAfter,
|
|
8179
|
+
job: e.job?.id ?? ""
|
|
8180
|
+
};
|
|
8181
|
+
}
|
|
8182
|
+
function historyOptions(opts) {
|
|
8183
|
+
const kind = opts.kind;
|
|
8184
|
+
if (kind !== void 0 && !HISTORY_KINDS.includes(kind)) throw new Error(`--kind must be one of ${HISTORY_KINDS.join(", ")}`);
|
|
8185
|
+
const limit = opts.limit === void 0 ? void 0 : Number(opts.limit);
|
|
8186
|
+
if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 100)) throw new Error("--limit must be a whole number from 1 to 100");
|
|
8187
|
+
return { kind, model: opts.model, from: opts.since, to: opts.until, q: opts.search, limit, cursor: opts.cursor };
|
|
8188
|
+
}
|
|
8169
8189
|
var GIB = 1024 * 1024 * 1024;
|
|
8170
8190
|
function money(m) {
|
|
8171
8191
|
try {
|
|
@@ -8277,6 +8297,48 @@ Examples:
|
|
|
8277
8297
|
handleError(err);
|
|
8278
8298
|
}
|
|
8279
8299
|
});
|
|
8300
|
+
cmd.command("summary").description("your credit usage over a period: totals, by model, by category, over time, by session and by workflow (Nodaro Cloud)").option("--profile <name>").option("--since <when>", "from this time: an ISO-8601 timestamp, or a date (2026-10-01, that whole UTC day); default 30 days ago").option("--until <when>", "up to this time, the same way; default now").option("--bucket <bucket>", "the series over time by day, week or month, in UTC (default day)").option("--json").action(async (opts) => {
|
|
8301
|
+
try {
|
|
8302
|
+
const bucket = opts.bucket;
|
|
8303
|
+
if (bucket !== void 0 && !SUMMARY_BUCKETS.includes(bucket)) throw new Error(`--bucket must be one of ${SUMMARY_BUCKETS.join(", ")}`);
|
|
8304
|
+
const client = buildClient(opts.profile);
|
|
8305
|
+
const summary = await client.credits.usageSummary({ from: opts.since, to: opts.until, bucket });
|
|
8306
|
+
if (opts.json) {
|
|
8307
|
+
emit(summary, opts);
|
|
8308
|
+
return;
|
|
8309
|
+
}
|
|
8310
|
+
const { totals } = summary;
|
|
8311
|
+
info(`${summary.period.from.slice(0, 10)} to ${summary.period.to.slice(0, 10)}: ${totals.used} credits on ${totals.runs} runs (avg ${totals.avgPerRun}); bought ${totals.purchased}, granted ${totals.granted}, refunded ${totals.refunded}`);
|
|
8312
|
+
if (summary.truncated) dim("(cut at the row cap: the figures under-report; narrow the period)");
|
|
8313
|
+
if (summary.partial) dim("(a side read failed: a grouping is missing or unnamed; the totals are whole)");
|
|
8314
|
+
table(summary.byModel.map((m) => ({ model: m.model, credits: m.credits, runs: m.runs, share: `${Math.round(m.share * 100)}%` })), ["model", "credits", "runs", "share"]);
|
|
8315
|
+
table(summary.overTime.map((b) => ({ [summary.period.bucket]: b.bucket, used: b.used, purchased: b.purchased, runs: b.runs })), [summary.period.bucket, "used", "purchased", "runs"]);
|
|
8316
|
+
if (summary.bySession.length > 0) table(summary.bySession.map((s) => ({ session: s.name ?? s.id, tool: s.tool ?? "", credits: s.credits, runs: s.runs })), ["session", "tool", "credits", "runs"]);
|
|
8317
|
+
if (summary.byWorkflow.length > 0) table(summary.byWorkflow.map((w) => ({ workflow: w.name ?? w.id, credits: w.credits, runs: w.runs })), ["workflow", "credits", "runs"]);
|
|
8318
|
+
} catch (err) {
|
|
8319
|
+
handleError(err);
|
|
8320
|
+
}
|
|
8321
|
+
});
|
|
8322
|
+
cmd.command("history").description("every movement of your balance, newest first, with the balance after each (Nodaro Cloud)").option("--profile <name>").option("--kind <kind>", `only ${HISTORY_KINDS.join(" / ")}`).option("--model <id>", "only runs of this model").option("--since <iso>", "from this time (ISO-8601), inclusive").option("--until <iso>", "up to this time (ISO-8601), inclusive").option("--search <words>", "words in the description").option("--limit <n>", "rows per page, 1\u2013100 (default 50)").option("--cursor <cursor>", "the previous page's nextCursor").option("--csv", "the whole filtered history as CSV (no paging; at most 5,000 rows)").option("--json").action(async (opts) => {
|
|
8323
|
+
try {
|
|
8324
|
+
const client = buildClient(opts.profile);
|
|
8325
|
+
const options = historyOptions(opts);
|
|
8326
|
+
if (opts.csv) {
|
|
8327
|
+
const { limit: _limit, cursor: _cursor, ...filters } = options;
|
|
8328
|
+
process.stdout.write(await client.credits.exportHistory(filters));
|
|
8329
|
+
return;
|
|
8330
|
+
}
|
|
8331
|
+
const page = await client.credits.history(options);
|
|
8332
|
+
if (opts.json) {
|
|
8333
|
+
emit(page, opts);
|
|
8334
|
+
return;
|
|
8335
|
+
}
|
|
8336
|
+
table(page.data.map(historyRow), ["at", "kind", "what", "credits", "status", "balance", "job"]);
|
|
8337
|
+
if (page.nextCursor) dim(`more: --cursor ${page.nextCursor}`);
|
|
8338
|
+
} catch (err) {
|
|
8339
|
+
handleError(err);
|
|
8340
|
+
}
|
|
8341
|
+
});
|
|
8280
8342
|
cmd.command("surface").description("how this deployment bills: whether it meters usage, and the unit costs display in (no sign-in needed)").option("--profile <name>", "ask this profile's instance (its token is not sent)").option("--base-url <url>", "ask this instance instead (default: the profile's, else https://app.nodaro.ai)").option("--json").action(async (opts) => {
|
|
8281
8343
|
try {
|
|
8282
8344
|
const client = buildPublicClient({ profile: opts.profile, baseUrl: opts.baseUrl });
|