From 6324160dcc6a7c044b480d2414c9cae7c148365c Mon Sep 17 00:00:00 2001 From: Catfish-75 Date: Fri, 29 May 2026 11:04:32 +0300 Subject: [PATCH] Fix Codex screenshot sharp runtime --- browse/scripts/build-node-server.sh | 1 + bun.lock | 1 + package.json | 1 + setup | 11 ++++++++++- test/gen-skill-docs.test.ts | 9 +++++++-- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/browse/scripts/build-node-server.sh b/browse/scripts/build-node-server.sh index 3ab652ac0..31344b24d 100755 --- a/browse/scripts/build-node-server.sh +++ b/browse/scripts/build-node-server.sh @@ -25,6 +25,7 @@ bun build "$SRC_DIR/server.ts" \ --external playwright \ --external playwright-core \ --external diff \ + --external sharp \ --external "bun:sqlite" \ --external "@ngrok/ngrok" diff --git a/bun.lock b/bun.lock index 96fda00aa..b3320016e 100644 --- a/bun.lock +++ b/bun.lock @@ -11,6 +11,7 @@ "marked": "^18.0.2", "playwright": "^1.58.2", "puppeteer-core": "^24.40.0", + "sharp": "^0.34.5", "socks": "^2.8.8", }, "devDependencies": { diff --git a/package.json b/package.json index eb77faa51..46713d60e 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "marked": "^18.0.2", "playwright": "^1.58.2", "puppeteer-core": "^24.40.0", + "sharp": "^0.34.5", "socks": "^2.8.8" }, "engines": { diff --git a/setup b/setup index d405a3e03..bb897d929 100755 --- a/setup +++ b/setup @@ -687,11 +687,20 @@ link_browse_runtime_assets() { fi # server-node.mjs intentionally externalizes these runtime packages. - for dep in playwright playwright-core diff; do + # sharp is used by screenshot size-guard and needs its platform-specific + # native @img/* sidecars present in the copied Codex runtime root. + for dep in playwright playwright-core diff sharp semver detect-libc; do if [ -d "$gstack_dir/node_modules/$dep" ]; then _link_or_copy "$gstack_dir/node_modules/$dep" "$runtime_root/node_modules/$dep" fi done + if [ -d "$gstack_dir/node_modules/@img" ]; then + mkdir -p "$runtime_root/node_modules/@img" + for scoped_dep in "$gstack_dir/node_modules/@img"/*; do + [ -e "$scoped_dep" ] || continue + _link_or_copy "$scoped_dep" "$runtime_root/node_modules/@img/$(basename "$scoped_dep")" + done + fi if [ -d "$gstack_dir/node_modules/@ngrok" ]; then mkdir -p "$runtime_root/node_modules/@ngrok" for scoped_dep in "$gstack_dir/node_modules/@ngrok"/*; do diff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.ts index 1d57288d5..ef686f909 100644 --- a/test/gen-skill-docs.test.ts +++ b/test/gen-skill-docs.test.ts @@ -2238,6 +2238,8 @@ describe('setup script validation', () => { const root = dep.startsWith('@') ? dep.split('/')[0] : dep; expect(fnBody).toContain(root); } + expect(fnBody).toContain('sharp semver detect-libc'); + expect(fnBody).toContain('node_modules/@img'); expect(setupContent).toContain('link_browse_runtime_assets "$gstack_dir" "$codex_gstack"'); }); @@ -2370,9 +2372,12 @@ describe('setup script validation', () => { const fnStart = setupContent.indexOf('create_codex_runtime_root()'); const fnEnd = setupContent.indexOf('}', setupContent.indexOf('done', setupContent.indexOf('review/', fnStart))); const fnBody = setupContent.slice(fnStart, fnEnd); + const runtimeStart = setupContent.indexOf('link_browse_runtime_assets()'); + const runtimeEnd = setupContent.indexOf('# ─── Helper: create a minimal ~/.codex/skills/gstack runtime root', runtimeStart); + const runtimeBody = setupContent.slice(runtimeStart, runtimeEnd); expect(fnBody).toContain('gstack/SKILL.md'); - expect(fnBody).toContain('browse/dist'); - expect(fnBody).toContain('browse/bin'); + expect(runtimeBody).toContain('browse/dist'); + expect(runtimeBody).toContain('browse/bin'); expect(fnBody).toContain('gstack-upgrade/SKILL.md'); // Review runtime assets (individual files, not the whole dir) expect(fnBody).toContain('checklist.md');