From de7739a3ee7ef76a8eb4fe6570ef0bdfbdb92293 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 25 Nov 2025 12:12:49 +0000 Subject: [PATCH] fix(cli): handle better public apps --- cli/src/commands/app/apps.ts | 11 ++++++++--- cli/src/commands/sync/sync.ts | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cli/src/commands/app/apps.ts b/cli/src/commands/app/apps.ts index 1c6baceda2..0fefd7afbc 100644 --- a/cli/src/commands/app/apps.ts +++ b/cli/src/commands/app/apps.ts @@ -18,6 +18,7 @@ import { readInlinePathSync } from "../../utils/utils.ts"; export interface AppFile { value: any; + public?: boolean; summary: string; policy: Policy; } @@ -45,6 +46,10 @@ export async function pushApp( } catch { //ignore } + if (app?.["policy"]?.["execution_mode"] == "anonymous") { + app.public = true; + } + // console.log(app); if (app) { app.policy = undefined; } @@ -80,7 +85,7 @@ export async function pushApp( } replaceInlineScripts(localApp.value); - await generatingPolicy(localApp, remotePath); + await generatingPolicy(localApp, remotePath, localApp?.["public"] ?? false); if (app) { if (isSuperset(localApp, app)) { log.info(colors.green(`App ${remotePath} is up to date`)); @@ -109,11 +114,11 @@ export async function pushApp( } } -async function generatingPolicy(app: any, path: string) { +async function generatingPolicy(app: any, path: string, publicApp: boolean) { log.info(colors.gray(`Generating fresh policy for app ${path}...`)); try { app.policy = await windmillUtils.updatePolicy(app.value, undefined); - app.policy.execution_mode = "publisher"; + app.policy.execution_mode = publicApp ? "anonymous" : "publisher"; } catch (e) { log.error(colors.red(`Error generating policy for app ${path}: ${e}`)); throw e; diff --git a/cli/src/commands/sync/sync.ts b/cli/src/commands/sync/sync.ts index b0e2b74682..d145b03490 100644 --- a/cli/src/commands/sync/sync.ts +++ b/cli/src/commands/sync/sync.ts @@ -415,6 +415,9 @@ function ZipFSElement( }; } + if (app?.["policy"]?.["execution_mode"] == "anonymous") { + app.public = true; + } app.policy = undefined; yield { isDirectory: false,