feat(scaffold): OpenCode commit-nudge plugin#17
Merged
Conversation
OpenCode does not have shell-script hooks; it uses TS plugin modules loaded as-is by Bun. This plugin is the counterpart of the .claude/, .gemini/, .cursor/ hooks already in the scaffold. The plugin hooks tool.execute.after, filters to edit/write tools, runs 'git status --porcelain' via the injected Bun shell, and when uncommitted file count crosses WEBJS_COMMIT_NUDGE_THRESHOLD (default 4), appends a nudge to output.output so the agent sees it on its next turn. Same threshold and same message text as the other agents' hooks. Skipped on main/master (different guards cover that) and outside a git work tree. Auto-discovered by OpenCode from .opencode/plugins/ at startup. No opencode.json registration needed. lib/create.js scaffold copy list extended so new apps ship the plugin file alongside the other hook configs. Doc reference: https://opencode.ai/docs/plugins/
Updates the enforcement matrix in both framework AGENTS.md and scaffold templates/AGENTS.md. OpenCode moves from 'text rule only (TS plugin support planned)' to a real programmatic entry that fires on tool.execute.after at threshold 4, matching the Claude Code / Gemini CLI / Cursor coverage. Only Windsurf, Copilot, and Antigravity remain text-rule-only. Windsurf because its post-write hooks cannot inject context back to the agent; Copilot and Antigravity because they have no hooks API.
vivek7405
added a commit
that referenced
this pull request
May 21, 2026
feat(scaffold): OpenCode commit-nudge plugin
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
Closes the last gap in cross-agent commit-frequency enforcement. OpenCode users now get the same nudge that Claude Code, Gemini CLI, and Cursor users got in PR #13.
Mechanism
OpenCode doesn't use shell-script hooks. It uses TS plugin modules loaded by Bun at runtime, registered automatically when dropped into
.opencode/plugins/. The plugin exports an async function that returns aHooksobject whose handlers fire on lifecycle events.The plugin in this PR:
tool.execute.afterinput.tool === "edit" || input.tool === "write"git status --porcelainvia the injected Bun shell ($)WEBJS_COMMIT_NUDGE_THRESHOLD(default 4), appends a reminder tooutput.outputso the agent sees it on the next turnSame threshold and same message text as the Claude / Gemini / Cursor hooks. Skipped on
main/masterand outside a git work tree.Updated enforcement matrix
.claude/hooks/nudge-uncommitted.sh(PostToolUse).gemini/hooks/nudge-uncommitted.sh(AfterTool).cursor/hooks/nudge-uncommitted.sh(afterFileEdit).opencode/plugins/nudge-uncommitted.ts(tool.execute.after)Plus the tool-agnostic
.hooks/pre-committhat runswebjs test+webjs checkfor everyone.Commits
Two. First adds the plugin file plus the
create.jscopy-list entry. Second updates the enforcement matrix in frameworkAGENTS.mdand scaffoldtemplates/AGENTS.md.Test plan
npm testpasses on every commit (pre-commit gate)@opencode-ai/plugintypes per https://opencode.ai/docs/plugins/References