windmill-cli 1.817.0 → 1.819.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 +391 -336
  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.819.0",
16770
16770
  WITH_CREDENTIALS: true,
16771
16771
  interceptors: {
16772
16772
  request: new Interceptors,
@@ -18003,7 +18003,10 @@ var getAuditLog = (data) => {
18003
18003
  workspace: data.workspace
18004
18004
  },
18005
18005
  body: data.requestBody,
18006
- mediaType: "application/json"
18006
+ mediaType: "application/json",
18007
+ errors: {
18008
+ 400: "the body's workspace_id does not match the workspace in the path"
18009
+ }
18007
18010
  });
18008
18011
  }, deleteWorkspaceDependencies = (data) => {
18009
18012
  return request(OpenAPI, {
@@ -20020,7 +20023,7 @@ var init_auth = __esm(async () => {
20020
20023
  });
20021
20024
 
20022
20025
  // src/core/constants.ts
20023
- var WM_FORK_PREFIX = "wm-fork", VERSION = "1.817.0";
20026
+ var WM_FORK_PREFIX = "wm-fork", VERSION = "1.819.0";
20024
20027
 
20025
20028
  // src/utils/resource_folders.ts
20026
20029
  import { existsSync } from "node:fs";
@@ -22011,7 +22014,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22011
22014
  path,
22012
22015
  value: variable.value ?? "",
22013
22016
  is_secret: variable.is_secret,
22014
- description: variable.description ?? ""
22017
+ description: variable.description ?? "",
22018
+ labels: variable.labels
22015
22019
  },
22016
22020
  alreadyEncrypted: false
22017
22021
  });
@@ -22022,7 +22026,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22022
22026
  path,
22023
22027
  value: variable.value ?? "",
22024
22028
  is_secret: variable.is_secret,
22025
- description: variable.description ?? ""
22029
+ description: variable.description ?? "",
22030
+ labels: variable.labels
22026
22031
  }
22027
22032
  });
22028
22033
  }
@@ -22038,7 +22043,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22038
22043
  requestBody: {
22039
22044
  path,
22040
22045
  value: resource.value ?? "",
22041
- description: resource.description ?? ""
22046
+ description: resource.description ?? "",
22047
+ labels: resource.labels
22042
22048
  }
22043
22049
  });
22044
22050
  } else {
@@ -22048,7 +22054,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22048
22054
  path,
22049
22055
  value: resource.value ?? "",
22050
22056
  resource_type: resource.resource_type,
22051
- description: resource.description ?? ""
22057
+ description: resource.description ?? "",
22058
+ labels: resource.labels
22052
22059
  }
22053
22060
  });
22054
22061
  }
@@ -22089,7 +22096,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22089
22096
  requestBody: {
22090
22097
  owners: folder.owners,
22091
22098
  extra_perms: folder.extra_perms,
22092
- summary: folder.summary ?? undefined
22099
+ summary: folder.summary ?? undefined,
22100
+ labels: folder.labels ?? []
22093
22101
  }
22094
22102
  });
22095
22103
  } else {
@@ -22099,7 +22107,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22099
22107
  name,
22100
22108
  owners: folder.owners,
22101
22109
  extra_perms: folder.extra_perms,
22102
- summary: folder.summary ?? undefined
22110
+ summary: folder.summary ?? undefined,
22111
+ labels: folder.labels
22103
22112
  }
22104
22113
  });
22105
22114
  }
@@ -34753,6 +34762,30 @@ var init_job_polling = __esm(() => {
34753
34762
  });
34754
34763
 
34755
34764
  // src/utils/codebase.ts
