@signaliz/cli 1.0.84 → 1.0.85

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/bin.js +49 -4
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @signaliz/cli
2
2
 
3
- The Signaliz CLI exposes the Signaliz core products, Signal Awareness,
3
+ The Signaliz CLI exposes all five core products, Signal Awareness,
4
4
  Signaliz Flow, and delivered managed builds through one public contract:
5
5
 
6
6
  ```bash
package/dist/bin.js CHANGED
@@ -52,8 +52,10 @@ Product commands:
52
52
  signaliz flow --run-id run_... Read a durable Flow checkpoint without dispatching new work
53
53
  signaliz builds list
54
54
  signaliz builds get --build-id BLD-...
55
- signaliz builds run --build-id BLD-... [--input request.json] [--idempotency-key <key>]
55
+ signaliz builds quote --build-id BLD-... [--input request.json]
56
+ signaliz builds run --build-id BLD-... [--input request.json] --confirm-spend --max-credits <number> [--idempotency-key <key>]
56
57
  signaliz builds status --run-id <uuid> [--limit 100]
58
+ signaliz builds download --run-id <uuid> --out results.csv
57
59
 
58
60
  Access and connection:
59
61
  signaliz auth login
@@ -1986,18 +1988,44 @@ async function managedBuilds(args) {
1986
1988
  output(result, () => {
1987
1989
  process.stdout.write(`${result.build.build_id} \u2014 ${result.build.name}
1988
1990
  `);
1989
- process.stdout.write(`Fixed price: ${result.build.fixed_credits_per_run} Signaliz credits/run (${result.build.clay_credits_budget_per_run} Clay-credit budget)
1991
+ process.stdout.write(`Base price: ${result.build.fixed_credits_per_run} Signaliz credits for ${result.build.included_records_per_run} included record(s)
1992
+ `);
1993
+ process.stdout.write(`Additional records: ${result.build.additional_record_credits} Signaliz credits each \xB7 max ${result.build.max_records_per_run}
1994
+ `);
1995
+ process.stdout.write(`Estimated Clay use: ${result.build.clay_credits_budget_per_run} base + ${result.build.additional_clay_credits_per_record} per additional record
1990
1996
  `);
1991
1997
  if (result.build.delivery_notes) process.stdout.write(`${result.build.delivery_notes}
1992
1998
  `);
1993
1999
  });
1994
2000
  return;
1995
2001
  }
2002
+ if (action === "quote") {
2003
+ const buildId = flag("build-id");
2004
+ if (!buildId) throw new CliInputError("signaliz builds quote requires --build-id BLD-...");
2005
+ const result = await client.quoteManagedBuildRun(buildId, readManagedBuildInput());
2006
+ output(result, () => {
2007
+ process.stdout.write(`${result.quote.item_count} record(s): ${result.quote.total_signaliz_credits} Signaliz credits
2008
+ `);
2009
+ process.stdout.write(`Estimated Clay consumption: ${result.quote.estimated_clay_credits} credits
2010
+ `);
2011
+ process.stdout.write("No run created and no credits charged.\n");
2012
+ });
2013
+ return;
2014
+ }
1996
2015
  if (action === "run") {
1997
2016
  const buildId = flag("build-id");
1998
2017
  if (!buildId) throw new CliInputError("signaliz builds run requires --build-id BLD-...");
1999
- const result = await client.runManagedBuild(buildId, readManagedBuildInput(), flag("idempotency-key"));
2018
+ const maxCredits = numberFlag("max-credits");
2019
+ if (!hasFlag("confirm-spend") || maxCredits === void 0) {
2020
+ throw new CliInputError("Live managed-build runs require --confirm-spend and --max-credits <number>. Use builds quote first.");
2021
+ }
2022
+ const result = await client.runManagedBuild(buildId, readManagedBuildInput(), {
2023
+ idempotencyKey: flag("idempotency-key"),
2024
+ confirmSpend: true,
2025
+ maxCredits
2026
+ });
2000
2027
  output(result, () => {
2028
+ if (!result.run) throw new CliInputError(result.message || "Managed build was not queued.");
2001
2029
  process.stdout.write(`Managed build queued: ${result.run.run_id}
2002
2030
  `);
2003
2031
  process.stdout.write(`Charged: ${result.run.fixed_credits_charged} Signaliz credits (${result.run.billing_status})
@@ -2017,13 +2045,30 @@ async function managedBuilds(args) {
2017
2045
  process.stdout.write(`${result.run.build_id} run ${result.run.run_id}: ${result.run.status}
2018
2046
  `);
2019
2047
  process.stdout.write(`Results returned: ${result.returned || 0}
2048
+ `);
2049
+ const csv = result.artifacts?.csv?.download_url;
2050
+ if (csv) process.stdout.write(`CSV: ${csv}
2020
2051
  `);
2021
2052
  if (result.run.error) process.stdout.write(`Error: ${result.run.error}
2022
2053
  `);
2023
2054
  });
2024
2055
  return;
2025
2056
  }
2026
- throw new CliInputError("Usage: signaliz builds list|get|run|status");
2057
+ if (action === "download") {
2058
+ const runId = flag("run-id");
2059
+ const out = flag("out");
2060
+ if (!runId || !out) throw new CliInputError("signaliz builds download requires --run-id <uuid> --out results.csv");
2061
+ const result = await client.getManagedBuildRun(runId, 1);
2062
+ const url = result.artifacts?.csv?.download_url;
2063
+ if (!url) throw new CliInputError("This run does not have a CSV artifact yet. Check builds status first.");
2064
+ const response = await fetch(url);
2065
+ if (!response.ok) throw new Error(`CSV download failed (HTTP ${response.status}).`);
2066
+ (0, import_node_fs.writeFileSync)(out, Buffer.from(await response.arrayBuffer()));
2067
+ output({ success: true, run_id: runId, path: out }, () => process.stdout.write(`Saved ${out}
2068
+ `));
2069
+ return;
2070
+ }
2071
+ throw new CliInputError("Usage: signaliz builds list|get|quote|run|status|download");
2027
2072
  }
2028
2073
  async function main() {
2029
2074
  const [, , command, ...args] = process.argv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signaliz/cli",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "Signaliz CLI for core products, Signal Awareness, Signaliz Flow, and reusable managed builds.",
5
5
  "bin": {
6
6
  "signaliz": "dist/bin.js"
@@ -29,7 +29,7 @@
29
29
  "node": ">=18"
30
30
  },
31
31
  "dependencies": {
32
- "@signaliz/sdk": "^1.0.88"
32
+ "@signaliz/sdk": "^1.0.89"
33
33
  },
34
34
  "devDependencies": {
35
35
  "tsup": "^8.0.0",