fix(agent-setup): provision bundled skill extras from inside app.asar
Problem
Every packaged build logs, once per bundled skill at boot:
[agent-setup] Failed to provision skill superset-setup: Error: ENOENT, dist/main/templates/plugin/skills/setup/agents not found in …/app.asar
and the skill's extra files (agents/openai.yaml, scripts/*.sh) never reach the agent directories. Only SKILL.md is written. Development builds are unaffected because the templates are on a real filesystem there.
Cause
copyBundledExtras used fs.promises.cp({ recursive: true }). Node's cp walks directories with opendir, which Electron's asar filesystem shim does not implement, so the walk fails with the shim's ENOENT for a directory that is in the archive. Reproduced inside the packaged Electron (41.10.3, Node 24.18) against app.asar:
call on the agents directory | result |
|---|---|
readdirSync / promises.readdir | ok |
statSync / promises.lstat | ok |
promises.copyFile (a file in it) | ok |
promises.opendir | ENOTDIR |
promises.cp / cpSync recursive | ENOENT … not found in app.asar |
Fix
Copy file by file with the existing listFilesRecursive (readdir-based) plus mkdir and copyFile, which the shim supports. Same output layout as before.
Found while running the Linux desktop acceptance checklist (#7428, row 4.3); it is not Linux-specific, macOS builds hit the same path.
Verification
bun test packages/agent-setup: 323 pass.- Packaged app (AppImage build of #7428 with this patch applied, run on a Linux desktop): zero
Failed to provision skilllines at boot, and~/.claude/skills/superset/skills/<skill>/agents/openai.yamlplus10x/scripts/audit.share present. The same build without the patch logged the ENOENT for every skill.