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 κΈ°λ° μ½λ μμ±μ μλ‘μ΄ κ°λ₯μ±μ ννν μ μμ΅λλ€.