Remove unnecessary /tmp copy + chmod workaround for cursor-agent#98
Remove unnecessary /tmp copy + chmod workaround for cursor-agent#98
Conversation
WalkthroughThe changes remove a temporary file workaround from binary execution by replacing the copy-to-/tmp-and-chmod pattern with direct execution of a bundled node binary. The README documentation is updated to reflect this new approach, and the implementation in Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
cursor-cli-demo/extensions/cursor-cli.ts (2)
59-69:⚠️ Potential issue | 🟡 MinorMissing existence check for
bundledNode.
entryPointis validated on Line 62 butbundledNodeis not. If the bundled node binary is absent,spawnwill throw a genericENOENTwhich is harder to debug than a descriptive error message like the one forentryPoint.Proposed fix
const entryPoint = `${CURSOR_AGENT_DIR}/index.js`; const bundledNode = `${CURSOR_AGENT_DIR}/node`; + if (!existsSync(bundledNode)) { + throw new Error( + `Bundled node binary not found at ${bundledNode}. Contents: ${existsSync(CURSOR_AGENT_DIR) ? readdirSync(CURSOR_AGENT_DIR).join(", ") : "N/A"}`, + ); + } + if (!existsSync(entryPoint)) {
24-25:⚠️ Potential issue | 🟡 MinorStale comment: still references
process.execPath.Line 24 says "so we can invoke with
process.execPathat runtime" but the code now uses the bundled node binary instead. Consider updating to match the new approach.Proposed fix
- // Copy the resolved index.js + deps to a fixed path so we can invoke with process.execPath at runtime + // Copy the resolved index.js + deps (including bundled node) to a fixed path for runtime invocation
Summary by CodeRabbit
Improvements
Documentation