Skip to content

feat(adapters): Codex CLI adapter — export + import (#32)#45

Open
nanookclaw wants to merge 1 commit intoopen-gitagent:mainfrom
nanookclaw:feat/codex-cli-adapter
Open

feat(adapters): Codex CLI adapter — export + import (#32)#45
nanookclaw wants to merge 1 commit intoopen-gitagent:mainfrom
nanookclaw:feat/codex-cli-adapter

Conversation

@nanookclaw
Copy link
Contributor

What

Adds an adapter for OpenAI Codex CLI, closing #32 (help wanted).

New files:

  • src/adapters/codex.tsexportToCodex() and exportToCodexString()
  • src/adapters/codex.test.ts — 15 new tests (29/29 full suite pass)

Updated files:

  • src/adapters/index.ts — re-exports the new adapter
  • src/commands/export.ts — adds 'codex' format case
  • src/commands/import.ts — adds importFromCodex() for 'codex' source

Format mapping

Codex CLI uses AGENTS.md for instructions (identical to OpenCode) and codex.json for model config.

gitagent Codex CLI
agent.yaml + SOUL.md + RULES.md AGENTS.md
model.preferred codex.json model
claude/gemini models provider: "openai-compatible"
llama/mistral/qwen provider: "ollama"
gpt/o-series/codex (default — no provider field)

Usage

Export:

gitagent export --format codex

Emits AGENTS.md (identity, rules, skills, compliance) and codex.json (model + provider).

Import:

gitagent import --from codex <path>

Reads AGENTS.md + codex.json, produces agent.yaml + SOUL.md + optional RULES.md.

Tests

15 new tests across two suites:

  • exportToCodex: struct shape, SOUL/RULES/skill content, model/provider inference for 5 provider families
  • exportToCodexString: section headers, JSON validity, empty config

Follows the pattern of the existing cursor.test.ts and opencode.ts adapters.

Add OpenAI Codex CLI adapter, closing open-gitagent#32 (help wanted).

## What

- New  —  and
- New  — 15 tests, 29/29 total suite pass
- Updated  — re-exports the new adapter
- Updated  — adds 'codex' format case
- Updated  — adds importFromCodex() for 'codex' source

## Why

Codex CLI (openai/codex) is OpenAI's open-source terminal coding agent.
Gitagent can now round-trip agents to/from Codex CLI format.

## Format mapping

| gitagent            | Codex CLI            |
|---------------------|----------------------|
| agent.yaml + SOUL.md + RULES.md | AGENTS.md |
| model.preferred     | codex.json model     |
| model → claude/gemini | provider: openai-compatible |
| model → llama/mistral | provider: ollama   |
| model → gpt/o-series | (default, no provider field) |

## Export

```
gitagent export --format codex
```

Emits:
- AGENTS.md — identity (SOUL.md), rules (RULES.md), skills, compliance
- codex.json — { model, provider? }

## Import

```
gitagent import --from codex <path>
```

Reads AGENTS.md + codex.json, writes:
- agent.yaml — name, model (from codex.json)
- SOUL.md — all non-rule sections
- RULES.md — rule/constraint/compliance sections (when present)

## Tests

15 new tests covering: struct shape, SOUL/RULES/skill content, config
model/provider inference for OpenAI/o-series/Claude/Llama/Mistral, string
export section headers, JSON validity.
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