Skip to content

fix(opencode): discover project directory permission configs - #4856

Open
superbiche wants to merge 1 commit into
rtk-ai:developfrom
superbiche:fix/opencode-project-dir-discovery
Open

superbiche wants to merge 1 commit into
rtk-ai:developfrom
superbiche:fix/opencode-project-dir-discovery

Conversation

@superbiche

Copy link
Copy Markdown

Summary

  • rtk hook opencode now discovers project permissions in .opencode/opencode.json(c) directories, not only direct ancestor opencode.json(c) files, so a project-level deny or ask is seen by the before/after verdict comparison and the rewrite is skipped ({}).
  • Source order follows OpenCode: direct files outermost first, then .opencode directories outermost first, opencode.json before opencode.jsonc in each directory. Global config and OPENCODE_CONFIG semantics are unchanged.
  • Tests cover subdirectory discovery, deny and ask, a project-directory deny over a nearer direct allow, and jsonc priority.

Fixes #4855 (deny lifted when the project policy lives in .opencode/).

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test — not run locally; this patch was prepared from source inspection in an environment that does not build the crate. Please rely on CI and tell me if anything fails, I will follow up.
  • Manual testing: installed rtk 1.1.0 reproduces the defect ({"command":"rtk git diff"} under a .opencode/opencode.json deny, {} under ./opencode.json); the patch applies cleanly on develop (7e92da0) and git diff --check is clean.

@superbiche · user · drafted with Claude Fable 5.1, reviewed before posting; the voice and decisions are mine.

@CLAassistant

CLAassistant commented Oct 30, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

Fixes OpenCode permission discovery in rtk hook opencode so that project-level permission configs living in .opencode/opencode.json(c) directories are discovered, not just direct ancestor opencode.json(c) files. This ensures a project-level deny or ask rule is correctly applied by the before/after verdict comparison, preventing the rewrite from incorrectly clearing it to {}.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4855


Analyzed automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCode hook misses .opencode project permissions and can lift deny or ask

2 participants