fix(ci): mark @cursor/sdk external in standalone-binary bundle step#147
Merged
Merged
Conversation
The standalone-binary build does a second esbuild pass on top of dist/cli.mjs to produce a single-file bundle per platform. @cursor/sdk was added as an optionalDependency in v0.6.0 (PR #129, Cursor IDE support), and its TypeScript declarations re-export internal workspace paths (`@anysphere/cursor-sdk-local-runtime/*`, `./messages.js`, `./platform.js`, etc.) that esbuild cannot resolve in this pass. Mark @cursor/sdk external. The package stays in optionalDependencies so `npm ci` keeps installing it (npm publish still ships a working package); the AgentSdk factory's dynamic import falls back to the Claude wrapper when the standalone binary is loaded without the SDK present, exactly as for the plugin bundle (build.mjs:74 does the same externalization for the same reason). Repairs the v0.6.0 release-binary failure on tag v0.6.0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.
Why
The
v0.6.0tag push triggeredrelease-binary.ymland the build matrix failed on all 6 platforms (failed run) with:```
✘ [ERROR] Could not resolve "@anysphere/cursor-sdk-local-runtime/run-store"
node_modules/@cursor/sdk/dist/esm/public-api.d.ts:2:189
✘ [ERROR] Could not resolve "./messages.js"
✘ [ERROR] Could not resolve "./platform.js"
... (46 errors total)
```
Diagnosis
release-binary.ymldoes a second-pass esbuild on top ofdist/cli.mjsto produce a single self-contained file per platform. In v0.6.0 we added@cursor/sdkas an optionalDependency for first-class Cursor IDE support (PR #129). Its TypeScript declarations re-export internal workspace paths (@anysphere/cursor-sdk-local-runtime/*,./messages.js,./platform.js, etc.) that don't exist as resolvable modules in the published package — they're build-internal references.build.mjsalready knows about this — the plugin variant marks@cursor/sdkexternal for the exact same reason (build.mjs:74). But the inline esbuild call in the release workflow doesn't pass that flag, so it walks the type re-exports and dies.Fix
One-line workflow change: add
--external:@cursor/sdkto the second-pass esbuild bundle call.Effects:
@cursor/sdkis no longer bundled. The AgentSdk factory's dynamicawait import(\"@cursor/sdk\")returns MODULE_NOT_FOUND and falls back to the Claude wrapper — exactly the path standalone-binary users (curl|bash install, not Cursor) actually need.@cursor/sdkships there via the extension's own bundling path. (Extension publish v0.1.5 succeeded on the same commit.)AxmeAI/axme-code-plugin): unaffected —build.mjsalready externalizes@cursor/sdkfor the plugin variant.@axme/code): unaffected — npm install resolves optionalDependencies independently; users who want Cursor SDK at runtime get it vianpm install.What needs to happen after this PR merges
The
v0.6.0tag has already been pushed and is bound to the broken commit. To re-fire the workflow against the fixed commit, the tag needs to be moved:```bash
After this PR merges, from a fresh main checkout:
git checkout main && git pull origin main
Move v0.6.0 to the fixed commit
git push origin :refs/tags/v0.6.0 # delete remote tag
git tag -d v0.6.0 # delete local tag
git tag v0.6.0 # re-tag at current HEAD (has the fix)
git push origin v0.6.0 # fires release-binary workflow with the fix
```
The previous failed runs are harmless — no GitHub Release was created, no npm publish happened, no plugin-repo sync. The matrix failed before any external side effect, all downstream jobs (
release/publish-npm/sync-plugin-repo) were skipped.Test plan
build.mjsalready uses the sameexternal: [\"@cursor/sdk\"]strategy for the plugin variant — pattern proven🤖 Generated with Claude Code