OpenAI Codex cli
TMT๐ก OpenAI Codex CLI ์๊ฐ
OpenAI Codex CLI๋ ํฐ๋ฏธ๋์์ AI๋ฅผ ํ์ฉํ์ฌ ์ฝ๋ ์์ฑ, ์์ , ํ์ผ ๊ด๋ฆฌ ๋ฑ์ ํ ์ ์๋ ๋๊ตฌ์ ๋๋ค. ChatGPT ์์ค์ ์์ฐ์ด ์ดํด๋ฅผ ํตํด ์ฝ๋ ์์ฑ, ์์ , ๋ฆฌํฉํ ๋ง ๋ฑ์ ์ํํ ์ ์์ผ๋ฉฐ, ํฐ๋ฏธ๋ ๊ธฐ๋ฐ ์ํฌํ๋ก์ฐ์ ์ ํฉํ๊ฒ ์ค๊ณ๋์์ต๋๋ค. ๋จ์ํ ์ฝ๋ ์์ฑ์ ๋์ด ์ค์ ๋ก ํ์ผ์ ์์ ํ๊ฑฐ๋ ์คํํ์ฌ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํ ์ ์๋ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.
๐ Codex CLI ์ฃผ์ ๊ธฐ๋ฅ
-
์ฝ๋ ์์ฑ ๋ฐ ์์
-
์์ฐ์ด๋ก ์ฝ๋ ์์ฑ ์์ฒญ:
codex "create a simple REST API using FastAPI" -
์ฝ๋ ์์ ์์ฒญ:
codex "refactor the Dashboard component to use React Hooks" -
ํน์ ์ฝ๋ ํ์ผ ์ค๋ช :
codex "explain utils/date.ts"
-
-
์๋ ์คํ ๋ชจ๋
-
Suggest ๋ชจ๋ (๊ธฐ๋ณธ): ์ฝ๋ ์ ์๋ง ํ๊ณ , ์ฌ์ฉ์ ํ์ธ ํ ์คํ.
-
Auto Edit ๋ชจ๋: ์ฝ๋ ์์ ๊น์ง ์๋์ผ๋ก ์คํํ๋, ๋ช ๋ น์ด ์คํ์ ์น์ธ ํ์.
-
Full Auto ๋ชจ๋: ํ์ผ ์์ ๋ฐ ๋ช ๋ น์ด ์คํ์ ์๋์ผ๋ก ์ฒ๋ฆฌ (๋คํธ์ํฌ ๋นํ์ฑํ).
codex --approval-mode full-auto "generate unit tests for app.js"
-
-
ํ์ผ ๊ด๋ฆฌ
-
ํ์ผ ์ด๋/์ด๋ฆ ๋ณ๊ฒฝ ๋ฑ์ ํฐ๋ฏธ๋ ๋ช ๋ น์ด์ ๊ฒฐํฉํ์ฌ ์ํ:
codex "Bulk-rename *.jpeg -> *.jpg with git mv"
-
-
๋ณด์ ๋ชจ๋ธ
- ๊ธฐ๋ณธ์ ์ผ๋ก ๋คํธ์ํฌ๋ฅผ ๋นํ์ฑํํ์ฌ ์ธ๋ถ๋ก๋ถํฐ ๊ฒฉ๋ฆฌ๋ ์ํ๋ก ์ฝ๋ ์คํ.
- macOS:
sandbox-exec๋ฅผ ์ฌ์ฉํ์ฌ ๊ถํ์ ์ ํ. - Linux: Docker๋ฅผ ์ฌ์ฉํ์ฌ ๋คํธ์ํฌ๋ฅผ ๊ฒฉ๋ฆฌ.
-
CI/CD์์ ์ฐ๋
-
CI ํ์ดํ๋ผ์ธ์์ ์ฌ์ฉ ๊ฐ๋ฅ:
- name: Update changelog via Codex run: | npm install -g @openai/codex export OPENAI_API_KEY="${{ secrets.OPENAI_KEY }}" codex -a auto-edit --quiet "update CHANGELOG for next release"
-
-
๋ค์ํ AI ์ ๊ณต์ ์ง์
-
OpenAI ๋ฟ๋ง ์๋๋ผ Azure, OpenRouter, Gemini, Ollama ๋ฑ ๋ค์ํ AI ๋ชจ๋ธ ์ฌ์ฉ ๊ฐ๋ฅ.
-
ํ๊ฒฝ ๋ณ์๋ก API ํค ์ค์ :
export OPENAI_API_KEY="your-api-key-here" export AZURE_OPENAI_API_KEY="your-azure-api-key-here"
-
-
๋๋ฒ๊น ์ง์
-
๋๋ฒ๊น ๋ชจ๋ ํ์ฑํ:
DEBUG=true codex -
CLI์ ๋ฌธ์ ํด๊ฒฐ์ ์ํ ๋ก๊ทธ๋ฅผ ์์ธํ ํ์ธ ๊ฐ๋ฅ.
-
๐ ๏ธ ์ฌ์ฉ ์์
-
์ฝ๋ ์์ฑ
codex "create a Python script that reads a CSV and prints the average value"- Python ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ์ฌ CSV ํ์ผ์ ์ฝ๊ณ ํ๊ท ๊ฐ์ ์ถ๋ ฅํ๋ ์ฝ๋ ์์ฑ.
- ์์ฑ ํ
print๋ก ํ๊ท ๊ฐ์ ํ์ธํ๋ ๋ก์ง๊น์ง ํฌํจ.
-
์ฝ๋ ์์
codex "convert this class-based component to a functional component"- ๊ธฐ์กด React ํด๋์คํ ์ปดํฌ๋ํธ๋ฅผ ํจ์ํ ์ปดํฌ๋ํธ๋ก ๋ณํํ์ฌ ์์ .
-
ํ์ผ ๋ณ๊ฒฝ
codex "rename all .txt files to .md"- ํ์ฌ ๋๋ ํ ๋ฆฌ์ ๋ชจ๋
.txtํ์ผ์.md๋ก ๋ณ๊ฒฝ.
- ํ์ฌ ๋๋ ํ ๋ฆฌ์ ๋ชจ๋
-
์ฝ๋ ๋ฆฌ๋ทฐ ์๋ํ
codex "analyze this codebase for potential security vulnerabilities"- ์ฝ๋๋ฒ ์ด์ค๋ฅผ ๋ถ์ํ์ฌ ์ ์ฌ์ ๋ณด์ ์ทจ์ฝ์ ๋ฆฌํฌํธ ์์ฑ.
๐งฉ SDK์ฒ๋ผ ์ฌ์ฉํ๊ธฐ
Codex CLI๋ฅผ SDK์ฒ๋ผ ์ฌ์ฉํ์ฌ ์๋ํ ์ํฌํ๋ก์ฐ์ ํตํฉํ ์ ์์ต๋๋ค.
-
ํ๋ก๊ทธ๋จ ์คํ Node.js ์ ํ๋ฆฌ์ผ์ด์ ์์ Codex๋ฅผ ๋ช ๋ น์ค๋ก ํธ์ถํ์ฌ ์ฝ๋ ์๋ ์์ฑ:
const { exec } = require("child_process"); exec('codex "generate a REST API in Python"', (err, stdout, stderr) => { if (err) { console.error(`Error: ${stderr}`); return; } console.log(`Generated Code: ${stdout}`); }); -
CI ํ์ดํ๋ผ์ธ์์ ์ฌ์ฉ
-
GitHub Actions๋ฅผ ์ฌ์ฉํ์ฌ ์ฝ๋ ์์ ๋ฐ ๋ฆฌ๋ทฐ ์๋ํ:
- name: Automated Code Review run: | npm install -g @openai/codex export OPENAI_API_KEY="${{ secrets.OPENAI_KEY }}" codex -a auto-edit "review the recent changes for potential bugs" -
์๋ ๋ฆฌ๋ทฐ ํ ์์ ์ฌํญ์ Git์ ์ปค๋ฐํ๋๋ก ์ค์ .
-
-
์คํฌ๋ฆฝํธ ์์ฑ ๋ฐ ์คํ Codex๋ฅผ ํตํด ์ฝ๋๋ฅผ ์์ฑํ๊ณ ํ ์คํธ๊น์ง ์๋์ผ๋ก ์งํ:
codex "generate a Jest test for add.js"- ํ
์คํธ ํ์ผ ์์ฑ ํ
npm test๋ก ์๋ ์คํํ์ฌ ๊ฒฐ๊ณผ ํ์ธ.
- ํ
์คํธ ํ์ผ ์์ฑ ํ
๐ก ํ์ฉ ์์ด๋์ด
-
์ฝ๋ ๋ฆฌํฉํ ๋ง ์๋ํ
- ์ฝ๋๋ฒ ์ด์ค ์ ์ฒด๋ฅผ ๋ถ์ํ์ฌ ๋นํจ์จ์ ์ธ ๋ถ๋ถ์ ์ฐพ์ ์์ .
-
ํ ์คํธ ์ฝ๋ ์์ฑ
- ํจ์๋ณ๋ก ์๋ ํ ์คํธ ์ฝ๋๋ฅผ ์์ฑํ์ฌ ์ปค๋ฒ๋ฆฌ์ง ํ์ฅ.
-
๋ฌธ์ ์๋ ์์ฑ
- ํจ์ ์ค๋ช ๋ฐ ์ฝ๋ ๊ตฌ์กฐ๋ฅผ ์๋์ผ๋ก ๋ฌธ์ํํ์ฌ ๊ฐ๋ฐ ๊ฐ์ด๋ ์์ฑ.
-
๋ณด์ ๊ฐ์ฌ
- ์คํ์์ค ํ๋ก์ ํธ์์ ์ทจ์ฝ์ ํ์ง ๋ฐ ํจ์น ์ ์.
-
์ค์๊ฐ ํผ๋๋ฐฑ
- ์ฝ๋๋ฅผ ์์ฑํ๋ฉด์ AI ํผ๋๋ฐฑ์ ๋ฐ์ ๋ ๋์ ์ฝ๋ ์์ฑ ์ ๋.
โ ์ ๋ฆฌ
Codex CLI๋ ๊ฐ๋ฐ์๊ฐ ํฐ๋ฏธ๋ ํ๊ฒฝ์์ AI์ ๊ฐ๋ ฅํ ์ฝ๋ ์์ฑ์ ํ์ฉํ ์ ์๋๋ก ํด์ค๋๋ค. ๋ค์ํ AI ๋ชจ๋ธ๊ณผ ์ ์ฐํ๊ฒ ์ฐ๋๋๋ฉฐ, ์๋ํ๋ ์ฝ๋ ์์ฑ ๋ฐ ์์ ์ ์ ํฉํฉ๋๋ค. SDK์ฒ๋ผ ํ์ฉํ์ฌ ์ฝ๋ ์๋ํ์ CI/CD ํ์ดํ๋ผ์ธ์์ ํ์ฉํ ์ ์์ด ๋งค์ฐ ์ ์ฉํฉ๋๋ค. ํฐ๋ฏธ๋์ ๋ง์ด ์ฌ์ฉํ๋ ๊ฐ๋ฐ์๋ผ๋ฉด Codex CLI๋ฅผ ํตํด AI ๊ธฐ๋ฐ ์ฝ๋ ์์ฑ์ ์๋ก์ด ๊ฐ๋ฅ์ฑ์ ํํํ ์ ์์ต๋๋ค.