|
| 1 | +--- |
| 2 | +description: Trunk Code Quality for OpenAI Codex |
| 3 | +--- |
| 4 | + |
| 5 | +# OpenAI Codex Support |
| 6 | + |
| 7 | +This document provides guidance for integrating Trunk Code Quality into OpenAI Codex environments. |
| 8 | + |
| 9 | +### Requirements |
| 10 | + |
| 11 | +Ensure you’re running the following minimum versions in your `.trunk/trunk.yaml` file: |
| 12 | + |
| 13 | +* Trunk CLI: v1.24.0 or later |
| 14 | +* Trunk Plugins: v1.7.0 or later |
| 15 | + |
| 16 | +### Installation |
| 17 | + |
| 18 | +In your Codex environment setup script, include: |
| 19 | + |
| 20 | +``` |
| 21 | +# Install Trunk CLI and dependent tools |
| 22 | +curl https://get.trunk.io -fsSL | bash |
| 23 | +trunk install |
| 24 | +``` |
| 25 | + |
| 26 | +It's important to pre-install all trunk dependencies during the setup because codex environments are network-isolated post-setup. |
| 27 | + |
| 28 | +#### Debugging Installation |
| 29 | + |
| 30 | +If the environment setup is slow, run the following to diagnose: |
| 31 | + |
| 32 | +``` |
| 33 | +trunk install --debug |
| 34 | +``` |
| 35 | + |
| 36 | +This command will detail installation timings and potential bottlenecks. |
| 37 | + |
| 38 | +### Handling Network Isolation |
| 39 | + |
| 40 | +Codex environments are network-isolated post-setup. Linters requiring network access must be excluded from running explicitly: |
| 41 | + |
| 42 | +Example: |
| 43 | + |
| 44 | +``` |
| 45 | +trunk check --filter=-trufflehog,-semgrep |
| 46 | +``` |
| 47 | + |
| 48 | +### Teaching Codex how to use Trunk |
| 49 | + |
| 50 | +Codex can automatically run trunk commands for you, by informing it to do so in your AGENTS.md file: |
| 51 | + |
| 52 | +``` |
| 53 | +## AGENTS Instructions |
| 54 | +
|
| 55 | +### Formatting and Linting |
| 56 | +- Run `trunk check -y --filter=-trufflehog,-semgrep` after modifying code to format and fix linting issues. |
| 57 | +- Review and verify changes before committing. |
| 58 | +- If only formatting is required, run `trunk fmt`. |
| 59 | +- Exclude linters requiring network access by adding them to the negative filter list as shown above. |
| 60 | +``` |
0 commit comments