windmill-cli 1.715.0 → 1.716.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.
- package/esm/main.js +1021 -796
- package/package.json +2 -2
package/esm/main.js
CHANGED
|
@@ -16772,7 +16772,7 @@ var init_OpenAPI = __esm(() => {
|
|
|
16772
16772
|
PASSWORD: undefined,
|
|
16773
16773
|
TOKEN: getEnv3("WM_TOKEN"),
|
|
16774
16774
|
USERNAME: undefined,
|
|
16775
|
-
VERSION: "1.
|
|
16775
|
+
VERSION: "1.716.0",
|
|
16776
16776
|
WITH_CREDENTIALS: true,
|
|
16777
16777
|
interceptors: {
|
|
16778
16778
|
request: new Interceptors,
|
|
@@ -25289,7 +25289,7 @@ var init_auth = __esm(async () => {
|
|
|
25289
25289
|
});
|
|
25290
25290
|
|
|
25291
25291
|
// src/core/constants.ts
|
|
25292
|
-
var WM_FORK_PREFIX = "wm-fork";
|
|
25292
|
+
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.716.0";
|
|
25293
25293
|
|
|
25294
25294
|
// src/utils/git.ts
|
|
25295
25295
|
var exports_git = {};
|
|
@@ -27464,70 +27464,6 @@ var init_conf = __esm(async () => {
|
|
|
27464
27464
|
RESERVED_WORKSPACE_KEYS = new Set(["commonSpecificItems"]);
|
|
27465
27465
|
});
|
|
27466
27466
|
|
|
27467
|
-
// src/commands/resource-type/tsconfig.ts
|
|
27468
|
-
import { execSync as execSync3 } from "node:child_process";
|
|
27469
|
-
import { existsSync as existsSync3, writeFileSync } from "node:fs";
|
|
27470
|
-
import path3 from "node:path";
|
|
27471
|
-
import process10 from "node:process";
|
|
27472
|
-
async function generateTsconfigForIde() {
|
|
27473
|
-
const tsconfigPath = path3.join(process10.cwd(), "tsconfig.json");
|
|
27474
|
-
if (existsSync3(tsconfigPath)) {
|
|
27475
|
-
info(colors.gray("tsconfig.json already exists, skipping"));
|
|
27476
|
-
return;
|
|
27477
|
-
}
|
|
27478
|
-
let defaultTs = "bun";
|
|
27479
|
-
try {
|
|
27480
|
-
const conf = await readConfigFile({ warnIfMissing: false });
|
|
27481
|
-
if (conf?.defaultTs === "deno") {
|
|
27482
|
-
defaultTs = "deno";
|
|
27483
|
-
}
|
|
27484
|
-
} catch {}
|
|
27485
|
-
const bunTypesAvailable = defaultTs === "bun" ? ensureBunTypesAvailable() : false;
|
|
27486
|
-
const tsconfig = {
|
|
27487
|
-
compilerOptions: {
|
|
27488
|
-
target: "ESNext",
|
|
27489
|
-
module: "ESNext",
|
|
27490
|
-
moduleResolution: "bundler",
|
|
27491
|
-
noEmit: true,
|
|
27492
|
-
strict: false
|
|
27493
|
-
},
|
|
27494
|
-
include: ["**/*.ts", "rt.d.ts"]
|
|
27495
|
-
};
|
|
27496
|
-
if (bunTypesAvailable) {
|
|
27497
|
-
tsconfig.compilerOptions.types = ["bun-types"];
|
|
27498
|
-
}
|
|
27499
|
-
writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2) + `
|
|
27500
|
-
`);
|
|
27501
|
-
info(colors.green("Created tsconfig.json for IDE type support."));
|
|
27502
|
-
}
|
|
27503
|
-
function ensureBunTypesAvailable() {
|
|
27504
|
-
const cwd = process10.cwd();
|
|
27505
|
-
if (existsSync3(path3.join(cwd, "node_modules", "bun-types"))) {
|
|
27506
|
-
return true;
|
|
27507
|
-
}
|
|
27508
|
-
try {
|
|
27509
|
-
execSync3("bun --version", { stdio: "ignore" });
|
|
27510
|
-
} catch {
|
|
27511
|
-
info(`Install bun (https://bun.sh) then run 'bun add -d bun-types' and add "types": ["bun-types"] to tsconfig.json for Bun API autocompletion.`);
|
|
27512
|
-
return false;
|
|
27513
|
-
}
|
|
27514
|
-
try {
|
|
27515
|
-
info(colors.yellow("Installing bun-types with 'bun add -d bun-types'..."));
|
|
27516
|
-
execSync3("bun add -d bun-types", { stdio: "inherit" });
|
|
27517
|
-
info(colors.green("Installed bun-types."));
|
|
27518
|
-
return true;
|
|
27519
|
-
} catch (e) {
|
|
27520
|
-
warn(`Failed to install bun-types automatically: ${e instanceof Error ? e.message : e}`);
|
|
27521
|
-
info(`Run 'bun add -d bun-types' manually and add "types": ["bun-types"] to tsconfig.json for Bun API autocompletion.`);
|
|
27522
|
-
return false;
|
|
27523
|
-
}
|
|
27524
|
-
}
|
|
27525
|
-
var init_tsconfig = __esm(async () => {
|
|
27526
|
-
init_colors2();
|
|
27527
|
-
init_log();
|
|
27528
|
-
await init_conf();
|
|
27529
|
-
});
|
|
27530
|
-
|
|
27531
27467
|
// src/utils/resource_types.ts
|
|
27532
27468
|
function compileResourceTypeToTsType(schema) {
|
|
27533
27469
|
function rec(x, root = false) {
|
|
@@ -27570,10 +27506,10 @@ __export(exports_resource_type, {
|
|
|
27570
27506
|
generateRTNamespace: () => generateRTNamespace,
|
|
27571
27507
|
default: () => resource_type_default
|
|
27572
27508
|
});
|
|
27573
|
-
import { writeFileSync
|
|
27509
|
+
import { writeFileSync } from "node:fs";
|
|
27574
27510
|
import { stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
|
|
27575
|
-
import
|
|
27576
|
-
import
|
|
27511
|
+
import path3 from "node:path";
|
|
27512
|
+
import process10 from "node:process";
|
|
27577
27513
|
async function pushResourceType(workspace, remotePath, resource, localResource) {
|
|
27578
27514
|
remotePath = removeType(remotePath, "resource-type");
|
|
27579
27515
|
try {
|
|
@@ -27658,12 +27594,12 @@ async function newResourceType(opts, name) {
|
|
|
27658
27594
|
});
|
|
27659
27595
|
info(colors.green(`Created ${filePath}`));
|
|
27660
27596
|
}
|
|
27661
|
-
async function get(opts,
|
|
27597
|
+
async function get(opts, path4) {
|
|
27662
27598
|
const workspace = await resolveWorkspace(opts);
|
|
27663
27599
|
await requireLogin(opts);
|
|
27664
27600
|
const rt = await getResourceType({
|
|
27665
27601
|
workspace: workspace.workspaceId,
|
|
27666
|
-
path:
|
|
27602
|
+
path: path4
|
|
27667
27603
|
});
|
|
27668
27604
|
if (opts.json) {
|
|
27669
27605
|
console.log(JSON.stringify(rt));
|
|
@@ -27693,9 +27629,8 @@ async function generateRTNamespace(opts) {
|
|
|
27693
27629
|
`);
|
|
27694
27630
|
namespaceContent += `
|
|
27695
27631
|
}`;
|
|
27696
|
-
|
|
27632
|
+
writeFileSync(path3.join(process10.cwd(), "rt.d.ts"), namespaceContent);
|
|
27697
27633
|
info(colors.green("Created rt.d.ts with resource types namespace (RT) for TypeScript."));
|
|
27698
|
-
await generateTsconfigForIde();
|
|
27699
27634
|
}
|
|
27700
27635
|
var import_yaml4, command, resource_type_default;
|
|
27701
27636
|
var init_resource_type = __esm(async () => {
|
|
@@ -27708,7 +27643,6 @@ var init_resource_type = __esm(async () => {
|
|
|
27708
27643
|
init_types(),
|
|
27709
27644
|
init_auth(),
|
|
27710
27645
|
init_context(),
|
|
27711
|
-
init_tsconfig(),
|
|
27712
27646
|
init_utils()
|
|
27713
27647
|
]);
|
|
27714
27648
|
import_yaml4 = __toESM(require_dist(), 1);
|
|
@@ -27731,7 +27665,7 @@ __export(exports_workspace, {
|
|
|
27731
27665
|
add: () => add
|
|
27732
27666
|
});
|
|
27733
27667
|
import { writeFile as writeFile3, open as fsOpen } from "node:fs/promises";
|
|
27734
|
-
import
|
|
27668
|
+
import process11 from "node:process";
|
|
27735
27669
|
async function allWorkspaces(configDirOverride) {
|
|
27736
27670
|
try {
|
|
27737
27671
|
const file = await getWorkspaceConfigFilePath(configDirOverride);
|
|
@@ -27843,7 +27777,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
|
|
|
27843
27777
|
}
|
|
27844
27778
|
remote = new URL(remote).toString();
|
|
27845
27779
|
let token = await tryGetLoginInfo(opts);
|
|
27846
|
-
if (!token && !(
|
|
27780
|
+
if (!token && !(process11.stdin.isTTY ?? false)) {
|
|
27847
27781
|
info("Not a TTY, can't login interactively. Pass the token in --token");
|
|
27848
27782
|
return;
|
|
27849
27783
|
}
|
|
@@ -27885,7 +27819,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
|
|
|
27885
27819
|
info(`- ${workspace.id} (name: ${workspace.name})`);
|
|
27886
27820
|
}
|
|
27887
27821
|
}
|
|
27888
|
-
|
|
27822
|
+
process11.exit(1);
|
|
27889
27823
|
}
|
|
27890
27824
|
const added = await addWorkspace({
|
|
27891
27825
|
name: workspaceName,
|
|
@@ -27902,7 +27836,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
|
|
|
27902
27836
|
async function addWorkspace(workspace, opts) {
|
|
27903
27837
|
workspace.remote = new URL(workspace.remote).toString();
|
|
27904
27838
|
const existingWorkspaces = await allWorkspaces(opts.configDir);
|
|
27905
|
-
const isInteractive = (
|
|
27839
|
+
const isInteractive = (process11.stdin.isTTY ?? false) && (process11.stdout.isTTY ?? false) && !opts.force;
|
|
27906
27840
|
const nameConflict = existingWorkspaces.find((w) => w.name === workspace.name);
|
|
27907
27841
|
if (nameConflict) {
|
|
27908
27842
|
if (nameConflict.remote === workspace.remote && nameConflict.workspaceId === workspace.workspaceId) {
|
|
@@ -28078,7 +28012,7 @@ async function bind(opts, doBind) {
|
|
|
28078
28012
|
if (!config.workspaces) {
|
|
28079
28013
|
config.workspaces = {};
|
|
28080
28014
|
}
|
|
28081
|
-
const isInteractive = !!
|
|
28015
|
+
const isInteractive = !!process11.stdin.isTTY;
|
|
28082
28016
|
const inGitRepo = isGitRepository2();
|
|
28083
28017
|
const currentBranch = inGitRepo ? getCurrentGitBranch2() : null;
|
|
28084
28018
|
if (doBind) {
|
|
@@ -28267,16 +28201,16 @@ async function getBranchProfilesPath(configDirOverride) {
|
|
|
28267
28201
|
}
|
|
28268
28202
|
async function loadBranchProfiles(configDirOverride) {
|
|
28269
28203
|
try {
|
|
28270
|
-
const
|
|
28271
|
-
const content = await readTextFile(
|
|
28204
|
+
const path4 = await getBranchProfilesPath(configDirOverride);
|
|
28205
|
+
const content = await readTextFile(path4);
|
|
28272
28206
|
return JSON.parse(content);
|
|
28273
28207
|
} catch {
|
|
28274
28208
|
return { lastUsed: {} };
|
|
28275
28209
|
}
|
|
28276
28210
|
}
|
|
28277
28211
|
async function saveBranchProfiles(mapping, configDirOverride) {
|
|
28278
|
-
const
|
|
28279
|
-
await writeFile4(
|
|
28212
|
+
const path4 = await getBranchProfilesPath(configDirOverride);
|
|
28213
|
+
await writeFile4(path4, JSON.stringify(mapping, null, 2), "utf-8");
|
|
28280
28214
|
}
|
|
28281
28215
|
function getBranchProfileKey(branch, baseUrl2, workspaceId) {
|
|
28282
28216
|
let normalizedUrl;
|
|
@@ -28715,8 +28649,8 @@ async function tryResolveVersion(opts) {
|
|
|
28715
28649
|
return;
|
|
28716
28650
|
}
|
|
28717
28651
|
}
|
|
28718
|
-
function validatePath(
|
|
28719
|
-
if (!(
|
|
28652
|
+
function validatePath(path4) {
|
|
28653
|
+
if (!(path4.startsWith("g") || path4.startsWith("u") || path4.startsWith("f"))) {
|
|
28720
28654
|
info(colors.red("Given remote path looks invalid. Remote paths are typically of the form <u|g|f>/<username|group|folder>/..."));
|
|
28721
28655
|
return false;
|
|
28722
28656
|
}
|
|
@@ -28769,7 +28703,7 @@ var init_global = __esm(() => {
|
|
|
28769
28703
|
// src/utils/utils.ts
|
|
28770
28704
|
import { sep as SEP3 } from "node:path";
|
|
28771
28705
|
import crypto2 from "node:crypto";
|
|
28772
|
-
import { readFileSync, writeFileSync as
|
|
28706
|
+
import { readFileSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
28773
28707
|
import { readdir, readFile } from "node:fs/promises";
|
|
28774
28708
|
function deepEqual(a, b) {
|
|
28775
28709
|
if (a === b)
|
|
@@ -28856,12 +28790,12 @@ function getHeaders2() {
|
|
|
28856
28790
|
return;
|
|
28857
28791
|
}
|
|
28858
28792
|
}
|
|
28859
|
-
async function digestDir(
|
|
28793
|
+
async function digestDir(path4, conf) {
|
|
28860
28794
|
const hashes = [];
|
|
28861
|
-
const entries = await readdir(
|
|
28795
|
+
const entries = await readdir(path4, { withFileTypes: true });
|
|
28862
28796
|
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
28863
28797
|
for (const e of entries) {
|
|
28864
|
-
const npath =
|
|
28798
|
+
const npath = path4 + "/" + e.name;
|
|
28865
28799
|
if (e.isFile()) {
|
|
28866
28800
|
hashes.push(await generateHashFromBuffer(await readFile(npath)));
|
|
28867
28801
|
} else if (e.isDirectory() && !e.isSymbolicLink()) {
|
|
@@ -28878,19 +28812,19 @@ async function generateHashFromBuffer(content) {
|
|
|
28878
28812
|
const hashBuffer = await crypto2.subtle.digest("SHA-256", content);
|
|
28879
28813
|
return Buffer.from(hashBuffer).toString("hex");
|
|
28880
28814
|
}
|
|
28881
|
-
function decodeBufferAsUtf8(buf,
|
|
28815
|
+
function decodeBufferAsUtf8(buf, path4) {
|
|
28882
28816
|
if (buf.length >= 2) {
|
|
28883
28817
|
if (buf[0] === 255 && buf[1] === 254) {
|
|
28884
28818
|
if (buf.length >= 4 && buf[2] === 0 && buf[3] === 0) {
|
|
28885
|
-
throw new Error(`File ${
|
|
28819
|
+
throw new Error(`File ${path4} is encoded as UTF-32 LE, which is not supported. Please convert it to UTF-8.`);
|
|
28886
28820
|
}
|
|
28887
|
-
throw new Error(`File ${
|
|
28821
|
+
throw new Error(`File ${path4} is encoded as UTF-16 LE, which is not supported. Please convert it to UTF-8.`);
|
|
28888
28822
|
}
|
|
28889
28823
|
if (buf[0] === 254 && buf[1] === 255) {
|
|
28890
|
-
throw new Error(`File ${
|
|
28824
|
+
throw new Error(`File ${path4} is encoded as UTF-16 BE, which is not supported. Please convert it to UTF-8.`);
|
|
28891
28825
|
}
|
|
28892
28826
|
if (buf.length >= 4 && buf[0] === 0 && buf[1] === 0 && buf[2] === 254 && buf[3] === 255) {
|
|
28893
|
-
throw new Error(`File ${
|
|
28827
|
+
throw new Error(`File ${path4} is encoded as UTF-32 BE, which is not supported. Please convert it to UTF-8.`);
|
|
28894
28828
|
}
|
|
28895
28829
|
}
|
|
28896
28830
|
if (buf.length >= 3 && buf[0] === 239 && buf[1] === 187 && buf[2] === 191) {
|
|
@@ -28898,32 +28832,32 @@ function decodeBufferAsUtf8(buf, path5) {
|
|
|
28898
28832
|
}
|
|
28899
28833
|
return buf.toString("utf-8");
|
|
28900
28834
|
}
|
|
28901
|
-
async function readTextFile(
|
|
28902
|
-
return decodeBufferAsUtf8(await readFile(
|
|
28835
|
+
async function readTextFile(path4) {
|
|
28836
|
+
return decodeBufferAsUtf8(await readFile(path4), path4);
|
|
28903
28837
|
}
|
|
28904
|
-
function readTextFileSync(
|
|
28905
|
-
return decodeBufferAsUtf8(readFileSync(
|
|
28838
|
+
function readTextFileSync(path4) {
|
|
28839
|
+
return decodeBufferAsUtf8(readFileSync(path4), path4);
|
|
28906
28840
|
}
|
|
28907
|
-
function readInlinePathSync(
|
|
28841
|
+
function readInlinePathSync(path4) {
|
|
28908
28842
|
try {
|
|
28909
|
-
return readTextFileSync(
|
|
28843
|
+
return readTextFileSync(path4.replaceAll("/", SEP3));
|
|
28910
28844
|
} catch (error2) {
|
|
28911
|
-
warn(`Error reading inline path: ${
|
|
28845
|
+
warn(`Error reading inline path: ${path4}, ${error2}`);
|
|
28912
28846
|
return "";
|
|
28913
28847
|
}
|
|
28914
28848
|
}
|
|
28915
|
-
function isFileResource(
|
|
28916
|
-
const splitPath =
|
|
28849
|
+
function isFileResource(path4) {
|
|
28850
|
+
const splitPath = path4.split(".");
|
|
28917
28851
|
return splitPath.length >= 4 && splitPath[splitPath.length - 3] == "resource" && splitPath[splitPath.length - 2] == "file";
|
|
28918
28852
|
}
|
|
28919
|
-
function isFilesetResource(
|
|
28920
|
-
return
|
|
28853
|
+
function isFilesetResource(path4) {
|
|
28854
|
+
return path4.includes(".fileset/") || path4.includes(".fileset\\");
|
|
28921
28855
|
}
|
|
28922
|
-
function isRawAppFile(
|
|
28923
|
-
return isRawAppPath(
|
|
28856
|
+
function isRawAppFile(path4) {
|
|
28857
|
+
return isRawAppPath(path4);
|
|
28924
28858
|
}
|
|
28925
|
-
function isWorkspaceDependencies(
|
|
28926
|
-
return
|
|
28859
|
+
function isWorkspaceDependencies(path4) {
|
|
28860
|
+
return path4.startsWith("dependencies/");
|
|
28927
28861
|
}
|
|
28928
28862
|
async function selectRepository(repositories, operation) {
|
|
28929
28863
|
if (repositories.length === 0) {
|
|
@@ -28962,16 +28896,16 @@ async function getIsWin() {
|
|
|
28962
28896
|
}
|
|
28963
28897
|
return isWin;
|
|
28964
28898
|
}
|
|
28965
|
-
function writeIfChanged(
|
|
28899
|
+
function writeIfChanged(path4, content) {
|
|
28966
28900
|
try {
|
|
28967
|
-
const existing = readTextFileSync(
|
|
28901
|
+
const existing = readTextFileSync(path4);
|
|
28968
28902
|
if (existing === content) {
|
|
28969
28903
|
return false;
|
|
28970
28904
|
}
|
|
28971
28905
|
} catch (error2) {
|
|
28972
28906
|
if (error2?.code !== "ENOENT") {}
|
|
28973
28907
|
}
|
|
28974
|
-
|
|
28908
|
+
writeFileSync2(path4, content, "utf-8");
|
|
28975
28909
|
return true;
|
|
28976
28910
|
}
|
|
28977
28911
|
async function fetchRemoteVersion(workspace) {
|
|
@@ -28979,6 +28913,7 @@ async function fetchRemoteVersion(workspace) {
|
|
|
28979
28913
|
if (version) {
|
|
28980
28914
|
updateGlobalVersions(version);
|
|
28981
28915
|
}
|
|
28916
|
+
info(colors.gray("CLI version: " + VERSION));
|
|
28982
28917
|
info(colors.gray("Remote version: " + version));
|
|
28983
28918
|
}
|
|
28984
28919
|
function toCamel(s) {
|
|
@@ -29011,24 +28946,24 @@ var init_utils = __esm(async () => {
|
|
|
29011
28946
|
});
|
|
29012
28947
|
|
|
29013
28948
|
// src/utils/yaml.ts
|
|
29014
|
-
async function yamlParseFile(
|
|
28949
|
+
async function yamlParseFile(path4, options = {}) {
|
|
29015
28950
|
try {
|
|
29016
|
-
return import_yaml5.parse(await readTextFile(
|
|
28951
|
+
return import_yaml5.parse(await readTextFile(path4), {
|
|
29017
28952
|
...options,
|
|
29018
28953
|
customTags: [...WINDMILL_CUSTOM_TAGS, ...options.customTags ?? []]
|
|
29019
28954
|
});
|
|
29020
28955
|
} catch (e) {
|
|
29021
|
-
throw new Error(`Error parsing yaml ${
|
|
28956
|
+
throw new Error(`Error parsing yaml ${path4}`, { cause: e });
|
|
29022
28957
|
}
|
|
29023
28958
|
}
|
|
29024
|
-
function yamlParseContent(
|
|
28959
|
+
function yamlParseContent(path4, content, options = {}) {
|
|
29025
28960
|
try {
|
|
29026
28961
|
return import_yaml5.parse(content, {
|
|
29027
28962
|
...options,
|
|
29028
28963
|
customTags: [...WINDMILL_CUSTOM_TAGS, ...options.customTags ?? []]
|
|
29029
28964
|
});
|
|
29030
28965
|
} catch (e) {
|
|
29031
|
-
throw new Error(`Error parsing yaml ${
|
|
28966
|
+
throw new Error(`Error parsing yaml ${path4}`, { cause: e });
|
|
29032
28967
|
}
|
|
29033
28968
|
}
|
|
29034
28969
|
var import_yaml5, inlineTag, inlineFilesetTag, WINDMILL_CUSTOM_TAGS;
|
|
@@ -30944,7 +30879,7 @@ return schema
|
|
|
30944
30879
|
|
|
30945
30880
|
// src/utils/port-probe.ts
|
|
30946
30881
|
import { createServer as createServer2 } from "node:net";
|
|
30947
|
-
import { execSync as
|
|
30882
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
30948
30883
|
function isPortFree(port, host) {
|
|
30949
30884
|
return new Promise((resolve6) => {
|
|
30950
30885
|
const s = createServer2();
|
|
@@ -30965,7 +30900,7 @@ async function isPortFreeOnBothStacks(port) {
|
|
|
30965
30900
|
}
|
|
30966
30901
|
function findPortHolder(port) {
|
|
30967
30902
|
try {
|
|
30968
|
-
const out =
|
|
30903
|
+
const out = execSync3(`lsof -nP -iTCP:${port} -sTCP:LISTEN -F pc 2>/dev/null`, {
|
|
30969
30904
|
encoding: "utf-8",
|
|
30970
30905
|
stdio: ["ignore", "pipe", "ignore"]
|
|
30971
30906
|
});
|
|
@@ -30982,7 +30917,7 @@ function findPortHolder(port) {
|
|
|
30982
30917
|
}
|
|
30983
30918
|
} catch {}
|
|
30984
30919
|
try {
|
|
30985
|
-
const out =
|
|
30920
|
+
const out = execSync3(`ss -ltnp 2>/dev/null | awk '$4 ~ /:${port}$/ { print $NF }'`, {
|
|
30986
30921
|
encoding: "utf-8",
|
|
30987
30922
|
stdio: ["ignore", "pipe", "ignore"]
|
|
30988
30923
|
}).trim();
|
|
@@ -33854,11 +33789,11 @@ var init_wrapper = __esm(() => {
|
|
|
33854
33789
|
|
|
33855
33790
|
// src/commands/app/bundle.ts
|
|
33856
33791
|
import * as fs7 from "node:fs";
|
|
33857
|
-
import * as
|
|
33858
|
-
import
|
|
33792
|
+
import * as path4 from "node:path";
|
|
33793
|
+
import process12 from "node:process";
|
|
33859
33794
|
import { spawn } from "node:child_process";
|
|
33860
33795
|
function detectFrameworks(appDir) {
|
|
33861
|
-
const packageJsonPath =
|
|
33796
|
+
const packageJsonPath = path4.join(appDir, "package.json");
|
|
33862
33797
|
if (!fs7.existsSync(packageJsonPath)) {
|
|
33863
33798
|
return { svelte: false, vue: false };
|
|
33864
33799
|
}
|
|
@@ -33883,7 +33818,7 @@ function createSveltePlugin(appDir) {
|
|
|
33883
33818
|
build.onLoad({ filter: /\.svelte$/ }, async (args) => {
|
|
33884
33819
|
const svelte = await import("svelte/compiler");
|
|
33885
33820
|
const source = await readTextFile(args.path);
|
|
33886
|
-
const filename =
|
|
33821
|
+
const filename = path4.relative(process12.cwd(), args.path);
|
|
33887
33822
|
const convertMessage = ({ message, start, end }) => {
|
|
33888
33823
|
let location;
|
|
33889
33824
|
if (start && end) {
|
|
@@ -33924,8 +33859,8 @@ async function createFrameworkPlugins(appDir) {
|
|
|
33924
33859
|
return plugins;
|
|
33925
33860
|
}
|
|
33926
33861
|
async function ensureNodeModules(appDir) {
|
|
33927
|
-
const targetDir = appDir ??
|
|
33928
|
-
const nodeModulesPath =
|
|
33862
|
+
const targetDir = appDir ?? process12.cwd();
|
|
33863
|
+
const nodeModulesPath = path4.join(targetDir, "node_modules");
|
|
33929
33864
|
if (!fs7.existsSync(nodeModulesPath)) {
|
|
33930
33865
|
info(colors.yellow("\uD83D\uDCE6 node_modules not found, running npm install..."));
|
|
33931
33866
|
const code2 = await new Promise((resolve6, reject) => {
|
|
@@ -33945,7 +33880,7 @@ async function ensureNodeModules(appDir) {
|
|
|
33945
33880
|
}
|
|
33946
33881
|
async function createBundle(options = {}) {
|
|
33947
33882
|
const esbuild = await import("esbuild");
|
|
33948
|
-
const appDir = options.entryPoint ?
|
|
33883
|
+
const appDir = options.entryPoint ? path4.dirname(options.entryPoint) : process12.cwd();
|
|
33949
33884
|
const frameworks = detectFrameworks(appDir);
|
|
33950
33885
|
const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
33951
33886
|
const entryPoint = options.entryPoint ?? defaultEntry;
|
|
@@ -33958,11 +33893,11 @@ async function createBundle(options = {}) {
|
|
|
33958
33893
|
}
|
|
33959
33894
|
await ensureNodeModules(appDir);
|
|
33960
33895
|
const frameworkPlugins = await createFrameworkPlugins(appDir);
|
|
33961
|
-
const distDir =
|
|
33896
|
+
const distDir = path4.join(process12.cwd(), outDir);
|
|
33962
33897
|
if (!fs7.existsSync(distDir)) {
|
|
33963
33898
|
fs7.mkdirSync(distDir, { recursive: true });
|
|
33964
33899
|
}
|
|
33965
|
-
const outfile =
|
|
33900
|
+
const outfile = path4.join(outDir, "bundle.js");
|
|
33966
33901
|
const wmillTs = rawAppWmillTs_exports.default ?? rawAppWmillTs_exports;
|
|
33967
33902
|
const wmillPlugin = {
|
|
33968
33903
|
name: "wmill-virtual",
|
|
@@ -33992,11 +33927,11 @@ async function createBundle(options = {}) {
|
|
|
33992
33927
|
build.onResolve({ filter: /^\/ui\// }, (args) => {
|
|
33993
33928
|
const rel = args.path.slice("/ui/".length);
|
|
33994
33929
|
const candidates = [rel];
|
|
33995
|
-
if (!
|
|
33996
|
-
candidates.push(rel + ".tsx", rel + ".ts", rel + ".jsx", rel + ".js", rel + ".css",
|
|
33930
|
+
if (!path4.extname(rel)) {
|
|
33931
|
+
candidates.push(rel + ".tsx", rel + ".ts", rel + ".jsx", rel + ".js", rel + ".css", path4.join(rel, "index.tsx"), path4.join(rel, "index.ts"));
|
|
33997
33932
|
}
|
|
33998
33933
|
for (const c of candidates) {
|
|
33999
|
-
const full =
|
|
33934
|
+
const full = path4.join(sharedUiDir, c);
|
|
34000
33935
|
if (fs7.existsSync(full)) {
|
|
34001
33936
|
return { path: full };
|
|
34002
33937
|
}
|
|
@@ -34034,8 +33969,8 @@ async function createBundle(options = {}) {
|
|
|
34034
33969
|
throw new Error("Build failed with errors");
|
|
34035
33970
|
}
|
|
34036
33971
|
info(colors.green("✅ Bundle created successfully"));
|
|
34037
|
-
const jsPath =
|
|
34038
|
-
const cssPath =
|
|
33972
|
+
const jsPath = path4.join(process12.cwd(), outfile);
|
|
33973
|
+
const cssPath = path4.join(process12.cwd(), outDir, "bundle.css");
|
|
34039
33974
|
if (!fs7.existsSync(jsPath)) {
|
|
34040
33975
|
throw new Error(`Expected JS bundle at ${jsPath} but file not found`);
|
|
34041
33976
|
}
|
|
@@ -35887,7 +35822,7 @@ var minimatch = (p, pattern, options = {}) => {
|
|
|
35887
35822
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
35888
35823
|
const len = $0.length;
|
|
35889
35824
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
35890
|
-
}, defaultPlatform,
|
|
35825
|
+
}, defaultPlatform, path5, sep2, GLOBSTAR, qmark2 = "[^/]", star3, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
|
|
35891
35826
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
35892
35827
|
return minimatch;
|
|
35893
35828
|
}
|
|
@@ -35945,11 +35880,11 @@ var init_esm2 = __esm(() => {
|
|
|
35945
35880
|
starRE = /^\*+$/;
|
|
35946
35881
|
qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
35947
35882
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
35948
|
-
|
|
35883
|
+
path5 = {
|
|
35949
35884
|
win32: { sep: "\\" },
|
|
35950
35885
|
posix: { sep: "/" }
|
|
35951
35886
|
};
|
|
35952
|
-
sep2 = defaultPlatform === "win32" ?
|
|
35887
|
+
sep2 = defaultPlatform === "win32" ? path5.win32.sep : path5.posix.sep;
|
|
35953
35888
|
minimatch.sep = sep2;
|
|
35954
35889
|
GLOBSTAR = Symbol("globstar **");
|
|
35955
35890
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -38678,8 +38613,8 @@ var require_utils = __commonJS((exports) => {
|
|
|
38678
38613
|
var result = transform[inputType][outputType](input);
|
|
38679
38614
|
return result;
|
|
38680
38615
|
};
|
|
38681
|
-
exports.resolve = function(
|
|
38682
|
-
var parts =
|
|
38616
|
+
exports.resolve = function(path6) {
|
|
38617
|
+
var parts = path6.split("/");
|
|
38683
38618
|
var result = [];
|
|
38684
38619
|
for (var index = 0;index < parts.length; index++) {
|
|
38685
38620
|
var part = parts[index];
|
|
@@ -44129,18 +44064,18 @@ var require_object = __commonJS((exports, module) => {
|
|
|
44129
44064
|
var object = new ZipObject(name, zipObjectContent, o);
|
|
44130
44065
|
this.files[name] = object;
|
|
44131
44066
|
};
|
|
44132
|
-
var parentFolder = function(
|
|
44133
|
-
if (
|
|
44134
|
-
|
|
44067
|
+
var parentFolder = function(path6) {
|
|
44068
|
+
if (path6.slice(-1) === "/") {
|
|
44069
|
+
path6 = path6.substring(0, path6.length - 1);
|
|
44135
44070
|
}
|
|
44136
|
-
var lastSlash =
|
|
44137
|
-
return lastSlash > 0 ?
|
|
44071
|
+
var lastSlash = path6.lastIndexOf("/");
|
|
44072
|
+
return lastSlash > 0 ? path6.substring(0, lastSlash) : "";
|
|
44138
44073
|
};
|
|
44139
|
-
var forceTrailingSlash = function(
|
|
44140
|
-
if (
|
|
44141
|
-
|
|
44074
|
+
var forceTrailingSlash = function(path6) {
|
|
44075
|
+
if (path6.slice(-1) !== "/") {
|
|
44076
|
+
path6 += "/";
|
|
44142
44077
|
}
|
|
44143
|
-
return
|
|
44078
|
+
return path6;
|
|
44144
44079
|
};
|
|
44145
44080
|
var folderAdd = function(name, createFolders) {
|
|
44146
44081
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults2.createFolders;
|
|
@@ -50645,8 +50580,8 @@ var require_utils2 = __commonJS((exports, module) => {
|
|
|
50645
50580
|
}
|
|
50646
50581
|
return ind;
|
|
50647
50582
|
}
|
|
50648
|
-
function removeDotSegments(
|
|
50649
|
-
let input =
|
|
50583
|
+
function removeDotSegments(path6) {
|
|
50584
|
+
let input = path6;
|
|
50650
50585
|
const output = [];
|
|
50651
50586
|
let nextSlash = -1;
|
|
50652
50587
|
let len = 0;
|
|
@@ -50836,8 +50771,8 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
50836
50771
|
wsComponent.secure = undefined;
|
|
50837
50772
|
}
|
|
50838
50773
|
if (wsComponent.resourceName) {
|
|
50839
|
-
const [
|
|
50840
|
-
wsComponent.path =
|
|
50774
|
+
const [path6, query] = wsComponent.resourceName.split("?");
|
|
50775
|
+
wsComponent.path = path6 && path6 !== "/" ? path6 : undefined;
|
|
50841
50776
|
wsComponent.query = query;
|
|
50842
50777
|
wsComponent.resourceName = undefined;
|
|
50843
50778
|
}
|
|
@@ -54270,13 +54205,13 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
54270
54205
|
}
|
|
54271
54206
|
return next();
|
|
54272
54207
|
};
|
|
54273
|
-
__rewriteRelativeImportExtension = function(
|
|
54274
|
-
if (typeof
|
|
54275
|
-
return
|
|
54208
|
+
__rewriteRelativeImportExtension = function(path6, preserveJsx) {
|
|
54209
|
+
if (typeof path6 === "string" && /^\.\.?\//.test(path6)) {
|
|
54210
|
+
return path6.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext2, cm) {
|
|
54276
54211
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext2 || !cm) ? m : d + ext2 + "." + cm.toLowerCase() + "js";
|
|
54277
54212
|
});
|
|
54278
54213
|
}
|
|
54279
|
-
return
|
|
54214
|
+
return path6;
|
|
54280
54215
|
};
|
|
54281
54216
|
exporter("__extends", __extends2);
|
|
54282
54217
|
exporter("__assign", __assign2);
|
|
@@ -57580,19 +57515,19 @@ var require_buildJsonPath = __commonJS((exports) => {
|
|
|
57580
57515
|
var types_1 = require_types2();
|
|
57581
57516
|
var utils_1 = require_utils3();
|
|
57582
57517
|
function buildJsonPath(node) {
|
|
57583
|
-
const
|
|
57518
|
+
const path6 = [];
|
|
57584
57519
|
let prevNode = node;
|
|
57585
57520
|
while (node) {
|
|
57586
57521
|
switch (node.kind) {
|
|
57587
57522
|
case types_1.Kind.SCALAR:
|
|
57588
|
-
|
|
57523
|
+
path6.unshift(node.value);
|
|
57589
57524
|
break;
|
|
57590
57525
|
case types_1.Kind.MAPPING:
|
|
57591
57526
|
if (prevNode !== node.key) {
|
|
57592
|
-
if (
|
|
57593
|
-
|
|
57527
|
+
if (path6.length > 0 && utils_1.isObject(node.value) && node.value.value === path6[0]) {
|
|
57528
|
+
path6[0] = node.key.value;
|
|
57594
57529
|
} else {
|
|
57595
|
-
|
|
57530
|
+
path6.unshift(node.key.value);
|
|
57596
57531
|
}
|
|
57597
57532
|
}
|
|
57598
57533
|
break;
|
|
@@ -57600,9 +57535,9 @@ var require_buildJsonPath = __commonJS((exports) => {
|
|
|
57600
57535
|
if (prevNode) {
|
|
57601
57536
|
const index = node.items.indexOf(prevNode);
|
|
57602
57537
|
if (prevNode.kind === types_1.Kind.SCALAR) {
|
|
57603
|
-
|
|
57538
|
+
path6[0] = index;
|
|
57604
57539
|
} else if (index !== -1) {
|
|
57605
|
-
|
|
57540
|
+
path6.unshift(index);
|
|
57606
57541
|
}
|
|
57607
57542
|
}
|
|
57608
57543
|
break;
|
|
@@ -57610,7 +57545,7 @@ var require_buildJsonPath = __commonJS((exports) => {
|
|
|
57610
57545
|
prevNode = node;
|
|
57611
57546
|
node = node.parent;
|
|
57612
57547
|
}
|
|
57613
|
-
return
|
|
57548
|
+
return path6;
|
|
57614
57549
|
}
|
|
57615
57550
|
exports.buildJsonPath = buildJsonPath;
|
|
57616
57551
|
});
|
|
@@ -57669,10 +57604,10 @@ var require_getJsonPathForPosition = __commonJS((exports) => {
|
|
|
57669
57604
|
const node = findClosestScalar(ast, Math.min(lineMap[line] - 1, startOffset + character), line, lineMap);
|
|
57670
57605
|
if (!utils_1.isObject(node))
|
|
57671
57606
|
return;
|
|
57672
|
-
const
|
|
57673
|
-
if (
|
|
57607
|
+
const path6 = buildJsonPath_1.buildJsonPath(node);
|
|
57608
|
+
if (path6.length === 0)
|
|
57674
57609
|
return;
|
|
57675
|
-
return
|
|
57610
|
+
return path6;
|
|
57676
57611
|
};
|
|
57677
57612
|
function* walk(node) {
|
|
57678
57613
|
switch (node.kind) {
|
|
@@ -57793,8 +57728,8 @@ var require_getLocationForJsonPath = __commonJS((exports) => {
|
|
|
57793
57728
|
var lineForPosition_1 = require_lineForPosition();
|
|
57794
57729
|
var types_1 = require_types2();
|
|
57795
57730
|
var utils_1 = require_utils3();
|
|
57796
|
-
exports.getLocationForJsonPath = ({ ast, lineMap, metadata },
|
|
57797
|
-
const node = findNodeAtPath(ast,
|
|
57731
|
+
exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path6, closest = false) => {
|
|
57732
|
+
const node = findNodeAtPath(ast, path6, { closest, mergeKeys: metadata !== undefined && metadata.mergeKeys === true });
|
|
57798
57733
|
if (node === undefined)
|
|
57799
57734
|
return;
|
|
57800
57735
|
return getLoc(lineMap, {
|
|
@@ -57845,9 +57780,9 @@ var require_getLocationForJsonPath = __commonJS((exports) => {
|
|
|
57845
57780
|
}
|
|
57846
57781
|
return node.endPosition;
|
|
57847
57782
|
}
|
|
57848
|
-
function findNodeAtPath(node,
|
|
57783
|
+
function findNodeAtPath(node, path6, { closest, mergeKeys }) {
|
|
57849
57784
|
pathLoop:
|
|
57850
|
-
for (const segment of
|
|
57785
|
+
for (const segment of path6) {
|
|
57851
57786
|
if (!utils_1.isObject(node)) {
|
|
57852
57787
|
return closest ? node : undefined;
|
|
57853
57788
|
}
|
|
@@ -61787,14 +61722,14 @@ var require_yaml_validator = __commonJS((exports) => {
|
|
|
61787
61722
|
email: email_json_1.default
|
|
61788
61723
|
};
|
|
61789
61724
|
function getValidationTargetFromFilename(filePath) {
|
|
61790
|
-
const
|
|
61791
|
-
if (/[/\\]flow\.ya?ml$/.test(
|
|
61725
|
+
const path6 = filePath.toLowerCase();
|
|
61726
|
+
if (/[/\\]flow\.ya?ml$/.test(path6) || /^flow\.ya?ml$/.test(path6)) {
|
|
61792
61727
|
return { type: "flow" };
|
|
61793
61728
|
}
|
|
61794
|
-
if (/\.schedule\.ya?ml$/.test(
|
|
61729
|
+
if (/\.schedule\.ya?ml$/.test(path6)) {
|
|
61795
61730
|
return { type: "schedule" };
|
|
61796
61731
|
}
|
|
61797
|
-
const triggerMatch =
|
|
61732
|
+
const triggerMatch = path6.match(/\.(http|websocket|kafka|nats|postgres|mqtt|sqs|gcp|email)_trigger\.ya?ml$/);
|
|
61798
61733
|
if (triggerMatch) {
|
|
61799
61734
|
return {
|
|
61800
61735
|
type: "trigger",
|
|
@@ -61948,7 +61883,7 @@ function formatError(e) {
|
|
|
61948
61883
|
return String(e);
|
|
61949
61884
|
}
|
|
61950
61885
|
}
|
|
61951
|
-
async function applyExtraPermsDiff(workspace, kind,
|
|
61886
|
+
async function applyExtraPermsDiff(workspace, kind, path6, local, remote) {
|
|
61952
61887
|
if (local === undefined || local === null) {
|
|
61953
61888
|
return 0;
|
|
61954
61889
|
}
|
|
@@ -61976,13 +61911,13 @@ async function applyExtraPermsDiff(workspace, kind, path7, local, remote) {
|
|
|
61976
61911
|
await addGranularAcls({
|
|
61977
61912
|
workspace,
|
|
61978
61913
|
kind,
|
|
61979
|
-
path:
|
|
61914
|
+
path: path6,
|
|
61980
61915
|
requestBody: { owner, write }
|
|
61981
61916
|
});
|
|
61982
|
-
info(colors.green(` extra_perms: granted ${access} to ${owner} on ${kind}/${
|
|
61917
|
+
info(colors.green(` extra_perms: granted ${access} to ${owner} on ${kind}/${path6}`));
|
|
61983
61918
|
calls += 1;
|
|
61984
61919
|
} catch (e) {
|
|
61985
|
-
error(colors.red(` extra_perms: failed to grant ${access} to ${owner} on ${kind}/${
|
|
61920
|
+
error(colors.red(` extra_perms: failed to grant ${access} to ${owner} on ${kind}/${path6}: ${formatError(e)}`));
|
|
61986
61921
|
}
|
|
61987
61922
|
}
|
|
61988
61923
|
for (const owner of toRevoke) {
|
|
@@ -61990,13 +61925,13 @@ async function applyExtraPermsDiff(workspace, kind, path7, local, remote) {
|
|
|
61990
61925
|
await removeGranularAcls({
|
|
61991
61926
|
workspace,
|
|
61992
61927
|
kind,
|
|
61993
|
-
path:
|
|
61928
|
+
path: path6,
|
|
61994
61929
|
requestBody: { owner }
|
|
61995
61930
|
});
|
|
61996
|
-
info(colors.green(` extra_perms: revoked ${owner} on ${kind}/${
|
|
61931
|
+
info(colors.green(` extra_perms: revoked ${owner} on ${kind}/${path6}`));
|
|
61997
61932
|
calls += 1;
|
|
61998
61933
|
} catch (e) {
|
|
61999
|
-
error(colors.red(` extra_perms: failed to revoke ${owner} on ${kind}/${
|
|
61934
|
+
error(colors.red(` extra_perms: failed to revoke ${owner} on ${kind}/${path6}: ${formatError(e)}`));
|
|
62000
61935
|
}
|
|
62001
61936
|
}
|
|
62002
61937
|
return calls;
|
|
@@ -62021,20 +61956,20 @@ function getWorkspaceSpecificTypeKinds() {
|
|
|
62021
61956
|
...TRIGGER_TYPES.map((t) => `${t}_trigger`)
|
|
62022
61957
|
];
|
|
62023
61958
|
}
|
|
62024
|
-
function isTriggerFile(
|
|
62025
|
-
return TRIGGER_TYPES.some((type) =>
|
|
61959
|
+
function isTriggerFile(path6) {
|
|
61960
|
+
return TRIGGER_TYPES.some((type) => path6.endsWith(`.${type}_trigger.yaml`) || path6.endsWith(`.${type}_trigger.json`));
|
|
62026
61961
|
}
|
|
62027
|
-
function isScheduleFile(
|
|
62028
|
-
return
|
|
61962
|
+
function isScheduleFile(path6) {
|
|
61963
|
+
return path6.endsWith(".schedule.yaml") || path6.endsWith(".schedule.json");
|
|
62029
61964
|
}
|
|
62030
|
-
function getFileTypeSuffix(
|
|
61965
|
+
function getFileTypeSuffix(path6) {
|
|
62031
61966
|
for (const kind of getWorkspaceSpecificTypeKinds()) {
|
|
62032
|
-
if (
|
|
61967
|
+
if (path6.endsWith(`.${kind}.yaml`))
|
|
62033
61968
|
return `.${kind}.yaml`;
|
|
62034
|
-
if (
|
|
61969
|
+
if (path6.endsWith(`.${kind}.json`))
|
|
62035
61970
|
return `.${kind}.json`;
|
|
62036
61971
|
}
|
|
62037
|
-
const resourceFileMatch =
|
|
61972
|
+
const resourceFileMatch = path6.match(/(\.resource\.file\..+)$/);
|
|
62038
61973
|
if (resourceFileMatch) {
|
|
62039
61974
|
return resourceFileMatch[1];
|
|
62040
61975
|
}
|
|
@@ -62105,76 +62040,76 @@ function getSpecificItemsForCurrentBranch(config, workspaceNameOverride) {
|
|
|
62105
62040
|
}
|
|
62106
62041
|
return merged;
|
|
62107
62042
|
}
|
|
62108
|
-
function matchesPatterns(
|
|
62109
|
-
return patterns.some((pattern) => minimatch(
|
|
62043
|
+
function matchesPatterns(path6, patterns) {
|
|
62044
|
+
return patterns.some((pattern) => minimatch(path6, pattern));
|
|
62110
62045
|
}
|
|
62111
|
-
function normalizeJsonToYaml(
|
|
62112
|
-
return
|
|
62046
|
+
function normalizeJsonToYaml(path6) {
|
|
62047
|
+
return path6.endsWith(".json") ? path6.slice(0, -".json".length) + ".yaml" : path6;
|
|
62113
62048
|
}
|
|
62114
|
-
function isItemTypeConfigured(
|
|
62049
|
+
function isItemTypeConfigured(path6, specificItems) {
|
|
62115
62050
|
if (!specificItems) {
|
|
62116
62051
|
return false;
|
|
62117
62052
|
}
|
|
62118
|
-
|
|
62119
|
-
if (
|
|
62053
|
+
path6 = normalizeJsonToYaml(path6);
|
|
62054
|
+
if (path6.endsWith(".variable.yaml")) {
|
|
62120
62055
|
return specificItems.variables !== undefined;
|
|
62121
62056
|
}
|
|
62122
|
-
if (
|
|
62057
|
+
if (path6.endsWith(".resource.yaml")) {
|
|
62123
62058
|
return specificItems.resources !== undefined;
|
|
62124
62059
|
}
|
|
62125
|
-
if (isTriggerFile(
|
|
62060
|
+
if (isTriggerFile(path6)) {
|
|
62126
62061
|
return specificItems.triggers !== undefined;
|
|
62127
62062
|
}
|
|
62128
|
-
if (isScheduleFile(
|
|
62063
|
+
if (isScheduleFile(path6)) {
|
|
62129
62064
|
return specificItems.schedules !== undefined;
|
|
62130
62065
|
}
|
|
62131
|
-
if (
|
|
62066
|
+
if (path6.endsWith("/folder.meta.yaml")) {
|
|
62132
62067
|
return specificItems.folders !== undefined;
|
|
62133
62068
|
}
|
|
62134
|
-
if (
|
|
62069
|
+
if (path6 === "settings.yaml") {
|
|
62135
62070
|
return specificItems.settings !== undefined;
|
|
62136
62071
|
}
|
|
62137
|
-
if (isFileResource(
|
|
62072
|
+
if (isFileResource(path6) || isFilesetResource(path6)) {
|
|
62138
62073
|
return specificItems.resources !== undefined;
|
|
62139
62074
|
}
|
|
62140
62075
|
return false;
|
|
62141
62076
|
}
|
|
62142
|
-
function isSpecificItem(
|
|
62077
|
+
function isSpecificItem(path6, specificItems) {
|
|
62143
62078
|
if (!specificItems) {
|
|
62144
62079
|
return false;
|
|
62145
62080
|
}
|
|
62146
|
-
|
|
62147
|
-
if (
|
|
62148
|
-
return specificItems.variables ? matchesPatterns(
|
|
62081
|
+
path6 = normalizeJsonToYaml(path6);
|
|
62082
|
+
if (path6.endsWith(".variable.yaml")) {
|
|
62083
|
+
return specificItems.variables ? matchesPatterns(path6, specificItems.variables) : false;
|
|
62149
62084
|
}
|
|
62150
|
-
if (
|
|
62151
|
-
return specificItems.resources ? matchesPatterns(
|
|
62085
|
+
if (path6.endsWith(".resource.yaml")) {
|
|
62086
|
+
return specificItems.resources ? matchesPatterns(path6, specificItems.resources) : false;
|
|
62152
62087
|
}
|
|
62153
|
-
if (isTriggerFile(
|
|
62154
|
-
return specificItems.triggers ? matchesPatterns(
|
|
62088
|
+
if (isTriggerFile(path6)) {
|
|
62089
|
+
return specificItems.triggers ? matchesPatterns(path6, specificItems.triggers) : false;
|
|
62155
62090
|
}
|
|
62156
|
-
if (isScheduleFile(
|
|
62157
|
-
return specificItems.schedules ? matchesPatterns(
|
|
62091
|
+
if (isScheduleFile(path6)) {
|
|
62092
|
+
return specificItems.schedules ? matchesPatterns(path6, specificItems.schedules) : false;
|
|
62158
62093
|
}
|
|
62159
|
-
if (
|
|
62094
|
+
if (path6.endsWith("/folder.meta.yaml")) {
|
|
62160
62095
|
if (specificItems.folders) {
|
|
62161
|
-
const folderPath =
|
|
62096
|
+
const folderPath = path6.slice(0, -"/folder.meta.yaml".length);
|
|
62162
62097
|
return matchesPatterns(folderPath, specificItems.folders);
|
|
62163
62098
|
}
|
|
62164
62099
|
return false;
|
|
62165
62100
|
}
|
|
62166
|
-
if (
|
|
62101
|
+
if (path6 === "settings.yaml") {
|
|
62167
62102
|
return specificItems.settings === true;
|
|
62168
62103
|
}
|
|
62169
|
-
if (isFileResource(
|
|
62170
|
-
const basePathMatch =
|
|
62104
|
+
if (isFileResource(path6)) {
|
|
62105
|
+
const basePathMatch = path6.match(/^(.+?)\.resource\.file\./);
|
|
62171
62106
|
if (basePathMatch && specificItems.resources) {
|
|
62172
62107
|
const basePath = basePathMatch[1] + ".resource.yaml";
|
|
62173
62108
|
return matchesPatterns(basePath, specificItems.resources);
|
|
62174
62109
|
}
|
|
62175
62110
|
}
|
|
62176
|
-
if (isFilesetResource(
|
|
62177
|
-
const basePathMatch =
|
|
62111
|
+
if (isFilesetResource(path6)) {
|
|
62112
|
+
const basePathMatch = path6.match(/^(.+?)\.fileset[/\\]/);
|
|
62178
62113
|
if (basePathMatch && specificItems.resources) {
|
|
62179
62114
|
const basePath = basePathMatch[1] + ".resource.yaml";
|
|
62180
62115
|
return matchesPatterns(basePath, specificItems.resources);
|
|
@@ -62258,7 +62193,7 @@ function getWorkspaceSpecificPath(basePath, specificItems, workspaceNameOverride
|
|
|
62258
62193
|
}
|
|
62259
62194
|
return;
|
|
62260
62195
|
}
|
|
62261
|
-
function isCurrentWorkspaceFile(
|
|
62196
|
+
function isCurrentWorkspaceFile(path6, workspaceNameOverride) {
|
|
62262
62197
|
let currentWorkspace = null;
|
|
62263
62198
|
if (workspaceNameOverride) {
|
|
62264
62199
|
currentWorkspace = workspaceNameOverride;
|
|
@@ -62275,11 +62210,11 @@ function isCurrentWorkspaceFile(path7, workspaceNameOverride) {
|
|
|
62275
62210
|
pattern = new RegExp(`\\.${escapedName}\\.${buildItemTypePattern()}\\.(yaml|json)$|` + `\\.${escapedName}\\.resource\\.file\\..+$|` + `/folder\\.${escapedName}\\.meta\\.(yaml|json)$|` + `^settings\\.${escapedName}\\.(yaml|json)$`);
|
|
62276
62211
|
workspacePatternCache.set(currentWorkspace, pattern);
|
|
62277
62212
|
}
|
|
62278
|
-
return pattern.test(
|
|
62213
|
+
return pattern.test(path6);
|
|
62279
62214
|
}
|
|
62280
|
-
function isWorkspaceSpecificFile(
|
|
62215
|
+
function isWorkspaceSpecificFile(path6) {
|
|
62281
62216
|
const typePattern = buildItemTypePattern();
|
|
62282
|
-
return new RegExp(`\\.[^.]+\\.${typePattern}\\.(yaml|json)$|` + `\\.[^.]+\\.resource\\.file\\..+$|` + `/folder\\.[^.]+\\.meta\\.(yaml|json)$|` + `^settings\\.[^.]+\\.(yaml|json)$`).test(
|
|
62217
|
+
return new RegExp(`\\.[^.]+\\.${typePattern}\\.(yaml|json)$|` + `\\.[^.]+\\.resource\\.file\\..+$|` + `/folder\\.[^.]+\\.meta\\.(yaml|json)$|` + `^settings\\.[^.]+\\.(yaml|json)$`).test(path6);
|
|
62283
62218
|
}
|
|
62284
62219
|
var workspacePatternCache;
|
|
62285
62220
|
var init_specific_items = __esm(async () => {
|
|
@@ -62320,22 +62255,22 @@ __export(exports_dependency_tree, {
|
|
|
62320
62255
|
async function uploadScripts(tree, workspace) {
|
|
62321
62256
|
const scriptHashes = {};
|
|
62322
62257
|
const workspaceDeps = [];
|
|
62323
|
-
for (const
|
|
62324
|
-
const content = tree.getContent(
|
|
62325
|
-
const itemType = tree.getItemType(
|
|
62258
|
+
for (const path6 of tree.allPaths()) {
|
|
62259
|
+
const content = tree.getContent(path6);
|
|
62260
|
+
const itemType = tree.getItemType(path6);
|
|
62326
62261
|
if (itemType === "dependencies") {
|
|
62327
62262
|
if (content === undefined)
|
|
62328
62263
|
continue;
|
|
62329
|
-
const info2 = workspaceDependenciesPathToLanguageAndFilename(
|
|
62264
|
+
const info2 = workspaceDependenciesPathToLanguageAndFilename(path6);
|
|
62330
62265
|
if (info2) {
|
|
62331
62266
|
const hash2 = await generateHash(content);
|
|
62332
|
-
workspaceDeps.push({ path:
|
|
62267
|
+
workspaceDeps.push({ path: path6, language: info2.language, name: info2.name, hash: hash2 });
|
|
62333
62268
|
}
|
|
62334
62269
|
} else if (itemType === "script") {
|
|
62335
62270
|
if (!content)
|
|
62336
62271
|
continue;
|
|
62337
62272
|
const hash2 = await generateHash(content);
|
|
62338
|
-
scriptHashes[
|
|
62273
|
+
scriptHashes[path6] = hash2;
|
|
62339
62274
|
}
|
|
62340
62275
|
}
|
|
62341
62276
|
if (Object.keys(scriptHashes).length === 0 && workspaceDeps.length === 0)
|
|
@@ -62347,19 +62282,19 @@ async function uploadScripts(tree, workspace) {
|
|
|
62347
62282
|
workspace_deps: workspaceDeps
|
|
62348
62283
|
}
|
|
62349
62284
|
});
|
|
62350
|
-
for (const
|
|
62351
|
-
const content = tree.getContent(
|
|
62352
|
-
const itemType = tree.getItemType(
|
|
62285
|
+
for (const path6 of mismatched) {
|
|
62286
|
+
const content = tree.getContent(path6);
|
|
62287
|
+
const itemType = tree.getItemType(path6);
|
|
62353
62288
|
if (itemType === "dependencies") {
|
|
62354
62289
|
if (content !== undefined) {
|
|
62355
|
-
tree.setContentHash(
|
|
62290
|
+
tree.setContentHash(path6, "mismatched");
|
|
62356
62291
|
}
|
|
62357
62292
|
} else if (content) {
|
|
62358
62293
|
const hash2 = await storeRawScriptTemp({
|
|
62359
62294
|
workspace: workspace.workspaceId,
|
|
62360
62295
|
requestBody: content
|
|
62361
62296
|
});
|
|
62362
|
-
tree.setContentHash(
|
|
62297
|
+
tree.setContentHash(path6, hash2);
|
|
62363
62298
|
}
|
|
62364
62299
|
}
|
|
62365
62300
|
}
|
|
@@ -62370,12 +62305,12 @@ class DoubleLinkedDependencyTree {
|
|
|
62370
62305
|
setWorkspaceDeps(deps) {
|
|
62371
62306
|
this.workspaceDeps = deps;
|
|
62372
62307
|
}
|
|
62373
|
-
async addNode(
|
|
62308
|
+
async addNode(path6, content, language, metadata, imports, itemType, folder, originalPath, isDirectlyStale, isRawApp) {
|
|
62374
62309
|
const hasWorkspaceDeps = itemType === "script" || itemType === "inline_script";
|
|
62375
62310
|
const filteredDeps = hasWorkspaceDeps ? filterWorkspaceDependencies(this.workspaceDeps, content, language) : {};
|
|
62376
62311
|
const stalenessHash = await generateScriptHash({}, content, metadata);
|
|
62377
|
-
if (!this.nodes.has(
|
|
62378
|
-
this.nodes.set(
|
|
62312
|
+
if (!this.nodes.has(path6)) {
|
|
62313
|
+
this.nodes.set(path6, {
|
|
62379
62314
|
content: "",
|
|
62380
62315
|
stalenessHash: "",
|
|
62381
62316
|
language: "deno",
|
|
@@ -62388,7 +62323,7 @@ class DoubleLinkedDependencyTree {
|
|
|
62388
62323
|
isDirectlyStale: false
|
|
62389
62324
|
});
|
|
62390
62325
|
}
|
|
62391
|
-
const node = this.nodes.get(
|
|
62326
|
+
const node = this.nodes.get(path6);
|
|
62392
62327
|
node.content = content;
|
|
62393
62328
|
node.stalenessHash = stalenessHash;
|
|
62394
62329
|
node.language = language;
|
|
@@ -62435,59 +62370,59 @@ class DoubleLinkedDependencyTree {
|
|
|
62435
62370
|
isDirectlyStale: false
|
|
62436
62371
|
});
|
|
62437
62372
|
}
|
|
62438
|
-
this.nodes.get(importPath).importedBy.add(
|
|
62373
|
+
this.nodes.get(importPath).importedBy.add(path6);
|
|
62439
62374
|
}
|
|
62440
62375
|
}
|
|
62441
|
-
getContent(
|
|
62442
|
-
return this.nodes.get(
|
|
62376
|
+
getContent(path6) {
|
|
62377
|
+
return this.nodes.get(path6)?.content;
|
|
62443
62378
|
}
|
|
62444
|
-
getStalenessHash(
|
|
62445
|
-
return this.nodes.get(
|
|
62379
|
+
getStalenessHash(path6) {
|
|
62380
|
+
return this.nodes.get(path6)?.stalenessHash;
|
|
62446
62381
|
}
|
|
62447
|
-
getContentHash(
|
|
62448
|
-
return this.nodes.get(
|
|
62382
|
+
getContentHash(path6) {
|
|
62383
|
+
return this.nodes.get(path6)?.contentHash;
|
|
62449
62384
|
}
|
|
62450
|
-
setContentHash(
|
|
62451
|
-
const node = this.nodes.get(
|
|
62385
|
+
setContentHash(path6, hash2) {
|
|
62386
|
+
const node = this.nodes.get(path6);
|
|
62452
62387
|
if (node) {
|
|
62453
62388
|
node.contentHash = hash2;
|
|
62454
62389
|
}
|
|
62455
62390
|
}
|
|
62456
|
-
getLanguage(
|
|
62457
|
-
return this.nodes.get(
|
|
62391
|
+
getLanguage(path6) {
|
|
62392
|
+
return this.nodes.get(path6)?.language;
|
|
62458
62393
|
}
|
|
62459
|
-
getMetadata(
|
|
62460
|
-
return this.nodes.get(
|
|
62394
|
+
getMetadata(path6) {
|
|
62395
|
+
return this.nodes.get(path6)?.metadata;
|
|
62461
62396
|
}
|
|
62462
|
-
getStaleReason(
|
|
62463
|
-
return this.nodes.get(
|
|
62397
|
+
getStaleReason(path6) {
|
|
62398
|
+
return this.nodes.get(path6)?.staleReason;
|
|
62464
62399
|
}
|
|
62465
|
-
getItemType(
|
|
62466
|
-
return this.nodes.get(
|
|
62400
|
+
getItemType(path6) {
|
|
62401
|
+
return this.nodes.get(path6)?.itemType;
|
|
62467
62402
|
}
|
|
62468
|
-
getFolder(
|
|
62469
|
-
return this.nodes.get(
|
|
62403
|
+
getFolder(path6) {
|
|
62404
|
+
return this.nodes.get(path6)?.folder;
|
|
62470
62405
|
}
|
|
62471
|
-
getIsRawApp(
|
|
62472
|
-
return this.nodes.get(
|
|
62406
|
+
getIsRawApp(path6) {
|
|
62407
|
+
return this.nodes.get(path6)?.isRawApp;
|
|
62473
62408
|
}
|
|
62474
|
-
getIsDirectlyStale(
|
|
62475
|
-
return this.nodes.get(
|
|
62409
|
+
getIsDirectlyStale(path6) {
|
|
62410
|
+
return this.nodes.get(path6)?.isDirectlyStale ?? false;
|
|
62476
62411
|
}
|
|
62477
|
-
getOriginalPath(
|
|
62478
|
-
return this.nodes.get(
|
|
62412
|
+
getOriginalPath(path6) {
|
|
62413
|
+
return this.nodes.get(path6)?.originalPath;
|
|
62479
62414
|
}
|
|
62480
|
-
getImports(
|
|
62481
|
-
return this.nodes.get(
|
|
62415
|
+
getImports(path6) {
|
|
62416
|
+
return this.nodes.get(path6)?.imports;
|
|
62482
62417
|
}
|
|
62483
|
-
isStale(
|
|
62484
|
-
return this.nodes.get(
|
|
62418
|
+
isStale(path6) {
|
|
62419
|
+
return this.nodes.get(path6)?.staleReason !== undefined;
|
|
62485
62420
|
}
|
|
62486
62421
|
propagateStaleness() {
|
|
62487
62422
|
const directlyStale = new Set;
|
|
62488
|
-
for (const [
|
|
62423
|
+
for (const [path6, node] of this.nodes.entries()) {
|
|
62489
62424
|
if (node.isDirectlyStale) {
|
|
62490
|
-
directlyStale.add(
|
|
62425
|
+
directlyStale.add(path6);
|
|
62491
62426
|
node.staleReason = "content changed";
|
|
62492
62427
|
}
|
|
62493
62428
|
}
|
|
@@ -62539,20 +62474,20 @@ class DoubleLinkedDependencyTree {
|
|
|
62539
62474
|
return this.nodes.keys();
|
|
62540
62475
|
}
|
|
62541
62476
|
*stalePaths() {
|
|
62542
|
-
for (const [
|
|
62477
|
+
for (const [path6, node] of this.nodes.entries()) {
|
|
62543
62478
|
if (node.staleReason) {
|
|
62544
|
-
yield
|
|
62479
|
+
yield path6;
|
|
62545
62480
|
}
|
|
62546
62481
|
}
|
|
62547
62482
|
}
|
|
62548
|
-
has(
|
|
62549
|
-
return this.nodes.has(
|
|
62483
|
+
has(path6) {
|
|
62484
|
+
return this.nodes.has(path6);
|
|
62550
62485
|
}
|
|
62551
62486
|
getMismatchedWorkspaceDeps() {
|
|
62552
62487
|
const result = {};
|
|
62553
|
-
for (const [
|
|
62488
|
+
for (const [path6, node] of this.nodes.entries()) {
|
|
62554
62489
|
if (node.itemType === "dependencies" && node.contentHash && node.content !== undefined) {
|
|
62555
|
-
result[
|
|
62490
|
+
result[path6] = node.content;
|
|
62556
62491
|
}
|
|
62557
62492
|
}
|
|
62558
62493
|
return result;
|
|
@@ -62567,11 +62502,11 @@ class DoubleLinkedDependencyTree {
|
|
|
62567
62502
|
return result;
|
|
62568
62503
|
}
|
|
62569
62504
|
async persistDepsHashes(depsPaths) {
|
|
62570
|
-
for (const
|
|
62571
|
-
const node = this.nodes.get(
|
|
62505
|
+
for (const path6 of depsPaths) {
|
|
62506
|
+
const node = this.nodes.get(path6);
|
|
62572
62507
|
if (node?.itemType === "dependencies" && node.content !== undefined) {
|
|
62573
|
-
const hash2 = await generateHash(node.content +
|
|
62574
|
-
await updateMetadataGlobalLock(
|
|
62508
|
+
const hash2 = await generateHash(node.content + path6);
|
|
62509
|
+
await updateMetadataGlobalLock(path6, hash2);
|
|
62575
62510
|
}
|
|
62576
62511
|
}
|
|
62577
62512
|
}
|
|
@@ -62749,15 +62684,15 @@ var init_path_assigner = __esm(() => {
|
|
|
62749
62684
|
function extractRawscriptInline(id, summary, rawscript, mapping, separator, assigner, failOnInlineDirective) {
|
|
62750
62685
|
const [basePath, ext2] = assigner.assignPath(summary ?? id, rawscript.language);
|
|
62751
62686
|
const mappedPath = mapping[id];
|
|
62752
|
-
const
|
|
62687
|
+
const path6 = mappedPath ?? basePath + ext2;
|
|
62753
62688
|
const language = rawscript.language;
|
|
62754
62689
|
const content = rawscript.content;
|
|
62755
62690
|
if (failOnInlineDirective && typeof content === "string" && content.startsWith("!inline ")) {
|
|
62756
62691
|
throw new Error(`Refusing to extract corrupted inline script for module '${id}': ` + `rawscript.content is the literal string \`${content.split(`
|
|
62757
62692
|
`)[0]}\` ` + `instead of script source. The backend's flow_version.value is corrupt — ` + `re-push from a known-good local copy to repair it.`);
|
|
62758
62693
|
}
|
|
62759
|
-
const r = [{ path:
|
|
62760
|
-
rawscript.content = "!inline " +
|
|
62694
|
+
const r = [{ path: path6, content, language, is_lock: false }];
|
|
62695
|
+
rawscript.content = "!inline " + path6.replaceAll(separator, "/");
|
|
62761
62696
|
const lock = rawscript.lock;
|
|
62762
62697
|
if (lock && lock != "") {
|
|
62763
62698
|
const dotIdx = mappedPath ? mappedPath.lastIndexOf(".") : -1;
|
|
@@ -62844,23 +62779,23 @@ async function replaceRawscriptInline(id, rawscript, fileReader, logger, separat
|
|
|
62844
62779
|
if (!rawscript.content || !rawscript.content.startsWith("!inline")) {
|
|
62845
62780
|
return;
|
|
62846
62781
|
}
|
|
62847
|
-
const
|
|
62848
|
-
const pathSuffix =
|
|
62782
|
+
const path6 = rawscript.content.split(" ")[1];
|
|
62783
|
+
const pathSuffix = path6.split(".").slice(1).join(".");
|
|
62849
62784
|
const newPath = id + "." + pathSuffix;
|
|
62850
62785
|
try {
|
|
62851
|
-
rawscript.content = await fileReader(
|
|
62786
|
+
rawscript.content = await fileReader(path6);
|
|
62852
62787
|
} catch {
|
|
62853
|
-
logger.error(`Script file ${
|
|
62788
|
+
logger.error(`Script file ${path6} not found`);
|
|
62854
62789
|
try {
|
|
62855
62790
|
rawscript.content = await fileReader(newPath);
|
|
62856
62791
|
} catch {
|
|
62857
62792
|
logger.error(`Script file ${newPath} not found`);
|
|
62858
62793
|
if (missingFiles)
|
|
62859
|
-
missingFiles.push(
|
|
62794
|
+
missingFiles.push(path6);
|
|
62860
62795
|
}
|
|
62861
62796
|
}
|
|
62862
62797
|
const lock = rawscript.lock;
|
|
62863
|
-
if (removeLocks && removeLocks.includes(
|
|
62798
|
+
if (removeLocks && removeLocks.includes(path6)) {
|
|
62864
62799
|
rawscript.lock = undefined;
|
|
62865
62800
|
} else if (lock && typeof lock === "string" && lock.trimStart().startsWith("!inline ")) {
|
|
62866
62801
|
const lockPath = lock.split(" ")[1];
|
|
@@ -63016,7 +62951,7 @@ function collectPathScriptPaths(flowValue) {
|
|
|
63016
62951
|
}
|
|
63017
62952
|
|
|
63018
62953
|
// src/commands/flow/flow_metadata.ts
|
|
63019
|
-
import * as
|
|
62954
|
+
import * as path6 from "node:path";
|
|
63020
62955
|
import { sep as SEP4 } from "node:path";
|
|
63021
62956
|
async function isFlowDirectlyStale(folder, hashes, conf) {
|
|
63022
62957
|
if (await checkifMetadataUptodate(folder, hashes[TOP_HASH], conf, TOP_HASH)) {
|
|
@@ -63032,7 +62967,7 @@ async function isFlowDirectlyStale(folder, hashes, conf) {
|
|
|
63032
62967
|
return false;
|
|
63033
62968
|
}
|
|
63034
62969
|
async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
|
|
63035
|
-
const elems = await FSFSElement(
|
|
62970
|
+
const elems = await FSFSElement(path6.join(process.cwd(), folder), [], true);
|
|
63036
62971
|
const hashes = {};
|
|
63037
62972
|
for await (const f of elems.getChildren()) {
|
|
63038
62973
|
if (exts.some((e) => f.path.endsWith(e))) {
|
|
@@ -63080,7 +63015,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63080
63015
|
continue;
|
|
63081
63016
|
}
|
|
63082
63017
|
}
|
|
63083
|
-
const treePath = folderNormalized + "/" +
|
|
63018
|
+
const treePath = folderNormalized + "/" + path6.basename(script.path, path6.extname(script.path));
|
|
63084
63019
|
const language = script.language;
|
|
63085
63020
|
const imports = await extractRelativeImports(content, treePath, language);
|
|
63086
63021
|
await tree.addNode(treePath, content, language, "", imports, "inline_script", folderNormalized, folder, false);
|
|
@@ -63115,29 +63050,29 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63115
63050
|
const c = script.content;
|
|
63116
63051
|
if (c.startsWith("!inline ")) {
|
|
63117
63052
|
const fileName = c.replace("!inline ", "");
|
|
63118
|
-
const treePath = folderNormalized + "/" +
|
|
63053
|
+
const treePath = folderNormalized + "/" + path6.basename(script.path, path6.extname(script.path));
|
|
63119
63054
|
fileToTreePath.set(fileName, treePath);
|
|
63120
63055
|
}
|
|
63121
63056
|
}
|
|
63122
63057
|
if (!justUpdateMetadataLock) {
|
|
63123
63058
|
const hashes = await generateFlowHash(filteredDeps, folder, opts.defaultTs);
|
|
63124
|
-
for (const [
|
|
63125
|
-
if (
|
|
63059
|
+
for (const [path7, hash2] of Object.entries(hashes)) {
|
|
63060
|
+
if (path7 == TOP_HASH) {
|
|
63126
63061
|
continue;
|
|
63127
63062
|
}
|
|
63128
|
-
if (!await checkifMetadataUptodate(folder, hash2, conf,
|
|
63129
|
-
changedScripts.push(
|
|
63063
|
+
if (!await checkifMetadataUptodate(folder, hash2, conf, path7)) {
|
|
63064
|
+
changedScripts.push(path7);
|
|
63130
63065
|
}
|
|
63131
63066
|
}
|
|
63132
63067
|
if (!noStaleMessage) {
|
|
63133
63068
|
info(`Recomputing locks of ${changedScripts.join(", ")} in ${folder}`);
|
|
63134
63069
|
}
|
|
63135
|
-
const fileReader = async (
|
|
63070
|
+
const fileReader = async (path7) => await readTextFile(folder + SEP4 + path7);
|
|
63136
63071
|
const currentMapping = extractCurrentMapping(flowValue.value.modules, {}, flowValue.value.failure_module, flowValue.value.preprocessor_module);
|
|
63137
63072
|
const locksToRemove = tree ? Object.keys(hashes).filter((k) => {
|
|
63138
63073
|
if (k === TOP_HASH)
|
|
63139
63074
|
return false;
|
|
63140
|
-
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" +
|
|
63075
|
+
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path6.basename(k, path6.extname(k));
|
|
63141
63076
|
return tree.isStale(treePath);
|
|
63142
63077
|
}) : changedScripts;
|
|
63143
63078
|
const missingFiles = [];
|
|
@@ -63178,8 +63113,8 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63178
63113
|
const depsForHash = tree ? {} : filteredDeps;
|
|
63179
63114
|
const finalHashes = await generateFlowHash(depsForHash, folder, opts.defaultTs);
|
|
63180
63115
|
await clearGlobalLock(folder);
|
|
63181
|
-
for (const [
|
|
63182
|
-
await updateMetadataGlobalLock(folder, hash2,
|
|
63116
|
+
for (const [path7, hash2] of Object.entries(finalHashes)) {
|
|
63117
|
+
await updateMetadataGlobalLock(folder, hash2, path7);
|
|
63183
63118
|
}
|
|
63184
63119
|
if (!noStaleMessage) {
|
|
63185
63120
|
info(colors.green(`Flow ${remote_path} lockfiles updated`));
|
|
@@ -63187,7 +63122,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63187
63122
|
const relocked = tree ? Object.keys(finalHashes).filter((k) => {
|
|
63188
63123
|
if (k === TOP_HASH)
|
|
63189
63124
|
return false;
|
|
63190
|
-
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" +
|
|
63125
|
+
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path6.basename(k, path6.extname(k));
|
|
63191
63126
|
return tree.isStale(treePath);
|
|
63192
63127
|
}) : changedScripts;
|
|
63193
63128
|
const updatedScripts = relocked.map((p) => {
|
|
@@ -63711,8 +63646,8 @@ async function generateMetadata(opts, folder) {
|
|
|
63711
63646
|
info("");
|
|
63712
63647
|
if (errors.length > 0) {
|
|
63713
63648
|
info(`Done. Updated ${colors.bold(String(succeeded))}/${total} item(s). ${colors.red(String(errors.length) + " failed")}:`);
|
|
63714
|
-
for (const { path:
|
|
63715
|
-
error(` ${
|
|
63649
|
+
for (const { path: path7, error: error2 } of errors) {
|
|
63650
|
+
error(` ${path7}: ${error2}`);
|
|
63716
63651
|
}
|
|
63717
63652
|
process.exitCode = 1;
|
|
63718
63653
|
} else {
|
|
@@ -63756,9 +63691,9 @@ var init_generate_metadata = __esm(async () => {
|
|
|
63756
63691
|
import { writeFile as writeFile5, stat as stat4, mkdir as mkdir3 } from "node:fs/promises";
|
|
63757
63692
|
import { Buffer as Buffer4 } from "node:buffer";
|
|
63758
63693
|
import { sep as SEP6 } from "node:path";
|
|
63759
|
-
import * as
|
|
63694
|
+
import * as path7 from "node:path";
|
|
63760
63695
|
import fs8 from "node:fs";
|
|
63761
|
-
import { execSync as
|
|
63696
|
+
import { execSync as execSync4 } from "node:child_process";
|
|
63762
63697
|
function isRawAppBackendPath2(filePath) {
|
|
63763
63698
|
return isRawAppBackendPath(filePath);
|
|
63764
63699
|
}
|
|
@@ -63805,8 +63740,8 @@ async function push2(opts, filePath) {
|
|
|
63805
63740
|
await handleFile(filePath, workspace, [], opts.message, opts, await getRawWorkspaceDependencies(true), codebases);
|
|
63806
63741
|
info(colors.bold.underline.green(`Script ${filePath} pushed`));
|
|
63807
63742
|
}
|
|
63808
|
-
async function findResourceFile(
|
|
63809
|
-
const splitPath =
|
|
63743
|
+
async function findResourceFile(path8) {
|
|
63744
|
+
const splitPath = path8.split(".");
|
|
63810
63745
|
let contentBasePathJSON = splitPath[0] + "." + splitPath[1] + ".json";
|
|
63811
63746
|
let contentBasePathYAML = splitPath[0] + "." + splitPath[1] + ".yaml";
|
|
63812
63747
|
const currentBranch = getCurrentGitBranch();
|
|
@@ -63828,48 +63763,48 @@ async function findResourceFile(path9) {
|
|
|
63828
63763
|
throw new Error("Found two resource files for the same resource" + validCandidates.join(", "));
|
|
63829
63764
|
}
|
|
63830
63765
|
if (validCandidates.length < 1) {
|
|
63831
|
-
throw new Error(`No resource matching file resource: ${
|
|
63766
|
+
throw new Error(`No resource matching file resource: ${path8}.`);
|
|
63832
63767
|
}
|
|
63833
63768
|
return validCandidates[0];
|
|
63834
63769
|
}
|
|
63835
|
-
async function handleScriptMetadata(
|
|
63836
|
-
const isFlatMeta =
|
|
63837
|
-
const isFolderMeta = !isFlatMeta && isScriptModulePath(
|
|
63770
|
+
async function handleScriptMetadata(path8, workspace, alreadySynced, message, rawWorkspaceDependencies, codebases, opts, permissionedAsContext) {
|
|
63771
|
+
const isFlatMeta = path8.endsWith(".script.json") || path8.endsWith(".script.yaml") || path8.endsWith(".script.lock");
|
|
63772
|
+
const isFolderMeta = !isFlatMeta && isScriptModulePath(path8) && (path8.endsWith("/script.yaml") || path8.endsWith("/script.json") || path8.endsWith("/script.lock"));
|
|
63838
63773
|
if (isFlatMeta || isFolderMeta) {
|
|
63839
|
-
const contentPath = await findContentFile(
|
|
63774
|
+
const contentPath = await findContentFile(path8);
|
|
63840
63775
|
return handleFile(contentPath, workspace, alreadySynced, message, opts, rawWorkspaceDependencies, codebases, permissionedAsContext);
|
|
63841
63776
|
} else {
|
|
63842
63777
|
return false;
|
|
63843
63778
|
}
|
|
63844
63779
|
}
|
|
63845
|
-
async function handleFile(
|
|
63846
|
-
const moduleEntryPoint = isModuleEntryPoint(
|
|
63847
|
-
if (!isAppInlineScriptPath2(
|
|
63848
|
-
if (alreadySynced.includes(
|
|
63780
|
+
async function handleFile(path8, workspace, alreadySynced, message, opts, rawWorkspaceDependencies, codebases, permissionedAsContext) {
|
|
63781
|
+
const moduleEntryPoint = isModuleEntryPoint(path8);
|
|
63782
|
+
if (!isAppInlineScriptPath2(path8) && !isFlowInlineScriptPath2(path8) && !isRawAppBackendPath2(path8) && (!isScriptModulePath(path8) || moduleEntryPoint) && exts.some((exts2) => path8.endsWith(exts2))) {
|
|
63783
|
+
if (alreadySynced.includes(path8)) {
|
|
63849
63784
|
return true;
|
|
63850
63785
|
}
|
|
63851
|
-
debug(`Processing local script ${
|
|
63852
|
-
alreadySynced.push(
|
|
63853
|
-
const remotePath = scriptPathToRemotePath(
|
|
63854
|
-
const language = inferContentTypeFromFilePath(
|
|
63855
|
-
const codebase = language == "bun" ? findCodebase(
|
|
63786
|
+
debug(`Processing local script ${path8}`);
|
|
63787
|
+
alreadySynced.push(path8);
|
|
63788
|
+
const remotePath = scriptPathToRemotePath(path8);
|
|
63789
|
+
const language = inferContentTypeFromFilePath(path8, opts?.defaultTs);
|
|
63790
|
+
const codebase = language == "bun" ? findCodebase(path8, codebases) : undefined;
|
|
63856
63791
|
let bundleContent = undefined;
|
|
63857
63792
|
let forceTar = false;
|
|
63858
63793
|
if (codebase) {
|
|
63859
63794
|
let outputFiles = [];
|
|
63860
63795
|
if (codebase.customBundler) {
|
|
63861
|
-
info(`Using custom bundler ${codebase.customBundler} for ${
|
|
63862
|
-
bundleContent =
|
|
63796
|
+
info(`Using custom bundler ${codebase.customBundler} for ${path8}`);
|
|
63797
|
+
bundleContent = execSync4(codebase.customBundler + " " + path8, {
|
|
63863
63798
|
maxBuffer: 1024 * 1024 * 50
|
|
63864
63799
|
}).toString();
|
|
63865
|
-
info("Custom bundler executed for " +
|
|
63800
|
+
info("Custom bundler executed for " + path8);
|
|
63866
63801
|
} else {
|
|
63867
63802
|
const esbuild = await import("esbuild");
|
|
63868
|
-
info(`Started bundling ${
|
|
63803
|
+
info(`Started bundling ${path8} ...`);
|
|
63869
63804
|
const startTime = performance.now();
|
|
63870
63805
|
const format6 = codebase.format ?? "cjs";
|
|
63871
63806
|
const out = await esbuild.build({
|
|
63872
|
-
entryPoints: [
|
|
63807
|
+
entryPoints: [path8],
|
|
63873
63808
|
format: format6,
|
|
63874
63809
|
bundle: true,
|
|
63875
63810
|
write: false,
|
|
@@ -63887,15 +63822,15 @@ async function handleFile(path9, workspace, alreadySynced, message, opts, rawWor
|
|
|
63887
63822
|
bundleContent = out.outputFiles[0].text;
|
|
63888
63823
|
outputFiles = out.outputFiles ?? [];
|
|
63889
63824
|
if (outputFiles.length == 0) {
|
|
63890
|
-
throw new Error(`No output files found for ${
|
|
63825
|
+
throw new Error(`No output files found for ${path8}`);
|
|
63891
63826
|
}
|
|
63892
|
-
info(`Finished bundling ${
|
|
63827
|
+
info(`Finished bundling ${path8}: ${(bundleContent.length / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
|
|
63893
63828
|
}
|
|
63894
63829
|
if (outputFiles.length > 1) {
|
|
63895
|
-
info(`Found multiple output files for ${
|
|
63830
|
+
info(`Found multiple output files for ${path8}, creating a tarball... ${outputFiles.map((file) => file.path).join(", ")}`);
|
|
63896
63831
|
forceTar = true;
|
|
63897
63832
|
const startTime = performance.now();
|
|
63898
|
-
const mainPath =
|
|
63833
|
+
const mainPath = path8.split(SEP6).pop()?.split(".")[0] + ".js";
|
|
63899
63834
|
const mainContent = outputFiles.find((file) => file.path == "/" + mainPath)?.text ?? "";
|
|
63900
63835
|
info(`Main content: ${mainContent.length}chars`);
|
|
63901
63836
|
const entries = [
|
|
@@ -63910,10 +63845,10 @@ async function handleFile(path9, workspace, alreadySynced, message, opts, rawWor
|
|
|
63910
63845
|
}
|
|
63911
63846
|
bundleContent = await createTarBlob(entries);
|
|
63912
63847
|
const endTime = performance.now();
|
|
63913
|
-
info(`Finished creating tarball for ${
|
|
63848
|
+
info(`Finished creating tarball for ${path8}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
|
|
63914
63849
|
} else {
|
|
63915
63850
|
if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {
|
|
63916
|
-
info(`Using the following asset configuration for ${
|
|
63851
|
+
info(`Using the following asset configuration for ${path8}: ${JSON.stringify(codebase.assets)}`);
|
|
63917
63852
|
const startTime = performance.now();
|
|
63918
63853
|
const entries = [
|
|
63919
63854
|
{ name: "main.js", content: bundleContent }
|
|
@@ -63924,13 +63859,13 @@ async function handleFile(path9, workspace, alreadySynced, message, opts, rawWor
|
|
|
63924
63859
|
}
|
|
63925
63860
|
bundleContent = await createTarBlob(entries);
|
|
63926
63861
|
const endTime = performance.now();
|
|
63927
|
-
info(`Finished creating tarball for ${
|
|
63862
|
+
info(`Finished creating tarball for ${path8}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
|
|
63928
63863
|
}
|
|
63929
63864
|
}
|
|
63930
63865
|
}
|
|
63931
63866
|
let typed = opts?.skipScriptsMetadata ? undefined : (await parseMetadataFile(remotePath, opts ? {
|
|
63932
63867
|
...opts,
|
|
63933
|
-
path:
|
|
63868
|
+
path: path8,
|
|
63934
63869
|
workspaceRemote: workspace,
|
|
63935
63870
|
schemaOnly: codebase ? true : undefined,
|
|
63936
63871
|
rawWorkspaceDependencies,
|
|
@@ -63947,14 +63882,14 @@ async function handleFile(path9, workspace, alreadySynced, message, opts, rawWor
|
|
|
63947
63882
|
} catch {
|
|
63948
63883
|
debug(`Script ${remotePath} does not exist on remote`);
|
|
63949
63884
|
}
|
|
63950
|
-
const content = await readTextFile(
|
|
63885
|
+
const content = await readTextFile(path8);
|
|
63951
63886
|
if (opts?.skipScriptsMetadata) {
|
|
63952
63887
|
typed = structuredClone(remote);
|
|
63953
63888
|
}
|
|
63954
63889
|
if (typed && codebase) {
|
|
63955
63890
|
typed.codebase = await codebase.getDigest(forceTar);
|
|
63956
63891
|
}
|
|
63957
|
-
const scriptBasePath = moduleEntryPoint ? getScriptBasePathFromModulePath(
|
|
63892
|
+
const scriptBasePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path8) : path8.substring(0, path8.indexOf("."));
|
|
63958
63893
|
const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
|
|
63959
63894
|
const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, moduleEntryPoint);
|
|
63960
63895
|
const requestBodyCommon = {
|
|
@@ -64040,7 +63975,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
|
|
|
64040
63975
|
function readDir2(dirPath, relPrefix) {
|
|
64041
63976
|
const entries = fs8.readdirSync(dirPath, { withFileTypes: true });
|
|
64042
63977
|
for (const entry of entries) {
|
|
64043
|
-
const fullPath =
|
|
63978
|
+
const fullPath = path7.join(dirPath, entry.name);
|
|
64044
63979
|
const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
|
|
64045
63980
|
const isTopLevel = relPrefix === "";
|
|
64046
63981
|
if (entry.isDirectory()) {
|
|
@@ -64050,7 +63985,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
|
|
|
64050
63985
|
const content = readTextFileSync(fullPath);
|
|
64051
63986
|
const language = inferContentTypeFromFilePath(entry.name, defaultTs);
|
|
64052
63987
|
const baseName = entry.name.replace(/\.[^.]+$/, "");
|
|
64053
|
-
const lockPath =
|
|
63988
|
+
const lockPath = path7.join(dirPath, baseName + ".lock");
|
|
64054
63989
|
let lock;
|
|
64055
63990
|
if (fs8.existsSync(lockPath)) {
|
|
64056
63991
|
lock = readTextFileSync(lockPath);
|
|
@@ -64192,13 +64127,13 @@ function filePathExtensionFromContentType(language, defaultTs) {
|
|
|
64192
64127
|
throw new Error("Invalid language: " + language);
|
|
64193
64128
|
}
|
|
64194
64129
|
}
|
|
64195
|
-
function removeExtensionToPath(
|
|
64130
|
+
function removeExtensionToPath(path8) {
|
|
64196
64131
|
for (const ext2 of exts) {
|
|
64197
|
-
if (
|
|
64198
|
-
return
|
|
64132
|
+
if (path8.endsWith(ext2)) {
|
|
64133
|
+
return path8.substring(0, path8.length - ext2.length);
|
|
64199
64134
|
}
|
|
64200
64135
|
}
|
|
64201
|
-
throw new Error("Invalid extension: " +
|
|
64136
|
+
throw new Error("Invalid extension: " + path8);
|
|
64202
64137
|
}
|
|
64203
64138
|
async function list4(opts) {
|
|
64204
64139
|
if (opts.json)
|
|
@@ -64249,7 +64184,7 @@ async function resolve6(input) {
|
|
|
64249
64184
|
throw e;
|
|
64250
64185
|
}
|
|
64251
64186
|
}
|
|
64252
|
-
async function run2(opts,
|
|
64187
|
+
async function run2(opts, path8) {
|
|
64253
64188
|
if (opts.silent) {
|
|
64254
64189
|
setSilent(true);
|
|
64255
64190
|
}
|
|
@@ -64260,7 +64195,7 @@ async function run2(opts, path9) {
|
|
|
64260
64195
|
try {
|
|
64261
64196
|
const script = await getScriptByPath({
|
|
64262
64197
|
workspace: workspace.workspaceId,
|
|
64263
|
-
path:
|
|
64198
|
+
path: path8
|
|
64264
64199
|
});
|
|
64265
64200
|
validateRequiredArgs(script.schema);
|
|
64266
64201
|
} catch (e) {
|
|
@@ -64273,7 +64208,7 @@ async function run2(opts, path9) {
|
|
|
64273
64208
|
try {
|
|
64274
64209
|
id = await runScriptByPath({
|
|
64275
64210
|
workspace: workspace.workspaceId,
|
|
64276
|
-
path:
|
|
64211
|
+
path: path8,
|
|
64277
64212
|
requestBody: input
|
|
64278
64213
|
});
|
|
64279
64214
|
} catch (e) {
|
|
@@ -64281,10 +64216,10 @@ async function run2(opts, path9) {
|
|
|
64281
64216
|
try {
|
|
64282
64217
|
const script = await getScriptByPath({
|
|
64283
64218
|
workspace: workspace.workspaceId,
|
|
64284
|
-
path:
|
|
64219
|
+
path: path8
|
|
64285
64220
|
});
|
|
64286
64221
|
if (script.lock_error_logs) {
|
|
64287
|
-
throw new Error(`Script '${
|
|
64222
|
+
throw new Error(`Script '${path8}' has a deployment error and cannot be run:
|
|
64288
64223
|
${script.lock_error_logs}`);
|
|
64289
64224
|
}
|
|
64290
64225
|
} catch (lookupErr) {
|
|
@@ -64293,7 +64228,7 @@ ${script.lock_error_logs}`);
|
|
|
64293
64228
|
if (lookupErr?.status && lookupErr.status !== 404)
|
|
64294
64229
|
throw lookupErr;
|
|
64295
64230
|
}
|
|
64296
|
-
throw new Error(`Script '${
|
|
64231
|
+
throw new Error(`Script '${path8}' not found. Run 'wmill script list' to see available scripts.`);
|
|
64297
64232
|
}
|
|
64298
64233
|
throw e;
|
|
64299
64234
|
}
|
|
@@ -64399,12 +64334,12 @@ async function track_job(workspace, id) {
|
|
|
64399
64334
|
async function pollForJobResult(workspace, jobId) {
|
|
64400
64335
|
return await pollJobWithQueueLogging(workspace, jobId);
|
|
64401
64336
|
}
|
|
64402
|
-
async function show(opts,
|
|
64337
|
+
async function show(opts, path8) {
|
|
64403
64338
|
const workspace = await resolveWorkspace(opts);
|
|
64404
64339
|
await requireLogin(opts);
|
|
64405
64340
|
const s = await getScriptByPath({
|
|
64406
64341
|
workspace: workspace.workspaceId,
|
|
64407
|
-
path:
|
|
64342
|
+
path: path8
|
|
64408
64343
|
});
|
|
64409
64344
|
info(colors.underline(s.path));
|
|
64410
64345
|
if (s.description)
|
|
@@ -64412,14 +64347,14 @@ async function show(opts, path9) {
|
|
|
64412
64347
|
info("");
|
|
64413
64348
|
info(s.content);
|
|
64414
64349
|
}
|
|
64415
|
-
async function get2(opts,
|
|
64350
|
+
async function get2(opts, path8) {
|
|
64416
64351
|
if (opts.json)
|
|
64417
64352
|
setSilent(true);
|
|
64418
64353
|
const workspace = await resolveWorkspace(opts);
|
|
64419
64354
|
await requireLogin(opts);
|
|
64420
64355
|
const s = await getScriptByPath({
|
|
64421
64356
|
workspace: workspace.workspaceId,
|
|
64422
|
-
path:
|
|
64357
|
+
path: path8
|
|
64423
64358
|
});
|
|
64424
64359
|
if (opts.json) {
|
|
64425
64360
|
console.log(JSON.stringify(s));
|
|
@@ -64469,7 +64404,7 @@ async function bootstrap(opts, scriptPath, language) {
|
|
|
64469
64404
|
scriptMetadata.description = opts.description;
|
|
64470
64405
|
}
|
|
64471
64406
|
const scriptInitialMetadataYaml = import_yaml8.stringify(scriptMetadata, yamlOptions);
|
|
64472
|
-
const parentDir =
|
|
64407
|
+
const parentDir = path7.dirname(scriptCodeFileFullPath);
|
|
64473
64408
|
await mkdir3(parentDir, { recursive: true });
|
|
64474
64409
|
await writeFile5(scriptCodeFileFullPath, scriptInitialCode, {
|
|
64475
64410
|
flag: "wx",
|
|
@@ -64564,7 +64499,7 @@ async function preview(opts, filePath) {
|
|
|
64564
64499
|
const content = await readTextFile(filePath);
|
|
64565
64500
|
const input = opts.data ? await resolve6(opts.data) : {};
|
|
64566
64501
|
const isFolderLayout = isModuleEntryPoint(filePath);
|
|
64567
|
-
const moduleFolderPath = isFolderLayout ?
|
|
64502
|
+
const moduleFolderPath = isFolderLayout ? path7.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix();
|
|
64568
64503
|
const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, isFolderLayout);
|
|
64569
64504
|
const codebase = language == "bun" ? findCodebase(filePath, codebases) : undefined;
|
|
64570
64505
|
let tempScriptRefs = undefined;
|
|
@@ -64581,7 +64516,7 @@ async function preview(opts, filePath) {
|
|
|
64581
64516
|
if (!opts.silent) {
|
|
64582
64517
|
info(`Using custom bundler ${codebase.customBundler} for preview`);
|
|
64583
64518
|
}
|
|
64584
|
-
bundledContent =
|
|
64519
|
+
bundledContent = execSync4(codebase.customBundler + " " + filePath, {
|
|
64585
64520
|
maxBuffer: 52428800
|
|
64586
64521
|
}).toString();
|
|
64587
64522
|
} else {
|
|
@@ -64840,8 +64775,8 @@ var init_script = __esm(async () => {
|
|
|
64840
64775
|
|
|
64841
64776
|
// src/commands/lint/lint.ts
|
|
64842
64777
|
import { stat as stat5, readdir as readdir2 } from "node:fs/promises";
|
|
64843
|
-
import
|
|
64844
|
-
import * as
|
|
64778
|
+
import process13 from "node:process";
|
|
64779
|
+
import * as path8 from "node:path";
|
|
64845
64780
|
import { sep as SEP7 } from "node:path";
|
|
64846
64781
|
function normalizePath(p) {
|
|
64847
64782
|
return p.replaceAll(SEP7, "/");
|
|
@@ -64900,7 +64835,7 @@ async function isLockResolved(lockValue, baseDir) {
|
|
|
64900
64835
|
return true;
|
|
64901
64836
|
}
|
|
64902
64837
|
async function checkInlineFile(relativePath, baseDir) {
|
|
64903
|
-
const fullPath =
|
|
64838
|
+
const fullPath = path8.join(baseDir, relativePath.trim());
|
|
64904
64839
|
try {
|
|
64905
64840
|
const s = await stat5(fullPath);
|
|
64906
64841
|
return s.size > 0;
|
|
@@ -64990,7 +64925,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
|
|
|
64990
64925
|
continue;
|
|
64991
64926
|
const runnableId = fileName.replace(".yaml", "");
|
|
64992
64927
|
processedIds.add(runnableId);
|
|
64993
|
-
const filePath =
|
|
64928
|
+
const filePath = path8.join(backendDir, fileName);
|
|
64994
64929
|
let runnable;
|
|
64995
64930
|
try {
|
|
64996
64931
|
runnable = await yamlParseFile(filePath);
|
|
@@ -65008,7 +64943,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
|
|
|
65008
64943
|
}
|
|
65009
64944
|
if (!language || !languageNeedsLock(language))
|
|
65010
64945
|
continue;
|
|
65011
|
-
const lockFile =
|
|
64946
|
+
const lockFile = path8.join(backendDir, `${runnableId}.lock`);
|
|
65012
64947
|
let hasLock = false;
|
|
65013
64948
|
try {
|
|
65014
64949
|
const s = await stat5(lockFile);
|
|
@@ -65055,7 +64990,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
|
|
|
65055
64990
|
}
|
|
65056
64991
|
if (!languageNeedsLock(language))
|
|
65057
64992
|
continue;
|
|
65058
|
-
const lockFile =
|
|
64993
|
+
const lockFile = path8.join(backendDir, `${runnableId}.lock`);
|
|
65059
64994
|
let hasLock = false;
|
|
65060
64995
|
try {
|
|
65061
64996
|
const s = await stat5(lockFile);
|
|
@@ -65074,8 +65009,8 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
|
|
|
65074
65009
|
return issues;
|
|
65075
65010
|
}
|
|
65076
65011
|
async function checkMissingLocks(opts, directory) {
|
|
65077
|
-
const initialCwd =
|
|
65078
|
-
const targetDirectory = directory ?
|
|
65012
|
+
const initialCwd = process13.cwd();
|
|
65013
|
+
const targetDirectory = directory ? path8.resolve(initialCwd, directory) : process13.cwd();
|
|
65079
65014
|
const { ...syncOpts } = opts;
|
|
65080
65015
|
const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
|
|
65081
65016
|
const ignore = await ignoreF(mergedOpts);
|
|
@@ -65099,19 +65034,19 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65099
65034
|
if (normalizedPath.endsWith("/flow.yaml") && normalizedPath.includes(flowSuffix + "/")) {
|
|
65100
65035
|
flowYamls.push({
|
|
65101
65036
|
normalizedPath,
|
|
65102
|
-
fullPath:
|
|
65037
|
+
fullPath: path8.join(targetDirectory, entry.path)
|
|
65103
65038
|
});
|
|
65104
65039
|
}
|
|
65105
65040
|
if (normalizedPath.endsWith("/app.yaml") && normalizedPath.includes(appSuffix + "/")) {
|
|
65106
65041
|
appYamls.push({
|
|
65107
65042
|
normalizedPath,
|
|
65108
|
-
fullPath:
|
|
65043
|
+
fullPath: path8.join(targetDirectory, entry.path)
|
|
65109
65044
|
});
|
|
65110
65045
|
}
|
|
65111
65046
|
if (normalizedPath.endsWith("/raw_app.yaml") && normalizedPath.includes(rawAppSuffix + "/")) {
|
|
65112
65047
|
rawAppYamls.push({
|
|
65113
65048
|
normalizedPath,
|
|
65114
|
-
fullPath:
|
|
65049
|
+
fullPath: path8.join(targetDirectory, entry.path)
|
|
65115
65050
|
});
|
|
65116
65051
|
}
|
|
65117
65052
|
}
|
|
@@ -65120,14 +65055,14 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65120
65055
|
let language = null;
|
|
65121
65056
|
for (const ext2 of exts) {
|
|
65122
65057
|
try {
|
|
65123
|
-
await stat5(
|
|
65058
|
+
await stat5(path8.join(targetDirectory, basePath + ext2));
|
|
65124
65059
|
language = inferContentTypeFromFilePath(basePath + ext2, defaultTs);
|
|
65125
65060
|
break;
|
|
65126
65061
|
} catch {}
|
|
65127
65062
|
}
|
|
65128
65063
|
if (language && languageNeedsLock(language)) {
|
|
65129
65064
|
try {
|
|
65130
|
-
const metadata = await yamlParseFile(
|
|
65065
|
+
const metadata = await yamlParseFile(path8.join(targetDirectory, yamlPath));
|
|
65131
65066
|
const lockResolved = await isLockResolved(metadata?.lock, targetDirectory);
|
|
65132
65067
|
if (!lockResolved) {
|
|
65133
65068
|
issues.push({
|
|
@@ -65144,7 +65079,7 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65144
65079
|
}
|
|
65145
65080
|
}
|
|
65146
65081
|
for (const { normalizedPath: flowYamlPath, fullPath } of flowYamls) {
|
|
65147
|
-
const flowDir =
|
|
65082
|
+
const flowDir = path8.dirname(fullPath);
|
|
65148
65083
|
try {
|
|
65149
65084
|
const flowFile = await yamlParseFile(fullPath);
|
|
65150
65085
|
if (!flowFile?.value?.modules)
|
|
@@ -65169,7 +65104,7 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65169
65104
|
}
|
|
65170
65105
|
}
|
|
65171
65106
|
for (const { normalizedPath: appYamlPath, fullPath } of appYamls) {
|
|
65172
|
-
const appDir =
|
|
65107
|
+
const appDir = path8.dirname(fullPath);
|
|
65173
65108
|
try {
|
|
65174
65109
|
const appFile = await yamlParseFile(fullPath);
|
|
65175
65110
|
if (!appFile?.value)
|
|
@@ -65194,8 +65129,8 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65194
65129
|
}
|
|
65195
65130
|
}
|
|
65196
65131
|
for (const { normalizedPath: rawAppYamlPath, fullPath } of rawAppYamls) {
|
|
65197
|
-
const rawAppDir =
|
|
65198
|
-
const backendDir =
|
|
65132
|
+
const rawAppDir = path8.dirname(fullPath);
|
|
65133
|
+
const backendDir = path8.join(rawAppDir, "backend");
|
|
65199
65134
|
try {
|
|
65200
65135
|
await stat5(backendDir);
|
|
65201
65136
|
} catch {
|
|
@@ -65211,11 +65146,11 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65211
65146
|
return issues;
|
|
65212
65147
|
}
|
|
65213
65148
|
async function runLint(opts, directory) {
|
|
65214
|
-
const initialCwd =
|
|
65215
|
-
const explicitTargetDirectory = directory ?
|
|
65149
|
+
const initialCwd = process13.cwd();
|
|
65150
|
+
const explicitTargetDirectory = directory ? path8.resolve(initialCwd, directory) : undefined;
|
|
65216
65151
|
const { json: _json, ...syncOpts } = opts;
|
|
65217
65152
|
const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
|
|
65218
|
-
const targetDirectory = explicitTargetDirectory ??
|
|
65153
|
+
const targetDirectory = explicitTargetDirectory ?? process13.cwd();
|
|
65219
65154
|
const stats = await stat5(targetDirectory).catch(() => null);
|
|
65220
65155
|
if (!stats) {
|
|
65221
65156
|
throw new Error(`Directory not found: ${targetDirectory}`);
|
|
@@ -65223,7 +65158,7 @@ async function runLint(opts, directory) {
|
|
|
65223
65158
|
if (!stats.isDirectory()) {
|
|
65224
65159
|
throw new Error(`Path is not a directory: ${targetDirectory}`);
|
|
65225
65160
|
}
|
|
65226
|
-
const isSubdirectory = explicitTargetDirectory && !await stat5(
|
|
65161
|
+
const isSubdirectory = explicitTargetDirectory && !await stat5(path8.join(targetDirectory, "wmill.yaml")).catch(() => null);
|
|
65227
65162
|
const ignore = isSubdirectory ? (_p, _isDir) => false : await ignoreF(mergedOpts);
|
|
65228
65163
|
const root = await FSFSElement(targetDirectory, [], false);
|
|
65229
65164
|
const validator = new import_windmill_yaml_validator.WindmillYamlValidator;
|
|
@@ -65330,7 +65265,7 @@ async function lint(opts, directory) {
|
|
|
65330
65265
|
const report = await runLint(opts, directory);
|
|
65331
65266
|
printReport(report, !!opts.json);
|
|
65332
65267
|
if (report.exitCode !== 0) {
|
|
65333
|
-
|
|
65268
|
+
process13.exit(report.exitCode);
|
|
65334
65269
|
}
|
|
65335
65270
|
} catch (error2) {
|
|
65336
65271
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
@@ -65343,17 +65278,17 @@ async function lint(opts, directory) {
|
|
|
65343
65278
|
} else {
|
|
65344
65279
|
error(colors.red(`❌ ${message}`));
|
|
65345
65280
|
}
|
|
65346
|
-
|
|
65281
|
+
process13.exit(1);
|
|
65347
65282
|
}
|
|
65348
65283
|
}
|
|
65349
65284
|
async function lintWatch(opts, directory) {
|
|
65350
65285
|
const { watch } = await import("node:fs");
|
|
65351
|
-
const targetDir = directory ?
|
|
65286
|
+
const targetDir = directory ? path8.resolve(process13.cwd(), directory) : process13.cwd();
|
|
65352
65287
|
info(colors.blue(`Watching ${targetDir} for changes... (Ctrl+C to stop)`));
|
|
65353
65288
|
async function runAndReport() {
|
|
65354
65289
|
try {
|
|
65355
65290
|
const report = await runLint(opts, directory);
|
|
65356
|
-
|
|
65291
|
+
process13.stdout.write("\x1Bc");
|
|
65357
65292
|
info(colors.gray(`[${new Date().toLocaleTimeString()}] Lint results:
|
|
65358
65293
|
`));
|
|
65359
65294
|
printReport(report, false);
|
|
@@ -65394,13 +65329,13 @@ var init_lint = __esm(async () => {
|
|
|
65394
65329
|
|
|
65395
65330
|
// src/commands/shared_ui.ts
|
|
65396
65331
|
import * as fs9 from "node:fs";
|
|
65397
|
-
import * as
|
|
65332
|
+
import * as path9 from "node:path";
|
|
65398
65333
|
async function readDirRecursive(dir, rel = "", out = {}) {
|
|
65399
65334
|
if (!fs9.existsSync(dir))
|
|
65400
65335
|
return out;
|
|
65401
65336
|
const entries = await fs9.promises.readdir(dir, { withFileTypes: true });
|
|
65402
65337
|
for (const entry of entries) {
|
|
65403
|
-
const full =
|
|
65338
|
+
const full = path9.join(dir, entry.name);
|
|
65404
65339
|
const r = rel ? rel + "/" + entry.name : entry.name;
|
|
65405
65340
|
if (entry.isDirectory()) {
|
|
65406
65341
|
await readDirRecursive(full, r, out);
|
|
@@ -65411,7 +65346,7 @@ async function readDirRecursive(dir, rel = "", out = {}) {
|
|
|
65411
65346
|
return out;
|
|
65412
65347
|
}
|
|
65413
65348
|
async function pushSharedUi(workspace) {
|
|
65414
|
-
const localDir =
|
|
65349
|
+
const localDir = path9.join(process.cwd(), SHARED_UI_DIR);
|
|
65415
65350
|
if (!fs9.existsSync(localDir)) {
|
|
65416
65351
|
return false;
|
|
65417
65352
|
}
|
|
@@ -65433,7 +65368,7 @@ async function pushSharedUi(workspace) {
|
|
|
65433
65368
|
return true;
|
|
65434
65369
|
}
|
|
65435
65370
|
async function pullSharedUi(workspace) {
|
|
65436
|
-
const localDir =
|
|
65371
|
+
const localDir = path9.join(process.cwd(), SHARED_UI_DIR);
|
|
65437
65372
|
let got;
|
|
65438
65373
|
try {
|
|
65439
65374
|
got = await getSharedUi({ workspace });
|
|
@@ -65447,8 +65382,8 @@ async function pullSharedUi(workspace) {
|
|
|
65447
65382
|
}
|
|
65448
65383
|
fs9.mkdirSync(localDir, { recursive: true });
|
|
65449
65384
|
for (const [rel, content] of Object.entries(files)) {
|
|
65450
|
-
const full =
|
|
65451
|
-
fs9.mkdirSync(
|
|
65385
|
+
const full = path9.join(localDir, rel);
|
|
65386
|
+
fs9.mkdirSync(path9.dirname(full), { recursive: true });
|
|
65452
65387
|
let existing;
|
|
65453
65388
|
try {
|
|
65454
65389
|
existing = readTextFileSync(full);
|
|
@@ -65463,7 +65398,7 @@ async function pullSharedUi(workspace) {
|
|
|
65463
65398
|
const local = await readDirRecursive(localDir);
|
|
65464
65399
|
for (const rel of Object.keys(local)) {
|
|
65465
65400
|
if (!known.has(rel)) {
|
|
65466
|
-
const full =
|
|
65401
|
+
const full = path9.join(localDir, rel);
|
|
65467
65402
|
try {
|
|
65468
65403
|
fs9.unlinkSync(full);
|
|
65469
65404
|
} catch {}
|
|
@@ -65744,11 +65679,11 @@ async function list5(opts) {
|
|
|
65744
65679
|
new Table2().header(["Path", "Resource Type"]).padding(2).border(true).body(total.map((x) => [x.path, x.resource_type])).render();
|
|
65745
65680
|
}
|
|
65746
65681
|
}
|
|
65747
|
-
async function newResource(opts,
|
|
65748
|
-
if (!validatePath(
|
|
65682
|
+
async function newResource(opts, path10) {
|
|
65683
|
+
if (!validatePath(path10)) {
|
|
65749
65684
|
return;
|
|
65750
65685
|
}
|
|
65751
|
-
const filePath =
|
|
65686
|
+
const filePath = path10 + ".resource.yaml";
|
|
65752
65687
|
try {
|
|
65753
65688
|
await stat6(filePath);
|
|
65754
65689
|
throw new Error("File already exists: " + filePath);
|
|
@@ -65768,14 +65703,14 @@ async function newResource(opts, path11) {
|
|
|
65768
65703
|
});
|
|
65769
65704
|
info(colors.green(`Created ${filePath}`));
|
|
65770
65705
|
}
|
|
65771
|
-
async function get3(opts,
|
|
65706
|
+
async function get3(opts, path10) {
|
|
65772
65707
|
if (opts.json)
|
|
65773
65708
|
setSilent(true);
|
|
65774
65709
|
const workspace = await resolveWorkspace(opts);
|
|
65775
65710
|
await requireLogin(opts);
|
|
65776
65711
|
const r = await getResource({
|
|
65777
65712
|
workspace: workspace.workspaceId,
|
|
65778
|
-
path:
|
|
65713
|
+
path: path10
|
|
65779
65714
|
});
|
|
65780
65715
|
if (opts.json) {
|
|
65781
65716
|
console.log(JSON.stringify(r));
|
|
@@ -65829,7 +65764,7 @@ __export(exports_sync, {
|
|
|
65829
65764
|
FSFSElement: () => FSFSElement
|
|
65830
65765
|
});
|
|
65831
65766
|
import { writeFile as writeFile7, readdir as readdir4, stat as stat7, rm, copyFile, mkdir as mkdir5 } from "node:fs/promises";
|
|
65832
|
-
import * as
|
|
65767
|
+
import * as path10 from "node:path";
|
|
65833
65768
|
import { sep as SEP9 } from "node:path";
|
|
65834
65769
|
function configKeyForItemKind(kind) {
|
|
65835
65770
|
switch (kind) {
|
|
@@ -65961,8 +65896,8 @@ function mergeCliWithEffectiveOptions(cliOpts, effectiveOpts) {
|
|
|
65961
65896
|
async function resolveEffectiveSyncOptions(workspace, localConfig, promotion, workspaceNameOverride) {
|
|
65962
65897
|
return await getEffectiveSettings(localConfig, promotion, false, false, workspaceNameOverride);
|
|
65963
65898
|
}
|
|
65964
|
-
function findCodebase(
|
|
65965
|
-
if (!
|
|
65899
|
+
function findCodebase(path11, codebases) {
|
|
65900
|
+
if (!path11.endsWith(".ts")) {
|
|
65966
65901
|
return;
|
|
65967
65902
|
}
|
|
65968
65903
|
for (const c of codebases) {
|
|
@@ -65978,7 +65913,7 @@ function findCodebase(path12, codebases) {
|
|
|
65978
65913
|
if (included) {
|
|
65979
65914
|
break;
|
|
65980
65915
|
}
|
|
65981
|
-
if (minimatch(
|
|
65916
|
+
if (minimatch(path11, r)) {
|
|
65982
65917
|
included = true;
|
|
65983
65918
|
}
|
|
65984
65919
|
}
|
|
@@ -65986,7 +65921,7 @@ function findCodebase(path12, codebases) {
|
|
|
65986
65921
|
c.excludes = [c.excludes];
|
|
65987
65922
|
}
|
|
65988
65923
|
for (const r of c.excludes ?? []) {
|
|
65989
|
-
if (minimatch(
|
|
65924
|
+
if (minimatch(path11, r)) {
|
|
65990
65925
|
excluded = true;
|
|
65991
65926
|
}
|
|
65992
65927
|
}
|
|
@@ -65995,13 +65930,13 @@ function findCodebase(path12, codebases) {
|
|
|
65995
65930
|
}
|
|
65996
65931
|
}
|
|
65997
65932
|
}
|
|
65998
|
-
async function addCodebaseDigestIfRelevant(
|
|
65999
|
-
const isScript =
|
|
65933
|
+
async function addCodebaseDigestIfRelevant(path11, content, codebases, ignoreCodebaseChanges) {
|
|
65934
|
+
const isScript = path11.endsWith(".script.yaml");
|
|
66000
65935
|
if (!isScript) {
|
|
66001
65936
|
return content;
|
|
66002
65937
|
}
|
|
66003
65938
|
let isTs = true;
|
|
66004
|
-
const replacedPath =
|
|
65939
|
+
const replacedPath = path11.replace(".script.yaml", ".ts");
|
|
66005
65940
|
try {
|
|
66006
65941
|
await stat7(replacedPath);
|
|
66007
65942
|
} catch {
|
|
@@ -66015,9 +65950,9 @@ async function addCodebaseDigestIfRelevant(path12, content, codebases, ignoreCod
|
|
|
66015
65950
|
if (c) {
|
|
66016
65951
|
let parsed;
|
|
66017
65952
|
try {
|
|
66018
|
-
parsed = yamlParseContent(
|
|
65953
|
+
parsed = yamlParseContent(path11, content);
|
|
66019
65954
|
} catch (error2) {
|
|
66020
|
-
error(`Failed to parse YAML content for codebase digest at path: ${
|
|
65955
|
+
error(`Failed to parse YAML content for codebase digest at path: ${path11}`);
|
|
66021
65956
|
throw error2;
|
|
66022
65957
|
}
|
|
66023
65958
|
if (parsed && typeof parsed == "object") {
|
|
@@ -66029,7 +65964,7 @@ async function addCodebaseDigestIfRelevant(path12, content, codebases, ignoreCod
|
|
|
66029
65964
|
parsed["lock"] = "";
|
|
66030
65965
|
return import_yaml11.stringify(parsed, yamlOptions);
|
|
66031
65966
|
} else {
|
|
66032
|
-
throw Error(`Expected local yaml ${
|
|
65967
|
+
throw Error(`Expected local yaml ${path11} to be an object, found: ${content} instead`);
|
|
66033
65968
|
}
|
|
66034
65969
|
}
|
|
66035
65970
|
}
|
|
@@ -66046,7 +65981,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
|
|
|
66046
65981
|
try {
|
|
66047
65982
|
const entries = await readdir4(localP, { withFileTypes: true });
|
|
66048
65983
|
for (const e of entries) {
|
|
66049
|
-
yield _internal_element(
|
|
65984
|
+
yield _internal_element(path10.join(localP, e.name), e.isDirectory(), codebases2);
|
|
66050
65985
|
}
|
|
66051
65986
|
} catch (e) {
|
|
66052
65987
|
warn(`Error reading dir: ${localP}, ${e}`);
|
|
@@ -66356,9 +66291,9 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66356
66291
|
for (const basePath of moduleScripts) {
|
|
66357
66292
|
if (normalizedP.startsWith(basePath + ".")) {
|
|
66358
66293
|
const ext2 = normalizedP.slice(basePath.length);
|
|
66359
|
-
const dir =
|
|
66360
|
-
const base =
|
|
66361
|
-
finalPath =
|
|
66294
|
+
const dir = path10.dirname(finalPath);
|
|
66295
|
+
const base = path10.basename(basePath);
|
|
66296
|
+
finalPath = path10.join(dir, base + getModuleFolderSuffix(), "script" + ext2);
|
|
66362
66297
|
break;
|
|
66363
66298
|
}
|
|
66364
66299
|
}
|
|
@@ -66394,7 +66329,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66394
66329
|
for (const s of inlineScripts) {
|
|
66395
66330
|
yield {
|
|
66396
66331
|
isDirectory: false,
|
|
66397
|
-
path:
|
|
66332
|
+
path: path10.join(finalPath, s.path),
|
|
66398
66333
|
async* getChildren() {},
|
|
66399
66334
|
async getContentText() {
|
|
66400
66335
|
return s.content;
|
|
@@ -66407,7 +66342,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66407
66342
|
}
|
|
66408
66343
|
yield {
|
|
66409
66344
|
isDirectory: false,
|
|
66410
|
-
path:
|
|
66345
|
+
path: path10.join(finalPath, "flow.yaml"),
|
|
66411
66346
|
async* getChildren() {},
|
|
66412
66347
|
async getContentText() {
|
|
66413
66348
|
return import_yaml11.stringify(flow, yamlOptions);
|
|
@@ -66431,7 +66366,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66431
66366
|
for (const s of inlineScripts) {
|
|
66432
66367
|
yield {
|
|
66433
66368
|
isDirectory: false,
|
|
66434
|
-
path:
|
|
66369
|
+
path: path10.join(finalPath, s.path),
|
|
66435
66370
|
async* getChildren() {},
|
|
66436
66371
|
async getContentText() {
|
|
66437
66372
|
return s.content;
|
|
@@ -66444,7 +66379,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66444
66379
|
app.policy = undefined;
|
|
66445
66380
|
yield {
|
|
66446
66381
|
isDirectory: false,
|
|
66447
|
-
path:
|
|
66382
|
+
path: path10.join(finalPath, "app.yaml"),
|
|
66448
66383
|
async* getChildren() {},
|
|
66449
66384
|
async getContentText() {
|
|
66450
66385
|
return import_yaml11.stringify(app, yamlOptions);
|
|
@@ -66499,7 +66434,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66499
66434
|
}
|
|
66500
66435
|
yield {
|
|
66501
66436
|
isDirectory: false,
|
|
66502
|
-
path:
|
|
66437
|
+
path: path10.join(finalPath, filePath.substring(1)),
|
|
66503
66438
|
async* getChildren() {},
|
|
66504
66439
|
async getContentText() {
|
|
66505
66440
|
if (typeof content !== "string") {
|
|
@@ -66516,7 +66451,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66516
66451
|
for (const s of inlineScripts) {
|
|
66517
66452
|
yield {
|
|
66518
66453
|
isDirectory: false,
|
|
66519
|
-
path:
|
|
66454
|
+
path: path10.join(finalPath, APP_BACKEND_FOLDER, s.path),
|
|
66520
66455
|
async* getChildren() {},
|
|
66521
66456
|
async getContentText() {
|
|
66522
66457
|
return s.content;
|
|
@@ -66552,7 +66487,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66552
66487
|
}
|
|
66553
66488
|
yield {
|
|
66554
66489
|
isDirectory: false,
|
|
66555
|
-
path:
|
|
66490
|
+
path: path10.join(finalPath, APP_BACKEND_FOLDER, `${runnableId}.yaml`),
|
|
66556
66491
|
async* getChildren() {},
|
|
66557
66492
|
async getContentText() {
|
|
66558
66493
|
return import_yaml11.stringify(simplifiedRunnable, yamlOptions);
|
|
@@ -66566,7 +66501,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66566
66501
|
delete rawApp?.["value"];
|
|
66567
66502
|
yield {
|
|
66568
66503
|
isDirectory: false,
|
|
66569
|
-
path:
|
|
66504
|
+
path: path10.join(finalPath, "raw_app.yaml"),
|
|
66570
66505
|
async* getChildren() {},
|
|
66571
66506
|
async getContentText() {
|
|
66572
66507
|
return import_yaml11.stringify(rawApp, yamlOptions);
|
|
@@ -66574,7 +66509,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66574
66509
|
};
|
|
66575
66510
|
yield {
|
|
66576
66511
|
isDirectory: false,
|
|
66577
|
-
path:
|
|
66512
|
+
path: path10.join(finalPath, "DATATABLES.md"),
|
|
66578
66513
|
async* getChildren() {},
|
|
66579
66514
|
async getContentText() {
|
|
66580
66515
|
return generateDatatablesDocumentation(data3);
|
|
@@ -66677,12 +66612,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66677
66612
|
const scriptBasePath = removeSuffix(removeSuffix(finalPath, metaExt), ".script");
|
|
66678
66613
|
const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
|
|
66679
66614
|
if (hasModules) {
|
|
66680
|
-
r[0].path =
|
|
66615
|
+
r[0].path = path10.join(moduleFolderPath, "script" + metaExt);
|
|
66681
66616
|
}
|
|
66682
66617
|
if (lock && lock != "") {
|
|
66683
66618
|
r.push({
|
|
66684
66619
|
isDirectory: false,
|
|
66685
|
-
path: hasModules ?
|
|
66620
|
+
path: hasModules ? path10.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
|
|
66686
66621
|
async* getChildren() {},
|
|
66687
66622
|
async getContentText() {
|
|
66688
66623
|
return lock;
|
|
@@ -66697,7 +66632,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66697
66632
|
for (const [relPath, mod] of Object.entries(scriptModules)) {
|
|
66698
66633
|
yield {
|
|
66699
66634
|
isDirectory: false,
|
|
66700
|
-
path:
|
|
66635
|
+
path: path10.join(moduleFolderPath, relPath),
|
|
66701
66636
|
async* getChildren() {},
|
|
66702
66637
|
async getContentText() {
|
|
66703
66638
|
return mod.content;
|
|
@@ -66707,7 +66642,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66707
66642
|
const baseName = relPath.replace(/\.[^.]+$/, "");
|
|
66708
66643
|
yield {
|
|
66709
66644
|
isDirectory: false,
|
|
66710
|
-
path:
|
|
66645
|
+
path: path10.join(moduleFolderPath, baseName + ".lock"),
|
|
66711
66646
|
async* getChildren() {},
|
|
66712
66647
|
async getContentText() {
|
|
66713
66648
|
return mod.lock;
|
|
@@ -66744,7 +66679,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66744
66679
|
if (typeof fileContent === "string") {
|
|
66745
66680
|
yield {
|
|
66746
66681
|
isDirectory: false,
|
|
66747
|
-
path:
|
|
66682
|
+
path: path10.join(filesetBasePath, relPath),
|
|
66748
66683
|
async* getChildren() {},
|
|
66749
66684
|
async getContentText() {
|
|
66750
66685
|
return fileContent;
|
|
@@ -66780,7 +66715,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66780
66715
|
async* getChildren() {
|
|
66781
66716
|
for (const filename in zip2.files) {
|
|
66782
66717
|
const file = zip2.files[filename];
|
|
66783
|
-
const totalPath =
|
|
66718
|
+
const totalPath = path10.join(p, filename);
|
|
66784
66719
|
if (file.dir) {
|
|
66785
66720
|
const e = zip2.folder(file.name);
|
|
66786
66721
|
yield _internal_folder(totalPath, e);
|
|
@@ -66849,15 +66784,15 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66849
66784
|
if (entry.ignored) {
|
|
66850
66785
|
continue;
|
|
66851
66786
|
}
|
|
66852
|
-
const
|
|
66853
|
-
if (isScriptModulePath(
|
|
66854
|
-
map[
|
|
66787
|
+
const path11 = entry.path;
|
|
66788
|
+
if (isScriptModulePath(path11)) {
|
|
66789
|
+
map[path11] = await entry.getContentText();
|
|
66855
66790
|
continue;
|
|
66856
66791
|
}
|
|
66857
|
-
if (!isFileResource(
|
|
66858
|
-
if (json &&
|
|
66792
|
+
if (!isFileResource(path11) && !isFilesetResource(path11) && !isRawAppFile(path11) && !isWorkspaceDependencies(path11)) {
|
|
66793
|
+
if (json && path11.endsWith(".yaml"))
|
|
66859
66794
|
continue;
|
|
66860
|
-
if (!json &&
|
|
66795
|
+
if (!json && path11.endsWith(".json"))
|
|
66861
66796
|
continue;
|
|
66862
66797
|
if (![
|
|
66863
66798
|
"json",
|
|
@@ -66879,39 +66814,39 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66879
66814
|
"java",
|
|
66880
66815
|
"rb",
|
|
66881
66816
|
"r"
|
|
66882
|
-
].includes(
|
|
66817
|
+
].includes(path11.split(".").pop() ?? "")) {
|
|
66883
66818
|
continue;
|
|
66884
66819
|
}
|
|
66885
66820
|
}
|
|
66886
|
-
if (isRawAppFile(
|
|
66887
|
-
const suffix =
|
|
66821
|
+
if (isRawAppFile(path11)) {
|
|
66822
|
+
const suffix = path11.split(getFolderSuffix("raw_app") + SEP9).pop();
|
|
66888
66823
|
if (suffix?.startsWith("dist/") || suffix == "wmill.d.ts" || suffix == "package-lock.json" || suffix == "DATATABLES.md") {
|
|
66889
66824
|
continue;
|
|
66890
66825
|
}
|
|
66891
66826
|
}
|
|
66892
|
-
if (skips.skipResources && (isFileResource(
|
|
66827
|
+
if (skips.skipResources && (isFileResource(path11) || isFilesetResource(path11)))
|
|
66893
66828
|
continue;
|
|
66894
66829
|
const ext2 = json ? ".json" : ".yaml";
|
|
66895
|
-
if (!skips.includeSchedules &&
|
|
66830
|
+
if (!skips.includeSchedules && path11.endsWith(".schedule" + ext2))
|
|
66896
66831
|
continue;
|
|
66897
|
-
if (!skips.includeTriggers && (
|
|
66832
|
+
if (!skips.includeTriggers && (path11.endsWith(".http_trigger" + ext2) || path11.endsWith(".websocket_trigger" + ext2) || path11.endsWith(".kafka_trigger" + ext2) || path11.endsWith(".nats_trigger" + ext2) || path11.endsWith(".postgres_trigger" + ext2) || path11.endsWith(".mqtt_trigger" + ext2) || path11.endsWith(".sqs_trigger" + ext2) || path11.endsWith(".gcp_trigger" + ext2) || path11.endsWith(".azure_trigger" + ext2) || path11.endsWith(".email_trigger" + ext2) || path11.endsWith("_native_trigger" + ext2))) {
|
|
66898
66833
|
continue;
|
|
66899
66834
|
}
|
|
66900
|
-
if (!skips.includeUsers &&
|
|
66835
|
+
if (!skips.includeUsers && path11.endsWith(".user" + ext2))
|
|
66901
66836
|
continue;
|
|
66902
|
-
if (!skips.includeGroups &&
|
|
66837
|
+
if (!skips.includeGroups && path11.endsWith(".group" + ext2))
|
|
66903
66838
|
continue;
|
|
66904
|
-
if (!skips.includeSettings &&
|
|
66839
|
+
if (!skips.includeSettings && path11 === "settings" + ext2)
|
|
66905
66840
|
continue;
|
|
66906
|
-
if (!skips.includeKey &&
|
|
66841
|
+
if (!skips.includeKey && path11 === "encryption_key")
|
|
66907
66842
|
continue;
|
|
66908
|
-
if (skips.skipResources &&
|
|
66843
|
+
if (skips.skipResources && path11.endsWith(".resource" + ext2))
|
|
66909
66844
|
continue;
|
|
66910
|
-
if (skips.skipResourceTypes &&
|
|
66845
|
+
if (skips.skipResourceTypes && path11.endsWith(".resource-type" + ext2)) {
|
|
66911
66846
|
continue;
|
|
66912
66847
|
}
|
|
66913
66848
|
try {
|
|
66914
|
-
const fileType = getTypeStrFromPath(
|
|
66849
|
+
const fileType = getTypeStrFromPath(path11);
|
|
66915
66850
|
if (skips.skipVariables && fileType === "variable")
|
|
66916
66851
|
continue;
|
|
66917
66852
|
if (skips.skipScripts && fileType === "script")
|
|
@@ -66925,27 +66860,27 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66925
66860
|
if (skips.skipWorkspaceDependencies && fileType === "workspace_dependencies")
|
|
66926
66861
|
continue;
|
|
66927
66862
|
} catch {}
|
|
66928
|
-
if (specificItems && isWorkspaceSpecificFile(
|
|
66929
|
-
if (!isCurrentWorkspaceFile(
|
|
66863
|
+
if (specificItems && isWorkspaceSpecificFile(path11)) {
|
|
66864
|
+
if (!isCurrentWorkspaceFile(path11, cachedWsName)) {
|
|
66930
66865
|
continue;
|
|
66931
66866
|
}
|
|
66932
66867
|
}
|
|
66933
66868
|
const content = await entry.getContentText();
|
|
66934
|
-
if (skips.skipSecrets &&
|
|
66869
|
+
if (skips.skipSecrets && path11.endsWith(".variable" + ext2)) {
|
|
66935
66870
|
try {
|
|
66936
66871
|
let o;
|
|
66937
66872
|
if (json) {
|
|
66938
66873
|
try {
|
|
66939
66874
|
o = JSON.parse(content);
|
|
66940
66875
|
} catch (error2) {
|
|
66941
|
-
error(`Failed to parse JSON variable content at path: ${
|
|
66876
|
+
error(`Failed to parse JSON variable content at path: ${path11}`);
|
|
66942
66877
|
throw error2;
|
|
66943
66878
|
}
|
|
66944
66879
|
} else {
|
|
66945
66880
|
try {
|
|
66946
|
-
o = yamlParseContent(
|
|
66881
|
+
o = yamlParseContent(path11, content);
|
|
66947
66882
|
} catch (error2) {
|
|
66948
|
-
error(`Failed to parse YAML variable content at path: ${
|
|
66883
|
+
error(`Failed to parse YAML variable content at path: ${path11}`);
|
|
66949
66884
|
throw error2;
|
|
66950
66885
|
}
|
|
66951
66886
|
}
|
|
@@ -66953,12 +66888,12 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66953
66888
|
continue;
|
|
66954
66889
|
}
|
|
66955
66890
|
} catch (e) {
|
|
66956
|
-
warn(`Error reading variable ${
|
|
66891
|
+
warn(`Error reading variable ${path11} to check for secrets`);
|
|
66957
66892
|
}
|
|
66958
66893
|
}
|
|
66959
|
-
if (cachedWsName && isCurrentWorkspaceFile(
|
|
66894
|
+
if (cachedWsName && isCurrentWorkspaceFile(path11, cachedWsName)) {
|
|
66960
66895
|
const currentBranch = cachedWsName;
|
|
66961
|
-
const basePath = fromWorkspaceSpecificPath(
|
|
66896
|
+
const basePath = fromWorkspaceSpecificPath(path11, currentBranch);
|
|
66962
66897
|
if (!isItemTypeConfigured(basePath, specificItems)) {
|
|
66963
66898
|
continue;
|
|
66964
66899
|
}
|
|
@@ -66967,14 +66902,14 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66967
66902
|
}
|
|
66968
66903
|
map[basePath] = content;
|
|
66969
66904
|
processedBasePaths.add(basePath);
|
|
66970
|
-
} else if (!isWorkspaceSpecificFile(
|
|
66971
|
-
if (processedBasePaths.has(
|
|
66905
|
+
} else if (!isWorkspaceSpecificFile(path11)) {
|
|
66906
|
+
if (processedBasePaths.has(path11)) {
|
|
66972
66907
|
continue;
|
|
66973
66908
|
}
|
|
66974
|
-
if (!isRemote && isSpecificItem(
|
|
66909
|
+
if (!isRemote && isSpecificItem(path11, specificItems)) {
|
|
66975
66910
|
continue;
|
|
66976
66911
|
}
|
|
66977
|
-
map[
|
|
66912
|
+
map[path11] = content;
|
|
66978
66913
|
}
|
|
66979
66914
|
}
|
|
66980
66915
|
if (wrongFormatPaths.length > 0) {
|
|
@@ -67359,7 +67294,7 @@ async function pull(opts) {
|
|
|
67359
67294
|
throw error2;
|
|
67360
67295
|
}
|
|
67361
67296
|
if (opts.stateful) {
|
|
67362
|
-
await mkdir5(
|
|
67297
|
+
await mkdir5(path10.join(process.cwd(), ".wmill"), { recursive: true });
|
|
67363
67298
|
}
|
|
67364
67299
|
const workspace = await resolveWorkspace(opts, wsNameForConfig);
|
|
67365
67300
|
await requireLogin(opts);
|
|
@@ -67433,7 +67368,7 @@ async function pull(opts) {
|
|
|
67433
67368
|
} catch {}
|
|
67434
67369
|
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.defaultTs);
|
|
67435
67370
|
const remote = ZipFSElement(zipFile, !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, true, parseSyncBehavior(opts.syncBehavior) >= 1);
|
|
67436
|
-
const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(
|
|
67371
|
+
const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(path10.join(process.cwd(), ".wmill"), [], true);
|
|
67437
67372
|
const { changes, localMap } = await compareDynFSElement(remote, local, await ignoreF(opts), opts.json ?? false, opts, false, codebases, true, specificItems, wsNameForFiles, true);
|
|
67438
67373
|
info(`remote (${workspace.name}) -> local: ${changes.length} changes to apply`);
|
|
67439
67374
|
if (wsSpecificMerge.serverItems && wsSpecificMerge.serverItems.length > 0) {
|
|
@@ -67488,8 +67423,8 @@ async function pull(opts) {
|
|
|
67488
67423
|
targetPath = workspaceSpecificPath;
|
|
67489
67424
|
}
|
|
67490
67425
|
}
|
|
67491
|
-
const target =
|
|
67492
|
-
const stateTarget =
|
|
67426
|
+
const target = path10.join(process.cwd(), targetPath);
|
|
67427
|
+
const stateTarget = path10.join(process.cwd(), ".wmill", targetPath);
|
|
67493
67428
|
if (change.name === "edited") {
|
|
67494
67429
|
if (opts.stateful) {
|
|
67495
67430
|
try {
|
|
@@ -67522,13 +67457,13 @@ Both local and remote have been modified.`));
|
|
|
67522
67457
|
}
|
|
67523
67458
|
await writeFile7(target, change.after, "utf-8");
|
|
67524
67459
|
if (opts.stateful) {
|
|
67525
|
-
await mkdir5(
|
|
67460
|
+
await mkdir5(path10.dirname(stateTarget), { recursive: true });
|
|
67526
67461
|
await copyFile(target, stateTarget);
|
|
67527
67462
|
}
|
|
67528
67463
|
} else if (change.name === "added") {
|
|
67529
|
-
await mkdir5(
|
|
67464
|
+
await mkdir5(path10.dirname(target), { recursive: true });
|
|
67530
67465
|
if (opts.stateful) {
|
|
67531
|
-
await mkdir5(
|
|
67466
|
+
await mkdir5(path10.dirname(stateTarget), { recursive: true });
|
|
67532
67467
|
info(`Adding ${getTypeStrFromPath(change.path)} ${targetPath}${targetPath !== change.path ? colors.gray(` (workspace-specific override for ${change.path})`) : ""}`);
|
|
67533
67468
|
}
|
|
67534
67469
|
await writeFile7(target, change.content, "utf-8");
|
|
@@ -67796,7 +67731,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
|
|
|
67796
67731
|
resourceTypeToIsFileset = parsed.filesetMap;
|
|
67797
67732
|
} catch {}
|
|
67798
67733
|
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.defaultTs), !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, false, parseSyncBehavior(opts.syncBehavior) >= 1);
|
|
67799
|
-
const local = await FSFSElement(
|
|
67734
|
+
const local = await FSFSElement(path10.join(process.cwd(), ""), codebases, false);
|
|
67800
67735
|
const { changes, localMap } = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false);
|
|
67801
67736
|
const wsSpecificFlagOnly = computeWsSpecificFlagOnlyPushes(localMap, localSpecificItems, serverWsSpecificItems);
|
|
67802
67737
|
for (const item of wsSpecificFlagOnly) {
|
|
@@ -67956,7 +67891,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
|
|
|
67956
67891
|
}
|
|
67957
67892
|
}
|
|
67958
67893
|
for (const folderName2 of folderNames) {
|
|
67959
|
-
const basePath =
|
|
67894
|
+
const basePath = path10.join("f", folderName2, "folder.meta.yaml");
|
|
67960
67895
|
const branchPath = getWorkspaceSpecificPath(`f/${folderName2}/folder.meta.yaml`, specificItems, wsNameForFiles);
|
|
67961
67896
|
let found = false;
|
|
67962
67897
|
if (branchPath) {
|
|
@@ -68078,7 +68013,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
68078
68013
|
let stateful = opts.stateful;
|
|
68079
68014
|
if (stateful) {
|
|
68080
68015
|
try {
|
|
68081
|
-
await stat7(
|
|
68016
|
+
await stat7(path10.join(process.cwd(), ".wmill"));
|
|
68082
68017
|
} catch {
|
|
68083
68018
|
stateful = false;
|
|
68084
68019
|
}
|
|
@@ -68129,7 +68064,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
68129
68064
|
let stateTarget = undefined;
|
|
68130
68065
|
if (stateful) {
|
|
68131
68066
|
try {
|
|
68132
|
-
stateTarget =
|
|
68067
|
+
stateTarget = path10.join(process.cwd(), ".wmill", change.path);
|
|
68133
68068
|
await stat7(stateTarget);
|
|
68134
68069
|
} catch {
|
|
68135
68070
|
stateTarget = undefined;
|
|
@@ -68154,7 +68089,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
68154
68089
|
continue;
|
|
68155
68090
|
}
|
|
68156
68091
|
if (stateTarget) {
|
|
68157
|
-
await mkdir5(
|
|
68092
|
+
await mkdir5(path10.dirname(stateTarget), { recursive: true });
|
|
68158
68093
|
info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
|
|
68159
68094
|
}
|
|
68160
68095
|
if (isFileResource(change.path)) {
|
|
@@ -68218,7 +68153,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
68218
68153
|
continue;
|
|
68219
68154
|
}
|
|
68220
68155
|
if (stateTarget) {
|
|
68221
|
-
await mkdir5(
|
|
68156
|
+
await mkdir5(path10.dirname(stateTarget), { recursive: true });
|
|
68222
68157
|
info(`Adding ${getTypeStrFromPath(change.path)} ${change.path}`);
|
|
68223
68158
|
}
|
|
68224
68159
|
const obj = parseFromPath(change.path, change.content);
|
|
@@ -68859,8 +68794,8 @@ var init_parse_schema = __esm(() => {
|
|
|
68859
68794
|
// src/utils/metadata.ts
|
|
68860
68795
|
import { sep as SEP10 } from "node:path";
|
|
68861
68796
|
import { writeFile as writeFile8, stat as stat8, rm as rm2, readdir as readdir5 } from "node:fs/promises";
|
|
68862
|
-
import { readFileSync as readFileSync2, existsSync as
|
|
68863
|
-
import * as
|
|
68797
|
+
import { readFileSync as readFileSync2, existsSync as existsSync5, readdirSync, statSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
68798
|
+
import * as path11 from "node:path";
|
|
68864
68799
|
import { createRequire as createRequire2 } from "node:module";
|
|
68865
68800
|
function loadParser(pkgName) {
|
|
68866
68801
|
let p = _parserCache.get(pkgName);
|
|
@@ -68902,8 +68837,8 @@ async function getRawWorkspaceDependencies(legacyBehaviour) {
|
|
|
68902
68837
|
} catch {}
|
|
68903
68838
|
return rawWorkspaceDeps;
|
|
68904
68839
|
}
|
|
68905
|
-
function workspaceDependenciesPathToLanguageAndFilename(
|
|
68906
|
-
const relativePath =
|
|
68840
|
+
function workspaceDependenciesPathToLanguageAndFilename(path12) {
|
|
68841
|
+
const relativePath = path12.replace("dependencies/", "");
|
|
68907
68842
|
for (const { filename, language } of workspaceDependenciesLanguages) {
|
|
68908
68843
|
if (relativePath.endsWith(filename)) {
|
|
68909
68844
|
return {
|
|
@@ -68957,8 +68892,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
68957
68892
|
const scriptContent = await readTextFile(scriptPath);
|
|
68958
68893
|
const metadataContent = await readTextFile(metadataWithType.path);
|
|
68959
68894
|
const filteredRawWorkspaceDependencies = filterWorkspaceDependencies(rawWorkspaceDependencies, scriptContent, language);
|
|
68960
|
-
const moduleFolderPath = isFolderLayout ?
|
|
68961
|
-
const hasModules =
|
|
68895
|
+
const moduleFolderPath = isFolderLayout ? path11.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix();
|
|
68896
|
+
const hasModules = existsSync5(moduleFolderPath) && statSync(moduleFolderPath).isDirectory();
|
|
68962
68897
|
const depsForHash = tree ? {} : filteredRawWorkspaceDependencies;
|
|
68963
68898
|
let hash2 = await generateScriptHash(depsForHash, scriptContent, metadataContent);
|
|
68964
68899
|
let moduleHashes = {};
|
|
@@ -69029,7 +68964,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
69029
68964
|
const hasCodebase = findCodebase(scriptPath, codebases) != null;
|
|
69030
68965
|
if (!hasCodebase) {
|
|
69031
68966
|
const tempScriptRefs = tree?.getTempScriptRefs(remotePath);
|
|
69032
|
-
const lockPathOverride = isFolderLayout ?
|
|
68967
|
+
const lockPathOverride = isFolderLayout ? path11.dirname(scriptPath) + "/script.lock" : undefined;
|
|
69033
68968
|
await updateScriptLock(workspace, scriptContent, language, remotePath, metadataParsedContent, filteredRawWorkspaceDependencies, tempScriptRefs, lockPathOverride);
|
|
69034
68969
|
} else {
|
|
69035
68970
|
metadataParsedContent.lock = "";
|
|
@@ -69060,10 +68995,10 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
69060
68995
|
let newMetadataContent;
|
|
69061
68996
|
if (isFolderLayout) {
|
|
69062
68997
|
if (metadataWithType.isJson) {
|
|
69063
|
-
metaPath =
|
|
68998
|
+
metaPath = path11.dirname(scriptPath) + "/script.json";
|
|
69064
68999
|
newMetadataContent = JSON.stringify(metadataParsedContent);
|
|
69065
69000
|
} else {
|
|
69066
|
-
metaPath =
|
|
69001
|
+
metaPath = path11.dirname(scriptPath) + "/script.yaml";
|
|
69067
69002
|
newMetadataContent = import_yaml13.stringify(metadataParsedContent, yamlOptions);
|
|
69068
69003
|
}
|
|
69069
69004
|
} else {
|
|
@@ -69093,8 +69028,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
69093
69028
|
}
|
|
69094
69029
|
return `${remotePath} (${language})`;
|
|
69095
69030
|
}
|
|
69096
|
-
async function updateScriptSchema(scriptContent, language, metadataContent,
|
|
69097
|
-
const result = await inferSchema(language, scriptContent, metadataContent.schema,
|
|
69031
|
+
async function updateScriptSchema(scriptContent, language, metadataContent, path12) {
|
|
69032
|
+
const result = await inferSchema(language, scriptContent, metadataContent.schema, path12);
|
|
69098
69033
|
metadataContent.schema = result.schema;
|
|
69099
69034
|
if (result.has_preprocessor) {
|
|
69100
69035
|
metadataContent.has_preprocessor = result.has_preprocessor;
|
|
@@ -69256,7 +69191,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
|
|
|
69256
69191
|
async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules) {
|
|
69257
69192
|
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
69258
69193
|
for (const entry of entries) {
|
|
69259
|
-
const fullPath =
|
|
69194
|
+
const fullPath = path11.join(dirPath, entry.name);
|
|
69260
69195
|
const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
|
|
69261
69196
|
if (entry.isDirectory()) {
|
|
69262
69197
|
await updateModuleLocks(workspace, fullPath, relPath, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules);
|
|
@@ -69280,12 +69215,12 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
|
|
|
69280
69215
|
try {
|
|
69281
69216
|
const lock = await fetchScriptLock(workspace, moduleContent, modLanguage, moduleRemotePath, rawWorkspaceDependencies);
|
|
69282
69217
|
const baseName = entry.name.replace(/\.[^.]+$/, "");
|
|
69283
|
-
const lockPath =
|
|
69218
|
+
const lockPath = path11.join(dirPath, baseName + ".lock");
|
|
69284
69219
|
if (lock != "") {
|
|
69285
|
-
|
|
69220
|
+
writeFileSync4(lockPath, lock, "utf-8");
|
|
69286
69221
|
} else {
|
|
69287
69222
|
try {
|
|
69288
|
-
if (
|
|
69223
|
+
if (existsSync5(lockPath)) {
|
|
69289
69224
|
const { rm: rmAsync } = await import("node:fs/promises");
|
|
69290
69225
|
await rmAsync(lockPath);
|
|
69291
69226
|
}
|
|
@@ -69297,7 +69232,7 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
|
|
|
69297
69232
|
}
|
|
69298
69233
|
}
|
|
69299
69234
|
}
|
|
69300
|
-
async function inferSchema(language, content, currentSchema,
|
|
69235
|
+
async function inferSchema(language, content, currentSchema, path12) {
|
|
69301
69236
|
let inferedSchema;
|
|
69302
69237
|
if (language === "python3") {
|
|
69303
69238
|
const { parse_python } = await loadParser("windmill-parser-wasm-py");
|
|
@@ -69400,7 +69335,7 @@ async function inferSchema(language, content, currentSchema, path13) {
|
|
|
69400
69335
|
throw new Error("Invalid language: " + language);
|
|
69401
69336
|
}
|
|
69402
69337
|
if (inferedSchema.type == "Invalid") {
|
|
69403
|
-
info(colors.yellow(`Script ${
|
|
69338
|
+
info(colors.yellow(`Script ${path12} invalid, it cannot be parsed to infer schema.`));
|
|
69404
69339
|
return {
|
|
69405
69340
|
schema: defaultScriptMetadata().schema,
|
|
69406
69341
|
has_preprocessor: false,
|
|
@@ -69592,15 +69527,15 @@ async function readLockfile() {
|
|
|
69592
69527
|
}
|
|
69593
69528
|
return conf;
|
|
69594
69529
|
}
|
|
69595
|
-
function v2LockPath(
|
|
69596
|
-
const normalizedPath = normalizeLockPath(
|
|
69530
|
+
function v2LockPath(path12, subpath) {
|
|
69531
|
+
const normalizedPath = normalizeLockPath(path12);
|
|
69597
69532
|
if (subpath) {
|
|
69598
69533
|
return `${normalizedPath}+${normalizeLockPath(subpath)}`;
|
|
69599
69534
|
} else {
|
|
69600
69535
|
return normalizedPath;
|
|
69601
69536
|
}
|
|
69602
69537
|
}
|
|
69603
|
-
async function checkifMetadataUptodate(
|
|
69538
|
+
async function checkifMetadataUptodate(path12, hash2, conf, subpath) {
|
|
69604
69539
|
if (!conf) {
|
|
69605
69540
|
conf = await readLockfile();
|
|
69606
69541
|
}
|
|
@@ -69609,10 +69544,10 @@ async function checkifMetadataUptodate(path13, hash2, conf, subpath) {
|
|
|
69609
69544
|
}
|
|
69610
69545
|
const isFlatKeyed = conf?.version === "v2";
|
|
69611
69546
|
if (isFlatKeyed) {
|
|
69612
|
-
const key = v2LockPath(
|
|
69547
|
+
const key = v2LockPath(path12, subpath);
|
|
69613
69548
|
return conf.locks?.[key] === hash2 || conf.locks?.["./" + key] === hash2;
|
|
69614
69549
|
}
|
|
69615
|
-
for (const p of [
|
|
69550
|
+
for (const p of [path12, "./" + path12]) {
|
|
69616
69551
|
const obj = conf.locks?.[p];
|
|
69617
69552
|
const v = subpath && typeof obj == "object" ? obj?.[subpath] : obj;
|
|
69618
69553
|
if (v === hash2)
|
|
@@ -69628,7 +69563,7 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
|
|
|
69628
69563
|
async function readDir2(dirPath, relPrefix) {
|
|
69629
69564
|
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
69630
69565
|
for (const entry of entries) {
|
|
69631
|
-
const fullPath =
|
|
69566
|
+
const fullPath = path11.join(dirPath, entry.name);
|
|
69632
69567
|
const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
|
|
69633
69568
|
const isTopLevel = relPrefix === "";
|
|
69634
69569
|
if (entry.isDirectory()) {
|
|
@@ -69648,14 +69583,14 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
|
|
|
69648
69583
|
await readDir2(moduleFolderPath, "");
|
|
69649
69584
|
return hashes;
|
|
69650
69585
|
}
|
|
69651
|
-
async function clearGlobalLock(
|
|
69586
|
+
async function clearGlobalLock(path12) {
|
|
69652
69587
|
const conf = await readLockfile();
|
|
69653
69588
|
if (!conf?.locks) {
|
|
69654
69589
|
conf.locks = {};
|
|
69655
69590
|
}
|
|
69656
69591
|
const isFlatKeyed = conf?.version === "v2";
|
|
69657
69592
|
if (isFlatKeyed) {
|
|
69658
|
-
const key = v2LockPath(
|
|
69593
|
+
const key = v2LockPath(path12);
|
|
69659
69594
|
const legacyKey = "./" + key;
|
|
69660
69595
|
if (conf.locks) {
|
|
69661
69596
|
Object.keys(conf.locks).forEach((k) => {
|
|
@@ -69671,24 +69606,24 @@ async function clearGlobalLock(path13) {
|
|
|
69671
69606
|
}
|
|
69672
69607
|
}
|
|
69673
69608
|
}
|
|
69674
|
-
async function updateMetadataGlobalLock(
|
|
69609
|
+
async function updateMetadataGlobalLock(path12, hash2, subpath) {
|
|
69675
69610
|
const conf = await readLockfile();
|
|
69676
69611
|
if (!conf?.locks) {
|
|
69677
69612
|
conf.locks = {};
|
|
69678
69613
|
}
|
|
69679
69614
|
const isFlatKeyed = conf?.version === "v2";
|
|
69680
69615
|
if (isFlatKeyed) {
|
|
69681
|
-
conf.locks[v2LockPath(
|
|
69616
|
+
conf.locks[v2LockPath(path12, subpath)] = hash2;
|
|
69682
69617
|
} else {
|
|
69683
69618
|
if (subpath) {
|
|
69684
|
-
let prev = conf.locks[
|
|
69619
|
+
let prev = conf.locks[path12];
|
|
69685
69620
|
if (!prev || typeof prev != "object") {
|
|
69686
69621
|
prev = {};
|
|
69687
|
-
conf.locks[
|
|
69622
|
+
conf.locks[path12] = prev;
|
|
69688
69623
|
}
|
|
69689
69624
|
prev[subpath] = hash2;
|
|
69690
69625
|
} else {
|
|
69691
|
-
conf.locks[
|
|
69626
|
+
conf.locks[path12] = hash2;
|
|
69692
69627
|
}
|
|
69693
69628
|
}
|
|
69694
69629
|
if (!inMemoryLock) {
|
|
@@ -69755,7 +69690,7 @@ __export(exports_raw_apps, {
|
|
|
69755
69690
|
generatingPolicy: () => generatingPolicy
|
|
69756
69691
|
});
|
|
69757
69692
|
import { sep as SEP11 } from "node:path";
|
|
69758
|
-
import
|
|
69693
|
+
import path12 from "node:path";
|
|
69759
69694
|
import { readdir as readdir6 } from "node:fs/promises";
|
|
69760
69695
|
async function readSiblingLock(backendPath, runnableId, allFiles) {
|
|
69761
69696
|
const target = `${runnableId.toLowerCase()}.lock`;
|
|
@@ -69763,7 +69698,7 @@ async function readSiblingLock(backendPath, runnableId, allFiles) {
|
|
|
69763
69698
|
if (!lockFile)
|
|
69764
69699
|
return;
|
|
69765
69700
|
try {
|
|
69766
|
-
return await readTextFile(
|
|
69701
|
+
return await readTextFile(path12.join(backendPath, lockFile));
|
|
69767
69702
|
} catch {
|
|
69768
69703
|
return;
|
|
69769
69704
|
}
|
|
@@ -69780,7 +69715,7 @@ async function findRunnableContentFile(backendPath, runnableId, allFiles) {
|
|
|
69780
69715
|
const ext2 = fileName.substring(runnableId.length + 1);
|
|
69781
69716
|
if (EXTENSION_TO_LANGUAGE[ext2]) {
|
|
69782
69717
|
try {
|
|
69783
|
-
const content = await readTextFile(
|
|
69718
|
+
const content = await readTextFile(path12.join(backendPath, fileName));
|
|
69784
69719
|
return { ext: ext2, content };
|
|
69785
69720
|
} catch {
|
|
69786
69721
|
continue;
|
|
@@ -69817,7 +69752,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
|
|
|
69817
69752
|
}
|
|
69818
69753
|
const runnableId = fileName.replace(".yaml", "");
|
|
69819
69754
|
processedIds.add(runnableId.toLowerCase());
|
|
69820
|
-
const filePath =
|
|
69755
|
+
const filePath = path12.join(backendPath, fileName);
|
|
69821
69756
|
const runnable = await yamlParseFile(filePath);
|
|
69822
69757
|
if (runnable?.type === "inline") {
|
|
69823
69758
|
const contentFile = await findRunnableContentFile(backendPath, runnableId, allFiles);
|
|
@@ -69878,7 +69813,7 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
|
|
|
69878
69813
|
...rest
|
|
69879
69814
|
};
|
|
69880
69815
|
}
|
|
69881
|
-
const filePath =
|
|
69816
|
+
const filePath = path12.join(backendPath, `${runnableId}.yaml`);
|
|
69882
69817
|
writeIfChanged(filePath, import_yaml16.stringify(runnableToWrite, yamlOptions));
|
|
69883
69818
|
}
|
|
69884
69819
|
async function collectAppFiles(localPath) {
|
|
@@ -69929,7 +69864,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
69929
69864
|
}
|
|
69930
69865
|
const appFilePath = localPath + "raw_app.yaml";
|
|
69931
69866
|
const localApp = await yamlParseFile(appFilePath);
|
|
69932
|
-
const backendPath =
|
|
69867
|
+
const backendPath = path12.join(localPath, APP_BACKEND_FOLDER);
|
|
69933
69868
|
const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
|
|
69934
69869
|
let runnables;
|
|
69935
69870
|
if (Object.keys(runnablesFromBackend).length > 0) {
|
|
@@ -69951,7 +69886,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
69951
69886
|
const frameworks = detectFrameworks(localPath);
|
|
69952
69887
|
const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
69953
69888
|
const entryPoint = localPath + entryFile;
|
|
69954
|
-
const sharedUiDir =
|
|
69889
|
+
const sharedUiDir = path12.join(process.cwd(), "ui");
|
|
69955
69890
|
return await createBundle({
|
|
69956
69891
|
entryPoint,
|
|
69957
69892
|
production: true,
|
|
@@ -70011,13 +69946,13 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
70011
69946
|
}
|
|
70012
69947
|
await applyExtraPermsDiff(workspace, "raw_app", remotePath, localPerms, app?.extra_perms);
|
|
70013
69948
|
}
|
|
70014
|
-
async function generatingPolicy(app,
|
|
70015
|
-
info(colors.gray(`Generating fresh policy for app ${
|
|
69949
|
+
async function generatingPolicy(app, path13, publicApp) {
|
|
69950
|
+
info(colors.gray(`Generating fresh policy for app ${path13}...`));
|
|
70016
69951
|
try {
|
|
70017
69952
|
app.policy = await updateRawAppPolicy(app.runnables, app.policy);
|
|
70018
69953
|
app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
|
|
70019
69954
|
} catch (e) {
|
|
70020
|
-
error(colors.red(`Error generating policy for app ${
|
|
69955
|
+
error(colors.red(`Error generating policy for app ${path13}: ${e}`));
|
|
70021
69956
|
throw e;
|
|
70022
69957
|
}
|
|
70023
69958
|
}
|
|
@@ -70056,7 +69991,7 @@ __export(exports_app_metadata, {
|
|
|
70056
69991
|
filterWorkspaceDependenciesForApp: () => filterWorkspaceDependenciesForApp,
|
|
70057
69992
|
APP_BACKEND_FOLDER: () => APP_BACKEND_FOLDER
|
|
70058
69993
|
});
|
|
70059
|
-
import
|
|
69994
|
+
import path13 from "node:path";
|
|
70060
69995
|
import { mkdir as mkdir6, readdir as readdir7 } from "node:fs/promises";
|
|
70061
69996
|
import { sep as SEP12 } from "node:path";
|
|
70062
69997
|
async function isAppDirectlyStale(appFolder, hashes, conf) {
|
|
@@ -70073,7 +70008,7 @@ async function isAppDirectlyStale(appFolder, hashes, conf) {
|
|
|
70073
70008
|
return false;
|
|
70074
70009
|
}
|
|
70075
70010
|
async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
|
|
70076
|
-
const runnablesFolder = rawApp ?
|
|
70011
|
+
const runnablesFolder = rawApp ? path13.join(folder, APP_BACKEND_FOLDER) : folder;
|
|
70077
70012
|
const hashes = {};
|
|
70078
70013
|
try {
|
|
70079
70014
|
const elems = await FSFSElement(runnablesFolder, [], true);
|
|
@@ -70116,7 +70051,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
|
|
|
70116
70051
|
if (!justUpdateMetadataLock && !noStaleMessage) {
|
|
70117
70052
|
info(`Generating locks for app ${appFolder} at ${remote_path}`);
|
|
70118
70053
|
}
|
|
70119
|
-
const appFilePath =
|
|
70054
|
+
const appFilePath = path13.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
|
|
70120
70055
|
const appFile = await yamlParseFile(appFilePath);
|
|
70121
70056
|
const appValue = rawApp ? appFile.runnables : appFile.value;
|
|
70122
70057
|
const folderNormalized = appFolder.replaceAll(SEP12, "/");
|
|
@@ -70128,7 +70063,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
|
|
|
70128
70063
|
const isDirectlyStale = await isAppDirectlyStale(appFolder, hashes, conf);
|
|
70129
70064
|
let treeAppValue = structuredClone(appValue);
|
|
70130
70065
|
if (rawApp) {
|
|
70131
|
-
const runnablesPath =
|
|
70066
|
+
const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
|
|
70132
70067
|
const runnablesFromFiles = await loadRunnablesFromBackend(runnablesPath);
|
|
70133
70068
|
if (Object.keys(runnablesFromFiles).length > 0) {
|
|
70134
70069
|
treeAppValue = runnablesFromFiles;
|
|
@@ -70194,7 +70129,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
|
|
|
70194
70129
|
info(`Recomputing locks of ${changedScripts.join(", ")} in ${appFolder}`);
|
|
70195
70130
|
}
|
|
70196
70131
|
if (rawApp) {
|
|
70197
|
-
const runnablesPath =
|
|
70132
|
+
const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
|
|
70198
70133
|
const rawAppFile = appFile;
|
|
70199
70134
|
let runnables = await loadRunnablesFromBackend(runnablesPath);
|
|
70200
70135
|
if (Object.keys(runnables).length === 0 && rawAppFile.runnables) {
|
|
@@ -70267,7 +70202,7 @@ async function traverseAndProcessInlineScripts(obj, processor, currentPath = [])
|
|
|
70267
70202
|
}
|
|
70268
70203
|
async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage, tempScriptRefs) {
|
|
70269
70204
|
const updatedRunnables = [];
|
|
70270
|
-
const runnablesFolder =
|
|
70205
|
+
const runnablesFolder = path13.join(appFolder, APP_BACKEND_FOLDER);
|
|
70271
70206
|
try {
|
|
70272
70207
|
await mkdir6(runnablesFolder, { recursive: true });
|
|
70273
70208
|
} catch {}
|
|
@@ -70292,7 +70227,7 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
|
|
|
70292
70227
|
if (language === "frontend") {
|
|
70293
70228
|
const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
|
|
70294
70229
|
const basePath = basePathO.replaceAll(SEP12, "/");
|
|
70295
|
-
const contentPath =
|
|
70230
|
+
const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
|
|
70296
70231
|
writeIfChanged(contentPath, content);
|
|
70297
70232
|
const simplifiedRunnable = { type: "inline" };
|
|
70298
70233
|
for (const [key, value] of Object.entries(runnable)) {
|
|
@@ -70310,8 +70245,8 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
|
|
|
70310
70245
|
const lock = await generateInlineScriptLock(workspace, content, language, `${remotePath}/${runnableId}`, rawDeps, tempScriptRefs);
|
|
70311
70246
|
const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
|
|
70312
70247
|
const basePath = basePathO.replaceAll(SEP12, "/");
|
|
70313
|
-
const contentPath =
|
|
70314
|
-
const lockPath =
|
|
70248
|
+
const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
|
|
70249
|
+
const lockPath = path13.join(runnablesFolder, `${basePath}lock`);
|
|
70315
70250
|
writeIfChanged(contentPath, content);
|
|
70316
70251
|
if (lock && lock !== "") {
|
|
70317
70252
|
writeIfChanged(lockPath, lock);
|
|
@@ -70359,8 +70294,8 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
|
|
|
70359
70294
|
}
|
|
70360
70295
|
const [basePathO, ext2] = pathAssigner.assignPath(scriptName, language);
|
|
70361
70296
|
const basePath = basePathO.replaceAll(SEP12, "/");
|
|
70362
|
-
const contentPath =
|
|
70363
|
-
const lockPath =
|
|
70297
|
+
const contentPath = path13.join(appFolder, `${basePath}${ext2}`);
|
|
70298
|
+
const lockPath = path13.join(appFolder, `${basePath}lock`);
|
|
70364
70299
|
writeIfChanged(contentPath, content);
|
|
70365
70300
|
if (lock && lock !== "") {
|
|
70366
70301
|
writeIfChanged(lockPath, lock);
|
|
@@ -70434,7 +70369,7 @@ ${text}`);
|
|
|
70434
70369
|
return lock ?? "";
|
|
70435
70370
|
}
|
|
70436
70371
|
async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultTs = "bun") {
|
|
70437
|
-
const fileName =
|
|
70372
|
+
const fileName = path13.basename(runnableFilePath);
|
|
70438
70373
|
if (fileName.endsWith(".lock") || fileName.endsWith(".yaml")) {
|
|
70439
70374
|
return;
|
|
70440
70375
|
}
|
|
@@ -70449,13 +70384,13 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
|
|
|
70449
70384
|
if (!runnableId || !ext2) {
|
|
70450
70385
|
return;
|
|
70451
70386
|
}
|
|
70452
|
-
const runnableFilePath2 =
|
|
70387
|
+
const runnableFilePath2 = path13.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
|
|
70453
70388
|
let runnable;
|
|
70454
70389
|
try {
|
|
70455
70390
|
runnable = await yamlParseFile(runnableFilePath2);
|
|
70456
70391
|
} catch {
|
|
70457
70392
|
try {
|
|
70458
|
-
const appFilePath =
|
|
70393
|
+
const appFilePath = path13.join(appFolder, "raw_app.yaml");
|
|
70459
70394
|
const appFile = await yamlParseFile(appFilePath);
|
|
70460
70395
|
if (!appFile.runnables?.[runnableId]) {
|
|
70461
70396
|
warn(colors.yellow(`Runnable ${runnableId} not found in backend folder or raw_app.yaml`));
|
|
@@ -70480,7 +70415,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
|
|
|
70480
70415
|
warn(colors.yellow(`Could not determine language for ${runnableId} (ext: ${ext2})`));
|
|
70481
70416
|
return;
|
|
70482
70417
|
}
|
|
70483
|
-
const fullFilePath =
|
|
70418
|
+
const fullFilePath = path13.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
|
|
70484
70419
|
let content;
|
|
70485
70420
|
try {
|
|
70486
70421
|
content = await readTextFile(fullFilePath);
|
|
@@ -70503,7 +70438,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
|
|
|
70503
70438
|
}
|
|
70504
70439
|
async function inferAllInlineSchemas(appFolder, defaultTs = "bun") {
|
|
70505
70440
|
const schemas = {};
|
|
70506
|
-
const backendPath =
|
|
70441
|
+
const backendPath = path13.join(appFolder, APP_BACKEND_FOLDER);
|
|
70507
70442
|
let entries;
|
|
70508
70443
|
try {
|
|
70509
70444
|
entries = await readdir7(backendPath, { withFileTypes: true });
|
|
@@ -70613,8 +70548,8 @@ var init_app_metadata = __esm(async () => {
|
|
|
70613
70548
|
// src/commands/app/generate_agents.ts
|
|
70614
70549
|
import * as fs10 from "node:fs";
|
|
70615
70550
|
import { writeFile as writeFile9 } from "node:fs/promises";
|
|
70616
|
-
import
|
|
70617
|
-
import
|
|
70551
|
+
import path14 from "node:path";
|
|
70552
|
+
import process14 from "node:process";
|
|
70618
70553
|
function generateDatatablesMarkdown(schemas, localData) {
|
|
70619
70554
|
const defaultDatatable = localData?.datatable;
|
|
70620
70555
|
const defaultSchema = localData?.schema;
|
|
@@ -70713,7 +70648,7 @@ Configure datatables in Workspace Settings > Windmill Data Tables.
|
|
|
70713
70648
|
return content;
|
|
70714
70649
|
}
|
|
70715
70650
|
async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
|
|
70716
|
-
const rawAppPath =
|
|
70651
|
+
const rawAppPath = path14.join(targetDir, "raw_app.yaml");
|
|
70717
70652
|
if (!fs10.existsSync(rawAppPath)) {
|
|
70718
70653
|
if (!silent) {
|
|
70719
70654
|
error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
|
|
@@ -70740,11 +70675,11 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
|
|
|
70740
70675
|
}
|
|
70741
70676
|
} catch {}
|
|
70742
70677
|
const agentsContent = generateAgentsDocumentation(localData);
|
|
70743
|
-
await writeFile9(
|
|
70744
|
-
await writeFile9(
|
|
70678
|
+
await writeFile9(path14.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");
|
|
70679
|
+
await writeFile9(path14.join(targetDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
|
|
70745
70680
|
`, "utf-8");
|
|
70746
70681
|
const datatablesContent = generateDatatablesMarkdown(schemas, localData);
|
|
70747
|
-
await writeFile9(
|
|
70682
|
+
await writeFile9(path14.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
|
|
70748
70683
|
if (!silent) {
|
|
70749
70684
|
info(colors.green(`✓ Generated AGENTS.md, CLAUDE.md, and DATATABLES.md`));
|
|
70750
70685
|
const datatableCount = schemas.length;
|
|
@@ -70762,24 +70697,24 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
|
|
|
70762
70697
|
}
|
|
70763
70698
|
}
|
|
70764
70699
|
async function generateAgents(opts, appFolder) {
|
|
70765
|
-
const cwd =
|
|
70700
|
+
const cwd = process14.cwd();
|
|
70766
70701
|
let targetDir = cwd;
|
|
70767
70702
|
if (appFolder) {
|
|
70768
|
-
targetDir =
|
|
70703
|
+
targetDir = path14.isAbsolute(appFolder) ? appFolder : path14.join(cwd, appFolder);
|
|
70769
70704
|
}
|
|
70770
70705
|
await loadNonDottedPathsSetting();
|
|
70771
|
-
const dirName =
|
|
70706
|
+
const dirName = path14.basename(targetDir);
|
|
70772
70707
|
if (!hasFolderSuffix(dirName, "raw_app")) {
|
|
70773
|
-
if (!hasFolderSuffix(
|
|
70708
|
+
if (!hasFolderSuffix(path14.basename(cwd), "raw_app") && !appFolder) {
|
|
70774
70709
|
error(colors.red(`Error: Must be run inside a ${getFolderSuffix("raw_app")} folder or specify one as argument.`));
|
|
70775
70710
|
info(colors.gray("Usage: wmill app generate-agents [app_folder]"));
|
|
70776
|
-
|
|
70711
|
+
process14.exit(1);
|
|
70777
70712
|
}
|
|
70778
70713
|
}
|
|
70779
|
-
const rawAppPath =
|
|
70714
|
+
const rawAppPath = path14.join(targetDir, "raw_app.yaml");
|
|
70780
70715
|
if (!fs10.existsSync(rawAppPath)) {
|
|
70781
70716
|
error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
|
|
70782
|
-
|
|
70717
|
+
process14.exit(1);
|
|
70783
70718
|
}
|
|
70784
70719
|
const workspace = await resolveWorkspace(opts);
|
|
70785
70720
|
await requireLogin(opts);
|
|
@@ -70806,33 +70741,33 @@ var init_generate_agents = __esm(async () => {
|
|
|
70806
70741
|
import { sep as SEP13 } from "node:path";
|
|
70807
70742
|
import * as http2 from "node:http";
|
|
70808
70743
|
import * as fs11 from "node:fs";
|
|
70809
|
-
import * as
|
|
70810
|
-
import
|
|
70811
|
-
import { writeFileSync as
|
|
70744
|
+
import * as path15 from "node:path";
|
|
70745
|
+
import process15 from "node:process";
|
|
70746
|
+
import { writeFileSync as writeFileSync5 } from "node:fs";
|
|
70812
70747
|
async function dev(opts, appFolder) {
|
|
70813
70748
|
GLOBAL_CONFIG_OPT.noCdToRoot = true;
|
|
70814
70749
|
await loadNonDottedPathsSetting();
|
|
70815
|
-
const originalCwd =
|
|
70750
|
+
const originalCwd = process15.cwd();
|
|
70816
70751
|
let targetDir = originalCwd;
|
|
70817
70752
|
if (appFolder) {
|
|
70818
|
-
targetDir =
|
|
70753
|
+
targetDir = path15.isAbsolute(appFolder) ? appFolder : path15.join(originalCwd, appFolder);
|
|
70819
70754
|
if (!fs11.existsSync(targetDir)) {
|
|
70820
70755
|
error(colors.red(`Error: Directory not found: ${targetDir}`));
|
|
70821
|
-
|
|
70756
|
+
process15.exit(1);
|
|
70822
70757
|
}
|
|
70823
70758
|
}
|
|
70824
|
-
const targetDirName =
|
|
70759
|
+
const targetDirName = path15.basename(targetDir);
|
|
70825
70760
|
if (!hasFolderSuffix(targetDirName, "raw_app")) {
|
|
70826
70761
|
error(colors.red(`Error: The dev command must be run inside a ${getFolderSuffix("raw_app")} folder.
|
|
70827
70762
|
` + `Target directory: ${targetDirName}
|
|
70828
70763
|
` + `Please navigate to a folder ending with '${getFolderSuffix("raw_app")}' or specify one as argument.`));
|
|
70829
|
-
|
|
70764
|
+
process15.exit(1);
|
|
70830
70765
|
}
|
|
70831
|
-
const rawAppPath =
|
|
70766
|
+
const rawAppPath = path15.join(targetDir, "raw_app.yaml");
|
|
70832
70767
|
if (!fs11.existsSync(rawAppPath)) {
|
|
70833
70768
|
error(colors.red(`Error: raw_app.yaml not found in ${targetDir}.
|
|
70834
70769
|
` + `The dev command requires a ${getFolderSuffix("raw_app")} folder containing a raw_app.yaml file.`));
|
|
70835
|
-
|
|
70770
|
+
process15.exit(1);
|
|
70836
70771
|
}
|
|
70837
70772
|
const workspace = await resolveWorkspace(opts);
|
|
70838
70773
|
await requireLogin(opts);
|
|
@@ -70840,25 +70775,25 @@ async function dev(opts, appFolder) {
|
|
|
70840
70775
|
let appTempRefs = undefined;
|
|
70841
70776
|
{
|
|
70842
70777
|
const wmillYamlPath = getWmillYamlPath();
|
|
70843
|
-
const workspaceRoot = wmillYamlPath ?
|
|
70844
|
-
const relAppFolder =
|
|
70778
|
+
const workspaceRoot = wmillYamlPath ? path15.dirname(wmillYamlPath) : originalCwd;
|
|
70779
|
+
const relAppFolder = path15.relative(workspaceRoot, targetDir) || ".";
|
|
70845
70780
|
const mergedOpts = await mergeConfigWithConfigFile(opts);
|
|
70846
70781
|
const codebases = await listSyncCodebases(mergedOpts);
|
|
70847
70782
|
const { buildPreviewTempScriptRefs: buildPreviewTempScriptRefs2 } = await init_generate_metadata().then(() => exports_generate_metadata);
|
|
70848
|
-
const savedCwd =
|
|
70783
|
+
const savedCwd = process15.cwd();
|
|
70849
70784
|
if (workspaceRoot !== savedCwd) {
|
|
70850
|
-
|
|
70785
|
+
process15.chdir(workspaceRoot);
|
|
70851
70786
|
}
|
|
70852
70787
|
try {
|
|
70853
70788
|
appTempRefs = await buildPreviewTempScriptRefs2(workspace, mergedOpts, codebases, { kind: "app", folder: relAppFolder, rawApp: true });
|
|
70854
70789
|
} finally {
|
|
70855
70790
|
if (workspaceRoot !== savedCwd) {
|
|
70856
|
-
|
|
70791
|
+
process15.chdir(savedCwd);
|
|
70857
70792
|
}
|
|
70858
70793
|
}
|
|
70859
70794
|
}
|
|
70860
70795
|
if (appFolder) {
|
|
70861
|
-
|
|
70796
|
+
process15.chdir(targetDir);
|
|
70862
70797
|
}
|
|
70863
70798
|
const rawApp = await yamlParseFile(rawAppPath);
|
|
70864
70799
|
const appPath = rawApp?.custom_path ?? "u/unknown/newapp";
|
|
@@ -70872,30 +70807,30 @@ async function dev(opts, appFolder) {
|
|
|
70872
70807
|
port: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((p) => p + DEFAULT_PORT)
|
|
70873
70808
|
});
|
|
70874
70809
|
const shouldOpen = opts.open ?? true;
|
|
70875
|
-
const frameworks = detectFrameworks(
|
|
70810
|
+
const frameworks = detectFrameworks(process15.cwd());
|
|
70876
70811
|
const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
70877
70812
|
const entryPoint = opts.entry ?? defaultEntry;
|
|
70878
70813
|
if (!fs11.existsSync(entryPoint)) {
|
|
70879
70814
|
error(colors.red(`Entry point "${entryPoint}" not found. Please specify a valid entry point with --entry.`));
|
|
70880
|
-
|
|
70815
|
+
process15.exit(1);
|
|
70881
70816
|
}
|
|
70882
|
-
const appDir =
|
|
70817
|
+
const appDir = path15.dirname(entryPoint) || process15.cwd();
|
|
70883
70818
|
await ensureNodeModules(appDir);
|
|
70884
70819
|
const inferredSchemas = {};
|
|
70885
70820
|
try {
|
|
70886
|
-
Object.assign(inferredSchemas, await inferAllInlineSchemas(
|
|
70821
|
+
Object.assign(inferredSchemas, await inferAllInlineSchemas(process15.cwd()));
|
|
70887
70822
|
} catch (err) {
|
|
70888
70823
|
warn(colors.yellow(`Could not seed inline schemas at startup: ${err.message}`));
|
|
70889
70824
|
}
|
|
70890
70825
|
const pathRunnableSchemas = {};
|
|
70891
70826
|
try {
|
|
70892
|
-
const initialRunnables = await loadRunnablesFromBackend(
|
|
70827
|
+
const initialRunnables = await loadRunnablesFromBackend(path15.join(process15.cwd(), APP_BACKEND_FOLDER));
|
|
70893
70828
|
Object.assign(pathRunnableSchemas, await fetchPathRunnableSchemas(workspaceId, initialRunnables));
|
|
70894
70829
|
} catch (err) {
|
|
70895
70830
|
warn(colors.yellow(`Could not fetch schemas for path-based runnables: ${err.message}`));
|
|
70896
70831
|
}
|
|
70897
70832
|
await genRunnablesTs(inferredSchemas, pathRunnableSchemas);
|
|
70898
|
-
const distDir =
|
|
70833
|
+
const distDir = path15.join(process15.cwd(), "dist");
|
|
70899
70834
|
if (!fs11.existsSync(distDir)) {
|
|
70900
70835
|
fs11.mkdirSync(distDir);
|
|
70901
70836
|
}
|
|
@@ -70958,7 +70893,7 @@ data: reload
|
|
|
70958
70893
|
info(colors.blue(`\uD83D\uDC40 Watching for file changes...
|
|
70959
70894
|
`));
|
|
70960
70895
|
await ctx.rebuild();
|
|
70961
|
-
const runnablesPath =
|
|
70896
|
+
const runnablesPath = path15.join(process15.cwd(), APP_BACKEND_FOLDER);
|
|
70962
70897
|
let runnablesWatcher;
|
|
70963
70898
|
if (fs11.existsSync(runnablesPath)) {
|
|
70964
70899
|
info(colors.blue(`\uD83D\uDC41️ Watching runnables folder at: ${runnablesPath}
|
|
@@ -70970,8 +70905,8 @@ data: reload
|
|
|
70970
70905
|
if (!filename)
|
|
70971
70906
|
return;
|
|
70972
70907
|
const fileStr = typeof filename === "string" ? filename : filename.toString();
|
|
70973
|
-
const changedPath =
|
|
70974
|
-
const relativePath =
|
|
70908
|
+
const changedPath = path15.join(runnablesPath, fileStr);
|
|
70909
|
+
const relativePath = path15.relative(process15.cwd(), changedPath);
|
|
70975
70910
|
const relativeToRunnables = fileStr;
|
|
70976
70911
|
if (changedPath.endsWith(".lock")) {
|
|
70977
70912
|
return;
|
|
@@ -70984,7 +70919,7 @@ data: reload
|
|
|
70984
70919
|
delete schemaInferenceTimeouts[changedPath];
|
|
70985
70920
|
try {
|
|
70986
70921
|
info(colors.cyan(`\uD83D\uDCDD Inferring schema for: ${relativeToRunnables}`));
|
|
70987
|
-
const result = await inferRunnableSchemaFromFile(
|
|
70922
|
+
const result = await inferRunnableSchemaFromFile(process15.cwd(), relativeToRunnables);
|
|
70988
70923
|
if (result) {
|
|
70989
70924
|
inferredSchemas[result.runnableId] = result.schema;
|
|
70990
70925
|
info(colors.green(` Inferred Schemas: ${JSON.stringify(inferredSchemas, null, 2)}`));
|
|
@@ -71022,7 +70957,7 @@ data: reload
|
|
|
71022
70957
|
return;
|
|
71023
70958
|
}
|
|
71024
70959
|
if (url === "/dist/bundle.js" || url === "/bundle.js") {
|
|
71025
|
-
const jsPath =
|
|
70960
|
+
const jsPath = path15.join(process15.cwd(), "dist/bundle.js");
|
|
71026
70961
|
if (fs11.existsSync(jsPath)) {
|
|
71027
70962
|
res.writeHead(200, { "Content-Type": "application/javascript" });
|
|
71028
70963
|
res.end(fs11.readFileSync(jsPath));
|
|
@@ -71033,7 +70968,7 @@ data: reload
|
|
|
71033
70968
|
return;
|
|
71034
70969
|
}
|
|
71035
70970
|
if (url === "/dist/bundle.css" || url === "/bundle.css") {
|
|
71036
|
-
const cssPath =
|
|
70971
|
+
const cssPath = path15.join(process15.cwd(), "dist/bundle.css");
|
|
71037
70972
|
if (fs11.existsSync(cssPath)) {
|
|
71038
70973
|
res.writeHead(200, { "Content-Type": "text/css" });
|
|
71039
70974
|
res.end(fs11.readFileSync(cssPath));
|
|
@@ -71044,7 +70979,7 @@ data: reload
|
|
|
71044
70979
|
return;
|
|
71045
70980
|
}
|
|
71046
70981
|
if (url === "/dist/bundle.js.map" || url === "/bundle.js.map") {
|
|
71047
|
-
const mapPath =
|
|
70982
|
+
const mapPath = path15.join(process15.cwd(), "dist/bundle.js.map");
|
|
71048
70983
|
if (fs11.existsSync(mapPath)) {
|
|
71049
70984
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
71050
70985
|
res.end(fs11.readFileSync(mapPath));
|
|
@@ -71055,7 +70990,7 @@ data: reload
|
|
|
71055
70990
|
return;
|
|
71056
70991
|
}
|
|
71057
70992
|
if (url === "/dist/bundle.css.map" || url === "/bundle.css.map") {
|
|
71058
|
-
const mapPath =
|
|
70993
|
+
const mapPath = path15.join(process15.cwd(), "dist/bundle.css.map");
|
|
71059
70994
|
if (fs11.existsSync(mapPath)) {
|
|
71060
70995
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
71061
70996
|
res.end(fs11.readFileSync(mapPath));
|
|
@@ -71069,12 +71004,12 @@ data: reload
|
|
|
71069
71004
|
res.end(createHTML("/dist/bundle.js", "/dist/bundle.css"));
|
|
71070
71005
|
});
|
|
71071
71006
|
const wss = new import_websocket_server.default({ server });
|
|
71072
|
-
const sqlToApplyPath =
|
|
71007
|
+
const sqlToApplyPath = path15.join(process15.cwd(), "sql_to_apply");
|
|
71073
71008
|
const sqlFileQueue = [];
|
|
71074
71009
|
let currentSqlFile = null;
|
|
71075
71010
|
async function getDatatableConfig() {
|
|
71076
71011
|
try {
|
|
71077
|
-
const rawApp2 = await yamlParseFile(
|
|
71012
|
+
const rawApp2 = await yamlParseFile(path15.join(process15.cwd(), "raw_app.yaml"));
|
|
71078
71013
|
return rawApp2?.data?.datatable;
|
|
71079
71014
|
} catch {
|
|
71080
71015
|
return;
|
|
@@ -71111,12 +71046,12 @@ data: reload
|
|
|
71111
71046
|
}
|
|
71112
71047
|
const filePath = sqlFileQueue.shift();
|
|
71113
71048
|
if (!fs11.existsSync(filePath)) {
|
|
71114
|
-
info(colors.gray(`File no longer exists: ${
|
|
71049
|
+
info(colors.gray(`File no longer exists: ${path15.basename(filePath)}`));
|
|
71115
71050
|
await processNextSqlFile();
|
|
71116
71051
|
return;
|
|
71117
71052
|
}
|
|
71118
71053
|
currentSqlFile = filePath;
|
|
71119
|
-
const fileName =
|
|
71054
|
+
const fileName = path15.basename(filePath);
|
|
71120
71055
|
try {
|
|
71121
71056
|
const sqlContent = await readTextFile(filePath);
|
|
71122
71057
|
if (!sqlContent.trim()) {
|
|
@@ -71138,9 +71073,9 @@ data: reload
|
|
|
71138
71073
|
if (deleteFile && fs11.existsSync(filePath)) {
|
|
71139
71074
|
try {
|
|
71140
71075
|
fs11.unlinkSync(filePath);
|
|
71141
|
-
info(colors.green(`✓ Deleted: ${
|
|
71076
|
+
info(colors.green(`✓ Deleted: ${path15.basename(filePath)}`));
|
|
71142
71077
|
} catch (error2) {
|
|
71143
|
-
error(colors.red(`Failed to delete ${
|
|
71078
|
+
error(colors.red(`Failed to delete ${path15.basename(filePath)}: ${error2.message}`));
|
|
71144
71079
|
}
|
|
71145
71080
|
}
|
|
71146
71081
|
currentSqlFile = null;
|
|
@@ -71152,7 +71087,7 @@ data: reload
|
|
|
71152
71087
|
try {
|
|
71153
71088
|
const sqlContent = await readTextFile(currentSqlFile);
|
|
71154
71089
|
const datatable = await getDatatableConfig();
|
|
71155
|
-
const fileName =
|
|
71090
|
+
const fileName = path15.basename(currentSqlFile);
|
|
71156
71091
|
ws.send(JSON.stringify({
|
|
71157
71092
|
type: "sqlMigration",
|
|
71158
71093
|
fileName,
|
|
@@ -71166,7 +71101,7 @@ data: reload
|
|
|
71166
71101
|
const sqlFiles = entries.filter((entry) => entry.endsWith(".sql"));
|
|
71167
71102
|
if (sqlFiles.length > 0 && sqlFileQueue.length === 0) {
|
|
71168
71103
|
for (const sqlFile of sqlFiles.sort()) {
|
|
71169
|
-
queueSqlFile(
|
|
71104
|
+
queueSqlFile(path15.join(sqlToApplyPath, sqlFile));
|
|
71170
71105
|
}
|
|
71171
71106
|
await processNextSqlFile();
|
|
71172
71107
|
}
|
|
@@ -71293,7 +71228,7 @@ data: reload
|
|
|
71293
71228
|
await onSqlFileCompleted(currentSqlFile, true);
|
|
71294
71229
|
}
|
|
71295
71230
|
try {
|
|
71296
|
-
await regenerateAgentDocs(workspaceId,
|
|
71231
|
+
await regenerateAgentDocs(workspaceId, process15.cwd(), true);
|
|
71297
71232
|
info(colors.gray(`[SQL Migration] Refreshed AGENTS.md and DATATABLES.md`));
|
|
71298
71233
|
} catch (regenError) {
|
|
71299
71234
|
warn(colors.yellow(`[SQL Migration] Could not refresh docs: ${regenError.message}`));
|
|
@@ -71345,7 +71280,7 @@ data: reload
|
|
|
71345
71280
|
}
|
|
71346
71281
|
info(colors.blue(`\uD83D\uDD0D Found ${sqlFiles.length} SQL file(s) in sql_to_apply/`));
|
|
71347
71282
|
for (const sqlFile of sqlFiles) {
|
|
71348
|
-
const filePath =
|
|
71283
|
+
const filePath = path15.join(sqlToApplyPath, sqlFile);
|
|
71349
71284
|
queueSqlFile(filePath);
|
|
71350
71285
|
}
|
|
71351
71286
|
await processNextSqlFile();
|
|
@@ -71363,11 +71298,11 @@ data: reload
|
|
|
71363
71298
|
if (!filename)
|
|
71364
71299
|
return;
|
|
71365
71300
|
const fileStr = typeof filename === "string" ? filename : filename.toString();
|
|
71366
|
-
const changedPath =
|
|
71301
|
+
const changedPath = path15.join(sqlToApplyPath, fileStr);
|
|
71367
71302
|
if (!changedPath.endsWith(".sql")) {
|
|
71368
71303
|
return;
|
|
71369
71304
|
}
|
|
71370
|
-
const fileName =
|
|
71305
|
+
const fileName = path15.basename(changedPath);
|
|
71371
71306
|
if (sqlDebounceTimeouts[changedPath]) {
|
|
71372
71307
|
clearTimeout(sqlDebounceTimeouts[changedPath]);
|
|
71373
71308
|
}
|
|
@@ -71392,7 +71327,7 @@ data: reload
|
|
|
71392
71327
|
const url = `http://${host}:${port}`;
|
|
71393
71328
|
info(colors.bold.green(`\uD83D\uDE80 Dev server running at ${url}`));
|
|
71394
71329
|
info(colors.cyan(`\uD83D\uDD0C WebSocket server running at ws://${host}:${port}`));
|
|
71395
|
-
info(colors.gray(`\uD83D\uDCE6 Serving files from: ${
|
|
71330
|
+
info(colors.gray(`\uD83D\uDCE6 Serving files from: ${process15.cwd()}`));
|
|
71396
71331
|
info(colors.gray(`\uD83D\uDD04 Live reload enabled
|
|
71397
71332
|
`));
|
|
71398
71333
|
if (shouldOpen) {
|
|
@@ -71406,7 +71341,7 @@ data: reload
|
|
|
71406
71341
|
}
|
|
71407
71342
|
}
|
|
71408
71343
|
});
|
|
71409
|
-
|
|
71344
|
+
process15.on("SIGINT", async () => {
|
|
71410
71345
|
info(colors.yellow(`
|
|
71411
71346
|
|
|
71412
71347
|
\uD83D\uDED1 Shutting down...`));
|
|
@@ -71419,17 +71354,17 @@ data: reload
|
|
|
71419
71354
|
sqlWatcher.close();
|
|
71420
71355
|
}
|
|
71421
71356
|
await ctx.dispose();
|
|
71422
|
-
|
|
71357
|
+
process15.exit(0);
|
|
71423
71358
|
});
|
|
71424
71359
|
}
|
|
71425
71360
|
async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides = {}) {
|
|
71426
71361
|
info(colors.blue("\uD83D\uDD04 Generating wmill.d.ts..."));
|
|
71427
|
-
const localPath =
|
|
71428
|
-
const backendPath =
|
|
71362
|
+
const localPath = process15.cwd();
|
|
71363
|
+
const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
|
|
71429
71364
|
let runnables = await loadRunnablesFromBackend(backendPath);
|
|
71430
71365
|
if (Object.keys(runnables).length === 0) {
|
|
71431
71366
|
try {
|
|
71432
|
-
const rawApp = await yamlParseFile(
|
|
71367
|
+
const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
|
|
71433
71368
|
runnables = rawApp?.["runnables"] ?? {};
|
|
71434
71369
|
} catch {
|
|
71435
71370
|
runnables = {};
|
|
@@ -71437,7 +71372,7 @@ async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides =
|
|
|
71437
71372
|
}
|
|
71438
71373
|
try {
|
|
71439
71374
|
const newWmillTs = buildWmillTs(runnables, inlineSchemaOverrides, pathSchemaOverrides);
|
|
71440
|
-
|
|
71375
|
+
writeFileSync5(path15.join(process15.cwd(), "wmill.d.ts"), newWmillTs);
|
|
71441
71376
|
} catch (error2) {
|
|
71442
71377
|
error(colors.red(`Failed to generate wmill.d.ts: ${error2.message}`));
|
|
71443
71378
|
}
|
|
@@ -71506,11 +71441,11 @@ function convertRunnablesToApiFormat(runnables) {
|
|
|
71506
71441
|
}
|
|
71507
71442
|
async function loadRunnables() {
|
|
71508
71443
|
try {
|
|
71509
|
-
const localPath =
|
|
71510
|
-
const backendPath =
|
|
71444
|
+
const localPath = process15.cwd();
|
|
71445
|
+
const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
|
|
71511
71446
|
let runnables = await loadRunnablesFromBackend(backendPath);
|
|
71512
71447
|
if (Object.keys(runnables).length === 0) {
|
|
71513
|
-
const rawApp = await yamlParseFile(
|
|
71448
|
+
const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
|
|
71514
71449
|
runnables = rawApp?.runnables ?? {};
|
|
71515
71450
|
}
|
|
71516
71451
|
convertRunnablesToApiFormat(runnables);
|
|
@@ -72014,8 +71949,8 @@ var init_dev = __esm(async () => {
|
|
|
72014
71949
|
|
|
72015
71950
|
// src/commands/app/lint.ts
|
|
72016
71951
|
import * as fs12 from "node:fs";
|
|
72017
|
-
import * as
|
|
72018
|
-
import
|
|
71952
|
+
import * as path16 from "node:path";
|
|
71953
|
+
import process16 from "node:process";
|
|
72019
71954
|
function validateRawAppYaml(appData) {
|
|
72020
71955
|
const errors = [];
|
|
72021
71956
|
const warnings = [];
|
|
@@ -72029,7 +71964,7 @@ function validateRawAppYaml(appData) {
|
|
|
72029
71964
|
async function validateRunnables(appDir, appData) {
|
|
72030
71965
|
const errors = [];
|
|
72031
71966
|
const warnings = [];
|
|
72032
|
-
const backendPath =
|
|
71967
|
+
const backendPath = path16.join(appDir, APP_BACKEND_FOLDER);
|
|
72033
71968
|
const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
|
|
72034
71969
|
const hasBackendRunnables = Object.keys(runnablesFromBackend).length > 0;
|
|
72035
71970
|
const hasYamlRunnables = appData.runnables && typeof appData.runnables === "object" && !Array.isArray(appData.runnables) && Object.keys(appData.runnables).length > 0;
|
|
@@ -72052,7 +71987,7 @@ async function validateBuild(appDir) {
|
|
|
72052
71987
|
info(colors.blue("\uD83D\uDD28 Testing build..."));
|
|
72053
71988
|
const frameworks = detectFrameworks(appDir);
|
|
72054
71989
|
const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
72055
|
-
const entryPoint =
|
|
71990
|
+
const entryPoint = path16.join(appDir, entryFile);
|
|
72056
71991
|
await createBundle({
|
|
72057
71992
|
entryPoint,
|
|
72058
71993
|
production: true,
|
|
@@ -72067,12 +72002,12 @@ async function validateBuild(appDir) {
|
|
|
72067
72002
|
async function lintRawApp(appDir, opts) {
|
|
72068
72003
|
const errors = [];
|
|
72069
72004
|
const warnings = [];
|
|
72070
|
-
const currentDirName =
|
|
72005
|
+
const currentDirName = path16.basename(appDir);
|
|
72071
72006
|
if (!hasFolderSuffix(currentDirName, "raw_app")) {
|
|
72072
72007
|
errors.push(`Not a raw app folder: '${currentDirName}' does not end with '${getFolderSuffix("raw_app")}'`);
|
|
72073
72008
|
return { valid: false, errors, warnings };
|
|
72074
72009
|
}
|
|
72075
|
-
const rawAppPath =
|
|
72010
|
+
const rawAppPath = path16.join(appDir, "raw_app.yaml");
|
|
72076
72011
|
if (!fs12.existsSync(rawAppPath)) {
|
|
72077
72012
|
errors.push("Missing raw_app.yaml file");
|
|
72078
72013
|
return { valid: false, errors, warnings };
|
|
@@ -72111,7 +72046,7 @@ async function lintRawApp(appDir, opts) {
|
|
|
72111
72046
|
}
|
|
72112
72047
|
async function lint2(opts, appFolder) {
|
|
72113
72048
|
await loadNonDottedPathsSetting();
|
|
72114
|
-
const targetDir = appFolder ??
|
|
72049
|
+
const targetDir = appFolder ?? process16.cwd();
|
|
72115
72050
|
info(colors.bold.blue(`
|
|
72116
72051
|
\uD83D\uDD0D Linting raw app: ${targetDir}
|
|
72117
72052
|
`));
|
|
@@ -72132,7 +72067,7 @@ async function lint2(opts, appFolder) {
|
|
|
72132
72067
|
info(colors.red(`
|
|
72133
72068
|
❌ Lint failed
|
|
72134
72069
|
`));
|
|
72135
|
-
|
|
72070
|
+
process16.exit(1);
|
|
72136
72071
|
}
|
|
72137
72072
|
info(colors.green(`
|
|
72138
72073
|
✅ All checks passed
|
|
@@ -72156,8 +72091,8 @@ var init_lint2 = __esm(async () => {
|
|
|
72156
72091
|
|
|
72157
72092
|
// src/commands/app/new.ts
|
|
72158
72093
|
import { stat as stat9, writeFile as writeFile10, mkdir as mkdir7, rm as rm3 } from "node:fs/promises";
|
|
72159
|
-
import
|
|
72160
|
-
import { execSync as
|
|
72094
|
+
import path17 from "node:path";
|
|
72095
|
+
import { execSync as execSync5, exec, execFile as execFile6 } from "node:child_process";
|
|
72161
72096
|
function validateAppPath(appPath) {
|
|
72162
72097
|
if (!appPath.startsWith("u/") && !appPath.startsWith("f/")) {
|
|
72163
72098
|
return {
|
|
@@ -72412,7 +72347,7 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
72412
72347
|
}
|
|
72413
72348
|
await loadNonDottedPathsSetting();
|
|
72414
72349
|
const folderName2 = buildFolderPath(appPath, "raw_app");
|
|
72415
|
-
const appDir =
|
|
72350
|
+
const appDir = path17.join(process.cwd(), folderName2);
|
|
72416
72351
|
let dirExists = false;
|
|
72417
72352
|
try {
|
|
72418
72353
|
await stat9(appDir);
|
|
@@ -72437,17 +72372,17 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
72437
72372
|
await rm3(appDir, { recursive: true, force: true });
|
|
72438
72373
|
}
|
|
72439
72374
|
await mkdir7(appDir, { recursive: true });
|
|
72440
|
-
await mkdir7(
|
|
72441
|
-
await mkdir7(
|
|
72375
|
+
await mkdir7(path17.join(appDir, "backend"), { recursive: true });
|
|
72376
|
+
await mkdir7(path17.join(appDir, "sql_to_apply"), { recursive: true });
|
|
72442
72377
|
const rawAppConfig = {
|
|
72443
72378
|
summary
|
|
72444
72379
|
};
|
|
72445
72380
|
if (dataConfig.datatable) {
|
|
72446
72381
|
rawAppConfig.data = dataConfig;
|
|
72447
72382
|
}
|
|
72448
|
-
await writeFile10(
|
|
72383
|
+
await writeFile10(path17.join(appDir, "raw_app.yaml"), import_yaml22.stringify(rawAppConfig, yamlOptions), "utf-8");
|
|
72449
72384
|
for (const [filePath, content] of Object.entries(template.files)) {
|
|
72450
|
-
const fullPath =
|
|
72385
|
+
const fullPath = path17.join(appDir, filePath.slice(1));
|
|
72451
72386
|
await writeFile10(fullPath, content.trim() + `
|
|
72452
72387
|
`, "utf-8");
|
|
72453
72388
|
}
|
|
@@ -72457,21 +72392,21 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
72457
72392
|
schema: dataConfig.schema
|
|
72458
72393
|
} : undefined;
|
|
72459
72394
|
const agentsContent = generateAgentsDocumentation(dataForDocs);
|
|
72460
|
-
await writeFile10(
|
|
72461
|
-
await writeFile10(
|
|
72395
|
+
await writeFile10(path17.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
|
|
72396
|
+
await writeFile10(path17.join(appDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
|
|
72462
72397
|
`, "utf-8");
|
|
72463
72398
|
const datatablesContent = generateDatatablesDocumentation(dataForDocs);
|
|
72464
|
-
await writeFile10(
|
|
72399
|
+
await writeFile10(path17.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
|
|
72465
72400
|
const exampleRunnable = {
|
|
72466
72401
|
type: "inline",
|
|
72467
72402
|
path: undefined
|
|
72468
72403
|
};
|
|
72469
|
-
await writeFile10(
|
|
72470
|
-
await writeFile10(
|
|
72404
|
+
await writeFile10(path17.join(appDir, "backend", "a.yaml"), import_yaml22.stringify(exampleRunnable, yamlOptions), "utf-8");
|
|
72405
|
+
await writeFile10(path17.join(appDir, "backend", "a.ts"), `export async function main(x: number): Promise<string> {
|
|
72471
72406
|
return \`Hello from backend! x = \${x}\`;
|
|
72472
72407
|
}
|
|
72473
72408
|
`, "utf-8");
|
|
72474
|
-
await writeFile10(
|
|
72409
|
+
await writeFile10(path17.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
|
|
72475
72410
|
|
|
72476
72411
|
This folder is for SQL migration files that will be applied to datatables during development.
|
|
72477
72412
|
|
|
@@ -72499,7 +72434,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
72499
72434
|
- Use idempotent SQL (\`CREATE TABLE IF NOT EXISTS\`, etc.)
|
|
72500
72435
|
`);
|
|
72501
72436
|
if (createSchemaSQL && schemaName) {
|
|
72502
|
-
await writeFile10(
|
|
72437
|
+
await writeFile10(path17.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
|
|
72503
72438
|
}
|
|
72504
72439
|
info("");
|
|
72505
72440
|
info(colors.bold.green(`App created successfully at ${folderName2}/`));
|
|
@@ -72543,7 +72478,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
72543
72478
|
let hasClaudeDesktop = false;
|
|
72544
72479
|
if (process.platform === "darwin") {
|
|
72545
72480
|
try {
|
|
72546
|
-
|
|
72481
|
+
execSync5("ls /Applications/Claude.app", { stdio: "ignore" });
|
|
72547
72482
|
hasClaudeDesktop = true;
|
|
72548
72483
|
} catch {}
|
|
72549
72484
|
}
|
|
@@ -72555,9 +72490,9 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
72555
72490
|
});
|
|
72556
72491
|
if (openInDesktop) {
|
|
72557
72492
|
try {
|
|
72558
|
-
const absAppDir =
|
|
72559
|
-
const claudeDir =
|
|
72560
|
-
const launchPath =
|
|
72493
|
+
const absAppDir = path17.resolve(appDir);
|
|
72494
|
+
const claudeDir = path17.join(absAppDir, ".claude");
|
|
72495
|
+
const launchPath = path17.join(claudeDir, "launch.json");
|
|
72561
72496
|
if (!await stat9(launchPath).catch(() => null)) {
|
|
72562
72497
|
const launchJson = JSON.stringify({
|
|
72563
72498
|
version: "0.0.1",
|
|
@@ -72572,7 +72507,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
72572
72507
|
`;
|
|
72573
72508
|
await mkdir7(claudeDir, { recursive: true });
|
|
72574
72509
|
await writeFile10(launchPath, launchJson, "utf-8");
|
|
72575
|
-
info(colors.gray(`Seeded ${
|
|
72510
|
+
info(colors.gray(`Seeded ${path17.relative(process.cwd(), launchPath)}`));
|
|
72576
72511
|
}
|
|
72577
72512
|
const sessionId = crypto.randomUUID();
|
|
72578
72513
|
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
@@ -72874,8 +72809,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
72874
72809
|
if (!localPath.endsWith(SEP14)) {
|
|
72875
72810
|
localPath += SEP14;
|
|
72876
72811
|
}
|
|
72877
|
-
const
|
|
72878
|
-
const localApp = await yamlParseFile(
|
|
72812
|
+
const path18 = localPath + "app.yaml";
|
|
72813
|
+
const localApp = await yamlParseFile(path18);
|
|
72879
72814
|
replaceInlineScripts2(localApp.value, localPath, true);
|
|
72880
72815
|
await generatingPolicy2(localApp, remotePath, localApp?.["public"] ?? localApp?.["policy"]?.["execution_mode"] == "anonymous");
|
|
72881
72816
|
const preserveFields = {};
|
|
@@ -72921,13 +72856,13 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
72921
72856
|
}
|
|
72922
72857
|
await applyExtraPermsDiff(workspace, "app", remotePath, localPerms, app?.extra_perms);
|
|
72923
72858
|
}
|
|
72924
|
-
async function generatingPolicy2(app,
|
|
72925
|
-
info(colors.gray(`Generating fresh policy for app ${
|
|
72859
|
+
async function generatingPolicy2(app, path18, publicApp) {
|
|
72860
|
+
info(colors.gray(`Generating fresh policy for app ${path18}...`));
|
|
72926
72861
|
try {
|
|
72927
72862
|
app.policy = await updatePolicy(app.value, undefined);
|
|
72928
72863
|
app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
|
|
72929
72864
|
} catch (e) {
|
|
72930
|
-
error(colors.red(`Error generating policy for app ${
|
|
72865
|
+
error(colors.red(`Error generating policy for app ${path18}: ${e}`));
|
|
72931
72866
|
throw e;
|
|
72932
72867
|
}
|
|
72933
72868
|
}
|
|
@@ -72956,12 +72891,12 @@ async function list6(opts) {
|
|
|
72956
72891
|
new Table2().header(["path", "summary"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary])).render();
|
|
72957
72892
|
}
|
|
72958
72893
|
}
|
|
72959
|
-
async function get4(opts,
|
|
72894
|
+
async function get4(opts, path18) {
|
|
72960
72895
|
const workspace = await resolveWorkspace(opts);
|
|
72961
72896
|
await requireLogin(opts);
|
|
72962
72897
|
const a = await getAppByPath({
|
|
72963
72898
|
workspace: workspace.workspaceId,
|
|
72964
|
-
path:
|
|
72899
|
+
path: path18
|
|
72965
72900
|
});
|
|
72966
72901
|
if (opts.json) {
|
|
72967
72902
|
console.log(JSON.stringify(a));
|
|
@@ -73347,11 +73282,11 @@ async function list8(opts) {
|
|
|
73347
73282
|
])).render();
|
|
73348
73283
|
}
|
|
73349
73284
|
}
|
|
73350
|
-
async function newVariable(opts,
|
|
73351
|
-
if (!validatePath(
|
|
73285
|
+
async function newVariable(opts, path18) {
|
|
73286
|
+
if (!validatePath(path18)) {
|
|
73352
73287
|
return;
|
|
73353
73288
|
}
|
|
73354
|
-
const filePath =
|
|
73289
|
+
const filePath = path18 + ".variable.yaml";
|
|
73355
73290
|
try {
|
|
73356
73291
|
await stat12(filePath);
|
|
73357
73292
|
throw new Error("File already exists: " + filePath);
|
|
@@ -73371,14 +73306,14 @@ async function newVariable(opts, path19) {
|
|
|
73371
73306
|
});
|
|
73372
73307
|
info(colors.green(`Created ${filePath}`));
|
|
73373
73308
|
}
|
|
73374
|
-
async function get6(opts,
|
|
73309
|
+
async function get6(opts, path18) {
|
|
73375
73310
|
if (opts.json)
|
|
73376
73311
|
setSilent(true);
|
|
73377
73312
|
const workspace = await resolveWorkspace(opts);
|
|
73378
73313
|
await requireLogin(opts);
|
|
73379
73314
|
const v = await getVariable({
|
|
73380
73315
|
workspace: workspace.workspaceId,
|
|
73381
|
-
path:
|
|
73316
|
+
path: path18
|
|
73382
73317
|
});
|
|
73383
73318
|
if (opts.json) {
|
|
73384
73319
|
console.log(JSON.stringify(v));
|
|
@@ -73509,11 +73444,11 @@ async function list9(opts) {
|
|
|
73509
73444
|
new Table2().header(["Path", "Schedule"]).padding(2).border(true).body(schedules.map((x) => [x.path, x.schedule])).render();
|
|
73510
73445
|
}
|
|
73511
73446
|
}
|
|
73512
|
-
async function newSchedule(opts,
|
|
73513
|
-
if (!validatePath(
|
|
73447
|
+
async function newSchedule(opts, path18) {
|
|
73448
|
+
if (!validatePath(path18)) {
|
|
73514
73449
|
return;
|
|
73515
73450
|
}
|
|
73516
|
-
const filePath =
|
|
73451
|
+
const filePath = path18 + ".schedule.yaml";
|
|
73517
73452
|
try {
|
|
73518
73453
|
await stat13(filePath);
|
|
73519
73454
|
throw new Error("File already exists: " + filePath);
|
|
@@ -73537,14 +73472,14 @@ async function newSchedule(opts, path19) {
|
|
|
73537
73472
|
});
|
|
73538
73473
|
info(colors.green(`Created ${filePath}`));
|
|
73539
73474
|
}
|
|
73540
|
-
async function get7(opts,
|
|
73475
|
+
async function get7(opts, path18) {
|
|
73541
73476
|
if (opts.json)
|
|
73542
73477
|
setSilent(true);
|
|
73543
73478
|
const workspace = await resolveWorkspace(opts);
|
|
73544
73479
|
await requireLogin(opts);
|
|
73545
73480
|
const s = await getSchedule({
|
|
73546
73481
|
workspace: workspace.workspaceId,
|
|
73547
|
-
path:
|
|
73482
|
+
path: path18
|
|
73548
73483
|
});
|
|
73549
73484
|
if (opts.json) {
|
|
73550
73485
|
console.log(JSON.stringify(s));
|
|
@@ -73557,14 +73492,14 @@ async function get7(opts, path19) {
|
|
|
73557
73492
|
console.log(colors.bold("Enabled:") + " " + (s.enabled ? "true" : "false"));
|
|
73558
73493
|
}
|
|
73559
73494
|
}
|
|
73560
|
-
async function pushSchedule(workspace,
|
|
73561
|
-
|
|
73562
|
-
debug(`Processing local schedule ${
|
|
73495
|
+
async function pushSchedule(workspace, path18, schedule, localSchedule, permissionedAsContext) {
|
|
73496
|
+
path18 = removeType(path18, "schedule").replaceAll(SEP17, "/");
|
|
73497
|
+
debug(`Processing local schedule ${path18}`);
|
|
73563
73498
|
try {
|
|
73564
|
-
schedule = await getSchedule({ workspace, path:
|
|
73565
|
-
debug(`Schedule ${
|
|
73499
|
+
schedule = await getSchedule({ workspace, path: path18 });
|
|
73500
|
+
debug(`Schedule ${path18} exists on remote`);
|
|
73566
73501
|
} catch {
|
|
73567
|
-
debug(`Schedule ${
|
|
73502
|
+
debug(`Schedule ${path18} does not exist on remote`);
|
|
73568
73503
|
}
|
|
73569
73504
|
delete localSchedule.has_permissioned_as;
|
|
73570
73505
|
const preserveFields = {};
|
|
@@ -73573,31 +73508,31 @@ async function pushSchedule(workspace, path19, schedule, localSchedule, permissi
|
|
|
73573
73508
|
preserveFields.preserve_permissioned_as = true;
|
|
73574
73509
|
if (schedule.permissioned_as) {
|
|
73575
73510
|
preserveFields.permissioned_as = schedule.permissioned_as;
|
|
73576
|
-
info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${
|
|
73511
|
+
info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path18}`);
|
|
73577
73512
|
}
|
|
73578
73513
|
}
|
|
73579
73514
|
}
|
|
73580
73515
|
if (schedule) {
|
|
73581
73516
|
if (isSuperset(localSchedule, schedule)) {
|
|
73582
|
-
debug(`Schedule ${
|
|
73517
|
+
debug(`Schedule ${path18} is up to date`);
|
|
73583
73518
|
return;
|
|
73584
73519
|
}
|
|
73585
|
-
debug(`Updating schedule ${
|
|
73520
|
+
debug(`Updating schedule ${path18}`);
|
|
73586
73521
|
try {
|
|
73587
|
-
info(colors.bold.yellow(`Updating schedule ${
|
|
73522
|
+
info(colors.bold.yellow(`Updating schedule ${path18}`));
|
|
73588
73523
|
await updateSchedule({
|
|
73589
73524
|
workspace,
|
|
73590
|
-
path:
|
|
73525
|
+
path: path18,
|
|
73591
73526
|
requestBody: {
|
|
73592
73527
|
...localSchedule,
|
|
73593
73528
|
...preserveFields
|
|
73594
73529
|
}
|
|
73595
73530
|
});
|
|
73596
73531
|
if (localSchedule.enabled !== undefined && localSchedule.enabled !== schedule.enabled) {
|
|
73597
|
-
info(colors.bold.yellow(`Schedule ${
|
|
73532
|
+
info(colors.bold.yellow(`Schedule ${path18} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
|
|
73598
73533
|
await setScheduleEnabled({
|
|
73599
73534
|
workspace,
|
|
73600
|
-
path:
|
|
73535
|
+
path: path18,
|
|
73601
73536
|
requestBody: {
|
|
73602
73537
|
enabled: localSchedule.enabled
|
|
73603
73538
|
}
|
|
@@ -73608,12 +73543,12 @@ async function pushSchedule(workspace, path19, schedule, localSchedule, permissi
|
|
|
73608
73543
|
throw e;
|
|
73609
73544
|
}
|
|
73610
73545
|
} else {
|
|
73611
|
-
console.log(colors.bold.yellow("Creating new schedule " +
|
|
73546
|
+
console.log(colors.bold.yellow("Creating new schedule " + path18));
|
|
73612
73547
|
try {
|
|
73613
73548
|
await createSchedule({
|
|
73614
73549
|
workspace,
|
|
73615
73550
|
requestBody: {
|
|
73616
|
-
path:
|
|
73551
|
+
path: path18,
|
|
73617
73552
|
...localSchedule,
|
|
73618
73553
|
...preserveFields
|
|
73619
73554
|
}
|
|
@@ -73624,26 +73559,26 @@ async function pushSchedule(workspace, path19, schedule, localSchedule, permissi
|
|
|
73624
73559
|
}
|
|
73625
73560
|
}
|
|
73626
73561
|
}
|
|
73627
|
-
async function enable(opts,
|
|
73562
|
+
async function enable(opts, path18) {
|
|
73628
73563
|
opts = await mergeConfigWithConfigFile(opts);
|
|
73629
73564
|
const workspace = await resolveWorkspace(opts);
|
|
73630
73565
|
await requireLogin(opts);
|
|
73631
73566
|
try {
|
|
73632
73567
|
await setScheduleEnabled({
|
|
73633
73568
|
workspace: workspace.workspaceId,
|
|
73634
|
-
path:
|
|
73569
|
+
path: path18,
|
|
73635
73570
|
requestBody: { enabled: true, force: opts.force }
|
|
73636
73571
|
});
|
|
73637
73572
|
} catch (e) {
|
|
73638
73573
|
const conflict = parseForkConflict(e);
|
|
73639
73574
|
if (conflict) {
|
|
73640
|
-
error(`Cannot enable schedule '${
|
|
73575
|
+
error(`Cannot enable schedule '${path18}': the parent workspace '${conflict.parentWorkspaceId}' has the same path configured. ` + `Both crons would fire on every tick and the script would run twice per scheduled time.
|
|
73641
73576
|
` + `Re-run with --force to enable anyway.`);
|
|
73642
73577
|
process.exit(1);
|
|
73643
73578
|
}
|
|
73644
73579
|
throw e;
|
|
73645
73580
|
}
|
|
73646
|
-
info(colors.green(`Schedule ${
|
|
73581
|
+
info(colors.green(`Schedule ${path18} enabled.`));
|
|
73647
73582
|
}
|
|
73648
73583
|
function parseForkConflict(e) {
|
|
73649
73584
|
const body = e?.body;
|
|
@@ -73653,16 +73588,16 @@ function parseForkConflict(e) {
|
|
|
73653
73588
|
return;
|
|
73654
73589
|
return { kind: m[1], parentWorkspaceId: m[2].trim() };
|
|
73655
73590
|
}
|
|
73656
|
-
async function disable(opts,
|
|
73591
|
+
async function disable(opts, path18) {
|
|
73657
73592
|
opts = await mergeConfigWithConfigFile(opts);
|
|
73658
73593
|
const workspace = await resolveWorkspace(opts);
|
|
73659
73594
|
await requireLogin(opts);
|
|
73660
73595
|
await setScheduleEnabled({
|
|
73661
73596
|
workspace: workspace.workspaceId,
|
|
73662
|
-
path:
|
|
73597
|
+
path: path18,
|
|
73663
73598
|
requestBody: { enabled: false }
|
|
73664
73599
|
});
|
|
73665
|
-
info(colors.yellow(`Schedule ${
|
|
73600
|
+
info(colors.yellow(`Schedule ${path18} disabled.`));
|
|
73666
73601
|
}
|
|
73667
73602
|
async function push8(opts, filePath, remotePath) {
|
|
73668
73603
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -73805,7 +73740,7 @@ async function decrypt(combinedCiphertext, keyString) {
|
|
|
73805
73740
|
var init_local_encryption = () => {};
|
|
73806
73741
|
|
|
73807
73742
|
// src/core/settings.ts
|
|
73808
|
-
import
|
|
73743
|
+
import process17 from "node:process";
|
|
73809
73744
|
import { writeFile as writeFile14 } from "node:fs/promises";
|
|
73810
73745
|
function migrateToGroupedFormat(settings) {
|
|
73811
73746
|
const result = { name: settings.name ?? "" };
|
|
@@ -74109,7 +74044,7 @@ async function pushWorkspaceKey(workspace, _path, key, localKey, opts) {
|
|
|
74109
74044
|
}
|
|
74110
74045
|
if (localKey && key !== localKey) {
|
|
74111
74046
|
let reencrypt;
|
|
74112
|
-
const explicitSkip = opts?.skipReencrypt || (
|
|
74047
|
+
const explicitSkip = opts?.skipReencrypt || (process17.env.WMILL_NO_REENCRYPT_ON_KEY_CHANGE ?? "").toLowerCase() === "true";
|
|
74113
74048
|
if (explicitSkip) {
|
|
74114
74049
|
reencrypt = false;
|
|
74115
74050
|
info("Workspace encryption key changed; leaving remote ciphertexts untouched (skip re-encryption requested).");
|
|
@@ -74148,7 +74083,7 @@ async function readInstanceSettings(opts) {
|
|
|
74148
74083
|
return localSettings;
|
|
74149
74084
|
}
|
|
74150
74085
|
async function processInstanceSettings(settings, mode) {
|
|
74151
|
-
const encKey =
|
|
74086
|
+
const encKey = process17.env.WMILL_INSTANCE_LOCAL_ENCRYPTION_KEY;
|
|
74152
74087
|
if (encKey) {
|
|
74153
74088
|
const res = [];
|
|
74154
74089
|
for (const s of settings) {
|
|
@@ -74322,7 +74257,7 @@ var init_settings = __esm(async () => {
|
|
|
74322
74257
|
// src/commands/instance/instance.ts
|
|
74323
74258
|
import { writeFile as writeFile15, readdir as readdir9, mkdir as mkdir11, rm as rm4, stat as stat14 } from "node:fs/promises";
|
|
74324
74259
|
import { appendFile } from "node:fs/promises";
|
|
74325
|
-
import * as
|
|
74260
|
+
import * as path18 from "node:path";
|
|
74326
74261
|
async function allInstances() {
|
|
74327
74262
|
try {
|
|
74328
74263
|
const file = await getInstancesConfigFilePath();
|
|
@@ -74514,7 +74449,7 @@ async function instancePull(opts) {
|
|
|
74514
74449
|
if (confirm) {
|
|
74515
74450
|
if (uChanges > 0) {
|
|
74516
74451
|
if (opts.folderPerInstance && opts.prefixSettings) {
|
|
74517
|
-
await mkdir11(
|
|
74452
|
+
await mkdir11(path18.join(rootDir, opts.prefix), {
|
|
74518
74453
|
recursive: true
|
|
74519
74454
|
});
|
|
74520
74455
|
}
|
|
@@ -74548,10 +74483,10 @@ Pulling all workspaces`);
|
|
|
74548
74483
|
info(`
|
|
74549
74484
|
Pulling workspace ` + remoteWorkspace.id);
|
|
74550
74485
|
const workspaceName = opts?.folderPerInstance ? instance.prefix + "/" + remoteWorkspace.id : instance.prefix + "_" + remoteWorkspace.id;
|
|
74551
|
-
await mkdir11(
|
|
74486
|
+
await mkdir11(path18.join(rootDir, workspaceName), {
|
|
74552
74487
|
recursive: true
|
|
74553
74488
|
});
|
|
74554
|
-
process.chdir(
|
|
74489
|
+
process.chdir(path18.join(rootDir, workspaceName));
|
|
74555
74490
|
await addWorkspace({
|
|
74556
74491
|
remote: instance.remote,
|
|
74557
74492
|
name: workspaceName,
|
|
@@ -74586,7 +74521,7 @@ Pulling workspace ` + remoteWorkspace.id);
|
|
|
74586
74521
|
if (confirmDelete) {
|
|
74587
74522
|
for (const workspace of localWorkspacesToDelete) {
|
|
74588
74523
|
await removeWorkspace(workspace.id, false, {});
|
|
74589
|
-
await rm4(
|
|
74524
|
+
await rm4(path18.join(rootDir, workspace.dir), {
|
|
74590
74525
|
recursive: true
|
|
74591
74526
|
});
|
|
74592
74527
|
}
|
|
@@ -74675,12 +74610,12 @@ Pushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
|
|
|
74675
74610
|
info(`
|
|
74676
74611
|
Pushing workspace ` + localWorkspace.id);
|
|
74677
74612
|
try {
|
|
74678
|
-
process.chdir(
|
|
74613
|
+
process.chdir(path18.join(rootDir, localWorkspace.dir));
|
|
74679
74614
|
} catch (_) {
|
|
74680
74615
|
throw new Error("Workspace folder not found, are you in the right directory?");
|
|
74681
74616
|
}
|
|
74682
74617
|
try {
|
|
74683
|
-
const workspaceSettings = await yamlParseFile(
|
|
74618
|
+
const workspaceSettings = await yamlParseFile(path18.join(process.cwd(), "settings.yaml"));
|
|
74684
74619
|
await add({
|
|
74685
74620
|
token: instance.token,
|
|
74686
74621
|
workspace: undefined,
|
|
@@ -74944,8 +74879,8 @@ async function createToken2(opts) {
|
|
|
74944
74879
|
}
|
|
74945
74880
|
info("Token: " + await createToken({ requestBody: {} }));
|
|
74946
74881
|
}
|
|
74947
|
-
async function pushWorkspaceUser(workspace,
|
|
74948
|
-
const email = removePathPrefix(removeType(
|
|
74882
|
+
async function pushWorkspaceUser(workspace, path19, user, localUser) {
|
|
74883
|
+
const email = removePathPrefix(removeType(path19, "user"), "users");
|
|
74949
74884
|
debug(`Processing local user ${email}`);
|
|
74950
74885
|
if (!["operator", "developer", "admin"].includes(localUser.role)) {
|
|
74951
74886
|
throw new Error(`Invalid role for user ${email}: ${localUser.role}`);
|
|
@@ -75008,8 +74943,8 @@ async function pushWorkspaceUser(workspace, path20, user, localUser) {
|
|
|
75008
74943
|
}
|
|
75009
74944
|
}
|
|
75010
74945
|
}
|
|
75011
|
-
async function pushGroup(workspace,
|
|
75012
|
-
const name = removePathPrefix(removeType(
|
|
74946
|
+
async function pushGroup(workspace, path19, group, localGroup) {
|
|
74947
|
+
const name = removePathPrefix(removeType(path19, "group"), "groups");
|
|
75013
74948
|
debug(`Processing local group ${name}`);
|
|
75014
74949
|
try {
|
|
75015
74950
|
const remoteGroup = await getGroup({
|
|
@@ -75260,10 +75195,10 @@ async function push9(opts, filePath) {
|
|
|
75260
75195
|
const content = readTextFileSync(filePath);
|
|
75261
75196
|
await pushWorkspaceDependencies(workspace.workspaceId, filePath, null, content);
|
|
75262
75197
|
}
|
|
75263
|
-
async function pushWorkspaceDependencies(workspace,
|
|
75264
|
-
const res = workspaceDependenciesPathToLanguageAndFilename(
|
|
75198
|
+
async function pushWorkspaceDependencies(workspace, path19, _befObj, newDependenciesContent) {
|
|
75199
|
+
const res = workspaceDependenciesPathToLanguageAndFilename(path19);
|
|
75265
75200
|
if (!res) {
|
|
75266
|
-
throw new Error(`Unknown workspace dependencies file format: ${
|
|
75201
|
+
throw new Error(`Unknown workspace dependencies file format: ${path19}. ` + `Valid files: package.json, requirements.in, composer.json, go.mod, modules.json`);
|
|
75267
75202
|
}
|
|
75268
75203
|
const { language, name } = res;
|
|
75269
75204
|
const displayName = name ? `named dependencies "${name}"` : `workspace default dependencies`;
|
|
@@ -75315,7 +75250,7 @@ var init_dependencies = __esm(async () => {
|
|
|
75315
75250
|
import { mkdir as mkdir12, stat as stat15, writeFile as writeFile17 } from "node:fs/promises";
|
|
75316
75251
|
import { dirname as dirname16 } from "node:path";
|
|
75317
75252
|
import { sep as SEP18 } from "node:path";
|
|
75318
|
-
async function getTrigger(triggerType, workspace,
|
|
75253
|
+
async function getTrigger(triggerType, workspace, path19) {
|
|
75319
75254
|
const triggerFunctions = {
|
|
75320
75255
|
http: getHttpTrigger,
|
|
75321
75256
|
websocket: getWebsocketTrigger,
|
|
@@ -75329,10 +75264,10 @@ async function getTrigger(triggerType, workspace, path20) {
|
|
|
75329
75264
|
email: getEmailTrigger
|
|
75330
75265
|
};
|
|
75331
75266
|
const triggerFunction = triggerFunctions[triggerType];
|
|
75332
|
-
const trigger = await triggerFunction({ workspace, path:
|
|
75267
|
+
const trigger = await triggerFunction({ workspace, path: path19 });
|
|
75333
75268
|
return trigger;
|
|
75334
75269
|
}
|
|
75335
|
-
async function updateTrigger(triggerType, workspace,
|
|
75270
|
+
async function updateTrigger(triggerType, workspace, path19, trigger) {
|
|
75336
75271
|
const triggerFunctions = {
|
|
75337
75272
|
http: updateHttpTrigger,
|
|
75338
75273
|
websocket: updateWebsocketTrigger,
|
|
@@ -75346,9 +75281,9 @@ async function updateTrigger(triggerType, workspace, path20, trigger) {
|
|
|
75346
75281
|
email: updateEmailTrigger
|
|
75347
75282
|
};
|
|
75348
75283
|
const triggerFunction = triggerFunctions[triggerType];
|
|
75349
|
-
await triggerFunction({ workspace, path:
|
|
75284
|
+
await triggerFunction({ workspace, path: path19, requestBody: trigger });
|
|
75350
75285
|
}
|
|
75351
|
-
async function createTrigger(triggerType, workspace,
|
|
75286
|
+
async function createTrigger(triggerType, workspace, path19, trigger) {
|
|
75352
75287
|
const triggerFunctions = {
|
|
75353
75288
|
http: createHttpTrigger,
|
|
75354
75289
|
websocket: createWebsocketTrigger,
|
|
@@ -75362,16 +75297,16 @@ async function createTrigger(triggerType, workspace, path20, trigger) {
|
|
|
75362
75297
|
email: createEmailTrigger
|
|
75363
75298
|
};
|
|
75364
75299
|
const triggerFunction = triggerFunctions[triggerType];
|
|
75365
|
-
await triggerFunction({ workspace, path:
|
|
75300
|
+
await triggerFunction({ workspace, path: path19, requestBody: trigger });
|
|
75366
75301
|
}
|
|
75367
|
-
async function pushTrigger(triggerType, workspace,
|
|
75368
|
-
|
|
75369
|
-
debug(`Processing local ${triggerType} trigger ${
|
|
75302
|
+
async function pushTrigger(triggerType, workspace, path19, trigger, localTrigger, permissionedAsContext) {
|
|
75303
|
+
path19 = removeType(path19, triggerType + "_trigger").replaceAll(SEP18, "/");
|
|
75304
|
+
debug(`Processing local ${triggerType} trigger ${path19}`);
|
|
75370
75305
|
try {
|
|
75371
|
-
trigger = await getTrigger(triggerType, workspace,
|
|
75372
|
-
debug(`${triggerType} trigger ${
|
|
75306
|
+
trigger = await getTrigger(triggerType, workspace, path19);
|
|
75307
|
+
debug(`${triggerType} trigger ${path19} exists on remote`);
|
|
75373
75308
|
} catch {
|
|
75374
|
-
debug(`${triggerType} trigger ${
|
|
75309
|
+
debug(`${triggerType} trigger ${path19} does not exist on remote`);
|
|
75375
75310
|
}
|
|
75376
75311
|
delete localTrigger.has_permissioned_as;
|
|
75377
75312
|
const preserveFields = {};
|
|
@@ -75380,33 +75315,33 @@ async function pushTrigger(triggerType, workspace, path20, trigger, localTrigger
|
|
|
75380
75315
|
preserveFields.preserve_permissioned_as = true;
|
|
75381
75316
|
if (trigger.permissioned_as) {
|
|
75382
75317
|
preserveFields.permissioned_as = trigger.permissioned_as;
|
|
75383
|
-
info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${
|
|
75318
|
+
info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path19}`);
|
|
75384
75319
|
}
|
|
75385
75320
|
}
|
|
75386
75321
|
}
|
|
75387
75322
|
if (trigger) {
|
|
75388
75323
|
if (isSuperset(localTrigger, trigger)) {
|
|
75389
|
-
debug(`${triggerType} trigger ${
|
|
75324
|
+
debug(`${triggerType} trigger ${path19} is up to date`);
|
|
75390
75325
|
return;
|
|
75391
75326
|
}
|
|
75392
|
-
debug(`${triggerType} trigger ${
|
|
75327
|
+
debug(`${triggerType} trigger ${path19} is not up-to-date, updating...`);
|
|
75393
75328
|
try {
|
|
75394
|
-
await updateTrigger(triggerType, workspace,
|
|
75329
|
+
await updateTrigger(triggerType, workspace, path19, {
|
|
75395
75330
|
...localTrigger,
|
|
75396
75331
|
...preserveFields,
|
|
75397
|
-
path:
|
|
75332
|
+
path: path19
|
|
75398
75333
|
});
|
|
75399
75334
|
} catch (e) {
|
|
75400
75335
|
console.error(e.body);
|
|
75401
75336
|
throw e;
|
|
75402
75337
|
}
|
|
75403
75338
|
} else {
|
|
75404
|
-
console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${
|
|
75339
|
+
console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path19}`));
|
|
75405
75340
|
try {
|
|
75406
|
-
await createTrigger(triggerType, workspace,
|
|
75341
|
+
await createTrigger(triggerType, workspace, path19, {
|
|
75407
75342
|
...localTrigger,
|
|
75408
75343
|
...preserveFields,
|
|
75409
|
-
path:
|
|
75344
|
+
path: path19
|
|
75410
75345
|
});
|
|
75411
75346
|
} catch (e) {
|
|
75412
75347
|
console.error(e.body);
|
|
@@ -75491,8 +75426,8 @@ async function pushNativeTrigger(workspace, filePath, _remoteTrigger, localTrigg
|
|
|
75491
75426
|
}
|
|
75492
75427
|
}
|
|
75493
75428
|
}
|
|
75494
|
-
async function newTrigger(opts,
|
|
75495
|
-
if (!validatePath(
|
|
75429
|
+
async function newTrigger(opts, path19) {
|
|
75430
|
+
if (!validatePath(path19)) {
|
|
75496
75431
|
return;
|
|
75497
75432
|
}
|
|
75498
75433
|
if (!opts.kind) {
|
|
@@ -75502,7 +75437,7 @@ async function newTrigger(opts, path20) {
|
|
|
75502
75437
|
throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
|
|
75503
75438
|
}
|
|
75504
75439
|
const kind = opts.kind;
|
|
75505
|
-
const filePath = `${
|
|
75440
|
+
const filePath = `${path19}.${kind}_trigger.yaml`;
|
|
75506
75441
|
try {
|
|
75507
75442
|
await stat15(filePath);
|
|
75508
75443
|
throw new Error("File already exists: " + filePath);
|
|
@@ -75538,7 +75473,7 @@ function printTriggerDetails(trigger, kind) {
|
|
|
75538
75473
|
console.log(colors.bold(label + ":") + " " + display);
|
|
75539
75474
|
}
|
|
75540
75475
|
}
|
|
75541
|
-
async function get8(opts,
|
|
75476
|
+
async function get8(opts, path19) {
|
|
75542
75477
|
if (opts.json)
|
|
75543
75478
|
setSilent(true);
|
|
75544
75479
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -75547,7 +75482,7 @@ async function get8(opts, path20) {
|
|
|
75547
75482
|
if (!checkIfValidTrigger(opts.kind)) {
|
|
75548
75483
|
throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
|
|
75549
75484
|
}
|
|
75550
|
-
const trigger = await getTrigger(opts.kind, workspace.workspaceId,
|
|
75485
|
+
const trigger = await getTrigger(opts.kind, workspace.workspaceId, path19);
|
|
75551
75486
|
if (opts.json) {
|
|
75552
75487
|
console.log(JSON.stringify(trigger));
|
|
75553
75488
|
} else {
|
|
@@ -75558,12 +75493,12 @@ async function get8(opts, path20) {
|
|
|
75558
75493
|
const matches = [];
|
|
75559
75494
|
for (const kind of TRIGGER_TYPES) {
|
|
75560
75495
|
try {
|
|
75561
|
-
const trigger = await getTrigger(kind, workspace.workspaceId,
|
|
75496
|
+
const trigger = await getTrigger(kind, workspace.workspaceId, path19);
|
|
75562
75497
|
matches.push({ kind, trigger });
|
|
75563
75498
|
} catch {}
|
|
75564
75499
|
}
|
|
75565
75500
|
if (matches.length === 0) {
|
|
75566
|
-
throw new Error("No trigger found at path: " +
|
|
75501
|
+
throw new Error("No trigger found at path: " + path19);
|
|
75567
75502
|
}
|
|
75568
75503
|
if (matches.length === 1) {
|
|
75569
75504
|
const { kind, trigger } = matches[0];
|
|
@@ -75574,7 +75509,7 @@ async function get8(opts, path20) {
|
|
|
75574
75509
|
}
|
|
75575
75510
|
return;
|
|
75576
75511
|
}
|
|
75577
|
-
console.log("Multiple triggers found at path " +
|
|
75512
|
+
console.log("Multiple triggers found at path " + path19 + ":");
|
|
75578
75513
|
for (const m of matches) {
|
|
75579
75514
|
console.log(" - " + m.kind);
|
|
75580
75515
|
}
|
|
@@ -75804,7 +75739,7 @@ var init_trigger = __esm(async () => {
|
|
|
75804
75739
|
});
|
|
75805
75740
|
|
|
75806
75741
|
// src/types.ts
|
|
75807
|
-
import * as
|
|
75742
|
+
import * as path19 from "node:path";
|
|
75808
75743
|
import { sep as SEP19 } from "node:path";
|
|
75809
75744
|
function isSuperset(subset, superset) {
|
|
75810
75745
|
return Object.keys(subset).every((key) => {
|
|
@@ -75848,11 +75783,11 @@ function showDiff(local, remote) {
|
|
|
75848
75783
|
}
|
|
75849
75784
|
info(finalString);
|
|
75850
75785
|
}
|
|
75851
|
-
function showConflict(
|
|
75852
|
-
info(colors.yellow(`- ${
|
|
75786
|
+
function showConflict(path20, local, remote) {
|
|
75787
|
+
info(colors.yellow(`- ${path20}`));
|
|
75853
75788
|
let isEncryptionKey = false;
|
|
75854
75789
|
try {
|
|
75855
|
-
isEncryptionKey = getTypeStrFromPath(
|
|
75790
|
+
isEncryptionKey = getTypeStrFromPath(path20) === "encryption_key";
|
|
75856
75791
|
} catch {}
|
|
75857
75792
|
if (isEncryptionKey) {
|
|
75858
75793
|
showDiff(redactEncryptionKey(local), redactEncryptionKey(remote));
|
|
@@ -75979,7 +75914,7 @@ function getTypeStrFromPath(p) {
|
|
|
75979
75914
|
if (isFileResource(p) || isFilesetResource(p)) {
|
|
75980
75915
|
return "resource";
|
|
75981
75916
|
}
|
|
75982
|
-
const parsed =
|
|
75917
|
+
const parsed = path19.parse(p);
|
|
75983
75918
|
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") {
|
|
75984
75919
|
return "script";
|
|
75985
75920
|
}
|
|
@@ -76003,7 +75938,7 @@ function getTypeStrFromPath(p) {
|
|
|
76003
75938
|
}
|
|
76004
75939
|
}
|
|
76005
75940
|
function removeType(str, type) {
|
|
76006
|
-
const normalizedStr =
|
|
75941
|
+
const normalizedStr = path19.normalize(str).replaceAll(SEP19, "/");
|
|
76007
75942
|
if (normalizedStr.endsWith("." + type + ".yaml") || normalizedStr.endsWith("." + type + ".json")) {
|
|
76008
75943
|
return normalizedStr.slice(0, normalizedStr.length - type.length - 6);
|
|
76009
75944
|
}
|
|
@@ -76013,7 +75948,7 @@ function removeType(str, type) {
|
|
|
76013
75948
|
return normalizedStr;
|
|
76014
75949
|
}
|
|
76015
75950
|
function extractNativeTriggerInfo(p) {
|
|
76016
|
-
const normalizedPath =
|
|
75951
|
+
const normalizedPath = path19.normalize(p).replaceAll(SEP19, "/");
|
|
76017
75952
|
const withoutExt = normalizedPath.replace(/\.(json|yaml)$/, "");
|
|
76018
75953
|
const match2 = withoutExt.match(/^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/);
|
|
76019
75954
|
if (!match2) {
|
|
@@ -76027,8 +75962,8 @@ function extractNativeTriggerInfo(p) {
|
|
|
76027
75962
|
};
|
|
76028
75963
|
}
|
|
76029
75964
|
function removePathPrefix(str, prefix) {
|
|
76030
|
-
const normalizedStr =
|
|
76031
|
-
const normalizedPrefix =
|
|
75965
|
+
const normalizedStr = path19.normalize(str).replaceAll(SEP19, "/");
|
|
75966
|
+
const normalizedPrefix = path19.normalize(prefix).replaceAll(SEP19, "/");
|
|
76032
75967
|
if (normalizedStr === normalizedPrefix) {
|
|
76033
75968
|
return "";
|
|
76034
75969
|
}
|
|
@@ -76201,7 +76136,7 @@ var init_local_path_scripts = __esm(async () => {
|
|
|
76201
76136
|
|
|
76202
76137
|
// src/commands/flow/flow.ts
|
|
76203
76138
|
import { dirname as dirname17, sep as SEP20 } from "node:path";
|
|
76204
|
-
import { mkdirSync as mkdirSync5, writeFileSync as
|
|
76139
|
+
import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync6 } from "node:fs";
|
|
76205
76140
|
function normalizeOptionalString(value) {
|
|
76206
76141
|
return typeof value === "string" && value.trim() === "" ? undefined : value ?? undefined;
|
|
76207
76142
|
}
|
|
@@ -76243,12 +76178,12 @@ function warnAboutLocalPathScriptDivergence(divergence) {
|
|
|
76243
76178
|
const details = [];
|
|
76244
76179
|
if (divergence.changed.length > 0) {
|
|
76245
76180
|
details.push(`These workspace scripts differ from the deployed version:
|
|
76246
|
-
${divergence.changed.map((
|
|
76181
|
+
${divergence.changed.map((path20) => `- ${path20}`).join(`
|
|
76247
76182
|
`)}`);
|
|
76248
76183
|
}
|
|
76249
76184
|
if (divergence.missing.length > 0) {
|
|
76250
76185
|
details.push(`These scripts do not exist in the workspace yet:
|
|
76251
|
-
${divergence.missing.map((
|
|
76186
|
+
${divergence.missing.map((path20) => `- ${path20}`).join(`
|
|
76252
76187
|
`)}`);
|
|
76253
76188
|
}
|
|
76254
76189
|
warn(`Using local PathScript files for flow preview.
|
|
@@ -76273,7 +76208,7 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
|
|
|
76273
76208
|
localPath += SEP20;
|
|
76274
76209
|
}
|
|
76275
76210
|
const localFlow = await yamlParseFile(localPath + "flow.yaml");
|
|
76276
|
-
const fileReader = async (
|
|
76211
|
+
const fileReader = async (path20) => await readTextFile(localPath + path20);
|
|
76277
76212
|
const missingFiles = [];
|
|
76278
76213
|
await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, localPath, SEP20, undefined, missingFiles);
|
|
76279
76214
|
if (localFlow.value.failure_module) {
|
|
@@ -76369,14 +76304,14 @@ async function list12(opts) {
|
|
|
76369
76304
|
new Table2().header(["path", "summary", "edited by"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary, x.edited_by])).render();
|
|
76370
76305
|
}
|
|
76371
76306
|
}
|
|
76372
|
-
async function get9(opts,
|
|
76307
|
+
async function get9(opts, path20) {
|
|
76373
76308
|
if (opts.json)
|
|
76374
76309
|
setSilent(true);
|
|
76375
76310
|
const workspace = await resolveWorkspace(opts);
|
|
76376
76311
|
await requireLogin(opts);
|
|
76377
76312
|
const f = await getFlowByPath({
|
|
76378
76313
|
workspace: workspace.workspaceId,
|
|
76379
|
-
path:
|
|
76314
|
+
path: path20
|
|
76380
76315
|
});
|
|
76381
76316
|
if (opts.json) {
|
|
76382
76317
|
console.log(JSON.stringify(f));
|
|
@@ -76414,7 +76349,7 @@ async function get9(opts, path21) {
|
|
|
76414
76349
|
}
|
|
76415
76350
|
}
|
|
76416
76351
|
}
|
|
76417
|
-
async function run3(opts,
|
|
76352
|
+
async function run3(opts, path20) {
|
|
76418
76353
|
if (opts.silent) {
|
|
76419
76354
|
setSilent(true);
|
|
76420
76355
|
}
|
|
@@ -76425,7 +76360,7 @@ async function run3(opts, path21) {
|
|
|
76425
76360
|
try {
|
|
76426
76361
|
const flow = await getFlowByPath({
|
|
76427
76362
|
workspace: workspace.workspaceId,
|
|
76428
|
-
path:
|
|
76363
|
+
path: path20
|
|
76429
76364
|
});
|
|
76430
76365
|
validateRequiredArgs(flow.schema);
|
|
76431
76366
|
} catch (e) {
|
|
@@ -76436,7 +76371,7 @@ async function run3(opts, path21) {
|
|
|
76436
76371
|
}
|
|
76437
76372
|
const id = await runFlowByPath({
|
|
76438
76373
|
workspace: workspace.workspaceId,
|
|
76439
|
-
path:
|
|
76374
|
+
path: path20,
|
|
76440
76375
|
requestBody: input
|
|
76441
76376
|
});
|
|
76442
76377
|
const stepLabels = new Map;
|
|
@@ -76582,7 +76517,7 @@ async function preview2(opts, flowPath) {
|
|
|
76582
76517
|
flowPath += SEP20;
|
|
76583
76518
|
}
|
|
76584
76519
|
const localFlow = await yamlParseFile(flowPath + "flow.yaml");
|
|
76585
|
-
const fileReader = async (
|
|
76520
|
+
const fileReader = async (path20) => await readTextFile(flowPath + path20);
|
|
76586
76521
|
await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, flowPath, SEP20);
|
|
76587
76522
|
if (localFlow.value.failure_module) {
|
|
76588
76523
|
await replaceInlineScripts([localFlow.value.failure_module], fileReader, exports_log, flowPath, SEP20);
|
|
@@ -76854,7 +76789,7 @@ async function bootstrap2(opts, flowPath) {
|
|
|
76854
76789
|
const newFlowDefinitionYaml = import_yaml36.stringify(newFlowDefinition);
|
|
76855
76790
|
const metadataFile = getMetadataFileName("flow", "yaml");
|
|
76856
76791
|
const flowYamlPath = `${flowDirFullPath}/${metadataFile}`;
|
|
76857
|
-
|
|
76792
|
+
writeFileSync6(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
|
|
76858
76793
|
info(colors.green(`Created flow at ${flowDirFullPath}`));
|
|
76859
76794
|
info("");
|
|
76860
76795
|
info(colors.bold("To preview this flow:"));
|
|
@@ -77093,7 +77028,7 @@ class GitSyncSettingsConverter {
|
|
|
77093
77028
|
}
|
|
77094
77029
|
|
|
77095
77030
|
// src/commands/gitsync-settings/legacySettings.ts
|
|
77096
|
-
import
|
|
77031
|
+
import process18 from "node:process";
|
|
77097
77032
|
async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, workspace, opts, operationName = "operation") {
|
|
77098
77033
|
if (selectedRepo.settings) {
|
|
77099
77034
|
return selectedRepo;
|
|
@@ -77103,7 +77038,7 @@ async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, wo
|
|
|
77103
77038
|
}
|
|
77104
77039
|
const workspaceIncludePath = gitSyncSettings.include_path;
|
|
77105
77040
|
const workspaceIncludeType = gitSyncSettings.include_type;
|
|
77106
|
-
if (!!
|
|
77041
|
+
if (!!process18.stdout.isTTY && !opts.yes) {
|
|
77107
77042
|
console.log(colors.yellow(`
|
|
77108
77043
|
⚠️ Legacy git-sync settings detected!`));
|
|
77109
77044
|
console.log(`
|
|
@@ -77209,7 +77144,7 @@ Repository "${selectedRepo.git_repo_resource_path}" has legacy settings format.`
|
|
|
77209
77144
|
console.error(` wmill gitsync-settings push
|
|
77210
77145
|
`);
|
|
77211
77146
|
}
|
|
77212
|
-
|
|
77147
|
+
process18.exit(1);
|
|
77213
77148
|
}
|
|
77214
77149
|
}
|
|
77215
77150
|
var init_legacySettings = __esm(async () => {
|
|
@@ -77253,8 +77188,8 @@ function outputResult(opts, result) {
|
|
|
77253
77188
|
error(colors.red(result.error));
|
|
77254
77189
|
}
|
|
77255
77190
|
}
|
|
77256
|
-
function normalizeRepoPath(
|
|
77257
|
-
return
|
|
77191
|
+
function normalizeRepoPath(path20) {
|
|
77192
|
+
return path20.replace(/^\$res:/, "");
|
|
77258
77193
|
}
|
|
77259
77194
|
function getOrCreateBranchConfig(config, branchName) {
|
|
77260
77195
|
if (!config.workspaces) {
|
|
@@ -77665,14 +77600,14 @@ var init_pull2 = __esm(async () => {
|
|
|
77665
77600
|
});
|
|
77666
77601
|
|
|
77667
77602
|
// src/commands/gitsync-settings/push.ts
|
|
77668
|
-
import
|
|
77603
|
+
import process19 from "node:process";
|
|
77669
77604
|
async function pushGitSyncSettings(opts) {
|
|
77670
77605
|
try {
|
|
77671
77606
|
await validateBranchConfiguration({ yes: opts.yes });
|
|
77672
77607
|
} catch (error2) {
|
|
77673
77608
|
if (error2 instanceof Error && error2.message.includes("overrides")) {
|
|
77674
77609
|
error(error2.message);
|
|
77675
|
-
|
|
77610
|
+
process19.exit(1);
|
|
77676
77611
|
}
|
|
77677
77612
|
throw error2;
|
|
77678
77613
|
}
|
|
@@ -77682,7 +77617,7 @@ async function pushGitSyncSettings(opts) {
|
|
|
77682
77617
|
const wmillYamlPath = getWmillYamlPath();
|
|
77683
77618
|
if (!wmillYamlPath) {
|
|
77684
77619
|
error(colors.red("No wmill.yaml file found. Please run 'wmill init' first to create the configuration file."));
|
|
77685
|
-
|
|
77620
|
+
process19.exit(1);
|
|
77686
77621
|
}
|
|
77687
77622
|
const localConfig = await readConfigFile();
|
|
77688
77623
|
let settings;
|
|
@@ -77798,7 +77733,7 @@ async function pushGitSyncSettings(opts) {
|
|
|
77798
77733
|
displayChanges(changes);
|
|
77799
77734
|
}
|
|
77800
77735
|
}
|
|
77801
|
-
if (!opts.yes && !!
|
|
77736
|
+
if (!opts.yes && !!process19.stdin.isTTY) {
|
|
77802
77737
|
const confirmed = await Confirm.prompt({
|
|
77803
77738
|
message: `Do you want to apply these changes to the remote?`,
|
|
77804
77739
|
default: true
|
|
@@ -84495,12 +84430,14 @@ List all queues with their metrics
|
|
|
84495
84430
|
|
|
84496
84431
|
### refresh
|
|
84497
84432
|
|
|
84498
|
-
Refresh wmill-managed project files (AGENTS.cli.md
|
|
84433
|
+
Refresh wmill-managed project files (AGENTS.cli.md, skills, tsconfig.wmill.json)
|
|
84499
84434
|
|
|
84500
84435
|
**Subcommands:**
|
|
84501
84436
|
|
|
84502
84437
|
- \`refresh prompts\` - Refresh AGENTS.cli.md and managed skills. User-owned AGENTS.md and CLAUDE.md are never overwritten unless you opt in.
|
|
84503
|
-
- \`--yes\` - Non-interactive:
|
|
84438
|
+
- \`--yes\` - Non-interactive: append the @AGENTS.cli.md include to an existing AGENTS.md / CLAUDE.md without prompting. Without it, a non-interactive run leaves an unlinked file untouched.
|
|
84439
|
+
- \`refresh tsconfig\` - Refresh the wmill-managed tsconfig.wmill.json (and Deno import map for Deno projects)
|
|
84440
|
+
- \`--yes\` - Non-interactive: wire an existing custom tsconfig.json/deno.json to the managed file without prompting (a previously-generated config is always migrated automatically).
|
|
84504
84441
|
|
|
84505
84442
|
### resource
|
|
84506
84443
|
|
|
@@ -86142,12 +86079,12 @@ async function warnIfPromptsStale(opts) {
|
|
|
86142
86079
|
if (opts?.argv && !shouldRunFreshnessCheck(opts.argv))
|
|
86143
86080
|
return;
|
|
86144
86081
|
const cwd = opts?.cwd ?? process.cwd();
|
|
86145
|
-
const
|
|
86146
|
-
if (!await stat18(
|
|
86082
|
+
const path21 = `${cwd}/AGENTS.cli.md`;
|
|
86083
|
+
if (!await stat18(path21).catch(() => null))
|
|
86147
86084
|
return;
|
|
86148
86085
|
let content;
|
|
86149
86086
|
try {
|
|
86150
|
-
content = await readTextFile(
|
|
86087
|
+
content = await readTextFile(path21);
|
|
86151
86088
|
} catch {
|
|
86152
86089
|
return;
|
|
86153
86090
|
}
|
|
@@ -86184,6 +86121,283 @@ var init_freshness = __esm(async () => {
|
|
|
86184
86121
|
PROMPTS_HASH_REGEX = /<!-- wmill-prompts-hash: ([0-9a-f]{12}) -->/;
|
|
86185
86122
|
});
|
|
86186
86123
|
|
|
86124
|
+
// src/commands/refresh/tsconfig.ts
|
|
86125
|
+
var exports_tsconfig = {};
|
|
86126
|
+
__export(exports_tsconfig, {
|
|
86127
|
+
warnIfTsconfigStale: () => warnIfTsconfigStale,
|
|
86128
|
+
refreshTsconfig: () => refreshTsconfig,
|
|
86129
|
+
default: () => tsconfig_default
|
|
86130
|
+
});
|
|
86131
|
+
import { execSync as execSync6 } from "node:child_process";
|
|
86132
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
86133
|
+
import { existsSync as existsSync12, readFileSync as readFileSync4, writeFileSync as writeFileSync7 } from "node:fs";
|
|
86134
|
+
import path21 from "node:path";
|
|
86135
|
+
import process22 from "node:process";
|
|
86136
|
+
function buildManagedTsconfig() {
|
|
86137
|
+
const paths = {};
|
|
86138
|
+
for (const [alias, dir] of Object.entries(WORKSPACE_IMPORT_ALIASES)) {
|
|
86139
|
+
paths[`${alias}/*`] = [`./${dir}/*`];
|
|
86140
|
+
}
|
|
86141
|
+
return {
|
|
86142
|
+
compilerOptions: {
|
|
86143
|
+
target: "ESNext",
|
|
86144
|
+
module: "ESNext",
|
|
86145
|
+
moduleResolution: "bundler",
|
|
86146
|
+
allowImportingTsExtensions: true,
|
|
86147
|
+
noEmit: true,
|
|
86148
|
+
strict: false,
|
|
86149
|
+
paths
|
|
86150
|
+
},
|
|
86151
|
+
include: ["**/*.ts", "rt.d.ts"]
|
|
86152
|
+
};
|
|
86153
|
+
}
|
|
86154
|
+
function currentTsconfigHash() {
|
|
86155
|
+
return createHash2("sha256").update(JSON.stringify(buildManagedTsconfig())).digest("hex").slice(0, 12);
|
|
86156
|
+
}
|
|
86157
|
+
function deepEqual2(a, b) {
|
|
86158
|
+
if (a === b)
|
|
86159
|
+
return true;
|
|
86160
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
86161
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {
|
|
86162
|
+
return false;
|
|
86163
|
+
}
|
|
86164
|
+
return a.every((x, i) => deepEqual2(x, b[i]));
|
|
86165
|
+
}
|
|
86166
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
86167
|
+
const ka = Object.keys(a);
|
|
86168
|
+
const kb = Object.keys(b);
|
|
86169
|
+
if (ka.length !== kb.length)
|
|
86170
|
+
return false;
|
|
86171
|
+
return ka.every((k) => deepEqual2(a[k], b[k]));
|
|
86172
|
+
}
|
|
86173
|
+
return false;
|
|
86174
|
+
}
|
|
86175
|
+
async function refreshTsconfig(opts) {
|
|
86176
|
+
let defaultTs = "bun";
|
|
86177
|
+
try {
|
|
86178
|
+
const conf = await readConfigFile({ warnIfMissing: false });
|
|
86179
|
+
if (conf?.defaultTs === "deno") {
|
|
86180
|
+
defaultTs = "deno";
|
|
86181
|
+
}
|
|
86182
|
+
} catch {}
|
|
86183
|
+
const assumeYes = opts?.yes === true;
|
|
86184
|
+
const mode = {
|
|
86185
|
+
assumeYes,
|
|
86186
|
+
interactive: !!process22.stdin.isTTY && !assumeYes
|
|
86187
|
+
};
|
|
86188
|
+
await refreshManagedTsconfig(defaultTs, mode);
|
|
86189
|
+
if (defaultTs === "deno") {
|
|
86190
|
+
await refreshManagedDenoImportMap(mode);
|
|
86191
|
+
}
|
|
86192
|
+
}
|
|
86193
|
+
async function refreshManagedTsconfig(defaultTs, mode) {
|
|
86194
|
+
const managed = buildManagedTsconfig();
|
|
86195
|
+
const bunTypesAvailable = defaultTs === "bun" ? ensureBunTypesAvailable() : false;
|
|
86196
|
+
if (bunTypesAvailable) {
|
|
86197
|
+
managed.compilerOptions.types = ["bun-types"];
|
|
86198
|
+
}
|
|
86199
|
+
const header = MANAGED_NOTICE + TSCONFIG_HASH_PREFIX + currentTsconfigHash() + `
|
|
86200
|
+
`;
|
|
86201
|
+
writeFileSync7(path21.join(process22.cwd(), MANAGED_TSCONFIG), header + JSON.stringify(managed, null, 2) + `
|
|
86202
|
+
`);
|
|
86203
|
+
info(colors.green(`Refreshed ${MANAGED_TSCONFIG}`));
|
|
86204
|
+
await ensureUserReferencesManaged({
|
|
86205
|
+
file: "tsconfig.json",
|
|
86206
|
+
create: { extends: `./${MANAGED_TSCONFIG}` },
|
|
86207
|
+
legacyFormats: LEGACY_GENERATED_TSCONFIGS,
|
|
86208
|
+
mode,
|
|
86209
|
+
wire: (parsed) => {
|
|
86210
|
+
const co = parsed.compilerOptions;
|
|
86211
|
+
const paths = co && typeof co === "object" && !Array.isArray(co) ? co.paths : undefined;
|
|
86212
|
+
if (paths && typeof paths === "object" && !Array.isArray(paths) && Object.keys(paths).length > 0) {
|
|
86213
|
+
return "defines its own `compilerOptions.paths` (TS won't merge ours in via " + '`extends`); add "$f/*": ["./f/*"] and "$u/*": ["./u/*"] to it';
|
|
86214
|
+
}
|
|
86215
|
+
const ext2 = parsed.extends;
|
|
86216
|
+
const managed2 = `./${MANAGED_TSCONFIG}`;
|
|
86217
|
+
if (ext2 === undefined) {
|
|
86218
|
+
parsed.extends = managed2;
|
|
86219
|
+
} else if (typeof ext2 === "string") {
|
|
86220
|
+
parsed.extends = [managed2, ext2];
|
|
86221
|
+
} else if (Array.isArray(ext2)) {
|
|
86222
|
+
ext2.unshift(managed2);
|
|
86223
|
+
} else {
|
|
86224
|
+
return "unexpected `extends` value";
|
|
86225
|
+
}
|
|
86226
|
+
return true;
|
|
86227
|
+
},
|
|
86228
|
+
token: MANAGED_TSCONFIG,
|
|
86229
|
+
hint: `"extends": "./${MANAGED_TSCONFIG}"`
|
|
86230
|
+
});
|
|
86231
|
+
}
|
|
86232
|
+
async function refreshManagedDenoImportMap(mode) {
|
|
86233
|
+
const imports = {};
|
|
86234
|
+
for (const [alias, dir] of Object.entries(WORKSPACE_IMPORT_ALIASES)) {
|
|
86235
|
+
imports[`${alias}/`] = `./${dir}/`;
|
|
86236
|
+
}
|
|
86237
|
+
writeFileSync7(path21.join(process22.cwd(), MANAGED_IMPORT_MAP), JSON.stringify({ imports }, null, 2) + `
|
|
86238
|
+
`);
|
|
86239
|
+
info(colors.green(`Refreshed ${MANAGED_IMPORT_MAP}`));
|
|
86240
|
+
await ensureUserReferencesManaged({
|
|
86241
|
+
file: "deno.json",
|
|
86242
|
+
altFiles: ["deno.jsonc"],
|
|
86243
|
+
create: { importMap: `./${MANAGED_IMPORT_MAP}` },
|
|
86244
|
+
mode,
|
|
86245
|
+
wire: (parsed) => {
|
|
86246
|
+
if (parsed.imports !== undefined) {
|
|
86247
|
+
return "deno.json already defines `imports` (can't also use importMap)";
|
|
86248
|
+
}
|
|
86249
|
+
if (parsed.importMap !== undefined && parsed.importMap !== `./${MANAGED_IMPORT_MAP}`) {
|
|
86250
|
+
return "deno.json already sets a different `importMap`";
|
|
86251
|
+
}
|
|
86252
|
+
parsed.importMap = `./${MANAGED_IMPORT_MAP}`;
|
|
86253
|
+
return true;
|
|
86254
|
+
},
|
|
86255
|
+
token: MANAGED_IMPORT_MAP,
|
|
86256
|
+
hint: `"importMap": "./${MANAGED_IMPORT_MAP}"`
|
|
86257
|
+
});
|
|
86258
|
+
}
|
|
86259
|
+
async function ensureUserReferencesManaged(opts) {
|
|
86260
|
+
const existing = [opts.file, ...opts.altFiles ?? []].map((f) => path21.join(process22.cwd(), f)).find((p) => existsSync12(p));
|
|
86261
|
+
if (!existing) {
|
|
86262
|
+
const userPath = path21.join(process22.cwd(), opts.file);
|
|
86263
|
+
writeFileSync7(userPath, JSON.stringify(opts.create, null, 2) + `
|
|
86264
|
+
`);
|
|
86265
|
+
info(colors.green(`Created ${opts.file} (references ${opts.token})`));
|
|
86266
|
+
return;
|
|
86267
|
+
}
|
|
86268
|
+
const existingName = path21.basename(existing);
|
|
86269
|
+
let text = "";
|
|
86270
|
+
try {
|
|
86271
|
+
text = readFileSync4(existing, "utf-8");
|
|
86272
|
+
} catch {
|
|
86273
|
+
return;
|
|
86274
|
+
}
|
|
86275
|
+
if (text.includes(opts.token)) {
|
|
86276
|
+
info(colors.gray(`${existingName} already references ${opts.token}, leaving it untouched`));
|
|
86277
|
+
return;
|
|
86278
|
+
}
|
|
86279
|
+
let parsed;
|
|
86280
|
+
try {
|
|
86281
|
+
parsed = JSON.parse(text);
|
|
86282
|
+
} catch {
|
|
86283
|
+
warn(`${existingName} couldn't be auto-edited (it may contain comments). Add ${opts.hint} ` + `to pick up wmill's recommended settings (incl. $f//$u/ import aliases).`);
|
|
86284
|
+
return;
|
|
86285
|
+
}
|
|
86286
|
+
if (opts.legacyFormats?.some((fmt) => deepEqual2(parsed, fmt))) {
|
|
86287
|
+
writeFileSync7(existing, JSON.stringify(opts.create, null, 2) + `
|
|
86288
|
+
`);
|
|
86289
|
+
info(colors.green(`Migrated previously-generated ${existingName} to reference ${opts.token}`));
|
|
86290
|
+
return;
|
|
86291
|
+
}
|
|
86292
|
+
const next = JSON.parse(JSON.stringify(parsed));
|
|
86293
|
+
const wired = opts.wire(next);
|
|
86294
|
+
if (wired !== true) {
|
|
86295
|
+
warn(`${existingName}: ${wired}. Add ${opts.hint} manually to pick up wmill's ` + `recommended settings (incl. $f//$u/ import aliases).`);
|
|
86296
|
+
return;
|
|
86297
|
+
}
|
|
86298
|
+
const consent = opts.mode.assumeYes ? true : opts.mode.interactive ? await Confirm.prompt({
|
|
86299
|
+
message: `${existingName} isn't linked to wmill's ${opts.token}. Add ${opts.hint}? ` + `Your settings are preserved (it's inserted first, so your config wins).`,
|
|
86300
|
+
default: true
|
|
86301
|
+
}) : false;
|
|
86302
|
+
if (!consent) {
|
|
86303
|
+
info(colors.gray(`Left ${existingName} unchanged — add ${opts.hint} when ready to enable ` + `$f//$u/ import aliases (or re-run \`wmill refresh tsconfig\`).`));
|
|
86304
|
+
return;
|
|
86305
|
+
}
|
|
86306
|
+
writeFileSync7(existing, JSON.stringify(next, null, 2) + `
|
|
86307
|
+
`);
|
|
86308
|
+
info(colors.green(`Linked ${existingName} → ${opts.token}`));
|
|
86309
|
+
}
|
|
86310
|
+
function ensureBunTypesAvailable() {
|
|
86311
|
+
const cwd = process22.cwd();
|
|
86312
|
+
if (existsSync12(path21.join(cwd, "node_modules", "bun-types"))) {
|
|
86313
|
+
return true;
|
|
86314
|
+
}
|
|
86315
|
+
try {
|
|
86316
|
+
execSync6("bun --version", { stdio: "ignore" });
|
|
86317
|
+
} catch {
|
|
86318
|
+
info("Install bun (https://bun.sh), run 'bun add -d bun-types', then re-run 'wmill refresh tsconfig' for Bun API autocompletion.");
|
|
86319
|
+
return false;
|
|
86320
|
+
}
|
|
86321
|
+
try {
|
|
86322
|
+
info(colors.yellow("Installing bun-types with 'bun add -d bun-types'..."));
|
|
86323
|
+
execSync6("bun add -d bun-types", { stdio: "inherit" });
|
|
86324
|
+
info(colors.green("Installed bun-types."));
|
|
86325
|
+
return true;
|
|
86326
|
+
} catch (e) {
|
|
86327
|
+
warn(`Failed to install bun-types automatically: ${e instanceof Error ? e.message : e}`);
|
|
86328
|
+
info("Run 'bun add -d bun-types' manually, then 'wmill refresh tsconfig', for Bun API autocompletion.");
|
|
86329
|
+
return false;
|
|
86330
|
+
}
|
|
86331
|
+
}
|
|
86332
|
+
async function warnIfTsconfigStale(opts) {
|
|
86333
|
+
const cwd = opts?.cwd ?? process22.cwd();
|
|
86334
|
+
const managedPath = path21.join(cwd, MANAGED_TSCONFIG);
|
|
86335
|
+
if (!existsSync12(managedPath))
|
|
86336
|
+
return;
|
|
86337
|
+
let managedText;
|
|
86338
|
+
try {
|
|
86339
|
+
managedText = readFileSync4(managedPath, "utf-8");
|
|
86340
|
+
} catch {
|
|
86341
|
+
return;
|
|
86342
|
+
}
|
|
86343
|
+
const match2 = managedText.match(TSCONFIG_HASH_REGEX);
|
|
86344
|
+
if (!match2) {
|
|
86345
|
+
emitTsconfigWarning(`${MANAGED_TSCONFIG} predates versioning. Run \`wmill refresh tsconfig\` to refresh it.`);
|
|
86346
|
+
return;
|
|
86347
|
+
}
|
|
86348
|
+
if (match2[1] !== currentTsconfigHash()) {
|
|
86349
|
+
emitTsconfigWarning(`${MANAGED_TSCONFIG} is out of date. Run \`wmill refresh tsconfig\` to refresh.`);
|
|
86350
|
+
}
|
|
86351
|
+
}
|
|
86352
|
+
function emitTsconfigWarning(message) {
|
|
86353
|
+
process22.stderr.write(`${colors.yellow(message)}
|
|
86354
|
+
`);
|
|
86355
|
+
}
|
|
86356
|
+
var WORKSPACE_IMPORT_ALIASES, MANAGED_TSCONFIG = "tsconfig.wmill.json", MANAGED_IMPORT_MAP = "import_map.wmill.json", MANAGED_NOTICE, TSCONFIG_HASH_PREFIX = "// wmill-tsconfig-hash: ", TSCONFIG_HASH_REGEX, LEGACY_GENERATED_TSCONFIGS, command30, tsconfig_default;
|
|
86357
|
+
var init_tsconfig = __esm(async () => {
|
|
86358
|
+
init_colors2();
|
|
86359
|
+
init_mod3();
|
|
86360
|
+
init_log();
|
|
86361
|
+
await __promiseAll([
|
|
86362
|
+
init_confirm(),
|
|
86363
|
+
init_conf()
|
|
86364
|
+
]);
|
|
86365
|
+
WORKSPACE_IMPORT_ALIASES = {
|
|
86366
|
+
$f: "f",
|
|
86367
|
+
$u: "u"
|
|
86368
|
+
};
|
|
86369
|
+
MANAGED_NOTICE = "// Managed by wmill — regenerated by `wmill init` / `wmill refresh tsconfig`.\n" + `// Do not edit; put your overrides in tsconfig.json (which extends this file).
|
|
86370
|
+
`;
|
|
86371
|
+
TSCONFIG_HASH_REGEX = /^\/\/ wmill-tsconfig-hash: ([0-9a-f]{12})/m;
|
|
86372
|
+
LEGACY_GENERATED_TSCONFIGS = [
|
|
86373
|
+
{
|
|
86374
|
+
compilerOptions: {
|
|
86375
|
+
target: "ESNext",
|
|
86376
|
+
module: "ESNext",
|
|
86377
|
+
moduleResolution: "bundler",
|
|
86378
|
+
noEmit: true,
|
|
86379
|
+
strict: false
|
|
86380
|
+
},
|
|
86381
|
+
include: ["**/*.ts", "rt.d.ts"]
|
|
86382
|
+
},
|
|
86383
|
+
{
|
|
86384
|
+
compilerOptions: {
|
|
86385
|
+
target: "ESNext",
|
|
86386
|
+
module: "ESNext",
|
|
86387
|
+
moduleResolution: "bundler",
|
|
86388
|
+
noEmit: true,
|
|
86389
|
+
strict: false,
|
|
86390
|
+
types: ["bun-types"]
|
|
86391
|
+
},
|
|
86392
|
+
include: ["**/*.ts", "rt.d.ts"]
|
|
86393
|
+
}
|
|
86394
|
+
];
|
|
86395
|
+
command30 = new Command().description("Refresh the wmill-managed tsconfig.wmill.json (and Deno import map for Deno projects)").option("--yes", "Non-interactive: wire an existing custom tsconfig.json/deno.json to the managed file without prompting (a previously-generated config is always migrated automatically).").action(async (opts) => {
|
|
86396
|
+
await refreshTsconfig({ yes: opts.yes === true });
|
|
86397
|
+
});
|
|
86398
|
+
tsconfig_default = command30;
|
|
86399
|
+
});
|
|
86400
|
+
|
|
86187
86401
|
// src/main.ts
|
|
86188
86402
|
init_mod3();
|
|
86189
86403
|
|
|
@@ -87560,7 +87774,7 @@ await __promiseAll([
|
|
|
87560
87774
|
init_context()
|
|
87561
87775
|
]);
|
|
87562
87776
|
var import_yaml39 = __toESM(require_dist(), 1);
|
|
87563
|
-
import { existsSync as
|
|
87777
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
87564
87778
|
import { writeFile as writeFile19 } from "node:fs/promises";
|
|
87565
87779
|
import { dirname as dirname18, join as join18 } from "node:path";
|
|
87566
87780
|
var PROTECTION_RULES_FILENAME = "protection-rules.yaml";
|
|
@@ -87570,17 +87784,17 @@ function getProtectionRulesPath() {
|
|
|
87570
87784
|
return null;
|
|
87571
87785
|
return join18(dirname18(wmillPath), PROTECTION_RULES_FILENAME);
|
|
87572
87786
|
}
|
|
87573
|
-
async function readProtectionRulesFile(
|
|
87574
|
-
if (!
|
|
87787
|
+
async function readProtectionRulesFile(path20) {
|
|
87788
|
+
if (!existsSync9(path20))
|
|
87575
87789
|
return {};
|
|
87576
|
-
const parsed = await yamlParseFile(
|
|
87790
|
+
const parsed = await yamlParseFile(path20);
|
|
87577
87791
|
return parsed ?? {};
|
|
87578
87792
|
}
|
|
87579
|
-
async function writeProtectionRulesFile(
|
|
87793
|
+
async function writeProtectionRulesFile(path20, data3) {
|
|
87580
87794
|
const sorted = {};
|
|
87581
87795
|
for (const k of Object.keys(data3).sort())
|
|
87582
87796
|
sorted[k] = data3[k];
|
|
87583
|
-
await writeFile19(
|
|
87797
|
+
await writeFile19(path20, import_yaml39.stringify(sorted, yamlOptions), "utf-8");
|
|
87584
87798
|
}
|
|
87585
87799
|
|
|
87586
87800
|
class WorkspaceResolver {
|
|
@@ -87625,7 +87839,7 @@ async function configureClientForWorkspace(opts, ws, resolver) {
|
|
|
87625
87839
|
// src/commands/protection-rules/utils.ts
|
|
87626
87840
|
init_colors2();
|
|
87627
87841
|
init_log();
|
|
87628
|
-
import
|
|
87842
|
+
import process20 from "node:process";
|
|
87629
87843
|
function outputResult2(opts, result) {
|
|
87630
87844
|
if (opts.jsonOutput) {
|
|
87631
87845
|
console.log(JSON.stringify(result));
|
|
@@ -87637,7 +87851,7 @@ function outputResult2(opts, result) {
|
|
|
87637
87851
|
}
|
|
87638
87852
|
function fail(opts, result) {
|
|
87639
87853
|
outputResult2(opts, { ...result, success: false });
|
|
87640
|
-
|
|
87854
|
+
process20.exit(1);
|
|
87641
87855
|
}
|
|
87642
87856
|
function describeEntry(entry) {
|
|
87643
87857
|
const n = ProtectionRulesConverter.normalizeEntry(entry);
|
|
@@ -87781,8 +87995,8 @@ await __promiseAll([
|
|
|
87781
87995
|
init_confirm(),
|
|
87782
87996
|
init_conf()
|
|
87783
87997
|
]);
|
|
87784
|
-
import
|
|
87785
|
-
import { existsSync as
|
|
87998
|
+
import process21 from "node:process";
|
|
87999
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
87786
88000
|
async function pushProtectionRules(opts, workspaceArg) {
|
|
87787
88001
|
if (opts.jsonOutput)
|
|
87788
88002
|
setSilent(true);
|
|
@@ -87792,7 +88006,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87792
88006
|
error: "No wmill.yaml found. Run 'wmill init' first — protection-rules.yaml lives next to it."
|
|
87793
88007
|
});
|
|
87794
88008
|
}
|
|
87795
|
-
if (!
|
|
88009
|
+
if (!existsSync10(prPath)) {
|
|
87796
88010
|
fail(opts, {
|
|
87797
88011
|
error: "No protection-rules.yaml found. Run 'wmill protection-rules pull' first."
|
|
87798
88012
|
});
|
|
@@ -87862,7 +88076,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87862
88076
|
workspaces: Object.fromEntries(wsPlans.map((w) => [w.ws, structuredPlan(w.plan)]))
|
|
87863
88077
|
}));
|
|
87864
88078
|
if (hadError)
|
|
87865
|
-
|
|
88079
|
+
process21.exit(1);
|
|
87866
88080
|
return;
|
|
87867
88081
|
}
|
|
87868
88082
|
if (!opts.jsonOutput) {
|
|
@@ -87876,7 +88090,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87876
88090
|
error: "One or more workspaces failed (see errors above); the rest are in sync",
|
|
87877
88091
|
partialFailure: true
|
|
87878
88092
|
});
|
|
87879
|
-
|
|
88093
|
+
process21.exit(1);
|
|
87880
88094
|
}
|
|
87881
88095
|
if (!opts.dryRun) {
|
|
87882
88096
|
outputResult2(opts, {
|
|
@@ -87888,7 +88102,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87888
88102
|
}
|
|
87889
88103
|
if (opts.dryRun) {
|
|
87890
88104
|
if (hadError)
|
|
87891
|
-
|
|
88105
|
+
process21.exit(1);
|
|
87892
88106
|
return;
|
|
87893
88107
|
}
|
|
87894
88108
|
for (const w of wsPlans) {
|
|
@@ -87897,7 +88111,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87897
88111
|
}
|
|
87898
88112
|
}
|
|
87899
88113
|
const totalDeletes = changed.reduce((n, w) => n + w.plan.toDelete.length, 0);
|
|
87900
|
-
if (!opts.yes && !!
|
|
88114
|
+
if (!opts.yes && !!process21.stdin.isTTY) {
|
|
87901
88115
|
const confirmed = await Confirm.prompt({
|
|
87902
88116
|
message: totalDeletes > 0 ? `Apply these changes? This DELETES ${totalDeletes} protection rule(s) across ${changed.length} workspace(s).` : `Apply these changes to ${changed.length} workspace(s)?`,
|
|
87903
88117
|
default: totalDeletes === 0
|
|
@@ -87959,7 +88173,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87959
88173
|
partialFailure: true,
|
|
87960
88174
|
...applied
|
|
87961
88175
|
});
|
|
87962
|
-
|
|
88176
|
+
process21.exit(1);
|
|
87963
88177
|
}
|
|
87964
88178
|
outputResult2(opts, {
|
|
87965
88179
|
success: true,
|
|
@@ -88089,7 +88303,7 @@ import * as http3 from "node:http";
|
|
|
88089
88303
|
import * as https from "node:https";
|
|
88090
88304
|
import { access, readdir as readdir10, realpath, stat as stat17, unlink, writeFile as writeFile20 } from "node:fs/promises";
|
|
88091
88305
|
import { watch as watch2 } from "node:fs";
|
|
88092
|
-
import * as
|
|
88306
|
+
import * as path20 from "node:path";
|
|
88093
88307
|
import * as fs14 from "node:fs";
|
|
88094
88308
|
|
|
88095
88309
|
// src/commands/dev/pathscript-restore.ts
|
|
@@ -88185,7 +88399,7 @@ var PORT = 3001;
|
|
|
88185
88399
|
var FLOW_SUFFIXES = [".flow", "__flow"];
|
|
88186
88400
|
var APP_SUFFIXES = [".app", "__app", ".raw_app", "__raw_app"];
|
|
88187
88401
|
var INLINE_SCRIPT_EXTS = new Set([
|
|
88188
|
-
...exts.map((e) =>
|
|
88402
|
+
...exts.map((e) => path20.extname("x" + e)).filter((e) => e !== ".yml"),
|
|
88189
88403
|
".js"
|
|
88190
88404
|
]);
|
|
88191
88405
|
function stripFolderSuffix(rel, suffixes) {
|
|
@@ -88226,13 +88440,13 @@ async function listWorkspacePaths() {
|
|
|
88226
88440
|
if (entry.name.startsWith(".") || entry.name === "node_modules")
|
|
88227
88441
|
continue;
|
|
88228
88442
|
const childRel = rel ? `${rel}/${entry.name}` : entry.name;
|
|
88229
|
-
const childAbs =
|
|
88443
|
+
const childAbs = path20.join(dir, entry.name);
|
|
88230
88444
|
if (entry.isDirectory()) {
|
|
88231
88445
|
if (isFlowFolderName(entry.name)) {
|
|
88232
88446
|
items.push({
|
|
88233
88447
|
path: stripFolderSuffix(childRel, FLOW_SUFFIXES),
|
|
88234
88448
|
kind: "flow",
|
|
88235
|
-
_metaPath:
|
|
88449
|
+
_metaPath: path20.join(childAbs, "flow.yaml")
|
|
88236
88450
|
});
|
|
88237
88451
|
continue;
|
|
88238
88452
|
}
|
|
@@ -88271,25 +88485,25 @@ async function listWorkspacePaths() {
|
|
|
88271
88485
|
async function dev2(opts) {
|
|
88272
88486
|
if (!opts.path) {
|
|
88273
88487
|
const cwd = process.cwd();
|
|
88274
|
-
const cwdBasename =
|
|
88488
|
+
const cwdBasename = path20.basename(cwd);
|
|
88275
88489
|
await loadNonDottedPathsSetting();
|
|
88276
88490
|
if (isFlowFolderName(cwdBasename)) {
|
|
88277
88491
|
GLOBAL_CONFIG_OPT.noCdToRoot = true;
|
|
88278
88492
|
let searchDir = cwd;
|
|
88279
88493
|
let workspaceRoot;
|
|
88280
88494
|
while (true) {
|
|
88281
|
-
const wmillYaml =
|
|
88495
|
+
const wmillYaml = path20.join(searchDir, "wmill.yaml");
|
|
88282
88496
|
if (fs14.existsSync(wmillYaml)) {
|
|
88283
88497
|
workspaceRoot = searchDir;
|
|
88284
88498
|
break;
|
|
88285
88499
|
}
|
|
88286
|
-
const parentDir =
|
|
88500
|
+
const parentDir = path20.dirname(searchDir);
|
|
88287
88501
|
if (parentDir === searchDir)
|
|
88288
88502
|
break;
|
|
88289
88503
|
searchDir = parentDir;
|
|
88290
88504
|
}
|
|
88291
88505
|
if (workspaceRoot) {
|
|
88292
|
-
const relPath =
|
|
88506
|
+
const relPath = path20.relative(workspaceRoot, cwd).replaceAll("\\", "/");
|
|
88293
88507
|
opts.path = stripFolderSuffix(relPath, FLOW_SUFFIXES);
|
|
88294
88508
|
info(`Detected flow folder, path: ${opts.path}`);
|
|
88295
88509
|
process.chdir(workspaceRoot);
|
|
@@ -88354,7 +88568,7 @@ async function dev2(opts) {
|
|
|
88354
88568
|
return;
|
|
88355
88569
|
const wmFlowPath = stripFolderSuffix(localPath.replace(/\/$/, ""), FLOW_SUFFIXES);
|
|
88356
88570
|
const localFlow = await yamlParseFile(localPath + "flow.yaml");
|
|
88357
|
-
await replaceInlineScripts(localFlow.value.modules, async (
|
|
88571
|
+
await replaceInlineScripts(localFlow.value.modules, async (path21) => await readTextFile(localPath + path21), exports_log, localPath, SEP21, undefined);
|
|
88358
88572
|
snapshotPathScripts(localFlow.value);
|
|
88359
88573
|
const localScriptReader = createPreviewLocalScriptReader({
|
|
88360
88574
|
exts,
|
|
@@ -88516,7 +88730,7 @@ async function dev2(opts) {
|
|
|
88516
88730
|
for (const file of dirFiles) {
|
|
88517
88731
|
if (file === "flow.yaml" || file === "flow.json" || file.startsWith("."))
|
|
88518
88732
|
continue;
|
|
88519
|
-
if (!INLINE_SCRIPT_EXTS.has(
|
|
88733
|
+
if (!INLINE_SCRIPT_EXTS.has(path20.extname(file)))
|
|
88520
88734
|
continue;
|
|
88521
88735
|
if (!extractedPaths.has(file)) {
|
|
88522
88736
|
await unlink(flowDir + file);
|
|
@@ -89706,7 +89920,8 @@ async function refreshPrompts(opts) {
|
|
|
89706
89920
|
const config = await readConfigFile2();
|
|
89707
89921
|
nonDottedPaths = config.nonDottedPaths ?? false;
|
|
89708
89922
|
} catch {}
|
|
89709
|
-
const
|
|
89923
|
+
const assumeYes = opts.yes === true;
|
|
89924
|
+
const interactive = process.stdin.isTTY && !assumeYes;
|
|
89710
89925
|
try {
|
|
89711
89926
|
const result = await writeAiGuidanceFiles({
|
|
89712
89927
|
targetDir: ".",
|
|
@@ -89715,9 +89930,11 @@ async function refreshPrompts(opts) {
|
|
|
89715
89930
|
agentsSourcePath: process.env[WMILL_INIT_AI_AGENTS_SOURCE_ENV],
|
|
89716
89931
|
claudeSourcePath: process.env[WMILL_INIT_AI_CLAUDE_SOURCE_ENV],
|
|
89717
89932
|
resolveAgentsMdMigration: async () => {
|
|
89718
|
-
if (
|
|
89933
|
+
if (assumeYes)
|
|
89719
89934
|
return "append";
|
|
89720
|
-
|
|
89935
|
+
if (interactive)
|
|
89936
|
+
return await promptMigration();
|
|
89937
|
+
return "skip";
|
|
89721
89938
|
}
|
|
89722
89939
|
});
|
|
89723
89940
|
info(colors.green("Refreshed AGENTS.cli.md"));
|
|
@@ -89792,10 +90009,11 @@ async function promptMigration() {
|
|
|
89792
90009
|
async function promptsAction(opts) {
|
|
89793
90010
|
await refreshPrompts({ yes: opts.yes === true });
|
|
89794
90011
|
}
|
|
89795
|
-
var command29 = new Command().description("Refresh AGENTS.cli.md and managed skills. User-owned AGENTS.md and CLAUDE.md are never overwritten unless you opt in.").option("--yes", "Non-interactive:
|
|
90012
|
+
var command29 = new Command().description("Refresh AGENTS.cli.md and managed skills. User-owned AGENTS.md and CLAUDE.md are never overwritten unless you opt in.").option("--yes", "Non-interactive: append the @AGENTS.cli.md include to an existing AGENTS.md / CLAUDE.md without prompting. Without it, a non-interactive run leaves an unlinked file untouched.").action(promptsAction);
|
|
89796
90013
|
var prompts_default = command29;
|
|
89797
90014
|
|
|
89798
90015
|
// src/commands/init/init.ts
|
|
90016
|
+
await init_tsconfig();
|
|
89799
90017
|
async function initAction(opts) {
|
|
89800
90018
|
let didBindWorkspace = false;
|
|
89801
90019
|
let boundProfile;
|
|
@@ -89940,6 +90158,11 @@ async function initAction(opts) {
|
|
|
89940
90158
|
}
|
|
89941
90159
|
}
|
|
89942
90160
|
await refreshPrompts({ yes: opts.useDefault === true });
|
|
90161
|
+
try {
|
|
90162
|
+
await refreshTsconfig({ yes: opts.useDefault === true });
|
|
90163
|
+
} catch (error2) {
|
|
90164
|
+
warn(`Could not generate tsconfig: ${error2 instanceof Error ? error2.message : error2}`);
|
|
90165
|
+
}
|
|
89943
90166
|
if (didBindWorkspace && boundProfile) {
|
|
89944
90167
|
try {
|
|
89945
90168
|
const rtOpts = { ...opts };
|
|
@@ -89952,13 +90175,14 @@ async function initAction(opts) {
|
|
|
89952
90175
|
info(colors.gray("Skipped resource type namespace generation (no workspace bound). Run 'wmill workspace bind' then 'wmill init' to generate it."));
|
|
89953
90176
|
}
|
|
89954
90177
|
}
|
|
89955
|
-
var
|
|
89956
|
-
var init_default =
|
|
90178
|
+
var command31 = new Command().description("Bootstrap a windmill project with a wmill.yaml file").option("--use-default", "Use default settings without checking backend").option("--use-backend", "Use backend git-sync settings if available").option("--repository <repo:string>", "Specify repository path (e.g., u/user/repo) when using backend settings").option("--bind-profile", "Automatically bind active workspace profile to current Git branch").option("--no-bind-profile", "Skip workspace profile binding prompt").action(initAction);
|
|
90179
|
+
var init_default = command31;
|
|
89957
90180
|
|
|
89958
90181
|
// src/commands/refresh/refresh.ts
|
|
89959
90182
|
init_mod3();
|
|
89960
|
-
|
|
89961
|
-
var
|
|
90183
|
+
await init_tsconfig();
|
|
90184
|
+
var command32 = new Command().description("Refresh wmill-managed project files (AGENTS.cli.md, skills, tsconfig.wmill.json)").command("prompts", prompts_default).command("tsconfig", tsconfig_default);
|
|
90185
|
+
var refresh_default = command32;
|
|
89962
90186
|
|
|
89963
90187
|
// src/main.ts
|
|
89964
90188
|
init_freshness_gate();
|
|
@@ -90127,8 +90351,8 @@ Warning: Found ${workers.length} active worker(s) on the instance.`));
|
|
|
90127
90351
|
}
|
|
90128
90352
|
var pull3 = new Command().description("Pull completed and queued jobs from workspace").option("-c, --completed-output <file:string>", "Completed jobs output file (default: completed_jobs.json)").option("-q, --queued-output <file:string>", "Queued jobs output file (default: queued_jobs.json)").option("--skip-worker-check", "Skip checking for active workers before export").arguments("[workspace:string]").action(pullJobs);
|
|
90129
90353
|
var push12 = new Command().description("Push completed and queued jobs to workspace").option("-c, --completed-file <file:string>", "Completed jobs input file (default: completed_jobs.json)").option("-q, --queued-file <file:string>", "Queued jobs input file (default: queued_jobs.json)").option("--skip-worker-check", "Skip checking for active workers before import").arguments("[workspace:string]").action(pushJobs);
|
|
90130
|
-
var
|
|
90131
|
-
var jobs_default =
|
|
90354
|
+
var command33 = new Command().description("Manage jobs (import/export)").command("pull", pull3).command("push", push12);
|
|
90355
|
+
var jobs_default = command33;
|
|
90132
90356
|
|
|
90133
90357
|
// src/commands/job/job.ts
|
|
90134
90358
|
init_mod3();
|
|
@@ -90489,8 +90713,8 @@ async function restart(opts, id) {
|
|
|
90489
90713
|
console.log(newId);
|
|
90490
90714
|
}
|
|
90491
90715
|
var listOptions = (cmd) => cmd.option("--json", "Output as JSON (for piping to jq)").option("--script-path <scriptPath:string>", "Filter by exact script/flow path").option("--created-by <createdBy:string>", "Filter by creator username").option("--running", "Show only running jobs").option("--failed", "Show only failed jobs").option("--success <success:boolean>", "Filter by success status (true/false)").option("--limit <limit:number>", "Number of jobs to return (default 30, max 100)").option("--job-kinds <jobKinds:string>", "Filter by job kinds (default: script,flow,singlestepflow)").option("--label <label:string>", "Filter by job label").option("--all", "Include sub-jobs (flow steps). By default only top-level jobs are shown").option("--parent <parent:string>", "Filter by parent job ID (show sub-jobs of a specific flow)").option("--is-flow-step", "Show only flow step jobs");
|
|
90492
|
-
var
|
|
90493
|
-
var job_default =
|
|
90716
|
+
var command34 = listOptions(new Command().description("Manage jobs (list, inspect, cancel)")).action(list13).command("list", listOptions(new Command().description("List recent jobs"))).action(list13).command("get", "Get job details. For flows: shows step tree with sub-job IDs").arguments("<id:string>").option("--json", "Output as JSON (for piping to jq)").action(get10).command("result", "Get the result of a completed job (machine-friendly)").arguments("<id:string>").action(result).command("logs", "Get job logs. For flows: aggregates all step logs").arguments("<id:string>").action(logs).command("cancel", "Cancel a running or queued job").arguments("<id:string>").option("--reason <reason:string>", "Reason for cancellation").action(cancel).command("rerun", "Re-run a completed job with the same args. Prints the new job UUID on stdout.").arguments("<id:string>").action(rerun).command("restart", "Restart a completed flow at a given top-level step. Prints the new flow job UUID on stdout.").arguments("<id:string>").option("--step <stepId:string>", "Top-level step id to restart the flow from", { required: true }).option("--iteration <n:number>", "For a top-level branchall or for-loop step, the iteration to restart at").action(restart);
|
|
90717
|
+
var job_default = command34;
|
|
90494
90718
|
|
|
90495
90719
|
// src/commands/group/group.ts
|
|
90496
90720
|
init_mod3();
|
|
@@ -90589,8 +90813,8 @@ async function removeUser(opts, name, username) {
|
|
|
90589
90813
|
});
|
|
90590
90814
|
info(colors.green(`User '${username}' removed from group '${name}'.`));
|
|
90591
90815
|
}
|
|
90592
|
-
var
|
|
90593
|
-
var group_default =
|
|
90816
|
+
var command35 = new Command().description("Manage workspace groups").option("--json", "Output as JSON (for piping to jq)").action(list14).command("list", "List all groups in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list14).command("get", "Get group details and members").arguments("<name:string>").option("--json", "Output as JSON (for piping to jq)").action(get11).command("create", "Create a new group").arguments("<name:string>").option("--summary <summary:string>", "Group summary/description").action(create).command("delete", "Delete a group").arguments("<name:string>").action(deleteGroup2).command("add-user", "Add a user to a group").arguments("<name:string> <username:string>").action(addUser2).command("remove-user", "Remove a user from a group").arguments("<name:string> <username:string>").action(removeUser);
|
|
90817
|
+
var group_default = command35;
|
|
90594
90818
|
|
|
90595
90819
|
// src/commands/audit/audit.ts
|
|
90596
90820
|
init_mod3();
|
|
@@ -90667,8 +90891,8 @@ async function get12(opts, id) {
|
|
|
90667
90891
|
}
|
|
90668
90892
|
}
|
|
90669
90893
|
var auditListOptions = (cmd) => cmd.option("--json", "Output as JSON (for piping to jq)").option("--username <username:string>", "Filter by username").option("--operation <operation:string>", "Filter by operation (exact or prefix)").option("--action-kind <actionKind:string>", "Filter by action kind (Create, Update, Delete, Execute)").option("--before <before:string>", "Filter events before this timestamp").option("--after <after:string>", "Filter events after this timestamp").option("--limit <limit:number>", "Number of entries to return (default 30, max 100)");
|
|
90670
|
-
var
|
|
90671
|
-
var audit_default =
|
|
90894
|
+
var command36 = auditListOptions(new Command().description("View audit logs (requires admin)")).action(list15).command("list", auditListOptions(new Command().description("List audit log entries"))).action(list15).command("get", "Get a specific audit log entry").arguments("<id:string>").option("--json", "Output as JSON (for piping to jq)").action(get12);
|
|
90895
|
+
var audit_default = command36;
|
|
90672
90896
|
|
|
90673
90897
|
// src/commands/token/token.ts
|
|
90674
90898
|
init_mod3();
|
|
@@ -90722,8 +90946,8 @@ async function deleteToken2(opts, tokenPrefix) {
|
|
|
90722
90946
|
await deleteToken({ tokenPrefix });
|
|
90723
90947
|
info(colors.green(`Token with prefix '${tokenPrefix}' deleted.`));
|
|
90724
90948
|
}
|
|
90725
|
-
var
|
|
90726
|
-
var token_default =
|
|
90949
|
+
var command37 = new Command().description("Manage API tokens").option("--json", "Output as JSON (for piping to jq)").action(list16).command("list", "List API tokens").option("--json", "Output as JSON (for piping to jq)").action(list16).command("create", "Create a new API token").option("--label <label:string>", "Token label").option("--expiration <expiration:string>", "Token expiration (ISO 8601 timestamp)").action(create2).command("delete", "Delete a token by its prefix").arguments("<token_prefix:string>").action(deleteToken2);
|
|
90950
|
+
var token_default = command37;
|
|
90727
90951
|
|
|
90728
90952
|
// src/main.ts
|
|
90729
90953
|
await init_generate_metadata();
|
|
@@ -90803,8 +91027,8 @@ ${await res.text()}`);
|
|
|
90803
91027
|
console.log();
|
|
90804
91028
|
}
|
|
90805
91029
|
}
|
|
90806
|
-
var
|
|
90807
|
-
var docs_default =
|
|
91030
|
+
var command38 = new Command().name("docs").description("Search Windmill documentation.").arguments("<query:string>").option("--json", "Output results as JSON.").action(docs);
|
|
91031
|
+
var docs_default = command38;
|
|
90808
91032
|
|
|
90809
91033
|
// src/commands/config/config.ts
|
|
90810
91034
|
init_mod3();
|
|
@@ -90874,8 +91098,8 @@ async function migrateAction() {
|
|
|
90874
91098
|
info(` Also removed additional legacy keys: ${legacyKeys.slice(1).join(", ")}`);
|
|
90875
91099
|
}
|
|
90876
91100
|
}
|
|
90877
|
-
var
|
|
90878
|
-
var config_default =
|
|
91101
|
+
var command39 = new Command().name("config").description("Show all available wmill.yaml configuration options").option("--json", "Output as JSON for programmatic consumption").action(configAction).command("migrate").description("Migrate wmill.yaml from gitBranches/environments to workspaces format").action(migrateAction);
|
|
91102
|
+
var config_default = command39;
|
|
90879
91103
|
|
|
90880
91104
|
// src/commands/datatable/datatable.ts
|
|
90881
91105
|
init_mod3();
|
|
@@ -92789,8 +93013,8 @@ async function serve2(opts) {
|
|
|
92789
93013
|
async function psql2(opts) {
|
|
92790
93014
|
await psql(opts);
|
|
92791
93015
|
}
|
|
92792
|
-
var
|
|
92793
|
-
var datatable_default =
|
|
93016
|
+
var command40 = new Command().description("datatable related commands").command("list", "list all datatables in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list17).command("run", "run a SQL query on a datatable").arguments("<sql:string>").option("-n --name <name:string>", "Datatable name (default: main)").option("-s --silent", "Output only the final result as JSON. Useful for scripting.").action(run4).command("serve", "Serve all datatables as a Postgres-wire endpoint (psql, DBeaver, pgAdmin); the client picks the datatable via the database name in its connection string").option("--port <port:number>", "Port to listen on (default: first free port in 5433-5500)").option("--host <host:string>", "Bind address (default: 127.0.0.1)").option("--password <password:string>", "Password for Postgres clients (default: generate a random password at startup)").action(serve2).command("psql", "Start a serve listener and launch psql connected to it").option("-n --name <name:string>", "Datatable to connect psql to (default: main)").option("--port <port:number>", "Port the proxy listens on (default: first free port in 5433-5500)").option("--host <host:string>", "Bind address for the proxy (default: 127.0.0.1)").option("--password <password:string>", "Password for the temporary Postgres proxy (default: generate a random password at startup)").action(psql2);
|
|
93017
|
+
var datatable_default = command40;
|
|
92794
93018
|
|
|
92795
93019
|
// src/commands/ducklake/ducklake.ts
|
|
92796
93020
|
init_mod3();
|
|
@@ -92820,8 +93044,8 @@ async function run5(opts, sql) {
|
|
|
92820
93044
|
const name = opts.name ?? DEFAULT_DUCKLAKE_NAME;
|
|
92821
93045
|
await runCatalogQuery(opts, "ducklake", name, sql);
|
|
92822
93046
|
}
|
|
92823
|
-
var
|
|
92824
|
-
var ducklake_default =
|
|
93047
|
+
var command41 = new Command().description("ducklake related commands").command("list", "list all ducklakes in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list18).command("run", "run a SQL query on a ducklake").arguments("<sql:string>").option("-n --name <name:string>", "Ducklake name (default: main)").option("-s --silent", "Output only the final result as JSON. Useful for scripting.").action(run5);
|
|
93048
|
+
var ducklake_default = command41;
|
|
92825
93049
|
|
|
92826
93050
|
// src/commands/object-storage/object-storage.ts
|
|
92827
93051
|
init_mod3();
|
|
@@ -93022,12 +93246,11 @@ async function preview3(opts, fileKey) {
|
|
|
93022
93246
|
`);
|
|
93023
93247
|
}
|
|
93024
93248
|
}
|
|
93025
|
-
var
|
|
93026
|
-
var object_storage_default =
|
|
93249
|
+
var command42 = new Command().alias("s3").description("Object storage (S3) related commands. Operates on the workspace's default object storage; use --storage to target a configured secondary storage.").action(listStorages).command("list", "List configured object storages for the workspace (default + secondary).").option("--json", "Output as JSON (for piping to jq)").action(listStorages).command("files", "List files in an object storage. Optionally filter by prefix.").alias("ls").arguments("[prefix:string]").option("--json", "Output as JSON (for piping to jq)").option("--max-keys <maxKeys:number>", "Page size (default 100)").option("--marker <marker:string>", "Pagination marker from a previous response").option("--storage <storage:string>", "Secondary storage name (omit for the workspace default)").action(listFiles).command("upload", "Upload a local file to object storage at the given file key.").arguments("<local_path:string> <file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--content-type <contentType:string>", "Content-Type header to set on the object").option("--content-disposition <contentDisposition:string>", "Content-Disposition header to set on the object").action(upload).command("download", "Download an object to a local file (or stdout). Default output path is the basename of the file key in the current directory.").arguments("<file_key:string> [output_path:string]").option("--storage <storage:string>", "Secondary storage name").option("--stdout", "Write file contents to stdout instead of a file").action(download).command("delete", "Delete an object from object storage. Prompts for confirmation unless --yes is set.").arguments("<file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--yes", "Skip the confirmation prompt").action(del).command("move", "Move an object within the same storage (rename or relocate by key).").arguments("<src_file_key:string> <dest_file_key:string>").option("--storage <storage:string>", "Secondary storage name").action(move).command("info", "Show metadata (size, mime, last-modified) for an object.").arguments("<file_key:string>").option("--json", "Output as JSON (for piping to jq)").option("--storage <storage:string>", "Secondary storage name").action(info2).command("preview", "Preview the contents of an object (text/CSV). Use --bytes-from / --bytes-length to peek at a slice of binary files.").arguments("<file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--mime <mime:string>", "Override the detected mime type (e.g. text/csv)").option("--bytes-from <bytesFrom:number>", "Start offset in bytes").option("--bytes-length <bytesLength:number>", "Number of bytes to read").option("--csv-separator <csvSeparator:string>", "CSV column separator (default ,)").option("--csv-header", "Treat the first CSV row as a header").action(preview3);
|
|
93250
|
+
var object_storage_default = command42;
|
|
93027
93251
|
|
|
93028
93252
|
// src/main.ts
|
|
93029
93253
|
await init_context();
|
|
93030
|
-
var VERSION = "1.715.0";
|
|
93031
93254
|
async function checkVersionSafe(cmd) {
|
|
93032
93255
|
const mainCommand = cmd.getMainCommand();
|
|
93033
93256
|
const upgradeCommand = mainCommand.getCommand("upgrade");
|
|
@@ -93044,7 +93267,7 @@ async function checkVersionSafe(cmd) {
|
|
|
93044
93267
|
}
|
|
93045
93268
|
mainCommand.version(`${currentVersion} (New version available: ${latestVersion}. Run '${mainCommand.getName()} upgrade' to upgrade to the latest version!)`);
|
|
93046
93269
|
}
|
|
93047
|
-
var
|
|
93270
|
+
var command43 = new Command().name("wmill").action(() => info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`)).description("Windmill CLI").globalOption("--workspace <workspace:string>", "Specify the target workspace. This overrides the default workspace.").globalOption("--debug --verbose", "Show debug/verbose logs").globalOption("--show-diffs", "Show diff informations when syncing (may show sensitive informations)").globalOption("--token <token:string>", "Specify an API token. This will override any stored token.").globalOption("--base-url <baseUrl:string>", "Specify the base URL of the API. If used, --token and --workspace are required and no local remote/workspace already set will be used.").globalOption("--config-dir <configDir:string>", "Specify a custom config directory. Overrides WMILL_CONFIG_DIR environment variable and default ~/.config location.").env("HEADERS <headers:string>", `Specify headers to use for all requests. e.g: "HEADERS='h1: v1, h2: v2'"`).version(VERSION).versionOption(false).helpOption("-h, --help", "Show this help.", {
|
|
93048
93271
|
action: async function() {
|
|
93049
93272
|
const self2 = this;
|
|
93050
93273
|
const long = self2.getRawArgs().includes(`--${self2.getHelpOption()?.name}`);
|
|
@@ -93086,20 +93309,20 @@ var command42 = new Command().name("wmill").action(() => info(`Welcome to Windmi
|
|
|
93086
93309
|
error(e2);
|
|
93087
93310
|
info("Try running with sudo and otherwise check the result of the command: npm uninstall windmill-cli && npm install -g windmill-cli");
|
|
93088
93311
|
})).command("completions", new Command().description("Generate shell completions.").command("bash", new Command().description("Generate bash completions.").action(() => {
|
|
93089
|
-
process.stdout.write(generateShellCompletions(
|
|
93312
|
+
process.stdout.write(generateShellCompletions(command43, "bash") + `
|
|
93090
93313
|
`);
|
|
93091
93314
|
})).command("zsh", new Command().description("Generate zsh completions.").action(() => {
|
|
93092
|
-
process.stdout.write(generateShellCompletions(
|
|
93315
|
+
process.stdout.write(generateShellCompletions(command43, "zsh") + `
|
|
93093
93316
|
`);
|
|
93094
93317
|
})).command("fish", new Command().description("Generate fish completions.").action(() => {
|
|
93095
|
-
process.stdout.write(generateShellCompletions(
|
|
93318
|
+
process.stdout.write(generateShellCompletions(command43, "fish") + `
|
|
93096
93319
|
`);
|
|
93097
93320
|
})));
|
|
93098
93321
|
async function main2() {
|
|
93099
93322
|
try {
|
|
93100
93323
|
const args = process.argv.slice(2);
|
|
93101
93324
|
if (args.length === 0) {
|
|
93102
|
-
|
|
93325
|
+
command43.showHelp();
|
|
93103
93326
|
}
|
|
93104
93327
|
const LOG_LEVEL = args.includes("--verbose") || args.includes("--debug") ? "DEBUG" : "INFO";
|
|
93105
93328
|
setShowDiffs(args.includes("--show-diffs"));
|
|
@@ -93116,8 +93339,10 @@ async function main2() {
|
|
|
93116
93339
|
if (shouldRunFreshnessCheck(process.argv)) {
|
|
93117
93340
|
const { warnIfPromptsStale: warnIfPromptsStale2 } = await init_freshness().then(() => exports_freshness);
|
|
93118
93341
|
await warnIfPromptsStale2({ argv: process.argv }).catch(() => {});
|
|
93342
|
+
const { warnIfTsconfigStale: warnIfTsconfigStale2 } = await init_tsconfig().then(() => exports_tsconfig);
|
|
93343
|
+
await warnIfTsconfigStale2().catch(() => {});
|
|
93119
93344
|
}
|
|
93120
|
-
await
|
|
93345
|
+
await command43.parse(args);
|
|
93121
93346
|
} catch (e2) {
|
|
93122
93347
|
if (e2 && typeof e2 === "object" && "name" in e2 && e2.name === "ApiError") {
|
|
93123
93348
|
const body = e2.body;
|
|
@@ -93153,7 +93378,7 @@ if (isMain()) {
|
|
|
93153
93378
|
process.stdin.destroy();
|
|
93154
93379
|
});
|
|
93155
93380
|
}
|
|
93156
|
-
var main_default =
|
|
93381
|
+
var main_default = command43;
|
|
93157
93382
|
export {
|
|
93158
93383
|
add as workspaceAdd,
|
|
93159
93384
|
workspace_default as workspace,
|