Files
codex/codex-cli/scripts/README.md
Michael Bolin 3f8d7abe3c # Use @openai/codex dist-tags for platform binaries instead of separate package names
https://github.com/openai/codex/pull/11318 introduced logic to publish platform artifacts as separate npm packages (for example,
`@openai/codex-darwin-arm64`, `@openai/codex-linux-x64`, etc.). That requires provisioning and
maintaining multiple package entries in npm, which would be nice to avoid.

We still need to keep the package-size mitigation (platform-specific payloads), but we want that
layout to live under a single npm package namespace (`@openai/codex`) using dist-tags.

We also need to preserve pre-release workflows where users install `@openai/codex@alpha` and get
platform-appropriate binaries.

## Release Strategy (New Scheme)

We publish **one npm package name for Codex binaries** (`@openai/codex`) and use **dist-tags** to select platform-specific payloads.
This avoids creating separate platform package names while keeping the package size split by platform.

### What gets published

#### Mainline release (`x.y.z`)

- `@openai/codex@latest` (meta package)
- `@openai/codex@darwin-arm64`
- `@openai/codex@darwin-x64`
- `@openai/codex@linux-arm64`
- `@openai/codex@linux-x64`
- `@openai/codex@win32-arm64`
- `@openai/codex@win32-x64`
- `@openai/codex-responses-api-proxy@latest`
- `@openai/codex-sdk@latest`

#### Alpha release (`x.y.z-alpha.N`)

- `@openai/codex@alpha` (meta package)
- `@openai/codex@alpha-darwin-arm64`
- `@openai/codex@alpha-darwin-x64`
- `@openai/codex@alpha-linux-arm64`
- `@openai/codex@alpha-linux-x64`
- `@openai/codex@alpha-win32-arm64`
- `@openai/codex@alpha-win32-x64`
- `@openai/codex-responses-api-proxy@alpha`
- `@openai/codex-sdk@alpha`

### Important note

**Note:** Because we never created the new packages on npm for, e.g., `@openai/codex-darwin-arm64`, since #11318 was merged, there are no npm packages to "clean up" as a result of this change.

## What changed

### 1. Stage platform tarballs as `@openai/codex` with platform-specific versions

File: `codex-cli/scripts/build_npm_package.py`

- Added `CODEX_NPM_NAME = "@openai/codex"` and platform metadata `npm_tag` values:
  - `darwin-arm64`, `darwin-x64`, `linux-arm64`, `linux-x64`, `win32-arm64`, `win32-x64`
- For platform package staging (`codex-<platform>` inputs), switched generated `package.json` from:
  - `name = @openai/codex-<platform>`
    to:
  - `name = @openai/codex`
- Added `compute_platform_package_version(version, platform_tag)` to make platform tarball versions unique
  (`<release-version>-<platform-tag>`), because npm does not allow publishing the same `name@version`
  repeatedly for multiple platform artifacts.

### 2. Point meta package optional dependencies at dist-tags on `@openai/codex`

File: `codex-cli/scripts/build_npm_package.py`

- Updated `optionalDependencies` generation for the main `codex` package to use npm alias syntax:
  - key remains alias package name (e.g. `@openai/codex-darwin-arm64`), preserving runtime lookup behavior
  - value now resolves to `@openai/codex` by dist-tag
- Stable releases now emit:
  - `npm:@openai/codex@darwin-arm64`, etc.
- Alpha releases (`x.y.z-alpha.N`) now emit:
  - `npm:@openai/codex@alpha-darwin-arm64`, etc.

### 3. Publish with per-tarball dist-tags in release CI

File: `.github/workflows/rust-release.yml`

- Reworked npm publish step to derive publish tag per tarball filename:
  - platform tarballs publish with `<platform>` tags for stable releases
  - platform tarballs publish with `alpha-<platform>` tags for alpha releases
  - top-level tarballs (`codex`, `codex-responses-api-proxy`, `codex-sdk`) continue using the release tag policy
    (`latest` implicit for stable, `alpha` for alpha)
- Added fail-fast behavior for unexpected tarball names to avoid silent mispublishes.

### 4. Documentation update

File: `codex-cli/scripts/README.md`

- Updated release staging description to reflect that platform-native variants are published as
  dist-tagged `@openai/codex` artifacts rather than separate npm package names.

## Resulting behavior

- Mainline release:
  - `@openai/codex@latest` resolves meta package
  - meta package optional deps reference `@openai/codex@<platform-tag>`
- Alpha release:
  - users can continue installing `@openai/codex@alpha`
  - alpha meta package optional deps reference `@openai/codex@alpha-<platform-tag>`

This preserves platform-specific payload distribution while eliminating the need to manage a separate npm
package per platform.

## Validation notes

- Verified staged `package.json` output for stable and alpha meta packages includes expected alias targets.
- Verified staged platform package manifests are `name=@openai/codex` with unique platform-suffixed versions.
- Verified release publish tag derivation logic maps tarball names to expected stable and alpha platform tags.
2026-02-10 10:05:05 -08:00

876 B

npm releases

Use the staging helper in the repo root to generate npm tarballs for a release. For example, to stage the CLI, responses proxy, and SDK packages for version 0.6.0:

./scripts/stage_npm_packages.py \
  --release-version 0.6.0 \
  --package codex \
  --package codex-responses-api-proxy \
  --package codex-sdk

This downloads the native artifacts once, hydrates vendor/ for each package, and writes tarballs to dist/npm/.

When --package codex is provided, the staging helper builds the lightweight @openai/codex meta package plus all platform-native @openai/codex variants that are later published under platform-specific dist-tags.

If you need to invoke build_npm_package.py directly, run codex-cli/scripts/install_native_deps.py first and pass --vendor-src pointing to the directory that contains the populated vendor/ tree.