Files
Arpit Behera 18fc58c398 feat: add Codex CLI as a first-class fourth platform (#35)
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>
2026-04-12 21:26:56 +02:00

49 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# =============================================================================
# scripts/build.sh — Run the platform adapter to populate dist/<platform>/
# =============================================================================
# Usage: bash scripts/build.sh --platform <name>
# Discovers available platforms by listing adapters/ subdirectories.
# =============================================================================
set -eo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# shellcheck source=scripts/lib.sh
source "$SCRIPT_DIR/lib.sh"
# ── Parse args ─────────────────────────────────────────────────────────────
PLATFORM="claude-code"
while [[ $# -gt 0 ]]; do
case "$1" in
--platform) PLATFORM="$2"; shift 2 ;;
*) die "Unknown argument: $1" ;;
esac
done
# ── Validate platform ─────────────────────────────────────────────────────
if [[ ! -d "$REPO_ROOT/adapters/$PLATFORM" ]]; then
AVAILABLE="$(ls "$REPO_ROOT/adapters/" 2>/dev/null | grep -v '^lib.sh$' | tr '\n' ' ')"
die "Unknown platform: $PLATFORM. Available: $AVAILABLE"
fi
# ── Check dependencies ─────────────────────────────────────────────────────
case "$PLATFORM" in
codex-cli) ;;
*)
command -v jq >/dev/null 2>&1 || die "jq is required for the build (install via brew, apt, etc.)"
;;
esac
# ── Source adapters ────────────────────────────────────────────────────────
# shellcheck source=adapters/lib.sh
source "$REPO_ROOT/adapters/lib.sh"
# shellcheck source=/dev/null
source "$REPO_ROOT/adapters/$PLATFORM/adapter.sh"
# ── Run the build ──────────────────────────────────────────────────────────
DIST_DIR="$REPO_ROOT/dist/$PLATFORM"
info "Building $PLATFORM$DIST_DIR"
adapter_build "$REPO_ROOT" "$DIST_DIR"
success "Build complete"