From 365fb060f5f46343eb4439e58399c16f9f813869 Mon Sep 17 00:00:00 2001 From: Fouad Matin Date: Wed, 16 Apr 2025 12:55:19 -0700 Subject: [PATCH 1/3] add: release script --- .gitignore | 3 +++ README.md | 15 +++++++++++++++ codex-cli/package.json | 9 ++++++--- codex-cli/src/cli.tsx | 2 +- codex-cli/src/utils/session.ts | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 25a5e13f7e46..3e287dafc197 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ build/ out/ storybook-static/ +# ignore README for publishing +codex-cli/README.md + # editor .vscode/ .idea/ diff --git a/README.md b/README.md index e38a5fa5c48e..6ce71dfa803b 100644 --- a/README.md +++ b/README.md @@ -370,6 +370,21 @@ git push --force-with-lease # updates the PR The **DCO check** blocks merges until every commit in the PR carries the footer (with squash this is just the one). +### Releasing `codex` + +To publish a new version of the CLI, run the release scripts defined in `codex-cli/package.json`: + +1. Open the `codex-cli` directory +2. Make sure you're on a branch like `git checkout -b bump-version` +3. Bump the version and `CLI_VERSION` to current datetime: `npm run release:version` +3. Commit the version bump (with DCO sign-off): + ```bash + git add codex-cli/src/utils/session.ts codex-cli/package.json + git commit -s -m "chore(release): codex-cli v$(node -p \"require('./codex-cli/package.json').version\")" + ``` +4. Copy README, build, and publish to npm: `npm run release` +5. Push to branch: `git push origin HEAD` + --- ## Security & Responsible AI diff --git a/codex-cli/package.json b/codex-cli/package.json index b85a0cc94f55..d2d3302f3b0a 100644 --- a/codex-cli/package.json +++ b/codex-cli/package.json @@ -1,7 +1,6 @@ { - "private": true, "name": "@openai/codex", - "version": "0.1.04160940", + "version": "0.1.04161241", "license": "Apache-2.0", "bin": { "codex": "dist/cli.js" @@ -20,9 +19,13 @@ "test:watch": "vitest --watch", "typecheck": "tsc --noEmit", "build": "node build.mjs", - "build:dev": "NODE_ENV=development node build.mjs --dev && NODE_OPTIONS=--enable-source-maps node dist/cli-dev.js" + "build:dev": "NODE_ENV=development node build.mjs --dev && NODE_OPTIONS=--enable-source-maps node dist/cli-dev.js", + "release:readme": "cp ../README.md ./README.md", + "release:version": "codex -a full-auto 'update the CLI_VERSION in codex-cli/src/utils/session.ts and the version in package.json to use the current timestamp (MMDDHHmm format)'", + "release": "npm run release:readme && npm run build && npm publish" }, "files": [ + "README.md", "dist" ], "dependencies": { diff --git a/codex-cli/src/cli.tsx b/codex-cli/src/cli.tsx index b86926abc840..3cf158a66d61 100644 --- a/codex-cli/src/cli.tsx +++ b/codex-cli/src/cli.tsx @@ -1,4 +1,4 @@ -#!/usr/bin/env -S NODE_OPTIONS=--no-deprecation node +#!/usr/bin/env node import type { AppRollout } from "./app"; import type { CommandConfirmation } from "./utils/agent/agent-loop"; diff --git a/codex-cli/src/utils/session.ts b/codex-cli/src/utils/session.ts index b53c12a4b95f..287d0d7ed602 100644 --- a/codex-cli/src/utils/session.ts +++ b/codex-cli/src/utils/session.ts @@ -1,4 +1,4 @@ -export const CLI_VERSION = "0.1.04160940"; // Must be in sync with package.json. +export const CLI_VERSION = "0.1.04161241"; // Must be in sync with package.json. export const ORIGIN = "codex_cli_ts"; export type TerminalChatSession = { From a02c9ea13d3905d7d8232fe804a0b0b1a97b3391 Mon Sep 17 00:00:00 2001 From: Fouad Matin Date: Wed, 16 Apr 2025 13:06:57 -0700 Subject: [PATCH 2/3] add: src to npm module --- codex-cli/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codex-cli/package.json b/codex-cli/package.json index d2d3302f3b0a..2aa366d4adbc 100644 --- a/codex-cli/package.json +++ b/codex-cli/package.json @@ -26,7 +26,8 @@ }, "files": [ "README.md", - "dist" + "dist", + "src" ], "dependencies": { "@inkjs/ui": "^2.0.0", From 0fdbb9eba4e32e03cf39db79b5935202847feff7 Mon Sep 17 00:00:00 2001 From: Fouad Matin Date: Wed, 16 Apr 2025 13:09:56 -0700 Subject: [PATCH 3/3] fix: readme Signed-off-by: Fouad Matin --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6ce71dfa803b..546d8b7e7c0a 100644 --- a/README.md +++ b/README.md @@ -377,13 +377,13 @@ To publish a new version of the CLI, run the release scripts defined in `codex-c 1. Open the `codex-cli` directory 2. Make sure you're on a branch like `git checkout -b bump-version` 3. Bump the version and `CLI_VERSION` to current datetime: `npm run release:version` -3. Commit the version bump (with DCO sign-off): +4. Commit the version bump (with DCO sign-off): ```bash git add codex-cli/src/utils/session.ts codex-cli/package.json git commit -s -m "chore(release): codex-cli v$(node -p \"require('./codex-cli/package.json').version\")" ``` -4. Copy README, build, and publish to npm: `npm run release` -5. Push to branch: `git push origin HEAD` +5. Copy README, build, and publish to npm: `npm run release` +6. Push to branch: `git push origin HEAD` ---