Skip to content

feat(release): publish DCode to npm as dcode-ai#43

Merged
CreatorGhost merged 2 commits into
devfrom
npm-publish
Jul 12, 2026
Merged

feat(release): publish DCode to npm as dcode-ai#43
CreatorGhost merged 2 commits into
devfrom
npm-publish

Conversation

@CreatorGhost

Copy link
Copy Markdown
Owner

What

Makes DCode installable via npm: npm install -g dcode-ai → the dcode command.

Model (esbuild-style)

  • Thin wrapper package dcode-ai (a Node bin/dcode shim + optionalDependencies).
  • Per-platform binary packages dcode-ai-<os>-<arch>[-baseline][-musl] — npm auto-selects the right one via os/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 generated dcode-* platform packages to dcode-ai-*, publishes each, then assembles + publishes the dcode-ai wrapper with matching optionalDependencies. Supports --dry-run and --single.
  • .github/workflows/publish.yml: workflow_dispatch (version + dry_run inputs), runs the publish script with NPM_TOKEN.
  • bin/dcode + postinstall.mjs: base name → dcode-ai- (platform packages are dcode-ai-*; dcode-* are squatted on npm).
  • packages/script/src/index.ts: version source repointed off upstream opencode-aidcode-ai with a safe 0.0.0 fallback. CI always passes an explicit OPENCODE_VERSION.
  • README: documents npm install -g dcode-ai.

Not changed / kept safe

  • packages/opencode stays private: true (prevents accidental publish of the dev package); only the generated dist/ packages are published.
  • GitHub Releases + curl installer unchanged (release assets stay dcode-<target>).

Validation

End-to-end single-platform dry run (npm publish --dry-run) succeeded: built dcode-ai-darwin-arm64@9.9.9, smoke-tested dcode --version, and packed the dcode-ai wrapper (shim + README + optionalDependencies). typecheck 30/30.

To go live (needs you)

Create an npm automation token and add it as the NPM_TOKEN repo secret, then run the publish-npm workflow (optionally with dry_run: true first).

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).
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@CreatorGhost, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 045efd01-efae-4797-b51b-740ccae12c61

📥 Commits

Reviewing files that changed from the base of the PR and between 7b9d4b2 and 45342be.

📒 Files selected for processing (7)
  • .github/workflows/publish.yml
  • README.md
  • packages/opencode/bin/dcode
  • packages/opencode/package.json
  • packages/opencode/script/postinstall.mjs
  • packages/opencode/script/publish.ts
  • packages/script/src/index.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch npm-publish

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.

- 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.
@CreatorGhost CreatorGhost merged commit a9644a2 into dev Jul 12, 2026
3 checks passed
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