windmill-cli 1.686.0 → 1.688.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.
Files changed (2) hide show
  1. package/esm/main.js +157 -36
  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.686.0",
11815
+ VERSION: "1.688.0",
11816
11816
  WITH_CREDENTIALS: true,
11817
11817
  interceptors: {
11818
11818
  request: new Interceptors,
@@ -12335,6 +12335,7 @@ __export(exports_services_gen, {
12335
12335
  listGoogleDriveFiles: () => listGoogleDriveFiles,
12336
12336
  listGoogleCalendars: () => listGoogleCalendars,
12337
12337
  listGlobalSettings: () => listGlobalSettings,
12338
+ listGithubRepos: () => listGithubRepos,
12338
12339
  listGitRepoFiles: () => listGitRepoFiles,
12339
12340
  listGcpTriggers: () => listGcpTriggers,
12340
12341
  listFolders: () => listFolders,
@@ -12379,6 +12380,7 @@ __export(exports_services_gen, {
12379
12380
  leaveInstance: () => leaveInstance,
12380
12381
  isValidPostgresConfiguration: () => isValidPostgresConfiguration,
12381
12382
  isSmtpConfigured: () => isSmtpConfigured,
12383
+ isPasswordLoginDisabled: () => isPasswordLoginDisabled,
12382
12384
  isOwnerOfPath: () => isOwnerOfPath,
12383
12385
  isDomainAllowed: () => isDomainAllowed,
12384
12386
  isDefaultTagsPerWorkspace: () => isDefaultTagsPerWorkspace,
@@ -12867,6 +12869,11 @@ var backendVersion = () => {
12867
12869
  method: "GET",
12868
12870
  url: "/auth/is_smtp_configured"
12869
12871
  });
12872
+ }, isPasswordLoginDisabled = () => {
12873
+ return request(OpenAPI, {
12874
+ method: "GET",
12875
+ url: "/auth/is_password_login_disabled"
12876
+ });
12870
12877
  }, requestPasswordReset = (data2) => {
12871
12878
  return request(OpenAPI, {
12872
12879
  method: "POST",
@@ -16738,7 +16745,8 @@ var backendVersion = () => {
16738
16745
  workspace: data2.workspace
16739
16746
  },
16740
16747
  query: {
16741
- force_cancel: data2.forceCancel
16748
+ force_cancel: data2.forceCancel,
16749
+ all_workspaces: data2.allWorkspaces
16742
16750
  },
16743
16751
  body: data2.requestBody,
16744
16752
  mediaType: "application/json"
@@ -18125,6 +18133,14 @@ var backendVersion = () => {
18125
18133
  workspace: data2.workspace
18126
18134
  }
18127
18135
  });
18136
+ }, listGithubRepos = (data2) => {
18137
+ return request(OpenAPI, {
18138
+ method: "GET",
18139
+ url: "/w/{workspace}/native_triggers/github/repos",
18140
+ path: {
18141
+ workspace: data2.workspace
18142
+ }
18143
+ });
18128
18144
  }, nativeTriggerWebhook = (data2) => {
18129
18145
  return request(OpenAPI, {
18130
18146
  method: "POST",
@@ -67433,6 +67449,7 @@ var init_raw_apps = __esm(async () => {
67433
67449
  var exports_app_metadata = {};
67434
67450
  __export(exports_app_metadata, {
67435
67451
  inferRunnableSchemaFromFile: () => inferRunnableSchemaFromFile,
67452
+ inferAllInlineSchemas: () => inferAllInlineSchemas,
67436
67453
  getAppFolders: () => getAppFolders,
67437
67454
  generateLocksCommand: () => generateLocksCommand,
67438
67455
  generateAppLocksInternal: () => generateAppLocksInternal,
@@ -67440,7 +67457,7 @@ __export(exports_app_metadata, {
67440
67457
  APP_BACKEND_FOLDER: () => APP_BACKEND_FOLDER
67441
67458
  });
67442
67459
  import path13 from "node:path";
67443
- import { readFile as readFile11, mkdir as mkdir6 } from "node:fs/promises";
67460
+ import { readFile as readFile11, mkdir as mkdir6, readdir as readdir7 } from "node:fs/promises";
67444
67461
  import { sep as SEP11 } from "node:path";
67445
67462
  async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
67446
67463
  const runnablesFolder = rawApp ? path13.join(folder, APP_BACKEND_FOLDER) : folder;
@@ -67792,16 +67809,22 @@ ${text}`);
67792
67809
  throw new Error(`Failed to parse dependency response: ${rawResponse.statusText}, ${responseText}, ${e.message}`);
67793
67810
  }
67794
67811
  }
67795
- async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67812
+ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultTs = "bun") {
67796
67813
  const fileName = path13.basename(runnableFilePath);
67797
67814
  if (fileName.endsWith(".lock") || fileName.endsWith(".yaml")) {
67798
67815
  return;
67799
67816
  }
67800
- const match2 = fileName.match(/^(.+)\.[^.]+$/);
67801
- if (!match2) {
67817
+ let runnableId;
67818
+ let ext2;
67819
+ for (const knownExt of Object.keys(EXTENSION_TO_LANGUAGE)) {
67820
+ if (fileName.endsWith("." + knownExt) && (!ext2 || knownExt.length > ext2.length)) {
67821
+ ext2 = knownExt;
67822
+ runnableId = fileName.slice(0, -(knownExt.length + 1));
67823
+ }
67824
+ }
67825
+ if (!runnableId || !ext2) {
67802
67826
  return;
67803
67827
  }
67804
- const runnableId = match2[1];
67805
67828
  const runnableFilePath2 = path13.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
67806
67829
  let runnable;
67807
67830
  try {
@@ -67816,15 +67839,23 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67816
67839
  }
67817
67840
  runnable = appFile.runnables[runnableId];
67818
67841
  } catch {
67819
- warn(colors.yellow(`Could not read runnable ${runnableId} from any source`));
67820
- return;
67842
+ runnable = { type: "inline" };
67821
67843
  }
67822
67844
  }
67823
- if (!runnable?.inlineScript) {
67845
+ let language;
67846
+ let currentSchema;
67847
+ if (runnable?.inlineScript) {
67848
+ language = runnable.inlineScript.language;
67849
+ currentSchema = runnable.inlineScript.schema;
67850
+ } else if (runnable?.type === "inline" || runnable?.type === "runnableByName") {
67851
+ language = getLanguageFromExtension(ext2, defaultTs);
67852
+ } else {
67853
+ return;
67854
+ }
67855
+ if (!language) {
67856
+ warn(colors.yellow(`Could not determine language for ${runnableId} (ext: ${ext2})`));
67824
67857
  return;
67825
67858
  }
67826
- const inlineScript = runnable.inlineScript;
67827
- const language = inlineScript.language;
67828
67859
  const fullFilePath = path13.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
67829
67860
  let content;
67830
67861
  try {
@@ -67833,7 +67864,6 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67833
67864
  warn(colors.yellow(`Could not read file: ${fullFilePath}`));
67834
67865
  return;
67835
67866
  }
67836
- const currentSchema = inlineScript.schema;
67837
67867
  const remotePath = appFolder.replaceAll(SEP11, "/");
67838
67868
  try {
67839
67869
  const schemaResult = await inferSchema(language, content, currentSchema, `${remotePath}/${runnableId}`);
@@ -67847,6 +67877,28 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath) {
67847
67877
  return;
67848
67878
  }
67849
67879
  }
67880
+ async function inferAllInlineSchemas(appFolder, defaultTs = "bun") {
67881
+ const schemas = {};
67882
+ const backendPath = path13.join(appFolder, APP_BACKEND_FOLDER);
67883
+ let entries;
67884
+ try {
67885
+ entries = await readdir7(backendPath, { withFileTypes: true });
67886
+ } catch {
67887
+ return schemas;
67888
+ }
67889
+ for (const entry of entries) {
67890
+ if (!entry.isFile())
67891
+ continue;
67892
+ const fileName = entry.name;
67893
+ if (fileName.endsWith(".yaml") || fileName.endsWith(".lock"))
67894
+ continue;
67895
+ const result = await inferRunnableSchemaFromFile(appFolder, fileName, defaultTs);
67896
+ if (result) {
67897
+ schemas[result.runnableId] = result.schema;
67898
+ }
67899
+ }
67900
+ return schemas;
67901
+ }
67850
67902
  function getAppFolders(elems, extension) {
67851
67903
  return Object.keys(elems).filter((p) => p.endsWith(SEP11 + extension)).map((p) => p.substring(0, p.length - (SEP11 + extension).length));
67852
67904
  }
@@ -68181,7 +68233,19 @@ async function dev(opts, appFolder) {
68181
68233
  const appDir = path15.dirname(entryPoint) || process16.cwd();
68182
68234
  await ensureNodeModules(appDir);
68183
68235
  const inferredSchemas = {};
68184
- genRunnablesTs(inferredSchemas);
68236
+ try {
68237
+ Object.assign(inferredSchemas, await inferAllInlineSchemas(process16.cwd()));
68238
+ } catch (err) {
68239
+ warn(colors.yellow(`Could not seed inline schemas at startup: ${err.message}`));
68240
+ }
68241
+ const pathRunnableSchemas = {};
68242
+ try {
68243
+ const initialRunnables = await loadRunnablesFromBackend(path15.join(process16.cwd(), APP_BACKEND_FOLDER));
68244
+ Object.assign(pathRunnableSchemas, await fetchPathRunnableSchemas(workspaceId, initialRunnables));
68245
+ } catch (err) {
68246
+ warn(colors.yellow(`Could not fetch schemas for path-based runnables: ${err.message}`));
68247
+ }
68248
+ await genRunnablesTs(inferredSchemas, pathRunnableSchemas);
68185
68249
  const distDir = path15.join(process16.cwd(), "dist");
68186
68250
  if (!fs10.existsSync(distDir)) {
68187
68251
  fs10.mkdirSync(distDir);
@@ -68275,7 +68339,7 @@ data: reload
68275
68339
  if (result) {
68276
68340
  inferredSchemas[result.runnableId] = result.schema;
68277
68341
  info(colors.green(` Inferred Schemas: ${JSON.stringify(inferredSchemas, null, 2)}`));
68278
- await genRunnablesTs(inferredSchemas);
68342
+ await genRunnablesTs(inferredSchemas, pathRunnableSchemas);
68279
68343
  }
68280
68344
  } catch (error2) {
68281
68345
  error(colors.red(`Error inferring schema: ${error2.message}`));
@@ -68709,7 +68773,7 @@ data: reload
68709
68773
  process16.exit(0);
68710
68774
  });
68711
68775
  }
68712
- async function genRunnablesTs(schemaOverrides = {}) {
68776
+ async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides = {}) {
68713
68777
  info(colors.blue("\uD83D\uDD04 Generating wmill.d.ts..."));
68714
68778
  const localPath = process16.cwd();
68715
68779
  const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
@@ -68722,21 +68786,65 @@ async function genRunnablesTs(schemaOverrides = {}) {
68722
68786
  runnables = {};
68723
68787
  }
68724
68788
  }
68725
- if (Object.keys(schemaOverrides).length > 0) {
68726
- for (const [runnableId, schema] of Object.entries(schemaOverrides)) {
68727
- if (runnables[runnableId]?.inlineScript) {
68728
- runnables[runnableId].inlineScript.schema = schema;
68729
- runnables[runnableId].type = "inline";
68730
- }
68731
- }
68732
- }
68733
68789
  try {
68734
- const newWmillTs = genWmillTs(runnables);
68790
+ const newWmillTs = buildWmillTs(runnables, inlineSchemaOverrides, pathSchemaOverrides);
68735
68791
  writeFileSync5(path15.join(process16.cwd(), "wmill.d.ts"), newWmillTs);
68736
68792
  } catch (error2) {
68737
68793
  error(colors.red(`Failed to generate wmill.d.ts: ${error2.message}`));
68738
68794
  }
68739
68795
  }
68796
+ function buildWmillTs(runnables, inlineSchemaOverrides = {}, pathSchemaOverrides = {}) {
68797
+ for (const [runnableId, schema] of Object.entries(inlineSchemaOverrides)) {
68798
+ if (runnables[runnableId]?.inlineScript) {
68799
+ runnables[runnableId].inlineScript.schema = schema;
68800
+ runnables[runnableId].type = "inline";
68801
+ }
68802
+ }
68803
+ for (const [runnableId, schema] of Object.entries(pathSchemaOverrides)) {
68804
+ const runnable = runnables[runnableId];
68805
+ if (runnable?.type === "path" && schema) {
68806
+ runnable.schema = schema;
68807
+ }
68808
+ }
68809
+ for (const runnable of Object.values(runnables)) {
68810
+ if (runnable?.type === "path" && !runnable.schema) {
68811
+ runnable.schema = {};
68812
+ }
68813
+ }
68814
+ return genWmillTs(runnables);
68815
+ }
68816
+ async function fetchPathRunnableSchemas(workspaceId, runnables) {
68817
+ const schemas = {};
68818
+ for (const [runnableId, runnable] of Object.entries(runnables)) {
68819
+ if (runnable?.type !== "path" || !runnable.path)
68820
+ continue;
68821
+ if (runnable.schema) {
68822
+ schemas[runnableId] = runnable.schema;
68823
+ continue;
68824
+ }
68825
+ try {
68826
+ if (runnable.runType === "script") {
68827
+ const script = await getScriptByPath({
68828
+ workspace: workspaceId,
68829
+ path: runnable.path
68830
+ });
68831
+ if (script.schema)
68832
+ schemas[runnableId] = script.schema;
68833
+ } else if (runnable.runType === "flow") {
68834
+ const flow = await getFlowByPath({
68835
+ workspace: workspaceId,
68836
+ path: runnable.path
68837
+ });
68838
+ const flowSchema = flow?.value?.schema ?? flow?.schema;
68839
+ if (flowSchema)
68840
+ schemas[runnableId] = flowSchema;
68841
+ }
68842
+ } catch (err) {
68843
+ warn(colors.yellow(`Failed to fetch schema for ${runnable.runType} ${runnable.path}: ${err.message}`));
68844
+ }
68845
+ }
68846
+ return schemas;
68847
+ }
68740
68848
  function convertRunnablesToApiFormat(runnables) {
68741
68849
  for (const [runnableId, runnable] of Object.entries(runnables)) {
68742
68850
  if (runnable?.type === "script" || runnable?.type === "hubscript" || runnable?.type === "flow") {
@@ -70130,7 +70238,7 @@ var init_app = __esm(async () => {
70130
70238
  });
70131
70239
 
70132
70240
  // src/commands/folder/folder.ts
70133
- import { stat as stat11, readdir as readdir7, writeFile as writeFile11, mkdir as mkdir8 } from "node:fs/promises";
70241
+ import { stat as stat11, readdir as readdir8, writeFile as writeFile11, mkdir as mkdir8 } from "node:fs/promises";
70134
70242
  import { sep as SEP14 } from "node:path";
70135
70243
  async function list7(opts) {
70136
70244
  if (opts.json)
@@ -70258,7 +70366,7 @@ async function addMissing(opts) {
70258
70366
  info("No 'f/' directory found. Nothing to do.");
70259
70367
  return;
70260
70368
  }
70261
- const entries = await readdir7(fDir, { withFileTypes: true });
70369
+ const entries = await readdir8(fDir, { withFileTypes: true });
70262
70370
  const missing = [];
70263
70371
  for (const entry of entries) {
70264
70372
  if (!entry.isDirectory())
@@ -71258,7 +71366,7 @@ var init_settings = __esm(async () => {
71258
71366
  });
71259
71367
 
71260
71368
  // src/commands/instance/instance.ts
71261
- import { readFile as readFile13, writeFile as writeFile15, readdir as readdir8, mkdir as mkdir11, rm as rm3, stat as stat14 } from "node:fs/promises";
71369
+ import { readFile as readFile13, writeFile as writeFile15, readdir as readdir9, mkdir as mkdir11, rm as rm3, stat as stat14 } from "node:fs/promises";
71262
71370
  import { appendFile } from "node:fs/promises";
71263
71371
  import * as path18 from "node:path";
71264
71372
  async function allInstances() {
@@ -71673,7 +71781,7 @@ async function getLocalWorkspaces(rootDir, localPrefix, folderPerInstance) {
71673
71781
  await mkdir11(localPrefix);
71674
71782
  }
71675
71783
  if (folderPerInstance) {
71676
- const prefixEntries = await readdir8(rootDir + "/" + localPrefix, { withFileTypes: true });
71784
+ const prefixEntries = await readdir9(rootDir + "/" + localPrefix, { withFileTypes: true });
71677
71785
  for (const dir of prefixEntries) {
71678
71786
  if (dir.isDirectory()) {
71679
71787
  const dirName = dir.name;
@@ -71684,7 +71792,7 @@ async function getLocalWorkspaces(rootDir, localPrefix, folderPerInstance) {
71684
71792
  }
71685
71793
  }
71686
71794
  } else {
71687
- const rootEntries = await readdir8(rootDir, { withFileTypes: true });
71795
+ const rootEntries = await readdir9(rootDir, { withFileTypes: true });
71688
71796
  for (const dir of rootEntries) {
71689
71797
  const dirName = dir.name;
71690
71798
  if (dirName.startsWith(localPrefix + "_")) {
@@ -76682,7 +76790,7 @@ await __promiseAll([
76682
76790
  import { stat as stat18, writeFile as writeFile20, rm as rm4 } from "node:fs/promises";
76683
76791
 
76684
76792
  // src/guidance/writer.ts
76685
- import { cp, mkdir as mkdir13, readdir as readdir9, readFile as readFile17, stat as stat17, writeFile as writeFile19 } from "node:fs/promises";
76793
+ import { cp, mkdir as mkdir13, readdir as readdir10, readFile as readFile17, stat as stat17, writeFile as writeFile19 } from "node:fs/promises";
76686
76794
  import { join as join17 } from "node:path";
76687
76795
 
76688
76796
  // src/guidance/core.ts
@@ -76725,6 +76833,19 @@ You MUST use the \`resources\` skill to manage resource types and credentials.
76725
76833
 
76726
76834
  You MUST use the \`cli-commands\` skill to use the CLI.
76727
76835
 
76836
+ ## Debugging Jobs
76837
+
76838
+ When the user reports a script or flow failure, is investigating unexpected output, or asks why something ran the way it did, use the CLI to fetch job details before speculating. See the \`cli-commands\` skill for all flags.
76839
+
76840
+ - \`wmill job list --script-path <path>\` — recent runs of a specific script or flow
76841
+ - \`wmill job list --failed --limit 20\` — recent failures across the workspace
76842
+ - \`wmill job get <id>\` — status, timing, and (for flows) the step tree with sub-job IDs
76843
+ - \`wmill job logs <id>\` — stdout/stderr; for flows, aggregates every step's logs
76844
+ - \`wmill job result <id>\` — JSON result of a completed job
76845
+ - \`wmill job cancel <id>\` — stop a running or queued job
76846
+
76847
+ For flow failures, start with \`wmill job get <id>\` to identify the failing step and its sub-job ID, then \`wmill job logs <sub-job-id>\` to drill in.
76848
+
76728
76849
  ## Skills
76729
76850
 
76730
76851
  For specific guidance, ALWAYS use the skills listed below.
@@ -76760,7 +76881,7 @@ var SKILLS = [
76760
76881
  { name: "triggers", description: "MUST use when configuring triggers." },
76761
76882
  { name: "schedules", description: "MUST use when configuring schedules." },
76762
76883
  { name: "resources", description: "MUST use when managing resources." },
76763
- { name: "cli-commands", description: "MUST use when using the CLI." }
76884
+ { name: "cli-commands", description: "MUST use when using the CLI, including debugging job failures and inspecting run history via `wmill job`." }
76764
76885
  ];
76765
76886
  var SKILL_CONTENT = {
76766
76887
  "write-script-bash": `---
@@ -81979,7 +82100,7 @@ wmill sync push
81979
82100
  `,
81980
82101
  "cli-commands": `---
81981
82102
  name: cli-commands
81982
- description: MUST use when using the CLI.
82103
+ description: MUST use when using the CLI, including debugging job failures and inspecting run history via \`wmill job\`.
81983
82104
  ---
81984
82105
 
81985
82106
  # Windmill CLI Commands
@@ -83592,7 +83713,7 @@ async function ensureSkillsDirectory(targetDir) {
83592
83713
  return skillsDir;
83593
83714
  }
83594
83715
  async function copyDirectoryContents(sourceDir, targetDir) {
83595
- const entries = await readdir9(sourceDir, { withFileTypes: true });
83716
+ const entries = await readdir10(sourceDir, { withFileTypes: true });
83596
83717
  await Promise.all(entries.map(async (entry) => {
83597
83718
  await cp(join17(sourceDir, entry.name), join17(targetDir, entry.name), {
83598
83719
  recursive: true,
@@ -83631,7 +83752,7 @@ ${schemaDocs.join(`
83631
83752
  `)}`;
83632
83753
  }
83633
83754
  async function readSkillMetadataFromDirectory(skillsDir) {
83634
- const entries = await readdir9(skillsDir, { withFileTypes: true });
83755
+ const entries = await readdir10(skillsDir, { withFileTypes: true });
83635
83756
  const skills = [];
83636
83757
  for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
83637
83758
  if (!entry.isDirectory()) {
@@ -85445,7 +85566,7 @@ var config_default = command35;
85445
85566
 
85446
85567
  // src/main.ts
85447
85568
  await init_context();
85448
- var VERSION = "1.686.0";
85569
+ var VERSION = "1.688.0";
85449
85570
  async function checkVersionSafe(cmd) {
85450
85571
  const mainCommand = cmd.getMainCommand();
85451
85572
  const upgradeCommand = mainCommand.getCommand("upgrade");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.686.0",
3
+ "version": "1.688.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",