Skip to content

feat: agent-agnostic codex support + bats test framework#52

Merged
MrFlounder merged 6 commits intomainfrom
feat/agent-agnostic-codex-support
Mar 11, 2026
Merged

feat: agent-agnostic codex support + bats test framework#52
MrFlounder merged 6 commits intomainfrom
feat/agent-agnostic-codex-support

Conversation

@MrFlounder
Copy link
Contributor

Summary

  • Agent abstraction layer: Crabcode now natively supports codex alongside claude. Projects configure agent: codex (or agent: claude, the default) in their YAML config
  • ~180 LOC helper functions centralize all agent-specific CLI differences (command building, session resume, system prompts, non-interactive mode)
  • All callsites updated: workspace open/continue, WIP save/restore/list, session start/resume, review, handoff — all use the new helpers
  • Bats-core test framework vendored as git submodules with 36 unit tests for the agent layer
  • CI workflow runs unit tests + shellcheck on every PR

Agent CLI mapping

Operation Claude Codex
Base command claude --dangerously-skip-permissions codex --full-auto
Continue session --continue codex resume --last
Resume specific --resume <id> codex resume <id>
Non-interactive claude --print codex exec
System prompt .claude/CLAUDE.md AGENTS.md

Out of scope

  • Court review (hardcoded Claude judge + Codex reviewer B) — separate PR

Test plan

  • 36 bats unit tests pass locally (make test-unit)
  • Bash syntax check passes (bash -n src/crabcode)
  • CI runs on this PR (first run — watch it)
  • Backward compat: existing projects without agent: field default to claude
  • Source guard enables testing without executing main

🤖 Generated with Claude Code

Make crabcode natively support codex alongside claude. Projects can
configure `agent: codex` in their YAML config to use codex as the
default coding agent.

Changes:
- Add agent abstraction layer (~180 LOC) with helpers for command
  building, session resume, system prompts, and display names
- Update all callsites: open_workspace, continue_workspace, wip_save,
  wip_restore, wip_list, generate_wip_summary, session_start,
  session_resume, review_quick, handoff save/receive
- Backward compatible: defaults to claude when no agent field set
- Court review left hardcoded (out of scope)

Testing:
- Add bats-core framework (vendored as git submodules)
- Add 36 unit tests for the agent abstraction layer
- Add source guard to src/crabcode for testability
- Update Makefile with test-unit target
- Add CI workflow (.github/workflows/test.yml)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The 10k-line script has hundreds of SC2155 warnings (declare and assign
separately) throughout — these predate this PR. Set --severity=error
so CI catches real issues without blocking on cosmetic warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MrFlounder and others added 4 commits March 10, 2026 21:04
GitHub Advanced Security flagged missing permissions. Set contents: read
as the minimal required scope for checkout + test execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace GNU-only `sed 's/^./\U&/'` with `${var^}` bash parameter
expansion. BSD sed (macOS) doesn't support \U, causing "Ucodex" instead
of "Codex" in wip list output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
${var^} requires bash 4+, but macOS ships bash 3.2. Use awk toupper()
which works everywhere.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…structure

Codex stores sessions as ~/.codex/sessions/YYYY/MM/DD/rollout-<ts>-<uuid>.jsonl.
The old code just listed top-level dirs, grabbing "2026" instead of the UUID.
Now finds the most recent .jsonl file and extracts the UUID with grep.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MrFlounder MrFlounder merged commit 164a6be into main Mar 11, 2026
5 checks passed
@MrFlounder MrFlounder deleted the feat/agent-agnostic-codex-support branch March 11, 2026 04:45
MrFlounder added a commit that referenced this pull request Mar 11, 2026
)

## Summary

- **`crab agent status`** — audit what MCP servers and agents/skills
exist on Claude vs Codex side
- **`crab agent sync mcp`** — mechanically translate MCP server configs
between Claude's JSON and Codex's TOML (uses `codex mcp add` for
reliable config writing)
- **`crab agent sync agents`** — LLM-assisted rewrite of Claude agents →
Codex skills (and vice versa)
- Dry-run by default, `--apply` to write changes, `--from claude|codex`
for direction

Builds on the agent-agnostic foundation from #52.

## Test plan

- [x] `crab agent status` — correctly shows Linear MCP in Claude, agents
list, gaps
- [x] `crab agent sync mcp --from claude --apply` — synced Linear to
Codex, verified with `codex mcp list`
- [x] `crab agent status` after sync — shows MCP "✓ In sync"
- [x] `make test-unit` — all 36 existing tests pass (no regressions)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@MrFlounder MrFlounder mentioned this pull request Mar 11, 2026
MrFlounder added a commit that referenced this pull request Mar 11, 2026
## Summary

Bump version `0.12.0` → `0.13.0`.

Features since 0.12.0:
- Agent-agnostic support — Claude Code + Codex CLI (#52)
- `crab agent sync` for cross-agent config migration (#55)
- `crab env snapshot/restore` for machine migration (#57)
- Bats unit test framework + CI (#52)
- `crab court` fresh-start prompt fix (#54)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant