diff --git a/config/electron-builder.config.cjs b/config/electron-builder.config.cjs index e731cb7f1..0a96abb6d 100644 --- a/config/electron-builder.config.cjs +++ b/config/electron-builder.config.cjs @@ -83,12 +83,17 @@ module.exports = { '!skill-guides{,/**/*}', '!skill-stubs{,/**/*}', '!tests{,/**/*}', + // Why: examples/ is plugin authoring documentation with no runtime consumer — + // bundled plugins ship via extraResources from resources/plugins/launch/. It also + // carries hostile-panel, the adversarial fixture the containment tests point at, + // which must never reach a user's install. + '!examples{,/**/*}', // Why: pr-evidence/ is a local e2e screenshot output (ORCA_CAPTURE_EVIDENCE); // it is gitignored, but exclude it defensively so a stray local capture at // package time never bloats app.asar. '!pr-evidence{,/**/*}', '!Casks{,/**/*}', - '!{AGENTS.md,CLAUDE.md,DEVELOPING.md,bundle-size-progress.md}', + '!{AGENTS.md,CLAUDE.md,DEVELOPING.md,bundle-size-progress.md,ORCHESTRATION_IMPLEMENTATION_CHECKLIST.md,ORCHESTRATION_STRUCTURED_OUTPUT_DESIGN.md}', '!out/**/*.test.js', // Why: Vite's manifest is only used to project the paired web client. '!out/renderer/.vite{,/**/*}', diff --git a/config/scripts/electron-builder-config.test.mjs b/config/scripts/electron-builder-config.test.mjs index 0d4c7dd71..442b7bd84 100644 --- a/config/scripts/electron-builder-config.test.mjs +++ b/config/scripts/electron-builder-config.test.mjs @@ -6,6 +6,7 @@ import { describe, expect, it } from 'vitest' const require = createRequire(import.meta.url) const electronBuilderConfig = require('../electron-builder.config.cjs') +const { FileMatcher } = require('app-builder-lib/out/fileMatcher') const electronBuilderNativeRebuild = require('./electron-builder-native-rebuild.cjs') const { createPackagedRuntimeNodeModuleResources, @@ -38,15 +39,39 @@ describe('electron-builder config', () => { '!skill-stubs{,/**/*}', '!resources/skills/**', '!tests{,/**/*}', + '!examples{,/**/*}', '!pr-evidence{,/**/*}', '!Casks{,/**/*}', - '!{AGENTS.md,CLAUDE.md,DEVELOPING.md,bundle-size-progress.md}', + '!{AGENTS.md,CLAUDE.md,DEVELOPING.md,bundle-size-progress.md,ORCHESTRATION_IMPLEMENTATION_CHECKLIST.md,ORCHESTRATION_STRUCTURED_OUTPUT_DESIGN.md}', '!out/**/*.test.js', '!resources/plugins/launch/**' ]) ) }) + // Why: `files` is an all-negation list, so electron-builder's default `**/*` packs + // anything without an explicit `!` entry — examples/ landed without one and shipped + // hostile-panel, the adversarial containment fixture, into 1.4.160-rc.3's app.asar. + // Drive the real matcher: pinning the pattern string cannot prove it excludes the tree. + it('keeps plugin authoring examples out of app.asar', () => { + const matcher = new FileMatcher('/app', '/dest', (value) => value, electronBuilderConfig.files) + // copyFiles() prepends this itself once the pattern list is all-negation. + matcher.prependPattern('**/*') + const isPacked = matcher.createFilter() + const packs = (repoPath) => isPacked(join('/app', repoPath), { isDirectory: () => false }) + + for (const authoringOnly of [ + 'examples/plugins/hostile-panel/panel.html', + 'examples/plugins/hostile-panel/orca-plugin.json', + 'examples/plugins/hello-orca/main.mjs', + 'examples/plugins/hello-orca/orca-plugin.json' + ]) { + expect(packs(authoringOnly)).toBe(false) + } + // The negation stays anchored at the app root, so nested `examples` segments still ship. + expect(packs('out/main/examples/index.js')).toBe(true) + }) + it('keeps runtime resources available through extraResources', () => { const bundledPluginResources = expect.objectContaining({ from: 'resources/plugins/launch',