Skip to content

feat(codex): route shell commands through plugin hooks#2063

Open
AZ-LL wants to merge 2 commits into
rtk-ai:developfrom
AZ-LL:feat/codex-plugin-integration
Open

feat(codex): route shell commands through plugin hooks#2063
AZ-LL wants to merge 2 commits into
rtk-ai:developfrom
AZ-LL:feat/codex-plugin-integration

Conversation

@AZ-LL
Copy link
Copy Markdown

@AZ-LL AZ-LL commented May 24, 2026

Add Codex plugin integration

Target branch: upstream develop

Summary

  • Replaces Codex's default loose RTK.md plus AGENTS.md setup with a packaged RTK Codex plugin.
  • Adds plugin-owned RTK Codex files: .codex-plugin/plugin.json, skills/rtk/SKILL.md, and hooks/hooks.json.
  • Adds native rtk hook codex handling for Codex PreToolUse Bash payloads.
  • Updates rtk init --codex, rtk init -g --codex, rtk init --codex --show, and rtk init --codex --uninstall to manage the plugin lifecycle.
  • Keeps the implementation self-contained on upstream develop.

Behavior

  • The plugin manifest advertises RTK command rewriting, points Codex to bundled skills, and registers plugin hook lifecycle config.
  • The bundled RTK skill explains when to use RTK, automatic Bash rewriting, opt-out behavior, and validation with rtk gain.
  • The Codex PreToolUse hook rewrites supported Bash commands such as git status to rtk git status.
  • The hook config delegates directly to the native RTK hook processor with rtk hook codex on Linux/macOS and rtk.exe hook codex through commandWindows on native Windows.
  • RTK_EXE can be set before rtk init --codex to write an explicit executable path into the installed hook config.
  • The hook still matches Codex Bash tool payloads; the matcher name does not imply that native Windows needs a Unix shell launcher.
  • rtk hook codex ignores empty input, malformed JSON, non-Bash tools, missing commands, unsupported commands, already-RTK commands, and heredocs.

Safety

  • The Codex hook delegates command selection to RTK's existing rewrite registry and heredoc guard instead of adding new command filters.
  • Rewrites emit Codex-supported permissionDecision: "allow" with updatedInput.command; RTK does not emit unsupported permissionDecision: "ask" rewrites.
  • Hook runtime processing failures do not block the original Codex tool call.
  • Uninstall removes only RTK-managed plugin state, marketplace entries, and legacy RTK-managed Codex guidance.
  • Legacy cleanup preserves unmanaged user-owned RTK.md content and its AGENTS.md reference.

Validation

  • cargo test codex: 26 passed, 0 failed.
  • cargo fmt --all -- --check: pass.
  • cargo build: pass.
  • Native hook processor success path: returned an allow rewrite to rtk git status.
  • Hook config tests cover direct Linux/macOS command generation, native Windows commandWindows, and install-time RTK_EXE override rendering.
  • cargo clippy --all-targets: pass.
  • cargo test --all: 1945 passed, 0 failed, 6 ignored.
  • git diff --check: pass.

AZ-LL added 2 commits May 23, 2026 20:35
Add an RTK Codex plugin package with bundled skill guidance, hook lifecycle configuration, and a thin launcher that delegates Codex PreToolUse payloads to the native RTK hook processor.

Teach rtk init --codex to install local and global plugin packages, register marketplace entries, report plugin and feature state, and uninstall only RTK-managed plugin or legacy guidance state.

Add native rtk hook codex handling for Bash rewrites with fail-open behavior, supported allow-with-updatedInput responses, and tests for plugin packaging, lifecycle migration, unsupported inputs, heredocs, and missing RTK executables.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 24, 2026

CLA assistant check
All committers have signed the CLA.

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.

2 participants