feat(release): publish DCode to npm as dcode-ai#43
Conversation
Add an esbuild-style npm distribution: a thin wrapper package (dcode-ai) plus per-platform binary packages (dcode-ai-<os>-<arch>) that npm auto-selects via os/cpu. `npm install -g dcode-ai` then provides the `dcode` command. - script/publish.ts builds all targets and publishes the platform packages + wrapper (with matching optionalDependencies); supports --dry-run/--single. - .github/workflows/publish.yml (workflow_dispatch) runs it with NPM_TOKEN; a dry_run input validates without publishing. - Point the bin/dcode shim and postinstall resolver at the dcode-ai- base. - Repoint the version source off upstream opencode-ai to dcode-ai (with a safe 0.0.0 fallback); CI always passes an explicit version. - Document the npm install path in the README. Validated end-to-end with a single-platform dry run (npm publish --dry-run).
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
- Idempotent re-runs: skip platform/wrapper versions already on npm instead of 403-aborting after a partial failure. - Guard against broken publishes: refuse a non-dry-run --single build (would only install on one platform) and refuse publishing without an explicit OPENCODE_VERSION (avoids the 0.0.0 fallback). - Workflow: pin registry=https://registry.npmjs.org/ in .npmrc so a repo/workspace .npmrc can't redirect the publish; add a channel input for preview dist-tags. - Use the npm-normalized bin path to silence the publish warning.
What
Makes DCode installable via npm:
npm install -g dcode-ai→ thedcodecommand.Model (esbuild-style)
dcode-ai(a Nodebin/dcodeshim +optionalDependencies).dcode-ai-<os>-<arch>[-baseline][-musl]— npm auto-selects the right one viaos/cpu/libc. No postinstall download; the shim execs the sibling platform package.Changes
packages/opencode/script/publish.ts: builds all targets (via build.ts), renames the generateddcode-*platform packages todcode-ai-*, publishes each, then assembles + publishes thedcode-aiwrapper with matchingoptionalDependencies. Supports--dry-runand--single..github/workflows/publish.yml:workflow_dispatch(version + dry_run inputs), runs the publish script withNPM_TOKEN.bin/dcode+postinstall.mjs: base name →dcode-ai-(platform packages aredcode-ai-*;dcode-*are squatted on npm).packages/script/src/index.ts: version source repointed off upstreamopencode-ai→dcode-aiwith a safe0.0.0fallback. CI always passes an explicitOPENCODE_VERSION.npm install -g dcode-ai.Not changed / kept safe
packages/opencodestaysprivate: true(prevents accidental publish of the dev package); only the generateddist/packages are published.dcode-<target>).Validation
End-to-end single-platform dry run (
npm publish --dry-run) succeeded: builtdcode-ai-darwin-arm64@9.9.9, smoke-testeddcode --version, and packed thedcode-aiwrapper (shim + README + optionalDependencies). typecheck 30/30.To go live (needs you)
Create an npm automation token and add it as the
NPM_TOKENrepo secret, then run the publish-npm workflow (optionally withdry_run: truefirst).