You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backlog/tasks/back-494 - Backlog-Guard-PreToolUse-hook-to-enforce-MCP-CLI-access-to-backlog-directories.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,30 @@ All 5 files created via Serena (serena-guard blocked direct Write on .sh/.py):
121
121
Branch: feature/back-494-backlog-guard-hook
122
122
Commit: 59308c6
123
123
PR: https://github.com/MrLesk/Backlog.md/pull/649
124
+
125
+
### OpenCode support (added post-initial-implementation)
126
+
127
+
OpenCode does NOT have Claude Code-style declarative shell-script hooks. Verified
128
+
against https://opencode.ai/docs. The equivalent mechanism is a JS plugin with a
129
+
`tool.execute.before` handler that throws an Error to hard-block a tool call.
130
+
131
+
Added `hooks/backlog-guard/opencode-plugin.js`:
132
+
- Mirrors check.py logic entirely in JavaScript (no external deps — YAML parsed
133
+
with a targeted regex since the format is self-authored)
134
+
- Config discovery uses the same 4-step order as check.py (git root → CWD walk →
135
+
auto-detect → no-op)
136
+
- Cache (`_cache` sentinel) avoids re-running `git rev-parse` + FS walk on every
137
+
tool call within a long OpenCode session
138
+
- Block method: `throw new Error(message)`vs check.py's JSON stdout protocol
139
+
140
+
Updated README.md and SKILL.md to cover both tools:
141
+
- README: global/per-project install matrix for both Claude Code and OpenCode,
142
+
mechanism comparison table
143
+
- SKILL.md: added Steps 7–8 for OpenCode (global symlink to
144
+
`~/.config/opencode/plugins/`or per-project `plugin` array in opencode.json)
145
+
146
+
Also added `opencode.json` at repo root for use when developing Backlog.md itself
147
+
with OpenCode (MCP server + plugin wired up together).
0 commit comments