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
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