core-agent-ide/codex-cli
John Gardner 965420cfc5
feat: read approvalMode from config file (#298)
This PR implements support for reading the approvalMode setting from the
user's config file (`~/.codex/config.json` or `~/.codex/config.yaml`),
allowing users to set a persistent default approval mode without needing
to specify command-line flags for each session.

Changes:
- Added approvalMode to the AppConfig type in config.ts
- Updated loadConfig() to read the approval mode from the config file
- Modified saveConfig() to persist the approval mode setting
- Updated CLI logic to respect the config-defined approval mode (while
maintaining CLI flag priority)
- Added comprehensive tests for approval mode config functionality
- Updated README to document the new config option in both YAML and JSON
formats
- additions to `.gitignore` for other CLI tools

Motivation:
As a user who regularly works with CLI-tools, I found it odd to have to
alias this with the command flags I wanted when `approvalMode` simply
wasn't being parsed even though it was an optional prop in `config.ts`.
This change allows me (and other users) to set the preference once in
the config file, streamlining daily usage while maintaining the ability
to override via command-line flags when needed.

Testing:
I've added a new test case loads and saves approvalMode correctly that
verifies:
- Reading the approvalMode from the config file works correctly
- Saving the approvalMode to the config file works as expected
- The value persists through load/save operations

All tests related to the implementation are passing.
2025-04-19 07:25:25 -07:00
..
bin fix: /bug report command, thinking indicator (#381) 2025-04-18 18:13:34 -07:00
examples fix: typos in prompts and comments (#195) 2025-04-17 07:12:39 -07:00
scripts Fix #371 Allow multiple containers on same machine (#373) 2025-04-18 16:48:07 -07:00
src feat: read approvalMode from config file (#298) 2025-04-19 07:25:25 -07:00
tests feat: read approvalMode from config file (#298) 2025-04-19 07:25:25 -07:00
.dockerignore (fix) update Docker container scripts (#47) 2025-04-16 12:02:41 -07:00
.editorconfig Initial commit 2025-04-16 12:56:08 -04:00
.eslintrc.cjs Initial commit 2025-04-16 12:56:08 -04:00
build.mjs Initial commit 2025-04-16 12:56:08 -04:00
Dockerfile chore: reduce docker image size (#194) 2025-04-17 07:12:14 -07:00
HUSKY.md Feat/add husky (#223) 2025-04-17 07:18:43 -07:00
ignore-react-devtools-plugin.js Initial commit 2025-04-16 12:56:08 -04:00
package.json fix: configure husky and lint-staged for pnpm monorepo (#384) 2025-04-19 07:18:36 -07:00
require-shim.js Initial commit 2025-04-16 12:56:08 -04:00
tsconfig.json fix: /bug report command, thinking indicator (#381) 2025-04-18 18:13:34 -07:00
vite.config.ts fix: add empty vite config file to prevent resolving to parent (#273) 2025-04-17 17:03:15 -07:00