Guidance for AI agents and humans working in this repo.
@pwrdrvr/codex-app-server-protocol vendors the TypeScript types for the
Codex App Server JSON-RPC protocol. Everything under src/ is generator
output from codex app-server generate-ts --experimental — every file carries
a // GENERATED CODE! DO NOT MODIFY BY HAND! header.
Never hand-edit src/. To change the types, regenerate from a different
Codex version (below). The only files you edit by hand are package.json,
README.md, PUBLISHING.md, this file, CLAUDE.md, and scripts/.
The package version equals the codex-cli version that generated src/.
@pwrdrvr/codex-app-server-protocol@0.135.0 was generated by codex-cli 0.135.0. Provenance is duplicated in package.json as codexCliVersion. See
the README for the full rationale and the npm-immutability caveat (no
patch-bump for packaging-only fixes against an unchanged Codex surface).
Corollary: generate from an exact released version, not a prerelease. If you
generate from 0.135.0-alpha.1, the honest package version is
0.135.0-alpha.1, not 0.135.0.
This is the canonical way to bump to a new Codex version. The key idea is
delete src/ first, so types the new version renamed or removed disappear
from the working tree and surface as deletions/renames in the diff. A plain
re-run leaves stale files behind and only ever shows additions/modifications.
Pick one source. Listed best-first:
-
Exact released version from GitHub (recommended for a real release). Homebrew's
codexcask is a rolling cask — it only ever offers the latest version, so it cannot pin an older exact version. Codex Desktop ships whatever the app bundles (often a-alpha). To pin an exact release, download its binary:VER=0.135.0 CACHE=~/.cache/pwrdrvr-codex/rust-v$VER mkdir -p "$CACHE" && cd "$CACHE" gh release download "rust-v$VER" --repo openai/codex \ --pattern 'codex-aarch64-apple-darwin.tar.gz' --clobber # arm64 macOS tar -xzf codex-aarch64-apple-darwin.tar.gz xattr -d com.apple.quarantine codex-aarch64-apple-darwin 2>/dev/null || true ./codex-aarch64-apple-darwin --version # must print exactly: codex-cli 0.135.0
(Swap the asset for your platform:
*-x86_64-apple-darwin,*-aarch64-unknown-linux-musl, etc. Release tags arerust-vX.Y.Z; list them withgh release list --repo openai/codex.) -
Codex Desktop's bundled binary (the script default), at
/Applications/Codex.app/Contents/Resources/codex. Convenient, but it is whatever the installed app bundles — verify--versionis a clean release before shipping it as one.
PWRDRVR_CODEX_BIN=~/.cache/pwrdrvr-codex/rust-v0.135.0/codex-aarch64-apple-darwin \
pnpm regeneratePWRDRVR_CODEX_BIN defaults to the Codex Desktop binary if unset. The script
(scripts/regenerate.sh):
- prints the binary +
--version, rm -rf src(so removals/renames show up),codex app-server generate-ts --out ./src --experimental,git add -A src,- prints an A/D/M summary, the
.tsfile count, and the detected version.
Set both fields in package.json to the detected codex --version:
Refresh the README's "Current generated source" line (version and the
.ts file count printed by the script).
pnpm install # if node_modules is missing
pnpm typecheck # tsc --noEmit over the generated sources; must pass
pnpm dlx publint@0.3.21 # validate the published package shape; must passpnpm typecheck is the core check — it proves the generated, type-only sources
compile for consumers. publint validates the published package shape (the
exports map, files, types resolution) so a packaging regression fails here
rather than reaching consumers. Both run in CI (and publish.yml before the npm
publish), so green locally ≈ green CI.
Note: a globally-configured pnpmfile may inject a
pnpmfileChecksum:line intopnpm-lock.yamlon install. The committed lockfile intentionally omits it (CI portability). Ifgit statusshows that as the only lockfile change, revert it:git checkout -- pnpm-lock.yaml.
git add -A
git status # expect: src/ A/D/M, package.json, README.mdSanity-check the deletions/renames are intentional (they reflect real protocol changes), then commit. Publishing is gated separately — see PUBLISHING.md.
| Command | What it does |
|---|---|
pnpm regenerate |
Clean-room: delete src/, regenerate, stage, summarize. Use this. |
pnpm generate |
Raw generator only (no delete, no stage). Won't surface removals. |
pnpm typecheck |
tsc --noEmit over the generated sources. |
pnpm dlx publint@0.3.21 |
Validate the published package shape (exports, files, types). |
{ "version": "0.135.0", "codexCliVersion": "0.135.0" }