feat: add user-defined safe commands configuration and approval logic #380 (#386)

This pull request adds a feature that allows users to configure
auto-approved commands via a `safeCommands` array in the configuration
file.

## Related Issue
#380 

## Changes
- Added loading and validation of the `safeCommands` array in
`src/utils/config.ts`
- Implemented auto-approval logic for commands matching `safeCommands`
prefixes in `src/approvals.ts`
- Added test cases in `src/tests/approvals.test.ts` to verify
`safeCommands` behavior
- Updated documentation with examples and explanations of the
configuration
This commit is contained in:
autotaker
2025-04-19 14:35:32 +09:00
committed by GitHub
parent fd6f6c51c0
commit ca7ab76569
4 changed files with 68 additions and 1 deletions

View File

@@ -288,6 +288,9 @@ Codex looks for config files in **`~/.codex/`**.
model: o4-mini # Default model
fullAutoErrorMode: ask-user # or ignore-and-continue
notify: true # Enable desktop notifications for responses
safeCommands:
- npm test # Automatically approve npm test
- yarn lint # Automatically approve yarn lint
```
You can also define custom instructions: