mirror of
https://github.com/gnekt/My-Brain-Is-Full-Crew.git
synced 2026-09-05 23:10:52 +00:00
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:
@@ -28,7 +28,12 @@ if [[ ! -d "$REPO_ROOT/adapters/$PLATFORM" ]]; then
|
||||
fi
|
||||
|
||||
# ── Check dependencies ─────────────────────────────────────────────────────
|
||||
command -v jq >/dev/null 2>&1 || die "jq is required for the build (install via brew, apt, etc.)"
|
||||
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
|
||||
|
||||
@@ -102,6 +102,7 @@ EXISTING=0
|
||||
[[ -d "$VAULT_DIR/.claude" ]] && EXISTING=1
|
||||
[[ -d "$VAULT_DIR/.opencode" ]] && EXISTING=1
|
||||
[[ -d "$VAULT_DIR/.gemini" ]] && EXISTING=1
|
||||
[[ -d "$VAULT_DIR/.codex" ]] && EXISTING=1
|
||||
[[ -f "$VAULT_DIR/CLAUDE.md" ]] && EXISTING=1
|
||||
[[ -f "$VAULT_DIR/AGENTS.md" ]] && EXISTING=1
|
||||
[[ -f "$VAULT_DIR/GEMINI.md" ]] && EXISTING=1
|
||||
@@ -111,6 +112,7 @@ if [[ $EXISTING -eq 1 ]]; then
|
||||
[[ -d "$VAULT_DIR/.claude" ]] && warn " .claude/ directory exists"
|
||||
[[ -d "$VAULT_DIR/.opencode" ]] && warn " .opencode/ directory exists"
|
||||
[[ -d "$VAULT_DIR/.gemini" ]] && warn " .gemini/ directory exists"
|
||||
[[ -d "$VAULT_DIR/.codex" ]] && warn " .codex/ directory exists"
|
||||
[[ -f "$VAULT_DIR/CLAUDE.md" ]] && warn " CLAUDE.md exists"
|
||||
[[ -f "$VAULT_DIR/AGENTS.md" ]] && warn " AGENTS.md exists"
|
||||
[[ -f "$VAULT_DIR/GEMINI.md" ]] && warn " GEMINI.md exists"
|
||||
@@ -162,11 +164,26 @@ case "$PLATFORM" in
|
||||
MCP_SRC=""
|
||||
MCP_DST=""
|
||||
HAS_PLUGINS=0
|
||||
DIST_SKILLS_DIR="$DIST_COMPONENTS_DIR/skills"
|
||||
VAULT_SKILLS_DIR="$VAULT_COMPONENTS_DIR/skills"
|
||||
;;
|
||||
codex-cli)
|
||||
DIST_COMPONENTS_DIR="$DIST_DIR/.codex"
|
||||
VAULT_COMPONENTS_DIR="$VAULT_DIR/.codex"
|
||||
DISPATCHER_SRC="$DIST_DIR/AGENTS.md"
|
||||
DISPATCHER_DST="$VAULT_DIR/AGENTS.md"
|
||||
MCP_SRC="$DIST_DIR/.codex/config.toml"
|
||||
MCP_DST="$VAULT_DIR/.codex/config.toml"
|
||||
HAS_PLUGINS=0
|
||||
DIST_SKILLS_DIR="$DIST_DIR/.agents/skills"
|
||||
VAULT_SKILLS_DIR="$VAULT_DIR/.agents/skills"
|
||||
;;
|
||||
*)
|
||||
die "Unknown platform: $PLATFORM (install layout not defined)"
|
||||
;;
|
||||
esac
|
||||
[[ -n "${DIST_SKILLS_DIR:-}" ]] || DIST_SKILLS_DIR="$DIST_COMPONENTS_DIR/skills"
|
||||
[[ -n "${VAULT_SKILLS_DIR:-}" ]] || VAULT_SKILLS_DIR="$VAULT_COMPONENTS_DIR/skills"
|
||||
PLATFORM_VAULT_DIR="$VAULT_COMPONENTS_DIR"
|
||||
|
||||
# Load opencode-specific helpers when building for opencode
|
||||
@@ -190,7 +207,11 @@ mkdir -p "$VAULT_DIR/Meta/states"
|
||||
|
||||
# ── Install components ────────────────────────────────────────────────────────
|
||||
info "Installing agents..."
|
||||
AGENT_COUNT=$(install_agents "$DIST_COMPONENTS_DIR/agents" "$VAULT_COMPONENTS_DIR/agents")
|
||||
if [[ "$PLATFORM" == "codex-cli" ]]; then
|
||||
AGENT_COUNT=$(install_toml_agents "$DIST_COMPONENTS_DIR/agents" "$VAULT_COMPONENTS_DIR/agents")
|
||||
else
|
||||
AGENT_COUNT=$(install_agents "$DIST_COMPONENTS_DIR/agents" "$VAULT_COMPONENTS_DIR/agents")
|
||||
fi
|
||||
success "Agents: $AGENT_COUNT installed/updated"
|
||||
|
||||
info "Installing references..."
|
||||
@@ -198,7 +219,7 @@ REF_COUNT=$(install_refs "$DIST_COMPONENTS_DIR/references" "$VAULT_COMPONENTS_DI
|
||||
success "References: $REF_COUNT installed/updated"
|
||||
|
||||
info "Installing skills..."
|
||||
SKILL_COUNT=$(install_skills "$DIST_COMPONENTS_DIR/skills" "$VAULT_COMPONENTS_DIR/skills")
|
||||
SKILL_COUNT=$(install_skills "$DIST_SKILLS_DIR" "$VAULT_SKILLS_DIR")
|
||||
success "Skills: $SKILL_COUNT installed/updated"
|
||||
|
||||
info "Installing hooks..."
|
||||
@@ -266,19 +287,30 @@ echo ""
|
||||
echo -e " ${VAULT_DIR}/"
|
||||
FW_DIR_NAME="$(basename "$VAULT_COMPONENTS_DIR")"
|
||||
DISPATCHER_NAME="$(basename "$DISPATCHER_DST")"
|
||||
echo -e " ├── ${FW_DIR_NAME}/"
|
||||
echo -e " │ ├── agents/ ${DIM}← agents${NC}"
|
||||
echo -e " │ ├── skills/ ${DIM}← skills${NC}"
|
||||
echo -e " │ ├── hooks/ ${DIM}← hooks${NC}"
|
||||
if [[ $HAS_PLUGINS -eq 1 ]]; then
|
||||
echo -e " │ ├── plugins/ ${DIM}← hook plugins${NC}"
|
||||
if [[ "$PLATFORM" == "codex-cli" ]]; then
|
||||
echo -e " ├── .codex/"
|
||||
echo -e " │ ├── agents/ ${DIM}← custom agents${NC}"
|
||||
echo -e " │ ├── references/ ${DIM}← shared docs${NC}"
|
||||
echo -e " │ └── config.toml ${DIM}← MCP + profiles${NC}"
|
||||
echo -e " ├── .agents/"
|
||||
echo -e " │ └── skills/ ${DIM}← repo skills${NC}"
|
||||
else
|
||||
echo -e " │ ├── settings.json ${DIM}← hooks configuration${NC}"
|
||||
echo -e " ├── ${FW_DIR_NAME}/"
|
||||
echo -e " │ ├── agents/ ${DIM}← agents${NC}"
|
||||
echo -e " │ ├── skills/ ${DIM}← skills${NC}"
|
||||
echo -e " │ ├── hooks/ ${DIM}← hooks${NC}"
|
||||
if [[ $HAS_PLUGINS -eq 1 ]]; then
|
||||
echo -e " │ ├── plugins/ ${DIM}← hook plugins${NC}"
|
||||
else
|
||||
echo -e " │ ├── settings.json ${DIM}← hooks configuration${NC}"
|
||||
fi
|
||||
echo -e " │ └── references/ ${DIM}← shared docs${NC}"
|
||||
fi
|
||||
echo -e " │ └── references/ ${DIM}← shared docs${NC}"
|
||||
echo -e " ├── Meta/"
|
||||
echo -e " │ └── scripts/ ${DIM}← ${ORCH_COUNT:-0} orchestra scripts${NC}"
|
||||
if [[ -n "$MCP_SRC" && -f "$MCP_DST" ]]; then
|
||||
if [[ "$PLATFORM" == "codex-cli" && -f "$MCP_DST" ]]; then
|
||||
echo -e " └── ${DISPATCHER_NAME} ${DIM}← project instructions${NC}"
|
||||
elif [[ -n "$MCP_SRC" && -f "$MCP_DST" ]]; then
|
||||
echo -e " ├── ${DISPATCHER_NAME} ${DIM}← project instructions${NC}"
|
||||
echo -e " └── $(basename "$MCP_DST") ${DIM}← MCP servers${NC}"
|
||||
else
|
||||
@@ -295,6 +327,7 @@ case "$PLATFORM" in
|
||||
claude-code) echo -e " 1. Open Claude Code in your vault folder" ;;
|
||||
opencode) echo -e " 1. Open OpenCode in your vault folder" ;;
|
||||
gemini-cli) echo -e " 1. Open Gemini CLI in your vault folder" ;;
|
||||
codex-cli) echo -e " 1. Open Codex CLI in your vault folder (run: codex)" ;;
|
||||
*) echo -e " 1. Open your agent platform in your vault folder" ;;
|
||||
esac
|
||||
echo -e " 2. Say: ${BOLD}\"Initialize my vault\"${NC}"
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -42,6 +42,7 @@ if [[ -z "$PLATFORM" ]]; then
|
||||
[[ -d "$VAULT_DIR/.claude/agents" ]] && DETECTED+=("claude-code")
|
||||
[[ -d "$VAULT_DIR/.opencode/agents" ]] && DETECTED+=("opencode")
|
||||
[[ -d "$VAULT_DIR/.gemini/agents" ]] && DETECTED+=("gemini-cli")
|
||||
[[ -d "$VAULT_DIR/.codex/agents" ]] && DETECTED+=("codex-cli")
|
||||
|
||||
if [[ ${#DETECTED[@]} -eq 0 ]]; then
|
||||
die "No installed platform detected in $VAULT_DIR — run launchme.sh first"
|
||||
@@ -73,6 +74,7 @@ case "$PLATFORM" in
|
||||
claude-code) _SETUP_CHECK="$VAULT_DIR/.claude/agents" ;;
|
||||
opencode) _SETUP_CHECK="$VAULT_DIR/.opencode/agents" ;;
|
||||
gemini-cli) _SETUP_CHECK="$VAULT_DIR/.gemini/agents" ;;
|
||||
codex-cli) _SETUP_CHECK="$VAULT_DIR/.codex/agents" ;;
|
||||
*) die "Unknown platform: $PLATFORM" ;;
|
||||
esac
|
||||
[[ -d "$_SETUP_CHECK" ]] \
|
||||
@@ -83,6 +85,7 @@ case "$PLATFORM" in
|
||||
opencode) _DISP_NAME="AGENTS.md"; _FW_DIR_NAME="opencode" ;;
|
||||
gemini-cli) _DISP_NAME="GEMINI.md"; _FW_DIR_NAME="gemini" ;;
|
||||
claude-code) _DISP_NAME="CLAUDE.md"; _FW_DIR_NAME="claude" ;;
|
||||
codex-cli) _DISP_NAME="AGENTS.md"; _FW_DIR_NAME="codex" ;;
|
||||
*) die "Unknown platform: $PLATFORM" ;;
|
||||
esac
|
||||
echo -e "${BOLD}This will update core agents, skills, references, hooks, and ${_DISP_NAME}.${NC}"
|
||||
@@ -132,11 +135,26 @@ case "$PLATFORM" in
|
||||
MCP_SRC=""
|
||||
MCP_DST=""
|
||||
HAS_PLUGINS=0
|
||||
DIST_SKILLS_DIR="$DIST_COMPONENTS_DIR/skills"
|
||||
VAULT_SKILLS_DIR="$VAULT_COMPONENTS_DIR/skills"
|
||||
;;
|
||||
codex-cli)
|
||||
DIST_COMPONENTS_DIR="$DIST_DIR/.codex"
|
||||
VAULT_COMPONENTS_DIR="$VAULT_DIR/.codex"
|
||||
DISPATCHER_SRC="$DIST_DIR/AGENTS.md"
|
||||
DISPATCHER_DST="$VAULT_DIR/AGENTS.md"
|
||||
MCP_SRC="$DIST_DIR/.codex/config.toml"
|
||||
MCP_DST="$VAULT_DIR/.codex/config.toml"
|
||||
HAS_PLUGINS=0
|
||||
DIST_SKILLS_DIR="$DIST_DIR/.agents/skills"
|
||||
VAULT_SKILLS_DIR="$VAULT_DIR/.agents/skills"
|
||||
;;
|
||||
*)
|
||||
die "Unknown platform: $PLATFORM (install layout not defined)"
|
||||
;;
|
||||
esac
|
||||
[[ -n "${DIST_SKILLS_DIR:-}" ]] || DIST_SKILLS_DIR="$DIST_COMPONENTS_DIR/skills"
|
||||
[[ -n "${VAULT_SKILLS_DIR:-}" ]] || VAULT_SKILLS_DIR="$VAULT_COMPONENTS_DIR/skills"
|
||||
PLATFORM_VAULT_DIR="$VAULT_COMPONENTS_DIR"
|
||||
|
||||
# Load opencode-specific helpers when building for opencode
|
||||
@@ -158,9 +176,13 @@ mkdir -p "$VAULT_DIR/Meta/states"
|
||||
# ── Update components (per-file logging enabled) ─────────────────────────────
|
||||
VERBOSE_COPY=1
|
||||
|
||||
AGENT_COUNT=$(install_agents "$DIST_COMPONENTS_DIR/agents" "$VAULT_COMPONENTS_DIR/agents")
|
||||
if [[ "$PLATFORM" == "codex-cli" ]]; then
|
||||
AGENT_COUNT=$(install_toml_agents "$DIST_COMPONENTS_DIR/agents" "$VAULT_COMPONENTS_DIR/agents")
|
||||
else
|
||||
AGENT_COUNT=$(install_agents "$DIST_COMPONENTS_DIR/agents" "$VAULT_COMPONENTS_DIR/agents")
|
||||
fi
|
||||
REF_COUNT=$(install_refs "$DIST_COMPONENTS_DIR/references" "$VAULT_COMPONENTS_DIR/references")
|
||||
SKILL_COUNT=$(install_skills "$DIST_COMPONENTS_DIR/skills" "$VAULT_COMPONENTS_DIR/skills")
|
||||
SKILL_COUNT=$(install_skills "$DIST_SKILLS_DIR" "$VAULT_SKILLS_DIR")
|
||||
HOOK_COUNT=$(install_hooks "$DIST_COMPONENTS_DIR/hooks" "$VAULT_COMPONENTS_DIR/hooks")
|
||||
|
||||
PLUGIN_COUNT=0
|
||||
|
||||
Reference in New Issue
Block a user