Skip to content

feat: add CLI binary to SDK package for npx support#73

Open
Prasanna721 wants to merge 3 commits intomainfrom
add-supermemory-cli
Open

feat: add CLI binary to SDK package for npx support#73
Prasanna721 wants to merge 3 commits intomainfrom
add-supermemory-cli

Conversation

@Prasanna721
Copy link
Member

@Prasanna721 Prasanna721 commented Mar 15, 2026

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)
@Prasanna721 Prasanna721 self-assigned this Mar 15, 2026
@Prasanna721 Prasanna721 requested a review from Dhravya March 15, 2026 07:11
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Prasanna721 Prasanna721 marked this pull request as ready for review March 15, 2026 07:11
Comment on lines +12 to 14
"supermemory": "dist/bin/cli"
},
"packageManager": "yarn@1.22.22",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +11 to +13
"bin": {
"supermemory": "dist/bin/cli"
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`)
@Prasanna721 Prasanna721 force-pushed the add-supermemory-cli branch from fbebb79 to 010e42d Compare March 15, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant