Skip to content

Conversation

@Mai0313
Copy link

@Mai0313 Mai0313 commented Oct 15, 2025

This pull request introduces support for distributing CodeGPT as an npm package, enabling easy installation via Node.js and npm. It adds a new workflow for publishing to npm, updates documentation in all supported languages, and implements the necessary packaging scripts and configuration for cross-platform binary installation. The most important changes are grouped below:

GitHub Actions & Release Automation:

  • Added a new publish-npm job to .github/workflows/goreleaser.yml to automate npm publishing, including steps for downloading build artifacts, updating package.json, copying documentation, and verifying publication. The workflow outputs the version from the tagged release for use in npm publishing. [1] [2]

Node.js Package Implementation:

  • Created cli/nodejs/package.json to define the npm package, including metadata, binary mapping, supported platforms/architectures, and a postinstall script to handle binary setup.
  • Added cli/nodejs/install.js, a Node.js installer script that detects the user's platform and architecture, copies the appropriate binary, and sets executable permissions.
  • Added .npmignore in cli/nodejs to exclude unnecessary files from the npm package.

Documentation Updates:

  • Updated README.md, README.zh-cn.md, and README.zh-tw.md to include npm badges and installation instructions for the new npm package, clarifying that the correct binary is automatically installed for the user's platform. [1] [2] [3] [4] [5] [6]

Copilot AI review requested due to automatic review settings October 15, 2025 04:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds Node.js/npm distribution support for CodeGPT, enabling users to install the CLI tool through npm alongside existing installation methods. The implementation includes automated npm publishing through GitHub Actions and cross-platform binary installation.

  • Automated npm package publishing integrated into the existing GoReleaser workflow
  • Node.js installer that detects platform/architecture and copies the appropriate binary
  • Documentation updates across all supported languages (English, Chinese Traditional, Chinese Simplified)

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.github/workflows/goreleaser.yml Adds npm publishing job with artifact handling and version extraction
cli/nodejs/package.json Defines npm package metadata, supported platforms, and installation scripts
cli/nodejs/install.js Platform detection and binary installation logic for cross-platform support
cli/nodejs/.npmignore Excludes unnecessary files from npm package distribution
README.md, README.zh-cn.md, README.zh-tw.md Adds npm badges and installation instructions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

"description": "A CLI tool that uses AI models to help write commit messages, code review, summary code, and more",
"main": "install.js",
"bin": {
"codegpt": "bin/codegpt"
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

The binary path points to 'bin/codegpt' but the install script copies the binary to 'bin/codegpt-bin'. This mismatch will cause the CLI command to fail when users try to run 'codegpt' after installation.

Suggested change
"codegpt": "bin/codegpt"
"codegpt": "bin/codegpt-bin"

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 6.79%. Comparing base (0125d86) to head (91a591f).
⚠️ Report is 212 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (0125d86) and HEAD (91a591f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (0125d86) HEAD (91a591f)
1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #251       +/-   ##
==========================================
- Coverage   21.96%   6.79%   -15.18%     
==========================================
  Files           8      33       +25     
  Lines         346    1870     +1524     
==========================================
+ Hits           76     127       +51     
- Misses        264    1734     +1470     
- Partials        6       9        +3     
Flag Coverage Δ
go-1.24 6.79% <ø> (?)
go-1.25 6.79% <ø> (?)
macos-latest 6.79% <ø> (?)
ubuntu-latest 6.79% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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