**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

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>
35 lines
906 B
JSON
35 lines
906 B
JSON
{
|
|
"compilerOptions": {
|
|
"outDir": "dist",
|
|
"module": "ESNext",
|
|
"moduleResolution": "bundler",
|
|
"target": "esnext",
|
|
"lib": [
|
|
"DOM",
|
|
"DOM.Iterable",
|
|
"ES2022" // Node.js 18
|
|
],
|
|
"types": ["node"],
|
|
"baseUrl": "./",
|
|
"resolveJsonModule": true, // ESM doesn't yet support JSON modules.
|
|
"jsx": "react",
|
|
"declaration": true,
|
|
"newLine": "lf",
|
|
"stripInternal": true,
|
|
"strict": true,
|
|
"noImplicitReturns": true,
|
|
"noImplicitOverride": true,
|
|
"noUnusedLocals": true,
|
|
"noUnusedParameters": true,
|
|
"noFallthroughCasesInSwitch": true,
|
|
"noUncheckedIndexedAccess": true,
|
|
"noPropertyAccessFromIndexSignature": true,
|
|
"noUncheckedSideEffectImports": true,
|
|
"noEmitOnError": true,
|
|
"useDefineForClassFields": true,
|
|
"forceConsistentCasingInFileNames": true,
|
|
"skipLibCheck": true
|
|
},
|
|
"include": ["src", "tests"]
|
|
}
|