windmill-cli 1.692.0 → 1.693.1
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 +691 -458
- package/package.json +1 -1
package/esm/main.js
CHANGED
|
@@ -16710,7 +16710,7 @@ var init_OpenAPI = __esm(() => {
|
|
|
16710
16710
|
PASSWORD: undefined,
|
|
16711
16711
|
TOKEN: getEnv3("WM_TOKEN"),
|
|
16712
16712
|
USERNAME: undefined,
|
|
16713
|
-
VERSION: "1.
|
|
16713
|
+
VERSION: "1.693.1",
|
|
16714
16714
|
WITH_CREDENTIALS: true,
|
|
16715
16715
|
interceptors: {
|
|
16716
16716
|
request: new Interceptors,
|
|
@@ -16993,7 +16993,9 @@ __export(exports_services_gen, {
|
|
|
16993
16993
|
updateVariable: () => updateVariable,
|
|
16994
16994
|
updateUser: () => updateUser,
|
|
16995
16995
|
updateTutorialProgress: () => updateTutorialProgress,
|
|
16996
|
+
updateTokenScopes: () => updateTokenScopes,
|
|
16996
16997
|
updateSqsTrigger: () => updateSqsTrigger,
|
|
16998
|
+
updateSharedUi: () => updateSharedUi,
|
|
16997
16999
|
updateScriptHistory: () => updateScriptHistory,
|
|
16998
17000
|
updateSchedule: () => updateSchedule,
|
|
16999
17001
|
updateResourceValue: () => updateResourceValue,
|
|
@@ -17191,6 +17193,7 @@ __export(exports_services_gen, {
|
|
|
17191
17193
|
listTokens: () => listTokens,
|
|
17192
17194
|
listStoredFiles: () => listStoredFiles,
|
|
17193
17195
|
listSqsTriggers: () => listSqsTriggers,
|
|
17196
|
+
listSharedUi: () => listSharedUi,
|
|
17194
17197
|
listSelectedJobGroups: () => listSelectedJobGroups,
|
|
17195
17198
|
listSearchScript: () => listSearchScript,
|
|
17196
17199
|
listSearchResource: () => listSearchResource,
|
|
@@ -17257,6 +17260,7 @@ __export(exports_services_gen, {
|
|
|
17257
17260
|
listDeploymentRequestEligibleDeployers: () => listDeploymentRequestEligibleDeployers,
|
|
17258
17261
|
listDedicatedWithDeps: () => listDedicatedWithDeps,
|
|
17259
17262
|
listDataTables: () => listDataTables,
|
|
17263
|
+
listDataTableTables: () => listDataTableTables,
|
|
17260
17264
|
listDataTableSchemas: () => listDataTableSchemas,
|
|
17261
17265
|
listCustomInstanceDbs: () => listCustomInstanceDbs,
|
|
17262
17266
|
listConversationMessages: () => listConversationMessages,
|
|
@@ -17334,6 +17338,8 @@ __export(exports_services_gen, {
|
|
|
17334
17338
|
getStartedAtByIds: () => getStartedAtByIds,
|
|
17335
17339
|
getSqsTrigger: () => getSqsTrigger,
|
|
17336
17340
|
getSlackApprovalPayload: () => getSlackApprovalPayload,
|
|
17341
|
+
getSharedUiVersion: () => getSharedUiVersion,
|
|
17342
|
+
getSharedUi: () => getSharedUi,
|
|
17337
17343
|
getSettings: () => getSettings,
|
|
17338
17344
|
getSecondaryStorageNames: () => getSecondaryStorageNames,
|
|
17339
17345
|
getScriptLatestVersion: () => getScriptLatestVersion,
|
|
@@ -17442,6 +17448,7 @@ __export(exports_services_gen, {
|
|
|
17442
17448
|
getDefaultScripts: () => getDefaultScripts,
|
|
17443
17449
|
getDbClock: () => getDbClock,
|
|
17444
17450
|
getDatatableFullSchema: () => getDatatableFullSchema,
|
|
17451
|
+
getDataTableTableSchema: () => getDataTableTableSchema,
|
|
17445
17452
|
getCustomTagsForWorkspace: () => getCustomTagsForWorkspace,
|
|
17446
17453
|
getCustomTags: () => getCustomTags,
|
|
17447
17454
|
getCurrentEmail: () => getCurrentEmail,
|
|
@@ -18994,6 +19001,27 @@ var backendVersion = () => {
|
|
|
18994
19001
|
workspace: data3.workspace
|
|
18995
19002
|
}
|
|
18996
19003
|
});
|
|
19004
|
+
}, listDataTableTables = (data3) => {
|
|
19005
|
+
return request(OpenAPI, {
|
|
19006
|
+
method: "GET",
|
|
19007
|
+
url: "/w/{workspace}/workspaces/list_datatable_tables",
|
|
19008
|
+
path: {
|
|
19009
|
+
workspace: data3.workspace
|
|
19010
|
+
}
|
|
19011
|
+
});
|
|
19012
|
+
}, getDataTableTableSchema = (data3) => {
|
|
19013
|
+
return request(OpenAPI, {
|
|
19014
|
+
method: "GET",
|
|
19015
|
+
url: "/w/{workspace}/workspaces/get_datatable_table_schema",
|
|
19016
|
+
path: {
|
|
19017
|
+
workspace: data3.workspace
|
|
19018
|
+
},
|
|
19019
|
+
query: {
|
|
19020
|
+
datatable_name: data3.datatableName,
|
|
19021
|
+
schema_name: data3.schemaName,
|
|
19022
|
+
table_name: data3.tableName
|
|
19023
|
+
}
|
|
19024
|
+
});
|
|
18997
19025
|
}, editDucklakeConfig = (data3) => {
|
|
18998
19026
|
return request(OpenAPI, {
|
|
18999
19027
|
method: "POST",
|
|
@@ -19252,6 +19280,16 @@ var backendVersion = () => {
|
|
|
19252
19280
|
token_prefix: data3.tokenPrefix
|
|
19253
19281
|
}
|
|
19254
19282
|
});
|
|
19283
|
+
}, updateTokenScopes = (data3) => {
|
|
19284
|
+
return request(OpenAPI, {
|
|
19285
|
+
method: "POST",
|
|
19286
|
+
url: "/users/tokens/update_scopes/{token_prefix}",
|
|
19287
|
+
path: {
|
|
19288
|
+
token_prefix: data3.tokenPrefix
|
|
19289
|
+
},
|
|
19290
|
+
body: data3.requestBody,
|
|
19291
|
+
mediaType: "application/json"
|
|
19292
|
+
});
|
|
19255
19293
|
}, listTokens = (data3 = {}) => {
|
|
19256
19294
|
return request(OpenAPI, {
|
|
19257
19295
|
method: "GET",
|
|
@@ -21040,6 +21078,40 @@ var backendVersion = () => {
|
|
|
21040
21078
|
label: data3.label
|
|
21041
21079
|
}
|
|
21042
21080
|
});
|
|
21081
|
+
}, getSharedUi = (data3) => {
|
|
21082
|
+
return request(OpenAPI, {
|
|
21083
|
+
method: "GET",
|
|
21084
|
+
url: "/w/{workspace}/shared_ui/get",
|
|
21085
|
+
path: {
|
|
21086
|
+
workspace: data3.workspace
|
|
21087
|
+
}
|
|
21088
|
+
});
|
|
21089
|
+
}, listSharedUi = (data3) => {
|
|
21090
|
+
return request(OpenAPI, {
|
|
21091
|
+
method: "GET",
|
|
21092
|
+
url: "/w/{workspace}/shared_ui/list",
|
|
21093
|
+
path: {
|
|
21094
|
+
workspace: data3.workspace
|
|
21095
|
+
}
|
|
21096
|
+
});
|
|
21097
|
+
}, getSharedUiVersion = (data3) => {
|
|
21098
|
+
return request(OpenAPI, {
|
|
21099
|
+
method: "GET",
|
|
21100
|
+
url: "/w/{workspace}/shared_ui/version",
|
|
21101
|
+
path: {
|
|
21102
|
+
workspace: data3.workspace
|
|
21103
|
+
}
|
|
21104
|
+
});
|
|
21105
|
+
}, updateSharedUi = (data3) => {
|
|
21106
|
+
return request(OpenAPI, {
|
|
21107
|
+
method: "PUT",
|
|
21108
|
+
url: "/w/{workspace}/shared_ui",
|
|
21109
|
+
path: {
|
|
21110
|
+
workspace: data3.workspace
|
|
21111
|
+
},
|
|
21112
|
+
body: data3.requestBody,
|
|
21113
|
+
mediaType: "application/json"
|
|
21114
|
+
});
|
|
21043
21115
|
}, getRawAppData = (data3) => {
|
|
21044
21116
|
return request(OpenAPI, {
|
|
21045
21117
|
method: "GET",
|
|
@@ -33279,6 +33351,35 @@ async function createBundle(options = {}) {
|
|
|
33279
33351
|
});
|
|
33280
33352
|
}
|
|
33281
33353
|
};
|
|
33354
|
+
const sharedUiPlugins = [];
|
|
33355
|
+
if (options.sharedUiDir && fs7.existsSync(options.sharedUiDir)) {
|
|
33356
|
+
const sharedUiDir = options.sharedUiDir;
|
|
33357
|
+
sharedUiPlugins.push({
|
|
33358
|
+
name: "wmill-shared-ui",
|
|
33359
|
+
setup(build) {
|
|
33360
|
+
build.onResolve({ filter: /^\/ui\// }, (args) => {
|
|
33361
|
+
const rel = args.path.slice("/ui/".length);
|
|
33362
|
+
const candidates = [rel];
|
|
33363
|
+
if (!path5.extname(rel)) {
|
|
33364
|
+
candidates.push(rel + ".tsx", rel + ".ts", rel + ".jsx", rel + ".js", rel + ".css", path5.join(rel, "index.tsx"), path5.join(rel, "index.ts"));
|
|
33365
|
+
}
|
|
33366
|
+
for (const c of candidates) {
|
|
33367
|
+
const full = path5.join(sharedUiDir, c);
|
|
33368
|
+
if (fs7.existsSync(full)) {
|
|
33369
|
+
return { path: full };
|
|
33370
|
+
}
|
|
33371
|
+
}
|
|
33372
|
+
return {
|
|
33373
|
+
errors: [
|
|
33374
|
+
{
|
|
33375
|
+
text: `Could not resolve shared UI import "${args.path}" in ${sharedUiDir}`
|
|
33376
|
+
}
|
|
33377
|
+
]
|
|
33378
|
+
};
|
|
33379
|
+
});
|
|
33380
|
+
}
|
|
33381
|
+
});
|
|
33382
|
+
}
|
|
33282
33383
|
const buildOptions = {
|
|
33283
33384
|
...DEFAULT_BUILD_OPTIONS,
|
|
33284
33385
|
entryPoints: [entryPoint],
|
|
@@ -33288,7 +33389,7 @@ async function createBundle(options = {}) {
|
|
|
33288
33389
|
define: {
|
|
33289
33390
|
"process.env.NODE_ENV": production ? '"production"' : '"development"'
|
|
33290
33391
|
},
|
|
33291
|
-
plugins: [...frameworkPlugins, wmillPlugin]
|
|
33392
|
+
plugins: [...frameworkPlugins, wmillPlugin, ...sharedUiPlugins]
|
|
33292
33393
|
};
|
|
33293
33394
|
info(colors.blue("\uD83D\uDCE6 Building bundle..."));
|
|
33294
33395
|
try {
|
|
@@ -63052,6 +63153,94 @@ var init_lint = __esm(async () => {
|
|
|
63052
63153
|
lint_default = command5;
|
|
63053
63154
|
});
|
|
63054
63155
|
|
|
63156
|
+
// src/commands/shared_ui.ts
|
|
63157
|
+
import * as fs9 from "node:fs";
|
|
63158
|
+
import * as path9 from "node:path";
|
|
63159
|
+
async function readDirRecursive(dir, rel = "", out = {}) {
|
|
63160
|
+
if (!fs9.existsSync(dir))
|
|
63161
|
+
return out;
|
|
63162
|
+
const entries = await fs9.promises.readdir(dir, { withFileTypes: true });
|
|
63163
|
+
for (const entry of entries) {
|
|
63164
|
+
const full = path9.join(dir, entry.name);
|
|
63165
|
+
const r = rel ? rel + "/" + entry.name : entry.name;
|
|
63166
|
+
if (entry.isDirectory()) {
|
|
63167
|
+
await readDirRecursive(full, r, out);
|
|
63168
|
+
} else if (entry.isFile()) {
|
|
63169
|
+
out[r] = await readTextFile(full);
|
|
63170
|
+
}
|
|
63171
|
+
}
|
|
63172
|
+
return out;
|
|
63173
|
+
}
|
|
63174
|
+
async function pushSharedUi(workspace) {
|
|
63175
|
+
const localDir = path9.join(process.cwd(), SHARED_UI_DIR);
|
|
63176
|
+
if (!fs9.existsSync(localDir)) {
|
|
63177
|
+
return false;
|
|
63178
|
+
}
|
|
63179
|
+
const files = await readDirRecursive(localDir);
|
|
63180
|
+
let remote = {};
|
|
63181
|
+
try {
|
|
63182
|
+
const got = await getSharedUi({ workspace });
|
|
63183
|
+
remote = got.files ?? {};
|
|
63184
|
+
} catch {}
|
|
63185
|
+
if (Object.keys(remote).length === Object.keys(files).length && Object.entries(files).every(([k, v]) => remote[k] === v)) {
|
|
63186
|
+
info(colors.gray("Shared UI folder up to date"));
|
|
63187
|
+
return false;
|
|
63188
|
+
}
|
|
63189
|
+
await updateSharedUi({
|
|
63190
|
+
workspace,
|
|
63191
|
+
requestBody: { files }
|
|
63192
|
+
});
|
|
63193
|
+
info(colors.green(`Pushed ${Object.keys(files).length} file(s) to shared UI folder`));
|
|
63194
|
+
return true;
|
|
63195
|
+
}
|
|
63196
|
+
async function pullSharedUi(workspace) {
|
|
63197
|
+
const localDir = path9.join(process.cwd(), SHARED_UI_DIR);
|
|
63198
|
+
let got;
|
|
63199
|
+
try {
|
|
63200
|
+
got = await getSharedUi({ workspace });
|
|
63201
|
+
} catch (e) {
|
|
63202
|
+
debug(`Skipping shared UI pull: ${e}`);
|
|
63203
|
+
return false;
|
|
63204
|
+
}
|
|
63205
|
+
const files = got?.files ?? {};
|
|
63206
|
+
if (Object.keys(files).length === 0 && !fs9.existsSync(localDir)) {
|
|
63207
|
+
return false;
|
|
63208
|
+
}
|
|
63209
|
+
fs9.mkdirSync(localDir, { recursive: true });
|
|
63210
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
63211
|
+
const full = path9.join(localDir, rel);
|
|
63212
|
+
fs9.mkdirSync(path9.dirname(full), { recursive: true });
|
|
63213
|
+
let existing;
|
|
63214
|
+
try {
|
|
63215
|
+
existing = readTextFileSync(full);
|
|
63216
|
+
} catch {
|
|
63217
|
+
existing = undefined;
|
|
63218
|
+
}
|
|
63219
|
+
if (existing !== content) {
|
|
63220
|
+
fs9.writeFileSync(full, content, "utf-8");
|
|
63221
|
+
}
|
|
63222
|
+
}
|
|
63223
|
+
const known = new Set(Object.keys(files));
|
|
63224
|
+
const local = await readDirRecursive(localDir);
|
|
63225
|
+
for (const rel of Object.keys(local)) {
|
|
63226
|
+
if (!known.has(rel)) {
|
|
63227
|
+
const full = path9.join(localDir, rel);
|
|
63228
|
+
try {
|
|
63229
|
+
fs9.unlinkSync(full);
|
|
63230
|
+
} catch {}
|
|
63231
|
+
}
|
|
63232
|
+
}
|
|
63233
|
+
info(colors.green(`Pulled ${Object.keys(files).length} file(s) into ui/`));
|
|
63234
|
+
return true;
|
|
63235
|
+
}
|
|
63236
|
+
var SHARED_UI_DIR = "ui";
|
|
63237
|
+
var init_shared_ui = __esm(async () => {
|
|
63238
|
+
init_log();
|
|
63239
|
+
init_colors2();
|
|
63240
|
+
init_services_gen();
|
|
63241
|
+
await init_utils();
|
|
63242
|
+
});
|
|
63243
|
+
|
|
63055
63244
|
// src/core/permissioned_as.ts
|
|
63056
63245
|
var exports_permissioned_as = {};
|
|
63057
63246
|
__export(exports_permissioned_as, {
|
|
@@ -63315,11 +63504,11 @@ async function list5(opts) {
|
|
|
63315
63504
|
new Table2().header(["Path", "Resource Type"]).padding(2).border(true).body(total.map((x) => [x.path, x.resource_type])).render();
|
|
63316
63505
|
}
|
|
63317
63506
|
}
|
|
63318
|
-
async function newResource(opts,
|
|
63319
|
-
if (!validatePath(
|
|
63507
|
+
async function newResource(opts, path10) {
|
|
63508
|
+
if (!validatePath(path10)) {
|
|
63320
63509
|
return;
|
|
63321
63510
|
}
|
|
63322
|
-
const filePath =
|
|
63511
|
+
const filePath = path10 + ".resource.yaml";
|
|
63323
63512
|
try {
|
|
63324
63513
|
await stat6(filePath);
|
|
63325
63514
|
throw new Error("File already exists: " + filePath);
|
|
@@ -63339,14 +63528,14 @@ async function newResource(opts, path9) {
|
|
|
63339
63528
|
});
|
|
63340
63529
|
info(colors.green(`Created ${filePath}`));
|
|
63341
63530
|
}
|
|
63342
|
-
async function get3(opts,
|
|
63531
|
+
async function get3(opts, path10) {
|
|
63343
63532
|
if (opts.json)
|
|
63344
63533
|
setSilent(true);
|
|
63345
63534
|
const workspace = await resolveWorkspace(opts);
|
|
63346
63535
|
await requireLogin(opts);
|
|
63347
63536
|
const r = await getResource({
|
|
63348
63537
|
workspace: workspace.workspaceId,
|
|
63349
|
-
path:
|
|
63538
|
+
path: path10
|
|
63350
63539
|
});
|
|
63351
63540
|
if (opts.json) {
|
|
63352
63541
|
console.log(JSON.stringify(r));
|
|
@@ -63505,11 +63694,11 @@ var init_path_assigner = __esm(() => {
|
|
|
63505
63694
|
function extractRawscriptInline(id, summary, rawscript, mapping, separator, assigner) {
|
|
63506
63695
|
const [basePath, ext2] = assigner.assignPath(summary ?? id, rawscript.language);
|
|
63507
63696
|
const mappedPath = mapping[id];
|
|
63508
|
-
const
|
|
63697
|
+
const path10 = mappedPath ?? basePath + ext2;
|
|
63509
63698
|
const language = rawscript.language;
|
|
63510
63699
|
const content = rawscript.content;
|
|
63511
|
-
const r = [{ path:
|
|
63512
|
-
rawscript.content = "!inline " +
|
|
63700
|
+
const r = [{ path: path10, content, language, is_lock: false }];
|
|
63701
|
+
rawscript.content = "!inline " + path10.replaceAll(separator, "/");
|
|
63513
63702
|
const lock = rawscript.lock;
|
|
63514
63703
|
if (lock && lock != "") {
|
|
63515
63704
|
const dotIdx = mappedPath ? mappedPath.lastIndexOf(".") : -1;
|
|
@@ -63595,23 +63784,23 @@ async function replaceRawscriptInline(id, rawscript, fileReader, logger, separat
|
|
|
63595
63784
|
if (!rawscript.content || !rawscript.content.startsWith("!inline")) {
|
|
63596
63785
|
return;
|
|
63597
63786
|
}
|
|
63598
|
-
const
|
|
63599
|
-
const pathSuffix =
|
|
63787
|
+
const path10 = rawscript.content.split(" ")[1];
|
|
63788
|
+
const pathSuffix = path10.split(".").slice(1).join(".");
|
|
63600
63789
|
const newPath = id + "." + pathSuffix;
|
|
63601
63790
|
try {
|
|
63602
|
-
rawscript.content = await fileReader(
|
|
63791
|
+
rawscript.content = await fileReader(path10);
|
|
63603
63792
|
} catch {
|
|
63604
|
-
logger.error(`Script file ${
|
|
63793
|
+
logger.error(`Script file ${path10} not found`);
|
|
63605
63794
|
try {
|
|
63606
63795
|
rawscript.content = await fileReader(newPath);
|
|
63607
63796
|
} catch {
|
|
63608
63797
|
logger.error(`Script file ${newPath} not found`);
|
|
63609
63798
|
if (missingFiles)
|
|
63610
|
-
missingFiles.push(
|
|
63799
|
+
missingFiles.push(path10);
|
|
63611
63800
|
}
|
|
63612
63801
|
}
|
|
63613
63802
|
const lock = rawscript.lock;
|
|
63614
|
-
if (removeLocks && removeLocks.includes(
|
|
63803
|
+
if (removeLocks && removeLocks.includes(path10)) {
|
|
63615
63804
|
rawscript.lock = undefined;
|
|
63616
63805
|
} else if (lock && typeof lock === "string" && lock.trimStart().startsWith("!inline ")) {
|
|
63617
63806
|
const lockPath = lock.split(" ")[1];
|
|
@@ -63794,10 +63983,10 @@ var init_relative_imports = __esm(async () => {
|
|
|
63794
63983
|
});
|
|
63795
63984
|
|
|
63796
63985
|
// src/commands/flow/flow_metadata.ts
|
|
63797
|
-
import * as
|
|
63986
|
+
import * as path10 from "node:path";
|
|
63798
63987
|
import { sep as SEP7 } from "node:path";
|
|
63799
63988
|
async function generateFlowHash(rawWorkspaceDependencies, folder, defaultTs) {
|
|
63800
|
-
const elems = await FSFSElement(
|
|
63989
|
+
const elems = await FSFSElement(path10.join(process.cwd(), folder), [], true);
|
|
63801
63990
|
const hashes = {};
|
|
63802
63991
|
for await (const f of elems.getChildren()) {
|
|
63803
63992
|
if (exts.some((e) => f.path.endsWith(e))) {
|
|
@@ -63837,7 +64026,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63837
64026
|
continue;
|
|
63838
64027
|
}
|
|
63839
64028
|
}
|
|
63840
|
-
const treePath = folderNormalized + "/" +
|
|
64029
|
+
const treePath = folderNormalized + "/" + path10.basename(script.path, path10.extname(script.path));
|
|
63841
64030
|
const language = script.language;
|
|
63842
64031
|
const imports = await extractRelativeImports(content, treePath, language);
|
|
63843
64032
|
await tree.addNode(treePath, content, language, "", imports, "inline_script", folderNormalized, folder, false);
|
|
@@ -63872,29 +64061,29 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63872
64061
|
const c = script.content;
|
|
63873
64062
|
if (c.startsWith("!inline ")) {
|
|
63874
64063
|
const fileName = c.replace("!inline ", "");
|
|
63875
|
-
const treePath = folderNormalized + "/" +
|
|
64064
|
+
const treePath = folderNormalized + "/" + path10.basename(script.path, path10.extname(script.path));
|
|
63876
64065
|
fileToTreePath.set(fileName, treePath);
|
|
63877
64066
|
}
|
|
63878
64067
|
}
|
|
63879
64068
|
if (!justUpdateMetadataLock) {
|
|
63880
64069
|
const hashes = await generateFlowHash(filteredDeps, folder, opts.defaultTs);
|
|
63881
|
-
for (const [
|
|
63882
|
-
if (
|
|
64070
|
+
for (const [path11, hash2] of Object.entries(hashes)) {
|
|
64071
|
+
if (path11 == TOP_HASH) {
|
|
63883
64072
|
continue;
|
|
63884
64073
|
}
|
|
63885
|
-
if (!await checkifMetadataUptodate(folder, hash2, conf,
|
|
63886
|
-
changedScripts.push(
|
|
64074
|
+
if (!await checkifMetadataUptodate(folder, hash2, conf, path11)) {
|
|
64075
|
+
changedScripts.push(path11);
|
|
63887
64076
|
}
|
|
63888
64077
|
}
|
|
63889
64078
|
if (!noStaleMessage) {
|
|
63890
64079
|
info(`Recomputing locks of ${changedScripts.join(", ")} in ${folder}`);
|
|
63891
64080
|
}
|
|
63892
|
-
const fileReader = async (
|
|
64081
|
+
const fileReader = async (path11) => await readTextFile(folder + SEP7 + path11);
|
|
63893
64082
|
const currentMapping = extractCurrentMapping(flowValue.value.modules, {}, flowValue.value.failure_module, flowValue.value.preprocessor_module);
|
|
63894
64083
|
const locksToRemove = tree ? Object.keys(hashes).filter((k) => {
|
|
63895
64084
|
if (k === TOP_HASH)
|
|
63896
64085
|
return false;
|
|
63897
|
-
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" +
|
|
64086
|
+
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path10.basename(k, path10.extname(k));
|
|
63898
64087
|
return tree.isStale(treePath);
|
|
63899
64088
|
}) : changedScripts;
|
|
63900
64089
|
await replaceInlineScripts(flowValue.value.modules, fileReader, exports_log, folder + SEP7, SEP7, locksToRemove);
|
|
@@ -63930,8 +64119,8 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63930
64119
|
const depsForHash = tree ? {} : filteredDeps;
|
|
63931
64120
|
const finalHashes = await generateFlowHash(depsForHash, folder, opts.defaultTs);
|
|
63932
64121
|
await clearGlobalLock(folder);
|
|
63933
|
-
for (const [
|
|
63934
|
-
await updateMetadataGlobalLock(folder, hash2,
|
|
64122
|
+
for (const [path11, hash2] of Object.entries(finalHashes)) {
|
|
64123
|
+
await updateMetadataGlobalLock(folder, hash2, path11);
|
|
63935
64124
|
}
|
|
63936
64125
|
if (!noStaleMessage) {
|
|
63937
64126
|
info(colors.green(`Flow ${remote_path} lockfiles updated`));
|
|
@@ -63939,7 +64128,7 @@ async function generateFlowLockInternal(folder, dryRun, workspace, opts, justUpd
|
|
|
63939
64128
|
const relocked = tree ? Object.keys(finalHashes).filter((k) => {
|
|
63940
64129
|
if (k === TOP_HASH)
|
|
63941
64130
|
return false;
|
|
63942
|
-
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" +
|
|
64131
|
+
const treePath = fileToTreePath.get(k) ?? folderNormalized + "/" + path10.basename(k, path10.extname(k));
|
|
63943
64132
|
return tree.isStale(treePath);
|
|
63944
64133
|
}) : changedScripts;
|
|
63945
64134
|
const updatedScripts = relocked.map((p) => {
|
|
@@ -64048,7 +64237,7 @@ __export(exports_sync, {
|
|
|
64048
64237
|
FSFSElement: () => FSFSElement
|
|
64049
64238
|
});
|
|
64050
64239
|
import { writeFile as writeFile7, readdir as readdir4, stat as stat7, rm, copyFile, mkdir as mkdir5 } from "node:fs/promises";
|
|
64051
|
-
import * as
|
|
64240
|
+
import * as path11 from "node:path";
|
|
64052
64241
|
import { sep as SEP8 } from "node:path";
|
|
64053
64242
|
function resolveWsNameFromBranch(opts, branchName) {
|
|
64054
64243
|
const match2 = findWorkspaceByGitBranch(opts.workspaces, branchName);
|
|
@@ -64118,8 +64307,8 @@ function mergeCliWithEffectiveOptions(cliOpts, effectiveOpts) {
|
|
|
64118
64307
|
async function resolveEffectiveSyncOptions(workspace, localConfig, promotion, workspaceNameOverride) {
|
|
64119
64308
|
return await getEffectiveSettings(localConfig, promotion, false, false, workspaceNameOverride);
|
|
64120
64309
|
}
|
|
64121
|
-
function findCodebase(
|
|
64122
|
-
if (!
|
|
64310
|
+
function findCodebase(path12, codebases) {
|
|
64311
|
+
if (!path12.endsWith(".ts")) {
|
|
64123
64312
|
return;
|
|
64124
64313
|
}
|
|
64125
64314
|
for (const c of codebases) {
|
|
@@ -64135,7 +64324,7 @@ function findCodebase(path11, codebases) {
|
|
|
64135
64324
|
if (included) {
|
|
64136
64325
|
break;
|
|
64137
64326
|
}
|
|
64138
|
-
if (minimatch(
|
|
64327
|
+
if (minimatch(path12, r)) {
|
|
64139
64328
|
included = true;
|
|
64140
64329
|
}
|
|
64141
64330
|
}
|
|
@@ -64143,7 +64332,7 @@ function findCodebase(path11, codebases) {
|
|
|
64143
64332
|
c.excludes = [c.excludes];
|
|
64144
64333
|
}
|
|
64145
64334
|
for (const r of c.excludes ?? []) {
|
|
64146
|
-
if (minimatch(
|
|
64335
|
+
if (minimatch(path12, r)) {
|
|
64147
64336
|
excluded = true;
|
|
64148
64337
|
}
|
|
64149
64338
|
}
|
|
@@ -64152,13 +64341,13 @@ function findCodebase(path11, codebases) {
|
|
|
64152
64341
|
}
|
|
64153
64342
|
}
|
|
64154
64343
|
}
|
|
64155
|
-
async function addCodebaseDigestIfRelevant(
|
|
64156
|
-
const isScript =
|
|
64344
|
+
async function addCodebaseDigestIfRelevant(path12, content, codebases, ignoreCodebaseChanges) {
|
|
64345
|
+
const isScript = path12.endsWith(".script.yaml");
|
|
64157
64346
|
if (!isScript) {
|
|
64158
64347
|
return content;
|
|
64159
64348
|
}
|
|
64160
64349
|
let isTs = true;
|
|
64161
|
-
const replacedPath =
|
|
64350
|
+
const replacedPath = path12.replace(".script.yaml", ".ts");
|
|
64162
64351
|
try {
|
|
64163
64352
|
await stat7(replacedPath);
|
|
64164
64353
|
} catch {
|
|
@@ -64172,9 +64361,9 @@ async function addCodebaseDigestIfRelevant(path11, content, codebases, ignoreCod
|
|
|
64172
64361
|
if (c) {
|
|
64173
64362
|
let parsed;
|
|
64174
64363
|
try {
|
|
64175
|
-
parsed = yamlParseContent(
|
|
64364
|
+
parsed = yamlParseContent(path12, content);
|
|
64176
64365
|
} catch (error2) {
|
|
64177
|
-
error(`Failed to parse YAML content for codebase digest at path: ${
|
|
64366
|
+
error(`Failed to parse YAML content for codebase digest at path: ${path12}`);
|
|
64178
64367
|
throw error2;
|
|
64179
64368
|
}
|
|
64180
64369
|
if (parsed && typeof parsed == "object") {
|
|
@@ -64186,7 +64375,7 @@ async function addCodebaseDigestIfRelevant(path11, content, codebases, ignoreCod
|
|
|
64186
64375
|
parsed["lock"] = "";
|
|
64187
64376
|
return import_yaml11.stringify(parsed, yamlOptions);
|
|
64188
64377
|
} else {
|
|
64189
|
-
throw Error(`Expected local yaml ${
|
|
64378
|
+
throw Error(`Expected local yaml ${path12} to be an object, found: ${content} instead`);
|
|
64190
64379
|
}
|
|
64191
64380
|
}
|
|
64192
64381
|
}
|
|
@@ -64203,7 +64392,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
|
|
|
64203
64392
|
try {
|
|
64204
64393
|
const entries = await readdir4(localP, { withFileTypes: true });
|
|
64205
64394
|
for (const e of entries) {
|
|
64206
|
-
yield _internal_element(
|
|
64395
|
+
yield _internal_element(path11.join(localP, e.name), e.isDirectory(), codebases2);
|
|
64207
64396
|
}
|
|
64208
64397
|
} catch (e) {
|
|
64209
64398
|
warn(`Error reading dir: ${localP}, ${e}`);
|
|
@@ -64501,9 +64690,9 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64501
64690
|
for (const basePath of moduleScripts) {
|
|
64502
64691
|
if (normalizedP.startsWith(basePath + ".")) {
|
|
64503
64692
|
const ext2 = normalizedP.slice(basePath.length);
|
|
64504
|
-
const dir =
|
|
64505
|
-
const base =
|
|
64506
|
-
finalPath =
|
|
64693
|
+
const dir = path11.dirname(finalPath);
|
|
64694
|
+
const base = path11.basename(basePath);
|
|
64695
|
+
finalPath = path11.join(dir, base + getModuleFolderSuffix(), "script" + ext2);
|
|
64507
64696
|
break;
|
|
64508
64697
|
}
|
|
64509
64698
|
}
|
|
@@ -64539,7 +64728,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64539
64728
|
for (const s of inlineScripts) {
|
|
64540
64729
|
yield {
|
|
64541
64730
|
isDirectory: false,
|
|
64542
|
-
path:
|
|
64731
|
+
path: path11.join(finalPath, s.path),
|
|
64543
64732
|
async* getChildren() {},
|
|
64544
64733
|
async getContentText() {
|
|
64545
64734
|
return s.content;
|
|
@@ -64552,7 +64741,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64552
64741
|
}
|
|
64553
64742
|
yield {
|
|
64554
64743
|
isDirectory: false,
|
|
64555
|
-
path:
|
|
64744
|
+
path: path11.join(finalPath, "flow.yaml"),
|
|
64556
64745
|
async* getChildren() {},
|
|
64557
64746
|
async getContentText() {
|
|
64558
64747
|
return import_yaml11.stringify(flow, yamlOptions);
|
|
@@ -64576,7 +64765,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64576
64765
|
for (const s of inlineScripts) {
|
|
64577
64766
|
yield {
|
|
64578
64767
|
isDirectory: false,
|
|
64579
|
-
path:
|
|
64768
|
+
path: path11.join(finalPath, s.path),
|
|
64580
64769
|
async* getChildren() {},
|
|
64581
64770
|
async getContentText() {
|
|
64582
64771
|
return s.content;
|
|
@@ -64589,7 +64778,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64589
64778
|
app.policy = undefined;
|
|
64590
64779
|
yield {
|
|
64591
64780
|
isDirectory: false,
|
|
64592
|
-
path:
|
|
64781
|
+
path: path11.join(finalPath, "app.yaml"),
|
|
64593
64782
|
async* getChildren() {},
|
|
64594
64783
|
async getContentText() {
|
|
64595
64784
|
return import_yaml11.stringify(app, yamlOptions);
|
|
@@ -64644,7 +64833,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64644
64833
|
}
|
|
64645
64834
|
yield {
|
|
64646
64835
|
isDirectory: false,
|
|
64647
|
-
path:
|
|
64836
|
+
path: path11.join(finalPath, filePath.substring(1)),
|
|
64648
64837
|
async* getChildren() {},
|
|
64649
64838
|
async getContentText() {
|
|
64650
64839
|
if (typeof content !== "string") {
|
|
@@ -64661,7 +64850,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64661
64850
|
for (const s of inlineScripts) {
|
|
64662
64851
|
yield {
|
|
64663
64852
|
isDirectory: false,
|
|
64664
|
-
path:
|
|
64853
|
+
path: path11.join(finalPath, APP_BACKEND_FOLDER, s.path),
|
|
64665
64854
|
async* getChildren() {},
|
|
64666
64855
|
async getContentText() {
|
|
64667
64856
|
return s.content;
|
|
@@ -64697,7 +64886,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64697
64886
|
}
|
|
64698
64887
|
yield {
|
|
64699
64888
|
isDirectory: false,
|
|
64700
|
-
path:
|
|
64889
|
+
path: path11.join(finalPath, APP_BACKEND_FOLDER, `${runnableId}.yaml`),
|
|
64701
64890
|
async* getChildren() {},
|
|
64702
64891
|
async getContentText() {
|
|
64703
64892
|
return import_yaml11.stringify(simplifiedRunnable, yamlOptions);
|
|
@@ -64711,7 +64900,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64711
64900
|
delete rawApp?.["value"];
|
|
64712
64901
|
yield {
|
|
64713
64902
|
isDirectory: false,
|
|
64714
|
-
path:
|
|
64903
|
+
path: path11.join(finalPath, "raw_app.yaml"),
|
|
64715
64904
|
async* getChildren() {},
|
|
64716
64905
|
async getContentText() {
|
|
64717
64906
|
return import_yaml11.stringify(rawApp, yamlOptions);
|
|
@@ -64719,7 +64908,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64719
64908
|
};
|
|
64720
64909
|
yield {
|
|
64721
64910
|
isDirectory: false,
|
|
64722
|
-
path:
|
|
64911
|
+
path: path11.join(finalPath, "DATATABLES.md"),
|
|
64723
64912
|
async* getChildren() {},
|
|
64724
64913
|
async getContentText() {
|
|
64725
64914
|
return generateDatatablesDocumentation(data3);
|
|
@@ -64822,12 +65011,12 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64822
65011
|
const scriptBasePath = removeSuffix(removeSuffix(finalPath, metaExt), ".script");
|
|
64823
65012
|
const moduleFolderPath = scriptBasePath + getModuleFolderSuffix();
|
|
64824
65013
|
if (hasModules) {
|
|
64825
|
-
r[0].path =
|
|
65014
|
+
r[0].path = path11.join(moduleFolderPath, "script" + metaExt);
|
|
64826
65015
|
}
|
|
64827
65016
|
if (lock && lock != "") {
|
|
64828
65017
|
r.push({
|
|
64829
65018
|
isDirectory: false,
|
|
64830
|
-
path: hasModules ?
|
|
65019
|
+
path: hasModules ? path11.join(moduleFolderPath, "script.lock") : removeSuffix(finalPath, metaExt) + ".lock",
|
|
64831
65020
|
async* getChildren() {},
|
|
64832
65021
|
async getContentText() {
|
|
64833
65022
|
return lock;
|
|
@@ -64842,7 +65031,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64842
65031
|
for (const [relPath, mod] of Object.entries(scriptModules)) {
|
|
64843
65032
|
yield {
|
|
64844
65033
|
isDirectory: false,
|
|
64845
|
-
path:
|
|
65034
|
+
path: path11.join(moduleFolderPath, relPath),
|
|
64846
65035
|
async* getChildren() {},
|
|
64847
65036
|
async getContentText() {
|
|
64848
65037
|
return mod.content;
|
|
@@ -64852,7 +65041,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64852
65041
|
const baseName = relPath.replace(/\.[^.]+$/, "");
|
|
64853
65042
|
yield {
|
|
64854
65043
|
isDirectory: false,
|
|
64855
|
-
path:
|
|
65044
|
+
path: path11.join(moduleFolderPath, baseName + ".lock"),
|
|
64856
65045
|
async* getChildren() {},
|
|
64857
65046
|
async getContentText() {
|
|
64858
65047
|
return mod.lock;
|
|
@@ -64889,7 +65078,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64889
65078
|
if (typeof fileContent === "string") {
|
|
64890
65079
|
yield {
|
|
64891
65080
|
isDirectory: false,
|
|
64892
|
-
path:
|
|
65081
|
+
path: path11.join(filesetBasePath, relPath),
|
|
64893
65082
|
async* getChildren() {},
|
|
64894
65083
|
async getContentText() {
|
|
64895
65084
|
return fileContent;
|
|
@@ -64925,13 +65114,13 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
64925
65114
|
async* getChildren() {
|
|
64926
65115
|
for (const filename in zip2.files) {
|
|
64927
65116
|
const file = zip2.files[filename];
|
|
64928
|
-
const totalPath =
|
|
65117
|
+
const totalPath = path11.join(p, filename);
|
|
64929
65118
|
if (file.dir) {
|
|
64930
65119
|
const e = zip2.folder(file.name);
|
|
64931
65120
|
yield _internal_folder(totalPath, e);
|
|
64932
65121
|
} else {
|
|
64933
|
-
const
|
|
64934
|
-
for (const f of
|
|
65122
|
+
const fs10 = await _internal_file(totalPath, file);
|
|
65123
|
+
for (const f of fs10) {
|
|
64935
65124
|
yield f;
|
|
64936
65125
|
}
|
|
64937
65126
|
}
|
|
@@ -64994,15 +65183,15 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
64994
65183
|
if (entry.ignored) {
|
|
64995
65184
|
continue;
|
|
64996
65185
|
}
|
|
64997
|
-
const
|
|
64998
|
-
if (isScriptModulePath(
|
|
64999
|
-
map[
|
|
65186
|
+
const path12 = entry.path;
|
|
65187
|
+
if (isScriptModulePath(path12)) {
|
|
65188
|
+
map[path12] = await entry.getContentText();
|
|
65000
65189
|
continue;
|
|
65001
65190
|
}
|
|
65002
|
-
if (!isFileResource(
|
|
65003
|
-
if (json &&
|
|
65191
|
+
if (!isFileResource(path12) && !isFilesetResource(path12) && !isRawAppFile(path12) && !isWorkspaceDependencies(path12)) {
|
|
65192
|
+
if (json && path12.endsWith(".yaml"))
|
|
65004
65193
|
continue;
|
|
65005
|
-
if (!json &&
|
|
65194
|
+
if (!json && path12.endsWith(".json"))
|
|
65006
65195
|
continue;
|
|
65007
65196
|
if (![
|
|
65008
65197
|
"json",
|
|
@@ -65024,39 +65213,39 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
65024
65213
|
"java",
|
|
65025
65214
|
"rb",
|
|
65026
65215
|
"r"
|
|
65027
|
-
].includes(
|
|
65216
|
+
].includes(path12.split(".").pop() ?? "")) {
|
|
65028
65217
|
continue;
|
|
65029
65218
|
}
|
|
65030
65219
|
}
|
|
65031
|
-
if (isRawAppFile(
|
|
65032
|
-
const suffix =
|
|
65220
|
+
if (isRawAppFile(path12)) {
|
|
65221
|
+
const suffix = path12.split(getFolderSuffix("raw_app") + SEP8).pop();
|
|
65033
65222
|
if (suffix?.startsWith("dist/") || suffix == "wmill.d.ts" || suffix == "package-lock.json" || suffix == "DATATABLES.md") {
|
|
65034
65223
|
continue;
|
|
65035
65224
|
}
|
|
65036
65225
|
}
|
|
65037
|
-
if (skips.skipResources && (isFileResource(
|
|
65226
|
+
if (skips.skipResources && (isFileResource(path12) || isFilesetResource(path12)))
|
|
65038
65227
|
continue;
|
|
65039
65228
|
const ext2 = json ? ".json" : ".yaml";
|
|
65040
|
-
if (!skips.includeSchedules &&
|
|
65229
|
+
if (!skips.includeSchedules && path12.endsWith(".schedule" + ext2))
|
|
65041
65230
|
continue;
|
|
65042
|
-
if (!skips.includeTriggers && (
|
|
65231
|
+
if (!skips.includeTriggers && (path12.endsWith(".http_trigger" + ext2) || path12.endsWith(".websocket_trigger" + ext2) || path12.endsWith(".kafka_trigger" + ext2) || path12.endsWith(".nats_trigger" + ext2) || path12.endsWith(".postgres_trigger" + ext2) || path12.endsWith(".mqtt_trigger" + ext2) || path12.endsWith(".sqs_trigger" + ext2) || path12.endsWith(".gcp_trigger" + ext2) || path12.endsWith(".azure_trigger" + ext2) || path12.endsWith(".email_trigger" + ext2) || path12.endsWith("_native_trigger" + ext2))) {
|
|
65043
65232
|
continue;
|
|
65044
65233
|
}
|
|
65045
|
-
if (!skips.includeUsers &&
|
|
65234
|
+
if (!skips.includeUsers && path12.endsWith(".user" + ext2))
|
|
65046
65235
|
continue;
|
|
65047
|
-
if (!skips.includeGroups &&
|
|
65236
|
+
if (!skips.includeGroups && path12.endsWith(".group" + ext2))
|
|
65048
65237
|
continue;
|
|
65049
|
-
if (!skips.includeSettings &&
|
|
65238
|
+
if (!skips.includeSettings && path12 === "settings" + ext2)
|
|
65050
65239
|
continue;
|
|
65051
|
-
if (!skips.includeKey &&
|
|
65240
|
+
if (!skips.includeKey && path12 === "encryption_key")
|
|
65052
65241
|
continue;
|
|
65053
|
-
if (skips.skipResources &&
|
|
65242
|
+
if (skips.skipResources && path12.endsWith(".resource" + ext2))
|
|
65054
65243
|
continue;
|
|
65055
|
-
if (skips.skipResourceTypes &&
|
|
65244
|
+
if (skips.skipResourceTypes && path12.endsWith(".resource-type" + ext2)) {
|
|
65056
65245
|
continue;
|
|
65057
65246
|
}
|
|
65058
65247
|
try {
|
|
65059
|
-
const fileType = getTypeStrFromPath(
|
|
65248
|
+
const fileType = getTypeStrFromPath(path12);
|
|
65060
65249
|
if (skips.skipVariables && fileType === "variable")
|
|
65061
65250
|
continue;
|
|
65062
65251
|
if (skips.skipScripts && fileType === "script")
|
|
@@ -65070,27 +65259,27 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
65070
65259
|
if (skips.skipWorkspaceDependencies && fileType === "workspace_dependencies")
|
|
65071
65260
|
continue;
|
|
65072
65261
|
} catch {}
|
|
65073
|
-
if (specificItems && isWorkspaceSpecificFile(
|
|
65074
|
-
if (!isCurrentWorkspaceFile(
|
|
65262
|
+
if (specificItems && isWorkspaceSpecificFile(path12)) {
|
|
65263
|
+
if (!isCurrentWorkspaceFile(path12, cachedWsName)) {
|
|
65075
65264
|
continue;
|
|
65076
65265
|
}
|
|
65077
65266
|
}
|
|
65078
65267
|
const content = await entry.getContentText();
|
|
65079
|
-
if (skips.skipSecrets &&
|
|
65268
|
+
if (skips.skipSecrets && path12.endsWith(".variable" + ext2)) {
|
|
65080
65269
|
try {
|
|
65081
65270
|
let o;
|
|
65082
65271
|
if (json) {
|
|
65083
65272
|
try {
|
|
65084
65273
|
o = JSON.parse(content);
|
|
65085
65274
|
} catch (error2) {
|
|
65086
|
-
error(`Failed to parse JSON variable content at path: ${
|
|
65275
|
+
error(`Failed to parse JSON variable content at path: ${path12}`);
|
|
65087
65276
|
throw error2;
|
|
65088
65277
|
}
|
|
65089
65278
|
} else {
|
|
65090
65279
|
try {
|
|
65091
|
-
o = yamlParseContent(
|
|
65280
|
+
o = yamlParseContent(path12, content);
|
|
65092
65281
|
} catch (error2) {
|
|
65093
|
-
error(`Failed to parse YAML variable content at path: ${
|
|
65282
|
+
error(`Failed to parse YAML variable content at path: ${path12}`);
|
|
65094
65283
|
throw error2;
|
|
65095
65284
|
}
|
|
65096
65285
|
}
|
|
@@ -65098,12 +65287,12 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
65098
65287
|
continue;
|
|
65099
65288
|
}
|
|
65100
65289
|
} catch (e) {
|
|
65101
|
-
warn(`Error reading variable ${
|
|
65290
|
+
warn(`Error reading variable ${path12} to check for secrets`);
|
|
65102
65291
|
}
|
|
65103
65292
|
}
|
|
65104
|
-
if (cachedWsName && isCurrentWorkspaceFile(
|
|
65293
|
+
if (cachedWsName && isCurrentWorkspaceFile(path12, cachedWsName)) {
|
|
65105
65294
|
const currentBranch = cachedWsName;
|
|
65106
|
-
const basePath = fromWorkspaceSpecificPath(
|
|
65295
|
+
const basePath = fromWorkspaceSpecificPath(path12, currentBranch);
|
|
65107
65296
|
if (!isItemTypeConfigured(basePath, specificItems)) {
|
|
65108
65297
|
continue;
|
|
65109
65298
|
}
|
|
@@ -65112,14 +65301,14 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
65112
65301
|
}
|
|
65113
65302
|
map[basePath] = content;
|
|
65114
65303
|
processedBasePaths.add(basePath);
|
|
65115
|
-
} else if (!isWorkspaceSpecificFile(
|
|
65116
|
-
if (processedBasePaths.has(
|
|
65304
|
+
} else if (!isWorkspaceSpecificFile(path12)) {
|
|
65305
|
+
if (processedBasePaths.has(path12)) {
|
|
65117
65306
|
continue;
|
|
65118
65307
|
}
|
|
65119
|
-
if (!isRemote && isSpecificItem(
|
|
65308
|
+
if (!isRemote && isSpecificItem(path12, specificItems)) {
|
|
65120
65309
|
continue;
|
|
65121
65310
|
}
|
|
65122
|
-
map[
|
|
65311
|
+
map[path12] = content;
|
|
65123
65312
|
}
|
|
65124
65313
|
}
|
|
65125
65314
|
if (wrongFormatPaths.length > 0) {
|
|
@@ -65503,7 +65692,7 @@ async function pull(opts) {
|
|
|
65503
65692
|
throw error2;
|
|
65504
65693
|
}
|
|
65505
65694
|
if (opts.stateful) {
|
|
65506
|
-
await mkdir5(
|
|
65695
|
+
await mkdir5(path11.join(process.cwd(), ".wmill"), { recursive: true });
|
|
65507
65696
|
}
|
|
65508
65697
|
const workspace = await resolveWorkspace(opts, wsNameForConfig);
|
|
65509
65698
|
await requireLogin(opts);
|
|
@@ -65528,7 +65717,7 @@ async function pull(opts) {
|
|
|
65528
65717
|
} catch {}
|
|
65529
65718
|
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);
|
|
65530
65719
|
const remote = ZipFSElement(zipFile, !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, true, parseSyncBehavior(opts.syncBehavior) >= 1);
|
|
65531
|
-
const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(
|
|
65720
|
+
const local = !opts.stateful ? await FSFSElement(process.cwd(), codebases, true) : await FSFSElement(path11.join(process.cwd(), ".wmill"), [], true);
|
|
65532
65721
|
const changes = await compareDynFSElement(remote, local, await ignoreF(opts), opts.json ?? false, opts, false, codebases, true, specificItems, wsNameForFiles, true);
|
|
65533
65722
|
info(`remote (${workspace.name}) -> local: ${changes.length} changes to apply`);
|
|
65534
65723
|
if (opts.dryRun && opts.jsonOutput) {
|
|
@@ -65572,8 +65761,8 @@ async function pull(opts) {
|
|
|
65572
65761
|
targetPath = workspaceSpecificPath;
|
|
65573
65762
|
}
|
|
65574
65763
|
}
|
|
65575
|
-
const target =
|
|
65576
|
-
const stateTarget =
|
|
65764
|
+
const target = path11.join(process.cwd(), targetPath);
|
|
65765
|
+
const stateTarget = path11.join(process.cwd(), ".wmill", targetPath);
|
|
65577
65766
|
if (change.name === "edited") {
|
|
65578
65767
|
if (opts.stateful) {
|
|
65579
65768
|
try {
|
|
@@ -65606,13 +65795,13 @@ Both local and remote have been modified.`));
|
|
|
65606
65795
|
}
|
|
65607
65796
|
await writeFile7(target, change.after, "utf-8");
|
|
65608
65797
|
if (opts.stateful) {
|
|
65609
|
-
await mkdir5(
|
|
65798
|
+
await mkdir5(path11.dirname(stateTarget), { recursive: true });
|
|
65610
65799
|
await copyFile(target, stateTarget);
|
|
65611
65800
|
}
|
|
65612
65801
|
} else if (change.name === "added") {
|
|
65613
|
-
await mkdir5(
|
|
65802
|
+
await mkdir5(path11.dirname(target), { recursive: true });
|
|
65614
65803
|
if (opts.stateful) {
|
|
65615
|
-
await mkdir5(
|
|
65804
|
+
await mkdir5(path11.dirname(stateTarget), { recursive: true });
|
|
65616
65805
|
info(`Adding ${getTypeStrFromPath(change.path)} ${targetPath}${targetPath !== change.path ? colors.gray(` (workspace-specific override for ${change.path})`) : ""}`);
|
|
65617
65806
|
}
|
|
65618
65807
|
await writeFile7(target, change.content, "utf-8");
|
|
@@ -65693,6 +65882,11 @@ Done! All ${changes.length} changes applied locally and wmill-lock.yaml updated.
|
|
|
65693
65882
|
} else if (opts.jsonOutput) {
|
|
65694
65883
|
console.log(JSON.stringify({ success: true, message: "No changes to apply", total: 0 }, null, 2));
|
|
65695
65884
|
}
|
|
65885
|
+
try {
|
|
65886
|
+
await pullSharedUi(workspace.workspaceId);
|
|
65887
|
+
} catch (e) {
|
|
65888
|
+
warn(`Failed to pull shared UI folder: ${e}`);
|
|
65889
|
+
}
|
|
65696
65890
|
}
|
|
65697
65891
|
function prettyChanges(changes, specificItems, branchOverride, folderDefaultAnnotations) {
|
|
65698
65892
|
for (const change of changes) {
|
|
@@ -65815,7 +66009,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
|
|
|
65815
66009
|
resourceTypeToIsFileset = parsed.filesetMap;
|
|
65816
66010
|
} catch {}
|
|
65817
66011
|
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);
|
|
65818
|
-
const local = await FSFSElement(
|
|
66012
|
+
const local = await FSFSElement(path11.join(process.cwd(), ""), codebases, false);
|
|
65819
66013
|
const changes = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false);
|
|
65820
66014
|
const rawWorkspaceDependencies = await getRawWorkspaceDependencies(true);
|
|
65821
66015
|
const tracker = await buildTracker(changes);
|
|
@@ -65929,7 +66123,7 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
|
|
|
65929
66123
|
}
|
|
65930
66124
|
}
|
|
65931
66125
|
for (const folderName2 of folderNames) {
|
|
65932
|
-
const basePath =
|
|
66126
|
+
const basePath = path11.join("f", folderName2, "folder.meta.yaml");
|
|
65933
66127
|
const branchPath = getWorkspaceSpecificPath(`f/${folderName2}/folder.meta.yaml`, specificItems, wsNameForFiles);
|
|
65934
66128
|
let found = false;
|
|
65935
66129
|
if (branchPath) {
|
|
@@ -66051,7 +66245,7 @@ ${folderList}
|
|
|
66051
66245
|
let stateful = opts.stateful;
|
|
66052
66246
|
if (stateful) {
|
|
66053
66247
|
try {
|
|
66054
|
-
await stat7(
|
|
66248
|
+
await stat7(path11.join(process.cwd(), ".wmill"));
|
|
66055
66249
|
} catch {
|
|
66056
66250
|
stateful = false;
|
|
66057
66251
|
}
|
|
@@ -66102,7 +66296,7 @@ ${folderList}
|
|
|
66102
66296
|
let stateTarget = undefined;
|
|
66103
66297
|
if (stateful) {
|
|
66104
66298
|
try {
|
|
66105
|
-
stateTarget =
|
|
66299
|
+
stateTarget = path11.join(process.cwd(), ".wmill", change.path);
|
|
66106
66300
|
await stat7(stateTarget);
|
|
66107
66301
|
} catch {
|
|
66108
66302
|
stateTarget = undefined;
|
|
@@ -66127,7 +66321,7 @@ ${folderList}
|
|
|
66127
66321
|
continue;
|
|
66128
66322
|
}
|
|
66129
66323
|
if (stateTarget) {
|
|
66130
|
-
await mkdir5(
|
|
66324
|
+
await mkdir5(path11.dirname(stateTarget), { recursive: true });
|
|
66131
66325
|
info(`Editing ${getTypeStrFromPath(change.path)} ${change.path}`);
|
|
66132
66326
|
}
|
|
66133
66327
|
if (isFileResource(change.path)) {
|
|
@@ -66183,7 +66377,7 @@ ${folderList}
|
|
|
66183
66377
|
continue;
|
|
66184
66378
|
}
|
|
66185
66379
|
if (stateTarget) {
|
|
66186
|
-
await mkdir5(
|
|
66380
|
+
await mkdir5(path11.dirname(stateTarget), { recursive: true });
|
|
66187
66381
|
info(`Adding ${getTypeStrFromPath(change.path)} ${change.path}`);
|
|
66188
66382
|
}
|
|
66189
66383
|
const obj = parseFromPath(change.path, change.content);
|
|
@@ -66490,6 +66684,11 @@ ${folderList}
|
|
|
66490
66684
|
await Promise.race(pool);
|
|
66491
66685
|
}
|
|
66492
66686
|
}
|
|
66687
|
+
try {
|
|
66688
|
+
await pushSharedUi(workspace.workspaceId);
|
|
66689
|
+
} catch (e) {
|
|
66690
|
+
warn(`Failed to push shared UI folder: ${e}`);
|
|
66691
|
+
}
|
|
66493
66692
|
if (opts.jsonOutput) {
|
|
66494
66693
|
const result = {
|
|
66495
66694
|
success: true,
|
|
@@ -66511,14 +66710,24 @@ ${folderList}
|
|
|
66511
66710
|
info(colors.bold.green.underline(`
|
|
66512
66711
|
Done! All ${changes.length} changes pushed to the remote workspace ${workspace.workspaceId} named ${workspace.name} (${(performance.now() - start).toFixed(0)}ms)`));
|
|
66513
66712
|
}
|
|
66514
|
-
} else
|
|
66515
|
-
|
|
66713
|
+
} else {
|
|
66714
|
+
try {
|
|
66715
|
+
await pushSharedUi(workspace.workspaceId);
|
|
66716
|
+
} catch (e) {
|
|
66717
|
+
warn(`Failed to push shared UI folder: ${e}`);
|
|
66718
|
+
}
|
|
66719
|
+
if (opts.jsonOutput) {
|
|
66720
|
+
console.log(JSON.stringify({ success: true, message: "No changes to push", total: 0 }, null, 2));
|
|
66721
|
+
}
|
|
66516
66722
|
}
|
|
66517
66723
|
}
|
|
66518
66724
|
var import_yaml11, branchDeprecationWarned = false, yamlOptions, isNotWmillFile = (p, isDirectory2) => {
|
|
66519
66725
|
if (p.endsWith(SEP8)) {
|
|
66520
66726
|
return false;
|
|
66521
66727
|
}
|
|
66728
|
+
if (p.startsWith("ui" + SEP8)) {
|
|
66729
|
+
return true;
|
|
66730
|
+
}
|
|
66522
66731
|
if (isDirectory2) {
|
|
66523
66732
|
return !p.startsWith("u" + SEP8) && !p.startsWith("f" + SEP8) && !p.startsWith("g" + SEP8) && !p.startsWith("users" + SEP8) && !p.startsWith("groups" + SEP8) && !p.startsWith("dependencies" + SEP8);
|
|
66524
66733
|
}
|
|
@@ -66536,7 +66745,7 @@ var import_yaml11, branchDeprecationWarned = false, yamlOptions, isNotWmillFile
|
|
|
66536
66745
|
return true;
|
|
66537
66746
|
}
|
|
66538
66747
|
}, isWhitelisted = (p) => {
|
|
66539
|
-
return p == "." + SEP8 || p == "" || p == "u" || p == "f" || p == "g" || p == "users" || p == "groups" || p == "dependencies";
|
|
66748
|
+
return p == "." + SEP8 || p == "" || p == "u" || p == "f" || p == "g" || p == "ui" || p == "users" || p == "groups" || p == "dependencies";
|
|
66540
66749
|
}, command7, sync_default;
|
|
66541
66750
|
var init_sync = __esm(async () => {
|
|
66542
66751
|
init_colors2();
|
|
@@ -66555,6 +66764,7 @@ var init_sync = __esm(async () => {
|
|
|
66555
66764
|
init_types(),
|
|
66556
66765
|
init_pull(),
|
|
66557
66766
|
init_lint(),
|
|
66767
|
+
init_shared_ui(),
|
|
66558
66768
|
init_script(),
|
|
66559
66769
|
init_script(),
|
|
66560
66770
|
init_utils(),
|
|
@@ -66786,8 +66996,8 @@ var init_parse_schema = __esm(() => {
|
|
|
66786
66996
|
// src/utils/metadata.ts
|
|
66787
66997
|
import { sep as SEP9 } from "node:path";
|
|
66788
66998
|
import { writeFile as writeFile8, stat as stat8, rm as rm2, readdir as readdir5 } from "node:fs/promises";
|
|
66789
|
-
import { readFileSync as readFileSync2, existsSync as
|
|
66790
|
-
import * as
|
|
66999
|
+
import { readFileSync as readFileSync2, existsSync as existsSync6, readdirSync, statSync, writeFileSync as writeFileSync5 } from "node:fs";
|
|
67000
|
+
import * as path12 from "node:path";
|
|
66791
67001
|
import { createRequire as createRequire2 } from "node:module";
|
|
66792
67002
|
function loadParser(pkgName) {
|
|
66793
67003
|
let p = _parserCache.get(pkgName);
|
|
@@ -66829,8 +67039,8 @@ async function getRawWorkspaceDependencies(legacyBehaviour) {
|
|
|
66829
67039
|
} catch {}
|
|
66830
67040
|
return rawWorkspaceDeps;
|
|
66831
67041
|
}
|
|
66832
|
-
function workspaceDependenciesPathToLanguageAndFilename(
|
|
66833
|
-
const relativePath =
|
|
67042
|
+
function workspaceDependenciesPathToLanguageAndFilename(path13) {
|
|
67043
|
+
const relativePath = path13.replace("dependencies/", "");
|
|
66834
67044
|
for (const { filename, language } of workspaceDependenciesLanguages) {
|
|
66835
67045
|
if (relativePath.endsWith(filename)) {
|
|
66836
67046
|
return {
|
|
@@ -66884,8 +67094,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
66884
67094
|
const scriptContent = await readTextFile(scriptPath);
|
|
66885
67095
|
const metadataContent = await readTextFile(metadataWithType.path);
|
|
66886
67096
|
const filteredRawWorkspaceDependencies = filterWorkspaceDependencies(rawWorkspaceDependencies, scriptContent, language);
|
|
66887
|
-
const moduleFolderPath = isFolderLayout ?
|
|
66888
|
-
const hasModules =
|
|
67097
|
+
const moduleFolderPath = isFolderLayout ? path12.dirname(scriptPath) : scriptPath.substring(0, scriptPath.indexOf(".")) + getModuleFolderSuffix();
|
|
67098
|
+
const hasModules = existsSync6(moduleFolderPath) && statSync(moduleFolderPath).isDirectory();
|
|
66889
67099
|
const depsForHash = tree ? {} : filteredRawWorkspaceDependencies;
|
|
66890
67100
|
let hash2 = await generateScriptHash(depsForHash, scriptContent, metadataContent);
|
|
66891
67101
|
let moduleHashes = {};
|
|
@@ -66941,7 +67151,7 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
66941
67151
|
const hasCodebase = findCodebase(scriptPath, codebases) != null;
|
|
66942
67152
|
if (!hasCodebase) {
|
|
66943
67153
|
const tempScriptRefs = tree?.getTempScriptRefs(remotePath);
|
|
66944
|
-
const lockPathOverride = isFolderLayout ?
|
|
67154
|
+
const lockPathOverride = isFolderLayout ? path12.dirname(scriptPath) + "/script.lock" : undefined;
|
|
66945
67155
|
await updateScriptLock(workspace, scriptContent, language, remotePath, metadataParsedContent, filteredRawWorkspaceDependencies, tempScriptRefs, lockPathOverride);
|
|
66946
67156
|
} else {
|
|
66947
67157
|
metadataParsedContent.lock = "";
|
|
@@ -66972,10 +67182,10 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
66972
67182
|
let newMetadataContent;
|
|
66973
67183
|
if (isFolderLayout) {
|
|
66974
67184
|
if (metadataWithType.isJson) {
|
|
66975
|
-
metaPath =
|
|
67185
|
+
metaPath = path12.dirname(scriptPath) + "/script.json";
|
|
66976
67186
|
newMetadataContent = JSON.stringify(metadataParsedContent);
|
|
66977
67187
|
} else {
|
|
66978
|
-
metaPath =
|
|
67188
|
+
metaPath = path12.dirname(scriptPath) + "/script.yaml";
|
|
66979
67189
|
newMetadataContent = import_yaml13.stringify(metadataParsedContent, yamlOptions);
|
|
66980
67190
|
}
|
|
66981
67191
|
} else {
|
|
@@ -67005,8 +67215,8 @@ async function generateScriptMetadataInternal(scriptPath, workspace, opts, dryRu
|
|
|
67005
67215
|
}
|
|
67006
67216
|
return `${remotePath} (${language})`;
|
|
67007
67217
|
}
|
|
67008
|
-
async function updateScriptSchema(scriptContent, language, metadataContent,
|
|
67009
|
-
const result = await inferSchema(language, scriptContent, metadataContent.schema,
|
|
67218
|
+
async function updateScriptSchema(scriptContent, language, metadataContent, path13) {
|
|
67219
|
+
const result = await inferSchema(language, scriptContent, metadataContent.schema, path13);
|
|
67010
67220
|
metadataContent.schema = result.schema;
|
|
67011
67221
|
if (result.has_preprocessor) {
|
|
67012
67222
|
metadataContent.has_preprocessor = result.has_preprocessor;
|
|
@@ -67167,7 +67377,7 @@ async function updateScriptLock(workspace, scriptContent, language, remotePath,
|
|
|
67167
67377
|
async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules) {
|
|
67168
67378
|
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
67169
67379
|
for (const entry of entries) {
|
|
67170
|
-
const fullPath =
|
|
67380
|
+
const fullPath = path12.join(dirPath, entry.name);
|
|
67171
67381
|
const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
|
|
67172
67382
|
if (entry.isDirectory()) {
|
|
67173
67383
|
await updateModuleLocks(workspace, fullPath, relPath, scriptRemotePath, rawWorkspaceDependencies, defaultTs, changedModules);
|
|
@@ -67191,12 +67401,12 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
|
|
|
67191
67401
|
try {
|
|
67192
67402
|
const lock = await fetchScriptLock(workspace, moduleContent, modLanguage, moduleRemotePath, rawWorkspaceDependencies);
|
|
67193
67403
|
const baseName = entry.name.replace(/\.[^.]+$/, "");
|
|
67194
|
-
const lockPath =
|
|
67404
|
+
const lockPath = path12.join(dirPath, baseName + ".lock");
|
|
67195
67405
|
if (lock != "") {
|
|
67196
|
-
|
|
67406
|
+
writeFileSync5(lockPath, lock, "utf-8");
|
|
67197
67407
|
} else {
|
|
67198
67408
|
try {
|
|
67199
|
-
if (
|
|
67409
|
+
if (existsSync6(lockPath)) {
|
|
67200
67410
|
const { rm: rmAsync } = await import("node:fs/promises");
|
|
67201
67411
|
await rmAsync(lockPath);
|
|
67202
67412
|
}
|
|
@@ -67208,7 +67418,7 @@ async function updateModuleLocks(workspace, dirPath, relPrefix, scriptRemotePath
|
|
|
67208
67418
|
}
|
|
67209
67419
|
}
|
|
67210
67420
|
}
|
|
67211
|
-
async function inferSchema(language, content, currentSchema,
|
|
67421
|
+
async function inferSchema(language, content, currentSchema, path13) {
|
|
67212
67422
|
let inferedSchema;
|
|
67213
67423
|
if (language === "python3") {
|
|
67214
67424
|
const { parse_python } = await loadParser("windmill-parser-wasm-py");
|
|
@@ -67311,7 +67521,7 @@ async function inferSchema(language, content, currentSchema, path12) {
|
|
|
67311
67521
|
throw new Error("Invalid language: " + language);
|
|
67312
67522
|
}
|
|
67313
67523
|
if (inferedSchema.type == "Invalid") {
|
|
67314
|
-
info(colors.yellow(`Script ${
|
|
67524
|
+
info(colors.yellow(`Script ${path13} invalid, it cannot be parsed to infer schema.`));
|
|
67315
67525
|
return {
|
|
67316
67526
|
schema: defaultScriptMetadata().schema,
|
|
67317
67527
|
has_preprocessor: false,
|
|
@@ -67483,15 +67693,15 @@ async function readLockfile() {
|
|
|
67483
67693
|
return lock;
|
|
67484
67694
|
}
|
|
67485
67695
|
}
|
|
67486
|
-
function v2LockPath(
|
|
67487
|
-
const normalizedPath = normalizeLockPath(
|
|
67696
|
+
function v2LockPath(path13, subpath) {
|
|
67697
|
+
const normalizedPath = normalizeLockPath(path13);
|
|
67488
67698
|
if (subpath) {
|
|
67489
67699
|
return `${normalizedPath}+${normalizeLockPath(subpath)}`;
|
|
67490
67700
|
} else {
|
|
67491
67701
|
return normalizedPath;
|
|
67492
67702
|
}
|
|
67493
67703
|
}
|
|
67494
|
-
async function checkifMetadataUptodate(
|
|
67704
|
+
async function checkifMetadataUptodate(path13, hash2, conf, subpath) {
|
|
67495
67705
|
if (!conf) {
|
|
67496
67706
|
conf = await readLockfile();
|
|
67497
67707
|
}
|
|
@@ -67500,10 +67710,10 @@ async function checkifMetadataUptodate(path12, hash2, conf, subpath) {
|
|
|
67500
67710
|
}
|
|
67501
67711
|
const isV2 = conf?.version == "v2";
|
|
67502
67712
|
if (isV2) {
|
|
67503
|
-
const current = conf.locks?.[v2LockPath(
|
|
67713
|
+
const current = conf.locks?.[v2LockPath(path13, subpath)];
|
|
67504
67714
|
return current == hash2;
|
|
67505
67715
|
} else {
|
|
67506
|
-
const obj = conf.locks?.[
|
|
67716
|
+
const obj = conf.locks?.[path13];
|
|
67507
67717
|
const current = subpath && typeof obj == "object" ? obj?.[subpath] : obj;
|
|
67508
67718
|
return current == hash2;
|
|
67509
67719
|
}
|
|
@@ -67516,7 +67726,7 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
|
|
|
67516
67726
|
async function readDir2(dirPath, relPrefix) {
|
|
67517
67727
|
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
67518
67728
|
for (const entry of entries) {
|
|
67519
|
-
const fullPath =
|
|
67729
|
+
const fullPath = path12.join(dirPath, entry.name);
|
|
67520
67730
|
const relPath = relPrefix ? relPrefix + "/" + entry.name : entry.name;
|
|
67521
67731
|
const isTopLevel = relPrefix === "";
|
|
67522
67732
|
if (entry.isDirectory()) {
|
|
@@ -67536,14 +67746,14 @@ async function computeModuleHashes(moduleFolderPath, defaultTs, rawWorkspaceDepe
|
|
|
67536
67746
|
await readDir2(moduleFolderPath, "");
|
|
67537
67747
|
return hashes;
|
|
67538
67748
|
}
|
|
67539
|
-
async function clearGlobalLock(
|
|
67749
|
+
async function clearGlobalLock(path13) {
|
|
67540
67750
|
const conf = await readLockfile();
|
|
67541
67751
|
if (!conf?.locks) {
|
|
67542
67752
|
conf.locks = {};
|
|
67543
67753
|
}
|
|
67544
67754
|
const isV2 = conf?.version == "v2";
|
|
67545
67755
|
if (isV2) {
|
|
67546
|
-
const key = v2LockPath(
|
|
67756
|
+
const key = v2LockPath(path13);
|
|
67547
67757
|
if (conf.locks) {
|
|
67548
67758
|
Object.keys(conf.locks).forEach((k) => {
|
|
67549
67759
|
if (conf.locks) {
|
|
@@ -67556,24 +67766,24 @@ async function clearGlobalLock(path12) {
|
|
|
67556
67766
|
await writeFile8(WMILL_LOCKFILE, import_yaml13.stringify(conf, yamlOptions), "utf-8");
|
|
67557
67767
|
}
|
|
67558
67768
|
}
|
|
67559
|
-
async function updateMetadataGlobalLock(
|
|
67769
|
+
async function updateMetadataGlobalLock(path13, hash2, subpath) {
|
|
67560
67770
|
const conf = await readLockfile();
|
|
67561
67771
|
if (!conf?.locks) {
|
|
67562
67772
|
conf.locks = {};
|
|
67563
67773
|
}
|
|
67564
67774
|
const isV2 = conf?.version == "v2";
|
|
67565
67775
|
if (isV2) {
|
|
67566
|
-
conf.locks[v2LockPath(
|
|
67776
|
+
conf.locks[v2LockPath(path13, subpath)] = hash2;
|
|
67567
67777
|
} else {
|
|
67568
67778
|
if (subpath) {
|
|
67569
|
-
let prev = conf.locks[
|
|
67779
|
+
let prev = conf.locks[path13];
|
|
67570
67780
|
if (!prev || typeof prev != "object") {
|
|
67571
67781
|
prev = {};
|
|
67572
|
-
conf.locks[
|
|
67782
|
+
conf.locks[path13] = prev;
|
|
67573
67783
|
}
|
|
67574
67784
|
prev[subpath] = hash2;
|
|
67575
67785
|
} else {
|
|
67576
|
-
conf.locks[
|
|
67786
|
+
conf.locks[path13] = hash2;
|
|
67577
67787
|
}
|
|
67578
67788
|
}
|
|
67579
67789
|
await writeFile8(WMILL_LOCKFILE, import_yaml13.stringify(conf, yamlOptions), "utf-8");
|
|
@@ -67624,7 +67834,7 @@ __export(exports_raw_apps, {
|
|
|
67624
67834
|
generatingPolicy: () => generatingPolicy
|
|
67625
67835
|
});
|
|
67626
67836
|
import { sep as SEP10 } from "node:path";
|
|
67627
|
-
import
|
|
67837
|
+
import path13 from "node:path";
|
|
67628
67838
|
import { readdir as readdir6 } from "node:fs/promises";
|
|
67629
67839
|
async function readSiblingLock(backendPath, runnableId, allFiles) {
|
|
67630
67840
|
const target = `${runnableId.toLowerCase()}.lock`;
|
|
@@ -67632,7 +67842,7 @@ async function readSiblingLock(backendPath, runnableId, allFiles) {
|
|
|
67632
67842
|
if (!lockFile)
|
|
67633
67843
|
return;
|
|
67634
67844
|
try {
|
|
67635
|
-
return await readTextFile(
|
|
67845
|
+
return await readTextFile(path13.join(backendPath, lockFile));
|
|
67636
67846
|
} catch {
|
|
67637
67847
|
return;
|
|
67638
67848
|
}
|
|
@@ -67649,7 +67859,7 @@ async function findRunnableContentFile(backendPath, runnableId, allFiles) {
|
|
|
67649
67859
|
const ext2 = fileName.substring(runnableId.length + 1);
|
|
67650
67860
|
if (EXTENSION_TO_LANGUAGE[ext2]) {
|
|
67651
67861
|
try {
|
|
67652
|
-
const content = await readTextFile(
|
|
67862
|
+
const content = await readTextFile(path13.join(backendPath, fileName));
|
|
67653
67863
|
return { ext: ext2, content };
|
|
67654
67864
|
} catch {
|
|
67655
67865
|
continue;
|
|
@@ -67686,7 +67896,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
|
|
|
67686
67896
|
}
|
|
67687
67897
|
const runnableId = fileName.replace(".yaml", "");
|
|
67688
67898
|
processedIds.add(runnableId.toLowerCase());
|
|
67689
|
-
const filePath =
|
|
67899
|
+
const filePath = path13.join(backendPath, fileName);
|
|
67690
67900
|
const runnable = await yamlParseFile(filePath);
|
|
67691
67901
|
if (runnable?.type === "inline") {
|
|
67692
67902
|
const contentFile = await findRunnableContentFile(backendPath, runnableId, allFiles);
|
|
@@ -67747,12 +67957,12 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
|
|
|
67747
67957
|
...rest
|
|
67748
67958
|
};
|
|
67749
67959
|
}
|
|
67750
|
-
const filePath =
|
|
67960
|
+
const filePath = path13.join(backendPath, `${runnableId}.yaml`);
|
|
67751
67961
|
writeIfChanged(filePath, import_yaml16.stringify(runnableToWrite, yamlOptions));
|
|
67752
67962
|
}
|
|
67753
67963
|
async function collectAppFiles(localPath) {
|
|
67754
67964
|
const files = {};
|
|
67755
|
-
async function
|
|
67965
|
+
async function readDirRecursive2(dir, basePath = "/") {
|
|
67756
67966
|
const dirEntries = await readdir6(dir, { withFileTypes: true });
|
|
67757
67967
|
for (const entry of dirEntries) {
|
|
67758
67968
|
const fullPath = dir + entry.name;
|
|
@@ -67761,7 +67971,7 @@ async function collectAppFiles(localPath) {
|
|
|
67761
67971
|
if (entry.name === APP_BACKEND_FOLDER || entry.name === "node_modules" || entry.name === "dist" || entry.name === ".claude" || entry.name === "sql_to_apply") {
|
|
67762
67972
|
continue;
|
|
67763
67973
|
}
|
|
67764
|
-
await
|
|
67974
|
+
await readDirRecursive2(fullPath + SEP10, relativePath + "/");
|
|
67765
67975
|
} else if (entry.isFile()) {
|
|
67766
67976
|
if (entry.name === "raw_app.yaml" || entry.name === "package-lock.json" || entry.name === "DATATABLES.md" || entry.name === "AGENTS.md" || entry.name === "wmill.d.ts") {
|
|
67767
67977
|
continue;
|
|
@@ -67771,7 +67981,7 @@ async function collectAppFiles(localPath) {
|
|
|
67771
67981
|
}
|
|
67772
67982
|
}
|
|
67773
67983
|
}
|
|
67774
|
-
await
|
|
67984
|
+
await readDirRecursive2(localPath);
|
|
67775
67985
|
return files;
|
|
67776
67986
|
}
|
|
67777
67987
|
async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
@@ -67798,7 +68008,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
67798
68008
|
}
|
|
67799
68009
|
const appFilePath = localPath + "raw_app.yaml";
|
|
67800
68010
|
const localApp = await yamlParseFile(appFilePath);
|
|
67801
|
-
const backendPath =
|
|
68011
|
+
const backendPath = path13.join(localPath, APP_BACKEND_FOLDER);
|
|
67802
68012
|
const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
|
|
67803
68013
|
let runnables;
|
|
67804
68014
|
if (Object.keys(runnablesFromBackend).length > 0) {
|
|
@@ -67820,10 +68030,12 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
67820
68030
|
const frameworks = detectFrameworks(localPath);
|
|
67821
68031
|
const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
67822
68032
|
const entryPoint = localPath + entryFile;
|
|
68033
|
+
const sharedUiDir = path13.join(process.cwd(), "ui");
|
|
67823
68034
|
return await createBundle({
|
|
67824
68035
|
entryPoint,
|
|
67825
68036
|
production: true,
|
|
67826
|
-
minify: true
|
|
68037
|
+
minify: true,
|
|
68038
|
+
sharedUiDir
|
|
67827
68039
|
});
|
|
67828
68040
|
}
|
|
67829
68041
|
const value = { runnables, files };
|
|
@@ -67874,13 +68086,13 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
67874
68086
|
});
|
|
67875
68087
|
}
|
|
67876
68088
|
}
|
|
67877
|
-
async function generatingPolicy(app,
|
|
67878
|
-
info(colors.gray(`Generating fresh policy for app ${
|
|
68089
|
+
async function generatingPolicy(app, path14, publicApp) {
|
|
68090
|
+
info(colors.gray(`Generating fresh policy for app ${path14}...`));
|
|
67879
68091
|
try {
|
|
67880
68092
|
app.policy = await updateRawAppPolicy(app.runnables, app.policy);
|
|
67881
68093
|
app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
|
|
67882
68094
|
} catch (e) {
|
|
67883
|
-
error(colors.red(`Error generating policy for app ${
|
|
68095
|
+
error(colors.red(`Error generating policy for app ${path14}: ${e}`));
|
|
67884
68096
|
throw e;
|
|
67885
68097
|
}
|
|
67886
68098
|
}
|
|
@@ -67918,11 +68130,11 @@ __export(exports_app_metadata, {
|
|
|
67918
68130
|
filterWorkspaceDependenciesForApp: () => filterWorkspaceDependenciesForApp,
|
|
67919
68131
|
APP_BACKEND_FOLDER: () => APP_BACKEND_FOLDER
|
|
67920
68132
|
});
|
|
67921
|
-
import
|
|
68133
|
+
import path14 from "node:path";
|
|
67922
68134
|
import { mkdir as mkdir6, readdir as readdir7 } from "node:fs/promises";
|
|
67923
68135
|
import { sep as SEP11 } from "node:path";
|
|
67924
68136
|
async function generateAppHash(rawReqs, folder, rawApp, defaultTs) {
|
|
67925
|
-
const runnablesFolder = rawApp ?
|
|
68137
|
+
const runnablesFolder = rawApp ? path14.join(folder, APP_BACKEND_FOLDER) : folder;
|
|
67926
68138
|
const hashes = {};
|
|
67927
68139
|
try {
|
|
67928
68140
|
const elems = await FSFSElement(runnablesFolder, [], true);
|
|
@@ -67957,7 +68169,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
|
|
|
67957
68169
|
if (!justUpdateMetadataLock && !noStaleMessage) {
|
|
67958
68170
|
info(`Generating locks for app ${appFolder} at ${remote_path}`);
|
|
67959
68171
|
}
|
|
67960
|
-
const appFilePath =
|
|
68172
|
+
const appFilePath = path14.join(appFolder, rawApp ? "raw_app.yaml" : "app.yaml");
|
|
67961
68173
|
const appFile = await yamlParseFile(appFilePath);
|
|
67962
68174
|
const appValue = rawApp ? appFile.runnables : appFile.value;
|
|
67963
68175
|
const folderNormalized = appFolder.replaceAll(SEP11, "/");
|
|
@@ -67969,7 +68181,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
|
|
|
67969
68181
|
const isDirectlyStale = !await checkifMetadataUptodate(appFolder, hashes[TOP_HASH2], conf, TOP_HASH2);
|
|
67970
68182
|
let treeAppValue = structuredClone(appValue);
|
|
67971
68183
|
if (rawApp) {
|
|
67972
|
-
const runnablesPath =
|
|
68184
|
+
const runnablesPath = path14.join(appFolder, APP_BACKEND_FOLDER);
|
|
67973
68185
|
const runnablesFromFiles = await loadRunnablesFromBackend(runnablesPath);
|
|
67974
68186
|
if (Object.keys(runnablesFromFiles).length > 0) {
|
|
67975
68187
|
treeAppValue = runnablesFromFiles;
|
|
@@ -68035,7 +68247,7 @@ async function generateAppLocksInternal(appFolder, rawApp, dryRun, workspace, op
|
|
|
68035
68247
|
info(`Recomputing locks of ${changedScripts.join(", ")} in ${appFolder}`);
|
|
68036
68248
|
}
|
|
68037
68249
|
if (rawApp) {
|
|
68038
|
-
const runnablesPath =
|
|
68250
|
+
const runnablesPath = path14.join(appFolder, APP_BACKEND_FOLDER);
|
|
68039
68251
|
const rawAppFile = appFile;
|
|
68040
68252
|
let runnables = await loadRunnablesFromBackend(runnablesPath);
|
|
68041
68253
|
if (Object.keys(runnables).length === 0 && rawAppFile.runnables) {
|
|
@@ -68108,7 +68320,7 @@ async function traverseAndProcessInlineScripts(obj, processor, currentPath = [])
|
|
|
68108
68320
|
}
|
|
68109
68321
|
async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder, rawDeps, defaultTs = "bun", noStaleMessage, tempScriptRefs) {
|
|
68110
68322
|
const updatedRunnables = [];
|
|
68111
|
-
const runnablesFolder =
|
|
68323
|
+
const runnablesFolder = path14.join(appFolder, APP_BACKEND_FOLDER);
|
|
68112
68324
|
try {
|
|
68113
68325
|
await mkdir6(runnablesFolder, { recursive: true });
|
|
68114
68326
|
} catch {}
|
|
@@ -68133,7 +68345,7 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
|
|
|
68133
68345
|
if (language === "frontend") {
|
|
68134
68346
|
const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
|
|
68135
68347
|
const basePath = basePathO.replaceAll(SEP11, "/");
|
|
68136
|
-
const contentPath =
|
|
68348
|
+
const contentPath = path14.join(runnablesFolder, `${basePath}${ext2}`);
|
|
68137
68349
|
writeIfChanged(contentPath, content);
|
|
68138
68350
|
const simplifiedRunnable = { type: "inline" };
|
|
68139
68351
|
for (const [key, value] of Object.entries(runnable)) {
|
|
@@ -68151,8 +68363,8 @@ async function updateRawAppRunnables(workspace, runnables, remotePath, appFolder
|
|
|
68151
68363
|
const lock = await generateInlineScriptLock(workspace, content, language, `${remotePath}/${runnableId}`, rawDeps, tempScriptRefs);
|
|
68152
68364
|
const [basePathO, ext2] = pathAssigner.assignPath(runnableId, language);
|
|
68153
68365
|
const basePath = basePathO.replaceAll(SEP11, "/");
|
|
68154
|
-
const contentPath =
|
|
68155
|
-
const lockPath =
|
|
68366
|
+
const contentPath = path14.join(runnablesFolder, `${basePath}${ext2}`);
|
|
68367
|
+
const lockPath = path14.join(runnablesFolder, `${basePath}lock`);
|
|
68156
68368
|
writeIfChanged(contentPath, content);
|
|
68157
68369
|
if (lock && lock !== "") {
|
|
68158
68370
|
writeIfChanged(lockPath, lock);
|
|
@@ -68200,8 +68412,8 @@ async function updateAppInlineScripts(workspace, appValue, remotePath, appFolder
|
|
|
68200
68412
|
}
|
|
68201
68413
|
const [basePathO, ext2] = pathAssigner.assignPath(scriptName, language);
|
|
68202
68414
|
const basePath = basePathO.replaceAll(SEP11, "/");
|
|
68203
|
-
const contentPath =
|
|
68204
|
-
const lockPath =
|
|
68415
|
+
const contentPath = path14.join(appFolder, `${basePath}${ext2}`);
|
|
68416
|
+
const lockPath = path14.join(appFolder, `${basePath}lock`);
|
|
68205
68417
|
writeIfChanged(contentPath, content);
|
|
68206
68418
|
if (lock && lock !== "") {
|
|
68207
68419
|
writeIfChanged(lockPath, lock);
|
|
@@ -68274,7 +68486,7 @@ ${text}`);
|
|
|
68274
68486
|
return lock ?? "";
|
|
68275
68487
|
}
|
|
68276
68488
|
async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultTs = "bun") {
|
|
68277
|
-
const fileName =
|
|
68489
|
+
const fileName = path14.basename(runnableFilePath);
|
|
68278
68490
|
if (fileName.endsWith(".lock") || fileName.endsWith(".yaml")) {
|
|
68279
68491
|
return;
|
|
68280
68492
|
}
|
|
@@ -68289,13 +68501,13 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
|
|
|
68289
68501
|
if (!runnableId || !ext2) {
|
|
68290
68502
|
return;
|
|
68291
68503
|
}
|
|
68292
|
-
const runnableFilePath2 =
|
|
68504
|
+
const runnableFilePath2 = path14.join(appFolder, APP_BACKEND_FOLDER, `${runnableId}.yaml`);
|
|
68293
68505
|
let runnable;
|
|
68294
68506
|
try {
|
|
68295
68507
|
runnable = await yamlParseFile(runnableFilePath2);
|
|
68296
68508
|
} catch {
|
|
68297
68509
|
try {
|
|
68298
|
-
const appFilePath =
|
|
68510
|
+
const appFilePath = path14.join(appFolder, "raw_app.yaml");
|
|
68299
68511
|
const appFile = await yamlParseFile(appFilePath);
|
|
68300
68512
|
if (!appFile.runnables?.[runnableId]) {
|
|
68301
68513
|
warn(colors.yellow(`Runnable ${runnableId} not found in backend folder or raw_app.yaml`));
|
|
@@ -68320,7 +68532,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
|
|
|
68320
68532
|
warn(colors.yellow(`Could not determine language for ${runnableId} (ext: ${ext2})`));
|
|
68321
68533
|
return;
|
|
68322
68534
|
}
|
|
68323
|
-
const fullFilePath =
|
|
68535
|
+
const fullFilePath = path14.join(appFolder, APP_BACKEND_FOLDER, runnableFilePath);
|
|
68324
68536
|
let content;
|
|
68325
68537
|
try {
|
|
68326
68538
|
content = await readTextFile(fullFilePath);
|
|
@@ -68343,7 +68555,7 @@ async function inferRunnableSchemaFromFile(appFolder, runnableFilePath, defaultT
|
|
|
68343
68555
|
}
|
|
68344
68556
|
async function inferAllInlineSchemas(appFolder, defaultTs = "bun") {
|
|
68345
68557
|
const schemas = {};
|
|
68346
|
-
const backendPath =
|
|
68558
|
+
const backendPath = path14.join(appFolder, APP_BACKEND_FOLDER);
|
|
68347
68559
|
let entries;
|
|
68348
68560
|
try {
|
|
68349
68561
|
entries = await readdir7(backendPath, { withFileTypes: true });
|
|
@@ -68450,9 +68662,9 @@ var init_app_metadata = __esm(async () => {
|
|
|
68450
68662
|
});
|
|
68451
68663
|
|
|
68452
68664
|
// src/commands/app/generate_agents.ts
|
|
68453
|
-
import * as
|
|
68665
|
+
import * as fs10 from "node:fs";
|
|
68454
68666
|
import { writeFile as writeFile9 } from "node:fs/promises";
|
|
68455
|
-
import
|
|
68667
|
+
import path15 from "node:path";
|
|
68456
68668
|
import process15 from "node:process";
|
|
68457
68669
|
function generateDatatablesMarkdown(schemas, localData) {
|
|
68458
68670
|
const defaultDatatable = localData?.datatable;
|
|
@@ -68552,8 +68764,8 @@ Configure datatables in Workspace Settings > Windmill Data Tables.
|
|
|
68552
68764
|
return content;
|
|
68553
68765
|
}
|
|
68554
68766
|
async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
|
|
68555
|
-
const rawAppPath =
|
|
68556
|
-
if (!
|
|
68767
|
+
const rawAppPath = path15.join(targetDir, "raw_app.yaml");
|
|
68768
|
+
if (!fs10.existsSync(rawAppPath)) {
|
|
68557
68769
|
if (!silent) {
|
|
68558
68770
|
error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
|
|
68559
68771
|
}
|
|
@@ -68579,11 +68791,11 @@ async function regenerateAgentDocs(workspaceId, targetDir, silent = false) {
|
|
|
68579
68791
|
}
|
|
68580
68792
|
} catch {}
|
|
68581
68793
|
const agentsContent = generateAgentsDocumentation(localData);
|
|
68582
|
-
await writeFile9(
|
|
68583
|
-
await writeFile9(
|
|
68794
|
+
await writeFile9(path15.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");
|
|
68795
|
+
await writeFile9(path15.join(targetDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
|
|
68584
68796
|
`, "utf-8");
|
|
68585
68797
|
const datatablesContent = generateDatatablesMarkdown(schemas, localData);
|
|
68586
|
-
await writeFile9(
|
|
68798
|
+
await writeFile9(path15.join(targetDir, "DATATABLES.md"), datatablesContent, "utf-8");
|
|
68587
68799
|
if (!silent) {
|
|
68588
68800
|
info(colors.green(`✓ Generated AGENTS.md, CLAUDE.md, and DATATABLES.md`));
|
|
68589
68801
|
const datatableCount = schemas.length;
|
|
@@ -68604,19 +68816,19 @@ async function generateAgents(opts, appFolder) {
|
|
|
68604
68816
|
const cwd = process15.cwd();
|
|
68605
68817
|
let targetDir = cwd;
|
|
68606
68818
|
if (appFolder) {
|
|
68607
|
-
targetDir =
|
|
68819
|
+
targetDir = path15.isAbsolute(appFolder) ? appFolder : path15.join(cwd, appFolder);
|
|
68608
68820
|
}
|
|
68609
68821
|
await loadNonDottedPathsSetting();
|
|
68610
|
-
const dirName =
|
|
68822
|
+
const dirName = path15.basename(targetDir);
|
|
68611
68823
|
if (!hasFolderSuffix(dirName, "raw_app")) {
|
|
68612
|
-
if (!hasFolderSuffix(
|
|
68824
|
+
if (!hasFolderSuffix(path15.basename(cwd), "raw_app") && !appFolder) {
|
|
68613
68825
|
error(colors.red(`Error: Must be run inside a ${getFolderSuffix("raw_app")} folder or specify one as argument.`));
|
|
68614
68826
|
info(colors.gray("Usage: wmill app generate-agents [app_folder]"));
|
|
68615
68827
|
process15.exit(1);
|
|
68616
68828
|
}
|
|
68617
68829
|
}
|
|
68618
|
-
const rawAppPath =
|
|
68619
|
-
if (!
|
|
68830
|
+
const rawAppPath = path15.join(targetDir, "raw_app.yaml");
|
|
68831
|
+
if (!fs10.existsSync(rawAppPath)) {
|
|
68620
68832
|
error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
|
|
68621
68833
|
process15.exit(1);
|
|
68622
68834
|
}
|
|
@@ -68644,31 +68856,31 @@ var init_generate_agents = __esm(async () => {
|
|
|
68644
68856
|
// src/commands/app/dev.ts
|
|
68645
68857
|
import { sep as SEP12 } from "node:path";
|
|
68646
68858
|
import * as http2 from "node:http";
|
|
68647
|
-
import * as
|
|
68648
|
-
import * as
|
|
68859
|
+
import * as fs11 from "node:fs";
|
|
68860
|
+
import * as path16 from "node:path";
|
|
68649
68861
|
import process16 from "node:process";
|
|
68650
|
-
import { writeFileSync as
|
|
68862
|
+
import { writeFileSync as writeFileSync6 } from "node:fs";
|
|
68651
68863
|
async function dev(opts, appFolder) {
|
|
68652
68864
|
GLOBAL_CONFIG_OPT.noCdToRoot = true;
|
|
68653
68865
|
await loadNonDottedPathsSetting();
|
|
68654
68866
|
const originalCwd = process16.cwd();
|
|
68655
68867
|
let targetDir = originalCwd;
|
|
68656
68868
|
if (appFolder) {
|
|
68657
|
-
targetDir =
|
|
68658
|
-
if (!
|
|
68869
|
+
targetDir = path16.isAbsolute(appFolder) ? appFolder : path16.join(originalCwd, appFolder);
|
|
68870
|
+
if (!fs11.existsSync(targetDir)) {
|
|
68659
68871
|
error(colors.red(`Error: Directory not found: ${targetDir}`));
|
|
68660
68872
|
process16.exit(1);
|
|
68661
68873
|
}
|
|
68662
68874
|
}
|
|
68663
|
-
const targetDirName =
|
|
68875
|
+
const targetDirName = path16.basename(targetDir);
|
|
68664
68876
|
if (!hasFolderSuffix(targetDirName, "raw_app")) {
|
|
68665
68877
|
error(colors.red(`Error: The dev command must be run inside a ${getFolderSuffix("raw_app")} folder.
|
|
68666
68878
|
` + `Target directory: ${targetDirName}
|
|
68667
68879
|
` + `Please navigate to a folder ending with '${getFolderSuffix("raw_app")}' or specify one as argument.`));
|
|
68668
68880
|
process16.exit(1);
|
|
68669
68881
|
}
|
|
68670
|
-
const rawAppPath =
|
|
68671
|
-
if (!
|
|
68882
|
+
const rawAppPath = path16.join(targetDir, "raw_app.yaml");
|
|
68883
|
+
if (!fs11.existsSync(rawAppPath)) {
|
|
68672
68884
|
error(colors.red(`Error: raw_app.yaml not found in ${targetDir}.
|
|
68673
68885
|
` + `The dev command requires a ${getFolderSuffix("raw_app")} folder containing a raw_app.yaml file.`));
|
|
68674
68886
|
process16.exit(1);
|
|
@@ -68694,11 +68906,11 @@ async function dev(opts, appFolder) {
|
|
|
68694
68906
|
const frameworks = detectFrameworks(process16.cwd());
|
|
68695
68907
|
const defaultEntry = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
68696
68908
|
const entryPoint = opts.entry ?? defaultEntry;
|
|
68697
|
-
if (!
|
|
68909
|
+
if (!fs11.existsSync(entryPoint)) {
|
|
68698
68910
|
error(colors.red(`Entry point "${entryPoint}" not found. Please specify a valid entry point with --entry.`));
|
|
68699
68911
|
process16.exit(1);
|
|
68700
68912
|
}
|
|
68701
|
-
const appDir =
|
|
68913
|
+
const appDir = path16.dirname(entryPoint) || process16.cwd();
|
|
68702
68914
|
await ensureNodeModules(appDir);
|
|
68703
68915
|
const inferredSchemas = {};
|
|
68704
68916
|
try {
|
|
@@ -68708,15 +68920,15 @@ async function dev(opts, appFolder) {
|
|
|
68708
68920
|
}
|
|
68709
68921
|
const pathRunnableSchemas = {};
|
|
68710
68922
|
try {
|
|
68711
|
-
const initialRunnables = await loadRunnablesFromBackend(
|
|
68923
|
+
const initialRunnables = await loadRunnablesFromBackend(path16.join(process16.cwd(), APP_BACKEND_FOLDER));
|
|
68712
68924
|
Object.assign(pathRunnableSchemas, await fetchPathRunnableSchemas(workspaceId, initialRunnables));
|
|
68713
68925
|
} catch (err) {
|
|
68714
68926
|
warn(colors.yellow(`Could not fetch schemas for path-based runnables: ${err.message}`));
|
|
68715
68927
|
}
|
|
68716
68928
|
await genRunnablesTs(inferredSchemas, pathRunnableSchemas);
|
|
68717
|
-
const distDir =
|
|
68718
|
-
if (!
|
|
68719
|
-
|
|
68929
|
+
const distDir = path16.join(process16.cwd(), "dist");
|
|
68930
|
+
if (!fs11.existsSync(distDir)) {
|
|
68931
|
+
fs11.mkdirSync(distDir);
|
|
68720
68932
|
}
|
|
68721
68933
|
const clients = [];
|
|
68722
68934
|
function notifyClients() {
|
|
@@ -68777,20 +68989,20 @@ data: reload
|
|
|
68777
68989
|
info(colors.blue(`\uD83D\uDC40 Watching for file changes...
|
|
68778
68990
|
`));
|
|
68779
68991
|
await ctx.rebuild();
|
|
68780
|
-
const runnablesPath =
|
|
68992
|
+
const runnablesPath = path16.join(process16.cwd(), APP_BACKEND_FOLDER);
|
|
68781
68993
|
let runnablesWatcher;
|
|
68782
|
-
if (
|
|
68994
|
+
if (fs11.existsSync(runnablesPath)) {
|
|
68783
68995
|
info(colors.blue(`\uD83D\uDC41️ Watching runnables folder at: ${runnablesPath}
|
|
68784
68996
|
`));
|
|
68785
|
-
runnablesWatcher =
|
|
68997
|
+
runnablesWatcher = fs11.watch(runnablesPath, { recursive: true });
|
|
68786
68998
|
const schemaInferenceTimeouts = {};
|
|
68787
68999
|
const SCHEMA_DEBOUNCE_MS = 500;
|
|
68788
69000
|
runnablesWatcher.on("change", (_eventType, filename) => {
|
|
68789
69001
|
if (!filename)
|
|
68790
69002
|
return;
|
|
68791
69003
|
const fileStr = typeof filename === "string" ? filename : filename.toString();
|
|
68792
|
-
const changedPath =
|
|
68793
|
-
const relativePath =
|
|
69004
|
+
const changedPath = path16.join(runnablesPath, fileStr);
|
|
69005
|
+
const relativePath = path16.relative(process16.cwd(), changedPath);
|
|
68794
69006
|
const relativeToRunnables = fileStr;
|
|
68795
69007
|
if (changedPath.endsWith(".lock")) {
|
|
68796
69008
|
return;
|
|
@@ -68841,10 +69053,10 @@ data: reload
|
|
|
68841
69053
|
return;
|
|
68842
69054
|
}
|
|
68843
69055
|
if (url === "/dist/bundle.js" || url === "/bundle.js") {
|
|
68844
|
-
const jsPath =
|
|
68845
|
-
if (
|
|
69056
|
+
const jsPath = path16.join(process16.cwd(), "dist/bundle.js");
|
|
69057
|
+
if (fs11.existsSync(jsPath)) {
|
|
68846
69058
|
res.writeHead(200, { "Content-Type": "application/javascript" });
|
|
68847
|
-
res.end(
|
|
69059
|
+
res.end(fs11.readFileSync(jsPath));
|
|
68848
69060
|
} else {
|
|
68849
69061
|
res.writeHead(404);
|
|
68850
69062
|
res.end("Bundle not found");
|
|
@@ -68852,10 +69064,10 @@ data: reload
|
|
|
68852
69064
|
return;
|
|
68853
69065
|
}
|
|
68854
69066
|
if (url === "/dist/bundle.css" || url === "/bundle.css") {
|
|
68855
|
-
const cssPath =
|
|
68856
|
-
if (
|
|
69067
|
+
const cssPath = path16.join(process16.cwd(), "dist/bundle.css");
|
|
69068
|
+
if (fs11.existsSync(cssPath)) {
|
|
68857
69069
|
res.writeHead(200, { "Content-Type": "text/css" });
|
|
68858
|
-
res.end(
|
|
69070
|
+
res.end(fs11.readFileSync(cssPath));
|
|
68859
69071
|
} else {
|
|
68860
69072
|
res.writeHead(404);
|
|
68861
69073
|
res.end("CSS not found");
|
|
@@ -68863,10 +69075,10 @@ data: reload
|
|
|
68863
69075
|
return;
|
|
68864
69076
|
}
|
|
68865
69077
|
if (url === "/dist/bundle.js.map" || url === "/bundle.js.map") {
|
|
68866
|
-
const mapPath =
|
|
68867
|
-
if (
|
|
69078
|
+
const mapPath = path16.join(process16.cwd(), "dist/bundle.js.map");
|
|
69079
|
+
if (fs11.existsSync(mapPath)) {
|
|
68868
69080
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
68869
|
-
res.end(
|
|
69081
|
+
res.end(fs11.readFileSync(mapPath));
|
|
68870
69082
|
} else {
|
|
68871
69083
|
res.writeHead(404);
|
|
68872
69084
|
res.end("Source map not found");
|
|
@@ -68874,10 +69086,10 @@ data: reload
|
|
|
68874
69086
|
return;
|
|
68875
69087
|
}
|
|
68876
69088
|
if (url === "/dist/bundle.css.map" || url === "/bundle.css.map") {
|
|
68877
|
-
const mapPath =
|
|
68878
|
-
if (
|
|
69089
|
+
const mapPath = path16.join(process16.cwd(), "dist/bundle.css.map");
|
|
69090
|
+
if (fs11.existsSync(mapPath)) {
|
|
68879
69091
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
68880
|
-
res.end(
|
|
69092
|
+
res.end(fs11.readFileSync(mapPath));
|
|
68881
69093
|
} else {
|
|
68882
69094
|
res.writeHead(404);
|
|
68883
69095
|
res.end("Source map not found");
|
|
@@ -68888,12 +69100,12 @@ data: reload
|
|
|
68888
69100
|
res.end(createHTML("/dist/bundle.js", "/dist/bundle.css"));
|
|
68889
69101
|
});
|
|
68890
69102
|
const wss = new import_websocket_server.default({ server });
|
|
68891
|
-
const sqlToApplyPath =
|
|
69103
|
+
const sqlToApplyPath = path16.join(process16.cwd(), "sql_to_apply");
|
|
68892
69104
|
const sqlFileQueue = [];
|
|
68893
69105
|
let currentSqlFile = null;
|
|
68894
69106
|
async function getDatatableConfig() {
|
|
68895
69107
|
try {
|
|
68896
|
-
const rawApp2 = await yamlParseFile(
|
|
69108
|
+
const rawApp2 = await yamlParseFile(path16.join(process16.cwd(), "raw_app.yaml"));
|
|
68897
69109
|
return rawApp2?.data?.datatable;
|
|
68898
69110
|
} catch {
|
|
68899
69111
|
return;
|
|
@@ -68929,13 +69141,13 @@ data: reload
|
|
|
68929
69141
|
return;
|
|
68930
69142
|
}
|
|
68931
69143
|
const filePath = sqlFileQueue.shift();
|
|
68932
|
-
if (!
|
|
68933
|
-
info(colors.gray(`File no longer exists: ${
|
|
69144
|
+
if (!fs11.existsSync(filePath)) {
|
|
69145
|
+
info(colors.gray(`File no longer exists: ${path16.basename(filePath)}`));
|
|
68934
69146
|
await processNextSqlFile();
|
|
68935
69147
|
return;
|
|
68936
69148
|
}
|
|
68937
69149
|
currentSqlFile = filePath;
|
|
68938
|
-
const fileName =
|
|
69150
|
+
const fileName = path16.basename(filePath);
|
|
68939
69151
|
try {
|
|
68940
69152
|
const sqlContent = await readTextFile(filePath);
|
|
68941
69153
|
if (!sqlContent.trim()) {
|
|
@@ -68954,12 +69166,12 @@ data: reload
|
|
|
68954
69166
|
}
|
|
68955
69167
|
}
|
|
68956
69168
|
async function onSqlFileCompleted(filePath, deleteFile) {
|
|
68957
|
-
if (deleteFile &&
|
|
69169
|
+
if (deleteFile && fs11.existsSync(filePath)) {
|
|
68958
69170
|
try {
|
|
68959
|
-
|
|
68960
|
-
info(colors.green(`✓ Deleted: ${
|
|
69171
|
+
fs11.unlinkSync(filePath);
|
|
69172
|
+
info(colors.green(`✓ Deleted: ${path16.basename(filePath)}`));
|
|
68961
69173
|
} catch (error2) {
|
|
68962
|
-
error(colors.red(`Failed to delete ${
|
|
69174
|
+
error(colors.red(`Failed to delete ${path16.basename(filePath)}: ${error2.message}`));
|
|
68963
69175
|
}
|
|
68964
69176
|
}
|
|
68965
69177
|
currentSqlFile = null;
|
|
@@ -68967,11 +69179,11 @@ data: reload
|
|
|
68967
69179
|
}
|
|
68968
69180
|
wss.on("connection", async (ws) => {
|
|
68969
69181
|
info(colors.cyan("[WebSocket] Client connected"));
|
|
68970
|
-
if (currentSqlFile &&
|
|
69182
|
+
if (currentSqlFile && fs11.existsSync(currentSqlFile)) {
|
|
68971
69183
|
try {
|
|
68972
69184
|
const sqlContent = await readTextFile(currentSqlFile);
|
|
68973
69185
|
const datatable = await getDatatableConfig();
|
|
68974
|
-
const fileName =
|
|
69186
|
+
const fileName = path16.basename(currentSqlFile);
|
|
68975
69187
|
ws.send(JSON.stringify({
|
|
68976
69188
|
type: "sqlMigration",
|
|
68977
69189
|
fileName,
|
|
@@ -68980,12 +69192,12 @@ data: reload
|
|
|
68980
69192
|
}));
|
|
68981
69193
|
info(colors.magenta(`\uD83D\uDCCB Sent pending SQL file to new client: ${fileName}`));
|
|
68982
69194
|
} catch {}
|
|
68983
|
-
} else if (
|
|
68984
|
-
const entries =
|
|
69195
|
+
} else if (fs11.existsSync(sqlToApplyPath)) {
|
|
69196
|
+
const entries = fs11.readdirSync(sqlToApplyPath);
|
|
68985
69197
|
const sqlFiles = entries.filter((entry) => entry.endsWith(".sql"));
|
|
68986
69198
|
if (sqlFiles.length > 0 && sqlFileQueue.length === 0) {
|
|
68987
69199
|
for (const sqlFile of sqlFiles.sort()) {
|
|
68988
|
-
queueSqlFile(
|
|
69200
|
+
queueSqlFile(path16.join(sqlToApplyPath, sqlFile));
|
|
68989
69201
|
}
|
|
68990
69202
|
await processNextSqlFile();
|
|
68991
69203
|
}
|
|
@@ -69153,18 +69365,18 @@ data: reload
|
|
|
69153
69365
|
});
|
|
69154
69366
|
let sqlWatcher;
|
|
69155
69367
|
async function scanExistingSqlFiles() {
|
|
69156
|
-
if (!
|
|
69368
|
+
if (!fs11.existsSync(sqlToApplyPath)) {
|
|
69157
69369
|
return;
|
|
69158
69370
|
}
|
|
69159
69371
|
try {
|
|
69160
|
-
const entries =
|
|
69372
|
+
const entries = fs11.readdirSync(sqlToApplyPath);
|
|
69161
69373
|
const sqlFiles = entries.filter((entry) => entry.endsWith(".sql")).sort();
|
|
69162
69374
|
if (sqlFiles.length === 0) {
|
|
69163
69375
|
return;
|
|
69164
69376
|
}
|
|
69165
69377
|
info(colors.blue(`\uD83D\uDD0D Found ${sqlFiles.length} SQL file(s) in sql_to_apply/`));
|
|
69166
69378
|
for (const sqlFile of sqlFiles) {
|
|
69167
|
-
const filePath =
|
|
69379
|
+
const filePath = path16.join(sqlToApplyPath, sqlFile);
|
|
69168
69380
|
queueSqlFile(filePath);
|
|
69169
69381
|
}
|
|
69170
69382
|
await processNextSqlFile();
|
|
@@ -69172,21 +69384,21 @@ data: reload
|
|
|
69172
69384
|
error(colors.red(`Error scanning sql_to_apply folder: ${error2.message}`));
|
|
69173
69385
|
}
|
|
69174
69386
|
}
|
|
69175
|
-
if (
|
|
69387
|
+
if (fs11.existsSync(sqlToApplyPath)) {
|
|
69176
69388
|
info(colors.blue(`\uD83D\uDDC3️ Watching sql_to_apply folder at: ${sqlToApplyPath}
|
|
69177
69389
|
`));
|
|
69178
|
-
sqlWatcher =
|
|
69390
|
+
sqlWatcher = fs11.watch(sqlToApplyPath, { recursive: true });
|
|
69179
69391
|
const sqlDebounceTimeouts = {};
|
|
69180
69392
|
const SQL_DEBOUNCE_MS = 300;
|
|
69181
69393
|
sqlWatcher.on("change", (_eventType, filename) => {
|
|
69182
69394
|
if (!filename)
|
|
69183
69395
|
return;
|
|
69184
69396
|
const fileStr = typeof filename === "string" ? filename : filename.toString();
|
|
69185
|
-
const changedPath =
|
|
69397
|
+
const changedPath = path16.join(sqlToApplyPath, fileStr);
|
|
69186
69398
|
if (!changedPath.endsWith(".sql")) {
|
|
69187
69399
|
return;
|
|
69188
69400
|
}
|
|
69189
|
-
const fileName =
|
|
69401
|
+
const fileName = path16.basename(changedPath);
|
|
69190
69402
|
if (sqlDebounceTimeouts[changedPath]) {
|
|
69191
69403
|
clearTimeout(sqlDebounceTimeouts[changedPath]);
|
|
69192
69404
|
}
|
|
@@ -69244,11 +69456,11 @@ data: reload
|
|
|
69244
69456
|
async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides = {}) {
|
|
69245
69457
|
info(colors.blue("\uD83D\uDD04 Generating wmill.d.ts..."));
|
|
69246
69458
|
const localPath = process16.cwd();
|
|
69247
|
-
const backendPath =
|
|
69459
|
+
const backendPath = path16.join(localPath, APP_BACKEND_FOLDER);
|
|
69248
69460
|
let runnables = await loadRunnablesFromBackend(backendPath);
|
|
69249
69461
|
if (Object.keys(runnables).length === 0) {
|
|
69250
69462
|
try {
|
|
69251
|
-
const rawApp = await yamlParseFile(
|
|
69463
|
+
const rawApp = await yamlParseFile(path16.join(localPath, "raw_app.yaml"));
|
|
69252
69464
|
runnables = rawApp?.["runnables"] ?? {};
|
|
69253
69465
|
} catch {
|
|
69254
69466
|
runnables = {};
|
|
@@ -69256,7 +69468,7 @@ async function genRunnablesTs(inlineSchemaOverrides = {}, pathSchemaOverrides =
|
|
|
69256
69468
|
}
|
|
69257
69469
|
try {
|
|
69258
69470
|
const newWmillTs = buildWmillTs(runnables, inlineSchemaOverrides, pathSchemaOverrides);
|
|
69259
|
-
|
|
69471
|
+
writeFileSync6(path16.join(process16.cwd(), "wmill.d.ts"), newWmillTs);
|
|
69260
69472
|
} catch (error2) {
|
|
69261
69473
|
error(colors.red(`Failed to generate wmill.d.ts: ${error2.message}`));
|
|
69262
69474
|
}
|
|
@@ -69326,10 +69538,10 @@ function convertRunnablesToApiFormat(runnables) {
|
|
|
69326
69538
|
async function loadRunnables() {
|
|
69327
69539
|
try {
|
|
69328
69540
|
const localPath = process16.cwd();
|
|
69329
|
-
const backendPath =
|
|
69541
|
+
const backendPath = path16.join(localPath, APP_BACKEND_FOLDER);
|
|
69330
69542
|
let runnables = await loadRunnablesFromBackend(backendPath);
|
|
69331
69543
|
if (Object.keys(runnables).length === 0) {
|
|
69332
|
-
const rawApp = await yamlParseFile(
|
|
69544
|
+
const rawApp = await yamlParseFile(path16.join(localPath, "raw_app.yaml"));
|
|
69333
69545
|
runnables = rawApp?.runnables ?? {};
|
|
69334
69546
|
}
|
|
69335
69547
|
convertRunnablesToApiFormat(runnables);
|
|
@@ -69817,8 +70029,8 @@ var init_dev = __esm(async () => {
|
|
|
69817
70029
|
});
|
|
69818
70030
|
|
|
69819
70031
|
// src/commands/app/lint.ts
|
|
69820
|
-
import * as
|
|
69821
|
-
import * as
|
|
70032
|
+
import * as fs12 from "node:fs";
|
|
70033
|
+
import * as path17 from "node:path";
|
|
69822
70034
|
import process17 from "node:process";
|
|
69823
70035
|
function validateRawAppYaml(appData) {
|
|
69824
70036
|
const errors = [];
|
|
@@ -69833,7 +70045,7 @@ function validateRawAppYaml(appData) {
|
|
|
69833
70045
|
async function validateRunnables(appDir, appData) {
|
|
69834
70046
|
const errors = [];
|
|
69835
70047
|
const warnings = [];
|
|
69836
|
-
const backendPath =
|
|
70048
|
+
const backendPath = path17.join(appDir, APP_BACKEND_FOLDER);
|
|
69837
70049
|
const runnablesFromBackend = await loadRunnablesFromBackend(backendPath);
|
|
69838
70050
|
const hasBackendRunnables = Object.keys(runnablesFromBackend).length > 0;
|
|
69839
70051
|
const hasYamlRunnables = appData.runnables && typeof appData.runnables === "object" && !Array.isArray(appData.runnables) && Object.keys(appData.runnables).length > 0;
|
|
@@ -69856,7 +70068,7 @@ async function validateBuild(appDir) {
|
|
|
69856
70068
|
info(colors.blue("\uD83D\uDD28 Testing build..."));
|
|
69857
70069
|
const frameworks = detectFrameworks(appDir);
|
|
69858
70070
|
const entryFile = frameworks.svelte || frameworks.vue ? "index.ts" : "index.tsx";
|
|
69859
|
-
const entryPoint =
|
|
70071
|
+
const entryPoint = path17.join(appDir, entryFile);
|
|
69860
70072
|
await createBundle({
|
|
69861
70073
|
entryPoint,
|
|
69862
70074
|
production: true,
|
|
@@ -69871,13 +70083,13 @@ async function validateBuild(appDir) {
|
|
|
69871
70083
|
async function lintRawApp(appDir, opts) {
|
|
69872
70084
|
const errors = [];
|
|
69873
70085
|
const warnings = [];
|
|
69874
|
-
const currentDirName =
|
|
70086
|
+
const currentDirName = path17.basename(appDir);
|
|
69875
70087
|
if (!hasFolderSuffix(currentDirName, "raw_app")) {
|
|
69876
70088
|
errors.push(`Not a raw app folder: '${currentDirName}' does not end with '${getFolderSuffix("raw_app")}'`);
|
|
69877
70089
|
return { valid: false, errors, warnings };
|
|
69878
70090
|
}
|
|
69879
|
-
const rawAppPath =
|
|
69880
|
-
if (!
|
|
70091
|
+
const rawAppPath = path17.join(appDir, "raw_app.yaml");
|
|
70092
|
+
if (!fs12.existsSync(rawAppPath)) {
|
|
69881
70093
|
errors.push("Missing raw_app.yaml file");
|
|
69882
70094
|
return { valid: false, errors, warnings };
|
|
69883
70095
|
}
|
|
@@ -69960,7 +70172,7 @@ var init_lint2 = __esm(async () => {
|
|
|
69960
70172
|
|
|
69961
70173
|
// src/commands/app/new.ts
|
|
69962
70174
|
import { stat as stat9, writeFile as writeFile10, mkdir as mkdir7, rm as rm3 } from "node:fs/promises";
|
|
69963
|
-
import
|
|
70175
|
+
import path18 from "node:path";
|
|
69964
70176
|
import { execSync as execSync6, exec, execFile as execFile6 } from "node:child_process";
|
|
69965
70177
|
function validateAppPath(appPath) {
|
|
69966
70178
|
if (!appPath.startsWith("u/") && !appPath.startsWith("f/")) {
|
|
@@ -70216,7 +70428,7 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
70216
70428
|
}
|
|
70217
70429
|
await loadNonDottedPathsSetting();
|
|
70218
70430
|
const folderName2 = buildFolderPath(appPath, "raw_app");
|
|
70219
|
-
const appDir =
|
|
70431
|
+
const appDir = path18.join(process.cwd(), folderName2);
|
|
70220
70432
|
let dirExists = false;
|
|
70221
70433
|
try {
|
|
70222
70434
|
await stat9(appDir);
|
|
@@ -70241,17 +70453,17 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
70241
70453
|
await rm3(appDir, { recursive: true, force: true });
|
|
70242
70454
|
}
|
|
70243
70455
|
await mkdir7(appDir, { recursive: true });
|
|
70244
|
-
await mkdir7(
|
|
70245
|
-
await mkdir7(
|
|
70456
|
+
await mkdir7(path18.join(appDir, "backend"), { recursive: true });
|
|
70457
|
+
await mkdir7(path18.join(appDir, "sql_to_apply"), { recursive: true });
|
|
70246
70458
|
const rawAppConfig = {
|
|
70247
70459
|
summary
|
|
70248
70460
|
};
|
|
70249
70461
|
if (dataConfig.datatable) {
|
|
70250
70462
|
rawAppConfig.data = dataConfig;
|
|
70251
70463
|
}
|
|
70252
|
-
await writeFile10(
|
|
70464
|
+
await writeFile10(path18.join(appDir, "raw_app.yaml"), import_yaml22.stringify(rawAppConfig, yamlOptions), "utf-8");
|
|
70253
70465
|
for (const [filePath, content] of Object.entries(template.files)) {
|
|
70254
|
-
const fullPath =
|
|
70466
|
+
const fullPath = path18.join(appDir, filePath.slice(1));
|
|
70255
70467
|
await writeFile10(fullPath, content.trim() + `
|
|
70256
70468
|
`, "utf-8");
|
|
70257
70469
|
}
|
|
@@ -70261,21 +70473,21 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
70261
70473
|
schema: dataConfig.schema
|
|
70262
70474
|
} : undefined;
|
|
70263
70475
|
const agentsContent = generateAgentsDocumentation(dataForDocs);
|
|
70264
|
-
await writeFile10(
|
|
70265
|
-
await writeFile10(
|
|
70476
|
+
await writeFile10(path18.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
|
|
70477
|
+
await writeFile10(path18.join(appDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
|
|
70266
70478
|
`, "utf-8");
|
|
70267
70479
|
const datatablesContent = generateDatatablesDocumentation(dataForDocs);
|
|
70268
|
-
await writeFile10(
|
|
70480
|
+
await writeFile10(path18.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
|
|
70269
70481
|
const exampleRunnable = {
|
|
70270
70482
|
type: "inline",
|
|
70271
70483
|
path: undefined
|
|
70272
70484
|
};
|
|
70273
|
-
await writeFile10(
|
|
70274
|
-
await writeFile10(
|
|
70485
|
+
await writeFile10(path18.join(appDir, "backend", "a.yaml"), import_yaml22.stringify(exampleRunnable, yamlOptions), "utf-8");
|
|
70486
|
+
await writeFile10(path18.join(appDir, "backend", "a.ts"), `export async function main(x: number): Promise<string> {
|
|
70275
70487
|
return \`Hello from backend! x = \${x}\`;
|
|
70276
70488
|
}
|
|
70277
70489
|
`, "utf-8");
|
|
70278
|
-
await writeFile10(
|
|
70490
|
+
await writeFile10(path18.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
|
|
70279
70491
|
|
|
70280
70492
|
This folder is for SQL migration files that will be applied to datatables during development.
|
|
70281
70493
|
|
|
@@ -70303,7 +70515,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
70303
70515
|
- Use idempotent SQL (\`CREATE TABLE IF NOT EXISTS\`, etc.)
|
|
70304
70516
|
`);
|
|
70305
70517
|
if (createSchemaSQL && schemaName) {
|
|
70306
|
-
await writeFile10(
|
|
70518
|
+
await writeFile10(path18.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
|
|
70307
70519
|
}
|
|
70308
70520
|
info("");
|
|
70309
70521
|
info(colors.bold.green(`App created successfully at ${folderName2}/`));
|
|
@@ -70359,9 +70571,9 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
70359
70571
|
});
|
|
70360
70572
|
if (openInDesktop) {
|
|
70361
70573
|
try {
|
|
70362
|
-
const absAppDir =
|
|
70363
|
-
const claudeDir =
|
|
70364
|
-
const launchPath =
|
|
70574
|
+
const absAppDir = path18.resolve(appDir);
|
|
70575
|
+
const claudeDir = path18.join(absAppDir, ".claude");
|
|
70576
|
+
const launchPath = path18.join(claudeDir, "launch.json");
|
|
70365
70577
|
if (!await stat9(launchPath).catch(() => null)) {
|
|
70366
70578
|
const launchJson = JSON.stringify({
|
|
70367
70579
|
version: "0.0.1",
|
|
@@ -70376,7 +70588,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
70376
70588
|
`;
|
|
70377
70589
|
await mkdir7(claudeDir, { recursive: true });
|
|
70378
70590
|
await writeFile10(launchPath, launchJson, "utf-8");
|
|
70379
|
-
info(colors.gray(`Seeded ${
|
|
70591
|
+
info(colors.gray(`Seeded ${path18.relative(process.cwd(), launchPath)}`));
|
|
70380
70592
|
}
|
|
70381
70593
|
const sessionId = crypto.randomUUID();
|
|
70382
70594
|
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
@@ -70678,8 +70890,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
70678
70890
|
if (!localPath.endsWith(SEP13)) {
|
|
70679
70891
|
localPath += SEP13;
|
|
70680
70892
|
}
|
|
70681
|
-
const
|
|
70682
|
-
const localApp = await yamlParseFile(
|
|
70893
|
+
const path19 = localPath + "app.yaml";
|
|
70894
|
+
const localApp = await yamlParseFile(path19);
|
|
70683
70895
|
replaceInlineScripts2(localApp.value, localPath, true);
|
|
70684
70896
|
await generatingPolicy2(localApp, remotePath, localApp?.["public"] ?? localApp?.["policy"]?.["execution_mode"] == "anonymous");
|
|
70685
70897
|
const preserveFields = {};
|
|
@@ -70721,13 +70933,13 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
70721
70933
|
});
|
|
70722
70934
|
}
|
|
70723
70935
|
}
|
|
70724
|
-
async function generatingPolicy2(app,
|
|
70725
|
-
info(colors.gray(`Generating fresh policy for app ${
|
|
70936
|
+
async function generatingPolicy2(app, path19, publicApp) {
|
|
70937
|
+
info(colors.gray(`Generating fresh policy for app ${path19}...`));
|
|
70726
70938
|
try {
|
|
70727
70939
|
app.policy = await updatePolicy(app.value, undefined);
|
|
70728
70940
|
app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
|
|
70729
70941
|
} catch (e) {
|
|
70730
|
-
error(colors.red(`Error generating policy for app ${
|
|
70942
|
+
error(colors.red(`Error generating policy for app ${path19}: ${e}`));
|
|
70731
70943
|
throw e;
|
|
70732
70944
|
}
|
|
70733
70945
|
}
|
|
@@ -70756,12 +70968,12 @@ async function list6(opts) {
|
|
|
70756
70968
|
new Table2().header(["path", "summary"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary])).render();
|
|
70757
70969
|
}
|
|
70758
70970
|
}
|
|
70759
|
-
async function get4(opts,
|
|
70971
|
+
async function get4(opts, path19) {
|
|
70760
70972
|
const workspace = await resolveWorkspace(opts);
|
|
70761
70973
|
await requireLogin(opts);
|
|
70762
70974
|
const a = await getAppByPath({
|
|
70763
70975
|
workspace: workspace.workspaceId,
|
|
70764
|
-
path:
|
|
70976
|
+
path: path19
|
|
70765
70977
|
});
|
|
70766
70978
|
if (opts.json) {
|
|
70767
70979
|
console.log(JSON.stringify(a));
|
|
@@ -71078,7 +71290,7 @@ var init_folder = __esm(async () => {
|
|
|
71078
71290
|
|
|
71079
71291
|
// src/commands/variable/variable.ts
|
|
71080
71292
|
import { mkdir as mkdir9, stat as stat12, writeFile as writeFile12 } from "node:fs/promises";
|
|
71081
|
-
import { dirname as
|
|
71293
|
+
import { dirname as dirname14 } from "node:path";
|
|
71082
71294
|
import { sep as SEP15 } from "node:path";
|
|
71083
71295
|
async function list8(opts) {
|
|
71084
71296
|
if (opts.json)
|
|
@@ -71099,11 +71311,11 @@ async function list8(opts) {
|
|
|
71099
71311
|
])).render();
|
|
71100
71312
|
}
|
|
71101
71313
|
}
|
|
71102
|
-
async function newVariable(opts,
|
|
71103
|
-
if (!validatePath(
|
|
71314
|
+
async function newVariable(opts, path19) {
|
|
71315
|
+
if (!validatePath(path19)) {
|
|
71104
71316
|
return;
|
|
71105
71317
|
}
|
|
71106
|
-
const filePath =
|
|
71318
|
+
const filePath = path19 + ".variable.yaml";
|
|
71107
71319
|
try {
|
|
71108
71320
|
await stat12(filePath);
|
|
71109
71321
|
throw new Error("File already exists: " + filePath);
|
|
@@ -71116,21 +71328,21 @@ async function newVariable(opts, path18) {
|
|
|
71116
71328
|
is_secret: false,
|
|
71117
71329
|
description: ""
|
|
71118
71330
|
};
|
|
71119
|
-
await mkdir9(
|
|
71331
|
+
await mkdir9(dirname14(filePath), { recursive: true });
|
|
71120
71332
|
await writeFile12(filePath, import_yaml25.stringify(template), {
|
|
71121
71333
|
flag: "wx",
|
|
71122
71334
|
encoding: "utf-8"
|
|
71123
71335
|
});
|
|
71124
71336
|
info(colors.green(`Created ${filePath}`));
|
|
71125
71337
|
}
|
|
71126
|
-
async function get6(opts,
|
|
71338
|
+
async function get6(opts, path19) {
|
|
71127
71339
|
if (opts.json)
|
|
71128
71340
|
setSilent(true);
|
|
71129
71341
|
const workspace = await resolveWorkspace(opts);
|
|
71130
71342
|
await requireLogin(opts);
|
|
71131
71343
|
const v = await getVariable({
|
|
71132
71344
|
workspace: workspace.workspaceId,
|
|
71133
|
-
path:
|
|
71345
|
+
path: path19
|
|
71134
71346
|
});
|
|
71135
71347
|
if (opts.json) {
|
|
71136
71348
|
console.log(JSON.stringify(v));
|
|
@@ -71243,7 +71455,7 @@ var init_variable = __esm(async () => {
|
|
|
71243
71455
|
|
|
71244
71456
|
// src/commands/schedule/schedule.ts
|
|
71245
71457
|
import { mkdir as mkdir10, stat as stat13, writeFile as writeFile13 } from "node:fs/promises";
|
|
71246
|
-
import { dirname as
|
|
71458
|
+
import { dirname as dirname15 } from "node:path";
|
|
71247
71459
|
import { sep as SEP16 } from "node:path";
|
|
71248
71460
|
async function list9(opts) {
|
|
71249
71461
|
if (opts.json)
|
|
@@ -71259,11 +71471,11 @@ async function list9(opts) {
|
|
|
71259
71471
|
new Table2().header(["Path", "Schedule"]).padding(2).border(true).body(schedules.map((x) => [x.path, x.schedule])).render();
|
|
71260
71472
|
}
|
|
71261
71473
|
}
|
|
71262
|
-
async function newSchedule(opts,
|
|
71263
|
-
if (!validatePath(
|
|
71474
|
+
async function newSchedule(opts, path19) {
|
|
71475
|
+
if (!validatePath(path19)) {
|
|
71264
71476
|
return;
|
|
71265
71477
|
}
|
|
71266
|
-
const filePath =
|
|
71478
|
+
const filePath = path19 + ".schedule.yaml";
|
|
71267
71479
|
try {
|
|
71268
71480
|
await stat13(filePath);
|
|
71269
71481
|
throw new Error("File already exists: " + filePath);
|
|
@@ -71280,21 +71492,21 @@ async function newSchedule(opts, path18) {
|
|
|
71280
71492
|
is_flow: false,
|
|
71281
71493
|
enabled: false
|
|
71282
71494
|
};
|
|
71283
|
-
await mkdir10(
|
|
71495
|
+
await mkdir10(dirname15(filePath), { recursive: true });
|
|
71284
71496
|
await writeFile13(filePath, import_yaml26.stringify(template), {
|
|
71285
71497
|
flag: "wx",
|
|
71286
71498
|
encoding: "utf-8"
|
|
71287
71499
|
});
|
|
71288
71500
|
info(colors.green(`Created ${filePath}`));
|
|
71289
71501
|
}
|
|
71290
|
-
async function get7(opts,
|
|
71502
|
+
async function get7(opts, path19) {
|
|
71291
71503
|
if (opts.json)
|
|
71292
71504
|
setSilent(true);
|
|
71293
71505
|
const workspace = await resolveWorkspace(opts);
|
|
71294
71506
|
await requireLogin(opts);
|
|
71295
71507
|
const s = await getSchedule({
|
|
71296
71508
|
workspace: workspace.workspaceId,
|
|
71297
|
-
path:
|
|
71509
|
+
path: path19
|
|
71298
71510
|
});
|
|
71299
71511
|
if (opts.json) {
|
|
71300
71512
|
console.log(JSON.stringify(s));
|
|
@@ -71307,14 +71519,14 @@ async function get7(opts, path18) {
|
|
|
71307
71519
|
console.log(colors.bold("Enabled:") + " " + (s.enabled ? "true" : "false"));
|
|
71308
71520
|
}
|
|
71309
71521
|
}
|
|
71310
|
-
async function pushSchedule(workspace,
|
|
71311
|
-
|
|
71312
|
-
debug(`Processing local schedule ${
|
|
71522
|
+
async function pushSchedule(workspace, path19, schedule, localSchedule, permissionedAsContext) {
|
|
71523
|
+
path19 = removeType(path19, "schedule").replaceAll(SEP16, "/");
|
|
71524
|
+
debug(`Processing local schedule ${path19}`);
|
|
71313
71525
|
try {
|
|
71314
|
-
schedule = await getSchedule({ workspace, path:
|
|
71315
|
-
debug(`Schedule ${
|
|
71526
|
+
schedule = await getSchedule({ workspace, path: path19 });
|
|
71527
|
+
debug(`Schedule ${path19} exists on remote`);
|
|
71316
71528
|
} catch {
|
|
71317
|
-
debug(`Schedule ${
|
|
71529
|
+
debug(`Schedule ${path19} does not exist on remote`);
|
|
71318
71530
|
}
|
|
71319
71531
|
delete localSchedule.has_permissioned_as;
|
|
71320
71532
|
const preserveFields = {};
|
|
@@ -71323,31 +71535,31 @@ async function pushSchedule(workspace, path18, schedule, localSchedule, permissi
|
|
|
71323
71535
|
preserveFields.preserve_permissioned_as = true;
|
|
71324
71536
|
if (schedule.permissioned_as) {
|
|
71325
71537
|
preserveFields.permissioned_as = schedule.permissioned_as;
|
|
71326
|
-
info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${
|
|
71538
|
+
info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path19}`);
|
|
71327
71539
|
}
|
|
71328
71540
|
}
|
|
71329
71541
|
}
|
|
71330
71542
|
if (schedule) {
|
|
71331
71543
|
if (isSuperset(localSchedule, schedule)) {
|
|
71332
|
-
debug(`Schedule ${
|
|
71544
|
+
debug(`Schedule ${path19} is up to date`);
|
|
71333
71545
|
return;
|
|
71334
71546
|
}
|
|
71335
|
-
debug(`Updating schedule ${
|
|
71547
|
+
debug(`Updating schedule ${path19}`);
|
|
71336
71548
|
try {
|
|
71337
|
-
info(colors.bold.yellow(`Updating schedule ${
|
|
71549
|
+
info(colors.bold.yellow(`Updating schedule ${path19}`));
|
|
71338
71550
|
await updateSchedule({
|
|
71339
71551
|
workspace,
|
|
71340
|
-
path:
|
|
71552
|
+
path: path19,
|
|
71341
71553
|
requestBody: {
|
|
71342
71554
|
...localSchedule,
|
|
71343
71555
|
...preserveFields
|
|
71344
71556
|
}
|
|
71345
71557
|
});
|
|
71346
71558
|
if (localSchedule.enabled != schedule.enabled) {
|
|
71347
|
-
info(colors.bold.yellow(`Schedule ${
|
|
71559
|
+
info(colors.bold.yellow(`Schedule ${path19} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
|
|
71348
71560
|
await setScheduleEnabled({
|
|
71349
71561
|
workspace,
|
|
71350
|
-
path:
|
|
71562
|
+
path: path19,
|
|
71351
71563
|
requestBody: {
|
|
71352
71564
|
enabled: localSchedule.enabled
|
|
71353
71565
|
}
|
|
@@ -71358,12 +71570,12 @@ async function pushSchedule(workspace, path18, schedule, localSchedule, permissi
|
|
|
71358
71570
|
throw e;
|
|
71359
71571
|
}
|
|
71360
71572
|
} else {
|
|
71361
|
-
console.log(colors.bold.yellow("Creating new schedule " +
|
|
71573
|
+
console.log(colors.bold.yellow("Creating new schedule " + path19));
|
|
71362
71574
|
try {
|
|
71363
71575
|
await createSchedule({
|
|
71364
71576
|
workspace,
|
|
71365
71577
|
requestBody: {
|
|
71366
|
-
path:
|
|
71578
|
+
path: path19,
|
|
71367
71579
|
...localSchedule,
|
|
71368
71580
|
...preserveFields
|
|
71369
71581
|
}
|
|
@@ -71374,27 +71586,27 @@ async function pushSchedule(workspace, path18, schedule, localSchedule, permissi
|
|
|
71374
71586
|
}
|
|
71375
71587
|
}
|
|
71376
71588
|
}
|
|
71377
|
-
async function enable(opts,
|
|
71589
|
+
async function enable(opts, path19) {
|
|
71378
71590
|
opts = await mergeConfigWithConfigFile(opts);
|
|
71379
71591
|
const workspace = await resolveWorkspace(opts);
|
|
71380
71592
|
await requireLogin(opts);
|
|
71381
71593
|
await setScheduleEnabled({
|
|
71382
71594
|
workspace: workspace.workspaceId,
|
|
71383
|
-
path:
|
|
71595
|
+
path: path19,
|
|
71384
71596
|
requestBody: { enabled: true }
|
|
71385
71597
|
});
|
|
71386
|
-
info(colors.green(`Schedule ${
|
|
71598
|
+
info(colors.green(`Schedule ${path19} enabled.`));
|
|
71387
71599
|
}
|
|
71388
|
-
async function disable(opts,
|
|
71600
|
+
async function disable(opts, path19) {
|
|
71389
71601
|
opts = await mergeConfigWithConfigFile(opts);
|
|
71390
71602
|
const workspace = await resolveWorkspace(opts);
|
|
71391
71603
|
await requireLogin(opts);
|
|
71392
71604
|
await setScheduleEnabled({
|
|
71393
71605
|
workspace: workspace.workspaceId,
|
|
71394
|
-
path:
|
|
71606
|
+
path: path19,
|
|
71395
71607
|
requestBody: { enabled: false }
|
|
71396
71608
|
});
|
|
71397
|
-
info(colors.yellow(`Schedule ${
|
|
71609
|
+
info(colors.yellow(`Schedule ${path19} disabled.`));
|
|
71398
71610
|
}
|
|
71399
71611
|
async function push8(opts, filePath, remotePath) {
|
|
71400
71612
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -72044,7 +72256,7 @@ var init_settings = __esm(async () => {
|
|
|
72044
72256
|
// src/commands/instance/instance.ts
|
|
72045
72257
|
import { writeFile as writeFile15, readdir as readdir9, mkdir as mkdir11, rm as rm4, stat as stat14 } from "node:fs/promises";
|
|
72046
72258
|
import { appendFile } from "node:fs/promises";
|
|
72047
|
-
import * as
|
|
72259
|
+
import * as path19 from "node:path";
|
|
72048
72260
|
async function allInstances() {
|
|
72049
72261
|
try {
|
|
72050
72262
|
const file = await getInstancesConfigFilePath();
|
|
@@ -72236,7 +72448,7 @@ async function instancePull(opts) {
|
|
|
72236
72448
|
if (confirm) {
|
|
72237
72449
|
if (uChanges > 0) {
|
|
72238
72450
|
if (opts.folderPerInstance && opts.prefixSettings) {
|
|
72239
|
-
await mkdir11(
|
|
72451
|
+
await mkdir11(path19.join(rootDir, opts.prefix), {
|
|
72240
72452
|
recursive: true
|
|
72241
72453
|
});
|
|
72242
72454
|
}
|
|
@@ -72270,10 +72482,10 @@ Pulling all workspaces`);
|
|
|
72270
72482
|
info(`
|
|
72271
72483
|
Pulling workspace ` + remoteWorkspace.id);
|
|
72272
72484
|
const workspaceName = opts?.folderPerInstance ? instance.prefix + "/" + remoteWorkspace.id : instance.prefix + "_" + remoteWorkspace.id;
|
|
72273
|
-
await mkdir11(
|
|
72485
|
+
await mkdir11(path19.join(rootDir, workspaceName), {
|
|
72274
72486
|
recursive: true
|
|
72275
72487
|
});
|
|
72276
|
-
process.chdir(
|
|
72488
|
+
process.chdir(path19.join(rootDir, workspaceName));
|
|
72277
72489
|
await addWorkspace({
|
|
72278
72490
|
remote: instance.remote,
|
|
72279
72491
|
name: workspaceName,
|
|
@@ -72308,7 +72520,7 @@ Pulling workspace ` + remoteWorkspace.id);
|
|
|
72308
72520
|
if (confirmDelete) {
|
|
72309
72521
|
for (const workspace of localWorkspacesToDelete) {
|
|
72310
72522
|
await removeWorkspace(workspace.id, false, {});
|
|
72311
|
-
await rm4(
|
|
72523
|
+
await rm4(path19.join(rootDir, workspace.dir), {
|
|
72312
72524
|
recursive: true
|
|
72313
72525
|
});
|
|
72314
72526
|
}
|
|
@@ -72397,12 +72609,12 @@ Pushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
|
|
|
72397
72609
|
info(`
|
|
72398
72610
|
Pushing workspace ` + localWorkspace.id);
|
|
72399
72611
|
try {
|
|
72400
|
-
process.chdir(
|
|
72612
|
+
process.chdir(path19.join(rootDir, localWorkspace.dir));
|
|
72401
72613
|
} catch (_) {
|
|
72402
72614
|
throw new Error("Workspace folder not found, are you in the right directory?");
|
|
72403
72615
|
}
|
|
72404
72616
|
try {
|
|
72405
|
-
const workspaceSettings = await yamlParseFile(
|
|
72617
|
+
const workspaceSettings = await yamlParseFile(path19.join(process.cwd(), "settings.yaml"));
|
|
72406
72618
|
await add({
|
|
72407
72619
|
token: instance.token,
|
|
72408
72620
|
workspace: undefined,
|
|
@@ -72666,8 +72878,8 @@ async function createToken2(opts) {
|
|
|
72666
72878
|
}
|
|
72667
72879
|
info("Token: " + await createToken({ requestBody: {} }));
|
|
72668
72880
|
}
|
|
72669
|
-
async function pushWorkspaceUser(workspace,
|
|
72670
|
-
const email = removePathPrefix(removeType(
|
|
72881
|
+
async function pushWorkspaceUser(workspace, path20, user, localUser) {
|
|
72882
|
+
const email = removePathPrefix(removeType(path20, "user"), "users");
|
|
72671
72883
|
debug(`Processing local user ${email}`);
|
|
72672
72884
|
if (!["operator", "developer", "admin"].includes(localUser.role)) {
|
|
72673
72885
|
throw new Error(`Invalid role for user ${email}: ${localUser.role}`);
|
|
@@ -72730,8 +72942,8 @@ async function pushWorkspaceUser(workspace, path19, user, localUser) {
|
|
|
72730
72942
|
}
|
|
72731
72943
|
}
|
|
72732
72944
|
}
|
|
72733
|
-
async function pushGroup(workspace,
|
|
72734
|
-
const name = removePathPrefix(removeType(
|
|
72945
|
+
async function pushGroup(workspace, path20, group, localGroup) {
|
|
72946
|
+
const name = removePathPrefix(removeType(path20, "group"), "groups");
|
|
72735
72947
|
debug(`Processing local group ${name}`);
|
|
72736
72948
|
try {
|
|
72737
72949
|
const remoteGroup = await getGroup({
|
|
@@ -72972,20 +73184,20 @@ var init_user = __esm(async () => {
|
|
|
72972
73184
|
});
|
|
72973
73185
|
|
|
72974
73186
|
// src/commands/dependencies/dependencies.ts
|
|
72975
|
-
import
|
|
73187
|
+
import fs13 from "node:fs";
|
|
72976
73188
|
async function push9(opts, filePath) {
|
|
72977
73189
|
const workspace = await resolveWorkspace(opts);
|
|
72978
73190
|
await requireLogin(opts);
|
|
72979
|
-
if (!
|
|
73191
|
+
if (!fs13.existsSync(filePath)) {
|
|
72980
73192
|
throw new Error(`File not found: ${filePath}`);
|
|
72981
73193
|
}
|
|
72982
73194
|
const content = readTextFileSync(filePath);
|
|
72983
73195
|
await pushWorkspaceDependencies(workspace.workspaceId, filePath, null, content);
|
|
72984
73196
|
}
|
|
72985
|
-
async function pushWorkspaceDependencies(workspace,
|
|
72986
|
-
const res = workspaceDependenciesPathToLanguageAndFilename(
|
|
73197
|
+
async function pushWorkspaceDependencies(workspace, path20, _befObj, newDependenciesContent) {
|
|
73198
|
+
const res = workspaceDependenciesPathToLanguageAndFilename(path20);
|
|
72987
73199
|
if (!res) {
|
|
72988
|
-
throw new Error(`Unknown workspace dependencies file format: ${
|
|
73200
|
+
throw new Error(`Unknown workspace dependencies file format: ${path20}. ` + `Valid files: package.json, requirements.in, composer.json, go.mod, modules.json`);
|
|
72989
73201
|
}
|
|
72990
73202
|
const { language, name } = res;
|
|
72991
73203
|
const displayName = name ? `named dependencies "${name}"` : `workspace default dependencies`;
|
|
@@ -73035,9 +73247,9 @@ var init_dependencies = __esm(async () => {
|
|
|
73035
73247
|
|
|
73036
73248
|
// src/commands/trigger/trigger.ts
|
|
73037
73249
|
import { mkdir as mkdir12, stat as stat15, writeFile as writeFile17 } from "node:fs/promises";
|
|
73038
|
-
import { dirname as
|
|
73250
|
+
import { dirname as dirname16 } from "node:path";
|
|
73039
73251
|
import { sep as SEP17 } from "node:path";
|
|
73040
|
-
async function getTrigger(triggerType, workspace,
|
|
73252
|
+
async function getTrigger(triggerType, workspace, path20) {
|
|
73041
73253
|
const triggerFunctions = {
|
|
73042
73254
|
http: getHttpTrigger,
|
|
73043
73255
|
websocket: getWebsocketTrigger,
|
|
@@ -73051,10 +73263,10 @@ async function getTrigger(triggerType, workspace, path19) {
|
|
|
73051
73263
|
email: getEmailTrigger
|
|
73052
73264
|
};
|
|
73053
73265
|
const triggerFunction = triggerFunctions[triggerType];
|
|
73054
|
-
const trigger = await triggerFunction({ workspace, path:
|
|
73266
|
+
const trigger = await triggerFunction({ workspace, path: path20 });
|
|
73055
73267
|
return trigger;
|
|
73056
73268
|
}
|
|
73057
|
-
async function updateTrigger(triggerType, workspace,
|
|
73269
|
+
async function updateTrigger(triggerType, workspace, path20, trigger) {
|
|
73058
73270
|
const triggerFunctions = {
|
|
73059
73271
|
http: updateHttpTrigger,
|
|
73060
73272
|
websocket: updateWebsocketTrigger,
|
|
@@ -73068,9 +73280,9 @@ async function updateTrigger(triggerType, workspace, path19, trigger) {
|
|
|
73068
73280
|
email: updateEmailTrigger
|
|
73069
73281
|
};
|
|
73070
73282
|
const triggerFunction = triggerFunctions[triggerType];
|
|
73071
|
-
await triggerFunction({ workspace, path:
|
|
73283
|
+
await triggerFunction({ workspace, path: path20, requestBody: trigger });
|
|
73072
73284
|
}
|
|
73073
|
-
async function createTrigger(triggerType, workspace,
|
|
73285
|
+
async function createTrigger(triggerType, workspace, path20, trigger) {
|
|
73074
73286
|
const triggerFunctions = {
|
|
73075
73287
|
http: createHttpTrigger,
|
|
73076
73288
|
websocket: createWebsocketTrigger,
|
|
@@ -73084,16 +73296,16 @@ async function createTrigger(triggerType, workspace, path19, trigger) {
|
|
|
73084
73296
|
email: createEmailTrigger
|
|
73085
73297
|
};
|
|
73086
73298
|
const triggerFunction = triggerFunctions[triggerType];
|
|
73087
|
-
await triggerFunction({ workspace, path:
|
|
73299
|
+
await triggerFunction({ workspace, path: path20, requestBody: trigger });
|
|
73088
73300
|
}
|
|
73089
|
-
async function pushTrigger(triggerType, workspace,
|
|
73090
|
-
|
|
73091
|
-
debug(`Processing local ${triggerType} trigger ${
|
|
73301
|
+
async function pushTrigger(triggerType, workspace, path20, trigger, localTrigger, permissionedAsContext) {
|
|
73302
|
+
path20 = removeType(path20, triggerType + "_trigger").replaceAll(SEP17, "/");
|
|
73303
|
+
debug(`Processing local ${triggerType} trigger ${path20}`);
|
|
73092
73304
|
try {
|
|
73093
|
-
trigger = await getTrigger(triggerType, workspace,
|
|
73094
|
-
debug(`${triggerType} trigger ${
|
|
73305
|
+
trigger = await getTrigger(triggerType, workspace, path20);
|
|
73306
|
+
debug(`${triggerType} trigger ${path20} exists on remote`);
|
|
73095
73307
|
} catch {
|
|
73096
|
-
debug(`${triggerType} trigger ${
|
|
73308
|
+
debug(`${triggerType} trigger ${path20} does not exist on remote`);
|
|
73097
73309
|
}
|
|
73098
73310
|
delete localTrigger.has_permissioned_as;
|
|
73099
73311
|
const preserveFields = {};
|
|
@@ -73102,33 +73314,33 @@ async function pushTrigger(triggerType, workspace, path19, trigger, localTrigger
|
|
|
73102
73314
|
preserveFields.preserve_permissioned_as = true;
|
|
73103
73315
|
if (trigger.permissioned_as) {
|
|
73104
73316
|
preserveFields.permissioned_as = trigger.permissioned_as;
|
|
73105
|
-
info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${
|
|
73317
|
+
info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path20}`);
|
|
73106
73318
|
}
|
|
73107
73319
|
}
|
|
73108
73320
|
}
|
|
73109
73321
|
if (trigger) {
|
|
73110
73322
|
if (isSuperset(localTrigger, trigger)) {
|
|
73111
|
-
debug(`${triggerType} trigger ${
|
|
73323
|
+
debug(`${triggerType} trigger ${path20} is up to date`);
|
|
73112
73324
|
return;
|
|
73113
73325
|
}
|
|
73114
|
-
debug(`${triggerType} trigger ${
|
|
73326
|
+
debug(`${triggerType} trigger ${path20} is not up-to-date, updating...`);
|
|
73115
73327
|
try {
|
|
73116
|
-
await updateTrigger(triggerType, workspace,
|
|
73328
|
+
await updateTrigger(triggerType, workspace, path20, {
|
|
73117
73329
|
...localTrigger,
|
|
73118
73330
|
...preserveFields,
|
|
73119
|
-
path:
|
|
73331
|
+
path: path20
|
|
73120
73332
|
});
|
|
73121
73333
|
} catch (e) {
|
|
73122
73334
|
console.error(e.body);
|
|
73123
73335
|
throw e;
|
|
73124
73336
|
}
|
|
73125
73337
|
} else {
|
|
73126
|
-
console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${
|
|
73338
|
+
console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path20}`));
|
|
73127
73339
|
try {
|
|
73128
|
-
await createTrigger(triggerType, workspace,
|
|
73340
|
+
await createTrigger(triggerType, workspace, path20, {
|
|
73129
73341
|
...localTrigger,
|
|
73130
73342
|
...preserveFields,
|
|
73131
|
-
path:
|
|
73343
|
+
path: path20
|
|
73132
73344
|
});
|
|
73133
73345
|
} catch (e) {
|
|
73134
73346
|
console.error(e.body);
|
|
@@ -73213,8 +73425,8 @@ async function pushNativeTrigger(workspace, filePath, _remoteTrigger, localTrigg
|
|
|
73213
73425
|
}
|
|
73214
73426
|
}
|
|
73215
73427
|
}
|
|
73216
|
-
async function newTrigger(opts,
|
|
73217
|
-
if (!validatePath(
|
|
73428
|
+
async function newTrigger(opts, path20) {
|
|
73429
|
+
if (!validatePath(path20)) {
|
|
73218
73430
|
return;
|
|
73219
73431
|
}
|
|
73220
73432
|
if (!opts.kind) {
|
|
@@ -73224,7 +73436,7 @@ async function newTrigger(opts, path19) {
|
|
|
73224
73436
|
throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
|
|
73225
73437
|
}
|
|
73226
73438
|
const kind = opts.kind;
|
|
73227
|
-
const filePath = `${
|
|
73439
|
+
const filePath = `${path20}.${kind}_trigger.yaml`;
|
|
73228
73440
|
try {
|
|
73229
73441
|
await stat15(filePath);
|
|
73230
73442
|
throw new Error("File already exists: " + filePath);
|
|
@@ -73233,7 +73445,7 @@ async function newTrigger(opts, path19) {
|
|
|
73233
73445
|
throw e;
|
|
73234
73446
|
}
|
|
73235
73447
|
const template = triggerTemplates[kind];
|
|
73236
|
-
await mkdir12(
|
|
73448
|
+
await mkdir12(dirname16(filePath), { recursive: true });
|
|
73237
73449
|
await writeFile17(filePath, import_yaml33.stringify(template), {
|
|
73238
73450
|
flag: "wx",
|
|
73239
73451
|
encoding: "utf-8"
|
|
@@ -73260,7 +73472,7 @@ function printTriggerDetails(trigger, kind) {
|
|
|
73260
73472
|
console.log(colors.bold(label + ":") + " " + display);
|
|
73261
73473
|
}
|
|
73262
73474
|
}
|
|
73263
|
-
async function get8(opts,
|
|
73475
|
+
async function get8(opts, path20) {
|
|
73264
73476
|
if (opts.json)
|
|
73265
73477
|
setSilent(true);
|
|
73266
73478
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -73269,7 +73481,7 @@ async function get8(opts, path19) {
|
|
|
73269
73481
|
if (!checkIfValidTrigger(opts.kind)) {
|
|
73270
73482
|
throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
|
|
73271
73483
|
}
|
|
73272
|
-
const trigger = await getTrigger(opts.kind, workspace.workspaceId,
|
|
73484
|
+
const trigger = await getTrigger(opts.kind, workspace.workspaceId, path20);
|
|
73273
73485
|
if (opts.json) {
|
|
73274
73486
|
console.log(JSON.stringify(trigger));
|
|
73275
73487
|
} else {
|
|
@@ -73280,12 +73492,12 @@ async function get8(opts, path19) {
|
|
|
73280
73492
|
const matches = [];
|
|
73281
73493
|
for (const kind of TRIGGER_TYPES) {
|
|
73282
73494
|
try {
|
|
73283
|
-
const trigger = await getTrigger(kind, workspace.workspaceId,
|
|
73495
|
+
const trigger = await getTrigger(kind, workspace.workspaceId, path20);
|
|
73284
73496
|
matches.push({ kind, trigger });
|
|
73285
73497
|
} catch {}
|
|
73286
73498
|
}
|
|
73287
73499
|
if (matches.length === 0) {
|
|
73288
|
-
throw new Error("No trigger found at path: " +
|
|
73500
|
+
throw new Error("No trigger found at path: " + path20);
|
|
73289
73501
|
}
|
|
73290
73502
|
if (matches.length === 1) {
|
|
73291
73503
|
const { kind, trigger } = matches[0];
|
|
@@ -73296,7 +73508,7 @@ async function get8(opts, path19) {
|
|
|
73296
73508
|
}
|
|
73297
73509
|
return;
|
|
73298
73510
|
}
|
|
73299
|
-
console.log("Multiple triggers found at path " +
|
|
73511
|
+
console.log("Multiple triggers found at path " + path20 + ":");
|
|
73300
73512
|
for (const m of matches) {
|
|
73301
73513
|
console.log(" - " + m.kind);
|
|
73302
73514
|
}
|
|
@@ -73526,7 +73738,7 @@ var init_trigger = __esm(async () => {
|
|
|
73526
73738
|
});
|
|
73527
73739
|
|
|
73528
73740
|
// src/types.ts
|
|
73529
|
-
import * as
|
|
73741
|
+
import * as path20 from "node:path";
|
|
73530
73742
|
import { sep as SEP18 } from "node:path";
|
|
73531
73743
|
function isSuperset(subset, superset) {
|
|
73532
73744
|
return Object.keys(subset).every((key) => {
|
|
@@ -73570,8 +73782,8 @@ function showDiff(local, remote) {
|
|
|
73570
73782
|
}
|
|
73571
73783
|
info(finalString);
|
|
73572
73784
|
}
|
|
73573
|
-
function showConflict(
|
|
73574
|
-
info(colors.yellow(`- ${
|
|
73785
|
+
function showConflict(path21, local, remote) {
|
|
73786
|
+
info(colors.yellow(`- ${path21}`));
|
|
73575
73787
|
showDiff(local, remote);
|
|
73576
73788
|
info("\x1B[31mlocal\x1B[31m - \x1B[32mremote\x1B[32m");
|
|
73577
73789
|
info(`
|
|
@@ -73677,7 +73889,7 @@ function getTypeStrFromPath(p) {
|
|
|
73677
73889
|
if (isFileResource(p) || isFilesetResource(p)) {
|
|
73678
73890
|
return "resource";
|
|
73679
73891
|
}
|
|
73680
|
-
const parsed =
|
|
73892
|
+
const parsed = path20.parse(p);
|
|
73681
73893
|
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") {
|
|
73682
73894
|
return "script";
|
|
73683
73895
|
}
|
|
@@ -73701,7 +73913,7 @@ function getTypeStrFromPath(p) {
|
|
|
73701
73913
|
}
|
|
73702
73914
|
}
|
|
73703
73915
|
function removeType(str, type) {
|
|
73704
|
-
const normalizedStr =
|
|
73916
|
+
const normalizedStr = path20.normalize(str).replaceAll(SEP18, "/");
|
|
73705
73917
|
if (normalizedStr.endsWith("." + type + ".yaml") || normalizedStr.endsWith("." + type + ".json")) {
|
|
73706
73918
|
return normalizedStr.slice(0, normalizedStr.length - type.length - 6);
|
|
73707
73919
|
}
|
|
@@ -73711,7 +73923,7 @@ function removeType(str, type) {
|
|
|
73711
73923
|
return normalizedStr;
|
|
73712
73924
|
}
|
|
73713
73925
|
function extractNativeTriggerInfo(p) {
|
|
73714
|
-
const normalizedPath =
|
|
73926
|
+
const normalizedPath = path20.normalize(p).replaceAll(SEP18, "/");
|
|
73715
73927
|
const withoutExt = normalizedPath.replace(/\.(json|yaml)$/, "");
|
|
73716
73928
|
const match2 = withoutExt.match(/^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/);
|
|
73717
73929
|
if (!match2) {
|
|
@@ -73725,8 +73937,8 @@ function extractNativeTriggerInfo(p) {
|
|
|
73725
73937
|
};
|
|
73726
73938
|
}
|
|
73727
73939
|
function removePathPrefix(str, prefix) {
|
|
73728
|
-
const normalizedStr =
|
|
73729
|
-
const normalizedPrefix =
|
|
73940
|
+
const normalizedStr = path20.normalize(str).replaceAll(SEP18, "/");
|
|
73941
|
+
const normalizedPrefix = path20.normalize(prefix).replaceAll(SEP18, "/");
|
|
73730
73942
|
if (normalizedStr === normalizedPrefix) {
|
|
73731
73943
|
return "";
|
|
73732
73944
|
}
|
|
@@ -73899,7 +74111,7 @@ var init_local_path_scripts = __esm(async () => {
|
|
|
73899
74111
|
|
|
73900
74112
|
// src/commands/flow/flow.ts
|
|
73901
74113
|
import { sep as SEP19 } from "node:path";
|
|
73902
|
-
import { mkdirSync as
|
|
74114
|
+
import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync7 } from "node:fs";
|
|
73903
74115
|
function normalizeOptionalString(value) {
|
|
73904
74116
|
return typeof value === "string" && value.trim() === "" ? undefined : value ?? undefined;
|
|
73905
74117
|
}
|
|
@@ -73941,12 +74153,12 @@ function warnAboutLocalPathScriptDivergence(divergence) {
|
|
|
73941
74153
|
const details = [];
|
|
73942
74154
|
if (divergence.changed.length > 0) {
|
|
73943
74155
|
details.push(`These workspace scripts differ from the deployed version:
|
|
73944
|
-
${divergence.changed.map((
|
|
74156
|
+
${divergence.changed.map((path21) => `- ${path21}`).join(`
|
|
73945
74157
|
`)}`);
|
|
73946
74158
|
}
|
|
73947
74159
|
if (divergence.missing.length > 0) {
|
|
73948
74160
|
details.push(`These scripts do not exist in the workspace yet:
|
|
73949
|
-
${divergence.missing.map((
|
|
74161
|
+
${divergence.missing.map((path21) => `- ${path21}`).join(`
|
|
73950
74162
|
`)}`);
|
|
73951
74163
|
}
|
|
73952
74164
|
warn(`Using local PathScript files for flow preview.
|
|
@@ -73971,7 +74183,7 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
|
|
|
73971
74183
|
localPath += SEP19;
|
|
73972
74184
|
}
|
|
73973
74185
|
const localFlow = await yamlParseFile(localPath + "flow.yaml");
|
|
73974
|
-
const fileReader = async (
|
|
74186
|
+
const fileReader = async (path21) => await readTextFile(localPath + path21);
|
|
73975
74187
|
const missingFiles = [];
|
|
73976
74188
|
await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, localPath, SEP19, undefined, missingFiles);
|
|
73977
74189
|
if (localFlow.value.failure_module) {
|
|
@@ -74063,14 +74275,14 @@ async function list12(opts) {
|
|
|
74063
74275
|
new Table2().header(["path", "summary", "edited by"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary, x.edited_by])).render();
|
|
74064
74276
|
}
|
|
74065
74277
|
}
|
|
74066
|
-
async function get9(opts,
|
|
74278
|
+
async function get9(opts, path21) {
|
|
74067
74279
|
if (opts.json)
|
|
74068
74280
|
setSilent(true);
|
|
74069
74281
|
const workspace = await resolveWorkspace(opts);
|
|
74070
74282
|
await requireLogin(opts);
|
|
74071
74283
|
const f = await getFlowByPath({
|
|
74072
74284
|
workspace: workspace.workspaceId,
|
|
74073
|
-
path:
|
|
74285
|
+
path: path21
|
|
74074
74286
|
});
|
|
74075
74287
|
if (opts.json) {
|
|
74076
74288
|
console.log(JSON.stringify(f));
|
|
@@ -74108,7 +74320,7 @@ async function get9(opts, path20) {
|
|
|
74108
74320
|
}
|
|
74109
74321
|
}
|
|
74110
74322
|
}
|
|
74111
|
-
async function run3(opts,
|
|
74323
|
+
async function run3(opts, path21) {
|
|
74112
74324
|
if (opts.silent) {
|
|
74113
74325
|
setSilent(true);
|
|
74114
74326
|
}
|
|
@@ -74119,7 +74331,7 @@ async function run3(opts, path20) {
|
|
|
74119
74331
|
try {
|
|
74120
74332
|
const flow = await getFlowByPath({
|
|
74121
74333
|
workspace: workspace.workspaceId,
|
|
74122
|
-
path:
|
|
74334
|
+
path: path21
|
|
74123
74335
|
});
|
|
74124
74336
|
validateRequiredArgs(flow.schema);
|
|
74125
74337
|
} catch (e) {
|
|
@@ -74130,7 +74342,7 @@ async function run3(opts, path20) {
|
|
|
74130
74342
|
}
|
|
74131
74343
|
const id = await runFlowByPath({
|
|
74132
74344
|
workspace: workspace.workspaceId,
|
|
74133
|
-
path:
|
|
74345
|
+
path: path21,
|
|
74134
74346
|
requestBody: input
|
|
74135
74347
|
});
|
|
74136
74348
|
const stepLabels = new Map;
|
|
@@ -74276,7 +74488,7 @@ async function preview2(opts, flowPath) {
|
|
|
74276
74488
|
flowPath += SEP19;
|
|
74277
74489
|
}
|
|
74278
74490
|
const localFlow = await yamlParseFile(flowPath + "flow.yaml");
|
|
74279
|
-
const fileReader = async (
|
|
74491
|
+
const fileReader = async (path21) => await readTextFile(flowPath + path21);
|
|
74280
74492
|
await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, flowPath, SEP19);
|
|
74281
74493
|
if (localFlow.value.failure_module) {
|
|
74282
74494
|
await replaceInlineScripts([localFlow.value.failure_module], fileReader, exports_log, flowPath, SEP19);
|
|
@@ -74380,7 +74592,7 @@ async function bootstrap2(opts, flowPath) {
|
|
|
74380
74592
|
}
|
|
74381
74593
|
await loadNonDottedPathsSetting();
|
|
74382
74594
|
const flowDirFullPath = buildFolderPath(flowPath, "flow");
|
|
74383
|
-
|
|
74595
|
+
mkdirSync5(flowDirFullPath, { recursive: true });
|
|
74384
74596
|
const newFlowDefinition = defaultFlowDefinition();
|
|
74385
74597
|
if (opts.summary !== undefined) {
|
|
74386
74598
|
newFlowDefinition.summary = opts.summary;
|
|
@@ -74391,7 +74603,7 @@ async function bootstrap2(opts, flowPath) {
|
|
|
74391
74603
|
const newFlowDefinitionYaml = import_yaml36.stringify(newFlowDefinition);
|
|
74392
74604
|
const metadataFile = getMetadataFileName("flow", "yaml");
|
|
74393
74605
|
const flowYamlPath = `${flowDirFullPath}/${metadataFile}`;
|
|
74394
|
-
|
|
74606
|
+
writeFileSync7(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
|
|
74395
74607
|
info(colors.green(`Created flow at ${flowDirFullPath}`));
|
|
74396
74608
|
info("");
|
|
74397
74609
|
info(colors.bold("To preview this flow:"));
|
|
@@ -74788,8 +75000,8 @@ function outputResult(opts, result) {
|
|
|
74788
75000
|
error(colors.red(result.error));
|
|
74789
75001
|
}
|
|
74790
75002
|
}
|
|
74791
|
-
function normalizeRepoPath(
|
|
74792
|
-
return
|
|
75003
|
+
function normalizeRepoPath(path21) {
|
|
75004
|
+
return path21.replace(/^\$res:/, "");
|
|
74793
75005
|
}
|
|
74794
75006
|
function getOrCreateBranchConfig(config, branchName) {
|
|
74795
75007
|
if (!config.workspaces) {
|
|
@@ -75444,22 +75656,22 @@ var init_gitsync_settings = __esm(async () => {
|
|
|
75444
75656
|
async function uploadScripts(tree, workspace) {
|
|
75445
75657
|
const scriptHashes = {};
|
|
75446
75658
|
const workspaceDeps = [];
|
|
75447
|
-
for (const
|
|
75448
|
-
const content = tree.getContent(
|
|
75449
|
-
const itemType = tree.getItemType(
|
|
75659
|
+
for (const path22 of tree.allPaths()) {
|
|
75660
|
+
const content = tree.getContent(path22);
|
|
75661
|
+
const itemType = tree.getItemType(path22);
|
|
75450
75662
|
if (itemType === "dependencies") {
|
|
75451
75663
|
if (content === undefined)
|
|
75452
75664
|
continue;
|
|
75453
|
-
const info2 = workspaceDependenciesPathToLanguageAndFilename(
|
|
75665
|
+
const info2 = workspaceDependenciesPathToLanguageAndFilename(path22);
|
|
75454
75666
|
if (info2) {
|
|
75455
75667
|
const hash2 = await generateHash(content);
|
|
75456
|
-
workspaceDeps.push({ path:
|
|
75668
|
+
workspaceDeps.push({ path: path22, language: info2.language, name: info2.name, hash: hash2 });
|
|
75457
75669
|
}
|
|
75458
75670
|
} else if (itemType === "script") {
|
|
75459
75671
|
if (!content)
|
|
75460
75672
|
continue;
|
|
75461
75673
|
const hash2 = await generateHash(content);
|
|
75462
|
-
scriptHashes[
|
|
75674
|
+
scriptHashes[path22] = hash2;
|
|
75463
75675
|
}
|
|
75464
75676
|
}
|
|
75465
75677
|
if (Object.keys(scriptHashes).length === 0 && workspaceDeps.length === 0)
|
|
@@ -75471,19 +75683,19 @@ async function uploadScripts(tree, workspace) {
|
|
|
75471
75683
|
workspace_deps: workspaceDeps
|
|
75472
75684
|
}
|
|
75473
75685
|
});
|
|
75474
|
-
for (const
|
|
75475
|
-
const content = tree.getContent(
|
|
75476
|
-
const itemType = tree.getItemType(
|
|
75686
|
+
for (const path22 of mismatched) {
|
|
75687
|
+
const content = tree.getContent(path22);
|
|
75688
|
+
const itemType = tree.getItemType(path22);
|
|
75477
75689
|
if (itemType === "dependencies") {
|
|
75478
75690
|
if (content !== undefined) {
|
|
75479
|
-
tree.setContentHash(
|
|
75691
|
+
tree.setContentHash(path22, "mismatched");
|
|
75480
75692
|
}
|
|
75481
75693
|
} else if (content) {
|
|
75482
75694
|
const hash2 = await storeRawScriptTemp({
|
|
75483
75695
|
workspace: workspace.workspaceId,
|
|
75484
75696
|
requestBody: content
|
|
75485
75697
|
});
|
|
75486
|
-
tree.setContentHash(
|
|
75698
|
+
tree.setContentHash(path22, hash2);
|
|
75487
75699
|
}
|
|
75488
75700
|
}
|
|
75489
75701
|
}
|
|
@@ -75494,12 +75706,12 @@ class DoubleLinkedDependencyTree {
|
|
|
75494
75706
|
setWorkspaceDeps(deps) {
|
|
75495
75707
|
this.workspaceDeps = deps;
|
|
75496
75708
|
}
|
|
75497
|
-
async addNode(
|
|
75709
|
+
async addNode(path22, content, language, metadata, imports, itemType, folder, originalPath, isDirectlyStale, isRawApp) {
|
|
75498
75710
|
const hasWorkspaceDeps = itemType === "script" || itemType === "inline_script";
|
|
75499
75711
|
const filteredDeps = hasWorkspaceDeps ? filterWorkspaceDependencies(this.workspaceDeps, content, language) : {};
|
|
75500
75712
|
const stalenessHash = await generateScriptHash({}, content, metadata);
|
|
75501
|
-
if (!this.nodes.has(
|
|
75502
|
-
this.nodes.set(
|
|
75713
|
+
if (!this.nodes.has(path22)) {
|
|
75714
|
+
this.nodes.set(path22, {
|
|
75503
75715
|
content: "",
|
|
75504
75716
|
stalenessHash: "",
|
|
75505
75717
|
language: "deno",
|
|
@@ -75512,7 +75724,7 @@ class DoubleLinkedDependencyTree {
|
|
|
75512
75724
|
isDirectlyStale: false
|
|
75513
75725
|
});
|
|
75514
75726
|
}
|
|
75515
|
-
const node = this.nodes.get(
|
|
75727
|
+
const node = this.nodes.get(path22);
|
|
75516
75728
|
node.content = content;
|
|
75517
75729
|
node.stalenessHash = stalenessHash;
|
|
75518
75730
|
node.language = language;
|
|
@@ -75559,59 +75771,59 @@ class DoubleLinkedDependencyTree {
|
|
|
75559
75771
|
isDirectlyStale: false
|
|
75560
75772
|
});
|
|
75561
75773
|
}
|
|
75562
|
-
this.nodes.get(importPath).importedBy.add(
|
|
75774
|
+
this.nodes.get(importPath).importedBy.add(path22);
|
|
75563
75775
|
}
|
|
75564
75776
|
}
|
|
75565
|
-
getContent(
|
|
75566
|
-
return this.nodes.get(
|
|
75777
|
+
getContent(path22) {
|
|
75778
|
+
return this.nodes.get(path22)?.content;
|
|
75567
75779
|
}
|
|
75568
|
-
getStalenessHash(
|
|
75569
|
-
return this.nodes.get(
|
|
75780
|
+
getStalenessHash(path22) {
|
|
75781
|
+
return this.nodes.get(path22)?.stalenessHash;
|
|
75570
75782
|
}
|
|
75571
|
-
getContentHash(
|
|
75572
|
-
return this.nodes.get(
|
|
75783
|
+
getContentHash(path22) {
|
|
75784
|
+
return this.nodes.get(path22)?.contentHash;
|
|
75573
75785
|
}
|
|
75574
|
-
setContentHash(
|
|
75575
|
-
const node = this.nodes.get(
|
|
75786
|
+
setContentHash(path22, hash2) {
|
|
75787
|
+
const node = this.nodes.get(path22);
|
|
75576
75788
|
if (node) {
|
|
75577
75789
|
node.contentHash = hash2;
|
|
75578
75790
|
}
|
|
75579
75791
|
}
|
|
75580
|
-
getLanguage(
|
|
75581
|
-
return this.nodes.get(
|
|
75792
|
+
getLanguage(path22) {
|
|
75793
|
+
return this.nodes.get(path22)?.language;
|
|
75582
75794
|
}
|
|
75583
|
-
getMetadata(
|
|
75584
|
-
return this.nodes.get(
|
|
75795
|
+
getMetadata(path22) {
|
|
75796
|
+
return this.nodes.get(path22)?.metadata;
|
|
75585
75797
|
}
|
|
75586
|
-
getStaleReason(
|
|
75587
|
-
return this.nodes.get(
|
|
75798
|
+
getStaleReason(path22) {
|
|
75799
|
+
return this.nodes.get(path22)?.staleReason;
|
|
75588
75800
|
}
|
|
75589
|
-
getItemType(
|
|
75590
|
-
return this.nodes.get(
|
|
75801
|
+
getItemType(path22) {
|
|
75802
|
+
return this.nodes.get(path22)?.itemType;
|
|
75591
75803
|
}
|
|
75592
|
-
getFolder(
|
|
75593
|
-
return this.nodes.get(
|
|
75804
|
+
getFolder(path22) {
|
|
75805
|
+
return this.nodes.get(path22)?.folder;
|
|
75594
75806
|
}
|
|
75595
|
-
getIsRawApp(
|
|
75596
|
-
return this.nodes.get(
|
|
75807
|
+
getIsRawApp(path22) {
|
|
75808
|
+
return this.nodes.get(path22)?.isRawApp;
|
|
75597
75809
|
}
|
|
75598
|
-
getIsDirectlyStale(
|
|
75599
|
-
return this.nodes.get(
|
|
75810
|
+
getIsDirectlyStale(path22) {
|
|
75811
|
+
return this.nodes.get(path22)?.isDirectlyStale ?? false;
|
|
75600
75812
|
}
|
|
75601
|
-
getOriginalPath(
|
|
75602
|
-
return this.nodes.get(
|
|
75813
|
+
getOriginalPath(path22) {
|
|
75814
|
+
return this.nodes.get(path22)?.originalPath;
|
|
75603
75815
|
}
|
|
75604
|
-
getImports(
|
|
75605
|
-
return this.nodes.get(
|
|
75816
|
+
getImports(path22) {
|
|
75817
|
+
return this.nodes.get(path22)?.imports;
|
|
75606
75818
|
}
|
|
75607
|
-
isStale(
|
|
75608
|
-
return this.nodes.get(
|
|
75819
|
+
isStale(path22) {
|
|
75820
|
+
return this.nodes.get(path22)?.staleReason !== undefined;
|
|
75609
75821
|
}
|
|
75610
75822
|
propagateStaleness() {
|
|
75611
75823
|
const directlyStale = new Set;
|
|
75612
|
-
for (const [
|
|
75824
|
+
for (const [path22, node] of this.nodes.entries()) {
|
|
75613
75825
|
if (node.isDirectlyStale) {
|
|
75614
|
-
directlyStale.add(
|
|
75826
|
+
directlyStale.add(path22);
|
|
75615
75827
|
node.staleReason = "content changed";
|
|
75616
75828
|
}
|
|
75617
75829
|
}
|
|
@@ -75663,20 +75875,20 @@ class DoubleLinkedDependencyTree {
|
|
|
75663
75875
|
return this.nodes.keys();
|
|
75664
75876
|
}
|
|
75665
75877
|
*stalePaths() {
|
|
75666
|
-
for (const [
|
|
75878
|
+
for (const [path22, node] of this.nodes.entries()) {
|
|
75667
75879
|
if (node.staleReason) {
|
|
75668
|
-
yield
|
|
75880
|
+
yield path22;
|
|
75669
75881
|
}
|
|
75670
75882
|
}
|
|
75671
75883
|
}
|
|
75672
|
-
has(
|
|
75673
|
-
return this.nodes.has(
|
|
75884
|
+
has(path22) {
|
|
75885
|
+
return this.nodes.has(path22);
|
|
75674
75886
|
}
|
|
75675
75887
|
getMismatchedWorkspaceDeps() {
|
|
75676
75888
|
const result2 = {};
|
|
75677
|
-
for (const [
|
|
75889
|
+
for (const [path22, node] of this.nodes.entries()) {
|
|
75678
75890
|
if (node.itemType === "dependencies" && node.contentHash && node.content !== undefined) {
|
|
75679
|
-
result2[
|
|
75891
|
+
result2[path22] = node.content;
|
|
75680
75892
|
}
|
|
75681
75893
|
}
|
|
75682
75894
|
return result2;
|
|
@@ -75691,11 +75903,11 @@ class DoubleLinkedDependencyTree {
|
|
|
75691
75903
|
return result2;
|
|
75692
75904
|
}
|
|
75693
75905
|
async persistDepsHashes(depsPaths) {
|
|
75694
|
-
for (const
|
|
75695
|
-
const node = this.nodes.get(
|
|
75906
|
+
for (const path22 of depsPaths) {
|
|
75907
|
+
const node = this.nodes.get(path22);
|
|
75696
75908
|
if (node?.itemType === "dependencies" && node.content !== undefined) {
|
|
75697
|
-
const hash2 = await generateHash(node.content +
|
|
75698
|
-
await updateMetadataGlobalLock(
|
|
75909
|
+
const hash2 = await generateHash(node.content + path22);
|
|
75910
|
+
await updateMetadataGlobalLock(path22, hash2);
|
|
75699
75911
|
}
|
|
75700
75912
|
}
|
|
75701
75913
|
}
|
|
@@ -77112,8 +77324,8 @@ import * as http3 from "node:http";
|
|
|
77112
77324
|
import * as https from "node:https";
|
|
77113
77325
|
import { access, readdir as readdir10, realpath, stat as stat17, unlink, writeFile as writeFile19 } from "node:fs/promises";
|
|
77114
77326
|
import { watch as watch2 } from "node:fs";
|
|
77115
|
-
import * as
|
|
77116
|
-
import * as
|
|
77327
|
+
import * as path21 from "node:path";
|
|
77328
|
+
import * as fs14 from "node:fs";
|
|
77117
77329
|
|
|
77118
77330
|
// src/commands/dev/pathscript-restore.ts
|
|
77119
77331
|
var TAG_KEY = "_originalPathScript";
|
|
@@ -77208,7 +77420,7 @@ var PORT = 3001;
|
|
|
77208
77420
|
var FLOW_SUFFIXES = [".flow", "__flow"];
|
|
77209
77421
|
var APP_SUFFIXES = [".app", "__app", ".raw_app", "__raw_app"];
|
|
77210
77422
|
var INLINE_SCRIPT_EXTS = new Set([
|
|
77211
|
-
...exts.map((e) =>
|
|
77423
|
+
...exts.map((e) => path21.extname("x" + e)).filter((e) => e !== ".yml"),
|
|
77212
77424
|
".js"
|
|
77213
77425
|
]);
|
|
77214
77426
|
function stripFolderSuffix(rel, suffixes) {
|
|
@@ -77249,13 +77461,13 @@ async function listWorkspacePaths() {
|
|
|
77249
77461
|
if (entry.name.startsWith(".") || entry.name === "node_modules")
|
|
77250
77462
|
continue;
|
|
77251
77463
|
const childRel = rel ? `${rel}/${entry.name}` : entry.name;
|
|
77252
|
-
const childAbs =
|
|
77464
|
+
const childAbs = path21.join(dir, entry.name);
|
|
77253
77465
|
if (entry.isDirectory()) {
|
|
77254
77466
|
if (isFlowFolderName(entry.name)) {
|
|
77255
77467
|
items.push({
|
|
77256
77468
|
path: stripFolderSuffix(childRel, FLOW_SUFFIXES),
|
|
77257
77469
|
kind: "flow",
|
|
77258
|
-
_metaPath:
|
|
77470
|
+
_metaPath: path21.join(childAbs, "flow.yaml")
|
|
77259
77471
|
});
|
|
77260
77472
|
continue;
|
|
77261
77473
|
}
|
|
@@ -77294,25 +77506,25 @@ async function listWorkspacePaths() {
|
|
|
77294
77506
|
async function dev2(opts) {
|
|
77295
77507
|
if (!opts.path) {
|
|
77296
77508
|
const cwd = process.cwd();
|
|
77297
|
-
const cwdBasename =
|
|
77509
|
+
const cwdBasename = path21.basename(cwd);
|
|
77298
77510
|
await loadNonDottedPathsSetting();
|
|
77299
77511
|
if (isFlowFolderName(cwdBasename)) {
|
|
77300
77512
|
GLOBAL_CONFIG_OPT.noCdToRoot = true;
|
|
77301
77513
|
let searchDir = cwd;
|
|
77302
77514
|
let workspaceRoot;
|
|
77303
77515
|
while (true) {
|
|
77304
|
-
const wmillYaml =
|
|
77305
|
-
if (
|
|
77516
|
+
const wmillYaml = path21.join(searchDir, "wmill.yaml");
|
|
77517
|
+
if (fs14.existsSync(wmillYaml)) {
|
|
77306
77518
|
workspaceRoot = searchDir;
|
|
77307
77519
|
break;
|
|
77308
77520
|
}
|
|
77309
|
-
const parentDir =
|
|
77521
|
+
const parentDir = path21.dirname(searchDir);
|
|
77310
77522
|
if (parentDir === searchDir)
|
|
77311
77523
|
break;
|
|
77312
77524
|
searchDir = parentDir;
|
|
77313
77525
|
}
|
|
77314
77526
|
if (workspaceRoot) {
|
|
77315
|
-
const relPath =
|
|
77527
|
+
const relPath = path21.relative(workspaceRoot, cwd).replaceAll("\\", "/");
|
|
77316
77528
|
opts.path = stripFolderSuffix(relPath, FLOW_SUFFIXES);
|
|
77317
77529
|
info(`Detected flow folder, path: ${opts.path}`);
|
|
77318
77530
|
process.chdir(workspaceRoot);
|
|
@@ -77377,7 +77589,7 @@ async function dev2(opts) {
|
|
|
77377
77589
|
return;
|
|
77378
77590
|
const wmFlowPath = stripFolderSuffix(localPath.replace(/\/$/, ""), FLOW_SUFFIXES);
|
|
77379
77591
|
const localFlow = await yamlParseFile(localPath + "flow.yaml");
|
|
77380
|
-
await replaceInlineScripts(localFlow.value.modules, async (
|
|
77592
|
+
await replaceInlineScripts(localFlow.value.modules, async (path22) => await readTextFile(localPath + path22), exports_log, localPath, SEP20, undefined);
|
|
77381
77593
|
snapshotPathScripts(localFlow.value);
|
|
77382
77594
|
const localScriptReader = createPreviewLocalScriptReader({
|
|
77383
77595
|
exts,
|
|
@@ -77539,7 +77751,7 @@ async function dev2(opts) {
|
|
|
77539
77751
|
for (const file of dirFiles) {
|
|
77540
77752
|
if (file === "flow.yaml" || file === "flow.json" || file.startsWith("."))
|
|
77541
77753
|
continue;
|
|
77542
|
-
if (!INLINE_SCRIPT_EXTS.has(
|
|
77754
|
+
if (!INLINE_SCRIPT_EXTS.has(path21.extname(file)))
|
|
77543
77755
|
continue;
|
|
77544
77756
|
if (!extractedPaths.has(file)) {
|
|
77545
77757
|
await unlink(flowDir + file);
|
|
@@ -77568,8 +77780,15 @@ async function dev2(opts) {
|
|
|
77568
77780
|
console.error("Failed to push initial state to new client:", e);
|
|
77569
77781
|
}
|
|
77570
77782
|
}
|
|
77783
|
+
let pendingFlowMessage;
|
|
77784
|
+
let flowDebounceTimer;
|
|
77571
77785
|
ws.on("close", () => {
|
|
77572
77786
|
connectedClients.delete(ws);
|
|
77787
|
+
if (flowDebounceTimer) {
|
|
77788
|
+
clearTimeout(flowDebounceTimer);
|
|
77789
|
+
flowDebounceTimer = undefined;
|
|
77790
|
+
pendingFlowMessage = undefined;
|
|
77791
|
+
}
|
|
77573
77792
|
console.log("Dev client disconnected");
|
|
77574
77793
|
});
|
|
77575
77794
|
ws.on("message", (message) => {
|
|
@@ -77583,9 +77802,20 @@ async function dev2(opts) {
|
|
|
77583
77802
|
if (data3.type === "load") {
|
|
77584
77803
|
loadPaths([data3.path]);
|
|
77585
77804
|
} else if (data3.type === "flow") {
|
|
77586
|
-
|
|
77587
|
-
|
|
77588
|
-
|
|
77805
|
+
pendingFlowMessage = data3;
|
|
77806
|
+
if (flowDebounceTimer) {
|
|
77807
|
+
clearTimeout(flowDebounceTimer);
|
|
77808
|
+
}
|
|
77809
|
+
flowDebounceTimer = setTimeout(() => {
|
|
77810
|
+
const msg = pendingFlowMessage;
|
|
77811
|
+
pendingFlowMessage = undefined;
|
|
77812
|
+
flowDebounceTimer = undefined;
|
|
77813
|
+
if (msg) {
|
|
77814
|
+
handleFlowRoundTrip(msg).catch((err) => {
|
|
77815
|
+
error(`Failed to write flow changes: ${err}`);
|
|
77816
|
+
});
|
|
77817
|
+
}
|
|
77818
|
+
}, 200);
|
|
77589
77819
|
} else if (data3.type === "loadWmPath") {
|
|
77590
77820
|
loadWmPath(data3.path).then((edit) => {
|
|
77591
77821
|
if (edit && ws.readyState === import_websocket.default.OPEN) {
|
|
@@ -78006,7 +78236,7 @@ import { stat as stat19, writeFile as writeFile21, rm as rm5 } from "node:fs/pro
|
|
|
78006
78236
|
// src/guidance/writer.ts
|
|
78007
78237
|
await init_utils();
|
|
78008
78238
|
import { cp, mkdir as mkdir13, readdir as readdir11, stat as stat18, writeFile as writeFile20 } from "node:fs/promises";
|
|
78009
|
-
import { join as
|
|
78239
|
+
import { join as join19 } from "node:path";
|
|
78010
78240
|
|
|
78011
78241
|
// src/guidance/core.ts
|
|
78012
78242
|
function generateAgentsMdContent(skillsReference) {
|
|
@@ -78074,7 +78304,7 @@ ${skillsReference}
|
|
|
78074
78304
|
`;
|
|
78075
78305
|
}
|
|
78076
78306
|
|
|
78077
|
-
// src/guidance/skills.ts
|
|
78307
|
+
// src/guidance/skills.gen.ts
|
|
78078
78308
|
var SKILLS = [
|
|
78079
78309
|
{ name: "write-script-bash", description: "MUST use when writing Bash scripts.", languageKey: "bash" },
|
|
78080
78310
|
{ name: "write-script-bigquery", description: "MUST use when writing BigQuery queries.", languageKey: "bigquery" },
|
|
@@ -82920,7 +83150,7 @@ name: write-flow
|
|
|
82920
83150
|
description: MUST use when creating flows.
|
|
82921
83151
|
---
|
|
82922
83152
|
|
|
82923
|
-
# Windmill Flow
|
|
83153
|
+
# Windmill Flow CLI Guide
|
|
82924
83154
|
|
|
82925
83155
|
## Creating a Flow
|
|
82926
83156
|
|
|
@@ -82994,6 +83224,9 @@ If the user already asked to test/run/try the flow in their original request, sk
|
|
|
82994
83224
|
|
|
82995
83225
|
To open the flow visually in the dev page (graph + live reload), use the \`preview\` skill. Always **offer** it as a one-sentence next step (e.g. "Want me to open the visual preview?") rather than opening it automatically — opening the dev page has side effects (browser window, possibly a \`launch.json\` entry under MCP-preview branches) the user should consent to. If the user already asked to see/preview/visualize the flow in their original request, skip the offer and just invoke the skill.
|
|
82996
83226
|
|
|
83227
|
+
|
|
83228
|
+
# Windmill Flow Building Guide
|
|
83229
|
+
|
|
82997
83230
|
## OpenFlow Schema
|
|
82998
83231
|
|
|
82999
83232
|
The OpenFlow schema (openflow.openapi.yaml) is the source of truth for flow structure. Refer to OPENFLOW_SCHEMA for the complete type definitions.
|
|
@@ -85737,12 +85970,12 @@ async function writeAiGuidanceFiles(options) {
|
|
|
85737
85970
|
const nonDottedPaths = options.nonDottedPaths ?? true;
|
|
85738
85971
|
const skillMetadata = options.skillsSourcePath ? await readSkillMetadataFromDirectory(options.skillsSourcePath) : getGeneratedSkillMetadata();
|
|
85739
85972
|
const agentsWritten = await writeProjectGuidanceFile({
|
|
85740
|
-
targetPath:
|
|
85973
|
+
targetPath: join19(options.targetDir, "AGENTS.md"),
|
|
85741
85974
|
overwrite: options.overwriteProjectGuidance ?? false,
|
|
85742
85975
|
content: options.agentsSourcePath != null ? await readTextFile(options.agentsSourcePath) : generateAgentsMdContent(buildSkillsReference(skillMetadata))
|
|
85743
85976
|
});
|
|
85744
85977
|
const claudeWritten = await writeProjectGuidanceFile({
|
|
85745
|
-
targetPath:
|
|
85978
|
+
targetPath: join19(options.targetDir, "CLAUDE.md"),
|
|
85746
85979
|
overwrite: options.overwriteProjectGuidance ?? false,
|
|
85747
85980
|
content: options.claudeSourcePath != null ? await readTextFile(options.claudeSourcePath) : CLAUDE_MD_DEFAULT
|
|
85748
85981
|
});
|
|
@@ -85769,9 +86002,9 @@ async function copySkillsFromSource(targetDir, skillsSourcePath) {
|
|
|
85769
86002
|
async function writeGeneratedSkills(targetDir, nonDottedPaths) {
|
|
85770
86003
|
const skillsDirs = await ensureSkillsDirectories(targetDir);
|
|
85771
86004
|
await Promise.all(skillsDirs.flatMap((skillsDir) => SKILLS.map(async (skill) => {
|
|
85772
|
-
const skillDir =
|
|
86005
|
+
const skillDir = join19(skillsDir, skill.name);
|
|
85773
86006
|
await mkdir13(skillDir, { recursive: true });
|
|
85774
|
-
await writeFile20(
|
|
86007
|
+
await writeFile20(join19(skillDir, "SKILL.md"), renderGeneratedSkillContent(skill.name, nonDottedPaths), "utf8");
|
|
85775
86008
|
})));
|
|
85776
86009
|
return SKILLS.map((skill) => ({
|
|
85777
86010
|
...skill,
|
|
@@ -85785,14 +86018,14 @@ function getGeneratedSkillMetadata() {
|
|
|
85785
86018
|
}));
|
|
85786
86019
|
}
|
|
85787
86020
|
async function ensureSkillsDirectories(targetDir) {
|
|
85788
|
-
const skillsDirs = SKILL_TARGET_ROOTS.map((root) =>
|
|
86021
|
+
const skillsDirs = SKILL_TARGET_ROOTS.map((root) => join19(targetDir, root, "skills"));
|
|
85789
86022
|
await Promise.all(skillsDirs.map((skillsDir) => mkdir13(skillsDir, { recursive: true })));
|
|
85790
86023
|
return skillsDirs;
|
|
85791
86024
|
}
|
|
85792
86025
|
async function copyDirectoryContents(sourceDir, targetDir) {
|
|
85793
86026
|
const entries = await readdir11(sourceDir, { withFileTypes: true });
|
|
85794
86027
|
await Promise.all(entries.map(async (entry) => {
|
|
85795
|
-
await cp(
|
|
86028
|
+
await cp(join19(sourceDir, entry.name), join19(targetDir, entry.name), {
|
|
85796
86029
|
recursive: true,
|
|
85797
86030
|
force: true
|
|
85798
86031
|
});
|
|
@@ -85835,7 +86068,7 @@ async function readSkillMetadataFromDirectory(skillsDir) {
|
|
|
85835
86068
|
if (!entry.isDirectory()) {
|
|
85836
86069
|
continue;
|
|
85837
86070
|
}
|
|
85838
|
-
const skillPath =
|
|
86071
|
+
const skillPath = join19(skillsDir, entry.name, "SKILL.md");
|
|
85839
86072
|
if (!await stat18(skillPath).catch(() => null)) {
|
|
85840
86073
|
continue;
|
|
85841
86074
|
}
|
|
@@ -86555,7 +86788,7 @@ await __promiseAll([
|
|
|
86555
86788
|
init_conf(),
|
|
86556
86789
|
init_utils()
|
|
86557
86790
|
]);
|
|
86558
|
-
import * as
|
|
86791
|
+
import * as fs15 from "node:fs/promises";
|
|
86559
86792
|
async function pullJobs(opts, workspace) {
|
|
86560
86793
|
opts = await mergeConfigWithConfigFile(opts);
|
|
86561
86794
|
const ws = await resolveWorkspace({ ...opts, workspace });
|
|
@@ -86599,7 +86832,7 @@ Warning: Found ${workers.length} active worker(s) on the instance.`));
|
|
|
86599
86832
|
page++;
|
|
86600
86833
|
}
|
|
86601
86834
|
const completedPath = opts.completedOutput || "completed_jobs.json";
|
|
86602
|
-
await
|
|
86835
|
+
await fs15.writeFile(completedPath, JSON.stringify(completedJobs, null, 2));
|
|
86603
86836
|
info(colors.green(`Successfully pulled ${completedJobs.length} completed jobs to ${completedPath}`));
|
|
86604
86837
|
let queuedJobs = [];
|
|
86605
86838
|
page = 1;
|
|
@@ -86617,7 +86850,7 @@ Warning: Found ${workers.length} active worker(s) on the instance.`));
|
|
|
86617
86850
|
page++;
|
|
86618
86851
|
}
|
|
86619
86852
|
const queuedPath = opts.queuedOutput || "queued_jobs.json";
|
|
86620
|
-
await
|
|
86853
|
+
await fs15.writeFile(queuedPath, JSON.stringify(queuedJobs, null, 2));
|
|
86621
86854
|
info(colors.green(`Successfully pulled ${queuedJobs.length} queued jobs to ${queuedPath}`));
|
|
86622
86855
|
const allJobs = [...queuedJobs, ...completedJobs];
|
|
86623
86856
|
if (allJobs.length > 0) {
|
|
@@ -87492,8 +87725,8 @@ async function generateMetadata2(opts, folder) {
|
|
|
87492
87725
|
info("");
|
|
87493
87726
|
if (errors.length > 0) {
|
|
87494
87727
|
info(`Done. Updated ${colors.bold(String(succeeded))}/${total} item(s). ${colors.red(String(errors.length) + " failed")}:`);
|
|
87495
|
-
for (const { path:
|
|
87496
|
-
error(` ${
|
|
87728
|
+
for (const { path: path22, error: error2 } of errors) {
|
|
87729
|
+
error(` ${path22}: ${error2}`);
|
|
87497
87730
|
}
|
|
87498
87731
|
process.exitCode = 1;
|
|
87499
87732
|
} else {
|
|
@@ -87649,7 +87882,7 @@ var config_default = command35;
|
|
|
87649
87882
|
|
|
87650
87883
|
// src/main.ts
|
|
87651
87884
|
await init_context();
|
|
87652
|
-
var VERSION = "1.
|
|
87885
|
+
var VERSION = "1.693.1";
|
|
87653
87886
|
async function checkVersionSafe(cmd) {
|
|
87654
87887
|
const mainCommand = cmd.getMainCommand();
|
|
87655
87888
|
const upgradeCommand = mainCommand.getCommand("upgrade");
|