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

    Ledger

    v0.5.0界面与主题
    @shivambaku/opencode-ledger

    Experimental code review agent and TUI review ledger plugin for OpenCode.

    GitHub 星标

    0

    月装机量

    11

    近 7 天 3

    综合评分SCORE

    22.7

    生态多维模型

    最近提交

    2 个月前

    2026-06-03

    快速安装与配置

    opencode.json

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

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@shivambaku/opencode-ledger@0.5.0"]
    }

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

    Experimental code review agent and TUI review ledger plugin for OpenCode.

    Note: opencode-ledger is an independent project and is not built by, affiliated with, or endorsed by the OpenCode team.

    Requirements

    • OpenCode
    • A git repository to review

    Install

    Add Ledger to your OpenCode TUI config:

    {
      "$schema": "https://opencode.ai/tui.json",
      "plugin": ["@shivambaku/opencode-ledger"]
    }
    

    Use one of these config locations:

    • ~/.config/opencode/tui.json for all projects
    • .opencode/tui.json inside one project

    Restart OpenCode after changing config. OpenCode installs npm plugins automatically on startup.

    Open Ledger from the command palette or with /ledger. Press ? inside Ledger for help.

    How it works

    Ledger lists changed files, lets you inspect each diff hunk, asks your OpenCode model for explanations, and tracks which blocks you have approved locally.

    Important keys

    • j / k: move selection or diff cursor
    • J / K: next or previous block
    • n / N: next or previous block
    • ] / [: next or previous file
    • enter: open file diff or switch explanation focus
    • space: approve selected file or active block
    • a: analyze selected file
    • A: analyze all pending files
    • tab: show or hide explanation
    • c: add or edit block comment
    • m: generate commit message
    • esc: back
    • q: close Ledger

    Privacy and storage

    • Ledger stores local review state in .opencode/ledger/state.json inside the reviewed repository.
    • Ledger writes .opencode/.gitignore with /ledger/ so its state is not committed by default.
    • AI analysis sends the current Git diff and relevant prior OpenCode edit context to your configured OpenCode model provider.
    • Analysis sessions are temporary and are deleted after analysis finishes or is stopped.
    • Set LEDGER_DEBUG=1 to keep analysis request and response payloads under .opencode/ledger/debug for troubleshooting.

    Troubleshooting

    • If Ledger does not appear, restart OpenCode and check that @shivambaku/opencode-ledger is listed in your tui.json plugin array.
    • If you already have plugins configured, add @shivambaku/opencode-ledger to the existing plugin array instead of replacing it.
    • If analysis has no files to show, make sure OpenCode is running inside a git repository with local changes.

    Local development

    Use a local source path in your OpenCode TUI config:

    {
      "$schema": "https://opencode.ai/tui.json",
      "plugin": ["file:///Users/you/opencode-plugins/opencode-ledger/src/tui.tsx"]
    }
    

    Replace /Users/you with your actual path. Restart OpenCode after changing the config.