feat: user defined auto approve commands

Resolved 💬 1 comment Opened Apr 19, 2025 by autotaker Closed Apr 19, 2025

Summary

Allow users to specify additional auto-approved commands via a safeCommands array in the config file.

  • If a command starts with an entry in safeCommands (i.e., all elements match as a prefix), it is auto-approved.
  • Example: "npm test" in safeCommands will auto-approve both npm test and npm test --watch, but not npm install.

Example

{
  "safeCommands": ["npm test", "yarn build"]
}
  • ["npm", "test"] → auto-approved
  • ["npm", "test", "--watch"] → auto-approved
  • ["npm", "install"] → not auto-approved

Related

  • codex-cli/src/utils/config.ts
  • codex-cli/src/approvals.ts
  • codex-cli/tests/approvals.test.ts

PR

https://github.com/openai/codex/pull/386

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