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-git-trailers

v0.5.0

Published

Automatically add standardized git trailers to AI-assisted commits for compliance, audit trails, and attribution

Readme

opencode-git-trailers

npm version npm downloads CI codecov License: MIT Snyk Vulnerabilities

Automatically track AI contributions in your git history with standardized trailers

Perfect for teams requiring compliance, audit trails, or transparency in AI-assisted development.

Quick Start

npm install opencode-git-trailers

Add to your OpenCode config:

{
  "plugins": ["opencode-git-trailers"]
}

Configure your preferred trailers:

git config --global opencode.trailer.model '{{model}}'
git config --global opencode.trailer.co-authored-by 'AI Assistant <[email protected]>'

Done! All commits through OpenCode will now include these trailers.

Use Cases

  • Compliance: Automatically tag AI-assisted commits for audit requirements
  • Attribution: Track which AI models contributed to your codebase
  • Team Transparency: Make AI assistance visible in git history
  • Debugging: Trace issues back to specific AI model versions
  • Analytics: Analyze AI contribution patterns across your project

Problem

Some projects require commits created with AI assistance to include metadata denoting this fact. Git trailers provide a standardized way to add such metadata to commit messages. This plugin ensures that trailers are deterministically added to all commits made through OpenCode.

What It Does

This plugin creates a temporary git commit-msg hook that automatically appends configured trailers to commit messages using git interpret-trailers. The hook is installed before commits made through OpenCode and automatically cleaned up afterward. Trailers are added to the end of the commit message following the git trailer format.

Installation

npm install opencode-git-trailers

Usage

Basic Setup

Add the plugin to your OpenCode configuration:

{
  "plugins": ["opencode-git-trailers"]
}

Configuration

This plugin uses a hybrid approach combining OpenCode-specific configuration with Git's standard trailer system:

  1. opencode.trailer.* - Specifies which trailers to add and their value templates
  2. trailer.* (optional) - Git's standard trailer config for controlling key formatting

Quick Start (Minimal Setup)

# Add trailers with default (lowercase) formatting
git config --global opencode.trailer.model '{{model}}'
git config --global opencode.trailer.co-authored-by 'AI Assistant <[email protected]>'

Result:

model: claude-sonnet-4-5@20250929
co-authored-by: AI Assistant <[email protected]>

Recommended Setup (With Proper Capitalization)

For properly capitalized trailer keys, combine OpenCode config with Git's standard trailer formatting:

# Define trailer key formatting (standard Git config)
git config --global trailer.model.key "Model"
git config --global trailer.co-authored-by.key "Co-authored-by"
git config --global trailer.signed-off-by.key "Signed-off-by"

# Specify which trailers OpenCode should add (OpenCode-specific config)
git config --global opencode.trailer.model '{{model}}'
git config --global opencode.trailer.co-authored-by 'AI Assistant <[email protected]>'
git config --global opencode.trailer.signed-off-by '{{user.name}} <{{user.email}}>'

Result:

Model: claude-sonnet-4-5@20250929
Co-authored-by: AI Assistant <[email protected]>
Signed-off-by: John Doe <[email protected]>

Per-Repository Configuration

Configure trailers for a specific repository by running commands within the repository directory (omit --global flag):

# Navigate to your repository
cd /path/to/your/repo

# Define formatting
git config trailer.model.key "Model"

# Specify what to add
git config opencode.trailer.model '{{model}}'

Per-repository configuration overrides global configuration for the same trailer key.

Variable Interpolation

Trailers support variable interpolation to include contextual information such as the model used:

# Configure a trailer with model interpolation
git config opencode.trailer.model '{{model}}'

# Use git user information
git config opencode.trailer.signed-off-by '{{user.name}} <{{user.email}}>'

Available Variables

  • {{model}} - The model identifier used for the commit
  • {{provider}} - The provider name (e.g., "anthropic", "openai")
  • {{timestamp}} - ISO 8601 timestamp of the commit
  • {{session}} - OpenCode session ID
  • {{user.name}} - Git user name from git config
  • {{user.email}} - Git user email from git config

How It Works

The plugin uses a two-step configuration system:

  1. OpenCode Configuration (opencode.trailer.*):

    • Determines which trailers are added to OpenCode commits
    • Provides value templates with variable interpolation (e.g., {{model}})
    • Required for trailers to be added
  2. Git Trailer Configuration (trailer.*.key, optional):

    • Controls how trailer keys are formatted in the commit message
    • If present, Git formats the trailer key according to this setting
    • If absent, the key from opencode.trailer.* is passed to git interpret-trailers as-is, which formats it according to Git's default trailer rules

Example:

# The config key name creates the association:
git config trailer.model.key "Model"          # ← Formats "model" as "Model"
git config opencode.trailer.model '{{model}}'  # ← Adds trailer "model"

When OpenCode makes a commit, it generates: --trailer "model:claude-4"
Git interpret-trailers formats it as: Model: claude-4

Additional Features

Hook Chaining

If your repository already has a commit-msg hook, this plugin will preserve and chain to it. The existing hook runs first, then the trailers are added. When the commit completes, your original hook is restored.

Graceful Error Handling

If the plugin encounters an error (e.g., unable to create the hook file), it logs the error but allows the commit to proceed without trailers. This ensures the plugin never blocks your commits.

Variable Filtering

Trailers with undefined or uninterpolated variables are automatically filtered out. For example, if {{provider}} is not available, a trailer configured as provider: {{provider}} will not be added to the commit.

Upgrading from Previous Versions

Version 0.1.3 and earlier automatically capitalized the first letter of trailer keys.
Version 0.1.4+ relies on Git's standard trailer.*.key configuration for formatting.

If upgrading, your trailers will appear in lowercase unless you add trailer.*.key configuration:

# For each trailer, add the corresponding formatting config
git config --global trailer.model.key "Model"
git config --global trailer.session.key "Session"
git config --global trailer.co-authored-by.key "Co-authored-by"
git config --global trailer.signed-off-by.key "Signed-off-by"

Example Commit Message

Before this plugin:

Add user authentication

This commit implements JWT-based authentication
for the API endpoints.

After this plugin (with configured trailers):

Add user authentication

This commit implements JWT-based authentication
for the API endpoints.

Model: claude-sonnet-4-5@20250929
Co-authored-by: AI Assistant <[email protected]>
Signed-off-by: John Doe <[email protected]>

Development

Prerequisites

  • Bun 1.x or later

Setup

bun install

Build

bun run build

Test

# Run tests once
bun run test

# Run tests in watch mode
bun run test:watch

# Run tests with coverage
bun run test:coverage

Lint

bun run lint

License

MIT