From 1733268d4d593cd5a0bd33c7cc6e45814b800d20 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Mon, 11 May 2026 12:02:16 -0700 Subject: [PATCH] feat: write .comfy_environment marker for desktop builds ComfyUI now reads a .comfy_environment file from its install directory and sends the value as the X-Comfy-Deploy-Env header on partner-node API calls (defaults to 'local-git' when missing). Write 'local-desktop' into assets/ComfyUI/.comfy_environment after the ComfyUI clone in scripts/makeComfy.js so the bundled copy ships with the correct identifier. Also extend scripts/verifyBuild.js to require the marker in both Mac and Windows build outputs, so a missing/dropped dotfile fails CI loudly instead of silently regressing to the local-git default. Mirrors the portable build's existing 'local-portable' marker (ComfyUI commit e35348aa). Amp-Thread-ID: https://ampcode.com/threads/T-019e1852-4349-768a-abb0-b78b78475c8d Co-authored-by: Amp --- scripts/makeComfy.js | 7 +++++++ scripts/verifyBuild.js | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/makeComfy.js b/scripts/makeComfy.js index 12141a720..f33d04a66 100644 --- a/scripts/makeComfy.js +++ b/scripts/makeComfy.js @@ -20,6 +20,13 @@ if (pkg.config.comfyUI.optionalBranch) { const assetsComfyPath = path.join('assets', 'ComfyUI'); const managerRequirementsPath = path.join(assetsComfyPath, 'manager_requirements.txt'); +// Mark this ComfyUI install as the desktop deploy environment. ComfyUI reads +// `.comfy_environment` from its own install directory (next to main.py) and +// sends the value as the `X-Comfy-Deploy-Env` header on partner-node API +// calls. The file is gitignored upstream, so writing it into the freshly +// cloned ComfyUI repo doesn't dirty the working tree. +fs.writeFileSync(path.join(assetsComfyPath, '.comfy_environment'), 'local-desktop\n'); + if (fs.existsSync(managerRequirementsPath)) { console.log('Detected manager_requirements.txt, skipping legacy ComfyUI-Manager clone.'); } else { diff --git a/scripts/verifyBuild.js b/scripts/verifyBuild.js index 0fbb4be7d..4e52bb817 100644 --- a/scripts/verifyBuild.js +++ b/scripts/verifyBuild.js @@ -12,13 +12,14 @@ import path from 'node:path'; const PATHS = /** @type {Record<'mac' | 'windows', VerifyConfig>} */ ({ mac: { base: 'dist/mac-arm64/ComfyUI.app/Contents/Resources', - required: ['ComfyUI', 'UI', 'uv/macos/uv', 'uv/macos/uvx'], + required: ['ComfyUI', 'ComfyUI/.comfy_environment', 'UI', 'uv/macos/uv', 'uv/macos/uvx'], }, windows: { base: 'dist/win-unpacked/resources', required: [ // Add Windows-specific paths here 'ComfyUI', + 'ComfyUI/.comfy_environment', 'UI', 'uv/win/uv.exe', 'uv/win/uvx.exe',