windmill-cli 1.817.0 → 1.818.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 +387 -335
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -16766,7 +16766,7 @@ var init_OpenAPI = __esm(() => {
16766
16766
  PASSWORD: undefined,
16767
16767
  TOKEN: getEnv3("WM_TOKEN"),
16768
16768
  USERNAME: undefined,
16769
- VERSION: "1.817.0",
16769
+ VERSION: "1.818.0",
16770
16770
  WITH_CREDENTIALS: true,
16771
16771
  interceptors: {
16772
16772
  request: new Interceptors,
@@ -20020,7 +20020,7 @@ var init_auth = __esm(async () => {
20020
20020
  });
20021
20021
 
20022
20022
  // src/core/constants.ts
20023
- var WM_FORK_PREFIX = "wm-fork", VERSION = "1.817.0";
20023
+ var WM_FORK_PREFIX = "wm-fork", VERSION = "1.818.0";
20024
20024
 
20025
20025
  // src/utils/resource_folders.ts
20026
20026
  import { existsSync } from "node:fs";
@@ -22011,7 +22011,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22011
22011
  path,
22012
22012
  value: variable.value ?? "",
22013
22013
  is_secret: variable.is_secret,
22014
- description: variable.description ?? ""
22014
+ description: variable.description ?? "",
22015
+ labels: variable.labels
22015
22016
  },
22016
22017
  alreadyEncrypted: false
22017
22018
  });
@@ -22022,7 +22023,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22022
22023
  path,
22023
22024
  value: variable.value ?? "",
22024
22025
  is_secret: variable.is_secret,
22025
- description: variable.description ?? ""
22026
+ description: variable.description ?? "",
22027
+ labels: variable.labels
22026
22028
  }
22027
22029
  });
22028
22030
  }
@@ -22038,7 +22040,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22038
22040
  requestBody: {
22039
22041
  path,
22040
22042
  value: resource.value ?? "",
22041
- description: resource.description ?? ""
22043
+ description: resource.description ?? "",
22044
+ labels: resource.labels
22042
22045
  }
22043
22046
  });
22044
22047
  } else {
@@ -22048,7 +22051,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22048
22051
  path,
22049
22052
  value: resource.value ?? "",
22050
22053
  resource_type: resource.resource_type,
22051
- description: resource.description ?? ""
22054
+ description: resource.description ?? "",
22055
+ labels: resource.labels
22052
22056
  }
22053
22057
  });
22054
22058
  }
@@ -22089,7 +22093,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22089
22093
  requestBody: {
22090
22094
  owners: folder.owners,
22091
22095
  extra_perms: folder.extra_perms,
22092
- summary: folder.summary ?? undefined
22096
+ summary: folder.summary ?? undefined,
22097
+ labels: folder.labels ?? []
22093
22098
  }
22094
22099
  });
22095
22100
  } else {
@@ -22099,7 +22104,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22099
22104
  name,
22100
22105
  owners: folder.owners,
22101
22106
  extra_perms: folder.extra_perms,
22102
- summary: folder.summary ?? undefined
22107
+ summary: folder.summary ?? undefined,
22108
+ labels: folder.labels
22103
22109
  }
22104
22110
  });
22105
22111
  }
@@ -34753,6 +34759,30 @@ var init_job_polling = __esm(() => {
34753
34759
  });
34754
34760
 
34755
34761
  // src/utils/codebase.ts
