feat: add Codex CLI as a first-class fourth platform

Rebuilt from scratch following Codex CLI's actual architecture (as
outlined in the review on PR #26). Closes the integration gap with a
proper build adapter, correct install paths, TOML agent files, and
all the architectural differences documented and tested.

What changed vs the previous attempt (PR #26):

- Agents: build adapter generates .toml files (name/description/
  developer_instructions) into dist/codex-cli/.codex/agents/ instead
  of copying .md files with sed transforms
- Skills: installed to .agents/skills/ (correct Codex discovery path)
  instead of .codex/skills/
- Dispatcher: AGENTS.md uses a root-context orchestration header that
  works within agents.max_depth=1 constraints; named-agent routing
  replaced with embedded-instructions workaround for the known
  spawn_agents limitation (openai/codex#15250)
- Tool compat: AskUserQuestion and request_user_input removed; all
  prompts adapted to Codex's actual tool set and approval/confirmation
  flow
- Installer/updater: launchme.sh --platform codex-cli and updateme.sh
  with Codex auto-detection, creating the correct split layout
  (AGENTS.md + .codex/agents/ + .codex/config.toml + .agents/skills/)
- Tests: new per-adapter test suite (tests/adapters/codex-cli/),
  install/update smoke (tests/scripts/codex-cli-install.test.sh), and
  a four-platform parity gate that proves Codex changes do not regress
  Claude Code, Gemini CLI, or OpenCode
- Docs: new codex-cli.md guide, codex-migration.md for users switching
  from other platforms, and README/getting-started/examples updated for
  four-platform positioning
- Bash harness: .gitattributes added to enforce LF on .sh files;
  harness LF-normalized so tests/run.sh works on Windows checkouts
- .gitignore: .planning/ added (internal GSD workflow artifacts)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Arpit Behera
2026-04-12 17:45:10 +03:00
parent 49839486b8
commit 3dde38e284
18 changed files with 3136 additions and 30 deletions

View File

@@ -51,6 +51,20 @@ copy_if_changed() {
fi
}
# ── copy_tree_if_changed <src_dir> <dst_dir> ────────────────────────────────
# Overlays a source directory tree onto the destination when files differ or
# the destination does not exist. This preserves nested skill assets/scripts
# needed by platforms such as Codex CLI.
copy_tree_if_changed() {
local src="$1" dst="$2"
_LAST_CHANGED=0
if [[ ! -d "$dst" ]] || ! diff -qr "$src" "$dst" >/dev/null 2>&1; then
mkdir -p "$dst"
cp -R "$src/." "$dst/"
_LAST_CHANGED=1
fi
}
# ── _insert_after_start_marker <dst> <content> ───────────────────────────────
# Inserts <content> immediately after the MBIFC:CUSTOM_AGENTS_START line in dst.
# dst must already exist and contain the marker.
@@ -304,7 +318,32 @@ install_agents() {
local src_dir="$1" dst_dir="$2"
local count=0 manifest=()
mkdir -p "$dst_dir"
for src in "$src_dir/"*.md; do
for src in "$src_dir/"*; do
[[ -f "$src" ]] || continue
case "$src" in
*.md|*.toml) ;;
*) continue ;;
esac
local name; name="$(basename "$src")"
manifest+=("$name")
copy_if_changed "$src" "$dst_dir/$name"
if [[ $_LAST_CHANGED -eq 1 ]]; then
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated agent: $name" || true
count=$((count + 1))
fi
done
manifest_write "agents" "${manifest[@]}"
printf '%d' "$count"
}
# install_toml_agents <src_dir> <dst_dir>
# Copies *.toml agent files from src to dst. Used by Codex CLI platform installs
# where agents are .toml rather than .md. Tracked in the manifest under "agents".
install_toml_agents() {
local src_dir="$1" dst_dir="$2"
local count=0 manifest=()
mkdir -p "$dst_dir"
for src in "$src_dir/"*.toml; do
[[ -f "$src" ]] || continue
local name; name="$(basename "$src")"
manifest+=("$name")
@@ -349,8 +388,7 @@ install_skills() {
[[ -f "${skill_src}SKILL.md" ]] || continue
local name; name="$(basename "$skill_src")"
manifest+=("$name")
mkdir -p "$dst_dir/$name"
copy_if_changed "${skill_src}SKILL.md" "$dst_dir/$name/SKILL.md"
copy_tree_if_changed "$skill_src" "$dst_dir/$name"
if [[ $_LAST_CHANGED -eq 1 ]]; then
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated skill: $name" || true
count=$((count + 1))