feat: add Codex agent conversion and install support (#362)

Adds Codex as a conversion/install target: each agent → `~/.codex/agents/<slug>.toml` with the three required Codex fields (name, description, developer_instructions).

Validated: all 184 agents generate valid, parseable TOML (incl. 21k-char agents with embedded code blocks) via the PR's TOML basic-string escaper. Matches OpenAI's documented custom-agent schema.

Thanks @yunuskilicdev.
This commit is contained in:
Yunus Kılıç
2026-06-04 01:59:48 +02:00
committed by GitHub
parent ab414934e3
commit 620a061a90
7 changed files with 190 additions and 8 deletions
+20 -1
View File
@@ -20,6 +20,7 @@
# windsurf -- Copy .windsurfrules to current directory
# openclaw -- Copy workspaces to ~/.openclaw/agency-agents/
# qwen -- Copy SubAgents to ~/.qwen/agents/ (user-wide) or .qwen/agents/ (project)
# codex -- Copy custom agent TOML files to ~/.codex/agents/
# all -- Install for all detected tools (default)
#
# Flags:
@@ -101,7 +102,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
INTEGRATIONS="$REPO_ROOT/integrations"
ALL_TOOLS=(claude-code copilot antigravity gemini-cli opencode openclaw cursor aider windsurf qwen kimi)
ALL_TOOLS=(claude-code copilot antigravity gemini-cli opencode openclaw cursor aider windsurf qwen kimi codex)
# Standard agent category directories (keep sorted, sync with convert.sh / lint-agents.sh)
AGENT_DIRS=(
@@ -149,6 +150,7 @@ detect_openclaw() { command -v openclaw >/dev/null 2>&1 || [[ -d "${HOME}/.o
detect_windsurf() { command -v windsurf >/dev/null 2>&1 || [[ -d "${HOME}/.codeium" ]]; }
detect_qwen() { command -v qwen >/dev/null 2>&1 || [[ -d "${HOME}/.qwen" ]]; }
detect_kimi() { command -v kimi >/dev/null 2>&1; }
detect_codex() { command -v codex >/dev/null 2>&1 || [[ -d "${HOME}/.codex" ]]; }
is_detected() {
case "$1" in
@@ -163,6 +165,7 @@ is_detected() {
windsurf) detect_windsurf ;;
qwen) detect_qwen ;;
kimi) detect_kimi ;;
codex) detect_codex ;;
*) return 1 ;;
esac
}
@@ -181,6 +184,7 @@ tool_label() {
windsurf) printf "%-14s %s" "Windsurf" "(.windsurfrules)" ;;
qwen) printf "%-14s %s" "Qwen Code" "(~/.qwen/agents)" ;;
kimi) printf "%-14s %s" "Kimi Code" "(~/.config/kimi/agents)" ;;
codex) printf "%-14s %s" "Codex" "(~/.codex/agents)" ;;
esac
}
@@ -518,6 +522,20 @@ install_kimi() {
ok "Usage: kimi --agent-file ~/.config/kimi/agents/<agent-name>/agent.yaml"
}
install_codex() {
local src="$INTEGRATIONS/codex/agents"
local dest="${HOME}/.codex/agents"
local count=0
[[ -d "$src" ]] || { err "integrations/codex missing. Run convert.sh first."; return 1; }
mkdir -p "$dest"
local f
while IFS= read -r -d '' f; do
cp "$f" "$dest/"
(( count++ )) || true
done < <(find "$src" -maxdepth 1 -name "*.toml" -print0)
ok "Codex: $count agents -> $dest"
}
install_tool() {
case "$1" in
claude-code) install_claude_code ;;
@@ -531,6 +549,7 @@ install_tool() {
windsurf) install_windsurf ;;
qwen) install_qwen ;;
kimi) install_kimi ;;
codex) install_codex ;;
esac
}