feat: add CLI binary to SDK package for npx support#73
feat: add CLI binary to SDK package for npx support#73Prasanna721 wants to merge 3 commits intomainfrom
Conversation
| "supermemory": "dist/bin/cli" | ||
| }, | ||
| "packageManager": "yarn@1.22.22", |
There was a problem hiding this comment.
Bug: The bin/cli file is missing the required #!/usr/bin/env node shebang line, which will prevent it from being executed by npx.
Severity: CRITICAL
Suggested Fix
Add #!/usr/bin/env node as the very first line of the bin/cli file. This will ensure that the operating system correctly uses Node.js to execute the script when a user runs npx supermemory.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not valid. Location: package.json#L12-L14 Potential issue: The `bin/cli` file, which is designated as the executable for the `npx supermemory` command in `package.json`, is missing the `#!/usr/bin/env node` shebang line at the beginning of the file. Without this line, operating systems (including Unix, macOS, and Windows via npm's wrapper) cannot determine which interpreter to use to run the script. As a result, the `npx supermemory` command will fail for all users, preventing the CLI from functioning as intended. Did we get this right? 👍 / 👎 to inform future reviews.
| "bin": { | ||
| "supermemory": "dist/bin/cli" | ||
| }, |
There was a problem hiding this comment.
Bug: The build script copies bin/cli but doesn't explicitly set execute permissions. If the source file lacks them, the published binary will be non-executable.
Severity: HIGH
Suggested Fix
Add a chmod +x dist/bin/cli command to the build script after the cp command. This ensures the binary is always executable, regardless of the permissions of the source file in the repository.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not valid. Location: package.json#L11-L13 Potential issue: The build process copies the compiled binary from `bin/cli` to `dist/bin/cli` using `cp -p`, which preserves file permissions. However, the script does not explicitly set execute permissions on the destination file using `chmod +x`. If the source `bin/cli` file in the repository does not have the execute bit set, the resulting binary in the published package will not be executable. This will cause the CLI command to fail for users who install the package, breaking its primary functionality. feat: add CLI binary for npx supermemory - Added `bin/cli` with Node.js-compatible compiled CLI - Added `bin` field to package.json pointing to `dist/bin/cli` - Leverages existing Stainless build pipeline (`scripts/build` already copies `bin/cli` to `dist/bin/cli`)
fbebb79 to 010e42d Compare 
feat: add CLI binary for npx supermemory
bin/cliwith Node.js-compatible compiled CLIbinfield to package.json pointing todist/bin/cliscripts/buildalready copiesbin/clitodist/bin/cli)