@lyupro/codex-bridge 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,152 +1,152 @@
1
- # codex-bridge
2
-
3
- **Delegate implementation, reconnaissance and review from Claude Code to Codex — five host guards, zero runtime dependencies, zero build steps.**
4
-
5
- [![npm version](https://img.shields.io/npm/v/@lyupro/codex-bridge)](https://www.npmjs.com/package/@lyupro/codex-bridge)
6
- [![Node.js](https://img.shields.io/node/v/@lyupro/codex-bridge)](https://www.npmjs.com/package/@lyupro/codex-bridge)
7
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
8
-
9
- [![npm downloads](https://img.shields.io/npm/dm/@lyupro/codex-bridge)](https://www.npmjs.com/package/@lyupro/codex-bridge)
10
- [![npm unpacked size](https://img.shields.io/npm/unpacked-size/@lyupro/codex-bridge)](https://www.npmjs.com/package/@lyupro/codex-bridge)
11
- [![dependencies: zero](https://img.shields.io/badge/dependencies-zero-brightgreen)](package.json)
12
-
13
- Agentic coding spends one model subscription on everything, and implementation is the expensive part. codex-bridge moves that work to a separate [Codex CLI](https://developers.openai.com/codex/cli) subscription: Claude Code plans, dispatches and accepts, Codex executes — and every delegated run is guarded, verified and audited on disk.
14
-
15
- ## Install
16
-
17
- ```bash
18
- npm i -g @lyupro/codex-bridge # puts both command names on PATH
19
- codex-bridge install # into ~/.claude and ~/.lyupro/.codex-bridge/
20
- codexb install # the short name, same command
21
- ```
22
-
23
- Two other entry points reach the same command: `npx @lyupro/codex-bridge install` for a one-off run without a global install, and `node bin/codex-bridge.mjs install` from a clone. Every command below works through all three.
24
-
25
- Shipped agents invoke delegated runs through `codex-bridge run`. This is a permission contract,
26
- not a style choice: the stable package command lets host permission rules match the invocation
27
- without exposing an installation-specific absolute path and prompting on every delegation.
28
-
29
- Use `--scope project` to install the Claude Code-facing files under `<repo>/.claude`; the default user scope uses `~/.claude`.
30
-
31
- Installation has two roots:
32
-
33
- - `~/.lyupro/.codex-bridge/` contains package runtime files, guards, configuration, conventions, and the installation record.
34
- - The selected Claude Code root (`~/.claude/` or `<repo>/.claude/`) contains the three agents, two slash commands, merged hook registrations in `settings.json`, and run artifacts under `codex-runs/`.
35
-
36
- The repository's `src/home/` directory is the literal image copied into the branded root: its
37
- `hooks/`, `lib/`, `config.json`, and `conventions.md` paths are the host paths without remapping.
38
- Only npm's `package.json` is copied into that root from outside the image.
39
-
40
- Before every `settings.json` write, the existing file is backed up. Existing settings and foreign hooks are preserved. `--dry-run` prints the plan without writing.
41
-
42
- If a global install and a clone coexist, you have two package copies. `codex-bridge update`, `codexb update`, and the clone entry point copy files from whichever copy launched the command; using the wrong one can replace a newer host installation with older files.
43
-
44
- `codex-runs/` contains operator data. Uninstall never removes it.
45
-
46
- ## Requirements
47
-
48
- - Node.js >= 24
49
- - An authenticated [Codex CLI](https://developers.openai.com/codex/cli): `codex --version` and `codex login`
50
- - Claude Code, which hosts the agents, commands, and guards
51
-
52
- ## What it gives you
53
-
54
- - **Runs survive the caller.** A detached worker keeps the run and its artifacts alive after the dispatcher exits.
55
- - **Invalid work is rejected before quota is spent.** Scope, order, retry, branch, and continuation checks run before a run folder is created.
56
- - **Verdicts come from artifacts.** CLI events, git state, and the declared report decide the result, not model claims about itself.
57
- - **Identical retries attach safely.** Repeating the same command joins the active run instead of starting another one.
58
- - **5 host guards enforce the boundary.** `reply-guard`, `order-gate`, `worktree-lock`, `prune-guard`, and `stop-guard` cover replies, orders, edits, deletion, and stopping.
59
- - **Installation is identifiable and reversible.** Writes to `settings.json` are merged and backed up; uninstall removes recorded package files only.
60
- - **Every run leaves an audit folder.** The verbatim task, scope, before/after git state, events, report, verdict, and reason remain together.
61
- - **Zero runtime dependencies and zero build steps.** The package is plain `.mjs` on the Node.js standard library.
62
-
63
- The current suite contains **705 automated tests: 704 passing and 1 skipped**.
64
-
65
- ## Verify
66
-
67
- ```bash
68
- codex-bridge doctor
69
- ```
70
-
71
- Output on a healthy host (trimmed):
72
-
73
- ```text
74
- [ok] host: ~/.claude (user, exists)
75
- [ok] installation: @lyupro/codex-bridge@0.5.1 (matches package)
76
- [ok] files: 53 installed file(s) present
77
- [ok] rules: ~/.codex/rules/codex-bridge.rules (matches record)
78
- [ok] permissions: installed (24/24 own strings in allow/deny)
79
- [ok] hook:SubagentStop: matcher * -> ~/.lyupro/.codex-bridge/hooks/reply-guard.mjs
80
- [ok] hook:PreToolUse: matcher Agent|Task -> ~/.lyupro/.codex-bridge/hooks/order-gate.mjs
81
- [ok] hook:PreToolUse: matcher Write|Edit|MultiEdit|NotebookEdit -> ~/.lyupro/.codex-bridge/hooks/worktree-lock.mjs
82
- [ok] hook:PreToolUse: matcher Bash|PowerShell -> ~/.lyupro/.codex-bridge/hooks/prune-guard.mjs
83
- [ok] hook:PreToolUse: matcher TaskStop -> ~/.lyupro/.codex-bridge/hooks/stop-guard.mjs
84
- [warn] retention: Automatic cleanup is ON — run transport older than 30 days is removed to reclaim disk space.
85
- [ok] conventions: ~/.lyupro/.codex-bridge/conventions.md (found)
86
- [ok] codex: codex-cli 0.146.1
87
- [ok] node: 24.18.0 (requires >=24)
88
- [ok] runsRoot: ~/.claude/codex-runs
89
- [ok] liveRuns: 0 runs working right now
90
- ```
91
-
92
- `doctor` reports the selected host, package source, installed files and guards, Codex availability, retention policy, permissions, live runs, and the current repository's run folder. The `agents` line is a read, not a file count: each installed definition is parsed and its `name` checked against the dispatcher it claims to be, because a definition the host cannot read is a dispatcher that does not exist while every other line still says `[ok]`. Content that drifts from the packaged definition is a failure, not a warning: `doctor` exits 1 and names `codex-bridge update --force`, because a host running someone else's agent files may be calling the runner in a form no permission rule matches.
93
-
94
- If a session answers `Agent type 'codex-build' not found`, a run can still be started without the dispatcher — the agent is a wrapper that types one command:
95
-
96
- ```bash
97
- codex-bridge run --agent codex-build --repo <repository> --order-id <id> --scope <globs> --task-file <absolute path>
98
- ```
99
-
100
- The trade-off is explicit: `order-gate` and `reply-guard` sit on the dispatcher call, so a direct run is unguarded and its result is judged by the worktree and the suite.
101
-
102
- ## Update
103
-
104
- Update the global package, then refresh the selected host installation:
105
-
106
- ```bash
107
- npm i -g @lyupro/codex-bridge
108
- codex-bridge update
109
- ```
110
-
111
- `update` refreshes unchanged package files, refuses to overwrite operator edits unless `--force` is supplied, and removes obsolete files only when their installed fingerprint is unchanged.
112
-
113
- ## Limitations
114
-
115
- - **Runs are not isolated from one another.** They share one worktree; guards prevent concurrent writers instead of creating sandboxes.
116
- - **A build run has a 25-minute deadline.** Work and artifacts survive a timeout, but the run may need an explicit continuation.
117
- - **A dispatcher verdict is not the work outcome.** Judge completion from the worktree and tests as well as the recorded verdict.
118
-
119
- Transport files from runs at least **30 days** old are pruned automatically when a new run starts. Configuration can change or disable that retention policy; reports, accounting, and worktree snapshots are retained.
120
-
121
- ## Command reference
122
-
123
- | Command | Purpose |
124
- | --- | --- |
125
- | `install [--scope user\|project] [--host <path>] [--dry-run] [--force]` | Install into a Claude Code host. |
126
- | `update [--scope user\|project] [--host <path>] [--dry-run] [--force]` | Refresh a recorded installation. |
127
- | `permissions [add\|remove] [--scope user\|project] [--host <path>]` | Inspect or manage optional shell rules. |
128
- | `uninstall [--scope user\|project] [--host <path>] [--dry-run]` | Remove recorded package files while preserving run artifacts. |
129
- | `doctor [--scope user\|project] [--host <path>]` | Diagnose the selected host and Codex connection. |
130
- | `run <runner options> --task-file <abs path>` | Start or attach to a delegated run through the permission-stable package command. The task file carries the statement, the scout questions and the verification command; its path must be absolute. Piping the statement on stdin is the alternative channel, and the two cannot be combined. |
131
- | `projects [<name>] [--json]` | List projects or runs in the run store. |
132
- | `prune <project> [<run>] [--purge] [--older-than <age>] [-f] [--json]` | Plan or perform operator-confirmed cleanup. |
133
- | `unlock [<project>\|--all]` | Close records whose runner is gone. |
134
- | `read <run>` | Render a run's structured event stream. |
135
- | `stop <run>` | Stop a run and record a `FAIL` verdict. |
136
-
137
- Both `codex-bridge` and `codexb` invoke the same command. Run `codex-bridge --help` for exact forms.
138
-
139
- ### Development
140
-
141
- ```bash
142
- git clone https://github.com/lyupro/codex-bridge.git
143
- cd codex-bridge
144
- git config core.hooksPath .githooks
145
- npm test
146
- ```
147
-
148
- The Git hook enforces the 400-line source-file limit.
149
-
150
- ## License
151
-
152
- [MIT](LICENSE)
1
+ # codex-bridge
2
+
3
+ **Delegate implementation, reconnaissance and review from Claude Code to Codex — six host guards, zero runtime dependencies, zero build steps.**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@lyupro/codex-bridge)](https://www.npmjs.com/package/@lyupro/codex-bridge)
6
+ [![Node.js](https://img.shields.io/node/v/@lyupro/codex-bridge)](https://www.npmjs.com/package/@lyupro/codex-bridge)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
8
+
9
+ [![npm downloads](https://img.shields.io/npm/dm/@lyupro/codex-bridge)](https://www.npmjs.com/package/@lyupro/codex-bridge)
10
+ [![npm unpacked size](https://img.shields.io/npm/unpacked-size/@lyupro/codex-bridge)](https://www.npmjs.com/package/@lyupro/codex-bridge)
11
+ [![dependencies: zero](https://img.shields.io/badge/dependencies-zero-brightgreen)](package.json)
12
+
13
+ Agentic coding spends one model subscription on everything, and implementation is the expensive part. codex-bridge moves that work to a separate [Codex CLI](https://developers.openai.com/codex/cli) subscription: Claude Code plans, dispatches and accepts, Codex executes — and every delegated run is guarded, verified and audited on disk.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm i -g @lyupro/codex-bridge # puts both command names on PATH
19
+ codex-bridge install # into ~/.claude and ~/.lyupro/.codex-bridge/
20
+ codexb install # the short name, same command
21
+ ```
22
+
23
+ Two other entry points reach the same command: `npx @lyupro/codex-bridge install` for a one-off run without a global install, and `node bin/codex-bridge.mjs install` from a clone. Every command below works through all three.
24
+
25
+ Shipped agents invoke delegated runs through `codex-bridge run`. This is a permission contract,
26
+ not a style choice: the stable package command lets host permission rules match the invocation
27
+ without exposing an installation-specific absolute path and prompting on every delegation.
28
+
29
+ Use `--scope project` to install the Claude Code-facing files under `<repo>/.claude`; the default user scope uses `~/.claude`.
30
+
31
+ Installation has two roots:
32
+
33
+ - `~/.lyupro/.codex-bridge/` contains package runtime files, guards, configuration, conventions, and the installation record.
34
+ - The selected Claude Code root (`~/.claude/` or `<repo>/.claude/`) contains the three agents, two slash commands, merged hook registrations in `settings.json`, and run artifacts under `codex-runs/`.
35
+
36
+ The repository's `src/home/` directory is the literal image copied into the branded root: its
37
+ `hooks/`, `lib/`, `config.json`, and `conventions.md` paths are the host paths without remapping.
38
+ Only npm's `package.json` is copied into that root from outside the image.
39
+
40
+ Before every `settings.json` write, the existing file is backed up. Existing settings and foreign hooks are preserved. `--dry-run` prints the plan without writing.
41
+
42
+ If a global install and a clone coexist, you have two package copies. `codex-bridge update`, `codexb update`, and the clone entry point copy files from whichever copy launched the command; using the wrong one can replace a newer host installation with older files.
43
+
44
+ `codex-runs/` contains operator data. Uninstall never removes it.
45
+
46
+ ## Requirements
47
+
48
+ - Node.js >= 24
49
+ - An authenticated [Codex CLI](https://developers.openai.com/codex/cli): `codex --version` and `codex login`
50
+ - Claude Code, which hosts the agents, commands, and guards
51
+
52
+ ## What it gives you
53
+
54
+ - **Runs survive the caller.** A detached worker keeps the run and its artifacts alive after the dispatcher exits.
55
+ - **Invalid work is rejected before quota is spent.** Scope, order, retry, branch, and continuation checks run before a run folder is created.
56
+ - **Verdicts come from artifacts.** CLI events, git state, and the declared report decide the result, not model claims about itself.
57
+ - **Identical retries attach safely.** Repeating the same command joins the active run instead of starting another one.
58
+ - **6 host guards enforce the boundary.** `reply-guard`, `order-gate`, `worktree-lock`, `prune-guard`, and `stop-guard` cover replies, orders, edits, deletion, and stopping; `worktree-witness` stands behind the lock and names a write that reached the tree anyway.
59
+ - **Installation is identifiable and reversible.** Writes to `settings.json` are merged and backed up; uninstall removes recorded package files only.
60
+ - **Every run leaves an audit folder.** The verbatim task, scope, before/after git state, events, report, verdict, and reason remain together.
61
+ - **Zero runtime dependencies and zero build steps.** The package is plain `.mjs` on the Node.js standard library.
62
+
63
+ The current suite contains **809 automated tests: 808 passing and 1 skipped**.
64
+
65
+ ## Verify
66
+
67
+ ```bash
68
+ codex-bridge doctor
69
+ ```
70
+
71
+ Output on a healthy host (trimmed):
72
+
73
+ ```text
74
+ [ok] host: ~/.claude (user, exists)
75
+ [ok] installation: @lyupro/codex-bridge@0.5.1 (matches package)
76
+ [ok] files: 53 installed file(s) present
77
+ [ok] rules: ~/.codex/rules/codex-bridge.rules (matches record)
78
+ [ok] permissions: installed (24/24 own strings in allow/deny)
79
+ [ok] hook:SubagentStop: matcher * -> ~/.lyupro/.codex-bridge/hooks/reply-guard.mjs
80
+ [ok] hook:PreToolUse: matcher Agent|Task -> ~/.lyupro/.codex-bridge/hooks/order-gate.mjs
81
+ [ok] hook:PreToolUse: matcher Write|Edit|MultiEdit|NotebookEdit -> ~/.lyupro/.codex-bridge/hooks/worktree-lock.mjs
82
+ [ok] hook:PreToolUse: matcher Bash|PowerShell -> ~/.lyupro/.codex-bridge/hooks/prune-guard.mjs
83
+ [ok] hook:PreToolUse: matcher TaskStop -> ~/.lyupro/.codex-bridge/hooks/stop-guard.mjs
84
+ [warn] retention: Automatic cleanup is ON — run transport older than 30 days is removed to reclaim disk space.
85
+ [ok] conventions: ~/.lyupro/.codex-bridge/conventions.md (found)
86
+ [ok] codex: codex-cli 0.146.1
87
+ [ok] node: 24.18.0 (requires >=24)
88
+ [ok] runsRoot: ~/.claude/codex-runs
89
+ [ok] liveRuns: 0 runs working right now
90
+ ```
91
+
92
+ `doctor` reports the selected host, package source, installed files and guards, Codex availability, retention policy, permissions, live runs, and the current repository's run folder. The `agents` line is a read, not a file count: each installed definition is parsed and its `name` checked against the dispatcher it claims to be, because a definition the host cannot read is a dispatcher that does not exist while every other line still says `[ok]`. Content that drifts from the packaged definition is a failure, not a warning: `doctor` exits 1 and names `codex-bridge update --force`, because a host running someone else's agent files may be calling the runner in a form no permission rule matches.
93
+
94
+ If a session answers `Agent type 'codex-build' not found`, a run can still be started without the dispatcher — the agent is a wrapper that types one command:
95
+
96
+ ```bash
97
+ codex-bridge run --agent codex-build --repo <repository> --order-id <id> --scope <globs> --task-file <absolute path>
98
+ ```
99
+
100
+ The trade-off is explicit: `order-gate` and `reply-guard` sit on the dispatcher call, so a direct run is unguarded and its result is judged by the worktree and the suite.
101
+
102
+ ## Update
103
+
104
+ Update the global package, then refresh the selected host installation:
105
+
106
+ ```bash
107
+ npm i -g @lyupro/codex-bridge
108
+ codex-bridge update
109
+ ```
110
+
111
+ `update` refreshes unchanged package files, refuses to overwrite operator edits unless `--force` is supplied, and removes obsolete files only when their installed fingerprint is unchanged.
112
+
113
+ ## Limitations
114
+
115
+ - **Runs are not isolated from one another.** They share one worktree; guards prevent concurrent writers instead of creating sandboxes.
116
+ - **A build run has a 25-minute deadline.** Work and artifacts survive a timeout, but the run may need an explicit continuation.
117
+ - **A dispatcher verdict is not the work outcome.** Judge completion from the worktree and tests as well as the recorded verdict.
118
+
119
+ Transport files from runs at least **30 days** old are pruned automatically when a new run starts. Configuration can change or disable that retention policy; reports, accounting, and worktree snapshots are retained.
120
+
121
+ ## Command reference
122
+
123
+ | Command | Purpose |
124
+ | --- | --- |
125
+ | `install [--scope user\|project] [--host <path>] [--dry-run] [--force]` | Install into a Claude Code host. |
126
+ | `update [--scope user\|project] [--host <path>] [--dry-run] [--force]` | Refresh a recorded installation. |
127
+ | `permissions [add\|remove] [--scope user\|project] [--host <path>]` | Inspect or manage optional shell rules. |
128
+ | `uninstall [--scope user\|project] [--host <path>] [--dry-run]` | Remove recorded package files while preserving run artifacts. |
129
+ | `doctor [--scope user\|project] [--host <path>] [--probe-contract]` | Diagnose the selected host and Codex connection. `--probe-contract` measures on a live host whether it still honours a hook refusal, and records the answer. |
130
+ | `run <runner options> --task-file <abs path>` | Start or attach to a delegated run through the permission-stable package command. The task file carries the statement, the scout questions and the verification command; its path must be absolute. Piping the statement on stdin is the alternative channel, and the two cannot be combined. |
131
+ | `projects [<name>] [--json]` | List projects or runs in the run store. |
132
+ | `prune <project> [<run>] [--purge] [--older-than <age>] [-f] [--json]`<br>`prune --all-projects [--older-than <age>] [-f] [--json]` | Plan or perform operator-confirmed cleanup, for one project or across the whole run store. |
133
+ | `unlock [<project>\|--all]` | Close records whose runner is gone. |
134
+ | `read <run>` | Render a run's structured event stream. |
135
+ | `stop <run>` | Stop a run and record a `FAIL` verdict. |
136
+
137
+ Both `codex-bridge` and `codexb` invoke the same command. Run `codex-bridge --help` for exact forms.
138
+
139
+ ### Development
140
+
141
+ ```bash
142
+ git clone https://github.com/lyupro/codex-bridge.git
143
+ cd codex-bridge
144
+ git config core.hooksPath .githooks
145
+ npm test
146
+ ```
147
+
148
+ The Git hook enforces the 400-line source-file limit.
149
+
150
+ ## License
151
+
152
+ [MIT](LICENSE)