✨ feat(model): add Codex CLI provider#5
Merged
Merged
Conversation
- Route codex/ models from createProvider to a new CodexCliProvider in src/model/provider.ts. - Add Codex CLI chat execution with schema-shaped output handling and mock provider support. - Cover codex/ routing and mock-mode JSON parsing in test/model.test.ts.
- Drop `--output-schema` / `schemaPath` from `CodexCliProvider.chat()`: OpenAI strict structured outputs reject our shared schema because it lacks `additionalProperties:false` on every nested object - Rely on the system prompt's embedded schema + "Return ONLY the JSON object" instruction, mirroring how the `claude` provider works, and let `extractJSON` parse the result - Update error-message example model from `codex/gpt-5-codex` to `codex/gpt-5.5` in `validateModel` and align tests accordingly - Add `Body Rules (REQUIRED for non-trivial changes)` spec line to `buildGenerationMessages` so the LLM always populates the body for feat/fix/refactor/multi-file diffs - Minor formatting: collapse single-line arrow functions and reflow long `dbg()` call in `prompt.ts`
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.
What & why
Adds a Codex CLI provider so
ai-conventional-commitcan generate commit messages via OpenAI Codex on a ChatGPT plan (no API key), alongside the existing claude / opencode / anthropic providers.Closes #4.
Changes
CodexCliProvider(src/model/provider.ts) — shells out tocodex exec, mirroringClaudeCliProvider. Captures the final message via--output-last-message; runs--sandbox read-only --ephemeralso it never writes or persists a session.codex/registered in the provider factory; defaultcodex/gpt-5.5.--output-schema— OpenAI strict structured outputs reject the shared schema (they requireadditionalProperties: falseon every object). Relies on the system prompt's embedded schema +extractJSON, exactly like theclaudeprovider.src/prompt.ts) for non-trivial changes, so every provider writes a description. Codex had been mirroring the repo's terse title-only style; this lifts it (and any model) to parity — permissive, still allowing an empty body for genuinely trivial commits.test/model.test.ts); body-rule assertion (test/prompt.test.ts).Verification
tsc --noEmitclean ·vitest run69/69 ·eslint0 errorscodex/gpt-5.5generated this feature's own commit message, with a full multi-bullet body.Auth note
Codex here uses the ChatGPT plan (
codex login status→ "Logged in using ChatGPT"), so there's no API-key requirement like theanthropic/provider has.