Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Add Codex support (#2512)

Douglas Soares de Andrade2c675e00f751
diff --git a/.codex-plugin/hooks/hooks.json b/.codex-plugin/hooks/hooks.json
new file mode 100644
index 000000000..f99a09e1d
--- /dev/null
+++ b/.codex-plugin/hooks/hooks.json
@@ -0,0 +1,34 @@
+{
+ "hooks": {
+ "SessionStart": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "wt config state marker set \"πŸ’¬\" >/dev/null 2>&1 || true"
+ }
+ ]
+ }
+ ],
+ "UserPromptSubmit": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "wt config state marker set \"πŸ€–\" >/dev/null 2>&1 || true"
+ }
+ ]
+ }
+ ],
+ "Stop": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "wt config state marker set \"πŸ’¬\" >/dev/null 2>&1 || true"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
new file mode 100644
index 000000000..e37a2a49c
--- /dev/null
+++ b/.codex-plugin/plugin.json
@@ -0,0 +1,23 @@
+{
+ "name": "worktrunk",
+ "description": "Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows. This plugin provides configuration guidance and bundled activity hooks for Codex sessions.",
+ "author": {
+ "name": "Worktrunk",
+ "url": "https://github.com/max-sixty/worktrunk"
+ },
+ "homepage": "https://worktrunk.dev/claude-code/",
+ "repository": "https://github.com/max-sixty/worktrunk",
+ "license": "MIT OR Apache-2.0",
+ "keywords": ["git", "worktree", "codex", "agent"],
+ "skills": "./skills/",
+ "hooks": "./.codex-plugin/hooks/hooks.json",
+ "interface": {
+ "displayName": "Worktrunk",
+ "shortDescription": "Git worktree workflows for parallel Codex sessions.",
+ "longDescription": "Use Worktrunk from Codex to manage linked worktrees, set up LLM commit workflows, configure hooks, and bundle activity markers for wt list.",
+ "developerName": "Worktrunk",
+ "category": "Productivity",
+ "capabilities": ["Interactive", "Write"],
+ "websiteURL": "https://worktrunk.dev/claude-code/"
+ }
+}
diff --git a/docs/content/claude-code.md b/docs/content/claude-code.md
index 033663ca2..459d37251 100644
--- a/docs/content/claude-code.md
+++ b/docs/content/claude-code.md
@@ -1,22 +1,27 @@
+++
-title = "Claude Code Integration"
-description = "Worktrunk plugin for Claude Code: configuration skill, worktree isolation for agents, and activity tracking for wt list."
+title = "Claude Code & Codex Integration"
+description = "Worktrunk plugins for Claude Code and Codex: configuration skill, agent worktree isolation, and activity tracking for wt list."
weight = 23
[extra]
group = "Reference"
+++
-The worktrunk Claude Code plugin provides four features:
+Worktrunk ships plugins for Claude Code and Codex. Both bundle:
-1. **Configuration skill** β€” Documentation Claude Code can read, so it can help set up LLM commits, hooks, and troubleshoot issues
-2. **Worktree isolation** β€” When Claude Code agents create isolated worktrees, the plugin routes creation and removal through `wt` instead of raw `git`
-3. **Activity tracking** β€” Status markers in `wt list` showing which worktrees have active Claude sessions (πŸ€– working, πŸ’¬ waiting)
+1. **Configuration skill** β€” Documentation the agent can read, so it can help set up LLM commits, hooks, and troubleshoot issues
+2. **Activity tracking** β€” Status markers in `wt list` showing which worktrees have active agent sessions (πŸ€– working, πŸ’¬ waiting)
+
+The Claude Code plugin additionally provides:
+
+3. **Worktree isolation** β€” Routes agent-created isolated worktrees through `wt switch --create` / `wt remove` instead of raw `git`
4. **`/wt-switch-create` command** β€” Creates a worktrunk worktree and moves the current Claude session into it
+Codex does not currently expose equivalent worktree-lifecycle hooks, so Codex users invoke `wt switch --create` and `wt remove` directly.
+
## Installation
-Recommended:
+### Claude Code
{{ terminal(cmd="wt config plugins claude install") }}
@@ -24,9 +29,21 @@ Manual equivalent:
{{ terminal(cmd="claude plugin marketplace add max-sixty/worktrunk|||claude plugin install worktrunk@worktrunk") }}
+### Codex
+
+{{ terminal(cmd="wt config plugins codex install") }}
+
+This configures the Worktrunk marketplace in Codex. Then run `/plugins` in Codex and install Worktrunk from the marketplace. Manual equivalent:
+
+{{ terminal(cmd="codex plugin marketplace add max-sixty/worktrunk") }}
+
+To remove the marketplace entry, run `wt config plugins codex uninstall`. Already-installed plugins and global Codex hook feature flags are left unchanged.
+
+If activity markers do not appear after installing the plugin, Codex may be gating plugin-bundled hooks. Run `codex features list`; if `plugin_hooks` is `false`, enable it (`codex features enable plugin_hooks`), or copy this repo's `.codex-plugin/hooks/hooks.json` to `~/.codex/hooks.json`.
+
## Configuration skill
-The plugin includes a skill β€” documentation that Claude Code can read β€” covering worktrunk's configuration system. After installation, Claude Code can help with:
+The plugin includes a skill β€” documentation the agent can read β€” covering Worktrunk's configuration system. After installation, the agent can help with:
- Setting up LLM-generated commit messages
- Adding project hooks (pre-start, pre-merge, pre-commit)
@@ -37,7 +54,7 @@ Claude Code is designed to load the skill automatically when it detects worktrun
## Activity tracking
-The plugin tracks Claude sessions with status markers in `wt list`:
+The plugins track agent sessions with status markers in `wt list`:
<!-- ⚠️ AUTO-GENERATED from tests/snapshots/integration__integration_tests__list__list_with_user_marker.snap β€” edit source to update -->
@@ -54,8 +71,10 @@ The plugin tracks Claude sessions with status markers in `wt list`:
<!-- END AUTO-GENERATED -->
-- πŸ€– β€” Claude is working
-- πŸ’¬ β€” Claude is waiting for input
+- πŸ€– β€” agent is working
+- πŸ’¬ β€” agent is waiting or idle
+
+The Claude Code plugin clears the marker when a session ends; Codex exposes no session-end hook event, so a Codex worktree rests at πŸ’¬ after its session ends rather than clearing. Either plugin can also leave a stale marker if the agent process is killed before its stop hook runs. `wt config state marker clear` removes a marker manually.
### Manual status markers
@@ -67,17 +86,19 @@ Set status markers manually for any workflow:
<span class="cmd">git config worktrunk.state.feature.marker '{"marker":"πŸ’¬","set_at":0}' # Direct</span>
{% end %}
-## Worktree isolation
+## Worktree isolation (Claude Code only)
Claude Code agents can run in isolated worktrees (`isolation: "worktree"`). By default, Claude Code creates these with `git worktree add`. The plugin's `WorktreeCreate` and `WorktreeRemove` hooks route this through `wt switch --create` and `wt remove` instead, so worktrees created by agents get worktrunk's naming conventions, hooks, and lifecycle management.
-## `/wt-switch-create` command
+Codex does not currently expose equivalent hook events, so Codex users should invoke `wt switch --create` and `wt remove` directly.
+
+## `/wt-switch-create` command (Claude Code only)
`/wt-switch-create <branch> [<repo>] [-- <task>]` starts work in a fresh worktree without leaving the session. It creates (or re-enters) the named worktrunk worktree β€” sibling layout `<repo>.<branch>/`, not `.claude/worktrees/` β€” switches the session's working directory into it, then runs the task there. An optional second token names a different repository to create the worktree in; the task is whatever follows `--` (or, with no `--`, whatever follows the branch). The command rides the same `WorktreeCreate` hook as agent isolation, so the worktree gets worktrunk's naming, hooks, and lifecycle.
On session exit the worktree is offered for removal via the `WorktreeRemove` hook; one with uncommitted changes is kept rather than removed.
-## Statusline
+## Statusline (Claude Code only)
`wt list statusline --format=claude-code` outputs a single-line status for the Claude Code statusline. When the CI status cache is stale, this fetches from the network β€” typically 1–2 seconds β€” making it suitable for async statuslines but too slow for synchronous shell prompts. If a faster version would be helpful, please [open an issue](https://github.com/max-sixty/worktrunk/issues).
diff --git a/docs/static/llms.txt b/docs/static/llms.txt
index 1ee5cb58f..93310f347 100644
--- a/docs/static/llms.txt
+++ b/docs/static/llms.txt
@@ -23,6 +23,6 @@ with many parallel changes, including hooks to automate local workflows.
- [Extending Worktrunk](https://worktrunk.dev/extending.md): Three ways to add custom behavior: hooks for lifecycle automation, aliases for reusable commands, and custom subcommands for standalone tools.
- [LLM Commit Messages](https://worktrunk.dev/llm-commits.md): Generate commit messages from diffs using any LLM. Integrates with wt merge, wt step commit, and wt step squash.
-- [Claude Code Integration](https://worktrunk.dev/claude-code.md): Worktrunk plugin for Claude Code: configuration skill, worktree isolation for agents, and activity tracking for wt list.
+- [Claude Code & Codex Integration](https://worktrunk.dev/claude-code.md): Worktrunk plugins for Claude Code and Codex: configuration skill, agent worktree isolation, and activity tracking for wt list.
- [Tips & Patterns](https://worktrunk.dev/tips-patterns.md): Practical recipes for Worktrunk workflows: aliases, shell integration, Zellij layouts, and parallel agent patterns.
- [FAQ](https://worktrunk.dev/faq.md): Common questions about Worktrunk: comparison to git worktree and branch switching, bare repos, TUI support, and more.
diff --git a/skills/worktrunk/reference/claude-code.md b/skills/worktrunk/reference/claude-code.md
index a38d5a590..a89eb34e1 100644
--- a/skills/worktrunk/reference/claude-code.md
+++ b/skills/worktrunk/reference/claude-code.md
@@ -1,15 +1,20 @@
-# Claude Code Integration
+# Claude Code & Codex Integration
-The worktrunk Claude Code plugin provides four features:
+Worktrunk ships plugins for Claude Code and Codex. Both bundle:
-1. **Configuration skill** β€” Documentation Claude Code can read, so it can help set up LLM commits, hooks, and troubleshoot issues
-2. **Worktree isolation** β€” When Claude Code agents create isolated worktrees, the plugin routes creation and removal through `wt` instead of raw `git`
-3. **Activity tracking** β€” Status markers in `wt list` showing which worktrees have active Claude sessions (πŸ€– working, πŸ’¬ waiting)
+1. **Configuration skill** β€” Documentation the agent can read, so it can help set up LLM commits, hooks, and troubleshoot issues
+2. **Activity tracking** β€” Status markers in `wt list` showing which worktrees have active agent sessions (πŸ€– working, πŸ’¬ waiting)
+
+The Claude Code plugin additionally provides:
+
+3. **Worktree isolation** β€” Routes agent-created isolated worktrees through `wt switch --create` / `wt remove` instead of raw `git`
4. **`/wt-switch-create` command** β€” Creates a worktrunk worktree and moves the current Claude session into it
+Codex does not currently expose equivalent worktree-lifecycle hooks, so Codex users invoke `wt switch --create` and `wt remove` directly.
+
## Installation
-Recommended:
+### Claude Code
```bash
wt config plugins claude install
@@ -22,9 +27,25 @@ claude plugin marketplace add max-sixty/worktrunk
claude plugin install worktrunk@worktrunk
```
+### Codex
+
+```bash
+wt config plugins codex install
+```
+
+This configures the Worktrunk marketplace in Codex. Then run `/plugins` in Codex and install Worktrunk from the marketplace. Manual equivalent:
+
+```bash
+codex plugin marketplace add max-sixty/worktrunk
+```
+
+To remove the marketplace entry, run `wt config plugins codex uninstall`. Already-installed plugins and global Codex hook feature flags are left unchanged.
+
+If activity markers do not appear after installing the plugin, Codex may be gating plugin-bundled hooks. Run `codex features list`; if `plugin_hooks` is `false`, enable it (`codex features enable plugin_hooks`), or copy this repo's `.codex-plugin/hooks/hooks.json` to `~/.codex/hooks.json`.
+
## Configuration skill
-The plugin includes a skill β€” documentation that Claude Code can read β€” covering worktrunk's configuration system. After installation, Claude Code can help with:
+The plugin includes a skill β€” documentation the agent can read β€” covering Worktrunk's configuration system. After installation, the agent can help with:
- Setting up LLM-generated commit messages
- Adding project hooks (pre-start, pre-merge, pre-commit)
@@ -35,7 +56,7 @@ Claude Code is designed to load the skill automatically when it detects worktrun
## Activity tracking
-The plugin tracks Claude sessions with status markers in `wt list`:
+The plugins track agent sessions with status markers in `wt list`:
```bash
$ wt list
@@ -48,8 +69,10 @@ $ wt list
<span class=d>β—‹</span> <span class=d>Showing 4 worktrees, 2 with changes, 2 ahead</span>
```
-- πŸ€– β€” Claude is working
-- πŸ’¬ β€” Claude is waiting for input
+- πŸ€– β€” agent is working
+- πŸ’¬ β€” agent is waiting or idle
+
+The Claude Code plugin clears the marker when a session ends; Codex exposes no session-end hook event, so a Codex worktree rests at πŸ’¬ after its session ends rather than clearing. Either plugin can also leave a stale marker if the agent process is killed before its stop hook runs. `wt config state marker clear` removes a marker manually.
### Manual status markers
@@ -61,17 +84,19 @@ $ wt config state marker set "βœ…" --branch feature # Specific branch
$ git config worktrunk.state.feature.marker '{"marker":"πŸ’¬","set_at":0}' # Direct
```
-## Worktree isolation
+## Worktree isolation (Claude Code only)
Claude Code agents can run in isolated worktrees (`isolation: "worktree"`). By default, Claude Code creates these with `git worktree add`. The plugin's `WorktreeCreate` and `WorktreeRemove` hooks route this through `wt switch --create` and `wt remove` instead, so worktrees created by agents get worktrunk's naming conventions, hooks, and lifecycle management.
-## `/wt-switch-create` command
+Codex does not currently expose equivalent hook events, so Codex users should invoke `wt switch --create` and `wt remove` directly.
+
+## `/wt-switch-create` command (Claude Code only)
`/wt-switch-create <branch> [<repo>] [-- <task>]` starts work in a fresh worktree without leaving the session. It creates (or re-enters) the named worktrunk worktree β€” sibling layout `<repo>.<branch>/`, not `.claude/worktrees/` β€” switches the session's working directory into it, then runs the task there. An optional second token names a different repository to create the worktree in; the task is whatever follows `--` (or, with no `--`, whatever follows the branch). The command rides the same `WorktreeCreate` hook as agent isolation, so the worktree gets worktrunk's naming, hooks, and lifecycle.
On session exit the worktree is offered for removal via the `WorktreeRemove` hook; one with uncommitted changes is kept rather than removed.
-## Statusline
+## Statusline (Claude Code only)
`wt list statusline --format=claude-code` outputs a single-line status for the Claude Code statusline. When the CI status cache is stale, this fetches from the network β€” typically 1–2 seconds β€” making it suitable for async statuslines but too slow for synchronous shell prompts. If a faster version would be helpful, please [open an issue](https://github.com/max-sixty/worktrunk/issues).
diff --git a/src/cli/config.rs b/src/cli/config.rs
index cc532d74c..be99de3b1 100644
--- a/src/cli/config.rs
+++ b/src/cli/config.rs
@@ -186,6 +186,34 @@ $ wt config plugins opencode uninstall
Uninstall,
}
+// Ordering: action + inverse adjacent (install, uninstall).
+#[derive(Subcommand)]
+pub enum ConfigPluginsCodexCommand {
+ /// Configure the Worktrunk marketplace in Codex
+ #[command(
+ after_long_help = r#"Configures the Worktrunk plugin marketplace in Codex. Equivalent to:
+
+```console
+$ codex plugin marketplace add max-sixty/worktrunk
+```
+
+This does not install the plugin by itself. Afterward, open `/plugins` in Codex and install Worktrunk from the marketplace."#
+ )]
+ Install,
+
+ /// Remove the Worktrunk marketplace from Codex
+ #[command(
+ after_long_help = r#"Removes the Worktrunk plugin marketplace from Codex. Equivalent to:
+
+```console
+$ codex plugin marketplace remove worktrunk
+```
+
+This leaves any already-installed Worktrunk plugin and global Codex hook feature flags unchanged."#
+ )]
+ Uninstall,
+}
+
// Ordering: action + inverse adjacent (add, clear).
#[derive(Subcommand)]
pub enum ApprovalsCommand {
@@ -242,6 +270,24 @@ $ wt config plugins claude install-statusline
action: ConfigPluginsClaudeCommand,
},
+ /// Codex plugin
+ #[command(
+ after_long_help = r#"Bundled activity hooks β€” can show status markers in `wt list` when Codex loads plugin hooks:
+- πŸ€– β€” Codex is working
+- πŸ’¬ β€” Codex is waiting or idle
+
+## Examples
+
+```console
+$ wt config plugins codex install
+$ wt config plugins codex uninstall
+```"#
+ )]
+ Codex {
+ #[command(subcommand)]
+ action: ConfigPluginsCodexCommand,
+ },
+
/// OpenCode plugin
#[command(
after_long_help = r#"Activity tracking plugin β€” shows status markers in `wt list`:
@@ -529,12 +575,14 @@ $ wt config alias dry-run deploy -- --env=staging
## Supported tools
- **claude** β€” Claude Code plugin (activity tracking + statusline)
+- **codex** β€” Codex plugin (Worktrunk skill + bundled activity hooks)
- **opencode** β€” OpenCode plugin (activity tracking)
## Examples
```console
$ wt config plugins claude install
+$ wt config plugins codex install
$ wt config plugins opencode install
```"#
)]
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 4bbcf8c03..a3d83b9b4 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -5,9 +5,9 @@ mod step;
pub(crate) use config::{
ApprovalsCommand, CiStatusAction, ConfigAliasCommand, ConfigCommand,
- ConfigPluginsClaudeCommand, ConfigPluginsCommand, ConfigPluginsOpencodeCommand,
- ConfigShellCommand, DefaultBranchAction, HintsAction, LogsAction, MarkerAction,
- PreviousBranchAction, StateCommand, VarsAction,
+ ConfigPluginsClaudeCommand, ConfigPluginsCodexCommand, ConfigPluginsCommand,
+ ConfigPluginsOpencodeCommand, ConfigShellCommand, DefaultBranchAction, HintsAction, LogsAction,
+ MarkerAction, PreviousBranchAction, StateCommand, VarsAction,
};
pub(crate) use hook::{HOOK_TYPE_NAMES, HookCommand, HookOptions};
pub(crate) use list::ListSubcommand;
diff --git a/src/commands/config/codex.rs b/src/commands/config/codex.rs
new file mode 100644
index 000000000..5531f7c84
--- /dev/null
+++ b/src/commands/config/codex.rs
@@ -0,0 +1,111 @@
+//! Codex plugin marketplace management.
+
+use anyhow::{Context, Result, bail};
+use color_print::cformat;
+use worktrunk::shell_exec::Cmd;
+use worktrunk::styling::{eprintln, hint_message, progress_message, success_message};
+
+use super::show::is_codex_available;
+use crate::output::prompt::{PromptResponse, prompt_yes_no_preview};
+
+const MARKETPLACE_SOURCE: &str = "max-sixty/worktrunk";
+const MARKETPLACE_NAME: &str = "worktrunk";
+
+/// Handle `wt config plugins codex install`.
+pub fn handle_codex_install(yes: bool) -> Result<()> {
+ require_codex_cli()?;
+
+ if !yes {
+ match prompt_yes_no_preview(
+ &cformat!("Add Worktrunk plugin marketplace to <bold>Codex</>?"),
+ || {
+ let commands = format!("codex plugin marketplace add {MARKETPLACE_SOURCE}");
+ eprintln!("{}", worktrunk::styling::format_bash_with_gutter(&commands));
+ },
+ )? {
+ PromptResponse::Accepted => {}
+ PromptResponse::Declined => return Ok(()),
+ }
+ }
+
+ eprintln!("{}", progress_message("Adding Codex plugin marketplace..."));
+ let output = Cmd::new("codex")
+ .args(["plugin", "marketplace", "add", MARKETPLACE_SOURCE])
+ .run()
+ .context("Failed to run codex CLI")?;
+
+ if !output.status.success() {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ bail!("codex plugin marketplace add failed: {}", stderr.trim());
+ }
+
+ eprintln!("{}", success_message("Codex marketplace configured"));
+ eprintln!(
+ "{}",
+ hint_message("Next, run /plugins in Codex and install Worktrunk from the marketplace")
+ );
+ eprintln!(
+ "{}",
+ hint_message("Activity markers (πŸ€–/πŸ’¬) use Codex plugin-bundled hooks")
+ );
+ eprintln!(
+ "{}",
+ hint_message(
+ "If markers do not appear, enable Codex plugin hooks or copy .codex-plugin/hooks/hooks.json to a standard Codex hook location"
+ )
+ );
+
+ Ok(())
+}
+
+/// Handle `wt config plugins codex uninstall`.
+pub fn handle_codex_uninstall(yes: bool) -> Result<()> {
+ require_codex_cli()?;
+
+ if !yes {
+ match prompt_yes_no_preview(
+ &cformat!("Remove Worktrunk plugin marketplace from <bold>Codex</>?"),
+ || {
+ eprintln!(
+ "{}",
+ worktrunk::styling::format_bash_with_gutter(
+ "codex plugin marketplace remove worktrunk"
+ )
+ );
+ },
+ )? {
+ PromptResponse::Accepted => {}
+ PromptResponse::Declined => return Ok(()),
+ }
+ }
+
+ eprintln!(
+ "{}",
+ progress_message("Removing Codex plugin marketplace...")
+ );
+ let output = Cmd::new("codex")
+ .args(["plugin", "marketplace", "remove", MARKETPLACE_NAME])
+ .run()
+ .context("Failed to run codex CLI")?;
+
+ if !output.status.success() {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ bail!("codex plugin marketplace remove failed: {}", stderr.trim());
+ }
+
+ eprintln!("{}", success_message("Codex marketplace removed"));
+ eprintln!(
+ "{}",
+ hint_message("Installed plugins and global Codex hook feature flags are left unchanged")
+ );
+
+ Ok(())
+}
+
+fn require_codex_cli() -> Result<()> {
+ if is_codex_available() {
+ return Ok(());
+ }
+
+ bail!("codex CLI not found. Install Codex first: https://developers.openai.com/codex/cli/");
+}
diff --git a/src/commands/config/mod.rs b/src/commands/config/mod.rs
index 694421abb..86963d50a 100644
--- a/src/commands/config/mod.rs
+++ b/src/commands/config/mod.rs
@@ -4,6 +4,7 @@
mod alias;
mod approvals;
+mod codex;
mod create;
mod hints;
pub mod opencode;
@@ -15,6 +16,7 @@ mod update;
// Re-export public functions
pub use alias::{handle_alias_dry_run, handle_alias_show};
pub use approvals::{add_approvals, clear_approvals};
+pub use codex::{handle_codex_install, handle_codex_uninstall};
pub use create::handle_config_create;
pub use hints::{handle_hints_clear, handle_hints_get};
pub use opencode::{handle_opencode_install, handle_opencode_uninstall};
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index d69c1b7a3..a5925e3e1 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -60,6 +60,12 @@ pub fn handle_config_show(full: bool, format: SwitchFormat) -> anyhow::Result<()
render_claude_code_status(&mut show_output)?;
}
+ // Render Codex status (only when codex CLI is available)
+ if is_codex_available() {
+ show_output.push('\n');
+ render_codex_status(&mut show_output)?;
+ }
+
// Render OpenCode status (only when opencode CLI is available)
if is_opencode_available() {
show_output.push('\n');
@@ -134,6 +140,15 @@ pub(super) fn is_claude_available() -> bool {
which::which("claude").is_ok()
}
+/// Check if Codex CLI is available
+pub(super) fn is_codex_available() -> bool {
+ // Allow tests to override detection
+ if let Ok(val) = std::env::var("WORKTRUNK_TEST_CODEX_INSTALLED") {
+ return val == "1";
+ }
+ which::which("codex").is_ok()
+}
+
/// Get the home directory for Claude Code config detection
pub(super) fn home_dir() -> Option<PathBuf> {
// Try HOME/USERPROFILE env vars first (for tests and explicit overrides), then fall back to dirs
@@ -272,6 +287,22 @@ fn render_claude_code_status(out: &mut String) -> anyhow::Result<()> {
Ok(())
}
+/// Render CODEX section (marketplace install hint).
+/// Caller must check `is_codex_available()` first.
+fn render_codex_status(out: &mut String) -> anyhow::Result<()> {
+ writeln!(out, "{}", format_heading("CODEX", None))?;
+ writeln!(out, "{}", success_message("Codex CLI available"))?;
+ writeln!(
+ out,
+ "{}",
+ hint_message(cformat!(
+ "If Worktrunk is not installed in /plugins yet, run <underline>wt config plugins codex install</>"
+ ))
+ )?;
+
+ Ok(())
+}
+
/// Check if OpenCode CLI is available
fn is_opencode_available() -> bool {
// Allow tests to override detection
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
index 1e1e1ed90..0759194a0 100644
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -34,11 +34,12 @@ pub(crate) use alias::{
};
pub(crate) use config::{
add_approvals, clear_approvals, handle_alias_dry_run, handle_alias_show, handle_claude_install,
- handle_claude_install_statusline, handle_claude_uninstall, handle_config_create,
- handle_config_show, handle_config_update, handle_hints_clear, handle_hints_get,
- handle_logs_list, handle_opencode_install, handle_opencode_uninstall, handle_state_clear,
- handle_state_clear_all, handle_state_get, handle_state_set, handle_state_show,
- handle_vars_clear, handle_vars_get, handle_vars_list, handle_vars_set,
+ handle_claude_install_statusline, handle_claude_uninstall, handle_codex_install,
+ handle_codex_uninstall, handle_config_create, handle_config_show, handle_config_update,
+ handle_hints_clear, handle_hints_get, handle_logs_list, handle_opencode_install,
+ handle_opencode_uninstall, handle_state_clear, handle_state_clear_all, handle_state_get,
+ handle_state_set, handle_state_show, handle_vars_clear, handle_vars_get, handle_vars_list,
+ handle_vars_set,
};
pub(crate) use configure_shell::{
handle_configure_shell, handle_show_theme, handle_unconfigure_shell,
diff --git a/src/main.rs b/src/main.rs
index 9e45626aa..0d57b2c3e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -52,24 +52,26 @@ use commands::{
HookCliArgs, MergeFlagOverrides, MergeOptions, OperationMode, RebaseResult, RemoveTarget,
SquashResult, SwitchOptions, add_approvals, clear_approvals, handle_alias_dry_run,
handle_alias_show, handle_claude_install, handle_claude_install_statusline,
- handle_claude_uninstall, handle_completions, handle_config_create, handle_config_show,
- handle_config_update, handle_configure_shell, handle_custom_command, handle_hints_clear,
- handle_hints_get, handle_hook_show, handle_init, handle_list, handle_logs_list, handle_merge,
- handle_opencode_install, handle_opencode_uninstall, handle_promote, handle_rebase,
- handle_show_theme, handle_squash, handle_state_clear, handle_state_clear_all, handle_state_get,
- handle_state_set, handle_state_show, handle_unconfigure_shell, handle_vars_clear,
- handle_vars_get, handle_vars_list, handle_vars_set, resolve_worktree_arg, run_hook, run_switch,
- step_commit, step_copy_ignored, step_diff, step_eval, step_for_each, step_prune, step_relocate,
+ handle_claude_uninstall, handle_codex_install, handle_codex_uninstall, handle_completions,
+ handle_config_create, handle_config_show, handle_config_update, handle_configure_shell,
+ handle_custom_command, handle_hints_clear, handle_hints_get, handle_hook_show, handle_init,
+ handle_list, handle_logs_list, handle_merge, handle_opencode_install,
+ handle_opencode_uninstall, handle_promote, handle_rebase, handle_show_theme, handle_squash,
+ handle_state_clear, handle_state_clear_all, handle_state_get, handle_state_set,
+ handle_state_show, handle_unconfigure_shell, handle_vars_clear, handle_vars_get,
+ handle_vars_list, handle_vars_set, resolve_worktree_arg, run_hook, run_switch, step_commit,
+ step_copy_ignored, step_diff, step_eval, step_for_each, step_prune, step_relocate,
};
use output::handle_remove_output;
use worktrunk::git::BranchDeletionMode;
use cli::{
ApprovalsCommand, CiStatusAction, Cli, Commands, ConfigAliasCommand, ConfigCommand,
- ConfigPluginsClaudeCommand, ConfigPluginsCommand, ConfigPluginsOpencodeCommand,
- ConfigShellCommand, DefaultBranchAction, HintsAction, HookCommand, HookOptions, ListArgs,
- ListSubcommand, LogsAction, MarkerAction, MergeArgs, PreviousBranchAction, RemoveArgs,
- StateCommand, StepCommand, SwitchArgs, SwitchFormat, VarsAction,
+ ConfigPluginsClaudeCommand, ConfigPluginsCodexCommand, ConfigPluginsCommand,
+ ConfigPluginsOpencodeCommand, ConfigShellCommand, DefaultBranchAction, HintsAction,
+ HookCommand, HookOptions, ListArgs, ListSubcommand, LogsAction, MarkerAction, MergeArgs,
+ PreviousBranchAction, RemoveArgs, StateCommand, StepCommand, SwitchArgs, SwitchFormat,
+ VarsAction,
};
/// Render a clap error to stderr, appending a wt-specific nested-subcommand
@@ -591,6 +593,10 @@ fn handle_plugins_command(action: ConfigPluginsCommand, yes: bool) -> anyhow::Re
ConfigPluginsClaudeCommand::Uninstall => handle_claude_uninstall(yes),
ConfigPluginsClaudeCommand::InstallStatusline => handle_claude_install_statusline(yes),
},
+ ConfigPluginsCommand::Codex { action } => match action {
+ ConfigPluginsCodexCommand::Install => handle_codex_install(yes),
+ ConfigPluginsCodexCommand::Uninstall => handle_codex_uninstall(yes),
+ },
ConfigPluginsCommand::Opencode { action } => match action {
ConfigPluginsOpencodeCommand::Install => handle_opencode_install(yes),
ConfigPluginsOpencodeCommand::Uninstall => handle_opencode_uninstall(yes),
diff --git a/src/testing/mod.rs b/src/testing/mod.rs
index 9acfa8eff..6c90084a6 100644
--- a/src/testing/mod.rs
+++ b/src/testing/mod.rs
@@ -535,6 +535,8 @@ pub fn configure_cli_command(cmd: &mut Command) {
cmd.env("RUST_LOG", "warn");
// Treat Claude as not installed by default (tests can override with "1")
cmd.env("WORKTRUNK_TEST_CLAUDE_INSTALLED", "0");
+ // Treat Codex as not installed by default (tests can override with "1")
+ cmd.env("WORKTRUNK_TEST_CODEX_INSTALLED", "0");
// Treat OpenCode as not installed by default (tests can override with "1")
cmd.env("WORKTRUNK_TEST_OPENCODE_INSTALLED", "0");
@@ -778,6 +780,8 @@ pub struct TestRepo {
mock_bin_path: Option<PathBuf>,
/// Whether Claude CLI should be treated as installed
claude_installed: bool,
+ /// Whether Codex CLI should be treated as installed
+ codex_installed: bool,
/// Whether OpenCode CLI should be treated as installed
opencode_installed: bool,
}
@@ -873,6 +877,7 @@ impl TestRepo {
git_config_path,
mock_bin_path: None,
claude_installed: false,
+ codex_installed: false,
opencode_installed: false,
};
@@ -923,6 +928,7 @@ impl TestRepo {
git_config_path,
mock_bin_path: None,
claude_installed: false,
+ codex_installed: false,
opencode_installed: false,
}
}
@@ -969,6 +975,7 @@ impl TestRepo {
git_config_path,
mock_bin_path: None,
claude_installed: false,
+ codex_installed: false,
opencode_installed: false,
}
}
@@ -1735,6 +1742,14 @@ impl TestRepo {
self.claude_installed = true;
}
+ /// Setup mock `codex` CLI as installed
+ ///
+ /// Call this after setup_mock_ci_tools_unauthenticated() to simulate
+ /// Codex being available on the system.
+ pub fn setup_mock_codex_installed(&mut self) {
+ self.codex_installed = true;
+ }
+
/// Setup the worktrunk plugin as installed in Claude Code
///
/// Creates the installed_plugins.json file in the temp home directory.
@@ -1805,6 +1820,26 @@ impl TestRepo {
self.claude_installed = true;
}
+ /// Setup mock `codex` CLI with plugin marketplace support
+ ///
+ /// Creates a mock codex binary that handles `plugin marketplace add`,
+ /// and `plugin marketplace remove` commands. Must call
+ /// `setup_mock_ci_tools_unauthenticated()` first to create the mock bin
+ /// directory.
+ pub fn setup_mock_codex_with_plugins(&mut self) {
+ let mock_bin = self
+ .mock_bin_path
+ .as_ref()
+ .expect("call setup_mock_ci_tools_unauthenticated() first");
+
+ MockConfig::new("codex")
+ .command("plugin marketplace add", MockResponse::exit(0))
+ .command("plugin marketplace remove", MockResponse::exit(0))
+ .write(mock_bin);
+
+ self.codex_installed = true;
+ }
+
/// Setup mock `claude` CLI where plugin commands fail
///
/// Creates a mock claude binary where `plugin marketplace`, `plugin install`,
@@ -1834,6 +1869,29 @@ impl TestRepo {
self.claude_installed = true;
}
+ /// Setup mock `codex` CLI where marketplace commands fail
+ ///
+ /// Must call `setup_mock_ci_tools_unauthenticated()` first.
+ pub fn setup_mock_codex_with_plugins_failing(&mut self) {
+ let mock_bin = self
+ .mock_bin_path
+ .as_ref()
+ .expect("call setup_mock_ci_tools_unauthenticated() first");
+
+ MockConfig::new("codex")
+ .command(
+ "plugin marketplace add",
+ MockResponse::exit(1).with_stderr("error: marketplace add failed\n"),
+ )
+ .command(
+ "plugin marketplace remove",
+ MockResponse::exit(1).with_stderr("error: marketplace remove failed\n"),
+ )
+ .write(mock_bin);
+
+ self.codex_installed = true;
+ }
+
/// Setup mock `gh` that returns configurable PR/CI data
///
/// Use this for testing CI status parsing code. The mock returns JSON data
@@ -2247,6 +2305,11 @@ impl TestRepo {
cmd.env("WORKTRUNK_TEST_CLAUDE_INSTALLED", "1");
}
+ // Override Codex installed status if setup_mock_codex_installed() was called
+ if self.codex_installed {
+ cmd.env("WORKTRUNK_TEST_CODEX_INSTALLED", "1");
+ }
+
// Override OpenCode installed status if setup_mock_opencode_installed() was called
if self.opencode_installed {
cmd.env("WORKTRUNK_TEST_OPENCODE_INSTALLED", "1");
diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rs
index 870863a35..c6bd29dab 100644
--- a/tests/integration_tests/config_show.rs
+++ b/tests/integration_tests/config_show.rs
@@ -2174,6 +2174,36 @@ fn test_config_show_statusline_configured(mut repo: TestRepo, temp_home: TempDir
});
}
+#[rstest]
+fn test_config_show_codex_available(mut repo: TestRepo, temp_home: TempDir) {
+ // Setup mock gh/glab for deterministic output
+ repo.setup_mock_ci_tools_unauthenticated();
+ // Setup mock codex as available
+ repo.setup_mock_codex_installed();
+
+ // Create global config
+ let global_config_dir = temp_home.path().join(".config").join("worktrunk");
+ fs::create_dir_all(&global_config_dir).unwrap();
+ fs::write(
+ global_config_dir.join("config.toml"),
+ r#"worktree-path = "../{{ repo }}.{{ branch }}"
+"#,
+ )
+ .unwrap();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.arg("config").arg("show").current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ set_xdg_config_path(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
#[rstest]
fn test_config_show_opencode_available_plugin_not_installed(
mut repo: TestRepo,
@@ -3436,6 +3466,110 @@ fn test_plugins_claude_uninstall_not_installed(mut repo: TestRepo, temp_home: Te
});
}
+// ==================== Codex Plugin Install/Uninstall Tests ====================
+
+#[rstest]
+fn test_plugins_codex_install(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_codex_with_plugins();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "codex", "install", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_codex_install_codex_not_found(repo: TestRepo) {
+ // Don't call setup_mock_codex_installed β€” codex CLI not available
+ let settings = setup_snapshot_settings(&repo);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ cmd.args(["config", "plugins", "codex", "install", "--yes"])
+ .current_dir(repo.root_path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_codex_uninstall(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_codex_with_plugins();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "codex", "uninstall", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_codex_install_command_fails(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_codex_with_plugins_failing();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "codex", "install", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[test]
+fn test_codex_plugin_metadata_is_valid_json() {
+ let project_root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
+ let plugin: serde_json::Value = serde_json::from_str(
+ &fs::read_to_string(project_root.join(".codex-plugin/plugin.json")).unwrap(),
+ )
+ .unwrap();
+ // Codex falls back to .claude-plugin/marketplace.json when
+ // .agents/plugins/marketplace.json is absent, so the existing Claude
+ // marketplace doubles as the Codex marketplace.
+ let marketplace: serde_json::Value = serde_json::from_str(
+ &fs::read_to_string(project_root.join(".claude-plugin/marketplace.json")).unwrap(),
+ )
+ .unwrap();
+ let hooks: serde_json::Value = serde_json::from_str(
+ &fs::read_to_string(project_root.join(".codex-plugin/hooks/hooks.json")).unwrap(),
+ )
+ .unwrap();
+
+ assert_eq!(plugin["name"], "worktrunk");
+ assert_eq!(plugin["skills"], "./skills/");
+ assert_eq!(plugin["hooks"], "./.codex-plugin/hooks/hooks.json");
+ assert_eq!(marketplace["plugins"][0]["name"], "worktrunk");
+ assert_eq!(marketplace["plugins"][0]["source"], "./");
+ assert_eq!(
+ hooks["hooks"]["UserPromptSubmit"][0]["hooks"][0]["command"],
+ "wt config state marker set \"πŸ€–\" >/dev/null 2>&1 || true"
+ );
+ assert_eq!(
+ hooks["hooks"]["Stop"][0]["hooks"][0]["command"],
+ "wt config state marker set \"πŸ’¬\" >/dev/null 2>&1 || true"
+ );
+}
+
// ==================== Plugin Install-Statusline Tests ====================
#[rstest]
diff --git a/tests/integration_tests/help.rs b/tests/integration_tests/help.rs
index 32a33be39..c223ada45 100644
--- a/tests/integration_tests/help.rs
+++ b/tests/integration_tests/help.rs
@@ -64,6 +64,12 @@ fn snapshot_help(test_name: &str, args: &[&str]) {
#[case("help_config_shell", "config shell --help")]
#[case("help_config_create", "config create --help")]
#[case("help_config_show", "config show --help")]
+#[case("help_config_plugins", "config plugins --help")]
+#[case("help_config_plugins_codex", "config plugins codex --help")]
+#[case(
+ "help_config_plugins_codex_install",
+ "config plugins codex install --help"
+)]
#[case("help_config_state", "config state --help")]
#[case(
"help_config_state_default_branch",
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_codex_available.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_codex_available.snap
new file mode 100644
index 000000000..15f2d9c76
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_codex_available.snap
@@ -0,0 +1,77 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - show
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMON_DIR: ""
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_DIR: ""
+ GIT_EDITOR: ""
+ GIT_INDEX_FILE: ""
+ GIT_OBJECT_DIRECTORY: ""
+ GIT_TERMINAL_PROMPT: "0"
+ GIT_WORK_TREE: ""
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+USER CONFIG @ ~/.config/worktrunk/config.toml
+  worktree-path = "../{{ repo }}.{{ branch }}"
+↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
+
+PROJECT CONFIG @ _REPO_/.config/wt.toml
+↳ Not found
+
+SHELL INTEGRATION
+β–² Shell integration not configured
+↳ To configure, run wt config shell install
+  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
+
+CODEX
+βœ“ Codex CLI available
+↳ If Worktrunk is not installed in /plugins yet, run wt config plugins codex install
+
+OTHER
+β—‹ wt: [VERSION]
+β—‹ git: [VERSION]
+β—‹ Hyperlinks: inactive
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_codex_install.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_codex_install.snap
new file mode 100644
index 000000000..7d301b011
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_codex_install.snap
@@ -0,0 +1,55 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - codex
+ - install
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+β—Ž Adding Codex plugin marketplace...
+βœ“ Codex marketplace configured
+↳ Next, run /plugins in Codex and install Worktrunk from the marketplace
+↳ Activity markers (πŸ€–/πŸ’¬) use Codex plugin-bundled hooks
+↳ If markers do not appear, enable Codex plugin hooks or copy .codex-plugin/hooks/hooks.json to a standard Codex hook location
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_codex_install_codex_not_found.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_codex_install_codex_not_found.snap
new file mode 100644
index 000000000..48b10bc8b
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_codex_install_codex_not_found.snap
@@ -0,0 +1,50 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - codex
+ - install
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+βœ— codex CLI not found. Install Codex first: https://developers.openai.com/codex/cli/
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_codex_install_command_fails.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_codex_install_command_fails.snap
new file mode 100644
index 000000000..abd73f127
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_codex_install_command_fails.snap
@@ -0,0 +1,51 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - codex
+ - install
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+β—Ž Adding Codex plugin marketplace...
+βœ— codex plugin marketplace add failed: error: marketplace add failed
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_codex_uninstall.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_codex_uninstall.snap
new file mode 100644
index 000000000..d25091d13
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_codex_uninstall.snap
@@ -0,0 +1,53 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - codex
+ - uninstall
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_PAGER: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+β—Ž Removing Codex plugin marketplace...
+βœ“ Codex marketplace removed
+↳ Installed plugins and global Codex hook feature flags are left unchanged
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_plugins.snap b/tests/snapshots/integration__integration_tests__help__help_config_plugins.snap
new file mode 100644
index 000000000..416356ccb
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__help__help_config_plugins.snap
@@ -0,0 +1,75 @@
+---
+source: tests/integration_tests/help.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - "--help"
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_PAGER: ""
+ LANG: C
+ LC_ALL: C
+ NO_COLOR: ""
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ WORKTRUNK_APPROVALS_PATH: /nonexistent/test/approvals.toml
+ WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml
+ WORKTRUNK_SYSTEM_CONFIG_PATH: /etc/xdg/worktrunk/config.toml
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+---
+success: true
+exit_code: 0
+----- stdout -----
+wt config plugins - Plugin management
+
+Usage: wt config plugins [OPTIONS] <COMMAND>
+
+Commands:
+ claude Claude Code plugin
+ codex Codex plugin
+ opencode OpenCode plugin
+
+Options:
+ -h, --help
+ Print help (see a summary with '-h')
+
+Global Options:
+ -C <path>
+ Working directory for this command
+
+ --config <path>
+ User config file path
+
+ -v, --verbose...
+ Verbose output (-v: info logs + hook/alias template variable & output; -vv: debug logs + diagnostic report + trace.log/output.log under .git/wt/logs/)
+
+ -y, --yes
+ Skip approval prompts
+
+Install and manage Worktrunk plugins for AI coding tools.
+
+Supported tools
+
+- claude β€” Claude Code plugin (activity tracking + statusline)
+- codex β€” Codex plugin (Worktrunk skill + bundled activity hooks)
+- opencode β€” OpenCode plugin (activity tracking)
+
+Examples
+
+  wt config plugins claude install
+  wt config plugins codex install
+  wt config plugins opencode install
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_plugins_codex.snap b/tests/snapshots/integration__integration_tests__help__help_config_plugins_codex.snap
new file mode 100644
index 000000000..a75c941e9
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__help__help_config_plugins_codex.snap
@@ -0,0 +1,70 @@
+---
+source: tests/integration_tests/help.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - codex
+ - "--help"
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_PAGER: ""
+ LANG: C
+ LC_ALL: C
+ NO_COLOR: ""
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ WORKTRUNK_APPROVALS_PATH: /nonexistent/test/approvals.toml
+ WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml
+ WORKTRUNK_SYSTEM_CONFIG_PATH: /etc/xdg/worktrunk/config.toml
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+---
+success: true
+exit_code: 0
+----- stdout -----
+wt config plugins codex - Codex plugin
+
+Usage: wt config plugins codex [OPTIONS] <COMMAND>
+
+Commands:
+ install Configure the Worktrunk marketplace in Codex
+ uninstall Remove the Worktrunk marketplace from Codex
+
+Options:
+ -h, --help
+ Print help (see a summary with '-h')
+
+Global Options:
+ -C <path>
+ Working directory for this command
+
+ --config <path>
+ User config file path
+
+ -v, --verbose...
+ Verbose output (-v: info logs + hook/alias template variable & output; -vv: debug logs + diagnostic report + trace.log/output.log under .git/wt/logs/)
+
+ -y, --yes
+ Skip approval prompts
+
+Bundled activity hooks β€” can show status markers in wt list when Codex loads plugin hooks:
+- πŸ€– β€” Codex is working
+- πŸ’¬ β€” Codex is waiting or idle
+
+Examples
+
+  wt config plugins codex install
+  wt config plugins codex uninstall
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_plugins_codex_install.snap b/tests/snapshots/integration__integration_tests__help__help_config_plugins_codex_install.snap
new file mode 100644
index 000000000..bfa0c01c8
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__help__help_config_plugins_codex_install.snap
@@ -0,0 +1,63 @@
+---
+source: tests/integration_tests/help.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - codex
+ - install
+ - "--help"
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_EDITOR: ""
+ LANG: C
+ LC_ALL: C
+ NO_COLOR: ""
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ WORKTRUNK_APPROVALS_PATH: /nonexistent/test/approvals.toml
+ WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml
+ WORKTRUNK_SYSTEM_CONFIG_PATH: /etc/xdg/worktrunk/config.toml
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+---
+success: true
+exit_code: 0
+----- stdout -----
+wt config plugins codex install - Configure the Worktrunk marketplace in Codex
+
+Usage: wt config plugins codex install [OPTIONS]
+
+Options:
+ -h, --help
+ Print help (see a summary with '-h')
+
+Global Options:
+ -C <path>
+ Working directory for this command
+
+ --config <path>
+ User config file path
+
+ -v, --verbose...
+ Verbose output (-v: info logs + hook/alias template variable & output; -vv: debug logs + diagnostic report + trace.log/output.log under .git/wt/logs/)
+
+ -y, --yes
+ Skip approval prompts
+
+Configures the Worktrunk plugin marketplace in Codex. Equivalent to:
+
+  codex plugin marketplace add max-sixty/worktrunk
+
+This does not install the plugin by itself. Afterward, open /plugins in Codex and install Worktrunk from the marketplace.
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_marker.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_marker.snap
index 4b0f3fa38..8d01f219e 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_state_marker.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_marker.snap
@@ -22,6 +22,7 @@ info:
WORKTRUNK_CONFIG_PATH: /nonexistent/wt/config.toml
WORKTRUNK_SYSTEM_CONFIG_PATH: /etc/xdg/worktrunk/config.toml
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
WORKTRUNK_TEST_NUSHELL_ENV: "0"