Repository navigation
Conversation
📊 Automated PR Analysis
SummaryFixes rtk init -g --opencode so it additionally installs the Claude Code hook instead of replacing it, matching the flag's documented behavior. Removes the now-unreachable opencode-only code path and updates help text/README accordingly, with a regression test verifying both installs occur. Review Checklist
Linked issues: #4046 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
`rtk init -g --opencode` installed only the OpenCode plugin and skipped
Claude hook registration, contradicting the flag's help text ("in addition
to Claude Code"). Root cause: `install_claude = !opencode` in the CLI
mapping — `init::run` already supported the combined case.
- always install the Claude Code hook; --opencode only adds the plugin
- drop the now-unreachable opencode-only mode and its match arm
- update `--show` hint and README accordingly
- add regression test on `rtk init -g --opencode --dry-run`
Fixes rtk-ai#4046
Signed-off-by: dopaemon <[email protected]>
ba7518e to
43f078e
Compare
|
Thanks for this, and sorry for the duplicated effort — closing as DUPLICATE, recommend closing in favour of #4052. The reason is timing on the issue rather than anything about the code: @TechWizard9999 asked to be assigned #4046 at 09:28Z and was assigned at 11:02:21Z; this PR was opened at 11:23:40Z, about 20 minutes after the issue was already assigned. #4052 is the assignee's PR, so that one carries. For the record, I reviewed both against real runs rather than assuming they were interchangeable, and they are equivalent on correctness — both share the same blocking regression: Routing One thing your PR does that #4052 doesn't, and that I'd like to keep: removing Your diagnosis in the PR body was accurate, and the |
Fixes #4046
Problem
rtk init -g --opencodeinstalled only the OpenCode plugin and skipped Claude hook registration, even though the flag's help text says "Install OpenCode plugin (in addition to Claude Code)". Users had to runrtk init -gseparately afterwards.Root cause
src/main.rs:let install_claude = !opencode;— the flag replaced the Claude setup.hooks::init::runalready handled the combined case via its(true, opencode, …)match arms, so nothing else was missing.Changes
src/main.rs:install_claudeis alwaystrue;--opencodeis purely additive.src/hooks/init.rs: removed the now-unreachable(false, true, …)arm andrun_opencode_only_mode(); updated thertk init --showhint.README.md:# Claude Code hook + OpenCode plugininstead of "instead of Claude Code".tests/init_opencode_additive_test.rs: regression test —rtk init -g --opencode --dry-rununder a temp$HOMEmust report both the OpenCode plugin and the Claude hook (RTK.md + settings.json).Verification
cargo fmt --all+cargo clippy --all-targetsclean, lib suite (3613 tests) and all integration test binaries pass locally. Note:tests/guard_integration_test.rscould not be run locally (itsgitsubprocesses hang in my sandbox); it is untouched by this change and left to CI.