Skip to content

feat(hook): cover opencode's native tool names in the branch guard - #281

Merged
getappz merged 2 commits into
masterfrom
opencode-branch-guard
Jul 20, 2026
Merged

feat(hook): cover opencode's native tool names in the branch guard#281
getappz merged 2 commits into
masterfrom
opencode-branch-guard

Conversation

@getappz

@getappz getappz commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • MUTATING_TOOLS in src/hook_redirect.rs now includes opencode's native tool names (patch, apply_patch, multiedit) plus the previously-missing MultiEdit/multiedit for Claude Code.
  • These are consulted by the opencode branch-guard plugin (~/.config/opencode/plugin/branch-guard.js), which shells out to agentflare hook pre-tool-use instead of duplicating branch-check logic — this is what actually makes that classifier cover opencode's real tool set.

Test plan

  • cargo test hook_redirect — 17/17 passing, including new classify_blocks_opencode_native_tool_names_on_master
  • Live-tested against a real opencode run: native write correctly denied on master via the rebuilt binary

Summary by CodeRabbit

  • Bug Fixes
    • Added branch protection for additional editing tools, including patch and multi-edit operations.
    • These changes are now blocked when attempted on the repository’s default branch, matching existing safeguards.

MUTATING_TOOLS now includes patch/apply_patch/multiedit (opencode) and
MultiEdit/multiedit (Claude Code, previously missing) alongside the
existing write/edit/notebookedit names, so the shared classifier the
opencode branch-guard plugin calls via `agentflare hook pre-tool-use`
actually covers opencode's real tool set.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e153330c-0897-4f33-a7d7-ea078f377ec4

📥 Commits

Reviewing files that changed from the base of the PR and between 2ab2dd0 and de9f63b.

📒 Files selected for processing (1)
  • src/hook_redirect.rs

📝 Walkthrough

Walkthrough

The pre-tool-use redirect classifier now treats additional opencode mutation tools as mutating on the default branch, and tests that they are blocked on master.

Changes

Opencode mutation tool guarding

Layer / File(s) Summary
Mutation tool classification and coverage
src/hook_redirect.rs
Adds patch, apply_patch, multiedit, and MultiEdit to the mutating-tool allowlist and verifies they are blocked on master.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the branch-guard change for opencode's native tool names.
Description check ✅ Passed The description covers the required summary and test plan and is mostly complete, though the notes for reviewers section is missing.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch opencode-branch-guard

Comment @coderabbitai help to get the list of available commands.

@getappz
getappz merged commit 6d632e3 into master Jul 20, 2026
16 checks passed
@getappz
getappz deleted the opencode-branch-guard branch July 20, 2026 18:51
getappz added a commit that referenced this pull request Jul 20, 2026
Agentflare-Agent: claude-code_2-1-215_agent
Agentflare-Branch: item-185-asset-store-migration
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.

1 participant