34765
+ import { readFile as readFile2, stat as stat4 } from "node:fs/promises";
34766
+ import path7 from "node:path";
34767
+ function extraDigestPaths(codebase) {
34768
+ return [].concat(codebase.extra_digest_paths ?? []);
34769
+ }
34770
+ async function digestPath(p) {
34771
+ let s;
34772
+ try {
34773
+ s = await stat4(p);
34774
+ } catch {
34775
+ throw new Error(`Codebase extra_digest_paths entry not found: ${p} (resolved to ${path7.resolve(p)})`);
34776
+ }
34777
+ return s.isDirectory() ? await digestDir(p, "") : await generateHashFromBuffer(await readFile2(p));
34778
+ }
34779
+ function uncoveredBundleInputs(codebase, entry, inputs) {
34780
+ const entryAbs = path7.resolve(entry);
34781
+ const roots = [codebase.relative_path, ...extraDigestPaths(codebase)].map((r) => path7.resolve(r));
34782
+ return inputs.filter((i) => {
34783
+ if (/^[<(]|^[a-z-]{2,}:/i.test(i) || i.includes("node_modules"))
34784
+ return false;
34785
+ const abs = path7.resolve(i);
34786
+ return abs != entryAbs && !roots.some((r) => abs == r || abs.startsWith(r + path7.sep));
34787
+ });
34788
+ }
34756
34789
  function listSyncCodebases(options) {
34757
34790
  const res = [];
34758
34791
  const nb_codebase = options?.codebases?.length ?? 0;
@@ -34765,10 +34798,16 @@ function listSyncCodebases(options) {
34765
34798
  let hasAssets = false;
34766
34799
  const getDigest = async (forceTar) => {
34767
34800
  if (_digest == undefined) {
34768
- _digest = await digestDir(codebase.relative_path, JSON.stringify(codebase));
34801
+ let digest = await digestDir(codebase.relative_path, JSON.stringify(codebase));
34802
+ const extra = extraDigestPaths(codebase);
34803
+ if (extra.length > 0) {
34804
+ const hashes = await Promise.all(extra.map(digestPath));
34805
+ digest = await generateHash(digest + hashes.join(""));
34806
+ }
34769
34807
  if (codebase.format == "esm") {
34770
- _digest += ".esm";
34808
+ digest += ".esm";
34771
34809
  }
34810
+ _digest = digest;
34772
34811
  if (!alreadyPrinted) {
34773
34812
  alreadyPrinted = true;
34774
34813
  info(`Codebase ${codebase.relative_path}, digest: ${_digest}`);
@@ -36254,7 +36293,7 @@ var minimatch = (p, pattern, options = {}) => {
36254
36293
  }, qmarksTestNoExtDot = ([$0]) => {
36255
36294
  const len = $0.length;
36256
36295
  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) => {
36296
+ }, 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
36297
  if (!def || typeof def !== "object" || !Object.keys(def).length) {
36259
36298
  return minimatch;
36260
36299
  }
@@ -36312,11 +36351,11 @@ var init_esm2 = __esm(() => {
36312
36351
  starRE = /^\*+$/;
36313
36352
  qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
36314
36353
  defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
36315
- path7 = {
36354
+ path8 = {
36316
36355
  win32: { sep: "\\" },
36317
36356
  posix: { sep: "/" }
36318
36357
  };
36319
- sep3 = defaultPlatform === "win32" ? path7.win32.sep : path7.posix.sep;
36358
+ sep3 = defaultPlatform === "win32" ? path8.win32.sep : path8.posix.sep;
36320
36359
  minimatch.sep = sep3;
36321
36360
  GLOBSTAR = Symbol("globstar **");
36322
36361
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -56943,7 +56982,7 @@ var init_openflow = __esm(() => {
56943
56982
  openflow_default = {
56944
56983
  openapi: "3.0.3",
56945
56984
  info: {
56946
- version: "1.817.0",
56985
+ version: "1.819.0",
56947
56986
  title: "OpenFlow Spec",
56948
56987
  contact: {
56949
56988
  name: "Ruben Fiszel",
@@ -62160,7 +62199,7 @@ function collectPathScriptPaths(flowValue) {
62160
62199
  // src/commands/flow/flow_metadata.ts
62161
62200
  import { existsSync as existsSync8 } from "node:fs";
62162
62201
  import { rm } from "node:fs/promises";
62163
- import * as path8 from "node:path";
62202
+ import * as path9 from "node:path";
62164
62203
  import { sep as SEP4 } from "node:path";
62165
62204
  async function isFlowDirectlyStale(folder, hashes, conf) {
62166
62205
  if (await checkifMetadataUptodate(folder, hashes[TOP_HASH], conf, TOP_HASH)) {
@@ -62176,7 +62215,7 @@ async function isFlowDirectlyStale(folder, hashes, conf) {
62176
62215
  return false;
62177
62216
  }
62178
62217
  async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
62179
- const elems = await FSFSElement(path8.join(process.cwd(), folder), [], true);
62218
+ const elems = await FSFSElement(path9.join(process.cwd(), folder), [], true);
62180
62219
  const hashes = {};
62181
62220
  for await (const f of elems.getChildren()) {
62182
62221
  if (exts.some((e) => f.path.endsWith(e))) {
@@ -62224,7 +62263,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
62224
62263
  continue;
62225
62264
  }
62226
62265
  }
62227
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
62266
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
62228
62267
  const language = script.language;
62229
62268
  const imports = await extractRelativeImports(content, treePath, language);
62230
62269
  await tree.addNode(treePath, content, language, "", imports, "inline_script", folderNormalized, folder, false);
@@ -62259,7 +62298,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
62259
62298
  const c = script.content;
62260
62299
  if (c.startsWith("!inline ")) {
62261
62300
  const fileName = c.replace("!inline ", "");
62262
- const treePath = folderNormalized + "/" + path8.basename(script.path, path8.extname(script.path));
62301
+ const treePath = folderNormalized + "/" + path9.basename(script.path, path9.extname(script.path));
62263
62302
  fileToTreePath.set(fileName, treePath);
62264
62303
  }
62265
62304
  }
@@ -62281,7 +62320,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
62281
62320
  const locksToRemove = tree ? Object.keys(hashes).filter((k) => {
62282
62321
  if (k === TOP_HASH)
62283
62322
  return false;
62284
- const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path8.basename(k, path8.extname(k));
62323
+ const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path9.basename(k, path9.extname(k));
62285
62324
  return tree.isStale(treePath);
62286
62325
  }) : changedScripts;
62287
62326
  const missingFiles = [];
@@ -62349,7 +62388,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
62349
62388
  const relocked = tree ? Object.keys(finalHashes).filter((k) => {
62350
62389
  if (k === TOP_HASH)
62351
62390
  return false;
62352
- const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path8.basename(k, path8.extname(k));
62391
+ const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path9.basename(k, path9.extname(k));
62353
62392
  return tree.isStale(treePath);
62354
62393
  }) : changedScripts;
62355
62394
  const updatedScripts = relocked.map((p) => {
@@ -62942,10 +62981,10 @@ var init_generate_metadata = __esm(async () => {
62942
62981
  });
62943
62982
 
62944
62983
  // src/commands/script/script.ts
62945
- import { writeFile as writeFile5, stat as stat4, mkdir as mkdir3 } from "node:fs/promises";
62984
+ import { writeFile as writeFile5, stat as stat5, mkdir as mkdir3 } from "node:fs/promises";
62946
62985
  import { Buffer as Buffer4 } from "node:buffer";
62947
62986
  import { sep as SEP6 } from "node:path";
62948
- import * as path9 from "node:path";
62987
+ import * as path10 from "node:path";
62949
62988
  import fs10 from "node:fs";
62950
62989
  import { execSync as execSync4 } from "node:child_process";
62951
62990
  function nonePositiveInt(v) {
@@ -62973,9 +63012,9 @@ async function push2(opts, filePath) {
62973
63012
  if (!validatePath(filePath)) {
62974
63013
  return;
62975
63014
  }
62976
- const absentDescriptor = await stat4(filePath).then(() => false, (e) => isMissingDbtDescriptor(filePath, e));
63015
+ const absentDescriptor = await stat5(filePath).then(() => false, (e) => isMissingDbtDescriptor(filePath, e));
62977
63016
  if (!absentDescriptor) {
62978
- const fstat = await stat4(filePath);
63017
+ const fstat = await stat5(filePath);
62979
63018
  if (!fstat.isFile()) {
62980
63019
  throw new Error("file path must refer to a file.");
62981
63020
  }
@@ -63017,7 +63056,7 @@ async function findResourceFile(path) {
63017
63056
  candidates.unshift(branchSpecificJSON, branchSpecificYAML);
63018
63057
  }
63019
63058
  const validCandidates = (await Promise.all(candidates.map((x) => {
63020
- return stat4(x).catch(() => {
63059
+ return stat5(x).catch(() => {
63021
63060
  return;
63022
63061
  }).then((x) => x?.isFile()).then((e) => {
63023
63062
  return { path: x, file: e };
@@ -63092,9 +63131,14 @@ async function handleFile(path, workspace, alreadySynced, message, opts, rawWork
63092
63131
  platform: "node",
63093
63132
  packages: "bundle",
63094
63133
  target: format == "cjs" ? "node20.15.1" : "esnext",
63095
- banner: codebase.banner
63134
+ banner: codebase.banner,
63135
+ metafile: true
63096
63136
  });
63097
63137
  const endTime = performance.now();
63138
+ const uncovered = uncoveredBundleInputs(codebase, path, Object.keys(out.metafile?.inputs ?? {}));
63139
+ if (uncovered.length > 0) {
63140
+ 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(", ")}`);
63141
+ }
63098
63142
  bundleContent = out.outputFiles[0].text;
63099
63143
  outputFiles = out.outputFiles ?? [];
63100
63144
  if (outputFiles.length == 0) {
@@ -63265,7 +63309,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
63265
63309
  function readDir(dirPath, relPrefix) {
63266
63310
  const entries = fs10.readdirSync(dirPath, { withFileTypes: true });
63267
63311
  for (const entry of entries) {
63268
- const fullPath = path9.join(dirPath, entry.name);
63312
+ const fullPath = path10.join(dirPath, entry.name);
63269
63313
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
63270
63314
  const isTopLevel = relPrefix === "";
63271
63315
  if (entry.isDirectory()) {
@@ -63294,7 +63338,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
63294
63338
  const content = readTextFileSync(fullPath);
63295
63339
  const language = inferContentTypeFromFilePath(entry.name, defaultTs);
63296
63340
  const baseName = entry.name.replace(/\.[^.]+$/, "");
63297
- const lockPath = path9.join(dirPath, baseName + ".lock");
63341
+ const lockPath = path10.join(dirPath, baseName + ".lock");
63298
63342
  let lock;
63299
63343
  if (fs10.existsSync(lockPath)) {
63300
63344
  lock = readTextFileSync(lockPath);
@@ -63361,8 +63405,8 @@ async function createScript2(bundleContent, workspaceId, body, workspace) {
63361
63405
  }
63362
63406
  async function collidingDbtProject(basePath, baseDir) {
63363
63407
  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;
63408
+ const onDisk = baseDir ? path10.join(baseDir, project) : project;
63409
+ return await stat5(onDisk).then(() => true).catch(() => false) ? project : undefined;
63366
63410
  }
63367
63411
  async function collidingOrdinaryScript(basePath) {
63368
63412
  for (const ext of exts) {
@@ -63372,7 +63416,7 @@ async function collidingOrdinaryScript(basePath) {
63372
63416
  basePath + ext,
63373
63417
  `${basePath}${getModuleFolderSuffix()}/script${ext}`
63374
63418
  ]) {
63375
- const isFile = await stat4(candidate).then((s) => s.isFile()).catch(() => false);
63419
+ const isFile = await stat5(candidate).then((s) => s.isFile()).catch(() => false);
63376
63420
  if (isFile)
63377
63421
  return candidate;
63378
63422
  }
@@ -63392,7 +63436,7 @@ async function readScriptContent(filePath) {
63392
63436
  }
63393
63437
  }
63394
63438
  async function findContentFile(filePath, baseDir) {
63395
- const onDisk = (p) => baseDir ? path9.join(baseDir, p) : p;
63439
+ const onDisk = (p) => baseDir ? path10.join(baseDir, p) : p;
63396
63440
  const isModuleFolderMeta = isModuleEntryMetadata(filePath);
63397
63441
  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
63442
  if (!isModuleFolderMeta && !/\.script\.(yaml|json|lock)$/.test(filePath)) {
@@ -63400,7 +63444,7 @@ async function findContentFile(filePath, baseDir) {
63400
63444
  }
63401
63445
  const candidates = exts.map(toCandidate);
63402
63446
  const validCandidates = (await Promise.all(candidates.map((x) => {
63403
- return stat4(onDisk(x)).catch(() => {
63447
+ return stat5(onDisk(x)).catch(() => {
63404
63448
  return;
63405
63449
  }).then((x) => x?.isFile()).then((e) => {
63406
63450
  return { path: x, file: e };
@@ -63746,14 +63790,14 @@ async function bootstrap(opts, scriptPath, language) {
63746
63790
  const scriptCodeFileFullPath = scriptPath + extension;
63747
63791
  const scriptMetadataFileFullPath = scriptPath + ".script.yaml";
63748
63792
  try {
63749
- await stat4(scriptCodeFileFullPath);
63793
+ await stat5(scriptCodeFileFullPath);
63750
63794
  throw new Error("File already exists: " + scriptCodeFileFullPath);
63751
63795
  } catch (e) {
63752
63796
  if (e.message?.startsWith("File already exists"))
63753
63797
  throw e;
63754
63798
  }
63755
63799
  try {
63756
- await stat4(scriptMetadataFileFullPath);
63800
+ await stat5(scriptMetadataFileFullPath);
63757
63801
  throw new Error("File already exists: " + scriptMetadataFileFullPath);
63758
63802
  } catch (e) {
63759
63803
  if (e.message?.startsWith("File already exists"))
@@ -63767,7 +63811,7 @@ async function bootstrap(opts, scriptPath, language) {
63767
63811
  scriptMetadata.description = opts.description;
63768
63812
  }
63769
63813
  const scriptInitialMetadataYaml = import_yaml9.stringify(scriptMetadata, yamlOptions);
63770
- const parentDir = path9.dirname(scriptCodeFileFullPath);
63814
+ const parentDir = path10.dirname(scriptCodeFileFullPath);
63771
63815
  await mkdir3(parentDir, { recursive: true });
63772
63816
  await writeFile5(scriptCodeFileFullPath, scriptInitialCode, {
63773
63817
  flag: "wx",
@@ -63852,9 +63896,9 @@ async function preview(opts, filePath) {
63852
63896
  filePath = toSyncRootRelativePath(filePath, cwdBeforeConfig);
63853
63897
  const remotePath = scriptPathToRemotePath(filePath);
63854
63898
  assertRemotePath(remotePath, argPath);
63855
- const absentDescriptor = await stat4(filePath).then(() => false, (e) => isMissingDbtDescriptor(filePath, e));
63899
+ const absentDescriptor = await stat5(filePath).then(() => false, (e) => isMissingDbtDescriptor(filePath, e));
63856
63900
  if (!absentDescriptor) {
63857
- const fstat = await stat4(filePath);
63901
+ const fstat = await stat5(filePath);
63858
63902
  if (!fstat.isFile()) {
63859
63903
  throw new Error("file path must refer to a file.");
63860
63904
  }
@@ -63868,7 +63912,7 @@ async function preview(opts, filePath) {
63868
63912
  const input = opts.data ? await resolve9(opts.data) : {};
63869
63913
  const isFolderLayout = isModuleEntryPoint(filePath);
63870
63914
  const isDbt = language === "dbt";
63871
- const moduleFolderPath = isFolderLayout ? path9.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix(language);
63915
+ const moduleFolderPath = isFolderLayout ? path10.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix(language);
63872
63916
  const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, isFolderLayout, isDbt);
63873
63917
  const codebase = language == "bun" ? findCodebase(filePath, codebases) : undefined;
63874
63918
  let tempScriptRefs = undefined;
@@ -64154,9 +64198,9 @@ var init_script = __esm(async () => {
64154
64198
  });
64155
64199
 
64156
64200
  // src/commands/lint/lint.ts
64157
- import { stat as stat5, readdir as readdir2 } from "node:fs/promises";
64201
+ import { stat as stat6, readdir as readdir2 } from "node:fs/promises";
64158
64202
  import process15 from "node:process";
64159
- import * as path10 from "node:path";
64203
+ import * as path11 from "node:path";
64160
64204
  import { sep as SEP7 } from "node:path";
64161
64205
  function normalizePath(p) {
64162
64206
  return p.replaceAll(SEP7, "/");
@@ -64216,23 +64260,23 @@ async function isLockResolved(lockValue, baseDir, sharedLockBase) {
64216
64260
  }
64217
64261
  async function checkInlineFile(relativePath, baseDir, sharedLockBase) {
64218
64262
  const trimmed = relativePath.trim();
64219
- const fullPath = sharedLockBase !== undefined && isSharedLockPath(trimmed) ? path10.resolve(sharedLockBase, trimmed) : path10.join(baseDir, trimmed);
64263
+ const fullPath = sharedLockBase !== undefined && isSharedLockPath(trimmed) ? path11.resolve(sharedLockBase, trimmed) : path11.join(baseDir, trimmed);
64220
64264
  try {
64221
- const s = await stat5(fullPath);
64265
+ const s = await stat6(fullPath);
64222
64266
  return s.size > 0;
64223
64267
  } catch {
64224
64268
  return false;
64225
64269
  }
64226
64270
  }
64227
64271
  async function findSyncRoot(dir) {
64228
- let current = path10.resolve(dir);
64272
+ let current = path11.resolve(dir);
64229
64273
  while (true) {
64230
- if (await stat5(path10.join(current, "wmill.yaml")).then(() => true).catch(() => false)) {
64274
+ if (await stat6(path11.join(current, "wmill.yaml")).then(() => true).catch(() => false)) {
64231
64275
  return current;
64232
64276
  }
64233
- const parent = path10.dirname(current);
64277
+ const parent = path11.dirname(current);
64234
64278
  if (parent === current)
64235
- return path10.resolve(dir);
64279
+ return path11.resolve(dir);
64236
64280
  current = parent;
64237
64281
  }
64238
64282
  }
@@ -64318,7 +64362,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
64318
64362
  continue;
64319
64363
  const runnableId = fileName.replace(".yaml", "");
64320
64364
  processedIds.add(runnableId);
64321
- const filePath = path10.join(backendDir, fileName);
64365
+ const filePath = path11.join(backendDir, fileName);
64322
64366
  let runnable;
64323
64367
  try {
64324
64368
  runnable = await yamlParseFile(filePath);
@@ -64336,10 +64380,10 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
64336
64380
  }
64337
64381
  if (!language || !languageNeedsLock(language))
64338
64382
  continue;
64339
- const lockFile = path10.join(backendDir, `${runnableId}.lock`);
64383
+ const lockFile = path11.join(backendDir, `${runnableId}.lock`);
64340
64384
  let hasLock = false;
64341
64385
  try {
64342
- const s = await stat5(lockFile);
64386
+ const s = await stat6(lockFile);
64343
64387
  hasLock = s.size > 0;
64344
64388
  } catch {}
64345
64389
  if (!hasLock && runnable.inlineScript?.lock) {
@@ -64383,10 +64427,10 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
64383
64427
  }
64384
64428
  if (!languageNeedsLock(language))
64385
64429
  continue;
64386
- const lockFile = path10.join(backendDir, `${runnableId}.lock`);
64430
+ const lockFile = path11.join(backendDir, `${runnableId}.lock`);
64387
64431
  let hasLock = false;
64388
64432
  try {
64389
- const s = await stat5(lockFile);
64433
+ const s = await stat6(lockFile);
64390
64434
  hasLock = s.size > 0;
64391
64435
  } catch {}
64392
64436
  if (!hasLock) {
@@ -64403,7 +64447,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
64403
64447
  }
64404
64448
  async function checkMissingLocks(opts, directory) {
64405
64449
  const initialCwd = process15.cwd();
64406
- const targetDirectory = directory ? path10.resolve(initialCwd, directory) : process15.cwd();
64450
+ const targetDirectory = directory ? path11.resolve(initialCwd, directory) : process15.cwd();
64407
64451
  const { ...syncOpts } = opts;
64408
64452
  const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
64409
64453
  const ignore = await ignoreF(mergedOpts);
@@ -64427,19 +64471,19 @@ async function checkMissingLocks(opts, directory) {
64427
64471
  if (normalizedPath.endsWith("/flow.yaml") && normalizedPath.includes(flowSuffix + "/")) {
64428
64472
  flowYamls.push({
64429
64473
  normalizedPath,
64430
- fullPath: path10.join(targetDirectory, entry.path)
64474
+ fullPath: path11.join(targetDirectory, entry.path)
64431
64475
  });
64432
64476
  }
64433
64477
  if (normalizedPath.endsWith("/app.yaml") && normalizedPath.includes(appSuffix + "/")) {
64434
64478
  appYamls.push({
64435
64479
  normalizedPath,
64436
- fullPath: path10.join(targetDirectory, entry.path)
64480
+ fullPath: path11.join(targetDirectory, entry.path)
64437
64481
  });
64438
64482
  }
64439
64483
  if (normalizedPath.endsWith("/raw_app.yaml") && normalizedPath.includes(rawAppSuffix + "/")) {
64440
64484
  rawAppYamls.push({
64441
64485
  normalizedPath,
64442
- fullPath: path10.join(targetDirectory, entry.path)
64486
+ fullPath: path11.join(targetDirectory, entry.path)
64443
64487
  });
64444
64488
  }
64445
64489
  }
@@ -64449,14 +64493,14 @@ async function checkMissingLocks(opts, directory) {
64449
64493
  let language = null;
64450
64494
  for (const ext of exts) {
64451
64495
  try {
64452
- await stat5(path10.join(targetDirectory, basePath + ext));
64496
+ await stat6(path11.join(targetDirectory, basePath + ext));
64453
64497
  language = inferContentTypeFromFilePath(basePath + ext, defaultTs);
64454
64498
  break;
64455
64499
  } catch {}
64456
64500
  }
64457
64501
  if (language && languageNeedsLock(language)) {
64458
64502
  try {
64459
- const metadata = await yamlParseFile(path10.join(targetDirectory, yamlPath));
64503
+ const metadata = await yamlParseFile(path11.join(targetDirectory, yamlPath));
64460
64504
  const lockResolved = await isLockResolved(metadata?.lock, targetDirectory, syncRoot);
64461
64505
  if (!lockResolved) {
64462
64506
  issues.push({
@@ -64473,7 +64517,7 @@ async function checkMissingLocks(opts, directory) {
64473
64517
  }
64474
64518
  }
64475
64519
  for (const { normalizedPath: flowYamlPath, fullPath } of flowYamls) {
64476
- const flowDir = path10.dirname(fullPath);
64520
+ const flowDir = path11.dirname(fullPath);
64477
64521
  try {
64478
64522
  const flowFile = await yamlParseFile(fullPath);
64479
64523
  if (!flowFile?.value?.modules)
@@ -64498,7 +64542,7 @@ async function checkMissingLocks(opts, directory) {
64498
64542
  }
64499
64543
  }
64500
64544
  for (const { normalizedPath: appYamlPath, fullPath } of appYamls) {
64501
- const appDir = path10.dirname(fullPath);
64545
+ const appDir = path11.dirname(fullPath);
64502
64546
  try {
64503
64547
  const appFile = await yamlParseFile(fullPath);
64504
64548
  if (!appFile?.value)
@@ -64523,10 +64567,10 @@ async function checkMissingLocks(opts, directory) {
64523
64567
  }
64524
64568
  }
64525
64569
  for (const { normalizedPath: rawAppYamlPath, fullPath } of rawAppYamls) {
64526
- const rawAppDir = path10.dirname(fullPath);
64527
- const backendDir = path10.join(rawAppDir, "backend");
64570
+ const rawAppDir = path11.dirname(fullPath);
64571
+ const backendDir = path11.join(rawAppDir, "backend");
64528
64572
  try {
64529
- await stat5(backendDir);
64573
+ await stat6(backendDir);
64530
64574
  } catch {
64531
64575
  continue;
64532
64576
  }
@@ -64577,23 +64621,23 @@ async function checkOrphanScriptMetadata(syncRoot, prefix, metadataPaths) {
64577
64621
  }
64578
64622
  async function runLint(opts, directory) {
64579
64623
  const initialCwd = process15.cwd();
64580
- const explicitTargetDirectory = directory ? path10.resolve(initialCwd, directory) : undefined;
64624
+ const explicitTargetDirectory = directory ? path11.resolve(initialCwd, directory) : undefined;
64581
64625
  const { json: _json, ...syncOpts } = opts;
64582
64626
  const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
64583
64627
  const targetDirectory = explicitTargetDirectory ?? process15.cwd();
64584
- const stats = await stat5(targetDirectory).catch(() => null);
64628
+ const stats = await stat6(targetDirectory).catch(() => null);
64585
64629
  if (!stats) {
64586
64630
  throw new Error(`Directory not found: ${targetDirectory}`);
64587
64631
  }
64588
64632
  if (!stats.isDirectory()) {
64589
64633
  throw new Error(`Path is not a directory: ${targetDirectory}`);
64590
64634
  }
64591
- const isSubdirectory = explicitTargetDirectory && !await stat5(path10.join(targetDirectory, "wmill.yaml")).catch(() => null);
64635
+ const isSubdirectory = explicitTargetDirectory && !await stat6(path11.join(targetDirectory, "wmill.yaml")).catch(() => null);
64592
64636
  const ignore = isSubdirectory ? (_p, _isDir) => false : await ignoreF(mergedOpts);
64593
64637
  const root = await FSFSElement(targetDirectory, [], false);
64594
64638
  const validator = new WindmillYamlValidator;
64595
64639
  const syncRoot = await findSyncRoot(targetDirectory);
64596
- const metadataPrefix = normalizePath(path10.relative(syncRoot, targetDirectory));
64640
+ const metadataPrefix = normalizePath(path11.relative(syncRoot, targetDirectory));
64597
64641
  const warnings = [];
64598
64642
  const issues = [];
64599
64643
  const scriptMetadataPaths = [];
@@ -64723,7 +64767,7 @@ function affectsLint(filename) {
64723
64767
  }
64724
64768
  async function lintWatch(opts, directory) {
64725
64769
  const { watch } = await import("node:fs");
64726
- const targetDir = directory ? path10.resolve(process15.cwd(), directory) : process15.cwd();
64770
+ const targetDir = directory ? path11.resolve(process15.cwd(), directory) : process15.cwd();
64727
64771
  info(colors.blue(`Watching ${targetDir} for changes... (Ctrl+C to stop)`));
64728
64772
  async function runAndReport() {
64729
64773
  try {
@@ -64771,13 +64815,13 @@ var init_lint = __esm(async () => {
64771
64815
 
64772
64816
  // src/commands/shared_ui.ts
64773
64817
  import * as fs11 from "node:fs";
64774
- import * as path11 from "node:path";
64818
+ import * as path12 from "node:path";
64775
64819
  async function readDirRecursive(dir, rel = "", out = {}) {
64776
64820
  if (!fs11.existsSync(dir))
64777
64821
  return out;
64778
64822
  const entries = await fs11.promises.readdir(dir, { withFileTypes: true });
64779
64823
  for (const entry of entries) {
64780
- const full = path11.join(dir, entry.name);
64824
+ const full = path12.join(dir, entry.name);
64781
64825
  const r = rel ? rel + "/" + entry.name : entry.name;
64782
64826
  if (entry.isDirectory()) {
64783
64827
  await readDirRecursive(full, r, out);
@@ -64815,7 +64859,7 @@ function sharedUiChanges(files, remote, keepDeleted) {
64815
64859
  return changes;
64816
64860
  }
64817
64861
  async function diffSharedUi(workspace, keepDeleted) {
64818
- const localDir = path11.join(process.cwd(), SHARED_UI_DIR);
64862
+ const localDir = path12.join(process.cwd(), SHARED_UI_DIR);
64819
64863
  if (!fs11.existsSync(localDir)) {
64820
64864
  return [];
64821
64865
  }
@@ -64827,7 +64871,7 @@ async function diffSharedUi(workspace, keepDeleted) {
64827
64871
  return sharedUiChanges(files, remote ?? {}, keepDeleted);
64828
64872
  }
64829
64873
  async function pushSharedUi(workspace, keepDeleted) {
64830
- const localDir = path11.join(process.cwd(), SHARED_UI_DIR);
64874
+ const localDir = path12.join(process.cwd(), SHARED_UI_DIR);
64831
64875
  if (!fs11.existsSync(localDir)) {
64832
64876
  return false;
64833
64877
  }
@@ -64861,7 +64905,7 @@ async function pushSharedUi(workspace, keepDeleted) {
64861
64905
  return true;
64862
64906
  }
64863
64907
  async function pullSharedUi(workspace, keepDeleted) {
64864
- const localDir = path11.join(process.cwd(), SHARED_UI_DIR);
64908
+ const localDir = path12.join(process.cwd(), SHARED_UI_DIR);
64865
64909
  let got;
64866
64910
  try {
64867
64911
  got = await getSharedUi({ workspace });
@@ -64875,8 +64919,8 @@ async function pullSharedUi(workspace, keepDeleted) {
64875
64919
  }
64876
64920
  fs11.mkdirSync(localDir, { recursive: true });
64877
64921
  for (const [rel, content] of Object.entries(files)) {
64878
- const full = path11.join(localDir, rel);
64879
- fs11.mkdirSync(path11.dirname(full), { recursive: true });
64922
+ const full = path12.join(localDir, rel);
64923
+ fs11.mkdirSync(path12.dirname(full), { recursive: true });
64880
64924
  let existing;
64881
64925
  try {
64882
64926
  existing = readTextFileSync(full);
@@ -64892,7 +64936,7 @@ async function pullSharedUi(workspace, keepDeleted) {
64892
64936
  const local = await readDirRecursive(localDir);
64893
64937
  for (const rel of Object.keys(local)) {
64894
64938
  if (!known.has(rel)) {
64895
- const full = path11.join(localDir, rel);
64939
+ const full = path12.join(localDir, rel);
64896
64940
  try {
64897
64941
  fs11.unlinkSync(full);
64898
64942
  } catch {}
@@ -64911,7 +64955,7 @@ var init_shared_ui = __esm(async () => {
64911
64955
  });
64912
64956
 
64913
64957
  // src/commands/resource/resource.ts
64914
- import { mkdir as mkdir4, stat as stat6, writeFile as writeFile6, readdir as readdir3 } from "node:fs/promises";
64958
+ import { mkdir as mkdir4, stat as stat7, writeFile as writeFile6, readdir as readdir3 } from "node:fs/promises";
64915
64959
  import nodePath from "node:path";
64916
64960
  import { sep as SEP8 } from "node:path";
64917
64961
  async function readFilesetDirectory(dirPath) {
@@ -65003,7 +65047,7 @@ async function push3(opts, filePath, remotePath) {
65003
65047
  if (!validatePath(remotePath)) {
65004
65048
  return;
65005
65049
  }
65006
- const fstat = await stat6(filePath);
65050
+ const fstat = await stat7(filePath);
65007
65051
  if (!fstat.isFile()) {
65008
65052
  throw new Error("file path must refer to a file.");
65009
65053
  }
@@ -65043,7 +65087,7 @@ async function newResource(opts, path) {
65043
65087
  }
65044
65088
  const filePath = path + ".resource.yaml";
65045
65089
  try {
65046
- await stat6(filePath);
65090
+ await stat7(filePath);
65047
65091
  throw new Error("File already exists: " + filePath);
65048
65092
  } catch (e) {
65049
65093
  if (e.message?.startsWith("File already exists"))
@@ -65102,7 +65146,7 @@ var init_resource = __esm(async () => {
65102
65146
  // src/utils/lock_dedup.ts
65103
65147
  import { mkdir as mkdir5, rm as rm2, writeFile as writeFile7 } from "node:fs/promises";
65104
65148
  import { existsSync as existsSync10 } from "node:fs";
65105
- import * as path12 from "node:path";
65149
+ import * as path13 from "node:path";
65106
65150
  function isEmptySharedLockPlan(plan) {
65107
65151
  return Object.keys(plan.writes).length === 0 && plan.deletes.length === 0;
65108
65152
  }
@@ -65199,7 +65243,7 @@ function metadataLockUnreadable(metaPath, metaContent, isJson) {
65199
65243
  }
65200
65244
  function sharedLockRefIn(metadataContent, isJson, root = ".") {
65201
65245
  const ref = sharedLockRefOf("metadata", metadataContent, isJson);
65202
- return ref && existsSync10(path12.resolve(root, ref)) ? ref : undefined;
65246
+ return ref && existsSync10(path13.resolve(root, ref)) ? ref : undefined;
65203
65247
  }
65204
65248
  function depKeyOf(depFilePath) {
65205
65249
  const info = workspaceDependenciesPathToLanguageAndFilename(depFilePath);
@@ -65367,7 +65411,7 @@ function applySharedLockPlanToMap(map, plan) {
65367
65411
  }
65368
65412
  async function applySharedLockPlanToDisk(plan) {
65369
65413
  for (const [key, content] of Object.entries(plan.writes)) {
65370
- await mkdir5(path12.dirname(key), { recursive: true });
65414
+ await mkdir5(path13.dirname(key), { recursive: true });
65371
65415
  await writeFile7(key, content, "utf-8");
65372
65416
  }
65373
65417
  for (const key of plan.deletes) {
@@ -65387,7 +65431,7 @@ function scriptsReferencingSharedLock(map, sharedKey) {
65387
65431
  }
65388
65432
  return referrers;
65389
65433
  }
65390
- var import_yaml12, INLINE_PREFIX = "!inline ", toMapKey = (refPath) => refPath.replaceAll("/", path12.sep), toRefPath = (mapKey) => mapKey.replaceAll("\\", "/"), LOCKABLE_EXTS;
65434
+ var import_yaml12, INLINE_PREFIX = "!inline ", toMapKey = (refPath) => refPath.replaceAll("/", path13.sep), toRefPath = (mapKey) => mapKey.replaceAll("\\", "/"), LOCKABLE_EXTS;
65391
65435
  var init_lock_dedup = __esm(async () => {
65392
65436
  await __promiseAll([
65393
65437
  init_sync(),
@@ -65412,13 +65456,13 @@ var init_lock_dedup = __esm(async () => {
65412
65456
  import {
65413
65457
  writeFile as writeFile8,
65414
65458
  readdir as readdir4,
65415
- stat as stat7,
65459
+ stat as stat8,
65416
65460
  rm as rm3,
65417
65461
  copyFile,
65418
65462
  mkdir as mkdir6
65419
65463
  } from "node:fs/promises";
65420
65464
  import { existsSync as existsSync11 } from "node:fs";
65421
- import * as path13 from "node:path";
65465
+ import * as path14 from "node:path";
65422
65466
  import { sep as SEP9 } from "node:path";
65423
65467
  function isScriptLockPath(p) {
65424
65468
  const n = p.replaceAll(SEP9, "/");
@@ -65438,7 +65482,7 @@ async function collectSharedLockReaders(json) {
65438
65482
  throw e;
65439
65483
  }
65440
65484
  for (const entry of entries) {
65441
- const full = path13.join(dir, entry.name);
65485
+ const full = path14.join(dir, entry.name);
65442
65486
  if (entry.isDirectory()) {
65443
65487
  if (isNeverWalkedDir(entry.name))
65444
65488
  continue;
@@ -65627,7 +65671,7 @@ async function addCodebaseDigestIfRelevant(path, content, codebases, ignoreCodeb
65627
65671
  let isTs = true;
65628
65672
  const replacedPath = path.replace(".script.yaml", ".ts");
65629
65673
  try {
65630
- await stat7(replacedPath);
65674
+ await stat8(replacedPath);
65631
65675
  } catch {
65632
65676
  isTs = false;
65633
65677
  }
@@ -65676,7 +65720,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
65676
65720
  try {
65677
65721
  const entries = await readdir4(localP, { withFileTypes: true });
65678
65722
  for (const e of entries) {
65679
- yield _internal_element(path13.join(localP, e.name), e.isDirectory(), codebases);
65723
+ yield _internal_element(path14.join(localP, e.name), e.isDirectory(), codebases);
65680
65724
  }
65681
65725
  } catch (e) {
65682
65726
  warn(`Error reading dir: ${localP}, ${e}`);
@@ -65693,7 +65737,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
65693
65737
  }
65694
65738
  };
65695
65739
  }
65696
- return _internal_element(p, (await stat7(p)).isDirectory(), codebases);
65740
+ return _internal_element(p, (await stat8(p)).isDirectory(), codebases);
65697
65741
  }
65698
65742
  function prioritizeName(name) {
65699
65743
  if (name == "version")
@@ -65920,7 +65964,7 @@ async function findFilesetResourceFile(changePath, wsName) {
65920
65964
  }
65921
65965
  for (const candidate of candidates) {
65922
65966
  try {
65923
- const s = await stat7(candidate);
65967
+ const s = await stat8(candidate);
65924
65968
  if (s.isFile())
65925
65969
  return candidate;
65926
65970
  } catch {}
@@ -65951,9 +65995,9 @@ async function pushFilesetParentResource(childPath, workspaceId, alreadySynced,
65951
65995
  return { status: "pushed", resourceFilePath };
65952
65996
  }
65953
65997
  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)) {
65998
+ const resolved = path14.join(baseFolder, relPath);
65999
+ const rel = path14.relative(baseFolder, resolved);
66000
+ if (rel === "" || rel === ".." || rel.startsWith(".." + path14.sep) || path14.isAbsolute(rel)) {
65957
66001
  throw new Error(`raw app path ${JSON.stringify(relPath)} escapes the app folder ${baseFolder}`);
65958
66002
  }
65959
66003
  return resolved;
@@ -66003,9 +66047,9 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66003
66047
  for (const basePath of moduleScripts) {
66004
66048
  if (normalizedP.startsWith(basePath + ".")) {
66005
66049
  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);
66050
+ const dir = path14.dirname(finalPath);
66051
+ const base = path14.basename(basePath);
66052
+ finalPath = path14.join(dir, base + getModuleFolderSuffix(), "script" + ext);
66009
66053
  break;
66010
66054
  }
66011
66055
  }
@@ -66056,7 +66100,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66056
66100
  for (const s of inlineScripts) {
66057
66101
  yield {
66058
66102
  isDirectory: false,
66059
- path: path13.join(finalPath, s.path),
66103
+ path: path14.join(finalPath, s.path),
66060
66104
  async* getChildren() {},
66061
66105
  async getContentText() {
66062
66106
  return s.content;
@@ -66071,7 +66115,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66071
66115
  }
66072
66116
  yield {
66073
66117
  isDirectory: false,
66074
- path: path13.join(finalPath, "flow.yaml"),
66118
+ path: path14.join(finalPath, "flow.yaml"),
66075
66119
  async* getChildren() {},
66076
66120
  async getContentText() {
66077
66121
  return import_yaml14.stringify(flow, yamlOptions);
@@ -66097,7 +66141,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66097
66141
  for (const s of inlineScripts) {
66098
66142
  yield {
66099
66143
  isDirectory: false,
66100
- path: path13.join(finalPath, s.path),
66144
+ path: path14.join(finalPath, s.path),
66101
66145
  async* getChildren() {},
66102
66146
  async getContentText() {
66103
66147
  return s.content;
@@ -66108,7 +66152,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66108
66152
  app.policy = undefined;
66109
66153
  yield {
66110
66154
  isDirectory: false,
66111
- path: path13.join(finalPath, "app.yaml"),
66155
+ path: path14.join(finalPath, "app.yaml"),
66112
66156
  async* getChildren() {},
66113
66157
  async getContentText() {
66114
66158
  return import_yaml14.stringify(app, yamlOptions);
@@ -66179,7 +66223,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66179
66223
  for (const s of inlineScripts) {
66180
66224
  yield {
66181
66225
  isDirectory: false,
66182
- path: path13.join(finalPath, APP_BACKEND_FOLDER, s.path),
66226
+ path: path14.join(finalPath, APP_BACKEND_FOLDER, s.path),
66183
66227
  async* getChildren() {},
66184
66228
  async getContentText() {
66185
66229
  return s.content;
@@ -66215,7 +66259,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66215
66259
  }
66216
66260
  yield {
66217
66261
  isDirectory: false,
66218
- path: rawAppPathWithinFolder(path13.join(finalPath, APP_BACKEND_FOLDER), `${runnableId}.yaml`),
66262
+ path: rawAppPathWithinFolder(path14.join(finalPath, APP_BACKEND_FOLDER), `${runnableId}.yaml`),
66219
66263
  async* getChildren() {},
66220
66264
  async getContentText() {
66221
66265
  return import_yaml14.stringify(simplifiedRunnable, yamlOptions);
@@ -66229,7 +66273,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66229
66273
  delete rawApp?.["value"];
66230
66274
  yield {
66231
66275
  isDirectory: false,
66232
- path: path13.join(finalPath, "raw_app.yaml"),
66276
+ path: path14.join(finalPath, "raw_app.yaml"),
66233
66277
  async* getChildren() {},
66234
66278
  async getContentText() {
66235
66279
  return import_yaml14.stringify(rawApp, yamlOptions);
@@ -66237,7 +66281,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66237
66281
  };
66238
66282
  yield {
66239
66283
  isDirectory: false,
66240
- path: path13.join(finalPath, "DATATABLES.md"),
66284
+ path: path14.join(finalPath, "DATATABLES.md"),
66241
66285
  async* getChildren() {},
66242
66286
  async getContentText() {
66243
66287
  return generateDatatablesDocumentation(data);
@@ -66348,12 +66392,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66348
66392
  const scriptBasePath = removeSuffix(removeSuffix(finalPath, metaExt), ".script");
66349
66393
  const moduleFolderPath = scriptBasePath + getModuleFolderSuffix(isDbt ? "dbt" : undefined);
66350
66394
  if (hasModules && !isDbt) {
66351
- r[0].path = path13.join(moduleFolderPath, "script" + metaExt);
66395
+ r[0].path = path14.join(moduleFolderPath, "script" + metaExt);
66352
66396
  }
66353
66397
  if (lock && lock != "") {
66354
66398
  r.push({
66355
66399
  isDirectory: false,
66356
- path: hasModules && !isDbt ? path13.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
66400
+ path: hasModules && !isDbt ? path14.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
66357
66401
  async* getChildren() {},
66358
66402
  async getContentText() {
66359
66403
  return lock;
@@ -66368,7 +66412,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66368
66412
  for (const [relPath, mod] of Object.entries(scriptModules)) {
66369
66413
  yield {
66370
66414
  isDirectory: false,
66371
- path: path13.join(moduleFolderPath, relPath),
66415
+ path: path14.join(moduleFolderPath, relPath),
66372
66416
  async* getChildren() {},
66373
66417
  async getContentText() {
66374
66418
  return mod.content;
@@ -66378,7 +66422,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66378
66422
  const baseName = relPath.replace(/\.[^.]+$/, "");
66379
66423
  yield {
66380
66424
  isDirectory: false,
66381
- path: path13.join(moduleFolderPath, baseName + ".lock"),
66425
+ path: path14.join(moduleFolderPath, baseName + ".lock"),
66382
66426
  async* getChildren() {},
66383
66427
  async getContentText() {
66384
66428
  return mod.lock;
@@ -66415,7 +66459,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66415
66459
  if (typeof fileContent === "string") {
66416
66460
  yield {
66417
66461
  isDirectory: false,
66418
- path: path13.join(filesetBasePath, relPath),
66462
+ path: path14.join(filesetBasePath, relPath),
66419
66463
  async* getChildren() {},
66420
66464
  async getContentText() {
66421
66465
  return fileContent;
@@ -66451,7 +66495,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
66451
66495
  async* getChildren() {
66452
66496
  for (const filename in zip.files) {
66453
66497
  const file = zip.files[filename];
66454
- const totalPath = path13.join(p, filename);
66498
+ const totalPath = path14.join(p, filename);
66455
66499
  if (file.dir) {
66456
66500
  const e = zip.folder(file.name);
66457
66501
  yield _internal_folder(totalPath, e);
@@ -66809,11 +66853,11 @@ async function isCaseInsensitiveFilesystem(dir) {
66809
66853
  return _caseInsensitiveFsCache;
66810
66854
  let result = false;
66811
66855
  try {
66812
- const upper = path13.join(dir, `.wmill-CASEPROBE-${process.pid}.tmp`);
66813
- const lower = path13.join(dir, `.wmill-caseprobe-${process.pid}.tmp`);
66856
+ const upper = path14.join(dir, `.wmill-CASEPROBE-${process.pid}.tmp`);
66857
+ const lower = path14.join(dir, `.wmill-caseprobe-${process.pid}.tmp`);
66814
66858
  await writeFile8(upper, "", "utf-8");
66815
66859
  try {
66816
- await stat7(lower);
66860
+ await stat8(lower);
66817
66861
  result = true;
66818
66862
  } catch {
66819
66863
  result = false;
@@ -67152,7 +67196,7 @@ async function ignoreF(wmillconf) {
67152
67196
  };
67153
67197
  }
67154
67198
  try {
67155
- await stat7(".wmillignore");
67199
+ await stat8(".wmillignore");
67156
67200
  throw Error(".wmillignore is not supported anymore, switch to wmill.yaml");
67157
67201
  } catch {}
67158
67202
  return (p, isDirectory) => {
@@ -67503,7 +67547,7 @@ async function pull(opts) {
67503
67547
  specificItems = wsSpecificMerge.merged;
67504
67548
  opts = mergeCliWithEffectiveOptions(originalCliOpts, effectiveOpts);
67505
67549
  if (opts.stateful) {
67506
- await mkdir6(path13.join(process.cwd(), ".wmill"), { recursive: true });
67550
+ await mkdir6(path14.join(process.cwd(), ".wmill"), { recursive: true });
67507
67551
  }
67508
67552
  const codebases = await listSyncCodebases(opts);
67509
67553
  info(colors.gray("Computing the files to update locally to match remote (taking wmill.yaml into account)"));
@@ -67519,7 +67563,7 @@ async function pull(opts) {
67519
67563
  } catch {}
67520
67564
  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
67565
  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);
67566
+ const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(path14.join(process.cwd(), ".wmill"), [], true);
67523
67567
  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
67568
  if (opts.keepDeleted) {
67525
67569
  dropDeletions(changes, "local");
@@ -67579,8 +67623,8 @@ async function pull(opts) {
67579
67623
  targetPath = workspaceSpecificPath;
67580
67624
  }
67581
67625
  }
67582
- const target = path13.join(process.cwd(), targetPath);
67583
- const stateTarget = path13.join(process.cwd(), ".wmill", targetPath);
67626
+ const target = path14.join(process.cwd(), targetPath);
67627
+ const stateTarget = path14.join(process.cwd(), ".wmill", targetPath);
67584
67628
  if (removesDbtDescriptor(change)) {
67585
67629
  await rm3(target, { force: true });
67586
67630
  if (opts.stateful) {
@@ -67620,13 +67664,13 @@ Both local and remote have been modified.`));
67620
67664
  }
67621
67665
  await writeFile8(target, change.after, "utf-8");
67622
67666
  if (opts.stateful) {
67623
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
67667
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
67624
67668
  await copyFile(target, stateTarget);
67625
67669
  }
67626
67670
  } else if (change.name === "added") {
67627
- await mkdir6(path13.dirname(target), { recursive: true });
67671
+ await mkdir6(path14.dirname(target), { recursive: true });
67628
67672
  if (opts.stateful) {
67629
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
67673
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
67630
67674
  info(`Adding ${changeTypeLabel(change.path)}${targetPath}${targetPath !== change.path ? colors.gray(` (workspace-specific override for ${change.path})`) : ""}`);
67631
67675
  }
67632
67676
  await writeFile8(target, change.content, "utf-8");
@@ -67899,7 +67943,7 @@ async function checkoutInlineNames(flowYamlPath) {
67899
67943
  }
67900
67944
  const mapping = extractCurrentMapping(flow?.value?.modules, {}, flow?.value?.failure_module, flow?.value?.preprocessor_module);
67901
67945
  for (const [id, ref] of Object.entries(mapping)) {
67902
- if (path13.isAbsolute(ref) || ref.split(/[\\/]/).includes("..")) {
67946
+ if (path14.isAbsolute(ref) || ref.split(/[\\/]/).includes("..")) {
67903
67947
  delete mapping[id];
67904
67948
  }
67905
67949
  }
@@ -68031,9 +68075,9 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
68031
68075
  resourceTypeToFormatExtension = parsed.formatExtMap;
68032
68076
  resourceTypeToIsFileset = parsed.filesetMap;
68033
68077
  } catch {}
68034
- const localFlowInlineMapping = (flowDir) => checkoutInlineNames(path13.join(process.cwd(), flowDir, "flow.yaml"));
68078
+ const localFlowInlineMapping = (flowDir) => checkoutInlineNames(path14.join(process.cwd(), flowDir, "flow.yaml"));
68035
68079
  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);
68080
+ const local = await FSFSElement(path14.join(process.cwd(), ""), codebases, false);
68037
68081
  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
68082
  const wsSpecificFlagOnly = computeWsSpecificFlagOnlyPushes(localMap, localSpecificItems, serverWsSpecificItems);
68039
68083
  for (const item of wsSpecificFlagOnly) {
@@ -68289,18 +68333,18 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
68289
68333
  }
68290
68334
  }
68291
68335
  for (const folderName of folderNames) {
68292
- const basePath = path13.join("f", folderName, "folder.meta.yaml");
68336
+ const basePath = path14.join("f", folderName, "folder.meta.yaml");
68293
68337
  const branchPath = getWorkspaceSpecificPath(`f/${folderName}/folder.meta.yaml`, specificItems, wsNameForFiles);
68294
68338
  let found = false;
68295
68339
  if (branchPath) {
68296
68340
  try {
68297
- await stat7(branchPath);
68341
+ await stat8(branchPath);
68298
68342
  found = true;
68299
68343
  } catch {}
68300
68344
  }
68301
68345
  if (!found) {
68302
68346
  try {
68303
- await stat7(basePath);
68347
+ await stat8(basePath);
68304
68348
  found = true;
68305
68349
  } catch {}
68306
68350
  }
@@ -68469,7 +68513,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68469
68513
  let stateful = opts.stateful;
68470
68514
  if (stateful) {
68471
68515
  try {
68472
- await stat7(path13.join(process.cwd(), ".wmill"));
68516
+ await stat8(path14.join(process.cwd(), ".wmill"));
68473
68517
  } catch {
68474
68518
  stateful = false;
68475
68519
  }
@@ -68541,8 +68585,8 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68541
68585
  let stateTarget = undefined;
68542
68586
  if (stateful) {
68543
68587
  try {
68544
- stateTarget = path13.join(process.cwd(), ".wmill", change.path);
68545
- await stat7(stateTarget);
68588
+ stateTarget = path14.join(process.cwd(), ".wmill", change.path);
68589
+ await stat8(stateTarget);
68546
68590
  } catch {
68547
68591
  stateTarget = undefined;
68548
68592
  }
@@ -68550,7 +68594,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68550
68594
  if (change.name === "edited") {
68551
68595
  if (isFileResource(change.path) || isFilesetResource(change.path)) {
68552
68596
  if (stateTarget) {
68553
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
68597
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
68554
68598
  info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
68555
68599
  }
68556
68600
  }
@@ -68603,7 +68647,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68603
68647
  continue;
68604
68648
  }
68605
68649
  if (stateTarget) {
68606
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
68650
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
68607
68651
  info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
68608
68652
  }
68609
68653
  const oldObj = parseFromPath(change.path, change.before);
@@ -68661,7 +68705,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68661
68705
  continue;
68662
68706
  }
68663
68707
  if (stateTarget) {
68664
- await mkdir6(path13.dirname(stateTarget), { recursive: true });
68708
+ await mkdir6(path14.dirname(stateTarget), { recursive: true });
68665
68709
  info(`Adding ${getTypeStrFromPath(change.path)} ${change.path}`);
68666
68710
  }
68667
68711
  const obj = parseFromPath(change.path, change.content);
@@ -68756,7 +68800,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68756
68800
  let flowFolderExists = false;
68757
68801
  if (flowFolder) {
68758
68802
  try {
68759
- await stat7(flowFolder);
68803
+ await stat8(flowFolder);
68760
68804
  flowFolderExists = true;
68761
68805
  } catch {}
68762
68806
  }
@@ -68784,7 +68828,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68784
68828
  let appFolderExists = false;
68785
68829
  if (appFolder) {
68786
68830
  try {
68787
- await stat7(appFolder);
68831
+ await stat8(appFolder);
68788
68832
  appFolderExists = true;
68789
68833
  } catch {}
68790
68834
  }
@@ -68812,7 +68856,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
68812
68856
  let folderExists = false;
68813
68857
  if (rawAppFolder) {
68814
68858
  try {
68815
- await stat7(rawAppFolder);
68859
+ await stat8(rawAppFolder);
68816
68860
  folderExists = true;
68817
68861
  } catch {}
68818
68862
  }
@@ -69370,9 +69414,9 @@ var init_parse_schema = __esm(() => {
69370
69414
 
69371
69415
  // src/utils/metadata.ts
69372
69416
  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";
69417
+ import { writeFile as writeFile9, stat as stat9, rm as rm4, readdir as readdir5 } from "node:fs/promises";
69374
69418
  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";
69419
+ import * as path15 from "node:path";
69376
69420
  import { createRequire as createRequire3 } from "node:module";
69377
69421
  function loadParser(pkgName) {
69378
69422
  let p = _parserCache.get(pkgName);
@@ -69463,7 +69507,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
69463
69507
  });
69464
69508
  const metadataContent = await readTextFile(metadataWithType.path);
69465
69509
  const filteredRawWorkspaceDependencies = filterWorkspaceDependencies(rawWorkspaceDependencies, scriptContent, language);
69466
- const moduleFolderPath = isFolderLayout ? path14.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix(language);
69510
+ const moduleFolderPath = isFolderLayout ? path15.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix(language);
69467
69511
  const hasModules = existsSync12(moduleFolderPath) && statSync3(moduleFolderPath).isDirectory();
69468
69512
  const depsForHash = tree ? {} : filteredRawWorkspaceDependencies;
69469
69513
  let hash = await generateScriptHash(depsForHash, scriptContent, metadataContent);
@@ -69535,7 +69579,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
69535
69579
  const hasCodebase = findCodebase(scriptPath, codebases) != null;
69536
69580
  if (!hasCodebase) {
69537
69581
  const tempScriptRefs = tree?.getTempScriptRefs(remotePath);
69538
- const lockPathOverride = metadataInFolder ? path14.dirname(scriptPath) + "/script.lock" : undefined;
69582
+ const lockPathOverride = metadataInFolder ? path15.dirname(scriptPath) + "/script.lock" : undefined;
69539
69583
  await updateScriptLock(workspace, scriptContent, language, remotePath, metadataParsedContent, filteredRawWorkspaceDependencies, tempScriptRefs, lockPathOverride, opts.dedupeLockfiles ? sharedLockTargetFor(scriptContent, language, Object.keys(rawWorkspaceDependencies)) : undefined);
69540
69584
  } else {
69541
69585
  metadataParsedContent.lock = "";
@@ -69569,10 +69613,10 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
69569
69613
  let newMetadataContent;
69570
69614
  if (metadataInFolder) {
69571
69615
  if (metadataWithType.isJson) {
69572
- metaPath = path14.dirname(scriptPath) + "/script.json";
69616
+ metaPath = path15.dirname(scriptPath) + "/script.json";
69573
69617
  newMetadataContent = JSON.stringify(metadataParsedContent);
69574
69618
  } else {
69575
- metaPath = path14.dirname(scriptPath) + "/script.yaml";
69619
+ metaPath = path15.dirname(scriptPath) + "/script.yaml";
69576
69620
  newMetadataContent = import_yaml16.stringify(metadataParsedContent, yamlOptions);
69577
69621
  }
69578
69622
  } else {
@@ -69725,7 +69769,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
69725
69769
  metadataContent.lock = "!inline " + lockPath.replaceAll(SEP10, "/");
69726
69770
  } else {
69727
69771
  try {
69728
- if (await stat8(lockPath)) {
69772
+ if (await stat9(lockPath)) {
69729
69773
  await rm4(lockPath);
69730
69774
  }
69731
69775
  } catch (e) {
@@ -69737,7 +69781,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
69737
69781
  async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules) {
69738
69782
  const entries = readdirSync2(dirPath, { withFileTypes: true });
69739
69783
  for (const entry of entries) {
69740
- const fullPath = path14.join(dirPath, entry.name);
69784
+ const fullPath = path15.join(dirPath, entry.name);
69741
69785
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
69742
69786
  if (entry.isDirectory()) {
69743
69787
  await updateModuleLocks(workspace, fullPath, relPath, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules);
@@ -69761,7 +69805,7 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
69761
69805
  try {
69762
69806
  const lock = await fetchScriptLock(workspace, moduleContent, modLanguage, moduleRemotePath, rawWorkspaceDependencies);
69763
69807
  const baseName = entry.name.replace(/\.[^.]+$/, "");
69764
- const lockPath = path14.join(dirPath, baseName + ".lock");
69808
+ const lockPath = path15.join(dirPath, baseName + ".lock");
69765
69809
  if (lock != "") {
69766
69810
  writeFileSync5(lockPath, lock, "utf-8");
69767
69811
  } else {
@@ -69943,7 +69987,7 @@ function replaceLock(o) {
69943
69987
  async function parseMetadataFileIfExists(scriptPath) {
69944
69988
  let metadataFilePath = scriptPath + ".script.json";
69945
69989
  try {
69946
- await stat8(metadataFilePath);
69990
+ await stat9(metadataFilePath);
69947
69991
  const payload = JSON.parse(await readTextFile(metadataFilePath));
69948
69992
  replaceLock(payload);
69949
69993
  return {
@@ -69954,7 +69998,7 @@ async function parseMetadataFileIfExists(scriptPath) {
69954
69998
  } catch {
69955
69999
  try {
69956
70000
  metadataFilePath = scriptPath + ".script.yaml";
69957
- await stat8(metadataFilePath);
70001
+ await stat9(metadataFilePath);
69958
70002
  const payload = await yamlParseFile(metadataFilePath);
69959
70003
  replaceLock(payload);
69960
70004
  return {
@@ -69970,7 +70014,7 @@ async function parseMetadataFileIfExists(scriptPath) {
69970
70014
  async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
69971
70015
  let metadataFilePath = scriptPath + ".script.json";
69972
70016
  try {
69973
- await stat8(metadataFilePath);
70017
+ await stat9(metadataFilePath);
69974
70018
  return {
69975
70019
  path: metadataFilePath,
69976
70020
  payload: JSON.parse(await readTextFile(metadataFilePath)),
@@ -69979,7 +70023,7 @@ async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
69979
70023
  } catch {
69980
70024
  try {
69981
70025
  metadataFilePath = scriptPath + ".script.yaml";
69982
- await stat8(metadataFilePath);
70026
+ await stat9(metadataFilePath);
69983
70027
  const payload = await yamlParseFile(metadataFilePath);
69984
70028
  replaceLock(payload);
69985
70029
  return {
@@ -69991,7 +70035,7 @@ async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
69991
70035
  const moduleFolderMeta = scriptPath + getModuleFolderSuffix();
69992
70036
  try {
69993
70037
  metadataFilePath = moduleFolderMeta + "/script.json";
69994
- await stat8(metadataFilePath);
70038
+ await stat9(metadataFilePath);
69995
70039
  return {
69996
70040
  path: metadataFilePath,
69997
70041
  payload: JSON.parse(await readTextFile(metadataFilePath)),
@@ -70000,7 +70044,7 @@ async function parseMetadataFile(scriptPath, generateMetadataIfMissing) {
70000
70044
  } catch {
70001
70045
  try {
70002
70046
  metadataFilePath = moduleFolderMeta + "/script.yaml";
70003
- await stat8(metadataFilePath);
70047
+ await stat9(metadataFilePath);
70004
70048
  const payload = await yamlParseFile(metadataFilePath);
70005
70049
  replaceLock(payload);
70006
70050
  return {
@@ -70113,7 +70157,7 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
70113
70157
  async function readDir(dirPath, relPrefix) {
70114
70158
  const entries = readdirSync2(dirPath, { withFileTypes: true });
70115
70159
  for (const entry of entries) {
70116
- const fullPath = path14.join(dirPath, entry.name);
70160
+ const fullPath = path15.join(dirPath, entry.name);
70117
70161
  const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
70118
70162
  const isTopLevel = relPrefix === "";
70119
70163
  if (entry.isDirectory()) {
@@ -70235,7 +70279,7 @@ var init_metadata = __esm(async () => {
70235
70279
 
70236
70280
  // src/commands/app/raw_apps.ts
70237
70281
  import { sep as SEP11 } from "node:path";
70238
- import path15 from "node:path";
70282
+ import path16 from "node:path";
70239
70283
  import { readdir as readdir6 } from "node:fs/promises";
70240
70284
  async function readSiblingLock(backendPath, runnableId, allFiles) {
70241
70285
  const target = `${runnableId.toLowerCase()}.lock`;
@@ -70243,7 +70287,7 @@ async function readSiblingLock(backendPath, runnableId, allFiles) {
70243
70287
  if (!lockFile)
70244
70288
  return;
70245
70289
  try {
70246
- return await readTextFile(path15.join(backendPath, lockFile));
70290
+ return await readTextFile(path16.join(backendPath, lockFile));
70247
70291
  } catch {
70248
70292
  return;
70249
70293
  }
@@ -70260,7 +70304,7 @@ async function findRunnableContentFile(backendPath, runnableId, allFiles) {
70260
70304
  const ext = fileName.substring(runnableId.length + 1);
70261
70305
  if (EXTENSION_TO_LANGUAGE[ext]) {
70262
70306
  try {
70263
- const content = await readTextFile(path15.join(backendPath, fileName));
70307
+ const content = await readTextFile(path16.join(backendPath, fileName));
70264
70308
  return { ext, content };
70265
70309
  } catch {
70266
70310
  continue;
@@ -70297,7 +70341,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
70297
70341
  }
70298
70342
  const runnableId = fileName.replace(".yaml", "");
70299
70343
  processedIds.add(runnableId.toLowerCase());
70300
- const filePath = path15.join(backendPath, fileName);
70344
+ const filePath = path16.join(backendPath, fileName);
70301
70345
  const runnable = await yamlParseFile(filePath);
70302
70346
  if (runnable?.type === "inline") {
70303
70347
  const contentFile = await findRunnableContentFile(backendPath, runnableId, allFiles);
@@ -70358,7 +70402,7 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
70358
70402
  ...rest
70359
70403
  };
70360
70404
  }
70361
- const filePath = path15.join(backendPath, `${runnableId}.yaml`);
70405
+ const filePath = path16.join(backendPath, `${runnableId}.yaml`);
70362
70406
  writeIfChanged(filePath, import_yaml19.stringify(runnableToWrite, yamlOptions));
70363
70407
  }
70364
70408
  async function collectAppFiles(localPath) {
@@ -70411,7 +70455,7 @@ async function pushRawApp(workspace, remotePath, localPath, message, defaultTs =
70411
70455
  }
70412
70456
  const appFilePath = localPath + "raw_app.yaml";
70413
70457
  const localApp = await yamlParseFile(appFilePath);
70414
- const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
70458
+ const backendPath = path16.join(localPath, APP_BACKEND_FOLDER);
70415
70459
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath, defaultTs);
70416
70460
  let runnables;
70417
70461
  if (Object.keys(runnablesFromBackend).length > 0) {
@@ -70434,7 +70478,7 @@ async function pushRawApp(workspace, remotePath, localPath, message, defaultTs =
70434
70478
  const frameworks = detectFrameworks(localPath);
70435
70479
  const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
70436
70480
  const entryPoint = localPath + entryFile;
70437
- const sharedUiDir = path15.join(process.cwd(), "ui");
70481
+ const sharedUiDir = path16.join(process.cwd(), "ui");
70438
70482
  return await createBundle({
70439
70483
  entryPoint,
70440
70484
  production: true,
@@ -70533,7 +70577,7 @@ var init_raw_apps = __esm(async () => {
70533
70577
  });
70534
70578
 
70535
70579
  // src/commands/app/app_metadata.ts
70536
- import path16 from "node:path";
70580
+ import path17 from "node:path";
70537
70581
  import { mkdir as mkdir8, readdir as readdir7 } from "node:fs/promises";
70538
70582
  import { sep as SEP12 } from "node:path";
70539
70583
  async function isAppDirectlyStale(appFolder, hashes, conf) {
@@ -70550,7 +70594,7 @@ async function isAppDirectlyStale(appFolder, hashes, conf) {
70550
70594
  return false;
70551
70595
  }
70552
70596
  async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
70553
- const runnablesFolder = rawApp ? path16.join(folder, APP_BACKEND_FOLDER) : folder;
70597
+ const runnablesFolder = rawApp ? path17.join(folder, APP_BACKEND_FOLDER) : folder;
70554
70598
  const hashes = {};
70555
70599
  try {
70556
70600
  const elems = await FSFSElement(runnablesFolder, [], true);
@@ -70593,9 +70637,9 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
70593
70637
  if (!justUpdateMetadataLock && !noStaleMessage) {
70594
70638
  info(`Generating locks for app ${appFolder} at ${remote_path}`);
70595
70639
  }
70596
- const appFilePath = path16.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
70640
+ const appFilePath = path17.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
70597
70641
  const appFile = await yamlParseFile(appFilePath);
70598
- const runnablesFolder = path16.join(appFolder, APP_BACKEND_FOLDER);
70642
+ const runnablesFolder = path17.join(appFolder, APP_BACKEND_FOLDER);
70599
70643
  let rawAppRunnables = {};
70600
70644
  if (rawApp) {
70601
70645
  rawAppRunnables = await loadRunnablesFromBackend(runnablesFolder, opts.defaultTs);
@@ -70739,7 +70783,7 @@ async function traverseAndProcessInlineScripts(obj, processor, currentPath = [])
70739
70783
  }
70740
70784
  async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage, tempScriptRefs) {
70741
70785
  const updatedRunnables = [];
70742
- const runnablesFolder = path16.join(appFolder, APP_BACKEND_FOLDER);
70786
+ const runnablesFolder = path17.join(appFolder, APP_BACKEND_FOLDER);
70743
70787
  try {
70744
70788
  await mkdir8(runnablesFolder, { recursive: true });
70745
70789
  } catch {}
@@ -70764,7 +70808,7 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
70764
70808
  if (language === "frontend") {
70765
70809
  const [basePathO, ext] = pathAssigner.assignPath(runnableId, language);
70766
70810
  const basePath = basePathO.replaceAll(SEP12, "/");
70767
- const contentPath = path16.join(runnablesFolder, `${basePath}${ext}`);
70811
+ const contentPath = path17.join(runnablesFolder, `${basePath}${ext}`);
70768
70812
  writeIfChanged(contentPath, content);
70769
70813
  const simplifiedRunnable = { type: "inline" };
70770
70814
  for (const [key, value] of Object.entries(runnable)) {
@@ -70782,8 +70826,8 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
70782
70826
  const lock = await generateInlineScriptLock(workspace, content, language, `${remotePath}/${runnableId}`, rawDeps, tempScriptRefs);
70783
70827
  const [basePathO, ext] = pathAssigner.assignPath(runnableId, language);
70784
70828
  const basePath = basePathO.replaceAll(SEP12, "/");
70785
- const contentPath = path16.join(runnablesFolder, `${basePath}${ext}`);
70786
- const lockPath = path16.join(runnablesFolder, `${basePath}lock`);
70829
+ const contentPath = path17.join(runnablesFolder, `${basePath}${ext}`);
70830
+ const lockPath = path17.join(runnablesFolder, `${basePath}lock`);
70787
70831
  writeIfChanged(contentPath, content);
70788
70832
  if (lock && lock !== "") {
70789
70833
  writeIfChanged(lockPath, lock);
@@ -70831,8 +70875,8 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
70831
70875
  }
70832
70876
  const [basePathO, ext] = pathAssigner.assignPath(scriptName, language);
70833
70877
  const basePath = basePathO.replaceAll(SEP12, "/");
70834
- const contentPath = path16.join(appFolder, `${basePath}${ext}`);
70835
- const lockPath = path16.join(appFolder, `${basePath}lock`);
70878
+ const contentPath = path17.join(appFolder, `${basePath}${ext}`);
70879
+ const lockPath = path17.join(appFolder, `${basePath}lock`);
70836
70880
  writeIfChanged(contentPath, content);
70837
70881
  if (lock && lock !== "") {
70838
70882
  writeIfChanged(lockPath, lock);
@@ -70906,7 +70950,7 @@ ${text}`);
70906
70950
  return lock ?? "";
70907
70951
  }
70908
70952
  async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultTs = "bun") {
70909
- const fileName = path16.basename(runnableFilePath);
70953
+ const fileName = path17.basename(runnableFilePath);
70910
70954
  if (fileName.endsWith(".lock") || fileName.endsWith(".yaml")) {
70911
70955
  return;
70912
70956
  }
@@ -70921,13 +70965,13 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
70921
70965
  if (!runnableId || !ext) {
70922
70966
  return;
70923
70967
  }
70924
- const runnableFilePath2 = path16.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
70968
+ const runnableFilePath2 = path17.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
70925
70969
  let runnable;
70926
70970
  try {
70927
70971
  runnable = await yamlParseFile(runnableFilePath2);
70928
70972
  } catch {
70929
70973
  try {
70930
- const appFilePath = path16.join(appFolder, "raw_app.yaml");
70974
+ const appFilePath = path17.join(appFolder, "raw_app.yaml");
70931
70975
  const appFile = await yamlParseFile(appFilePath);
70932
70976
  if (!appFile.runnables?.[runnableId]) {
70933
70977
  warn(colors.yellow(`Runnable ${runnableId} not found in backend folder or raw_app.yaml`));
@@ -70952,7 +70996,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
70952
70996
  warn(colors.yellow(`Could not determine language for ${runnableId} (ext: ${ext})`));
70953
70997
  return;
70954
70998
  }
70955
- const fullFilePath = path16.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
70999
+ const fullFilePath = path17.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
70956
71000
  let content;
70957
71001
  try {
70958
71002
  content = await readTextFile(fullFilePath);
@@ -70975,7 +71019,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
70975
71019
  }
70976
71020
  async function inferAllInlineSchemas(appFolder, defaultTs = "bun") {
70977
71021
  const schemas = {};
70978
- const backendPath = path16.join(appFolder, APP_BACKEND_FOLDER);
71022
+ const backendPath = path17.join(appFolder, APP_BACKEND_FOLDER);
70979
71023
  let entries;
70980
71024
  try {
70981
71025
  entries = await readdir7(backendPath, { withFileTypes: true });
@@ -71085,7 +71129,7 @@ var init_app_metadata = __esm(async () => {
71085
71129
  // src/commands/app/generate_agents.ts
71086
71130
  import * as fs12 from "node:fs";
71087
71131
  import { writeFile as writeFile10 } from "node:fs/promises";
71088
- import path17 from "node:path";
71132
+ import path18 from "node:path";
71089
71133
  import process16 from "node:process";
71090
71134
  function generateDatatablesMarkdown(schemas, localData) {
71091
71135
  const defaultDatatable = localData?.datatable;
@@ -71185,7 +71229,7 @@ Configure datatables in Workspace Settings > Windmill Data Tables.
71185
71229
  return content;
71186
71230
  }
71187
71231
  async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
71188
- const rawAppPath = path17.join(targetDir, "raw_app.yaml");
71232
+ const rawAppPath = path18.join(targetDir, "raw_app.yaml");
71189
71233
  if (!fs12.existsSync(rawAppPath)) {
71190
71234
  if (!silent) {
71191
71235
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
@@ -71212,11 +71256,11 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
71212
71256
  }
71213
71257
  } catch {}
71214
71258
  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
71259
+ await writeFile10(path18.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");
71260
+ await writeFile10(path18.join(targetDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
71217
71261
  `, "utf-8");
71218
71262
  const datatablesContent = generateDatatablesMarkdown(schemas, localData);
71219
- await writeFile10(path17.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
71263
+ await writeFile10(path18.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
71220
71264
  if (!silent) {
71221
71265
  info(colors.green(`✓ Generated AGENTS.md, CLAUDE.md, and DATATABLES.md`));
71222
71266
  const datatableCount = schemas.length;
@@ -71237,18 +71281,18 @@ async function generateAgents(opts, appFolder) {
71237
71281
  const cwd = process16.cwd();
71238
71282
  let targetDir = cwd;
71239
71283
  if (appFolder) {
71240
- targetDir = path17.isAbsolute(appFolder) ? appFolder : path17.join(cwd, appFolder);
71284
+ targetDir = path18.isAbsolute(appFolder) ? appFolder : path18.join(cwd, appFolder);
71241
71285
  }
71242
71286
  await loadNonDottedPathsSetting();
71243
- const dirName = path17.basename(targetDir);
71287
+ const dirName = path18.basename(targetDir);
71244
71288
  if (!hasFolderSuffix(dirName, "raw_app")) {
71245
- if (!hasFolderSuffix(path17.basename(cwd), "raw_app") && !appFolder) {
71289
+ if (!hasFolderSuffix(path18.basename(cwd), "raw_app") && !appFolder) {
71246
71290
  error(colors.red(`Error: Must be run inside a ${getFolderSuffix("raw_app")} folder or specify one as argument.`));
71247
71291
  info(colors.gray("Usage: wmill app generate-agents [app_folder]"));
71248
71292
  process16.exit(1);
71249
71293
  }
71250
71294
  }
71251
- const rawAppPath = path17.join(targetDir, "raw_app.yaml");
71295
+ const rawAppPath = path18.join(targetDir, "raw_app.yaml");
71252
71296
  if (!fs12.existsSync(rawAppPath)) {
71253
71297
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
71254
71298
  process16.exit(1);
@@ -71511,7 +71555,7 @@ var init_devRecorder = __esm(async () => {
71511
71555
  import { sep as SEP13 } from "node:path";
71512
71556
  import * as http2 from "node:http";
71513
71557
  import * as fs13 from "node:fs";
71514
- import * as path18 from "node:path";
71558
+ import * as path19 from "node:path";
71515
71559
  import process17 from "node:process";
71516
71560
  import { Buffer as Buffer5 } from "node:buffer";
71517
71561
  import { writeFileSync as writeFileSync6 } from "node:fs";
@@ -71521,20 +71565,20 @@ async function dev(opts, appFolder) {
71521
71565
  const originalCwd = process17.cwd();
71522
71566
  let targetDir = originalCwd;
71523
71567
  if (appFolder) {
71524
- targetDir = path18.isAbsolute(appFolder) ? appFolder : path18.join(originalCwd, appFolder);
71568
+ targetDir = path19.isAbsolute(appFolder) ? appFolder : path19.join(originalCwd, appFolder);
71525
71569
  if (!fs13.existsSync(targetDir)) {
71526
71570
  error(colors.red(`Error: Directory not found: ${targetDir}`));
71527
71571
  process17.exit(1);
71528
71572
  }
71529
71573
  }
71530
- const targetDirName = path18.basename(targetDir);
71574
+ const targetDirName = path19.basename(targetDir);
71531
71575
  if (!hasFolderSuffix(targetDirName, "raw_app")) {
71532
71576
  error(colors.red(`Error: The dev command must be run inside a ${getFolderSuffix("raw_app")} folder.
71533
71577
  ` + `Target directory: ${targetDirName}
71534
71578
  ` + `Please navigate to a folder ending with '${getFolderSuffix("raw_app")}' or specify one as argument.`));
71535
71579
  process17.exit(1);
71536
71580
  }
71537
- const rawAppPath = path18.join(targetDir, "raw_app.yaml");
71581
+ const rawAppPath = path19.join(targetDir, "raw_app.yaml");
71538
71582
  if (!fs13.existsSync(rawAppPath)) {
71539
71583
  error(colors.red(`Error: raw_app.yaml not found in ${targetDir}.
71540
71584
  ` + `The dev command requires a ${getFolderSuffix("raw_app")} folder containing a raw_app.yaml file.`));
@@ -71546,8 +71590,8 @@ async function dev(opts, appFolder) {
71546
71590
  let appTempRefs = undefined;
71547
71591
  {
71548
71592
  const wmillYamlPath = getWmillYamlPath();
71549
- const workspaceRoot = wmillYamlPath ? path18.dirname(wmillYamlPath) : originalCwd;
71550
- const relAppFolder = path18.relative(workspaceRoot, targetDir) || ".";
71593
+ const workspaceRoot = wmillYamlPath ? path19.dirname(wmillYamlPath) : originalCwd;
71594
+ const relAppFolder = path19.relative(workspaceRoot, targetDir) || ".";
71551
71595
  const mergedOpts = await mergeConfigWithConfigFile(opts);
71552
71596
  defaultTs = mergedOpts.defaultTs ?? "bun";
71553
71597
  const codebases = await listSyncCodebases(mergedOpts);
@@ -71586,7 +71630,7 @@ async function dev(opts, appFolder) {
71586
71630
  error(colors.red(`Entry point "${entryPoint}" not found. Please specify a valid entry point with --entry.`));
71587
71631
  process17.exit(1);
71588
71632
  }
71589
- const appDir = path18.dirname(entryPoint) || process17.cwd();
71633
+ const appDir = path19.dirname(entryPoint) || process17.cwd();
71590
71634
  await ensureNodeModules(appDir);
71591
71635
  const inferredSchemas = {};
71592
71636
  try {
@@ -71596,18 +71640,18 @@ async function dev(opts, appFolder) {
71596
71640
  }
71597
71641
  const pathRunnableSchemas = {};
71598
71642
  try {
71599
- const initialRunnables = await loadRunnablesFromBackend(path18.join(process17.cwd(), APP_BACKEND_FOLDER), defaultTs);
71643
+ const initialRunnables = await loadRunnablesFromBackend(path19.join(process17.cwd(), APP_BACKEND_FOLDER), defaultTs);
71600
71644
  Object.assign(pathRunnableSchemas, await fetchPathRunnableSchemas(workspaceId, initialRunnables));
71601
71645
  } catch (err) {
71602
71646
  warn(colors.yellow(`Could not fetch schemas for path-based runnables: ${err.message}`));
71603
71647
  }
71604
71648
  await genRunnablesTs(inferredSchemas, pathRunnableSchemas);
71605
- const distDir = path18.join(process17.cwd(), "dist");
71649
+ const distDir = path19.join(process17.cwd(), "dist");
71606
71650
  if (!fs13.existsSync(distDir)) {
71607
71651
  fs13.mkdirSync(distDir);
71608
71652
  }
71609
71653
  const recordingEnabled = opts.recording ?? false;
71610
- const recordingsDir = path18.join(process17.cwd(), RECORDINGS_FOLDER);
71654
+ const recordingsDir = path19.join(process17.cwd(), RECORDINGS_FOLDER);
71611
71655
  const playerBaseUrl = workspace.remote.endsWith("/") ? workspace.remote : `${workspace.remote}/`;
71612
71656
  const playerOrigin = (() => {
71613
71657
  try {
@@ -71675,7 +71719,7 @@ data: reload
71675
71719
  info(colors.blue(`\uD83D\uDC40 Watching for file changes...
71676
71720
  `));
71677
71721
  await ctx.rebuild();
71678
- const runnablesPath = path18.join(process17.cwd(), APP_BACKEND_FOLDER);
71722
+ const runnablesPath = path19.join(process17.cwd(), APP_BACKEND_FOLDER);
71679
71723
  let runnablesWatcher;
71680
71724
  if (fs13.existsSync(runnablesPath)) {
71681
71725
  info(colors.blue(`\uD83D\uDC41️ Watching runnables folder at: ${runnablesPath}
@@ -71687,8 +71731,8 @@ data: reload
71687
71731
  if (!filename)
71688
71732
  return;
71689
71733
  const fileStr = typeof filename === "string" ? filename : filename.toString();
71690
- const changedPath = path18.join(runnablesPath, fileStr);
71691
- const relativePath = path18.relative(process17.cwd(), changedPath);
71734
+ const changedPath = path19.join(runnablesPath, fileStr);
71735
+ const relativePath = path19.relative(process17.cwd(), changedPath);
71692
71736
  const relativeToRunnables = fileStr;
71693
71737
  if (changedPath.endsWith(".lock")) {
71694
71738
  return;
@@ -71729,7 +71773,7 @@ data: reload
71729
71773
  for (let attempt = 0;attempt < 100; attempt++) {
71730
71774
  const file = recordingFileName(now, attempt);
71731
71775
  try {
71732
- await fs13.promises.writeFile(path18.join(recordingsDir, file), body, {
71776
+ await fs13.promises.writeFile(path19.join(recordingsDir, file), body, {
71733
71777
  flag: "wx"
71734
71778
  });
71735
71779
  return file;
@@ -71786,7 +71830,7 @@ data: reload
71786
71830
  sendJson(res, 500, { error: error2.message });
71787
71831
  return;
71788
71832
  }
71789
- info(colors.green(`\uD83C\uDFAC Recording saved to ${path18.join(RECORDINGS_FOLDER, file)}`));
71833
+ info(colors.green(`\uD83C\uDFAC Recording saved to ${path19.join(RECORDINGS_FOLDER, file)}`));
71790
71834
  info(colors.gray(` Replay it at ${playerBaseUrl}replay (open the file, or use ?src=)`));
71791
71835
  sendJson(res, 200, { file });
71792
71836
  });
@@ -71797,7 +71841,7 @@ data: reload
71797
71841
  sendJson(res, 400, { error: "Invalid recording name" });
71798
71842
  return;
71799
71843
  }
71800
- const filePath = path18.join(recordingsDir, file);
71844
+ const filePath = path19.join(recordingsDir, file);
71801
71845
  if (!fs13.existsSync(filePath)) {
71802
71846
  sendJson(res, 404, { error: "Recording not found" });
71803
71847
  return;
@@ -71853,7 +71897,7 @@ data: reload
71853
71897
  return;
71854
71898
  }
71855
71899
  if (url === "/dist/bundle.js" || url === "/bundle.js") {
71856
- const jsPath = path18.join(process17.cwd(), "dist/bundle.js");
71900
+ const jsPath = path19.join(process17.cwd(), "dist/bundle.js");
71857
71901
  if (fs13.existsSync(jsPath)) {
71858
71902
  res.writeHead(200, { "Content-Type": "application/javascript" });
71859
71903
  res.end(fs13.readFileSync(jsPath));
@@ -71864,7 +71908,7 @@ data: reload
71864
71908
  return;
71865
71909
  }
71866
71910
  if (url === "/dist/bundle.css" || url === "/bundle.css") {
71867
- const cssPath = path18.join(process17.cwd(), "dist/bundle.css");
71911
+ const cssPath = path19.join(process17.cwd(), "dist/bundle.css");
71868
71912
  if (fs13.existsSync(cssPath)) {
71869
71913
  res.writeHead(200, { "Content-Type": "text/css" });
71870
71914
  res.end(fs13.readFileSync(cssPath));
@@ -71875,7 +71919,7 @@ data: reload
71875
71919
  return;
71876
71920
  }
71877
71921
  if (url === "/dist/bundle.js.map" || url === "/bundle.js.map") {
71878
- const mapPath = path18.join(process17.cwd(), "dist/bundle.js.map");
71922
+ const mapPath = path19.join(process17.cwd(), "dist/bundle.js.map");
71879
71923
  if (fs13.existsSync(mapPath)) {
71880
71924
  res.writeHead(200, { "Content-Type": "application/json" });
71881
71925
  res.end(fs13.readFileSync(mapPath));
@@ -71886,7 +71930,7 @@ data: reload
71886
71930
  return;
71887
71931
  }
71888
71932
  if (url === "/dist/bundle.css.map" || url === "/bundle.css.map") {
71889
- const mapPath = path18.join(process17.cwd(), "dist/bundle.css.map");
71933
+ const mapPath = path19.join(process17.cwd(), "dist/bundle.css.map");
71890
71934
  if (fs13.existsSync(mapPath)) {
71891
71935
  res.writeHead(200, { "Content-Type": "application/json" });
71892
71936
  res.end(fs13.readFileSync(mapPath));
@@ -71900,12 +71944,12 @@ data: reload
71900
71944
  res.end(createHTML("/dist/bundle.js", "/dist/bundle.css"));
71901
71945
  });
71902
71946
  const wss = new import_websocket_server.default({ server });
71903
- const sqlToApplyPath = path18.join(process17.cwd(), "sql_to_apply");
71947
+ const sqlToApplyPath = path19.join(process17.cwd(), "sql_to_apply");
71904
71948
  const sqlFileQueue = [];
71905
71949
  let currentSqlFile = null;
71906
71950
  async function getDatatableConfig() {
71907
71951
  try {
71908
- const rawApp = await yamlParseFile(path18.join(process17.cwd(), "raw_app.yaml"));
71952
+ const rawApp = await yamlParseFile(path19.join(process17.cwd(), "raw_app.yaml"));
71909
71953
  return rawApp?.data?.datatable;
71910
71954
  } catch {
71911
71955
  return;
@@ -71942,12 +71986,12 @@ data: reload
71942
71986
  }
71943
71987
  const filePath = sqlFileQueue.shift();
71944
71988
  if (!fs13.existsSync(filePath)) {
71945
- info(colors.gray(`File no longer exists: ${path18.basename(filePath)}`));
71989
+ info(colors.gray(`File no longer exists: ${path19.basename(filePath)}`));
71946
71990
  await processNextSqlFile();
71947
71991
  return;
71948
71992
  }
71949
71993
  currentSqlFile = filePath;
71950
- const fileName = path18.basename(filePath);
71994
+ const fileName = path19.basename(filePath);
71951
71995
  try {
71952
71996
  const sqlContent = await readTextFile(filePath);
71953
71997
  if (!sqlContent.trim()) {
@@ -71969,9 +72013,9 @@ data: reload
71969
72013
  if (deleteFile && fs13.existsSync(filePath)) {
71970
72014
  try {
71971
72015
  fs13.unlinkSync(filePath);
71972
- info(colors.green(`✓ Deleted: ${path18.basename(filePath)}`));
72016
+ info(colors.green(`✓ Deleted: ${path19.basename(filePath)}`));
71973
72017
  } catch (error2) {
71974
- error(colors.red(`Failed to delete ${path18.basename(filePath)}: ${error2.message}`));
72018
+ error(colors.red(`Failed to delete ${path19.basename(filePath)}: ${error2.message}`));
71975
72019
  }
71976
72020
  }
71977
72021
  currentSqlFile = null;
@@ -71983,7 +72027,7 @@ data: reload
71983
72027
  try {
71984
72028
  const sqlContent = await readTextFile(currentSqlFile);
71985
72029
  const datatable = await getDatatableConfig();
71986
- const fileName = path18.basename(currentSqlFile);
72030
+ const fileName = path19.basename(currentSqlFile);
71987
72031
  ws.send(JSON.stringify({
71988
72032
  type: "sqlMigration",
71989
72033
  fileName,
@@ -71997,7 +72041,7 @@ data: reload
71997
72041
  const sqlFiles = entries.filter((entry) => entry.endsWith(".sql"));
71998
72042
  if (sqlFiles.length > 0 && sqlFileQueue.length === 0) {
71999
72043
  for (const sqlFile of sqlFiles.sort()) {
72000
- queueSqlFile(path18.join(sqlToApplyPath, sqlFile));
72044
+ queueSqlFile(path19.join(sqlToApplyPath, sqlFile));
72001
72045
  }
72002
72046
  await processNextSqlFile();
72003
72047
  }
@@ -72176,7 +72220,7 @@ data: reload
72176
72220
  }
72177
72221
  info(colors.blue(`\uD83D\uDD0D Found ${sqlFiles.length} SQL file(s) in sql_to_apply/`));
72178
72222
  for (const sqlFile of sqlFiles) {
72179
- const filePath = path18.join(sqlToApplyPath, sqlFile);
72223
+ const filePath = path19.join(sqlToApplyPath, sqlFile);
72180
72224
  queueSqlFile(filePath);
72181
72225
  }
72182
72226
  await processNextSqlFile();
@@ -72194,11 +72238,11 @@ data: reload
72194
72238
  if (!filename)
72195
72239
  return;
72196
72240
  const fileStr = typeof filename === "string" ? filename : filename.toString();
72197
- const changedPath = path18.join(sqlToApplyPath, fileStr);
72241
+ const changedPath = path19.join(sqlToApplyPath, fileStr);
72198
72242
  if (!changedPath.endsWith(".sql")) {
72199
72243
  return;
72200
72244
  }
72201
- const fileName = path18.basename(changedPath);
72245
+ const fileName = path19.basename(changedPath);
72202
72246
  if (sqlDebounceTimeouts[changedPath]) {
72203
72247
  clearTimeout(sqlDebounceTimeouts[changedPath]);
72204
72248
  }
@@ -72260,11 +72304,11 @@ data: reload
72260
72304
  async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides = {}) {
72261
72305
  info(colors.blue("\uD83D\uDD04 Generating wmill.d.ts..."));
72262
72306
  const localPath = process17.cwd();
72263
- const backendPath = path18.join(localPath, APP_BACKEND_FOLDER);
72307
+ const backendPath = path19.join(localPath, APP_BACKEND_FOLDER);
72264
72308
  let runnables = await loadRunnablesFromBackend(backendPath, defaultTs);
72265
72309
  if (Object.keys(runnables).length === 0) {
72266
72310
  try {
72267
- const rawApp = await yamlParseFile(path18.join(localPath, "raw_app.yaml"));
72311
+ const rawApp = await yamlParseFile(path19.join(localPath, "raw_app.yaml"));
72268
72312
  runnables = rawApp?.["runnables"] ?? {};
72269
72313
  } catch {
72270
72314
  runnables = {};
@@ -72272,7 +72316,7 @@ async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides =
72272
72316
  }
72273
72317
  try {
72274
72318
  const newWmillTs = buildWmillTs(runnables, inlineSchemaOverrides, pathSchemaOverrides);
72275
- writeFileSync6(path18.join(process17.cwd(), "wmill.d.ts"), newWmillTs);
72319
+ writeFileSync6(path19.join(process17.cwd(), "wmill.d.ts"), newWmillTs);
72276
72320
  } catch (error2) {
72277
72321
  error(colors.red(`Failed to generate wmill.d.ts: ${error2.message}`));
72278
72322
  }
@@ -72342,10 +72386,10 @@ function convertRunnablesToApiFormat(runnables) {
72342
72386
  async function loadRunnables() {
72343
72387
  try {
72344
72388
  const localPath = process17.cwd();
72345
- const backendPath = path18.join(localPath, APP_BACKEND_FOLDER);
72389
+ const backendPath = path19.join(localPath, APP_BACKEND_FOLDER);
72346
72390
  let runnables = await loadRunnablesFromBackend(backendPath, defaultTs);
72347
72391
  if (Object.keys(runnables).length === 0) {
72348
- const rawApp = await yamlParseFile(path18.join(localPath, "raw_app.yaml"));
72392
+ const rawApp = await yamlParseFile(path19.join(localPath, "raw_app.yaml"));
72349
72393
  runnables = rawApp?.runnables ?? {};
72350
72394
  }
72351
72395
  convertRunnablesToApiFormat(runnables);
@@ -72850,7 +72894,7 @@ var init_dev = __esm(async () => {
72850
72894
 
72851
72895
  // src/commands/app/lint.ts
72852
72896
  import * as fs14 from "node:fs";
72853
- import * as path19 from "node:path";
72897
+ import * as path20 from "node:path";
72854
72898
  import process18 from "node:process";
72855
72899
  function validateRawAppYaml(appData) {
72856
72900
  const errors = [];
@@ -72865,7 +72909,7 @@ function validateRawAppYaml(appData) {
72865
72909
  async function validateRunnables(appDir, appData) {
72866
72910
  const errors = [];
72867
72911
  const warnings = [];
72868
- const backendPath = path19.join(appDir, APP_BACKEND_FOLDER);
72912
+ const backendPath = path20.join(appDir, APP_BACKEND_FOLDER);
72869
72913
  const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
72870
72914
  const hasBackendRunnables = Object.keys(runnablesFromBackend).length > 0;
72871
72915
  const hasYamlRunnables = appData.runnables && typeof appData.runnables === "object" && !Array.isArray(appData.runnables) && Object.keys(appData.runnables).length > 0;
@@ -72888,7 +72932,7 @@ async function validateBuild(appDir) {
72888
72932
  info(colors.blue("\uD83D\uDD28 Testing build..."));
72889
72933
  const frameworks = detectFrameworks(appDir);
72890
72934
  const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
72891
- const entryPoint = path19.join(appDir, entryFile);
72935
+ const entryPoint = path20.join(appDir, entryFile);
72892
72936
  await createBundle({
72893
72937
  entryPoint,
72894
72938
  production: true,
@@ -72903,12 +72947,12 @@ async function validateBuild(appDir) {
72903
72947
  async function lintRawApp(appDir, opts) {
72904
72948
  const errors = [];
72905
72949
  const warnings = [];
72906
- const currentDirName = path19.basename(appDir);
72950
+ const currentDirName = path20.basename(appDir);
72907
72951
  if (!hasFolderSuffix(currentDirName, "raw_app")) {
72908
72952
  errors.push(`Not a raw app folder: '${currentDirName}' does not end with '${getFolderSuffix("raw_app")}'`);
72909
72953
  return { valid: false, errors, warnings };
72910
72954
  }
72911
- const rawAppPath = path19.join(appDir, "raw_app.yaml");
72955
+ const rawAppPath = path20.join(appDir, "raw_app.yaml");
72912
72956
  if (!fs14.existsSync(rawAppPath)) {
72913
72957
  errors.push("Missing raw_app.yaml file");
72914
72958
  return { valid: false, errors, warnings };
@@ -72992,30 +73036,30 @@ var init_lint2 = __esm(async () => {
72992
73036
 
72993
73037
  // src/commands/app/bundle_command.ts
72994
73038
  import * as fs15 from "node:fs";
72995
- import * as path20 from "node:path";
73039
+ import * as path21 from "node:path";
72996
73040
  import process19 from "node:process";
72997
73041
  function entryPointFor(appDir) {
72998
73042
  const frameworks = detectFrameworks(appDir);
72999
73043
  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)));
73044
+ const entry = candidates.find((c) => fs15.existsSync(path21.join(appDir, c)));
73001
73045
  if (!entry) {
73002
73046
  throw new Error(`No entry point in ${appDir}: expected one of ${candidates.join(", ")}`);
73003
73047
  }
73004
- return path20.join(appDir, entry);
73048
+ return path21.join(appDir, entry);
73005
73049
  }
73006
73050
  async function bundleApp(opts, appFolder) {
73007
- const appDir = path20.resolve(appFolder ?? process19.cwd());
73051
+ const appDir = path21.resolve(appFolder ?? process19.cwd());
73008
73052
  const { js, css } = await createBundle({
73009
73053
  entryPoint: entryPointFor(appDir),
73010
73054
  production: true,
73011
73055
  minify: opts.minify ?? true,
73012
- sharedUiDir: path20.join(process19.cwd(), "ui"),
73056
+ sharedUiDir: path21.join(process19.cwd(), "ui"),
73013
73057
  outDir: `.wmill-bundle-${process19.pid}`
73014
73058
  });
73015
- const outDir = path20.resolve(opts.out ?? path20.join(appDir, "dist"));
73059
+ const outDir = path21.resolve(opts.out ?? path21.join(appDir, "dist"));
73016
73060
  fs15.mkdirSync(outDir, { recursive: true });
73017
- fs15.writeFileSync(path20.join(outDir, "bundle.js"), js);
73018
- fs15.writeFileSync(path20.join(outDir, "bundle.css"), css);
73061
+ fs15.writeFileSync(path21.join(outDir, "bundle.js"), js);
73062
+ fs15.writeFileSync(path21.join(outDir, "bundle.css"), css);
73019
73063
  info(colors.green(`Wrote bundle.js and bundle.css to ${outDir}`));
73020
73064
  }
73021
73065
  var command12, bundle_command_default;
@@ -73029,8 +73073,8 @@ var init_bundle_command = __esm(async () => {
73029
73073
  });
73030
73074
 
73031
73075
  // 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";
73076
+ import { stat as stat10, writeFile as writeFile11, mkdir as mkdir9, rm as rm5 } from "node:fs/promises";
73077
+ import path22 from "node:path";
73034
73078
  import { execSync as execSync5, exec, execFile as execFile6 } from "node:child_process";
73035
73079
  function validateAppPath(appPath) {
73036
73080
  if (!appPath.startsWith("u/") && !appPath.startsWith("f/")) {
@@ -73286,10 +73330,10 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
73286
73330
  }
73287
73331
  await loadNonDottedPathsSetting();
73288
73332
  const folderName = buildFolderPath(appPath, "raw_app");
73289
- const appDir = path21.join(process.cwd(), folderName);
73333
+ const appDir = path22.join(process.cwd(), folderName);
73290
73334
  let dirExists = false;
73291
73335
  try {
73292
- await stat9(appDir);
73336
+ await stat10(appDir);
73293
73337
  dirExists = true;
73294
73338
  } catch {}
73295
73339
  if (dirExists) {
@@ -73311,17 +73355,17 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
73311
73355
  await rm5(appDir, { recursive: true, force: true });
73312
73356
  }
73313
73357
  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 });
73358
+ await mkdir9(path22.join(appDir, "backend"), { recursive: true });
73359
+ await mkdir9(path22.join(appDir, "sql_to_apply"), { recursive: true });
73316
73360
  const rawAppConfig = {
73317
73361
  summary
73318
73362
  };
73319
73363
  if (dataConfig.datatable) {
73320
73364
  rawAppConfig.data = dataConfig;
73321
73365
  }
73322
- await writeFile11(path21.join(appDir, "raw_app.yaml"), import_yaml25.stringify(rawAppConfig, yamlOptions), "utf-8");
73366
+ await writeFile11(path22.join(appDir, "raw_app.yaml"), import_yaml25.stringify(rawAppConfig, yamlOptions), "utf-8");
73323
73367
  for (const [filePath, content] of Object.entries(template.files)) {
73324
- const fullPath = path21.join(appDir, filePath.slice(1));
73368
+ const fullPath = path22.join(appDir, filePath.slice(1));
73325
73369
  await writeFile11(fullPath, content.trim() + `
73326
73370
  `, "utf-8");
73327
73371
  }
@@ -73331,21 +73375,21 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
73331
73375
  schema: dataConfig.schema
73332
73376
  } : undefined;
73333
73377
  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
73378
+ await writeFile11(path22.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
73379
+ await writeFile11(path22.join(appDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
73336
73380
  `, "utf-8");
73337
73381
  const datatablesContent = generateDatatablesDocumentation(dataForDocs);
73338
- await writeFile11(path21.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
73382
+ await writeFile11(path22.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
73339
73383
  const exampleRunnable = {
73340
73384
  type: "inline",
73341
73385
  path: undefined
73342
73386
  };
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> {
73387
+ await writeFile11(path22.join(appDir, "backend", "a.yaml"), import_yaml25.stringify(exampleRunnable, yamlOptions), "utf-8");
73388
+ await writeFile11(path22.join(appDir, "backend", "a.ts"), `export async function main(x: number): Promise<string> {
73345
73389
  return \`Hello from backend! x = \${x}\`;
73346
73390
  }
73347
73391
  `, "utf-8");
73348
- await writeFile11(path21.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
73392
+ await writeFile11(path22.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
73349
73393
 
73350
73394
  This folder is for SQL migration files that will be applied to datatables during development.
73351
73395
 
@@ -73373,7 +73417,7 @@ This folder is for SQL migration files that will be applied to datatables during
73373
73417
  - Use idempotent SQL (\`CREATE TABLE IF NOT EXISTS\`, etc.)
73374
73418
  `);
73375
73419
  if (createSchemaSQL && schemaName) {
73376
- await writeFile11(path21.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
73420
+ await writeFile11(path22.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
73377
73421
  }
73378
73422
  info("");
73379
73423
  info(colors.bold.green(`App created successfully at ${folderName}/`));
@@ -73429,10 +73473,10 @@ This folder is for SQL migration files that will be applied to datatables during
73429
73473
  });
73430
73474
  if (openInDesktop) {
73431
73475
  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)) {
73476
+ const absAppDir = path22.resolve(appDir);
73477
+ const claudeDir = path22.join(absAppDir, ".claude");
73478
+ const launchPath = path22.join(claudeDir, "launch.json");
73479
+ if (!await stat10(launchPath).catch(() => null)) {
73436
73480
  const launchJson = JSON.stringify({
73437
73481
  version: "0.0.1",
73438
73482
  configurations: [{
@@ -73446,7 +73490,7 @@ This folder is for SQL migration files that will be applied to datatables during
73446
73490
  `;
73447
73491
  await mkdir9(claudeDir, { recursive: true });
73448
73492
  await writeFile11(launchPath, launchJson, "utf-8");
73449
- info(colors.gray(`Seeded ${path21.relative(process.cwd(), launchPath)}`));
73493
+ info(colors.gray(`Seeded ${path22.relative(process.cwd(), launchPath)}`));
73450
73494
  }
73451
73495
  const sessionId = crypto.randomUUID();
73452
73496
  const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
@@ -73652,7 +73696,7 @@ var init_new = __esm(async () => {
73652
73696
 
73653
73697
  // src/commands/app/app.ts
73654
73698
  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";
73699
+ import { stat as stat11 } from "node:fs/promises";
73656
73700
  function respecializeFields(fields) {
73657
73701
  Object.entries(fields).forEach(([k, v]) => {
73658
73702
  if (typeof v == "object") {
@@ -73892,12 +73936,12 @@ async function push5(opts, filePath, remotePath) {
73892
73936
  let hasRawAppYaml = false;
73893
73937
  let hasAppYaml = false;
73894
73938
  try {
73895
- await stat10(normalizedPath + SEP14 + "raw_app.yaml");
73939
+ await stat11(normalizedPath + SEP14 + "raw_app.yaml");
73896
73940
  hasRawAppYaml = true;
73897
73941
  } catch {}
73898
73942
  if (!hasRawAppYaml) {
73899
73943
  try {
73900
- await stat10(normalizedPath + SEP14 + "app.yaml");
73944
+ await stat11(normalizedPath + SEP14 + "app.yaml");
73901
73945
  hasAppYaml = true;
73902
73946
  } catch {}
73903
73947
  }
@@ -74008,7 +74052,7 @@ var init_app = __esm(async () => {
74008
74052
  });
74009
74053
 
74010
74054
  // src/commands/folder/folder.ts
74011
- import { stat as stat11, readdir as readdir8, writeFile as writeFile12, mkdir as mkdir10 } from "node:fs/promises";
74055
+ import { stat as stat12, readdir as readdir8, writeFile as writeFile12, mkdir as mkdir10 } from "node:fs/promises";
74012
74056
  import { sep as SEP15 } from "node:path";
74013
74057
  async function list7(opts) {
74014
74058
  if (opts.json)
@@ -74032,7 +74076,7 @@ async function newFolder(opts, name) {
74032
74076
  const dirPath = `f${SEP15}${name}`;
74033
74077
  const filePath = `${dirPath}${SEP15}folder.meta.yaml`;
74034
74078
  try {
74035
- await stat11(filePath);
74079
+ await stat12(filePath);
74036
74080
  throw new Error("File already exists: " + filePath);
74037
74081
  } catch (e) {
74038
74082
  if (e.message?.startsWith("File already exists"))
@@ -74120,7 +74164,7 @@ async function push6(opts, name) {
74120
74164
  await requireLogin(opts);
74121
74165
  const metaPath = `f${SEP15}${name}${SEP15}folder.meta.yaml`;
74122
74166
  try {
74123
- await stat11(metaPath);
74167
+ await stat12(metaPath);
74124
74168
  } catch {
74125
74169
  throw new Error(`Could not find ${metaPath}. Does the folder exist locally?`);
74126
74170
  }
@@ -74131,7 +74175,7 @@ async function push6(opts, name) {
74131
74175
  async function addMissing(opts) {
74132
74176
  const fDir = `f`;
74133
74177
  try {
74134
- await stat11(fDir);
74178
+ await stat12(fDir);
74135
74179
  } catch {
74136
74180
  info("No 'f/' directory found. Nothing to do.");
74137
74181
  return;
@@ -74143,7 +74187,7 @@ async function addMissing(opts) {
74143
74187
  continue;
74144
74188
  const metaPath = `${fDir}${SEP15}${entry.name}${SEP15}folder.meta.yaml`;
74145
74189
  try {
74146
- await stat11(metaPath);
74190
+ await stat12(metaPath);
74147
74191
  } catch {
74148
74192
  missing.push(entry.name);
74149
74193
  }
@@ -74234,7 +74278,7 @@ var init_folder = __esm(async () => {
74234
74278
  });
74235
74279
 
74236
74280
  // src/commands/variable/variable.ts
74237
- import { mkdir as mkdir11, stat as stat12, writeFile as writeFile13 } from "node:fs/promises";
74281
+ import { mkdir as mkdir11, stat as stat13, writeFile as writeFile13 } from "node:fs/promises";
74238
74282
  import { dirname as dirname17 } from "node:path";
74239
74283
  import { sep as SEP16 } from "node:path";
74240
74284
  async function list8(opts) {
@@ -74262,7 +74306,7 @@ async function newVariable(opts, path) {
74262
74306
  }
74263
74307
  const filePath = path + ".variable.yaml";
74264
74308
  try {
74265
- await stat12(filePath);
74309
+ await stat13(filePath);
74266
74310
  throw new Error("File already exists: " + filePath);
74267
74311
  } catch (e) {
74268
74312
  if (e.message?.startsWith("File already exists"))
@@ -74369,7 +74413,7 @@ async function push7(opts, filePath, remotePath) {
74369
74413
  if (!validatePath(remotePath)) {
74370
74414
  return;
74371
74415
  }
74372
- const fstat = await stat12(filePath);
74416
+ const fstat = await stat13(filePath);
74373
74417
  if (!fstat.isFile()) {
74374
74418
  throw new Error("file path must refer to a file.");
74375
74419
  }
@@ -74460,7 +74504,7 @@ var init_variable = __esm(async () => {
74460
74504
  });
74461
74505
 
74462
74506
  // src/commands/schedule/schedule.ts
74463
- import { mkdir as mkdir12, stat as stat13, writeFile as writeFile14 } from "node:fs/promises";
74507
+ import { mkdir as mkdir12, stat as stat14, writeFile as writeFile14 } from "node:fs/promises";
74464
74508
  import { dirname as dirname18 } from "node:path";
74465
74509
  import { sep as SEP17, resolve as pathResolve2 } from "node:path";
74466
74510
  async function list9(opts) {
@@ -74483,7 +74527,7 @@ async function newSchedule(opts, path) {
74483
74527
  }
74484
74528
  const filePath = path + ".schedule.yaml";
74485
74529
  try {
74486
- await stat13(filePath);
74530
+ await stat14(filePath);
74487
74531
  throw new Error("File already exists: " + filePath);
74488
74532
  } catch (e) {
74489
74533
  if (e.message?.startsWith("File already exists"))
@@ -74662,7 +74706,7 @@ async function push8(opts, filePath, remotePath) {
74662
74706
  if (!validatePath(remotePath)) {
74663
74707
  return;
74664
74708
  }
74665
- const fstat = await stat13(filePath);
74709
+ const fstat = await stat14(filePath);
74666
74710
  if (!fstat.isFile()) {
74667
74711
  throw new Error("file path must refer to a file.");
74668
74712
  }
@@ -75054,7 +75098,16 @@ async function pushWorkspaceSettings(workspace, _path, settings, localSettings)
75054
75098
  }
75055
75099
  });
75056
75100
  }
75057
- if (!deepEqual(localSettings.operator_settings, settings.operator_settings)) {
75101
+ const localOperatorSettings = localSettings.operator_settings && {
75102
+ ...localSettings.operator_settings
75103
+ };
75104
+ for (const key of ["manage_schedules", "manage_triggers"]) {
75105
+ const remote = settings.operator_settings?.[key];
75106
+ if (localOperatorSettings && localOperatorSettings[key] === undefined && remote !== undefined) {
75107
+ localOperatorSettings[key] = remote;
75108
+ }
75109
+ }
75110
+ if (localOperatorSettings && !deepEqual(localOperatorSettings, settings.operator_settings)) {
75058
75111
  debug(`Updating operator settings...`);
75059
75112
  await updateOperatorSettings({
75060
75113
  workspace,
@@ -75316,9 +75369,9 @@ var init_settings = __esm(async () => {
75316
75369
  });
75317
75370
 
75318
75371
  // 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";
75372
+ import { writeFile as writeFile16, readdir as readdir9, mkdir as mkdir13, rm as rm6, stat as stat15 } from "node:fs/promises";
75320
75373
  import { appendFile } from "node:fs/promises";
75321
- import * as path22 from "node:path";
75374
+ import * as path23 from "node:path";
75322
75375
  async function allInstances() {
75323
75376
  try {
75324
75377
  const file = await getInstancesConfigFilePath();
@@ -75510,7 +75563,7 @@ async function instancePull(opts) {
75510
75563
  if (confirm) {
75511
75564
  if (uChanges > 0) {
75512
75565
  if (opts.folderPerInstance && opts.prefixSettings) {
75513
- await mkdir13(path22.join(rootDir, opts.prefix), {
75566
+ await mkdir13(path23.join(rootDir, opts.prefix), {
75514
75567
  recursive: true
75515
75568
  });
75516
75569
  }
@@ -75544,10 +75597,10 @@ Pulling all workspaces`);
75544
75597
  info(`
75545
75598
  Pulling workspace ` + remoteWorkspace.id);
75546
75599
  const workspaceName = opts?.folderPerInstance ? instance.prefix + "/" + remoteWorkspace.id : instance.prefix + "_" + remoteWorkspace.id;
75547
- await mkdir13(path22.join(rootDir, workspaceName), {
75600
+ await mkdir13(path23.join(rootDir, workspaceName), {
75548
75601
  recursive: true
75549
75602
  });
75550
- process.chdir(path22.join(rootDir, workspaceName));
75603
+ process.chdir(path23.join(rootDir, workspaceName));
75551
75604
  await addWorkspace({
75552
75605
  remote: instance.remote,
75553
75606
  name: workspaceName,
@@ -75582,7 +75635,7 @@ Pulling workspace ` + remoteWorkspace.id);
75582
75635
  if (confirmDelete) {
75583
75636
  for (const workspace of localWorkspacesToDelete) {
75584
75637
  await removeWorkspace(workspace.id, false, {});
75585
- await rm6(path22.join(rootDir, workspace.dir), {
75638
+ await rm6(path23.join(rootDir, workspace.dir), {
75586
75639
  recursive: true
75587
75640
  });
75588
75641
  }
@@ -75671,12 +75724,12 @@ Pushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
75671
75724
  info(`
75672
75725
  Pushing workspace ` + localWorkspace.id);
75673
75726
  try {
75674
- process.chdir(path22.join(rootDir, localWorkspace.dir));
75727
+ process.chdir(path23.join(rootDir, localWorkspace.dir));
75675
75728
  } catch (_) {
75676
75729
  throw new Error("Workspace folder not found, are you in the right directory?");
75677
75730
  }
75678
75731
  try {
75679
- const workspaceSettings = await yamlParseFile(path22.join(process.cwd(), "settings.yaml"));
75732
+ const workspaceSettings = await yamlParseFile(path23.join(process.cwd(), "settings.yaml"));
75680
75733
  await add({
75681
75734
  token: instance.token,
75682
75735
  workspace: undefined,
@@ -75727,7 +75780,7 @@ Pushing workspace ` + localWorkspace.id);
75727
75780
  }
75728
75781
  async function getLocalWorkspaces(rootDir, localPrefix, folderPerInstance) {
75729
75782
  const localWorkspaces = [];
75730
- if (!await stat14(localPrefix).catch(() => null)) {
75783
+ if (!await stat15(localPrefix).catch(() => null)) {
75731
75784
  await mkdir13(localPrefix);
75732
75785
  }
75733
75786
  if (folderPerInstance) {
@@ -76308,7 +76361,7 @@ var init_dependencies = __esm(async () => {
76308
76361
  });
76309
76362
 
76310
76363
  // src/commands/trigger/trigger.ts
76311
- import { mkdir as mkdir14, stat as stat15, writeFile as writeFile18 } from "node:fs/promises";
76364
+ import { mkdir as mkdir14, stat as stat16, writeFile as writeFile18 } from "node:fs/promises";
76312
76365
  import { dirname as dirname19 } from "node:path";
76313
76366
  import { sep as SEP18, resolve as pathResolve3 } from "node:path";
76314
76367
  async function getTrigger(triggerType, workspace, path) {
@@ -76504,7 +76557,7 @@ async function newTrigger(opts, path) {
76504
76557
  const kind = opts.kind;
76505
76558
  const filePath = `${path}.${kind}_trigger.yaml`;
76506
76559
  try {
76507
- await stat15(filePath);
76560
+ await stat16(filePath);
76508
76561
  throw new Error("File already exists: " + filePath);
76509
76562
  } catch (e) {
76510
76563
  if (e.message?.startsWith("File already exists"))
@@ -76664,7 +76717,7 @@ async function push10(opts, filePath, remotePath) {
76664
76717
  if (!validatePath(remotePath)) {
76665
76718
  return;
76666
76719
  }
76667
- const fstat = await stat15(filePath);
76720
+ const fstat = await stat16(filePath);
76668
76721
  if (!fstat.isFile()) {
76669
76722
  throw new Error("file path must refer to a file.");
76670
76723
  }
@@ -76818,7 +76871,7 @@ var init_trigger = __esm(async () => {
76818
76871
  });
76819
76872
 
76820
76873
  // src/types.ts
76821
- import * as path23 from "node:path";
76874
+ import * as path24 from "node:path";
76822
76875
  import { sep as SEP19 } from "node:path";
76823
76876
  function isSuperset(subset, superset) {
76824
76877
  return Object.keys(subset).every((key) => {
@@ -77027,7 +77080,7 @@ function getTypeStrFromPath(p) {
77027
77080
  if (isFileResource(p) || isFilesetResource(p)) {
77028
77081
  return "resource";
77029
77082
  }
77030
- const parsed = path23.parse(p);
77083
+ const parsed = path24.parse(p);
77031
77084
  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
77085
  return "script";
77033
77086
  }
@@ -77051,7 +77104,7 @@ function getTypeStrFromPath(p) {
77051
77104
  }
77052
77105
  }
77053
77106
  function removeType(str, type) {
77054
- const normalizedStr = path23.normalize(str).replaceAll(SEP19, "/");
77107
+ const normalizedStr = path24.normalize(str).replaceAll(SEP19, "/");
77055
77108
  if (normalizedStr.endsWith("." + type + ".yaml") || normalizedStr.endsWith("." + type + ".json")) {
77056
77109
  return normalizedStr.slice(0, normalizedStr.length - type.length - 6);
77057
77110
  }
@@ -77061,7 +77114,7 @@ function removeType(str, type) {
77061
77114
  return normalizedStr;
77062
77115
  }
77063
77116
  function extractNativeTriggerInfo(p) {
77064
- const normalizedPath = path23.normalize(p).replaceAll(SEP19, "/");
77117
+ const normalizedPath = path24.normalize(p).replaceAll(SEP19, "/");
77065
77118
  const withoutExt = normalizedPath.replace(/\.(json|yaml)$/, "");
77066
77119
  const match = withoutExt.match(/^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/);
77067
77120
  if (!match) {
@@ -77075,8 +77128,8 @@ function extractNativeTriggerInfo(p) {
77075
77128
  };
77076
77129
  }
77077
77130
  function removePathPrefix(str, prefix) {
77078
- const normalizedStr = path23.normalize(str).replaceAll(SEP19, "/");
77079
- const normalizedPrefix = path23.normalize(prefix).replaceAll(SEP19, "/");
77131
+ const normalizedStr = path24.normalize(str).replaceAll(SEP19, "/");
77132
+ const normalizedPrefix = path24.normalize(prefix).replaceAll(SEP19, "/");
77080
77133
  if (normalizedStr === normalizedPrefix) {
77081
77134
  return "";
77082
77135
  }
@@ -77148,7 +77201,7 @@ function defaultFlowDefinition() {
77148
77201
 
77149
77202
  // src/utils/local_path_scripts.ts
77150
77203
  import { execFileSync as execFileSync2 } from "node:child_process";
77151
- import { stat as stat16 } from "node:fs/promises";
77204
+ import { stat as stat17 } from "node:fs/promises";
77152
77205
  async function readOptionalLock(scriptPath) {
77153
77206
  try {
77154
77207
  return await readTextFile(scriptPath + ".script.lock");
@@ -77212,7 +77265,7 @@ async function resolvePreviewLocalScriptState(scriptPath, opts) {
77212
77265
  const filePath = scriptPath + ext;
77213
77266
  let fileStat;
77214
77267
  try {
77215
- fileStat = await stat16(filePath);
77268
+ fileStat = await stat17(filePath);
77216
77269
  } catch {
77217
77270
  continue;
77218
77271
  }
@@ -88931,7 +88984,7 @@ var init_freshness_gate = __esm(() => {
88931
88984
 
88932
88985
  // src/guidance/freshness.ts
88933
88986
  import { createHash } from "node:crypto";
88934
- import { stat as stat18 } from "node:fs/promises";
88987
+ import { stat as stat19 } from "node:fs/promises";
88935
88988
  function buildPromptsHashMarker(hash) {
88936
88989
  return `${PROMPTS_HASH_MARKER_PREFIX}${hash} -->`;
88937
88990
  }
@@ -88982,10 +89035,10 @@ async function warnIfPromptsStale(opts) {
88982
89035
  const cwd = opts?.cwd ?? process.cwd();
88983
89036
  let fileName = AGENTS_WMILL_FILENAME;
88984
89037
  let path = `${cwd}/${fileName}`;
88985
- if (!await stat18(path).catch(() => null)) {
89038
+ if (!await stat19(path).catch(() => null)) {
88986
89039
  fileName = LEGACY_AGENTS_CLI_FILENAME;
88987
89040
  path = `${cwd}/${fileName}`;
88988
- if (!await stat18(path).catch(() => null)) {
89041
+ if (!await stat19(path).catch(() => null)) {
88989
89042
  return;
88990
89043
  }
88991
89044
  }
@@ -89032,7 +89085,7 @@ var init_freshness = __esm(async () => {
89032
89085
  import { execSync as execSync6 } from "node:child_process";
89033
89086
  import { createHash as createHash2 } from "node:crypto";
89034
89087
  import { existsSync as existsSync20, readFileSync as readFileSync5, writeFileSync as writeFileSync9 } from "node:fs";
89035
- import path25 from "node:path";
89088
+ import path26 from "node:path";
89036
89089
  import process25 from "node:process";
89037
89090
  function buildManagedTsconfig() {
89038
89091
  const paths = {};
@@ -89099,7 +89152,7 @@ async function refreshManagedTsconfig(defaultTs, mode) {
89099
89152
  }
89100
89153
  const header = MANAGED_NOTICE + TSCONFIG_HASH_PREFIX + currentTsconfigHash() + `
89101
89154
  `;
89102
- writeFileSync9(path25.join(process25.cwd(), MANAGED_TSCONFIG), header + JSON.stringify(managed, null, 2) + `
89155
+ writeFileSync9(path26.join(process25.cwd(), MANAGED_TSCONFIG), header + JSON.stringify(managed, null, 2) + `
89103
89156
  `);
89104
89157
  info(colors.green(`Refreshed ${MANAGED_TSCONFIG}`));
89105
89158
  await ensureUserReferencesManaged({
@@ -89135,7 +89188,7 @@ async function refreshManagedDenoImportMap(mode) {
89135
89188
  for (const dir of WORKSPACE_IMPORT_DIRS) {
89136
89189
  imports[`/${dir}/`] = `./${dir}/`;
89137
89190
  }
89138
- writeFileSync9(path25.join(process25.cwd(), MANAGED_IMPORT_MAP), JSON.stringify({ imports }, null, 2) + `
89191
+ writeFileSync9(path26.join(process25.cwd(), MANAGED_IMPORT_MAP), JSON.stringify({ imports }, null, 2) + `
89139
89192
  `);
89140
89193
  info(colors.green(`Refreshed ${MANAGED_IMPORT_MAP}`));
89141
89194
  await ensureUserReferencesManaged({
@@ -89158,15 +89211,15 @@ async function refreshManagedDenoImportMap(mode) {
89158
89211
  });
89159
89212
  }
89160
89213
  async function ensureUserReferencesManaged(opts) {
89161
- const existing = [opts.file, ...opts.altFiles ?? []].map((f) => path25.join(process25.cwd(), f)).find((p) => existsSync20(p));
89214
+ const existing = [opts.file, ...opts.altFiles ?? []].map((f) => path26.join(process25.cwd(), f)).find((p) => existsSync20(p));
89162
89215
  if (!existing) {
89163
- const userPath = path25.join(process25.cwd(), opts.file);
89216
+ const userPath = path26.join(process25.cwd(), opts.file);
89164
89217
  writeFileSync9(userPath, JSON.stringify(opts.create, null, 2) + `
89165
89218
  `);
89166
89219
  info(colors.green(`Created ${opts.file} (references ${opts.token})`));
89167
89220
  return;
89168
89221
  }
89169
- const existingName = path25.basename(existing);
89222
+ const existingName = path26.basename(existing);
89170
89223
  let text = "";
89171
89224
  try {
89172
89225
  text = readFileSync5(existing, "utf-8");
@@ -89210,7 +89263,7 @@ async function ensureUserReferencesManaged(opts) {
89210
89263
  }
89211
89264
  function ensureBunTypesAvailable() {
89212
89265
  const cwd = process25.cwd();
89213
- if (existsSync20(path25.join(cwd, "node_modules", "bun-types"))) {
89266
+ if (existsSync20(path26.join(cwd, "node_modules", "bun-types"))) {
89214
89267
  return true;
89215
89268
  }
89216
89269
  try {
@@ -89232,7 +89285,7 @@ function ensureBunTypesAvailable() {
89232
89285
  }
89233
89286
  async function warnIfTsconfigStale(opts) {
89234
89287
  const cwd = opts?.cwd ?? process25.cwd();
89235
- const managedPath = path25.join(cwd, MANAGED_TSCONFIG);
89288
+ const managedPath = path26.join(cwd, MANAGED_TSCONFIG);
89236
89289
  if (!existsSync20(managedPath))
89237
89290
  return;
89238
89291
  let managedText;
@@ -91095,9 +91148,9 @@ var import_yaml45 = __toESM(require_dist(), 1);
91095
91148
  import { sep as SEP21 } from "node:path";
91096
91149
  import * as http3 from "node:http";
91097
91150
  import * as https from "node:https";
91098
- import { access, readdir as readdir10, realpath, stat as stat17, unlink, writeFile as writeFile21 } from "node:fs/promises";
91151
+ import { access, readdir as readdir10, realpath, stat as stat18, unlink, writeFile as writeFile21 } from "node:fs/promises";
91099
91152
  import { watch as watch2 } from "node:fs";
91100
- import * as path24 from "node:path";
91153
+ import * as path25 from "node:path";
91101
91154
  import * as fs17 from "node:fs";
91102
91155
 
91103
91156
  // src/commands/dev/pathscript-restore.ts
@@ -91193,7 +91246,7 @@ var PORT = 3001;
91193
91246
  var FLOW_SUFFIXES = [".flow", "__flow"];
91194
91247
  var APP_SUFFIXES = [".app", "__app", ".raw_app", "__raw_app"];
91195
91248
  var INLINE_SCRIPT_EXTS = new Set([
91196
- ...exts.map((e) => path24.extname("x" + e)).filter((e) => e !== ".yml"),
91249
+ ...exts.map((e) => path25.extname("x" + e)).filter((e) => e !== ".yml"),
91197
91250
  ".js"
91198
91251
  ]);
91199
91252
  function stripFolderSuffix(rel, suffixes) {
@@ -91234,13 +91287,13 @@ async function listWorkspacePaths() {
91234
91287
  if (entry.name.startsWith(".") || entry.name === "node_modules")
91235
91288
  continue;
91236
91289
  const childRel = rel ? `${rel}/${entry.name}` : entry.name;
91237
- const childAbs = path24.join(dir, entry.name);
91290
+ const childAbs = path25.join(dir, entry.name);
91238
91291
  if (entry.isDirectory()) {
91239
91292
  if (isFlowFolderName(entry.name)) {
91240
91293
  items.push({
91241
91294
  path: stripFolderSuffix(childRel, FLOW_SUFFIXES),
91242
91295
  kind: "flow",
91243
- _metaPath: path24.join(childAbs, "flow.yaml")
91296
+ _metaPath: path25.join(childAbs, "flow.yaml")
91244
91297
  });
91245
91298
  continue;
91246
91299
  }
@@ -91288,25 +91341,25 @@ async function listWorkspacePaths() {
91288
91341
  async function dev2(opts) {
91289
91342
  if (!opts.path) {
91290
91343
  const cwd = process.cwd();
91291
- const cwdBasename = path24.basename(cwd);
91344
+ const cwdBasename = path25.basename(cwd);
91292
91345
  await loadNonDottedPathsSetting();
91293
91346
  if (isFlowFolderName(cwdBasename)) {
91294
91347
  GLOBAL_CONFIG_OPT.noCdToRoot = true;
91295
91348
  let searchDir = cwd;
91296
91349
  let workspaceRoot;
91297
91350
  while (true) {
91298
- const wmillYaml = path24.join(searchDir, "wmill.yaml");
91351
+ const wmillYaml = path25.join(searchDir, "wmill.yaml");
91299
91352
  if (fs17.existsSync(wmillYaml)) {
91300
91353
  workspaceRoot = searchDir;
91301
91354
  break;
91302
91355
  }
91303
- const parentDir = path24.dirname(searchDir);
91356
+ const parentDir = path25.dirname(searchDir);
91304
91357
  if (parentDir === searchDir)
91305
91358
  break;
91306
91359
  searchDir = parentDir;
91307
91360
  }
91308
91361
  if (workspaceRoot) {
91309
- const relPath = path24.relative(workspaceRoot, cwd).replaceAll("\\", "/");
91362
+ const relPath = path25.relative(workspaceRoot, cwd).replaceAll("\\", "/");
91310
91363
  opts.path = stripFolderSuffix(relPath, FLOW_SUFFIXES);
91311
91364
  info(`Detected flow folder, path: ${opts.path}`);
91312
91365
  process.chdir(workspaceRoot);
@@ -91537,7 +91590,7 @@ async function dev2(opts) {
91537
91590
  const filePath = flowDir + s.path;
91538
91591
  if (s.content.startsWith("!inline ")) {
91539
91592
  try {
91540
- await stat17(filePath);
91593
+ await stat18(filePath);
91541
91594
  } catch {
91542
91595
  await writeFile21(filePath, "", "utf-8");
91543
91596
  }
@@ -91569,7 +91622,7 @@ async function dev2(opts) {
91569
91622
  for (const file of dirFiles) {
91570
91623
  if (file === "flow.yaml" || file === "flow.json" || file.startsWith("."))
91571
91624
  continue;
91572
- if (!INLINE_SCRIPT_EXTS.has(path24.extname(file)))
91625
+ if (!INLINE_SCRIPT_EXTS.has(path25.extname(file)))
91573
91626
  continue;
91574
91627
  if (!extractedPaths.has(file)) {
91575
91628
  await unlink(flowDir + file);
@@ -92093,7 +92146,7 @@ await __promiseAll([
92093
92146
  init_workspace(),
92094
92147
  init_resource_type()
92095
92148
  ]);
92096
- import { stat as stat20, writeFile as writeFile23, rm as rm8 } from "node:fs/promises";
92149
+ import { stat as stat21, writeFile as writeFile23, rm as rm8 } from "node:fs/promises";
92097
92150
 
92098
92151
  // src/commands/init/template.ts
92099
92152
  var NON_SCHEMA_KEYS = new Set([
@@ -92318,6 +92371,7 @@ var CONFIG_REFERENCE = [
92318
92371
  type: "object",
92319
92372
  properties: {
92320
92373
  relative_path: { type: "string", description: "Path to the codebase directory" },
92374
+ extra_digest_paths: { type: "array", items: { type: "string" }, description: "Paths outside relative_path that scripts import, relative to wmill.yaml; hashed recursively" },
92321
92375
  includes: { type: "array", items: { type: "string" }, description: "Glob patterns for files to include in bundle" },
92322
92376
  excludes: { type: "array", items: { type: "string" }, description: "Glob patterns for files to exclude from bundle" },
92323
92377
  format: { type: "string", enum: ["cjs", "esm"], description: "Bundle output format" },
@@ -92338,6 +92392,7 @@ Each entry is bundled and uploaded so scripts can import shared code.`,
92338
92392
  example: [
92339
92393
  "# codebases:",
92340
92394
  "# - relative_path: ./shared # path to the codebase",
92395
+ '# # extra_digest_paths: ["../packages/utils/src"] # imported paths outside relative_path, hashed recursively (skip node_modules/dist)',
92341
92396
  '# includes: ["**/*.ts"] # files to include in bundle',
92342
92397
  '# excludes: ["node_modules/**"] # files to exclude',
92343
92398
  '# format: esm # bundle format: "cjs" or "esm"',
@@ -92583,7 +92638,7 @@ await __promiseAll([
92583
92638
  init_utils(),
92584
92639
  init_freshness()
92585
92640
  ]);
92586
- import { cp, mkdir as mkdir15, readdir as readdir11, rm as rm7, stat as stat19, writeFile as writeFile22 } from "node:fs/promises";
92641
+ import { cp, mkdir as mkdir15, readdir as readdir11, rm as rm7, stat as stat20, writeFile as writeFile22 } from "node:fs/promises";
92587
92642
  import { join as join23 } from "node:path";
92588
92643
  var WMILL_INIT_AI_SKILLS_SOURCE_ENV = "WMILL_INIT_AI_SKILLS_SOURCE";
92589
92644
  var WMILL_INIT_AI_AGENTS_SOURCE_ENV = "WMILL_INIT_AI_AGENTS_SOURCE";
@@ -92642,7 +92697,7 @@ async function migrateLegacyManagedFile(targetDir) {
92642
92697
  }
92643
92698
  }
92644
92699
  const legacyPath = join23(targetDir, LEGACY_AGENTS_CLI_FILENAME);
92645
- const legacyExists = await stat19(legacyPath).catch(() => null) != null;
92700
+ const legacyExists = await stat20(legacyPath).catch(() => null) != null;
92646
92701
  if (legacyExists) {
92647
92702
  await rm7(legacyPath, { force: true });
92648
92703
  }
@@ -92667,7 +92722,7 @@ function cacheOnce(resolver) {
92667
92722
  };
92668
92723
  }
92669
92724
  async function reconcileIncludingFile(options) {
92670
- const exists = await stat19(options.path).catch(() => null) != null;
92725
+ const exists = await stat20(options.path).catch(() => null) != null;
92671
92726
  if (!exists) {
92672
92727
  await writeFile22(options.path, options.skeleton, "utf8");
92673
92728
  return { created: true, migration: "not-applicable" };
@@ -92785,7 +92840,7 @@ async function readSkillMetadataFromDirectory(skillsDir) {
92785
92840
  continue;
92786
92841
  }
92787
92842
  const skillPath = join23(skillsDir, entry.name, "SKILL.md");
92788
- if (!await stat19(skillPath).catch(() => null)) {
92843
+ if (!await stat20(skillPath).catch(() => null)) {
92789
92844
  continue;
92790
92845
  }
92791
92846
  const content = await readTextFile(skillPath);
@@ -92938,7 +92993,7 @@ await init_tsconfig();
92938
92993
  async function initAction(opts) {
92939
92994
  let didBindWorkspace = false;
92940
92995
  let boundProfile;
92941
- if (await stat20("wmill.yaml").catch(() => null)) {
92996
+ if (await stat21("wmill.yaml").catch(() => null)) {
92942
92997
  info("wmill.yaml already exists, skipping config generation");
92943
92998
  } else {
92944
92999
  await init_git();
@@ -96346,7 +96401,7 @@ await __promiseAll([
96346
96401
  init_conf()
96347
96402
  ]);
96348
96403
  import * as fs19 from "node:fs";
96349
- import * as path26 from "node:path";
96404
+ import * as path27 from "node:path";
96350
96405
  import process26 from "node:process";
96351
96406
 
96352
96407
  // src/commands/pipeline/duckdbMacros.ts
@@ -96579,7 +96634,7 @@ function parseMacroAnnotations(content) {
96579
96634
  // src/commands/pipeline/localGraph.ts
96580
96635
  function workspaceRoot() {
96581
96636
  const yaml = getWmillYamlPath();
96582
- return yaml ? path26.dirname(yaml) : process26.cwd();
96637
+ return yaml ? path27.dirname(yaml) : process26.cwd();
96583
96638
  }
96584
96639
  function wasmFnForLanguage(language) {
96585
96640
  switch (language) {
@@ -96815,7 +96870,7 @@ async function collectScripts2(folderDir, root, defaultTs) {
96815
96870
  for (const e of entries) {
96816
96871
  if (e.name.startsWith(".") || e.name === "node_modules")
96817
96872
  continue;
96818
- const abs = path26.join(dir, e.name);
96873
+ const abs = path27.join(dir, e.name);
96819
96874
  if (e.isDirectory()) {
96820
96875
  walk(abs);
96821
96876
  continue;
@@ -96825,7 +96880,7 @@ async function collectScripts2(folderDir, root, defaultTs) {
96825
96880
  const ext = exts.find((x) => e.name.endsWith(x));
96826
96881
  if (!ext)
96827
96882
  continue;
96828
- const relFromRoot = path26.relative(root, abs).replaceAll("\\", "/");
96883
+ const relFromRoot = path27.relative(root, abs).replaceAll("\\", "/");
96829
96884
  let language;
96830
96885
  try {
96831
96886
  language = inferContentTypeFromFilePath(abs, defaultTs);
@@ -96864,7 +96919,7 @@ function hideDbtRunnables(graph) {
96864
96919
  }
96865
96920
  async function buildLocalPipelineGraph(args) {
96866
96921
  const folderClean = args.folder.replace(/^f\//, "").replace(/\/$/, "");
96867
- const folderDir = path26.join(args.root, "f", folderClean);
96922
+ const folderDir = path27.join(args.root, "f", folderClean);
96868
96923
  const all = await collectScripts2(folderDir, args.root, args.defaultTs);
96869
96924
  const libMacros = collectMacroLibraries(args.root);
96870
96925
  const runnables = [];
@@ -97105,7 +97160,7 @@ function collectMacroLibraries(root) {
97105
97160
  for (const e of entries) {
97106
97161
  if (e.name.startsWith(".") || e.name === "node_modules")
97107
97162
  continue;
97108
- const abs = path26.join(dir, e.name);
97163
+ const abs = path27.join(dir, e.name);
97109
97164
  if (e.isDirectory()) {
97110
97165
  walk(abs);
97111
97166
  continue;
@@ -97120,11 +97175,11 @@ function collectMacroLibraries(root) {
97120
97175
  }
97121
97176
  if (!parseMacroAnnotations(content).macros)
97122
97177
  continue;
97123
- const relFromRoot = path26.relative(root, abs).replaceAll("\\", "/");
97178
+ const relFromRoot = path27.relative(root, abs).replaceAll("\\", "/");
97124
97179
  out.set(removeExtensionToPath(relFromRoot), parseMacroLibrary(content));
97125
97180
  }
97126
97181
  };
97127
- walk(path26.join(root, "f"));
97182
+ walk(path27.join(root, "f"));
97128
97183
  return out;
97129
97184
  }
97130
97185
  function buildMacroEdges(all, libMacros, runnables) {
@@ -97212,7 +97267,7 @@ await __promiseAll([
97212
97267
  init_codebase(),
97213
97268
  init_metadata()
97214
97269
  ]);
97215
- import { readFile as readFile3 } from "node:fs/promises";
97270
+ import { readFile as readFile4 } from "node:fs/promises";
97216
97271
 
97217
97272
  // src/commands/pipeline/dev.ts
97218
97273
  init_mod3();
@@ -97230,7 +97285,7 @@ await __promiseAll([
97230
97285
  ]);
97231
97286
  import * as http4 from "node:http";
97232
97287
  import * as fs20 from "node:fs";
97233
- import * as path27 from "node:path";
97288
+ import * as path28 from "node:path";
97234
97289
  import { createHash as createHash3, randomBytes as randomBytes2 } from "node:crypto";
97235
97290
  import process27 from "node:process";
97236
97291
  var PORT2 = 3201;
@@ -97239,7 +97294,7 @@ async function stableWsToken(remote, workspaceId, root, folder, port) {
97239
97294
  const key = createHash3("sha256").update(`${remote}\x00${workspaceId}\x00${root}\x00${folder}\x00${port}`).digest("hex").slice(0, 32);
97240
97295
  let tokenFile;
97241
97296
  try {
97242
- tokenFile = path27.join(await getConfigDirPath(), `pipeline-dev-${key}.token`);
97297
+ tokenFile = path28.join(await getConfigDirPath(), `pipeline-dev-${key}.token`);
97243
97298
  const existing = fs20.readFileSync(tokenFile, "utf-8").trim();
97244
97299
  if (existing)
97245
97300
  return existing;
@@ -97255,7 +97310,7 @@ async function stableWsToken(remote, workspaceId, root, folder, port) {
97255
97310
  function resolveFolder(root, folderArg) {
97256
97311
  if (folderArg)
97257
97312
  return folderArg.replace(/^f\//, "").replace(/\/$/, "");
97258
- const rel = path27.relative(root, process27.cwd()).replaceAll("\\", "/");
97313
+ const rel = path28.relative(root, process27.cwd()).replaceAll("\\", "/");
97259
97314
  if (rel === "" || rel.startsWith(".."))
97260
97315
  return;
97261
97316
  const segs = rel.split("/");
@@ -97270,7 +97325,7 @@ async function dev3(opts, folderArg) {
97270
97325
  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
97326
  process27.exit(1);
97272
97327
  }
97273
- const folderDir = path27.join(root, "f", folder);
97328
+ const folderDir = path28.join(root, "f", folder);
97274
97329
  if (!fs20.existsSync(folderDir)) {
97275
97330
  error(colors.red(`Folder not found on disk: ${folderDir}`));
97276
97331
  process27.exit(1);
@@ -97396,7 +97451,7 @@ await __promiseAll([
97396
97451
  ]);
97397
97452
  import { writeFile as writeFile26 } from "node:fs/promises";
97398
97453
  import { existsSync as existsSync22, readFileSync as readFileSync8 } from "node:fs";
97399
- import * as path28 from "node:path";
97454
+ import * as path29 from "node:path";
97400
97455
  var ASSET_KINDS = "s3object,ducklake,datatable,volume,dbt";
97401
97456
  function assetUri(kind, p) {
97402
97457
  const prefix = kind === "s3object" ? "s3" : kind;
@@ -97604,8 +97659,8 @@ async function generatePipelineDocs(opts, folder) {
97604
97659
  }
97605
97660
  }
97606
97661
  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");
97662
+ const folderDir = path29.join(root, "f", f);
97663
+ await writeFile26(path29.join(folderDir, "PIPELINE.md"), md, "utf-8");
97609
97664
  const written = ["PIPELINE.md"];
97610
97665
  const pointers = [
97611
97666
  ["AGENTS.md", `See @PIPELINE.md for this pipeline's graph, assets, and how to run it.
@@ -97614,7 +97669,7 @@ async function generatePipelineDocs(opts, folder) {
97614
97669
  `]
97615
97670
  ];
97616
97671
  for (const [name, content] of pointers) {
97617
- const p = path28.join(folderDir, name);
97672
+ const p = path29.join(folderDir, name);
97618
97673
  if (existsSync22(p)) {
97619
97674
  let existing;
97620
97675
  try {
@@ -97974,7 +98029,7 @@ async function resolveUploadArgs(bindings, scriptPath, workspaceId, local, local
97974
98029
  if (binding.source.startsWith("s3://")) {
97975
98030
  obj = parseS3Uri(binding.source);
97976
98031
  } else {
97977
- const buf = await readFile3(binding.source);
98032
+ const buf = await readFile4(binding.source);
97978
98033
  const key = devUploadKey(scriptPath, param, binding.source);
97979
98034
  await fileUpload({
97980
98035
  workspace: workspaceId,
@@ -98320,7 +98375,7 @@ await __promiseAll([
98320
98375
  init_utils()
98321
98376
  ]);
98322
98377
  import { Buffer as Buffer6 } from "node:buffer";
98323
- import { readFile as readFile4, writeFile as writeFile27 } from "node:fs/promises";
98378
+ import { readFile as readFile5, writeFile as writeFile27 } from "node:fs/promises";
98324
98379
  import { basename as basename12 } from "node:path";
98325
98380
  function formatBytes(n) {
98326
98381
  if (n == null)
@@ -98384,7 +98439,7 @@ More results available. Use --marker '${result.next_marker}' to paginate.`);
98384
98439
  async function upload(opts, localPath, fileKey) {
98385
98440
  const workspace = await resolveWorkspace(opts);
98386
98441
  await requireLogin(opts);
98387
- const buf = await readFile4(localPath);
98442
+ const buf = await readFile5(localPath);
98388
98443
  const blob = new Blob([buf], { type: opts.contentType ?? "application/octet-stream" });
98389
98444
  await fileUpload({
98390
98445
  workspace: workspace.workspaceId,