@shivambaku/opencode-ledgerExperimental code review agent and TUI review ledger plugin for OpenCode.
0
11
近 7 天 3
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"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@shivambaku/opencode-ledger@0.5.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @shivambaku/opencode-ledgeropencode 启动时会通过内嵌运行时自动加载 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.jsonfor all projects.opencode/tui.jsoninside 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 cursorJ/K: next or previous blockn/N: next or previous block]/[: next or previous fileenter: open file diff or switch explanation focusspace: approve selected file or active blocka: analyze selected fileA: analyze all pending filestab: show or hide explanationc: add or edit block commentm: generate commit messageesc: backq: close Ledger
Privacy and storage
- Ledger stores local review state in
.opencode/ledger/state.jsoninside the reviewed repository. - Ledger writes
.opencode/.gitignorewith/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=1to keep analysis request and response payloads under.opencode/ledger/debugfor troubleshooting.
Troubleshooting
- If Ledger does not appear, restart OpenCode and check that
@shivambaku/opencode-ledgeris listed in yourtui.jsonpluginarray. - If you already have plugins configured, add
@shivambaku/opencode-ledgerto the existingpluginarray 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.