Skip to content

feat: add npm package wrapper for global installation - #4

Closed
timimsms wants to merge 1 commit into
mainfrom
feat/npm-package
Closed

feat: add npm package wrapper for global installation#4
timimsms wants to merge 1 commit into
mainfrom
feat/npm-package

Conversation

@timimsms

Copy link
Copy Markdown
Owner

Summary

  • Adds npm package wrapper for easy global installation via npm/yarn
  • Implements automatic binary download during post-install
  • Provides cross-platform support with architecture detection

What's Included

npm Package Structure (npm/ directory)

  • package.json: Package configuration as @clickup/cli
  • index.js: Main entry point that executes the platform-specific binary
  • postinstall.js: Downloads the correct binary for the user's platform
  • bin/cu: Executable wrapper for global CLI access
  • README.md: npm-specific documentation

Features

  • ✅ Automatic platform detection (Windows, macOS, Linux)
  • ✅ Architecture support (x64, arm64, i386)
  • ✅ Binary download with progress indicator
  • ✅ SHA256 checksum verification
  • ✅ Graceful error handling with fallback instructions
  • ✅ CI environment detection (skips download when CI=true)
  • ✅ Support for offline/restricted environments

Publishing Script

  • scripts/publish-npm.sh: Automated npm publishing for releases
  • Updates version from git tag
  • Publishes with proper authentication
  • Tags as "latest" on npm

Installation (Once Published)

# Install globally
npm install -g @clickup/cli

# Or with yarn
yarn global add @clickup/cli

# Then use
cu --help

How It Works

  1. User runs npm install -g @clickup/cli
  2. npm installs the package files
  3. postinstall.js runs automatically:
    • Detects the user's platform and architecture
    • Downloads the appropriate binary from GitHub releases
    • Verifies the checksum
    • Extracts and installs the binary
  4. The cu command becomes available globally

Security Considerations

  • Binary checksums are verified during download
  • HTTPS only for all downloads
  • Clear error messages if verification fails
  • No elevated permissions required

Manual Setup Required

After merging, you'll need to:

  1. Add npm Token: Add NPM_TOKEN secret to GitHub repository
  2. Update Release Workflow: Add npm publish step that calls scripts/publish-npm.sh
  3. First Publish: The first version needs to be published manually to claim the package name

Testing

Local testing instructions:

cd npm
npm pack
npm install -g clickup-cli-0.0.0-development.tgz
cu --version

Next Steps

This PR completes the npm distribution feature. After merging:

  • Add NPM_TOKEN to GitHub secrets
  • Update the release workflow to include npm publishing
  • Manually publish first version to claim package name
  • Test installation on various platforms

🤖 Generated with Claude Code

- Create npm package structure at npm/ directory
- Add automatic binary download during post-install
- Support all major platforms with architecture detection
- Include checksum verification for security
- Add fallback error handling for failed downloads
- Create publish script for automated npm releases

Features:
- Platform detection (Windows, macOS, Linux)
- Architecture support (x64, arm64, i386)
- Progress indicators during download
- Automatic binary extraction
- CI environment detection (skips download)
- Clean error messages with fallback instructions

The package will be published as @clickup/cli and provides:
- Global installation via: npm install -g @clickup/cli
- Binary wrapper that launches the correct platform binary
- Automatic updates through npm

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@timimsms timimsms mentioned this pull request Jun 27, 2025
10 tasks
@timimsms

Copy link
Copy Markdown
Owner Author

Deprioritized. npm distribution is a lower priority than Homebrew + direct download (PR #17). See issue #5 for status.

@timimsms timimsms closed this Feb 24, 2026
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