windmill-cli 1.714.1 → 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 +1031 -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,
|
|
@@ -17462,6 +17462,7 @@ __export(exports_services_gen, {
|
|
|
17462
17462
|
getLatestKeyRenewalAttempt: () => getLatestKeyRenewalAttempt,
|
|
17463
17463
|
getKafkaTrigger: () => getKafkaTrigger,
|
|
17464
17464
|
getJwks: () => getJwks,
|
|
17465
|
+
getJobViewToken: () => getJobViewToken,
|
|
17465
17466
|
getJobUpdatesSse: () => getJobUpdatesSse,
|
|
17466
17467
|
getJobUpdates: () => getJobUpdates,
|
|
17467
17468
|
getJobProgress: () => getJobProgress,
|
|
@@ -20950,6 +20951,15 @@ var backendVersion = () => {
|
|
|
20950
20951
|
node_id: data3.nodeId
|
|
20951
20952
|
}
|
|
20952
20953
|
});
|
|
20954
|
+
}, getJobViewToken = (data3) => {
|
|
20955
|
+
return request(OpenAPI, {
|
|
20956
|
+
method: "GET",
|
|
20957
|
+
url: "/w/{workspace}/jobs/job_view_token/{id}",
|
|
20958
|
+
path: {
|
|
20959
|
+
workspace: data3.workspace,
|
|
20960
|
+
id: data3.id
|
|
20961
|
+
}
|
|
20962
|
+
});
|
|
20953
20963
|
}, listFlowPaths = (data3) => {
|
|
20954
20964
|
return request(OpenAPI, {
|
|
20955
20965
|
method: "GET",
|
|
@@ -25279,7 +25289,7 @@ var init_auth = __esm(async () => {
|
|
|
25279
25289
|
});
|
|
25280
25290
|
|
|
25281
25291
|
// src/core/constants.ts
|
|
25282
|
-
var WM_FORK_PREFIX = "wm-fork";
|
|
25292
|
+
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.716.0";
|
|
25283
25293
|
|
|
25284
25294
|
// src/utils/git.ts
|
|
25285
25295
|
var exports_git = {};
|
|
@@ -27454,70 +27464,6 @@ var init_conf = __esm(async () => {
|
|
|
27454
27464
|
RESERVED_WORKSPACE_KEYS = new Set(["commonSpecificItems"]);
|
|
27455
27465
|
});
|
|
27456
27466
|
|
|
27457
|
-
// src/commands/resource-type/tsconfig.ts
|
|
27458
|
-
import { execSync as execSync3 } from "node:child_process";
|
|
27459
|
-
import { existsSync as existsSync3, writeFileSync } from "node:fs";
|
|
27460
|
-
import path3 from "node:path";
|
|
27461
|
-
import process10 from "node:process";
|
|
27462
|
-
async function generateTsconfigForIde() {
|
|
27463
|
-
const tsconfigPath = path3.join(process10.cwd(), "tsconfig.json");
|
|
27464
|
-
if (existsSync3(tsconfigPath)) {
|
|
27465
|
-
info(colors.gray("tsconfig.json already exists, skipping"));
|
|
27466
|
-
return;
|
|
27467
|
-
}
|
|
27468
|
-
let defaultTs = "bun";
|
|
27469
|
-
try {
|
|
27470
|
-
const conf = await readConfigFile({ warnIfMissing: false });
|
|
27471
|
-
if (conf?.defaultTs === "deno") {
|
|
27472
|
-
defaultTs = "deno";
|
|
27473
|
-
}
|
|
27474
|
-
} catch {}
|
|
27475
|
-
const bunTypesAvailable = defaultTs === "bun" ? ensureBunTypesAvailable() : false;
|
|
27476
|
-
const tsconfig = {
|
|
27477
|
-
compilerOptions: {
|
|
27478
|
-
target: "ESNext",
|
|
27479
|
-
module: "ESNext",
|
|
27480
|
-
moduleResolution: "bundler",
|
|
27481
|
-
noEmit: true,
|
|
27482
|
-
strict: false
|
|
27483
|
-
},
|
|
27484
|
-
include: ["**/*.ts", "rt.d.ts"]
|
|
27485
|
-
};
|
|
27486
|
-
if (bunTypesAvailable) {
|
|
27487
|
-
tsconfig.compilerOptions.types = ["bun-types"];
|
|
27488
|
-
}
|
|
27489
|
-
writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2) + `
|
|
27490
|
-
`);
|
|
27491
|
-
info(colors.green("Created tsconfig.json for IDE type support."));
|
|
27492
|
-
}
|
|
27493
|
-
function ensureBunTypesAvailable() {
|
|
27494
|
-
const cwd = process10.cwd();
|
|
27495
|
-
if (existsSync3(path3.join(cwd, "node_modules", "bun-types"))) {
|
|
27496
|
-
return true;
|
|
27497
|
-
}
|
|
27498
|
-
try {
|
|
27499
|
-
execSync3("bun --version", { stdio: "ignore" });
|
|
27500
|
-
} catch {
|
|
27501
|
-
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.`);
|
|
27502
|
-
return false;
|
|
27503
|
-
}
|
|
27504
|
-
try {
|
|
27505
|
-
info(colors.yellow("Installing bun-types with 'bun add -d bun-types'..."));
|
|
27506
|
-
execSync3("bun add -d bun-types", { stdio: "inherit" });
|
|
27507
|
-
info(colors.green("Installed bun-types."));
|
|
27508
|
-
return true;
|
|
27509
|
-
} catch (e) {
|
|
27510
|
-
warn(`Failed to install bun-types automatically: ${e instanceof Error ? e.message : e}`);
|
|
27511
|
-
info(`Run 'bun add -d bun-types' manually and add "types": ["bun-types"] to tsconfig.json for Bun API autocompletion.`);
|
|
27512
|
-
return false;
|
|
27513
|
-
}
|
|
27514
|
-
}
|
|
27515
|
-
var init_tsconfig = __esm(async () => {
|
|
27516
|
-
init_colors2();
|
|
27517
|
-
init_log();
|
|
27518
|
-
await init_conf();
|
|
27519
|
-
});
|
|
27520
|
-
|
|
27521
27467
|
// src/utils/resource_types.ts
|
|
27522
27468
|
function compileResourceTypeToTsType(schema) {
|
|
27523
27469
|
function rec(x, root = false) {
|
|
@@ -27560,10 +27506,10 @@ __export(exports_resource_type, {
|
|
|
27560
27506
|
generateRTNamespace: () => generateRTNamespace,
|
|
27561
27507
|
default: () => resource_type_default
|
|
27562
27508
|
});
|
|
27563
|
-
import { writeFileSync
|
|
27509
|
+
import { writeFileSync } from "node:fs";
|
|
27564
27510
|
import { stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
|
|
27565
|
-
import
|
|
27566
|
-
import
|
|
27511
|
+
import path3 from "node:path";
|
|
27512
|
+
import process10 from "node:process";
|
|
27567
27513
|
async function pushResourceType(workspace, remotePath, resource, localResource) {
|
|
27568
27514
|
remotePath = removeType(remotePath, "resource-type");
|
|
27569
27515
|
try {
|
|
@@ -27648,12 +27594,12 @@ async function newResourceType(opts, name) {
|
|
|
27648
27594
|
});
|
|
27649
27595
|
info(colors.green(`Created ${filePath}`));
|
|
27650
27596
|
}
|
|
27651
|
-
async function get(opts,
|
|
27597
|
+
async function get(opts, path4) {
|
|
27652
27598
|
const workspace = await resolveWorkspace(opts);
|
|
27653
27599
|
await requireLogin(opts);
|
|
27654
27600
|
const rt = await getResourceType({
|
|
27655
27601
|
workspace: workspace.workspaceId,
|
|
27656
|
-
path:
|
|
27602
|
+
path: path4
|
|
27657
27603
|
});
|
|
27658
27604
|
if (opts.json) {
|
|
27659
27605
|
console.log(JSON.stringify(rt));
|
|
@@ -27683,9 +27629,8 @@ async function generateRTNamespace(opts) {
|
|
|
27683
27629
|
`);
|
|
27684
27630
|
namespaceContent += `
|
|
27685
27631
|
}`;
|
|
27686
|
-
|
|
27632
|
+
writeFileSync(path3.join(process10.cwd(), "rt.d.ts"), namespaceContent);
|
|
27687
27633
|
info(colors.green("Created rt.d.ts with resource types namespace (RT) for TypeScript."));
|
|
27688
|
-
await generateTsconfigForIde();
|
|
27689
27634
|
}
|
|
27690
27635
|
var import_yaml4, command, resource_type_default;
|
|
27691
27636
|
var init_resource_type = __esm(async () => {
|
|
@@ -27698,7 +27643,6 @@ var init_resource_type = __esm(async () => {
|
|
|
27698
27643
|
init_types(),
|
|
27699
27644
|
init_auth(),
|
|
27700
27645
|
init_context(),
|
|
27701
|
-
init_tsconfig(),
|
|
27702
27646
|
init_utils()
|
|
27703
27647
|
]);
|
|
27704
27648
|
import_yaml4 = __toESM(require_dist(), 1);
|
|
@@ -27721,7 +27665,7 @@ __export(exports_workspace, {
|
|
|
27721
27665
|
add: () => add
|
|
27722
27666
|
});
|
|
27723
27667
|
import { writeFile as writeFile3, open as fsOpen } from "node:fs/promises";
|
|
27724
|
-
import
|
|
27668
|
+
import process11 from "node:process";
|
|
27725
27669
|
async function allWorkspaces(configDirOverride) {
|
|
27726
27670
|
try {
|
|
27727
27671
|
const file = await getWorkspaceConfigFilePath(configDirOverride);
|
|
@@ -27833,7 +27777,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
|
|
|
27833
27777
|
}
|
|
27834
27778
|
remote = new URL(remote).toString();
|
|
27835
27779
|
let token = await tryGetLoginInfo(opts);
|
|
27836
|
-
if (!token && !(
|
|
27780
|
+
if (!token && !(process11.stdin.isTTY ?? false)) {
|
|
27837
27781
|
info("Not a TTY, can't login interactively. Pass the token in --token");
|
|
27838
27782
|
return;
|
|
27839
27783
|
}
|
|
@@ -27875,7 +27819,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
|
|
|
27875
27819
|
info(`- ${workspace.id} (name: ${workspace.name})`);
|
|
27876
27820
|
}
|
|
27877
27821
|
}
|
|
27878
|
-
|
|
27822
|
+
process11.exit(1);
|
|
27879
27823
|
}
|
|
27880
27824
|
const added = await addWorkspace({
|
|
27881
27825
|
name: workspaceName,
|
|
@@ -27892,7 +27836,7 @@ async function add(opts, workspaceName, workspaceId, remote) {
|
|
|
27892
27836
|
async function addWorkspace(workspace, opts) {
|
|
27893
27837
|
workspace.remote = new URL(workspace.remote).toString();
|
|
27894
27838
|
const existingWorkspaces = await allWorkspaces(opts.configDir);
|
|
27895
|
-
const isInteractive = (
|
|
27839
|
+
const isInteractive = (process11.stdin.isTTY ?? false) && (process11.stdout.isTTY ?? false) && !opts.force;
|
|
27896
27840
|
const nameConflict = existingWorkspaces.find((w) => w.name === workspace.name);
|
|
27897
27841
|
if (nameConflict) {
|
|
27898
27842
|
if (nameConflict.remote === workspace.remote && nameConflict.workspaceId === workspace.workspaceId) {
|
|
@@ -28068,7 +28012,7 @@ async function bind(opts, doBind) {
|
|
|
28068
28012
|
if (!config.workspaces) {
|
|
28069
28013
|
config.workspaces = {};
|
|
28070
28014
|
}
|
|
28071
|
-
const isInteractive = !!
|
|
28015
|
+
const isInteractive = !!process11.stdin.isTTY;
|
|
28072
28016
|
const inGitRepo = isGitRepository2();
|
|
28073
28017
|
const currentBranch = inGitRepo ? getCurrentGitBranch2() : null;
|
|
28074
28018
|
if (doBind) {
|
|
@@ -28257,16 +28201,16 @@ async function getBranchProfilesPath(configDirOverride) {
|
|
|
28257
28201
|
}
|
|
28258
28202
|
async function loadBranchProfiles(configDirOverride) {
|
|
28259
28203
|
try {
|
|
28260
|
-
const
|
|
28261
|
-
const content = await readTextFile(
|
|
28204
|
+
const path4 = await getBranchProfilesPath(configDirOverride);
|
|
28205
|
+
const content = await readTextFile(path4);
|
|
28262
28206
|
return JSON.parse(content);
|
|
28263
28207
|
} catch {
|
|
28264
28208
|
return { lastUsed: {} };
|
|
28265
28209
|
}
|
|
28266
28210
|
}
|
|
28267
28211
|
async function saveBranchProfiles(mapping, configDirOverride) {
|
|
28268
|
-
const
|
|
28269
|
-
await writeFile4(
|
|
28212
|
+
const path4 = await getBranchProfilesPath(configDirOverride);
|
|
28213
|
+
await writeFile4(path4, JSON.stringify(mapping, null, 2), "utf-8");
|
|
28270
28214
|
}
|
|
28271
28215
|
function getBranchProfileKey(branch, baseUrl2, workspaceId) {
|
|
28272
28216
|
let normalizedUrl;
|
|
@@ -28705,8 +28649,8 @@ async function tryResolveVersion(opts) {
|
|
|
28705
28649
|
return;
|
|
28706
28650
|
}
|
|
28707
28651
|
}
|
|
28708
|
-
function validatePath(
|
|
28709
|
-
if (!(
|
|
28652
|
+
function validatePath(path4) {
|
|
28653
|
+
if (!(path4.startsWith("g") || path4.startsWith("u") || path4.startsWith("f"))) {
|
|
28710
28654
|
info(colors.red("Given remote path looks invalid. Remote paths are typically of the form <u|g|f>/<username|group|folder>/..."));
|
|
28711
28655
|
return false;
|
|
28712
28656
|
}
|
|
@@ -28759,7 +28703,7 @@ var init_global = __esm(() => {
|
|
|
28759
28703
|
// src/utils/utils.ts
|
|
28760
28704
|
import { sep as SEP3 } from "node:path";
|
|
28761
28705
|
import crypto2 from "node:crypto";
|
|
28762
|
-
import { readFileSync, writeFileSync as
|
|
28706
|
+
import { readFileSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
28763
28707
|
import { readdir, readFile } from "node:fs/promises";
|
|
28764
28708
|
function deepEqual(a, b) {
|
|
28765
28709
|
if (a === b)
|
|
@@ -28846,12 +28790,12 @@ function getHeaders2() {
|
|
|
28846
28790
|
return;
|
|
28847
28791
|
}
|
|
28848
28792
|
}
|
|
28849
|
-
async function digestDir(
|
|
28793
|
+
async function digestDir(path4, conf) {
|
|
28850
28794
|
const hashes = [];
|
|
28851
|
-
const entries = await readdir(
|
|
28795
|
+
const entries = await readdir(path4, { withFileTypes: true });
|
|
28852
28796
|
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
28853
28797
|
for (const e of entries) {
|
|
28854
|
-
const npath =
|
|
28798
|
+
const npath = path4 + "/" + e.name;
|
|
28855
28799
|
if (e.isFile()) {
|
|
28856
28800
|
hashes.push(await generateHashFromBuffer(await readFile(npath)));
|
|
28857
28801
|
} else if (e.isDirectory() && !e.isSymbolicLink()) {
|
|
@@ -28868,19 +28812,19 @@ async function generateHashFromBuffer(content) {
|
|
|
28868
28812
|
const hashBuffer = await crypto2.subtle.digest("SHA-256", content);
|
|
28869
28813
|
return Buffer.from(hashBuffer).toString("hex");
|
|
28870
28814
|
}
|
|
28871
|
-
function decodeBufferAsUtf8(buf,
|
|
28815
|
+
function decodeBufferAsUtf8(buf, path4) {
|
|
28872
28816
|
if (buf.length >= 2) {
|
|
28873
28817
|
if (buf[0] === 255 && buf[1] === 254) {
|
|
28874
28818
|
if (buf.length >= 4 && buf[2] === 0 && buf[3] === 0) {
|
|
28875
|
-
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.`);
|
|
28876
28820
|
}
|
|
28877
|
-
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.`);
|
|
28878
28822
|
}
|
|
28879
28823
|
if (buf[0] === 254 && buf[1] === 255) {
|
|
28880
|
-
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.`);
|
|
28881
28825
|
}
|
|
28882
28826
|
if (buf.length >= 4 && buf[0] === 0 && buf[1] === 0 && buf[2] === 254 && buf[3] === 255) {
|
|
28883
|
-
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.`);
|
|
28884
28828
|
}
|
|
28885
28829
|
}
|
|
28886
28830
|
if (buf.length >= 3 && buf[0] === 239 && buf[1] === 187 && buf[2] === 191) {
|
|
@@ -28888,32 +28832,32 @@ function decodeBufferAsUtf8(buf, path5) {
|
|
|
28888
28832
|
}
|
|
28889
28833
|
return buf.toString("utf-8");
|
|
28890
28834
|
}
|
|
28891
|
-
async function readTextFile(
|
|
28892
|
-
return decodeBufferAsUtf8(await readFile(
|
|
28835
|
+
async function readTextFile(path4) {
|
|
28836
|
+
return decodeBufferAsUtf8(await readFile(path4), path4);
|
|
28893
28837
|
}
|
|
28894
|
-
function readTextFileSync(
|
|
28895
|
-
return decodeBufferAsUtf8(readFileSync(
|
|
28838
|
+
function readTextFileSync(path4) {
|
|
28839
|
+
return decodeBufferAsUtf8(readFileSync(path4), path4);
|
|
28896
28840
|
}
|
|
28897
|
-
function readInlinePathSync(
|
|
28841
|
+
function readInlinePathSync(path4) {
|
|
28898
28842
|
try {
|
|
28899
|
-
return readTextFileSync(
|
|
28843
|
+
return readTextFileSync(path4.replaceAll("/", SEP3));
|
|
28900
28844
|
} catch (error2) {
|
|
28901
|
-
warn(`Error reading inline path: ${
|
|
28845
|
+
warn(`Error reading inline path: ${path4}, ${error2}`);
|
|
28902
28846
|
return "";
|
|
28903
28847
|
}
|
|
28904
28848
|
}
|
|
28905
|
-
function isFileResource(
|
|
28906
|
-
const splitPath =
|
|
28849
|
+
function isFileResource(path4) {
|
|
28850
|
+
const splitPath = path4.split(".");
|
|
28907
28851
|
return splitPath.length >= 4 && splitPath[splitPath.length - 3] == "resource" && splitPath[splitPath.length - 2] == "file";
|
|
28908
28852
|
}
|
|
28909
|
-
function isFilesetResource(
|
|
28910
|
-
return
|
|
28853
|
+
function isFilesetResource(path4) {
|
|
28854
|
+
return path4.includes(".fileset/") || path4.includes(".fileset\\");
|
|
28911
28855
|
}
|
|
28912
|
-
function isRawAppFile(
|
|
28913
|
-
return isRawAppPath(
|
|
28856
|
+
function isRawAppFile(path4) {
|
|
28857
|
+
return isRawAppPath(path4);
|
|
28914
28858
|
}
|
|
28915
|
-
function isWorkspaceDependencies(
|
|
28916
|
-
return
|
|
28859
|
+
function isWorkspaceDependencies(path4) {
|
|
28860
|
+
return path4.startsWith("dependencies/");
|
|
28917
28861
|
}
|
|
28918
28862
|
async function selectRepository(repositories, operation) {
|
|
28919
28863
|
if (repositories.length === 0) {
|
|
@@ -28952,16 +28896,16 @@ async function getIsWin() {
|
|
|
28952
28896
|
}
|
|
28953
28897
|
return isWin;
|
|
28954
28898
|
}
|
|
28955
|
-
function writeIfChanged(
|
|
28899
|
+
function writeIfChanged(path4, content) {
|
|
28956
28900
|
try {
|
|
28957
|
-
const existing = readTextFileSync(
|
|
28901
|
+
const existing = readTextFileSync(path4);
|
|
28958
28902
|
if (existing === content) {
|
|
28959
28903
|
return false;
|
|
28960
28904
|
}
|
|
28961
28905
|
} catch (error2) {
|
|
28962
28906
|
if (error2?.code !== "ENOENT") {}
|
|
28963
28907
|
}
|
|
28964
|
-
|
|
28908
|
+
writeFileSync2(path4, content, "utf-8");
|
|
28965
28909
|
return true;
|
|
28966
28910
|
}
|
|
28967
28911
|
async function fetchRemoteVersion(workspace) {
|
|
@@ -28969,6 +28913,7 @@ async function fetchRemoteVersion(workspace) {
|
|
|
28969
28913
|
if (version) {
|
|
28970
28914
|
updateGlobalVersions(version);
|
|
28971
28915
|
}
|
|
28916
|
+
info(colors.gray("CLI version: " + VERSION));
|
|
28972
28917
|
info(colors.gray("Remote version: " + version));
|
|
28973
28918
|
}
|
|
28974
28919
|
function toCamel(s) {
|
|
@@ -29001,24 +28946,24 @@ var init_utils = __esm(async () => {
|
|
|
29001
28946
|
});
|
|
29002
28947
|
|
|
29003
28948
|
// src/utils/yaml.ts
|
|
29004
|
-
async function yamlParseFile(
|
|
28949
|
+
async function yamlParseFile(path4, options = {}) {
|
|
29005
28950
|
try {
|
|
29006
|
-
return import_yaml5.parse(await readTextFile(
|
|
28951
|
+
return import_yaml5.parse(await readTextFile(path4), {
|
|
29007
28952
|
...options,
|
|
29008
28953
|
customTags: [...WINDMILL_CUSTOM_TAGS, ...options.customTags ?? []]
|
|
29009
28954
|
});
|
|
29010
28955
|
} catch (e) {
|
|
29011
|
-
throw new Error(`Error parsing yaml ${
|
|
28956
|
+
throw new Error(`Error parsing yaml ${path4}`, { cause: e });
|
|
29012
28957
|
}
|
|
29013
28958
|
}
|
|
29014
|
-
function yamlParseContent(
|
|
28959
|
+
function yamlParseContent(path4, content, options = {}) {
|
|
29015
28960
|
try {
|
|
29016
28961
|
return import_yaml5.parse(content, {
|
|
29017
28962
|
...options,
|
|
29018
28963
|
customTags: [...WINDMILL_CUSTOM_TAGS, ...options.customTags ?? []]
|
|
29019
28964
|
});
|
|
29020
28965
|
} catch (e) {
|
|
29021
|
-
throw new Error(`Error parsing yaml ${
|
|
28966
|
+
throw new Error(`Error parsing yaml ${path4}`, { cause: e });
|
|
29022
28967
|
}
|
|
29023
28968
|
}
|
|
29024
28969
|
var import_yaml5, inlineTag, inlineFilesetTag, WINDMILL_CUSTOM_TAGS;
|
|
@@ -30934,7 +30879,7 @@ return schema
|
|
|
30934
30879
|
|
|
30935
30880
|
// src/utils/port-probe.ts
|
|
30936
30881
|
import { createServer as createServer2 } from "node:net";
|
|
30937
|
-
import { execSync as
|
|
30882
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
30938
30883
|
function isPortFree(port, host) {
|
|
30939
30884
|
return new Promise((resolve6) => {
|
|
30940
30885
|
const s = createServer2();
|
|
@@ -30955,7 +30900,7 @@ async function isPortFreeOnBothStacks(port) {
|
|
|
30955
30900
|
}
|
|
30956
30901
|
function findPortHolder(port) {
|
|
30957
30902
|
try {
|
|
30958
|
-
const out =
|
|
30903
|
+
const out = execSync3(`lsof -nP -iTCP:${port} -sTCP:LISTEN -F pc 2>/dev/null`, {
|
|
30959
30904
|
encoding: "utf-8",
|
|
30960
30905
|
stdio: ["ignore", "pipe", "ignore"]
|
|
30961
30906
|
});
|
|
@@ -30972,7 +30917,7 @@ function findPortHolder(port) {
|
|
|
30972
30917
|
}
|
|
30973
30918
|
} catch {}
|
|
30974
30919
|
try {
|
|
30975
|
-
const out =
|
|
30920
|
+
const out = execSync3(`ss -ltnp 2>/dev/null | awk '$4 ~ /:${port}$/ { print $NF }'`, {
|
|
30976
30921
|
encoding: "utf-8",
|
|
30977
30922
|
stdio: ["ignore", "pipe", "ignore"]
|
|
30978
30923
|
}).trim();
|
|
@@ -33844,11 +33789,11 @@ var init_wrapper = __esm(() => {
|
|
|
33844
33789
|
|
|
33845
33790
|
// src/commands/app/bundle.ts
|
|
33846
33791
|
import * as fs7 from "node:fs";
|
|
33847
|
-
import * as
|
|
33848
|
-
import
|
|
33792
|
+
import * as path4 from "node:path";
|
|
33793
|
+
import process12 from "node:process";
|
|
33849
33794
|
import { spawn } from "node:child_process";
|
|
33850
33795
|
function detectFrameworks(appDir) {
|
|
33851
|
-
const packageJsonPath =
|
|
33796
|
+
const packageJsonPath = path4.join(appDir, "package.json");
|
|
33852
33797
|
if (!fs7.existsSync(packageJsonPath)) {
|
|
33853
33798
|
return { svelte: false, vue: false };
|
|
33854
33799
|
}
|
|
@@ -33873,7 +33818,7 @@ function createSveltePlugin(appDir) {
|
|
|
33873
33818
|
build.onLoad({ filter: /\.svelte$/ }, async (args) => {
|
|
33874
33819
|
const svelte = await import("svelte/compiler");
|
|
33875
33820
|
const source = await readTextFile(args.path);
|
|
33876
|
-
const filename =
|
|
33821
|
+
const filename = path4.relative(process12.cwd(), args.path);
|
|
33877
33822
|
const convertMessage = ({ message, start, end }) => {
|
|
33878
33823
|
let location;
|
|
33879
33824
|
if (start && end) {
|
|
@@ -33914,8 +33859,8 @@ async function createFrameworkPlugins(appDir) {
|
|
|
33914
33859
|
return plugins;
|
|
33915
33860
|
}
|
|
33916
33861
|
async function ensureNodeModules(appDir) {
|
|
33917
|
-
const targetDir = appDir ??
|
|
33918
|
-
const nodeModulesPath =
|
|
33862
|
+
const targetDir = appDir ?? process12.cwd();
|
|
33863
|
+
const nodeModulesPath = path4.join(targetDir, "node_modules");
|
|
33919
33864
|
if (!fs7.existsSync(nodeModulesPath)) {
|
|
33920
33865
|
info(colors.yellow("\uD83D\uDCE6 node_modules not found, running npm install..."));
|
|
33921
33866
|
const code2 = await new Promise((resolve6, reject) => {
|
|
@@ -33935,7 +33880,7 @@ async function ensureNodeModules(appDir) {
|
|
|
33935
33880
|
}
|
|
33936
33881
|
async function createBundle(options = {}) {
|
|
33937
33882
|
const esbuild = await import("esbuild");
|
|
33938
|
-
const appDir = options.entryPoint ?
|
|
33883
|
+
const appDir = options.entryPoint ? path4.dirname(options.entryPoint) : process12.cwd();
|
|
33939
33884
|
const frameworks = detectFrameworks(appDir);
|
|
33940
33885
|
const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
33941
33886
|
const entryPoint = options.entryPoint ?? defaultEntry;
|
|
@@ -33948,11 +33893,11 @@ async function createBundle(options = {}) {
|
|
|
33948
33893
|
}
|
|
33949
33894
|
await ensureNodeModules(appDir);
|
|
33950
33895
|
const frameworkPlugins = await createFrameworkPlugins(appDir);
|
|
33951
|
-
const distDir =
|
|
33896
|
+
const distDir = path4.join(process12.cwd(), outDir);
|
|
33952
33897
|
if (!fs7.existsSync(distDir)) {
|
|
33953
33898
|
fs7.mkdirSync(distDir, { recursive: true });
|
|
33954
33899
|
}
|
|
33955
|
-
const outfile =
|
|
33900
|
+
const outfile = path4.join(outDir, "bundle.js");
|
|
33956
33901
|
const wmillTs = rawAppWmillTs_exports.default ?? rawAppWmillTs_exports;
|
|
33957
33902
|
const wmillPlugin = {
|
|
33958
33903
|
name: "wmill-virtual",
|
|
@@ -33982,11 +33927,11 @@ async function createBundle(options = {}) {
|
|
|
33982
33927
|
build.onResolve({ filter: /^\/ui\// }, (args) => {
|
|
33983
33928
|
const rel = args.path.slice("/ui/".length);
|
|
33984
33929
|
const candidates = [rel];
|
|
33985
|
-
if (!
|
|
33986
|
-
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"));
|
|
33987
33932
|
}
|
|
33988
33933
|
for (const c of candidates) {
|
|
33989
|
-
const full =
|
|
33934
|
+
const full = path4.join(sharedUiDir, c);
|
|
33990
33935
|
if (fs7.existsSync(full)) {
|
|
33991
33936
|
return { path: full };
|
|
33992
33937
|
}
|
|
@@ -34024,8 +33969,8 @@ async function createBundle(options = {}) {
|
|
|
34024
33969
|
throw new Error("Build failed with errors");
|
|
34025
33970
|
}
|
|
34026
33971
|
info(colors.green("✅ Bundle created successfully"));
|
|
34027
|
-
const jsPath =
|
|
34028
|
-
const cssPath =
|
|
33972
|
+
const jsPath = path4.join(process12.cwd(), outfile);
|
|
33973
|
+
const cssPath = path4.join(process12.cwd(), outDir, "bundle.css");
|
|
34029
33974
|
if (!fs7.existsSync(jsPath)) {
|
|
34030
33975
|
throw new Error(`Expected JS bundle at ${jsPath} but file not found`);
|
|
34031
33976
|
}
|
|
@@ -35877,7 +35822,7 @@ var minimatch = (p, pattern, options = {}) => {
|
|
|
35877
35822
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
35878
35823
|
const len = $0.length;
|
|
35879
35824
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
35880
|
-
}, 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) => {
|
|
35881
35826
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
35882
35827
|
return minimatch;
|
|
35883
35828
|
}
|
|
@@ -35935,11 +35880,11 @@ var init_esm2 = __esm(() => {
|
|
|
35935
35880
|
starRE = /^\*+$/;
|
|
35936
35881
|
qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
35937
35882
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
35938
|
-
|
|
35883
|
+
path5 = {
|
|
35939
35884
|
win32: { sep: "\\" },
|
|
35940
35885
|
posix: { sep: "/" }
|
|
35941
35886
|
};
|
|
35942
|
-
sep2 = defaultPlatform === "win32" ?
|
|
35887
|
+
sep2 = defaultPlatform === "win32" ? path5.win32.sep : path5.posix.sep;
|
|
35943
35888
|
minimatch.sep = sep2;
|
|
35944
35889
|
GLOBSTAR = Symbol("globstar **");
|
|
35945
35890
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -38668,8 +38613,8 @@ var require_utils = __commonJS((exports) => {
|
|
|
38668
38613
|
var result = transform[inputType][outputType](input);
|
|
38669
38614
|
return result;
|
|
38670
38615
|
};
|
|
38671
|
-
exports.resolve = function(
|
|
38672
|
-
var parts =
|
|
38616
|
+
exports.resolve = function(path6) {
|
|
38617
|
+
var parts = path6.split("/");
|
|
38673
38618
|
var result = [];
|
|
38674
38619
|
for (var index = 0;index < parts.length; index++) {
|
|
38675
38620
|
var part = parts[index];
|
|
@@ -44119,18 +44064,18 @@ var require_object = __commonJS((exports, module) => {
|
|
|
44119
44064
|
var object = new ZipObject(name, zipObjectContent, o);
|
|
44120
44065
|
this.files[name] = object;
|
|
44121
44066
|
};
|
|
44122
|
-
var parentFolder = function(
|
|
44123
|
-
if (
|
|
44124
|
-
|
|
44067
|
+
var parentFolder = function(path6) {
|
|
44068
|
+
if (path6.slice(-1) === "/") {
|
|
44069
|
+
path6 = path6.substring(0, path6.length - 1);
|
|
44125
44070
|
}
|
|
44126
|
-
var lastSlash =
|
|
44127
|
-
return lastSlash > 0 ?
|
|
44071
|
+
var lastSlash = path6.lastIndexOf("/");
|
|
44072
|
+
return lastSlash > 0 ? path6.substring(0, lastSlash) : "";
|
|
44128
44073
|
};
|
|
44129
|
-
var forceTrailingSlash = function(
|
|
44130
|
-
if (
|
|
44131
|
-
|
|
44074
|
+
var forceTrailingSlash = function(path6) {
|
|
44075
|
+
if (path6.slice(-1) !== "/") {
|
|
44076
|
+
path6 += "/";
|
|
44132
44077
|
}
|
|
44133
|
-
return
|
|
44078
|
+
return path6;
|
|
44134
44079
|
};
|
|
44135
44080
|
var folderAdd = function(name, createFolders) {
|
|
44136
44081
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults2.createFolders;
|
|
@@ -50635,8 +50580,8 @@ var require_utils2 = __commonJS((exports, module) => {
|
|
|
50635
50580
|
}
|
|
50636
50581
|
return ind;
|
|
50637
50582
|
}
|
|
50638
|
-
function removeDotSegments(
|
|
50639
|
-
let input =
|
|
50583
|
+
function removeDotSegments(path6) {
|
|
50584
|
+
let input = path6;
|
|
50640
50585
|
const output = [];
|
|
50641
50586
|
let nextSlash = -1;
|
|
50642
50587
|
let len = 0;
|
|
@@ -50826,8 +50771,8 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
50826
50771
|
wsComponent.secure = undefined;
|
|
50827
50772
|
}
|
|
50828
50773
|
if (wsComponent.resourceName) {
|
|
50829
|
-
const [
|
|
50830
|
-
wsComponent.path =
|
|
50774
|
+
const [path6, query] = wsComponent.resourceName.split("?");
|
|
50775
|
+
wsComponent.path = path6 && path6 !== "/" ? path6 : undefined;
|
|
50831
50776
|
wsComponent.query = query;
|
|
50832
50777
|
wsComponent.resourceName = undefined;
|
|
50833
50778
|
}
|
|
@@ -54260,13 +54205,13 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
54260
54205
|
}
|
|
54261
54206
|
return next();
|
|
54262
54207
|
};
|
|
54263
|
-
__rewriteRelativeImportExtension = function(
|
|
54264
|
-
if (typeof
|
|
54265
|
-
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) {
|
|
54266
54211
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext2 || !cm) ? m : d + ext2 + "." + cm.toLowerCase() + "js";
|
|
54267
54212
|
});
|
|
54268
54213
|
}
|
|
54269
|
-
return
|
|
54214
|
+
return path6;
|
|
54270
54215
|
};
|
|
54271
54216
|
exporter("__extends", __extends2);
|
|
54272
54217
|
exporter("__assign", __assign2);
|
|
@@ -57570,19 +57515,19 @@ var require_buildJsonPath = __commonJS((exports) => {
|
|
|
57570
57515
|
var types_1 = require_types2();
|
|
57571
57516
|
var utils_1 = require_utils3();
|
|
57572
57517
|
function buildJsonPath(node) {
|
|
57573
|
-
const
|
|
57518
|
+
const path6 = [];
|
|
57574
57519
|
let prevNode = node;
|
|
57575
57520
|
while (node) {
|
|
57576
57521
|
switch (node.kind) {
|
|
57577
57522
|
case types_1.Kind.SCALAR:
|
|
57578
|
-
|
|
57523
|
+
path6.unshift(node.value);
|
|
57579
57524
|
break;
|
|
57580
57525
|
case types_1.Kind.MAPPING:
|
|
57581
57526
|
if (prevNode !== node.key) {
|
|
57582
|
-
if (
|
|
57583
|
-
|
|
57527
|
+
if (path6.length > 0 && utils_1.isObject(node.value) && node.value.value === path6[0]) {
|
|
57528
|
+
path6[0] = node.key.value;
|
|
57584
57529
|
} else {
|
|
57585
|
-
|
|
57530
|
+
path6.unshift(node.key.value);
|
|
57586
57531
|
}
|
|
57587
57532
|
}
|
|
57588
57533
|
break;
|
|
@@ -57590,9 +57535,9 @@ var require_buildJsonPath = __commonJS((exports) => {
|
|
|
57590
57535
|
if (prevNode) {
|
|
57591
57536
|
const index = node.items.indexOf(prevNode);
|
|
57592
57537
|
if (prevNode.kind === types_1.Kind.SCALAR) {
|
|
57593
|
-
|
|
57538
|
+
path6[0] = index;
|
|
57594
57539
|
} else if (index !== -1) {
|
|
57595
|
-
|
|
57540
|
+
path6.unshift(index);
|
|
57596
57541
|
}
|
|
57597
57542
|
}
|
|
57598
57543
|
break;
|
|
@@ -57600,7 +57545,7 @@ var require_buildJsonPath = __commonJS((exports) => {
|
|
|
57600
57545
|
prevNode = node;
|
|
57601
57546
|
node = node.parent;
|
|
57602
57547
|
}
|
|
57603
|
-
return
|
|
57548
|
+
return path6;
|
|
57604
57549
|
}
|
|
57605
57550
|
exports.buildJsonPath = buildJsonPath;
|
|
57606
57551
|
});
|
|
@@ -57659,10 +57604,10 @@ var require_getJsonPathForPosition = __commonJS((exports) => {
|
|
|
57659
57604
|
const node = findClosestScalar(ast, Math.min(lineMap[line] - 1, startOffset + character), line, lineMap);
|
|
57660
57605
|
if (!utils_1.isObject(node))
|
|
57661
57606
|
return;
|
|
57662
|
-
const
|
|
57663
|
-
if (
|
|
57607
|
+
const path6 = buildJsonPath_1.buildJsonPath(node);
|
|
57608
|
+
if (path6.length === 0)
|
|
57664
57609
|
return;
|
|
57665
|
-
return
|
|
57610
|
+
return path6;
|
|
57666
57611
|
};
|
|
57667
57612
|
function* walk(node) {
|
|
57668
57613
|
switch (node.kind) {
|
|
@@ -57783,8 +57728,8 @@ var require_getLocationForJsonPath = __commonJS((exports) => {
|
|
|
57783
57728
|
var lineForPosition_1 = require_lineForPosition();
|
|
57784
57729
|
var types_1 = require_types2();
|
|
57785
57730
|
var utils_1 = require_utils3();
|
|
57786
|
-
exports.getLocationForJsonPath = ({ ast, lineMap, metadata },
|
|
57787
|
-
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 });
|
|
57788
57733
|
if (node === undefined)
|
|
57789
57734
|
return;
|
|
57790
57735
|
return getLoc(lineMap, {
|
|
@@ -57835,9 +57780,9 @@ var require_getLocationForJsonPath = __commonJS((exports) => {
|
|
|
57835
57780
|
}
|
|
57836
57781
|
return node.endPosition;
|
|
57837
57782
|
}
|
|
57838
|
-
function findNodeAtPath(node,
|
|
57783
|
+
function findNodeAtPath(node, path6, { closest, mergeKeys }) {
|
|
57839
57784
|
pathLoop:
|
|
57840
|
-
for (const segment of
|
|
57785
|
+
for (const segment of path6) {
|
|
57841
57786
|
if (!utils_1.isObject(node)) {
|
|
57842
57787
|
return closest ? node : undefined;
|
|
57843
57788
|
}
|
|
@@ -61777,14 +61722,14 @@ var require_yaml_validator = __commonJS((exports) => {
|
|
|
61777
61722
|
email: email_json_1.default
|
|
61778
61723
|
};
|
|
61779
61724
|
function getValidationTargetFromFilename(filePath) {
|
|
61780
|
-
const
|
|
61781
|
-
if (/[/\\]flow\.ya?ml$/.test(
|
|
61725
|
+
const path6 = filePath.toLowerCase();
|
|
61726
|
+
if (/[/\\]flow\.ya?ml$/.test(path6) || /^flow\.ya?ml$/.test(path6)) {
|
|
61782
61727
|
return { type: "flow" };
|
|
61783
61728
|
}
|
|
61784
|
-
if (/\.schedule\.ya?ml$/.test(
|
|
61729
|
+
if (/\.schedule\.ya?ml$/.test(path6)) {
|
|
61785
61730
|
return { type: "schedule" };
|
|
61786
61731
|
}
|
|
61787
|
-
const triggerMatch =
|
|
61732
|
+
const triggerMatch = path6.match(/\.(http|websocket|kafka|nats|postgres|mqtt|sqs|gcp|email)_trigger\.ya?ml$/);
|
|
61788
61733
|
if (triggerMatch) {
|
|
61789
61734
|
return {
|
|
61790
61735
|
type: "trigger",
|
|
@@ -61938,7 +61883,7 @@ function formatError(e) {
|
|
|
61938
61883
|
return String(e);
|
|
61939
61884
|
}
|
|
61940
61885
|
}
|
|
61941
|
-
async function applyExtraPermsDiff(workspace, kind,
|
|
61886
|
+
async function applyExtraPermsDiff(workspace, kind, path6, local, remote) {
|
|
61942
61887
|
if (local === undefined || local === null) {
|
|
61943
61888
|
return 0;
|
|
61944
61889
|
}
|
|
@@ -61966,13 +61911,13 @@ async function applyExtraPermsDiff(workspace, kind, path7, local, remote) {
|
|
|
61966
61911
|
await addGranularAcls({
|
|
61967
61912
|
workspace,
|
|
61968
61913
|
kind,
|
|
61969
|
-
path:
|
|
61914
|
+
path: path6,
|
|
61970
61915
|
requestBody: { owner, write }
|
|
61971
61916
|
});
|
|
61972
|
-
info(colors.green(` extra_perms: granted ${access} to ${owner} on ${kind}/${
|
|
61917
|
+
info(colors.green(` extra_perms: granted ${access} to ${owner} on ${kind}/${path6}`));
|
|
61973
61918
|
calls += 1;
|
|
61974
61919
|
} catch (e) {
|
|
61975
|
-
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)}`));
|
|
61976
61921
|
}
|
|
61977
61922
|
}
|
|
61978
61923
|
for (const owner of toRevoke) {
|
|
@@ -61980,13 +61925,13 @@ async function applyExtraPermsDiff(workspace, kind, path7, local, remote) {
|
|
|
61980
61925
|
await removeGranularAcls({
|
|
61981
61926
|
workspace,
|
|
61982
61927
|
kind,
|
|
61983
|
-
path:
|
|
61928
|
+
path: path6,
|
|
61984
61929
|
requestBody: { owner }
|
|
61985
61930
|
});
|
|
61986
|
-
info(colors.green(` extra_perms: revoked ${owner} on ${kind}/${
|
|
61931
|
+
info(colors.green(` extra_perms: revoked ${owner} on ${kind}/${path6}`));
|
|
61987
61932
|
calls += 1;
|
|
61988
61933
|
} catch (e) {
|
|
61989
|
-
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)}`));
|
|
61990
61935
|
}
|
|
61991
61936
|
}
|
|
61992
61937
|
return calls;
|
|
@@ -62011,20 +61956,20 @@ function getWorkspaceSpecificTypeKinds() {
|
|
|
62011
61956
|
...TRIGGER_TYPES.map((t) => `${t}_trigger`)
|
|
62012
61957
|
];
|
|
62013
61958
|
}
|
|
62014
|
-
function isTriggerFile(
|
|
62015
|
-
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`));
|
|
62016
61961
|
}
|
|
62017
|
-
function isScheduleFile(
|
|
62018
|
-
return
|
|
61962
|
+
function isScheduleFile(path6) {
|
|
61963
|
+
return path6.endsWith(".schedule.yaml") || path6.endsWith(".schedule.json");
|
|
62019
61964
|
}
|
|
62020
|
-
function getFileTypeSuffix(
|
|
61965
|
+
function getFileTypeSuffix(path6) {
|
|
62021
61966
|
for (const kind of getWorkspaceSpecificTypeKinds()) {
|
|
62022
|
-
if (
|
|
61967
|
+
if (path6.endsWith(`.${kind}.yaml`))
|
|
62023
61968
|
return `.${kind}.yaml`;
|
|
62024
|
-
if (
|
|
61969
|
+
if (path6.endsWith(`.${kind}.json`))
|
|
62025
61970
|
return `.${kind}.json`;
|
|
62026
61971
|
}
|
|
62027
|
-
const resourceFileMatch =
|
|
61972
|
+
const resourceFileMatch = path6.match(/(\.resource\.file\..+)$/);
|
|
62028
61973
|
if (resourceFileMatch) {
|
|
62029
61974
|
return resourceFileMatch[1];
|
|
62030
61975
|
}
|
|
@@ -62095,76 +62040,76 @@ function getSpecificItemsForCurrentBranch(config, workspaceNameOverride) {
|
|
|
62095
62040
|
}
|
|
62096
62041
|
return merged;
|
|
62097
62042
|
}
|
|
62098
|
-
function matchesPatterns(
|
|
62099
|
-
return patterns.some((pattern) => minimatch(
|
|
62043
|
+
function matchesPatterns(path6, patterns) {
|
|
62044
|
+
return patterns.some((pattern) => minimatch(path6, pattern));
|
|
62100
62045
|
}
|
|
62101
|
-
function normalizeJsonToYaml(
|
|
62102
|
-
return
|
|
62046
|
+
function normalizeJsonToYaml(path6) {
|
|
62047
|
+
return path6.endsWith(".json") ? path6.slice(0, -".json".length) + ".yaml" : path6;
|
|
62103
62048
|
}
|
|
62104
|
-
function isItemTypeConfigured(
|
|
62049
|
+
function isItemTypeConfigured(path6, specificItems) {
|
|
62105
62050
|
if (!specificItems) {
|
|
62106
62051
|
return false;
|
|
62107
62052
|
}
|
|
62108
|
-
|
|
62109
|
-
if (
|
|
62053
|
+
path6 = normalizeJsonToYaml(path6);
|
|
62054
|
+
if (path6.endsWith(".variable.yaml")) {
|
|
62110
62055
|
return specificItems.variables !== undefined;
|
|
62111
62056
|
}
|
|
62112
|
-
if (
|
|
62057
|
+
if (path6.endsWith(".resource.yaml")) {
|
|
62113
62058
|
return specificItems.resources !== undefined;
|
|
62114
62059
|
}
|
|
62115
|
-
if (isTriggerFile(
|
|
62060
|
+
if (isTriggerFile(path6)) {
|
|
62116
62061
|
return specificItems.triggers !== undefined;
|
|
62117
62062
|
}
|
|
62118
|
-
if (isScheduleFile(
|
|
62063
|
+
if (isScheduleFile(path6)) {
|
|
62119
62064
|
return specificItems.schedules !== undefined;
|
|
62120
62065
|
}
|
|
62121
|
-
if (
|
|
62066
|
+
if (path6.endsWith("/folder.meta.yaml")) {
|
|
62122
62067
|
return specificItems.folders !== undefined;
|
|
62123
62068
|
}
|
|
62124
|
-
if (
|
|
62069
|
+
if (path6 === "settings.yaml") {
|
|
62125
62070
|
return specificItems.settings !== undefined;
|
|
62126
62071
|
}
|
|
62127
|
-
if (isFileResource(
|
|
62072
|
+
if (isFileResource(path6) || isFilesetResource(path6)) {
|
|
62128
62073
|
return specificItems.resources !== undefined;
|
|
62129
62074
|
}
|
|
62130
62075
|
return false;
|
|
62131
62076
|
}
|
|
62132
|
-
function isSpecificItem(
|
|
62077
|
+
function isSpecificItem(path6, specificItems) {
|
|
62133
62078
|
if (!specificItems) {
|
|
62134
62079
|
return false;
|
|
62135
62080
|
}
|
|
62136
|
-
|
|
62137
|
-
if (
|
|
62138
|
-
return specificItems.variables ? matchesPatterns(
|
|
62081
|
+
path6 = normalizeJsonToYaml(path6);
|
|
62082
|
+
if (path6.endsWith(".variable.yaml")) {
|
|
62083
|
+
return specificItems.variables ? matchesPatterns(path6, specificItems.variables) : false;
|
|
62139
62084
|
}
|
|
62140
|
-
if (
|
|
62141
|
-
return specificItems.resources ? matchesPatterns(
|
|
62085
|
+
if (path6.endsWith(".resource.yaml")) {
|
|
62086
|
+
return specificItems.resources ? matchesPatterns(path6, specificItems.resources) : false;
|
|
62142
62087
|
}
|
|
62143
|
-
if (isTriggerFile(
|
|
62144
|
-
return specificItems.triggers ? matchesPatterns(
|
|
62088
|
+
if (isTriggerFile(path6)) {
|
|
62089
|
+
return specificItems.triggers ? matchesPatterns(path6, specificItems.triggers) : false;
|
|
62145
62090
|
}
|
|
62146
|
-
if (isScheduleFile(
|
|
62147
|
-
return specificItems.schedules ? matchesPatterns(
|
|
62091
|
+
if (isScheduleFile(path6)) {
|
|
62092
|
+
return specificItems.schedules ? matchesPatterns(path6, specificItems.schedules) : false;
|
|
62148
62093
|
}
|
|
62149
|
-
if (
|
|
62094
|
+
if (path6.endsWith("/folder.meta.yaml")) {
|
|
62150
62095
|
if (specificItems.folders) {
|
|
62151
|
-
const folderPath =
|
|
62096
|
+
const folderPath = path6.slice(0, -"/folder.meta.yaml".length);
|
|
62152
62097
|
return matchesPatterns(folderPath, specificItems.folders);
|
|
62153
62098
|
}
|
|
62154
62099
|
return false;
|
|
62155
62100
|
}
|
|
62156
|
-
if (
|
|
62101
|
+
if (path6 === "settings.yaml") {
|
|
62157
62102
|
return specificItems.settings === true;
|
|
62158
62103
|
}
|
|
62159
|
-
if (isFileResource(
|
|
62160
|
-
const basePathMatch =
|
|
62104
|
+
if (isFileResource(path6)) {
|
|
62105
|
+
const basePathMatch = path6.match(/^(.+?)\.resource\.file\./);
|
|
62161
62106
|
if (basePathMatch && specificItems.resources) {
|
|
62162
62107
|
const basePath = basePathMatch[1] + ".resource.yaml";
|
|
62163
62108
|
return matchesPatterns(basePath, specificItems.resources);
|
|
62164
62109
|
}
|
|
62165
62110
|
}
|
|
62166
|
-
if (isFilesetResource(
|
|
62167
|
-
const basePathMatch =
|
|
62111
|
+
if (isFilesetResource(path6)) {
|
|
62112
|
+
const basePathMatch = path6.match(/^(.+?)\.fileset[/\\]/);
|
|
62168
62113
|
if (basePathMatch && specificItems.resources) {
|
|
62169
62114
|
const basePath = basePathMatch[1] + ".resource.yaml";
|
|
62170
62115
|
return matchesPatterns(basePath, specificItems.resources);
|
|
@@ -62248,7 +62193,7 @@ function getWorkspaceSpecificPath(basePath, specificItems, workspaceNameOverride
|
|
|
62248
62193
|
}
|
|
62249
62194
|
return;
|
|
62250
62195
|
}
|
|
62251
|
-
function isCurrentWorkspaceFile(
|
|
62196
|
+
function isCurrentWorkspaceFile(path6, workspaceNameOverride) {
|
|
62252
62197
|
let currentWorkspace = null;
|
|
62253
62198
|
if (workspaceNameOverride) {
|
|
62254
62199
|
currentWorkspace = workspaceNameOverride;
|
|
@@ -62265,11 +62210,11 @@ function isCurrentWorkspaceFile(path7, workspaceNameOverride) {
|
|
|
62265
62210
|
pattern = new RegExp(`\\.${escapedName}\\.${buildItemTypePattern()}\\.(yaml|json)$|` + `\\.${escapedName}\\.resource\\.file\\..+$|` + `/folder\\.${escapedName}\\.meta\\.(yaml|json)$|` + `^settings\\.${escapedName}\\.(yaml|json)$`);
|
|
62266
62211
|
workspacePatternCache.set(currentWorkspace, pattern);
|
|
62267
62212
|
}
|
|
62268
|
-
return pattern.test(
|
|
62213
|
+
return pattern.test(path6);
|
|
62269
62214
|
}
|
|
62270
|
-
function isWorkspaceSpecificFile(
|
|
62215
|
+
function isWorkspaceSpecificFile(path6) {
|
|
62271
62216
|
const typePattern = buildItemTypePattern();
|
|
62272
|
-
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);
|
|
62273
62218
|
}
|
|
62274
62219
|
var workspacePatternCache;
|
|
62275
62220
|
var init_specific_items = __esm(async () => {
|
|
@@ -62310,22 +62255,22 @@ __export(exports_dependency_tree, {
|
|
|
62310
62255
|
async function uploadScripts(tree, workspace) {
|
|
62311
62256
|
const scriptHashes = {};
|
|
62312
62257
|
const workspaceDeps = [];
|
|
62313
|
-
for (const
|
|
62314
|
-
const content = tree.getContent(
|
|
62315
|
-
const itemType = tree.getItemType(
|
|
62258
|
+
for (const path6 of tree.allPaths()) {
|
|
62259
|
+
const content = tree.getContent(path6);
|
|
62260
|
+
const itemType = tree.getItemType(path6);
|
|
62316
62261
|
if (itemType === "dependencies") {
|
|
62317
62262
|
if (content === undefined)
|
|
62318
62263
|
continue;
|
|
62319
|
-
const info2 = workspaceDependenciesPathToLanguageAndFilename(
|
|
62264
|
+
const info2 = workspaceDependenciesPathToLanguageAndFilename(path6);
|
|
62320
62265
|
if (info2) {
|
|
62321
62266
|
const hash2 = await generateHash(content);
|
|
62322
|
-
workspaceDeps.push({ path:
|
|
62267
|
+
workspaceDeps.push({ path: path6, language: info2.language, name: info2.name, hash: hash2 });
|
|
62323
62268
|
}
|
|
62324
62269
|
} else if (itemType === "script") {
|
|
62325
62270
|
if (!content)
|
|
62326
62271
|
continue;
|
|
62327
62272
|
const hash2 = await generateHash(content);
|
|
62328
|
-
scriptHashes[
|
|
62273
|
+
scriptHashes[path6] = hash2;
|
|
62329
62274
|
}
|
|
62330
62275
|
}
|
|
62331
62276
|
if (Object.keys(scriptHashes).length === 0 && workspaceDeps.length === 0)
|
|
@@ -62337,19 +62282,19 @@ async function uploadScripts(tree, workspace) {
|
|
|
62337
62282
|
workspace_deps: workspaceDeps
|
|
62338
62283
|
}
|
|
62339
62284
|
});
|
|
62340
|
-
for (const
|
|
62341
|
-
const content = tree.getContent(
|
|
62342
|
-
const itemType = tree.getItemType(
|
|
62285
|
+
for (const path6 of mismatched) {
|
|
62286
|
+
const content = tree.getContent(path6);
|
|
62287
|
+
const itemType = tree.getItemType(path6);
|
|
62343
62288
|
if (itemType === "dependencies") {
|
|
62344
62289
|
if (content !== undefined) {
|
|
62345
|
-
tree.setContentHash(
|
|
62290
|
+
tree.setContentHash(path6, "mismatched");
|
|
62346
62291
|
}
|
|
62347
62292
|
} else if (content) {
|
|
62348
62293
|
const hash2 = await storeRawScriptTemp({
|
|
62349
62294
|
workspace: workspace.workspaceId,
|
|
62350
62295
|
requestBody: content
|
|
62351
62296
|
});
|
|
62352
|
-
tree.setContentHash(
|
|
62297
|
+
tree.setContentHash(path6, hash2);
|
|
62353
62298
|
}
|
|
62354
62299
|
}
|
|
62355
62300
|
}
|
|
@@ -62360,12 +62305,12 @@ class DoubleLinkedDependencyTree {
|
|
|
62360
62305
|
setWorkspaceDeps(deps) {
|
|
62361
62306
|
this.workspaceDeps = deps;
|
|
62362
62307
|
}
|
|
62363
|
-
async addNode(
|
|
62308
|
+
async addNode(path6, content, language, metadata, imports, itemType, folder, originalPath, isDirectlyStale, isRawApp) {
|
|
62364
62309
|
const hasWorkspaceDeps = itemType === "script" || itemType === "inline_script";
|
|
62365
62310
|
const filteredDeps = hasWorkspaceDeps ? filterWorkspaceDependencies(this.workspaceDeps, content, language) : {};
|
|
62366
62311
|
const stalenessHash = await generateScriptHash({}, content, metadata);
|
|
62367
|
-
if (!this.nodes.has(
|
|
62368
|
-
this.nodes.set(
|
|
62312
|
+
if (!this.nodes.has(path6)) {
|
|
62313
|
+
this.nodes.set(path6, {
|
|
62369
62314
|
content: "",
|
|
62370
62315
|
stalenessHash: "",
|
|
62371
62316
|
language: "deno",
|
|
@@ -62378,7 +62323,7 @@ class DoubleLinkedDependencyTree {
|
|
|
62378
62323
|
isDirectlyStale: false
|
|
62379
62324
|
});
|
|
62380
62325
|
}
|
|
62381
|
-
const node = this.nodes.get(
|
|
62326
|
+
const node = this.nodes.get(path6);
|
|
62382
62327
|
node.content = content;
|
|
62383
62328
|
node.stalenessHash = stalenessHash;
|
|
62384
62329
|
node.language = language;
|
|
@@ -62425,59 +62370,59 @@ class DoubleLinkedDependencyTree {
|
|
|
62425
62370
|
isDirectlyStale: false
|
|
62426
62371
|
});
|
|
62427
62372
|
}
|
|
62428
|
-
this.nodes.get(importPath).importedBy.add(
|
|
62373
|
+
this.nodes.get(importPath).importedBy.add(path6);
|
|
62429
62374
|
}
|
|
62430
62375
|
}
|
|
62431
|
-
getContent(
|
|
62432
|
-
return this.nodes.get(
|
|
62376
|
+
getContent(path6) {
|
|
62377
|
+
return this.nodes.get(path6)?.content;
|
|
62433
62378
|
}
|
|
62434
|
-
getStalenessHash(
|
|
62435
|
-
return this.nodes.get(
|
|
62379
|
+
getStalenessHash(path6) {
|
|
62380
|
+
return this.nodes.get(path6)?.stalenessHash;
|
|
62436
62381
|
}
|
|
62437
|
-
getContentHash(
|
|
62438
|
-
return this.nodes.get(
|
|
62382
|
+
getContentHash(path6) {
|
|
62383
|
+
return this.nodes.get(path6)?.contentHash;
|
|
62439
62384
|
}
|
|
62440
|
-
setContentHash(
|
|
62441
|
-
const node = this.nodes.get(
|
|
62385
|
+
setContentHash(path6, hash2) {
|
|
62386
|
+
const node = this.nodes.get(path6);
|
|
62442
62387
|
if (node) {
|
|
62443
62388
|
node.contentHash = hash2;
|
|
62444
62389
|
}
|
|
62445
62390
|
}
|
|
62446
|
-
getLanguage(
|
|
62447
|
-
return this.nodes.get(
|
|
62391
|
+
getLanguage(path6) {
|
|
62392
|
+
return this.nodes.get(path6)?.language;
|
|
62448
62393
|
}
|
|
62449
|
-
getMetadata(
|
|
62450
|
-
return this.nodes.get(
|
|
62394
|
+
getMetadata(path6) {
|
|
62395
|
+
return this.nodes.get(path6)?.metadata;
|
|
62451
62396
|
}
|
|
62452
|
-
getStaleReason(
|
|
62453
|
-
return this.nodes.get(
|
|
62397
|
+
getStaleReason(path6) {
|
|
62398
|
+
return this.nodes.get(path6)?.staleReason;
|
|
62454
62399
|
}
|
|
62455
|
-
getItemType(
|
|
62456
|
-
return this.nodes.get(
|
|
62400
|
+
getItemType(path6) {
|
|
62401
|
+
return this.nodes.get(path6)?.itemType;
|
|
62457
62402
|
}
|
|
62458
|
-
getFolder(
|
|
62459
|
-
return this.nodes.get(
|
|
62403
|
+
getFolder(path6) {
|
|
62404
|
+
return this.nodes.get(path6)?.folder;
|
|
62460
62405
|
}
|
|
62461
|
-
getIsRawApp(
|
|
62462
|
-
return this.nodes.get(
|
|
62406
|
+
getIsRawApp(path6) {
|
|
62407
|
+
return this.nodes.get(path6)?.isRawApp;
|
|
62463
62408
|
}
|
|
62464
|
-
getIsDirectlyStale(
|
|
62465
|
-
return this.nodes.get(
|
|
62409
|
+
getIsDirectlyStale(path6) {
|
|
62410
|
+
return this.nodes.get(path6)?.isDirectlyStale ?? false;
|
|
62466
62411
|
}
|
|
62467
|
-
getOriginalPath(
|
|
62468
|
-
return this.nodes.get(
|
|
62412
|
+
getOriginalPath(path6) {
|
|
62413
|
+
return this.nodes.get(path6)?.originalPath;
|
|
62469
62414
|
}
|
|
62470
|
-
getImports(
|
|
62471
|
-
return this.nodes.get(
|
|
62415
|
+
getImports(path6) {
|
|
62416
|
+
return this.nodes.get(path6)?.imports;
|
|
62472
62417
|
}
|
|
62473
|
-
isStale(
|
|
62474
|
-
return this.nodes.get(
|
|
62418
|
+
isStale(path6) {
|
|
62419
|
+
return this.nodes.get(path6)?.staleReason !== undefined;
|
|
62475
62420
|
}
|
|
62476
62421
|
propagateStaleness() {
|
|
62477
62422
|
const directlyStale = new Set;
|
|
62478
|
-
for (const [
|
|
62423
|
+
for (const [path6, node] of this.nodes.entries()) {
|
|
62479
62424
|
if (node.isDirectlyStale) {
|
|
62480
|
-
directlyStale.add(
|
|
62425
|
+
directlyStale.add(path6);
|
|
62481
62426
|
node.staleReason = "content changed";
|
|
62482
62427
|
}
|
|
62483
62428
|
}
|
|
@@ -62529,20 +62474,20 @@ class DoubleLinkedDependencyTree {
|
|
|
62529
62474
|
return this.nodes.keys();
|
|
62530
62475
|
}
|
|
62531
62476
|
*stalePaths() {
|
|
62532
|
-
for (const [
|
|
62477
|
+
for (const [path6, node] of this.nodes.entries()) {
|
|
62533
62478
|
if (node.staleReason) {
|
|
62534
|
-
yield
|
|
62479
|
+
yield path6;
|
|
62535
62480
|
}
|
|
62536
62481
|
}
|
|
62537
62482
|
}
|
|
62538
|
-
has(
|
|
62539
|
-
return this.nodes.has(
|
|
62483
|
+
has(path6) {
|
|
62484
|
+
return this.nodes.has(path6);
|
|
62540
62485
|
}
|
|
62541
62486
|
getMismatchedWorkspaceDeps() {
|
|
62542
62487
|
const result = {};
|
|
62543
|
-
for (const [
|
|
62488
|
+
for (const [path6, node] of this.nodes.entries()) {
|
|
62544
62489
|
if (node.itemType === "dependencies" && node.contentHash && node.content !== undefined) {
|
|
62545
|
-
result[
|
|
62490
|
+
result[path6] = node.content;
|
|
62546
62491
|
}
|
|
62547
62492
|
}
|
|
62548
62493
|
return result;
|
|
@@ -62557,11 +62502,11 @@ class DoubleLinkedDependencyTree {
|
|
|
62557
62502
|
return result;
|
|
62558
62503
|
}
|
|
62559
62504
|
async persistDepsHashes(depsPaths) {
|
|
62560
|
-
for (const
|
|
62561
|
-
const node = this.nodes.get(
|
|
62505
|
+
for (const path6 of depsPaths) {
|
|
62506
|
+
const node = this.nodes.get(path6);
|
|
62562
62507
|
if (node?.itemType === "dependencies" && node.content !== undefined) {
|
|
62563
|
-
const hash2 = await generateHash(node.content +
|
|
62564
|
-
await updateMetadataGlobalLock(
|
|
62508
|
+
const hash2 = await generateHash(node.content + path6);
|
|
62509
|
+
await updateMetadataGlobalLock(path6, hash2);
|
|
62565
62510
|
}
|
|
62566
62511
|
}
|
|
62567
62512
|
}
|
|
@@ -62739,15 +62684,15 @@ var init_path_assigner = __esm(() => {
|
|
|
62739
62684
|
function extractRawscriptInline(id, summary, rawscript, mapping, separator, assigner, failOnInlineDirective) {
|
|
62740
62685
|
const [basePath, ext2] = assigner.assignPath(summary ?? id, rawscript.language);
|
|
62741
62686
|
const mappedPath = mapping[id];
|
|
62742
|
-
const
|
|
62687
|
+
const path6 = mappedPath ?? basePath + ext2;
|
|
62743
62688
|
const language = rawscript.language;
|
|
62744
62689
|
const content = rawscript.content;
|
|
62745
62690
|
if (failOnInlineDirective && typeof content === "string" && content.startsWith("!inline ")) {
|
|
62746
62691
|
throw new Error(`Refusing to extract corrupted inline script for module '${id}': ` + `rawscript.content is the literal string \`${content.split(`
|
|
62747
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.`);
|
|
62748
62693
|
}
|
|
62749
|
-
const r = [{ path:
|
|
62750
|
-
rawscript.content = "!inline " +
|
|
62694
|
+
const r = [{ path: path6, content, language, is_lock: false }];
|
|
62695
|
+
rawscript.content = "!inline " + path6.replaceAll(separator, "/");
|
|
62751
62696
|
const lock = rawscript.lock;
|
|
62752
62697
|
if (lock && lock != "") {
|
|
62753
62698
|
const dotIdx = mappedPath ? mappedPath.lastIndexOf(".") : -1;
|
|
@@ -62834,23 +62779,23 @@ async function replaceRawscriptInline(id, rawscript, fileReader, logger, separat
|
|
|
62834
62779
|
if (!rawscript.content || !rawscript.content.startsWith("!inline")) {
|
|
62835
62780
|
return;
|
|
62836
62781
|
}
|
|
62837
|
-
const
|
|
62838
|
-
const pathSuffix =
|
|
62782
|
+
const path6 = rawscript.content.split(" ")[1];
|
|
62783
|
+
const pathSuffix = path6.split(".").slice(1).join(".");
|
|
62839
62784
|
const newPath = id + "." + pathSuffix;
|
|
62840
62785
|
try {
|
|
62841
|
-
rawscript.content = await fileReader(
|
|
62786
|
+
rawscript.content = await fileReader(path6);
|
|
62842
62787
|
} catch {
|
|
62843
|
-
logger.error(`Script file ${
|
|
62788
|
+
logger.error(`Script file ${path6} not found`);
|
|
62844
62789
|
try {
|
|
62845
62790
|
rawscript.content = await fileReader(newPath);
|
|
62846
62791
|
} catch {
|
|
62847
62792
|
logger.error(`Script file ${newPath} not found`);
|
|
62848
62793
|
if (missingFiles)
|
|
62849
|
-
missingFiles.push(
|
|
62794
|
+
missingFiles.push(path6);
|
|
62850
62795
|
}
|
|
62851
62796
|
}
|
|
62852
62797
|
const lock = rawscript.lock;
|
|
62853
|
-
if (removeLocks && removeLocks.includes(
|
|
62798
|
+
if (removeLocks && removeLocks.includes(path6)) {
|
|
62854
62799
|
rawscript.lock = undefined;
|
|
62855
62800
|
} else if (lock && typeof lock === "string" && lock.trimStart().startsWith("!inline ")) {
|
|
62856
62801
|
const lockPath = lock.split(" ")[1];
|
|
@@ -63006,7 +62951,7 @@ function collectPathScriptPaths(flowValue) {
|
|
|
63006
62951
|
}
|
|
63007
62952
|
|
|
63008
62953
|
// src/commands/flow/flow_metadata.ts
|
|
63009
|
-
import * as
|
|
62954
|
+
import * as path6 from "node:path";
|
|
63010
62955
|
import { sep as SEP4 } from "node:path";
|
|
63011
62956
|
async function isFlowDirectlyStale(folder, hashes, conf) {
|
|
63012
62957
|
if (await checkifMetadataUptodate(folder, hashes[TOP_HASH], conf, TOP_HASH)) {
|
|
@@ -63022,7 +62967,7 @@ async function isFlowDirectlyStale(folder, hashes, conf) {
|
|
|
63022
62967
|
return false;
|
|
63023
62968
|
}
|
|
63024
62969
|
async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
|
|
63025
|
-
const elems = await FSFSElement(
|
|
62970
|
+
const elems = await FSFSElement(path6.join(process.cwd(), folder), [], true);
|
|
63026
62971
|
const hashes = {};
|
|
63027
62972
|
for await (const f of elems.getChildren()) {
|
|
63028
62973
|
if (exts.some((e) => f.path.endsWith(e))) {
|
|
@@ -63070,7 +63015,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63070
63015
|
continue;
|
|
63071
63016
|
}
|
|
63072
63017
|
}
|
|
63073
|
-
const treePath = folderNormalized + "/" +
|
|
63018
|
+
const treePath = folderNormalized + "/" + path6.basename(script.path, path6.extname(script.path));
|
|
63074
63019
|
const language = script.language;
|
|
63075
63020
|
const imports = await extractRelativeImports(content, treePath, language);
|
|
63076
63021
|
await tree.addNode(treePath, content, language, "", imports, "inline_script", folderNormalized, folder, false);
|
|
@@ -63105,29 +63050,29 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63105
63050
|
const c = script.content;
|
|
63106
63051
|
if (c.startsWith("!inline ")) {
|
|
63107
63052
|
const fileName = c.replace("!inline ", "");
|
|
63108
|
-
const treePath = folderNormalized + "/" +
|
|
63053
|
+
const treePath = folderNormalized + "/" + path6.basename(script.path, path6.extname(script.path));
|
|
63109
63054
|
fileToTreePath.set(fileName, treePath);
|
|
63110
63055
|
}
|
|
63111
63056
|
}
|
|
63112
63057
|
if (!justUpdateMetadataLock) {
|
|
63113
63058
|
const hashes = await generateFlowHash(filteredDeps, folder, opts.defaultTs);
|
|
63114
|
-
for (const [
|
|
63115
|
-
if (
|
|
63059
|
+
for (const [path7, hash2] of Object.entries(hashes)) {
|
|
63060
|
+
if (path7 == TOP_HASH) {
|
|
63116
63061
|
continue;
|
|
63117
63062
|
}
|
|
63118
|
-
if (!await checkifMetadataUptodate(folder, hash2, conf,
|
|
63119
|
-
changedScripts.push(
|
|
63063
|
+
if (!await checkifMetadataUptodate(folder, hash2, conf, path7)) {
|
|
63064
|
+
changedScripts.push(path7);
|
|
63120
63065
|
}
|
|
63121
63066
|
}
|
|
63122
63067
|
if (!noStaleMessage) {
|
|
63123
63068
|
info(`Recomputing locks of ${changedScripts.join(", ")} in ${folder}`);
|
|
63124
63069
|
}
|
|
63125
|
-
const fileReader = async (
|
|
63070
|
+
const fileReader = async (path7) => await readTextFile(folder + SEP4 + path7);
|
|
63126
63071
|
const currentMapping = extractCurrentMapping(flowValue.value.modules, {}, flowValue.value.failure_module, flowValue.value.preprocessor_module);
|
|
63127
63072
|
const locksToRemove = tree ? Object.keys(hashes).filter((k) => {
|
|
63128
63073
|
if (k === TOP_HASH)
|
|
63129
63074
|
return false;
|
|
63130
|
-
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" +
|
|
63075
|
+
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path6.basename(k, path6.extname(k));
|
|
63131
63076
|
return tree.isStale(treePath);
|
|
63132
63077
|
}) : changedScripts;
|
|
63133
63078
|
const missingFiles = [];
|
|
@@ -63168,8 +63113,8 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63168
63113
|
const depsForHash = tree ? {} : filteredDeps;
|
|
63169
63114
|
const finalHashes = await generateFlowHash(depsForHash, folder, opts.defaultTs);
|
|
63170
63115
|
await clearGlobalLock(folder);
|
|
63171
|
-
for (const [
|
|
63172
|
-
await updateMetadataGlobalLock(folder, hash2,
|
|
63116
|
+
for (const [path7, hash2] of Object.entries(finalHashes)) {
|
|
63117
|
+
await updateMetadataGlobalLock(folder, hash2, path7);
|
|
63173
63118
|
}
|
|
63174
63119
|
if (!noStaleMessage) {
|
|
63175
63120
|
info(colors.green(`Flow ${remote_path} lockfiles updated`));
|
|
@@ -63177,7 +63122,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63177
63122
|
const relocked = tree ? Object.keys(finalHashes).filter((k) => {
|
|
63178
63123
|
if (k === TOP_HASH)
|
|
63179
63124
|
return false;
|
|
63180
|
-
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" +
|
|
63125
|
+
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path6.basename(k, path6.extname(k));
|
|
63181
63126
|
return tree.isStale(treePath);
|
|
63182
63127
|
}) : changedScripts;
|
|
63183
63128
|
const updatedScripts = relocked.map((p) => {
|
|
@@ -63701,8 +63646,8 @@ async function generateMetadata(opts, folder) {
|
|
|
63701
63646
|
info("");
|
|
63702
63647
|
if (errors.length > 0) {
|
|
63703
63648
|
info(`Done. Updated ${colors.bold(String(succeeded))}/${total} item(s). ${colors.red(String(errors.length) + " failed")}:`);
|
|
63704
|
-
for (const { path:
|
|
63705
|
-
error(` ${
|
|
63649
|
+
for (const { path: path7, error: error2 } of errors) {
|
|
63650
|
+
error(` ${path7}: ${error2}`);
|
|
63706
63651
|
}
|
|
63707
63652
|
process.exitCode = 1;
|
|
63708
63653
|
} else {
|
|
@@ -63746,9 +63691,9 @@ var init_generate_metadata = __esm(async () => {
|
|
|
63746
63691
|
import { writeFile as writeFile5, stat as stat4, mkdir as mkdir3 } from "node:fs/promises";
|
|
63747
63692
|
import { Buffer as Buffer4 } from "node:buffer";
|
|
63748
63693
|
import { sep as SEP6 } from "node:path";
|
|
63749
|
-
import * as
|
|
63694
|
+
import * as path7 from "node:path";
|
|
63750
63695
|
import fs8 from "node:fs";
|
|
63751
|
-
import { execSync as
|
|
63696
|
+
import { execSync as execSync4 } from "node:child_process";
|
|
63752
63697
|
function isRawAppBackendPath2(filePath) {
|
|
63753
63698
|
return isRawAppBackendPath(filePath);
|
|
63754
63699
|
}
|
|
@@ -63795,8 +63740,8 @@ async function push2(opts, filePath) {
|
|
|
63795
63740
|
await handleFile(filePath, workspace, [], opts.message, opts, await getRawWorkspaceDependencies(true), codebases);
|
|
63796
63741
|
info(colors.bold.underline.green(`Script ${filePath} pushed`));
|
|
63797
63742
|
}
|
|
63798
|
-
async function findResourceFile(
|
|
63799
|
-
const splitPath =
|
|
63743
|
+
async function findResourceFile(path8) {
|
|
63744
|
+
const splitPath = path8.split(".");
|
|
63800
63745
|
let contentBasePathJSON = splitPath[0] + "." + splitPath[1] + ".json";
|
|
63801
63746
|
let contentBasePathYAML = splitPath[0] + "." + splitPath[1] + ".yaml";
|
|
63802
63747
|
const currentBranch = getCurrentGitBranch();
|
|
@@ -63818,48 +63763,48 @@ async function findResourceFile(path9) {
|
|
|
63818
63763
|
throw new Error("Found two resource files for the same resource" + validCandidates.join(", "));
|
|
63819
63764
|
}
|
|
63820
63765
|
if (validCandidates.length < 1) {
|
|
63821
|
-
throw new Error(`No resource matching file resource: ${
|
|
63766
|
+
throw new Error(`No resource matching file resource: ${path8}.`);
|
|
63822
63767
|
}
|
|
63823
63768
|
return validCandidates[0];
|
|
63824
63769
|
}
|
|
63825
|
-
async function handleScriptMetadata(
|
|
63826
|
-
const isFlatMeta =
|
|
63827
|
-
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"));
|
|
63828
63773
|
if (isFlatMeta || isFolderMeta) {
|
|
63829
|
-
const contentPath = await findContentFile(
|
|
63774
|
+
const contentPath = await findContentFile(path8);
|
|
63830
63775
|
return handleFile(contentPath, workspace, alreadySynced, message, opts, rawWorkspaceDependencies, codebases, permissionedAsContext);
|
|
63831
63776
|
} else {
|
|
63832
63777
|
return false;
|
|
63833
63778
|
}
|
|
63834
63779
|
}
|
|
63835
|
-
async function handleFile(
|
|
63836
|
-
const moduleEntryPoint = isModuleEntryPoint(
|
|
63837
|
-
if (!isAppInlineScriptPath2(
|
|
63838
|
-
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)) {
|
|
63839
63784
|
return true;
|
|
63840
63785
|
}
|
|
63841
|
-
debug(`Processing local script ${
|
|
63842
|
-
alreadySynced.push(
|
|
63843
|
-
const remotePath = scriptPathToRemotePath(
|
|
63844
|
-
const language = inferContentTypeFromFilePath(
|
|
63845
|
-
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;
|
|
63846
63791
|
let bundleContent = undefined;
|
|
63847
63792
|
let forceTar = false;
|
|
63848
63793
|
if (codebase) {
|
|
63849
63794
|
let outputFiles = [];
|
|
63850
63795
|
if (codebase.customBundler) {
|
|
63851
|
-
info(`Using custom bundler ${codebase.customBundler} for ${
|
|
63852
|
-
bundleContent =
|
|
63796
|
+
info(`Using custom bundler ${codebase.customBundler} for ${path8}`);
|
|
63797
|
+
bundleContent = execSync4(codebase.customBundler + " " + path8, {
|
|
63853
63798
|
maxBuffer: 1024 * 1024 * 50
|
|
63854
63799
|
}).toString();
|
|
63855
|
-
info("Custom bundler executed for " +
|
|
63800
|
+
info("Custom bundler executed for " + path8);
|
|
63856
63801
|
} else {
|
|
63857
63802
|
const esbuild = await import("esbuild");
|
|
63858
|
-
info(`Started bundling ${
|
|
63803
|
+
info(`Started bundling ${path8} ...`);
|
|
63859
63804
|
const startTime = performance.now();
|
|
63860
63805
|
const format6 = codebase.format ?? "cjs";
|
|
63861
63806
|
const out = await esbuild.build({
|
|
63862
|
-
entryPoints: [
|
|
63807
|
+
entryPoints: [path8],
|
|
63863
63808
|
format: format6,
|
|
63864
63809
|
bundle: true,
|
|
63865
63810
|
write: false,
|
|
@@ -63877,15 +63822,15 @@ async function handleFile(path9, workspace, alreadySynced, message, opts, rawWor
|
|
|
63877
63822
|
bundleContent = out.outputFiles[0].text;
|
|
63878
63823
|
outputFiles = out.outputFiles ?? [];
|
|
63879
63824
|
if (outputFiles.length == 0) {
|
|
63880
|
-
throw new Error(`No output files found for ${
|
|
63825
|
+
throw new Error(`No output files found for ${path8}`);
|
|
63881
63826
|
}
|
|
63882
|
-
info(`Finished bundling ${
|
|
63827
|
+
info(`Finished bundling ${path8}: ${(bundleContent.length / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
|
|
63883
63828
|
}
|
|
63884
63829
|
if (outputFiles.length > 1) {
|
|
63885
|
-
info(`Found multiple output files for ${
|
|
63830
|
+
info(`Found multiple output files for ${path8}, creating a tarball... ${outputFiles.map((file) => file.path).join(", ")}`);
|
|
63886
63831
|
forceTar = true;
|
|
63887
63832
|
const startTime = performance.now();
|
|
63888
|
-
const mainPath =
|
|
63833
|
+
const mainPath = path8.split(SEP6).pop()?.split(".")[0] + ".js";
|
|
63889
63834
|
const mainContent = outputFiles.find((file) => file.path == "/" + mainPath)?.text ?? "";
|
|
63890
63835
|
info(`Main content: ${mainContent.length}chars`);
|
|
63891
63836
|
const entries = [
|
|
@@ -63900,10 +63845,10 @@ async function handleFile(path9, workspace, alreadySynced, message, opts, rawWor
|
|
|
63900
63845
|
}
|
|
63901
63846
|
bundleContent = await createTarBlob(entries);
|
|
63902
63847
|
const endTime = performance.now();
|
|
63903
|
-
info(`Finished creating tarball for ${
|
|
63848
|
+
info(`Finished creating tarball for ${path8}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
|
|
63904
63849
|
} else {
|
|
63905
63850
|
if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {
|
|
63906
|
-
info(`Using the following asset configuration for ${
|
|
63851
|
+
info(`Using the following asset configuration for ${path8}: ${JSON.stringify(codebase.assets)}`);
|
|
63907
63852
|
const startTime = performance.now();
|
|
63908
63853
|
const entries = [
|
|
63909
63854
|
{ name: "main.js", content: bundleContent }
|
|
@@ -63914,13 +63859,13 @@ async function handleFile(path9, workspace, alreadySynced, message, opts, rawWor
|
|
|
63914
63859
|
}
|
|
63915
63860
|
bundleContent = await createTarBlob(entries);
|
|
63916
63861
|
const endTime = performance.now();
|
|
63917
|
-
info(`Finished creating tarball for ${
|
|
63862
|
+
info(`Finished creating tarball for ${path8}: ${(bundleContent.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
|
|
63918
63863
|
}
|
|
63919
63864
|
}
|
|
63920
63865
|
}
|
|
63921
63866
|
let typed = opts?.skipScriptsMetadata ? undefined : (await parseMetadataFile(remotePath, opts ? {
|
|
63922
63867
|
...opts,
|
|
63923
|
-
path:
|
|
63868
|
+
path: path8,
|
|
63924
63869
|
workspaceRemote: workspace,
|
|
63925
63870
|
schemaOnly: codebase ? true : undefined,
|
|
63926
63871
|
rawWorkspaceDependencies,
|
|
@@ -63937,14 +63882,14 @@ async function handleFile(path9, workspace, alreadySynced, message, opts, rawWor
|
|
|
63937
63882
|
} catch {
|
|
63938
63883
|
debug(`Script ${remotePath} does not exist on remote`);
|
|
63939
63884
|
}
|
|
63940
|
-
const content = await readTextFile(
|
|
63885
|
+
const content = await readTextFile(path8);
|
|
63941
63886
|
if (opts?.skipScriptsMetadata) {
|
|
63942
63887
|
typed = structuredClone(remote);
|
|
63943
63888
|
}
|
|
63944
63889
|
if (typed && codebase) {
|
|
63945
63890
|
typed.codebase = await codebase.getDigest(forceTar);
|
|
63946
63891
|
}
|
|
63947
|
-
const scriptBasePath = moduleEntryPoint ? getScriptBasePathFromModulePath(
|
|
63892
|
+
const scriptBasePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path8) : path8.substring(0, path8.indexOf("."));
|
|
63948
63893
|
const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
|
|
63949
63894
|
const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, moduleEntryPoint);
|
|
63950
63895
|
const requestBodyCommon = {
|
|
@@ -64030,7 +63975,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
|
|
|
64030
63975
|
function readDir2(dirPath, relPrefix) {
|
|
64031
63976
|
const entries = fs8.readdirSync(dirPath, { withFileTypes: true });
|
|
64032
63977
|
for (const entry of entries) {
|
|
64033
|
-
const fullPath =
|
|
63978
|
+
const fullPath = path7.join(dirPath, entry.name);
|
|
64034
63979
|
const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
|
|
64035
63980
|
const isTopLevel = relPrefix === "";
|
|
64036
63981
|
if (entry.isDirectory()) {
|
|
@@ -64040,7 +63985,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
|
|
|
64040
63985
|
const content = readTextFileSync(fullPath);
|
|
64041
63986
|
const language = inferContentTypeFromFilePath(entry.name, defaultTs);
|
|
64042
63987
|
const baseName = entry.name.replace(/\.[^.]+$/, "");
|
|
64043
|
-
const lockPath =
|
|
63988
|
+
const lockPath = path7.join(dirPath, baseName + ".lock");
|
|
64044
63989
|
let lock;
|
|
64045
63990
|
if (fs8.existsSync(lockPath)) {
|
|
64046
63991
|
lock = readTextFileSync(lockPath);
|
|
@@ -64182,13 +64127,13 @@ function filePathExtensionFromContentType(language, defaultTs) {
|
|
|
64182
64127
|
throw new Error("Invalid language: " + language);
|
|
64183
64128
|
}
|
|
64184
64129
|
}
|
|
64185
|
-
function removeExtensionToPath(
|
|
64130
|
+
function removeExtensionToPath(path8) {
|
|
64186
64131
|
for (const ext2 of exts) {
|
|
64187
|
-
if (
|
|
64188
|
-
return
|
|
64132
|
+
if (path8.endsWith(ext2)) {
|
|
64133
|
+
return path8.substring(0, path8.length - ext2.length);
|
|
64189
64134
|
}
|
|
64190
64135
|
}
|
|
64191
|
-
throw new Error("Invalid extension: " +
|
|
64136
|
+
throw new Error("Invalid extension: " + path8);
|
|
64192
64137
|
}
|
|
64193
64138
|
async function list4(opts) {
|
|
64194
64139
|
if (opts.json)
|
|
@@ -64239,7 +64184,7 @@ async function resolve6(input) {
|
|
|
64239
64184
|
throw e;
|
|
64240
64185
|
}
|
|
64241
64186
|
}
|
|
64242
|
-
async function run2(opts,
|
|
64187
|
+
async function run2(opts, path8) {
|
|
64243
64188
|
if (opts.silent) {
|
|
64244
64189
|
setSilent(true);
|
|
64245
64190
|
}
|
|
@@ -64250,7 +64195,7 @@ async function run2(opts, path9) {
|
|
|
64250
64195
|
try {
|
|
64251
64196
|
const script = await getScriptByPath({
|
|
64252
64197
|
workspace: workspace.workspaceId,
|
|
64253
|
-
path:
|
|
64198
|
+
path: path8
|
|
64254
64199
|
});
|
|
64255
64200
|
validateRequiredArgs(script.schema);
|
|
64256
64201
|
} catch (e) {
|
|
@@ -64263,7 +64208,7 @@ async function run2(opts, path9) {
|
|
|
64263
64208
|
try {
|
|
64264
64209
|
id = await runScriptByPath({
|
|
64265
64210
|
workspace: workspace.workspaceId,
|
|
64266
|
-
path:
|
|
64211
|
+
path: path8,
|
|
64267
64212
|
requestBody: input
|
|
64268
64213
|
});
|
|
64269
64214
|
} catch (e) {
|
|
@@ -64271,10 +64216,10 @@ async function run2(opts, path9) {
|
|
|
64271
64216
|
try {
|
|
64272
64217
|
const script = await getScriptByPath({
|
|
64273
64218
|
workspace: workspace.workspaceId,
|
|
64274
|
-
path:
|
|
64219
|
+
path: path8
|
|
64275
64220
|
});
|
|
64276
64221
|
if (script.lock_error_logs) {
|
|
64277
|
-
throw new Error(`Script '${
|
|
64222
|
+
throw new Error(`Script '${path8}' has a deployment error and cannot be run:
|
|
64278
64223
|
${script.lock_error_logs}`);
|
|
64279
64224
|
}
|
|
64280
64225
|
} catch (lookupErr) {
|
|
@@ -64283,7 +64228,7 @@ ${script.lock_error_logs}`);
|
|
|
64283
64228
|
if (lookupErr?.status && lookupErr.status !== 404)
|
|
64284
64229
|
throw lookupErr;
|
|
64285
64230
|
}
|
|
64286
|
-
throw new Error(`Script '${
|
|
64231
|
+
throw new Error(`Script '${path8}' not found. Run 'wmill script list' to see available scripts.`);
|
|
64287
64232
|
}
|
|
64288
64233
|
throw e;
|
|
64289
64234
|
}
|
|
@@ -64389,12 +64334,12 @@ async function track_job(workspace, id) {
|
|
|
64389
64334
|
async function pollForJobResult(workspace, jobId) {
|
|
64390
64335
|
return await pollJobWithQueueLogging(workspace, jobId);
|
|
64391
64336
|
}
|
|
64392
|
-
async function show(opts,
|
|
64337
|
+
async function show(opts, path8) {
|
|
64393
64338
|
const workspace = await resolveWorkspace(opts);
|
|
64394
64339
|
await requireLogin(opts);
|
|
64395
64340
|
const s = await getScriptByPath({
|
|
64396
64341
|
workspace: workspace.workspaceId,
|
|
64397
|
-
path:
|
|
64342
|
+
path: path8
|
|
64398
64343
|
});
|
|
64399
64344
|
info(colors.underline(s.path));
|
|
64400
64345
|
if (s.description)
|
|
@@ -64402,14 +64347,14 @@ async function show(opts, path9) {
|
|
|
64402
64347
|
info("");
|
|
64403
64348
|
info(s.content);
|
|
64404
64349
|
}
|
|
64405
|
-
async function get2(opts,
|
|
64350
|
+
async function get2(opts, path8) {
|
|
64406
64351
|
if (opts.json)
|
|
64407
64352
|
setSilent(true);
|
|
64408
64353
|
const workspace = await resolveWorkspace(opts);
|
|
64409
64354
|
await requireLogin(opts);
|
|
64410
64355
|
const s = await getScriptByPath({
|
|
64411
64356
|
workspace: workspace.workspaceId,
|
|
64412
|
-
path:
|
|
64357
|
+
path: path8
|
|
64413
64358
|
});
|
|
64414
64359
|
if (opts.json) {
|
|
64415
64360
|
console.log(JSON.stringify(s));
|
|
@@ -64459,7 +64404,7 @@ async function bootstrap(opts, scriptPath, language) {
|
|
|
64459
64404
|
scriptMetadata.description = opts.description;
|
|
64460
64405
|
}
|
|
64461
64406
|
const scriptInitialMetadataYaml = import_yaml8.stringify(scriptMetadata, yamlOptions);
|
|
64462
|
-
const parentDir =
|
|
64407
|
+
const parentDir = path7.dirname(scriptCodeFileFullPath);
|
|
64463
64408
|
await mkdir3(parentDir, { recursive: true });
|
|
64464
64409
|
await writeFile5(scriptCodeFileFullPath, scriptInitialCode, {
|
|
64465
64410
|
flag: "wx",
|
|
@@ -64554,7 +64499,7 @@ async function preview(opts, filePath) {
|
|
|
64554
64499
|
const content = await readTextFile(filePath);
|
|
64555
64500
|
const input = opts.data ? await resolve6(opts.data) : {};
|
|
64556
64501
|
const isFolderLayout = isModuleEntryPoint(filePath);
|
|
64557
|
-
const moduleFolderPath = isFolderLayout ?
|
|
64502
|
+
const moduleFolderPath = isFolderLayout ? path7.dirname(filePath) : filePath.substring(0, filePath.indexOf(".")) + getModuleFolderSuffix();
|
|
64558
64503
|
const modules = await readModulesFromDisk(moduleFolderPath, opts?.defaultTs, isFolderLayout);
|
|
64559
64504
|
const codebase = language == "bun" ? findCodebase(filePath, codebases) : undefined;
|
|
64560
64505
|
let tempScriptRefs = undefined;
|
|
@@ -64571,7 +64516,7 @@ async function preview(opts, filePath) {
|
|
|
64571
64516
|
if (!opts.silent) {
|
|
64572
64517
|
info(`Using custom bundler ${codebase.customBundler} for preview`);
|
|
64573
64518
|
}
|
|
64574
|
-
bundledContent =
|
|
64519
|
+
bundledContent = execSync4(codebase.customBundler + " " + filePath, {
|
|
64575
64520
|
maxBuffer: 52428800
|
|
64576
64521
|
}).toString();
|
|
64577
64522
|
} else {
|
|
@@ -64830,8 +64775,8 @@ var init_script = __esm(async () => {
|
|
|
64830
64775
|
|
|
64831
64776
|
// src/commands/lint/lint.ts
|
|
64832
64777
|
import { stat as stat5, readdir as readdir2 } from "node:fs/promises";
|
|
64833
|
-
import
|
|
64834
|
-
import * as
|
|
64778
|
+
import process13 from "node:process";
|
|
64779
|
+
import * as path8 from "node:path";
|
|
64835
64780
|
import { sep as SEP7 } from "node:path";
|
|
64836
64781
|
function normalizePath(p) {
|
|
64837
64782
|
return p.replaceAll(SEP7, "/");
|
|
@@ -64890,7 +64835,7 @@ async function isLockResolved(lockValue, baseDir) {
|
|
|
64890
64835
|
return true;
|
|
64891
64836
|
}
|
|
64892
64837
|
async function checkInlineFile(relativePath, baseDir) {
|
|
64893
|
-
const fullPath =
|
|
64838
|
+
const fullPath = path8.join(baseDir, relativePath.trim());
|
|
64894
64839
|
try {
|
|
64895
64840
|
const s = await stat5(fullPath);
|
|
64896
64841
|
return s.size > 0;
|
|
@@ -64980,7 +64925,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
|
|
|
64980
64925
|
continue;
|
|
64981
64926
|
const runnableId = fileName.replace(".yaml", "");
|
|
64982
64927
|
processedIds.add(runnableId);
|
|
64983
|
-
const filePath =
|
|
64928
|
+
const filePath = path8.join(backendDir, fileName);
|
|
64984
64929
|
let runnable;
|
|
64985
64930
|
try {
|
|
64986
64931
|
runnable = await yamlParseFile(filePath);
|
|
@@ -64998,7 +64943,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
|
|
|
64998
64943
|
}
|
|
64999
64944
|
if (!language || !languageNeedsLock(language))
|
|
65000
64945
|
continue;
|
|
65001
|
-
const lockFile =
|
|
64946
|
+
const lockFile = path8.join(backendDir, `${runnableId}.lock`);
|
|
65002
64947
|
let hasLock = false;
|
|
65003
64948
|
try {
|
|
65004
64949
|
const s = await stat5(lockFile);
|
|
@@ -65045,7 +64990,7 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
|
|
|
65045
64990
|
}
|
|
65046
64991
|
if (!languageNeedsLock(language))
|
|
65047
64992
|
continue;
|
|
65048
|
-
const lockFile =
|
|
64993
|
+
const lockFile = path8.join(backendDir, `${runnableId}.lock`);
|
|
65049
64994
|
let hasLock = false;
|
|
65050
64995
|
try {
|
|
65051
64996
|
const s = await stat5(lockFile);
|
|
@@ -65064,8 +65009,8 @@ async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
|
|
|
65064
65009
|
return issues;
|
|
65065
65010
|
}
|
|
65066
65011
|
async function checkMissingLocks(opts, directory) {
|
|
65067
|
-
const initialCwd =
|
|
65068
|
-
const targetDirectory = directory ?
|
|
65012
|
+
const initialCwd = process13.cwd();
|
|
65013
|
+
const targetDirectory = directory ? path8.resolve(initialCwd, directory) : process13.cwd();
|
|
65069
65014
|
const { ...syncOpts } = opts;
|
|
65070
65015
|
const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
|
|
65071
65016
|
const ignore = await ignoreF(mergedOpts);
|
|
@@ -65089,19 +65034,19 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65089
65034
|
if (normalizedPath.endsWith("/flow.yaml") && normalizedPath.includes(flowSuffix + "/")) {
|
|
65090
65035
|
flowYamls.push({
|
|
65091
65036
|
normalizedPath,
|
|
65092
|
-
fullPath:
|
|
65037
|
+
fullPath: path8.join(targetDirectory, entry.path)
|
|
65093
65038
|
});
|
|
65094
65039
|
}
|
|
65095
65040
|
if (normalizedPath.endsWith("/app.yaml") && normalizedPath.includes(appSuffix + "/")) {
|
|
65096
65041
|
appYamls.push({
|
|
65097
65042
|
normalizedPath,
|
|
65098
|
-
fullPath:
|
|
65043
|
+
fullPath: path8.join(targetDirectory, entry.path)
|
|
65099
65044
|
});
|
|
65100
65045
|
}
|
|
65101
65046
|
if (normalizedPath.endsWith("/raw_app.yaml") && normalizedPath.includes(rawAppSuffix + "/")) {
|
|
65102
65047
|
rawAppYamls.push({
|
|
65103
65048
|
normalizedPath,
|
|
65104
|
-
fullPath:
|
|
65049
|
+
fullPath: path8.join(targetDirectory, entry.path)
|
|
65105
65050
|
});
|
|
65106
65051
|
}
|
|
65107
65052
|
}
|
|
@@ -65110,14 +65055,14 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65110
65055
|
let language = null;
|
|
65111
65056
|
for (const ext2 of exts) {
|
|
65112
65057
|
try {
|
|
65113
|
-
await stat5(
|
|
65058
|
+
await stat5(path8.join(targetDirectory, basePath + ext2));
|
|
65114
65059
|
language = inferContentTypeFromFilePath(basePath + ext2, defaultTs);
|
|
65115
65060
|
break;
|
|
65116
65061
|
} catch {}
|
|
65117
65062
|
}
|
|
65118
65063
|
if (language && languageNeedsLock(language)) {
|
|
65119
65064
|
try {
|
|
65120
|
-
const metadata = await yamlParseFile(
|
|
65065
|
+
const metadata = await yamlParseFile(path8.join(targetDirectory, yamlPath));
|
|
65121
65066
|
const lockResolved = await isLockResolved(metadata?.lock, targetDirectory);
|
|
65122
65067
|
if (!lockResolved) {
|
|
65123
65068
|
issues.push({
|
|
@@ -65134,7 +65079,7 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65134
65079
|
}
|
|
65135
65080
|
}
|
|
65136
65081
|
for (const { normalizedPath: flowYamlPath, fullPath } of flowYamls) {
|
|
65137
|
-
const flowDir =
|
|
65082
|
+
const flowDir = path8.dirname(fullPath);
|
|
65138
65083
|
try {
|
|
65139
65084
|
const flowFile = await yamlParseFile(fullPath);
|
|
65140
65085
|
if (!flowFile?.value?.modules)
|
|
@@ -65159,7 +65104,7 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65159
65104
|
}
|
|
65160
65105
|
}
|
|
65161
65106
|
for (const { normalizedPath: appYamlPath, fullPath } of appYamls) {
|
|
65162
|
-
const appDir =
|
|
65107
|
+
const appDir = path8.dirname(fullPath);
|
|
65163
65108
|
try {
|
|
65164
65109
|
const appFile = await yamlParseFile(fullPath);
|
|
65165
65110
|
if (!appFile?.value)
|
|
@@ -65184,8 +65129,8 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65184
65129
|
}
|
|
65185
65130
|
}
|
|
65186
65131
|
for (const { normalizedPath: rawAppYamlPath, fullPath } of rawAppYamls) {
|
|
65187
|
-
const rawAppDir =
|
|
65188
|
-
const backendDir =
|
|
65132
|
+
const rawAppDir = path8.dirname(fullPath);
|
|
65133
|
+
const backendDir = path8.join(rawAppDir, "backend");
|
|
65189
65134
|
try {
|
|
65190
65135
|
await stat5(backendDir);
|
|
65191
65136
|
} catch {
|
|
@@ -65201,11 +65146,11 @@ async function checkMissingLocks(opts, directory) {
|
|
|
65201
65146
|
return issues;
|
|
65202
65147
|
}
|
|
65203
65148
|
async function runLint(opts, directory) {
|
|
65204
|
-
const initialCwd =
|
|
65205
|
-
const explicitTargetDirectory = directory ?
|
|
65149
|
+
const initialCwd = process13.cwd();
|
|
65150
|
+
const explicitTargetDirectory = directory ? path8.resolve(initialCwd, directory) : undefined;
|
|
65206
65151
|
const { json: _json, ...syncOpts } = opts;
|
|
65207
65152
|
const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
|
|
65208
|
-
const targetDirectory = explicitTargetDirectory ??
|
|
65153
|
+
const targetDirectory = explicitTargetDirectory ?? process13.cwd();
|
|
65209
65154
|
const stats = await stat5(targetDirectory).catch(() => null);
|
|
65210
65155
|
if (!stats) {
|
|
65211
65156
|
throw new Error(`Directory not found: ${targetDirectory}`);
|
|
@@ -65213,7 +65158,7 @@ async function runLint(opts, directory) {
|
|
|
65213
65158
|
if (!stats.isDirectory()) {
|
|
65214
65159
|
throw new Error(`Path is not a directory: ${targetDirectory}`);
|
|
65215
65160
|
}
|
|
65216
|
-
const isSubdirectory = explicitTargetDirectory && !await stat5(
|
|
65161
|
+
const isSubdirectory = explicitTargetDirectory && !await stat5(path8.join(targetDirectory, "wmill.yaml")).catch(() => null);
|
|
65217
65162
|
const ignore = isSubdirectory ? (_p, _isDir) => false : await ignoreF(mergedOpts);
|
|
65218
65163
|
const root = await FSFSElement(targetDirectory, [], false);
|
|
65219
65164
|
const validator = new import_windmill_yaml_validator.WindmillYamlValidator;
|
|
@@ -65320,7 +65265,7 @@ async function lint(opts, directory) {
|
|
|
65320
65265
|
const report = await runLint(opts, directory);
|
|
65321
65266
|
printReport(report, !!opts.json);
|
|
65322
65267
|
if (report.exitCode !== 0) {
|
|
65323
|
-
|
|
65268
|
+
process13.exit(report.exitCode);
|
|
65324
65269
|
}
|
|
65325
65270
|
} catch (error2) {
|
|
65326
65271
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
@@ -65333,17 +65278,17 @@ async function lint(opts, directory) {
|
|
|
65333
65278
|
} else {
|
|
65334
65279
|
error(colors.red(`❌ ${message}`));
|
|
65335
65280
|
}
|
|
65336
|
-
|
|
65281
|
+
process13.exit(1);
|
|
65337
65282
|
}
|
|
65338
65283
|
}
|
|
65339
65284
|
async function lintWatch(opts, directory) {
|
|
65340
65285
|
const { watch } = await import("node:fs");
|
|
65341
|
-
const targetDir = directory ?
|
|
65286
|
+
const targetDir = directory ? path8.resolve(process13.cwd(), directory) : process13.cwd();
|
|
65342
65287
|
info(colors.blue(`Watching ${targetDir} for changes... (Ctrl+C to stop)`));
|
|
65343
65288
|
async function runAndReport() {
|
|
65344
65289
|
try {
|
|
65345
65290
|
const report = await runLint(opts, directory);
|
|
65346
|
-
|
|
65291
|
+
process13.stdout.write("\x1Bc");
|
|
65347
65292
|
info(colors.gray(`[${new Date().toLocaleTimeString()}] Lint results:
|
|
65348
65293
|
`));
|
|
65349
65294
|
printReport(report, false);
|
|
@@ -65384,13 +65329,13 @@ var init_lint = __esm(async () => {
|
|
|
65384
65329
|
|
|
65385
65330
|
// src/commands/shared_ui.ts
|
|
65386
65331
|
import * as fs9 from "node:fs";
|
|
65387
|
-
import * as
|
|
65332
|
+
import * as path9 from "node:path";
|
|
65388
65333
|
async function readDirRecursive(dir, rel = "", out = {}) {
|
|
65389
65334
|
if (!fs9.existsSync(dir))
|
|
65390
65335
|
return out;
|
|
65391
65336
|
const entries = await fs9.promises.readdir(dir, { withFileTypes: true });
|
|
65392
65337
|
for (const entry of entries) {
|
|
65393
|
-
const full =
|
|
65338
|
+
const full = path9.join(dir, entry.name);
|
|
65394
65339
|
const r = rel ? rel + "/" + entry.name : entry.name;
|
|
65395
65340
|
if (entry.isDirectory()) {
|
|
65396
65341
|
await readDirRecursive(full, r, out);
|
|
@@ -65401,7 +65346,7 @@ async function readDirRecursive(dir, rel = "", out = {}) {
|
|
|
65401
65346
|
return out;
|
|
65402
65347
|
}
|
|
65403
65348
|
async function pushSharedUi(workspace) {
|
|
65404
|
-
const localDir =
|
|
65349
|
+
const localDir = path9.join(process.cwd(), SHARED_UI_DIR);
|
|
65405
65350
|
if (!fs9.existsSync(localDir)) {
|
|
65406
65351
|
return false;
|
|
65407
65352
|
}
|
|
@@ -65423,7 +65368,7 @@ async function pushSharedUi(workspace) {
|
|
|
65423
65368
|
return true;
|
|
65424
65369
|
}
|
|
65425
65370
|
async function pullSharedUi(workspace) {
|
|
65426
|
-
const localDir =
|
|
65371
|
+
const localDir = path9.join(process.cwd(), SHARED_UI_DIR);
|
|
65427
65372
|
let got;
|
|
65428
65373
|
try {
|
|
65429
65374
|
got = await getSharedUi({ workspace });
|
|
@@ -65437,8 +65382,8 @@ async function pullSharedUi(workspace) {
|
|
|
65437
65382
|
}
|
|
65438
65383
|
fs9.mkdirSync(localDir, { recursive: true });
|
|
65439
65384
|
for (const [rel, content] of Object.entries(files)) {
|
|
65440
|
-
const full =
|
|
65441
|
-
fs9.mkdirSync(
|
|
65385
|
+
const full = path9.join(localDir, rel);
|
|
65386
|
+
fs9.mkdirSync(path9.dirname(full), { recursive: true });
|
|
65442
65387
|
let existing;
|
|
65443
65388
|
try {
|
|
65444
65389
|
existing = readTextFileSync(full);
|
|
@@ -65453,7 +65398,7 @@ async function pullSharedUi(workspace) {
|
|
|
65453
65398
|
const local = await readDirRecursive(localDir);
|
|
65454
65399
|
for (const rel of Object.keys(local)) {
|
|
65455
65400
|
if (!known.has(rel)) {
|
|
65456
|
-
const full =
|
|
65401
|
+
const full = path9.join(localDir, rel);
|
|
65457
65402
|
try {
|
|
65458
65403
|
fs9.unlinkSync(full);
|
|
65459
65404
|
} catch {}
|
|
@@ -65734,11 +65679,11 @@ async function list5(opts) {
|
|
|
65734
65679
|
new Table2().header(["Path", "Resource Type"]).padding(2).border(true).body(total.map((x) => [x.path, x.resource_type])).render();
|
|
65735
65680
|
}
|
|
65736
65681
|
}
|
|
65737
|
-
async function newResource(opts,
|
|
65738
|
-
if (!validatePath(
|
|
65682
|
+
async function newResource(opts, path10) {
|
|
65683
|
+
if (!validatePath(path10)) {
|
|
65739
65684
|
return;
|
|
65740
65685
|
}
|
|
65741
|
-
const filePath =
|
|
65686
|
+
const filePath = path10 + ".resource.yaml";
|
|
65742
65687
|
try {
|
|
65743
65688
|
await stat6(filePath);
|
|
65744
65689
|
throw new Error("File already exists: " + filePath);
|
|
@@ -65758,14 +65703,14 @@ async function newResource(opts, path11) {
|
|
|
65758
65703
|
});
|
|
65759
65704
|
info(colors.green(`Created ${filePath}`));
|
|
65760
65705
|
}
|
|
65761
|
-
async function get3(opts,
|
|
65706
|
+
async function get3(opts, path10) {
|
|
65762
65707
|
if (opts.json)
|
|
65763
65708
|
setSilent(true);
|
|
65764
65709
|
const workspace = await resolveWorkspace(opts);
|
|
65765
65710
|
await requireLogin(opts);
|
|
65766
65711
|
const r = await getResource({
|
|
65767
65712
|
workspace: workspace.workspaceId,
|
|
65768
|
-
path:
|
|
65713
|
+
path: path10
|
|
65769
65714
|
});
|
|
65770
65715
|
if (opts.json) {
|
|
65771
65716
|
console.log(JSON.stringify(r));
|
|
@@ -65819,7 +65764,7 @@ __export(exports_sync, {
|
|
|
65819
65764
|
FSFSElement: () => FSFSElement
|
|
65820
65765
|
});
|
|
65821
65766
|
import { writeFile as writeFile7, readdir as readdir4, stat as stat7, rm, copyFile, mkdir as mkdir5 } from "node:fs/promises";
|
|
65822
|
-
import * as
|
|
65767
|
+
import * as path10 from "node:path";
|
|
65823
65768
|
import { sep as SEP9 } from "node:path";
|
|
65824
65769
|
function configKeyForItemKind(kind) {
|
|
65825
65770
|
switch (kind) {
|
|
@@ -65951,8 +65896,8 @@ function mergeCliWithEffectiveOptions(cliOpts, effectiveOpts) {
|
|
|
65951
65896
|
async function resolveEffectiveSyncOptions(workspace, localConfig, promotion, workspaceNameOverride) {
|
|
65952
65897
|
return await getEffectiveSettings(localConfig, promotion, false, false, workspaceNameOverride);
|
|
65953
65898
|
}
|
|
65954
|
-
function findCodebase(
|
|
65955
|
-
if (!
|
|
65899
|
+
function findCodebase(path11, codebases) {
|
|
65900
|
+
if (!path11.endsWith(".ts")) {
|
|
65956
65901
|
return;
|
|
65957
65902
|
}
|
|
65958
65903
|
for (const c of codebases) {
|
|
@@ -65968,7 +65913,7 @@ function findCodebase(path12, codebases) {
|
|
|
65968
65913
|
if (included) {
|
|
65969
65914
|
break;
|
|
65970
65915
|
}
|
|
65971
|
-
if (minimatch(
|
|
65916
|
+
if (minimatch(path11, r)) {
|
|
65972
65917
|
included = true;
|
|
65973
65918
|
}
|
|
65974
65919
|
}
|
|
@@ -65976,7 +65921,7 @@ function findCodebase(path12, codebases) {
|
|
|
65976
65921
|
c.excludes = [c.excludes];
|
|
65977
65922
|
}
|
|
65978
65923
|
for (const r of c.excludes ?? []) {
|
|
65979
|
-
if (minimatch(
|
|
65924
|
+
if (minimatch(path11, r)) {
|
|
65980
65925
|
excluded = true;
|
|
65981
65926
|
}
|
|
65982
65927
|
}
|
|
@@ -65985,13 +65930,13 @@ function findCodebase(path12, codebases) {
|
|
|
65985
65930
|
}
|
|
65986
65931
|
}
|
|
65987
65932
|
}
|
|
65988
|
-
async function addCodebaseDigestIfRelevant(
|
|
65989
|
-
const isScript =
|
|
65933
|
+
async function addCodebaseDigestIfRelevant(path11, content, codebases, ignoreCodebaseChanges) {
|
|
65934
|
+
const isScript = path11.endsWith(".script.yaml");
|
|
65990
65935
|
if (!isScript) {
|
|
65991
65936
|
return content;
|
|
65992
65937
|
}
|
|
65993
65938
|
let isTs = true;
|
|
65994
|
-
const replacedPath =
|
|
65939
|
+
const replacedPath = path11.replace(".script.yaml", ".ts");
|
|
65995
65940
|
try {
|
|
65996
65941
|
await stat7(replacedPath);
|
|
65997
65942
|
} catch {
|
|
@@ -66005,9 +65950,9 @@ async function addCodebaseDigestIfRelevant(path12, content, codebases, ignoreCod
|
|
|
66005
65950
|
if (c) {
|
|
66006
65951
|
let parsed;
|
|
66007
65952
|
try {
|
|
66008
|
-
parsed = yamlParseContent(
|
|
65953
|
+
parsed = yamlParseContent(path11, content);
|
|
66009
65954
|
} catch (error2) {
|
|
66010
|
-
error(`Failed to parse YAML content for codebase digest at path: ${
|
|
65955
|
+
error(`Failed to parse YAML content for codebase digest at path: ${path11}`);
|
|
66011
65956
|
throw error2;
|
|
66012
65957
|
}
|
|
66013
65958
|
if (parsed && typeof parsed == "object") {
|
|
@@ -66019,7 +65964,7 @@ async function addCodebaseDigestIfRelevant(path12, content, codebases, ignoreCod
|
|
|
66019
65964
|
parsed["lock"] = "";
|
|
66020
65965
|
return import_yaml11.stringify(parsed, yamlOptions);
|
|
66021
65966
|
} else {
|
|
66022
|
-
throw Error(`Expected local yaml ${
|
|
65967
|
+
throw Error(`Expected local yaml ${path11} to be an object, found: ${content} instead`);
|
|
66023
65968
|
}
|
|
66024
65969
|
}
|
|
66025
65970
|
}
|
|
@@ -66036,7 +65981,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
|
|
|
66036
65981
|
try {
|
|
66037
65982
|
const entries = await readdir4(localP, { withFileTypes: true });
|
|
66038
65983
|
for (const e of entries) {
|
|
66039
|
-
yield _internal_element(
|
|
65984
|
+
yield _internal_element(path10.join(localP, e.name), e.isDirectory(), codebases2);
|
|
66040
65985
|
}
|
|
66041
65986
|
} catch (e) {
|
|
66042
65987
|
warn(`Error reading dir: ${localP}, ${e}`);
|
|
@@ -66346,9 +66291,9 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66346
66291
|
for (const basePath of moduleScripts) {
|
|
66347
66292
|
if (normalizedP.startsWith(basePath + ".")) {
|
|
66348
66293
|
const ext2 = normalizedP.slice(basePath.length);
|
|
66349
|
-
const dir =
|
|
66350
|
-
const base =
|
|
66351
|
-
finalPath =
|
|
66294
|
+
const dir = path10.dirname(finalPath);
|
|
66295
|
+
const base = path10.basename(basePath);
|
|
66296
|
+
finalPath = path10.join(dir, base + getModuleFolderSuffix(), "script" + ext2);
|
|
66352
66297
|
break;
|
|
66353
66298
|
}
|
|
66354
66299
|
}
|
|
@@ -66384,7 +66329,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66384
66329
|
for (const s of inlineScripts) {
|
|
66385
66330
|
yield {
|
|
66386
66331
|
isDirectory: false,
|
|
66387
|
-
path:
|
|
66332
|
+
path: path10.join(finalPath, s.path),
|
|
66388
66333
|
async* getChildren() {},
|
|
66389
66334
|
async getContentText() {
|
|
66390
66335
|
return s.content;
|
|
@@ -66397,7 +66342,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66397
66342
|
}
|
|
66398
66343
|
yield {
|
|
66399
66344
|
isDirectory: false,
|
|
66400
|
-
path:
|
|
66345
|
+
path: path10.join(finalPath, "flow.yaml"),
|
|
66401
66346
|
async* getChildren() {},
|
|
66402
66347
|
async getContentText() {
|
|
66403
66348
|
return import_yaml11.stringify(flow, yamlOptions);
|
|
@@ -66421,7 +66366,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66421
66366
|
for (const s of inlineScripts) {
|
|
66422
66367
|
yield {
|
|
66423
66368
|
isDirectory: false,
|
|
66424
|
-
path:
|
|
66369
|
+
path: path10.join(finalPath, s.path),
|
|
66425
66370
|
async* getChildren() {},
|
|
66426
66371
|
async getContentText() {
|
|
66427
66372
|
return s.content;
|
|
@@ -66434,7 +66379,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66434
66379
|
app.policy = undefined;
|
|
66435
66380
|
yield {
|
|
66436
66381
|
isDirectory: false,
|
|
66437
|
-
path:
|
|
66382
|
+
path: path10.join(finalPath, "app.yaml"),
|
|
66438
66383
|
async* getChildren() {},
|
|
66439
66384
|
async getContentText() {
|
|
66440
66385
|
return import_yaml11.stringify(app, yamlOptions);
|
|
@@ -66489,7 +66434,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66489
66434
|
}
|
|
66490
66435
|
yield {
|
|
66491
66436
|
isDirectory: false,
|
|
66492
|
-
path:
|
|
66437
|
+
path: path10.join(finalPath, filePath.substring(1)),
|
|
66493
66438
|
async* getChildren() {},
|
|
66494
66439
|
async getContentText() {
|
|
66495
66440
|
if (typeof content !== "string") {
|
|
@@ -66506,7 +66451,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66506
66451
|
for (const s of inlineScripts) {
|
|
66507
66452
|
yield {
|
|
66508
66453
|
isDirectory: false,
|
|
66509
|
-
path:
|
|
66454
|
+
path: path10.join(finalPath, APP_BACKEND_FOLDER, s.path),
|
|
66510
66455
|
async* getChildren() {},
|
|
66511
66456
|
async getContentText() {
|
|
66512
66457
|
return s.content;
|
|
@@ -66542,7 +66487,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66542
66487
|
}
|
|
66543
66488
|
yield {
|
|
66544
66489
|
isDirectory: false,
|
|
66545
|
-
path:
|
|
66490
|
+
path: path10.join(finalPath, APP_BACKEND_FOLDER, `${runnableId}.yaml`),
|
|
66546
66491
|
async* getChildren() {},
|
|
66547
66492
|
async getContentText() {
|
|
66548
66493
|
return import_yaml11.stringify(simplifiedRunnable, yamlOptions);
|
|
@@ -66556,7 +66501,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66556
66501
|
delete rawApp?.["value"];
|
|
66557
66502
|
yield {
|
|
66558
66503
|
isDirectory: false,
|
|
66559
|
-
path:
|
|
66504
|
+
path: path10.join(finalPath, "raw_app.yaml"),
|
|
66560
66505
|
async* getChildren() {},
|
|
66561
66506
|
async getContentText() {
|
|
66562
66507
|
return import_yaml11.stringify(rawApp, yamlOptions);
|
|
@@ -66564,7 +66509,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66564
66509
|
};
|
|
66565
66510
|
yield {
|
|
66566
66511
|
isDirectory: false,
|
|
66567
|
-
path:
|
|
66512
|
+
path: path10.join(finalPath, "DATATABLES.md"),
|
|
66568
66513
|
async* getChildren() {},
|
|
66569
66514
|
async getContentText() {
|
|
66570
66515
|
return generateDatatablesDocumentation(data3);
|
|
@@ -66667,12 +66612,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66667
66612
|
const scriptBasePath = removeSuffix(removeSuffix(finalPath, metaExt), ".script");
|
|
66668
66613
|
const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
|
|
66669
66614
|
if (hasModules) {
|
|
66670
|
-
r[0].path =
|
|
66615
|
+
r[0].path = path10.join(moduleFolderPath, "script" + metaExt);
|
|
66671
66616
|
}
|
|
66672
66617
|
if (lock && lock != "") {
|
|
66673
66618
|
r.push({
|
|
66674
66619
|
isDirectory: false,
|
|
66675
|
-
path: hasModules ?
|
|
66620
|
+
path: hasModules ? path10.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
|
|
66676
66621
|
async* getChildren() {},
|
|
66677
66622
|
async getContentText() {
|
|
66678
66623
|
return lock;
|
|
@@ -66687,7 +66632,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66687
66632
|
for (const [relPath, mod] of Object.entries(scriptModules)) {
|
|
66688
66633
|
yield {
|
|
66689
66634
|
isDirectory: false,
|
|
66690
|
-
path:
|
|
66635
|
+
path: path10.join(moduleFolderPath, relPath),
|
|
66691
66636
|
async* getChildren() {},
|
|
66692
66637
|
async getContentText() {
|
|
66693
66638
|
return mod.content;
|
|
@@ -66697,7 +66642,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66697
66642
|
const baseName = relPath.replace(/\.[^.]+$/, "");
|
|
66698
66643
|
yield {
|
|
66699
66644
|
isDirectory: false,
|
|
66700
|
-
path:
|
|
66645
|
+
path: path10.join(moduleFolderPath, baseName + ".lock"),
|
|
66701
66646
|
async* getChildren() {},
|
|
66702
66647
|
async getContentText() {
|
|
66703
66648
|
return mod.lock;
|
|
@@ -66734,7 +66679,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66734
66679
|
if (typeof fileContent === "string") {
|
|
66735
66680
|
yield {
|
|
66736
66681
|
isDirectory: false,
|
|
66737
|
-
path:
|
|
66682
|
+
path: path10.join(filesetBasePath, relPath),
|
|
66738
66683
|
async* getChildren() {},
|
|
66739
66684
|
async getContentText() {
|
|
66740
66685
|
return fileContent;
|
|
@@ -66770,7 +66715,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
66770
66715
|
async* getChildren() {
|
|
66771
66716
|
for (const filename in zip2.files) {
|
|
66772
66717
|
const file = zip2.files[filename];
|
|
66773
|
-
const totalPath =
|
|
66718
|
+
const totalPath = path10.join(p, filename);
|
|
66774
66719
|
if (file.dir) {
|
|
66775
66720
|
const e = zip2.folder(file.name);
|
|
66776
66721
|
yield _internal_folder(totalPath, e);
|
|
@@ -66839,15 +66784,15 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66839
66784
|
if (entry.ignored) {
|
|
66840
66785
|
continue;
|
|
66841
66786
|
}
|
|
66842
|
-
const
|
|
66843
|
-
if (isScriptModulePath(
|
|
66844
|
-
map[
|
|
66787
|
+
const path11 = entry.path;
|
|
66788
|
+
if (isScriptModulePath(path11)) {
|
|
66789
|
+
map[path11] = await entry.getContentText();
|
|
66845
66790
|
continue;
|
|
66846
66791
|
}
|
|
66847
|
-
if (!isFileResource(
|
|
66848
|
-
if (json &&
|
|
66792
|
+
if (!isFileResource(path11) && !isFilesetResource(path11) && !isRawAppFile(path11) && !isWorkspaceDependencies(path11)) {
|
|
66793
|
+
if (json && path11.endsWith(".yaml"))
|
|
66849
66794
|
continue;
|
|
66850
|
-
if (!json &&
|
|
66795
|
+
if (!json && path11.endsWith(".json"))
|
|
66851
66796
|
continue;
|
|
66852
66797
|
if (![
|
|
66853
66798
|
"json",
|
|
@@ -66869,39 +66814,39 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66869
66814
|
"java",
|
|
66870
66815
|
"rb",
|
|
66871
66816
|
"r"
|
|
66872
|
-
].includes(
|
|
66817
|
+
].includes(path11.split(".").pop() ?? "")) {
|
|
66873
66818
|
continue;
|
|
66874
66819
|
}
|
|
66875
66820
|
}
|
|
66876
|
-
if (isRawAppFile(
|
|
66877
|
-
const suffix =
|
|
66821
|
+
if (isRawAppFile(path11)) {
|
|
66822
|
+
const suffix = path11.split(getFolderSuffix("raw_app") + SEP9).pop();
|
|
66878
66823
|
if (suffix?.startsWith("dist/") || suffix == "wmill.d.ts" || suffix == "package-lock.json" || suffix == "DATATABLES.md") {
|
|
66879
66824
|
continue;
|
|
66880
66825
|
}
|
|
66881
66826
|
}
|
|
66882
|
-
if (skips.skipResources && (isFileResource(
|
|
66827
|
+
if (skips.skipResources && (isFileResource(path11) || isFilesetResource(path11)))
|
|
66883
66828
|
continue;
|
|
66884
66829
|
const ext2 = json ? ".json" : ".yaml";
|
|
66885
|
-
if (!skips.includeSchedules &&
|
|
66830
|
+
if (!skips.includeSchedules && path11.endsWith(".schedule" + ext2))
|
|
66886
66831
|
continue;
|
|
66887
|
-
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))) {
|
|
66888
66833
|
continue;
|
|
66889
66834
|
}
|
|
66890
|
-
if (!skips.includeUsers &&
|
|
66835
|
+
if (!skips.includeUsers && path11.endsWith(".user" + ext2))
|
|
66891
66836
|
continue;
|
|
66892
|
-
if (!skips.includeGroups &&
|
|
66837
|
+
if (!skips.includeGroups && path11.endsWith(".group" + ext2))
|
|
66893
66838
|
continue;
|
|
66894
|
-
if (!skips.includeSettings &&
|
|
66839
|
+
if (!skips.includeSettings && path11 === "settings" + ext2)
|
|
66895
66840
|
continue;
|
|
66896
|
-
if (!skips.includeKey &&
|
|
66841
|
+
if (!skips.includeKey && path11 === "encryption_key")
|
|
66897
66842
|
continue;
|
|
66898
|
-
if (skips.skipResources &&
|
|
66843
|
+
if (skips.skipResources && path11.endsWith(".resource" + ext2))
|
|
66899
66844
|
continue;
|
|
66900
|
-
if (skips.skipResourceTypes &&
|
|
66845
|
+
if (skips.skipResourceTypes && path11.endsWith(".resource-type" + ext2)) {
|
|
66901
66846
|
continue;
|
|
66902
66847
|
}
|
|
66903
66848
|
try {
|
|
66904
|
-
const fileType = getTypeStrFromPath(
|
|
66849
|
+
const fileType = getTypeStrFromPath(path11);
|
|
66905
66850
|
if (skips.skipVariables && fileType === "variable")
|
|
66906
66851
|
continue;
|
|
66907
66852
|
if (skips.skipScripts && fileType === "script")
|
|
@@ -66915,27 +66860,27 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66915
66860
|
if (skips.skipWorkspaceDependencies && fileType === "workspace_dependencies")
|
|
66916
66861
|
continue;
|
|
66917
66862
|
} catch {}
|
|
66918
|
-
if (specificItems && isWorkspaceSpecificFile(
|
|
66919
|
-
if (!isCurrentWorkspaceFile(
|
|
66863
|
+
if (specificItems && isWorkspaceSpecificFile(path11)) {
|
|
66864
|
+
if (!isCurrentWorkspaceFile(path11, cachedWsName)) {
|
|
66920
66865
|
continue;
|
|
66921
66866
|
}
|
|
66922
66867
|
}
|
|
66923
66868
|
const content = await entry.getContentText();
|
|
66924
|
-
if (skips.skipSecrets &&
|
|
66869
|
+
if (skips.skipSecrets && path11.endsWith(".variable" + ext2)) {
|
|
66925
66870
|
try {
|
|
66926
66871
|
let o;
|
|
66927
66872
|
if (json) {
|
|
66928
66873
|
try {
|
|
66929
66874
|
o = JSON.parse(content);
|
|
66930
66875
|
} catch (error2) {
|
|
66931
|
-
error(`Failed to parse JSON variable content at path: ${
|
|
66876
|
+
error(`Failed to parse JSON variable content at path: ${path11}`);
|
|
66932
66877
|
throw error2;
|
|
66933
66878
|
}
|
|
66934
66879
|
} else {
|
|
66935
66880
|
try {
|
|
66936
|
-
o = yamlParseContent(
|
|
66881
|
+
o = yamlParseContent(path11, content);
|
|
66937
66882
|
} catch (error2) {
|
|
66938
|
-
error(`Failed to parse YAML variable content at path: ${
|
|
66883
|
+
error(`Failed to parse YAML variable content at path: ${path11}`);
|
|
66939
66884
|
throw error2;
|
|
66940
66885
|
}
|
|
66941
66886
|
}
|
|
@@ -66943,12 +66888,12 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66943
66888
|
continue;
|
|
66944
66889
|
}
|
|
66945
66890
|
} catch (e) {
|
|
66946
|
-
warn(`Error reading variable ${
|
|
66891
|
+
warn(`Error reading variable ${path11} to check for secrets`);
|
|
66947
66892
|
}
|
|
66948
66893
|
}
|
|
66949
|
-
if (cachedWsName && isCurrentWorkspaceFile(
|
|
66894
|
+
if (cachedWsName && isCurrentWorkspaceFile(path11, cachedWsName)) {
|
|
66950
66895
|
const currentBranch = cachedWsName;
|
|
66951
|
-
const basePath = fromWorkspaceSpecificPath(
|
|
66896
|
+
const basePath = fromWorkspaceSpecificPath(path11, currentBranch);
|
|
66952
66897
|
if (!isItemTypeConfigured(basePath, specificItems)) {
|
|
66953
66898
|
continue;
|
|
66954
66899
|
}
|
|
@@ -66957,14 +66902,14 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
66957
66902
|
}
|
|
66958
66903
|
map[basePath] = content;
|
|
66959
66904
|
processedBasePaths.add(basePath);
|
|
66960
|
-
} else if (!isWorkspaceSpecificFile(
|
|
66961
|
-
if (processedBasePaths.has(
|
|
66905
|
+
} else if (!isWorkspaceSpecificFile(path11)) {
|
|
66906
|
+
if (processedBasePaths.has(path11)) {
|
|
66962
66907
|
continue;
|
|
66963
66908
|
}
|
|
66964
|
-
if (!isRemote && isSpecificItem(
|
|
66909
|
+
if (!isRemote && isSpecificItem(path11, specificItems)) {
|
|
66965
66910
|
continue;
|
|
66966
66911
|
}
|
|
66967
|
-
map[
|
|
66912
|
+
map[path11] = content;
|
|
66968
66913
|
}
|
|
66969
66914
|
}
|
|
66970
66915
|
if (wrongFormatPaths.length > 0) {
|
|
@@ -67349,7 +67294,7 @@ async function pull(opts) {
|
|
|
67349
67294
|
throw error2;
|
|
67350
67295
|
}
|
|
67351
67296
|
if (opts.stateful) {
|
|
67352
|
-
await mkdir5(
|
|
67297
|
+
await mkdir5(path10.join(process.cwd(), ".wmill"), { recursive: true });
|
|
67353
67298
|
}
|
|
67354
67299
|
const workspace = await resolveWorkspace(opts, wsNameForConfig);
|
|
67355
67300
|
await requireLogin(opts);
|
|
@@ -67423,7 +67368,7 @@ async function pull(opts) {
|
|
|
67423
67368
|
} catch {}
|
|
67424
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);
|
|
67425
67370
|
const remote = ZipFSElement(zipFile, !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, true, parseSyncBehavior(opts.syncBehavior) >= 1);
|
|
67426
|
-
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);
|
|
67427
67372
|
const { changes, localMap } = await compareDynFSElement(remote, local, await ignoreF(opts), opts.json ?? false, opts, false, codebases, true, specificItems, wsNameForFiles, true);
|
|
67428
67373
|
info(`remote (${workspace.name}) -> local: ${changes.length} changes to apply`);
|
|
67429
67374
|
if (wsSpecificMerge.serverItems && wsSpecificMerge.serverItems.length > 0) {
|
|
@@ -67478,8 +67423,8 @@ async function pull(opts) {
|
|
|
67478
67423
|
targetPath = workspaceSpecificPath;
|
|
67479
67424
|
}
|
|
67480
67425
|
}
|
|
67481
|
-
const target =
|
|
67482
|
-
const stateTarget =
|
|
67426
|
+
const target = path10.join(process.cwd(), targetPath);
|
|
67427
|
+
const stateTarget = path10.join(process.cwd(), ".wmill", targetPath);
|
|
67483
67428
|
if (change.name === "edited") {
|
|
67484
67429
|
if (opts.stateful) {
|
|
67485
67430
|
try {
|
|
@@ -67512,13 +67457,13 @@ Both local and remote have been modified.`));
|
|
|
67512
67457
|
}
|
|
67513
67458
|
await writeFile7(target, change.after, "utf-8");
|
|
67514
67459
|
if (opts.stateful) {
|
|
67515
|
-
await mkdir5(
|
|
67460
|
+
await mkdir5(path10.dirname(stateTarget), { recursive: true });
|
|
67516
67461
|
await copyFile(target, stateTarget);
|
|
67517
67462
|
}
|
|
67518
67463
|
} else if (change.name === "added") {
|
|
67519
|
-
await mkdir5(
|
|
67464
|
+
await mkdir5(path10.dirname(target), { recursive: true });
|
|
67520
67465
|
if (opts.stateful) {
|
|
67521
|
-
await mkdir5(
|
|
67466
|
+
await mkdir5(path10.dirname(stateTarget), { recursive: true });
|
|
67522
67467
|
info(`Adding ${getTypeStrFromPath(change.path)} ${targetPath}${targetPath !== change.path ? colors.gray(` (workspace-specific override for ${change.path})`) : ""}`);
|
|
67523
67468
|
}
|
|
67524
67469
|
await writeFile7(target, change.content, "utf-8");
|
|
@@ -67786,7 +67731,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
|
|
|
67786
67731
|
resourceTypeToIsFileset = parsed.filesetMap;
|
|
67787
67732
|
} catch {}
|
|
67788
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);
|
|
67789
|
-
const local = await FSFSElement(
|
|
67734
|
+
const local = await FSFSElement(path10.join(process.cwd(), ""), codebases, false);
|
|
67790
67735
|
const { changes, localMap } = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false);
|
|
67791
67736
|
const wsSpecificFlagOnly = computeWsSpecificFlagOnlyPushes(localMap, localSpecificItems, serverWsSpecificItems);
|
|
67792
67737
|
for (const item of wsSpecificFlagOnly) {
|
|
@@ -67946,7 +67891,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
|
|
|
67946
67891
|
}
|
|
67947
67892
|
}
|
|
67948
67893
|
for (const folderName2 of folderNames) {
|
|
67949
|
-
const basePath =
|
|
67894
|
+
const basePath = path10.join("f", folderName2, "folder.meta.yaml");
|
|
67950
67895
|
const branchPath = getWorkspaceSpecificPath(`f/${folderName2}/folder.meta.yaml`, specificItems, wsNameForFiles);
|
|
67951
67896
|
let found = false;
|
|
67952
67897
|
if (branchPath) {
|
|
@@ -68068,7 +68013,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
68068
68013
|
let stateful = opts.stateful;
|
|
68069
68014
|
if (stateful) {
|
|
68070
68015
|
try {
|
|
68071
|
-
await stat7(
|
|
68016
|
+
await stat7(path10.join(process.cwd(), ".wmill"));
|
|
68072
68017
|
} catch {
|
|
68073
68018
|
stateful = false;
|
|
68074
68019
|
}
|
|
@@ -68119,7 +68064,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
68119
68064
|
let stateTarget = undefined;
|
|
68120
68065
|
if (stateful) {
|
|
68121
68066
|
try {
|
|
68122
|
-
stateTarget =
|
|
68067
|
+
stateTarget = path10.join(process.cwd(), ".wmill", change.path);
|
|
68123
68068
|
await stat7(stateTarget);
|
|
68124
68069
|
} catch {
|
|
68125
68070
|
stateTarget = undefined;
|
|
@@ -68144,7 +68089,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
68144
68089
|
continue;
|
|
68145
68090
|
}
|
|
68146
68091
|
if (stateTarget) {
|
|
68147
|
-
await mkdir5(
|
|
68092
|
+
await mkdir5(path10.dirname(stateTarget), { recursive: true });
|
|
68148
68093
|
info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
|
|
68149
68094
|
}
|
|
68150
68095
|
if (isFileResource(change.path)) {
|
|
@@ -68208,7 +68153,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
68208
68153
|
continue;
|
|
68209
68154
|
}
|
|
68210
68155
|
if (stateTarget) {
|
|
68211
|
-
await mkdir5(
|
|
68156
|
+
await mkdir5(path10.dirname(stateTarget), { recursive: true });
|
|
68212
68157
|
info(`Adding ${getTypeStrFromPath(change.path)} ${change.path}`);
|
|
68213
68158
|
}
|
|
68214
68159
|
const obj = parseFromPath(change.path, change.content);
|
|
@@ -68849,8 +68794,8 @@ var init_parse_schema = __esm(() => {
|
|
|
68849
68794
|
// src/utils/metadata.ts
|
|
68850
68795
|
import { sep as SEP10 } from "node:path";
|
|
68851
68796
|
import { writeFile as writeFile8, stat as stat8, rm as rm2, readdir as readdir5 } from "node:fs/promises";
|
|
68852
|
-
import { readFileSync as readFileSync2, existsSync as
|
|
68853
|
-
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";
|
|
68854
68799
|
import { createRequire as createRequire2 } from "node:module";
|
|
68855
68800
|
function loadParser(pkgName) {
|
|
68856
68801
|
let p = _parserCache.get(pkgName);
|
|
@@ -68892,8 +68837,8 @@ async function getRawWorkspaceDependencies(legacyBehaviour) {
|
|
|
68892
68837
|
} catch {}
|
|
68893
68838
|
return rawWorkspaceDeps;
|
|
68894
68839
|
}
|
|
68895
|
-
function workspaceDependenciesPathToLanguageAndFilename(
|
|
68896
|
-
const relativePath =
|
|
68840
|
+
function workspaceDependenciesPathToLanguageAndFilename(path12) {
|
|
68841
|
+
const relativePath = path12.replace("dependencies/", "");
|
|
68897
68842
|
for (const { filename, language } of workspaceDependenciesLanguages) {
|
|
68898
68843
|
if (relativePath.endsWith(filename)) {
|
|
68899
68844
|
return {
|
|
@@ -68947,8 +68892,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
68947
68892
|
const scriptContent = await readTextFile(scriptPath);
|
|
68948
68893
|
const metadataContent = await readTextFile(metadataWithType.path);
|
|
68949
68894
|
const filteredRawWorkspaceDependencies = filterWorkspaceDependencies(rawWorkspaceDependencies, scriptContent, language);
|
|
68950
|
-
const moduleFolderPath = isFolderLayout ?
|
|
68951
|
-
const hasModules =
|
|
68895
|
+
const moduleFolderPath = isFolderLayout ? path11.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix();
|
|
68896
|
+
const hasModules = existsSync5(moduleFolderPath) && statSync(moduleFolderPath).isDirectory();
|
|
68952
68897
|
const depsForHash = tree ? {} : filteredRawWorkspaceDependencies;
|
|
68953
68898
|
let hash2 = await generateScriptHash(depsForHash, scriptContent, metadataContent);
|
|
68954
68899
|
let moduleHashes = {};
|
|
@@ -69019,7 +68964,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
69019
68964
|
const hasCodebase = findCodebase(scriptPath, codebases) != null;
|
|
69020
68965
|
if (!hasCodebase) {
|
|
69021
68966
|
const tempScriptRefs = tree?.getTempScriptRefs(remotePath);
|
|
69022
|
-
const lockPathOverride = isFolderLayout ?
|
|
68967
|
+
const lockPathOverride = isFolderLayout ? path11.dirname(scriptPath) + "/script.lock" : undefined;
|
|
69023
68968
|
await updateScriptLock(workspace, scriptContent, language, remotePath, metadataParsedContent, filteredRawWorkspaceDependencies, tempScriptRefs, lockPathOverride);
|
|
69024
68969
|
} else {
|
|
69025
68970
|
metadataParsedContent.lock = "";
|
|
@@ -69050,10 +68995,10 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
69050
68995
|
let newMetadataContent;
|
|
69051
68996
|
if (isFolderLayout) {
|
|
69052
68997
|
if (metadataWithType.isJson) {
|
|
69053
|
-
metaPath =
|
|
68998
|
+
metaPath = path11.dirname(scriptPath) + "/script.json";
|
|
69054
68999
|
newMetadataContent = JSON.stringify(metadataParsedContent);
|
|
69055
69000
|
} else {
|
|
69056
|
-
metaPath =
|
|
69001
|
+
metaPath = path11.dirname(scriptPath) + "/script.yaml";
|
|
69057
69002
|
newMetadataContent = import_yaml13.stringify(metadataParsedContent, yamlOptions);
|
|
69058
69003
|
}
|
|
69059
69004
|
} else {
|
|
@@ -69083,8 +69028,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
69083
69028
|
}
|
|
69084
69029
|
return `${remotePath} (${language})`;
|
|
69085
69030
|
}
|
|
69086
|
-
async function updateScriptSchema(scriptContent, language, metadataContent,
|
|
69087
|
-
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);
|
|
69088
69033
|
metadataContent.schema = result.schema;
|
|
69089
69034
|
if (result.has_preprocessor) {
|
|
69090
69035
|
metadataContent.has_preprocessor = result.has_preprocessor;
|
|
@@ -69246,7 +69191,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
|
|
|
69246
69191
|
async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules) {
|
|
69247
69192
|
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
69248
69193
|
for (const entry of entries) {
|
|
69249
|
-
const fullPath =
|
|
69194
|
+
const fullPath = path11.join(dirPath, entry.name);
|
|
69250
69195
|
const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
|
|
69251
69196
|
if (entry.isDirectory()) {
|
|
69252
69197
|
await updateModuleLocks(workspace, fullPath, relPath, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules);
|
|
@@ -69270,12 +69215,12 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
|
|
|
69270
69215
|
try {
|
|
69271
69216
|
const lock = await fetchScriptLock(workspace, moduleContent, modLanguage, moduleRemotePath, rawWorkspaceDependencies);
|
|
69272
69217
|
const baseName = entry.name.replace(/\.[^.]+$/, "");
|
|
69273
|
-
const lockPath =
|
|
69218
|
+
const lockPath = path11.join(dirPath, baseName + ".lock");
|
|
69274
69219
|
if (lock != "") {
|
|
69275
|
-
|
|
69220
|
+
writeFileSync4(lockPath, lock, "utf-8");
|
|
69276
69221
|
} else {
|
|
69277
69222
|
try {
|
|
69278
|
-
if (
|
|
69223
|
+
if (existsSync5(lockPath)) {
|
|
69279
69224
|
const { rm: rmAsync } = await import("node:fs/promises");
|
|
69280
69225
|
await rmAsync(lockPath);
|
|
69281
69226
|
}
|
|
@@ -69287,7 +69232,7 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
|
|
|
69287
69232
|
}
|
|
69288
69233
|
}
|
|
69289
69234
|
}
|
|
69290
|
-
async function inferSchema(language, content, currentSchema,
|
|
69235
|
+
async function inferSchema(language, content, currentSchema, path12) {
|
|
69291
69236
|
let inferedSchema;
|
|
69292
69237
|
if (language === "python3") {
|
|
69293
69238
|
const { parse_python } = await loadParser("windmill-parser-wasm-py");
|
|
@@ -69390,7 +69335,7 @@ async function inferSchema(language, content, currentSchema, path13) {
|
|
|
69390
69335
|
throw new Error("Invalid language: " + language);
|
|
69391
69336
|
}
|
|
69392
69337
|
if (inferedSchema.type == "Invalid") {
|
|
69393
|
-
info(colors.yellow(`Script ${
|
|
69338
|
+
info(colors.yellow(`Script ${path12} invalid, it cannot be parsed to infer schema.`));
|
|
69394
69339
|
return {
|
|
69395
69340
|
schema: defaultScriptMetadata().schema,
|
|
69396
69341
|
has_preprocessor: false,
|
|
@@ -69582,15 +69527,15 @@ async function readLockfile() {
|
|
|
69582
69527
|
}
|
|
69583
69528
|
return conf;
|
|
69584
69529
|
}
|
|
69585
|
-
function v2LockPath(
|
|
69586
|
-
const normalizedPath = normalizeLockPath(
|
|
69530
|
+
function v2LockPath(path12, subpath) {
|
|
69531
|
+
const normalizedPath = normalizeLockPath(path12);
|
|
69587
69532
|
if (subpath) {
|
|
69588
69533
|
return `${normalizedPath}+${normalizeLockPath(subpath)}`;
|
|
69589
69534
|
} else {
|
|
69590
69535
|
return normalizedPath;
|
|
69591
69536
|
}
|
|
69592
69537
|
}
|
|
69593
|
-
async function checkifMetadataUptodate(
|
|
69538
|
+
async function checkifMetadataUptodate(path12, hash2, conf, subpath) {
|
|
69594
69539
|
if (!conf) {
|
|
69595
69540
|
conf = await readLockfile();
|
|
69596
69541
|
}
|
|
@@ -69599,10 +69544,10 @@ async function checkifMetadataUptodate(path13, hash2, conf, subpath) {
|
|
|
69599
69544
|
}
|
|
69600
69545
|
const isFlatKeyed = conf?.version === "v2";
|
|
69601
69546
|
if (isFlatKeyed) {
|
|
69602
|
-
const key = v2LockPath(
|
|
69547
|
+
const key = v2LockPath(path12, subpath);
|
|
69603
69548
|
return conf.locks?.[key] === hash2 || conf.locks?.["./" + key] === hash2;
|
|
69604
69549
|
}
|
|
69605
|
-
for (const p of [
|
|
69550
|
+
for (const p of [path12, "./" + path12]) {
|
|
69606
69551
|
const obj = conf.locks?.[p];
|
|
69607
69552
|
const v = subpath && typeof obj == "object" ? obj?.[subpath] : obj;
|
|
69608
69553
|
if (v === hash2)
|
|
@@ -69618,7 +69563,7 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
|
|
|
69618
69563
|
async function readDir2(dirPath, relPrefix) {
|
|
69619
69564
|
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
69620
69565
|
for (const entry of entries) {
|
|
69621
|
-
const fullPath =
|
|
69566
|
+
const fullPath = path11.join(dirPath, entry.name);
|
|
69622
69567
|
const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
|
|
69623
69568
|
const isTopLevel = relPrefix === "";
|
|
69624
69569
|
if (entry.isDirectory()) {
|
|
@@ -69638,14 +69583,14 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
|
|
|
69638
69583
|
await readDir2(moduleFolderPath, "");
|
|
69639
69584
|
return hashes;
|
|
69640
69585
|
}
|
|
69641
|
-
async function clearGlobalLock(
|
|
69586
|
+
async function clearGlobalLock(path12) {
|
|
69642
69587
|
const conf = await readLockfile();
|
|
69643
69588
|
if (!conf?.locks) {
|
|
69644
69589
|
conf.locks = {};
|
|
69645
69590
|
}
|
|
69646
69591
|
const isFlatKeyed = conf?.version === "v2";
|
|
69647
69592
|
if (isFlatKeyed) {
|
|
69648
|
-
const key = v2LockPath(
|
|
69593
|
+
const key = v2LockPath(path12);
|
|
69649
69594
|
const legacyKey = "./" + key;
|
|
69650
69595
|
if (conf.locks) {
|
|
69651
69596
|
Object.keys(conf.locks).forEach((k) => {
|
|
@@ -69661,24 +69606,24 @@ async function clearGlobalLock(path13) {
|
|
|
69661
69606
|
}
|
|
69662
69607
|
}
|
|
69663
69608
|
}
|
|
69664
|
-
async function updateMetadataGlobalLock(
|
|
69609
|
+
async function updateMetadataGlobalLock(path12, hash2, subpath) {
|
|
69665
69610
|
const conf = await readLockfile();
|
|
69666
69611
|
if (!conf?.locks) {
|
|
69667
69612
|
conf.locks = {};
|
|
69668
69613
|
}
|
|
69669
69614
|
const isFlatKeyed = conf?.version === "v2";
|
|
69670
69615
|
if (isFlatKeyed) {
|
|
69671
|
-
conf.locks[v2LockPath(
|
|
69616
|
+
conf.locks[v2LockPath(path12, subpath)] = hash2;
|
|
69672
69617
|
} else {
|
|
69673
69618
|
if (subpath) {
|
|
69674
|
-
let prev = conf.locks[
|
|
69619
|
+
let prev = conf.locks[path12];
|
|
69675
69620
|
if (!prev || typeof prev != "object") {
|
|
69676
69621
|
prev = {};
|
|
69677
|
-
conf.locks[
|
|
69622
|
+
conf.locks[path12] = prev;
|
|
69678
69623
|
}
|
|
69679
69624
|
prev[subpath] = hash2;
|
|
69680
69625
|
} else {
|
|
69681
|
-
conf.locks[
|
|
69626
|
+
conf.locks[path12] = hash2;
|
|
69682
69627
|
}
|
|
69683
69628
|
}
|
|
69684
69629
|
if (!inMemoryLock) {
|
|
@@ -69745,7 +69690,7 @@ __export(exports_raw_apps, {
|
|
|
69745
69690
|
generatingPolicy: () => generatingPolicy
|
|
69746
69691
|
});
|
|
69747
69692
|
import { sep as SEP11 } from "node:path";
|
|
69748
|
-
import
|
|
69693
|
+
import path12 from "node:path";
|
|
69749
69694
|
import { readdir as readdir6 } from "node:fs/promises";
|
|
69750
69695
|
async function readSiblingLock(backendPath, runnableId, allFiles) {
|
|
69751
69696
|
const target = `${runnableId.toLowerCase()}.lock`;
|
|
@@ -69753,7 +69698,7 @@ async function readSiblingLock(backendPath, runnableId, allFiles) {
|
|
|
69753
69698
|
if (!lockFile)
|
|
69754
69699
|
return;
|
|
69755
69700
|
try {
|
|
69756
|
-
return await readTextFile(
|
|
69701
|
+
return await readTextFile(path12.join(backendPath, lockFile));
|
|
69757
69702
|
} catch {
|
|
69758
69703
|
return;
|
|
69759
69704
|
}
|
|
@@ -69770,7 +69715,7 @@ async function findRunnableContentFile(backendPath, runnableId, allFiles) {
|
|
|
69770
69715
|
const ext2 = fileName.substring(runnableId.length + 1);
|
|
69771
69716
|
if (EXTENSION_TO_LANGUAGE[ext2]) {
|
|
69772
69717
|
try {
|
|
69773
|
-
const content = await readTextFile(
|
|
69718
|
+
const content = await readTextFile(path12.join(backendPath, fileName));
|
|
69774
69719
|
return { ext: ext2, content };
|
|
69775
69720
|
} catch {
|
|
69776
69721
|
continue;
|
|
@@ -69807,7 +69752,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
|
|
|
69807
69752
|
}
|
|
69808
69753
|
const runnableId = fileName.replace(".yaml", "");
|
|
69809
69754
|
processedIds.add(runnableId.toLowerCase());
|
|
69810
|
-
const filePath =
|
|
69755
|
+
const filePath = path12.join(backendPath, fileName);
|
|
69811
69756
|
const runnable = await yamlParseFile(filePath);
|
|
69812
69757
|
if (runnable?.type === "inline") {
|
|
69813
69758
|
const contentFile = await findRunnableContentFile(backendPath, runnableId, allFiles);
|
|
@@ -69868,7 +69813,7 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
|
|
|
69868
69813
|
...rest
|
|
69869
69814
|
};
|
|
69870
69815
|
}
|
|
69871
|
-
const filePath =
|
|
69816
|
+
const filePath = path12.join(backendPath, `${runnableId}.yaml`);
|
|
69872
69817
|
writeIfChanged(filePath, import_yaml16.stringify(runnableToWrite, yamlOptions));
|
|
69873
69818
|
}
|
|
69874
69819
|
async function collectAppFiles(localPath) {
|
|
@@ -69919,7 +69864,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
69919
69864
|
}
|
|
69920
69865
|
const appFilePath = localPath + "raw_app.yaml";
|
|
69921
69866
|
const localApp = await yamlParseFile(appFilePath);
|
|
69922
|
-
const backendPath =
|
|
69867
|
+
const backendPath = path12.join(localPath, APP_BACKEND_FOLDER);
|
|
69923
69868
|
const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
|
|
69924
69869
|
let runnables;
|
|
69925
69870
|
if (Object.keys(runnablesFromBackend).length > 0) {
|
|
@@ -69941,7 +69886,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
69941
69886
|
const frameworks = detectFrameworks(localPath);
|
|
69942
69887
|
const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
69943
69888
|
const entryPoint = localPath + entryFile;
|
|
69944
|
-
const sharedUiDir =
|
|
69889
|
+
const sharedUiDir = path12.join(process.cwd(), "ui");
|
|
69945
69890
|
return await createBundle({
|
|
69946
69891
|
entryPoint,
|
|
69947
69892
|
production: true,
|
|
@@ -70001,13 +69946,13 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
70001
69946
|
}
|
|
70002
69947
|
await applyExtraPermsDiff(workspace, "raw_app", remotePath, localPerms, app?.extra_perms);
|
|
70003
69948
|
}
|
|
70004
|
-
async function generatingPolicy(app,
|
|
70005
|
-
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}...`));
|
|
70006
69951
|
try {
|
|
70007
69952
|
app.policy = await updateRawAppPolicy(app.runnables, app.policy);
|
|
70008
69953
|
app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
|
|
70009
69954
|
} catch (e) {
|
|
70010
|
-
error(colors.red(`Error generating policy for app ${
|
|
69955
|
+
error(colors.red(`Error generating policy for app ${path13}: ${e}`));
|
|
70011
69956
|
throw e;
|
|
70012
69957
|
}
|
|
70013
69958
|
}
|
|
@@ -70046,7 +69991,7 @@ __export(exports_app_metadata, {
|
|
|
70046
69991
|
filterWorkspaceDependenciesForApp: () => filterWorkspaceDependenciesForApp,
|
|
70047
69992
|
APP_BACKEND_FOLDER: () => APP_BACKEND_FOLDER
|
|
70048
69993
|
});
|
|
70049
|
-
import
|
|
69994
|
+
import path13 from "node:path";
|
|
70050
69995
|
import { mkdir as mkdir6, readdir as readdir7 } from "node:fs/promises";
|
|
70051
69996
|
import { sep as SEP12 } from "node:path";
|
|
70052
69997
|
async function isAppDirectlyStale(appFolder, hashes, conf) {
|
|
@@ -70063,7 +70008,7 @@ async function isAppDirectlyStale(appFolder, hashes, conf) {
|
|
|
70063
70008
|
return false;
|
|
70064
70009
|
}
|
|
70065
70010
|
async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
|
|
70066
|
-
const runnablesFolder = rawApp ?
|
|
70011
|
+
const runnablesFolder = rawApp ? path13.join(folder, APP_BACKEND_FOLDER) : folder;
|
|
70067
70012
|
const hashes = {};
|
|
70068
70013
|
try {
|
|
70069
70014
|
const elems = await FSFSElement(runnablesFolder, [], true);
|
|
@@ -70106,7 +70051,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
|
|
|
70106
70051
|
if (!justUpdateMetadataLock && !noStaleMessage) {
|
|
70107
70052
|
info(`Generating locks for app ${appFolder} at ${remote_path}`);
|
|
70108
70053
|
}
|
|
70109
|
-
const appFilePath =
|
|
70054
|
+
const appFilePath = path13.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
|
|
70110
70055
|
const appFile = await yamlParseFile(appFilePath);
|
|
70111
70056
|
const appValue = rawApp ? appFile.runnables : appFile.value;
|
|
70112
70057
|
const folderNormalized = appFolder.replaceAll(SEP12, "/");
|
|
@@ -70118,7 +70063,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
|
|
|
70118
70063
|
const isDirectlyStale = await isAppDirectlyStale(appFolder, hashes, conf);
|
|
70119
70064
|
let treeAppValue = structuredClone(appValue);
|
|
70120
70065
|
if (rawApp) {
|
|
70121
|
-
const runnablesPath =
|
|
70066
|
+
const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
|
|
70122
70067
|
const runnablesFromFiles = await loadRunnablesFromBackend(runnablesPath);
|
|
70123
70068
|
if (Object.keys(runnablesFromFiles).length > 0) {
|
|
70124
70069
|
treeAppValue = runnablesFromFiles;
|
|
@@ -70184,7 +70129,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
|
|
|
70184
70129
|
info(`Recomputing locks of ${changedScripts.join(", ")} in ${appFolder}`);
|
|
70185
70130
|
}
|
|
70186
70131
|
if (rawApp) {
|
|
70187
|
-
const runnablesPath =
|
|
70132
|
+
const runnablesPath = path13.join(appFolder, APP_BACKEND_FOLDER);
|
|
70188
70133
|
const rawAppFile = appFile;
|
|
70189
70134
|
let runnables = await loadRunnablesFromBackend(runnablesPath);
|
|
70190
70135
|
if (Object.keys(runnables).length === 0 && rawAppFile.runnables) {
|
|
@@ -70257,7 +70202,7 @@ async function traverseAndProcessInlineScripts(obj, processor, currentPath = [])
|
|
|
70257
70202
|
}
|
|
70258
70203
|
async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage, tempScriptRefs) {
|
|
70259
70204
|
const updatedRunnables = [];
|
|
70260
|
-
const runnablesFolder =
|
|
70205
|
+
const runnablesFolder = path13.join(appFolder, APP_BACKEND_FOLDER);
|
|
70261
70206
|
try {
|
|
70262
70207
|
await mkdir6(runnablesFolder, { recursive: true });
|
|
70263
70208
|
} catch {}
|
|
@@ -70282,7 +70227,7 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
|
|
|
70282
70227
|
if (language === "frontend") {
|
|
70283
70228
|
const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
|
|
70284
70229
|
const basePath = basePathO.replaceAll(SEP12, "/");
|
|
70285
|
-
const contentPath =
|
|
70230
|
+
const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
|
|
70286
70231
|
writeIfChanged(contentPath, content);
|
|
70287
70232
|
const simplifiedRunnable = { type: "inline" };
|
|
70288
70233
|
for (const [key, value] of Object.entries(runnable)) {
|
|
@@ -70300,8 +70245,8 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
|
|
|
70300
70245
|
const lock = await generateInlineScriptLock(workspace, content, language, `${remotePath}/${runnableId}`, rawDeps, tempScriptRefs);
|
|
70301
70246
|
const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
|
|
70302
70247
|
const basePath = basePathO.replaceAll(SEP12, "/");
|
|
70303
|
-
const contentPath =
|
|
70304
|
-
const lockPath =
|
|
70248
|
+
const contentPath = path13.join(runnablesFolder, `${basePath}${ext2}`);
|
|
70249
|
+
const lockPath = path13.join(runnablesFolder, `${basePath}lock`);
|
|
70305
70250
|
writeIfChanged(contentPath, content);
|
|
70306
70251
|
if (lock && lock !== "") {
|
|
70307
70252
|
writeIfChanged(lockPath, lock);
|
|
@@ -70349,8 +70294,8 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
|
|
|
70349
70294
|
}
|
|
70350
70295
|
const [basePathO, ext2] = pathAssigner.assignPath(scriptName, language);
|
|
70351
70296
|
const basePath = basePathO.replaceAll(SEP12, "/");
|
|
70352
|
-
const contentPath =
|
|
70353
|
-
const lockPath =
|
|
70297
|
+
const contentPath = path13.join(appFolder, `${basePath}${ext2}`);
|
|
70298
|
+
const lockPath = path13.join(appFolder, `${basePath}lock`);
|
|
70354
70299
|
writeIfChanged(contentPath, content);
|
|
70355
70300
|
if (lock && lock !== "") {
|
|
70356
70301
|
writeIfChanged(lockPath, lock);
|
|
@@ -70424,7 +70369,7 @@ ${text}`);
|
|
|
70424
70369
|
return lock ?? "";
|
|
70425
70370
|
}
|
|
70426
70371
|
async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultTs = "bun") {
|
|
70427
|
-
const fileName =
|
|
70372
|
+
const fileName = path13.basename(runnableFilePath);
|
|
70428
70373
|
if (fileName.endsWith(".lock") || fileName.endsWith(".yaml")) {
|
|
70429
70374
|
return;
|
|
70430
70375
|
}
|
|
@@ -70439,13 +70384,13 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
|
|
|
70439
70384
|
if (!runnableId || !ext2) {
|
|
70440
70385
|
return;
|
|
70441
70386
|
}
|
|
70442
|
-
const runnableFilePath2 =
|
|
70387
|
+
const runnableFilePath2 = path13.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
|
|
70443
70388
|
let runnable;
|
|
70444
70389
|
try {
|
|
70445
70390
|
runnable = await yamlParseFile(runnableFilePath2);
|
|
70446
70391
|
} catch {
|
|
70447
70392
|
try {
|
|
70448
|
-
const appFilePath =
|
|
70393
|
+
const appFilePath = path13.join(appFolder, "raw_app.yaml");
|
|
70449
70394
|
const appFile = await yamlParseFile(appFilePath);
|
|
70450
70395
|
if (!appFile.runnables?.[runnableId]) {
|
|
70451
70396
|
warn(colors.yellow(`Runnable ${runnableId} not found in backend folder or raw_app.yaml`));
|
|
@@ -70470,7 +70415,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
|
|
|
70470
70415
|
warn(colors.yellow(`Could not determine language for ${runnableId} (ext: ${ext2})`));
|
|
70471
70416
|
return;
|
|
70472
70417
|
}
|
|
70473
|
-
const fullFilePath =
|
|
70418
|
+
const fullFilePath = path13.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
|
|
70474
70419
|
let content;
|
|
70475
70420
|
try {
|
|
70476
70421
|
content = await readTextFile(fullFilePath);
|
|
@@ -70493,7 +70438,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
|
|
|
70493
70438
|
}
|
|
70494
70439
|
async function inferAllInlineSchemas(appFolder, defaultTs = "bun") {
|
|
70495
70440
|
const schemas = {};
|
|
70496
|
-
const backendPath =
|
|
70441
|
+
const backendPath = path13.join(appFolder, APP_BACKEND_FOLDER);
|
|
70497
70442
|
let entries;
|
|
70498
70443
|
try {
|
|
70499
70444
|
entries = await readdir7(backendPath, { withFileTypes: true });
|
|
@@ -70603,8 +70548,8 @@ var init_app_metadata = __esm(async () => {
|
|
|
70603
70548
|
// src/commands/app/generate_agents.ts
|
|
70604
70549
|
import * as fs10 from "node:fs";
|
|
70605
70550
|
import { writeFile as writeFile9 } from "node:fs/promises";
|
|
70606
|
-
import
|
|
70607
|
-
import
|
|
70551
|
+
import path14 from "node:path";
|
|
70552
|
+
import process14 from "node:process";
|
|
70608
70553
|
function generateDatatablesMarkdown(schemas, localData) {
|
|
70609
70554
|
const defaultDatatable = localData?.datatable;
|
|
70610
70555
|
const defaultSchema = localData?.schema;
|
|
@@ -70703,7 +70648,7 @@ Configure datatables in Workspace Settings > Windmill Data Tables.
|
|
|
70703
70648
|
return content;
|
|
70704
70649
|
}
|
|
70705
70650
|
async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
|
|
70706
|
-
const rawAppPath =
|
|
70651
|
+
const rawAppPath = path14.join(targetDir, "raw_app.yaml");
|
|
70707
70652
|
if (!fs10.existsSync(rawAppPath)) {
|
|
70708
70653
|
if (!silent) {
|
|
70709
70654
|
error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
|
|
@@ -70730,11 +70675,11 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
|
|
|
70730
70675
|
}
|
|
70731
70676
|
} catch {}
|
|
70732
70677
|
const agentsContent = generateAgentsDocumentation(localData);
|
|
70733
|
-
await writeFile9(
|
|
70734
|
-
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
|
|
70735
70680
|
`, "utf-8");
|
|
70736
70681
|
const datatablesContent = generateDatatablesMarkdown(schemas, localData);
|
|
70737
|
-
await writeFile9(
|
|
70682
|
+
await writeFile9(path14.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
|
|
70738
70683
|
if (!silent) {
|
|
70739
70684
|
info(colors.green(`✓ Generated AGENTS.md, CLAUDE.md, and DATATABLES.md`));
|
|
70740
70685
|
const datatableCount = schemas.length;
|
|
@@ -70752,24 +70697,24 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
|
|
|
70752
70697
|
}
|
|
70753
70698
|
}
|
|
70754
70699
|
async function generateAgents(opts, appFolder) {
|
|
70755
|
-
const cwd =
|
|
70700
|
+
const cwd = process14.cwd();
|
|
70756
70701
|
let targetDir = cwd;
|
|
70757
70702
|
if (appFolder) {
|
|
70758
|
-
targetDir =
|
|
70703
|
+
targetDir = path14.isAbsolute(appFolder) ? appFolder : path14.join(cwd, appFolder);
|
|
70759
70704
|
}
|
|
70760
70705
|
await loadNonDottedPathsSetting();
|
|
70761
|
-
const dirName =
|
|
70706
|
+
const dirName = path14.basename(targetDir);
|
|
70762
70707
|
if (!hasFolderSuffix(dirName, "raw_app")) {
|
|
70763
|
-
if (!hasFolderSuffix(
|
|
70708
|
+
if (!hasFolderSuffix(path14.basename(cwd), "raw_app") && !appFolder) {
|
|
70764
70709
|
error(colors.red(`Error: Must be run inside a ${getFolderSuffix("raw_app")} folder or specify one as argument.`));
|
|
70765
70710
|
info(colors.gray("Usage: wmill app generate-agents [app_folder]"));
|
|
70766
|
-
|
|
70711
|
+
process14.exit(1);
|
|
70767
70712
|
}
|
|
70768
70713
|
}
|
|
70769
|
-
const rawAppPath =
|
|
70714
|
+
const rawAppPath = path14.join(targetDir, "raw_app.yaml");
|
|
70770
70715
|
if (!fs10.existsSync(rawAppPath)) {
|
|
70771
70716
|
error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
|
|
70772
|
-
|
|
70717
|
+
process14.exit(1);
|
|
70773
70718
|
}
|
|
70774
70719
|
const workspace = await resolveWorkspace(opts);
|
|
70775
70720
|
await requireLogin(opts);
|
|
@@ -70796,33 +70741,33 @@ var init_generate_agents = __esm(async () => {
|
|
|
70796
70741
|
import { sep as SEP13 } from "node:path";
|
|
70797
70742
|
import * as http2 from "node:http";
|
|
70798
70743
|
import * as fs11 from "node:fs";
|
|
70799
|
-
import * as
|
|
70800
|
-
import
|
|
70801
|
-
import { writeFileSync as
|
|
70744
|
+
import * as path15 from "node:path";
|
|
70745
|
+
import process15 from "node:process";
|
|
70746
|
+
import { writeFileSync as writeFileSync5 } from "node:fs";
|
|
70802
70747
|
async function dev(opts, appFolder) {
|
|
70803
70748
|
GLOBAL_CONFIG_OPT.noCdToRoot = true;
|
|
70804
70749
|
await loadNonDottedPathsSetting();
|
|
70805
|
-
const originalCwd =
|
|
70750
|
+
const originalCwd = process15.cwd();
|
|
70806
70751
|
let targetDir = originalCwd;
|
|
70807
70752
|
if (appFolder) {
|
|
70808
|
-
targetDir =
|
|
70753
|
+
targetDir = path15.isAbsolute(appFolder) ? appFolder : path15.join(originalCwd, appFolder);
|
|
70809
70754
|
if (!fs11.existsSync(targetDir)) {
|
|
70810
70755
|
error(colors.red(`Error: Directory not found: ${targetDir}`));
|
|
70811
|
-
|
|
70756
|
+
process15.exit(1);
|
|
70812
70757
|
}
|
|
70813
70758
|
}
|
|
70814
|
-
const targetDirName =
|
|
70759
|
+
const targetDirName = path15.basename(targetDir);
|
|
70815
70760
|
if (!hasFolderSuffix(targetDirName, "raw_app")) {
|
|
70816
70761
|
error(colors.red(`Error: The dev command must be run inside a ${getFolderSuffix("raw_app")} folder.
|
|
70817
70762
|
` + `Target directory: ${targetDirName}
|
|
70818
70763
|
` + `Please navigate to a folder ending with '${getFolderSuffix("raw_app")}' or specify one as argument.`));
|
|
70819
|
-
|
|
70764
|
+
process15.exit(1);
|
|
70820
70765
|
}
|
|
70821
|
-
const rawAppPath =
|
|
70766
|
+
const rawAppPath = path15.join(targetDir, "raw_app.yaml");
|
|
70822
70767
|
if (!fs11.existsSync(rawAppPath)) {
|
|
70823
70768
|
error(colors.red(`Error: raw_app.yaml not found in ${targetDir}.
|
|
70824
70769
|
` + `The dev command requires a ${getFolderSuffix("raw_app")} folder containing a raw_app.yaml file.`));
|
|
70825
|
-
|
|
70770
|
+
process15.exit(1);
|
|
70826
70771
|
}
|
|
70827
70772
|
const workspace = await resolveWorkspace(opts);
|
|
70828
70773
|
await requireLogin(opts);
|
|
@@ -70830,25 +70775,25 @@ async function dev(opts, appFolder) {
|
|
|
70830
70775
|
let appTempRefs = undefined;
|
|
70831
70776
|
{
|
|
70832
70777
|
const wmillYamlPath = getWmillYamlPath();
|
|
70833
|
-
const workspaceRoot = wmillYamlPath ?
|
|
70834
|
-
const relAppFolder =
|
|
70778
|
+
const workspaceRoot = wmillYamlPath ? path15.dirname(wmillYamlPath) : originalCwd;
|
|
70779
|
+
const relAppFolder = path15.relative(workspaceRoot, targetDir) || ".";
|
|
70835
70780
|
const mergedOpts = await mergeConfigWithConfigFile(opts);
|
|
70836
70781
|
const codebases = await listSyncCodebases(mergedOpts);
|
|
70837
70782
|
const { buildPreviewTempScriptRefs: buildPreviewTempScriptRefs2 } = await init_generate_metadata().then(() => exports_generate_metadata);
|
|
70838
|
-
const savedCwd =
|
|
70783
|
+
const savedCwd = process15.cwd();
|
|
70839
70784
|
if (workspaceRoot !== savedCwd) {
|
|
70840
|
-
|
|
70785
|
+
process15.chdir(workspaceRoot);
|
|
70841
70786
|
}
|
|
70842
70787
|
try {
|
|
70843
70788
|
appTempRefs = await buildPreviewTempScriptRefs2(workspace, mergedOpts, codebases, { kind: "app", folder: relAppFolder, rawApp: true });
|
|
70844
70789
|
} finally {
|
|
70845
70790
|
if (workspaceRoot !== savedCwd) {
|
|
70846
|
-
|
|
70791
|
+
process15.chdir(savedCwd);
|
|
70847
70792
|
}
|
|
70848
70793
|
}
|
|
70849
70794
|
}
|
|
70850
70795
|
if (appFolder) {
|
|
70851
|
-
|
|
70796
|
+
process15.chdir(targetDir);
|
|
70852
70797
|
}
|
|
70853
70798
|
const rawApp = await yamlParseFile(rawAppPath);
|
|
70854
70799
|
const appPath = rawApp?.custom_path ?? "u/unknown/newapp";
|
|
@@ -70862,30 +70807,30 @@ async function dev(opts, appFolder) {
|
|
|
70862
70807
|
port: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((p) => p + DEFAULT_PORT)
|
|
70863
70808
|
});
|
|
70864
70809
|
const shouldOpen = opts.open ?? true;
|
|
70865
|
-
const frameworks = detectFrameworks(
|
|
70810
|
+
const frameworks = detectFrameworks(process15.cwd());
|
|
70866
70811
|
const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
70867
70812
|
const entryPoint = opts.entry ?? defaultEntry;
|
|
70868
70813
|
if (!fs11.existsSync(entryPoint)) {
|
|
70869
70814
|
error(colors.red(`Entry point "${entryPoint}" not found. Please specify a valid entry point with --entry.`));
|
|
70870
|
-
|
|
70815
|
+
process15.exit(1);
|
|
70871
70816
|
}
|
|
70872
|
-
const appDir =
|
|
70817
|
+
const appDir = path15.dirname(entryPoint) || process15.cwd();
|
|
70873
70818
|
await ensureNodeModules(appDir);
|
|
70874
70819
|
const inferredSchemas = {};
|
|
70875
70820
|
try {
|
|
70876
|
-
Object.assign(inferredSchemas, await inferAllInlineSchemas(
|
|
70821
|
+
Object.assign(inferredSchemas, await inferAllInlineSchemas(process15.cwd()));
|
|
70877
70822
|
} catch (err) {
|
|
70878
70823
|
warn(colors.yellow(`Could not seed inline schemas at startup: ${err.message}`));
|
|
70879
70824
|
}
|
|
70880
70825
|
const pathRunnableSchemas = {};
|
|
70881
70826
|
try {
|
|
70882
|
-
const initialRunnables = await loadRunnablesFromBackend(
|
|
70827
|
+
const initialRunnables = await loadRunnablesFromBackend(path15.join(process15.cwd(), APP_BACKEND_FOLDER));
|
|
70883
70828
|
Object.assign(pathRunnableSchemas, await fetchPathRunnableSchemas(workspaceId, initialRunnables));
|
|
70884
70829
|
} catch (err) {
|
|
70885
70830
|
warn(colors.yellow(`Could not fetch schemas for path-based runnables: ${err.message}`));
|
|
70886
70831
|
}
|
|
70887
70832
|
await genRunnablesTs(inferredSchemas, pathRunnableSchemas);
|
|
70888
|
-
const distDir =
|
|
70833
|
+
const distDir = path15.join(process15.cwd(), "dist");
|
|
70889
70834
|
if (!fs11.existsSync(distDir)) {
|
|
70890
70835
|
fs11.mkdirSync(distDir);
|
|
70891
70836
|
}
|
|
@@ -70948,7 +70893,7 @@ data: reload
|
|
|
70948
70893
|
info(colors.blue(`\uD83D\uDC40 Watching for file changes...
|
|
70949
70894
|
`));
|
|
70950
70895
|
await ctx.rebuild();
|
|
70951
|
-
const runnablesPath =
|
|
70896
|
+
const runnablesPath = path15.join(process15.cwd(), APP_BACKEND_FOLDER);
|
|
70952
70897
|
let runnablesWatcher;
|
|
70953
70898
|
if (fs11.existsSync(runnablesPath)) {
|
|
70954
70899
|
info(colors.blue(`\uD83D\uDC41️ Watching runnables folder at: ${runnablesPath}
|
|
@@ -70960,8 +70905,8 @@ data: reload
|
|
|
70960
70905
|
if (!filename)
|
|
70961
70906
|
return;
|
|
70962
70907
|
const fileStr = typeof filename === "string" ? filename : filename.toString();
|
|
70963
|
-
const changedPath =
|
|
70964
|
-
const relativePath =
|
|
70908
|
+
const changedPath = path15.join(runnablesPath, fileStr);
|
|
70909
|
+
const relativePath = path15.relative(process15.cwd(), changedPath);
|
|
70965
70910
|
const relativeToRunnables = fileStr;
|
|
70966
70911
|
if (changedPath.endsWith(".lock")) {
|
|
70967
70912
|
return;
|
|
@@ -70974,7 +70919,7 @@ data: reload
|
|
|
70974
70919
|
delete schemaInferenceTimeouts[changedPath];
|
|
70975
70920
|
try {
|
|
70976
70921
|
info(colors.cyan(`\uD83D\uDCDD Inferring schema for: ${relativeToRunnables}`));
|
|
70977
|
-
const result = await inferRunnableSchemaFromFile(
|
|
70922
|
+
const result = await inferRunnableSchemaFromFile(process15.cwd(), relativeToRunnables);
|
|
70978
70923
|
if (result) {
|
|
70979
70924
|
inferredSchemas[result.runnableId] = result.schema;
|
|
70980
70925
|
info(colors.green(` Inferred Schemas: ${JSON.stringify(inferredSchemas, null, 2)}`));
|
|
@@ -71012,7 +70957,7 @@ data: reload
|
|
|
71012
70957
|
return;
|
|
71013
70958
|
}
|
|
71014
70959
|
if (url === "/dist/bundle.js" || url === "/bundle.js") {
|
|
71015
|
-
const jsPath =
|
|
70960
|
+
const jsPath = path15.join(process15.cwd(), "dist/bundle.js");
|
|
71016
70961
|
if (fs11.existsSync(jsPath)) {
|
|
71017
70962
|
res.writeHead(200, { "Content-Type": "application/javascript" });
|
|
71018
70963
|
res.end(fs11.readFileSync(jsPath));
|
|
@@ -71023,7 +70968,7 @@ data: reload
|
|
|
71023
70968
|
return;
|
|
71024
70969
|
}
|
|
71025
70970
|
if (url === "/dist/bundle.css" || url === "/bundle.css") {
|
|
71026
|
-
const cssPath =
|
|
70971
|
+
const cssPath = path15.join(process15.cwd(), "dist/bundle.css");
|
|
71027
70972
|
if (fs11.existsSync(cssPath)) {
|
|
71028
70973
|
res.writeHead(200, { "Content-Type": "text/css" });
|
|
71029
70974
|
res.end(fs11.readFileSync(cssPath));
|
|
@@ -71034,7 +70979,7 @@ data: reload
|
|
|
71034
70979
|
return;
|
|
71035
70980
|
}
|
|
71036
70981
|
if (url === "/dist/bundle.js.map" || url === "/bundle.js.map") {
|
|
71037
|
-
const mapPath =
|
|
70982
|
+
const mapPath = path15.join(process15.cwd(), "dist/bundle.js.map");
|
|
71038
70983
|
if (fs11.existsSync(mapPath)) {
|
|
71039
70984
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
71040
70985
|
res.end(fs11.readFileSync(mapPath));
|
|
@@ -71045,7 +70990,7 @@ data: reload
|
|
|
71045
70990
|
return;
|
|
71046
70991
|
}
|
|
71047
70992
|
if (url === "/dist/bundle.css.map" || url === "/bundle.css.map") {
|
|
71048
|
-
const mapPath =
|
|
70993
|
+
const mapPath = path15.join(process15.cwd(), "dist/bundle.css.map");
|
|
71049
70994
|
if (fs11.existsSync(mapPath)) {
|
|
71050
70995
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
71051
70996
|
res.end(fs11.readFileSync(mapPath));
|
|
@@ -71059,12 +71004,12 @@ data: reload
|
|
|
71059
71004
|
res.end(createHTML("/dist/bundle.js", "/dist/bundle.css"));
|
|
71060
71005
|
});
|
|
71061
71006
|
const wss = new import_websocket_server.default({ server });
|
|
71062
|
-
const sqlToApplyPath =
|
|
71007
|
+
const sqlToApplyPath = path15.join(process15.cwd(), "sql_to_apply");
|
|
71063
71008
|
const sqlFileQueue = [];
|
|
71064
71009
|
let currentSqlFile = null;
|
|
71065
71010
|
async function getDatatableConfig() {
|
|
71066
71011
|
try {
|
|
71067
|
-
const rawApp2 = await yamlParseFile(
|
|
71012
|
+
const rawApp2 = await yamlParseFile(path15.join(process15.cwd(), "raw_app.yaml"));
|
|
71068
71013
|
return rawApp2?.data?.datatable;
|
|
71069
71014
|
} catch {
|
|
71070
71015
|
return;
|
|
@@ -71101,12 +71046,12 @@ data: reload
|
|
|
71101
71046
|
}
|
|
71102
71047
|
const filePath = sqlFileQueue.shift();
|
|
71103
71048
|
if (!fs11.existsSync(filePath)) {
|
|
71104
|
-
info(colors.gray(`File no longer exists: ${
|
|
71049
|
+
info(colors.gray(`File no longer exists: ${path15.basename(filePath)}`));
|
|
71105
71050
|
await processNextSqlFile();
|
|
71106
71051
|
return;
|
|
71107
71052
|
}
|
|
71108
71053
|
currentSqlFile = filePath;
|
|
71109
|
-
const fileName =
|
|
71054
|
+
const fileName = path15.basename(filePath);
|
|
71110
71055
|
try {
|
|
71111
71056
|
const sqlContent = await readTextFile(filePath);
|
|
71112
71057
|
if (!sqlContent.trim()) {
|
|
@@ -71128,9 +71073,9 @@ data: reload
|
|
|
71128
71073
|
if (deleteFile && fs11.existsSync(filePath)) {
|
|
71129
71074
|
try {
|
|
71130
71075
|
fs11.unlinkSync(filePath);
|
|
71131
|
-
info(colors.green(`✓ Deleted: ${
|
|
71076
|
+
info(colors.green(`✓ Deleted: ${path15.basename(filePath)}`));
|
|
71132
71077
|
} catch (error2) {
|
|
71133
|
-
error(colors.red(`Failed to delete ${
|
|
71078
|
+
error(colors.red(`Failed to delete ${path15.basename(filePath)}: ${error2.message}`));
|
|
71134
71079
|
}
|
|
71135
71080
|
}
|
|
71136
71081
|
currentSqlFile = null;
|
|
@@ -71142,7 +71087,7 @@ data: reload
|
|
|
71142
71087
|
try {
|
|
71143
71088
|
const sqlContent = await readTextFile(currentSqlFile);
|
|
71144
71089
|
const datatable = await getDatatableConfig();
|
|
71145
|
-
const fileName =
|
|
71090
|
+
const fileName = path15.basename(currentSqlFile);
|
|
71146
71091
|
ws.send(JSON.stringify({
|
|
71147
71092
|
type: "sqlMigration",
|
|
71148
71093
|
fileName,
|
|
@@ -71156,7 +71101,7 @@ data: reload
|
|
|
71156
71101
|
const sqlFiles = entries.filter((entry) => entry.endsWith(".sql"));
|
|
71157
71102
|
if (sqlFiles.length > 0 && sqlFileQueue.length === 0) {
|
|
71158
71103
|
for (const sqlFile of sqlFiles.sort()) {
|
|
71159
|
-
queueSqlFile(
|
|
71104
|
+
queueSqlFile(path15.join(sqlToApplyPath, sqlFile));
|
|
71160
71105
|
}
|
|
71161
71106
|
await processNextSqlFile();
|
|
71162
71107
|
}
|
|
@@ -71283,7 +71228,7 @@ data: reload
|
|
|
71283
71228
|
await onSqlFileCompleted(currentSqlFile, true);
|
|
71284
71229
|
}
|
|
71285
71230
|
try {
|
|
71286
|
-
await regenerateAgentDocs(workspaceId,
|
|
71231
|
+
await regenerateAgentDocs(workspaceId, process15.cwd(), true);
|
|
71287
71232
|
info(colors.gray(`[SQL Migration] Refreshed AGENTS.md and DATATABLES.md`));
|
|
71288
71233
|
} catch (regenError) {
|
|
71289
71234
|
warn(colors.yellow(`[SQL Migration] Could not refresh docs: ${regenError.message}`));
|
|
@@ -71335,7 +71280,7 @@ data: reload
|
|
|
71335
71280
|
}
|
|
71336
71281
|
info(colors.blue(`\uD83D\uDD0D Found ${sqlFiles.length} SQL file(s) in sql_to_apply/`));
|
|
71337
71282
|
for (const sqlFile of sqlFiles) {
|
|
71338
|
-
const filePath =
|
|
71283
|
+
const filePath = path15.join(sqlToApplyPath, sqlFile);
|
|
71339
71284
|
queueSqlFile(filePath);
|
|
71340
71285
|
}
|
|
71341
71286
|
await processNextSqlFile();
|
|
@@ -71353,11 +71298,11 @@ data: reload
|
|
|
71353
71298
|
if (!filename)
|
|
71354
71299
|
return;
|
|
71355
71300
|
const fileStr = typeof filename === "string" ? filename : filename.toString();
|
|
71356
|
-
const changedPath =
|
|
71301
|
+
const changedPath = path15.join(sqlToApplyPath, fileStr);
|
|
71357
71302
|
if (!changedPath.endsWith(".sql")) {
|
|
71358
71303
|
return;
|
|
71359
71304
|
}
|
|
71360
|
-
const fileName =
|
|
71305
|
+
const fileName = path15.basename(changedPath);
|
|
71361
71306
|
if (sqlDebounceTimeouts[changedPath]) {
|
|
71362
71307
|
clearTimeout(sqlDebounceTimeouts[changedPath]);
|
|
71363
71308
|
}
|
|
@@ -71382,7 +71327,7 @@ data: reload
|
|
|
71382
71327
|
const url = `http://${host}:${port}`;
|
|
71383
71328
|
info(colors.bold.green(`\uD83D\uDE80 Dev server running at ${url}`));
|
|
71384
71329
|
info(colors.cyan(`\uD83D\uDD0C WebSocket server running at ws://${host}:${port}`));
|
|
71385
|
-
info(colors.gray(`\uD83D\uDCE6 Serving files from: ${
|
|
71330
|
+
info(colors.gray(`\uD83D\uDCE6 Serving files from: ${process15.cwd()}`));
|
|
71386
71331
|
info(colors.gray(`\uD83D\uDD04 Live reload enabled
|
|
71387
71332
|
`));
|
|
71388
71333
|
if (shouldOpen) {
|
|
@@ -71396,7 +71341,7 @@ data: reload
|
|
|
71396
71341
|
}
|
|
71397
71342
|
}
|
|
71398
71343
|
});
|
|
71399
|
-
|
|
71344
|
+
process15.on("SIGINT", async () => {
|
|
71400
71345
|
info(colors.yellow(`
|
|
71401
71346
|
|
|
71402
71347
|
\uD83D\uDED1 Shutting down...`));
|
|
@@ -71409,17 +71354,17 @@ data: reload
|
|
|
71409
71354
|
sqlWatcher.close();
|
|
71410
71355
|
}
|
|
71411
71356
|
await ctx.dispose();
|
|
71412
|
-
|
|
71357
|
+
process15.exit(0);
|
|
71413
71358
|
});
|
|
71414
71359
|
}
|
|
71415
71360
|
async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides = {}) {
|
|
71416
71361
|
info(colors.blue("\uD83D\uDD04 Generating wmill.d.ts..."));
|
|
71417
|
-
const localPath =
|
|
71418
|
-
const backendPath =
|
|
71362
|
+
const localPath = process15.cwd();
|
|
71363
|
+
const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
|
|
71419
71364
|
let runnables = await loadRunnablesFromBackend(backendPath);
|
|
71420
71365
|
if (Object.keys(runnables).length === 0) {
|
|
71421
71366
|
try {
|
|
71422
|
-
const rawApp = await yamlParseFile(
|
|
71367
|
+
const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
|
|
71423
71368
|
runnables = rawApp?.["runnables"] ?? {};
|
|
71424
71369
|
} catch {
|
|
71425
71370
|
runnables = {};
|
|
@@ -71427,7 +71372,7 @@ async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides =
|
|
|
71427
71372
|
}
|
|
71428
71373
|
try {
|
|
71429
71374
|
const newWmillTs = buildWmillTs(runnables, inlineSchemaOverrides, pathSchemaOverrides);
|
|
71430
|
-
|
|
71375
|
+
writeFileSync5(path15.join(process15.cwd(), "wmill.d.ts"), newWmillTs);
|
|
71431
71376
|
} catch (error2) {
|
|
71432
71377
|
error(colors.red(`Failed to generate wmill.d.ts: ${error2.message}`));
|
|
71433
71378
|
}
|
|
@@ -71496,11 +71441,11 @@ function convertRunnablesToApiFormat(runnables) {
|
|
|
71496
71441
|
}
|
|
71497
71442
|
async function loadRunnables() {
|
|
71498
71443
|
try {
|
|
71499
|
-
const localPath =
|
|
71500
|
-
const backendPath =
|
|
71444
|
+
const localPath = process15.cwd();
|
|
71445
|
+
const backendPath = path15.join(localPath, APP_BACKEND_FOLDER);
|
|
71501
71446
|
let runnables = await loadRunnablesFromBackend(backendPath);
|
|
71502
71447
|
if (Object.keys(runnables).length === 0) {
|
|
71503
|
-
const rawApp = await yamlParseFile(
|
|
71448
|
+
const rawApp = await yamlParseFile(path15.join(localPath, "raw_app.yaml"));
|
|
71504
71449
|
runnables = rawApp?.runnables ?? {};
|
|
71505
71450
|
}
|
|
71506
71451
|
convertRunnablesToApiFormat(runnables);
|
|
@@ -72004,8 +71949,8 @@ var init_dev = __esm(async () => {
|
|
|
72004
71949
|
|
|
72005
71950
|
// src/commands/app/lint.ts
|
|
72006
71951
|
import * as fs12 from "node:fs";
|
|
72007
|
-
import * as
|
|
72008
|
-
import
|
|
71952
|
+
import * as path16 from "node:path";
|
|
71953
|
+
import process16 from "node:process";
|
|
72009
71954
|
function validateRawAppYaml(appData) {
|
|
72010
71955
|
const errors = [];
|
|
72011
71956
|
const warnings = [];
|
|
@@ -72019,7 +71964,7 @@ function validateRawAppYaml(appData) {
|
|
|
72019
71964
|
async function validateRunnables(appDir, appData) {
|
|
72020
71965
|
const errors = [];
|
|
72021
71966
|
const warnings = [];
|
|
72022
|
-
const backendPath =
|
|
71967
|
+
const backendPath = path16.join(appDir, APP_BACKEND_FOLDER);
|
|
72023
71968
|
const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
|
|
72024
71969
|
const hasBackendRunnables = Object.keys(runnablesFromBackend).length > 0;
|
|
72025
71970
|
const hasYamlRunnables = appData.runnables && typeof appData.runnables === "object" && !Array.isArray(appData.runnables) && Object.keys(appData.runnables).length > 0;
|
|
@@ -72042,7 +71987,7 @@ async function validateBuild(appDir) {
|
|
|
72042
71987
|
info(colors.blue("\uD83D\uDD28 Testing build..."));
|
|
72043
71988
|
const frameworks = detectFrameworks(appDir);
|
|
72044
71989
|
const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
72045
|
-
const entryPoint =
|
|
71990
|
+
const entryPoint = path16.join(appDir, entryFile);
|
|
72046
71991
|
await createBundle({
|
|
72047
71992
|
entryPoint,
|
|
72048
71993
|
production: true,
|
|
@@ -72057,12 +72002,12 @@ async function validateBuild(appDir) {
|
|
|
72057
72002
|
async function lintRawApp(appDir, opts) {
|
|
72058
72003
|
const errors = [];
|
|
72059
72004
|
const warnings = [];
|
|
72060
|
-
const currentDirName =
|
|
72005
|
+
const currentDirName = path16.basename(appDir);
|
|
72061
72006
|
if (!hasFolderSuffix(currentDirName, "raw_app")) {
|
|
72062
72007
|
errors.push(`Not a raw app folder: '${currentDirName}' does not end with '${getFolderSuffix("raw_app")}'`);
|
|
72063
72008
|
return { valid: false, errors, warnings };
|
|
72064
72009
|
}
|
|
72065
|
-
const rawAppPath =
|
|
72010
|
+
const rawAppPath = path16.join(appDir, "raw_app.yaml");
|
|
72066
72011
|
if (!fs12.existsSync(rawAppPath)) {
|
|
72067
72012
|
errors.push("Missing raw_app.yaml file");
|
|
72068
72013
|
return { valid: false, errors, warnings };
|
|
@@ -72101,7 +72046,7 @@ async function lintRawApp(appDir, opts) {
|
|
|
72101
72046
|
}
|
|
72102
72047
|
async function lint2(opts, appFolder) {
|
|
72103
72048
|
await loadNonDottedPathsSetting();
|
|
72104
|
-
const targetDir = appFolder ??
|
|
72049
|
+
const targetDir = appFolder ?? process16.cwd();
|
|
72105
72050
|
info(colors.bold.blue(`
|
|
72106
72051
|
\uD83D\uDD0D Linting raw app: ${targetDir}
|
|
72107
72052
|
`));
|
|
@@ -72122,7 +72067,7 @@ async function lint2(opts, appFolder) {
|
|
|
72122
72067
|
info(colors.red(`
|
|
72123
72068
|
❌ Lint failed
|
|
72124
72069
|
`));
|
|
72125
|
-
|
|
72070
|
+
process16.exit(1);
|
|
72126
72071
|
}
|
|
72127
72072
|
info(colors.green(`
|
|
72128
72073
|
✅ All checks passed
|
|
@@ -72146,8 +72091,8 @@ var init_lint2 = __esm(async () => {
|
|
|
72146
72091
|
|
|
72147
72092
|
// src/commands/app/new.ts
|
|
72148
72093
|
import { stat as stat9, writeFile as writeFile10, mkdir as mkdir7, rm as rm3 } from "node:fs/promises";
|
|
72149
|
-
import
|
|
72150
|
-
import { execSync as
|
|
72094
|
+
import path17 from "node:path";
|
|
72095
|
+
import { execSync as execSync5, exec, execFile as execFile6 } from "node:child_process";
|
|
72151
72096
|
function validateAppPath(appPath) {
|
|
72152
72097
|
if (!appPath.startsWith("u/") && !appPath.startsWith("f/")) {
|
|
72153
72098
|
return {
|
|
@@ -72402,7 +72347,7 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
72402
72347
|
}
|
|
72403
72348
|
await loadNonDottedPathsSetting();
|
|
72404
72349
|
const folderName2 = buildFolderPath(appPath, "raw_app");
|
|
72405
|
-
const appDir =
|
|
72350
|
+
const appDir = path17.join(process.cwd(), folderName2);
|
|
72406
72351
|
let dirExists = false;
|
|
72407
72352
|
try {
|
|
72408
72353
|
await stat9(appDir);
|
|
@@ -72427,17 +72372,17 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
72427
72372
|
await rm3(appDir, { recursive: true, force: true });
|
|
72428
72373
|
}
|
|
72429
72374
|
await mkdir7(appDir, { recursive: true });
|
|
72430
|
-
await mkdir7(
|
|
72431
|
-
await mkdir7(
|
|
72375
|
+
await mkdir7(path17.join(appDir, "backend"), { recursive: true });
|
|
72376
|
+
await mkdir7(path17.join(appDir, "sql_to_apply"), { recursive: true });
|
|
72432
72377
|
const rawAppConfig = {
|
|
72433
72378
|
summary
|
|
72434
72379
|
};
|
|
72435
72380
|
if (dataConfig.datatable) {
|
|
72436
72381
|
rawAppConfig.data = dataConfig;
|
|
72437
72382
|
}
|
|
72438
|
-
await writeFile10(
|
|
72383
|
+
await writeFile10(path17.join(appDir, "raw_app.yaml"), import_yaml22.stringify(rawAppConfig, yamlOptions), "utf-8");
|
|
72439
72384
|
for (const [filePath, content] of Object.entries(template.files)) {
|
|
72440
|
-
const fullPath =
|
|
72385
|
+
const fullPath = path17.join(appDir, filePath.slice(1));
|
|
72441
72386
|
await writeFile10(fullPath, content.trim() + `
|
|
72442
72387
|
`, "utf-8");
|
|
72443
72388
|
}
|
|
@@ -72447,21 +72392,21 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
72447
72392
|
schema: dataConfig.schema
|
|
72448
72393
|
} : undefined;
|
|
72449
72394
|
const agentsContent = generateAgentsDocumentation(dataForDocs);
|
|
72450
|
-
await writeFile10(
|
|
72451
|
-
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
|
|
72452
72397
|
`, "utf-8");
|
|
72453
72398
|
const datatablesContent = generateDatatablesDocumentation(dataForDocs);
|
|
72454
|
-
await writeFile10(
|
|
72399
|
+
await writeFile10(path17.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
|
|
72455
72400
|
const exampleRunnable = {
|
|
72456
72401
|
type: "inline",
|
|
72457
72402
|
path: undefined
|
|
72458
72403
|
};
|
|
72459
|
-
await writeFile10(
|
|
72460
|
-
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> {
|
|
72461
72406
|
return \`Hello from backend! x = \${x}\`;
|
|
72462
72407
|
}
|
|
72463
72408
|
`, "utf-8");
|
|
72464
|
-
await writeFile10(
|
|
72409
|
+
await writeFile10(path17.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
|
|
72465
72410
|
|
|
72466
72411
|
This folder is for SQL migration files that will be applied to datatables during development.
|
|
72467
72412
|
|
|
@@ -72489,7 +72434,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
72489
72434
|
- Use idempotent SQL (\`CREATE TABLE IF NOT EXISTS\`, etc.)
|
|
72490
72435
|
`);
|
|
72491
72436
|
if (createSchemaSQL && schemaName) {
|
|
72492
|
-
await writeFile10(
|
|
72437
|
+
await writeFile10(path17.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
|
|
72493
72438
|
}
|
|
72494
72439
|
info("");
|
|
72495
72440
|
info(colors.bold.green(`App created successfully at ${folderName2}/`));
|
|
@@ -72533,7 +72478,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
72533
72478
|
let hasClaudeDesktop = false;
|
|
72534
72479
|
if (process.platform === "darwin") {
|
|
72535
72480
|
try {
|
|
72536
|
-
|
|
72481
|
+
execSync5("ls /Applications/Claude.app", { stdio: "ignore" });
|
|
72537
72482
|
hasClaudeDesktop = true;
|
|
72538
72483
|
} catch {}
|
|
72539
72484
|
}
|
|
@@ -72545,9 +72490,9 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
72545
72490
|
});
|
|
72546
72491
|
if (openInDesktop) {
|
|
72547
72492
|
try {
|
|
72548
|
-
const absAppDir =
|
|
72549
|
-
const claudeDir =
|
|
72550
|
-
const launchPath =
|
|
72493
|
+
const absAppDir = path17.resolve(appDir);
|
|
72494
|
+
const claudeDir = path17.join(absAppDir, ".claude");
|
|
72495
|
+
const launchPath = path17.join(claudeDir, "launch.json");
|
|
72551
72496
|
if (!await stat9(launchPath).catch(() => null)) {
|
|
72552
72497
|
const launchJson = JSON.stringify({
|
|
72553
72498
|
version: "0.0.1",
|
|
@@ -72562,7 +72507,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
72562
72507
|
`;
|
|
72563
72508
|
await mkdir7(claudeDir, { recursive: true });
|
|
72564
72509
|
await writeFile10(launchPath, launchJson, "utf-8");
|
|
72565
|
-
info(colors.gray(`Seeded ${
|
|
72510
|
+
info(colors.gray(`Seeded ${path17.relative(process.cwd(), launchPath)}`));
|
|
72566
72511
|
}
|
|
72567
72512
|
const sessionId = crypto.randomUUID();
|
|
72568
72513
|
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
@@ -72864,8 +72809,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
72864
72809
|
if (!localPath.endsWith(SEP14)) {
|
|
72865
72810
|
localPath += SEP14;
|
|
72866
72811
|
}
|
|
72867
|
-
const
|
|
72868
|
-
const localApp = await yamlParseFile(
|
|
72812
|
+
const path18 = localPath + "app.yaml";
|
|
72813
|
+
const localApp = await yamlParseFile(path18);
|
|
72869
72814
|
replaceInlineScripts2(localApp.value, localPath, true);
|
|
72870
72815
|
await generatingPolicy2(localApp, remotePath, localApp?.["public"] ?? localApp?.["policy"]?.["execution_mode"] == "anonymous");
|
|
72871
72816
|
const preserveFields = {};
|
|
@@ -72911,13 +72856,13 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
72911
72856
|
}
|
|
72912
72857
|
await applyExtraPermsDiff(workspace, "app", remotePath, localPerms, app?.extra_perms);
|
|
72913
72858
|
}
|
|
72914
|
-
async function generatingPolicy2(app,
|
|
72915
|
-
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}...`));
|
|
72916
72861
|
try {
|
|
72917
72862
|
app.policy = await updatePolicy(app.value, undefined);
|
|
72918
72863
|
app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
|
|
72919
72864
|
} catch (e) {
|
|
72920
|
-
error(colors.red(`Error generating policy for app ${
|
|
72865
|
+
error(colors.red(`Error generating policy for app ${path18}: ${e}`));
|
|
72921
72866
|
throw e;
|
|
72922
72867
|
}
|
|
72923
72868
|
}
|
|
@@ -72946,12 +72891,12 @@ async function list6(opts) {
|
|
|
72946
72891
|
new Table2().header(["path", "summary"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary])).render();
|
|
72947
72892
|
}
|
|
72948
72893
|
}
|
|
72949
|
-
async function get4(opts,
|
|
72894
|
+
async function get4(opts, path18) {
|
|
72950
72895
|
const workspace = await resolveWorkspace(opts);
|
|
72951
72896
|
await requireLogin(opts);
|
|
72952
72897
|
const a = await getAppByPath({
|
|
72953
72898
|
workspace: workspace.workspaceId,
|
|
72954
|
-
path:
|
|
72899
|
+
path: path18
|
|
72955
72900
|
});
|
|
72956
72901
|
if (opts.json) {
|
|
72957
72902
|
console.log(JSON.stringify(a));
|
|
@@ -73337,11 +73282,11 @@ async function list8(opts) {
|
|
|
73337
73282
|
])).render();
|
|
73338
73283
|
}
|
|
73339
73284
|
}
|
|
73340
|
-
async function newVariable(opts,
|
|
73341
|
-
if (!validatePath(
|
|
73285
|
+
async function newVariable(opts, path18) {
|
|
73286
|
+
if (!validatePath(path18)) {
|
|
73342
73287
|
return;
|
|
73343
73288
|
}
|
|
73344
|
-
const filePath =
|
|
73289
|
+
const filePath = path18 + ".variable.yaml";
|
|
73345
73290
|
try {
|
|
73346
73291
|
await stat12(filePath);
|
|
73347
73292
|
throw new Error("File already exists: " + filePath);
|
|
@@ -73361,14 +73306,14 @@ async function newVariable(opts, path19) {
|
|
|
73361
73306
|
});
|
|
73362
73307
|
info(colors.green(`Created ${filePath}`));
|
|
73363
73308
|
}
|
|
73364
|
-
async function get6(opts,
|
|
73309
|
+
async function get6(opts, path18) {
|
|
73365
73310
|
if (opts.json)
|
|
73366
73311
|
setSilent(true);
|
|
73367
73312
|
const workspace = await resolveWorkspace(opts);
|
|
73368
73313
|
await requireLogin(opts);
|
|
73369
73314
|
const v = await getVariable({
|
|
73370
73315
|
workspace: workspace.workspaceId,
|
|
73371
|
-
path:
|
|
73316
|
+
path: path18
|
|
73372
73317
|
});
|
|
73373
73318
|
if (opts.json) {
|
|
73374
73319
|
console.log(JSON.stringify(v));
|
|
@@ -73499,11 +73444,11 @@ async function list9(opts) {
|
|
|
73499
73444
|
new Table2().header(["Path", "Schedule"]).padding(2).border(true).body(schedules.map((x) => [x.path, x.schedule])).render();
|
|
73500
73445
|
}
|
|
73501
73446
|
}
|
|
73502
|
-
async function newSchedule(opts,
|
|
73503
|
-
if (!validatePath(
|
|
73447
|
+
async function newSchedule(opts, path18) {
|
|
73448
|
+
if (!validatePath(path18)) {
|
|
73504
73449
|
return;
|
|
73505
73450
|
}
|
|
73506
|
-
const filePath =
|
|
73451
|
+
const filePath = path18 + ".schedule.yaml";
|
|
73507
73452
|
try {
|
|
73508
73453
|
await stat13(filePath);
|
|
73509
73454
|
throw new Error("File already exists: " + filePath);
|
|
@@ -73527,14 +73472,14 @@ async function newSchedule(opts, path19) {
|
|
|
73527
73472
|
});
|
|
73528
73473
|
info(colors.green(`Created ${filePath}`));
|
|
73529
73474
|
}
|
|
73530
|
-
async function get7(opts,
|
|
73475
|
+
async function get7(opts, path18) {
|
|
73531
73476
|
if (opts.json)
|
|
73532
73477
|
setSilent(true);
|
|
73533
73478
|
const workspace = await resolveWorkspace(opts);
|
|
73534
73479
|
await requireLogin(opts);
|
|
73535
73480
|
const s = await getSchedule({
|
|
73536
73481
|
workspace: workspace.workspaceId,
|
|
73537
|
-
path:
|
|
73482
|
+
path: path18
|
|
73538
73483
|
});
|
|
73539
73484
|
if (opts.json) {
|
|
73540
73485
|
console.log(JSON.stringify(s));
|
|
@@ -73547,14 +73492,14 @@ async function get7(opts, path19) {
|
|
|
73547
73492
|
console.log(colors.bold("Enabled:") + " " + (s.enabled ? "true" : "false"));
|
|
73548
73493
|
}
|
|
73549
73494
|
}
|
|
73550
|
-
async function pushSchedule(workspace,
|
|
73551
|
-
|
|
73552
|
-
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}`);
|
|
73553
73498
|
try {
|
|
73554
|
-
schedule = await getSchedule({ workspace, path:
|
|
73555
|
-
debug(`Schedule ${
|
|
73499
|
+
schedule = await getSchedule({ workspace, path: path18 });
|
|
73500
|
+
debug(`Schedule ${path18} exists on remote`);
|
|
73556
73501
|
} catch {
|
|
73557
|
-
debug(`Schedule ${
|
|
73502
|
+
debug(`Schedule ${path18} does not exist on remote`);
|
|
73558
73503
|
}
|
|
73559
73504
|
delete localSchedule.has_permissioned_as;
|
|
73560
73505
|
const preserveFields = {};
|
|
@@ -73563,31 +73508,31 @@ async function pushSchedule(workspace, path19, schedule, localSchedule, permissi
|
|
|
73563
73508
|
preserveFields.preserve_permissioned_as = true;
|
|
73564
73509
|
if (schedule.permissioned_as) {
|
|
73565
73510
|
preserveFields.permissioned_as = schedule.permissioned_as;
|
|
73566
|
-
info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${
|
|
73511
|
+
info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path18}`);
|
|
73567
73512
|
}
|
|
73568
73513
|
}
|
|
73569
73514
|
}
|
|
73570
73515
|
if (schedule) {
|
|
73571
73516
|
if (isSuperset(localSchedule, schedule)) {
|
|
73572
|
-
debug(`Schedule ${
|
|
73517
|
+
debug(`Schedule ${path18} is up to date`);
|
|
73573
73518
|
return;
|
|
73574
73519
|
}
|
|
73575
|
-
debug(`Updating schedule ${
|
|
73520
|
+
debug(`Updating schedule ${path18}`);
|
|
73576
73521
|
try {
|
|
73577
|
-
info(colors.bold.yellow(`Updating schedule ${
|
|
73522
|
+
info(colors.bold.yellow(`Updating schedule ${path18}`));
|
|
73578
73523
|
await updateSchedule({
|
|
73579
73524
|
workspace,
|
|
73580
|
-
path:
|
|
73525
|
+
path: path18,
|
|
73581
73526
|
requestBody: {
|
|
73582
73527
|
...localSchedule,
|
|
73583
73528
|
...preserveFields
|
|
73584
73529
|
}
|
|
73585
73530
|
});
|
|
73586
73531
|
if (localSchedule.enabled !== undefined && localSchedule.enabled !== schedule.enabled) {
|
|
73587
|
-
info(colors.bold.yellow(`Schedule ${
|
|
73532
|
+
info(colors.bold.yellow(`Schedule ${path18} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
|
|
73588
73533
|
await setScheduleEnabled({
|
|
73589
73534
|
workspace,
|
|
73590
|
-
path:
|
|
73535
|
+
path: path18,
|
|
73591
73536
|
requestBody: {
|
|
73592
73537
|
enabled: localSchedule.enabled
|
|
73593
73538
|
}
|
|
@@ -73598,12 +73543,12 @@ async function pushSchedule(workspace, path19, schedule, localSchedule, permissi
|
|
|
73598
73543
|
throw e;
|
|
73599
73544
|
}
|
|
73600
73545
|
} else {
|
|
73601
|
-
console.log(colors.bold.yellow("Creating new schedule " +
|
|
73546
|
+
console.log(colors.bold.yellow("Creating new schedule " + path18));
|
|
73602
73547
|
try {
|
|
73603
73548
|
await createSchedule({
|
|
73604
73549
|
workspace,
|
|
73605
73550
|
requestBody: {
|
|
73606
|
-
path:
|
|
73551
|
+
path: path18,
|
|
73607
73552
|
...localSchedule,
|
|
73608
73553
|
...preserveFields
|
|
73609
73554
|
}
|
|
@@ -73614,26 +73559,26 @@ async function pushSchedule(workspace, path19, schedule, localSchedule, permissi
|
|
|
73614
73559
|
}
|
|
73615
73560
|
}
|
|
73616
73561
|
}
|
|
73617
|
-
async function enable(opts,
|
|
73562
|
+
async function enable(opts, path18) {
|
|
73618
73563
|
opts = await mergeConfigWithConfigFile(opts);
|
|
73619
73564
|
const workspace = await resolveWorkspace(opts);
|
|
73620
73565
|
await requireLogin(opts);
|
|
73621
73566
|
try {
|
|
73622
73567
|
await setScheduleEnabled({
|
|
73623
73568
|
workspace: workspace.workspaceId,
|
|
73624
|
-
path:
|
|
73569
|
+
path: path18,
|
|
73625
73570
|
requestBody: { enabled: true, force: opts.force }
|
|
73626
73571
|
});
|
|
73627
73572
|
} catch (e) {
|
|
73628
73573
|
const conflict = parseForkConflict(e);
|
|
73629
73574
|
if (conflict) {
|
|
73630
|
-
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.
|
|
73631
73576
|
` + `Re-run with --force to enable anyway.`);
|
|
73632
73577
|
process.exit(1);
|
|
73633
73578
|
}
|
|
73634
73579
|
throw e;
|
|
73635
73580
|
}
|
|
73636
|
-
info(colors.green(`Schedule ${
|
|
73581
|
+
info(colors.green(`Schedule ${path18} enabled.`));
|
|
73637
73582
|
}
|
|
73638
73583
|
function parseForkConflict(e) {
|
|
73639
73584
|
const body = e?.body;
|
|
@@ -73643,16 +73588,16 @@ function parseForkConflict(e) {
|
|
|
73643
73588
|
return;
|
|
73644
73589
|
return { kind: m[1], parentWorkspaceId: m[2].trim() };
|
|
73645
73590
|
}
|
|
73646
|
-
async function disable(opts,
|
|
73591
|
+
async function disable(opts, path18) {
|
|
73647
73592
|
opts = await mergeConfigWithConfigFile(opts);
|
|
73648
73593
|
const workspace = await resolveWorkspace(opts);
|
|
73649
73594
|
await requireLogin(opts);
|
|
73650
73595
|
await setScheduleEnabled({
|
|
73651
73596
|
workspace: workspace.workspaceId,
|
|
73652
|
-
path:
|
|
73597
|
+
path: path18,
|
|
73653
73598
|
requestBody: { enabled: false }
|
|
73654
73599
|
});
|
|
73655
|
-
info(colors.yellow(`Schedule ${
|
|
73600
|
+
info(colors.yellow(`Schedule ${path18} disabled.`));
|
|
73656
73601
|
}
|
|
73657
73602
|
async function push8(opts, filePath, remotePath) {
|
|
73658
73603
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -73795,7 +73740,7 @@ async function decrypt(combinedCiphertext, keyString) {
|
|
|
73795
73740
|
var init_local_encryption = () => {};
|
|
73796
73741
|
|
|
73797
73742
|
// src/core/settings.ts
|
|
73798
|
-
import
|
|
73743
|
+
import process17 from "node:process";
|
|
73799
73744
|
import { writeFile as writeFile14 } from "node:fs/promises";
|
|
73800
73745
|
function migrateToGroupedFormat(settings) {
|
|
73801
73746
|
const result = { name: settings.name ?? "" };
|
|
@@ -74099,7 +74044,7 @@ async function pushWorkspaceKey(workspace, _path, key, localKey, opts) {
|
|
|
74099
74044
|
}
|
|
74100
74045
|
if (localKey && key !== localKey) {
|
|
74101
74046
|
let reencrypt;
|
|
74102
|
-
const explicitSkip = opts?.skipReencrypt || (
|
|
74047
|
+
const explicitSkip = opts?.skipReencrypt || (process17.env.WMILL_NO_REENCRYPT_ON_KEY_CHANGE ?? "").toLowerCase() === "true";
|
|
74103
74048
|
if (explicitSkip) {
|
|
74104
74049
|
reencrypt = false;
|
|
74105
74050
|
info("Workspace encryption key changed; leaving remote ciphertexts untouched (skip re-encryption requested).");
|
|
@@ -74138,7 +74083,7 @@ async function readInstanceSettings(opts) {
|
|
|
74138
74083
|
return localSettings;
|
|
74139
74084
|
}
|
|
74140
74085
|
async function processInstanceSettings(settings, mode) {
|
|
74141
|
-
const encKey =
|
|
74086
|
+
const encKey = process17.env.WMILL_INSTANCE_LOCAL_ENCRYPTION_KEY;
|
|
74142
74087
|
if (encKey) {
|
|
74143
74088
|
const res = [];
|
|
74144
74089
|
for (const s of settings) {
|
|
@@ -74312,7 +74257,7 @@ var init_settings = __esm(async () => {
|
|
|
74312
74257
|
// src/commands/instance/instance.ts
|
|
74313
74258
|
import { writeFile as writeFile15, readdir as readdir9, mkdir as mkdir11, rm as rm4, stat as stat14 } from "node:fs/promises";
|
|
74314
74259
|
import { appendFile } from "node:fs/promises";
|
|
74315
|
-
import * as
|
|
74260
|
+
import * as path18 from "node:path";
|
|
74316
74261
|
async function allInstances() {
|
|
74317
74262
|
try {
|
|
74318
74263
|
const file = await getInstancesConfigFilePath();
|
|
@@ -74504,7 +74449,7 @@ async function instancePull(opts) {
|
|
|
74504
74449
|
if (confirm) {
|
|
74505
74450
|
if (uChanges > 0) {
|
|
74506
74451
|
if (opts.folderPerInstance && opts.prefixSettings) {
|
|
74507
|
-
await mkdir11(
|
|
74452
|
+
await mkdir11(path18.join(rootDir, opts.prefix), {
|
|
74508
74453
|
recursive: true
|
|
74509
74454
|
});
|
|
74510
74455
|
}
|
|
@@ -74538,10 +74483,10 @@ Pulling all workspaces`);
|
|
|
74538
74483
|
info(`
|
|
74539
74484
|
Pulling workspace ` + remoteWorkspace.id);
|
|
74540
74485
|
const workspaceName = opts?.folderPerInstance ? instance.prefix + "/" + remoteWorkspace.id : instance.prefix + "_" + remoteWorkspace.id;
|
|
74541
|
-
await mkdir11(
|
|
74486
|
+
await mkdir11(path18.join(rootDir, workspaceName), {
|
|
74542
74487
|
recursive: true
|
|
74543
74488
|
});
|
|
74544
|
-
process.chdir(
|
|
74489
|
+
process.chdir(path18.join(rootDir, workspaceName));
|
|
74545
74490
|
await addWorkspace({
|
|
74546
74491
|
remote: instance.remote,
|
|
74547
74492
|
name: workspaceName,
|
|
@@ -74576,7 +74521,7 @@ Pulling workspace ` + remoteWorkspace.id);
|
|
|
74576
74521
|
if (confirmDelete) {
|
|
74577
74522
|
for (const workspace of localWorkspacesToDelete) {
|
|
74578
74523
|
await removeWorkspace(workspace.id, false, {});
|
|
74579
|
-
await rm4(
|
|
74524
|
+
await rm4(path18.join(rootDir, workspace.dir), {
|
|
74580
74525
|
recursive: true
|
|
74581
74526
|
});
|
|
74582
74527
|
}
|
|
@@ -74665,12 +74610,12 @@ Pushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
|
|
|
74665
74610
|
info(`
|
|
74666
74611
|
Pushing workspace ` + localWorkspace.id);
|
|
74667
74612
|
try {
|
|
74668
|
-
process.chdir(
|
|
74613
|
+
process.chdir(path18.join(rootDir, localWorkspace.dir));
|
|
74669
74614
|
} catch (_) {
|
|
74670
74615
|
throw new Error("Workspace folder not found, are you in the right directory?");
|
|
74671
74616
|
}
|
|
74672
74617
|
try {
|
|
74673
|
-
const workspaceSettings = await yamlParseFile(
|
|
74618
|
+
const workspaceSettings = await yamlParseFile(path18.join(process.cwd(), "settings.yaml"));
|
|
74674
74619
|
await add({
|
|
74675
74620
|
token: instance.token,
|
|
74676
74621
|
workspace: undefined,
|
|
@@ -74934,8 +74879,8 @@ async function createToken2(opts) {
|
|
|
74934
74879
|
}
|
|
74935
74880
|
info("Token: " + await createToken({ requestBody: {} }));
|
|
74936
74881
|
}
|
|
74937
|
-
async function pushWorkspaceUser(workspace,
|
|
74938
|
-
const email = removePathPrefix(removeType(
|
|
74882
|
+
async function pushWorkspaceUser(workspace, path19, user, localUser) {
|
|
74883
|
+
const email = removePathPrefix(removeType(path19, "user"), "users");
|
|
74939
74884
|
debug(`Processing local user ${email}`);
|
|
74940
74885
|
if (!["operator", "developer", "admin"].includes(localUser.role)) {
|
|
74941
74886
|
throw new Error(`Invalid role for user ${email}: ${localUser.role}`);
|
|
@@ -74998,8 +74943,8 @@ async function pushWorkspaceUser(workspace, path20, user, localUser) {
|
|
|
74998
74943
|
}
|
|
74999
74944
|
}
|
|
75000
74945
|
}
|
|
75001
|
-
async function pushGroup(workspace,
|
|
75002
|
-
const name = removePathPrefix(removeType(
|
|
74946
|
+
async function pushGroup(workspace, path19, group, localGroup) {
|
|
74947
|
+
const name = removePathPrefix(removeType(path19, "group"), "groups");
|
|
75003
74948
|
debug(`Processing local group ${name}`);
|
|
75004
74949
|
try {
|
|
75005
74950
|
const remoteGroup = await getGroup({
|
|
@@ -75250,10 +75195,10 @@ async function push9(opts, filePath) {
|
|
|
75250
75195
|
const content = readTextFileSync(filePath);
|
|
75251
75196
|
await pushWorkspaceDependencies(workspace.workspaceId, filePath, null, content);
|
|
75252
75197
|
}
|
|
75253
|
-
async function pushWorkspaceDependencies(workspace,
|
|
75254
|
-
const res = workspaceDependenciesPathToLanguageAndFilename(
|
|
75198
|
+
async function pushWorkspaceDependencies(workspace, path19, _befObj, newDependenciesContent) {
|
|
75199
|
+
const res = workspaceDependenciesPathToLanguageAndFilename(path19);
|
|
75255
75200
|
if (!res) {
|
|
75256
|
-
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`);
|
|
75257
75202
|
}
|
|
75258
75203
|
const { language, name } = res;
|
|
75259
75204
|
const displayName = name ? `named dependencies "${name}"` : `workspace default dependencies`;
|
|
@@ -75305,7 +75250,7 @@ var init_dependencies = __esm(async () => {
|
|
|
75305
75250
|
import { mkdir as mkdir12, stat as stat15, writeFile as writeFile17 } from "node:fs/promises";
|
|
75306
75251
|
import { dirname as dirname16 } from "node:path";
|
|
75307
75252
|
import { sep as SEP18 } from "node:path";
|
|
75308
|
-
async function getTrigger(triggerType, workspace,
|
|
75253
|
+
async function getTrigger(triggerType, workspace, path19) {
|
|
75309
75254
|
const triggerFunctions = {
|
|
75310
75255
|
http: getHttpTrigger,
|
|
75311
75256
|
websocket: getWebsocketTrigger,
|
|
@@ -75319,10 +75264,10 @@ async function getTrigger(triggerType, workspace, path20) {
|
|
|
75319
75264
|
email: getEmailTrigger
|
|
75320
75265
|
};
|
|
75321
75266
|
const triggerFunction = triggerFunctions[triggerType];
|
|
75322
|
-
const trigger = await triggerFunction({ workspace, path:
|
|
75267
|
+
const trigger = await triggerFunction({ workspace, path: path19 });
|
|
75323
75268
|
return trigger;
|
|
75324
75269
|
}
|
|
75325
|
-
async function updateTrigger(triggerType, workspace,
|
|
75270
|
+
async function updateTrigger(triggerType, workspace, path19, trigger) {
|
|
75326
75271
|
const triggerFunctions = {
|
|
75327
75272
|
http: updateHttpTrigger,
|
|
75328
75273
|
websocket: updateWebsocketTrigger,
|
|
@@ -75336,9 +75281,9 @@ async function updateTrigger(triggerType, workspace, path20, trigger) {
|
|
|
75336
75281
|
email: updateEmailTrigger
|
|
75337
75282
|
};
|
|
75338
75283
|
const triggerFunction = triggerFunctions[triggerType];
|
|
75339
|
-
await triggerFunction({ workspace, path:
|
|
75284
|
+
await triggerFunction({ workspace, path: path19, requestBody: trigger });
|
|
75340
75285
|
}
|
|
75341
|
-
async function createTrigger(triggerType, workspace,
|
|
75286
|
+
async function createTrigger(triggerType, workspace, path19, trigger) {
|
|
75342
75287
|
const triggerFunctions = {
|
|
75343
75288
|
http: createHttpTrigger,
|
|
75344
75289
|
websocket: createWebsocketTrigger,
|
|
@@ -75352,16 +75297,16 @@ async function createTrigger(triggerType, workspace, path20, trigger) {
|
|
|
75352
75297
|
email: createEmailTrigger
|
|
75353
75298
|
};
|
|
75354
75299
|
const triggerFunction = triggerFunctions[triggerType];
|
|
75355
|
-
await triggerFunction({ workspace, path:
|
|
75300
|
+
await triggerFunction({ workspace, path: path19, requestBody: trigger });
|
|
75356
75301
|
}
|
|
75357
|
-
async function pushTrigger(triggerType, workspace,
|
|
75358
|
-
|
|
75359
|
-
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}`);
|
|
75360
75305
|
try {
|
|
75361
|
-
trigger = await getTrigger(triggerType, workspace,
|
|
75362
|
-
debug(`${triggerType} trigger ${
|
|
75306
|
+
trigger = await getTrigger(triggerType, workspace, path19);
|
|
75307
|
+
debug(`${triggerType} trigger ${path19} exists on remote`);
|
|
75363
75308
|
} catch {
|
|
75364
|
-
debug(`${triggerType} trigger ${
|
|
75309
|
+
debug(`${triggerType} trigger ${path19} does not exist on remote`);
|
|
75365
75310
|
}
|
|
75366
75311
|
delete localTrigger.has_permissioned_as;
|
|
75367
75312
|
const preserveFields = {};
|
|
@@ -75370,33 +75315,33 @@ async function pushTrigger(triggerType, workspace, path20, trigger, localTrigger
|
|
|
75370
75315
|
preserveFields.preserve_permissioned_as = true;
|
|
75371
75316
|
if (trigger.permissioned_as) {
|
|
75372
75317
|
preserveFields.permissioned_as = trigger.permissioned_as;
|
|
75373
|
-
info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${
|
|
75318
|
+
info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path19}`);
|
|
75374
75319
|
}
|
|
75375
75320
|
}
|
|
75376
75321
|
}
|
|
75377
75322
|
if (trigger) {
|
|
75378
75323
|
if (isSuperset(localTrigger, trigger)) {
|
|
75379
|
-
debug(`${triggerType} trigger ${
|
|
75324
|
+
debug(`${triggerType} trigger ${path19} is up to date`);
|
|
75380
75325
|
return;
|
|
75381
75326
|
}
|
|
75382
|
-
debug(`${triggerType} trigger ${
|
|
75327
|
+
debug(`${triggerType} trigger ${path19} is not up-to-date, updating...`);
|
|
75383
75328
|
try {
|
|
75384
|
-
await updateTrigger(triggerType, workspace,
|
|
75329
|
+
await updateTrigger(triggerType, workspace, path19, {
|
|
75385
75330
|
...localTrigger,
|
|
75386
75331
|
...preserveFields,
|
|
75387
|
-
path:
|
|
75332
|
+
path: path19
|
|
75388
75333
|
});
|
|
75389
75334
|
} catch (e) {
|
|
75390
75335
|
console.error(e.body);
|
|
75391
75336
|
throw e;
|
|
75392
75337
|
}
|
|
75393
75338
|
} else {
|
|
75394
|
-
console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${
|
|
75339
|
+
console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path19}`));
|
|
75395
75340
|
try {
|
|
75396
|
-
await createTrigger(triggerType, workspace,
|
|
75341
|
+
await createTrigger(triggerType, workspace, path19, {
|
|
75397
75342
|
...localTrigger,
|
|
75398
75343
|
...preserveFields,
|
|
75399
|
-
path:
|
|
75344
|
+
path: path19
|
|
75400
75345
|
});
|
|
75401
75346
|
} catch (e) {
|
|
75402
75347
|
console.error(e.body);
|
|
@@ -75481,8 +75426,8 @@ async function pushNativeTrigger(workspace, filePath, _remoteTrigger, localTrigg
|
|
|
75481
75426
|
}
|
|
75482
75427
|
}
|
|
75483
75428
|
}
|
|
75484
|
-
async function newTrigger(opts,
|
|
75485
|
-
if (!validatePath(
|
|
75429
|
+
async function newTrigger(opts, path19) {
|
|
75430
|
+
if (!validatePath(path19)) {
|
|
75486
75431
|
return;
|
|
75487
75432
|
}
|
|
75488
75433
|
if (!opts.kind) {
|
|
@@ -75492,7 +75437,7 @@ async function newTrigger(opts, path20) {
|
|
|
75492
75437
|
throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
|
|
75493
75438
|
}
|
|
75494
75439
|
const kind = opts.kind;
|
|
75495
|
-
const filePath = `${
|
|
75440
|
+
const filePath = `${path19}.${kind}_trigger.yaml`;
|
|
75496
75441
|
try {
|
|
75497
75442
|
await stat15(filePath);
|
|
75498
75443
|
throw new Error("File already exists: " + filePath);
|
|
@@ -75528,7 +75473,7 @@ function printTriggerDetails(trigger, kind) {
|
|
|
75528
75473
|
console.log(colors.bold(label + ":") + " " + display);
|
|
75529
75474
|
}
|
|
75530
75475
|
}
|
|
75531
|
-
async function get8(opts,
|
|
75476
|
+
async function get8(opts, path19) {
|
|
75532
75477
|
if (opts.json)
|
|
75533
75478
|
setSilent(true);
|
|
75534
75479
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -75537,7 +75482,7 @@ async function get8(opts, path20) {
|
|
|
75537
75482
|
if (!checkIfValidTrigger(opts.kind)) {
|
|
75538
75483
|
throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
|
|
75539
75484
|
}
|
|
75540
|
-
const trigger = await getTrigger(opts.kind, workspace.workspaceId,
|
|
75485
|
+
const trigger = await getTrigger(opts.kind, workspace.workspaceId, path19);
|
|
75541
75486
|
if (opts.json) {
|
|
75542
75487
|
console.log(JSON.stringify(trigger));
|
|
75543
75488
|
} else {
|
|
@@ -75548,12 +75493,12 @@ async function get8(opts, path20) {
|
|
|
75548
75493
|
const matches = [];
|
|
75549
75494
|
for (const kind of TRIGGER_TYPES) {
|
|
75550
75495
|
try {
|
|
75551
|
-
const trigger = await getTrigger(kind, workspace.workspaceId,
|
|
75496
|
+
const trigger = await getTrigger(kind, workspace.workspaceId, path19);
|
|
75552
75497
|
matches.push({ kind, trigger });
|
|
75553
75498
|
} catch {}
|
|
75554
75499
|
}
|
|
75555
75500
|
if (matches.length === 0) {
|
|
75556
|
-
throw new Error("No trigger found at path: " +
|
|
75501
|
+
throw new Error("No trigger found at path: " + path19);
|
|
75557
75502
|
}
|
|
75558
75503
|
if (matches.length === 1) {
|
|
75559
75504
|
const { kind, trigger } = matches[0];
|
|
@@ -75564,7 +75509,7 @@ async function get8(opts, path20) {
|
|
|
75564
75509
|
}
|
|
75565
75510
|
return;
|
|
75566
75511
|
}
|
|
75567
|
-
console.log("Multiple triggers found at path " +
|
|
75512
|
+
console.log("Multiple triggers found at path " + path19 + ":");
|
|
75568
75513
|
for (const m of matches) {
|
|
75569
75514
|
console.log(" - " + m.kind);
|
|
75570
75515
|
}
|
|
@@ -75794,7 +75739,7 @@ var init_trigger = __esm(async () => {
|
|
|
75794
75739
|
});
|
|
75795
75740
|
|
|
75796
75741
|
// src/types.ts
|
|
75797
|
-
import * as
|
|
75742
|
+
import * as path19 from "node:path";
|
|
75798
75743
|
import { sep as SEP19 } from "node:path";
|
|
75799
75744
|
function isSuperset(subset, superset) {
|
|
75800
75745
|
return Object.keys(subset).every((key) => {
|
|
@@ -75838,11 +75783,11 @@ function showDiff(local, remote) {
|
|
|
75838
75783
|
}
|
|
75839
75784
|
info(finalString);
|
|
75840
75785
|
}
|
|
75841
|
-
function showConflict(
|
|
75842
|
-
info(colors.yellow(`- ${
|
|
75786
|
+
function showConflict(path20, local, remote) {
|
|
75787
|
+
info(colors.yellow(`- ${path20}`));
|
|
75843
75788
|
let isEncryptionKey = false;
|
|
75844
75789
|
try {
|
|
75845
|
-
isEncryptionKey = getTypeStrFromPath(
|
|
75790
|
+
isEncryptionKey = getTypeStrFromPath(path20) === "encryption_key";
|
|
75846
75791
|
} catch {}
|
|
75847
75792
|
if (isEncryptionKey) {
|
|
75848
75793
|
showDiff(redactEncryptionKey(local), redactEncryptionKey(remote));
|
|
@@ -75969,7 +75914,7 @@ function getTypeStrFromPath(p) {
|
|
|
75969
75914
|
if (isFileResource(p) || isFilesetResource(p)) {
|
|
75970
75915
|
return "resource";
|
|
75971
75916
|
}
|
|
75972
|
-
const parsed =
|
|
75917
|
+
const parsed = path19.parse(p);
|
|
75973
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") {
|
|
75974
75919
|
return "script";
|
|
75975
75920
|
}
|
|
@@ -75993,7 +75938,7 @@ function getTypeStrFromPath(p) {
|
|
|
75993
75938
|
}
|
|
75994
75939
|
}
|
|
75995
75940
|
function removeType(str, type) {
|
|
75996
|
-
const normalizedStr =
|
|
75941
|
+
const normalizedStr = path19.normalize(str).replaceAll(SEP19, "/");
|
|
75997
75942
|
if (normalizedStr.endsWith("." + type + ".yaml") || normalizedStr.endsWith("." + type + ".json")) {
|
|
75998
75943
|
return normalizedStr.slice(0, normalizedStr.length - type.length - 6);
|
|
75999
75944
|
}
|
|
@@ -76003,7 +75948,7 @@ function removeType(str, type) {
|
|
|
76003
75948
|
return normalizedStr;
|
|
76004
75949
|
}
|
|
76005
75950
|
function extractNativeTriggerInfo(p) {
|
|
76006
|
-
const normalizedPath =
|
|
75951
|
+
const normalizedPath = path19.normalize(p).replaceAll(SEP19, "/");
|
|
76007
75952
|
const withoutExt = normalizedPath.replace(/\.(json|yaml)$/, "");
|
|
76008
75953
|
const match2 = withoutExt.match(/^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/);
|
|
76009
75954
|
if (!match2) {
|
|
@@ -76017,8 +75962,8 @@ function extractNativeTriggerInfo(p) {
|
|
|
76017
75962
|
};
|
|
76018
75963
|
}
|
|
76019
75964
|
function removePathPrefix(str, prefix) {
|
|
76020
|
-
const normalizedStr =
|
|
76021
|
-
const normalizedPrefix =
|
|
75965
|
+
const normalizedStr = path19.normalize(str).replaceAll(SEP19, "/");
|
|
75966
|
+
const normalizedPrefix = path19.normalize(prefix).replaceAll(SEP19, "/");
|
|
76022
75967
|
if (normalizedStr === normalizedPrefix) {
|
|
76023
75968
|
return "";
|
|
76024
75969
|
}
|
|
@@ -76191,7 +76136,7 @@ var init_local_path_scripts = __esm(async () => {
|
|
|
76191
76136
|
|
|
76192
76137
|
// src/commands/flow/flow.ts
|
|
76193
76138
|
import { dirname as dirname17, sep as SEP20 } from "node:path";
|
|
76194
|
-
import { mkdirSync as mkdirSync5, writeFileSync as
|
|
76139
|
+
import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync6 } from "node:fs";
|
|
76195
76140
|
function normalizeOptionalString(value) {
|
|
76196
76141
|
return typeof value === "string" && value.trim() === "" ? undefined : value ?? undefined;
|
|
76197
76142
|
}
|
|
@@ -76233,12 +76178,12 @@ function warnAboutLocalPathScriptDivergence(divergence) {
|
|
|
76233
76178
|
const details = [];
|
|
76234
76179
|
if (divergence.changed.length > 0) {
|
|
76235
76180
|
details.push(`These workspace scripts differ from the deployed version:
|
|
76236
|
-
${divergence.changed.map((
|
|
76181
|
+
${divergence.changed.map((path20) => `- ${path20}`).join(`
|
|
76237
76182
|
`)}`);
|
|
76238
76183
|
}
|
|
76239
76184
|
if (divergence.missing.length > 0) {
|
|
76240
76185
|
details.push(`These scripts do not exist in the workspace yet:
|
|
76241
|
-
${divergence.missing.map((
|
|
76186
|
+
${divergence.missing.map((path20) => `- ${path20}`).join(`
|
|
76242
76187
|
`)}`);
|
|
76243
76188
|
}
|
|
76244
76189
|
warn(`Using local PathScript files for flow preview.
|
|
@@ -76263,7 +76208,7 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
|
|
|
76263
76208
|
localPath += SEP20;
|
|
76264
76209
|
}
|
|
76265
76210
|
const localFlow = await yamlParseFile(localPath + "flow.yaml");
|
|
76266
|
-
const fileReader = async (
|
|
76211
|
+
const fileReader = async (path20) => await readTextFile(localPath + path20);
|
|
76267
76212
|
const missingFiles = [];
|
|
76268
76213
|
await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, localPath, SEP20, undefined, missingFiles);
|
|
76269
76214
|
if (localFlow.value.failure_module) {
|
|
@@ -76359,14 +76304,14 @@ async function list12(opts) {
|
|
|
76359
76304
|
new Table2().header(["path", "summary", "edited by"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary, x.edited_by])).render();
|
|
76360
76305
|
}
|
|
76361
76306
|
}
|
|
76362
|
-
async function get9(opts,
|
|
76307
|
+
async function get9(opts, path20) {
|
|
76363
76308
|
if (opts.json)
|
|
76364
76309
|
setSilent(true);
|
|
76365
76310
|
const workspace = await resolveWorkspace(opts);
|
|
76366
76311
|
await requireLogin(opts);
|
|
76367
76312
|
const f = await getFlowByPath({
|
|
76368
76313
|
workspace: workspace.workspaceId,
|
|
76369
|
-
path:
|
|
76314
|
+
path: path20
|
|
76370
76315
|
});
|
|
76371
76316
|
if (opts.json) {
|
|
76372
76317
|
console.log(JSON.stringify(f));
|
|
@@ -76404,7 +76349,7 @@ async function get9(opts, path21) {
|
|
|
76404
76349
|
}
|
|
76405
76350
|
}
|
|
76406
76351
|
}
|
|
76407
|
-
async function run3(opts,
|
|
76352
|
+
async function run3(opts, path20) {
|
|
76408
76353
|
if (opts.silent) {
|
|
76409
76354
|
setSilent(true);
|
|
76410
76355
|
}
|
|
@@ -76415,7 +76360,7 @@ async function run3(opts, path21) {
|
|
|
76415
76360
|
try {
|
|
76416
76361
|
const flow = await getFlowByPath({
|
|
76417
76362
|
workspace: workspace.workspaceId,
|
|
76418
|
-
path:
|
|
76363
|
+
path: path20
|
|
76419
76364
|
});
|
|
76420
76365
|
validateRequiredArgs(flow.schema);
|
|
76421
76366
|
} catch (e) {
|
|
@@ -76426,7 +76371,7 @@ async function run3(opts, path21) {
|
|
|
76426
76371
|
}
|
|
76427
76372
|
const id = await runFlowByPath({
|
|
76428
76373
|
workspace: workspace.workspaceId,
|
|
76429
|
-
path:
|
|
76374
|
+
path: path20,
|
|
76430
76375
|
requestBody: input
|
|
76431
76376
|
});
|
|
76432
76377
|
const stepLabels = new Map;
|
|
@@ -76572,7 +76517,7 @@ async function preview2(opts, flowPath) {
|
|
|
76572
76517
|
flowPath += SEP20;
|
|
76573
76518
|
}
|
|
76574
76519
|
const localFlow = await yamlParseFile(flowPath + "flow.yaml");
|
|
76575
|
-
const fileReader = async (
|
|
76520
|
+
const fileReader = async (path20) => await readTextFile(flowPath + path20);
|
|
76576
76521
|
await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, flowPath, SEP20);
|
|
76577
76522
|
if (localFlow.value.failure_module) {
|
|
76578
76523
|
await replaceInlineScripts([localFlow.value.failure_module], fileReader, exports_log, flowPath, SEP20);
|
|
@@ -76844,7 +76789,7 @@ async function bootstrap2(opts, flowPath) {
|
|
|
76844
76789
|
const newFlowDefinitionYaml = import_yaml36.stringify(newFlowDefinition);
|
|
76845
76790
|
const metadataFile = getMetadataFileName("flow", "yaml");
|
|
76846
76791
|
const flowYamlPath = `${flowDirFullPath}/${metadataFile}`;
|
|
76847
|
-
|
|
76792
|
+
writeFileSync6(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
|
|
76848
76793
|
info(colors.green(`Created flow at ${flowDirFullPath}`));
|
|
76849
76794
|
info("");
|
|
76850
76795
|
info(colors.bold("To preview this flow:"));
|
|
@@ -77083,7 +77028,7 @@ class GitSyncSettingsConverter {
|
|
|
77083
77028
|
}
|
|
77084
77029
|
|
|
77085
77030
|
// src/commands/gitsync-settings/legacySettings.ts
|
|
77086
|
-
import
|
|
77031
|
+
import process18 from "node:process";
|
|
77087
77032
|
async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, workspace, opts, operationName = "operation") {
|
|
77088
77033
|
if (selectedRepo.settings) {
|
|
77089
77034
|
return selectedRepo;
|
|
@@ -77093,7 +77038,7 @@ async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, wo
|
|
|
77093
77038
|
}
|
|
77094
77039
|
const workspaceIncludePath = gitSyncSettings.include_path;
|
|
77095
77040
|
const workspaceIncludeType = gitSyncSettings.include_type;
|
|
77096
|
-
if (!!
|
|
77041
|
+
if (!!process18.stdout.isTTY && !opts.yes) {
|
|
77097
77042
|
console.log(colors.yellow(`
|
|
77098
77043
|
⚠️ Legacy git-sync settings detected!`));
|
|
77099
77044
|
console.log(`
|
|
@@ -77199,7 +77144,7 @@ Repository "${selectedRepo.git_repo_resource_path}" has legacy settings format.`
|
|
|
77199
77144
|
console.error(` wmill gitsync-settings push
|
|
77200
77145
|
`);
|
|
77201
77146
|
}
|
|
77202
|
-
|
|
77147
|
+
process18.exit(1);
|
|
77203
77148
|
}
|
|
77204
77149
|
}
|
|
77205
77150
|
var init_legacySettings = __esm(async () => {
|
|
@@ -77243,8 +77188,8 @@ function outputResult(opts, result) {
|
|
|
77243
77188
|
error(colors.red(result.error));
|
|
77244
77189
|
}
|
|
77245
77190
|
}
|
|
77246
|
-
function normalizeRepoPath(
|
|
77247
|
-
return
|
|
77191
|
+
function normalizeRepoPath(path20) {
|
|
77192
|
+
return path20.replace(/^\$res:/, "");
|
|
77248
77193
|
}
|
|
77249
77194
|
function getOrCreateBranchConfig(config, branchName) {
|
|
77250
77195
|
if (!config.workspaces) {
|
|
@@ -77655,14 +77600,14 @@ var init_pull2 = __esm(async () => {
|
|
|
77655
77600
|
});
|
|
77656
77601
|
|
|
77657
77602
|
// src/commands/gitsync-settings/push.ts
|
|
77658
|
-
import
|
|
77603
|
+
import process19 from "node:process";
|
|
77659
77604
|
async function pushGitSyncSettings(opts) {
|
|
77660
77605
|
try {
|
|
77661
77606
|
await validateBranchConfiguration({ yes: opts.yes });
|
|
77662
77607
|
} catch (error2) {
|
|
77663
77608
|
if (error2 instanceof Error && error2.message.includes("overrides")) {
|
|
77664
77609
|
error(error2.message);
|
|
77665
|
-
|
|
77610
|
+
process19.exit(1);
|
|
77666
77611
|
}
|
|
77667
77612
|
throw error2;
|
|
77668
77613
|
}
|
|
@@ -77672,7 +77617,7 @@ async function pushGitSyncSettings(opts) {
|
|
|
77672
77617
|
const wmillYamlPath = getWmillYamlPath();
|
|
77673
77618
|
if (!wmillYamlPath) {
|
|
77674
77619
|
error(colors.red("No wmill.yaml file found. Please run 'wmill init' first to create the configuration file."));
|
|
77675
|
-
|
|
77620
|
+
process19.exit(1);
|
|
77676
77621
|
}
|
|
77677
77622
|
const localConfig = await readConfigFile();
|
|
77678
77623
|
let settings;
|
|
@@ -77788,7 +77733,7 @@ async function pushGitSyncSettings(opts) {
|
|
|
77788
77733
|
displayChanges(changes);
|
|
77789
77734
|
}
|
|
77790
77735
|
}
|
|
77791
|
-
if (!opts.yes && !!
|
|
77736
|
+
if (!opts.yes && !!process19.stdin.isTTY) {
|
|
77792
77737
|
const confirmed = await Confirm.prompt({
|
|
77793
77738
|
message: `Do you want to apply these changes to the remote?`,
|
|
77794
77739
|
default: true
|
|
@@ -84485,12 +84430,14 @@ List all queues with their metrics
|
|
|
84485
84430
|
|
|
84486
84431
|
### refresh
|
|
84487
84432
|
|
|
84488
|
-
Refresh wmill-managed project files (AGENTS.cli.md
|
|
84433
|
+
Refresh wmill-managed project files (AGENTS.cli.md, skills, tsconfig.wmill.json)
|
|
84489
84434
|
|
|
84490
84435
|
**Subcommands:**
|
|
84491
84436
|
|
|
84492
84437
|
- \`refresh prompts\` - Refresh AGENTS.cli.md and managed skills. User-owned AGENTS.md and CLAUDE.md are never overwritten unless you opt in.
|
|
84493
|
-
- \`--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).
|
|
84494
84441
|
|
|
84495
84442
|
### resource
|
|
84496
84443
|
|
|
@@ -86132,12 +86079,12 @@ async function warnIfPromptsStale(opts) {
|
|
|
86132
86079
|
if (opts?.argv && !shouldRunFreshnessCheck(opts.argv))
|
|
86133
86080
|
return;
|
|
86134
86081
|
const cwd = opts?.cwd ?? process.cwd();
|
|
86135
|
-
const
|
|
86136
|
-
if (!await stat18(
|
|
86082
|
+
const path21 = `${cwd}/AGENTS.cli.md`;
|
|
86083
|
+
if (!await stat18(path21).catch(() => null))
|
|
86137
86084
|
return;
|
|
86138
86085
|
let content;
|
|
86139
86086
|
try {
|
|
86140
|
-
content = await readTextFile(
|
|
86087
|
+
content = await readTextFile(path21);
|
|
86141
86088
|
} catch {
|
|
86142
86089
|
return;
|
|
86143
86090
|
}
|
|
@@ -86174,6 +86121,283 @@ var init_freshness = __esm(async () => {
|
|
|
86174
86121
|
PROMPTS_HASH_REGEX = /<!-- wmill-prompts-hash: ([0-9a-f]{12}) -->/;
|
|
86175
86122
|
});
|
|
86176
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
|
+
|
|
86177
86401
|
// src/main.ts
|
|
86178
86402
|
init_mod3();
|
|
86179
86403
|
|
|
@@ -87550,7 +87774,7 @@ await __promiseAll([
|
|
|
87550
87774
|
init_context()
|
|
87551
87775
|
]);
|
|
87552
87776
|
var import_yaml39 = __toESM(require_dist(), 1);
|
|
87553
|
-
import { existsSync as
|
|
87777
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
87554
87778
|
import { writeFile as writeFile19 } from "node:fs/promises";
|
|
87555
87779
|
import { dirname as dirname18, join as join18 } from "node:path";
|
|
87556
87780
|
var PROTECTION_RULES_FILENAME = "protection-rules.yaml";
|
|
@@ -87560,17 +87784,17 @@ function getProtectionRulesPath() {
|
|
|
87560
87784
|
return null;
|
|
87561
87785
|
return join18(dirname18(wmillPath), PROTECTION_RULES_FILENAME);
|
|
87562
87786
|
}
|
|
87563
|
-
async function readProtectionRulesFile(
|
|
87564
|
-
if (!
|
|
87787
|
+
async function readProtectionRulesFile(path20) {
|
|
87788
|
+
if (!existsSync9(path20))
|
|
87565
87789
|
return {};
|
|
87566
|
-
const parsed = await yamlParseFile(
|
|
87790
|
+
const parsed = await yamlParseFile(path20);
|
|
87567
87791
|
return parsed ?? {};
|
|
87568
87792
|
}
|
|
87569
|
-
async function writeProtectionRulesFile(
|
|
87793
|
+
async function writeProtectionRulesFile(path20, data3) {
|
|
87570
87794
|
const sorted = {};
|
|
87571
87795
|
for (const k of Object.keys(data3).sort())
|
|
87572
87796
|
sorted[k] = data3[k];
|
|
87573
|
-
await writeFile19(
|
|
87797
|
+
await writeFile19(path20, import_yaml39.stringify(sorted, yamlOptions), "utf-8");
|
|
87574
87798
|
}
|
|
87575
87799
|
|
|
87576
87800
|
class WorkspaceResolver {
|
|
@@ -87615,7 +87839,7 @@ async function configureClientForWorkspace(opts, ws, resolver) {
|
|
|
87615
87839
|
// src/commands/protection-rules/utils.ts
|
|
87616
87840
|
init_colors2();
|
|
87617
87841
|
init_log();
|
|
87618
|
-
import
|
|
87842
|
+
import process20 from "node:process";
|
|
87619
87843
|
function outputResult2(opts, result) {
|
|
87620
87844
|
if (opts.jsonOutput) {
|
|
87621
87845
|
console.log(JSON.stringify(result));
|
|
@@ -87627,7 +87851,7 @@ function outputResult2(opts, result) {
|
|
|
87627
87851
|
}
|
|
87628
87852
|
function fail(opts, result) {
|
|
87629
87853
|
outputResult2(opts, { ...result, success: false });
|
|
87630
|
-
|
|
87854
|
+
process20.exit(1);
|
|
87631
87855
|
}
|
|
87632
87856
|
function describeEntry(entry) {
|
|
87633
87857
|
const n = ProtectionRulesConverter.normalizeEntry(entry);
|
|
@@ -87771,8 +87995,8 @@ await __promiseAll([
|
|
|
87771
87995
|
init_confirm(),
|
|
87772
87996
|
init_conf()
|
|
87773
87997
|
]);
|
|
87774
|
-
import
|
|
87775
|
-
import { existsSync as
|
|
87998
|
+
import process21 from "node:process";
|
|
87999
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
87776
88000
|
async function pushProtectionRules(opts, workspaceArg) {
|
|
87777
88001
|
if (opts.jsonOutput)
|
|
87778
88002
|
setSilent(true);
|
|
@@ -87782,7 +88006,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87782
88006
|
error: "No wmill.yaml found. Run 'wmill init' first — protection-rules.yaml lives next to it."
|
|
87783
88007
|
});
|
|
87784
88008
|
}
|
|
87785
|
-
if (!
|
|
88009
|
+
if (!existsSync10(prPath)) {
|
|
87786
88010
|
fail(opts, {
|
|
87787
88011
|
error: "No protection-rules.yaml found. Run 'wmill protection-rules pull' first."
|
|
87788
88012
|
});
|
|
@@ -87852,7 +88076,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87852
88076
|
workspaces: Object.fromEntries(wsPlans.map((w) => [w.ws, structuredPlan(w.plan)]))
|
|
87853
88077
|
}));
|
|
87854
88078
|
if (hadError)
|
|
87855
|
-
|
|
88079
|
+
process21.exit(1);
|
|
87856
88080
|
return;
|
|
87857
88081
|
}
|
|
87858
88082
|
if (!opts.jsonOutput) {
|
|
@@ -87866,7 +88090,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87866
88090
|
error: "One or more workspaces failed (see errors above); the rest are in sync",
|
|
87867
88091
|
partialFailure: true
|
|
87868
88092
|
});
|
|
87869
|
-
|
|
88093
|
+
process21.exit(1);
|
|
87870
88094
|
}
|
|
87871
88095
|
if (!opts.dryRun) {
|
|
87872
88096
|
outputResult2(opts, {
|
|
@@ -87878,7 +88102,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87878
88102
|
}
|
|
87879
88103
|
if (opts.dryRun) {
|
|
87880
88104
|
if (hadError)
|
|
87881
|
-
|
|
88105
|
+
process21.exit(1);
|
|
87882
88106
|
return;
|
|
87883
88107
|
}
|
|
87884
88108
|
for (const w of wsPlans) {
|
|
@@ -87887,7 +88111,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87887
88111
|
}
|
|
87888
88112
|
}
|
|
87889
88113
|
const totalDeletes = changed.reduce((n, w) => n + w.plan.toDelete.length, 0);
|
|
87890
|
-
if (!opts.yes && !!
|
|
88114
|
+
if (!opts.yes && !!process21.stdin.isTTY) {
|
|
87891
88115
|
const confirmed = await Confirm.prompt({
|
|
87892
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)?`,
|
|
87893
88117
|
default: totalDeletes === 0
|
|
@@ -87949,7 +88173,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
87949
88173
|
partialFailure: true,
|
|
87950
88174
|
...applied
|
|
87951
88175
|
});
|
|
87952
|
-
|
|
88176
|
+
process21.exit(1);
|
|
87953
88177
|
}
|
|
87954
88178
|
outputResult2(opts, {
|
|
87955
88179
|
success: true,
|
|
@@ -88079,7 +88303,7 @@ import * as http3 from "node:http";
|
|
|
88079
88303
|
import * as https from "node:https";
|
|
88080
88304
|
import { access, readdir as readdir10, realpath, stat as stat17, unlink, writeFile as writeFile20 } from "node:fs/promises";
|
|
88081
88305
|
import { watch as watch2 } from "node:fs";
|
|
88082
|
-
import * as
|
|
88306
|
+
import * as path20 from "node:path";
|
|
88083
88307
|
import * as fs14 from "node:fs";
|
|
88084
88308
|
|
|
88085
88309
|
// src/commands/dev/pathscript-restore.ts
|
|
@@ -88175,7 +88399,7 @@ var PORT = 3001;
|
|
|
88175
88399
|
var FLOW_SUFFIXES = [".flow", "__flow"];
|
|
88176
88400
|
var APP_SUFFIXES = [".app", "__app", ".raw_app", "__raw_app"];
|
|
88177
88401
|
var INLINE_SCRIPT_EXTS = new Set([
|
|
88178
|
-
...exts.map((e) =>
|
|
88402
|
+
...exts.map((e) => path20.extname("x" + e)).filter((e) => e !== ".yml"),
|
|
88179
88403
|
".js"
|
|
88180
88404
|
]);
|
|
88181
88405
|
function stripFolderSuffix(rel, suffixes) {
|
|
@@ -88216,13 +88440,13 @@ async function listWorkspacePaths() {
|
|
|
88216
88440
|
if (entry.name.startsWith(".") || entry.name === "node_modules")
|
|
88217
88441
|
continue;
|
|
88218
88442
|
const childRel = rel ? `${rel}/${entry.name}` : entry.name;
|
|
88219
|
-
const childAbs =
|
|
88443
|
+
const childAbs = path20.join(dir, entry.name);
|
|
88220
88444
|
if (entry.isDirectory()) {
|
|
88221
88445
|
if (isFlowFolderName(entry.name)) {
|
|
88222
88446
|
items.push({
|
|
88223
88447
|
path: stripFolderSuffix(childRel, FLOW_SUFFIXES),
|
|
88224
88448
|
kind: "flow",
|
|
88225
|
-
_metaPath:
|
|
88449
|
+
_metaPath: path20.join(childAbs, "flow.yaml")
|
|
88226
88450
|
});
|
|
88227
88451
|
continue;
|
|
88228
88452
|
}
|
|
@@ -88261,25 +88485,25 @@ async function listWorkspacePaths() {
|
|
|
88261
88485
|
async function dev2(opts) {
|
|
88262
88486
|
if (!opts.path) {
|
|
88263
88487
|
const cwd = process.cwd();
|
|
88264
|
-
const cwdBasename =
|
|
88488
|
+
const cwdBasename = path20.basename(cwd);
|
|
88265
88489
|
await loadNonDottedPathsSetting();
|
|
88266
88490
|
if (isFlowFolderName(cwdBasename)) {
|
|
88267
88491
|
GLOBAL_CONFIG_OPT.noCdToRoot = true;
|
|
88268
88492
|
let searchDir = cwd;
|
|
88269
88493
|
let workspaceRoot;
|
|
88270
88494
|
while (true) {
|
|
88271
|
-
const wmillYaml =
|
|
88495
|
+
const wmillYaml = path20.join(searchDir, "wmill.yaml");
|
|
88272
88496
|
if (fs14.existsSync(wmillYaml)) {
|
|
88273
88497
|
workspaceRoot = searchDir;
|
|
88274
88498
|
break;
|
|
88275
88499
|
}
|
|
88276
|
-
const parentDir =
|
|
88500
|
+
const parentDir = path20.dirname(searchDir);
|
|
88277
88501
|
if (parentDir === searchDir)
|
|
88278
88502
|
break;
|
|
88279
88503
|
searchDir = parentDir;
|
|
88280
88504
|
}
|
|
88281
88505
|
if (workspaceRoot) {
|
|
88282
|
-
const relPath =
|
|
88506
|
+
const relPath = path20.relative(workspaceRoot, cwd).replaceAll("\\", "/");
|
|
88283
88507
|
opts.path = stripFolderSuffix(relPath, FLOW_SUFFIXES);
|
|
88284
88508
|
info(`Detected flow folder, path: ${opts.path}`);
|
|
88285
88509
|
process.chdir(workspaceRoot);
|
|
@@ -88344,7 +88568,7 @@ async function dev2(opts) {
|
|
|
88344
88568
|
return;
|
|
88345
88569
|
const wmFlowPath = stripFolderSuffix(localPath.replace(/\/$/, ""), FLOW_SUFFIXES);
|
|
88346
88570
|
const localFlow = await yamlParseFile(localPath + "flow.yaml");
|
|
88347
|
-
await replaceInlineScripts(localFlow.value.modules, async (
|
|
88571
|
+
await replaceInlineScripts(localFlow.value.modules, async (path21) => await readTextFile(localPath + path21), exports_log, localPath, SEP21, undefined);
|
|
88348
88572
|
snapshotPathScripts(localFlow.value);
|
|
88349
88573
|
const localScriptReader = createPreviewLocalScriptReader({
|
|
88350
88574
|
exts,
|
|
@@ -88506,7 +88730,7 @@ async function dev2(opts) {
|
|
|
88506
88730
|
for (const file of dirFiles) {
|
|
88507
88731
|
if (file === "flow.yaml" || file === "flow.json" || file.startsWith("."))
|
|
88508
88732
|
continue;
|
|
88509
|
-
if (!INLINE_SCRIPT_EXTS.has(
|
|
88733
|
+
if (!INLINE_SCRIPT_EXTS.has(path20.extname(file)))
|
|
88510
88734
|
continue;
|
|
88511
88735
|
if (!extractedPaths.has(file)) {
|
|
88512
88736
|
await unlink(flowDir + file);
|
|
@@ -89696,7 +89920,8 @@ async function refreshPrompts(opts) {
|
|
|
89696
89920
|
const config = await readConfigFile2();
|
|
89697
89921
|
nonDottedPaths = config.nonDottedPaths ?? false;
|
|
89698
89922
|
} catch {}
|
|
89699
|
-
const
|
|
89923
|
+
const assumeYes = opts.yes === true;
|
|
89924
|
+
const interactive = process.stdin.isTTY && !assumeYes;
|
|
89700
89925
|
try {
|
|
89701
89926
|
const result = await writeAiGuidanceFiles({
|
|
89702
89927
|
targetDir: ".",
|
|
@@ -89705,9 +89930,11 @@ async function refreshPrompts(opts) {
|
|
|
89705
89930
|
agentsSourcePath: process.env[WMILL_INIT_AI_AGENTS_SOURCE_ENV],
|
|
89706
89931
|
claudeSourcePath: process.env[WMILL_INIT_AI_CLAUDE_SOURCE_ENV],
|
|
89707
89932
|
resolveAgentsMdMigration: async () => {
|
|
89708
|
-
if (
|
|
89933
|
+
if (assumeYes)
|
|
89709
89934
|
return "append";
|
|
89710
|
-
|
|
89935
|
+
if (interactive)
|
|
89936
|
+
return await promptMigration();
|
|
89937
|
+
return "skip";
|
|
89711
89938
|
}
|
|
89712
89939
|
});
|
|
89713
89940
|
info(colors.green("Refreshed AGENTS.cli.md"));
|
|
@@ -89782,10 +90009,11 @@ async function promptMigration() {
|
|
|
89782
90009
|
async function promptsAction(opts) {
|
|
89783
90010
|
await refreshPrompts({ yes: opts.yes === true });
|
|
89784
90011
|
}
|
|
89785
|
-
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);
|
|
89786
90013
|
var prompts_default = command29;
|
|
89787
90014
|
|
|
89788
90015
|
// src/commands/init/init.ts
|
|
90016
|
+
await init_tsconfig();
|
|
89789
90017
|
async function initAction(opts) {
|
|
89790
90018
|
let didBindWorkspace = false;
|
|
89791
90019
|
let boundProfile;
|
|
@@ -89930,6 +90158,11 @@ async function initAction(opts) {
|
|
|
89930
90158
|
}
|
|
89931
90159
|
}
|
|
89932
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
|
+
}
|
|
89933
90166
|
if (didBindWorkspace && boundProfile) {
|
|
89934
90167
|
try {
|
|
89935
90168
|
const rtOpts = { ...opts };
|
|
@@ -89942,13 +90175,14 @@ async function initAction(opts) {
|
|
|
89942
90175
|
info(colors.gray("Skipped resource type namespace generation (no workspace bound). Run 'wmill workspace bind' then 'wmill init' to generate it."));
|
|
89943
90176
|
}
|
|
89944
90177
|
}
|
|
89945
|
-
var
|
|
89946
|
-
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;
|
|
89947
90180
|
|
|
89948
90181
|
// src/commands/refresh/refresh.ts
|
|
89949
90182
|
init_mod3();
|
|
89950
|
-
|
|
89951
|
-
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;
|
|
89952
90186
|
|
|
89953
90187
|
// src/main.ts
|
|
89954
90188
|
init_freshness_gate();
|
|
@@ -90117,8 +90351,8 @@ Warning: Found ${workers.length} active worker(s) on the instance.`));
|
|
|
90117
90351
|
}
|
|
90118
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);
|
|
90119
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);
|
|
90120
|
-
var
|
|
90121
|
-
var jobs_default =
|
|
90354
|
+
var command33 = new Command().description("Manage jobs (import/export)").command("pull", pull3).command("push", push12);
|
|
90355
|
+
var jobs_default = command33;
|
|
90122
90356
|
|
|
90123
90357
|
// src/commands/job/job.ts
|
|
90124
90358
|
init_mod3();
|
|
@@ -90479,8 +90713,8 @@ async function restart(opts, id) {
|
|
|
90479
90713
|
console.log(newId);
|
|
90480
90714
|
}
|
|
90481
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");
|
|
90482
|
-
var
|
|
90483
|
-
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;
|
|
90484
90718
|
|
|
90485
90719
|
// src/commands/group/group.ts
|
|
90486
90720
|
init_mod3();
|
|
@@ -90579,8 +90813,8 @@ async function removeUser(opts, name, username) {
|
|
|
90579
90813
|
});
|
|
90580
90814
|
info(colors.green(`User '${username}' removed from group '${name}'.`));
|
|
90581
90815
|
}
|
|
90582
|
-
var
|
|
90583
|
-
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;
|
|
90584
90818
|
|
|
90585
90819
|
// src/commands/audit/audit.ts
|
|
90586
90820
|
init_mod3();
|
|
@@ -90657,8 +90891,8 @@ async function get12(opts, id) {
|
|
|
90657
90891
|
}
|
|
90658
90892
|
}
|
|
90659
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)");
|
|
90660
|
-
var
|
|
90661
|
-
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;
|
|
90662
90896
|
|
|
90663
90897
|
// src/commands/token/token.ts
|
|
90664
90898
|
init_mod3();
|
|
@@ -90712,8 +90946,8 @@ async function deleteToken2(opts, tokenPrefix) {
|
|
|
90712
90946
|
await deleteToken({ tokenPrefix });
|
|
90713
90947
|
info(colors.green(`Token with prefix '${tokenPrefix}' deleted.`));
|
|
90714
90948
|
}
|
|
90715
|
-
var
|
|
90716
|
-
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;
|
|
90717
90951
|
|
|
90718
90952
|
// src/main.ts
|
|
90719
90953
|
await init_generate_metadata();
|
|
@@ -90793,8 +91027,8 @@ ${await res.text()}`);
|
|
|
90793
91027
|
console.log();
|
|
90794
91028
|
}
|
|
90795
91029
|
}
|
|
90796
|
-
var
|
|
90797
|
-
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;
|
|
90798
91032
|
|
|
90799
91033
|
// src/commands/config/config.ts
|
|
90800
91034
|
init_mod3();
|
|
@@ -90864,8 +91098,8 @@ async function migrateAction() {
|
|
|
90864
91098
|
info(` Also removed additional legacy keys: ${legacyKeys.slice(1).join(", ")}`);
|
|
90865
91099
|
}
|
|
90866
91100
|
}
|
|
90867
|
-
var
|
|
90868
|
-
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;
|
|
90869
91103
|
|
|
90870
91104
|
// src/commands/datatable/datatable.ts
|
|
90871
91105
|
init_mod3();
|
|
@@ -92779,8 +93013,8 @@ async function serve2(opts) {
|
|
|
92779
93013
|
async function psql2(opts) {
|
|
92780
93014
|
await psql(opts);
|
|
92781
93015
|
}
|
|
92782
|
-
var
|
|
92783
|
-
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;
|
|
92784
93018
|
|
|
92785
93019
|
// src/commands/ducklake/ducklake.ts
|
|
92786
93020
|
init_mod3();
|
|
@@ -92810,8 +93044,8 @@ async function run5(opts, sql) {
|
|
|
92810
93044
|
const name = opts.name ?? DEFAULT_DUCKLAKE_NAME;
|
|
92811
93045
|
await runCatalogQuery(opts, "ducklake", name, sql);
|
|
92812
93046
|
}
|
|
92813
|
-
var
|
|
92814
|
-
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;
|
|
92815
93049
|
|
|
92816
93050
|
// src/commands/object-storage/object-storage.ts
|
|
92817
93051
|
init_mod3();
|
|
@@ -93012,12 +93246,11 @@ async function preview3(opts, fileKey) {
|
|
|
93012
93246
|
`);
|
|
93013
93247
|
}
|
|
93014
93248
|
}
|
|
93015
|
-
var
|
|
93016
|
-
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;
|
|
93017
93251
|
|
|
93018
93252
|
// src/main.ts
|
|
93019
93253
|
await init_context();
|
|
93020
|
-
var VERSION = "1.714.1";
|
|
93021
93254
|
async function checkVersionSafe(cmd) {
|
|
93022
93255
|
const mainCommand = cmd.getMainCommand();
|
|
93023
93256
|
const upgradeCommand = mainCommand.getCommand("upgrade");
|
|
@@ -93034,7 +93267,7 @@ async function checkVersionSafe(cmd) {
|
|
|
93034
93267
|
}
|
|
93035
93268
|
mainCommand.version(`${currentVersion} (New version available: ${latestVersion}. Run '${mainCommand.getName()} upgrade' to upgrade to the latest version!)`);
|
|
93036
93269
|
}
|
|
93037
|
-
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.", {
|
|
93038
93271
|
action: async function() {
|
|
93039
93272
|
const self2 = this;
|
|
93040
93273
|
const long = self2.getRawArgs().includes(`--${self2.getHelpOption()?.name}`);
|
|
@@ -93076,20 +93309,20 @@ var command42 = new Command().name("wmill").action(() => info(`Welcome to Windmi
|
|
|
93076
93309
|
error(e2);
|
|
93077
93310
|
info("Try running with sudo and otherwise check the result of the command: npm uninstall windmill-cli && npm install -g windmill-cli");
|
|
93078
93311
|
})).command("completions", new Command().description("Generate shell completions.").command("bash", new Command().description("Generate bash completions.").action(() => {
|
|
93079
|
-
process.stdout.write(generateShellCompletions(
|
|
93312
|
+
process.stdout.write(generateShellCompletions(command43, "bash") + `
|
|
93080
93313
|
`);
|
|
93081
93314
|
})).command("zsh", new Command().description("Generate zsh completions.").action(() => {
|
|
93082
|
-
process.stdout.write(generateShellCompletions(
|
|
93315
|
+
process.stdout.write(generateShellCompletions(command43, "zsh") + `
|
|
93083
93316
|
`);
|
|
93084
93317
|
})).command("fish", new Command().description("Generate fish completions.").action(() => {
|
|
93085
|
-
process.stdout.write(generateShellCompletions(
|
|
93318
|
+
process.stdout.write(generateShellCompletions(command43, "fish") + `
|
|
93086
93319
|
`);
|
|
93087
93320
|
})));
|
|
93088
93321
|
async function main2() {
|
|
93089
93322
|
try {
|
|
93090
93323
|
const args = process.argv.slice(2);
|
|
93091
93324
|
if (args.length === 0) {
|
|
93092
|
-
|
|
93325
|
+
command43.showHelp();
|
|
93093
93326
|
}
|
|
93094
93327
|
const LOG_LEVEL = args.includes("--verbose") || args.includes("--debug") ? "DEBUG" : "INFO";
|
|
93095
93328
|
setShowDiffs(args.includes("--show-diffs"));
|
|
@@ -93106,8 +93339,10 @@ async function main2() {
|
|
|
93106
93339
|
if (shouldRunFreshnessCheck(process.argv)) {
|
|
93107
93340
|
const { warnIfPromptsStale: warnIfPromptsStale2 } = await init_freshness().then(() => exports_freshness);
|
|
93108
93341
|
await warnIfPromptsStale2({ argv: process.argv }).catch(() => {});
|
|
93342
|
+
const { warnIfTsconfigStale: warnIfTsconfigStale2 } = await init_tsconfig().then(() => exports_tsconfig);
|
|
93343
|
+
await warnIfTsconfigStale2().catch(() => {});
|
|
93109
93344
|
}
|
|
93110
|
-
await
|
|
93345
|
+
await command43.parse(args);
|
|
93111
93346
|
} catch (e2) {
|
|
93112
93347
|
if (e2 && typeof e2 === "object" && "name" in e2 && e2.name === "ApiError") {
|
|
93113
93348
|
const body = e2.body;
|
|
@@ -93143,7 +93378,7 @@ if (isMain()) {
|
|
|
93143
93378
|
process.stdin.destroy();
|
|
93144
93379
|
});
|
|
93145
93380
|
}
|
|
93146
|
-
var main_default =
|
|
93381
|
+
var main_default = command43;
|
|
93147
93382
|
export {
|
|
93148
93383
|
add as workspaceAdd,
|
|
93149
93384
|
workspace_default as workspace,
|