windmill-cli 1.666.0 → 1.667.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 +647 -66
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -11618,21 +11618,40 @@ var require_dist = __commonJS((exports) => {
11618
11618
  import { readFile } from "node:fs/promises";
11619
11619
  async function yamlParseFile(path, options = {}) {
11620
11620
  try {
11621
- return import_yaml.parse(await readFile(path, "utf-8"), options);
11621
+ return import_yaml.parse(await readFile(path, "utf-8"), {
11622
+ ...options,
11623
+ customTags: [...WINDMILL_CUSTOM_TAGS, ...options.customTags ?? []]
11624
+ });
11622
11625
  } catch (e) {
11623
11626
  throw new Error(`Error parsing yaml ${path}`, { cause: e });
11624
11627
  }
11625
11628
  }
11626
11629
  function yamlParseContent(path, content, options = {}) {
11627
11630
  try {
11628
- return import_yaml.parse(content, options);
11631
+ return import_yaml.parse(content, {
11632
+ ...options,
11633
+ customTags: [...WINDMILL_CUSTOM_TAGS, ...options.customTags ?? []]
11634
+ });
11629
11635
  } catch (e) {
11630
11636
  throw new Error(`Error parsing yaml ${path}`, { cause: e });
11631
11637
  }
11632
11638
  }
11633
- var import_yaml;
11639
+ var import_yaml, inlineTag, inlineFilesetTag, WINDMILL_CUSTOM_TAGS;
11634
11640
  var init_yaml = __esm(() => {
11635
11641
  import_yaml = __toESM(require_dist(), 1);
11642
+ inlineTag = {
11643
+ tag: "!inline",
11644
+ resolve(value) {
11645
+ return "!inline " + value;
11646
+ }
11647
+ };
11648
+ inlineFilesetTag = {
11649
+ tag: "!inline_fileset",
11650
+ resolve(value) {
11651
+ return "!inline_fileset " + value;
11652
+ }
11653
+ };
11654
+ WINDMILL_CUSTOM_TAGS = [inlineTag, inlineFilesetTag];
11636
11655
  });
11637
11656
 
11638
11657
  // gen/core/ApiError.ts
@@ -11785,7 +11804,7 @@ var init_OpenAPI = __esm(() => {
11785
11804
  PASSWORD: undefined,
11786
11805
  TOKEN: getEnv2("WM_TOKEN"),
11787
11806
  USERNAME: undefined,
11788
- VERSION: "1.666.0",
11807
+ VERSION: "1.667.0",
11789
11808
  WITH_CREDENTIALS: true,
11790
11809
  interceptors: {
11791
11810
  request: new Interceptors,
@@ -12344,6 +12363,7 @@ __export(exports_services_gen, {
12344
12363
  importQueuedJobs: () => importQueuedJobs,
12345
12364
  importInstallation: () => importInstallation,
12346
12365
  importCompletedJobs: () => importCompletedJobs,
12366
+ impersonateServiceAccount: () => impersonateServiceAccount,
12347
12367
  globalWhoami: () => globalWhoami,
12348
12368
  globalUsersOverwrite: () => globalUsersOverwrite,
12349
12369
  globalUsersExport: () => globalUsersExport,
@@ -12521,6 +12541,7 @@ __export(exports_services_gen, {
12521
12541
  exportInstanceGroups: () => exportInstanceGroups,
12522
12542
  exportInstallation: () => exportInstallation,
12523
12543
  exportCompletedJobs: () => exportCompletedJobs,
12544
+ exitImpersonation: () => exitImpersonation,
12524
12545
  existsWorkspace: () => existsWorkspace,
12525
12546
  existsWorkersWithTags: () => existsWorkersWithTags,
12526
12547
  existsWebsocketTrigger: () => existsWebsocketTrigger,
@@ -12635,6 +12656,7 @@ __export(exports_services_gen, {
12635
12656
  createToken: () => createToken,
12636
12657
  createTemplateScript: () => createTemplateScript,
12637
12658
  createSqsTrigger: () => createSqsTrigger,
12659
+ createServiceAccount: () => createServiceAccount,
12638
12660
  createScript: () => createScript,
12639
12661
  createSchedule: () => createSchedule,
12640
12662
  createResourceType: () => createResourceType,
@@ -13374,6 +13396,36 @@ var backendVersion = () => {
13374
13396
  body: data2.requestBody,
13375
13397
  mediaType: "application/json"
13376
13398
  });
13399
+ }, createServiceAccount = (data2) => {
13400
+ return request(OpenAPI, {
13401
+ method: "POST",
13402
+ url: "/w/{workspace}/workspaces/create_service_account",
13403
+ path: {
13404
+ workspace: data2.workspace
13405
+ },
13406
+ body: data2.requestBody,
13407
+ mediaType: "application/json"
13408
+ });
13409
+ }, impersonateServiceAccount = (data2) => {
13410
+ return request(OpenAPI, {
13411
+ method: "POST",
13412
+ url: "/w/{workspace}/users/impersonate_service_account",
13413
+ path: {
13414
+ workspace: data2.workspace
13415
+ },
13416
+ body: data2.requestBody,
13417
+ mediaType: "application/json"
13418
+ });
13419
+ }, exitImpersonation = (data2) => {
13420
+ return request(OpenAPI, {
13421
+ method: "POST",
13422
+ url: "/w/{workspace}/users/exit_impersonation",
13423
+ path: {
13424
+ workspace: data2.workspace
13425
+ },
13426
+ body: data2.requestBody,
13427
+ mediaType: "application/json"
13428
+ });
13377
13429
  }, deleteInvite = (data2) => {
13378
13430
  return request(OpenAPI, {
13379
13431
  method: "POST",
@@ -24449,6 +24501,12 @@ function isRawAppMetadataFile(p) {
24449
24501
  function isRawAppFolderMetadataFile(p) {
24450
24502
  return p.endsWith(getMetadataPathSuffix("raw_app", "yaml")) || p.endsWith(getMetadataPathSuffix("raw_app", "json"));
24451
24503
  }
24504
+ function isAppFolderMetadataFile(p) {
24505
+ return p.endsWith(getMetadataPathSuffix("app", "yaml")) || p.endsWith(getMetadataPathSuffix("app", "json"));
24506
+ }
24507
+ function isFlowFolderMetadataFile(p) {
24508
+ return p.endsWith(getMetadataPathSuffix("flow", "yaml")) || p.endsWith(getMetadataPathSuffix("flow", "json"));
24509
+ }
24452
24510
  function getModuleFolderSuffix() {
24453
24511
  return MODULE_SUFFIX;
24454
24512
  }
@@ -56161,12 +56219,16 @@ function getBranchSpecificTypes() {
56161
56219
  return {
56162
56220
  variable: ".variable.yaml",
56163
56221
  resource: ".resource.yaml",
56222
+ schedule: ".schedule.yaml",
56164
56223
  ...Object.fromEntries(TRIGGER_TYPES.map((t) => [`${t}_trigger`, `.${t}_trigger.yaml`]))
56165
56224
  };
56166
56225
  }
56167
56226
  function isTriggerFile(path5) {
56168
56227
  return TRIGGER_TYPES.some((type) => path5.endsWith(`.${type}_trigger.yaml`));
56169
56228
  }
56229
+ function isScheduleFile(path5) {
56230
+ return path5.endsWith(".schedule.yaml");
56231
+ }
56170
56232
  function getFileTypeSuffix(path5) {
56171
56233
  for (const [_, suffix] of Object.entries(getBranchSpecificTypes())) {
56172
56234
  if (path5.endsWith(suffix)) {
@@ -56180,7 +56242,7 @@ function getFileTypeSuffix(path5) {
56180
56242
  return null;
56181
56243
  }
56182
56244
  function buildYamlTypePattern() {
56183
- const basicTypes = ["variable", "resource"];
56245
+ const basicTypes = ["variable", "resource", "schedule"];
56184
56246
  const triggerTypes = TRIGGER_TYPES.map((t) => `${t}_trigger`);
56185
56247
  return `((${basicTypes.join("|")})|(${triggerTypes.join("|")}))`;
56186
56248
  }
@@ -56212,6 +56274,9 @@ function getSpecificItemsForCurrentBranch(config, branchOverride) {
56212
56274
  if (commonItems?.triggers) {
56213
56275
  merged.triggers = [...commonItems.triggers];
56214
56276
  }
56277
+ if (commonItems?.schedules) {
56278
+ merged.schedules = [...commonItems.schedules];
56279
+ }
56215
56280
  if (commonItems?.folders) {
56216
56281
  merged.folders = [...commonItems.folders];
56217
56282
  }
@@ -56227,6 +56292,9 @@ function getSpecificItemsForCurrentBranch(config, branchOverride) {
56227
56292
  if (branchItems?.triggers) {
56228
56293
  merged.triggers = [...merged.triggers || [], ...branchItems.triggers];
56229
56294
  }
56295
+ if (branchItems?.schedules) {
56296
+ merged.schedules = [...merged.schedules || [], ...branchItems.schedules];
56297
+ }
56230
56298
  if (branchItems?.folders) {
56231
56299
  merged.folders = [...merged.folders || [], ...branchItems.folders];
56232
56300
  }
@@ -56251,6 +56319,9 @@ function isItemTypeConfigured(path5, specificItems) {
56251
56319
  if (isTriggerFile(path5)) {
56252
56320
  return specificItems.triggers !== undefined;
56253
56321
  }
56322
+ if (isScheduleFile(path5)) {
56323
+ return specificItems.schedules !== undefined;
56324
+ }
56254
56325
  if (path5.endsWith("/folder.meta.yaml")) {
56255
56326
  return specificItems.folders !== undefined;
56256
56327
  }
@@ -56275,6 +56346,9 @@ function isSpecificItem(path5, specificItems) {
56275
56346
  if (isTriggerFile(path5)) {
56276
56347
  return specificItems.triggers ? matchesPatterns(path5, specificItems.triggers) : false;
56277
56348
  }
56349
+ if (isScheduleFile(path5)) {
56350
+ return specificItems.schedules ? matchesPatterns(path5, specificItems.schedules) : false;
56351
+ }
56278
56352
  if (path5.endsWith("/folder.meta.yaml")) {
56279
56353
  if (specificItems.folders) {
56280
56354
  const folderPath = path5.slice(0, -"/folder.meta.yaml".length);
@@ -60557,6 +60631,10 @@ function getLanguageFromExtension(ext2, defaultTs = "bun") {
60557
60631
  }
60558
60632
  return;
60559
60633
  }
60634
+ function sanitizeForFilesystem(summary) {
60635
+ const name = summary.toLowerCase().replaceAll(" ", "_").replace(/[/\\:*?"<>|\x00-\x1f\x7f]/g, "").replace(/_+/g, "_").replace(/^[._]+|[._]+$/g, "");
60636
+ return WINDOWS_RESERVED.test(name) ? `_${name}` : name;
60637
+ }
60560
60638
  function newPathAssigner(defaultTs, options) {
60561
60639
  const resolvedOptions = typeof defaultTs === "object" ? defaultTs : { defaultTs, skipInlineScriptSuffix: options?.skipInlineScriptSuffix };
60562
60640
  const { defaultTs: tsRuntime, skipInlineScriptSuffix } = resolvedOptions;
@@ -60564,7 +60642,7 @@ function newPathAssigner(defaultTs, options) {
60564
60642
  const seen_names = new Set;
60565
60643
  function assignPath(summary, language) {
60566
60644
  let name;
60567
- name = summary?.toLowerCase()?.replaceAll(" ", "_") ?? "";
60645
+ name = summary ? sanitizeForFilesystem(summary) : "";
60568
60646
  let original_name = name;
60569
60647
  if (name == "") {
60570
60648
  original_name = INLINE_SCRIPT_PREFIX;
@@ -60586,7 +60664,7 @@ function newRawAppPathAssigner(defaultTs) {
60586
60664
  const seen_names = new Set;
60587
60665
  function assignPath(summary, language) {
60588
60666
  let name;
60589
- name = summary?.toLowerCase()?.replaceAll(" ", "_") ?? "";
60667
+ name = summary ? sanitizeForFilesystem(summary) : "";
60590
60668
  let original_name = name;
60591
60669
  if (name == "") {
60592
60670
  original_name = "runnable";
@@ -60602,7 +60680,7 @@ function newRawAppPathAssigner(defaultTs) {
60602
60680
  }
60603
60681
  return { assignPath };
60604
60682
  }
60605
- var INLINE_SCRIPT_PREFIX = "inline_script", LANGUAGE_EXTENSIONS, EXTENSION_TO_LANGUAGE;
60683
+ var INLINE_SCRIPT_PREFIX = "inline_script", LANGUAGE_EXTENSIONS, EXTENSION_TO_LANGUAGE, WINDOWS_RESERVED;
60606
60684
  var init_path_assigner = __esm(() => {
60607
60685
  LANGUAGE_EXTENSIONS = {
60608
60686
  python3: "py",
@@ -60656,19 +60734,23 @@ var init_path_assigner = __esm(() => {
60656
60734
  rb: "ruby",
60657
60735
  ts: "bun"
60658
60736
  };
60737
+ WINDOWS_RESERVED = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/;
60659
60738
  });
60660
60739
 
60661
60740
  // windmill-utils-internal/src/inline-scripts/extractor.ts
60662
60741
  function extractRawscriptInline(id, summary, rawscript, mapping, separator, assigner) {
60663
60742
  const [basePath, ext2] = assigner.assignPath(summary ?? id, rawscript.language);
60664
- const path7 = mapping[id] ?? basePath + ext2;
60743
+ const mappedPath = mapping[id];
60744
+ const path7 = mappedPath ?? basePath + ext2;
60665
60745
  const language = rawscript.language;
60666
60746
  const content = rawscript.content;
60667
60747
  const r = [{ path: path7, content, language, is_lock: false }];
60668
60748
  rawscript.content = "!inline " + path7.replaceAll(separator, "/");
60669
60749
  const lock = rawscript.lock;
60670
60750
  if (lock && lock != "") {
60671
- const lockPath = basePath + "lock";
60751
+ const dotIdx = mappedPath ? mappedPath.lastIndexOf(".") : -1;
60752
+ const lockBasePath = mappedPath ? dotIdx > 0 ? mappedPath.substring(0, dotIdx + 1) : mappedPath + "." : basePath;
60753
+ const lockPath = lockBasePath + "lock";
60672
60754
  rawscript.lock = "!inline " + lockPath.replaceAll(separator, "/");
60673
60755
  r.push({ path: lockPath, content: lock, language, is_lock: true });
60674
60756
  }
@@ -60703,6 +60785,43 @@ function extractInlineScripts(modules, mapping = {}, separator = "/", defaultTs,
60703
60785
  }
60704
60786
  });
60705
60787
  }
60788
+ function extractCurrentMapping(modules, mapping = {}, failureModule, preprocessorModule) {
60789
+ if (failureModule) {
60790
+ extractCurrentMapping([failureModule], mapping);
60791
+ }
60792
+ if (preprocessorModule) {
60793
+ extractCurrentMapping([preprocessorModule], mapping);
60794
+ }
60795
+ if (!modules || !Array.isArray(modules)) {
60796
+ return mapping;
60797
+ }
60798
+ modules.forEach((m) => {
60799
+ if (!m?.value?.type) {
60800
+ return;
60801
+ }
60802
+ if (m.value.type === "rawscript") {
60803
+ if (m.value.content && m.value.content.startsWith("!inline ")) {
60804
+ mapping[m.id] = m.value.content.trim().split(" ")[1];
60805
+ }
60806
+ } else if (m.value.type === "forloopflow" || m.value.type === "whileloopflow") {
60807
+ extractCurrentMapping(m.value.modules, mapping);
60808
+ } else if (m.value.type === "branchall") {
60809
+ m.value.branches.forEach((b) => extractCurrentMapping(b.modules, mapping));
60810
+ } else if (m.value.type === "branchone") {
60811
+ m.value.branches.forEach((b) => extractCurrentMapping(b.modules, mapping));
60812
+ extractCurrentMapping(m.value.default, mapping);
60813
+ } else if (m.value.type === "aiagent") {
60814
+ (m.value.tools ?? []).forEach((tool) => {
60815
+ const toolValue = tool.value;
60816
+ if (!toolValue || toolValue.tool_type !== "flowmodule" || toolValue.type !== "rawscript" || !toolValue.content || !toolValue.content.startsWith("!inline ")) {
60817
+ return;
60818
+ }
60819
+ mapping[tool.id] = toolValue.content.trim().split(" ")[1];
60820
+ });
60821
+ }
60822
+ });
60823
+ return mapping;
60824
+ }
60706
60825
  var init_extractor = __esm(() => {
60707
60826
  init_path_assigner();
60708
60827
  });
@@ -61000,6 +61119,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
61000
61119
  info(`Recomputing locks of ${changedScripts.join(", ")} in ${folder}`);
61001
61120
  }
61002
61121
  const fileReader = async (path8) => await readFile7(folder + SEP7 + path8, "utf-8");
61122
+ const currentMapping = extractCurrentMapping(flowValue.value.modules, {}, flowValue.value.failure_module, flowValue.value.preprocessor_module);
61003
61123
  const locksToRemove = tree && !legacyBehaviour ? Object.keys(hashes).filter((k) => {
61004
61124
  if (k === TOP_HASH)
61005
61125
  return false;
@@ -61018,12 +61138,12 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
61018
61138
  const lockAssigner = newPathAssigner(opts.defaultTs ?? "bun", {
61019
61139
  skipInlineScriptSuffix: getNonDottedPaths()
61020
61140
  });
61021
- const inlineScripts = extractInlineScripts(flowValue.value.modules, {}, SEP7, opts.defaultTs, lockAssigner);
61141
+ const inlineScripts = extractInlineScripts(flowValue.value.modules, currentMapping, SEP7, opts.defaultTs, lockAssigner);
61022
61142
  if (flowValue.value.failure_module) {
61023
- inlineScripts.push(...extractInlineScripts([flowValue.value.failure_module], {}, SEP7, opts.defaultTs, lockAssigner));
61143
+ inlineScripts.push(...extractInlineScripts([flowValue.value.failure_module], currentMapping, SEP7, opts.defaultTs, lockAssigner));
61024
61144
  }
61025
61145
  if (flowValue.value.preprocessor_module) {
61026
- inlineScripts.push(...extractInlineScripts([flowValue.value.preprocessor_module], {}, SEP7, opts.defaultTs, lockAssigner));
61146
+ inlineScripts.push(...extractInlineScripts([flowValue.value.preprocessor_module], currentMapping, SEP7, opts.defaultTs, lockAssigner));
61027
61147
  }
61028
61148
  inlineScripts.forEach((s) => {
61029
61149
  writeIfChanged(process.cwd() + SEP7 + folder + SEP7 + s.path, s.content);
@@ -63070,16 +63190,60 @@ ${folderList}
63070
63190
  });
63071
63191
  break;
63072
63192
  case "flow":
63073
- await deleteFlowByPath({
63074
- workspace: workspaceId,
63075
- path: removeSuffix(target, getDeleteSuffix("flow", "json"))
63076
- });
63193
+ if (isFlowFolderMetadataFile(target)) {
63194
+ await deleteFlowByPath({
63195
+ workspace: workspaceId,
63196
+ path: removeSuffix(target, getDeleteSuffix("flow", "json"))
63197
+ });
63198
+ } else {
63199
+ const flowFolder = extractFolderPath(target, "flow");
63200
+ let flowFolderExists = false;
63201
+ if (flowFolder) {
63202
+ try {
63203
+ await stat6(flowFolder);
63204
+ flowFolderExists = true;
63205
+ } catch {}
63206
+ }
63207
+ if (flowFolderExists) {
63208
+ await pushObj(workspaceId, target, undefined, undefined, opts.plainSecrets ?? false, alreadySynced, opts.message);
63209
+ } else {
63210
+ const remotePath = extractResourceName(target, "flow");
63211
+ if (remotePath) {
63212
+ await deleteFlowByPath({
63213
+ workspace: workspaceId,
63214
+ path: remotePath
63215
+ });
63216
+ }
63217
+ }
63218
+ }
63077
63219
  break;
63078
63220
  case "app":
63079
- await deleteApp({
63080
- workspace: workspaceId,
63081
- path: removeSuffix(target, getDeleteSuffix("app", "json"))
63082
- });
63221
+ if (isAppFolderMetadataFile(target)) {
63222
+ await deleteApp({
63223
+ workspace: workspaceId,
63224
+ path: removeSuffix(target, getDeleteSuffix("app", "json"))
63225
+ });
63226
+ } else {
63227
+ const appFolder = extractFolderPath(target, "app");
63228
+ let appFolderExists = false;
63229
+ if (appFolder) {
63230
+ try {
63231
+ await stat6(appFolder);
63232
+ appFolderExists = true;
63233
+ } catch {}
63234
+ }
63235
+ if (appFolderExists) {
63236
+ await pushObj(workspaceId, target, undefined, undefined, opts.plainSecrets ?? false, alreadySynced, opts.message);
63237
+ } else {
63238
+ const remotePath = extractResourceName(target, "app");
63239
+ if (remotePath) {
63240
+ await deleteApp({
63241
+ workspace: workspaceId,
63242
+ path: remotePath
63243
+ });
63244
+ }
63245
+ }
63246
+ }
63083
63247
  break;
63084
63248
  case "raw_app":
63085
63249
  if (isRawAppFolderMetadataFile(target)) {
@@ -69982,9 +70146,15 @@ async function pushObj(workspace, p, befObj, newObj, plainSecrets, alreadySynced
69982
70146
  const typeEnding = getTypeStrFromPath(p);
69983
70147
  if (typeEnding === "app") {
69984
70148
  const appName = extractResourceName(p, "app");
70149
+ if (!appName) {
70150
+ throw new Error(`Could not extract app name from path: ${p}`);
70151
+ }
69985
70152
  await pushApp(workspace, appName, buildFolderPath(appName, "app"), message);
69986
70153
  } else if (typeEnding === "raw_app") {
69987
70154
  const rawAppName = extractResourceName(p, "raw_app");
70155
+ if (!rawAppName) {
70156
+ throw new Error(`Could not extract raw app name from path: ${p}`);
70157
+ }
69988
70158
  await pushRawApp(workspace, rawAppName, buildFolderPath(rawAppName, "raw_app"), message);
69989
70159
  } else if (typeEnding === "folder") {
69990
70160
  await pushFolder(workspace, p, befObj, newObj);
@@ -69992,6 +70162,9 @@ async function pushObj(workspace, p, befObj, newObj, plainSecrets, alreadySynced
69992
70162
  await pushVariable(workspace, p, befObj, newObj, plainSecrets);
69993
70163
  } else if (typeEnding === "flow") {
69994
70164
  const flowName = extractResourceName(p, "flow");
70165
+ if (!flowName) {
70166
+ throw new Error(`Could not extract flow name from path: ${p}`);
70167
+ }
69995
70168
  await pushFlow(workspace, flowName, buildFolderPath(flowName, "flow"), message);
69996
70169
  } else if (typeEnding === "resource") {
69997
70170
  if (!alreadySynced3.includes(p)) {
@@ -70607,11 +70780,12 @@ async function generateLocks(opts, folder) {
70607
70780
  }
70608
70781
  }
70609
70782
  }
70610
- function bootstrap2(opts, flowPath) {
70783
+ async function bootstrap2(opts, flowPath) {
70611
70784
  if (!validatePath(flowPath)) {
70612
70785
  return;
70613
70786
  }
70614
- const flowDirFullPath = `${flowPath}.flow`;
70787
+ await loadNonDottedPathsSetting();
70788
+ const flowDirFullPath = buildFolderPath(flowPath, "flow");
70615
70789
  mkdirSync4(flowDirFullPath, { recursive: false });
70616
70790
  const newFlowDefinition = defaultFlowDefinition();
70617
70791
  if (opts.summary !== undefined) {
@@ -70621,7 +70795,8 @@ function bootstrap2(opts, flowPath) {
70621
70795
  newFlowDefinition.description = opts.description;
70622
70796
  }
70623
70797
  const newFlowDefinitionYaml = import_yaml36.stringify(newFlowDefinition);
70624
- const flowYamlPath = `${flowDirFullPath}/flow.yaml`;
70798
+ const metadataFile = getMetadataFileName("flow", "yaml");
70799
+ const flowYamlPath = `${flowDirFullPath}/${metadataFile}`;
70625
70800
  writeFileSync5(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
70626
70801
  }
70627
70802
  var import_yaml36, alreadySynced3, command21, flow_default;
@@ -70632,6 +70807,7 @@ var init_flow = __esm(async () => {
70632
70807
  init_log();
70633
70808
  init_yaml();
70634
70809
  init_services_gen();
70810
+ init_resource_folders();
70635
70811
  await __promiseAll([
70636
70812
  init_types(),
70637
70813
  init_confirm(),
@@ -73560,7 +73736,6 @@ await __promiseAll([
73560
73736
  init_workspace(),
73561
73737
  init_resource_type()
73562
73738
  ]);
73563
- var import_yaml40 = __toESM(require_dist(), 1);
73564
73739
  import { stat as stat16, writeFile as writeFile19, rm as rm4, mkdir as mkdir9 } from "node:fs/promises";
73565
73740
 
73566
73741
  // src/guidance/skills.ts
@@ -78555,6 +78730,13 @@ app related commands
78555
78730
  - \`--dry-run\` - Perform a dry run without making changes
78556
78731
  - \`--default-ts <runtime:string>\` - Default TypeScript runtime (bun or deno)
78557
78732
 
78733
+ ### config
78734
+
78735
+ Show all available wmill.yaml configuration options
78736
+
78737
+ **Options:**
78738
+ - \`--json\` - Output as JSON for programmatic consumption
78739
+
78558
78740
  ### dependencies
78559
78741
 
78560
78742
  workspace dependencies related commands
@@ -79950,6 +80132,406 @@ ${skillsReference}
79950
80132
  `;
79951
80133
  }
79952
80134
 
80135
+ // src/commands/init/template.ts
80136
+ var NON_SCHEMA_KEYS = new Set([
80137
+ "name",
80138
+ "default",
80139
+ "section",
80140
+ "sectionNote",
80141
+ "commented",
80142
+ "templateValue",
80143
+ "example",
80144
+ "inlineComment",
80145
+ "groupNote"
80146
+ ]);
80147
+ var SPECIFIC_ITEMS_SCHEMA = {
80148
+ type: "object",
80149
+ description: "Sync only specific items",
80150
+ properties: {
80151
+ variables: { type: "array", items: { type: "string" }, description: "Specific variable paths to sync" },
80152
+ resources: { type: "array", items: { type: "string" }, description: "Specific resource paths to sync" },
80153
+ triggers: { type: "array", items: { type: "string" }, description: "Specific trigger paths to sync" },
80154
+ folders: { type: "array", items: { type: "string" }, description: "Specific folder paths to sync" },
80155
+ settings: { type: "boolean", description: "Whether to sync settings" }
80156
+ },
80157
+ additionalProperties: false
80158
+ };
80159
+ var BRANCH_CONFIG_SCHEMA = {
80160
+ type: "object",
80161
+ properties: {
80162
+ baseUrl: { type: "string", description: "Windmill instance URL for this branch" },
80163
+ workspaceId: { type: "string", description: "Workspace ID to sync with for this branch" },
80164
+ overrides: { type: "object", description: "Override any top-level sync option for this branch" },
80165
+ promotionOverrides: { type: "object", description: "Overrides applied when using --promotion flag" },
80166
+ specificItems: SPECIFIC_ITEMS_SCHEMA
80167
+ },
80168
+ additionalProperties: false
80169
+ };
80170
+ var CONFIG_REFERENCE = [
80171
+ { name: "defaultTs", type: "string", enum: ["bun", "deno"], default: "bun", description: "Default TypeScript runtime for new scripts" },
80172
+ {
80173
+ name: "includes",
80174
+ type: "array",
80175
+ items: { type: "string" },
80176
+ default: '["f/**"]',
80177
+ description: "Glob patterns for files to include in sync",
80178
+ templateValue: `
80179
+ - "f/**"`
80180
+ },
80181
+ {
80182
+ name: "extraIncludes",
80183
+ type: "array",
80184
+ items: { type: "string" },
80185
+ default: "[]",
80186
+ description: "Additional glob patterns merged with includes (useful in branch overrides)",
80187
+ commented: true
80188
+ },
80189
+ { name: "excludes", type: "array", items: { type: "string" }, default: "[]", description: "Glob patterns for files to exclude from sync" },
80190
+ {
80191
+ name: "skipVariables",
80192
+ type: "boolean",
80193
+ default: "false",
80194
+ description: "Skip syncing variables",
80195
+ section: "What to sync",
80196
+ sectionNote: '"skip" options default to false (synced), "include" options default to false (not synced)'
80197
+ },
80198
+ { name: "skipResources", type: "boolean", default: "false", description: "Skip syncing resources" },
80199
+ { name: "skipResourceTypes", type: "boolean", default: "false", description: "Skip syncing resource types" },
80200
+ {
80201
+ name: "skipSecrets",
80202
+ type: "boolean",
80203
+ default: "true",
80204
+ description: "Skip syncing secrets (true by default for security)",
80205
+ inlineComment: "true by default — secrets are not synced for security"
80206
+ },
80207
+ { name: "skipScripts", type: "boolean", default: "false", description: "Skip syncing scripts" },
80208
+ { name: "skipFlows", type: "boolean", default: "false", description: "Skip syncing flows" },
80209
+ { name: "skipApps", type: "boolean", default: "false", description: "Skip syncing apps" },
80210
+ { name: "skipFolders", type: "boolean", default: "false", description: "Skip syncing folders" },
80211
+ { name: "skipWorkspaceDependencies", type: "boolean", default: "false", description: "Skip syncing workspace dependencies" },
80212
+ {
80213
+ name: "includeSchedules",
80214
+ type: "boolean",
80215
+ default: "false",
80216
+ description: "Include schedules in sync",
80217
+ commented: true,
80218
+ templateValue: "true",
80219
+ groupNote: "Uncomment to include these (excluded by default):"
80220
+ },
80221
+ {
80222
+ name: "includeTriggers",
80223
+ type: "boolean",
80224
+ default: "false",
80225
+ description: "Include triggers (http, websocket, kafka, etc.) in sync",
80226
+ commented: true,
80227
+ templateValue: "true"
80228
+ },
80229
+ {
80230
+ name: "includeUsers",
80231
+ type: "boolean",
80232
+ default: "false",
80233
+ description: "Include workspace users in sync",
80234
+ commented: true,
80235
+ templateValue: "true"
80236
+ },
80237
+ {
80238
+ name: "includeGroups",
80239
+ type: "boolean",
80240
+ default: "false",
80241
+ description: "Include workspace groups in sync",
80242
+ commented: true,
80243
+ templateValue: "true"
80244
+ },
80245
+ {
80246
+ name: "includeSettings",
80247
+ type: "boolean",
80248
+ default: "false",
80249
+ description: "Include workspace settings in sync",
80250
+ commented: true,
80251
+ templateValue: "true"
80252
+ },
80253
+ {
80254
+ name: "includeKey",
80255
+ type: "boolean",
80256
+ default: "false",
80257
+ description: "Include encryption key in sync",
80258
+ commented: true,
80259
+ templateValue: "true"
80260
+ },
80261
+ {
80262
+ name: "parallel",
80263
+ type: "integer",
80264
+ default: "(unset)",
80265
+ description: "Number of parallel operations during sync",
80266
+ section: "Sync behavior",
80267
+ commented: true,
80268
+ templateValue: "4"
80269
+ },
80270
+ {
80271
+ name: "locksRequired",
80272
+ type: "boolean",
80273
+ default: "false",
80274
+ description: "Require lock files for all scripts",
80275
+ commented: true,
80276
+ templateValue: "true"
80277
+ },
80278
+ {
80279
+ name: "lint",
80280
+ type: "boolean",
80281
+ default: "false",
80282
+ description: "Run linting before push",
80283
+ commented: true,
80284
+ templateValue: "true"
80285
+ },
80286
+ {
80287
+ name: "plainSecrets",
80288
+ type: "boolean",
80289
+ default: "false",
80290
+ description: "Handle secrets as plain text (not recommended)",
80291
+ commented: true
80292
+ },
80293
+ {
80294
+ name: "message",
80295
+ type: "string",
80296
+ default: "(unset)",
80297
+ description: "Default commit message for sync operations",
80298
+ commented: true,
80299
+ templateValue: '"my commit message"'
80300
+ },
80301
+ {
80302
+ name: "promotion",
80303
+ type: "string",
80304
+ default: "(unset)",
80305
+ description: "Branch name to use promotion overrides from during sync",
80306
+ commented: true,
80307
+ templateValue: "staging"
80308
+ },
80309
+ {
80310
+ name: "skipBranchValidation",
80311
+ type: "boolean",
80312
+ default: "false",
80313
+ description: "Skip validation that current git branch matches a configured branch",
80314
+ commented: true
80315
+ },
80316
+ { name: "nonDottedPaths", type: "boolean", default: "true", description: "Use __flow/__app/__raw_app suffixes instead of .flow/.app/.raw_app" },
80317
+ {
80318
+ name: "codebases",
80319
+ type: "array",
80320
+ default: "[]",
80321
+ description: "Codebase bundling configurations for shared libraries",
80322
+ items: {
80323
+ type: "object",
80324
+ properties: {
80325
+ relative_path: { type: "string", description: "Path to the codebase directory" },
80326
+ includes: { type: "array", items: { type: "string" }, description: "Glob patterns for files to include in bundle" },
80327
+ excludes: { type: "array", items: { type: "string" }, description: "Glob patterns for files to exclude from bundle" },
80328
+ format: { type: "string", enum: ["cjs", "esm"], description: "Bundle output format" },
80329
+ external: { type: "array", items: { type: "string" }, description: "Dependencies to leave unbundled (externals)" },
80330
+ assets: { type: "array", items: { type: "object", properties: { from: { type: "string" }, to: { type: "string" } }, required: ["from", "to"] }, description: "Static files to copy into the bundle" },
80331
+ customBundler: { type: "string", description: "Path to a custom bundler script (replaces esbuild)" },
80332
+ inject: { type: "array", items: { type: "string" }, description: "Files to inject into every entry point" },
80333
+ define: { type: "object", additionalProperties: { type: "string" }, description: "Compile-time constant definitions" },
80334
+ banner: { type: "object", additionalProperties: { type: "string" }, description: "Text to prepend to output files by type" },
80335
+ loader: { type: "object", additionalProperties: { type: "string" }, description: "esbuild loader overrides by extension" }
80336
+ },
80337
+ required: ["relative_path"],
80338
+ additionalProperties: false
80339
+ },
80340
+ section: "Codebase bundling (shared libraries)",
80341
+ sectionNote: `Bundle TypeScript/JavaScript codebases that scripts import from.
80342
+ Each entry is bundled and uploaded so scripts can import shared code.`,
80343
+ example: [
80344
+ "# codebases:",
80345
+ "# - relative_path: ./shared # path to the codebase",
80346
+ '# includes: ["**/*.ts"] # files to include in bundle',
80347
+ '# excludes: ["node_modules/**"] # files to exclude',
80348
+ '# format: esm # bundle format: "cjs" or "esm"',
80349
+ '# external: ["pg", "axios"] # dependencies to leave unbundled',
80350
+ "# assets: # static files to copy into bundle",
80351
+ "# - from: ./static",
80352
+ "# to: ./dist",
80353
+ "# # customBundler: ./build.ts # custom bundler script (replaces esbuild)",
80354
+ '# # inject: ["./polyfills.ts"] # files to inject into every entry point',
80355
+ "# # define: # compile-time constants",
80356
+ `# # API_URL: '"https://api.example.com"'`,
80357
+ "# # banner: # text prepended to output files",
80358
+ '# # js: "/* bundled by windmill */"',
80359
+ "# # loader: # esbuild loader overrides",
80360
+ '# # ".png": "dataurl"'
80361
+ ].join(`
80362
+ `)
80363
+ },
80364
+ {
80365
+ name: "gitBranches",
80366
+ type: "object",
80367
+ default: "{}",
80368
+ description: "Map git branches to workspaces and per-branch sync overrides",
80369
+ properties: { commonSpecificItems: SPECIFIC_ITEMS_SCHEMA },
80370
+ additionalProperties: BRANCH_CONFIG_SCHEMA,
80371
+ section: "Git branch / environment bindings",
80372
+ sectionNote: `Map git branches to Windmill workspaces and override settings per branch.
80373
+ Use "environments" as an alias if you prefer environment-based terminology.`,
80374
+ templateValue: `
80375
+ {{BRANCH}}:
80376
+ overrides: {}`,
80377
+ example: [
80378
+ "{{BASEURL_LINE}}",
80379
+ "{{WORKSPACE_ID_LINE}}",
80380
+ " # promotionOverrides: # overrides applied during --promotion",
80381
+ " # skipSecrets: false",
80382
+ " # specificItems: # only sync these specific items",
80383
+ ' # variables: ["f/my_folder/my_var"]',
80384
+ ' # resources: ["f/my_folder/my_res"]',
80385
+ ' # triggers: ["f/my_folder/my_trigger"]',
80386
+ ' # folders: ["my_folder"]',
80387
+ " # settings: true",
80388
+ "",
80389
+ " # Example: staging branch bound to a different workspace",
80390
+ " # staging:",
80391
+ " # baseUrl: https://staging.windmill.dev",
80392
+ " # workspaceId: staging-workspace",
80393
+ " # overrides:",
80394
+ " # skipSecrets: false",
80395
+ " # includeSchedules: true",
80396
+ "",
80397
+ " # Items shared across ALL branches",
80398
+ " # commonSpecificItems:",
80399
+ ' # variables: ["f/shared/api_key"]',
80400
+ ' # resources: ["f/shared/db_conn"]',
80401
+ ' # folders: ["shared"]'
80402
+ ].join(`
80403
+ `)
80404
+ },
80405
+ {
80406
+ name: "environments",
80407
+ type: "object",
80408
+ default: "{}",
80409
+ description: "Alias for gitBranches — use if you prefer environment-based terminology",
80410
+ properties: { commonSpecificItems: SPECIFIC_ITEMS_SCHEMA },
80411
+ additionalProperties: BRANCH_CONFIG_SCHEMA,
80412
+ commented: true
80413
+ }
80414
+ ];
80415
+ function yamlKey(s) {
80416
+ if (/^[a-zA-Z0-9_/.@-]+$/.test(s) && !/^(true|false|yes|no|on|off|null|~)$/i.test(s) && !/^\d+(\.\d+)?$/.test(s)) {
80417
+ return s;
80418
+ }
80419
+ return `"${s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
80420
+ }
80421
+ function generateCommentedTemplate(branchName, binding) {
80422
+ const branch = yamlKey(branchName ?? "main");
80423
+ const lines = [
80424
+ "# yaml-language-server: $schema=wmill.schema.json",
80425
+ "# wmill.yaml — Windmill CLI configuration",
80426
+ '# Full reference: run "wmill config"',
80427
+ ""
80428
+ ];
80429
+ for (const opt of CONFIG_REFERENCE) {
80430
+ if (opt.section) {
80431
+ const ruler = "-".repeat(Math.max(0, 65 - opt.section.length));
80432
+ lines.push(`# --- ${opt.section} ${ruler}`);
80433
+ if (opt.sectionNote) {
80434
+ for (const noteLine of opt.sectionNote.split(`
80435
+ `)) {
80436
+ lines.push(`# ${noteLine}`);
80437
+ }
80438
+ }
80439
+ lines.push("");
80440
+ }
80441
+ if (opt.groupNote) {
80442
+ lines.push(`# ${opt.groupNote}`);
80443
+ }
80444
+ const value = opt.templateValue ?? opt.default;
80445
+ const resolvedValue = value.replace("{{BRANCH}}", branch);
80446
+ if (opt.commented) {
80447
+ lines.push(`# ${opt.description}`);
80448
+ lines.push(`# ${opt.name}: ${resolvedValue}`);
80449
+ } else {
80450
+ lines.push(`# ${opt.description}`);
80451
+ if (opt.inlineComment) {
80452
+ const base = `${opt.name}: ${resolvedValue}`;
80453
+ const pad = " ".repeat(Math.max(1, 32 - base.length));
80454
+ lines.push(`${base}${pad}# ${opt.inlineComment}`);
80455
+ } else {
80456
+ lines.push(`${opt.name}: ${resolvedValue}`);
80457
+ }
80458
+ }
80459
+ if (opt.example) {
80460
+ let resolvedExample = opt.example.replace(/\{\{BRANCH\}\}/g, branch);
80461
+ if (binding) {
80462
+ resolvedExample = resolvedExample.replace("{{BASEURL_LINE}}", ` baseUrl: ${binding.baseUrl}`).replace("{{WORKSPACE_ID_LINE}}", ` workspaceId: ${binding.workspaceId}`);
80463
+ } else {
80464
+ resolvedExample = resolvedExample.replace("{{BASEURL_LINE}}", " # baseUrl: https://app.windmill.dev # Windmill instance URL for this branch").replace("{{WORKSPACE_ID_LINE}}", " # workspaceId: my-workspace # workspace to sync with");
80465
+ }
80466
+ for (const exLine of resolvedExample.split(`
80467
+ `)) {
80468
+ lines.push(exLine);
80469
+ }
80470
+ }
80471
+ lines.push("");
80472
+ }
80473
+ return lines.join(`
80474
+ `);
80475
+ }
80476
+ function expandSchema(prefix, schema, rows) {
80477
+ if (schema.properties) {
80478
+ for (const [key, prop] of Object.entries(schema.properties)) {
80479
+ const name = prefix ? `${prefix}.${key}` : key;
80480
+ rows.push({ name, description: prop.description ?? "", default: "" });
80481
+ if (prop.properties && prop.type === "object") {
80482
+ expandSchema(name, prop, rows);
80483
+ }
80484
+ }
80485
+ }
80486
+ }
80487
+ function formatConfigReference() {
80488
+ const nameWidth = 48;
80489
+ const descWidth = 70;
80490
+ const header = [
80491
+ "OPTION".padEnd(nameWidth),
80492
+ "DESCRIPTION".padEnd(descWidth),
80493
+ "DEFAULT"
80494
+ ].join(" ");
80495
+ const separator = "-".repeat(header.length + 10);
80496
+ const allRows = [];
80497
+ for (const opt of CONFIG_REFERENCE) {
80498
+ allRows.push({ name: opt.name, description: opt.description, default: opt.default });
80499
+ if (opt.items?.properties) {
80500
+ expandSchema(`${opt.name}[]`, opt.items, allRows);
80501
+ }
80502
+ if (opt.additionalProperties && typeof opt.additionalProperties === "object" && opt.additionalProperties.properties) {
80503
+ expandSchema(`${opt.name}.<branch>`, opt.additionalProperties, allRows);
80504
+ }
80505
+ if (opt.properties) {
80506
+ expandSchema(opt.name, opt, allRows);
80507
+ }
80508
+ }
80509
+ const rows = allRows.map((r) => [r.name.padEnd(nameWidth), r.description.padEnd(descWidth), r.default].join(" "));
80510
+ return [
80511
+ "wmill.yaml — Configuration Reference",
80512
+ "",
80513
+ "Full documentation: https://www.windmill.dev/docs/advanced/cli",
80514
+ "",
80515
+ separator,
80516
+ header,
80517
+ separator,
80518
+ ...rows,
80519
+ separator,
80520
+ "",
80521
+ 'Run "wmill init" to generate a wmill.yaml with commented examples.'
80522
+ ].join(`
80523
+ `);
80524
+ }
80525
+ function formatConfigReferenceJson() {
80526
+ const clean = CONFIG_REFERENCE.map((opt) => ({
80527
+ name: opt.name,
80528
+ type: opt.type,
80529
+ default: opt.default,
80530
+ description: opt.description
80531
+ }));
80532
+ return JSON.stringify(clean, null, 2);
80533
+ }
80534
+
79953
80535
  // src/commands/init/init.ts
79954
80536
  function formatSchemaForMarkdown(schemaYaml, schemaName, filePattern) {
79955
80537
  return `## ${schemaName} (\`${filePattern}\`)
@@ -79964,36 +80546,22 @@ async function initAction(opts) {
79964
80546
  if (await stat16("wmill.yaml").catch(() => null)) {
79965
80547
  error(colors.red("wmill.yaml already exists"));
79966
80548
  } else {
79967
- const { DEFAULT_SYNC_OPTIONS: DEFAULT_SYNC_OPTIONS2 } = await init_conf().then(() => exports_conf);
79968
- const initialConfig = { ...DEFAULT_SYNC_OPTIONS2 };
79969
80549
  const { isGitRepository: isGitRepository2, getCurrentGitBranch: getCurrentGitBranch2 } = await Promise.resolve().then(() => (init_git(), exports_git));
80550
+ let branchName;
80551
+ let binding;
79970
80552
  if (isGitRepository2()) {
79971
- const currentBranch = getCurrentGitBranch2();
79972
- if (currentBranch) {
79973
- initialConfig.gitBranches = {
79974
- [currentBranch]: { overrides: {} }
79975
- };
79976
- } else {
79977
- initialConfig.gitBranches = {};
79978
- }
79979
- } else {
79980
- initialConfig.gitBranches = {};
80553
+ branchName = getCurrentGitBranch2() ?? undefined;
79981
80554
  }
79982
- initialConfig.nonDottedPaths = true;
79983
- await writeFile19("wmill.yaml", import_yaml40.stringify(initialConfig), "utf-8");
79984
- info(colors.green("wmill.yaml created with default settings"));
79985
- await readLockfile();
79986
- if (isGitRepository2()) {
80555
+ if (isGitRepository2() && branchName) {
79987
80556
  const activeWorkspace = await getActiveWorkspaceOrFallback(opts);
79988
- const currentBranch = getCurrentGitBranch2();
79989
- if (activeWorkspace && currentBranch) {
80557
+ if (activeWorkspace) {
79990
80558
  const shouldBind = opts.bindProfile === true;
79991
80559
  const shouldPrompt = opts.bindProfile === undefined && !!process.stdin.isTTY && !opts.useDefault;
79992
- const shouldSkip = opts.bindProfile != true && (opts.useDefault || !!!process.stdin.isTTY);
80560
+ const shouldSkip = opts.bindProfile != true && (opts.useDefault || !process.stdin.isTTY);
79993
80561
  if (!shouldSkip) {
79994
80562
  if (shouldBind || shouldPrompt) {
79995
80563
  info(colors.yellow(`
79996
- Current Git branch: ${colors.bold(currentBranch)}`));
80564
+ Current Git branch: ${colors.bold(branchName)}`));
79997
80565
  info(colors.yellow(`Active workspace profile: ${colors.bold(activeWorkspace.name)}`));
79998
80566
  info(colors.yellow(` ${activeWorkspace.workspaceId} on ${activeWorkspace.remote}`));
79999
80567
  }
@@ -80001,22 +80569,21 @@ Current Git branch: ${colors.bold(currentBranch)}`));
80001
80569
  message: "Bind workspace profile to current Git branch?",
80002
80570
  default: true
80003
80571
  })) {
80004
- const currentConfig = await init_conf().then(() => exports_conf).then((m) => m.readConfigFile());
80005
- if (!currentConfig.gitBranches) {
80006
- currentConfig.gitBranches = {};
80007
- }
80008
- if (!currentConfig.gitBranches[currentBranch]) {
80009
- currentConfig.gitBranches[currentBranch] = { overrides: {} };
80010
- }
80011
- info(`binding branch ${currentBranch} to workspace ${activeWorkspace.name} on ${activeWorkspace.remote}`);
80012
- currentConfig.gitBranches[currentBranch].baseUrl = activeWorkspace.remote;
80013
- currentConfig.gitBranches[currentBranch].workspaceId = activeWorkspace.workspaceId;
80014
- await writeFile19("wmill.yaml", import_yaml40.stringify(currentConfig), "utf-8");
80015
- info(colors.green(`✓ Bound branch '${currentBranch}' to workspace '${activeWorkspace.name}'`));
80572
+ info(`binding branch ${branchName} to workspace ${activeWorkspace.name} on ${activeWorkspace.remote}`);
80573
+ binding = {
80574
+ baseUrl: activeWorkspace.remote,
80575
+ workspaceId: activeWorkspace.workspaceId
80576
+ };
80016
80577
  }
80017
80578
  }
80018
80579
  }
80019
80580
  }
80581
+ await writeFile19("wmill.yaml", generateCommentedTemplate(branchName, binding), "utf-8");
80582
+ info(colors.green("wmill.yaml created with default settings"));
80583
+ if (binding) {
80584
+ info(colors.green(`✓ Bound branch '${branchName}' to workspace`));
80585
+ }
80586
+ await readLockfile();
80020
80587
  if (!opts.useDefault) {
80021
80588
  try {
80022
80589
  const { requireLogin: requireLogin2 } = await init_auth().then(() => exports_auth);
@@ -80615,10 +81182,23 @@ ${await res.text()}`);
80615
81182
  var command30 = new Command().name("docs").description("Search Windmill documentation. Requires Enterprise Edition.").arguments("<query:string>").option("--json", "Output results as JSON.").action(docs);
80616
81183
  var docs_default = command30;
80617
81184
 
81185
+ // src/commands/config/config.ts
81186
+ init_mod3();
81187
+ init_log();
81188
+ async function configAction(opts) {
81189
+ if (opts.json) {
81190
+ console.log(formatConfigReferenceJson());
81191
+ } else {
81192
+ info(formatConfigReference());
81193
+ }
81194
+ }
81195
+ var command31 = new Command().name("config").description("Show all available wmill.yaml configuration options").option("--json", "Output as JSON for programmatic consumption").action(configAction);
81196
+ var config_default = command31;
81197
+
80618
81198
  // src/main.ts
80619
81199
  await init_context();
80620
- var VERSION = "1.666.0";
80621
- var command31 = 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("generate-metadata", generate_metadata_default).command("docs", docs_default).command("version --version", "Show version information").action(async (opts) => {
81200
+ var VERSION = "1.667.0";
81201
+ var command32 = 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("generate-metadata", generate_metadata_default).command("docs", docs_default).command("config", config_default).command("version --version", "Show version information").action(async (opts) => {
80622
81202
  console.log("CLI version: " + VERSION);
80623
81203
  try {
80624
81204
  const provider = new NpmProvider({ package: "windmill-cli" });
@@ -80648,20 +81228,20 @@ var command31 = new Command().name("wmill").action(() => info(`Welcome to Windmi
80648
81228
  error(e);
80649
81229
  info("Try running with sudo and otherwise check the result of the command: npm uninstall windmill-cli && npm install -g windmill-cli");
80650
81230
  })).command("completions", new Command().description("Generate shell completions.").command("bash", new Command().description("Generate bash completions.").action(() => {
80651
- process.stdout.write(generateShellCompletions(command31, "bash") + `
81231
+ process.stdout.write(generateShellCompletions(command32, "bash") + `
80652
81232
  `);
80653
81233
  })).command("zsh", new Command().description("Generate zsh completions.").action(() => {
80654
- process.stdout.write(generateShellCompletions(command31, "zsh") + `
81234
+ process.stdout.write(generateShellCompletions(command32, "zsh") + `
80655
81235
  `);
80656
81236
  })).command("fish", new Command().description("Generate fish completions.").action(() => {
80657
- process.stdout.write(generateShellCompletions(command31, "fish") + `
81237
+ process.stdout.write(generateShellCompletions(command32, "fish") + `
80658
81238
  `);
80659
81239
  })));
80660
81240
  async function main2() {
80661
81241
  try {
80662
81242
  const args = process.argv.slice(2);
80663
81243
  if (args.length === 0) {
80664
- command31.showHelp();
81244
+ command32.showHelp();
80665
81245
  }
80666
81246
  const LOG_LEVEL = args.includes("--verbose") || args.includes("--debug") ? "DEBUG" : "INFO";
80667
81247
  setShowDiffs(args.includes("--show-diffs"));
@@ -80671,7 +81251,7 @@ async function main2() {
80671
81251
  if (extraHeaders) {
80672
81252
  OpenAPI.HEADERS = extraHeaders;
80673
81253
  }
80674
- await command31.parse(args);
81254
+ await command32.parse(args);
80675
81255
  } catch (e) {
80676
81256
  if (e && typeof e === "object" && "name" in e && e.name === "ApiError") {
80677
81257
  console.log("Server failed. " + e.statusText + ": " + e.body);
@@ -80696,7 +81276,7 @@ if (isMain()) {
80696
81276
  process.stdin.destroy();
80697
81277
  });
80698
81278
  }
80699
- var main_default = command31;
81279
+ var main_default = command32;
80700
81280
  export {
80701
81281
  add as workspaceAdd,
80702
81282
  workspace_default as workspace,
@@ -80720,6 +81300,7 @@ export {
80720
81300
  docs_default as docs,
80721
81301
  dev_default2 as dev,
80722
81302
  main_default as default,
81303
+ config_default as config,
80723
81304
  app_default as app,
80724
81305
  WM_FORK_PREFIX,
80725
81306
  VERSION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.666.0",
3
+ "version": "1.667.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",