feat: agent-agnostic codex support + bats test framework#52
Merged
MrFlounder merged 6 commits intomainfrom Mar 11, 2026
Merged
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent: codex(oragent: claude, the default) in their YAML configAgent CLI mapping
claude --dangerously-skip-permissionscodex --full-auto--continuecodex resume --last--resume <id>codex resume <id>claude --printcodex exec.claude/CLAUDE.mdAGENTS.mdOut of scope
Test plan
make test-unit)bash -n src/crabcode)agent:field default to claude🤖 Generated with Claude Code