Files
llmx/codex-cli/package.json

90 lines
2.5 KiB
JSON
Raw Normal View History

{
"name": "@openai/codex",
"version": "0.0.0-dev",
"license": "Apache-2.0",
"bin": {
fix: Improper spawn of sh on Windows Powershell (#318) # Fix CLI launcher on Windows by replacing `sh`-based entrypoint with cross-platform Node script ## What's changed * This PR attempts to replace the sh-based entry point with a node script that works on all platforms including Windows Powershell and CMD ## Why * Previously, when installing Codex globally via `npm i -g @openai/codex`, Windows resulted in a broken CLI issue due to the `ps1` launcher trying to execute `sh.exe`. * If users don't have Unix-style shell, running the command will fail as seen below since `sh.exe` can't be found * Output: ``` & : The term 'sh.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Users\{user}\AppData\Roaming\npm\codex.ps1:24 char:7 + & "sh$exe" "$basedir/node_modules/@openai/codex/bin/codex" $args + ~~~~~~~~ + CategoryInfo : ObjectNotFound: (sh.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException ``` ## How * By using a Node based entry point that resolves the path to the compiled ESM bundle and dynamically loads it using native ESM * Removed dependency on platform-specific launchers allowing a single entrypoint to work everywhere Node.js runs. ## Result Codex CLI now supports cross-platform and launches correctly via: * macOS / Linux * Windows PowerShell * GitBash * CMD * WSL Directly addresses #316 ![image](https://github.com/user-attachments/assets/85faaca4-24bc-47c9-8160-4e30df6da4c3) ![image](https://github.com/user-attachments/assets/a13f7adc-52c1-4c0e-af02-e35a35dc45d4)
2025-04-18 14:35:51 -04:00
"codex": "bin/codex.js"
},
"type": "module",
"engines": {
"node": ">=22"
},
"scripts": {
"format": "prettier --check src tests",
"format:fix": "prettier --write src tests",
"dev": "tsc --watch",
"lint": "eslint src tests --ext ts --ext tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint src tests --ext ts --ext tsx --fix",
"test": "vitest run",
"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",
"stage-release": "./scripts/stage_release.sh"
},
"files": [
"bin",
"dist"
],
"dependencies": {
"@inkjs/ui": "^2.0.0",
"chalk": "^5.2.0",
"diff": "^7.0.0",
"dotenv": "^16.1.4",
"express": "^5.1.0",
"fast-deep-equal": "^3.1.3",
refactor(updates): fetch version from registry instead of npm CLI to support multiple managers (#446) ## Background Addressing feedback from https://github.com/openai/codex/pull/333#discussion_r2050893224, this PR adds support for Bun alongside npm, pnpm while keeping the code simple. ## Summary The update‑check flow is refactored to use a direct registry lookup (`fast-npm-meta` + `semver`) instead of shelling out to `npm outdated`, and adds a lightweight installer‑detection mechanism that: 1. Checks if the invoked script lives under a known global‑bin directory (npm, pnpm, or bun) 2. If not, falls back to local detection via `getUserAgent()` (the `package‑manager‑detector` library) ## What’s Changed - **Registry‑based version check** - Replace `execFile("npm", ["outdated"])` with `getLatestVersion()` and `semver.gt()` - **Multi‑manager support** - New `renderUpdateCommand` handles update commands for `npm`, `pnpm`, and `bun`. - Detect global installer first via `detectInstallerByPath()` - Fallback to local detection via `getUserAgent()` - **Module cleanup** - Extract `detectInstallerByPath` into `utils/package-manager-detector.ts` - Remove legacy `checkOutdated`, `getNPMCommandPath`, and child‑process JSON parsing - **Flow improvements in `checkForUpdates`** 1. Short‑circuit by `UPDATE_CHECK_FREQUENCY` 3. Fetch & compare versions 4. Persist new timestamp immediately 5. Render & display styled box only when an update exists - **Maintain simplicity** - All multi‑manager logic lives in one small helper and a concise lookup rather than a complex adapter hierarchy - Core `checkForUpdates` remains a single, easy‑to‑follow async function - **Dependencies added** - `fast-npm-meta`, `semver`, `package-manager-detector`, `@types/semver` ## Considerations If we decide to drop the interactive update‑message (`npm install -g @openai/codex`) rendering altogether, we could remove most of the installer‑detection code and dependencies, which would simplify the codebase further but result in a less friendly UX. ## Preview * npm ![refactor-update-check-flow-npm](https://github.com/user-attachments/assets/57320114-3fb6-4985-8780-3388a1d1ec85) * bun ![refactor-update-check-flow-bun](https://github.com/user-attachments/assets/d93bf0ae-a687-412a-ab92-581b4f967307) ## Simple Flow Chart ```mermaid flowchart TD A(Start) --> B[Read state] B --> C{Recent check?} C -- Yes --> Z[End] C -- No --> D[Fetch latest version] D --> E[Save check time] E --> F{Version data OK?} F -- No --> Z F -- Yes --> G{Update available?} G -- No --> Z G -- Yes --> H{Global install?} H -- Yes --> I[Select global manager] H -- No --> K{Local install?} K -- No --> Z K -- Yes --> L[Select local manager] I & L --> M[Render update message] M --> N[Format with boxen] N --> O[Print update] O --> Z ```
2025-04-21 15:00:20 +08:00
"fast-npm-meta": "^0.4.2",
feat: shell command explanation option (#173) # Shell Command Explanation Option ## Description This PR adds an option to explain shell commands when the user is prompted to approve them (Fixes #110). When reviewing a shell command, users can now select "Explain this command" to get a detailed explanation of what the command does before deciding whether to approve or reject it. ## Changes - Added a new "EXPLAIN" option to the `ReviewDecision` enum - Updated the command review UI to include an "Explain this command (x)" option - Implemented the logic to send the command to the LLM for explanation using the same model as the agent - Added a display for the explanation in the command review UI - Updated all relevant components to pass the explanation through the component tree ## Benefits - Improves user understanding of shell commands before approving them - Reduces the risk of approving potentially harmful commands - Enhances the educational aspect of the tool, helping users learn about shell commands - Maintains the same workflow with minimal UI changes ## Testing - Manually tested the explanation feature with various shell commands - Verified that the explanation is displayed correctly in the UI - Confirmed that the user can still approve or reject the command after viewing the explanation ## Screenshots ![improved_shell_explanation_demo](https://github.com/user-attachments/assets/05923481-29db-4eba-9cc6-5e92301d2be0) ## Additional Notes The explanation is generated using the same model as the agent, ensuring consistency in the quality and style of explanations. --------- Signed-off-by: crazywolf132 <crazywolf132@gmail.com>
2025-04-18 06:28:58 +10:00
"figures": "^6.1.0",
"file-type": "^20.1.0",
"https-proxy-agent": "^7.0.6",
"ink": "^5.2.0",
feat: shell command explanation option (#173) # Shell Command Explanation Option ## Description This PR adds an option to explain shell commands when the user is prompted to approve them (Fixes #110). When reviewing a shell command, users can now select "Explain this command" to get a detailed explanation of what the command does before deciding whether to approve or reject it. ## Changes - Added a new "EXPLAIN" option to the `ReviewDecision` enum - Updated the command review UI to include an "Explain this command (x)" option - Implemented the logic to send the command to the LLM for explanation using the same model as the agent - Added a display for the explanation in the command review UI - Updated all relevant components to pass the explanation through the component tree ## Benefits - Improves user understanding of shell commands before approving them - Reduces the risk of approving potentially harmful commands - Enhances the educational aspect of the tool, helping users learn about shell commands - Maintains the same workflow with minimal UI changes ## Testing - Manually tested the explanation feature with various shell commands - Verified that the explanation is displayed correctly in the UI - Confirmed that the user can still approve or reject the command after viewing the explanation ## Screenshots ![improved_shell_explanation_demo](https://github.com/user-attachments/assets/05923481-29db-4eba-9cc6-5e92301d2be0) ## Additional Notes The explanation is generated using the same model as the agent, ensuring consistency in the quality and style of explanations. --------- Signed-off-by: crazywolf132 <crazywolf132@gmail.com>
2025-04-18 06:28:58 +10:00
"js-yaml": "^4.1.0",
"marked": "^15.0.7",
"marked-terminal": "^7.3.0",
"meow": "^13.2.0",
"open": "^10.1.0",
"openai": "^4.95.1",
refactor(updates): fetch version from registry instead of npm CLI to support multiple managers (#446) ## Background Addressing feedback from https://github.com/openai/codex/pull/333#discussion_r2050893224, this PR adds support for Bun alongside npm, pnpm while keeping the code simple. ## Summary The update‑check flow is refactored to use a direct registry lookup (`fast-npm-meta` + `semver`) instead of shelling out to `npm outdated`, and adds a lightweight installer‑detection mechanism that: 1. Checks if the invoked script lives under a known global‑bin directory (npm, pnpm, or bun) 2. If not, falls back to local detection via `getUserAgent()` (the `package‑manager‑detector` library) ## What’s Changed - **Registry‑based version check** - Replace `execFile("npm", ["outdated"])` with `getLatestVersion()` and `semver.gt()` - **Multi‑manager support** - New `renderUpdateCommand` handles update commands for `npm`, `pnpm`, and `bun`. - Detect global installer first via `detectInstallerByPath()` - Fallback to local detection via `getUserAgent()` - **Module cleanup** - Extract `detectInstallerByPath` into `utils/package-manager-detector.ts` - Remove legacy `checkOutdated`, `getNPMCommandPath`, and child‑process JSON parsing - **Flow improvements in `checkForUpdates`** 1. Short‑circuit by `UPDATE_CHECK_FREQUENCY` 3. Fetch & compare versions 4. Persist new timestamp immediately 5. Render & display styled box only when an update exists - **Maintain simplicity** - All multi‑manager logic lives in one small helper and a concise lookup rather than a complex adapter hierarchy - Core `checkForUpdates` remains a single, easy‑to‑follow async function - **Dependencies added** - `fast-npm-meta`, `semver`, `package-manager-detector`, `@types/semver` ## Considerations If we decide to drop the interactive update‑message (`npm install -g @openai/codex`) rendering altogether, we could remove most of the installer‑detection code and dependencies, which would simplify the codebase further but result in a less friendly UX. ## Preview * npm ![refactor-update-check-flow-npm](https://github.com/user-attachments/assets/57320114-3fb6-4985-8780-3388a1d1ec85) * bun ![refactor-update-check-flow-bun](https://github.com/user-attachments/assets/d93bf0ae-a687-412a-ab92-581b4f967307) ## Simple Flow Chart ```mermaid flowchart TD A(Start) --> B[Read state] B --> C{Recent check?} C -- Yes --> Z[End] C -- No --> D[Fetch latest version] D --> E[Save check time] E --> F{Version data OK?} F -- No --> Z F -- Yes --> G{Update available?} G -- No --> Z G -- Yes --> H{Global install?} H -- Yes --> I[Select global manager] H -- No --> K{Local install?} K -- No --> Z K -- Yes --> L[Select local manager] I & L --> M[Render update message] M --> N[Format with boxen] N --> O[Print update] O --> Z ```
2025-04-21 15:00:20 +08:00
"package-manager-detector": "^1.2.0",
"react": "^18.2.0",
"shell-quote": "^1.8.2",
feat: shell command explanation option (#173) # Shell Command Explanation Option ## Description This PR adds an option to explain shell commands when the user is prompted to approve them (Fixes #110). When reviewing a shell command, users can now select "Explain this command" to get a detailed explanation of what the command does before deciding whether to approve or reject it. ## Changes - Added a new "EXPLAIN" option to the `ReviewDecision` enum - Updated the command review UI to include an "Explain this command (x)" option - Implemented the logic to send the command to the LLM for explanation using the same model as the agent - Added a display for the explanation in the command review UI - Updated all relevant components to pass the explanation through the component tree ## Benefits - Improves user understanding of shell commands before approving them - Reduces the risk of approving potentially harmful commands - Enhances the educational aspect of the tool, helping users learn about shell commands - Maintains the same workflow with minimal UI changes ## Testing - Manually tested the explanation feature with various shell commands - Verified that the explanation is displayed correctly in the UI - Confirmed that the user can still approve or reject the command after viewing the explanation ## Screenshots ![improved_shell_explanation_demo](https://github.com/user-attachments/assets/05923481-29db-4eba-9cc6-5e92301d2be0) ## Additional Notes The explanation is generated using the same model as the agent, ensuring consistency in the quality and style of explanations. --------- Signed-off-by: crazywolf132 <crazywolf132@gmail.com>
2025-04-18 06:28:58 +10:00
"strip-ansi": "^7.1.0",
"to-rotated": "^1.0.0",
feat: shell command explanation option (#173) # Shell Command Explanation Option ## Description This PR adds an option to explain shell commands when the user is prompted to approve them (Fixes #110). When reviewing a shell command, users can now select "Explain this command" to get a detailed explanation of what the command does before deciding whether to approve or reject it. ## Changes - Added a new "EXPLAIN" option to the `ReviewDecision` enum - Updated the command review UI to include an "Explain this command (x)" option - Implemented the logic to send the command to the LLM for explanation using the same model as the agent - Added a display for the explanation in the command review UI - Updated all relevant components to pass the explanation through the component tree ## Benefits - Improves user understanding of shell commands before approving them - Reduces the risk of approving potentially harmful commands - Enhances the educational aspect of the tool, helping users learn about shell commands - Maintains the same workflow with minimal UI changes ## Testing - Manually tested the explanation feature with various shell commands - Verified that the explanation is displayed correctly in the UI - Confirmed that the user can still approve or reject the command after viewing the explanation ## Screenshots ![improved_shell_explanation_demo](https://github.com/user-attachments/assets/05923481-29db-4eba-9cc6-5e92301d2be0) ## Additional Notes The explanation is generated using the same model as the agent, ensuring consistency in the quality and style of explanations. --------- Signed-off-by: crazywolf132 <crazywolf132@gmail.com>
2025-04-18 06:28:58 +10:00
"use-interval": "1.4.0",
"zod": "^3.24.3"
},
"devDependencies": {
"@eslint/js": "^9.22.0",
"@types/diff": "^7.0.2",
"@types/express": "^5.0.1",
"@types/js-yaml": "^4.0.9",
"@types/marked-terminal": "^6.1.1",
"@types/react": "^18.0.32",
refactor(updates): fetch version from registry instead of npm CLI to support multiple managers (#446) ## Background Addressing feedback from https://github.com/openai/codex/pull/333#discussion_r2050893224, this PR adds support for Bun alongside npm, pnpm while keeping the code simple. ## Summary The update‑check flow is refactored to use a direct registry lookup (`fast-npm-meta` + `semver`) instead of shelling out to `npm outdated`, and adds a lightweight installer‑detection mechanism that: 1. Checks if the invoked script lives under a known global‑bin directory (npm, pnpm, or bun) 2. If not, falls back to local detection via `getUserAgent()` (the `package‑manager‑detector` library) ## What’s Changed - **Registry‑based version check** - Replace `execFile("npm", ["outdated"])` with `getLatestVersion()` and `semver.gt()` - **Multi‑manager support** - New `renderUpdateCommand` handles update commands for `npm`, `pnpm`, and `bun`. - Detect global installer first via `detectInstallerByPath()` - Fallback to local detection via `getUserAgent()` - **Module cleanup** - Extract `detectInstallerByPath` into `utils/package-manager-detector.ts` - Remove legacy `checkOutdated`, `getNPMCommandPath`, and child‑process JSON parsing - **Flow improvements in `checkForUpdates`** 1. Short‑circuit by `UPDATE_CHECK_FREQUENCY` 3. Fetch & compare versions 4. Persist new timestamp immediately 5. Render & display styled box only when an update exists - **Maintain simplicity** - All multi‑manager logic lives in one small helper and a concise lookup rather than a complex adapter hierarchy - Core `checkForUpdates` remains a single, easy‑to‑follow async function - **Dependencies added** - `fast-npm-meta`, `semver`, `package-manager-detector`, `@types/semver` ## Considerations If we decide to drop the interactive update‑message (`npm install -g @openai/codex`) rendering altogether, we could remove most of the installer‑detection code and dependencies, which would simplify the codebase further but result in a less friendly UX. ## Preview * npm ![refactor-update-check-flow-npm](https://github.com/user-attachments/assets/57320114-3fb6-4985-8780-3388a1d1ec85) * bun ![refactor-update-check-flow-bun](https://github.com/user-attachments/assets/d93bf0ae-a687-412a-ab92-581b4f967307) ## Simple Flow Chart ```mermaid flowchart TD A(Start) --> B[Read state] B --> C{Recent check?} C -- Yes --> Z[End] C -- No --> D[Fetch latest version] D --> E[Save check time] E --> F{Version data OK?} F -- No --> Z F -- Yes --> G{Update available?} G -- No --> Z G -- Yes --> H{Global install?} H -- Yes --> I[Select global manager] H -- No --> K{Local install?} K -- No --> Z K -- Yes --> L[Select local manager] I & L --> M[Render update message] M --> N[Format with boxen] N --> O[Print update] O --> Z ```
2025-04-21 15:00:20 +08:00
"@types/semver": "^7.7.0",
"@types/shell-quote": "^1.7.5",
feat: notify when a newer version is available (#333) **Summary** This change introduces a new startup check that notifies users if a newer `@openai/codex` version is available. To avoid spamming, it writes a small state file recording the last check time and will only re‑check once every 24 hours. **What’s Changed** - **New file** `src/utils/check-updates.ts` - Runs `npm outdated --global @openai/codex` - Reads/writes `codex-state.json` under `CONFIG_DIR` - Limits checks to once per day (`UPDATE_CHECK_FREQUENCY = 24h`) - Uses `boxen` for a styled alert and `which` to locate the npm binary - **Hooked into** `src/cli.tsx` entrypoint: ```ts import { checkForUpdates } from "./utils/check-updates"; // … // after loading config await checkForUpdates().catch(); ``` - **Dependencies** - Added `boxen@^8.0.1`, `which@^5.0.0`, `@types/which@^3.0.4` - **Tests** - Vitest suite under `tests/check-updates.test.ts` - Snapshot in `__snapshots__/check-updates.test.ts.snap` **Motivation** Addresses issue #244. Users running a stale global install will now see a friendly reminder—at most once per day—to upgrade and enjoy the latest features. **Test Plan** - `getNPMCommandPath()` resolves npm correctly - `checkOutdated()` parses `npm outdated` JSON - State file prevents repeat alerts within 24h - Boxen snapshot matches expected output - No console output when state indicates a recent check **Related Issue** try resolves #244 **Preview** Prompt a pnpm‑style alert when outdated ![outdated‑alert](https://github.com/user-attachments/assets/294dad45-d858-45d1-bf34-55e672ab883a) Let me know if you’d tweak any of the messaging, throttle frequency, placement in the startup flow, or anything else. --------- Co-authored-by: Thibault Sottiaux <tibo@openai.com>
2025-04-19 08:00:45 +08:00
"@types/which": "^3.0.4",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
feat: notify when a newer version is available (#333) **Summary** This change introduces a new startup check that notifies users if a newer `@openai/codex` version is available. To avoid spamming, it writes a small state file recording the last check time and will only re‑check once every 24 hours. **What’s Changed** - **New file** `src/utils/check-updates.ts` - Runs `npm outdated --global @openai/codex` - Reads/writes `codex-state.json` under `CONFIG_DIR` - Limits checks to once per day (`UPDATE_CHECK_FREQUENCY = 24h`) - Uses `boxen` for a styled alert and `which` to locate the npm binary - **Hooked into** `src/cli.tsx` entrypoint: ```ts import { checkForUpdates } from "./utils/check-updates"; // … // after loading config await checkForUpdates().catch(); ``` - **Dependencies** - Added `boxen@^8.0.1`, `which@^5.0.0`, `@types/which@^3.0.4` - **Tests** - Vitest suite under `tests/check-updates.test.ts` - Snapshot in `__snapshots__/check-updates.test.ts.snap` **Motivation** Addresses issue #244. Users running a stale global install will now see a friendly reminder—at most once per day—to upgrade and enjoy the latest features. **Test Plan** - `getNPMCommandPath()` resolves npm correctly - `checkOutdated()` parses `npm outdated` JSON - State file prevents repeat alerts within 24h - Boxen snapshot matches expected output - No console output when state indicates a recent check **Related Issue** try resolves #244 **Preview** Prompt a pnpm‑style alert when outdated ![outdated‑alert](https://github.com/user-attachments/assets/294dad45-d858-45d1-bf34-55e672ab883a) Let me know if you’d tweak any of the messaging, throttle frequency, placement in the startup flow, or anything else. --------- Co-authored-by: Thibault Sottiaux <tibo@openai.com>
2025-04-19 08:00:45 +08:00
"boxen": "^8.0.1",
"esbuild": "^0.25.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.19",
"husky": "^9.1.7",
"ink-testing-library": "^3.0.0",
"prettier": "^3.5.3",
"punycode": "^2.3.1",
refactor(updates): fetch version from registry instead of npm CLI to support multiple managers (#446) ## Background Addressing feedback from https://github.com/openai/codex/pull/333#discussion_r2050893224, this PR adds support for Bun alongside npm, pnpm while keeping the code simple. ## Summary The update‑check flow is refactored to use a direct registry lookup (`fast-npm-meta` + `semver`) instead of shelling out to `npm outdated`, and adds a lightweight installer‑detection mechanism that: 1. Checks if the invoked script lives under a known global‑bin directory (npm, pnpm, or bun) 2. If not, falls back to local detection via `getUserAgent()` (the `package‑manager‑detector` library) ## What’s Changed - **Registry‑based version check** - Replace `execFile("npm", ["outdated"])` with `getLatestVersion()` and `semver.gt()` - **Multi‑manager support** - New `renderUpdateCommand` handles update commands for `npm`, `pnpm`, and `bun`. - Detect global installer first via `detectInstallerByPath()` - Fallback to local detection via `getUserAgent()` - **Module cleanup** - Extract `detectInstallerByPath` into `utils/package-manager-detector.ts` - Remove legacy `checkOutdated`, `getNPMCommandPath`, and child‑process JSON parsing - **Flow improvements in `checkForUpdates`** 1. Short‑circuit by `UPDATE_CHECK_FREQUENCY` 3. Fetch & compare versions 4. Persist new timestamp immediately 5. Render & display styled box only when an update exists - **Maintain simplicity** - All multi‑manager logic lives in one small helper and a concise lookup rather than a complex adapter hierarchy - Core `checkForUpdates` remains a single, easy‑to‑follow async function - **Dependencies added** - `fast-npm-meta`, `semver`, `package-manager-detector`, `@types/semver` ## Considerations If we decide to drop the interactive update‑message (`npm install -g @openai/codex`) rendering altogether, we could remove most of the installer‑detection code and dependencies, which would simplify the codebase further but result in a less friendly UX. ## Preview * npm ![refactor-update-check-flow-npm](https://github.com/user-attachments/assets/57320114-3fb6-4985-8780-3388a1d1ec85) * bun ![refactor-update-check-flow-bun](https://github.com/user-attachments/assets/d93bf0ae-a687-412a-ab92-581b4f967307) ## Simple Flow Chart ```mermaid flowchart TD A(Start) --> B[Read state] B --> C{Recent check?} C -- Yes --> Z[End] C -- No --> D[Fetch latest version] D --> E[Save check time] E --> F{Version data OK?} F -- No --> Z F -- Yes --> G{Update available?} G -- No --> Z G -- Yes --> H{Global install?} H -- Yes --> I[Select global manager] H -- No --> K{Local install?} K -- No --> Z K -- Yes --> L[Select local manager] I & L --> M[Render update message] M --> N[Format with boxen] N --> O[Print update] O --> Z ```
2025-04-21 15:00:20 +08:00
"semver": "^7.7.1",
"ts-node": "^10.9.1",
"typescript": "^5.0.3",
2025-05-02 09:30:08 -07:00
"vite": "^6.3.4",
"vitest": "^3.1.2",
feat: notify when a newer version is available (#333) **Summary** This change introduces a new startup check that notifies users if a newer `@openai/codex` version is available. To avoid spamming, it writes a small state file recording the last check time and will only re‑check once every 24 hours. **What’s Changed** - **New file** `src/utils/check-updates.ts` - Runs `npm outdated --global @openai/codex` - Reads/writes `codex-state.json` under `CONFIG_DIR` - Limits checks to once per day (`UPDATE_CHECK_FREQUENCY = 24h`) - Uses `boxen` for a styled alert and `which` to locate the npm binary - **Hooked into** `src/cli.tsx` entrypoint: ```ts import { checkForUpdates } from "./utils/check-updates"; // … // after loading config await checkForUpdates().catch(); ``` - **Dependencies** - Added `boxen@^8.0.1`, `which@^5.0.0`, `@types/which@^3.0.4` - **Tests** - Vitest suite under `tests/check-updates.test.ts` - Snapshot in `__snapshots__/check-updates.test.ts.snap` **Motivation** Addresses issue #244. Users running a stale global install will now see a friendly reminder—at most once per day—to upgrade and enjoy the latest features. **Test Plan** - `getNPMCommandPath()` resolves npm correctly - `checkOutdated()` parses `npm outdated` JSON - State file prevents repeat alerts within 24h - Boxen snapshot matches expected output - No console output when state indicates a recent check **Related Issue** try resolves #244 **Preview** Prompt a pnpm‑style alert when outdated ![outdated‑alert](https://github.com/user-attachments/assets/294dad45-d858-45d1-bf34-55e672ab883a) Let me know if you’d tweak any of the messaging, throttle frequency, placement in the startup flow, or anything else. --------- Co-authored-by: Thibault Sottiaux <tibo@openai.com>
2025-04-19 08:00:45 +08:00
"whatwg-url": "^14.2.0",
"which": "^5.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/openai/codex.git"
}
}