Skip to content

Commit e5f680c

Browse files
authored
Merge branch 'main' into fix-readme-cli-reference
2 parents 654997b + a4b51f6 commit e5f680c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1223
-709
lines changed

.github/dotslash-config.json

-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{
22
"outputs": {
3-
"codex-repl": {
4-
"platforms": {
5-
"macos-aarch64": { "regex": "^codex-repl-aarch64-apple-darwin\\.zst$", "path": "codex-repl" },
6-
"macos-x86_64": { "regex": "^codex-repl-x86_64-apple-darwin\\.zst$", "path": "codex-repl" },
7-
"linux-x86_64": { "regex": "^codex-repl-x86_64-unknown-linux-musl\\.zst$", "path": "codex-repl" },
8-
"linux-aarch64": { "regex": "^codex-repl-aarch64-unknown-linux-gnu\\.zst$", "path": "codex-repl" }
9-
}
10-
},
11-
123
"codex-exec": {
134
"platforms": {
145
"macos-aarch64": { "regex": "^codex-exec-aarch64-apple-darwin\\.zst$", "path": "codex-exec" },

.github/workflows/ci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ jobs:
6868
- name: Build
6969
run: pnpm run build
7070

71+
- name: Ensure staging a release works.
72+
working-directory: codex-cli
73+
env:
74+
GH_TOKEN: ${{ github.token }}
75+
run: pnpm stage-release
76+
7177
- name: Ensure README.md contains only ASCII and certain Unicode code points
7278
run: ./scripts/asciicheck.py README.md
7379
- name: Check README ToC

.github/workflows/rust-release.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ name: rust-release
99
on:
1010
push:
1111
tags:
12-
- "rust-v.*.*.*"
12+
- "rust-v*.*.*"
1313

1414
concurrency:
1515
group: ${{ github.workflow }}
1616
cancel-in-progress: true
1717

1818
env:
19-
TAG_REGEX: '^rust-v\.[0-9]+\.[0-9]+\.[0-9]+$'
19+
TAG_REGEX: '^rust-v[0-9]+\.[0-9]+\.[0-9]+$'
2020

2121
jobs:
2222
tag-check:
@@ -37,7 +37,7 @@ jobs:
3737
|| { echo "❌ Tag '${GITHUB_REF_NAME}' != ${TAG_REGEX}"; exit 1; }
3838
3939
# 2. Extract versions
40-
tag_ver="${GITHUB_REF_NAME#rust-v.}"
40+
tag_ver="${GITHUB_REF_NAME#rust-v}"
4141
cargo_ver="$(grep -m1 '^version' codex-rs/Cargo.toml \
4242
| sed -E 's/version *= *"([^"]+)".*/\1/')"
4343
@@ -102,7 +102,6 @@ jobs:
102102
dest="dist/${{ matrix.target }}"
103103
mkdir -p "$dest"
104104
105-
cp target/${{ matrix.target }}/release/codex-repl "$dest/codex-repl-${{ matrix.target }}"
106105
cp target/${{ matrix.target }}/release/codex-exec "$dest/codex-exec-${{ matrix.target }}"
107106
cp target/${{ matrix.target }}/release/codex "$dest/codex-${{ matrix.target }}"
108107
@@ -143,11 +142,9 @@ jobs:
143142
with:
144143
tag_name: ${{ env.RELEASE_TAG }}
145144
files: dist/**
146-
# TODO(ragona): I'm going to leave these as prerelease/draft for now.
147-
# It gives us 1) clarity that these are not yet a stable version, and
148-
# 2) allows a human step to review the release before publishing the draft.
145+
# For now, tag releases as "prerelease" because we are not claiming
146+
# the Rust CLI is stable yet.
149147
prerelease: true
150-
draft: true
151148

152149
- uses: facebook/dotslash-publish-release@v2
153150
env:

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

33
You can install any of these versions: `npm install -g codex@version`
44

5+
## `0.1.2504301751`
6+
7+
### 🚀 Features
8+
9+
- User config api key (#569)
10+
- `@mention` files in codex (#701)
11+
- Add `--reasoning` CLI flag (#314)
12+
- Lower default retry wait time and increase number of tries (#720)
13+
- Add common package registries domains to allowed-domains list (#414)
14+
15+
### 🪲 Bug Fixes
16+
17+
- Insufficient quota message (#758)
18+
- Input keyboard shortcut opt+delete (#685)
19+
- `/diff` should include untracked files (#686)
20+
- Only allow running without sandbox if explicitly marked in safe container (#699)
21+
- Tighten up check for /usr/bin/sandbox-exec (#710)
22+
- Check if sandbox-exec is available (#696)
23+
- Duplicate messages in quiet mode (#680)
24+
525
## `0.1.2504251709`
626

727
### 🚀 Features

README.md

+21-11
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ corepack enable
308308
pnpm install
309309
pnpm build
310310
311+
# Linux-only: download prebuilt sandboxing binaries (requires gh and zstd).
312+
./scripts/install_native_deps.sh
313+
311314
# Get the usage and the options
312315
node ./dist/cli.js --help
313316
@@ -633,18 +636,25 @@ The **DCO check** blocks merges until every commit in the PR carries the footer
633636

634637
### Releasing `codex`
635638

636-
To publish a new version of the CLI, run the release scripts defined in `codex-cli/package.json`:
639+
To publish a new version of the CLI, run the following in the `codex-cli` folder to stage the release in a temporary directory:
637640

638-
1. Open the `codex-cli` directory
639-
2. Make sure you're on a branch like `git checkout -b bump-version`
640-
3. Bump the version and `CLI_VERSION` to current datetime: `pnpm release:version`
641-
4. Commit the version bump (with DCO sign-off):
642-
```bash
643-
git add codex-cli/src/utils/session.ts codex-cli/package.json
644-
git commit -s -m "chore(release): codex-cli v$(node -p \"require('./codex-cli/package.json').version\")"
645-
```
646-
5. Copy README, build, and publish to npm: `pnpm release`
647-
6. Push to branch: `git push origin HEAD`
641+
```
642+
pnpm stage-release
643+
```
644+
645+
Note you can specify the folder for the staged release:
646+
647+
```
648+
RELEASE_DIR=$(mktemp -d)
649+
pnpm stage-release "$RELEASE_DIR"
650+
```
651+
652+
Go to the folder where the release is staged and verify that it works as intended. If so, run the following from the temp folder:
653+
654+
```
655+
cd "$RELEASE_DIR"
656+
npm publish
657+
```
648658

649659
### Alternative Build Options
650660

codex-cli/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Added by ./scripts/install_native_deps.sh
2+
/bin/codex-linux-sandbox-arm64
3+
/bin/codex-linux-sandbox-x64

codex-cli/package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openai/codex",
3-
"version": "0.1.2504251709",
3+
"version": "0.1.2504301751",
44
"license": "Apache-2.0",
55
"bin": {
66
"codex": "bin/codex.js"
@@ -20,10 +20,7 @@
2020
"typecheck": "tsc --noEmit",
2121
"build": "node build.mjs",
2222
"build:dev": "NODE_ENV=development node build.mjs --dev && NODE_OPTIONS=--enable-source-maps node dist/cli-dev.js",
23-
"release:readme": "cp ../README.md ./README.md",
24-
"release:version": "TS=$(date +%y%m%d%H%M) && sed -E -i'' -e \"s/\\\"0\\.1\\.[0-9]{10}\\\"/\\\"0.1.${TS}\\\"/g\" package.json src/utils/session.ts",
25-
"release:build-and-publish": "pnpm run build && npm publish",
26-
"release": "pnpm run release:readme && pnpm run release:version && pnpm install && pnpm run release:build-and-publish"
23+
"stage-release": "./scripts/stage_release.sh"
2724
},
2825
"files": [
2926
"dist"
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
# Copy the Linux sandbox native binaries into the bin/ subfolder of codex-cli/.
4+
#
5+
# Usage:
6+
# ./scripts/install_native_deps.sh [CODEX_CLI_ROOT]
7+
#
8+
# Arguments
9+
# [CODEX_CLI_ROOT] – Optional. If supplied, it should be the codex-cli
10+
# folder that contains the package.json for @openai/codex.
11+
#
12+
# When no argument is given we assume the script is being run directly from a
13+
# development checkout. In that case we install the binaries into the
14+
# repository’s own `bin/` directory so that the CLI can run locally.
15+
16+
set -euo pipefail
17+
18+
# ----------------------------------------------------------------------------
19+
# Determine where the binaries should be installed.
20+
# ----------------------------------------------------------------------------
21+
22+
if [[ $# -gt 0 ]]; then
23+
# The caller supplied a release root directory.
24+
CODEX_CLI_ROOT="$1"
25+
BIN_DIR="$CODEX_CLI_ROOT/bin"
26+
else
27+
# No argument; fall back to the repo’s own bin directory.
28+
# Resolve the path of this script, then walk up to the repo root.
29+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
30+
CODEX_CLI_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
31+
BIN_DIR="$CODEX_CLI_ROOT/bin"
32+
fi
33+
34+
# Make sure the destination directory exists.
35+
mkdir -p "$BIN_DIR"
36+
37+
# ----------------------------------------------------------------------------
38+
# Download and decompress the artifacts from the GitHub Actions workflow.
39+
# ----------------------------------------------------------------------------
40+
41+
# Until we start publishing stable GitHub releases, we have to grab the binaries
42+
# from the GitHub Action that created them. Update the URL below to point to the
43+
# appropriate workflow run:
44+
WORKFLOW_URL="https://github.com/openai/codex/actions/runs/14763725716"
45+
WORKFLOW_ID="${WORKFLOW_URL##*/}"
46+
47+
ARTIFACTS_DIR="$(mktemp -d)"
48+
trap 'rm -rf "$ARTIFACTS_DIR"' EXIT
49+
50+
# NB: The GitHub CLI `gh` must be installed and authenticated.
51+
gh run download --dir "$ARTIFACTS_DIR" --repo openai/codex "$WORKFLOW_ID"
52+
53+
# Decompress the two target architectures.
54+
zstd -d "$ARTIFACTS_DIR/x86_64-unknown-linux-musl/codex-linux-sandbox-x86_64-unknown-linux-musl.zst" \
55+
-o "$BIN_DIR/codex-linux-sandbox-x64"
56+
57+
zstd -d "$ARTIFACTS_DIR/aarch64-unknown-linux-gnu/codex-linux-sandbox-aarch64-unknown-linux-gnu.zst" \
58+
-o "$BIN_DIR/codex-linux-sandbox-arm64"
59+
60+
echo "Installed native dependencies into $BIN_DIR"
61+

codex-cli/scripts/stage_release.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Change to the codex-cli directory.
6+
cd "$(dirname "${BASH_SOURCE[0]}")/.."
7+
8+
# First argument is where to stage the release. Creates a temporary directory
9+
# if not provided.
10+
RELEASE_DIR="${1:-$(mktemp -d)}"
11+
[ -n "${1-}" ] && shift
12+
13+
# Compile the JavaScript.
14+
pnpm install
15+
pnpm build
16+
mkdir "$RELEASE_DIR/bin"
17+
cp -r bin/codex.js "$RELEASE_DIR/bin/codex.js"
18+
cp -r dist "$RELEASE_DIR/dist"
19+
cp -r src "$RELEASE_DIR/src" # important if we want sourcemaps to continue to work
20+
cp ../README.md "$RELEASE_DIR"
21+
# TODO: Derive version from Git tag.
22+
VERSION=$(printf '0.1.%d' "$(date +%y%m%d%H%M)")
23+
jq --arg version "$VERSION" '.version = $version' package.json > "$RELEASE_DIR/package.json"
24+
25+
# Copy the native dependencies.
26+
./scripts/install_native_deps.sh "$RELEASE_DIR"
27+
28+
echo "Staged version $VERSION for release in $RELEASE_DIR"

codex-cli/src/components/chat/multiline-editor.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ export interface MultilineTextEditorProps {
137137

138138
// Called when the internal text buffer updates.
139139
readonly onChange?: (text: string) => void;
140+
141+
// Optional initial cursor position (character offset)
142+
readonly initialCursorOffset?: number;
140143
}
141144

142145
// Expose a minimal imperative API so parent components (e.g. TerminalChatInput)
@@ -169,14 +172,15 @@ const MultilineTextEditorInner = (
169172
onSubmit,
170173
focus = true,
171174
onChange,
175+
initialCursorOffset,
172176
}: MultilineTextEditorProps,
173177
ref: React.Ref<MultilineTextEditorHandle | null>,
174178
): React.ReactElement => {
175179
// ---------------------------------------------------------------------------
176180
// Editor State
177181
// ---------------------------------------------------------------------------
178182

179-
const buffer = useRef(new TextBuffer(initialText));
183+
const buffer = useRef(new TextBuffer(initialText, initialCursorOffset));
180184
const [version, setVersion] = useState(0);
181185

182186
// Keep track of the current terminal size so that the editor grows/shrinks

0 commit comments

Comments
 (0)