npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-commit-guard

v1.3.0

Published

OpenCode V2 plugin enforcing git commit format rules

Readme

opencode-commit-guard

This OpenCode V2 plugin checks Git commit messages before an agent runs git commit. It requires @opencode/plugin 2.4.1 or newer and effect 4.1.0 or newer.

Overview

The plugin inspects every shell and bash tool call before it runs, across POSIX shells and PowerShell 7 (pwsh). If a git commit breaks a formatting rule, the plugin rejects the tool call with an error. The error lists each violation and shows a conforming example, so the agent can fix the message and retry.

Before the first commit in each session and checkout, the agent captures a Git baseline with the commit_context tool. The baseline records the effective commit.gpgsign setting, which determines whether a commit needs a signoff. On Windows, context capture and command inspection target PowerShell 7 (pwsh).

The plugin does not change Git hooks or repository configuration.

Installation

Add the package to your opencode.json or opencode.jsonc file:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": [
    {
      "package": "opencode-commit-guard",
    },
  ],
}

Set options on the plugin entry:

{
  "plugins": [
    {
      "package": "opencode-commit-guard",
      "options": {
        "requireScope": true,
        "allowedScopes": ["kernel", "build", "ui"],
        "maxLineLength": 72,
      },
    },
  ],
}

| Option | Default | Allowed values | | --------------- | ------- | ---------------------------------------------------------------------------------- | | requireScope | true | Boolean. Requires a <scope>: <subject> first line. | | allowedScopes | none | Array of non-empty scope names. An empty array allows any scope. | | maxLineLength | 72 | Integer of 0 or more. Limits each subject and body line. Set 0 to remove limits. |

The plugin rejects unknown options, including requireSignoff.

Usage

  1. Ask your agent to commit changes in your repository.
  2. Before the first commit in a session and checkout, your agent calls commit_context and runs the returned capture command in the foreground shell. Approve that shell command when OpenCode prompts you.
  3. Wait for Frozen commit baseline in the shell output. That report confirms the active baseline and lists the commit rules for the checkout.

RECEIPT_OK confirms only that the shell wrote the capture file. It does not authorize a commit.

Ask your agent to refresh the baseline (commit_context with refresh: true) after you switch branches, change signing settings, or change commit instructions.

Formatting rules

  • Scope: The first line uses <scope>: <subject>, for example kernel: fix race or feat(parser): add subshells.
  • Allowed scopes: If allowedScopes has entries, the scope must match one of them.
  • Line length: No subject or body line exceeds maxLineLength.
  • Signoff: If the captured commit.gpgsign is true, add -s or a Signed-off-by: trailer. Signoff is not a cryptographic signature.
  • Literal messages: Supply messages with -m, --message, one quoted heredoc on POSIX standard input, or a single literal here-string pipeline in PowerShell 7. The plugin rejects message files, shell expansion in messages, and --trailer.
  • Direct target: Run git commit directly in the captured checkout. The plugin rejects git -C, Git directory flags, Git environment overrides, and directory-changing wrappers.

In POSIX shells, use real newlines inside $'...' for a message body:

git commit -s -m $'kernel: Fix race in thermal driver\n\nHold the lock while the sensor list changes.'

In PowerShell 7 (pwsh), use single quotes or pipe a literal here-string to git commit -F -:

@'
kernel: Fix race in thermal driver

Hold the lock while the sensor list changes.
'@ | git commit -s -F -

git commit --help and git commit -h do not need a baseline.