windmill-cli 1.668.2 → 1.668.4

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 +155 -78
  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.2",
11815
+ VERSION: "1.668.4",
11816
11816
  WITH_CREDENTIALS: true,
11817
11817
  interceptors: {
11818
11818
  request: new Interceptors,
@@ -24671,6 +24671,7 @@ function getHeaders2() {
24671
24671
  async function digestDir(path3, conf) {
24672
24672
  const hashes = [];
24673
24673
  const entries = await readdir(path3, { withFileTypes: true });
24674
+ entries.sort((a, b) => a.name.localeCompare(b.name));
24674
24675
  for (const e of entries) {
24675
24676
  const npath = path3 + "/" + e.name;
24676
24677
  if (e.isFile()) {
@@ -26166,7 +26167,7 @@ Available workspaces:`);
26166
26167
  opts.__secret_workspace = ws;
26167
26168
  return ws;
26168
26169
  }
26169
- info(colors.red.bold("No workspace given and no default set."));
26170
+ info(colors.red.bold("No workspace given and no default set. Run 'wmill workspace add' to configure one."));
26170
26171
  return process.exit(-1);
26171
26172
  }
26172
26173
  async function fetchVersion(baseUrl2) {
@@ -59228,7 +59229,10 @@ async function push(opts, filePath) {
59228
59229
  const remotePath = removeExtensionToPath(filePath).replaceAll(SEP4, "/");
59229
59230
  const contentHash = await generateHash(content + remotePath);
59230
59231
  const conf = await readLockfile();
59231
- if (!await checkifMetadataUptodate(remotePath, contentHash, conf)) {
59232
+ const hasLockEntry = conf.locks && (conf.locks[remotePath] !== undefined || conf.locks[`${remotePath}.ts`] !== undefined);
59233
+ if (!hasLockEntry) {
59234
+ warn(colors.yellow(`No metadata generated yet for ${filePath}. Run 'wmill generate-metadata' to generate schema and lock.`));
59235
+ } else if (!await checkifMetadataUptodate(remotePath, contentHash, conf)) {
59232
59236
  warn(colors.yellow(`Metadata for ${filePath} appears stale (content changed since last 'wmill generate-metadata').
59233
59237
  ` + `The schema and lock may not match the current code. Consider running 'wmill generate-metadata' first.`));
59234
59238
  }
@@ -60167,7 +60171,7 @@ var init_script = __esm(async () => {
60167
60171
  languageAliases = {
60168
60172
  python: "python3"
60169
60173
  };
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);
60174
+ command3 = new Command().description("script related commands").option("--show-archived", "Show archived scripts instead of active ones").option("--json", "Output as JSON (for piping to jq)").action(list3).command("list", "list all scripts").option("--show-archived", "Show archived scripts instead of active ones").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);
60171
60175
  script_default = command3;
60172
60176
  });
60173
60177
 
@@ -60556,7 +60560,8 @@ async function runLint(opts, directory) {
60556
60560
  if (!stats.isDirectory()) {
60557
60561
  throw new Error(`Path is not a directory: ${targetDirectory}`);
60558
60562
  }
60559
- const ignore = await ignoreF(mergedOpts);
60563
+ const isSubdirectory = explicitTargetDirectory && !await stat4(path6.join(targetDirectory, "wmill.yaml")).catch(() => null);
60564
+ const ignore = isSubdirectory ? (_p, _isDir) => false : await ignoreF(mergedOpts);
60560
60565
  const root = await FSFSElement(targetDirectory, [], false);
60561
60566
  const validator = new import_windmill_yaml_validator.WindmillYamlValidator;
60562
60567
  const warnings = [];
@@ -60569,8 +60574,8 @@ async function runLint(opts, directory) {
60569
60574
  if (entry.isDirectory || entry.ignored) {
60570
60575
  continue;
60571
60576
  }
60572
- scannedFiles += 1;
60573
60577
  const normalizedPath = normalizePath(entry.path);
60578
+ scannedFiles += 1;
60574
60579
  if (!YAML_FILE_REGEX.test(normalizedPath)) {
60575
60580
  continue;
60576
60581
  }
@@ -60654,6 +60659,10 @@ function printReport(report, jsonOutput) {
60654
60659
  }
60655
60660
  }
60656
60661
  async function lint(opts, directory) {
60662
+ if (opts.watch) {
60663
+ await lintWatch(opts, directory);
60664
+ return;
60665
+ }
60657
60666
  try {
60658
60667
  const report = await runLint(opts, directory);
60659
60668
  printReport(report, !!opts.json);
@@ -60674,6 +60683,32 @@ async function lint(opts, directory) {
60674
60683
  process12.exit(1);
60675
60684
  }
60676
60685
  }
60686
+ async function lintWatch(opts, directory) {
60687
+ const { watch } = await import("node:fs");
60688
+ const targetDir = directory ? path6.resolve(process12.cwd(), directory) : process12.cwd();
60689
+ info(colors.blue(`Watching ${targetDir} for changes... (Ctrl+C to stop)`));
60690
+ async function runAndReport() {
60691
+ try {
60692
+ const report = await runLint(opts, directory);
60693
+ process12.stdout.write("\x1Bc");
60694
+ info(colors.gray(`[${new Date().toLocaleTimeString()}] Lint results:
60695
+ `));
60696
+ printReport(report, false);
60697
+ } catch (error2) {
60698
+ error(error2 instanceof Error ? error2.message : String(error2));
60699
+ }
60700
+ }
60701
+ await runAndReport();
60702
+ let debounce = null;
60703
+ watch(targetDir, { recursive: true }, (_event, filename) => {
60704
+ if (!filename || !filename.toString().endsWith(".yaml") && !filename.toString().endsWith(".yml"))
60705
+ return;
60706
+ if (debounce)
60707
+ clearTimeout(debounce);
60708
+ debounce = setTimeout(runAndReport, 300);
60709
+ });
60710
+ await new Promise(() => {});
60711
+ }
60677
60712
  var import_windmill_yaml_validator, YAML_FILE_REGEX, NATIVE_TRIGGER_REGEX, command4, lint_default;
60678
60713
  var init_lint = __esm(async () => {
60679
60714
  init_colors2();
@@ -60690,7 +60725,7 @@ var init_lint = __esm(async () => {
60690
60725
  import_windmill_yaml_validator = __toESM(require_dist3(), 1);
60691
60726
  YAML_FILE_REGEX = /\.ya?ml$/i;
60692
60727
  NATIVE_TRIGGER_REGEX = /\.[^.]+_native_trigger\.ya?ml$/i;
60693
- command4 = new Command().description("Validate Windmill flow, schedule, and trigger YAML files in a directory").arguments("[directory:string]").option("--json", "Output results in JSON format").option("--fail-on-warn", "Exit with code 1 when warnings are emitted").option("--locks-required", "Fail if scripts or flow inline scripts that need locks have no locks").action(lint);
60728
+ command4 = new Command().description("Validate Windmill flow, schedule, and trigger YAML files in a directory").arguments("[directory:string]").option("--json", "Output results in JSON format").option("--fail-on-warn", "Exit with code 1 when warnings are emitted").option("--locks-required", "Fail if scripts or flow inline scripts that need locks have no locks").option("-w, --watch", "Watch for file changes and re-lint automatically").action(lint);
60694
60729
  lint_default = command4;
60695
60730
  });
60696
60731
 
@@ -61084,7 +61119,7 @@ var init_extractor = __esm(() => {
61084
61119
  });
61085
61120
 
61086
61121
  // windmill-utils-internal/src/inline-scripts/replacer.ts
61087
- async function replaceRawscriptInline(id, rawscript, fileReader, logger, separator, removeLocks) {
61122
+ async function replaceRawscriptInline(id, rawscript, fileReader, logger, separator, removeLocks, missingFiles) {
61088
61123
  if (!rawscript.content || !rawscript.content.startsWith("!inline")) {
61089
61124
  return;
61090
61125
  }
@@ -61099,6 +61134,8 @@ async function replaceRawscriptInline(id, rawscript, fileReader, logger, separat
61099
61134
  rawscript.content = await fileReader(newPath);
61100
61135
  } catch {
61101
61136
  logger.error(`Script file ${newPath} not found`);
61137
+ if (missingFiles)
61138
+ missingFiles.push(path7);
61102
61139
  }
61103
61140
  }
61104
61141
  const lock = rawscript.lock;
@@ -61117,34 +61154,36 @@ async function replaceRawscriptInline(id, rawscript, fileReader, logger, separat
61117
61154
  async function replaceInlineScripts(modules, fileReader, logger = {
61118
61155
  info: () => {},
61119
61156
  error: () => {}
61120
- }, localPath, separator = "/", removeLocks) {
61157
+ }, localPath, separator = "/", removeLocks, missingFiles) {
61158
+ const missing = missingFiles ?? [];
61121
61159
  await Promise.all(modules.map(async (module) => {
61122
61160
  if (!module.value) {
61123
61161
  throw new Error(`Module value is undefined for module ${module.id}`);
61124
61162
  }
61125
61163
  if (module.value.type === "rawscript") {
61126
- await replaceRawscriptInline(module.id, module.value, fileReader, logger, separator, removeLocks);
61164
+ await replaceRawscriptInline(module.id, module.value, fileReader, logger, separator, removeLocks, missing);
61127
61165
  } else if (module.value.type === "forloopflow" || module.value.type === "whileloopflow") {
61128
- await replaceInlineScripts(module.value.modules, fileReader, logger, localPath, separator, removeLocks);
61166
+ await replaceInlineScripts(module.value.modules, fileReader, logger, localPath, separator, removeLocks, missing);
61129
61167
  } else if (module.value.type === "branchall") {
61130
61168
  await Promise.all(module.value.branches.map(async (branch) => {
61131
- await replaceInlineScripts(branch.modules, fileReader, logger, localPath, separator, removeLocks);
61169
+ await replaceInlineScripts(branch.modules, fileReader, logger, localPath, separator, removeLocks, missing);
61132
61170
  }));
61133
61171
  } else if (module.value.type === "branchone") {
61134
61172
  await Promise.all(module.value.branches.map(async (branch) => {
61135
- await replaceInlineScripts(branch.modules, fileReader, logger, localPath, separator, removeLocks);
61173
+ await replaceInlineScripts(branch.modules, fileReader, logger, localPath, separator, removeLocks, missing);
61136
61174
  }));
61137
- await replaceInlineScripts(module.value.default, fileReader, logger, localPath, separator, removeLocks);
61175
+ await replaceInlineScripts(module.value.default, fileReader, logger, localPath, separator, removeLocks, missing);
61138
61176
  } else if (module.value.type === "aiagent") {
61139
61177
  await Promise.all((module.value.tools ?? []).map(async (tool) => {
61140
61178
  const toolValue = tool.value;
61141
61179
  if (!toolValue || toolValue.tool_type !== "flowmodule" || toolValue.type !== "rawscript") {
61142
61180
  return;
61143
61181
  }
61144
- await replaceRawscriptInline(tool.id, toolValue, fileReader, logger, separator, removeLocks);
61182
+ await replaceRawscriptInline(tool.id, toolValue, fileReader, logger, separator, removeLocks, missing);
61145
61183
  }));
61146
61184
  }
61147
61185
  }));
61186
+ return missing;
61148
61187
  }
61149
61188
  async function replacePathScriptsWithLocal(modules, scriptReader, logger = {
61150
61189
  info: () => {},
@@ -61930,12 +61969,13 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
61930
61969
  let inlineScripts;
61931
61970
  try {
61932
61971
  const assigner = newPathAssigner(defaultTs, { skipInlineScriptSuffix: getNonDottedPaths() });
61933
- inlineScripts = extractInlineScripts(flow.value.modules, {}, SEP8, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths() });
61972
+ const inlineMapping = extractCurrentMapping(flow.value.modules, {}, flow.value.failure_module, flow.value.preprocessor_module);
61973
+ inlineScripts = extractInlineScripts(flow.value.modules, inlineMapping, SEP8, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths() });
61934
61974
  if (flow.value.failure_module) {
61935
- inlineScripts.push(...extractInlineScripts([flow.value.failure_module], {}, SEP8, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths() }));
61975
+ inlineScripts.push(...extractInlineScripts([flow.value.failure_module], inlineMapping, SEP8, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths() }));
61936
61976
  }
61937
61977
  if (flow.value.preprocessor_module) {
61938
- inlineScripts.push(...extractInlineScripts([flow.value.preprocessor_module], {}, SEP8, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths() }));
61978
+ inlineScripts.push(...extractInlineScripts([flow.value.preprocessor_module], inlineMapping, SEP8, defaultTs, assigner, { skipInlineScriptSuffix: getNonDottedPaths() }));
61939
61979
  }
61940
61980
  } catch (error2) {
61941
61981
  error(`Failed to extract inline scripts for flow at path: ${p}`);
@@ -62537,6 +62577,10 @@ async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetada
62537
62577
  continue;
62538
62578
  }
62539
62579
  if (k.startsWith("dependencies/")) {
62580
+ if (!workspaceDependenciesPathToLanguageAndFilename(k)) {
62581
+ warn(`Skipping unrecognized workspace dependencies file: ${k}`);
62582
+ continue;
62583
+ }
62540
62584
  info(`Adding workspace dependencies file: ${k}`);
62541
62585
  }
62542
62586
  changes.push({ name: "added", path: k, content: v });
@@ -70044,44 +70088,39 @@ async function push9(opts, filePath) {
70044
70088
  await pushWorkspaceDependencies(workspace.workspaceId, filePath, null, content);
70045
70089
  }
70046
70090
  async function pushWorkspaceDependencies(workspace, path18, _befObj, newDependenciesContent) {
70091
+ const res = workspaceDependenciesPathToLanguageAndFilename(path18);
70092
+ if (!res) {
70093
+ throw new Error(`Unknown workspace dependencies file format: ${path18}. ` + `Valid files: package.json, requirements.in, composer.json, go.mod, modules.json`);
70094
+ }
70095
+ const { language, name } = res;
70096
+ const displayName = name ? `named dependencies "${name}"` : `workspace default dependencies`;
70047
70097
  try {
70048
- const res = workspaceDependenciesPathToLanguageAndFilename(path18);
70049
- if (!res) {
70050
- throw new Error(`Unknown workspace dependencies file format: ${path18}`);
70051
- }
70052
- const { language, name } = res;
70053
- const displayName = name ? `named dependencies "${name}"` : `workspace default dependencies`;
70054
- try {
70055
- const remoteDeps = await getLatestWorkspaceDependencies({
70056
- workspace,
70057
- language,
70058
- name
70059
- });
70060
- if (remoteDeps && remoteDeps.content === newDependenciesContent) {
70061
- info(colors.green(`${displayName} for ${language} are up-to-date, skipping push`));
70062
- return;
70063
- }
70064
- } catch (e) {
70065
- if (e.status !== 404 && !e.message?.includes("not found")) {
70066
- throw e;
70067
- }
70068
- }
70069
- info(colors.yellow(`Pushing ${name ? "named" : "workspace default"} dependencies for ${language}...`));
70070
- await createWorkspaceDependencies({
70098
+ const remoteDeps = await getLatestWorkspaceDependencies({
70071
70099
  workspace,
70072
- requestBody: {
70073
- name,
70074
- content: newDependenciesContent,
70075
- language,
70076
- workspace_id: workspace,
70077
- description: undefined
70078
- }
70100
+ language,
70101
+ name
70079
70102
  });
70080
- info(colors.green(`Successfully pushed ${displayName} for ${language}`));
70081
- } catch (error2) {
70082
- error(colors.red(`Failed to push workspace dependencies: ${error2.message}`));
70083
- throw error2;
70103
+ if (remoteDeps && remoteDeps.content === newDependenciesContent) {
70104
+ info(colors.green(`${displayName} for ${language} are up-to-date, skipping push`));
70105
+ return;
70106
+ }
70107
+ } catch (e) {
70108
+ if (e.status !== 404 && !e.message?.includes("not found")) {
70109
+ throw e;
70110
+ }
70084
70111
  }
70112
+ info(colors.yellow(`Pushing ${name ? "named" : "workspace default"} dependencies for ${language}...`));
70113
+ await createWorkspaceDependencies({
70114
+ workspace,
70115
+ requestBody: {
70116
+ name,
70117
+ content: newDependenciesContent,
70118
+ language,
70119
+ workspace_id: workspace,
70120
+ description: undefined
70121
+ }
70122
+ });
70123
+ info(colors.green(`Successfully pushed ${displayName} for ${language}`));
70085
70124
  }
70086
70125
  var command19, dependencies_default;
70087
70126
  var init_dependencies = __esm(async () => {
@@ -70289,6 +70328,26 @@ async function newTrigger(opts, path18) {
70289
70328
  });
70290
70329
  info(colors.green(`Created ${filePath}`));
70291
70330
  }
70331
+ function printTriggerDetails(trigger, kind) {
70332
+ console.log(colors.bold("Path:") + " " + trigger.path);
70333
+ console.log(colors.bold("Kind:") + " " + kind);
70334
+ console.log(colors.bold("Enabled:") + " " + (trigger.enabled ?? trigger.mode ?? "-"));
70335
+ console.log(colors.bold("Script Path:") + " " + (trigger.script_path ?? ""));
70336
+ console.log(colors.bold("Is Flow:") + " " + (trigger.is_flow ? "true" : "false"));
70337
+ for (const [key, value] of Object.entries(trigger)) {
70338
+ if (["path", "enabled", "mode", "script_path", "is_flow"].includes(key))
70339
+ continue;
70340
+ if (TRIGGER_SKIP_FIELDS.has(key))
70341
+ continue;
70342
+ if (value === undefined || value === null || value === "")
70343
+ continue;
70344
+ const display = Array.isArray(value) ? value.length > 0 ? JSON.stringify(value) : "[]" : typeof value === "object" ? JSON.stringify(value) : String(value);
70345
+ if (display === "[]" || display === "{}")
70346
+ continue;
70347
+ const label = key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
70348
+ console.log(colors.bold(label + ":") + " " + display);
70349
+ }
70350
+ }
70292
70351
  async function get8(opts, path18) {
70293
70352
  if (opts.json)
70294
70353
  setSilent(true);
@@ -70302,11 +70361,7 @@ async function get8(opts, path18) {
70302
70361
  if (opts.json) {
70303
70362
  console.log(JSON.stringify(trigger));
70304
70363
  } else {
70305
- console.log(colors.bold("Path:") + " " + trigger.path);
70306
- console.log(colors.bold("Kind:") + " " + opts.kind);
70307
- console.log(colors.bold("Enabled:") + " " + (trigger.enabled ?? "-"));
70308
- console.log(colors.bold("Script Path:") + " " + (trigger.script_path ?? ""));
70309
- console.log(colors.bold("Is Flow:") + " " + (trigger.is_flow ? "true" : "false"));
70364
+ printTriggerDetails(trigger, opts.kind);
70310
70365
  }
70311
70366
  return;
70312
70367
  }
@@ -70325,11 +70380,7 @@ async function get8(opts, path18) {
70325
70380
  if (opts.json) {
70326
70381
  console.log(JSON.stringify(trigger));
70327
70382
  } else {
70328
- console.log(colors.bold("Path:") + " " + trigger.path);
70329
- console.log(colors.bold("Kind:") + " " + kind);
70330
- console.log(colors.bold("Enabled:") + " " + (trigger.enabled ?? trigger.mode ?? "-"));
70331
- console.log(colors.bold("Script Path:") + " " + (trigger.script_path ?? ""));
70332
- console.log(colors.bold("Is Flow:") + " " + (trigger.is_flow ? "true" : "false"));
70383
+ printTriggerDetails(trigger, kind);
70333
70384
  }
70334
70385
  return;
70335
70386
  }
@@ -70426,7 +70477,7 @@ async function push10(opts, filePath, remotePath) {
70426
70477
  await pushTrigger(triggerKind, workspace.workspaceId, remotePath, undefined, parseFromFile(filePath));
70427
70478
  console.log(colors.bold.underline.green("Trigger pushed"));
70428
70479
  }
70429
- var import_yaml33, triggerTemplates, command20, trigger_default;
70480
+ var import_yaml33, triggerTemplates, TRIGGER_SKIP_FIELDS, command20, trigger_default;
70430
70481
  var init_trigger = __esm(async () => {
70431
70482
  init_services_gen();
70432
70483
  init_mod3();
@@ -70518,9 +70569,11 @@ var init_trigger = __esm(async () => {
70518
70569
  email: {
70519
70570
  script_path: "",
70520
70571
  is_flow: false,
70572
+ local_part: "",
70521
70573
  enabled: false
70522
70574
  }
70523
70575
  };
70576
+ TRIGGER_SKIP_FIELDS = new Set(["workspace_id", "extra_perms", "edited_by", "edited_at"]);
70524
70577
  command20 = new Command().description("trigger related commands").option("--json", "Output as JSON (for piping to jq)").action(list11).command("list", "list all triggers").option("--json", "Output as JSON (for piping to jq)").action(list11).command("get", "get a trigger's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").option("--kind <kind:string>", "Trigger kind (http, websocket, kafka, nats, postgres, mqtt, sqs, gcp, email). Recommended for faster lookup").action(get8).command("new", "create a new trigger locally").arguments("<path:string>").option("--kind <kind:string>", "Trigger kind (required: http, websocket, kafka, nats, postgres, mqtt, sqs, gcp, email)").action(newTrigger).command("push", "push a local trigger spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").action(push10);
70525
70578
  trigger_default = command20;
70526
70579
  });
@@ -70970,12 +71023,16 @@ async function pushFlow(workspace, remotePath, localPath, message) {
70970
71023
  }
70971
71024
  const localFlow = await yamlParseFile(localPath + "flow.yaml");
70972
71025
  const fileReader = async (path19) => await readFile15(localPath + path19, "utf-8");
70973
- await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, localPath, SEP19);
71026
+ const missingFiles = [];
71027
+ await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, localPath, SEP19, undefined, missingFiles);
70974
71028
  if (localFlow.value.failure_module) {
70975
- await replaceInlineScripts([localFlow.value.failure_module], fileReader, exports_log, localPath, SEP19);
71029
+ await replaceInlineScripts([localFlow.value.failure_module], fileReader, exports_log, localPath, SEP19, undefined, missingFiles);
70976
71030
  }
70977
71031
  if (localFlow.value.preprocessor_module) {
70978
- await replaceInlineScripts([localFlow.value.preprocessor_module], fileReader, exports_log, localPath, SEP19);
71032
+ await replaceInlineScripts([localFlow.value.preprocessor_module], fileReader, exports_log, localPath, SEP19, undefined, missingFiles);
71033
+ }
71034
+ if (missingFiles.length > 0) {
71035
+ warn(colors.yellow(`Warning: missing inline script file(s): ${missingFiles.join(", ")}. ` + `The flow will be pushed with unresolved !inline references.`));
70979
71036
  }
70980
71037
  if (flow) {
70981
71038
  if (isSuperset(localFlow, flow)) {
@@ -71064,12 +71121,29 @@ async function get9(opts, path19) {
71064
71121
  console.log(colors.bold("Edited at:") + " " + (f.edited_at ?? ""));
71065
71122
  const modules = f.value?.modules;
71066
71123
  if (modules && Array.isArray(modules) && modules.length > 0) {
71124
+ let printModules = function(mods, indent = " ") {
71125
+ for (const mod of mods) {
71126
+ const type = mod.value?.type ?? "unknown";
71127
+ const detail = mod.value?.language ?? mod.value?.path ?? "";
71128
+ console.log(`${indent}${mod.id}: ${type}${detail ? " (" + detail + ")" : ""}`);
71129
+ if (type === "branchall" || type === "branchone") {
71130
+ for (const branch of mod.value?.branches ?? []) {
71131
+ console.log(`${indent} Branch: ${branch.summary || "(default)"}`);
71132
+ if (branch.modules)
71133
+ printModules(branch.modules, indent + " ");
71134
+ }
71135
+ if (type === "branchone" && mod.value?.default) {
71136
+ console.log(`${indent} Default:`);
71137
+ printModules(mod.value.default, indent + " ");
71138
+ }
71139
+ } else if (type === "forloopflow" || type === "whileloopflow") {
71140
+ if (mod.value?.modules)
71141
+ printModules(mod.value.modules, indent + " ");
71142
+ }
71143
+ }
71144
+ };
71067
71145
  console.log(colors.bold("Steps:"));
71068
- for (const mod of modules) {
71069
- const type = mod.value?.type ?? "unknown";
71070
- const detail = mod.value?.language ?? mod.value?.path ?? "";
71071
- console.log(` ${mod.id}: ${type}${detail ? " (" + detail + ")" : ""}`);
71072
- }
71146
+ printModules(modules);
71073
71147
  }
71074
71148
  }
71075
71149
  }
@@ -71230,7 +71304,6 @@ async function preview2(opts, flowPath) {
71230
71304
  process.exitCode = 1;
71231
71305
  return;
71232
71306
  }
71233
- error(`Flow preview failed: ${JSON.stringify(e.body)}`);
71234
71307
  }
71235
71308
  throw e;
71236
71309
  }
@@ -79540,6 +79613,7 @@ Validate Windmill flow, schedule, and trigger YAML files in a directory
79540
79613
  - \`--json\` - Output results in JSON format
79541
79614
  - \`--fail-on-warn\` - Exit with code 1 when warnings are emitted
79542
79615
  - \`--locks-required\` - Fail if scripts or flow inline scripts that need locks have no locks
79616
+ - \`-w, --watch\` - Watch for file changes and re-lint automatically
79543
79617
 
79544
79618
  ### queues
79545
79619
 
@@ -79608,13 +79682,13 @@ schedule related commands
79608
79682
  script related commands
79609
79683
 
79610
79684
  **Options:**
79611
- - \`--show-archived\` - Enable archived scripts in output
79685
+ - \`--show-archived\` - Show archived scripts instead of active ones
79612
79686
  - \`--json\` - Output as JSON (for piping to jq)
79613
79687
 
79614
79688
  **Subcommands:**
79615
79689
 
79616
79690
  - \`script list\` - list all scripts
79617
- - \`--show-archived\` - Enable archived scripts in output
79691
+ - \`--show-archived\` - Show archived scripts instead of active ones
79618
79692
  - \`--json\` - Output as JSON (for piping to jq)
79619
79693
  - \`script push <path:file>\` - push a local script spec. This overrides any remote versions. Use the script file (.ts, .js, .py, .sh
79620
79694
  - \`--message <message:string>\` - Deployment message
@@ -81581,17 +81655,19 @@ async function list13(opts) {
81581
81655
  let successFilter = opts.success;
81582
81656
  if (opts.failed)
81583
81657
  successFilter = false;
81584
- const jobs = await listJobs({
81658
+ const limit = Math.min(opts.limit ?? 30, 100);
81659
+ const allJobs = await listJobs({
81585
81660
  workspace: workspace.workspaceId,
81586
81661
  scriptPathExact: opts.scriptPath,
81587
81662
  createdBy: opts.createdBy,
81588
81663
  running: opts.running,
81589
81664
  success: successFilter,
81590
- perPage: Math.min(opts.limit ?? 30, 100),
81665
+ perPage: limit,
81591
81666
  jobKinds: opts.jobKinds ?? "script,flow,singlestepflow",
81592
81667
  label: opts.label,
81593
81668
  hasNullParent: opts.all ? undefined : true
81594
81669
  });
81670
+ const jobs = allJobs.slice(0, limit);
81595
81671
  if (opts.json) {
81596
81672
  console.log(JSON.stringify(jobs));
81597
81673
  } else {
@@ -82266,7 +82342,7 @@ var config_default = command35;
82266
82342
 
82267
82343
  // src/main.ts
82268
82344
  await init_context();
82269
- var VERSION = "1.668.2";
82345
+ var VERSION = "1.668.4";
82270
82346
  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) => {
82271
82347
  console.log("CLI version: " + VERSION);
82272
82348
  try {
@@ -82324,7 +82400,8 @@ async function main2() {
82324
82400
  } catch (e) {
82325
82401
  if (e && typeof e === "object" && "name" in e && e.name === "ApiError") {
82326
82402
  const body = e.body;
82327
- const bodyStr = typeof body === "object" && body !== null ? JSON.stringify(body) : body;
82403
+ let bodyStr = typeof body === "object" && body !== null ? JSON.stringify(body) : String(body ?? "");
82404
+ bodyStr = bodyStr.replace(/\s*[@(]\w+\.rs:\d+[:\d]*\)?/g, "");
82328
82405
  error("Server failed. " + e.statusText + ": " + bodyStr);
82329
82406
  } else if (e instanceof Error) {
82330
82407
  error(e.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.668.2",
3
+ "version": "1.668.4",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",