windmill-cli 1.777.2-gitsync.0 → 1.779.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/main.js +481 -351
- package/package.json +1 -1
package/esm/main.js
CHANGED
|
@@ -16784,7 +16784,7 @@ var init_OpenAPI = __esm(() => {
|
|
|
16784
16784
|
PASSWORD: undefined,
|
|
16785
16785
|
TOKEN: getEnv3("WM_TOKEN"),
|
|
16786
16786
|
USERNAME: undefined,
|
|
16787
|
-
VERSION: "1.
|
|
16787
|
+
VERSION: "1.779.0",
|
|
16788
16788
|
WITH_CREDENTIALS: true,
|
|
16789
16789
|
interceptors: {
|
|
16790
16790
|
request: new Interceptors,
|
|
@@ -17098,6 +17098,7 @@ __export(exports_services_gen, {
|
|
|
17098
17098
|
updateDraft: () => updateDraft,
|
|
17099
17099
|
updateConfig: () => updateConfig,
|
|
17100
17100
|
updateAzureTrigger: () => updateAzureTrigger,
|
|
17101
|
+
updateAppRawSource: () => updateAppRawSource,
|
|
17101
17102
|
updateAppRaw: () => updateAppRaw,
|
|
17102
17103
|
updateAppHistory: () => updateAppHistory,
|
|
17103
17104
|
updateApp: () => updateApp,
|
|
@@ -17263,6 +17264,7 @@ __export(exports_services_gen, {
|
|
|
17263
17264
|
nativeKubernetesAutoscalingHealthcheck: () => nativeKubernetesAutoscalingHealthcheck,
|
|
17264
17265
|
moveS3File: () => moveS3File,
|
|
17265
17266
|
moveCapturesAndConfigs: () => moveCapturesAndConfigs,
|
|
17267
|
+
mintPreviewSdkToken: () => mintPreviewSdkToken,
|
|
17266
17268
|
migrateSecretsToVault: () => migrateSecretsToVault,
|
|
17267
17269
|
migrateSecretsToDatabase: () => migrateSecretsToDatabase,
|
|
17268
17270
|
migrateSecretsToAzureKv: () => migrateSecretsToAzureKv,
|
|
@@ -17302,6 +17304,7 @@ __export(exports_services_gen, {
|
|
|
17302
17304
|
listTokensOfScript: () => listTokensOfScript,
|
|
17303
17305
|
listTokensOfFlow: () => listTokensOfFlow,
|
|
17304
17306
|
listTokens: () => listTokens,
|
|
17307
|
+
listStoredFilesPaged: () => listStoredFilesPaged,
|
|
17305
17308
|
listStoredFiles: () => listStoredFiles,
|
|
17306
17309
|
listSqsTriggers: () => listSqsTriggers,
|
|
17307
17310
|
listSharedUi: () => listSharedUi,
|
|
@@ -17411,6 +17414,7 @@ __export(exports_services_gen, {
|
|
|
17411
17414
|
listAllTgoogleTopicSubscriptions: () => listAllTgoogleTopicSubscriptions,
|
|
17412
17415
|
listAllDedicatedWithDeps: () => listAllDedicatedWithDeps,
|
|
17413
17416
|
listAiSkills: () => listAiSkills,
|
|
17417
|
+
listAddableInstanceUsers: () => listAddableInstanceUsers,
|
|
17414
17418
|
leaveWorkspace: () => leaveWorkspace,
|
|
17415
17419
|
leaveInstance: () => leaveInstance,
|
|
17416
17420
|
isValidPostgresConfiguration: () => isValidPostgresConfiguration,
|
|
@@ -17806,6 +17810,7 @@ __export(exports_services_gen, {
|
|
|
17806
17810
|
createDatatableMigration: () => createDatatableMigration,
|
|
17807
17811
|
createCustomerPortalSession: () => createCustomerPortalSession,
|
|
17808
17812
|
createAzureTrigger: () => createAzureTrigger,
|
|
17813
|
+
createAppRawSource: () => createAppRawSource,
|
|
17809
17814
|
createAppRaw: () => createAppRaw,
|
|
17810
17815
|
createApp: () => createApp,
|
|
17811
17816
|
createAmqpTrigger: () => createAmqpTrigger,
|
|
@@ -19697,6 +19702,18 @@ var backendVersion = () => {
|
|
|
19697
19702
|
workspace: data3.workspace
|
|
19698
19703
|
}
|
|
19699
19704
|
});
|
|
19705
|
+
}, listAddableInstanceUsers = (data3) => {
|
|
19706
|
+
return request(OpenAPI, {
|
|
19707
|
+
method: "GET",
|
|
19708
|
+
url: "/w/{workspace}/users/list_addable",
|
|
19709
|
+
path: {
|
|
19710
|
+
workspace: data3.workspace
|
|
19711
|
+
},
|
|
19712
|
+
query: {
|
|
19713
|
+
search: data3.search,
|
|
19714
|
+
per_page: data3.perPage
|
|
19715
|
+
}
|
|
19716
|
+
});
|
|
19700
19717
|
}, listUsersUsage = (data3) => {
|
|
19701
19718
|
return request(OpenAPI, {
|
|
19702
19719
|
method: "GET",
|
|
@@ -20601,6 +20618,9 @@ var backendVersion = () => {
|
|
|
20601
20618
|
url: "/apps_u/embed_token_by_custom_path/{custom_path}",
|
|
20602
20619
|
path: {
|
|
20603
20620
|
custom_path: data3.customPath
|
|
20621
|
+
},
|
|
20622
|
+
query: {
|
|
20623
|
+
sdk_consent: data3.sdkConsent
|
|
20604
20624
|
}
|
|
20605
20625
|
});
|
|
20606
20626
|
}, getHubScriptContentByPath = (data3) => {
|
|
@@ -21835,6 +21855,16 @@ var backendVersion = () => {
|
|
|
21835
21855
|
raw_app: data3.rawApp
|
|
21836
21856
|
}
|
|
21837
21857
|
});
|
|
21858
|
+
}, mintPreviewSdkToken = (data3) => {
|
|
21859
|
+
return request(OpenAPI, {
|
|
21860
|
+
method: "POST",
|
|
21861
|
+
url: "/w/{workspace}/apps/preview_sdk_token",
|
|
21862
|
+
path: {
|
|
21863
|
+
workspace: data3.workspace
|
|
21864
|
+
},
|
|
21865
|
+
body: data3.requestBody,
|
|
21866
|
+
mediaType: "application/json"
|
|
21867
|
+
});
|
|
21838
21868
|
}, getAppEmbedTokenByPath = (data3) => {
|
|
21839
21869
|
return request(OpenAPI, {
|
|
21840
21870
|
method: "GET",
|
|
@@ -21842,6 +21872,9 @@ var backendVersion = () => {
|
|
|
21842
21872
|
path: {
|
|
21843
21873
|
workspace: data3.workspace,
|
|
21844
21874
|
path: data3.path
|
|
21875
|
+
},
|
|
21876
|
+
query: {
|
|
21877
|
+
sdk_consent: data3.sdkConsent
|
|
21845
21878
|
}
|
|
21846
21879
|
});
|
|
21847
21880
|
}, getAppLiteByPath = (data3) => {
|
|
@@ -21909,6 +21942,9 @@ var backendVersion = () => {
|
|
|
21909
21942
|
path: {
|
|
21910
21943
|
workspace: data3.workspace,
|
|
21911
21944
|
secret: data3.secret
|
|
21945
|
+
},
|
|
21946
|
+
query: {
|
|
21947
|
+
sdk_consent: data3.sdkConsent
|
|
21912
21948
|
}
|
|
21913
21949
|
});
|
|
21914
21950
|
}, getPublicResource = (data3) => {
|
|
@@ -21967,6 +22003,27 @@ var backendVersion = () => {
|
|
|
21967
22003
|
body: data3.requestBody,
|
|
21968
22004
|
mediaType: "application/json"
|
|
21969
22005
|
});
|
|
22006
|
+
}, createAppRawSource = (data3) => {
|
|
22007
|
+
return request(OpenAPI, {
|
|
22008
|
+
method: "POST",
|
|
22009
|
+
url: "/w/{workspace}/apps/create_raw_source",
|
|
22010
|
+
path: {
|
|
22011
|
+
workspace: data3.workspace
|
|
22012
|
+
},
|
|
22013
|
+
body: data3.requestBody,
|
|
22014
|
+
mediaType: "application/json"
|
|
22015
|
+
});
|
|
22016
|
+
}, updateAppRawSource = (data3) => {
|
|
22017
|
+
return request(OpenAPI, {
|
|
22018
|
+
method: "POST",
|
|
22019
|
+
url: "/w/{workspace}/apps/update_raw_source/{path}",
|
|
22020
|
+
path: {
|
|
22021
|
+
workspace: data3.workspace,
|
|
22022
|
+
path: data3.path
|
|
22023
|
+
},
|
|
22024
|
+
body: data3.requestBody,
|
|
22025
|
+
mediaType: "application/json"
|
|
22026
|
+
});
|
|
21970
22027
|
}, updateAppRaw = (data3) => {
|
|
21971
22028
|
return request(OpenAPI, {
|
|
21972
22029
|
method: "POST",
|
|
@@ -25511,6 +25568,22 @@ var backendVersion = () => {
|
|
|
25511
25568
|
max_keys: data3.maxKeys,
|
|
25512
25569
|
marker: data3.marker,
|
|
25513
25570
|
prefix: data3.prefix,
|
|
25571
|
+
search: data3.search,
|
|
25572
|
+
storage: data3.storage,
|
|
25573
|
+
s3_resource_path: data3.s3ResourcePath
|
|
25574
|
+
}
|
|
25575
|
+
});
|
|
25576
|
+
}, listStoredFilesPaged = (data3) => {
|
|
25577
|
+
return request(OpenAPI, {
|
|
25578
|
+
method: "GET",
|
|
25579
|
+
url: "/w/{workspace}/job_helpers/list_stored_files_paged",
|
|
25580
|
+
path: {
|
|
25581
|
+
workspace: data3.workspace
|
|
25582
|
+
},
|
|
25583
|
+
query: {
|
|
25584
|
+
prefix: data3.prefix,
|
|
25585
|
+
max_keys: data3.maxKeys,
|
|
25586
|
+
page_token: data3.pageToken,
|
|
25514
25587
|
storage: data3.storage,
|
|
25515
25588
|
s3_resource_path: data3.s3ResourcePath
|
|
25516
25589
|
}
|
|
@@ -26403,6 +26476,7 @@ __export(exports_gen, {
|
|
|
26403
26476
|
updateDraft: () => updateDraft,
|
|
26404
26477
|
updateConfig: () => updateConfig,
|
|
26405
26478
|
updateAzureTrigger: () => updateAzureTrigger,
|
|
26479
|
+
updateAppRawSource: () => updateAppRawSource,
|
|
26406
26480
|
updateAppRaw: () => updateAppRaw,
|
|
26407
26481
|
updateAppHistory: () => updateAppHistory,
|
|
26408
26482
|
updateApp: () => updateApp,
|
|
@@ -26568,6 +26642,7 @@ __export(exports_gen, {
|
|
|
26568
26642
|
nativeKubernetesAutoscalingHealthcheck: () => nativeKubernetesAutoscalingHealthcheck,
|
|
26569
26643
|
moveS3File: () => moveS3File,
|
|
26570
26644
|
moveCapturesAndConfigs: () => moveCapturesAndConfigs,
|
|
26645
|
+
mintPreviewSdkToken: () => mintPreviewSdkToken,
|
|
26571
26646
|
migrateSecretsToVault: () => migrateSecretsToVault,
|
|
26572
26647
|
migrateSecretsToDatabase: () => migrateSecretsToDatabase,
|
|
26573
26648
|
migrateSecretsToAzureKv: () => migrateSecretsToAzureKv,
|
|
@@ -26607,6 +26682,7 @@ __export(exports_gen, {
|
|
|
26607
26682
|
listTokensOfScript: () => listTokensOfScript,
|
|
26608
26683
|
listTokensOfFlow: () => listTokensOfFlow,
|
|
26609
26684
|
listTokens: () => listTokens,
|
|
26685
|
+
listStoredFilesPaged: () => listStoredFilesPaged,
|
|
26610
26686
|
listStoredFiles: () => listStoredFiles,
|
|
26611
26687
|
listSqsTriggers: () => listSqsTriggers,
|
|
26612
26688
|
listSharedUi: () => listSharedUi,
|
|
@@ -26716,6 +26792,7 @@ __export(exports_gen, {
|
|
|
26716
26792
|
listAllTgoogleTopicSubscriptions: () => listAllTgoogleTopicSubscriptions,
|
|
26717
26793
|
listAllDedicatedWithDeps: () => listAllDedicatedWithDeps,
|
|
26718
26794
|
listAiSkills: () => listAiSkills,
|
|
26795
|
+
listAddableInstanceUsers: () => listAddableInstanceUsers,
|
|
26719
26796
|
leaveWorkspace: () => leaveWorkspace,
|
|
26720
26797
|
leaveInstance: () => leaveInstance,
|
|
26721
26798
|
isValidPostgresConfiguration: () => isValidPostgresConfiguration,
|
|
@@ -27111,6 +27188,7 @@ __export(exports_gen, {
|
|
|
27111
27188
|
createDatatableMigration: () => createDatatableMigration,
|
|
27112
27189
|
createCustomerPortalSession: () => createCustomerPortalSession,
|
|
27113
27190
|
createAzureTrigger: () => createAzureTrigger,
|
|
27191
|
+
createAppRawSource: () => createAppRawSource,
|
|
27114
27192
|
createAppRaw: () => createAppRaw,
|
|
27115
27193
|
createApp: () => createApp,
|
|
27116
27194
|
createAmqpTrigger: () => createAmqpTrigger,
|
|
@@ -27187,8 +27265,13 @@ var init_gen = __esm(() => {
|
|
|
27187
27265
|
// src/core/client.ts
|
|
27188
27266
|
var exports_client = {};
|
|
27189
27267
|
__export(exports_client, {
|
|
27190
|
-
setClient: () => setClient
|
|
27268
|
+
setClient: () => setClient,
|
|
27269
|
+
markRequestsAsSyncOrigin: () => markRequestsAsSyncOrigin
|
|
27191
27270
|
});
|
|
27271
|
+
function markRequestsAsSyncOrigin() {
|
|
27272
|
+
const existing = typeof OpenAPI.HEADERS === "object" ? OpenAPI.HEADERS : {};
|
|
27273
|
+
OpenAPI.HEADERS = { ...existing, "X-Windmill-Deploy-Origin": "sync" };
|
|
27274
|
+
}
|
|
27192
27275
|
function setClient(token, baseUrl2) {
|
|
27193
27276
|
if (baseUrl2 === undefined) {
|
|
27194
27277
|
baseUrl2 = process.env["BASE_INTERNAL_URL"] ?? process.env["BASE_URL"] ?? "http://localhost:8000";
|
|
@@ -27289,7 +27372,7 @@ var init_auth = __esm(async () => {
|
|
|
27289
27372
|
});
|
|
27290
27373
|
|
|
27291
27374
|
// src/core/constants.ts
|
|
27292
|
-
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.
|
|
27375
|
+
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.779.0";
|
|
27293
27376
|
|
|
27294
27377
|
// src/utils/git.ts
|
|
27295
27378
|
var exports_git = {};
|
|
@@ -29977,6 +30060,9 @@ Deploying ${colors.bold(String(selectedDiffs.length))} item(s)...`);
|
|
|
29977
30060
|
});
|
|
29978
30061
|
const workspaceFrom = direction === "to-parent" ? forkWorkspaceId : parentWorkspaceId;
|
|
29979
30062
|
const workspaceTo = direction === "to-parent" ? parentWorkspaceId : forkWorkspaceId;
|
|
30063
|
+
if (direction === "to-fork") {
|
|
30064
|
+
markRequestsAsSyncOrigin();
|
|
30065
|
+
}
|
|
29980
30066
|
let successCount = 0;
|
|
29981
30067
|
let failCount = 0;
|
|
29982
30068
|
const deployedMigrations = [];
|
|
@@ -50108,7 +50194,7 @@ var require_zipEntries = __commonJS((exports, module) => {
|
|
|
50108
50194
|
if (this.centralDirRecords !== this.files.length) {
|
|
50109
50195
|
if (this.centralDirRecords !== 0 && this.files.length === 0) {
|
|
50110
50196
|
throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
|
|
50111
|
-
}
|
|
50197
|
+
}
|
|
50112
50198
|
}
|
|
50113
50199
|
},
|
|
50114
50200
|
readEndOfCentral: function() {
|
|
@@ -58516,7 +58602,7 @@ var require_loader = __commonJS((exports, module) => {
|
|
|
58516
58602
|
var error2 = generateError(state, message);
|
|
58517
58603
|
if (state.onWarning) {
|
|
58518
58604
|
state.onWarning.call(null, error2);
|
|
58519
|
-
}
|
|
58605
|
+
}
|
|
58520
58606
|
}
|
|
58521
58607
|
var directiveHandlers = {
|
|
58522
58608
|
YAML: function handleYamlDirective(state, name, args) {
|
|
@@ -59054,7 +59140,7 @@ var require_loader = __commonJS((exports, module) => {
|
|
|
59054
59140
|
} else if (detectedIndent) {
|
|
59055
59141
|
sc.value += common3.repeat(`
|
|
59056
59142
|
`, emptyLines + 1);
|
|
59057
|
-
}
|
|
59143
|
+
}
|
|
59058
59144
|
detectedIndent = true;
|
|
59059
59145
|
emptyLines = 0;
|
|
59060
59146
|
captureStart = state.position;
|
|
@@ -61503,7 +61589,7 @@ var init_openflow = __esm(() => {
|
|
|
61503
61589
|
openflow_default = {
|
|
61504
61590
|
openapi: "3.0.3",
|
|
61505
61591
|
info: {
|
|
61506
|
-
version: "1.
|
|
61592
|
+
version: "1.779.0",
|
|
61507
61593
|
title: "OpenFlow Spec",
|
|
61508
61594
|
contact: {
|
|
61509
61595
|
name: "Ruben Fiszel",
|
|
@@ -71502,6 +71588,7 @@ async function checkServerLockJobs(workspaceId, sinceIso, changedPaths) {
|
|
|
71502
71588
|
async function push4(opts) {
|
|
71503
71589
|
if (opts.jsonOutput)
|
|
71504
71590
|
setSilent(true);
|
|
71591
|
+
markRequestsAsSyncOrigin();
|
|
71505
71592
|
const originalCliOpts = { ...opts };
|
|
71506
71593
|
opts = await mergeConfigWithConfigFile(opts);
|
|
71507
71594
|
if (originalCliOpts.includeSecrets) {
|
|
@@ -72563,6 +72650,7 @@ var import_yaml12, branchDeprecationWarned = false, yamlOptions, _caseInsensitiv
|
|
|
72563
72650
|
return p == "." + SEP9 || p == "" || p == "u" || p == "f" || p == "g" || p == "ui" || p == "users" || p == "groups" || p == "dependencies" || p == "migrations";
|
|
72564
72651
|
}, SYNC_PUSH_DESTRUCTIVE_WARNING = "`wmill sync push` is destructive: applying it deploys these changes to the remote workspace and overwrites or deletes remote items that differ from or are absent locally — this is not automatically reversible. If you are an AI agent, do NOT run `wmill sync push` (without --dry-run) until the user has explicitly confirmed this deploy, unless your custom instructions explicitly allow bypassing that confirmation.", command8, sync_default;
|
|
72565
72652
|
var init_sync = __esm(async () => {
|
|
72653
|
+
init_client();
|
|
72566
72654
|
init_colors2();
|
|
72567
72655
|
init_mod3();
|
|
72568
72656
|
init_log();
|
|
@@ -76523,9 +76611,47 @@ var init_lint2 = __esm(async () => {
|
|
|
76523
76611
|
lint_default2 = command11;
|
|
76524
76612
|
});
|
|
76525
76613
|
|
|
76614
|
+
// src/commands/app/bundle_command.ts
|
|
76615
|
+
import * as fs15 from "node:fs";
|
|
76616
|
+
import * as path19 from "node:path";
|
|
76617
|
+
import process19 from "node:process";
|
|
76618
|
+
function entryPointFor(appDir) {
|
|
76619
|
+
const frameworks = detectFrameworks(appDir);
|
|
76620
|
+
const candidates = frameworks.svelte || frameworks.vue ? ["index.ts", "index.tsx", "index.js"] : ["index.tsx", "index.ts", "index.js"];
|
|
76621
|
+
const entry = candidates.find((c) => fs15.existsSync(path19.join(appDir, c)));
|
|
76622
|
+
if (!entry) {
|
|
76623
|
+
throw new Error(`No entry point in ${appDir}: expected one of ${candidates.join(", ")}`);
|
|
76624
|
+
}
|
|
76625
|
+
return path19.join(appDir, entry);
|
|
76626
|
+
}
|
|
76627
|
+
async function bundleApp(opts, appFolder) {
|
|
76628
|
+
const appDir = path19.resolve(appFolder ?? process19.cwd());
|
|
76629
|
+
const { js, css } = await createBundle({
|
|
76630
|
+
entryPoint: entryPointFor(appDir),
|
|
76631
|
+
production: true,
|
|
76632
|
+
minify: opts.minify ?? true,
|
|
76633
|
+
sharedUiDir: path19.join(process19.cwd(), "ui"),
|
|
76634
|
+
outDir: `.wmill-bundle-${process19.pid}`
|
|
76635
|
+
});
|
|
76636
|
+
const outDir = path19.resolve(opts.out ?? path19.join(appDir, "dist"));
|
|
76637
|
+
fs15.mkdirSync(outDir, { recursive: true });
|
|
76638
|
+
fs15.writeFileSync(path19.join(outDir, "bundle.js"), js);
|
|
76639
|
+
fs15.writeFileSync(path19.join(outDir, "bundle.css"), css);
|
|
76640
|
+
info(colors.green(`Wrote bundle.js and bundle.css to ${outDir}`));
|
|
76641
|
+
}
|
|
76642
|
+
var command12, bundle_command_default;
|
|
76643
|
+
var init_bundle_command = __esm(async () => {
|
|
76644
|
+
init_mod3();
|
|
76645
|
+
init_log();
|
|
76646
|
+
init_colors2();
|
|
76647
|
+
await init_bundle();
|
|
76648
|
+
command12 = new Command().description("Bundle a raw app folder to js/css without deploying it").arguments("[app_folder:string]").option("--out <dir:string>", "Directory to write bundle.js and bundle.css into (default: <app_folder>/dist)").option("--no-minify", "Skip minification").action(bundleApp);
|
|
76649
|
+
bundle_command_default = command12;
|
|
76650
|
+
});
|
|
76651
|
+
|
|
76526
76652
|
// src/commands/app/new.ts
|
|
76527
76653
|
import { stat as stat9, writeFile as writeFile10, mkdir as mkdir7, rm as rm4 } from "node:fs/promises";
|
|
76528
|
-
import
|
|
76654
|
+
import path20 from "node:path";
|
|
76529
76655
|
import { execSync as execSync5, exec, execFile as execFile6 } from "node:child_process";
|
|
76530
76656
|
function validateAppPath(appPath) {
|
|
76531
76657
|
if (!appPath.startsWith("u/") && !appPath.startsWith("f/")) {
|
|
@@ -76781,7 +76907,7 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
76781
76907
|
}
|
|
76782
76908
|
await loadNonDottedPathsSetting();
|
|
76783
76909
|
const folderName2 = buildFolderPath(appPath, "raw_app");
|
|
76784
|
-
const appDir =
|
|
76910
|
+
const appDir = path20.join(process.cwd(), folderName2);
|
|
76785
76911
|
let dirExists = false;
|
|
76786
76912
|
try {
|
|
76787
76913
|
await stat9(appDir);
|
|
@@ -76806,17 +76932,17 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
76806
76932
|
await rm4(appDir, { recursive: true, force: true });
|
|
76807
76933
|
}
|
|
76808
76934
|
await mkdir7(appDir, { recursive: true });
|
|
76809
|
-
await mkdir7(
|
|
76810
|
-
await mkdir7(
|
|
76935
|
+
await mkdir7(path20.join(appDir, "backend"), { recursive: true });
|
|
76936
|
+
await mkdir7(path20.join(appDir, "sql_to_apply"), { recursive: true });
|
|
76811
76937
|
const rawAppConfig = {
|
|
76812
76938
|
summary
|
|
76813
76939
|
};
|
|
76814
76940
|
if (dataConfig.datatable) {
|
|
76815
76941
|
rawAppConfig.data = dataConfig;
|
|
76816
76942
|
}
|
|
76817
|
-
await writeFile10(
|
|
76943
|
+
await writeFile10(path20.join(appDir, "raw_app.yaml"), import_yaml23.stringify(rawAppConfig, yamlOptions), "utf-8");
|
|
76818
76944
|
for (const [filePath, content] of Object.entries(template.files)) {
|
|
76819
|
-
const fullPath =
|
|
76945
|
+
const fullPath = path20.join(appDir, filePath.slice(1));
|
|
76820
76946
|
await writeFile10(fullPath, content.trim() + `
|
|
76821
76947
|
`, "utf-8");
|
|
76822
76948
|
}
|
|
@@ -76826,21 +76952,21 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
76826
76952
|
schema: dataConfig.schema
|
|
76827
76953
|
} : undefined;
|
|
76828
76954
|
const agentsContent = generateAgentsDocumentation(dataForDocs);
|
|
76829
|
-
await writeFile10(
|
|
76830
|
-
await writeFile10(
|
|
76955
|
+
await writeFile10(path20.join(appDir, "AGENTS.md"), agentsContent, "utf-8");
|
|
76956
|
+
await writeFile10(path20.join(appDir, "CLAUDE.md"), `Instructions are in @AGENTS.md
|
|
76831
76957
|
`, "utf-8");
|
|
76832
76958
|
const datatablesContent = generateDatatablesDocumentation(dataForDocs);
|
|
76833
|
-
await writeFile10(
|
|
76959
|
+
await writeFile10(path20.join(appDir, "DATATABLES.md"), datatablesContent, "utf-8");
|
|
76834
76960
|
const exampleRunnable = {
|
|
76835
76961
|
type: "inline",
|
|
76836
76962
|
path: undefined
|
|
76837
76963
|
};
|
|
76838
|
-
await writeFile10(
|
|
76839
|
-
await writeFile10(
|
|
76964
|
+
await writeFile10(path20.join(appDir, "backend", "a.yaml"), import_yaml23.stringify(exampleRunnable, yamlOptions), "utf-8");
|
|
76965
|
+
await writeFile10(path20.join(appDir, "backend", "a.ts"), `export async function main(x: number): Promise<string> {
|
|
76840
76966
|
return \`Hello from backend! x = \${x}\`;
|
|
76841
76967
|
}
|
|
76842
76968
|
`, "utf-8");
|
|
76843
|
-
await writeFile10(
|
|
76969
|
+
await writeFile10(path20.join(appDir, "sql_to_apply", "README.md"), `# SQL Migrations Folder
|
|
76844
76970
|
|
|
76845
76971
|
This folder is for SQL migration files that will be applied to datatables during development.
|
|
76846
76972
|
|
|
@@ -76868,7 +76994,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
76868
76994
|
- Use idempotent SQL (\`CREATE TABLE IF NOT EXISTS\`, etc.)
|
|
76869
76995
|
`);
|
|
76870
76996
|
if (createSchemaSQL && schemaName) {
|
|
76871
|
-
await writeFile10(
|
|
76997
|
+
await writeFile10(path20.join(appDir, "sql_to_apply", `000_create_schema_${schemaName}.sql`), createSchemaSQL, "utf-8");
|
|
76872
76998
|
}
|
|
76873
76999
|
info("");
|
|
76874
77000
|
info(colors.bold.green(`App created successfully at ${folderName2}/`));
|
|
@@ -76924,9 +77050,9 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
76924
77050
|
});
|
|
76925
77051
|
if (openInDesktop) {
|
|
76926
77052
|
try {
|
|
76927
|
-
const absAppDir =
|
|
76928
|
-
const claudeDir =
|
|
76929
|
-
const launchPath =
|
|
77053
|
+
const absAppDir = path20.resolve(appDir);
|
|
77054
|
+
const claudeDir = path20.join(absAppDir, ".claude");
|
|
77055
|
+
const launchPath = path20.join(claudeDir, "launch.json");
|
|
76930
77056
|
if (!await stat9(launchPath).catch(() => null)) {
|
|
76931
77057
|
const launchJson = JSON.stringify({
|
|
76932
77058
|
version: "0.0.1",
|
|
@@ -76941,7 +77067,7 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
76941
77067
|
`;
|
|
76942
77068
|
await mkdir7(claudeDir, { recursive: true });
|
|
76943
77069
|
await writeFile10(launchPath, launchJson, "utf-8");
|
|
76944
|
-
info(colors.gray(`Seeded ${
|
|
77070
|
+
info(colors.gray(`Seeded ${path20.relative(process.cwd(), launchPath)}`));
|
|
76945
77071
|
}
|
|
76946
77072
|
const sessionId = crypto.randomUUID();
|
|
76947
77073
|
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
@@ -76950,8 +77076,8 @@ This folder is for SQL migration files that will be applied to datatables during
|
|
|
76950
77076
|
process.stdout.write(`\r${colors.gray(`${frames[i++ % frames.length]} Creating Claude session...`)}`);
|
|
76951
77077
|
}, 80);
|
|
76952
77078
|
try {
|
|
76953
|
-
await new Promise((
|
|
76954
|
-
exec(`claude --session-id "${sessionId}" -p "Say: Your app is ready, click on preview to test it!"`, { cwd: absAppDir }, (error2) => error2 ? reject(error2) :
|
|
77079
|
+
await new Promise((resolve11, reject) => {
|
|
77080
|
+
exec(`claude --session-id "${sessionId}" -p "Say: Your app is ready, click on preview to test it!"`, { cwd: absAppDir }, (error2) => error2 ? reject(error2) : resolve11());
|
|
76955
77081
|
});
|
|
76956
77082
|
} finally {
|
|
76957
77083
|
clearInterval(spinner);
|
|
@@ -77056,7 +77182,7 @@ createApp(App).mount('#root')`, indexCss = `body {
|
|
|
77056
77182
|
.myclass {
|
|
77057
77183
|
border: 1px solid gray;
|
|
77058
77184
|
padding: 2px;
|
|
77059
|
-
}`, templates,
|
|
77185
|
+
}`, templates, command13, new_default;
|
|
77060
77186
|
var init_new = __esm(async () => {
|
|
77061
77187
|
init_mod3();
|
|
77062
77188
|
init_colors2();
|
|
@@ -77141,8 +77267,8 @@ var init_new = __esm(async () => {
|
|
|
77141
77267
|
}
|
|
77142
77268
|
}
|
|
77143
77269
|
};
|
|
77144
|
-
|
|
77145
|
-
new_default =
|
|
77270
|
+
command13 = new Command().description("create a new raw app from a template").option("--summary <summary:string>", "App summary (short description). Skips the prompt when provided. Triggers non-interactive mode.").option("--path <path:string>", "App path (e.g., f/folder/my_app or u/username/my_app). Skips the prompt when provided. Triggers non-interactive mode.").option("--framework <framework:string>", "Framework template: react19 | react18 | svelte5 | vue. Skips the prompt when provided. Triggers non-interactive mode.").option("--datatable <datatable:string>", "Datatable to wire up. Without this flag in non-interactive mode, no datatable is configured.").option("--schema <schema:string>", "Schema to use with --datatable. Created (CREATE SCHEMA IF NOT EXISTS) if it doesn't already exist.").option("--overwrite", "Overwrite the target directory if it already exists, without prompting.").option("--no-open-in-desktop", "Do not prompt to open the new app in Claude Desktop.").action(newApp);
|
|
77271
|
+
new_default = command13;
|
|
77146
77272
|
});
|
|
77147
77273
|
|
|
77148
77274
|
// src/commands/app/app.ts
|
|
@@ -77243,8 +77369,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
77243
77369
|
if (!localPath.endsWith(SEP14)) {
|
|
77244
77370
|
localPath += SEP14;
|
|
77245
77371
|
}
|
|
77246
|
-
const
|
|
77247
|
-
const localApp = await yamlParseFile(
|
|
77372
|
+
const path21 = localPath + "app.yaml";
|
|
77373
|
+
const localApp = await yamlParseFile(path21);
|
|
77248
77374
|
replaceInlineScripts2(localApp.value, localPath, true);
|
|
77249
77375
|
await generatingPolicy2(localApp, remotePath, localApp?.["public"] ?? localApp?.["policy"]?.["execution_mode"] == "anonymous");
|
|
77250
77376
|
const preserveFields = {};
|
|
@@ -77290,13 +77416,13 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
77290
77416
|
}
|
|
77291
77417
|
await applyExtraPermsDiff(workspace, "app", remotePath, localPerms, app?.extra_perms);
|
|
77292
77418
|
}
|
|
77293
|
-
async function generatingPolicy2(app,
|
|
77294
|
-
info(colors.gray(`Generating fresh policy for app ${
|
|
77419
|
+
async function generatingPolicy2(app, path21, publicApp) {
|
|
77420
|
+
info(colors.gray(`Generating fresh policy for app ${path21}...`));
|
|
77295
77421
|
try {
|
|
77296
77422
|
app.policy = await updatePolicy(app.value, undefined);
|
|
77297
77423
|
app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
|
|
77298
77424
|
} catch (e) {
|
|
77299
|
-
error(colors.red(`Error generating policy for app ${
|
|
77425
|
+
error(colors.red(`Error generating policy for app ${path21}: ${e}`));
|
|
77300
77426
|
throw e;
|
|
77301
77427
|
}
|
|
77302
77428
|
}
|
|
@@ -77325,12 +77451,12 @@ async function list6(opts) {
|
|
|
77325
77451
|
new Table2().header(["path", "summary"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary])).render();
|
|
77326
77452
|
}
|
|
77327
77453
|
}
|
|
77328
|
-
async function get4(opts,
|
|
77454
|
+
async function get4(opts, path21) {
|
|
77329
77455
|
const workspace = await resolveWorkspace(opts);
|
|
77330
77456
|
await requireLogin(opts);
|
|
77331
77457
|
const a = await getAppByPath({
|
|
77332
77458
|
workspace: workspace.workspaceId,
|
|
77333
|
-
path:
|
|
77459
|
+
path: path21
|
|
77334
77460
|
});
|
|
77335
77461
|
if (opts.json) {
|
|
77336
77462
|
console.log(JSON.stringify(a));
|
|
@@ -77410,7 +77536,7 @@ async function push5(opts, filePath, remotePath) {
|
|
|
77410
77536
|
info(colors.bold.underline.green("App pushed"));
|
|
77411
77537
|
}
|
|
77412
77538
|
}
|
|
77413
|
-
var alreadySynced2, APP_FOLDER_SUFFIXES,
|
|
77539
|
+
var alreadySynced2, APP_FOLDER_SUFFIXES, command14, app_default;
|
|
77414
77540
|
var init_app = __esm(async () => {
|
|
77415
77541
|
init_mod3();
|
|
77416
77542
|
init_mod6();
|
|
@@ -77429,12 +77555,13 @@ var init_app = __esm(async () => {
|
|
|
77429
77555
|
init_utils(),
|
|
77430
77556
|
init_dev(),
|
|
77431
77557
|
init_lint2(),
|
|
77558
|
+
init_bundle_command(),
|
|
77432
77559
|
init_new(),
|
|
77433
77560
|
init_generate_agents()
|
|
77434
77561
|
]);
|
|
77435
77562
|
alreadySynced2 = [];
|
|
77436
77563
|
APP_FOLDER_SUFFIXES = ["__raw_app", ".raw_app", "__app", ".app"];
|
|
77437
|
-
|
|
77564
|
+
command14 = new Command().description("app related commands").option("--json", "Output as JSON (for piping to jq)").action(list6).command("list", "list all apps").option("--json", "Output as JSON (for piping to jq)").action(list6).command("get", "get an app's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get4).command("push", "push a local app. With no args, infers the app from the current directory and the remote path from its location relative to wmill.yaml.").arguments("[file_path:string] [remote_path:string]").action(push5).command("dev", dev_default).command("lint", lint_default2).command("bundle", bundle_command_default).command("new", new_default).command("generate-agents", generate_agents_default).command("generate-locks", 'DEPRECATED: re-generate app lockfiles. Use "wmill generate-metadata" instead.').arguments("[app_folder:string]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("--default-ts <runtime:string>", "Default TypeScript runtime (bun or deno)").action(async (opts, appFolder) => {
|
|
77438
77565
|
warn(colors.yellow('This command is deprecated. Use "wmill generate-metadata" instead.'));
|
|
77439
77566
|
const { generateLocksCommand: generateLocksCommand2 } = await init_app_metadata().then(() => exports_app_metadata);
|
|
77440
77567
|
await generateLocksCommand2(opts, appFolder);
|
|
@@ -77465,7 +77592,7 @@ var init_app = __esm(async () => {
|
|
|
77465
77592
|
});
|
|
77466
77593
|
info(colors.green(`Updated permissioned_as for app ${appPath} to ${email}`));
|
|
77467
77594
|
});
|
|
77468
|
-
app_default =
|
|
77595
|
+
app_default = command14;
|
|
77469
77596
|
});
|
|
77470
77597
|
|
|
77471
77598
|
// src/commands/folder/folder.ts
|
|
@@ -77629,7 +77756,7 @@ async function addMissing(opts) {
|
|
|
77629
77756
|
info(`
|
|
77630
77757
|
Created ${missing.length} folder.meta.yaml file(s). You can now run 'wmill sync push' to push them.`);
|
|
77631
77758
|
}
|
|
77632
|
-
var import_yaml25,
|
|
77759
|
+
var import_yaml25, command15, folder_default;
|
|
77633
77760
|
var init_folder = __esm(async () => {
|
|
77634
77761
|
init_colors2();
|
|
77635
77762
|
init_mod3();
|
|
@@ -77643,7 +77770,7 @@ var init_folder = __esm(async () => {
|
|
|
77643
77770
|
init_types()
|
|
77644
77771
|
]);
|
|
77645
77772
|
import_yaml25 = __toESM(require_dist(), 1);
|
|
77646
|
-
|
|
77773
|
+
command15 = new Command().description("folder related commands").option("--json", "Output as JSON (for piping to jq)").action(list7).command("list", "list all folders").option("--json", "Output as JSON (for piping to jq)").action(list7).command("get", "get a folder's details").arguments("<name:string>").option("--json", "Output as JSON (for piping to jq)").action(get5).command("new", "create a new folder locally").arguments("<name:string>").option("--summary <summary:string>", "folder summary").action(newFolder).command("push", "push a local folder to the remote by name. This overrides any remote versions.").arguments("<name:string>").action(push6).command("add-missing", "create default folder.meta.yaml for all subdirectories of f/ that are missing one").option("-y, --yes", "skip confirmation prompt").action(addMissing).command("show-rules", "Show default_permissioned_as rules for a folder. Use --test-path to see which rule matches a given item path.").arguments("<name:string>").option("--test-path <path:string>", "Test which rule matches this item path (e.g. f/prod/jobs/my_script)").option("--json", "Output as JSON").action(async (opts, folderName2) => {
|
|
77647
77774
|
const workspace = await resolveWorkspace(opts);
|
|
77648
77775
|
await requireLogin(opts);
|
|
77649
77776
|
const folder = await getFolder({
|
|
@@ -77691,7 +77818,7 @@ var init_folder = __esm(async () => {
|
|
|
77691
77818
|
info(colors.yellow(`No rule matches path '${testPath}' (relative: '${relative8}')`));
|
|
77692
77819
|
}
|
|
77693
77820
|
});
|
|
77694
|
-
folder_default =
|
|
77821
|
+
folder_default = command15;
|
|
77695
77822
|
});
|
|
77696
77823
|
|
|
77697
77824
|
// src/commands/variable/variable.ts
|
|
@@ -77717,11 +77844,11 @@ async function list8(opts) {
|
|
|
77717
77844
|
])).render();
|
|
77718
77845
|
}
|
|
77719
77846
|
}
|
|
77720
|
-
async function newVariable(opts,
|
|
77721
|
-
if (!validatePath(
|
|
77847
|
+
async function newVariable(opts, path21) {
|
|
77848
|
+
if (!validatePath(path21)) {
|
|
77722
77849
|
return;
|
|
77723
77850
|
}
|
|
77724
|
-
const filePath =
|
|
77851
|
+
const filePath = path21 + ".variable.yaml";
|
|
77725
77852
|
try {
|
|
77726
77853
|
await stat12(filePath);
|
|
77727
77854
|
throw new Error("File already exists: " + filePath);
|
|
@@ -77741,14 +77868,14 @@ async function newVariable(opts, path20) {
|
|
|
77741
77868
|
});
|
|
77742
77869
|
info(colors.green(`Created ${filePath}`));
|
|
77743
77870
|
}
|
|
77744
|
-
async function get6(opts,
|
|
77871
|
+
async function get6(opts, path21) {
|
|
77745
77872
|
if (opts.json)
|
|
77746
77873
|
setSilent(true);
|
|
77747
77874
|
const workspace = await resolveWorkspace(opts);
|
|
77748
77875
|
await requireLogin(opts);
|
|
77749
77876
|
const v = await getVariable({
|
|
77750
77877
|
workspace: workspace.workspaceId,
|
|
77751
|
-
path:
|
|
77878
|
+
path: path21
|
|
77752
77879
|
});
|
|
77753
77880
|
if (opts.json) {
|
|
77754
77881
|
console.log(JSON.stringify(v));
|
|
@@ -77899,7 +78026,7 @@ async function add2(opts, value, remotePath) {
|
|
|
77899
78026
|
}
|
|
77900
78027
|
info(colors.bold.underline.green(`Variable ${remotePath} pushed`));
|
|
77901
78028
|
}
|
|
77902
|
-
var import_yaml26,
|
|
78029
|
+
var import_yaml26, command16, variable_default;
|
|
77903
78030
|
var init_variable = __esm(async () => {
|
|
77904
78031
|
init_mod3();
|
|
77905
78032
|
init_mod6();
|
|
@@ -77913,8 +78040,8 @@ var init_variable = __esm(async () => {
|
|
|
77913
78040
|
init_confirm()
|
|
77914
78041
|
]);
|
|
77915
78042
|
import_yaml26 = __toESM(require_dist(), 1);
|
|
77916
|
-
|
|
77917
|
-
variable_default =
|
|
78043
|
+
command16 = new Command().description("variable related commands").option("--json", "Output as JSON (for piping to jq)").action(list8).command("list", "list all variables").option("--json", "Output as JSON (for piping to jq)").action(list8).command("get", "get a variable's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get6).command("new", "create a new variable locally").arguments("<path:string>").action(newVariable).command("push", "Push a local variable spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").option("--plain-secrets", "Push secrets as plain text").action(push7).command("add", "Create a new variable on the remote. This will update the variable if it already exists.").arguments("<value:string> <remote_path:string>").option("--yes", "Skip confirmation prompt when updating an existing variable").option("--secret", "Mark the variable as secret (default when creating a new variable)").option("--no-secret", "Mark the variable as non-secret (when updating, the existing setting is preserved if neither --secret nor --no-secret is passed)").option("--description <description:string>", "Set the variable description (when updating, the existing description is preserved if not passed)").option("--plain-secrets", "Push secrets as plain text").option("--public", "Legacy option, use --no-secret instead").action(add2);
|
|
78044
|
+
variable_default = command16;
|
|
77918
78045
|
});
|
|
77919
78046
|
|
|
77920
78047
|
// src/commands/schedule/schedule.ts
|
|
@@ -77935,11 +78062,11 @@ async function list9(opts) {
|
|
|
77935
78062
|
new Table2().header(["Path", "Schedule"]).padding(2).border(true).body(schedules.map((x) => [x.path, x.schedule])).render();
|
|
77936
78063
|
}
|
|
77937
78064
|
}
|
|
77938
|
-
async function newSchedule(opts,
|
|
77939
|
-
if (!validatePath(
|
|
78065
|
+
async function newSchedule(opts, path21) {
|
|
78066
|
+
if (!validatePath(path21)) {
|
|
77940
78067
|
return;
|
|
77941
78068
|
}
|
|
77942
|
-
const filePath =
|
|
78069
|
+
const filePath = path21 + ".schedule.yaml";
|
|
77943
78070
|
try {
|
|
77944
78071
|
await stat13(filePath);
|
|
77945
78072
|
throw new Error("File already exists: " + filePath);
|
|
@@ -77963,14 +78090,14 @@ async function newSchedule(opts, path20) {
|
|
|
77963
78090
|
});
|
|
77964
78091
|
info(colors.green(`Created ${filePath}`));
|
|
77965
78092
|
}
|
|
77966
|
-
async function get7(opts,
|
|
78093
|
+
async function get7(opts, path21) {
|
|
77967
78094
|
if (opts.json)
|
|
77968
78095
|
setSilent(true);
|
|
77969
78096
|
const workspace = await resolveWorkspace(opts);
|
|
77970
78097
|
await requireLogin(opts);
|
|
77971
78098
|
const s = await getSchedule({
|
|
77972
78099
|
workspace: workspace.workspaceId,
|
|
77973
|
-
path:
|
|
78100
|
+
path: path21
|
|
77974
78101
|
});
|
|
77975
78102
|
if (opts.json) {
|
|
77976
78103
|
console.log(JSON.stringify(s));
|
|
@@ -77983,14 +78110,14 @@ async function get7(opts, path20) {
|
|
|
77983
78110
|
console.log(colors.bold("Enabled:") + " " + (s.enabled ? "true" : "false"));
|
|
77984
78111
|
}
|
|
77985
78112
|
}
|
|
77986
|
-
async function pushSchedule(workspace,
|
|
77987
|
-
|
|
77988
|
-
debug(`Processing local schedule ${
|
|
78113
|
+
async function pushSchedule(workspace, path21, schedule, localSchedule, permissionedAsContext) {
|
|
78114
|
+
path21 = removeType(path21, "schedule").replaceAll(SEP17, "/");
|
|
78115
|
+
debug(`Processing local schedule ${path21}`);
|
|
77989
78116
|
try {
|
|
77990
|
-
schedule = await getSchedule({ workspace, path:
|
|
77991
|
-
debug(`Schedule ${
|
|
78117
|
+
schedule = await getSchedule({ workspace, path: path21 });
|
|
78118
|
+
debug(`Schedule ${path21} exists on remote`);
|
|
77992
78119
|
} catch {
|
|
77993
|
-
debug(`Schedule ${
|
|
78120
|
+
debug(`Schedule ${path21} does not exist on remote`);
|
|
77994
78121
|
}
|
|
77995
78122
|
delete localSchedule.has_permissioned_as;
|
|
77996
78123
|
const preserveFields = {};
|
|
@@ -77999,31 +78126,31 @@ async function pushSchedule(workspace, path20, schedule, localSchedule, permissi
|
|
|
77999
78126
|
preserveFields.preserve_permissioned_as = true;
|
|
78000
78127
|
if (schedule.permissioned_as) {
|
|
78001
78128
|
preserveFields.permissioned_as = schedule.permissioned_as;
|
|
78002
|
-
info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${
|
|
78129
|
+
info(`Preserving ${schedule.permissioned_as} as permissioned_as for schedule ${path21}`);
|
|
78003
78130
|
}
|
|
78004
78131
|
}
|
|
78005
78132
|
}
|
|
78006
78133
|
if (schedule) {
|
|
78007
78134
|
if (isSuperset(localSchedule, schedule)) {
|
|
78008
|
-
debug(`Schedule ${
|
|
78135
|
+
debug(`Schedule ${path21} is up to date`);
|
|
78009
78136
|
return;
|
|
78010
78137
|
}
|
|
78011
|
-
debug(`Updating schedule ${
|
|
78138
|
+
debug(`Updating schedule ${path21}`);
|
|
78012
78139
|
try {
|
|
78013
|
-
info(colors.bold.yellow(`Updating schedule ${
|
|
78140
|
+
info(colors.bold.yellow(`Updating schedule ${path21}`));
|
|
78014
78141
|
await updateSchedule({
|
|
78015
78142
|
workspace,
|
|
78016
|
-
path:
|
|
78143
|
+
path: path21,
|
|
78017
78144
|
requestBody: {
|
|
78018
78145
|
...localSchedule,
|
|
78019
78146
|
...preserveFields
|
|
78020
78147
|
}
|
|
78021
78148
|
});
|
|
78022
78149
|
if (localSchedule.enabled !== undefined && localSchedule.enabled !== schedule.enabled) {
|
|
78023
|
-
info(colors.bold.yellow(`Schedule ${
|
|
78150
|
+
info(colors.bold.yellow(`Schedule ${path21} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
|
|
78024
78151
|
await setScheduleEnabled({
|
|
78025
78152
|
workspace,
|
|
78026
|
-
path:
|
|
78153
|
+
path: path21,
|
|
78027
78154
|
requestBody: {
|
|
78028
78155
|
enabled: localSchedule.enabled
|
|
78029
78156
|
}
|
|
@@ -78034,12 +78161,12 @@ async function pushSchedule(workspace, path20, schedule, localSchedule, permissi
|
|
|
78034
78161
|
throw e;
|
|
78035
78162
|
}
|
|
78036
78163
|
} else {
|
|
78037
|
-
console.log(colors.bold.yellow("Creating new schedule " +
|
|
78164
|
+
console.log(colors.bold.yellow("Creating new schedule " + path21));
|
|
78038
78165
|
try {
|
|
78039
78166
|
await createSchedule({
|
|
78040
78167
|
workspace,
|
|
78041
78168
|
requestBody: {
|
|
78042
|
-
path:
|
|
78169
|
+
path: path21,
|
|
78043
78170
|
...localSchedule,
|
|
78044
78171
|
...preserveFields
|
|
78045
78172
|
}
|
|
@@ -78050,26 +78177,26 @@ async function pushSchedule(workspace, path20, schedule, localSchedule, permissi
|
|
|
78050
78177
|
}
|
|
78051
78178
|
}
|
|
78052
78179
|
}
|
|
78053
|
-
async function enable(opts,
|
|
78180
|
+
async function enable(opts, path21) {
|
|
78054
78181
|
opts = await mergeConfigWithConfigFile(opts);
|
|
78055
78182
|
const workspace = await resolveWorkspace(opts);
|
|
78056
78183
|
await requireLogin(opts);
|
|
78057
78184
|
try {
|
|
78058
78185
|
await setScheduleEnabled({
|
|
78059
78186
|
workspace: workspace.workspaceId,
|
|
78060
|
-
path:
|
|
78187
|
+
path: path21,
|
|
78061
78188
|
requestBody: { enabled: true, force: opts.force }
|
|
78062
78189
|
});
|
|
78063
78190
|
} catch (e) {
|
|
78064
78191
|
const conflict = parseForkConflict(e);
|
|
78065
78192
|
if (conflict) {
|
|
78066
|
-
error(`Cannot enable schedule '${
|
|
78193
|
+
error(`Cannot enable schedule '${path21}': the parent workspace '${conflict.parentWorkspaceId}' has the same path configured. ` + `Both crons would fire on every tick and the script would run twice per scheduled time.
|
|
78067
78194
|
` + `Re-run with --force to enable anyway.`);
|
|
78068
78195
|
process.exit(1);
|
|
78069
78196
|
}
|
|
78070
78197
|
throw e;
|
|
78071
78198
|
}
|
|
78072
|
-
info(colors.green(`Schedule ${
|
|
78199
|
+
info(colors.green(`Schedule ${path21} enabled.`));
|
|
78073
78200
|
}
|
|
78074
78201
|
function parseForkConflict(e) {
|
|
78075
78202
|
const body = e?.body;
|
|
@@ -78079,16 +78206,16 @@ function parseForkConflict(e) {
|
|
|
78079
78206
|
return;
|
|
78080
78207
|
return { kind: m[1], parentWorkspaceId: m[2].trim() };
|
|
78081
78208
|
}
|
|
78082
|
-
async function disable(opts,
|
|
78209
|
+
async function disable(opts, path21) {
|
|
78083
78210
|
opts = await mergeConfigWithConfigFile(opts);
|
|
78084
78211
|
const workspace = await resolveWorkspace(opts);
|
|
78085
78212
|
await requireLogin(opts);
|
|
78086
78213
|
await setScheduleEnabled({
|
|
78087
78214
|
workspace: workspace.workspaceId,
|
|
78088
|
-
path:
|
|
78215
|
+
path: path21,
|
|
78089
78216
|
requestBody: { enabled: false }
|
|
78090
78217
|
});
|
|
78091
|
-
info(colors.yellow(`Schedule ${
|
|
78218
|
+
info(colors.yellow(`Schedule ${path21} disabled.`));
|
|
78092
78219
|
}
|
|
78093
78220
|
async function push8(opts, filePath, remotePath) {
|
|
78094
78221
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -78104,7 +78231,7 @@ async function push8(opts, filePath, remotePath) {
|
|
|
78104
78231
|
await pushSchedule(workspace.workspaceId, remotePath, undefined, parseFromFile(filePath));
|
|
78105
78232
|
console.log(colors.bold.underline.green("Schedule pushed"));
|
|
78106
78233
|
}
|
|
78107
|
-
var import_yaml27,
|
|
78234
|
+
var import_yaml27, command17, schedule_default2;
|
|
78108
78235
|
var init_schedule2 = __esm(async () => {
|
|
78109
78236
|
init_mod3();
|
|
78110
78237
|
init_mod6();
|
|
@@ -78119,7 +78246,7 @@ var init_schedule2 = __esm(async () => {
|
|
|
78119
78246
|
init_types()
|
|
78120
78247
|
]);
|
|
78121
78248
|
import_yaml27 = __toESM(require_dist(), 1);
|
|
78122
|
-
|
|
78249
|
+
command17 = new Command().description("schedule related commands").option("--json", "Output as JSON (for piping to jq)").action(list9).command("list", "list all schedules").option("--json", "Output as JSON (for piping to jq)").action(list9).command("get", "get a schedule's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get7).command("new", "create a new schedule locally").arguments("<path:string>").action(newSchedule).command("push", "push a local schedule spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").action(push8).command("enable", "Enable a schedule").option("--force", "Bypass the fork-conflict warning when the parent workspace has the same schedule (acknowledges that both crons will fire)").arguments("<path:string>").action(enable).command("disable", "Disable a schedule").arguments("<path:string>").action(disable).command("set-permissioned-as", "Set the email (run-as user) for a schedule (requires admin or wm_deployers group)").arguments("<path:string> <email:string>").action(async (opts, schedulePath, email) => {
|
|
78123
78250
|
const workspace = await resolveWorkspace(opts);
|
|
78124
78251
|
await requireLogin(opts);
|
|
78125
78252
|
const cache3 = new Map;
|
|
@@ -78141,7 +78268,7 @@ var init_schedule2 = __esm(async () => {
|
|
|
78141
78268
|
});
|
|
78142
78269
|
info(colors.green(`Updated permissioned_as for schedule ${schedulePath} to ${email} (username: ${username})`));
|
|
78143
78270
|
});
|
|
78144
|
-
schedule_default2 =
|
|
78271
|
+
schedule_default2 = command17;
|
|
78145
78272
|
});
|
|
78146
78273
|
|
|
78147
78274
|
// src/commands/instance/slack.ts
|
|
@@ -78231,7 +78358,7 @@ async function decrypt(combinedCiphertext, keyString) {
|
|
|
78231
78358
|
var init_local_encryption = () => {};
|
|
78232
78359
|
|
|
78233
78360
|
// src/core/settings.ts
|
|
78234
|
-
import
|
|
78361
|
+
import process20 from "node:process";
|
|
78235
78362
|
import { writeFile as writeFile14 } from "node:fs/promises";
|
|
78236
78363
|
function migrateToGroupedFormat(settings) {
|
|
78237
78364
|
const result = { name: settings.name ?? "" };
|
|
@@ -78514,7 +78641,7 @@ async function pushWorkspaceKey(workspace, _path, key, localKey, opts) {
|
|
|
78514
78641
|
}
|
|
78515
78642
|
if (localKey && key !== localKey) {
|
|
78516
78643
|
let reencrypt;
|
|
78517
|
-
const explicitSkip = opts?.skipReencrypt || (
|
|
78644
|
+
const explicitSkip = opts?.skipReencrypt || (process20.env.WMILL_NO_REENCRYPT_ON_KEY_CHANGE ?? "").toLowerCase() === "true";
|
|
78518
78645
|
if (explicitSkip) {
|
|
78519
78646
|
reencrypt = false;
|
|
78520
78647
|
info("Workspace encryption key changed; leaving remote ciphertexts untouched (skip re-encryption requested).");
|
|
@@ -78553,7 +78680,7 @@ async function readInstanceSettings(opts) {
|
|
|
78553
78680
|
return localSettings;
|
|
78554
78681
|
}
|
|
78555
78682
|
async function processInstanceSettings(settings, mode) {
|
|
78556
|
-
const encKey =
|
|
78683
|
+
const encKey = process20.env.WMILL_INSTANCE_LOCAL_ENCRYPTION_KEY;
|
|
78557
78684
|
if (encKey) {
|
|
78558
78685
|
const res = [];
|
|
78559
78686
|
for (const s of settings) {
|
|
@@ -78727,7 +78854,7 @@ var init_settings = __esm(async () => {
|
|
|
78727
78854
|
// src/commands/instance/instance.ts
|
|
78728
78855
|
import { writeFile as writeFile15, readdir as readdir9, mkdir as mkdir11, rm as rm5, stat as stat14 } from "node:fs/promises";
|
|
78729
78856
|
import { appendFile } from "node:fs/promises";
|
|
78730
|
-
import * as
|
|
78857
|
+
import * as path21 from "node:path";
|
|
78731
78858
|
async function allInstances() {
|
|
78732
78859
|
try {
|
|
78733
78860
|
const file = await getInstancesConfigFilePath();
|
|
@@ -78919,7 +79046,7 @@ async function instancePull(opts) {
|
|
|
78919
79046
|
if (confirm) {
|
|
78920
79047
|
if (uChanges > 0) {
|
|
78921
79048
|
if (opts.folderPerInstance && opts.prefixSettings) {
|
|
78922
|
-
await mkdir11(
|
|
79049
|
+
await mkdir11(path21.join(rootDir, opts.prefix), {
|
|
78923
79050
|
recursive: true
|
|
78924
79051
|
});
|
|
78925
79052
|
}
|
|
@@ -78953,10 +79080,10 @@ Pulling all workspaces`);
|
|
|
78953
79080
|
info(`
|
|
78954
79081
|
Pulling workspace ` + remoteWorkspace.id);
|
|
78955
79082
|
const workspaceName = opts?.folderPerInstance ? instance.prefix + "/" + remoteWorkspace.id : instance.prefix + "_" + remoteWorkspace.id;
|
|
78956
|
-
await mkdir11(
|
|
79083
|
+
await mkdir11(path21.join(rootDir, workspaceName), {
|
|
78957
79084
|
recursive: true
|
|
78958
79085
|
});
|
|
78959
|
-
process.chdir(
|
|
79086
|
+
process.chdir(path21.join(rootDir, workspaceName));
|
|
78960
79087
|
await addWorkspace({
|
|
78961
79088
|
remote: instance.remote,
|
|
78962
79089
|
name: workspaceName,
|
|
@@ -78991,7 +79118,7 @@ Pulling workspace ` + remoteWorkspace.id);
|
|
|
78991
79118
|
if (confirmDelete) {
|
|
78992
79119
|
for (const workspace of localWorkspacesToDelete) {
|
|
78993
79120
|
await removeWorkspace(workspace.id, false, {});
|
|
78994
|
-
await rm5(
|
|
79121
|
+
await rm5(path21.join(rootDir, workspace.dir), {
|
|
78995
79122
|
recursive: true
|
|
78996
79123
|
});
|
|
78997
79124
|
}
|
|
@@ -79080,12 +79207,12 @@ Pushing all workspaces: ${localWorkspaces.map((x) => x.id).join(", ")}`);
|
|
|
79080
79207
|
info(`
|
|
79081
79208
|
Pushing workspace ` + localWorkspace.id);
|
|
79082
79209
|
try {
|
|
79083
|
-
process.chdir(
|
|
79210
|
+
process.chdir(path21.join(rootDir, localWorkspace.dir));
|
|
79084
79211
|
} catch (_) {
|
|
79085
79212
|
throw new Error("Workspace folder not found, are you in the right directory?");
|
|
79086
79213
|
}
|
|
79087
79214
|
try {
|
|
79088
|
-
const workspaceSettings = await yamlParseFile(
|
|
79215
|
+
const workspaceSettings = await yamlParseFile(path21.join(process.cwd(), "settings.yaml"));
|
|
79089
79216
|
await add({
|
|
79090
79217
|
token: instance.token,
|
|
79091
79218
|
workspace: undefined,
|
|
@@ -79224,7 +79351,7 @@ async function whoami3(opts) {
|
|
|
79224
79351
|
error(colors.red(`Failed to retrieve whoami information: ${error2.message}`));
|
|
79225
79352
|
}
|
|
79226
79353
|
}
|
|
79227
|
-
var import_yaml30,
|
|
79354
|
+
var import_yaml30, command18, instance_default;
|
|
79228
79355
|
var init_instance = __esm(async () => {
|
|
79229
79356
|
init_colors2();
|
|
79230
79357
|
init_mod3();
|
|
@@ -79249,7 +79376,7 @@ var init_instance = __esm(async () => {
|
|
|
79249
79376
|
init_workspace()
|
|
79250
79377
|
]);
|
|
79251
79378
|
import_yaml30 = __toESM(require_dist(), 1);
|
|
79252
|
-
|
|
79379
|
+
command18 = new Command().description("sync local with a remote instance or the opposite (push or pull)").action(async () => {
|
|
79253
79380
|
info("4 actions available, add, remove, switch, pull and push. Use -h to display help.");
|
|
79254
79381
|
const activeInstance = await getActiveInstance({});
|
|
79255
79382
|
new Table2().header(["name", "remote", "token"]).padding(2).border(true).body((await allInstances()).map((x) => [
|
|
@@ -79275,7 +79402,7 @@ var init_instance = __esm(async () => {
|
|
|
79275
79402
|
await removeInstance(choice);
|
|
79276
79403
|
info(colors.green.underline(`Removed instance ${choice}`));
|
|
79277
79404
|
}).command("switch").complete("instance", async () => (await allInstances()).map((x) => x.name)).arguments("<instance:string:instance>").description("Switch the current instance").action(switchI).command("pull").description("Pull instance settings, users, configs, instance groups and overwrite local").option("--yes", "Pull without needing confirmation").option("--dry-run", "Perform a dry run without making changes").option("--skip-users", "Skip pulling users").option("--skip-settings", "Skip pulling settings").option("--skip-configs", "Skip pulling configs (worker groups)").option("--skip-groups", "Skip pulling instance groups").option("--include-workspaces", "Also pull workspaces").option("--folder-per-instance", "Create a folder per instance").option("--instance <instance:string>", "Name of the instance to pull from, override the active instance").option("--prefix <prefix:string>", "Prefix of the local workspaces to pull, used to create the folders when using --include-workspaces").option("--prefix-settings", "Store instance yamls inside prefixed folders when using --prefix and --folder-per-instance").action(instancePull).command("push").description("Push instance settings, users, configs, group and overwrite remote").option("--yes", "Push without needing confirmation").option("--dry-run", "Perform a dry run without making changes").option("--skip-users", "Skip pushing users").option("--skip-settings", "Skip pushing settings").option("--skip-configs", "Skip pushing configs (worker groups)").option("--skip-groups", "Skip pushing instance groups").option("--include-workspaces", "Also push workspaces").option("--folder-per-instance", "Create a folder per instance").option("--instance <instance:string>", "Name of the instance to push to, override the active instance").option("--prefix <prefix:string>", "Prefix of the local workspaces folders to push").option("--prefix-settings", "Store instance yamls inside prefixed folders when using --prefix and --folder-per-instance").action(instancePush).command("whoami").description("Display information about the currently logged-in user").action(whoami3).command("get-config").description("Dump the current instance config (global settings + worker configs) as YAML").option("-o, --output-file <file:string>", "Write YAML to a file instead of stdout").option("--show-secrets", "Include sensitive fields (license key, JWT secret) without prompting").option("--instance <instance:string>", "Name of the instance, override the active instance").action(getConfig2).command("connect-slack").description("Non-interactively connect Slack at the instance level using a pre-minted bot token (xoxb-...). Produces the same artifacts as the UI OAuth flow: global_settings 'slack' row + encrypted f/slack_bot/global_bot_token variable and resource in the admins workspace.").option("--bot-token <bot_token:string>", "Slack bot token (xoxb-...)", { required: true }).option("--team-id <team_id:string>", "Slack team id", { required: true }).option("--team-name <team_name:string>", "Slack team name", { required: true }).option("--instance <instance:string>", "Instance profile to connect against (defaults to the active instance)").action((opts) => connectSlackInstance2(opts));
|
|
79278
|
-
instance_default =
|
|
79405
|
+
instance_default = command18;
|
|
79279
79406
|
});
|
|
79280
79407
|
|
|
79281
79408
|
// src/commands/user/user.ts
|
|
@@ -79349,8 +79476,8 @@ async function createToken2(opts) {
|
|
|
79349
79476
|
}
|
|
79350
79477
|
info("Token: " + await createToken({ requestBody: {} }));
|
|
79351
79478
|
}
|
|
79352
|
-
async function pushWorkspaceUser(workspace,
|
|
79353
|
-
const email = removePathPrefix(removeType(
|
|
79479
|
+
async function pushWorkspaceUser(workspace, path22, user, localUser) {
|
|
79480
|
+
const email = removePathPrefix(removeType(path22, "user"), "users");
|
|
79354
79481
|
debug(`Processing local user ${email}`);
|
|
79355
79482
|
if (!["operator", "developer", "admin"].includes(localUser.role)) {
|
|
79356
79483
|
throw new Error(`Invalid role for user ${email}: ${localUser.role}`);
|
|
@@ -79413,8 +79540,8 @@ async function pushWorkspaceUser(workspace, path21, user, localUser) {
|
|
|
79413
79540
|
}
|
|
79414
79541
|
}
|
|
79415
79542
|
}
|
|
79416
|
-
async function pushGroup(workspace,
|
|
79417
|
-
const name = removePathPrefix(removeType(
|
|
79543
|
+
async function pushGroup(workspace, path22, group, localGroup) {
|
|
79544
|
+
const name = removePathPrefix(removeType(path22, "group"), "groups");
|
|
79418
79545
|
debug(`Processing local group ${name}`);
|
|
79419
79546
|
try {
|
|
79420
79547
|
const remoteGroup = await getGroup({
|
|
@@ -79630,7 +79757,7 @@ async function pushInstanceGroups(opts, preview2 = false) {
|
|
|
79630
79757
|
info(colors.green("Groups pushed to the instance"));
|
|
79631
79758
|
}
|
|
79632
79759
|
}
|
|
79633
|
-
var import_yaml32, INSTANCE_USERS_PATH = "instance_users.yaml", instanceUsersPath, INSTANCE_GROUPS_PATH = "instance_groups.yaml", instanceGroupsPath,
|
|
79760
|
+
var import_yaml32, INSTANCE_USERS_PATH = "instance_users.yaml", instanceUsersPath, INSTANCE_GROUPS_PATH = "instance_groups.yaml", instanceGroupsPath, command19, user_default;
|
|
79634
79761
|
var init_user = __esm(async () => {
|
|
79635
79762
|
init_colors2();
|
|
79636
79763
|
init_mod3();
|
|
@@ -79646,29 +79773,29 @@ var init_user = __esm(async () => {
|
|
|
79646
79773
|
import_yaml32 = __toESM(require_dist(), 1);
|
|
79647
79774
|
instanceUsersPath = INSTANCE_USERS_PATH;
|
|
79648
79775
|
instanceGroupsPath = INSTANCE_GROUPS_PATH;
|
|
79649
|
-
|
|
79776
|
+
command19 = new Command().description("user related commands").action(list10).command("add", "Create a user").arguments("<email:string> [password:string]").option("--superadmin", "Specify to make the new user superadmin.").option("--company <company:string>", "Specify to set the company of the new user.").option("--name <name:string>", "Specify to set the name of the new user.").action(add3).command("remove", "Delete a user").arguments("<email:string>").action(remove2).command("create-token", "Create a new API token for the authenticated user").option("--email <email:string>", "Specify credentials to use for authentication. This will not be stored. It will only be used to exchange for a token with the API server, which will not be stored either.", {
|
|
79650
79777
|
depends: ["password"]
|
|
79651
79778
|
}).option("--password <password:string>", "Specify credentials to use for authentication. This will not be stored. It will only be used to exchange for a token with the API server, which will not be stored either.", {
|
|
79652
79779
|
depends: ["email"]
|
|
79653
79780
|
}).action(createToken2);
|
|
79654
|
-
user_default =
|
|
79781
|
+
user_default = command19;
|
|
79655
79782
|
});
|
|
79656
79783
|
|
|
79657
79784
|
// src/commands/dependencies/dependencies.ts
|
|
79658
|
-
import
|
|
79785
|
+
import fs16 from "node:fs";
|
|
79659
79786
|
async function push9(opts, filePath) {
|
|
79660
79787
|
const workspace = await resolveWorkspace(opts);
|
|
79661
79788
|
await requireLogin(opts);
|
|
79662
|
-
if (!
|
|
79789
|
+
if (!fs16.existsSync(filePath)) {
|
|
79663
79790
|
throw new Error(`File not found: ${filePath}`);
|
|
79664
79791
|
}
|
|
79665
79792
|
const content = readTextFileSync(filePath);
|
|
79666
79793
|
await pushWorkspaceDependencies(workspace.workspaceId, filePath, null, content);
|
|
79667
79794
|
}
|
|
79668
|
-
async function pushWorkspaceDependencies(workspace,
|
|
79669
|
-
const res = workspaceDependenciesPathToLanguageAndFilename(
|
|
79795
|
+
async function pushWorkspaceDependencies(workspace, path22, _befObj, newDependenciesContent) {
|
|
79796
|
+
const res = workspaceDependenciesPathToLanguageAndFilename(path22);
|
|
79670
79797
|
if (!res) {
|
|
79671
|
-
throw new Error(`Unknown workspace dependencies file format: ${
|
|
79798
|
+
throw new Error(`Unknown workspace dependencies file format: ${path22}. ` + `Valid files: package.json, requirements.in, composer.json, go.mod, modules.json`);
|
|
79672
79799
|
}
|
|
79673
79800
|
const { language, name } = res;
|
|
79674
79801
|
const displayName = name ? `named dependencies "${name}"` : `workspace default dependencies`;
|
|
@@ -79700,7 +79827,7 @@ async function pushWorkspaceDependencies(workspace, path21, _befObj, newDependen
|
|
|
79700
79827
|
});
|
|
79701
79828
|
info(colors.green(`Successfully pushed ${displayName} for ${language}`));
|
|
79702
79829
|
}
|
|
79703
|
-
var
|
|
79830
|
+
var command20, dependencies_default;
|
|
79704
79831
|
var init_dependencies = __esm(async () => {
|
|
79705
79832
|
init_colors2();
|
|
79706
79833
|
init_mod3();
|
|
@@ -79712,15 +79839,15 @@ var init_dependencies = __esm(async () => {
|
|
|
79712
79839
|
init_metadata(),
|
|
79713
79840
|
init_utils()
|
|
79714
79841
|
]);
|
|
79715
|
-
|
|
79716
|
-
dependencies_default =
|
|
79842
|
+
command20 = new Command().alias("deps").description("workspace dependencies related commands").command("push", "Push workspace dependencies from a local file").arguments("<file_path:string>").action(push9);
|
|
79843
|
+
dependencies_default = command20;
|
|
79717
79844
|
});
|
|
79718
79845
|
|
|
79719
79846
|
// src/commands/trigger/trigger.ts
|
|
79720
79847
|
import { mkdir as mkdir12, stat as stat15, writeFile as writeFile17 } from "node:fs/promises";
|
|
79721
79848
|
import { dirname as dirname17 } from "node:path";
|
|
79722
79849
|
import { sep as SEP18 } from "node:path";
|
|
79723
|
-
async function getTrigger(triggerType, workspace,
|
|
79850
|
+
async function getTrigger(triggerType, workspace, path22) {
|
|
79724
79851
|
const triggerFunctions = {
|
|
79725
79852
|
http: getHttpTrigger,
|
|
79726
79853
|
websocket: getWebsocketTrigger,
|
|
@@ -79735,10 +79862,10 @@ async function getTrigger(triggerType, workspace, path21) {
|
|
|
79735
79862
|
email: getEmailTrigger
|
|
79736
79863
|
};
|
|
79737
79864
|
const triggerFunction = triggerFunctions[triggerType];
|
|
79738
|
-
const trigger = await triggerFunction({ workspace, path:
|
|
79865
|
+
const trigger = await triggerFunction({ workspace, path: path22 });
|
|
79739
79866
|
return trigger;
|
|
79740
79867
|
}
|
|
79741
|
-
async function updateTrigger(triggerType, workspace,
|
|
79868
|
+
async function updateTrigger(triggerType, workspace, path22, trigger) {
|
|
79742
79869
|
const triggerFunctions = {
|
|
79743
79870
|
http: updateHttpTrigger,
|
|
79744
79871
|
websocket: updateWebsocketTrigger,
|
|
@@ -79753,9 +79880,9 @@ async function updateTrigger(triggerType, workspace, path21, trigger) {
|
|
|
79753
79880
|
email: updateEmailTrigger
|
|
79754
79881
|
};
|
|
79755
79882
|
const triggerFunction = triggerFunctions[triggerType];
|
|
79756
|
-
await triggerFunction({ workspace, path:
|
|
79883
|
+
await triggerFunction({ workspace, path: path22, requestBody: trigger });
|
|
79757
79884
|
}
|
|
79758
|
-
async function createTrigger(triggerType, workspace,
|
|
79885
|
+
async function createTrigger(triggerType, workspace, path22, trigger) {
|
|
79759
79886
|
const triggerFunctions = {
|
|
79760
79887
|
http: createHttpTrigger,
|
|
79761
79888
|
websocket: createWebsocketTrigger,
|
|
@@ -79770,16 +79897,16 @@ async function createTrigger(triggerType, workspace, path21, trigger) {
|
|
|
79770
79897
|
email: createEmailTrigger
|
|
79771
79898
|
};
|
|
79772
79899
|
const triggerFunction = triggerFunctions[triggerType];
|
|
79773
|
-
await triggerFunction({ workspace, path:
|
|
79900
|
+
await triggerFunction({ workspace, path: path22, requestBody: trigger });
|
|
79774
79901
|
}
|
|
79775
|
-
async function pushTrigger(triggerType, workspace,
|
|
79776
|
-
|
|
79777
|
-
debug(`Processing local ${triggerType} trigger ${
|
|
79902
|
+
async function pushTrigger(triggerType, workspace, path22, trigger, localTrigger, permissionedAsContext) {
|
|
79903
|
+
path22 = removeType(path22, triggerType + "_trigger").replaceAll(SEP18, "/");
|
|
79904
|
+
debug(`Processing local ${triggerType} trigger ${path22}`);
|
|
79778
79905
|
try {
|
|
79779
|
-
trigger = await getTrigger(triggerType, workspace,
|
|
79780
|
-
debug(`${triggerType} trigger ${
|
|
79906
|
+
trigger = await getTrigger(triggerType, workspace, path22);
|
|
79907
|
+
debug(`${triggerType} trigger ${path22} exists on remote`);
|
|
79781
79908
|
} catch {
|
|
79782
|
-
debug(`${triggerType} trigger ${
|
|
79909
|
+
debug(`${triggerType} trigger ${path22} does not exist on remote`);
|
|
79783
79910
|
}
|
|
79784
79911
|
delete localTrigger.has_permissioned_as;
|
|
79785
79912
|
const preserveFields = {};
|
|
@@ -79788,33 +79915,33 @@ async function pushTrigger(triggerType, workspace, path21, trigger, localTrigger
|
|
|
79788
79915
|
preserveFields.preserve_permissioned_as = true;
|
|
79789
79916
|
if (trigger.permissioned_as) {
|
|
79790
79917
|
preserveFields.permissioned_as = trigger.permissioned_as;
|
|
79791
|
-
info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${
|
|
79918
|
+
info(`Preserving ${trigger.permissioned_as} as permissioned_as for trigger ${path22}`);
|
|
79792
79919
|
}
|
|
79793
79920
|
}
|
|
79794
79921
|
}
|
|
79795
79922
|
if (trigger) {
|
|
79796
79923
|
if (isSuperset(localTrigger, trigger)) {
|
|
79797
|
-
debug(`${triggerType} trigger ${
|
|
79924
|
+
debug(`${triggerType} trigger ${path22} is up to date`);
|
|
79798
79925
|
return;
|
|
79799
79926
|
}
|
|
79800
|
-
debug(`${triggerType} trigger ${
|
|
79927
|
+
debug(`${triggerType} trigger ${path22} is not up-to-date, updating...`);
|
|
79801
79928
|
try {
|
|
79802
|
-
await updateTrigger(triggerType, workspace,
|
|
79929
|
+
await updateTrigger(triggerType, workspace, path22, {
|
|
79803
79930
|
...localTrigger,
|
|
79804
79931
|
...preserveFields,
|
|
79805
|
-
path:
|
|
79932
|
+
path: path22
|
|
79806
79933
|
});
|
|
79807
79934
|
} catch (e) {
|
|
79808
79935
|
console.error(e.body);
|
|
79809
79936
|
throw e;
|
|
79810
79937
|
}
|
|
79811
79938
|
} else {
|
|
79812
|
-
console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${
|
|
79939
|
+
console.log(colors.bold.yellow(`Creating new ${triggerType} trigger: ${path22}`));
|
|
79813
79940
|
try {
|
|
79814
|
-
await createTrigger(triggerType, workspace,
|
|
79941
|
+
await createTrigger(triggerType, workspace, path22, {
|
|
79815
79942
|
...localTrigger,
|
|
79816
79943
|
...preserveFields,
|
|
79817
|
-
path:
|
|
79944
|
+
path: path22
|
|
79818
79945
|
});
|
|
79819
79946
|
} catch (e) {
|
|
79820
79947
|
console.error(e.body);
|
|
@@ -79899,8 +80026,8 @@ async function pushNativeTrigger(workspace, filePath, _remoteTrigger, localTrigg
|
|
|
79899
80026
|
}
|
|
79900
80027
|
}
|
|
79901
80028
|
}
|
|
79902
|
-
async function newTrigger(opts,
|
|
79903
|
-
if (!validatePath(
|
|
80029
|
+
async function newTrigger(opts, path22) {
|
|
80030
|
+
if (!validatePath(path22)) {
|
|
79904
80031
|
return;
|
|
79905
80032
|
}
|
|
79906
80033
|
if (!opts.kind) {
|
|
@@ -79910,7 +80037,7 @@ async function newTrigger(opts, path21) {
|
|
|
79910
80037
|
throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
|
|
79911
80038
|
}
|
|
79912
80039
|
const kind = opts.kind;
|
|
79913
|
-
const filePath = `${
|
|
80040
|
+
const filePath = `${path22}.${kind}_trigger.yaml`;
|
|
79914
80041
|
try {
|
|
79915
80042
|
await stat15(filePath);
|
|
79916
80043
|
throw new Error("File already exists: " + filePath);
|
|
@@ -79946,7 +80073,7 @@ function printTriggerDetails(trigger, kind) {
|
|
|
79946
80073
|
console.log(colors.bold(label + ":") + " " + display);
|
|
79947
80074
|
}
|
|
79948
80075
|
}
|
|
79949
|
-
async function get8(opts,
|
|
80076
|
+
async function get8(opts, path22) {
|
|
79950
80077
|
if (opts.json)
|
|
79951
80078
|
setSilent(true);
|
|
79952
80079
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -79955,7 +80082,7 @@ async function get8(opts, path21) {
|
|
|
79955
80082
|
if (!checkIfValidTrigger(opts.kind)) {
|
|
79956
80083
|
throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
|
|
79957
80084
|
}
|
|
79958
|
-
const trigger = await getTrigger(opts.kind, workspace.workspaceId,
|
|
80085
|
+
const trigger = await getTrigger(opts.kind, workspace.workspaceId, path22);
|
|
79959
80086
|
if (opts.json) {
|
|
79960
80087
|
console.log(JSON.stringify(trigger));
|
|
79961
80088
|
} else {
|
|
@@ -79966,12 +80093,12 @@ async function get8(opts, path21) {
|
|
|
79966
80093
|
const matches = [];
|
|
79967
80094
|
for (const kind of TRIGGER_TYPES) {
|
|
79968
80095
|
try {
|
|
79969
|
-
const trigger = await getTrigger(kind, workspace.workspaceId,
|
|
80096
|
+
const trigger = await getTrigger(kind, workspace.workspaceId, path22);
|
|
79970
80097
|
matches.push({ kind, trigger });
|
|
79971
80098
|
} catch {}
|
|
79972
80099
|
}
|
|
79973
80100
|
if (matches.length === 0) {
|
|
79974
|
-
throw new Error("No trigger found at path: " +
|
|
80101
|
+
throw new Error("No trigger found at path: " + path22);
|
|
79975
80102
|
}
|
|
79976
80103
|
if (matches.length === 1) {
|
|
79977
80104
|
const { kind, trigger } = matches[0];
|
|
@@ -79982,7 +80109,7 @@ async function get8(opts, path21) {
|
|
|
79982
80109
|
}
|
|
79983
80110
|
return;
|
|
79984
80111
|
}
|
|
79985
|
-
console.log("Multiple triggers found at path " +
|
|
80112
|
+
console.log("Multiple triggers found at path " + path22 + ":");
|
|
79986
80113
|
for (const m of matches) {
|
|
79987
80114
|
console.log(" - " + m.kind);
|
|
79988
80115
|
}
|
|
@@ -80082,7 +80209,7 @@ async function push10(opts, filePath, remotePath) {
|
|
|
80082
80209
|
await pushTrigger(triggerKind, workspace.workspaceId, remotePath, undefined, parseFromFile(filePath));
|
|
80083
80210
|
console.log(colors.bold.underline.green("Trigger pushed"));
|
|
80084
80211
|
}
|
|
80085
|
-
var import_yaml34, triggerTemplates, TRIGGER_SKIP_FIELDS,
|
|
80212
|
+
var import_yaml34, triggerTemplates, TRIGGER_SKIP_FIELDS, command21, trigger_default;
|
|
80086
80213
|
var init_trigger = __esm(async () => {
|
|
80087
80214
|
init_services_gen();
|
|
80088
80215
|
init_mod3();
|
|
@@ -80195,7 +80322,7 @@ var init_trigger = __esm(async () => {
|
|
|
80195
80322
|
}
|
|
80196
80323
|
};
|
|
80197
80324
|
TRIGGER_SKIP_FIELDS = new Set(["workspace_id", "extra_perms", "edited_by", "edited_at"]);
|
|
80198
|
-
|
|
80325
|
+
command21 = new Command().description("trigger related commands").option("--json", "Output as JSON (for piping to jq)").action(list11).command("list", "list all triggers").option("--json", "Output as JSON (for piping to jq)").action(list11).command("get", "get a trigger's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").option("--kind <kind:string>", "Trigger kind (http, websocket, kafka, nats, postgres, mqtt, amqp, sqs, gcp, azure, email). Recommended for faster lookup").action(get8).command("new", "create a new trigger locally").arguments("<path:string>").option("--kind <kind:string>", "Trigger kind (required: http, websocket, kafka, nats, postgres, mqtt, amqp, sqs, gcp, azure, email)").action(newTrigger).command("push", "push a local trigger spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").action(push10).command("set-permissioned-as", "Set the email (run-as user) for a trigger (requires admin or wm_deployers group)").arguments("<path:string> <email:string>").option("--kind <kind:string>", "Trigger kind (required: http, websocket, kafka, nats, postgres, mqtt, amqp, sqs, gcp, azure, email)").action(async (opts, triggerPath, email) => {
|
|
80199
80326
|
const workspace = await resolveWorkspace(opts);
|
|
80200
80327
|
await requireLogin(opts);
|
|
80201
80328
|
if (!opts.kind) {
|
|
@@ -80218,11 +80345,11 @@ var init_trigger = __esm(async () => {
|
|
|
80218
80345
|
});
|
|
80219
80346
|
info(colors.green(`Updated permissioned_as for ${opts.kind} trigger ${triggerPath} to ${email} (username: ${username})`));
|
|
80220
80347
|
});
|
|
80221
|
-
trigger_default =
|
|
80348
|
+
trigger_default = command21;
|
|
80222
80349
|
});
|
|
80223
80350
|
|
|
80224
80351
|
// src/types.ts
|
|
80225
|
-
import * as
|
|
80352
|
+
import * as path22 from "node:path";
|
|
80226
80353
|
import { sep as SEP19 } from "node:path";
|
|
80227
80354
|
function isSuperset(subset, superset) {
|
|
80228
80355
|
return Object.keys(subset).every((key) => {
|
|
@@ -80266,11 +80393,11 @@ function showDiff(local, remote) {
|
|
|
80266
80393
|
}
|
|
80267
80394
|
info(finalString);
|
|
80268
80395
|
}
|
|
80269
|
-
function showConflict(
|
|
80270
|
-
info(colors.yellow(`- ${
|
|
80396
|
+
function showConflict(path23, local, remote) {
|
|
80397
|
+
info(colors.yellow(`- ${path23}`));
|
|
80271
80398
|
let isEncryptionKey = false;
|
|
80272
80399
|
try {
|
|
80273
|
-
isEncryptionKey = getTypeStrFromPath(
|
|
80400
|
+
isEncryptionKey = getTypeStrFromPath(path23) === "encryption_key";
|
|
80274
80401
|
} catch {}
|
|
80275
80402
|
if (isEncryptionKey) {
|
|
80276
80403
|
showDiff(redactEncryptionKey(local), redactEncryptionKey(remote));
|
|
@@ -80427,7 +80554,7 @@ function getTypeStrFromPath(p) {
|
|
|
80427
80554
|
if (isFileResource(p) || isFilesetResource(p)) {
|
|
80428
80555
|
return "resource";
|
|
80429
80556
|
}
|
|
80430
|
-
const parsed =
|
|
80557
|
+
const parsed = path22.parse(p);
|
|
80431
80558
|
if (parsed.ext == ".go" || parsed.ext == ".ts" || parsed.ext == ".sh" || parsed.ext == ".py" || parsed.ext == ".sql" || parsed.ext == ".gql" || parsed.ext == ".ps1" || parsed.ext == ".js" || parsed.ext == ".php" || parsed.ext == ".rs" || parsed.ext == ".cs" || parsed.ext == ".nu" || parsed.ext == ".java" || parsed.ext == ".rb" || parsed.ext == ".r" || parsed.ext == ".yml" && parsed.name.split(".").pop() == "playbook" || isDbtDescriptorPath(p)) {
|
|
80432
80559
|
return "script";
|
|
80433
80560
|
}
|
|
@@ -80451,7 +80578,7 @@ function getTypeStrFromPath(p) {
|
|
|
80451
80578
|
}
|
|
80452
80579
|
}
|
|
80453
80580
|
function removeType(str, type) {
|
|
80454
|
-
const normalizedStr =
|
|
80581
|
+
const normalizedStr = path22.normalize(str).replaceAll(SEP19, "/");
|
|
80455
80582
|
if (normalizedStr.endsWith("." + type + ".yaml") || normalizedStr.endsWith("." + type + ".json")) {
|
|
80456
80583
|
return normalizedStr.slice(0, normalizedStr.length - type.length - 6);
|
|
80457
80584
|
}
|
|
@@ -80461,7 +80588,7 @@ function removeType(str, type) {
|
|
|
80461
80588
|
return normalizedStr;
|
|
80462
80589
|
}
|
|
80463
80590
|
function extractNativeTriggerInfo(p) {
|
|
80464
|
-
const normalizedPath =
|
|
80591
|
+
const normalizedPath = path22.normalize(p).replaceAll(SEP19, "/");
|
|
80465
80592
|
const withoutExt = normalizedPath.replace(/\.(json|yaml)$/, "");
|
|
80466
80593
|
const match2 = withoutExt.match(/^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/);
|
|
80467
80594
|
if (!match2) {
|
|
@@ -80475,8 +80602,8 @@ function extractNativeTriggerInfo(p) {
|
|
|
80475
80602
|
};
|
|
80476
80603
|
}
|
|
80477
80604
|
function removePathPrefix(str, prefix) {
|
|
80478
|
-
const normalizedStr =
|
|
80479
|
-
const normalizedPrefix =
|
|
80605
|
+
const normalizedStr = path22.normalize(str).replaceAll(SEP19, "/");
|
|
80606
|
+
const normalizedPrefix = path22.normalize(prefix).replaceAll(SEP19, "/");
|
|
80480
80607
|
if (normalizedStr === normalizedPrefix) {
|
|
80481
80608
|
return "";
|
|
80482
80609
|
}
|
|
@@ -80652,7 +80779,7 @@ var init_local_path_scripts = __esm(async () => {
|
|
|
80652
80779
|
|
|
80653
80780
|
// src/commands/flow/flow.ts
|
|
80654
80781
|
import { dirname as dirname18, sep as SEP20 } from "node:path";
|
|
80655
|
-
import { mkdirSync as
|
|
80782
|
+
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync8 } from "node:fs";
|
|
80656
80783
|
function normalizeOptionalString(value) {
|
|
80657
80784
|
return typeof value === "string" && value.trim() === "" ? undefined : value ?? undefined;
|
|
80658
80785
|
}
|
|
@@ -80694,12 +80821,12 @@ function warnAboutLocalPathScriptDivergence(divergence) {
|
|
|
80694
80821
|
const details = [];
|
|
80695
80822
|
if (divergence.changed.length > 0) {
|
|
80696
80823
|
details.push(`These workspace scripts differ from the deployed version:
|
|
80697
|
-
${divergence.changed.map((
|
|
80824
|
+
${divergence.changed.map((path23) => `- ${path23}`).join(`
|
|
80698
80825
|
`)}`);
|
|
80699
80826
|
}
|
|
80700
80827
|
if (divergence.missing.length > 0) {
|
|
80701
80828
|
details.push(`These scripts do not exist in the workspace yet:
|
|
80702
|
-
${divergence.missing.map((
|
|
80829
|
+
${divergence.missing.map((path23) => `- ${path23}`).join(`
|
|
80703
80830
|
`)}`);
|
|
80704
80831
|
}
|
|
80705
80832
|
warn(`Using local PathScript files for flow preview.
|
|
@@ -80748,7 +80875,7 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
|
|
|
80748
80875
|
localPath += SEP20;
|
|
80749
80876
|
}
|
|
80750
80877
|
const localFlow = await yamlParseFile(localPath + "flow.yaml");
|
|
80751
|
-
const fileReader = async (
|
|
80878
|
+
const fileReader = async (path23) => await readTextFile(localPath + path23);
|
|
80752
80879
|
const missingFiles = [];
|
|
80753
80880
|
await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, localPath, SEP20, undefined, missingFiles);
|
|
80754
80881
|
if (localFlow.value.failure_module) {
|
|
@@ -80850,14 +80977,14 @@ async function list12(opts) {
|
|
|
80850
80977
|
new Table2().header(["path", "summary", "edited by"]).padding(2).border(true).body(total.map((x) => [x.path, x.summary, x.edited_by])).render();
|
|
80851
80978
|
}
|
|
80852
80979
|
}
|
|
80853
|
-
async function get9(opts,
|
|
80980
|
+
async function get9(opts, path23) {
|
|
80854
80981
|
if (opts.json)
|
|
80855
80982
|
setSilent(true);
|
|
80856
80983
|
const workspace = await resolveWorkspace(opts);
|
|
80857
80984
|
await requireLogin(opts);
|
|
80858
80985
|
const f = await getFlowByPath({
|
|
80859
80986
|
workspace: workspace.workspaceId,
|
|
80860
|
-
path:
|
|
80987
|
+
path: path23
|
|
80861
80988
|
});
|
|
80862
80989
|
if (opts.json) {
|
|
80863
80990
|
console.log(JSON.stringify(f));
|
|
@@ -80895,7 +81022,7 @@ async function get9(opts, path22) {
|
|
|
80895
81022
|
}
|
|
80896
81023
|
}
|
|
80897
81024
|
}
|
|
80898
|
-
async function run3(opts,
|
|
81025
|
+
async function run3(opts, path23) {
|
|
80899
81026
|
if (opts.silent) {
|
|
80900
81027
|
setSilent(true);
|
|
80901
81028
|
}
|
|
@@ -80906,7 +81033,7 @@ async function run3(opts, path22) {
|
|
|
80906
81033
|
try {
|
|
80907
81034
|
const flow = await getFlowByPath({
|
|
80908
81035
|
workspace: workspace.workspaceId,
|
|
80909
|
-
path:
|
|
81036
|
+
path: path23
|
|
80910
81037
|
});
|
|
80911
81038
|
validateRequiredArgs(flow.schema);
|
|
80912
81039
|
} catch (e) {
|
|
@@ -80917,7 +81044,7 @@ async function run3(opts, path22) {
|
|
|
80917
81044
|
}
|
|
80918
81045
|
const id = await runFlowByPath({
|
|
80919
81046
|
workspace: workspace.workspaceId,
|
|
80920
|
-
path:
|
|
81047
|
+
path: path23,
|
|
80921
81048
|
tag: opts.tag,
|
|
80922
81049
|
requestBody: input
|
|
80923
81050
|
});
|
|
@@ -80982,7 +81109,7 @@ async function run3(opts, path22) {
|
|
|
80982
81109
|
forLoopFailed = refreshedModule.type === "Failure";
|
|
80983
81110
|
break;
|
|
80984
81111
|
}
|
|
80985
|
-
await new Promise((
|
|
81112
|
+
await new Promise((resolve11) => setTimeout(resolve11, 200));
|
|
80986
81113
|
}
|
|
80987
81114
|
if (forLoopFailed)
|
|
80988
81115
|
break;
|
|
@@ -80998,7 +81125,7 @@ async function run3(opts, path22) {
|
|
|
80998
81125
|
info(colors.dim(status));
|
|
80999
81126
|
lastStatus = status;
|
|
81000
81127
|
}
|
|
81001
|
-
await new Promise((
|
|
81128
|
+
await new Promise((resolve11, _) => setTimeout(() => resolve11(undefined), 100));
|
|
81002
81129
|
if (isCompleted)
|
|
81003
81130
|
break;
|
|
81004
81131
|
continue;
|
|
@@ -81034,7 +81161,7 @@ async function run3(opts, path22) {
|
|
|
81034
81161
|
break;
|
|
81035
81162
|
} catch {
|
|
81036
81163
|
retries++;
|
|
81037
|
-
await new Promise((
|
|
81164
|
+
await new Promise((resolve11) => setTimeout(resolve11, 100));
|
|
81038
81165
|
}
|
|
81039
81166
|
}
|
|
81040
81167
|
if (retries >= MAX_RETRIES) {
|
|
@@ -81064,7 +81191,7 @@ async function preview2(opts, flowPath) {
|
|
|
81064
81191
|
flowPath += SEP20;
|
|
81065
81192
|
}
|
|
81066
81193
|
const localFlow = await yamlParseFile(flowPath + "flow.yaml");
|
|
81067
|
-
const fileReader = async (
|
|
81194
|
+
const fileReader = async (path23) => await readTextFile(flowPath + path23);
|
|
81068
81195
|
await replaceInlineScripts(localFlow.value.modules, fileReader, exports_log, flowPath, SEP20);
|
|
81069
81196
|
if (localFlow.value.failure_module) {
|
|
81070
81197
|
await replaceInlineScripts([localFlow.value.failure_module], fileReader, exports_log, flowPath, SEP20);
|
|
@@ -81329,7 +81456,7 @@ async function bootstrap2(opts, flowPath) {
|
|
|
81329
81456
|
}
|
|
81330
81457
|
await loadNonDottedPathsSetting();
|
|
81331
81458
|
const flowDirFullPath = buildFolderPath(flowPath, "flow");
|
|
81332
|
-
|
|
81459
|
+
mkdirSync8(flowDirFullPath, { recursive: true });
|
|
81333
81460
|
const newFlowDefinition = defaultFlowDefinition();
|
|
81334
81461
|
if (opts.summary !== undefined) {
|
|
81335
81462
|
newFlowDefinition.summary = opts.summary;
|
|
@@ -81340,7 +81467,7 @@ async function bootstrap2(opts, flowPath) {
|
|
|
81340
81467
|
const newFlowDefinitionYaml = import_yaml37.stringify(newFlowDefinition);
|
|
81341
81468
|
const metadataFile = getMetadataFileName("flow", "yaml");
|
|
81342
81469
|
const flowYamlPath = `${flowDirFullPath}/${metadataFile}`;
|
|
81343
|
-
|
|
81470
|
+
writeFileSync8(flowYamlPath, newFlowDefinitionYaml, { flag: "wx", encoding: "utf-8" });
|
|
81344
81471
|
info(colors.green(`Created flow at ${flowDirFullPath}`));
|
|
81345
81472
|
info("");
|
|
81346
81473
|
info(colors.bold("To preview this flow:"));
|
|
@@ -81393,7 +81520,7 @@ async function showVersion(opts, flowPath, version) {
|
|
|
81393
81520
|
console.log(JSON.stringify(flow.value, null, 2));
|
|
81394
81521
|
}
|
|
81395
81522
|
}
|
|
81396
|
-
var import_yaml37, alreadySynced3,
|
|
81523
|
+
var import_yaml37, alreadySynced3, command22, flow_default;
|
|
81397
81524
|
var init_flow = __esm(async () => {
|
|
81398
81525
|
init_colors2();
|
|
81399
81526
|
init_mod3();
|
|
@@ -81419,7 +81546,7 @@ var init_flow = __esm(async () => {
|
|
|
81419
81546
|
]);
|
|
81420
81547
|
import_yaml37 = __toESM(require_dist(), 1);
|
|
81421
81548
|
alreadySynced3 = [];
|
|
81422
|
-
|
|
81549
|
+
command22 = new Command().description("flow related commands").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("list", "list all flows").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("get", "get a flow's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get9).command("push", "push a local flow spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").option("--message <message:string>", "Deployment message").action(push11).command("run", "run a flow by path.").arguments("<path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not ouput anything other then the final output. Useful for scripting.").option("--tag <tag:string>", "Override the worker tag the run is dispatched to (e.g. to route it to dev workers instead of the flow's default tag).").action(run3).command("preview", "preview a local flow without deploying it. Runs the flow definition from local files and uses local PathScripts by default. Pass --step <id> to run only one module in isolation (resolves nested steps inside branchone/branchall/forloopflow/whileloopflow plus the special preprocessor/failure modules; supported step types: rawscript, script, flow).").arguments("<flow_path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other then the final output. Useful for scripting.").option("--remote", "Use deployed workspace scripts for PathScript steps instead of local files.").option("--step <step_id:string>", "Run only the named step instead of the whole flow. Honors --data as the step's args and --remote / local-PathScript resolution the same way the full-flow preview does.").option("--tag <tag:string>", "Override the worker tag the preview is dispatched to (e.g. to route it to dev workers instead of the flow's default tag).").action(preview2).command("generate-locks", 'DEPRECATED: re-generate flow lock files. Use "wmill generate-metadata" instead.').arguments("[flow:file]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("-i --includes <patterns:file[]>", "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)").option("-e --excludes <patterns:file[]>", "Comma separated patterns to specify which file to NOT take into account.").action(generateLocks).command("new", "create a new empty flow").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("bootstrap", "create a new empty flow (alias for new)").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("history", "Show version history for a flow").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(history2).command("show-version", "Show a specific version of a flow").arguments("<path:string> <version:string>").option("--json", "Output as JSON (for piping to jq)").action(showVersion).command("set-permissioned-as", "Set the on_behalf_of_email for a flow (requires admin or wm_deployers group)").arguments("<path:string> <email:string>").action(async (opts, flowPath, email) => {
|
|
81423
81550
|
const workspace = await resolveWorkspace(opts);
|
|
81424
81551
|
await requireLogin(opts);
|
|
81425
81552
|
const remote = await getFlowByPath({
|
|
@@ -81442,7 +81569,7 @@ var init_flow = __esm(async () => {
|
|
|
81442
81569
|
});
|
|
81443
81570
|
info(colors.green(`Updated permissioned_as for flow ${flowPath} to ${email}`));
|
|
81444
81571
|
});
|
|
81445
|
-
flow_default =
|
|
81572
|
+
flow_default = command22;
|
|
81446
81573
|
});
|
|
81447
81574
|
|
|
81448
81575
|
// src/commands/gitsync-settings/converter.ts
|
|
@@ -81585,7 +81712,7 @@ class GitSyncSettingsConverter {
|
|
|
81585
81712
|
}
|
|
81586
81713
|
|
|
81587
81714
|
// src/commands/gitsync-settings/legacySettings.ts
|
|
81588
|
-
import
|
|
81715
|
+
import process21 from "node:process";
|
|
81589
81716
|
async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, workspace, opts, operationName = "operation") {
|
|
81590
81717
|
if (selectedRepo.settings) {
|
|
81591
81718
|
return selectedRepo;
|
|
@@ -81595,7 +81722,7 @@ async function handleLegacyRepositoryMigration(selectedRepo, gitSyncSettings, wo
|
|
|
81595
81722
|
}
|
|
81596
81723
|
const workspaceIncludePath = gitSyncSettings.include_path;
|
|
81597
81724
|
const workspaceIncludeType = gitSyncSettings.include_type;
|
|
81598
|
-
if (!!
|
|
81725
|
+
if (!!process21.stdout.isTTY && !opts.yes) {
|
|
81599
81726
|
console.log(colors.yellow(`
|
|
81600
81727
|
⚠️ Legacy git-sync settings detected!`));
|
|
81601
81728
|
console.log(`
|
|
@@ -81701,7 +81828,7 @@ Repository "${selectedRepo.git_repo_resource_path}" has legacy settings format.`
|
|
|
81701
81828
|
console.error(` wmill gitsync-settings push
|
|
81702
81829
|
`);
|
|
81703
81830
|
}
|
|
81704
|
-
|
|
81831
|
+
process21.exit(1);
|
|
81705
81832
|
}
|
|
81706
81833
|
}
|
|
81707
81834
|
var init_legacySettings = __esm(async () => {
|
|
@@ -81746,8 +81873,8 @@ function outputResult(opts, result) {
|
|
|
81746
81873
|
error(colors.red(result.error));
|
|
81747
81874
|
}
|
|
81748
81875
|
}
|
|
81749
|
-
function normalizeRepoPath(
|
|
81750
|
-
return
|
|
81876
|
+
function normalizeRepoPath(path23) {
|
|
81877
|
+
return path23.replace(/^\$res:/, "");
|
|
81751
81878
|
}
|
|
81752
81879
|
function getOrCreateBranchConfig(config, branchName) {
|
|
81753
81880
|
if (!config.workspaces) {
|
|
@@ -82158,14 +82285,14 @@ var init_pull2 = __esm(async () => {
|
|
|
82158
82285
|
});
|
|
82159
82286
|
|
|
82160
82287
|
// src/commands/gitsync-settings/push.ts
|
|
82161
|
-
import
|
|
82288
|
+
import process22 from "node:process";
|
|
82162
82289
|
async function pushGitSyncSettings(opts) {
|
|
82163
82290
|
try {
|
|
82164
82291
|
await validateBranchConfiguration({ yes: opts.yes });
|
|
82165
82292
|
} catch (error2) {
|
|
82166
82293
|
if (error2 instanceof Error && error2.message.includes("overrides")) {
|
|
82167
82294
|
error(error2.message);
|
|
82168
|
-
|
|
82295
|
+
process22.exit(1);
|
|
82169
82296
|
}
|
|
82170
82297
|
throw error2;
|
|
82171
82298
|
}
|
|
@@ -82175,7 +82302,7 @@ async function pushGitSyncSettings(opts) {
|
|
|
82175
82302
|
const wmillYamlPath = getWmillYamlPath();
|
|
82176
82303
|
if (!wmillYamlPath) {
|
|
82177
82304
|
error(colors.red("No wmill.yaml file found. Please run 'wmill init' first to create the configuration file."));
|
|
82178
|
-
|
|
82305
|
+
process22.exit(1);
|
|
82179
82306
|
}
|
|
82180
82307
|
const localConfig = await readConfigFile();
|
|
82181
82308
|
let settings;
|
|
@@ -82291,7 +82418,7 @@ async function pushGitSyncSettings(opts) {
|
|
|
82291
82418
|
displayChanges(changes);
|
|
82292
82419
|
}
|
|
82293
82420
|
}
|
|
82294
|
-
if (!opts.yes && !!
|
|
82421
|
+
if (!opts.yes && !!process22.stdin.isTTY) {
|
|
82295
82422
|
const confirmed = await Confirm.prompt({
|
|
82296
82423
|
message: `Do you want to apply these changes to the remote?`,
|
|
82297
82424
|
default: true
|
|
@@ -82421,7 +82548,7 @@ __export(exports_gitsync_settings, {
|
|
|
82421
82548
|
gitSyncStatus: () => gitSyncStatus,
|
|
82422
82549
|
default: () => gitsync_settings_default
|
|
82423
82550
|
});
|
|
82424
|
-
var
|
|
82551
|
+
var command24, gitsync_settings_default;
|
|
82425
82552
|
var init_gitsync_settings = __esm(async () => {
|
|
82426
82553
|
init_mod3();
|
|
82427
82554
|
await __promiseAll([
|
|
@@ -82429,8 +82556,8 @@ var init_gitsync_settings = __esm(async () => {
|
|
|
82429
82556
|
init_push(),
|
|
82430
82557
|
init_status()
|
|
82431
82558
|
]);
|
|
82432
|
-
|
|
82433
|
-
gitsync_settings_default =
|
|
82559
|
+
command24 = new Command().description("Manage git-sync settings between local wmill.yaml and Windmill backend").command("pull").description("Pull git-sync settings from Windmill backend to local wmill.yaml").option("--repository <repo:string>", "Specify repository path (e.g., u/user/repo)").option("--default", "Write settings to top-level defaults instead of overrides").option("--replace", "Replace existing settings (non-interactive mode)").option("--override", "Add branch-specific override (non-interactive mode)").option("--diff", "Show differences without applying changes").option("--json-output", "Output in JSON format").option("--with-backend-settings <json:string>", "Use provided JSON settings instead of querying backend (for testing)").option("--yes", "Skip interactive prompts and use default behavior").option("--promotion <branch:string>", "Use promotionOverrides from the specified branch instead of regular overrides").action(pullGitSyncSettings).command("push").description("Push git-sync settings from local wmill.yaml to Windmill backend").option("--repository <repo:string>", "Specify repository path (e.g., u/user/repo)").option("--diff", "Show what would be pushed without applying changes").option("--json-output", "Output in JSON format").option("--with-backend-settings <json:string>", "Use provided JSON settings instead of querying backend (for testing)").option("--yes", "Skip interactive prompts and use default behavior").option("--promotion <branch:string>", "Use promotionOverrides from the specified branch instead of regular overrides").action(pushGitSyncSettings).command("status").description("Report how local changes deploy to the workspace (git push vs wmill sync push)").option("--json-output", "Output in JSON format").action(gitSyncStatus);
|
|
82560
|
+
gitsync_settings_default = command24;
|
|
82434
82561
|
});
|
|
82435
82562
|
|
|
82436
82563
|
// src/guidance/core.ts
|
|
@@ -89344,6 +89471,9 @@ app related commands
|
|
|
89344
89471
|
- \`--recording\` - Frame the app in a shell with a Record button, to capture a replayable session recording of the app under development
|
|
89345
89472
|
- \`app lint [app_folder:string]\` - Lint a raw app folder to validate structure and buildability
|
|
89346
89473
|
- \`--fix\` - Attempt to fix common issues (not implemented yet)
|
|
89474
|
+
- \`app bundle [app_folder:string]\` - Bundle a raw app folder to js/css without deploying it
|
|
89475
|
+
- \`--out <dir:string>\` - Directory to write bundle.js and bundle.css into (default: <app_folder>/dist)
|
|
89476
|
+
- \`--no-minify\` - Skip minification
|
|
89347
89477
|
- \`app new\` - create a new raw app from a template
|
|
89348
89478
|
- \`--summary <summary:string>\` - App summary (short description). Skips the prompt when provided. Triggers non-interactive mode.
|
|
89349
89479
|
- \`--path <path:string>\` - App path (e.g., f/folder/my_app or u/username/my_app). Skips the prompt when provided. Triggers non-interactive mode.
|
|
@@ -91738,17 +91868,17 @@ async function warnIfPromptsStale(opts) {
|
|
|
91738
91868
|
return;
|
|
91739
91869
|
const cwd = opts?.cwd ?? process.cwd();
|
|
91740
91870
|
let fileName = AGENTS_WMILL_FILENAME;
|
|
91741
|
-
let
|
|
91742
|
-
if (!await stat18(
|
|
91871
|
+
let path24 = `${cwd}/${fileName}`;
|
|
91872
|
+
if (!await stat18(path24).catch(() => null)) {
|
|
91743
91873
|
fileName = LEGACY_AGENTS_CLI_FILENAME;
|
|
91744
|
-
|
|
91745
|
-
if (!await stat18(
|
|
91874
|
+
path24 = `${cwd}/${fileName}`;
|
|
91875
|
+
if (!await stat18(path24).catch(() => null)) {
|
|
91746
91876
|
return;
|
|
91747
91877
|
}
|
|
91748
91878
|
}
|
|
91749
91879
|
let content;
|
|
91750
91880
|
try {
|
|
91751
|
-
content = await readTextFile(
|
|
91881
|
+
content = await readTextFile(path24);
|
|
91752
91882
|
} catch {
|
|
91753
91883
|
return;
|
|
91754
91884
|
}
|
|
@@ -91794,9 +91924,9 @@ __export(exports_tsconfig, {
|
|
|
91794
91924
|
});
|
|
91795
91925
|
import { execSync as execSync6 } from "node:child_process";
|
|
91796
91926
|
import { createHash as createHash2 } from "node:crypto";
|
|
91797
|
-
import { existsSync as
|
|
91798
|
-
import
|
|
91799
|
-
import
|
|
91927
|
+
import { existsSync as existsSync18, readFileSync as readFileSync5, writeFileSync as writeFileSync9 } from "node:fs";
|
|
91928
|
+
import path24 from "node:path";
|
|
91929
|
+
import process25 from "node:process";
|
|
91800
91930
|
function buildManagedTsconfig() {
|
|
91801
91931
|
const paths = {};
|
|
91802
91932
|
for (const dir of WORKSPACE_IMPORT_DIRS) {
|
|
@@ -91847,7 +91977,7 @@ async function refreshTsconfig(opts) {
|
|
|
91847
91977
|
const assumeYes = opts?.yes === true;
|
|
91848
91978
|
const mode = {
|
|
91849
91979
|
assumeYes,
|
|
91850
|
-
interactive: !!
|
|
91980
|
+
interactive: !!process25.stdin.isTTY && !assumeYes
|
|
91851
91981
|
};
|
|
91852
91982
|
await refreshManagedTsconfig(defaultTs2, mode);
|
|
91853
91983
|
if (defaultTs2 === "deno") {
|
|
@@ -91862,7 +91992,7 @@ async function refreshManagedTsconfig(defaultTs2, mode) {
|
|
|
91862
91992
|
}
|
|
91863
91993
|
const header = MANAGED_NOTICE + TSCONFIG_HASH_PREFIX + currentTsconfigHash() + `
|
|
91864
91994
|
`;
|
|
91865
|
-
|
|
91995
|
+
writeFileSync9(path24.join(process25.cwd(), MANAGED_TSCONFIG), header + JSON.stringify(managed, null, 2) + `
|
|
91866
91996
|
`);
|
|
91867
91997
|
info(colors.green(`Refreshed ${MANAGED_TSCONFIG}`));
|
|
91868
91998
|
await ensureUserReferencesManaged({
|
|
@@ -91898,7 +92028,7 @@ async function refreshManagedDenoImportMap(mode) {
|
|
|
91898
92028
|
for (const dir of WORKSPACE_IMPORT_DIRS) {
|
|
91899
92029
|
imports[`/${dir}/`] = `./${dir}/`;
|
|
91900
92030
|
}
|
|
91901
|
-
|
|
92031
|
+
writeFileSync9(path24.join(process25.cwd(), MANAGED_IMPORT_MAP), JSON.stringify({ imports }, null, 2) + `
|
|
91902
92032
|
`);
|
|
91903
92033
|
info(colors.green(`Refreshed ${MANAGED_IMPORT_MAP}`));
|
|
91904
92034
|
await ensureUserReferencesManaged({
|
|
@@ -91921,15 +92051,15 @@ async function refreshManagedDenoImportMap(mode) {
|
|
|
91921
92051
|
});
|
|
91922
92052
|
}
|
|
91923
92053
|
async function ensureUserReferencesManaged(opts) {
|
|
91924
|
-
const existing = [opts.file, ...opts.altFiles ?? []].map((f) =>
|
|
92054
|
+
const existing = [opts.file, ...opts.altFiles ?? []].map((f) => path24.join(process25.cwd(), f)).find((p) => existsSync18(p));
|
|
91925
92055
|
if (!existing) {
|
|
91926
|
-
const userPath =
|
|
91927
|
-
|
|
92056
|
+
const userPath = path24.join(process25.cwd(), opts.file);
|
|
92057
|
+
writeFileSync9(userPath, JSON.stringify(opts.create, null, 2) + `
|
|
91928
92058
|
`);
|
|
91929
92059
|
info(colors.green(`Created ${opts.file} (references ${opts.token})`));
|
|
91930
92060
|
return;
|
|
91931
92061
|
}
|
|
91932
|
-
const existingName =
|
|
92062
|
+
const existingName = path24.basename(existing);
|
|
91933
92063
|
let text = "";
|
|
91934
92064
|
try {
|
|
91935
92065
|
text = readFileSync5(existing, "utf-8");
|
|
@@ -91948,7 +92078,7 @@ async function ensureUserReferencesManaged(opts) {
|
|
|
91948
92078
|
return;
|
|
91949
92079
|
}
|
|
91950
92080
|
if (opts.legacyFormats?.some((fmt) => deepEqual2(parsed, fmt))) {
|
|
91951
|
-
|
|
92081
|
+
writeFileSync9(existing, JSON.stringify(opts.create, null, 2) + `
|
|
91952
92082
|
`);
|
|
91953
92083
|
info(colors.green(`Migrated previously-generated ${existingName} to reference ${opts.token}`));
|
|
91954
92084
|
return;
|
|
@@ -91967,13 +92097,13 @@ async function ensureUserReferencesManaged(opts) {
|
|
|
91967
92097
|
info(colors.gray(`Left ${existingName} unchanged — add ${opts.hint} when ready to enable ` + `workspace /f/, /u/ import resolution (or re-run \`wmill refresh tsconfig\`).`));
|
|
91968
92098
|
return;
|
|
91969
92099
|
}
|
|
91970
|
-
|
|
92100
|
+
writeFileSync9(existing, JSON.stringify(next, null, 2) + `
|
|
91971
92101
|
`);
|
|
91972
92102
|
info(colors.green(`Linked ${existingName} → ${opts.token}`));
|
|
91973
92103
|
}
|
|
91974
92104
|
function ensureBunTypesAvailable() {
|
|
91975
|
-
const cwd =
|
|
91976
|
-
if (
|
|
92105
|
+
const cwd = process25.cwd();
|
|
92106
|
+
if (existsSync18(path24.join(cwd, "node_modules", "bun-types"))) {
|
|
91977
92107
|
return true;
|
|
91978
92108
|
}
|
|
91979
92109
|
try {
|
|
@@ -91994,9 +92124,9 @@ function ensureBunTypesAvailable() {
|
|
|
91994
92124
|
}
|
|
91995
92125
|
}
|
|
91996
92126
|
async function warnIfTsconfigStale(opts) {
|
|
91997
|
-
const cwd = opts?.cwd ??
|
|
91998
|
-
const managedPath =
|
|
91999
|
-
if (!
|
|
92127
|
+
const cwd = opts?.cwd ?? process25.cwd();
|
|
92128
|
+
const managedPath = path24.join(cwd, MANAGED_TSCONFIG);
|
|
92129
|
+
if (!existsSync18(managedPath))
|
|
92000
92130
|
return;
|
|
92001
92131
|
let managedText;
|
|
92002
92132
|
try {
|
|
@@ -92014,10 +92144,10 @@ async function warnIfTsconfigStale(opts) {
|
|
|
92014
92144
|
}
|
|
92015
92145
|
}
|
|
92016
92146
|
function emitTsconfigWarning(message) {
|
|
92017
|
-
|
|
92147
|
+
process25.stderr.write(`${colors.yellow(message)}
|
|
92018
92148
|
`);
|
|
92019
92149
|
}
|
|
92020
|
-
var WORKSPACE_IMPORT_DIRS, MANAGED_TSCONFIG = "tsconfig.wmill.json", MANAGED_IMPORT_MAP = "import_map.wmill.json", MANAGED_NOTICE, TSCONFIG_HASH_PREFIX = "// wmill-tsconfig-hash: ", TSCONFIG_HASH_REGEX, LEGACY_GENERATED_TSCONFIGS,
|
|
92150
|
+
var WORKSPACE_IMPORT_DIRS, MANAGED_TSCONFIG = "tsconfig.wmill.json", MANAGED_IMPORT_MAP = "import_map.wmill.json", MANAGED_NOTICE, TSCONFIG_HASH_PREFIX = "// wmill-tsconfig-hash: ", TSCONFIG_HASH_REGEX, LEGACY_GENERATED_TSCONFIGS, command31, tsconfig_default;
|
|
92021
92151
|
var init_tsconfig = __esm(async () => {
|
|
92022
92152
|
init_colors2();
|
|
92023
92153
|
init_mod3();
|
|
@@ -92053,10 +92183,10 @@ var init_tsconfig = __esm(async () => {
|
|
|
92053
92183
|
include: ["**/*.ts", "rt.d.ts"]
|
|
92054
92184
|
}
|
|
92055
92185
|
];
|
|
92056
|
-
|
|
92186
|
+
command31 = new Command().description("Refresh the wmill-managed tsconfig.wmill.json (and Deno import map for Deno projects)").option("--yes", "Non-interactive: wire an existing custom tsconfig.json/deno.json to the managed file without prompting (a previously-generated config is always migrated automatically).").action(async (opts) => {
|
|
92057
92187
|
await refreshTsconfig({ yes: opts.yes === true });
|
|
92058
92188
|
});
|
|
92059
|
-
tsconfig_default =
|
|
92189
|
+
tsconfig_default = command31;
|
|
92060
92190
|
});
|
|
92061
92191
|
|
|
92062
92192
|
// src/main.ts
|
|
@@ -93333,8 +93463,8 @@ async function pull2(opts) {
|
|
|
93333
93463
|
await pushResourceType(workspace.workspaceId, x.name + ".resource-type.json", undefined, x);
|
|
93334
93464
|
}
|
|
93335
93465
|
}
|
|
93336
|
-
var
|
|
93337
|
-
var hub_default =
|
|
93466
|
+
var command23 = new Command().name("hub").description("Hub related commands. EXPERIMENTAL. INTERNAL USE ONLY.").command("pull").description("pull any supported definitions. EXPERIMENTAL.").action(pull2);
|
|
93467
|
+
var hub_default = command23;
|
|
93338
93468
|
|
|
93339
93469
|
// src/main.ts
|
|
93340
93470
|
await __promiseAll([
|
|
@@ -93435,27 +93565,27 @@ await __promiseAll([
|
|
|
93435
93565
|
init_context()
|
|
93436
93566
|
]);
|
|
93437
93567
|
var import_yaml40 = __toESM(require_dist(), 1);
|
|
93438
|
-
import { existsSync as
|
|
93568
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
93439
93569
|
import { writeFile as writeFile19 } from "node:fs/promises";
|
|
93440
|
-
import { dirname as dirname19, join as
|
|
93570
|
+
import { dirname as dirname19, join as join21 } from "node:path";
|
|
93441
93571
|
var PROTECTION_RULES_FILENAME = "protection-rules.yaml";
|
|
93442
93572
|
function getProtectionRulesPath() {
|
|
93443
93573
|
const wmillPath = getWmillYamlPath();
|
|
93444
93574
|
if (!wmillPath)
|
|
93445
93575
|
return null;
|
|
93446
|
-
return
|
|
93576
|
+
return join21(dirname19(wmillPath), PROTECTION_RULES_FILENAME);
|
|
93447
93577
|
}
|
|
93448
|
-
async function readProtectionRulesFile(
|
|
93449
|
-
if (!
|
|
93578
|
+
async function readProtectionRulesFile(path23) {
|
|
93579
|
+
if (!existsSync15(path23))
|
|
93450
93580
|
return {};
|
|
93451
|
-
const parsed = await yamlParseFile(
|
|
93581
|
+
const parsed = await yamlParseFile(path23);
|
|
93452
93582
|
return parsed ?? {};
|
|
93453
93583
|
}
|
|
93454
|
-
async function writeProtectionRulesFile(
|
|
93584
|
+
async function writeProtectionRulesFile(path23, data3) {
|
|
93455
93585
|
const sorted = {};
|
|
93456
93586
|
for (const k of Object.keys(data3).sort())
|
|
93457
93587
|
sorted[k] = data3[k];
|
|
93458
|
-
await writeFile19(
|
|
93588
|
+
await writeFile19(path23, import_yaml40.stringify(sorted, yamlOptions), "utf-8");
|
|
93459
93589
|
}
|
|
93460
93590
|
|
|
93461
93591
|
class WorkspaceResolver {
|
|
@@ -93500,7 +93630,7 @@ async function configureClientForWorkspace(opts, ws, resolver) {
|
|
|
93500
93630
|
// src/commands/protection-rules/utils.ts
|
|
93501
93631
|
init_colors2();
|
|
93502
93632
|
init_log();
|
|
93503
|
-
import
|
|
93633
|
+
import process23 from "node:process";
|
|
93504
93634
|
function outputResult2(opts, result) {
|
|
93505
93635
|
if (opts.jsonOutput) {
|
|
93506
93636
|
console.log(JSON.stringify(result));
|
|
@@ -93512,7 +93642,7 @@ function outputResult2(opts, result) {
|
|
|
93512
93642
|
}
|
|
93513
93643
|
function fail(opts, result) {
|
|
93514
93644
|
outputResult2(opts, { ...result, success: false });
|
|
93515
|
-
|
|
93645
|
+
process23.exit(1);
|
|
93516
93646
|
}
|
|
93517
93647
|
function describeEntry(entry) {
|
|
93518
93648
|
const n = ProtectionRulesConverter.normalizeEntry(entry);
|
|
@@ -93656,8 +93786,8 @@ await __promiseAll([
|
|
|
93656
93786
|
init_confirm(),
|
|
93657
93787
|
init_conf()
|
|
93658
93788
|
]);
|
|
93659
|
-
import
|
|
93660
|
-
import { existsSync as
|
|
93789
|
+
import process24 from "node:process";
|
|
93790
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
93661
93791
|
async function pushProtectionRules(opts, workspaceArg) {
|
|
93662
93792
|
if (opts.jsonOutput)
|
|
93663
93793
|
setSilent(true);
|
|
@@ -93667,7 +93797,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
93667
93797
|
error: "No wmill.yaml found. Run 'wmill init' first — protection-rules.yaml lives next to it."
|
|
93668
93798
|
});
|
|
93669
93799
|
}
|
|
93670
|
-
if (!
|
|
93800
|
+
if (!existsSync16(prPath)) {
|
|
93671
93801
|
fail(opts, {
|
|
93672
93802
|
error: "No protection-rules.yaml found. Run 'wmill protection-rules pull' first."
|
|
93673
93803
|
});
|
|
@@ -93737,7 +93867,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
93737
93867
|
workspaces: Object.fromEntries(wsPlans.map((w) => [w.ws, structuredPlan(w.plan)]))
|
|
93738
93868
|
}));
|
|
93739
93869
|
if (hadError)
|
|
93740
|
-
|
|
93870
|
+
process24.exit(1);
|
|
93741
93871
|
return;
|
|
93742
93872
|
}
|
|
93743
93873
|
if (!opts.jsonOutput) {
|
|
@@ -93751,7 +93881,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
93751
93881
|
error: "One or more workspaces failed (see errors above); the rest are in sync",
|
|
93752
93882
|
partialFailure: true
|
|
93753
93883
|
});
|
|
93754
|
-
|
|
93884
|
+
process24.exit(1);
|
|
93755
93885
|
}
|
|
93756
93886
|
if (!opts.dryRun) {
|
|
93757
93887
|
outputResult2(opts, {
|
|
@@ -93763,7 +93893,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
93763
93893
|
}
|
|
93764
93894
|
if (opts.dryRun) {
|
|
93765
93895
|
if (hadError)
|
|
93766
|
-
|
|
93896
|
+
process24.exit(1);
|
|
93767
93897
|
return;
|
|
93768
93898
|
}
|
|
93769
93899
|
for (const w of wsPlans) {
|
|
@@ -93772,7 +93902,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
93772
93902
|
}
|
|
93773
93903
|
}
|
|
93774
93904
|
const totalDeletes = changed.reduce((n, w) => n + w.plan.toDelete.length, 0);
|
|
93775
|
-
if (!opts.yes && !!
|
|
93905
|
+
if (!opts.yes && !!process24.stdin.isTTY) {
|
|
93776
93906
|
const confirmed = await Confirm.prompt({
|
|
93777
93907
|
message: totalDeletes > 0 ? `Apply these changes? This DELETES ${totalDeletes} protection rule(s) across ${changed.length} workspace(s).` : `Apply these changes to ${changed.length} workspace(s)?`,
|
|
93778
93908
|
default: totalDeletes === 0
|
|
@@ -93834,7 +93964,7 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
93834
93964
|
partialFailure: true,
|
|
93835
93965
|
...applied
|
|
93836
93966
|
});
|
|
93837
|
-
|
|
93967
|
+
process24.exit(1);
|
|
93838
93968
|
}
|
|
93839
93969
|
outputResult2(opts, {
|
|
93840
93970
|
success: true,
|
|
@@ -93844,8 +93974,8 @@ async function pushProtectionRules(opts, workspaceArg) {
|
|
|
93844
93974
|
}
|
|
93845
93975
|
|
|
93846
93976
|
// src/commands/protection-rules/protection-rules.ts
|
|
93847
|
-
var
|
|
93848
|
-
var protection_rules_default =
|
|
93977
|
+
var command25 = new Command().description("Sync workspace protection rules between protection-rules.yaml and Windmill. The file is keyed by workspace name; keys must match wmill.yaml 'workspaces'.").command("pull").description("Pull protection rules from Windmill into protection-rules.yaml for a workspace").arguments("[workspace:string]").option("--all", "Pull every workspace defined in wmill.yaml").option("--dry-run", "Show what would change without writing the file").option("--json-output", "Output in JSON format").action(pullProtectionRules).command("push").description("Push protection rules from protection-rules.yaml to Windmill for a workspace (full reconcile: creates, updates, and deletes)").arguments("[workspace:string]").option("--all", "Push every workspace defined in protection-rules.yaml").option("--dry-run", "Show what would change without applying").option("--json-output", "Output in JSON format").option("--yes", "Skip the confirmation prompt (including deletions)").action(pushProtectionRules);
|
|
93978
|
+
var protection_rules_default = command25;
|
|
93849
93979
|
|
|
93850
93980
|
// src/main.ts
|
|
93851
93981
|
await init_instance();
|
|
@@ -93929,8 +94059,8 @@ async function pushWorkerGroups(opts) {
|
|
|
93929
94059
|
await pushInstanceConfigs(opts, false);
|
|
93930
94060
|
}
|
|
93931
94061
|
}
|
|
93932
|
-
var
|
|
93933
|
-
var worker_groups_default =
|
|
94062
|
+
var command26 = new Command().description("display worker groups, pull and push worker groups configs").action(displayWorkerGroups).command("pull").description("Pull worker groups (similar to `wmill instance pull --skip-users --skip-settings --skip-groups`)").option("--instance", "Name of the instance to push to, override the active instance").option("--base-url", "Base url to be passed to the instance settings instead of the local one").option("--yes", "Pull without needing confirmation").action(pullWorkerGroups).command("push").description("Push worker groups (similar to `wmill instance push --skip-users --skip-settings --skip-groups`)").option("--instance [instance]", "Name of the instance to push to, override the active instance").option("--base-url [baseUrl]", "If used with --token, will be used as the base url for the instance").option("--yes", "Push without needing confirmation").action(pushWorkerGroups);
|
|
94063
|
+
var worker_groups_default = command26;
|
|
93934
94064
|
|
|
93935
94065
|
// src/main.ts
|
|
93936
94066
|
await init_lint();
|
|
@@ -93965,8 +94095,8 @@ import * as http3 from "node:http";
|
|
|
93965
94095
|
import * as https from "node:https";
|
|
93966
94096
|
import { access, readdir as readdir10, realpath, stat as stat17, unlink, writeFile as writeFile20 } from "node:fs/promises";
|
|
93967
94097
|
import { watch as watch2 } from "node:fs";
|
|
93968
|
-
import * as
|
|
93969
|
-
import * as
|
|
94098
|
+
import * as path23 from "node:path";
|
|
94099
|
+
import * as fs17 from "node:fs";
|
|
93970
94100
|
|
|
93971
94101
|
// src/commands/dev/pathscript-restore.ts
|
|
93972
94102
|
var TAG_KEY = "_originalPathScript";
|
|
@@ -94061,7 +94191,7 @@ var PORT = 3001;
|
|
|
94061
94191
|
var FLOW_SUFFIXES = [".flow", "__flow"];
|
|
94062
94192
|
var APP_SUFFIXES = [".app", "__app", ".raw_app", "__raw_app"];
|
|
94063
94193
|
var INLINE_SCRIPT_EXTS = new Set([
|
|
94064
|
-
...exts.map((e) =>
|
|
94194
|
+
...exts.map((e) => path23.extname("x" + e)).filter((e) => e !== ".yml"),
|
|
94065
94195
|
".js"
|
|
94066
94196
|
]);
|
|
94067
94197
|
function stripFolderSuffix(rel, suffixes) {
|
|
@@ -94102,13 +94232,13 @@ async function listWorkspacePaths() {
|
|
|
94102
94232
|
if (entry.name.startsWith(".") || entry.name === "node_modules")
|
|
94103
94233
|
continue;
|
|
94104
94234
|
const childRel = rel ? `${rel}/${entry.name}` : entry.name;
|
|
94105
|
-
const childAbs =
|
|
94235
|
+
const childAbs = path23.join(dir, entry.name);
|
|
94106
94236
|
if (entry.isDirectory()) {
|
|
94107
94237
|
if (isFlowFolderName(entry.name)) {
|
|
94108
94238
|
items.push({
|
|
94109
94239
|
path: stripFolderSuffix(childRel, FLOW_SUFFIXES),
|
|
94110
94240
|
kind: "flow",
|
|
94111
|
-
_metaPath:
|
|
94241
|
+
_metaPath: path23.join(childAbs, "flow.yaml")
|
|
94112
94242
|
});
|
|
94113
94243
|
continue;
|
|
94114
94244
|
}
|
|
@@ -94156,25 +94286,25 @@ async function listWorkspacePaths() {
|
|
|
94156
94286
|
async function dev2(opts) {
|
|
94157
94287
|
if (!opts.path) {
|
|
94158
94288
|
const cwd = process.cwd();
|
|
94159
|
-
const cwdBasename =
|
|
94289
|
+
const cwdBasename = path23.basename(cwd);
|
|
94160
94290
|
await loadNonDottedPathsSetting();
|
|
94161
94291
|
if (isFlowFolderName(cwdBasename)) {
|
|
94162
94292
|
GLOBAL_CONFIG_OPT.noCdToRoot = true;
|
|
94163
94293
|
let searchDir = cwd;
|
|
94164
94294
|
let workspaceRoot;
|
|
94165
94295
|
while (true) {
|
|
94166
|
-
const wmillYaml =
|
|
94167
|
-
if (
|
|
94296
|
+
const wmillYaml = path23.join(searchDir, "wmill.yaml");
|
|
94297
|
+
if (fs17.existsSync(wmillYaml)) {
|
|
94168
94298
|
workspaceRoot = searchDir;
|
|
94169
94299
|
break;
|
|
94170
94300
|
}
|
|
94171
|
-
const parentDir =
|
|
94301
|
+
const parentDir = path23.dirname(searchDir);
|
|
94172
94302
|
if (parentDir === searchDir)
|
|
94173
94303
|
break;
|
|
94174
94304
|
searchDir = parentDir;
|
|
94175
94305
|
}
|
|
94176
94306
|
if (workspaceRoot) {
|
|
94177
|
-
const relPath =
|
|
94307
|
+
const relPath = path23.relative(workspaceRoot, cwd).replaceAll("\\", "/");
|
|
94178
94308
|
opts.path = stripFolderSuffix(relPath, FLOW_SUFFIXES);
|
|
94179
94309
|
info(`Detected flow folder, path: ${opts.path}`);
|
|
94180
94310
|
process.chdir(workspaceRoot);
|
|
@@ -94267,7 +94397,7 @@ async function dev2(opts) {
|
|
|
94267
94397
|
return;
|
|
94268
94398
|
const wmFlowPath = stripFolderSuffix(localPath.replace(/\/$/, ""), FLOW_SUFFIXES);
|
|
94269
94399
|
const localFlow = await yamlParseFile(localPath + "flow.yaml");
|
|
94270
|
-
await replaceInlineScripts(localFlow.value.modules, async (
|
|
94400
|
+
await replaceInlineScripts(localFlow.value.modules, async (path24) => await readTextFile(localPath + path24), exports_log, localPath, SEP21, undefined);
|
|
94271
94401
|
snapshotPathScripts(localFlow.value);
|
|
94272
94402
|
const localScriptReader = createPreviewLocalScriptReader({
|
|
94273
94403
|
exts,
|
|
@@ -94437,7 +94567,7 @@ async function dev2(opts) {
|
|
|
94437
94567
|
for (const file of dirFiles) {
|
|
94438
94568
|
if (file === "flow.yaml" || file === "flow.json" || file.startsWith("."))
|
|
94439
94569
|
continue;
|
|
94440
|
-
if (!INLINE_SCRIPT_EXTS.has(
|
|
94570
|
+
if (!INLINE_SCRIPT_EXTS.has(path23.extname(file)))
|
|
94441
94571
|
continue;
|
|
94442
94572
|
if (!extractedPaths.has(file)) {
|
|
94443
94573
|
await unlink(flowDir + file);
|
|
@@ -94629,7 +94759,7 @@ async function dev2(opts) {
|
|
|
94629
94759
|
}
|
|
94630
94760
|
socket.destroy();
|
|
94631
94761
|
});
|
|
94632
|
-
return new Promise((
|
|
94762
|
+
return new Promise((resolve11) => {
|
|
94633
94763
|
proxyServer.listen(proxyPort, BIND_HOST, () => {
|
|
94634
94764
|
console.log(`Dev proxy listening on http://localhost:${proxyPort}`);
|
|
94635
94765
|
if (opts.path) {
|
|
@@ -94639,7 +94769,7 @@ async function dev2(opts) {
|
|
|
94639
94769
|
console.log("(pass --path <path> to skip the picker)");
|
|
94640
94770
|
}
|
|
94641
94771
|
maybeOpenBrowser(`http://localhost:${proxyPort}/`);
|
|
94642
|
-
|
|
94772
|
+
resolve11();
|
|
94643
94773
|
});
|
|
94644
94774
|
});
|
|
94645
94775
|
}
|
|
@@ -94675,8 +94805,8 @@ async function dev2(opts) {
|
|
|
94675
94805
|
await Promise.all([startServer(), watchChanges()]);
|
|
94676
94806
|
console.log("Stopped dev mode");
|
|
94677
94807
|
}
|
|
94678
|
-
var
|
|
94679
|
-
var dev_default2 =
|
|
94808
|
+
var command27 = new Command().description("Watch local file changes and live-reload the dev page for preview. Does NOT deploy to the remote workspace — use wmill sync push for that.").option("--includes <pattern...:string>", "Filter paths given a glob pattern or path").option("--proxy-port <port:number>", "Port for a localhost reverse proxy to the remote Windmill server").option("--path <path:string>", "Watch a specific windmill path (e.g., u/admin/my_script or f/my_flow)").option("--no-open", "Do not open the browser automatically").action(dev2);
|
|
94809
|
+
var dev_default2 = command27;
|
|
94680
94810
|
|
|
94681
94811
|
// src/main.ts
|
|
94682
94812
|
init_gen();
|
|
@@ -94745,9 +94875,9 @@ class NpmProvider extends Provider {
|
|
|
94745
94875
|
if (verbose)
|
|
94746
94876
|
process.stderr.write(d);
|
|
94747
94877
|
});
|
|
94748
|
-
const exitCode = await new Promise((
|
|
94878
|
+
const exitCode = await new Promise((resolve11, reject) => {
|
|
94749
94879
|
proc.on("error", reject);
|
|
94750
|
-
proc.on("close",
|
|
94880
|
+
proc.on("close", resolve11);
|
|
94751
94881
|
}).catch((e) => {
|
|
94752
94882
|
throw new Error(`failed to run npm: ${e instanceof Error ? e.message : e}
|
|
94753
94883
|
|
|
@@ -94833,8 +94963,8 @@ Worker Group: ${group.groupName} (${group.workers.length} workers)`);
|
|
|
94833
94963
|
info("Use 'wmill instance add' to add a new instance");
|
|
94834
94964
|
}
|
|
94835
94965
|
}
|
|
94836
|
-
var
|
|
94837
|
-
var workers_default =
|
|
94966
|
+
var command28 = new Command().description("List all workers grouped by worker groups").option("--instance [instance]", "Name of the instance to push to, override the active instance").option("--base-url [baseUrl]", "If used with --token, will be used as the base url for the instance").action(displayWorkers);
|
|
94967
|
+
var workers_default = command28;
|
|
94838
94968
|
|
|
94839
94969
|
// src/commands/queues/queues.ts
|
|
94840
94970
|
init_mod3();
|
|
@@ -94942,8 +95072,8 @@ async function displayQueues(opts, workspace) {
|
|
|
94942
95072
|
info("Use 'wmill instance add' to add a new instance");
|
|
94943
95073
|
}
|
|
94944
95074
|
}
|
|
94945
|
-
var
|
|
94946
|
-
var queues_default =
|
|
95075
|
+
var command29 = new Command().description("List all queues with their metrics").arguments("[workspace:string] the optional workspace to filter by (default to all workspaces)").option("--instance [instance]", "Name of the instance to push to, override the active instance").option("--base-url [baseUrl]", "If used with --token, will be used as the base url for the instance").action(displayQueues);
|
|
95076
|
+
var queues_default = command29;
|
|
94947
95077
|
|
|
94948
95078
|
// src/main.ts
|
|
94949
95079
|
await init_dependencies();
|
|
@@ -95443,7 +95573,7 @@ await __promiseAll([
|
|
|
95443
95573
|
init_freshness()
|
|
95444
95574
|
]);
|
|
95445
95575
|
import { cp, mkdir as mkdir13, readdir as readdir11, rm as rm6, stat as stat19, writeFile as writeFile21 } from "node:fs/promises";
|
|
95446
|
-
import { join as
|
|
95576
|
+
import { join as join23 } from "node:path";
|
|
95447
95577
|
var WMILL_INIT_AI_SKILLS_SOURCE_ENV = "WMILL_INIT_AI_SKILLS_SOURCE";
|
|
95448
95578
|
var WMILL_INIT_AI_AGENTS_SOURCE_ENV = "WMILL_INIT_AI_AGENTS_SOURCE";
|
|
95449
95579
|
var WMILL_INIT_AI_CLAUDE_SOURCE_ENV = "WMILL_INIT_AI_CLAUDE_SOURCE";
|
|
@@ -95456,20 +95586,20 @@ async function writeAiGuidanceFiles(options) {
|
|
|
95456
95586
|
const skillMetadata = options.skillsSourcePath ? await readSkillMetadataFromDirectory(options.skillsSourcePath) : getGeneratedSkillMetadata();
|
|
95457
95587
|
const rawAgentsCliContent = options.agentsSourcePath != null ? await readTextFile(options.agentsSourcePath) : generateAgentsCliMdContent(buildSkillsReference(skillMetadata));
|
|
95458
95588
|
const agentsCliContent = injectPromptsHashMarker(rawAgentsCliContent, currentPromptsHash(nonDottedPaths));
|
|
95459
|
-
const agentsCliPath =
|
|
95589
|
+
const agentsCliPath = join23(options.targetDir, AGENTS_WMILL_FILENAME);
|
|
95460
95590
|
await writeFile21(agentsCliPath, agentsCliContent, "utf8");
|
|
95461
95591
|
const agentsCliWritten = true;
|
|
95462
95592
|
const legacyManagedRemoved = await migrateLegacyManagedFile(options.targetDir);
|
|
95463
95593
|
const resolveMigration = cacheOnce(options.resolveAgentsMdMigration);
|
|
95464
95594
|
const agentsMdResult = await reconcileIncludingFile({
|
|
95465
|
-
path:
|
|
95595
|
+
path: join23(options.targetDir, "AGENTS.md"),
|
|
95466
95596
|
includeLine: AGENTS_WMILL_INCLUDE_LINE,
|
|
95467
95597
|
skeleton: generateAgentsMdSkeleton(),
|
|
95468
95598
|
resolveMigration
|
|
95469
95599
|
});
|
|
95470
95600
|
const claudeSkeleton = options.claudeSourcePath != null ? await readTextFile(options.claudeSourcePath) : CLAUDE_MD_DEFAULT;
|
|
95471
95601
|
const claudeMdResult = await reconcileIncludingFile({
|
|
95472
|
-
path:
|
|
95602
|
+
path: join23(options.targetDir, "CLAUDE.md"),
|
|
95473
95603
|
includeLine: CLAUDE_MD_INCLUDE_LINE,
|
|
95474
95604
|
skeleton: claudeSkeleton,
|
|
95475
95605
|
resolveMigration
|
|
@@ -95491,7 +95621,7 @@ async function writeAiGuidanceFiles(options) {
|
|
|
95491
95621
|
}
|
|
95492
95622
|
async function migrateLegacyManagedFile(targetDir) {
|
|
95493
95623
|
for (const fileName of ["AGENTS.md", "CLAUDE.md"]) {
|
|
95494
|
-
const filePath =
|
|
95624
|
+
const filePath = join23(targetDir, fileName);
|
|
95495
95625
|
const existing = await readTextFile(filePath).catch(() => null);
|
|
95496
95626
|
if (existing == null)
|
|
95497
95627
|
continue;
|
|
@@ -95500,7 +95630,7 @@ async function migrateLegacyManagedFile(targetDir) {
|
|
|
95500
95630
|
await writeFile21(filePath, rewritten, "utf8");
|
|
95501
95631
|
}
|
|
95502
95632
|
}
|
|
95503
|
-
const legacyPath =
|
|
95633
|
+
const legacyPath = join23(targetDir, LEGACY_AGENTS_CLI_FILENAME);
|
|
95504
95634
|
const legacyExists = await stat19(legacyPath).catch(() => null) != null;
|
|
95505
95635
|
if (legacyExists) {
|
|
95506
95636
|
await rm6(legacyPath, { force: true });
|
|
@@ -95577,9 +95707,9 @@ async function copySkillsFromSource(targetDir, skillsSourcePath) {
|
|
|
95577
95707
|
async function writeGeneratedSkills(targetDir, nonDottedPaths) {
|
|
95578
95708
|
const skillsDirs = await ensureSkillsDirectories(targetDir);
|
|
95579
95709
|
await Promise.all(skillsDirs.flatMap((skillsDir) => SKILLS.map(async (skill) => {
|
|
95580
|
-
const skillDir =
|
|
95710
|
+
const skillDir = join23(skillsDir, skill.name);
|
|
95581
95711
|
await mkdir13(skillDir, { recursive: true });
|
|
95582
|
-
await writeFile21(
|
|
95712
|
+
await writeFile21(join23(skillDir, "SKILL.md"), renderGeneratedSkillContent(skill.name, nonDottedPaths), "utf8");
|
|
95583
95713
|
})));
|
|
95584
95714
|
return SKILLS.map((skill) => ({
|
|
95585
95715
|
...skill,
|
|
@@ -95593,14 +95723,14 @@ function getGeneratedSkillMetadata() {
|
|
|
95593
95723
|
}));
|
|
95594
95724
|
}
|
|
95595
95725
|
async function ensureSkillsDirectories(targetDir) {
|
|
95596
|
-
const skillsDirs = SKILL_TARGET_ROOTS.map((root) =>
|
|
95726
|
+
const skillsDirs = SKILL_TARGET_ROOTS.map((root) => join23(targetDir, root, "skills"));
|
|
95597
95727
|
await Promise.all(skillsDirs.map((skillsDir) => mkdir13(skillsDir, { recursive: true })));
|
|
95598
95728
|
return skillsDirs;
|
|
95599
95729
|
}
|
|
95600
95730
|
async function copyDirectoryContents(sourceDir, targetDir) {
|
|
95601
95731
|
const entries = await readdir11(sourceDir, { withFileTypes: true });
|
|
95602
95732
|
await Promise.all(entries.map(async (entry) => {
|
|
95603
|
-
await cp(
|
|
95733
|
+
await cp(join23(sourceDir, entry.name), join23(targetDir, entry.name), {
|
|
95604
95734
|
recursive: true,
|
|
95605
95735
|
force: true
|
|
95606
95736
|
});
|
|
@@ -95643,7 +95773,7 @@ async function readSkillMetadataFromDirectory(skillsDir) {
|
|
|
95643
95773
|
if (!entry.isDirectory()) {
|
|
95644
95774
|
continue;
|
|
95645
95775
|
}
|
|
95646
|
-
const skillPath =
|
|
95776
|
+
const skillPath = join23(skillsDir, entry.name, "SKILL.md");
|
|
95647
95777
|
if (!await stat19(skillPath).catch(() => null)) {
|
|
95648
95778
|
continue;
|
|
95649
95779
|
}
|
|
@@ -95789,8 +95919,8 @@ async function promptMigration() {
|
|
|
95789
95919
|
async function promptsAction(opts) {
|
|
95790
95920
|
await refreshPrompts({ yes: opts.yes === true });
|
|
95791
95921
|
}
|
|
95792
|
-
var
|
|
95793
|
-
var prompts_default =
|
|
95922
|
+
var command30 = new Command().description("Refresh AGENTS.wmill.md and managed skills. User-owned AGENTS.md and CLAUDE.md are never overwritten unless you opt in.").option("--yes", "Non-interactive: append the @AGENTS.wmill.md include to an existing AGENTS.md / CLAUDE.md without prompting. Without it, a non-interactive run leaves an unlinked file untouched.").action(promptsAction);
|
|
95923
|
+
var prompts_default = command30;
|
|
95794
95924
|
|
|
95795
95925
|
// src/commands/init/init.ts
|
|
95796
95926
|
await init_tsconfig();
|
|
@@ -95984,14 +96114,14 @@ async function initAction(opts) {
|
|
|
95984
96114
|
}
|
|
95985
96115
|
}
|
|
95986
96116
|
}
|
|
95987
|
-
var
|
|
95988
|
-
var init_default =
|
|
96117
|
+
var command32 = new Command().description("Bootstrap a windmill project with a wmill.yaml file").option("--use-default", "Use default settings without checking backend").option("--use-backend", "Use backend git-sync settings if available").option("--repository <repo:string>", "Specify repository path (e.g., u/user/repo) when using backend settings").option("--bind-profile", "Automatically bind active workspace profile to current Git branch").option("--no-bind-profile", "Skip workspace profile binding prompt").action(initAction);
|
|
96118
|
+
var init_default = command32;
|
|
95989
96119
|
|
|
95990
96120
|
// src/commands/refresh/refresh.ts
|
|
95991
96121
|
init_mod3();
|
|
95992
96122
|
await init_tsconfig();
|
|
95993
|
-
var
|
|
95994
|
-
var refresh_default =
|
|
96123
|
+
var command33 = new Command().description("Refresh wmill-managed project files (AGENTS.wmill.md, skills, tsconfig.wmill.json)").command("prompts", prompts_default).command("tsconfig", tsconfig_default);
|
|
96124
|
+
var refresh_default = command33;
|
|
95995
96125
|
|
|
95996
96126
|
// src/main.ts
|
|
95997
96127
|
init_freshness_gate();
|
|
@@ -96008,7 +96138,7 @@ await __promiseAll([
|
|
|
96008
96138
|
init_conf(),
|
|
96009
96139
|
init_utils()
|
|
96010
96140
|
]);
|
|
96011
|
-
import * as
|
|
96141
|
+
import * as fs18 from "node:fs/promises";
|
|
96012
96142
|
async function pullJobs(opts, workspace) {
|
|
96013
96143
|
opts = await mergeConfigWithConfigFile(opts);
|
|
96014
96144
|
const ws = await resolveWorkspace({ ...opts, workspace });
|
|
@@ -96052,7 +96182,7 @@ Warning: Found ${workers.length} active worker(s) on the instance.`));
|
|
|
96052
96182
|
page++;
|
|
96053
96183
|
}
|
|
96054
96184
|
const completedPath = opts.completedOutput || "completed_jobs.json";
|
|
96055
|
-
await
|
|
96185
|
+
await fs18.writeFile(completedPath, JSON.stringify(completedJobs, null, 2));
|
|
96056
96186
|
info(colors.green(`Successfully pulled ${completedJobs.length} completed jobs to ${completedPath}`));
|
|
96057
96187
|
let queuedJobs = [];
|
|
96058
96188
|
page = 1;
|
|
@@ -96070,7 +96200,7 @@ Warning: Found ${workers.length} active worker(s) on the instance.`));
|
|
|
96070
96200
|
page++;
|
|
96071
96201
|
}
|
|
96072
96202
|
const queuedPath = opts.queuedOutput || "queued_jobs.json";
|
|
96073
|
-
await
|
|
96203
|
+
await fs18.writeFile(queuedPath, JSON.stringify(queuedJobs, null, 2));
|
|
96074
96204
|
info(colors.green(`Successfully pulled ${queuedJobs.length} queued jobs to ${queuedPath}`));
|
|
96075
96205
|
const allJobs = [...queuedJobs, ...completedJobs];
|
|
96076
96206
|
if (allJobs.length > 0) {
|
|
@@ -96160,8 +96290,8 @@ Warning: Found ${workers.length} active worker(s) on the instance.`));
|
|
|
96160
96290
|
}
|
|
96161
96291
|
var pull3 = new Command().description("Pull completed and queued jobs from workspace").option("-c, --completed-output <file:string>", "Completed jobs output file (default: completed_jobs.json)").option("-q, --queued-output <file:string>", "Queued jobs output file (default: queued_jobs.json)").option("--skip-worker-check", "Skip checking for active workers before export").arguments("[workspace:string]").action(pullJobs);
|
|
96162
96292
|
var push12 = new Command().description("Push completed and queued jobs to workspace").option("-c, --completed-file <file:string>", "Completed jobs input file (default: completed_jobs.json)").option("-q, --queued-file <file:string>", "Queued jobs input file (default: queued_jobs.json)").option("--skip-worker-check", "Skip checking for active workers before import").arguments("[workspace:string]").action(pushJobs);
|
|
96163
|
-
var
|
|
96164
|
-
var jobs_default =
|
|
96293
|
+
var command34 = new Command().description("Manage jobs (import/export)").command("pull", pull3).command("push", push12);
|
|
96294
|
+
var jobs_default = command34;
|
|
96165
96295
|
|
|
96166
96296
|
// src/commands/job/job.ts
|
|
96167
96297
|
init_mod3();
|
|
@@ -96522,8 +96652,8 @@ async function restart(opts, id) {
|
|
|
96522
96652
|
console.log(newId);
|
|
96523
96653
|
}
|
|
96524
96654
|
var listOptions = (cmd) => cmd.option("--json", "Output as JSON (for piping to jq)").option("--script-path <scriptPath:string>", "Filter by exact script/flow path").option("--created-by <createdBy:string>", "Filter by creator username").option("--running", "Show only running jobs").option("--failed", "Show only failed jobs").option("--success <success:boolean>", "Filter by success status (true/false)").option("--limit <limit:number>", "Number of jobs to return (default 30, max 100)").option("--job-kinds <jobKinds:string>", "Filter by job kinds (default: script,flow,singlestepflow)").option("--label <label:string>", "Filter by job label").option("--all", "Include sub-jobs (flow steps). By default only top-level jobs are shown").option("--parent <parent:string>", "Filter by parent job ID (show sub-jobs of a specific flow)").option("--is-flow-step", "Show only flow step jobs");
|
|
96525
|
-
var
|
|
96526
|
-
var job_default =
|
|
96655
|
+
var command35 = listOptions(new Command().description("Manage jobs (list, inspect, cancel)")).action(list13).command("list", listOptions(new Command().description("List recent jobs"))).action(list13).command("get", "Get job details. For flows: shows step tree with sub-job IDs").arguments("<id:string>").option("--json", "Output as JSON (for piping to jq)").action(get10).command("result", "Get the result of a completed job (machine-friendly)").arguments("<id:string>").action(result).command("logs", "Get job logs. For flows: aggregates all step logs").arguments("<id:string>").action(logs).command("cancel", "Cancel a running or queued job").arguments("<id:string>").option("--reason <reason:string>", "Reason for cancellation").action(cancel).command("rerun", "Re-run a completed job with the same args. Prints the new job UUID on stdout.").arguments("<id:string>").action(rerun).command("restart", "Restart a completed flow at a given top-level step. Prints the new flow job UUID on stdout.").arguments("<id:string>").option("--step <stepId:string>", "Top-level step id to restart the flow from", { required: true }).option("--iteration <n:number>", "For a top-level branchall or for-loop step, the iteration to restart at").action(restart);
|
|
96656
|
+
var job_default = command35;
|
|
96527
96657
|
|
|
96528
96658
|
// src/commands/group/group.ts
|
|
96529
96659
|
init_mod3();
|
|
@@ -96622,8 +96752,8 @@ async function removeUser(opts, name, username) {
|
|
|
96622
96752
|
});
|
|
96623
96753
|
info(colors.green(`User '${username}' removed from group '${name}'.`));
|
|
96624
96754
|
}
|
|
96625
|
-
var
|
|
96626
|
-
var group_default =
|
|
96755
|
+
var command36 = new Command().description("Manage workspace groups").option("--json", "Output as JSON (for piping to jq)").action(list14).command("list", "List all groups in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list14).command("get", "Get group details and members").arguments("<name:string>").option("--json", "Output as JSON (for piping to jq)").action(get11).command("create", "Create a new group").arguments("<name:string>").option("--summary <summary:string>", "Group summary/description").action(create).command("delete", "Delete a group").arguments("<name:string>").action(deleteGroup2).command("add-user", "Add a user to a group").arguments("<name:string> <username:string>").action(addUser2).command("remove-user", "Remove a user from a group").arguments("<name:string> <username:string>").action(removeUser);
|
|
96756
|
+
var group_default = command36;
|
|
96627
96757
|
|
|
96628
96758
|
// src/commands/audit/audit.ts
|
|
96629
96759
|
init_mod3();
|
|
@@ -96700,8 +96830,8 @@ async function get12(opts, id) {
|
|
|
96700
96830
|
}
|
|
96701
96831
|
}
|
|
96702
96832
|
var auditListOptions = (cmd) => cmd.option("--json", "Output as JSON (for piping to jq)").option("--username <username:string>", "Filter by username").option("--operation <operation:string>", "Filter by operation (exact or prefix)").option("--action-kind <actionKind:string>", "Filter by action kind (Create, Update, Delete, Execute)").option("--before <before:string>", "Filter events before this timestamp").option("--after <after:string>", "Filter events after this timestamp").option("--limit <limit:number>", "Number of entries to return (default 30, max 100)");
|
|
96703
|
-
var
|
|
96704
|
-
var audit_default =
|
|
96833
|
+
var command37 = auditListOptions(new Command().description("View audit logs (requires admin)")).action(list15).command("list", auditListOptions(new Command().description("List audit log entries"))).action(list15).command("get", "Get a specific audit log entry").arguments("<id:string>").option("--json", "Output as JSON (for piping to jq)").action(get12);
|
|
96834
|
+
var audit_default = command37;
|
|
96705
96835
|
|
|
96706
96836
|
// src/commands/token/token.ts
|
|
96707
96837
|
init_mod3();
|
|
@@ -96755,8 +96885,8 @@ async function deleteToken2(opts, tokenPrefix) {
|
|
|
96755
96885
|
await deleteToken({ tokenPrefix });
|
|
96756
96886
|
info(colors.green(`Token with prefix '${tokenPrefix}' deleted.`));
|
|
96757
96887
|
}
|
|
96758
|
-
var
|
|
96759
|
-
var token_default =
|
|
96888
|
+
var command38 = new Command().description("Manage API tokens").option("--json", "Output as JSON (for piping to jq)").action(list16).command("list", "List API tokens").option("--json", "Output as JSON (for piping to jq)").action(list16).command("create", "Create a new API token").option("--label <label:string>", "Token label").option("--expiration <expiration:string>", "Token expiration (ISO 8601 timestamp)").action(create2).command("delete", "Delete a token by its prefix").arguments("<token_prefix:string>").action(deleteToken2);
|
|
96889
|
+
var token_default = command38;
|
|
96760
96890
|
|
|
96761
96891
|
// src/main.ts
|
|
96762
96892
|
await init_generate_metadata();
|
|
@@ -96817,8 +96947,8 @@ ${await res.text()}`);
|
|
|
96817
96947
|
console.log();
|
|
96818
96948
|
}
|
|
96819
96949
|
}
|
|
96820
|
-
var
|
|
96821
|
-
var docs_default =
|
|
96950
|
+
var command39 = new Command().name("docs").description("Search Windmill documentation.").arguments("<query:string>").option("--json", "Output results as JSON.").action(docs);
|
|
96951
|
+
var docs_default = command39;
|
|
96822
96952
|
|
|
96823
96953
|
// src/commands/config/config.ts
|
|
96824
96954
|
init_mod3();
|
|
@@ -96888,8 +97018,8 @@ async function migrateAction() {
|
|
|
96888
97018
|
info(` Also removed additional legacy keys: ${legacyKeys.slice(1).join(", ")}`);
|
|
96889
97019
|
}
|
|
96890
97020
|
}
|
|
96891
|
-
var
|
|
96892
|
-
var config_default =
|
|
97021
|
+
var command40 = new Command().name("config").description("Show all available wmill.yaml configuration options").option("--json", "Output as JSON for programmatic consumption").action(configAction).command("migrate").description("Migrate wmill.yaml from gitBranches/environments to workspaces format").action(migrateAction);
|
|
97022
|
+
var config_default = command40;
|
|
96893
97023
|
|
|
96894
97024
|
// src/commands/datatable/datatable.ts
|
|
96895
97025
|
init_mod3();
|
|
@@ -98235,16 +98365,16 @@ async function startServe(opts) {
|
|
|
98235
98365
|
error(`server error: ${err.message}`);
|
|
98236
98366
|
process.exitCode = 1;
|
|
98237
98367
|
});
|
|
98238
|
-
await new Promise((
|
|
98368
|
+
await new Promise((resolve11) => server.listen(port, host, () => resolve11()));
|
|
98239
98369
|
return {
|
|
98240
98370
|
host,
|
|
98241
98371
|
port,
|
|
98242
98372
|
user: DEFAULT_USER,
|
|
98243
98373
|
password,
|
|
98244
98374
|
connectionString: (datatableName) => `postgresql://${DEFAULT_USER}:${encodeURIComponent(password)}@${host}:${port}/${encodeURIComponent(datatableName)}`,
|
|
98245
|
-
close: () => new Promise((
|
|
98246
|
-
server.close(() =>
|
|
98247
|
-
setTimeout(
|
|
98375
|
+
close: () => new Promise((resolve11) => {
|
|
98376
|
+
server.close(() => resolve11());
|
|
98377
|
+
setTimeout(resolve11, 1000).unref();
|
|
98248
98378
|
})
|
|
98249
98379
|
};
|
|
98250
98380
|
}
|
|
@@ -98753,13 +98883,13 @@ async function psql(opts) {
|
|
|
98753
98883
|
}
|
|
98754
98884
|
handle.close().finally(() => process.exit(1));
|
|
98755
98885
|
});
|
|
98756
|
-
const exitCode = await new Promise((
|
|
98886
|
+
const exitCode = await new Promise((resolve11) => {
|
|
98757
98887
|
child.on("exit", (code2, signal) => {
|
|
98758
98888
|
if (signal && typeof signal === "string") {
|
|
98759
98889
|
const num = signalToNumber(signal);
|
|
98760
|
-
|
|
98890
|
+
resolve11(num !== undefined ? 128 + num : 1);
|
|
98761
98891
|
} else {
|
|
98762
|
-
|
|
98892
|
+
resolve11(code2 ?? 0);
|
|
98763
98893
|
}
|
|
98764
98894
|
});
|
|
98765
98895
|
});
|
|
@@ -98857,8 +98987,8 @@ async function serve2(opts) {
|
|
|
98857
98987
|
async function psql2(opts) {
|
|
98858
98988
|
await psql(opts);
|
|
98859
98989
|
}
|
|
98860
|
-
var
|
|
98861
|
-
var datatable_default =
|
|
98990
|
+
var command41 = new Command().description("datatable related commands").command("list", "list all datatables in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list17).command("run", "run a SQL query on a datatable").arguments("<sql:string>").option("-n --name <name:string>", "Datatable name (default: main)").option("-s --silent", "Output only the final result as JSON. Useful for scripting.").action(run4).command("migrate", migrateCommand).command("create", "register a datatable database in the workspace (default: instance-backed 'main') so scripts can use datatable://<name>").arguments("[name:string]").option("--resource <resource:string>", "Back the datatable with an existing postgresql resource path instead of the instance database").option("--force", "Allow adding to a workspace that already has datatables (fork metadata on existing ones is not preserved)").action(create3).command("serve", "Serve all datatables as a Postgres-wire endpoint (psql, DBeaver, pgAdmin); the client picks the datatable via the database name in its connection string").option("--port <port:number>", "Port to listen on (default: first free port in 5433-5500)").option("--host <host:string>", "Bind address (default: 127.0.0.1)").option("--password <password:string>", "Password for Postgres clients (default: generate a random password at startup)").action(serve2).command("psql", "Start a serve listener and launch psql connected to it").option("-n --name <name:string>", "Datatable to connect psql to (default: main)").option("--port <port:number>", "Port the proxy listens on (default: first free port in 5433-5500)").option("--host <host:string>", "Bind address for the proxy (default: 127.0.0.1)").option("--password <password:string>", "Password for the temporary Postgres proxy (default: generate a random password at startup)").action(psql2);
|
|
98991
|
+
var datatable_default = command41;
|
|
98862
98992
|
|
|
98863
98993
|
// src/commands/pipeline/pipeline.ts
|
|
98864
98994
|
init_mod3();
|
|
@@ -98874,10 +99004,10 @@ await __promiseAll([
|
|
|
98874
99004
|
|
|
98875
99005
|
// src/commands/pipeline/boundedCascade.ts
|
|
98876
99006
|
var SCRIPT_PREFIX = "script:";
|
|
98877
|
-
var scriptNodeId = (
|
|
99007
|
+
var scriptNodeId = (path25) => `${SCRIPT_PREFIX}${path25}`;
|
|
98878
99008
|
var isScriptNode = (id) => id.startsWith(SCRIPT_PREFIX);
|
|
98879
99009
|
var scriptPathOf = (id) => id.slice(SCRIPT_PREFIX.length);
|
|
98880
|
-
var assetNodeId = (kind,
|
|
99010
|
+
var assetNodeId = (kind, path25) => `${kind}:${path25}`;
|
|
98881
99011
|
var NON_AUTORUN_TRIGGER_KINDS = new Set([
|
|
98882
99012
|
"kafka",
|
|
98883
99013
|
"mqtt",
|
|
@@ -99112,9 +99242,9 @@ await __promiseAll([
|
|
|
99112
99242
|
init_script_common(),
|
|
99113
99243
|
init_conf()
|
|
99114
99244
|
]);
|
|
99115
|
-
import * as
|
|
99116
|
-
import * as
|
|
99117
|
-
import
|
|
99245
|
+
import * as fs19 from "node:fs";
|
|
99246
|
+
import * as path25 from "node:path";
|
|
99247
|
+
import process26 from "node:process";
|
|
99118
99248
|
|
|
99119
99249
|
// src/commands/pipeline/duckdbMacros.ts
|
|
99120
99250
|
function stripKw(s2, kw) {
|
|
@@ -99346,7 +99476,7 @@ function parseMacroAnnotations(content) {
|
|
|
99346
99476
|
// src/commands/pipeline/localGraph.ts
|
|
99347
99477
|
function workspaceRoot() {
|
|
99348
99478
|
const yaml = getWmillYamlPath();
|
|
99349
|
-
return yaml ?
|
|
99479
|
+
return yaml ? path25.dirname(yaml) : process26.cwd();
|
|
99350
99480
|
}
|
|
99351
99481
|
function wasmFnForLanguage(language) {
|
|
99352
99482
|
switch (language) {
|
|
@@ -99575,14 +99705,14 @@ async function collectScripts(folderDir, root, defaultTs2) {
|
|
|
99575
99705
|
function walk(dir) {
|
|
99576
99706
|
let entries;
|
|
99577
99707
|
try {
|
|
99578
|
-
entries =
|
|
99708
|
+
entries = fs19.readdirSync(dir, { withFileTypes: true });
|
|
99579
99709
|
} catch {
|
|
99580
99710
|
return;
|
|
99581
99711
|
}
|
|
99582
99712
|
for (const e2 of entries) {
|
|
99583
99713
|
if (e2.name.startsWith(".") || e2.name === "node_modules")
|
|
99584
99714
|
continue;
|
|
99585
|
-
const abs =
|
|
99715
|
+
const abs = path25.join(dir, e2.name);
|
|
99586
99716
|
if (e2.isDirectory()) {
|
|
99587
99717
|
walk(abs);
|
|
99588
99718
|
continue;
|
|
@@ -99592,7 +99722,7 @@ async function collectScripts(folderDir, root, defaultTs2) {
|
|
|
99592
99722
|
const ext2 = exts.find((x3) => e2.name.endsWith(x3));
|
|
99593
99723
|
if (!ext2)
|
|
99594
99724
|
continue;
|
|
99595
|
-
const relFromRoot =
|
|
99725
|
+
const relFromRoot = path25.relative(root, abs).replaceAll("\\", "/");
|
|
99596
99726
|
let language;
|
|
99597
99727
|
try {
|
|
99598
99728
|
language = inferContentTypeFromFilePath(abs, defaultTs2);
|
|
@@ -99601,7 +99731,7 @@ async function collectScripts(folderDir, root, defaultTs2) {
|
|
|
99601
99731
|
}
|
|
99602
99732
|
out.push({
|
|
99603
99733
|
path: removeExtensionToPath(relFromRoot),
|
|
99604
|
-
content:
|
|
99734
|
+
content: fs19.readFileSync(abs, "utf-8"),
|
|
99605
99735
|
language
|
|
99606
99736
|
});
|
|
99607
99737
|
}
|
|
@@ -99611,11 +99741,11 @@ async function collectScripts(folderDir, root, defaultTs2) {
|
|
|
99611
99741
|
return out;
|
|
99612
99742
|
}
|
|
99613
99743
|
function hideDbtRunnables(graph) {
|
|
99614
|
-
const key = (usage_kind,
|
|
99744
|
+
const key = (usage_kind, path26) => `${usage_kind}:${path26}`;
|
|
99615
99745
|
const dbtKeys = new Set((graph.runnables ?? []).filter((r2) => r2.dbt).map((r2) => key(r2.usage_kind, r2.path)));
|
|
99616
99746
|
if (dbtKeys.size === 0)
|
|
99617
99747
|
return graph;
|
|
99618
|
-
const kept = (usage_kind,
|
|
99748
|
+
const kept = (usage_kind, path26) => !dbtKeys.has(key(usage_kind, path26));
|
|
99619
99749
|
return {
|
|
99620
99750
|
...graph,
|
|
99621
99751
|
runnables: graph.runnables.filter((r2) => kept(r2.usage_kind, r2.path)),
|
|
@@ -99631,7 +99761,7 @@ function hideDbtRunnables(graph) {
|
|
|
99631
99761
|
}
|
|
99632
99762
|
async function buildLocalPipelineGraph(args) {
|
|
99633
99763
|
const folderClean = args.folder.replace(/^f\//, "").replace(/\/$/, "");
|
|
99634
|
-
const folderDir =
|
|
99764
|
+
const folderDir = path25.join(args.root, "f", folderClean);
|
|
99635
99765
|
const all = await collectScripts(folderDir, args.root, args.defaultTs);
|
|
99636
99766
|
const libMacros = collectMacroLibraries(args.root);
|
|
99637
99767
|
const runnables = [];
|
|
@@ -99865,14 +99995,14 @@ function collectMacroLibraries(root) {
|
|
|
99865
99995
|
const walk = (dir) => {
|
|
99866
99996
|
let entries;
|
|
99867
99997
|
try {
|
|
99868
|
-
entries =
|
|
99998
|
+
entries = fs19.readdirSync(dir, { withFileTypes: true });
|
|
99869
99999
|
} catch {
|
|
99870
100000
|
return;
|
|
99871
100001
|
}
|
|
99872
100002
|
for (const e2 of entries) {
|
|
99873
100003
|
if (e2.name.startsWith(".") || e2.name === "node_modules")
|
|
99874
100004
|
continue;
|
|
99875
|
-
const abs =
|
|
100005
|
+
const abs = path25.join(dir, e2.name);
|
|
99876
100006
|
if (e2.isDirectory()) {
|
|
99877
100007
|
walk(abs);
|
|
99878
100008
|
continue;
|
|
@@ -99881,17 +100011,17 @@ function collectMacroLibraries(root) {
|
|
|
99881
100011
|
continue;
|
|
99882
100012
|
let content;
|
|
99883
100013
|
try {
|
|
99884
|
-
content =
|
|
100014
|
+
content = fs19.readFileSync(abs, "utf-8");
|
|
99885
100015
|
} catch {
|
|
99886
100016
|
continue;
|
|
99887
100017
|
}
|
|
99888
100018
|
if (!parseMacroAnnotations(content).macros)
|
|
99889
100019
|
continue;
|
|
99890
|
-
const relFromRoot =
|
|
100020
|
+
const relFromRoot = path25.relative(root, abs).replaceAll("\\", "/");
|
|
99891
100021
|
out.set(removeExtensionToPath(relFromRoot), parseMacroLibrary(content));
|
|
99892
100022
|
}
|
|
99893
100023
|
};
|
|
99894
|
-
walk(
|
|
100024
|
+
walk(path25.join(root, "f"));
|
|
99895
100025
|
return out;
|
|
99896
100026
|
}
|
|
99897
100027
|
function buildMacroEdges(all, libMacros, runnables) {
|
|
@@ -99996,25 +100126,25 @@ await __promiseAll([
|
|
|
99996
100126
|
init_codebase()
|
|
99997
100127
|
]);
|
|
99998
100128
|
import * as http4 from "node:http";
|
|
99999
|
-
import * as
|
|
100000
|
-
import * as
|
|
100129
|
+
import * as fs20 from "node:fs";
|
|
100130
|
+
import * as path26 from "node:path";
|
|
100001
100131
|
import { createHash as createHash3, randomBytes as randomBytes2 } from "node:crypto";
|
|
100002
|
-
import
|
|
100132
|
+
import process27 from "node:process";
|
|
100003
100133
|
var PORT2 = 3201;
|
|
100004
100134
|
var LISTEN_HOST = "127.0.0.1";
|
|
100005
100135
|
async function stableWsToken(remote, workspaceId, root, folder, port) {
|
|
100006
100136
|
const key = createHash3("sha256").update(`${remote}\x00${workspaceId}\x00${root}\x00${folder}\x00${port}`).digest("hex").slice(0, 32);
|
|
100007
100137
|
let tokenFile;
|
|
100008
100138
|
try {
|
|
100009
|
-
tokenFile =
|
|
100010
|
-
const existing =
|
|
100139
|
+
tokenFile = path26.join(await getConfigDirPath(), `pipeline-dev-${key}.token`);
|
|
100140
|
+
const existing = fs20.readFileSync(tokenFile, "utf-8").trim();
|
|
100011
100141
|
if (existing)
|
|
100012
100142
|
return existing;
|
|
100013
100143
|
} catch {}
|
|
100014
100144
|
const token = randomBytes2(24).toString("base64url");
|
|
100015
100145
|
if (tokenFile) {
|
|
100016
100146
|
try {
|
|
100017
|
-
|
|
100147
|
+
fs20.writeFileSync(tokenFile, token, { mode: 384 });
|
|
100018
100148
|
} catch {}
|
|
100019
100149
|
}
|
|
100020
100150
|
return token;
|
|
@@ -100022,7 +100152,7 @@ async function stableWsToken(remote, workspaceId, root, folder, port) {
|
|
|
100022
100152
|
function resolveFolder(root, folderArg) {
|
|
100023
100153
|
if (folderArg)
|
|
100024
100154
|
return folderArg.replace(/^f\//, "").replace(/\/$/, "");
|
|
100025
|
-
const rel =
|
|
100155
|
+
const rel = path26.relative(root, process27.cwd()).replaceAll("\\", "/");
|
|
100026
100156
|
if (rel === "" || rel.startsWith(".."))
|
|
100027
100157
|
return;
|
|
100028
100158
|
const segs = rel.split("/");
|
|
@@ -100035,12 +100165,12 @@ async function dev3(opts, folderArg) {
|
|
|
100035
100165
|
const folder = resolveFolder(root, folderArg);
|
|
100036
100166
|
if (!folder) {
|
|
100037
100167
|
error(colors.red("Could not determine the pipeline folder. Pass it explicitly " + "(`wmill pipeline dev <folder>`) or run from inside an `f/<folder>` directory."));
|
|
100038
|
-
|
|
100168
|
+
process27.exit(1);
|
|
100039
100169
|
}
|
|
100040
|
-
const folderDir =
|
|
100041
|
-
if (!
|
|
100170
|
+
const folderDir = path26.join(root, "f", folder);
|
|
100171
|
+
if (!fs20.existsSync(folderDir)) {
|
|
100042
100172
|
error(colors.red(`Folder not found on disk: ${folderDir}`));
|
|
100043
|
-
|
|
100173
|
+
process27.exit(1);
|
|
100044
100174
|
}
|
|
100045
100175
|
const workspace = await resolveWorkspace(opts);
|
|
100046
100176
|
await requireLogin(opts);
|
|
@@ -100083,7 +100213,7 @@ async function dev3(opts, folderArg) {
|
|
|
100083
100213
|
}
|
|
100084
100214
|
}
|
|
100085
100215
|
let timer;
|
|
100086
|
-
const watcher =
|
|
100216
|
+
const watcher = fs20.watch(folderDir, { recursive: true });
|
|
100087
100217
|
watcher.on("change", (_ev, filename) => {
|
|
100088
100218
|
if (filename && filename.toString().endsWith(".lock"))
|
|
100089
100219
|
return;
|
|
@@ -100138,18 +100268,18 @@ async function dev3(opts, folderArg) {
|
|
|
100138
100268
|
open_default(url).catch((e2) => warn(colors.yellow(`Failed to open browser: ${e2.message}`)));
|
|
100139
100269
|
}
|
|
100140
100270
|
});
|
|
100141
|
-
|
|
100271
|
+
process27.on("SIGINT", () => {
|
|
100142
100272
|
info(colors.yellow(`
|
|
100143
100273
|
\uD83D\uDED1 Shutting down…`));
|
|
100144
100274
|
watcher.close();
|
|
100145
100275
|
for (const ws of clients)
|
|
100146
100276
|
ws.close();
|
|
100147
100277
|
server.close();
|
|
100148
|
-
|
|
100278
|
+
process27.exit(0);
|
|
100149
100279
|
});
|
|
100150
100280
|
}
|
|
100151
|
-
var
|
|
100152
|
-
var dev_default3 =
|
|
100281
|
+
var command42 = new Command().description("Live-preview a data pipeline from local files: watch an `f/<folder>` of `// pipeline` scripts, push the working-tree graph to the dev page, and run the cascade via preview (no deploy).").arguments("[folder:string]").option("--port <port:number>", "Port for the dev WebSocket server.").option("--no-open", "Do not open the browser automatically.").option("--frontend <origin:string>", "Origin serving the /pipeline_dev page (e.g. http://localhost:3000 for a locally-run frontend). Defaults to the workspace remote; use it when the remote's deployed frontend predates the dev page.").action(dev3);
|
|
100282
|
+
var dev_default3 = command42;
|
|
100153
100283
|
|
|
100154
100284
|
// src/commands/pipeline/docs.ts
|
|
100155
100285
|
init_gen();
|
|
@@ -100162,8 +100292,8 @@ await __promiseAll([
|
|
|
100162
100292
|
init_conf()
|
|
100163
100293
|
]);
|
|
100164
100294
|
import { writeFile as writeFile25 } from "node:fs/promises";
|
|
100165
|
-
import { existsSync as
|
|
100166
|
-
import * as
|
|
100295
|
+
import { existsSync as existsSync20, readFileSync as readFileSync8 } from "node:fs";
|
|
100296
|
+
import * as path27 from "node:path";
|
|
100167
100297
|
var ASSET_KINDS = "s3object,ducklake,datatable,volume,dbt";
|
|
100168
100298
|
function assetUri(kind, p3) {
|
|
100169
100299
|
const prefix = kind === "s3object" ? "s3" : kind;
|
|
@@ -100371,8 +100501,8 @@ async function generatePipelineDocs(opts, folder) {
|
|
|
100371
100501
|
}
|
|
100372
100502
|
}
|
|
100373
100503
|
const md = generatePipelineMarkdown(f3, graph, datatableSchemas, !!opts.local);
|
|
100374
|
-
const folderDir =
|
|
100375
|
-
await writeFile25(
|
|
100504
|
+
const folderDir = path27.join(root, "f", f3);
|
|
100505
|
+
await writeFile25(path27.join(folderDir, "PIPELINE.md"), md, "utf-8");
|
|
100376
100506
|
const written = ["PIPELINE.md"];
|
|
100377
100507
|
const pointers = [
|
|
100378
100508
|
["AGENTS.md", `See @PIPELINE.md for this pipeline's graph, assets, and how to run it.
|
|
@@ -100381,8 +100511,8 @@ async function generatePipelineDocs(opts, folder) {
|
|
|
100381
100511
|
`]
|
|
100382
100512
|
];
|
|
100383
100513
|
for (const [name, content] of pointers) {
|
|
100384
|
-
const p3 =
|
|
100385
|
-
if (
|
|
100514
|
+
const p3 = path27.join(folderDir, name);
|
|
100515
|
+
if (existsSync20(p3)) {
|
|
100386
100516
|
let existing;
|
|
100387
100517
|
try {
|
|
100388
100518
|
existing = readFileSync8(p3, "utf-8");
|
|
@@ -100457,13 +100587,13 @@ function s3Arg(param, obj) {
|
|
|
100457
100587
|
}
|
|
100458
100588
|
|
|
100459
100589
|
// src/commands/pipeline/pipeline.ts
|
|
100460
|
-
async function apiGet(
|
|
100461
|
-
const response = await fetch(`${OpenAPI.BASE}${
|
|
100590
|
+
async function apiGet(path28) {
|
|
100591
|
+
const response = await fetch(`${OpenAPI.BASE}${path28}`, {
|
|
100462
100592
|
headers: { Authorization: `Bearer ${OpenAPI.TOKEN}` }
|
|
100463
100593
|
});
|
|
100464
100594
|
if (!response.ok) {
|
|
100465
100595
|
const body = await response.text();
|
|
100466
|
-
throw new Error(`GET ${
|
|
100596
|
+
throw new Error(`GET ${path28} -> ${response.status}: ${body}`);
|
|
100467
100597
|
}
|
|
100468
100598
|
return await response.json();
|
|
100469
100599
|
}
|
|
@@ -100482,9 +100612,9 @@ async function list18(opts) {
|
|
|
100482
100612
|
}
|
|
100483
100613
|
}
|
|
100484
100614
|
var ASSET_KINDS2 = "s3object,ducklake,datatable,volume,dbt";
|
|
100485
|
-
function assetUri2(kind,
|
|
100615
|
+
function assetUri2(kind, path28) {
|
|
100486
100616
|
const prefix = kind === "s3object" ? "s3" : kind;
|
|
100487
|
-
return `${prefix}://${
|
|
100617
|
+
return `${prefix}://${path28}`;
|
|
100488
100618
|
}
|
|
100489
100619
|
function shortName(scriptPath) {
|
|
100490
100620
|
return scriptPath.split("/").pop() ?? scriptPath;
|
|
@@ -101040,8 +101170,8 @@ Full logs: ${runUrl}`);
|
|
|
101040
101170
|
info(colors.green.bold(`Bounded run complete — ${order.length} script(s) succeeded.`));
|
|
101041
101171
|
}
|
|
101042
101172
|
}
|
|
101043
|
-
var
|
|
101044
|
-
var pipeline_default =
|
|
101173
|
+
var command43 = new Command().description("inspect asset-driven pipelines (scripts marked `// pipeline`, wired by `// on <spec>` annotations)").command("list", "list pipeline folders in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list18).command("show", "render a pipeline folder's DAG (sources, lineage, subscriptions) in the terminal").arguments("<folder:string>").option("--json", "Output the raw asset graph as JSON").option("--local", "Build the graph from local working-tree files (// pipeline scripts) instead of the deployed workspace — no deploy needed.").action(show2).command("run", "run a cascade: from --from (a root OR any mid-DAG model), fan downstream up to the --to end node(s)").arguments("<folder:string>").option("--from <script:string>", "Start script (short name or path). May be any node, including a mid-DAG model — that node plus its transitive downstream runs, upstream is NOT re-run (dbt `--select model+`). Defaults to the folder's sole schedule/manual root.").option("--to <node:string>", "End node(s) to stop at — script names/paths or asset URIs (e.g. datatable://main/staged). Repeatable or comma-separated. Omit to run the full downstream.", { collect: true }).option("--dry-run", "Print the topological run plan without executing.").option("--json", "Output the plan as JSON (for piping to jq).").option("--local", "Run the local working-tree scripts via preview (no deploy) instead of the deployed versions; the graph is built from local files.").option("--upload <binding:string>", "Bind an object to a data_upload/webhook entry point so it runs in the cascade, as SCRIPT[:PARAM]=SOURCE (SOURCE is a local file or an s3://key). Local files are uploaded to the workspace store; the S3Object param is inferred when the script has exactly one. Repeatable.", { collect: true }).option("--arg <binding:string>", "Pass a plain run arg to a script in the cascade, as SCRIPT:PARAM=VALUE (VALUE is parsed as JSON when possible, else taken as a string — e.g. daily_report:partition=2026-07-02). Repeatable.", { collect: true }).option("--partition <value:string>", "Partition value for `// partitioned` scripts in the run (e.g. 2026-06-30) — use it to backfill a past slice. With --local, time kinds (daily/hourly/weekly/monthly) default to the current UTC period when omitted; `dynamic` always needs it. Deployed runs without it defer to backend run-start resolution.").action(run5).command("docs", "generate PIPELINE.md (+ AGENTS.md pointer) describing a folder's pipeline graph and datatable schemas, for an editor / agentic loop").arguments("<folder:string>").option("--local", "Build the graph from local working-tree files instead of the deployed workspace.").action(generatePipelineDocs).command("dev", dev_default3);
|
|
101174
|
+
var pipeline_default = command43;
|
|
101045
101175
|
|
|
101046
101176
|
// src/commands/ducklake/ducklake.ts
|
|
101047
101177
|
init_mod3();
|
|
@@ -101071,8 +101201,8 @@ async function run6(opts, sql) {
|
|
|
101071
101201
|
const name = opts.name ?? DEFAULT_DUCKLAKE_NAME;
|
|
101072
101202
|
await runCatalogQuery(opts, "ducklake", name, sql);
|
|
101073
101203
|
}
|
|
101074
|
-
var
|
|
101075
|
-
var ducklake_default =
|
|
101204
|
+
var command44 = new Command().description("ducklake related commands").command("list", "list all ducklakes in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list19).command("run", "run a SQL query on a ducklake").arguments("<sql:string>").option("-n --name <name:string>", "Ducklake name (default: main)").option("-s --silent", "Output only the final result as JSON. Useful for scripting.").action(run6);
|
|
101205
|
+
var ducklake_default = command44;
|
|
101076
101206
|
|
|
101077
101207
|
// src/commands/object-storage/object-storage.ts
|
|
101078
101208
|
init_mod3();
|
|
@@ -101273,8 +101403,8 @@ async function preview3(opts, fileKey) {
|
|
|
101273
101403
|
`);
|
|
101274
101404
|
}
|
|
101275
101405
|
}
|
|
101276
|
-
var
|
|
101277
|
-
var object_storage_default =
|
|
101406
|
+
var command45 = new Command().alias("s3").description("Object storage (S3) related commands. Operates on the workspace's default object storage; use --storage to target a configured secondary storage.").action(listStorages).command("list", "List configured object storages for the workspace (default + secondary).").option("--json", "Output as JSON (for piping to jq)").action(listStorages).command("files", "List files in an object storage. Optionally filter by prefix.").alias("ls").arguments("[prefix:string]").option("--json", "Output as JSON (for piping to jq)").option("--max-keys <maxKeys:number>", "Page size (default 100)").option("--marker <marker:string>", "Pagination marker from a previous response").option("--storage <storage:string>", "Secondary storage name (omit for the workspace default)").action(listFiles).command("upload", "Upload a local file to object storage at the given file key.").arguments("<local_path:string> <file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--content-type <contentType:string>", "Content-Type header to set on the object").option("--content-disposition <contentDisposition:string>", "Content-Disposition header to set on the object").action(upload).command("download", "Download an object to a local file (or stdout). Default output path is the basename of the file key in the current directory.").arguments("<file_key:string> [output_path:string]").option("--storage <storage:string>", "Secondary storage name").option("--stdout", "Write file contents to stdout instead of a file").action(download).command("delete", "Delete an object from object storage. Prompts for confirmation unless --yes is set.").arguments("<file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--yes", "Skip the confirmation prompt").action(del).command("move", "Move an object within the same storage (rename or relocate by key).").arguments("<src_file_key:string> <dest_file_key:string>").option("--storage <storage:string>", "Secondary storage name").action(move).command("info", "Show metadata (size, mime, last-modified) for an object.").arguments("<file_key:string>").option("--json", "Output as JSON (for piping to jq)").option("--storage <storage:string>", "Secondary storage name").action(info2).command("preview", "Preview the contents of an object (text/CSV). Use --bytes-from / --bytes-length to peek at a slice of binary files.").arguments("<file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--mime <mime:string>", "Override the detected mime type (e.g. text/csv)").option("--bytes-from <bytesFrom:number>", "Start offset in bytes").option("--bytes-length <bytesLength:number>", "Number of bytes to read").option("--csv-separator <csvSeparator:string>", "CSV column separator (default ,)").option("--csv-header", "Treat the first CSV row as a header").action(preview3);
|
|
101407
|
+
var object_storage_default = command45;
|
|
101278
101408
|
|
|
101279
101409
|
// src/main.ts
|
|
101280
101410
|
await init_context();
|
|
@@ -101294,7 +101424,7 @@ async function checkVersionSafe(cmd) {
|
|
|
101294
101424
|
}
|
|
101295
101425
|
mainCommand.version(`${currentVersion} (New version available: ${latestVersion}. Run '${mainCommand.getName()} upgrade' to upgrade to the latest version!)`);
|
|
101296
101426
|
}
|
|
101297
|
-
var
|
|
101427
|
+
var command46 = new Command().name("wmill").action(() => info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`)).description("Windmill CLI").globalOption("--workspace <workspace:string>", "Specify the target workspace. This overrides the default workspace.").globalOption("--debug --verbose", "Show debug/verbose logs").globalOption("--show-diffs", "Show diff informations when syncing (may show sensitive informations)").globalOption("--token <token:string>", "Specify an API token. This will override any stored token.").globalOption("--base-url <baseUrl:string>", "Specify the base URL of the API. If used, --token and --workspace are required and no local remote/workspace already set will be used.").globalOption("--config-dir <configDir:string>", "Specify a custom config directory. Overrides WMILL_CONFIG_DIR environment variable and default ~/.config location.").env("HEADERS <headers:string>", `Specify headers to use for all requests. e.g: "HEADERS='h1: v1, h2: v2'"`).version(VERSION).versionOption(false).helpOption("-h, --help", "Show this help.", {
|
|
101298
101428
|
action: async function() {
|
|
101299
101429
|
const self2 = this;
|
|
101300
101430
|
const long = self2.getRawArgs().includes(`--${self2.getHelpOption()?.name}`);
|
|
@@ -101336,20 +101466,20 @@ var command45 = new Command().name("wmill").action(() => info(`Welcome to Windmi
|
|
|
101336
101466
|
error(e2);
|
|
101337
101467
|
info("Try running with sudo and otherwise check the result of the command: npm uninstall windmill-cli && npm install -g windmill-cli");
|
|
101338
101468
|
})).command("completions", new Command().description("Generate shell completions.").command("bash", new Command().description("Generate bash completions.").action(() => {
|
|
101339
|
-
process.stdout.write(generateShellCompletions(
|
|
101469
|
+
process.stdout.write(generateShellCompletions(command46, "bash") + `
|
|
101340
101470
|
`);
|
|
101341
101471
|
})).command("zsh", new Command().description("Generate zsh completions.").action(() => {
|
|
101342
|
-
process.stdout.write(generateShellCompletions(
|
|
101472
|
+
process.stdout.write(generateShellCompletions(command46, "zsh") + `
|
|
101343
101473
|
`);
|
|
101344
101474
|
})).command("fish", new Command().description("Generate fish completions.").action(() => {
|
|
101345
|
-
process.stdout.write(generateShellCompletions(
|
|
101475
|
+
process.stdout.write(generateShellCompletions(command46, "fish") + `
|
|
101346
101476
|
`);
|
|
101347
101477
|
})));
|
|
101348
101478
|
async function main2() {
|
|
101349
101479
|
try {
|
|
101350
101480
|
const args = process.argv.slice(2);
|
|
101351
101481
|
if (args.length === 0) {
|
|
101352
|
-
|
|
101482
|
+
command46.showHelp();
|
|
101353
101483
|
}
|
|
101354
101484
|
const LOG_LEVEL = args.includes("--verbose") || args.includes("--debug") ? "DEBUG" : "INFO";
|
|
101355
101485
|
setShowDiffs(args.includes("--show-diffs"));
|
|
@@ -101369,7 +101499,7 @@ async function main2() {
|
|
|
101369
101499
|
const { warnIfTsconfigStale: warnIfTsconfigStale2 } = await init_tsconfig().then(() => exports_tsconfig);
|
|
101370
101500
|
await warnIfTsconfigStale2().catch(() => {});
|
|
101371
101501
|
}
|
|
101372
|
-
await
|
|
101502
|
+
await command46.parse(args);
|
|
101373
101503
|
} catch (e2) {
|
|
101374
101504
|
if (e2 && typeof e2 === "object" && "name" in e2 && e2.name === "ApiError") {
|
|
101375
101505
|
const body = e2.body;
|
|
@@ -101405,7 +101535,7 @@ if (isMain()) {
|
|
|
101405
101535
|
process.stdin.destroy();
|
|
101406
101536
|
});
|
|
101407
101537
|
}
|
|
101408
|
-
var main_default =
|
|
101538
|
+
var main_default = command46;
|
|
101409
101539
|
export {
|
|
101410
101540
|
add as workspaceAdd,
|
|
101411
101541
|
workspace_default as workspace,
|