跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    levent-kurt

    Git Commit

    v1.0.1Git 与版本控制
    @levent-kurt/opencode-git-commit

    Zero-config background git auto-commit plugin for OpenCode CLI

    GitHub 星标

    1

    月装机量

    11

    近 7 天 2

    综合评分SCORE

    22.5

    生态多维模型

    最近提交

    4 个月前

    2026-04-17

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@levent-kurt/opencode-git-commit@1.0.1"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    npm version

    An OpenCode plugin that automatically commits changes when your coding session becomes idle.

    What It Does

    This plugin monitors your OpenCode session and automatically creates git commits when:

    1. The session goes idle (no active operations)
    2. There are uncommitted changes in your working directory
    3. A git repository exists (or can be initialized)

    The commit message is intelligently extracted from the last assistant message in your conversation, making commits contextual and meaningful.

    Features

    • Automatic Commits - Commits changes whenever your session becomes idle
    • Smart Commit Messages - Extracts context from your last conversation to create meaningful commit messages
    • Auto-initialize - Automatically initializes a git repository if one doesn't exist
    • Respects .gitignore - Git handles ignored files automatically
    • Conventional Commits - Uses feat: or fix: prefixes based on message content

    Installation

    Via Command Line

    opencode plugin "@levent-kurt/git-autocommit@latest"
    

    Via Configuration

    Add to your .opencode/opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": [
        "@levent-kurt/git-autocommit@latest"
      ]
    }
    

    Manual Installation

    npm install @levent-kurt/git-autocommit
    

    Then add to .opencode/opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": [
        "file:///path/to/node_modules/@levent-kurt/git-autocommit/dist/index.js"
      ]
    }
    

    How It Works

    1. When a session.idle event is triggered, the plugin checks for git changes
    2. If changes exist, it fetches the last assistant message from your session
    3. Extracts the first line, sanitizes it, and uses it as the commit message
    4. Stages all changes with git add .
    5. Commits with --no-verify to bypass hooks

    Configuration

    The plugin works out of the box with no configuration needed. Just install and it will start auto-committing.

    Requirements

    • OpenCode with plugin support
    • Node.js (for running the plugin)
    • Git installed on your system

    License

    MIT