windmill-cli 1.668.1 → 1.668.2

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 (2) hide show
  1. package/esm/main.js +61 -10
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -11812,7 +11812,7 @@ var init_OpenAPI = __esm(() => {
11812
11812
  PASSWORD: undefined,
11813
11813
  TOKEN: getEnv2("WM_TOKEN"),
11814
11814
  USERNAME: undefined,
11815
- VERSION: "1.668.1",
11815
+ VERSION: "1.668.2",
11816
11816
  WITH_CREDENTIALS: true,
11817
11817
  interceptors: {
11818
11818
  request: new Interceptors,
@@ -24777,6 +24777,13 @@ function capitalize(str) {
24777
24777
  function formatTimestamp(ts) {
24778
24778
  return new Date(ts).toISOString().replace("T", " ").substring(0, 19);
24779
24779
  }
24780
+ function validateRequiredArgs(schema) {
24781
+ const required = schema?.required ?? [];
24782
+ if (required.length > 0) {
24783
+ throw new Error(`Missing required arguments: ${required.join(", ")}.
24784
+ Use -d '{"${required[0]}": ...}' to provide input data.`);
24785
+ }
24786
+ }
24780
24787
  var isWin = undefined;
24781
24788
  var init_utils = __esm(async () => {
24782
24789
  init_colors2();
@@ -31089,7 +31096,8 @@ async function ensureNodeModules(appDir) {
31089
31096
  }
31090
31097
  async function createBundle(options = {}) {
31091
31098
  const esbuild = await import("esbuild");
31092
- const frameworks = detectFrameworks(process11.cwd());
31099
+ const appDir = options.entryPoint ? path3.dirname(options.entryPoint) : process11.cwd();
31100
+ const frameworks = detectFrameworks(appDir);
31093
31101
  const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
31094
31102
  const entryPoint = options.entryPoint ?? defaultEntry;
31095
31103
  const outDir = options.outDir ?? "dist";
@@ -31099,7 +31107,6 @@ async function createBundle(options = {}) {
31099
31107
  if (!fs7.existsSync(entryPoint)) {
31100
31108
  throw new Error(`Entry point "${entryPoint}" not found. Please ensure the file exists.`);
31101
31109
  }
31102
- const appDir = path3.dirname(entryPoint) || process11.cwd();
31103
31110
  await ensureNodeModules(appDir);
31104
31111
  const frameworkPlugins = await createFrameworkPlugins(appDir);
31105
31112
  const distDir = path3.join(process11.cwd(), outDir);
@@ -59227,7 +59234,7 @@ async function push(opts, filePath) {
59227
59234
  }
59228
59235
  } catch {}
59229
59236
  const codebases = await listSyncCodebases(opts);
59230
- await handleFile(filePath, workspace, [], undefined, opts, await getRawWorkspaceDependencies(true), codebases);
59237
+ await handleFile(filePath, workspace, [], opts.message, opts, await getRawWorkspaceDependencies(true), codebases);
59231
59238
  info(colors.bold.underline.green(`Script ${filePath} pushed`));
59232
59239
  }
59233
59240
  async function findResourceFile(path6) {
@@ -59649,6 +59656,19 @@ async function run2(opts, path6) {
59649
59656
  const workspace = await resolveWorkspace(opts);
59650
59657
  await requireLogin(opts);
59651
59658
  const input = opts.data ? await resolve6(opts.data) : {};
59659
+ if (!opts.data) {
59660
+ try {
59661
+ const script = await getScriptByPath({
59662
+ workspace: workspace.workspaceId,
59663
+ path: path6
59664
+ });
59665
+ validateRequiredArgs(script.schema);
59666
+ } catch (e) {
59667
+ if (e.message?.startsWith("Missing required"))
59668
+ throw e;
59669
+ warn(`Could not fetch schema to validate args: ${e.message}`);
59670
+ }
59671
+ }
59652
59672
  let id;
59653
59673
  try {
59654
59674
  id = await runScriptByPath({
@@ -60083,9 +60103,10 @@ async function history(opts, scriptPath) {
60083
60103
  info("No version history found for " + scriptPath);
60084
60104
  return;
60085
60105
  }
60086
- new Table2().header(["#", "Hash", "Deployment Message"]).padding(2).border(true).body(versions.map((v, i) => [
60106
+ new Table2().header(["#", "Hash", "Created At", "Deployment Message"]).padding(2).border(true).body(versions.map((v, i) => [
60087
60107
  String(versions.length - i),
60088
60108
  v.script_hash,
60109
+ v.created_at ? new Date(v.created_at).toLocaleString() : "-",
60089
60110
  v.deployment_msg ?? "-"
60090
60111
  ])).render();
60091
60112
  }
@@ -60146,7 +60167,7 @@ var init_script = __esm(async () => {
60146
60167
  languageAliases = {
60147
60168
  python: "python3"
60148
60169
  };
60149
- command3 = new Command().description("script related commands").option("--show-archived", "Enable archived scripts in output").option("--json", "Output as JSON (for piping to jq)").action(list3).command("list", "list all scripts").option("--show-archived", "Enable archived scripts in output").option("--json", "Output as JSON (for piping to jq)").action(list3).command("push", "push a local script spec. This overrides any remote versions. Use the script file (.ts, .js, .py, .sh)").arguments("<path:file>").action(push).command("get", "get a script's details").arguments("<path:file>").option("--json", "Output as JSON (for piping to jq)").action(get).command("show", "show a script's content (alias for get)").arguments("<path:file>").action(show).command("run", "run a script by path").arguments("<path:file>").option("-d --data <data:file>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other then the final output. Useful for scripting.").action(run2).command("preview", "preview a local script without deploying it. Supports both regular and codebase scripts.").arguments("<path:file>").option("-d --data <data:file>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other than the final output. Useful for scripting.").action(preview).command("new", "create a new script").arguments("<path:file> <language:string>").option("--summary <summary:string>", "script summary").option("--description <description:string>", "script description").action(bootstrap).command("bootstrap", "create a new script (alias for new)").arguments("<path:file> <language:string>").option("--summary <summary:string>", "script summary").option("--description <description:string>", "script description").action(bootstrap).command("generate-metadata", "re-generate the metadata file updating the lock and the script schema (for flows, use `wmill flow generate-locks`)").arguments("[script:file]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("--lock-only", "re-generate only the lock").option("--schema-only", "re-generate only script schema").option("-i --includes <patterns:file[]>", "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)").option("-e --excludes <patterns:file[]>", "Comma separated patterns to specify which file to NOT take into account.").action(generateMetadata).command("history", "show version history for a script").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(history);
60170
+ command3 = new Command().description("script related commands").option("--show-archived", "Enable archived scripts in output").option("--json", "Output as JSON (for piping to jq)").action(list3).command("list", "list all scripts").option("--show-archived", "Enable archived scripts in output").option("--json", "Output as JSON (for piping to jq)").action(list3).command("push", "push a local script spec. This overrides any remote versions. Use the script file (.ts, .js, .py, .sh)").arguments("<path:file>").option("--message <message:string>", "Deployment message").action(push).command("get", "get a script's details").arguments("<path:file>").option("--json", "Output as JSON (for piping to jq)").action(get).command("show", "show a script's content (alias for get)").arguments("<path:file>").action(show).command("run", "run a script by path").arguments("<path:file>").option("-d --data <data:file>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other then the final output. Useful for scripting.").action(run2).command("preview", "preview a local script without deploying it. Supports both regular and codebase scripts.").arguments("<path:file>").option("-d --data <data:file>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other than the final output. Useful for scripting.").action(preview).command("new", "create a new script").arguments("<path:file> <language:string>").option("--summary <summary:string>", "script summary").option("--description <description:string>", "script description").action(bootstrap).command("bootstrap", "create a new script (alias for new)").arguments("<path:file> <language:string>").option("--summary <summary:string>", "script summary").option("--description <description:string>", "script description").action(bootstrap).command("generate-metadata", "re-generate the metadata file updating the lock and the script schema (for flows, use `wmill flow generate-locks`)").arguments("[script:file]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("--lock-only", "re-generate only the lock").option("--schema-only", "re-generate only script schema").option("-i --includes <patterns:file[]>", "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)").option("-e --excludes <patterns:file[]>", "Comma separated patterns to specify which file to NOT take into account.").action(generateMetadata).command("history", "show version history for a script").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(history);
60150
60171
  script_default = command3;
60151
60172
  });
60152
60173
 
@@ -66945,7 +66966,11 @@ async function validateBuild(appDir) {
66945
66966
  const warnings = [];
66946
66967
  try {
66947
66968
  info(colors.blue("\uD83D\uDD28 Testing build..."));
66969
+ const frameworks = detectFrameworks(appDir);
66970
+ const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
66971
+ const entryPoint = path14.join(appDir, entryFile);
66948
66972
  await createBundle({
66973
+ entryPoint,
66949
66974
  production: true,
66950
66975
  minify: false
66951
66976
  });
@@ -70989,7 +71014,7 @@ async function push11(opts, filePath, remotePath) {
70989
71014
  }
70990
71015
  const workspace = await resolveWorkspace(opts);
70991
71016
  await requireLogin(opts);
70992
- await pushFlow(workspace.workspaceId, remotePath, filePath);
71017
+ await pushFlow(workspace.workspaceId, remotePath, filePath, opts.message);
70993
71018
  info(colors.bold.underline.green("Flow pushed"));
70994
71019
  }
70995
71020
  async function list12(opts) {
@@ -71055,6 +71080,19 @@ async function run3(opts, path19) {
71055
71080
  const workspace = await resolveWorkspace(opts);
71056
71081
  await requireLogin(opts);
71057
71082
  const input = opts.data ? await resolve6(opts.data) : {};
71083
+ if (!opts.data) {
71084
+ try {
71085
+ const flow = await getFlowByPath({
71086
+ workspace: workspace.workspaceId,
71087
+ path: path19
71088
+ });
71089
+ validateRequiredArgs(flow.schema);
71090
+ } catch (e) {
71091
+ if (e.message?.startsWith("Missing required"))
71092
+ throw e;
71093
+ warn(`Could not fetch schema to validate args: ${e.message}`);
71094
+ }
71095
+ }
71058
71096
  const id = await runFlowByPath({
71059
71097
  workspace: workspace.workspaceId,
71060
71098
  path: path19,
@@ -71182,6 +71220,16 @@ async function preview2(opts, flowPath) {
71182
71220
  });
71183
71221
  } catch (e) {
71184
71222
  if (e.body) {
71223
+ if (e.body.result !== undefined) {
71224
+ if (opts.silent) {
71225
+ console.log(JSON.stringify(e.body.result));
71226
+ } else {
71227
+ info(colors.yellow.bold("Flow failed, error handler result:"));
71228
+ info(JSON.stringify(e.body.result, null, 2));
71229
+ }
71230
+ process.exitCode = 1;
71231
+ return;
71232
+ }
71185
71233
  error(`Flow preview failed: ${JSON.stringify(e.body)}`);
71186
71234
  }
71187
71235
  throw e;
@@ -71311,6 +71359,7 @@ var init_flow = __esm(async () => {
71311
71359
  await __promiseAll([
71312
71360
  init_types(),
71313
71361
  init_confirm(),
71362
+ init_utils(),
71314
71363
  init_auth(),
71315
71364
  init_context(),
71316
71365
  init_script(),
@@ -71323,7 +71372,7 @@ var init_flow = __esm(async () => {
71323
71372
  ]);
71324
71373
  import_yaml36 = __toESM(require_dist(), 1);
71325
71374
  alreadySynced3 = [];
71326
- command21 = new Command().description("flow related commands").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("list", "list all flows").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("get", "get a flow's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get9).command("push", "push a local flow spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").action(push11).command("run", "run a flow by path.").arguments("<path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not ouput anything other then the final output. Useful for scripting.").action(run3).command("preview", "preview a local flow without deploying it. Runs the flow definition from local files and uses local PathScripts by default.").arguments("<flow_path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other then the final output. Useful for scripting.").option("--remote", "Use deployed workspace scripts for PathScript steps instead of local files.").action(preview2).command("generate-locks", "re-generate the lock files of all inline scripts of all updated flows").arguments("[flow:file]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("-i --includes <patterns:file[]>", "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)").option("-e --excludes <patterns:file[]>", "Comma separated patterns to specify which file to NOT take into account.").action(generateLocks).command("new", "create a new empty flow").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("bootstrap", "create a new empty flow (alias for new)").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("history", "Show version history for a flow").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(history2).command("show-version", "Show a specific version of a flow").arguments("<path:string> <version:string>").option("--json", "Output as JSON (for piping to jq)").action(showVersion);
71375
+ command21 = new Command().description("flow related commands").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("list", "list all flows").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("get", "get a flow's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get9).command("push", "push a local flow spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").option("--message <message:string>", "Deployment message").action(push11).command("run", "run a flow by path.").arguments("<path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not ouput anything other then the final output. Useful for scripting.").action(run3).command("preview", "preview a local flow without deploying it. Runs the flow definition from local files and uses local PathScripts by default.").arguments("<flow_path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other then the final output. Useful for scripting.").option("--remote", "Use deployed workspace scripts for PathScript steps instead of local files.").action(preview2).command("generate-locks", "re-generate the lock files of all inline scripts of all updated flows").arguments("[flow:file]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("-i --includes <patterns:file[]>", "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)").option("-e --excludes <patterns:file[]>", "Comma separated patterns to specify which file to NOT take into account.").action(generateLocks).command("new", "create a new empty flow").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("bootstrap", "create a new empty flow (alias for new)").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("history", "Show version history for a flow").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(history2).command("show-version", "Show a specific version of a flow").arguments("<path:string> <version:string>").option("--json", "Output as JSON (for piping to jq)").action(showVersion);
71327
71376
  flow_default = command21;
71328
71377
  });
71329
71378
 
@@ -79289,6 +79338,7 @@ flow related commands
79289
79338
  - \`flow get <path:string>\` - get a flow's details
79290
79339
  - \`--json\` - Output as JSON (for piping to jq)
79291
79340
  - \`flow push <file_path:string> <remote_path:string>\` - push a local flow spec. This overrides any remote versions.
79341
+ - \`--message <message:string>\` - Deployment message
79292
79342
  - \`flow run <path:string>\` - run a flow by path.
79293
79343
  - \`-d --data <data:string>\` - Inputs specified as a JSON string or a file using @<filename> or stdin using @-.
79294
79344
  - \`-s --silent\` - Do not ouput anything other then the final output. Useful for scripting.
@@ -79567,6 +79617,7 @@ script related commands
79567
79617
  - \`--show-archived\` - Enable archived scripts in output
79568
79618
  - \`--json\` - Output as JSON (for piping to jq)
79569
79619
  - \`script push <path:file>\` - push a local script spec. This overrides any remote versions. Use the script file (.ts, .js, .py, .sh
79620
+ - \`--message <message:string>\` - Deployment message
79570
79621
  - \`script get <path:file>\` - get a script's details
79571
79622
  - \`--json\` - Output as JSON (for piping to jq)
79572
79623
  - \`script show <path:file>\` - show a script's content (alias for get
@@ -81116,7 +81167,7 @@ ${schemaYaml.trim()}
81116
81167
  }
81117
81168
  async function initAction(opts) {
81118
81169
  if (await stat17("wmill.yaml").catch(() => null)) {
81119
- error(colors.red("wmill.yaml already exists"));
81170
+ info("wmill.yaml already exists, skipping config generation");
81120
81171
  } else {
81121
81172
  const { isGitRepository: isGitRepository2, getCurrentGitBranch: getCurrentGitBranch2 } = await Promise.resolve().then(() => (init_git(), exports_git));
81122
81173
  let branchName;
@@ -82215,7 +82266,7 @@ var config_default = command35;
82215
82266
 
82216
82267
  // src/main.ts
82217
82268
  await init_context();
82218
- var VERSION = "1.668.1";
82269
+ var VERSION = "1.668.2";
82219
82270
  var command36 = new Command().name("wmill").action(() => info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`)).description("Windmill CLI").globalOption("--workspace <workspace:string>", "Specify the target workspace. This overrides the default workspace.").globalOption("--debug --verbose", "Show debug/verbose logs").globalOption("--show-diffs", "Show diff informations when syncing (may show sensitive informations)").globalOption("--token <token:string>", "Specify an API token. This will override any stored token.").globalOption("--base-url <baseUrl:string>", "Specify the base URL of the API. If used, --token and --workspace are required and no local remote/workspace already set will be used.").globalOption("--config-dir <configDir:string>", "Specify a custom config directory. Overrides WMILL_CONFIG_DIR environment variable and default ~/.config location.").env("HEADERS <headers:string>", `Specify headers to use for all requests. e.g: "HEADERS='h1: v1, h2: v2'"`).version(VERSION).versionOption(false).command("init", init_default).command("app", app_default).command("flow", flow_default).command("script", script_default).command("workspace", workspace_default).command("resource", resource_default).command("resource-type", resource_type_default).command("user", user_default).command("variable", variable_default).command("hub", hub_default).command("folder", folder_default).command("schedule", schedule_default).command("trigger", trigger_default).command("dev", dev_default2).command("sync", sync_default).command("lint", lint_default).command("gitsync-settings", gitsync_settings_default).command("instance", instance_default).command("worker-groups", worker_groups_default).command("workers", workers_default).command("queues", queues_default).command("dependencies", dependencies_default).command("jobs", jobs_default).command("job", job_default).command("group", group_default).command("audit", audit_default).command("token", token_default).command("generate-metadata", generate_metadata_default).command("docs", docs_default).command("config", config_default).command("version --version", "Show version information").action(async (opts) => {
82220
82271
  console.log("CLI version: " + VERSION);
82221
82272
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.668.1",
3
+ "version": "1.668.2",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",