feat(codex): add integrated PreToolUse plugin support#2069
Open
xuegaoge wants to merge 3 commits into
Open
Conversation
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.
2afc3d0 to
f4b506d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR combines the stronger native Codex plugin direction from #2063 with the safer behavior and user-facing setup guidance from #2068.
rtk hook codexlifecycle integration from feat(codex): route shell commands through plugin hooks #2063.tool_inputwhen rewriting commands, replacing onlycommandso fields such astimeoutanddescriptionare not dropped.docs/usage/CODEX_PRETOOLUSE_ADAPTER.mdwith first-install guidance that reuses an existing RTK install whenrtk gainworks and installs RTK only when missing or incorrect.allow+updatedInputbehavior.Why
The previous prompt-only Codex setup depends on the model remembering to prefix shell commands with
rtk. The native Codex plugin hook moves that rewrite to the tool-call layer. This PR keeps that product-level integration while carrying over the safer adapter behavior tested in #2068: preserve the rest of Codex'stool_inputand provide a clear usage guide for new and already-installed RTK users.Credit: this builds on the implementation direction from #2063 and folds in the manual-adapter safeguards from #2068.
Validation
cargo test test_codex_rewrite_preserves_tool_input_fields -- --nocaptureinitially failed before the preservation fix.cargo test test_codex_rewrite_preserves_tool_input_fields -- --nocapturepassed after the fix.cargo test codex -- --nocapturepassed: 28 passed.cargo fmt --all -- --checkpassed.cargo clippy --all-targets -- -D warningspassed.cargo test --allpassed: 1947 passed, 6 ignored.git diff --check HEAD~3..HEADpassed.cargo run -- init -g --codexwith isolatedHOMEandCODEX_HOME; verified plugin package, marketplace entry, andhooks/hooks.jsonwere written andrtk init --show --codexdetected them.docs/usage/CODEX_PRETOOLUSE_ADAPTER.mdwithbash -n.