@claypi/cli 0.1.2 → 0.1.3

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 CHANGED
@@ -82946,13 +82946,21 @@ function parseBooleanFlag(flagName) {
82946
82946
  throw new InvalidArgumentError(`${flagName} must be true or false`);
82947
82947
  };
82948
82948
  }
82949
+ function isInlineJson(source) {
82950
+ const start = source.trimStart();
82951
+ return start.startsWith("{") || start.startsWith("[");
82952
+ }
82949
82953
  function readJsonFlag(flagName, source) {
82950
82954
  const display = source === "-" ? "stdin" : source;
82951
82955
  let raw;
82952
- try {
82953
- raw = source === "-" ? (0, import_node_fs9.readFileSync)(0, "utf8") : (0, import_node_fs9.readFileSync)(source, "utf8");
82954
- } catch (err) {
82955
- throw new InvalidArgumentError(`${flagName}: could not read ${display} (${err.message})`);
82956
+ if (isInlineJson(source)) {
82957
+ raw = source;
82958
+ } else {
82959
+ try {
82960
+ raw = source === "-" ? (0, import_node_fs9.readFileSync)(0, "utf8") : (0, import_node_fs9.readFileSync)(source, "utf8");
82961
+ } catch (err) {
82962
+ throw new InvalidArgumentError(`${flagName}: could not read ${display} (${err.message})`);
82963
+ }
82956
82964
  }
82957
82965
  const trimmed = raw.trim();
82958
82966
  if (trimmed === "") {
@@ -93196,6 +93204,9 @@ function validateJsonl(buf) {
93196
93204
  }
93197
93205
  function readUtf8Source(flagName, source) {
93198
93206
  const display = source === "-" ? "stdin" : source;
93207
+ if (isInlineJson(source)) {
93208
+ return source;
93209
+ }
93199
93210
  try {
93200
93211
  return source === "-" ? (0, import_node_fs10.readFileSync)(0, "utf8") : (0, import_node_fs10.readFileSync)(source, "utf8");
93201
93212
  } catch (err) {
@@ -93208,7 +93219,7 @@ function buildStartCommand() {
93208
93219
  const cmd = new Command("start");
93209
93220
  cmd.description(
93210
93221
  "Start an async tool run through the API & CLI integration. Returns immediately; this command does not poll or wait."
93211
- ).argument("<toolId>", "Tool id, e.g. function:tbl_abc123").option("--input <file|->", "Inline run body JSON. Use - to read from stdin.").option("--bulk <file.jsonl>", 'Batch run input JSONL file. Each line is { "id": <string>, "inputs": <object> }.').option("--webhook-id <id>", "Registered webhook id (wh_...) to notify when the run finishes.").addHelpText(
93222
+ ).argument("<toolId>", "Tool id, e.g. function:tbl_abc123").option("--input <json|file|->", "Run body JSON: inline JSON, a file path, or - to read from stdin.").option("--bulk <file.jsonl>", 'Batch run input JSONL file. Each line is { "id": <string>, "inputs": <object> }.').option("--webhook-id <id>", "Registered webhook id (wh_...) to notify when the run finishes.").addHelpText(
93212
93223
  "after",
93213
93224
  `
93214
93225
  Output (success, exit 0):
@@ -93231,6 +93242,7 @@ Common errors:
93231
93242
  Examples:
93232
93243
  $ clay tools update function:tbl_x --integrations api
93233
93244
  $ cat input.json | clay tools runs start function:tbl_x --input -
93245
+ $ clay tools runs start function:tbl_x --input '{"items":[{"id":"r1","inputs":{}}]}' | jq -r '.toolRunId'
93234
93246
  $ clay tools runs start function:tbl_x --input input.json | jq -r '.toolRunId'
93235
93247
  $ clay tools runs start function:tbl_x --input input.json --webhook-id wh_abc123 | jq -r '.toolRunId'
93236
93248
  $ clay tools runs start function:tbl_x --bulk rows.jsonl
@@ -96584,7 +96596,10 @@ function readRunInputs(source) {
96584
96596
  // src/commands/workflows/runs/start.ts
96585
96597
  function buildStartCommand2() {
96586
96598
  const cmd = new Command("start");
96587
- cmd.description("Start a workflow run. Returns immediately; this command does not poll or wait.").argument("<workflowId>", "Workflow id, e.g. wf_abc123").option("--input <file|->", "Workflow input JSON object. Use - to read from stdin. Defaults to {}.").addHelpText(
96599
+ cmd.description("Start a workflow run. Returns immediately; this command does not poll or wait.").argument("<workflowId>", "Workflow id, e.g. wf_abc123").option(
96600
+ "--input <json|file|->",
96601
+ "Workflow input JSON object: inline JSON, a file path, or - to read from stdin. Defaults to {}."
96602
+ ).addHelpText(
96588
96603
  "after",
96589
96604
  `
96590
96605
  Output (success, exit 0):
@@ -96610,6 +96625,7 @@ Common errors:
96610
96625
 
96611
96626
  Examples:
96612
96627
  $ clay workflows runs start wf_abc123 | jq -r '.runId'
96628
+ $ clay workflows runs start wf_abc123 --input '{"domain":"clay.com"}'
96613
96629
  $ echo '{"domain":"clay.com"}' | clay workflows runs start wf_abc123 --input -
96614
96630
  $ clay workflows runs start wf_abc123 --input inputs.json
96615
96631
  `