34762
+ import { readFile as readFile2, stat as stat4 } from "node:fs/promises";
34763
+ import path7 from "node:path";
34764
+ function extraDigestPaths(codebase) {
34765
+ return [].concat(codebase.extra_digest_paths ?? []);
34766
+ }
34767
+ async function digestPath(p) {
34768
+ let s;
34769
+ try {
34770
+ s = await stat4(p);
34771
+ } catch {
34772
+ throw new Error(`Codebase extra_digest_paths entry not found: ${p} (resolved to ${path7.resolve(p)})`);
34773
+ }
34774
+ return s.isDirectory() ? await digestDir(p, "") : await generateHashFromBuffer(await readFile2(p));
34775
+ }
34776
+ function uncoveredBundleInputs(codebase, entry, inputs) {
34777
+ const entryAbs = path7.resolve(entry);
34778
+ const roots = [codebase.relative_path, ...extraDigestPaths(codebase)].map((r) => path7.resolve(r));
34779
+ return inputs.filter((i) => {
34780
+ if (/^[<(]|^[a-z-]{2,}:/i.test(i) || i.includes("node_modules"))
34781
+ return false;
34782
+ const abs = path7.resolve(i);
34783
+ return abs != entryAbs && !roots.some((r) => abs == r || abs.startsWith(r + path7.sep));
34784
+ });
34785
+ }
34756
34786
  function listSyncCodebases(options) {
34757
34787
  const res = [];
34758
34788
  const nb_codebase = options?.codebases?.length ?? 0;
@@ -34765,10 +34795,16 @@ function listSyncCodebases(options) {
34765
34795
  let hasAssets = false;
34766
34796
  const getDigest = async (forceTar) => {
34767
34797
  if (_digest == undefined) {
34768
- _digest = await digestDir(codebase.relative_path, JSON.stringify(codebase));
34798
+ let digest = await digestDir(codebase.relative_path, JSON.stringify(codebase));
34799
+ const extra = extraDigestPaths(codebase);
34800
+ if (extra.length > 0) {
34801
+ const hashes = await Promise.all(extra.map(digestPath));
34802
+ digest = await generateHash(digest + hashes.join(""));
34803
+ }
34769
34804
  if (codebase.format == "esm") {
34770
- _digest += ".esm";
34805
+ digest += ".esm";
34771
34806
  }
34807
+ _digest = digest;
34772
34808
  if (!alreadyPrinted) {
34773
34809
  alreadyPrinted = true;
34774
34810
  info(`Codebase ${codebase.relative_path}, digest: ${_digest}`);
@@ -36254,7 +36290,7 @@ var minimatch = (p, pattern, options = {}) => {
36254
36290
  }, qmarksTestNoExtDot = ([$0]) => {
36255
36291
  const len = $0.length;
36256
36292
  return (f) => f.length === len && f !== "." && f !== "..";
36257
- }, defaultPlatform, path7, sep3, GLOBSTAR, qmark2 = "[^/]", star2, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
36293
+ }, defaultPlatform, path8, sep3, GLOBSTAR, qmark2 = "[^/]", star2, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
36258
36294
  if (!def || typeof def !== "object" || !Object.keys(def).length) {
36259
36295
  return minimatch;
36260
36296
  }
@@ -36312,11 +36348,11 @@ var init_esm2 = __esm(() => {
36312
36348
  starRE = /^\*+$/;
36313
36349
  qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
36314
36350
  defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
36315
- path7 = {
36351
+ path8 = {
36316
36352
  win32: { sep: "\\" },
36317
36353
  posix: { sep: "/" }
36318
36354
  };
36319
- sep3 = defaultPlatform === "win32" ? path7.win32.sep : path7.posix.sep;
36355
+ sep3 = defaultPlatform === "win32" ? path8.win32.sep : path8.posix.sep;
36320
36356
  minimatch.sep = sep3;
36321
36357
  GLOBSTAR = Symbol("globstar **");
36322
36358
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -56943,7 +56979,7 @@ var init_openflow = __esm(() => {
56943
56979
  openflow_default = {
56944
56980
  openapi: "3.0.3",
56945
56981
  info: {
56946
- version: "1.817.0",
56982
+ version: "1.818.0",
56947
56983
  title: "OpenFlow Spec",
56948
56984
  contact: {
56949
56985
  name: "Ruben Fiszel",
@@ -62160,7 +62196,7 @@ function collectPathScriptPaths(flowValue) {
62160
62196
  // src/commands/flow/flow_metadata.ts
62161
62197
  import { existsSync as existsSync8 } from "node:fs";
62162
62198
  import { rm } from "node:fs/promises";
62163
- import * as path8 from "node:path";
62199
+ import * as path9 from "node:path";
62164
62200
  import { sep as SEP4 } from "node:path";
62165
62201
  async function isFlowDirectlyStale(folder, hashes, conf) {
62166
62202
  if (await checkifMetadataUptodate(folder, hashes[TOP_HASH], conf, TOP_HASH)) {
@@ -62176,7 +62212,7 @@ async function isFlowDirectlyStale(folder, hashes, conf) {
62176
62212
  return false;
62177
62213
  }
62178
62214
  async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
62179
- const elems = await FSFSElement(path8.join(process.cwd(), folder), [], true);
62215
+ const elems = await FSFSElement(path9.join(process.cwd(), folder), [], true);
62180
62216
  const hashes = {};
62181
62217
  for await (const f of elems.getChildren()) {
62182
62218
  if (exts.some((e) => f.path.endsWith(e))) {
@@ -62224,7 +62260,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
62224
62260
  continue;
62225
62261
  }
62226
62262
  }
62227
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
62263
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
62228
62264
  const language = script.language;
62229
62265
  const imports = await extractRelativeImports(content, treePath, language);
62230
62266
  await tree.addNode(treePath, content, language, "", imports, "inline_script", folderNormalized, folder, false);
@@ -62259,7 +62295,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
62259
62295
  const c = script.content;
62260
62296
  if (c.startsWith("!inline ")) {
62261
62297
  const fileName = c.replace("!inline ", "");
62262
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
62298
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
62263
62299
  fileToTreePath.set(fileName, treePath);
62264
62300
  }
62265
62301
  }
@@ -62281,7 +62317,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
62281
62317
  const locksToRemove = tree ? Object.keys(hashes).filter((k) => {
62282
62318
  if (k === TOP_HASH)
62283
62319
  return false;
62284
- const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path8.basename(k, path8.extname(k));
62320
+ const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path9.basename(k, path9.extname(k));
62285
62321
  return tree.isStale(treePath);
62286
62322
  }) : changedScripts;
62287
62323
  const missingFiles = [];
@@ -62349,7 +62385,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
62349
62385
  const relocked = tree ? Object.keys(finalHashes).filter((k) => {
62350
62386
  if (k === TOP_HASH)
62351
62387
  return false;
62352
- const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path8.basename(k, path8.extname(k));
62388
+ const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path9.basename(k, path9.extname(k));
62353
62389
  return tree.isStale(treePath);
62354
62390
  }) : changedScripts;
62355
62391
  const updatedScripts = relocked.map((p) => {
@@ -62942,10 +62978,10 @@ var init_generate_metadata = __esm(async () => {
62942
62978
  });
62943
62979
 
62944
62980
  // src/commands/script/script.ts
62945
- import { writeFile as writeFile5, stat as stat4, mkdir as mkdir3 } from "node:fs/promises";
62981
+ import { writeFile as writeFile5, stat as stat5, mkdir as mkdir3 } from "node:fs/promises";
62946
62982
  import { Buffer as Buffer4 } from "node:buffer";
62947
62983
  import { sep as SEP6 } from "node:path";
62948
- import * as path9 from "node:path";
62984
+ import * as path10 from "node:path";
62949
62985
  import fs10 from "node:fs";
62950
62986
  import { execSync as execSync4 } from "node:child_process";
62951
62987
  function nonePositiveInt(v) {
@@ -62973,9 +63009,9 @@ async function push2(opts, filePath) {
62973
63009
  if (!validatePath(filePath)) {
62974
63010
  return;
62975
63011
  }
62976
- const absentDescriptor = await stat4(filePath).then(() => false, (e) => isMissingDbtDescriptor(filePath, e));
63012
+ const absentDescriptor = await stat5(filePath).then(() => false, (e) => isMissingDbtDescriptor(filePath, e));
62977
63013
  if (!absentDescriptor) {
62978
- const fstat = await stat4(filePath);
63014
+ const fstat = await stat5(filePath);
62979
63015
  if (!fstat.isFile()) {
62980
63016
  throw new Error("file path must refer to a file.");
62981
63017
  }
@@ -63017,7 +63053,7 @@ async function findResourceFile(path) {
63017
63053
  candidates.unshift(branchSpecificJSON, branchSpecificYAML);
63018
63054
  }
63019
63055
  const validCandidates = (await Promise.all(candidates.map((x) => {
63020
- return stat4(x).catch(() => {
63056
+ return stat5(x).catch(() => {
63021
63057
  return;
63022
63058
  }).then((x) => x?.isFile()).then((e) => {
63023
63059
  return { path: x, file: e };
@@ -63092,9 +63128,14 @@ async function handleFile(path, workspace, alreadySynced, message, opts, rawWork
63092
63128
  platform: "node",
63093
63129
  packages: "bundle",
63094
63130
  target: format == "cjs" ? "node20.15.1" : "esnext",
63095
- banner: codebase.banner
63131
+ banner: codebase.banner,
63132
+ metafile: true
63096
63133
  });
63097
63134
  const endTime = performance.now();
63135
+ const uncovered = uncoveredBundleInputs(codebase, path, Object.keys(out.metafile?.inputs ?? {}));
63136
+ if (uncovered.length > 0) {
63137
+ warnAlways(`${path} bundles files outside codebase ${codebase.relative_path}; edits to them won't be detected as changes unless listed in extra_digest_paths: ${uncovered.join(", ")}`);
63138
+ }
63098
63139
  bundleContent = out.outputFiles[0].text;
63099
63140
  outputFiles = out.outputFiles ?? [];
63100
63141
  if (outputFiles.length == 0) {
@@ -63265,7 +63306,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
63265
63306
  function readDir(dirPath, relPrefix) {
63266
63307
  const entries = fs10.readdirSync(dirPath, { withFileTypes: true });
63267
63308
  for (const entry of entries) {
63268
- const fullPath = path9.join(dirPath, entry.name);
63309
+ const fullPath = path10.join(dirPath, entry.name);
63269
63310
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
63270
63311
  const isTopLevel = relPrefix === "";
63271
63312
  if (entry.isDirectory()) {
@@ -63294,7 +63335,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
63294
63335
  const content = readTextFileSync(fullPath);
63295
63336
  const language = inferContentTypeFromFilePath(entry.name, defaultTs);
63296
63337
  const baseName = entry.name.replace(/\.[^.]+$/, "");
63297
- const lockPath = path9.join(dirPath, baseName + ".lock");
63338
+ const lockPath = path10.join(dirPath, baseName + ".lock");
63298
63339
  let lock;
63299
63340
  if (fs10.existsSync(lockPath)) {
63300
63341
  lock = readTextFileSync(lockPath);
@@ -63361,8 +63402,8 @@ async function createScript2(bundleContent, workspaceId, body, workspace) {
63361
63402
  }
63362
63403
  async function collidingDbtProject(basePath, baseDir) {
63363
63404
  const project = basePath + "__dbt/dbt_project.yml";
63364
- const onDisk = baseDir ? path9.join(baseDir, project) : project;
63365
- return await stat4(onDisk).then(() => true).catch(() => false) ? project : undefined;
63405
+ const onDisk = baseDir ? path10.join(baseDir, project) : project;
63406
+ return await stat5(onDisk).then(() => true).catch(() => false) ? project : undefined;
63366
63407
  }
63367
63408
  async function collidingOrdinaryScript(basePath) {
63368
63409
  for (const ext of exts) {
@@ -63372,7 +63413,7 @@ async function collidingOrdinaryScript(basePath) {
63372
63413
  basePath + ext,
63373
63414
  `${basePath}${getModuleFolderSuffix()}/script${ext}`
63374
63415
  ]) {
63375
- const isFile = await stat4(candidate).then((s) => s.isFile()).catch(() => false);
63416
+ const isFile = await stat5(candidate).then((s) => s.isFile()).catch(() => false);
63376
63417
  if (isFile)
63377
63418
  return candidate;
63378
63419
  }
@@ -63392,7 +63433,7 @@ async function readScriptContent(filePath) {
63392
63433
  }
63393
63434
  }
63394
63435
  async function findContentFile(filePath, baseDir) {
63395
- const onDisk = (p) => baseDir ? path9.join(baseDir, p) : p;
63436
+ const onDisk = (p) => baseDir ? path10.join(baseDir, p) : p;
63396
63437
  const isModuleFolderMeta = isModuleEntryMetadata(filePath);
63397
63438
  const toCandidate = (ext) => isModuleFolderMeta ? filePath.replace(MODULE_ENTRY_META_RE, "$1script" + ext) : filePath.endsWith("script.json") ? filePath.replace(".script.json", ext) : filePath.endsWith("script.lock") ? filePath.replace(".script.lock", ext) : filePath.replace(".script.yaml", ext);
63398
63439
  if (!isModuleFolderMeta && !/\.script\.(yaml|json|lock)$/.test(filePath)) {
@@ -63400,7 +63441,7 @@ async function findContentFile(filePath, baseDir) {
63400
63441
  }
63401
63442
  const candidates = exts.map(toCandidate);
63402
63443
  const validCandidates = (await Promise.all(candidates.map((x) => {
63403
- return stat4(onDisk(x)).catch(() => {
63444
+ return stat5(onDisk(x)).catch(() => {
63404
63445
  return;
63405
63446
  }).then((x) => x?.isFile()).then((e) => {
63406
63447
  return { path: x, file: e };
@@ -63746,14 +63787,14 @@ async function bootstrap(opts, scriptPath, language) {
63746
63787
  const scriptCodeFileFullPath = scriptPath + extension;
63747
63788
  const scriptMetadataFileFullPath = scriptPath + ".script.yaml";
63748
63789
  try {
63749
- await stat4(scriptCodeFileFullPath);
63790
+ await stat5(scriptCodeFileFullPath);
63750
63791
  throw new Error("File already exists: " + scriptCodeFileFullPath);
63751
63792
  } catch (e) {
63752
63793
  if (e.message?.startsWith("File already exists"))
63753
63794
  throw e;
63754
63795
  }
63755
63796
  try {
63756
- await stat4(scriptMetadataFileFullPath);
63797
+ await stat5(scriptMetadataFileFullPath);
63757
63798
  throw new Error("File already exists: " + scriptMetadataFileFullPath);
63758
63799
  } catch (e) {
63759
63800
  if (e.message?.startsWith("File already exists"))
@@ -63767,7 +63808,7 @@ async function bootstrap(opts, scriptPath, language) {
63767
63808
  scriptMetadata.description = opts.description;
63768
63809
  }
63769
63810
  const scriptInitialMetadataYaml = import_yaml9.stringify(scriptMetadata, yamlOptions);
63770
- const parentDir = path9.dirname(scriptCodeFileFullPath);
63811
+ const parentDir = path10.dirname(scriptCodeFileFullPath);
63771
63812
  await mkdir3(parentDir, { recursive: true });
63772
63813
  await writeFile5(scriptCodeFileFullPath, scriptInitialCode, {
63773
63814
  flag: "wx",
@@ -63852,9 +63893,9 @@ async function preview(opts, filePath) {
63852
63893
  filePath = toSyncRootRelativePath(filePath, cwdBeforeConfig);
63853
63894
  const remotePath = scriptPathToRemotePath(filePath);
63854
63895
  assertRemotePath(remotePath, argPath);
63855
- const absentDescriptor = await stat4(filePath).then(() => false, (e) => isMissingDbtDescriptor(filePath, e));
63896
+ const absentDescriptor = await stat5(filePath).then(() => false, (e) => isMissingDbtDescriptor(filePath, e));
63856
63897
  if (!absentDescriptor) {
63857
- const fstat = await stat4(filePath);
63898
+ const fstat = await stat5(filePath);
63858
63899
  if (!fstat.isFile()) {
63859
63900
  throw new Error("file path must refer to a file.");
63860
63901
  }
@@ -63868,7 +63909,7 @@ async function preview(opts, filePath) {
63868
63909
  const input = opts.data ? await resolve9(opts.data) : {};
63869
63910
  const isFolderLayout = isModuleEntryPoint(filePath);
63870
63911
  const isDbt = language === "dbt";
63871
- const moduleFolderPath = isFolderLayout ? path9.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix(language);
63912
+ const moduleFolderPath = isFolderLayout ? path10.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix(language);
63872
63913
  const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, isFolderLayout, isDbt);
63873
63914
  const codebase = language == "bun" ? findCodebase(filePath, codebases) : undefined;
63874
63915
  let tempScriptRefs = undefined;
@@ -64154,9 +64195,9 @@ var init_script = __esm(async () => {
64154
64195
  });
64155
64196
 
64156
64197
  // src/commands/lint/lint.ts
64157
- import { stat as stat5, readdir as readdir2 } from "node:fs/promises";
64198
+ import { stat as stat6, readdir as readdir2 } from "node:fs/promises";
64158
64199
  import process15 from "node:process";
64159
- import * as path10 from "node:path";
64200
+ import * as path11 from "node:path";
64160
64201
  import { sep as SEP7 } from "node:path";
64161
64202
  function normalizePath(p) {
64162
64203
  return p.replaceAll(SEP7, "/");
@@ -64216,23 +64257,23 @@ async function isLockResolved(lockValue, baseDir, sharedLockBase) {
64216
64257
  }
64217
64258
  async function checkInlineFile(relativePath, baseDir, sharedLockBase) {
64218
64259
  const trimmed = relativePath.trim();
64219
- const fullPath = sharedLockBase !== undefined && isSharedLockPath(trimmed) ? path10.resolve(sharedLockBase, trimmed) : path10.join(baseDir, trimmed);
64260
+ const fullPath = sharedLockBase !== undefined && isSharedLockPath(trimmed) ? path11.resolve(sharedLockBase, trimmed) : path11.join(baseDir, trimmed);
64220
64261
  try {
64221
- const s = await stat5(fullPath);
64262
+ const s = await stat6(fullPath);
64222
64263
  return s.size > 0;
64223
64264
  } catch {
64224
64265
  return false;
64225
64266
  }
64226
64267
  }
64227
64268
  async function findSyncRoot(dir) {
64228
- let current = path10.resolve(dir);
64269
+ let current = path11.resolve(dir);
64229
64270
  while (true) {
64230
- if (await stat5(path10.join(current, "wmill.yaml")).then(() => true).catch(() => false)) {
64271
+ if (await stat6(path11.join(current, "wmill.yaml")).then(() => true).catch(() => false)) {
64231
64272
  return current;
64232
64273
  }
64233
- const parent = path10.dirname(current);
64274
+ const parent = path11.dirname(current);
64234
64275
  if (parent === current)
64235
- return path10.resolve(dir);
64276
+ return path11.resolve(dir);
64236
64277
  current = parent;
64237
64278
  }
64238
64279
  }
@@ -64318,7 +64359,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
64318
64359
  continue;
64319
64360
  const runnableId = fileName.replace(".yaml", "");
64320
64361
  processedIds.add(runnableId);
64321
- const filePath = path10.join(backendDir, fileName);
64362
+ const filePath = path11.join(backendDir, fileName);
64322
64363
  let runnable;
64323
64364
  try {
64324
64365
  runnable = await yamlParseFile(filePath);
@@ -64336,10 +64377,10 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
64336
64377
  }
64337
64378
  if (!language || !languageNeedsLock(language))
64338
64379
  continue;
64339
- const lockFile = path10.join(backendDir, `${runnableId}.lock`);
64380
+ const lockFile = path11.join(backendDir, `${runnableId}.lock`);
64340
64381
  let hasLock = false;
64341
64382
  try {
64342
- const s = await stat5(lockFile);
64383
+ const s = await stat6(lockFile);
64343
64384
  hasLock = s.size > 0;
64344
64385
  } catch {}
64345
64386
  if (!hasLock && runnable.inlineScript?.lock) {
@@ -64383,10 +64424,10 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
64383
64424
  }
64384
64425
  if (!languageNeedsLock(language))
64385
64426
  continue;
64386
- const lockFile = path10.join(backendDir, `${runnableId}.lock`);
64427
+ const lockFile = path11.join(backendDir, `${runnableId}.lock`);
64387
64428
  let hasLock = false;
64388
64429
  try {
64389
- const s = await stat5(lockFile);
64430
+ const s = await stat6(lockFile);
64390
64431
  hasLock = s.size > 0;
64391
64432
  } catch {}
64392
64433
  if (!hasLock) {
@@ -64403,7 +64444,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
64403
64444
  }
64404
64445
  async function checkMissingLocks(opts, directory) {
64405
64446
  const initialCwd = process15.cwd();
64406
- const targetDirectory = directory ? path10.resolve(initialCwd, directory) : process15.cwd();
64447
+ const targetDirectory = directory ? path11.resolve(initialCwd, directory) : process15.cwd();
64407
64448
  const { ...syncOpts } = opts;
64408
64449
  const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
64409
64450
  const ignore = await ignoreF(mergedOpts);
@@ -64427,19 +64468,19 @@ async function checkMissingLocks(opts, directory) {
64427
64468
  if (normalizedPath.endsWith("/flow.yaml") && normalizedPath.includes(flowSuffix + "/")) {
64428
64469
  flowYamls.push({
64429
64470
  normalizedPath,
64430
- fullPath: path10.join(targetDirectory, entry.path)
64471
+ fullPath: path11.join(targetDirectory, entry.path)
64431
64472
  });
64432
64473
  }
64433
64474
  if (normalizedPath.endsWith("/app.yaml") && normalizedPath.includes(appSuffix + "/")) {
64434
64475
  appYamls.push({
64435
64476
  normalizedPath,
64436
- fullPath: path10.join(targetDirectory, entry.path)
64477
+ fullPath: path11.join(targetDirectory, entry.path)
64437
64478
  });
64438
64479
  }
64439
64480
  if (normalizedPath.endsWith("/raw_app.yaml") && normalizedPath.includes(rawAppSuffix + "/")) {
64440
64481
  rawAppYamls.push({
64441
64482
  normalizedPath,
64442
- fullPath: path10.join(targetDirectory, entry.path)
64483
+ fullPath: path11.join(targetDirectory, entry.path)
64443
64484
  });
64444
64485
  }
64445
64486
  }
@@ -64449,14 +64490,14 @@ async function checkMissingLocks(opts, directory) {
64449
64490
  let language = null;
64450
64491
  for (const ext of exts) {
64451
64492
  try {
64452
- await stat5(path10.join(targetDirectory, basePath + ext));
64493
+ await stat6(path11.join(targetDirectory, basePath + ext));
64453
64494
  language = inferContentTypeFromFilePath(basePath + ext, defaultTs);
64454
64495
  break;
64455
64496
  } catch {}
64456
64497
  }
64457
64498
  if (language && languageNeedsLock(language)) {
64458
64499
  try {
64459
- const metadata = await yamlParseFile(path10.join(targetDirectory, yamlPath));
64500
+ const metadata = await yamlParseFile(path11.join(targetDirectory, yamlPath));
64460
64501
  const lockResolved = await isLockResolved(metadata?.lock, targetDirectory, syncRoot);
64461
64502
  if (!lockResolved) {
64462
64503
  issues.push({
@@ -64473,7 +64514,7 @@ async function checkMissingLocks(opts, directory) {
64473
64514
  }
64474
64515
  }
64475
64516
  for (const { normalizedPath: flowYamlPath, fullPath } of flowYamls) {
64476
- const flowDir = path10.dirname(fullPath);
64517
+ const flowDir = path11.dirname(fullPath);
64477
64518
  try {
64478
64519
  const flowFile = await yamlParseFile(fullPath);
64479
64520
  if (!flowFile?.value?.modules)
@@ -64498,7 +64539,7 @@ async function checkMissingLocks(opts, directory) {
64498
64539
  }
64499
64540
  }
64500
64541
  for (const { normalizedPath: appYamlPath, fullPath } of appYamls) {
64501
- const appDir = path10.dirname(fullPath);
64542
+ const appDir = path11.dirname(fullPath);
64502
64543
  try {
64503
64544
  const appFile = await yamlParseFile(fullPath);
64504
64545
  if (!appFile?.value)
@@ -64523,10 +64564,10 @@ async function checkMissingLocks(opts, directory) {
64523
64564
  }
64524
64565
  }
64525
64566
  for (const { normalizedPath: rawAppYamlPath, fullPath } of rawAppYamls) {
64526
- const rawAppDir = path10.dirname(fullPath);
64527
- const backendDir = path10.join(rawAppDir, "backend");
64567
+ const rawAppDir = path11.dirname(fullPath);
64568
+ const backendDir = path11.join(rawAppDir, "backend");
64528
64569
  try {
64529
- await stat5(backendDir);
64570
+ await stat6(backendDir);
64530
64571
  } catch {
64531
64572
  continue;
64532
64573
  }
@@ -64577,23 +64618,23 @@ async function checkOrphanScriptMetadata(syncRoot, prefix, metadataPaths) {
64577
64618
  }
64578
64619
  async function runLint(opts, directory) {
64579
64620
  const initialCwd = process15.cwd();
64580
- const explicitTargetDirectory = directory ? path10.resolve(initialCwd, directory) : undefined;
64621
+ const explicitTargetDirectory = directory ? path11.resolve(initialCwd, directory) : undefined;
64581
64622
  const { json: _json, ...syncOpts } = opts;
64582
64623
  const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
64583
64624
  const targetDirectory = explicitTargetDirectory ?? process15.cwd();
64584
- const stats = await stat5(targetDirectory).catch(() => null);
64625
+ const stats = await stat6(targetDirectory).catch(() => null);
64585
64626
  if (!stats) {
64586
64627
  throw new Error(`Directory not found: ${targetDirectory}`);
64587
64628
  }
64588
64629
  if (!stats.isDirectory()) {
64589
64630
  throw new Error(`Path is not a directory: ${targetDirectory}`);
64590
64631
  }
64591
- const isSubdirectory = explicitTargetDirectory && !await stat5(path10.join(targetDirectory, "wmill.yaml")).catch(() => null);
64632
+ const isSubdirectory = explicitTargetDirectory && !await stat6(path11.join(targetDirectory, "wmill.yaml")).catch(() => null);
64592
64633
  const ignore = isSubdirectory ? (_p, _isDir) => false : await ignoreF(mergedOpts);
64593
64634
  const root = await FSFSElement(targetDirectory, [], false);
64594
64635
  const validator = new WindmillYamlValidator;
64595
64636
  const syncRoot = await findSyncRoot(targetDirectory);
64596
- const metadataPrefix = normalizePath(path10.relative(syncRoot, targetDirectory));
64637
+ const metadataPrefix = normalizePath(path11.relative(syncRoot, targetDirectory));
64597
64638
  const warnings = [];
64598
64639
  const issues = [];
64599
64640
  const scriptMetadataPaths = [];
@@ -64723,7 +64764,7 @@ function affectsLint(filename) {
64723
64764
  }
64724
64765
  async function lintWatch(opts, directory) {
64725
64766
  const { watch } = await import("node:fs");
64726
- const targetDir = directory ? path10.resolve(process15.cwd(), directory) : process15.cwd();
64767
+ const targetDir = directory ? path11.resolve(process15.cwd(), directory) : process15.cwd();
64727
64768
  info(colors.blue(`Watching ${targetDir} for changes... (Ctrl+C to stop)`));
64728
64769
  async function runAndReport() {
64729
64770
  try {
@@ -64771,13 +64812,13 @@ var init_lint = __esm(async () => {
64771
64812
 
64772
64813
  // src/commands/shared_ui.ts
64773
64814
  import * as fs11 from "node:fs";
64774
- import * as path11 from "node:path";
64815
+ import * as path12 from "node:path";
64775
64816
  async function readDirRecursive(dir, rel = "", out = {}) {
64776
64817
  if (!fs11.existsSync(dir))
64777
64818
  return out;
64778
64819
  const entries = await fs11.promises.readdir(dir, { withFileTypes: true });
64779
64820
  for (const entry of entries) {
64780
- const full = path11.join(dir, entry.name);
64821
+ const full = path12.join(dir, entry.name);
64781
64822
  const r = rel ? rel + "/" + entry.name : entry.name;
64782
64823
  if (entry.isDirectory()) {
64783
64824
  await readDirRecursive(full, r, out);
@@ -64815,7 +64856,7 @@ function sharedUiChanges(files, remote, keepDeleted) {
64815
64856
  return changes;
64816
64857
  }
64817
64858
  async function diffSharedUi(workspace, keepDeleted) {
64818
- const localDir = path11.join(process.cwd(), SHARED_UI_DIR);
64859
+ const localDir = path12.join(process.cwd(), SHARED_UI_DIR);
64819
64860
  if (!fs11.existsSync(localDir)) {
64820
64861
  return [];
64821
64862
  }
@@ -64827,7 +64868,7 @@ async function diffSharedUi(workspace, keepDeleted) {
64827
64868
  return sharedUiChanges(files, remote ?? {}, keepDeleted);
64828
64869
  }
64829
64870
  async function pushSharedUi(workspace, keepDeleted) {
64830
- const localDir = path11.join(process.cwd(), SHARED_UI_DIR);
64871
+ const localDir = path12.join(process.cwd(), SHARED_UI_DIR);
64831
64872
  if (!fs11.existsSync(localDir)) {
64832
64873
  return false;
64833
64874
  }
@@ -64861,7 +64902,7 @@ async function pushSharedUi(workspace, keepDeleted) {
64861
64902
  return true;
64862
64903
  }
64863
64904
  async function pullSharedUi(workspace, keepDeleted) {
64864
- const localDir = path11.join(process.cwd(), SHARED_UI_DIR);
64905
+ const localDir = path12.join(process.cwd(), SHARED_UI_DIR);
64865
64906
  let got;
64866
64907
  try {
64867
64908
  got = await getSharedUi({ workspace });
@@ -64875,8 +64916,8 @@ async function pullSharedUi(workspace, keepDeleted) {
64875
64916
  }
64876
64917
  fs11.mkdirSync(localDir, { recursive: true });
64877
64918
  for (const [rel, content] of Object.entries(files)) {
64878
- const full = path11.join(localDir, rel);
64879
- fs11.mkdirSync(path11.dirname(full), { recursive: true });
64919
+ const full = path12.join(localDir, rel);
64920
+ fs11.mkdirSync(path12.dirname(full), { recursive: true });
64880
64921
  let existing;
64881
64922
  try {
64882
64923
  existing = readTextFileSync(full);
@@ -64892,7 +64933,7 @@ async function pullSharedUi(workspace, keepDeleted) {
64892
64933
  const local = await readDirRecursive(localDir);
64893
64934
  for (const rel of Object.keys(local)) {
64894
64935
  if (!known.has(rel)) {
64895
- const full = path11.join(localDir, rel);
64936
+ const full = path12.join(localDir, rel);
64896
64937
  try {
64897
64938
  fs11.unlinkSync(full);
64898
64939
  } catch {}
@@ -64911,7 +64952,7 @@ var init_shared_ui = __esm(async () => {
64911
64952
  });
64912
64953
 
64913
64954
  // src/commands/resource/resource.ts
64914
- import { mkdir as mkdir4, stat as stat6, writeFile as writeFile6, readdir as readdir3 } from "node:fs/promises";
64955
+ import { mkdir as mkdir4, stat as stat7, writeFile as writeFile6, readdir as readdir3 } from "node:fs/promises";
64915
64956
  import nodePath from "node:path";
64916
64957
  import { sep as SEP8 } from "node:path";
64917
64958
  async function readFilesetDirectory(dirPath) {
@@ -65003,7 +65044,7 @@ async function push3(opts, filePath, remotePath) {
65003
65044
  if (!validatePath(remotePath)) {
65004
65045
  return;
65005
65046
  }
65006
- const fstat = await stat6(filePath);
65047
+ const fstat = await stat7(filePath);
65007
65048
  if (!fstat.isFile()) {
65008
65049
  throw new Error("file path must refer to a file.");
65009
65050
  }
@@ -65043,7 +65084,7 @@ async function newResource(opts, path) {
65043
65084
  }
65044
65085
  const filePath = path + ".resource.yaml";
65045
65086
  try {
65046
- await stat6(filePath);
65087
+ await stat7(filePath);
65047
65088
  throw new Error("File already exists: " + filePath);
65048
65089
  } catch (e) {
65049
65090
  if (e.message?.startsWith("File already exists"))
@@ -65102,7 +65143,7 @@ var init_resource = __esm(async () => {
65102
65143
  // src/utils/lock_dedup.ts
65103
65144
  import { mkdir as mkdir5, rm as rm2, writeFile as writeFile7 } from "node:fs/promises";
65104
65145
  import { existsSync as existsSync10 } from "node:fs";
65105
- import * as path12 from "node:path";
65146
+ import * as path13 from "node:path";
65106
65147
  function isEmptySharedLockPlan(plan) {
65107
65148
  return Object.keys(plan.writes).length === 0 && plan.deletes.length === 0;
65108
65149
  }
@@ -65199,7 +65240,7 @@ function metadataLockUnreadable(metaPath, metaContent, isJson) {
65199
65240
  }
65200
65241
  function sharedLockRefIn(metadataContent, isJson, root = ".") {
65201
65242
  const ref = sharedLockRefOf("metadata", metadataContent, isJson);
65202
- return ref && existsSync10(path12.resolve(root, ref)) ? ref : undefined;
65243
+ return ref && existsSync10(path13.resolve(root, ref)) ? ref : undefined;
65203
65244
  }
65204
65245
  function depKeyOf(depFilePath) {
65205
65246
  const info = workspaceDependenciesPathToLanguageAndFilename(depFilePath);
@@ -65367,7 +65408,7 @@ function applySharedLockPlanToMap(map, plan) {
65367
65408
  }
65368
65409
  async function applySharedLockPlanToDisk(plan) {
65369
65410
  for (const [key, content] of Object.entries(plan.writes)) {
65370
- await mkdir5(path12.dirname(key), { recursive: true });
65411
+ await mkdir5(path13.dirname(key), { recursive: true });
65371
65412
  await writeFile7(key, content, "utf-8");
65372
65413
  }
65373
65414
  for (const key of plan.deletes) {
@@ -65387,7 +65428,7 @@ function scriptsReferencingSharedLock(map, sharedKey) {
65387
65428
  }
65388
65429
  return referrers;
65389
65430
  }
65390
- var import_yaml12, INLINE_PREFIX = "!inline ", toMapKey = (refPath) => refPath.replaceAll("/", path12.sep), toRefPath = (mapKey) => mapKey.replaceAll("\\", "/"), LOCKABLE_EXTS;
65431
+ var import_yaml12, INLINE_PREFIX = "!inline ", toMapKey = (refPath) => refPath.replaceAll("/", path13.sep), toRefPath = (mapKey) => mapKey.replaceAll("\\", "/"), LOCKABLE_EXTS;
65391
65432
  var init_lock_dedup = __esm(async () => {
65392
65433
  await __promiseAll([
65393
65434
  init_sync(),
@@ -65412,13 +65453,13 @@ var init_lock_dedup = __esm(async () => {
65412
65453
  import {
65413
65454
  writeFile as writeFile8,
65414
65455
  readdir as readdir4,
65415
- stat as stat7,
65456
+ stat as stat8,
65416
65457
  rm as rm3,
65417
65458
  copyFile,
65418
65459
  mkdir as mkdir6
65419
65460
  } from "node:fs/promises";
65420
65461
  import { existsSync as existsSync11 } from "node:fs";
65421
- import * as path13 from "node:path";
65462
+ import * as path14 from "node:path";
65422
65463
  import { sep as SEP9 } from "node:path";
65423
65464
  function isScriptLockPath(p) {
65424
65465
  const n = p.replaceAll(SEP9, "/");
@@ -65438,7 +65479,7 @@ async function collectSharedLockReaders(json) {
65438
65479
  throw e;
65439
65480
  }
65440
65481
  for (const entry of entries) {
65441
- const full = path13.join(dir, entry.name);
65482
+ const full = path14.join(dir, entry.name);
65442
65483
  if (entry.isDirectory()) {
65443
65484
  if (isNeverWalkedDir(entry.name))
65444
65485
  continue;
@@ -65627,7 +65668,7 @@ async function addCodebaseDigestIfRelevant(path, content, codebases, ignoreCodeb
65627
65668
  let isTs = true;
65628
65669
  const replacedPath = path.replace(".script.yaml", ".ts");
65629
65670
  try {
65630
- await stat7(replacedPath);
65671
+ await stat8(replacedPath);
65631
65672
  } catch {
65632
65673
  isTs = false;
65633
65674
  }
@@ -65676,7 +65717,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
65676
65717
  try {
65677
65718
  const entries = await readdir4(localP, { withFileTypes: true });
65678
65719
  for (const e of entries) {
65679
- yield _internal_element(path13.join(localP, e.name), e.isDirectory(), codebases);
65720
+ yield _internal_element(path14.join(localP, e.name), e.isDirectory(), codebases);
65680
65721
  }
65681
65722
  } catch (e) {
65682
65723
  warn(`Error reading dir: ${localP}, ${e}`);
@@ -65693,7 +65734,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
65693
65734
  }
65694
65735
  };
65695
65736
  }
65696
- return _internal_element(p, (await stat7(p)).isDirectory(), codebases);
65737
+ return _internal_element(p, (await stat8(p)).isDirectory(), codebases);
65697
65738
  }
65698
65739
  function prioritizeName(name) {
65699
65740
  if (name == "version")
@@ -65920,7 +65961,7 @@ async function findFilesetResourceFile(changePath, wsName) {
65920
65961
  }
65921
65962
  for (const candidate of candidates) {
65922
65963
  try {
65923
- const s = await stat7(candidate);
65964
+ const s = await stat8(candidate);
65924
65965
  if (s.isFile())
65925
65966
  return candidate;
65926
65967
  } catch {}
@@ -65951,9 +65992,9 @@ async function pushFilesetParentResource(childPath, workspaceId, alreadySynced,
65951
65992
  return { status: "pushed", resourceFilePath };
65952
65993
  }
65953
65994
  function rawAppPathWithinFolder(baseFolder, relPath) {
65954
- const resolved = path13.join(baseFolder, relPath);
65955
- const rel = path13.relative(baseFolder, resolved);
65956
- if (rel === "" || rel === ".." || rel.startsWith(".." + path13.sep) || path13.isAbsolute(rel)) {
65995
+ const resolved = path14.join(baseFolder, relPath);
65996
+ const rel = path14.relative(baseFolder, resolved);
65997
+ if (rel === "" || rel === ".." || rel.startsWith(".." + path14.sep) || path14.isAbsolute(rel)) {
65957
65998
  throw new Error(`raw app path ${JSON.stringify(relPath)} escapes the app folder ${baseFolder}`);
65958
65999
  }
65959
66000
  return resolved;
@@ -66003,9 +66044,9 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66003
66044
  for (const basePath of moduleScripts) {
66004
66045
  if (normalizedP.startsWith(basePath + ".")) {
66005
66046
  const ext = normalizedP.slice(basePath.length);
66006
- const dir = path13.dirname(finalPath);
66007
- const base = path13.basename(basePath);
66008
- finalPath = path13.join(dir, base + getModuleFolderSuffix(), "script" + ext);
66047
+ const dir = path14.dirname(finalPath);
66048
+ const base = path14.basename(basePath);
66049
+ finalPath = path14.join(dir, base + getModuleFolderSuffix(), "script" + ext);
66009
66050
  break;
66010
66051
  }
66011
66052
  }
@@ -66056,7 +66097,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66056
66097
  for (const s of inlineScripts) {
66057
66098
  yield {
66058
66099
  isDirectory: false,
66059
- path: path13.join(finalPath, s.path),
66100
+ path: path14.join(finalPath, s.path),
66060
66101
  async* getChildren() {},
66061
66102
  async getContentText() {
66062
66103
  return s.content;
@@ -66071,7 +66112,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66071
66112
  }
66072
66113
  yield {
66073
66114
  isDirectory: false,
66074
- path: path13.join(finalPath, "flow.yaml"),
66115
+ path: path14.join(finalPath, "flow.yaml"),
66075
66116
  async* getChildren() {},
66076
66117
  async getContentText() {
66077
66118
  return import_yaml14.stringify(flow, yamlOptions);
@@ -66097,7 +66138,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66097
66138
  for (const s of inlineScripts) {
66098
66139
  yield {
66099
66140
  isDirectory: false,
66100
- path: path13.join(finalPath, s.path),
66141
+ path: path14.join(finalPath, s.path),
66101
66142
  async* getChildren() {},
66102
66143
  async getContentText() {
66103
66144
  return s.content;
@@ -66108,7 +66149,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66108
66149
  app.policy = undefined;
66109
66150
  yield {
66110
66151
  isDirectory: false,
66111
- path: path13.join(finalPath, "app.yaml"),
66152
+ path: path14.join(finalPath, "app.yaml"),
66112
66153
  async* getChildren() {},
66113
66154
  async getContentText() {
66114
66155
  return import_yaml14.stringify(app, yamlOptions);
@@ -66179,7 +66220,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66179
66220
  for (const s of inlineScripts) {
66180
66221
  yield {
66181
66222
  isDirectory: false,
66182
- path: path13.join(finalPath, APP_BACKEND_FOLDER, s.path),
66223
+ path: path14.join(finalPath, APP_BACKEND_FOLDER, s.path),
66183
66224
  async* getChildren() {},
66184
66225
  async getContentText() {
66185
66226
  return s.content;
@@ -66215,7 +66256,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66215
66256
  }
66216
66257
  yield {
66217
66258
  isDirectory: false,
66218
- path: rawAppPathWithinFolder(path13.join(finalPath, APP_BACKEND_FOLDER), `${runnableId}.yaml`),
66259
+ path: rawAppPathWithinFolder(path14.join(finalPath, APP_BACKEND_FOLDER), `${runnableId}.yaml`),
66219
66260
  async* getChildren() {},
66220
66261
  async getContentText() {
66221
66262
  return import_yaml14.stringify(simplifiedRunnable, yamlOptions);
@@ -66229,7 +66270,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66229
66270
  delete rawApp?.["value"];
66230
66271
  yield {
66231
66272
  isDirectory: false,
66232
- path: path13.join(finalPath, "raw_app.yaml"),
66273
+ path: path14.join(finalPath, "raw_app.yaml"),
66233
66274
  async* getChildren() {},
66234
66275
  async getContentText() {
66235
66276
  return import_yaml14.stringify(rawApp, yamlOptions);
@@ -66237,7 +66278,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66237
66278
  };
66238
66279
  yield {
66239
66280
  isDirectory: false,
66240
- path: path13.join(finalPath, "DATATABLES.md"),
66281
+ path: path14.join(finalPath, "DATATABLES.md"),
66241
66282
  async* getChildren() {},
66242
66283
  async getContentText() {
66243
66284
  return generateDatatablesDocumentation(data);
@@ -66348,12 +66389,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66348
66389
  const scriptBasePath = removeSuffix(removeSuffix(finalPath, metaExt), ".script");
66349
66390
  const moduleFolderPath = scriptBasePath + getModuleFolderSuffix(isDbt ? "dbt" : undefined);
66350
66391
  if (hasModules && !isDbt) {
66351
- r[0].path = path13.join(moduleFolderPath, "script" + metaExt);
66392
+ r[0].path = path14.join(moduleFolderPath, "script" + metaExt);
66352
66393
  }
66353
66394
  if (lock && lock != "") {
66354
66395
  r.push({
66355
66396
  isDirectory: false,
66356
- path: hasModules && !isDbt ? path13.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
66397
+ path: hasModules && !isDbt ? path14.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
66357
66398
  async* getChildren() {},
66358
66399
  async getContentText() {
66359
66400
  return lock;
@@ -66368,7 +66409,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66368
66409
  for (const [relPath, mod] of Object.entries(scriptModules)) {
66369
66410
  yield {
66370
66411
  isDirectory: false,
66371
- path: path13.join(moduleFolderPath, relPath),
66412
+ path: path14.join(moduleFolderPath, relPath),
66372
66413
  async* getChildren() {},
66373
66414
  async getContentText() {
66374
66415
  return mod.content;
@@ -66378,7 +66419,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66378
66419
  const baseName = relPath.replace(/\.[^.]+$/, "");
66379
66420
  yield {
66380
66421
  isDirectory: false,
66381
- path: path13.join(moduleFolderPath, baseName + ".lock"),
66422
+ path: path14.join(moduleFolderPath, baseName + ".lock"),
66382
66423
  async* getChildren() {},
66383
66424
  async getContentText() {
66384
66425
  return mod.lock;
@@ -66415,7 +66456,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66415
66456
  if (typeof fileContent === "string") {
66416
66457
  yield {
66417
66458
  isDirectory: false,
66418
- path: path13.join(filesetBasePath, relPath),
66459
+ path: path14.join(filesetBasePath, relPath),
66419
66460
  async* getChildren() {},
66420
66461
  async getContentText() {
66421
66462
  return fileContent;
@@ -66451,7 +66492,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66451
66492
  async* getChildren() {
66452
66493
  for (const filename in zip.files) {
66453
66494
  const file = zip.files[filename];
66454
- const totalPath = path13.join(p, filename);
66495
+ const totalPath = path14.join(p, filename);
66455
66496
  if (file.dir) {
66456
66497
  const e = zip.folder(file.name);
66457
66498
  yield _internal_folder(totalPath, e);
@@ -66809,11 +66850,11 @@ async function isCaseInsensitiveFilesystem(dir) {
66809
66850
  return _caseInsensitiveFsCache;
66810
66851
  let result = false;
66811
66852
  try {
66812
- const upper = path13.join(dir, `.wmill-CASEPROBE-${process.pid}.tmp`);
66813
- const lower = path13.join(dir, `.wmill-caseprobe-${process.pid}.tmp`);
66853
+ const upper = path14.join(dir, `.wmill-CASEPROBE-${process.pid}.tmp`);
66854
+ const lower = path14.join(dir, `.wmill-caseprobe-${process.pid}.tmp`);
66814
66855
  await writeFile8(upper, "", "utf-8");
66815
66856
  try {
66816
- await stat7(lower);
66857
+ await stat8(lower);
66817
66858
  result = true;
66818
66859
  } catch {
66819
66860
  result = false;
@@ -67152,7 +67193,7 @@ async function ignoreF(wmillconf) {
67152
67193
  };
67153
67194
  }
67154
67195
  try {
67155
- await stat7(".wmillignore");
67196
+ await stat8(".wmillignore");
67156
67197
  throw Error(".wmillignore is not supported anymore, switch to wmill.yaml");
67157
67198
  } catch {}
67158
67199
  return (p, isDirectory) => {
@@ -67503,7 +67544,7 @@ async function pull(opts) {
67503
67544
  specificItems = wsSpecificMerge.merged;
67504
67545
  opts = mergeCliWithEffectiveOptions(originalCliOpts, effectiveOpts);
67505
67546
  if (opts.stateful) {
67506
- await mkdir6(path13.join(process.cwd(), ".wmill"), { recursive: true });
67547
+ await mkdir6(path14.join(process.cwd(), ".wmill"), { recursive: true });
67507
67548
  }
67508
67549
  const codebases = await listSyncCodebases(opts);
67509
67550
  info(colors.gray("Computing the files to update locally to match remote (taking wmill.yaml into account)"));
@@ -67519,7 +67560,7 @@ async function pull(opts) {
67519
67560
  } catch {}
67520
67561
  const zipFile = await downloadZip(workspace, opts.plainSecrets, opts.skipVariables, opts.skipResources, opts.skipResourceTypes, opts.skipSecrets, opts.includeSchedules, opts.includeTriggers, opts.includeUsers, opts.includeGroups, opts.includeSettings, opts.includeKey, opts.skipWorkspaceDependencies, opts.skipDatatableMigrations, opts.defaultTs, opts.syncBehavior);
67521
67562
  const remote = ZipFSElement(zipFile, !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, true, parseSyncBehavior(opts.syncBehavior) >= 1);
67522
- const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(path13.join(process.cwd(), ".wmill"), [], true);
67563
+ const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(path14.join(process.cwd(), ".wmill"), [], true);
67523
67564
  const { changes, localMap } = await compareDynFSElement(remote, local, await ignoreF(opts), opts.json ?? false, opts, false, codebases, true, specificItems, wsNameForFiles, true, await isCaseInsensitiveFilesystem(process.cwd()));
67524
67565
  if (opts.keepDeleted) {
67525
67566
  dropDeletions(changes, "local");
@@ -67579,8 +67620,8 @@ async function pull(opts) {
67579
67620
  targetPath = workspaceSpecificPath;
67580
67621
  }
67581
67622
  }
67582
- const target = path13.join(process.cwd(), targetPath);
67583
- const stateTarget = path13.join(process.cwd(), ".wmill", targetPath);
67623
+ const target = path14.join(process.cwd(), targetPath);
67624
+ const stateTarget = path14.join(process.cwd(), ".wmill", targetPath);
67584
67625
  if (removesDbtDescriptor(change)) {
67585
67626
  await rm3(target, { force: true });
67586
67627
  if (opts.stateful) {
@@ -67620,13 +67661,13 @@ Both local and remote have been modified.`));
67620
67661
  }
67621
67662
  await writeFile8(target, change.after, "utf-8");
67622
67663
  if (opts.stateful) {
67623
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
67664
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
67624
67665
  await copyFile(target, stateTarget);
67625
67666
  }
67626
67667
  } else if (change.name === "added") {
67627
- await mkdir6(path13.dirname(target), { recursive: true });
67668
+ await mkdir6(path14.dirname(target), { recursive: true });
67628
67669
  if (opts.stateful) {
67629
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
67670
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
67630
67671
  info(`Adding ${changeTypeLabel(change.path)}${targetPath}${targetPath !== change.path ? colors.gray(` (workspace-specific override for ${change.path})`) : ""}`);
67631
67672
  }
67632
67673
  await writeFile8(target, change.content, "utf-8");
@@ -67899,7 +67940,7 @@ async function checkoutInlineNames(flowYamlPath) {
67899
67940
  }
67900
67941
  const mapping = extractCurrentMapping(flow?.value?.modules, {}, flow?.value?.failure_module, flow?.value?.preprocessor_module);
67901
67942
  for (const [id, ref] of Object.entries(mapping)) {
67902
- if (path13.isAbsolute(ref) || ref.split(/[\\/]/).includes("..")) {
67943
+ if (path14.isAbsolute(ref) || ref.split(/[\\/]/).includes("..")) {
67903
67944
  delete mapping[id];
67904
67945
  }
67905
67946
  }
@@ -68031,9 +68072,9 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
68031
68072
  resourceTypeToFormatExtension = parsed.formatExtMap;
68032
68073
  resourceTypeToIsFileset = parsed.filesetMap;
68033
68074
  } catch {}
68034
- const localFlowInlineMapping = (flowDir) => checkoutInlineNames(path13.join(process.cwd(), flowDir, "flow.yaml"));
68075
+ const localFlowInlineMapping = (flowDir) => checkoutInlineNames(path14.join(process.cwd(), flowDir, "flow.yaml"));
68035
68076
  const remote = ZipFSElement(await downloadZip(workspace, opts.plainSecrets, opts.skipVariables, opts.skipResources, opts.skipResourceTypes, opts.skipSecrets, opts.includeSchedules, opts.includeTriggers, opts.includeUsers, opts.includeGroups, opts.includeSettings, opts.includeKey, opts.skipWorkspaceDependencies, opts.skipDatatableMigrations, opts.defaultTs, opts.syncBehavior), !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, false, parseSyncBehavior(opts.syncBehavior) >= 1, localFlowInlineMapping);
68036
- const local = await FSFSElement(path13.join(process.cwd(), ""), codebases, false);
68077
+ const local = await FSFSElement(path14.join(process.cwd(), ""), codebases, false);
68037
68078
  const { changes, localMap } = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false, await isCaseInsensitiveFilesystem(process.cwd()), parentOwnsScheduleEnabled);
68038
68079
  const wsSpecificFlagOnly = computeWsSpecificFlagOnlyPushes(localMap, localSpecificItems, serverWsSpecificItems);
68039
68080
  for (const item of wsSpecificFlagOnly) {
@@ -68289,18 +68330,18 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
68289
68330
  }
68290
68331
  }
68291
68332
  for (const folderName of folderNames) {
68292
- const basePath = path13.join("f", folderName, "folder.meta.yaml");
68333
+ const basePath = path14.join("f", folderName, "folder.meta.yaml");
68293
68334
  const branchPath = getWorkspaceSpecificPath(`f/${folderName}/folder.meta.yaml`, specificItems, wsNameForFiles);
68294
68335
  let found = false;
68295
68336
  if (branchPath) {
68296
68337
  try {
68297
- await stat7(branchPath);
68338
+ await stat8(branchPath);
68298
68339
  found = true;
68299
68340
  } catch {}
68300
68341
  }
68301
68342
  if (!found) {
68302
68343
  try {
68303
- await stat7(basePath);
68344
+ await stat8(basePath);
68304
68345
  found = true;
68305
68346
  } catch {}
68306
68347
  }
@@ -68469,7 +68510,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68469
68510
  let stateful = opts.stateful;
68470
68511
  if (stateful) {
68471
68512
  try {
68472
- await stat7(path13.join(process.cwd(), ".wmill"));
68513
+ await stat8(path14.join(process.cwd(), ".wmill"));
68473
68514
  } catch {
68474
68515
  stateful = false;
68475
68516
  }
@@ -68541,8 +68582,8 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68541
68582
  let stateTarget = undefined;
68542
68583
  if (stateful) {
68543
68584
  try {
68544
- stateTarget = path13.join(process.cwd(), ".wmill", change.path);
68545
- await stat7(stateTarget);
68585
+ stateTarget = path14.join(process.cwd(), ".wmill", change.path);
68586
+ await stat8(stateTarget);
68546
68587
  } catch {
68547
68588
  stateTarget = undefined;
68548
68589
  }
@@ -68550,7 +68591,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68550
68591
  if (change.name === "edited") {
68551
68592
  if (isFileResource(change.path) || isFilesetResource(change.path)) {
68552
68593
  if (stateTarget) {
68553
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
68594
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
68554
68595
  info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
68555
68596
  }
68556
68597
  }
@@ -68603,7 +68644,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68603
68644
  continue;
68604
68645
  }
68605
68646
  if (stateTarget) {
68606
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
68647
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
68607
68648
  info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
68608
68649
  }
68609
68650
  const oldObj = parseFromPath(change.path, change.before);
@@ -68661,7 +68702,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68661
68702
  continue;
68662
68703
  }
68663
68704
  if (stateTarget) {
68664
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
68705
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
68665
68706
  info(`Adding ${getTypeStrFromPath(change.path)} ${change.path}`);
68666
68707
  }
68667
68708
  const obj = parseFromPath(change.path, change.content);
@@ -68756,7 +68797,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68756
68797
  let flowFolderExists = false;
68757
68798
  if (flowFolder) {
68758
68799
  try {
68759
- await stat7(flowFolder);
68800
+ await stat8(flowFolder);
68760
68801
  flowFolderExists = true;
68761
68802
  } catch {}
68762
68803
  }
@@ -68784,7 +68825,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68784
68825
  let appFolderExists = false;
68785
68826
  if (appFolder) {
68786
68827
  try {
68787
- await stat7(appFolder);
68828
+ await stat8(appFolder);
68788
68829
  appFolderExists = true;
68789
68830
  } catch {}
68790
68831
  }
@@ -68812,7 +68853,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68812
68853
  let folderExists = false;
68813
68854
  if (rawAppFolder) {
68814
68855
  try {
68815
- await stat7(rawAppFolder);
68856
+ await stat8(rawAppFolder);
68816
68857
  folderExists = true;
68817
68858
  } catch {}
68818
68859
  }
@@ -69370,9 +69411,9 @@ var init_parse_schema = __esm(() => {
69370
69411
 
69371
69412
  // src/utils/metadata.ts
69372
69413
  import { sep as SEP10 } from "node:path";
69373
- import { writeFile as writeFile9, stat as stat8, rm as rm4, readdir as readdir5 } from "node:fs/promises";
69414
+ import { writeFile as writeFile9, stat as stat9, rm as rm4, readdir as readdir5 } from "node:fs/promises";
69374
69415
  import { readFileSync as readFileSync3, existsSync as existsSync12, readdirSync as readdirSync2, statSync as statSync3, writeFileSync as writeFileSync5 } from "node:fs";
69375
- import * as path14 from "node:path";
69416
+ import * as path15 from "node:path";
69376
69417
  import { createRequire as createRequire3 } from "node:module";
69377
69418
  function loadParser(pkgName) {
69378
69419
  let p = _parserCache.get(pkgName);
@@ -69463,7 +69504,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
69463
69504
  });
69464
69505
  const metadataContent = await readTextFile(metadataWithType.path);
69465
69506
  const filteredRawWorkspaceDependencies = filterWorkspaceDependencies(rawWorkspaceDependencies, scriptContent, language);
69466
- const moduleFolderPath = isFolderLayout ? path14.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix(language);
69507
+ const moduleFolderPath = isFolderLayout ? path15.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix(language);
69467
69508
  const hasModules = existsSync12(moduleFolderPath) && statSync3(moduleFolderPath).isDirectory();
69468
69509
  const depsForHash = tree ? {} : filteredRawWorkspaceDependencies;
69469
69510
  let hash = await generateScriptHash(depsForHash, scriptContent, metadataContent);
@@ -69535,7 +69576,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
69535
69576
  const hasCodebase = findCodebase(scriptPath, codebases) != null;
69536
69577
  if (!hasCodebase) {
69537
69578
  const tempScriptRefs = tree?.getTempScriptRefs(remotePath);
69538
- const lockPathOverride = metadataInFolder ? path14.dirname(scriptPath) + "/script.lock" : undefined;
69579
+ const lockPathOverride = metadataInFolder ? path15.dirname(scriptPath) + "/script.lock" : undefined;
69539
69580
  await updateScriptLock(workspace, scriptContent, language, remotePath, metadataParsedContent, filteredRawWorkspaceDependencies, tempScriptRefs, lockPathOverride, opts.dedupeLockfiles ? sharedLockTargetFor(scriptContent, language, Object.keys(rawWorkspaceDependencies)) : undefined);
69540
69581
  } else {
69541
69582
  metadataParsedContent.lock = "";
@@ -69569,10 +69610,10 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
69569
69610
  let newMetadataContent;
69570
69611
  if (metadataInFolder) {
69571
69612
  if (metadataWithType.isJson) {
69572
- metaPath = path14.dirname(scriptPath) + "/script.json";
69613
+ metaPath = path15.dirname(scriptPath) + "/script.json";
69573
69614
  newMetadataContent = JSON.stringify(metadataParsedContent);
69574
69615
  } else {
69575
- metaPath = path14.dirname(scriptPath) + "/script.yaml";
69616
+ metaPath = path15.dirname(scriptPath) + "/script.yaml";
69576
69617
  newMetadataContent = import_yaml16.stringify(metadataParsedContent, yamlOptions);
69577
69618
  }
69578
69619
  } else {
@@ -69725,7 +69766,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
69725
69766
  metadataContent.lock = "!inline " + lockPath.replaceAll(SEP10, "/");
69726
69767
  } else {
69727
69768
  try {
69728
- if (await stat8(lockPath)) {
69769
+ if (await stat9(lockPath)) {
69729
69770
  await rm4(lockPath);
69730
69771
  }
69731
69772
  } catch (e) {
@@ -69737,7 +69778,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
69737
69778
  async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules) {
69738
69779
  const entries = readdirSync2(dirPath, { withFileTypes: true });
69739
69780
  for (const entry of entries) {
69740
- const fullPath = path14.join(dirPath, entry.name);
69781
+ const fullPath = path15.join(dirPath, entry.name);
69741
69782
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
69742
69783
  if (entry.isDirectory()) {
69743
69784
  await updateModuleLocks(workspace, fullPath, relPath, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules);
@@ -69761,7 +69802,7 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
69761
69802
  try {
69762
69803
  const lock = await fetchScriptLock(workspace, moduleContent, modLanguage, moduleRemotePath, rawWorkspaceDependencies);
69763
69804
  const baseName = entry.name.replace(/\.[^.]+$/, "");
69764
- const lockPath = path14.join(dirPath, baseName + ".lock");
69805
+ const lockPath = path15.join(dirPath, baseName + ".lock");
69765
69806
  if (lock != "") {
69766
69807
  writeFileSync5(lockPath, lock, "utf-8");
69767
69808
  } else {
@@ -69943,7 +69984,7 @@ function replaceLock(o) {
69943
69984
  async function parseMetadataFileIfExists(scriptPath) {
69944
69985
  let metadataFilePath = scriptPath + ".script.json";
69945
69986
  try {
69946
- await stat8(metadataFilePath);
69987
+ await stat9(metadataFilePath);
69947
69988
  const payload = JSON.parse(await readTextFile(metadataFilePath));
69948
69989
  replaceLock(payload);
69949
69990
  return {
@@ -69954,7 +69995,7 @@ async function parseMetadataFileIfExists(scriptPath) {
69954
69995
  } catch {
69955
69996
  try {
69956
69997
  metadataFilePath = scriptPath + ".script.yaml";
69957
- await stat8(metadataFilePath);
69998
+ await stat9(metadataFilePath);
69958
69999
  const payload = await yamlParseFile(metadataFilePath);
69959
70000
  replaceLock(payload);
69960
70001
  return {
@@ -69970,7 +70011,7 @@ async function parseMetadataFileIfExists(scriptPath) {
69970
70011
  async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
69971
70012
  let metadataFilePath = scriptPath + ".script.json";
69972
70013
  try {
69973
- await stat8(metadataFilePath);
70014
+ await stat9(metadataFilePath);
69974
70015
  return {
69975
70016
  path: metadataFilePath,
69976
70017
  payload: JSON.parse(await readTextFile(metadataFilePath)),
@@ -69979,7 +70020,7 @@ async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
69979
70020
  } catch {
69980
70021
  try {
69981
70022
  metadataFilePath = scriptPath + ".script.yaml";
69982
- await stat8(metadataFilePath);
70023
+ await stat9(metadataFilePath);
69983
70024
  const payload = await yamlParseFile(metadataFilePath);
69984
70025
  replaceLock(payload);
69985
70026
  return {
@@ -69991,7 +70032,7 @@ async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
69991
70032
  const moduleFolderMeta = scriptPath + getModuleFolderSuffix();
69992
70033
  try {
69993
70034
  metadataFilePath = moduleFolderMeta + "/script.json";
69994
- await stat8(metadataFilePath);
70035
+ await stat9(metadataFilePath);
69995
70036
  return {
69996
70037
  path: metadataFilePath,
69997
70038
  payload: JSON.parse(await readTextFile(metadataFilePath)),
@@ -70000,7 +70041,7 @@ async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
70000
70041
  } catch {
70001
70042
  try {
70002
70043
  metadataFilePath = moduleFolderMeta + "/script.yaml";
70003
- await stat8(metadataFilePath);
70044
+ await stat9(metadataFilePath);
70004
70045
  const payload = await yamlParseFile(metadataFilePath);
70005
70046
  replaceLock(payload);
70006
70047
  return {
@@ -70113,7 +70154,7 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
70113
70154
  async function readDir(dirPath, relPrefix) {
70114
70155
  const entries = readdirSync2(dirPath, { withFileTypes: true });
70115
70156
  for (const entry of entries) {
70116
- const fullPath = path14.join(dirPath, entry.name);
70157
+ const fullPath = path15.join(dirPath, entry.name);
70117
70158
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
70118
70159
  const isTopLevel = relPrefix === "";
70119
70160
  if (entry.isDirectory()) {
@@ -70235,7 +70276,7 @@ var init_metadata = __esm(async () => {
70235
70276
 
70236
70277
  // src/commands/app/raw_apps.ts
70237
70278
  import { sep as SEP11 } from "node:path";
70238
- import path15 from "node:path";
70279
+ import path16 from "node:path";
70239
70280
  import { readdir as readdir6 } from "node:fs/promises";
70240
70281
  async function readSiblingLock(backendPath, runnableId, allFiles) {
70241
70282
  const target = `${runnableId.toLowerCase()}.lock`;
@@ -70243,7 +70284,7 @@ async function readSiblingLock(backendPath, runnableId, allFiles) {
70243
70284
  if (!lockFile)
70244
70285
  return;
70245
70286
  try {
70246
- return await readTextFile(path15.join(backendPath, lockFile));
70287
+ return await readTextFile(path16.join(backendPath, lockFile));
70247
70288
  } catch {
70248
70289
  return;
70249
70290
  }
@@ -70260,7 +70301,7 @@ async function findRunnableContentFile(backendPath, runnableId, allFiles) {
70260
70301
  const ext = fileName.substring(runnableId.length + 1);
70261
70302
  if (EXTENSION_TO_LANGUAGE[ext]) {
70262
70303
  try {
70263
- const content = await readTextFile(path15.join(backendPath, fileName));
70304
+ const content = await readTextFile(path16.join(backendPath, fileName));
70264
70305
  return { ext, content };
70265
70306
  } catch {
70266
70307
  continue;
@@ -70297,7 +70338,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
70297
70338
  }
70298
70339
  const runnableId = fileName.replace(".yaml", "");
70299
70340
  processedIds.add(runnableId.toLowerCase());
70300
- const filePath = path15.join(backendPath, fileName);
70341
+ const filePath = path16.join(backendPath, fileName);
70301
70342
  const runnable = await yamlParseFile(filePath);
70302
70343
  if (runnable?.type === "inline") {
70303
70344
  const contentFile = await findRunnableContentFile(backendPath, runnableId, allFiles);
@@ -70358,7 +70399,7 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
70358
70399
  ...rest
70359
70400
  };
70360
70401
  }
70361
- const filePath = path15.join(backendPath, `${runnableId}.yaml`);
70402
+ const filePath = path16.join(backendPath, `${runnableId}.yaml`);
70362
70403
  writeIfChanged(filePath, import_yaml19.stringify(runnableToWrite, yamlOptions));
70363
70404
  }
70364
70405
  async function collectAppFiles(localPath) {
@@ -70411,7 +70452,7 @@ async function pushRawApp(workspace, remotePath, localPath, message, defaultTs =
70411
70452
  }
70412
70453
  const appFilePath = localPath + "raw_app.yaml";
70413
70454
  const localApp = await yamlParseFile(appFilePath);
70414
- const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
70455
+ const backendPath = path16.join(localPath, APP_BACKEND_FOLDER);
70415
70456
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath, defaultTs);
70416
70457
  let runnables;
70417
70458
  if (Object.keys(runnablesFromBackend).length > 0) {
@@ -70434,7 +70475,7 @@ async function pushRawApp(workspace, remotePath, localPath, message, defaultTs =
70434
70475
  const frameworks = detectFrameworks(localPath);
70435
70476
  const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
70436
70477
  const entryPoint = localPath + entryFile;
70437
- const sharedUiDir = path15.join(process.cwd(), "ui");
70478
+ const sharedUiDir = path16.join(process.cwd(), "ui");
70438
70479
  return await createBundle({
70439
70480
  entryPoint,
70440
70481
  production: true,
@@ -70533,7 +70574,7 @@ var init_raw_apps = __esm(async () => {
70533
70574
  });
70534
70575
 
70535
70576
  // src/commands/app/app_metadata.ts
70536
- import path16 from "node:path";
70577
+ import path17 from "node:path";
70537
70578
  import { mkdir as mkdir8, readdir as readdir7 } from "node:fs/promises";
70538
70579
  import { sep as SEP12 } from "node:path";
70539
70580
  async function isAppDirectlyStale(appFolder, hashes, conf) {
@@ -70550,7 +70591,7 @@ async function isAppDirectlyStale(appFolder, hashes, conf) {
70550
70591
  return false;
70551
70592
  }
70552
70593
  async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
70553
- const runnablesFolder = rawApp ? path16.join(folder, APP_BACKEND_FOLDER) : folder;
70594
+ const runnablesFolder = rawApp ? path17.join(folder, APP_BACKEND_FOLDER) : folder;
70554
70595
  const hashes = {};
70555
70596
  try {
70556
70597
  const elems = await FSFSElement(runnablesFolder, [], true);
@@ -70593,9 +70634,9 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
70593
70634
  if (!justUpdateMetadataLock && !noStaleMessage) {
70594
70635
  info(`Generating locks for app ${appFolder} at ${remote_path}`);
70595
70636
  }
70596
- const appFilePath = path16.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
70637
+ const appFilePath = path17.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
70597
70638
  const appFile = await yamlParseFile(appFilePath);
70598
- const runnablesFolder = path16.join(appFolder, APP_BACKEND_FOLDER);
70639
+ const runnablesFolder = path17.join(appFolder, APP_BACKEND_FOLDER);
70599
70640
  let rawAppRunnables = {};
70600
70641
  if (rawApp) {
70601
70642
  rawAppRunnables = await loadRunnablesFromBackend(runnablesFolder, opts.defaultTs);
@@ -70739,7 +70780,7 @@ async function traverseAndProcessInlineScripts(obj, processor, currentPath = [])
70739
70780
  }
70740
70781
  async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage, tempScriptRefs) {
70741
70782
  const updatedRunnables = [];
70742
- const runnablesFolder = path16.join(appFolder, APP_BACKEND_FOLDER);
70783
+ const runnablesFolder = path17.join(appFolder, APP_BACKEND_FOLDER);
70743
70784
  try {
70744
70785
  await mkdir8(runnablesFolder, { recursive: true });
70745
70786
  } catch {}
@@ -70764,7 +70805,7 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
70764
70805
  if (language === "frontend") {
70765
70806
  const [basePathO, ext] = pathAssigner.assignPath(runnableId, language);
70766
70807
  const basePath = basePathO.replaceAll(SEP12, "/");
70767
- const contentPath = path16.join(runnablesFolder, `${basePath}${ext}`);
70808
+ const contentPath = path17.join(runnablesFolder, `${basePath}${ext}`);
70768
70809
  writeIfChanged(contentPath, content);
70769
70810
  const simplifiedRunnable = { type: "inline" };
70770
70811
  for (const [key, value] of Object.entries(runnable)) {
@@ -70782,8 +70823,8 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
70782
70823
  const lock = await generateInlineScriptLock(workspace, content, language, `${remotePath}/${runnableId}`, rawDeps, tempScriptRefs);
70783
70824
  const [basePathO, ext] = pathAssigner.assignPath(runnableId, language);
70784
70825
  const basePath = basePathO.replaceAll(SEP12, "/");
70785
- const contentPath = path16.join(runnablesFolder, `${basePath}${ext}`);
70786
- const lockPath = path16.join(runnablesFolder, `${basePath}lock`);
70826
+ const contentPath = path17.join(runnablesFolder, `${basePath}${ext}`);
70827
+ const lockPath = path17.join(runnablesFolder, `${basePath}lock`);
70787
70828
  writeIfChanged(contentPath, content);
70788
70829
  if (lock && lock !== "") {
70789
70830
  writeIfChanged(lockPath, lock);
@@ -70831,8 +70872,8 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
70831
70872
  }
70832
70873
  const [basePathO, ext] = pathAssigner.assignPath(scriptName, language);
70833
70874
  const basePath = basePathO.replaceAll(SEP12, "/");
70834
- const contentPath = path16.join(appFolder, `${basePath}${ext}`);
70835
- const lockPath = path16.join(appFolder, `${basePath}lock`);
70875
+ const contentPath = path17.join(appFolder, `${basePath}${ext}`);
70876
+ const lockPath = path17.join(appFolder, `${basePath}lock`);
70836
70877
  writeIfChanged(contentPath, content);
70837
70878
  if (lock && lock !== "") {
70838
70879
  writeIfChanged(lockPath, lock);
@@ -70906,7 +70947,7 @@ ${text}`);
70906
70947
  return lock ?? "";
70907
70948
  }
70908
70949
  async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultTs = "bun") {
70909
- const fileName = path16.basename(runnableFilePath);
70950
+ const fileName = path17.basename(runnableFilePath);
70910
70951
  if (fileName.endsWith(".lock") || fileName.endsWith(".yaml")) {
70911
70952
  return;
70912
70953
  }
@@ -70921,13 +70962,13 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
70921
70962
  if (!runnableId || !ext) {
70922
70963
  return;
70923
70964
  }
70924
- const runnableFilePath2 = path16.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
70965
+ const runnableFilePath2 = path17.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
70925
70966
  let runnable;
70926
70967
  try {
70927
70968
  runnable = await yamlParseFile(runnableFilePath2);
70928
70969
  } catch {
70929
70970
  try {
70930
- const appFilePath = path16.join(appFolder, "raw_app.yaml");
70971
+ const appFilePath = path17.join(appFolder, "raw_app.yaml");
70931
70972
  const appFile = await yamlParseFile(appFilePath);
70932
70973
  if (!appFile.runnables?.[runnableId]) {
70933
70974
  warn(colors.yellow(`Runnable ${runnableId} not found in backend folder or raw_app.yaml`));
@@ -70952,7 +70993,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
70952
70993
  warn(colors.yellow(`Could not determine language for ${runnableId} (ext: ${ext})`));
70953
70994
  return;
70954
70995
  }
70955
- const fullFilePath = path16.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
70996
+ const fullFilePath = path17.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
70956
70997
  let content;
70957
70998
  try {
70958
70999
  content = await readTextFile(fullFilePath);
@@ -70975,7 +71016,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
70975
71016
  }
70976
71017
  async function inferAllInlineSchemas(appFolder, defaultTs = "bun") {
70977
71018
  const schemas = {};
70978
- const backendPath = path16.join(appFolder, APP_BACKEND_FOLDER);
71019
+ const backendPath = path17.join(appFolder, APP_BACKEND_FOLDER);
70979
71020
  let entries;
70980
71021
  try {
70981
71022
  entries = await readdir7(backendPath, { withFileTypes: true });
@@ -71085,7 +71126,7 @@ var init_app_metadata = __esm(async () => {
71085
71126
  // src/commands/app/generate_agents.ts
71086
71127
  import * as fs12 from "node:fs";
71087
71128
  import { writeFile as writeFile10 } from "node:fs/promises";
71088
- import path17 from "node:path";
71129
+ import path18 from "node:path";
71089
71130
  import process16 from "node:process";
71090
71131
  function generateDatatablesMarkdown(schemas, localData) {
71091
71132
  const defaultDatatable = localData?.datatable;
@@ -71185,7 +71226,7 @@ Configure datatables in Workspace Settings > Windmill Data Tables.
71185
71226
  return content;
71186
71227
  }
71187
71228
  async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
71188
- const rawAppPath = path17.join(targetDir, "raw_app.yaml");
71229
+ const rawAppPath = path18.join(targetDir, "raw_app.yaml");
71189
71230
  if (!fs12.existsSync(rawAppPath)) {
71190
71231
  if (!silent) {
71191
71232
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
@@ -71212,11 +71253,11 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
71212
71253
  }
71213
71254
  } catch {}
71214
71255
  const agentsContent = generateAgentsDocumentation(localData);
71215
- await writeFile10(path17.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");
71216
- await writeFile10(path17.join(targetDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
71256
+ await writeFile10(path18.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");
71257
+ await writeFile10(path18.join(targetDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
71217
71258
  `, "utf-8");
71218
71259
  const datatablesContent = generateDatatablesMarkdown(schemas, localData);
71219
- await writeFile10(path17.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
71260
+ await writeFile10(path18.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
71220
71261
  if (!silent) {
71221
71262
  info(colors.green(`✓ Generated AGENTS.md, CLAUDE.md, and DATATABLES.md`));
71222
71263
  const datatableCount = schemas.length;
@@ -71237,18 +71278,18 @@ async function generateAgents(opts, appFolder) {
71237
71278
  const cwd = process16.cwd();
71238
71279
  let targetDir = cwd;
71239
71280
  if (appFolder) {
71240
- targetDir = path17.isAbsolute(appFolder) ? appFolder : path17.join(cwd, appFolder);
71281
+ targetDir = path18.isAbsolute(appFolder) ? appFolder : path18.join(cwd, appFolder);
71241
71282
  }
71242
71283
  await loadNonDottedPathsSetting();
71243
- const dirName = path17.basename(targetDir);
71284
+ const dirName = path18.basename(targetDir);
71244
71285
  if (!hasFolderSuffix(dirName, "raw_app")) {
71245
- if (!hasFolderSuffix(path17.basename(cwd), "raw_app") && !appFolder) {
71286
+ if (!hasFolderSuffix(path18.basename(cwd), "raw_app") && !appFolder) {
71246
71287
  error(colors.red(`Error: Must be run inside a ${getFolderSuffix("raw_app")} folder or specify one as argument.`));
71247
71288
  info(colors.gray("Usage: wmill app generate-agents [app_folder]"));
71248
71289
  process16.exit(1);
71249
71290
  }
71250
71291
  }
71251
- const rawAppPath = path17.join(targetDir, "raw_app.yaml");
71292
+ const rawAppPath = path18.join(targetDir, "raw_app.yaml");
71252
71293
  if (!fs12.existsSync(rawAppPath)) {
71253
71294
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
71254
71295
  process16.exit(1);
@@ -71511,7 +71552,7 @@ var init_devRecorder = __esm(async () => {
71511
71552
  import { sep as SEP13 } from "node:path";
71512
71553
  import * as http2 from "node:http";
71513
71554
  import * as fs13 from "node:fs";
71514
- import * as path18 from "node:path";
71555
+ import * as path19 from "node:path";
71515
71556
  import process17 from "node:process";
71516
71557
  import { Buffer as Buffer5 } from "node:buffer";
71517
71558
  import { writeFileSync as writeFileSync6 } from "node:fs";
@@ -71521,20 +71562,20 @@ async function dev(opts, appFolder) {
71521
71562
  const originalCwd = process17.cwd();
71522
71563
  let targetDir = originalCwd;
71523
71564
  if (appFolder) {
71524
- targetDir = path18.isAbsolute(appFolder) ? appFolder : path18.join(originalCwd, appFolder);
71565
+ targetDir = path19.isAbsolute(appFolder) ? appFolder : path19.join(originalCwd, appFolder);
71525
71566
  if (!fs13.existsSync(targetDir)) {
71526
71567
  error(colors.red(`Error: Directory not found: ${targetDir}`));
71527
71568
  process17.exit(1);
71528
71569
  }
71529
71570
  }
71530
- const targetDirName = path18.basename(targetDir);
71571
+ const targetDirName = path19.basename(targetDir);
71531
71572
  if (!hasFolderSuffix(targetDirName, "raw_app")) {
71532
71573
  error(colors.red(`Error: The dev command must be run inside a ${getFolderSuffix("raw_app")} folder.
71533
71574
  ` + `Target directory: ${targetDirName}
71534
71575
  ` + `Please navigate to a folder ending with '${getFolderSuffix("raw_app")}' or specify one as argument.`));
71535
71576
  process17.exit(1);
71536
71577
  }
71537
- const rawAppPath = path18.join(targetDir, "raw_app.yaml");
71578
+ const rawAppPath = path19.join(targetDir, "raw_app.yaml");
71538
71579
  if (!fs13.existsSync(rawAppPath)) {
71539
71580
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}.
71540
71581
  ` + `The dev command requires a ${getFolderSuffix("raw_app")} folder containing a raw_app.yaml file.`));
@@ -71546,8 +71587,8 @@ async function dev(opts, appFolder) {
71546
71587
  let appTempRefs = undefined;
71547
71588
  {
71548
71589
  const wmillYamlPath = getWmillYamlPath();
71549
- const workspaceRoot = wmillYamlPath ? path18.dirname(wmillYamlPath) : originalCwd;
71550
- const relAppFolder = path18.relative(workspaceRoot, targetDir) || ".";
71590
+ const workspaceRoot = wmillYamlPath ? path19.dirname(wmillYamlPath) : originalCwd;
71591
+ const relAppFolder = path19.relative(workspaceRoot, targetDir) || ".";
71551
71592
  const mergedOpts = await mergeConfigWithConfigFile(opts);
71552
71593
  defaultTs = mergedOpts.defaultTs ?? "bun";
71553
71594
  const codebases = await listSyncCodebases(mergedOpts);
@@ -71586,7 +71627,7 @@ async function dev(opts, appFolder) {
71586
71627
  error(colors.red(`Entry point "${entryPoint}" not found. Please specify a valid entry point with --entry.`));
71587
71628
  process17.exit(1);
71588
71629
  }
71589
- const appDir = path18.dirname(entryPoint) || process17.cwd();
71630
+ const appDir = path19.dirname(entryPoint) || process17.cwd();
71590
71631
  await ensureNodeModules(appDir);
71591
71632
  const inferredSchemas = {};
71592
71633
  try {
@@ -71596,18 +71637,18 @@ async function dev(opts, appFolder) {
71596
71637
  }
71597
71638
  const pathRunnableSchemas = {};
71598
71639
  try {
71599
- const initialRunnables = await loadRunnablesFromBackend(path18.join(process17.cwd(), APP_BACKEND_FOLDER), defaultTs);
71640
+ const initialRunnables = await loadRunnablesFromBackend(path19.join(process17.cwd(), APP_BACKEND_FOLDER), defaultTs);
71600
71641
  Object.assign(pathRunnableSchemas, await fetchPathRunnableSchemas(workspaceId, initialRunnables));
71601
71642
  } catch (err) {
71602
71643
  warn(colors.yellow(`Could not fetch schemas for path-based runnables: ${err.message}`));
71603
71644
  }
71604
71645
  await genRunnablesTs(inferredSchemas, pathRunnableSchemas);
71605
- const distDir = path18.join(process17.cwd(), "dist");
71646
+ const distDir = path19.join(process17.cwd(), "dist");
71606
71647
  if (!fs13.existsSync(distDir)) {
71607
71648
  fs13.mkdirSync(distDir);
71608
71649
  }
71609
71650
  const recordingEnabled = opts.recording ?? false;
71610
- const recordingsDir = path18.join(process17.cwd(), RECORDINGS_FOLDER);
71651
+ const recordingsDir = path19.join(process17.cwd(), RECORDINGS_FOLDER);
71611
71652
  const playerBaseUrl = workspace.remote.endsWith("/") ? workspace.remote : `${workspace.remote}/`;
71612
71653
  const playerOrigin = (() => {
71613
71654
  try {
@@ -71675,7 +71716,7 @@ data: reload
71675
71716
  info(colors.blue(`\uD83D\uDC40 Watching for file changes...
71676
71717
  `));
71677
71718
  await ctx.rebuild();
71678
- const runnablesPath = path18.join(process17.cwd(), APP_BACKEND_FOLDER);
71719
+ const runnablesPath = path19.join(process17.cwd(), APP_BACKEND_FOLDER);
71679
71720
  let runnablesWatcher;
71680
71721
  if (fs13.existsSync(runnablesPath)) {
71681
71722
  info(colors.blue(`\uD83D\uDC41️ Watching runnables folder at: ${runnablesPath}
@@ -71687,8 +71728,8 @@ data: reload
71687
71728
  if (!filename)
71688
71729
  return;
71689
71730
  const fileStr = typeof filename === "string" ? filename : filename.toString();
71690
- const changedPath = path18.join(runnablesPath, fileStr);
71691
- const relativePath = path18.relative(process17.cwd(), changedPath);
71731
+ const changedPath = path19.join(runnablesPath, fileStr);
71732
+ const relativePath = path19.relative(process17.cwd(), changedPath);
71692
71733
  const relativeToRunnables = fileStr;
71693
71734
  if (changedPath.endsWith(".lock")) {
71694
71735
  return;
@@ -71729,7 +71770,7 @@ data: reload
71729
71770
  for (let attempt = 0;attempt < 100; attempt++) {
71730
71771
  const file = recordingFileName(now, attempt);
71731
71772
  try {
71732
- await fs13.promises.writeFile(path18.join(recordingsDir, file), body, {
71773
+ await fs13.promises.writeFile(path19.join(recordingsDir, file), body, {
71733
71774
  flag: "wx"
71734
71775
  });
71735
71776
  return file;
@@ -71786,7 +71827,7 @@ data: reload
71786
71827
  sendJson(res, 500, { error: error2.message });
71787
71828
  return;
71788
71829
  }
71789
- info(colors.green(`\uD83C\uDFAC Recording saved to ${path18.join(RECORDINGS_FOLDER, file)}`));
71830
+ info(colors.green(`\uD83C\uDFAC Recording saved to ${path19.join(RECORDINGS_FOLDER, file)}`));
71790
71831
  info(colors.gray(` Replay it at ${playerBaseUrl}replay (open the file, or use ?src=)`));
71791
71832
  sendJson(res, 200, { file });
71792
71833
  });
@@ -71797,7 +71838,7 @@ data: reload
71797
71838
  sendJson(res, 400, { error: "Invalid recording name" });
71798
71839
  return;
71799
71840
  }
71800
- const filePath = path18.join(recordingsDir, file);
71841
+ const filePath = path19.join(recordingsDir, file);
71801
71842
  if (!fs13.existsSync(filePath)) {
71802
71843
  sendJson(res, 404, { error: "Recording not found" });
71803
71844
  return;
@@ -71853,7 +71894,7 @@ data: reload
71853
71894
  return;
71854
71895
  }
71855
71896
  if (url === "/dist/bundle.js" || url === "/bundle.js") {
71856
- const jsPath = path18.join(process17.cwd(), "dist/bundle.js");
71897
+ const jsPath = path19.join(process17.cwd(), "dist/bundle.js");
71857
71898
  if (fs13.existsSync(jsPath)) {
71858
71899
  res.writeHead(200, { "Content-Type": "application/javascript" });
71859
71900
  res.end(fs13.readFileSync(jsPath));
@@ -71864,7 +71905,7 @@ data: reload
71864
71905
  return;
71865
71906
  }
71866
71907
  if (url === "/dist/bundle.css" || url === "/bundle.css") {
71867
- const cssPath = path18.join(process17.cwd(), "dist/bundle.css");
71908
+ const cssPath = path19.join(process17.cwd(), "dist/bundle.css");
71868
71909
  if (fs13.existsSync(cssPath)) {
71869
71910
  res.writeHead(200, { "Content-Type": "text/css" });
71870
71911
  res.end(fs13.readFileSync(cssPath));
@@ -71875,7 +71916,7 @@ data: reload
71875
71916
  return;
71876
71917
  }
71877
71918
  if (url === "/dist/bundle.js.map" || url === "/bundle.js.map") {
71878
- const mapPath = path18.join(process17.cwd(), "dist/bundle.js.map");
71919
+ const mapPath = path19.join(process17.cwd(), "dist/bundle.js.map");
71879
71920
  if (fs13.existsSync(mapPath)) {
71880
71921
  res.writeHead(200, { "Content-Type": "application/json" });
71881
71922
  res.end(fs13.readFileSync(mapPath));
@@ -71886,7 +71927,7 @@ data: reload
71886
71927
  return;
71887
71928
  }
71888
71929
  if (url === "/dist/bundle.css.map" || url === "/bundle.css.map") {
71889
- const mapPath = path18.join(process17.cwd(), "dist/bundle.css.map");
71930
+ const mapPath = path19.join(process17.cwd(), "dist/bundle.css.map");
71890
71931
  if (fs13.existsSync(mapPath)) {
71891
71932
  res.writeHead(200, { "Content-Type": "application/json" });
71892
71933
  res.end(fs13.readFileSync(mapPath));
@@ -71900,12 +71941,12 @@ data: reload
71900
71941
  res.end(createHTML("/dist/bundle.js", "/dist/bundle.css"));
71901
71942
  });
71902
71943
  const wss = new import_websocket_server.default({ server });
71903
- const sqlToApplyPath = path18.join(process17.cwd(), "sql_to_apply");
71944
+ const sqlToApplyPath = path19.join(process17.cwd(), "sql_to_apply");
71904
71945
  const sqlFileQueue = [];
71905
71946
  let currentSqlFile = null;
71906
71947
  async function getDatatableConfig() {
71907
71948
  try {
71908
- const rawApp = await yamlParseFile(path18.join(process17.cwd(), "raw_app.yaml"));
71949
+ const rawApp = await yamlParseFile(path19.join(process17.cwd(), "raw_app.yaml"));
71909
71950
  return rawApp?.data?.datatable;
71910
71951
  } catch {
71911
71952
  return;
@@ -71942,12 +71983,12 @@ data: reload
71942
71983
  }
71943
71984
  const filePath = sqlFileQueue.shift();
71944
71985
  if (!fs13.existsSync(filePath)) {
71945
- info(colors.gray(`File no longer exists: ${path18.basename(filePath)}`));
71986
+ info(colors.gray(`File no longer exists: ${path19.basename(filePath)}`));
71946
71987
  await processNextSqlFile();
71947
71988
  return;
71948
71989
  }
71949
71990
  currentSqlFile = filePath;
71950
- const fileName = path18.basename(filePath);
71991
+ const fileName = path19.basename(filePath);
71951
71992
  try {
71952
71993
  const sqlContent = await readTextFile(filePath);
71953
71994
  if (!sqlContent.trim()) {
@@ -71969,9 +72010,9 @@ data: reload
71969
72010
  if (deleteFile && fs13.existsSync(filePath)) {
71970
72011
  try {
71971
72012
  fs13.unlinkSync(filePath);
71972
- info(colors.green(`✓ Deleted: ${path18.basename(filePath)}`));
72013
+ info(colors.green(`✓ Deleted: ${path19.basename(filePath)}`));
71973
72014
  } catch (error2) {
71974
- error(colors.red(`Failed to delete ${path18.basename(filePath)}: ${error2.message}`));
72015
+ error(colors.red(`Failed to delete ${path19.basename(filePath)}: ${error2.message}`));
71975
72016
  }
71976
72017
  }
71977
72018
  currentSqlFile = null;
@@ -71983,7 +72024,7 @@ data: reload
71983
72024
  try {
71984
72025
  const sqlContent = await readTextFile(currentSqlFile);
71985
72026
  const datatable = await getDatatableConfig();
71986
- const fileName = path18.basename(currentSqlFile);
72027
+ const fileName = path19.basename(currentSqlFile);
71987
72028
  ws.send(JSON.stringify({
71988
72029
  type: "sqlMigration",
71989
72030
  fileName,
@@ -71997,7 +72038,7 @@ data: reload
71997
72038
  const sqlFiles = entries.filter((entry) => entry.endsWith(".sql"));
71998
72039
  if (sqlFiles.length > 0 && sqlFileQueue.length === 0) {
71999
72040
  for (const sqlFile of sqlFiles.sort()) {
72000
- queueSqlFile(path18.join(sqlToApplyPath, sqlFile));
72041
+ queueSqlFile(path19.join(sqlToApplyPath, sqlFile));
72001
72042
  }
72002
72043
  await processNextSqlFile();
72003
72044
  }
@@ -72176,7 +72217,7 @@ data: reload
72176
72217
  }
72177
72218
  info(colors.blue(`\uD83D\uDD0D Found ${sqlFiles.length} SQL file(s) in sql_to_apply/`));
72178
72219
  for (const sqlFile of sqlFiles) {
72179
- const filePath = path18.join(sqlToApplyPath, sqlFile);
72220
+ const filePath = path19.join(sqlToApplyPath, sqlFile);
72180
72221
  queueSqlFile(filePath);
72181
72222
  }
72182
72223
  await processNextSqlFile();
@@ -72194,11 +72235,11 @@ data: reload
72194
72235
  if (!filename)
72195
72236
  return;
72196
72237
  const fileStr = typeof filename === "string" ? filename : filename.toString();
72197
- const changedPath = path18.join(sqlToApplyPath, fileStr);
72238
+ const changedPath = path19.join(sqlToApplyPath, fileStr);
72198
72239
  if (!changedPath.endsWith(".sql")) {
72199
72240
  return;
72200
72241
  }
72201
- const fileName = path18.basename(changedPath);
72242
+ const fileName = path19.basename(changedPath);
72202
72243
  if (sqlDebounceTimeouts[changedPath]) {
72203
72244
  clearTimeout(sqlDebounceTimeouts[changedPath]);
72204
72245
  }
@@ -72260,11 +72301,11 @@ data: reload
72260
72301
  async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides = {}) {
72261
72302
  info(colors.blue("\uD83D\uDD04 Generating wmill.d.ts..."));
72262
72303
  const localPath = process17.cwd();
72263
- const backendPath = path18.join(localPath, APP_BACKEND_FOLDER);
72304
+ const backendPath = path19.join(localPath, APP_BACKEND_FOLDER);
72264
72305
  let runnables = await loadRunnablesFromBackend(backendPath, defaultTs);
72265
72306
  if (Object.keys(runnables).length === 0) {
72266
72307
  try {
72267
- const rawApp = await yamlParseFile(path18.join(localPath, "raw_app.yaml"));
72308
+ const rawApp = await yamlParseFile(path19.join(localPath, "raw_app.yaml"));
72268
72309
  runnables = rawApp?.["runnables"] ?? {};
72269
72310
  } catch {
72270
72311
  runnables = {};
@@ -72272,7 +72313,7 @@ async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides =
72272
72313
  }
72273
72314
  try {
72274
72315
  const newWmillTs = buildWmillTs(runnables, inlineSchemaOverrides, pathSchemaOverrides);
72275
- writeFileSync6(path18.join(process17.cwd(), "wmill.d.ts"), newWmillTs);
72316
+ writeFileSync6(path19.join(process17.cwd(), "wmill.d.ts"), newWmillTs);
72276
72317
  } catch (error2) {
72277
72318
  error(colors.red(`Failed to generate wmill.d.ts: ${error2.message}`));
72278
72319
  }
@@ -72342,10 +72383,10 @@ function convertRunnablesToApiFormat(runnables) {
72342
72383
  async function loadRunnables() {
72343
72384
  try {
72344
72385
  const localPath = process17.cwd();
72345
- const backendPath = path18.join(localPath, APP_BACKEND_FOLDER);
72386
+ const backendPath = path19.join(localPath, APP_BACKEND_FOLDER);
72346
72387
  let runnables = await loadRunnablesFromBackend(backendPath, defaultTs);
72347
72388
  if (Object.keys(runnables).length === 0) {
72348
- const rawApp = await yamlParseFile(path18.join(localPath, "raw_app.yaml"));
72389
+ const rawApp = await yamlParseFile(path19.join(localPath, "raw_app.yaml"));
72349
72390
  runnables = rawApp?.runnables ?? {};
72350
72391
  }
72351
72392
  convertRunnablesToApiFormat(runnables);
@@ -72850,7 +72891,7 @@ var init_dev = __esm(async () => {
72850
72891
 
72851
72892
  // src/commands/app/lint.ts
72852
72893
  import * as fs14 from "node:fs";
72853
- import * as path19 from "node:path";
72894
+ import * as path20 from "node:path";
72854
72895
  import process18 from "node:process";
72855
72896
  function validateRawAppYaml(appData) {
72856
72897
  const errors = [];
@@ -72865,7 +72906,7 @@ function validateRawAppYaml(appData) {
72865
72906
  async function validateRunnables(appDir, appData) {
72866
72907
  const errors = [];
72867
72908
  const warnings = [];
72868
- const backendPath = path19.join(appDir, APP_BACKEND_FOLDER);
72909
+ const backendPath = path20.join(appDir, APP_BACKEND_FOLDER);
72869
72910
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
72870
72911
  const hasBackendRunnables = Object.keys(runnablesFromBackend).length > 0;
72871
72912
  const hasYamlRunnables = appData.runnables && typeof appData.runnables === "object" && !Array.isArray(appData.runnables) && Object.keys(appData.runnables).length > 0;
@@ -72888,7 +72929,7 @@ async function validateBuild(appDir) {
72888
72929
  info(colors.blue("\uD83D\uDD28 Testing build..."));
72889
72930
  const frameworks = detectFrameworks(appDir);
72890
72931
  const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
72891
- const entryPoint = path19.join(appDir, entryFile);
72932
+ const entryPoint = path20.join(appDir, entryFile);
72892
72933
  await createBundle({
72893
72934
  entryPoint,
72894
72935
  production: true,
@@ -72903,12 +72944,12 @@ async function validateBuild(appDir) {
72903
72944
  async function lintRawApp(appDir, opts) {
72904
72945
  const errors = [];
72905
72946
  const warnings = [];
72906
- const currentDirName = path19.basename(appDir);
72947
+ const currentDirName = path20.basename(appDir);
72907
72948
  if (!hasFolderSuffix(currentDirName, "raw_app")) {
72908
72949
  errors.push(`Not a raw app folder: '${currentDirName}' does not end with '${getFolderSuffix("raw_app")}'`);
72909
72950
  return { valid: false, errors, warnings };
72910
72951
  }
72911
- const rawAppPath = path19.join(appDir, "raw_app.yaml");
72952
+ const rawAppPath = path20.join(appDir, "raw_app.yaml");
72912
72953
  if (!fs14.existsSync(rawAppPath)) {
72913
72954
  errors.push("Missing raw_app.yaml file");
72914
72955
  return { valid: false, errors, warnings };
@@ -72992,30 +73033,30 @@ var init_lint2 = __esm(async () => {
72992
73033
 
72993
73034
  // src/commands/app/bundle_command.ts
72994
73035
  import * as fs15 from "node:fs";
72995
- import * as path20 from "node:path";
73036
+ import * as path21 from "node:path";
72996
73037
  import process19 from "node:process";
72997
73038
  function entryPointFor(appDir) {
72998
73039
  const frameworks = detectFrameworks(appDir);
72999
73040
  const candidates = frameworks.svelte || frameworks.vue ? ["index.ts", "index.tsx", "index.js"] : ["index.tsx", "index.ts", "index.js"];
73000
- const entry = candidates.find((c) => fs15.existsSync(path20.join(appDir, c)));
73041
+ const entry = candidates.find((c) => fs15.existsSync(path21.join(appDir, c)));
73001
73042
  if (!entry) {
73002
73043
  throw new Error(`No entry point in ${appDir}: expected one of ${candidates.join(", ")}`);
73003
73044
  }
73004
- return path20.join(appDir, entry);
73045
+ return path21.join(appDir, entry);
73005
73046
  }
73006
73047
  async function bundleApp(opts, appFolder) {
73007
- const appDir = path20.resolve(appFolder ?? process19.cwd());
73048
+ const appDir = path21.resolve(appFolder ?? process19.cwd());
73008
73049
  const { js, css } = await createBundle({
73009
73050
  entryPoint: entryPointFor(appDir),
73010
73051
  production: true,
73011
73052
  minify: opts.minify ?? true,
73012
- sharedUiDir: path20.join(process19.cwd(), "ui"),
73053
+ sharedUiDir: path21.join(process19.cwd(), "ui"),
73013
73054
  outDir: `.wmill-bundle-${process19.pid}`
73014
73055
  });
73015
- const outDir = path20.resolve(opts.out ?? path20.join(appDir, "dist"));
73056
+ const outDir = path21.resolve(opts.out ?? path21.join(appDir, "dist"));
73016
73057
  fs15.mkdirSync(outDir, { recursive: true });
73017
- fs15.writeFileSync(path20.join(outDir, "bundle.js"), js);
73018
- fs15.writeFileSync(path20.join(outDir, "bundle.css"), css);
73058
+ fs15.writeFileSync(path21.join(outDir, "bundle.js"), js);
73059
+ fs15.writeFileSync(path21.join(outDir, "bundle.css"), css);
73019
73060
  info(colors.green(`Wrote bundle.js and bundle.css to ${outDir}`));
73020
73061
  }
73021
73062
  var command12, bundle_command_default;
@@ -73029,8 +73070,8 @@ var init_bundle_command = __esm(async () => {
73029
73070
  });
73030
73071
 
73031
73072
  // src/commands/app/new.ts
73032
- import { stat as stat9, writeFile as writeFile11, mkdir as mkdir9, rm as rm5 } from "node:fs/promises";
73033
- import path21 from "node:path";
73073
+ import { stat as stat10, writeFile as writeFile11, mkdir as mkdir9, rm as rm5 } from "node:fs/promises";
73074
+ import path22 from "node:path";
73034
73075
  import { execSync as execSync5, exec, execFile as execFile6 } from "node:child_process";
73035
73076
  function validateAppPath(appPath) {
73036
73077
  if (!appPath.startsWith("u/") && !appPath.startsWith("f/")) {
@@ -73286,10 +73327,10 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
73286
73327
  }
73287
73328
  await loadNonDottedPathsSetting();
73288
73329
  const folderName = buildFolderPath(appPath, "raw_app");
73289
- const appDir = path21.join(process.cwd(), folderName);
73330
+ const appDir = path22.join(process.cwd(), folderName);
73290
73331
  let dirExists = false;
73291
73332
  try {
73292
- await stat9(appDir);
73333
+ await stat10(appDir);
73293
73334
  dirExists = true;
73294
73335
  } catch {}
73295
73336
  if (dirExists) {
@@ -73311,17 +73352,17 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
73311
73352
  await rm5(appDir, { recursive: true, force: true });
73312
73353
  }
73313
73354
  await mkdir9(appDir, { recursive: true });
73314
- await mkdir9(path21.join(appDir, "backend"), { recursive: true });
73315
- await mkdir9(path21.join(appDir, "sql_to_apply"), { recursive: true });
73355
+ await mkdir9(path22.join(appDir, "backend"), { recursive: true });
73356
+ await mkdir9(path22.join(appDir, "sql_to_apply"), { recursive: true });
73316
73357
  const rawAppConfig = {
73317
73358
  summary
73318
73359
  };
73319
73360
  if (dataConfig.datatable) {
73320
73361
  rawAppConfig.data = dataConfig;
73321
73362
  }
73322
- await writeFile11(path21.join(appDir, "raw_app.yaml"), import_yaml25.stringify(rawAppConfig, yamlOptions), "utf-8");
73363
+ await writeFile11(path22.join(appDir, "raw_app.yaml"), import_yaml25.stringify(rawAppConfig, yamlOptions), "utf-8");
73323
73364
  for (const [filePath, content] of Object.entries(template.files)) {
73324
- const fullPath = path21.join(appDir, filePath.slice(1));
73365
+ const fullPath = path22.join(appDir, filePath.slice(1));
73325
73366
  await writeFile11(fullPath, content.trim() + `
73326
73367
  `, "utf-8");
73327
73368
  }
@@ -73331,21 +73372,21 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
73331
73372
  schema: dataConfig.schema
73332
73373
  } : undefined;
73333
73374
  const agentsContent = generateAgentsDocumentation(dataForDocs);
73334
- await writeFile11(path21.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
73335
- await writeFile11(path21.join(appDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
73375
+ await writeFile11(path22.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
73376
+ await writeFile11(path22.join(appDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
73336
73377
  `, "utf-8");
73337
73378
  const datatablesContent = generateDatatablesDocumentation(dataForDocs);
73338
- await writeFile11(path21.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
73379
+ await writeFile11(path22.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
73339
73380
  const exampleRunnable = {
73340
73381
  type: "inline",
73341
73382
  path: undefined
73342
73383
  };
73343
- await writeFile11(path21.join(appDir, "backend", "a.yaml"), import_yaml25.stringify(exampleRunnable, yamlOptions), "utf-8");
73344
- await writeFile11(path21.join(appDir, "backend", "a.ts"), `export async function main(x: number): Promise<string> {
73384
+ await writeFile11(path22.join(appDir, "backend", "a.yaml"), import_yaml25.stringify(exampleRunnable, yamlOptions), "utf-8");
73385
+ await writeFile11(path22.join(appDir, "backend", "a.ts"), `export async function main(x: number): Promise<string> {
73345
73386
  return \`Hello from backend! x = \${x}\`;
73346
73387
  }
73347
73388
  `, "utf-8");
73348
- await writeFile11(path21.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
73389
+ await writeFile11(path22.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
73349
73390
 
73350
73391
  This folder is for SQL migration files that will be applied to datatables during development.
73351
73392
 
@@ -73373,7 +73414,7 @@ This folder is for SQL migration files that will be applied to datatables during
73373
73414
  - Use idempotent SQL (\`CREATE TABLE IF NOT EXISTS\`, etc.)
73374
73415
  `);
73375
73416
  if (createSchemaSQL && schemaName) {
73376
- await writeFile11(path21.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
73417
+ await writeFile11(path22.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
73377
73418
  }
73378
73419
  info("");
73379
73420
  info(colors.bold.green(`App created successfully at ${folderName}/`));
@@ -73429,10 +73470,10 @@ This folder is for SQL migration files that will be applied to datatables during
73429
73470
  });
73430
73471
  if (openInDesktop) {
73431
73472
  try {
73432
- const absAppDir = path21.resolve(appDir);
73433
- const claudeDir = path21.join(absAppDir, ".claude");
73434
- const launchPath = path21.join(claudeDir, "launch.json");
73435
- if (!await stat9(launchPath).catch(() => null)) {
73473
+ const absAppDir = path22.resolve(appDir);
73474
+ const claudeDir = path22.join(absAppDir, ".claude");
73475
+ const launchPath = path22.join(claudeDir, "launch.json");
73476
+ if (!await stat10(launchPath).catch(() => null)) {
73436
73477
  const launchJson = JSON.stringify({
73437
73478
  version: "0.0.1",
73438
73479
  configurations: [{
@@ -73446,7 +73487,7 @@ This folder is for SQL migration files that will be applied to datatables during
73446
73487
  `;
73447
73488
  await mkdir9(claudeDir, { recursive: true });
73448
73489
  await writeFile11(launchPath, launchJson, "utf-8");
73449
- info(colors.gray(`Seeded ${path21.relative(process.cwd(), launchPath)}`));
73490
+ info(colors.gray(`Seeded ${path22.relative(process.cwd(), launchPath)}`));
73450
73491
  }
73451
73492
  const sessionId = crypto.randomUUID();
73452
73493
  const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
@@ -73652,7 +73693,7 @@ var init_new = __esm(async () => {
73652
73693
 
73653
73694
  // src/commands/app/app.ts
73654
73695
  import { sep as SEP14, isAbsolute as isAbsolute6, resolve as pathResolve, relative as pathRelative, basename as basename9 } from "node:path";
73655
- import { stat as stat10 } from "node:fs/promises";
73696
+ import { stat as stat11 } from "node:fs/promises";
73656
73697
  function respecializeFields(fields) {
73657
73698
  Object.entries(fields).forEach(([k, v]) => {
73658
73699
  if (typeof v == "object") {
@@ -73892,12 +73933,12 @@ async function push5(opts, filePath, remotePath) {
73892
73933
  let hasRawAppYaml = false;
73893
73934
  let hasAppYaml = false;
73894
73935
  try {
73895
- await stat10(normalizedPath + SEP14 + "raw_app.yaml");
73936
+ await stat11(normalizedPath + SEP14 + "raw_app.yaml");
73896
73937
  hasRawAppYaml = true;
73897
73938
  } catch {}
73898
73939
  if (!hasRawAppYaml) {
73899
73940
  try {
73900
- await stat10(normalizedPath + SEP14 + "app.yaml");
73941
+ await stat11(normalizedPath + SEP14 + "app.yaml");
73901
73942
  hasAppYaml = true;
73902
73943
  } catch {}
73903
73944
  }
@@ -74008,7 +74049,7 @@ var init_app = __esm(async () => {
74008
74049
  });
74009
74050
 
74010
74051
  // src/commands/folder/folder.ts
74011
- import { stat as stat11, readdir as readdir8, writeFile as writeFile12, mkdir as mkdir10 } from "node:fs/promises";
74052
+ import { stat as stat12, readdir as readdir8, writeFile as writeFile12, mkdir as mkdir10 } from "node:fs/promises";
74012
74053
  import { sep as SEP15 } from "node:path";
74013
74054
  async function list7(opts) {
74014
74055
  if (opts.json)
@@ -74032,7 +74073,7 @@ async function newFolder(opts, name) {
74032
74073
  const dirPath = `f${SEP15}${name}`;
74033
74074
  const filePath = `${dirPath}${SEP15}folder.meta.yaml`;
74034
74075
  try {
74035
- await stat11(filePath);
74076
+ await stat12(filePath);
74036
74077
  throw new Error("File already exists: " + filePath);
74037
74078
  } catch (e) {
74038
74079
  if (e.message?.startsWith("File already exists"))
@@ -74120,7 +74161,7 @@ async function push6(opts, name) {
74120
74161
  await requireLogin(opts);
74121
74162
  const metaPath = `f${SEP15}${name}${SEP15}folder.meta.yaml`;
74122
74163
  try {
74123
- await stat11(metaPath);
74164
+ await stat12(metaPath);
74124
74165
  } catch {
74125
74166
  throw new Error(`Could not find ${metaPath}. Does the folder exist locally?`);
74126
74167
  }
@@ -74131,7 +74172,7 @@ async function push6(opts, name) {
74131
74172
  async function addMissing(opts) {
74132
74173
  const fDir = `f`;
74133
74174
  try {
74134
- await stat11(fDir);
74175
+ await stat12(fDir);
74135
74176
  } catch {
74136
74177
  info("No 'f/' directory found. Nothing to do.");
74137
74178
  return;
@@ -74143,7 +74184,7 @@ async function addMissing(opts) {
74143
74184
  continue;
74144
74185
  const metaPath = `${fDir}${SEP15}${entry.name}${SEP15}folder.meta.yaml`;
74145
74186
  try {
74146
- await stat11(metaPath);
74187
+ await stat12(metaPath);
74147
74188
  } catch {
74148
74189
  missing.push(entry.name);
74149
74190
  }
@@ -74234,7 +74275,7 @@ var init_folder = __esm(async () => {
74234
74275
  });
74235
74276
 
74236
74277
  // src/commands/variable/variable.ts
74237
- import { mkdir as mkdir11, stat as stat12, writeFile as writeFile13 } from "node:fs/promises";
74278
+ import { mkdir as mkdir11, stat as stat13, writeFile as writeFile13 } from "node:fs/promises";
74238
74279
  import { dirname as dirname17 } from "node:path";
74239
74280
  import { sep as SEP16 } from "node:path";
74240
74281
  async function list8(opts) {
@@ -74262,7 +74303,7 @@ async function newVariable(opts, path) {
74262
74303
  }
74263
74304
  const filePath = path + ".variable.yaml";
74264
74305
  try {
74265
- await stat12(filePath);
74306
+ await stat13(filePath);
74266
74307
  throw new Error("File already exists: " + filePath);
74267
74308
  } catch (e) {
74268
74309
  if (e.message?.startsWith("File already exists"))
@@ -74369,7 +74410,7 @@ async function push7(opts, filePath, remotePath) {
74369
74410
  if (!validatePath(remotePath)) {
74370
74411
  return;
74371
74412
  }
74372
- const fstat = await stat12(filePath);
74413
+ const fstat = await stat13(filePath);
74373
74414
  if (!fstat.isFile()) {
74374
74415
  throw new Error("file path must refer to a file.");
74375
74416
  }
@@ -74460,7 +74501,7 @@ var init_variable = __esm(async () => {
74460
74501
  });
74461
74502
 
74462
74503
  // src/commands/schedule/schedule.ts
74463
- import { mkdir as mkdir12, stat as stat13, writeFile as writeFile14 } from "node:fs/promises";
74504
+ import { mkdir as mkdir12, stat as stat14, writeFile as writeFile14 } from "node:fs/promises";
74464
74505
  import { dirname as dirname18 } from "node:path";
74465
74506
  import { sep as SEP17, resolve as pathResolve2 } from "node:path";
74466
74507
  async function list9(opts) {
@@ -74483,7 +74524,7 @@ async function newSchedule(opts, path) {
74483
74524
  }
74484
74525
  const filePath = path + ".schedule.yaml";
74485
74526
  try {
74486
- await stat13(filePath);
74527
+ await stat14(filePath);
74487
74528
  throw new Error("File already exists: " + filePath);
74488
74529
  } catch (e) {
74489
74530
  if (e.message?.startsWith("File already exists"))
@@ -74662,7 +74703,7 @@ async function push8(opts, filePath, remotePath) {
74662
74703
  if (!validatePath(remotePath)) {
74663
74704
  return;
74664
74705
  }
74665
- const fstat = await stat13(filePath);
74706
+ const fstat = await stat14(filePath);
74666
74707
  if (!fstat.isFile()) {
74667
74708
  throw new Error("file path must refer to a file.");
74668
74709
  }
@@ -75054,7 +75095,16 @@ async function pushWorkspaceSettings(workspace, _path, settings, localSettings)
75054
75095
  }
75055
75096
  });
75056
75097
  }
75057
- if (!deepEqual(localSettings.operator_settings, settings.operator_settings)) {
75098
+ const localOperatorSettings = localSettings.operator_settings && {
75099
+ ...localSettings.operator_settings
75100
+ };
75101
+ for (const key of ["manage_schedules", "manage_triggers"]) {
75102
+ const remote = settings.operator_settings?.[key];
75103
+ if (localOperatorSettings && localOperatorSettings[key] === undefined && remote !== undefined) {
75104
+ localOperatorSettings[key] = remote;
75105
+ }
75106
+ }
75107
+ if (localOperatorSettings && !deepEqual(localOperatorSettings, settings.operator_settings)) {
75058
75108
  debug(`Updating operator settings...`);
75059
75109
  await updateOperatorSettings({
75060
75110
  workspace,
@@ -75316,9 +75366,9 @@ var init_settings = __esm(async () => {
75316
75366
  });
75317
75367
 
75318
75368
  // src/commands/instance/instance.ts
75319
- import { writeFile as writeFile16, readdir as readdir9, mkdir as mkdir13, rm as rm6, stat as stat14 } from "node:fs/promises";
75369
+ import { writeFile as writeFile16, readdir as readdir9, mkdir as mkdir13, rm as rm6, stat as stat15 } from "node:fs/promises";
75320
75370
  import { appendFile } from "node:fs/promises";
75321
- import * as path22 from "node:path";
75371
+ import * as path23 from "node:path";
75322
75372
  async function allInstances() {
75323
75373
  try {
75324
75374
  const file = await getInstancesConfigFilePath();
@@ -75510,7 +75560,7 @@ async function instancePull(opts) {
75510
75560
  if (confirm) {
75511
75561
  if (uChanges > 0) {
75512
75562
  if (opts.folderPerInstance && opts.prefixSettings) {
75513
- await mkdir13(path22.join(rootDir, opts.prefix), {
75563
+ await mkdir13(path23.join(rootDir, opts.prefix), {
75514
75564
  recursive: true
75515
75565
  });
75516
75566
  }
@@ -75544,10 +75594,10 @@ Pulling all workspaces`);
75544
75594
  info(`
75545
75595
  Pulling workspace ` + remoteWorkspace.id);
75546
75596
  const workspaceName = opts?.folderPerInstance ? instance.prefix + "/" + remoteWorkspace.id : instance.prefix + "_" + remoteWorkspace.id;
75547
- await mkdir13(path22.join(rootDir, workspaceName), {
75597
+ await mkdir13(path23.join(rootDir, workspaceName), {
75548
75598
  recursive: true
75549
75599
  });
75550
- process.chdir(path22.join(rootDir, workspaceName));
75600
+ process.chdir(path23.join(rootDir, workspaceName));
75551
75601
  await addWorkspace({
75552
75602
  remote: instance.remote,
75553
75603
  name: workspaceName,
@@ -75582,7 +75632,7 @@ Pulling workspace ` + remoteWorkspace.id);
75582
75632
  if (confirmDelete) {
75583
75633
  for (const workspace of localWorkspacesToDelete) {
75584
75634
  await removeWorkspace(workspace.id, false, {});
75585
- await rm6(path22.join(rootDir, workspace.dir), {
75635
+ await rm6(path23.join(rootDir, workspace.dir), {
75586
75636
  recursive: true
75587
75637
  });
75588
75638
  }
@@ -75671,12 +75721,12 @@ Pushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
75671
75721
  info(`
75672
75722
  Pushing workspace ` + localWorkspace.id);
75673
75723
  try {
75674
- process.chdir(path22.join(rootDir, localWorkspace.dir));
75724
+ process.chdir(path23.join(rootDir, localWorkspace.dir));
75675
75725
  } catch (_) {
75676
75726
  throw new Error("Workspace folder not found, are you in the right directory?");
75677
75727
  }
75678
75728
  try {
75679
- const workspaceSettings = await yamlParseFile(path22.join(process.cwd(), "settings.yaml"));
75729
+ const workspaceSettings = await yamlParseFile(path23.join(process.cwd(), "settings.yaml"));
75680
75730
  await add({
75681
75731
  token: instance.token,
75682
75732
  workspace: undefined,
@@ -75727,7 +75777,7 @@ Pushing workspace ` + localWorkspace.id);
75727
75777
  }
75728
75778
  async function getLocalWorkspaces(rootDir, localPrefix, folderPerInstance) {
75729
75779
  const localWorkspaces = [];
75730
- if (!await stat14(localPrefix).catch(() => null)) {
75780
+ if (!await stat15(localPrefix).catch(() => null)) {
75731
75781
  await mkdir13(localPrefix);
75732
75782
  }
75733
75783
  if (folderPerInstance) {
@@ -76308,7 +76358,7 @@ var init_dependencies = __esm(async () => {
76308
76358
  });
76309
76359
 
76310
76360
  // src/commands/trigger/trigger.ts
76311
- import { mkdir as mkdir14, stat as stat15, writeFile as writeFile18 } from "node:fs/promises";
76361
+ import { mkdir as mkdir14, stat as stat16, writeFile as writeFile18 } from "node:fs/promises";
76312
76362
  import { dirname as dirname19 } from "node:path";
76313
76363
  import { sep as SEP18, resolve as pathResolve3 } from "node:path";
76314
76364
  async function getTrigger(triggerType, workspace, path) {
@@ -76504,7 +76554,7 @@ async function newTrigger(opts, path) {
76504
76554
  const kind = opts.kind;
76505
76555
  const filePath = `${path}.${kind}_trigger.yaml`;
76506
76556
  try {
76507
- await stat15(filePath);
76557
+ await stat16(filePath);
76508
76558
  throw new Error("File already exists: " + filePath);
76509
76559
  } catch (e) {
76510
76560
  if (e.message?.startsWith("File already exists"))
@@ -76664,7 +76714,7 @@ async function push10(opts, filePath, remotePath) {
76664
76714
  if (!validatePath(remotePath)) {
76665
76715
  return;
76666
76716
  }
76667
- const fstat = await stat15(filePath);
76717
+ const fstat = await stat16(filePath);
76668
76718
  if (!fstat.isFile()) {
76669
76719
  throw new Error("file path must refer to a file.");
76670
76720
  }
@@ -76818,7 +76868,7 @@ var init_trigger = __esm(async () => {
76818
76868
  });
76819
76869
 
76820
76870
  // src/types.ts
76821
- import * as path23 from "node:path";
76871
+ import * as path24 from "node:path";
76822
76872
  import { sep as SEP19 } from "node:path";
76823
76873
  function isSuperset(subset, superset) {
76824
76874
  return Object.keys(subset).every((key) => {
@@ -77027,7 +77077,7 @@ function getTypeStrFromPath(p) {
77027
77077
  if (isFileResource(p) || isFilesetResource(p)) {
77028
77078
  return "resource";
77029
77079
  }
77030
- const parsed = path23.parse(p);
77080
+ const parsed = path24.parse(p);
77031
77081
  if (parsed.ext == ".go" || parsed.ext == ".ts" || parsed.ext == ".sh" || parsed.ext == ".py" || parsed.ext == ".sql" || parsed.ext == ".gql" || parsed.ext == ".ps1" || parsed.ext == ".js" || parsed.ext == ".php" || parsed.ext == ".rs" || parsed.ext == ".cs" || parsed.ext == ".nu" || parsed.ext == ".java" || parsed.ext == ".rb" || parsed.ext == ".r" || parsed.ext == ".yml" && parsed.name.split(".").pop() == "playbook" || isDbtDescriptorPath(p)) {
77032
77082
  return "script";
77033
77083
  }
@@ -77051,7 +77101,7 @@ function getTypeStrFromPath(p) {
77051
77101
  }
77052
77102
  }
77053
77103
  function removeType(str, type) {
77054
- const normalizedStr = path23.normalize(str).replaceAll(SEP19, "/");
77104
+ const normalizedStr = path24.normalize(str).replaceAll(SEP19, "/");
77055
77105
  if (normalizedStr.endsWith("." + type + ".yaml") || normalizedStr.endsWith("." + type + ".json")) {
77056
77106
  return normalizedStr.slice(0, normalizedStr.length - type.length - 6);
77057
77107
  }
@@ -77061,7 +77111,7 @@ function removeType(str, type) {
77061
77111
  return normalizedStr;
77062
77112
  }
77063
77113
  function extractNativeTriggerInfo(p) {
77064
- const normalizedPath = path23.normalize(p).replaceAll(SEP19, "/");
77114
+ const normalizedPath = path24.normalize(p).replaceAll(SEP19, "/");
77065
77115
  const withoutExt = normalizedPath.replace(/\.(json|yaml)$/, "");
77066
77116
  const match = withoutExt.match(/^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/);
77067
77117
  if (!match) {
@@ -77075,8 +77125,8 @@ function extractNativeTriggerInfo(p) {
77075
77125
  };
77076
77126
  }
77077
77127
  function removePathPrefix(str, prefix) {
77078
- const normalizedStr = path23.normalize(str).replaceAll(SEP19, "/");
77079
- const normalizedPrefix = path23.normalize(prefix).replaceAll(SEP19, "/");
77128
+ const normalizedStr = path24.normalize(str).replaceAll(SEP19, "/");
77129
+ const normalizedPrefix = path24.normalize(prefix).replaceAll(SEP19, "/");
77080
77130
  if (normalizedStr === normalizedPrefix) {
77081
77131
  return "";
77082
77132
  }
@@ -77148,7 +77198,7 @@ function defaultFlowDefinition() {
77148
77198
 
77149
77199
  // src/utils/local_path_scripts.ts
77150
77200
  import { execFileSync as execFileSync2 } from "node:child_process";
77151
- import { stat as stat16 } from "node:fs/promises";
77201
+ import { stat as stat17 } from "node:fs/promises";
77152
77202
  async function readOptionalLock(scriptPath) {
77153
77203
  try {
77154
77204
  return await readTextFile(scriptPath + ".script.lock");
@@ -77212,7 +77262,7 @@ async function resolvePreviewLocalScriptState(scriptPath, opts) {
77212
77262
  const filePath = scriptPath + ext;
77213
77263
  let fileStat;
77214
77264
  try {
77215
- fileStat = await stat16(filePath);
77265
+ fileStat = await stat17(filePath);
77216
77266
  } catch {
77217
77267
  continue;
77218
77268
  }
@@ -88931,7 +88981,7 @@ var init_freshness_gate = __esm(() => {
88931
88981
 
88932
88982
  // src/guidance/freshness.ts
88933
88983
  import { createHash } from "node:crypto";
88934
- import { stat as stat18 } from "node:fs/promises";
88984
+ import { stat as stat19 } from "node:fs/promises";
88935
88985
  function buildPromptsHashMarker(hash) {
88936
88986
  return `${PROMPTS_HASH_MARKER_PREFIX}${hash} -->`;
88937
88987
  }
@@ -88982,10 +89032,10 @@ async function warnIfPromptsStale(opts) {
88982
89032
  const cwd = opts?.cwd ?? process.cwd();
88983
89033
  let fileName = AGENTS_WMILL_FILENAME;
88984
89034
  let path = `${cwd}/${fileName}`;
88985
- if (!await stat18(path).catch(() => null)) {
89035
+ if (!await stat19(path).catch(() => null)) {
88986
89036
  fileName = LEGACY_AGENTS_CLI_FILENAME;
88987
89037
  path = `${cwd}/${fileName}`;
88988
- if (!await stat18(path).catch(() => null)) {
89038
+ if (!await stat19(path).catch(() => null)) {
88989
89039
  return;
88990
89040
  }
88991
89041
  }
@@ -89032,7 +89082,7 @@ var init_freshness = __esm(async () => {
89032
89082
  import { execSync as execSync6 } from "node:child_process";
89033
89083
  import { createHash as createHash2 } from "node:crypto";
89034
89084
  import { existsSync as existsSync20, readFileSync as readFileSync5, writeFileSync as writeFileSync9 } from "node:fs";
89035
- import path25 from "node:path";
89085
+ import path26 from "node:path";
89036
89086
  import process25 from "node:process";
89037
89087
  function buildManagedTsconfig() {
89038
89088
  const paths = {};
@@ -89099,7 +89149,7 @@ async function refreshManagedTsconfig(defaultTs, mode) {
89099
89149
  }
89100
89150
  const header = MANAGED_NOTICE + TSCONFIG_HASH_PREFIX + currentTsconfigHash() + `
89101
89151
  `;
89102
- writeFileSync9(path25.join(process25.cwd(), MANAGED_TSCONFIG), header + JSON.stringify(managed, null, 2) + `
89152
+ writeFileSync9(path26.join(process25.cwd(), MANAGED_TSCONFIG), header + JSON.stringify(managed, null, 2) + `
89103
89153
  `);
89104
89154
  info(colors.green(`Refreshed ${MANAGED_TSCONFIG}`));
89105
89155
  await ensureUserReferencesManaged({
@@ -89135,7 +89185,7 @@ async function refreshManagedDenoImportMap(mode) {
89135
89185
  for (const dir of WORKSPACE_IMPORT_DIRS) {
89136
89186
  imports[`/${dir}/`] = `./${dir}/`;
89137
89187
  }
89138
- writeFileSync9(path25.join(process25.cwd(), MANAGED_IMPORT_MAP), JSON.stringify({ imports }, null, 2) + `
89188
+ writeFileSync9(path26.join(process25.cwd(), MANAGED_IMPORT_MAP), JSON.stringify({ imports }, null, 2) + `
89139
89189
  `);
89140
89190
  info(colors.green(`Refreshed ${MANAGED_IMPORT_MAP}`));
89141
89191
  await ensureUserReferencesManaged({
@@ -89158,15 +89208,15 @@ async function refreshManagedDenoImportMap(mode) {
89158
89208
  });
89159
89209
  }
89160
89210
  async function ensureUserReferencesManaged(opts) {
89161
- const existing = [opts.file, ...opts.altFiles ?? []].map((f) => path25.join(process25.cwd(), f)).find((p) => existsSync20(p));
89211
+ const existing = [opts.file, ...opts.altFiles ?? []].map((f) => path26.join(process25.cwd(), f)).find((p) => existsSync20(p));
89162
89212
  if (!existing) {
89163
- const userPath = path25.join(process25.cwd(), opts.file);
89213
+ const userPath = path26.join(process25.cwd(), opts.file);
89164
89214
  writeFileSync9(userPath, JSON.stringify(opts.create, null, 2) + `
89165
89215
  `);
89166
89216
  info(colors.green(`Created ${opts.file} (references ${opts.token})`));
89167
89217
  return;
89168
89218
  }
89169
- const existingName = path25.basename(existing);
89219
+ const existingName = path26.basename(existing);
89170
89220
  let text = "";
89171
89221
  try {
89172
89222
  text = readFileSync5(existing, "utf-8");
@@ -89210,7 +89260,7 @@ async function ensureUserReferencesManaged(opts) {
89210
89260
  }
89211
89261
  function ensureBunTypesAvailable() {
89212
89262
  const cwd = process25.cwd();
89213
- if (existsSync20(path25.join(cwd, "node_modules", "bun-types"))) {
89263
+ if (existsSync20(path26.join(cwd, "node_modules", "bun-types"))) {
89214
89264
  return true;
89215
89265
  }
89216
89266
  try {
@@ -89232,7 +89282,7 @@ function ensureBunTypesAvailable() {
89232
89282
  }
89233
89283
  async function warnIfTsconfigStale(opts) {
89234
89284
  const cwd = opts?.cwd ?? process25.cwd();
89235
- const managedPath = path25.join(cwd, MANAGED_TSCONFIG);
89285
+ const managedPath = path26.join(cwd, MANAGED_TSCONFIG);
89236
89286
  if (!existsSync20(managedPath))
89237
89287
  return;
89238
89288
  let managedText;
@@ -91095,9 +91145,9 @@ var import_yaml45 = __toESM(require_dist(), 1);
91095
91145
  import { sep as SEP21 } from "node:path";
91096
91146
  import * as http3 from "node:http";
91097
91147
  import * as https from "node:https";
91098
- import { access, readdir as readdir10, realpath, stat as stat17, unlink, writeFile as writeFile21 } from "node:fs/promises";
91148
+ import { access, readdir as readdir10, realpath, stat as stat18, unlink, writeFile as writeFile21 } from "node:fs/promises";
91099
91149
  import { watch as watch2 } from "node:fs";
91100
- import * as path24 from "node:path";
91150
+ import * as path25 from "node:path";
91101
91151
  import * as fs17 from "node:fs";
91102
91152
 
91103
91153
  // src/commands/dev/pathscript-restore.ts
@@ -91193,7 +91243,7 @@ var PORT = 3001;
91193
91243
  var FLOW_SUFFIXES = [".flow", "__flow"];
91194
91244
  var APP_SUFFIXES = [".app", "__app", ".raw_app", "__raw_app"];
91195
91245
  var INLINE_SCRIPT_EXTS = new Set([
91196
- ...exts.map((e) => path24.extname("x" + e)).filter((e) => e !== ".yml"),
91246
+ ...exts.map((e) => path25.extname("x" + e)).filter((e) => e !== ".yml"),
91197
91247
  ".js"
91198
91248
  ]);
91199
91249
  function stripFolderSuffix(rel, suffixes) {
@@ -91234,13 +91284,13 @@ async function listWorkspacePaths() {
91234
91284
  if (entry.name.startsWith(".") || entry.name === "node_modules")
91235
91285
  continue;
91236
91286
  const childRel = rel ? `${rel}/${entry.name}` : entry.name;
91237
- const childAbs = path24.join(dir, entry.name);
91287
+ const childAbs = path25.join(dir, entry.name);
91238
91288
  if (entry.isDirectory()) {
91239
91289
  if (isFlowFolderName(entry.name)) {
91240
91290
  items.push({
91241
91291
  path: stripFolderSuffix(childRel, FLOW_SUFFIXES),
91242
91292
  kind: "flow",
91243
- _metaPath: path24.join(childAbs, "flow.yaml")
91293
+ _metaPath: path25.join(childAbs, "flow.yaml")
91244
91294
  });
91245
91295
  continue;
91246
91296
  }
@@ -91288,25 +91338,25 @@ async function listWorkspacePaths() {
91288
91338
  async function dev2(opts) {
91289
91339
  if (!opts.path) {
91290
91340
  const cwd = process.cwd();
91291
- const cwdBasename = path24.basename(cwd);
91341
+ const cwdBasename = path25.basename(cwd);
91292
91342
  await loadNonDottedPathsSetting();
91293
91343
  if (isFlowFolderName(cwdBasename)) {
91294
91344
  GLOBAL_CONFIG_OPT.noCdToRoot = true;
91295
91345
  let searchDir = cwd;
91296
91346
  let workspaceRoot;
91297
91347
  while (true) {
91298
- const wmillYaml = path24.join(searchDir, "wmill.yaml");
91348
+ const wmillYaml = path25.join(searchDir, "wmill.yaml");
91299
91349
  if (fs17.existsSync(wmillYaml)) {
91300
91350
  workspaceRoot = searchDir;
91301
91351
  break;
91302
91352
  }
91303
- const parentDir = path24.dirname(searchDir);
91353
+ const parentDir = path25.dirname(searchDir);
91304
91354
  if (parentDir === searchDir)
91305
91355
  break;
91306
91356
  searchDir = parentDir;
91307
91357
  }
91308
91358
  if (workspaceRoot) {
91309
- const relPath = path24.relative(workspaceRoot, cwd).replaceAll("\\", "/");
91359
+ const relPath = path25.relative(workspaceRoot, cwd).replaceAll("\\", "/");
91310
91360
  opts.path = stripFolderSuffix(relPath, FLOW_SUFFIXES);
91311
91361
  info(`Detected flow folder, path: ${opts.path}`);
91312
91362
  process.chdir(workspaceRoot);
@@ -91537,7 +91587,7 @@ async function dev2(opts) {
91537
91587
  const filePath = flowDir + s.path;
91538
91588
  if (s.content.startsWith("!inline ")) {
91539
91589
  try {
91540
- await stat17(filePath);
91590
+ await stat18(filePath);
91541
91591
  } catch {
91542
91592
  await writeFile21(filePath, "", "utf-8");
91543
91593
  }
@@ -91569,7 +91619,7 @@ async function dev2(opts) {
91569
91619
  for (const file of dirFiles) {
91570
91620
  if (file === "flow.yaml" || file === "flow.json" || file.startsWith("."))
91571
91621
  continue;
91572
- if (!INLINE_SCRIPT_EXTS.has(path24.extname(file)))
91622
+ if (!INLINE_SCRIPT_EXTS.has(path25.extname(file)))
91573
91623
  continue;
91574
91624
  if (!extractedPaths.has(file)) {
91575
91625
  await unlink(flowDir + file);
@@ -92093,7 +92143,7 @@ await __promiseAll([
92093
92143
  init_workspace(),
92094
92144
  init_resource_type()
92095
92145
  ]);
92096
- import { stat as stat20, writeFile as writeFile23, rm as rm8 } from "node:fs/promises";
92146
+ import { stat as stat21, writeFile as writeFile23, rm as rm8 } from "node:fs/promises";
92097
92147
 
92098
92148
  // src/commands/init/template.ts
92099
92149
  var NON_SCHEMA_KEYS = new Set([
@@ -92318,6 +92368,7 @@ var CONFIG_REFERENCE = [
92318
92368
  type: "object",
92319
92369
  properties: {
92320
92370
  relative_path: { type: "string", description: "Path to the codebase directory" },
92371
+ extra_digest_paths: { type: "array", items: { type: "string" }, description: "Paths outside relative_path that scripts import, relative to wmill.yaml; hashed recursively" },
92321
92372
  includes: { type: "array", items: { type: "string" }, description: "Glob patterns for files to include in bundle" },
92322
92373
  excludes: { type: "array", items: { type: "string" }, description: "Glob patterns for files to exclude from bundle" },
92323
92374
  format: { type: "string", enum: ["cjs", "esm"], description: "Bundle output format" },
@@ -92338,6 +92389,7 @@ Each entry is bundled and uploaded so scripts can import shared code.`,
92338
92389
  example: [
92339
92390
  "# codebases:",
92340
92391
  "# - relative_path: ./shared # path to the codebase",
92392
+ '# # extra_digest_paths: ["../packages/utils/src"] # imported paths outside relative_path, hashed recursively (skip node_modules/dist)',
92341
92393
  '# includes: ["**/*.ts"] # files to include in bundle',
92342
92394
  '# excludes: ["node_modules/**"] # files to exclude',
92343
92395
  '# format: esm # bundle format: "cjs" or "esm"',
@@ -92583,7 +92635,7 @@ await __promiseAll([
92583
92635
  init_utils(),
92584
92636
  init_freshness()
92585
92637
  ]);
92586
- import { cp, mkdir as mkdir15, readdir as readdir11, rm as rm7, stat as stat19, writeFile as writeFile22 } from "node:fs/promises";
92638
+ import { cp, mkdir as mkdir15, readdir as readdir11, rm as rm7, stat as stat20, writeFile as writeFile22 } from "node:fs/promises";
92587
92639
  import { join as join23 } from "node:path";
92588
92640
  var WMILL_INIT_AI_SKILLS_SOURCE_ENV = "WMILL_INIT_AI_SKILLS_SOURCE";
92589
92641
  var WMILL_INIT_AI_AGENTS_SOURCE_ENV = "WMILL_INIT_AI_AGENTS_SOURCE";
@@ -92642,7 +92694,7 @@ async function migrateLegacyManagedFile(targetDir) {
92642
92694
  }
92643
92695
  }
92644
92696
  const legacyPath = join23(targetDir, LEGACY_AGENTS_CLI_FILENAME);
92645
- const legacyExists = await stat19(legacyPath).catch(() => null) != null;
92697
+ const legacyExists = await stat20(legacyPath).catch(() => null) != null;
92646
92698
  if (legacyExists) {
92647
92699
  await rm7(legacyPath, { force: true });
92648
92700
  }
@@ -92667,7 +92719,7 @@ function cacheOnce(resolver) {
92667
92719
  };
92668
92720
  }
92669
92721
  async function reconcileIncludingFile(options) {
92670
- const exists = await stat19(options.path).catch(() => null) != null;
92722
+ const exists = await stat20(options.path).catch(() => null) != null;
92671
92723
  if (!exists) {
92672
92724
  await writeFile22(options.path, options.skeleton, "utf8");
92673
92725
  return { created: true, migration: "not-applicable" };
@@ -92785,7 +92837,7 @@ async function readSkillMetadataFromDirectory(skillsDir) {
92785
92837
  continue;
92786
92838
  }
92787
92839
  const skillPath = join23(skillsDir, entry.name, "SKILL.md");
92788
- if (!await stat19(skillPath).catch(() => null)) {
92840
+ if (!await stat20(skillPath).catch(() => null)) {
92789
92841
  continue;
92790
92842
  }
92791
92843
  const content = await readTextFile(skillPath);
@@ -92938,7 +92990,7 @@ await init_tsconfig();
92938
92990
  async function initAction(opts) {
92939
92991
  let didBindWorkspace = false;
92940
92992
  let boundProfile;
92941
- if (await stat20("wmill.yaml").catch(() => null)) {
92993
+ if (await stat21("wmill.yaml").catch(() => null)) {
92942
92994
  info("wmill.yaml already exists, skipping config generation");
92943
92995
  } else {
92944
92996
  await init_git();
@@ -96346,7 +96398,7 @@ await __promiseAll([
96346
96398
  init_conf()
96347
96399
  ]);
96348
96400
  import * as fs19 from "node:fs";
96349
- import * as path26 from "node:path";
96401
+ import * as path27 from "node:path";
96350
96402
  import process26 from "node:process";
96351
96403
 
96352
96404
  // src/commands/pipeline/duckdbMacros.ts
@@ -96579,7 +96631,7 @@ function parseMacroAnnotations(content) {
96579
96631
  // src/commands/pipeline/localGraph.ts
96580
96632
  function workspaceRoot() {
96581
96633
  const yaml = getWmillYamlPath();
96582
- return yaml ? path26.dirname(yaml) : process26.cwd();
96634
+ return yaml ? path27.dirname(yaml) : process26.cwd();
96583
96635
  }
96584
96636
  function wasmFnForLanguage(language) {
96585
96637
  switch (language) {
@@ -96815,7 +96867,7 @@ async function collectScripts2(folderDir, root, defaultTs) {
96815
96867
  for (const e of entries) {
96816
96868
  if (e.name.startsWith(".") || e.name === "node_modules")
96817
96869
  continue;
96818
- const abs = path26.join(dir, e.name);
96870
+ const abs = path27.join(dir, e.name);
96819
96871
  if (e.isDirectory()) {
96820
96872
  walk(abs);
96821
96873
  continue;
@@ -96825,7 +96877,7 @@ async function collectScripts2(folderDir, root, defaultTs) {
96825
96877
  const ext = exts.find((x) => e.name.endsWith(x));
96826
96878
  if (!ext)
96827
96879
  continue;
96828
- const relFromRoot = path26.relative(root, abs).replaceAll("\\", "/");
96880
+ const relFromRoot = path27.relative(root, abs).replaceAll("\\", "/");
96829
96881
  let language;
96830
96882
  try {
96831
96883
  language = inferContentTypeFromFilePath(abs, defaultTs);
@@ -96864,7 +96916,7 @@ function hideDbtRunnables(graph) {
96864
96916
  }
96865
96917
  async function buildLocalPipelineGraph(args) {
96866
96918
  const folderClean = args.folder.replace(/^f\//, "").replace(/\/$/, "");
96867
- const folderDir = path26.join(args.root, "f", folderClean);
96919
+ const folderDir = path27.join(args.root, "f", folderClean);
96868
96920
  const all = await collectScripts2(folderDir, args.root, args.defaultTs);
96869
96921
  const libMacros = collectMacroLibraries(args.root);
96870
96922
  const runnables = [];
@@ -97105,7 +97157,7 @@ function collectMacroLibraries(root) {
97105
97157
  for (const e of entries) {
97106
97158
  if (e.name.startsWith(".") || e.name === "node_modules")
97107
97159
  continue;
97108
- const abs = path26.join(dir, e.name);
97160
+ const abs = path27.join(dir, e.name);
97109
97161
  if (e.isDirectory()) {
97110
97162
  walk(abs);
97111
97163
  continue;
@@ -97120,11 +97172,11 @@ function collectMacroLibraries(root) {
97120
97172
  }
97121
97173
  if (!parseMacroAnnotations(content).macros)
97122
97174
  continue;
97123
- const relFromRoot = path26.relative(root, abs).replaceAll("\\", "/");
97175
+ const relFromRoot = path27.relative(root, abs).replaceAll("\\", "/");
97124
97176
  out.set(removeExtensionToPath(relFromRoot), parseMacroLibrary(content));
97125
97177
  }
97126
97178
  };
97127
- walk(path26.join(root, "f"));
97179
+ walk(path27.join(root, "f"));
97128
97180
  return out;
97129
97181
  }
97130
97182
  function buildMacroEdges(all, libMacros, runnables) {
@@ -97212,7 +97264,7 @@ await __promiseAll([
97212
97264
  init_codebase(),
97213
97265
  init_metadata()
97214
97266
  ]);
97215
- import { readFile as readFile3 } from "node:fs/promises";
97267
+ import { readFile as readFile4 } from "node:fs/promises";
97216
97268
 
97217
97269
  // src/commands/pipeline/dev.ts
97218
97270
  init_mod3();
@@ -97230,7 +97282,7 @@ await __promiseAll([
97230
97282
  ]);
97231
97283
  import * as http4 from "node:http";
97232
97284
  import * as fs20 from "node:fs";
97233
- import * as path27 from "node:path";
97285
+ import * as path28 from "node:path";
97234
97286
  import { createHash as createHash3, randomBytes as randomBytes2 } from "node:crypto";
97235
97287
  import process27 from "node:process";
97236
97288
  var PORT2 = 3201;
@@ -97239,7 +97291,7 @@ async function stableWsToken(remote, workspaceId, root, folder, port) {
97239
97291
  const key = createHash3("sha256").update(`${remote}\x00${workspaceId}\x00${root}\x00${folder}\x00${port}`).digest("hex").slice(0, 32);
97240
97292
  let tokenFile;
97241
97293
  try {
97242
- tokenFile = path27.join(await getConfigDirPath(), `pipeline-dev-${key}.token`);
97294
+ tokenFile = path28.join(await getConfigDirPath(), `pipeline-dev-${key}.token`);
97243
97295
  const existing = fs20.readFileSync(tokenFile, "utf-8").trim();
97244
97296
  if (existing)
97245
97297
  return existing;
@@ -97255,7 +97307,7 @@ async function stableWsToken(remote, workspaceId, root, folder, port) {
97255
97307
  function resolveFolder(root, folderArg) {
97256
97308
  if (folderArg)
97257
97309
  return folderArg.replace(/^f\//, "").replace(/\/$/, "");
97258
- const rel = path27.relative(root, process27.cwd()).replaceAll("\\", "/");
97310
+ const rel = path28.relative(root, process27.cwd()).replaceAll("\\", "/");
97259
97311
  if (rel === "" || rel.startsWith(".."))
97260
97312
  return;
97261
97313
  const segs = rel.split("/");
@@ -97270,7 +97322,7 @@ async function dev3(opts, folderArg) {
97270
97322
  error(colors.red("Could not determine the pipeline folder. Pass it explicitly " + "(`wmill pipeline dev <folder>`) or run from inside an `f/<folder>` directory."));
97271
97323
  process27.exit(1);
97272
97324
  }
97273
- const folderDir = path27.join(root, "f", folder);
97325
+ const folderDir = path28.join(root, "f", folder);
97274
97326
  if (!fs20.existsSync(folderDir)) {
97275
97327
  error(colors.red(`Folder not found on disk: ${folderDir}`));
97276
97328
  process27.exit(1);
@@ -97396,7 +97448,7 @@ await __promiseAll([
97396
97448
  ]);
97397
97449
  import { writeFile as writeFile26 } from "node:fs/promises";
97398
97450
  import { existsSync as existsSync22, readFileSync as readFileSync8 } from "node:fs";
97399
- import * as path28 from "node:path";
97451
+ import * as path29 from "node:path";
97400
97452
  var ASSET_KINDS = "s3object,ducklake,datatable,volume,dbt";
97401
97453
  function assetUri(kind, p) {
97402
97454
  const prefix = kind === "s3object" ? "s3" : kind;
@@ -97604,8 +97656,8 @@ async function generatePipelineDocs(opts, folder) {
97604
97656
  }
97605
97657
  }
97606
97658
  const md = generatePipelineMarkdown(f, graph, datatableSchemas, !!opts.local);
97607
- const folderDir = path28.join(root, "f", f);
97608
- await writeFile26(path28.join(folderDir, "PIPELINE.md"), md, "utf-8");
97659
+ const folderDir = path29.join(root, "f", f);
97660
+ await writeFile26(path29.join(folderDir, "PIPELINE.md"), md, "utf-8");
97609
97661
  const written = ["PIPELINE.md"];
97610
97662
  const pointers = [
97611
97663
  ["AGENTS.md", `See @PIPELINE.md for this pipeline's graph, assets, and how to run it.
@@ -97614,7 +97666,7 @@ async function generatePipelineDocs(opts, folder) {
97614
97666
  `]
97615
97667
  ];
97616
97668
  for (const [name, content] of pointers) {
97617
- const p = path28.join(folderDir, name);
97669
+ const p = path29.join(folderDir, name);
97618
97670
  if (existsSync22(p)) {
97619
97671
  let existing;
97620
97672
  try {
@@ -97974,7 +98026,7 @@ async function resolveUploadArgs(bindings, scriptPath, workspaceId, local, local
97974
98026
  if (binding.source.startsWith("s3://")) {
97975
98027
  obj = parseS3Uri(binding.source);
97976
98028
  } else {
97977
- const buf = await readFile3(binding.source);
98029
+ const buf = await readFile4(binding.source);
97978
98030
  const key = devUploadKey(scriptPath, param, binding.source);
97979
98031
  await fileUpload({
97980
98032
  workspace: workspaceId,
@@ -98320,7 +98372,7 @@ await __promiseAll([
98320
98372
  init_utils()
98321
98373
  ]);
98322
98374
  import { Buffer as Buffer6 } from "node:buffer";
98323
- import { readFile as readFile4, writeFile as writeFile27 } from "node:fs/promises";
98375
+ import { readFile as readFile5, writeFile as writeFile27 } from "node:fs/promises";
98324
98376
  import { basename as basename12 } from "node:path";
98325
98377
  function formatBytes(n) {
98326
98378
  if (n == null)
@@ -98384,7 +98436,7 @@ More results available. Use --marker '${result.next_marker}' to paginate.`);
98384
98436
  async function upload(opts, localPath, fileKey) {
98385
98437
  const workspace = await resolveWorkspace(opts);
98386
98438
  await requireLogin(opts);
98387
- const buf = await readFile4(localPath);
98439
+ const buf = await readFile5(localPath);
98388
98440
  const blob = new Blob([buf], { type: opts.contentType ?? "application/octet-stream" });
98389
98441
  await fileUpload({
98390
98442
  workspace: workspace.workspaceId,