Skip to content

Commit 509c0be

Browse files
George-iamclaude
andcommitted
fix(packaging): keep bundled node_modules/npm in win32-x64 .vsix + add CI verify
User reported v0.1.1 .vsix with bundled Node + npm.cmd STILL failed when enabling search mode: Error: Cannot find module '...\node-runtime\node_modules\npm\bin\npm-cli.js' MODULE_NOT_FOUND Root cause: `.vscodeignore` had `**/node_modules/**` which matches EVERY `node_modules/` at any depth — including the bundled `extension/bin/node-runtime/node_modules/npm/` that we explicitly extracted from the Node Windows zip during CI. So vsce dropped the entire npm package while keeping node.exe + npm.cmd, leaving a "bundled Node" install that couldn't actually run npm. This is the third Windows fix attempt for search-mode. Each previous one was structurally correct but a layer-below bug silently sabotaged it. To stop the cycle, this commit also adds a CI verification step that fails the build if the required files aren't physically inside the .vsix. Files: - extension/.vscodeignore — replaced `**/node_modules/**` (matches any depth) with `node_modules/**` (only the top-level extension/node_modules). The bundled bin/node-runtime/node_modules/ now ships intact. - .github/workflows/publish-extension.yml — new "Verify bundled Node runtime" step on win32-x64. Lists the .vsix via `unzip -l` and asserts each of these is present: extension/bin/axme-code.exe extension/bin/node-runtime/node.exe extension/bin/node-runtime/npm.cmd extension/bin/node-runtime/node_modules/npm/bin/npm-cli.js extension/bin/node-runtime/node_modules/npm/bin/npm-prefix.js Any missing entry fails the build with a clear ::error:: marker. If a future .vscodeignore tweak or vsce update silently drops one of these, CI will catch it BEFORE we ship a broken .vsix to users. Caught the original regression manually on 2026-05-19 — never again. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 33e396d commit 509c0be

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

.github/workflows/publish-extension.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,37 @@ jobs:
204204
working-directory: extension
205205
run: npx vsce package --target ${{ matrix.target }} --no-dependencies -o ../axme-code-${{ matrix.target }}.vsix
206206

207+
- name: Verify bundled Node runtime is inside the win32-x64 .vsix
208+
# A .vsix is just a zip. List its contents and assert that the
209+
# files search-mode needs at runtime are actually present.
210+
# Without this check, an over-broad .vscodeignore pattern (e.g.
211+
# the historical `**/node_modules/**`) silently drops the
212+
# bundled npm package from the package, and we ship a build
213+
# that boots fine on Cursor but explodes the moment a user
214+
# enables semantic search. We caught this once on 2026-05-19;
215+
# never again — this step fails CI if the bundle regresses.
216+
if: matrix.target == 'win32-x64'
217+
shell: bash
218+
run: |
219+
set -euo pipefail
220+
VSIX="axme-code-${{ matrix.target }}.vsix"
221+
REQUIRED=(
222+
"extension/bin/axme-code.exe"
223+
"extension/bin/node-runtime/node.exe"
224+
"extension/bin/node-runtime/npm.cmd"
225+
"extension/bin/node-runtime/node_modules/npm/bin/npm-cli.js"
226+
"extension/bin/node-runtime/node_modules/npm/bin/npm-prefix.js"
227+
)
228+
MANIFEST=$(unzip -l "$VSIX")
229+
for path in "${REQUIRED[@]}"; do
230+
if ! echo "$MANIFEST" | grep -qE " ${path}\$"; then
231+
echo "::error::Missing from $VSIX: $path"
232+
echo "$MANIFEST" | head -40
233+
exit 1
234+
fi
235+
done
236+
echo "OK — all required bundled-Node files are inside $VSIX."
237+
207238
- uses: actions/upload-artifact@v4
208239
with:
209240
name: axme-code-${{ matrix.target }}

extension/.vscodeignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ out-test/**
99
**/.eslintrc*
1010
**/.gitignore
1111
**/build.mjs
12-
**/node_modules/**
12+
# Only exclude extension/node_modules — the bundled Windows Node
13+
# runtime ships its own `bin/node-runtime/node_modules/npm/` which
14+
# IS required at runtime (search-mode `npm install`). The previous
15+
# `**/node_modules/**` pattern silently dropped the bundled npm
16+
# from the .vsix, so on Windows the npm-cli.js spawn failed with
17+
# MODULE_NOT_FOUND on every search-mode enable attempt.
18+
node_modules/**
1319
.github/**
1420
.git/**
1521
**/*.vsix

0 commit comments

Comments
 (0)