feat(packaging): build platform-specific VSIXs for native sqlite3#37
Open
albin-paul-saju wants to merge 1 commit into
Open
feat(packaging): build platform-specific VSIXs for native sqlite3#37albin-paul-saju wants to merge 1 commit into
albin-paul-saju wants to merge 1 commit into
Conversation
@cursor/sdk eagerly loads the native sqlite3 module, so a VSIX only works
on the OS/arch whose sqlite3 binary it bundles. Packaging on Linux shipped
a Linux ELF binary that macOS could not dlopen ("slice is not valid mach-o
file"), breaking Cursor.models.list and the rest of the SDK.
- add scripts/package-platforms.ts: per-target build that swaps in the
matching sqlite3 napi prebuild and @cursor/sdk-<target> package, runs
vsce package --target, and restores the host binaries afterwards
- add package:platforms npm script
- make self-update platform-aware: parse the <platform>-<arch> suffix,
match the running client's target, and prefer platform-specific builds
- upload.sh: upload the whole platform set for a version
- .vscodeignore: ship only the runtime sqlite3 binary
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@cursor/sdkeagerly loads the nativesqlite3module at import time, so a VSIX only works on the OS/arch whosesqlite3binary it bundles. Because packaging happens on Linux, the VSIX shipped a Linux ELFnode_sqlite3.node, which macOS cannotdlopen(slice is not valid mach-o file). This brokeCursor.models.list(and the rest of the SDK) on macOS.This PR produces one platform-specific VSIX per target and makes the Uranus self-update pipeline platform-aware.
scripts/package-platforms.ts(new): for each target (darwin-arm64,darwin-x64,linux-x64,linux-arm64,win32-x64) swaps in the matchingsqlite3N-API prebuild (cross-downloadable from Linux since these are ABI-stable) and the matching@cursor/sdk-<target>package, verifies the binary's magic bytes, runsvsce package --target, then restores the host's binaries in afinallyblock. Accepts optional target args to build a subset.package.json: addspackage:platformsscript.src/lib/vscode/selfUpdate.ts: parses the optional-<platform>-<arch>filename suffix, detects the running client's${process.platform}-${process.arch}, and only installs a matching VSIX (suffix-less legacy files kept as a fallback). Prevents a Mac from ever pulling the Linux build.upload.sh: uploads the whole platform set for a chosen version (self-update needs all platforms present on the server)..vscodeignore: ships only the runtimesqlite3binary, trimmingdeps/,src/, and build intermediates.Filename convention:
cursor--gerrit-<version>-<target>.vsix.Test plan
npm run package:platforms darwin-arm64 linux-x64builds both VSIXsnode_sqlite3.node+ only@cursor/sdk-darwin-arm64node_sqlite3.node+ only@cursor/sdk-linux-x64deps//src/trimmed from bundled sqlite3; host binaries restored after packagingtsc, ESLint, Prettier pass onsrc/@cursor/sdk-<target>packages confirmed available for all 5 targetsCursor.models.listsucceeds (noslice is not valid mach-owarning)Notes
Distribution here is the Uranus filer + self-update, not the Marketplace, so
publish.ymlis intentionally left unchanged. Existing Mac clients running the old (non-platform-aware) self-update won't recognize the new suffixed filenames, so the first upgrade on each Mac needs a one-time manual install; self-update handles subsequent updates.Made with Cursor