Skip to content

feat(release): add npm distribution wrapper#15

Merged
flc1125 merged 5 commits into
mainfrom
release/npm-wrapper
May 19, 2026
Merged

feat(release): add npm distribution wrapper#15
flc1125 merged 5 commits into
mainfrom
release/npm-wrapper

Conversation

@flc1125
Copy link
Copy Markdown
Member

@flc1125 flc1125 commented May 19, 2026

Summary

Add npm distribution for the TAPD CLI by publishing a lightweight wrapper package that installs verified binaries from GitHub Releases.

Changes

  • Add the npm/ package for @go-tapd/tapd, including install, wrapper, and version scripts
  • Extend the release workflow to publish the npm package after GoReleaser completes
  • Refresh README installation sections and contributor release-token guidance
  • Update AGENTS.md with stable project guidance for release and npm distribution

Motivation

  • Let users install tapd through npm while keeping GitHub Release binaries as the source of truth
  • Document release token setup so Homebrew and npm publishing can be maintained after token rotation

Testing

  • npm_config_cache=/tmp/npm-cache npm pack --dry-run --json
  • TAPD_VERSION=0.1.3 node scripts/install.js
  • node bin/tapd.js --help
  • git diff --check main...HEAD
  • make test

Summary by CodeRabbit

  • New Features

    • CLI tool is now available as an npm package (@go-tapd/tapd) with automatic binary installation and multi-platform support.
  • Documentation

    • Reorganized README with clearer sections and emoji headers for improved navigation.
    • Added comprehensive contributing guide covering maintenance steps and release procedures with token setup instructions.
    • Enhanced project documentation with setup and CI/release guidance updates.
  • Chores

    • Updated release automation workflow with enhanced publishing capabilities.
    • Added MIT license file and updated gitignore configuration.

Review Change Stack

Copilot AI review requested due to automatic review settings May 19, 2026 16:34
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR adds complete npm package distribution for the tapd Go CLI. It introduces npm package metadata and a postinstall installer that downloads and verifies prebuilt binaries from GitHub Releases, integrates npm publishing into the release workflow with credential validation, and documents the mechanism and maintenance procedures for users and contributors.

Changes

npm Distribution Infrastructure

Layer / File(s) Summary
npm Package Structure and Metadata
npm/package.json, npm/LICENSE, npm/README.md, npm/bin/tapd.js
Package manifest defines @go-tapd/tapd with Node >=18, platform/arch constraints, postinstall hook, and tapd binary entry. License, README, and Node.js CLI wrapper document the package and route execution to the platform-specific prebuilt binary.
npm Installer and Binary Handling
npm/scripts/install.js, npm/scripts/set-version.js, .gitignore
Postinstall script downloads versioned GitHub Release archives, verifies SHA-256 checksums, extracts and locates the tapd binary across platforms, and stages it into npm/vendor/. Version setter updates package.json during release. Vendor directory is gitignored.
Release Workflow with npm Publishing
.github/workflows/release.yml
Release workflow grants OIDC id-token permission, validates NPM_TOKEN credential, sets up Node.js v24, invokes version setter script, and publishes npm package with provenance support enabled.
User and Contributor Documentation
README.md, AGENTS.md, CONTRIBUTING.md
README adds npm subsection under Install. AGENTS.md documents npm as a distribution wrapper and adds setup inspection guidance. CONTRIBUTING.md provides complete release token setup procedures, verification commands, rotation steps, and reference links for TAP_GITHUB_TOKEN and NPM_TOKEN.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A hop, a skip, through npm's release gate,
Where binaries dance with checksums straight,
GitHub to vendor, swift and pristine,
The finest packaged CLI you've seen!
With tokens validated and provenance sealed,
This Go tool's npm future is revealed! 📦✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(release): add npm distribution wrapper' directly and concisely describes the main change—introducing an npm package that serves as a distribution wrapper for the TAPD CLI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch release/npm-wrapper

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@flc1125 flc1125 merged commit 673f401 into main May 19, 2026
4 of 5 checks passed
@flc1125 flc1125 deleted the release/npm-wrapper branch May 19, 2026 16:35
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an npm distribution wrapper for the tapd CLI, allowing users to install the tool via Node.js package managers. The changes include a new npm package structure with a post-install script that downloads and verifies platform-specific binaries from GitHub Releases. Additionally, documentation has been updated across README.md and AGENTS.md, and a new CONTRIBUTING.md file has been added to guide maintainers through the release process and secret management. Feedback was provided to generalize the npm token configuration instructions by removing a hardcoded username from a URL.

Comment thread CONTRIBUTING.md

Create this token from npm:

1. Open `https://www.npmjs.com/settings/flc1125/tokens`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The URL for creating an npm token is specific to the user flc1125. To make this documentation more general and useful for any contributor, please replace the hardcoded username with a placeholder like <your_username>.

Suggested change
1. Open `https://www.npmjs.com/settings/flc1125/tokens`.
1. Open `https://www.npmjs.com/settings/<your_username>/tokens`.

Copy link
Copy Markdown

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

Adds an npm distribution wrapper for the TAPD CLI so users can install tapd through Node.js tooling while continuing to use GitHub Release binaries as the source of truth.

Changes:

  • Adds an npm/ package with install, wrapper, versioning, README, and license files.
  • Extends the release workflow to publish the npm package after GoReleaser.
  • Updates installation, release-token, and agent guidance documentation.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Adds npm installation guidance and refreshes section headings.
npm/scripts/set-version.js Sets npm package version from release/tag metadata.
npm/scripts/install.js Downloads, verifies, extracts, and installs the matching release binary.
npm/README.md Documents npm package usage and binary verification behavior.
npm/package.json Defines the scoped npm wrapper package metadata and lifecycle script.
npm/LICENSE Adds license text for the npm package.
npm/bin/tapd.js Adds the npm-exposed wrapper that executes the vendored binary.
CONTRIBUTING.md Adds release secret setup, verification, and rotation guidance.
AGENTS.md Updates project guidance for docs, release workflow, and npm wrapper.
.gitignore Ignores the generated npm vendored binary directory.
.github/workflows/release.yml Adds npm token checks, Node setup, and npm publish step.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CONTRIBUTING.md

Create this token from npm:

1. Open `https://www.npmjs.com/settings/flc1125/tokens`.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c13cf04086

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread npm/bin/tapd.js
Comment on lines +18 to +20
if (result.signal) {
console.error(`tapd exited because of signal ${result.signal}`);
process.exit(1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve child signal exit semantics

When the wrapped tapd process is terminated by a signal (for example, Ctrl+C/SIGINT), this wrapper always exits with code 1 instead of propagating the signal-derived status. That changes observable CLI behavior versus running the binary directly (e.g., shell scripts expecting interruption semantics like 130 on Unix will mis-handle cancellations as generic failures). The wrapper should forward signal termination semantics rather than rewriting them to 1.

Useful? React with 👍 / 👎.

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.

2 participants