You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d2cb909
Browse filesBrowse the repository at this point in the historyBrowse files
Codex CLI joins Claude Code and Gemini CLI in v0.7.0's MCP-server-mode
infrastructure. A Windows / macOS / Linux operator with Codex installed
can now run cli-bridge against codex and have the bridged session call
OpenWar's eight native tools through MCP, same as Claude Code and
Gemini CLI in v0.7.0.
Brought up as v0.7.1 because Codex reads MCP config from
~/.codex/config.toml. v0.7.0's registry only knew how to write JSON.
v0.7.1 adds a small hand-rolled TOML serializer covering only what
MCP config needs (string values, string array values, dotted section
headers, every TOML 1.0 basic-string escape rule). Zero new runtime
dependencies; the alternative was shipping a TOML library and crossing
the framework's no-deps line.
Phase 0 design pick: append vs overwrite for ~/.codex/config.toml is
read-modify-write (option a in the brief). Operators with hand-edited
Codex configs (model preferences, history settings, etc) keep those
sections intact across OpenWar runs. The merge is text-boundary based:
find [mcp_servers.openwar] at column 0, replace its body up to the
next column-0 section header or EOF, append if absent. No TOML parser
required (and none added).
BridgedCliStrategy interface gains three optional fields, all
back-compat additive: serializeConfig (default JSON.stringify),
mergeIntoExisting (default false), mergeSectionHeader (default
"mcp_servers.<serverName>"). Claude Code and Gemini CLI entries
unchanged.
35 new tests. 25 in tests/mcp/toml-writer.test.ts (every escape rule
individually, Windows backslash paths, dotted headers, string arrays,
empty arrays, canonical MCP shape, plus 6 upsertTomlSection cases for
append / replace / final-section / prefix-collision / CRLF
normalization). 4 in tests/mcp/cli-bridge-wiring-codex.test.ts
(end-to-end against a tmp HOME: TOML written, operator [user] +
[history] sections survive merge, stale openwar block gets replaced,
cli.mcp_forward: false opt-out short-circuits setup). 7 extended in
tests/mcp/bridged-cli-registry.test.ts covering Codex resolution +
configPath + serializer dispatch + merge flags + the updated
listKnownBridgedClis output.
Known smoke-gap: real Codex CLI session against an OpenWar brief is
deferred (operator's Codex install is the gate). Ship on unit-test
strength per the brief's deferral clause. Smoke verification target
moves to v0.7.2.
413/413 tests pass (was 378 on v0.7.0). Lint clean, build clean.
Cross-platform CI matrix tests the home-dir expansion on both POSIX
and Windows via the existing infrastructure. Zero new runtime
dependencies.
Out of scope, deferred to later: aider registry entry (no native MCP
support yet), TOML parsing (only writes), general-purpose TOML
(integers, floats, booleans, dates, inline tables, multi-line strings
all unsupported by design).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,52 @@
1
1
# Changelog
2
2
3
+
## 0.7.1
4
+
5
+
Codex CLI joins Claude Code and Gemini CLI in the v0.7.0 MCP-server-mode infrastructure. Brought up as v0.7.1 because Codex's TOML config format required a small hand-rolled serializer; deferred from v0.7.0 to keep that release focused on the architectural foundation.
6
+
7
+
A Windows / macOS / Linux operator with Codex CLI installed can now run:
8
+
9
+
```bash
10
+
npx @pythonluvr/openwar run examples/cli-bridge-mcp-memory-brief.md \
11
+
--adapter cli-bridge \
12
+
--cli-binary codex
13
+
```
14
+
15
+
The runner writes `~/.codex/config.toml` with the OpenWar MCP server config, Codex discovers and consumes it, the bridged Codex session can call OpenWar's eight native tools through MCP. Same operator experience as Claude Code and Gemini CLI in v0.7.0.
16
+
17
+
### Added
18
+
19
+
-**`src/mcp/toml-writer.ts`**: hand-rolled TOML serializer scoped to MCP config shape only. Supports dotted section headers, string values, string array values. Escape rules cover every TOML 1.0 basic-string escape (`\b`, `\t`, `\n`, `\f`, `\r`, `\"`, `\\`, `\uXXXX` for non-printable Unicode). Public API is `writeTomlConfig(config: TomlConfig): string` plus `TomlConfig` type plus `upsertTomlSection(existing, header, body): string` for the read-modify-write merge path. Deliberately not a general-purpose TOML library: no integers, floats, booleans, dates, inline tables, multi-line strings, parsing.
20
+
-**Codex CLI registry entry**: `binary: "codex"` resolves to the Codex strategy. `configPath` returns `~/.codex/config.toml` via `os.homedir()`. Serializes the standard `McpConfigFileContent` to TOML via the new writer. No CLI flag injection (Codex auto-discovers `~/.codex/config.toml`). `cleanupConfigFile: false` consistent with Gemini (operators who wire Codex MCP typically want the wiring sticky). `mergeIntoExisting: true` so existing operator-edited sections survive.
21
+
-**`BridgedCliStrategy` interface gains three optional fields** (back-compat additive): `serializeConfig?(content): string` (default `JSON.stringify(content, null, 2)`), `mergeIntoExisting?: boolean` (default `false`), `mergeSectionHeader?: string` (default `"mcp_servers.<serverName>"`). Claude Code and Gemini CLI entries unchanged; the JSON default + overwrite behavior matches v0.7.0 exactly.
22
+
-**Runner-side read-modify-write** in `src/mcp/cli-bridge-wiring.ts`. When a strategy sets `mergeIntoExisting: true` and the config file exists, the runner reads the existing content, calls `upsertTomlSection` to replace or append just the OpenWar section, writes the merged result. When the file doesn't exist, behavior is unchanged (write the serialized output verbatim).
23
+
-**Tests**: `tests/mcp/toml-writer.test.ts` (25 cases covering basic strings, every TOML 1.0 escape individually, Windows backslash paths, paths with spaces, dotted section headers, string arrays, empty arrays, the canonical MCP config shape, and 6 cases on `upsertTomlSection` for append / replace / final-section / prefix-collision / CRLF normalization). `tests/mcp/cli-bridge-wiring-codex.test.ts` (4 end-to-end cases against a tmp HOME: writes TOML to `~/.codex/config.toml`, merge preserves operator `[user]` + `[history]` sections, merge replaces stale `[mcp_servers.openwar]` block, `cli.mcp_forward: false` opt-out short-circuits the whole setup). `tests/mcp/bridged-cli-registry.test.ts` extended with 7 Codex resolution + behavior cases.
24
+
-**`docs/adapters.md`**: cli-bridge section gains a "MCP-server-mode and the bridged-CLI registry" subsection with a table of all three registered CLIs (Claude Code, Gemini CLI, Codex CLI) and their config strategy.
25
+
26
+
### Changed
27
+
28
+
- The cli-bridge MCP forwarding now serializes the config file through the strategy's `serializeConfig` hook (default JSON, Codex TOML). Behavior for Claude Code and Gemini CLI is byte-identical to v0.7.0.
29
+
30
+
### Phase 0 design pick
31
+
32
+
**Append vs overwrite for `~/.codex/config.toml`: read-modify-write.** Builder picked option (a) from the v0.7.1 brief for safety. Operators with hand-edited Codex configs (model preferences, history settings) keep those sections intact across OpenWar runs. The merge is text-boundary based: find `[mcp_servers.openwar]` at column 0, replace its body up to the next column-0 section header or EOF, append if absent. No TOML parser required.
33
+
34
+
### Known smoke-gap
35
+
36
+
The brief allowed deferring the operator smoke test if Codex CLI isn't available locally. This release ships on the strength of 35 new unit tests (TOML writer + Codex registry + end-to-end wiring against a tmp HOME), validated cross-platform via the existing CI matrix. A real bridged-Codex session against an OpenWar brief is the v0.7.2 smoke-verification target once the operator has Codex installed.
37
+
38
+
### Out of scope (deferred or skipped)
39
+
40
+
-**aider registry entry.** Aider has no native MCP server support today. Defer to v0.7.2 or whenever aider ships first-class MCP support.
41
+
-**TOML parsing.** OpenWar only writes TOML. No parser is added.
42
+
-**General-purpose TOML support.** The serializer covers only what MCP config requires. Scope creep is the failure mode for v0.7.1; integers, floats, booleans, dates, inline tables, multi-line strings, tables of tables are all deliberately unsupported.
43
+
44
+
### Notes for forkers and War Room integrators
45
+
46
+
- Zero new runtime dependencies. The TOML writer is ~150 lines of hand-rolled Node stdlib.
47
+
- No state schema bump. No brief format change. Drop-in compatible with v0.7.0.
48
+
- The `BridgedCliStrategy` interface additions are optional fields; forker-defined custom registry entries that don't set them get the v0.7.0 JSON + overwrite behavior unchanged.
49
+
3
50
## 0.7.0
4
51
5
52
MCP-server-mode for cli-bridge. v0.5.0's cli-bridge adapter let OpenWar coordinate a CLI agent (Claude Code, etc), but the bridged CLI could not call OpenWar's native tools because its tool registry was its own. v0.7 closes the gap: OpenWar exposes its native tools as an MCP server, the bridged CLI consumes them through standard MCP, and the runtime threads OpenWar's authorization gates across the bridge. Operators can now run a brief that asks the bridged Claude Code to call `write_project_memory` (or any of the eight native tools) and have it actually work.
Copy file name to clipboardExpand all lines: docs/adapters.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,22 @@ cli:
82
82
83
83
Set `framework_prefix: false` (or pass `--cli-no-framework`) when the CLI already has OpenWar in its own system prompt. For Claude Code with `openwar.md` already in CLAUDE.md, the prepend is redundant and wasteful.
84
84
85
+
### MCP-server-mode and the bridged-CLI registry (v0.7+)
86
+
87
+
When a brief uses cli-bridge, OpenWar additionally exposes its eight native tools (`read_file`, `write_file`, `list_dir`, `shell_exec`, `http_fetch`, `apply_patch`, `read_project_memory`, `write_project_memory`) to the bridged CLI through standard MCP. The bridged agent can call any of them as `openwar:<tool_name>` and the runtime authorizes every call through the brief's `authorized_costs`.
88
+
89
+
The runtime knows how to wire MCP forwarding for these bridged CLIs out of the box:
| `codex` | Codex CLI (v0.7.1+) | `~/.codex/config.toml` | auto-discovered, merged into existing TOML | yes (no cleanup) |
96
+
97
+
Unknown binaries (aider, custom tools without native MCP support) hit a fallback: the OpenWar MCP config is still written to a temp JSON file, but no CLI args are injected. The runtime emits a startup warning so the operator can wire MCP manually for that CLI, or set `cli.mcp_forward: false` in the brief frontmatter to disable forwarding entirely and run the bridged CLI in its own tool sandbox.
98
+
99
+
The Codex entry preserves operator hand-edits to other sections of `~/.codex/config.toml` (it reads the file, replaces or appends the `[mcp_servers.openwar]` block, leaves everything else untouched). Same model is expected to extend to other TOML-config CLIs in v0.7.2+.
0 commit comments