Skip to content

feat(packaging): build platform-specific VSIXs for native sqlite3#37

Open
albin-paul-saju wants to merge 1 commit into
mainfrom
feat/multi-platform-packaging
Open

feat(packaging): build platform-specific VSIXs for native sqlite3#37
albin-paul-saju wants to merge 1 commit into
mainfrom
feat/multi-platform-packaging

Conversation

@albin-paul-saju

Copy link
Copy Markdown
Collaborator

Summary

@cursor/sdk eagerly loads the native sqlite3 module at import time, so a VSIX only works on the OS/arch whose sqlite3 binary it bundles. Because packaging happens on Linux, the VSIX shipped a Linux ELF node_sqlite3.node, which macOS cannot dlopen (slice is not valid mach-o file). This broke Cursor.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 matching sqlite3 N-API prebuild (cross-downloadable from Linux since these are ABI-stable) and the matching @cursor/sdk-<target> package, verifies the binary's magic bytes, runs vsce package --target, then restores the host's binaries in a finally block. Accepts optional target args to build a subset.
  • package.json: adds package:platforms script.
  • 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 runtime sqlite3 binary, trimming deps/, src/, and build intermediates.

Filename convention: cursor--gerrit-<version>-<target>.vsix.

Test plan

  • npm run package:platforms darwin-arm64 linux-x64 builds both VSIXs
  • darwin-arm64 VSIX contains a Mach-O arm64 node_sqlite3.node + only @cursor/sdk-darwin-arm64
  • linux-x64 VSIX contains an ELF x86-64 node_sqlite3.node + only @cursor/sdk-linux-x64
  • deps//src/ trimmed from bundled sqlite3; host binaries restored after packaging
  • tsc, ESLint, Prettier pass on src/
  • sqlite3 napi-v6 prebuilds + @cursor/sdk-<target> packages confirmed available for all 5 targets
  • Install darwin-arm64 VSIX on a Mac and confirm Cursor.models.list succeeds (no slice is not valid mach-o warning)

Notes

Distribution here is the Uranus filer + self-update, not the Marketplace, so publish.yml is 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

@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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant