1
51
近 7 天 23
24.7
生态多维模型
5 个月前
2026-03-17
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@xesrevinu/opencode-jj-enforcer@0.1.2"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@xesrevinu/opencode-jj-enforcer@0.1.2"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @xesrevinu/opencode-jj-enforceropencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode plugin that blocks git usage inside Jujutsu workspaces and forces agents onto jj.
Highlights
- inspects
bashtool calls before execution instead of relying on post-hoc review - detects
.jjroots from the workspace,git -C, andcd ... && git ...command patterns - blocks wrapper forms such as
rtk git ...so rewrite plugins cannot bypass the policy - stays repository local with no external service or daemon requirements
- ships as a small npm package that can also be copied directly into
.opencode/plugin
Install
Use the published package from opencode.jsonc:
{
"plugin": ["@xesrevinu/opencode-jj-enforcer@latest"],
}
Restart OpenCode after updating the plugin list.
If you want to iterate from a checkout instead of npm:
mkdir -p .opencode/plugin
cp plugin/jj-enforcer.ts .opencode/plugin/jj-enforcer.ts
Usage
The plugin checks the current workspace plus directories referenced inside the shell command. If any of them belong to a Jujutsu repository, the command is rejected and the agent is told to use jj.
Examples that are blocked inside a .jj workspace:
git status
git -C ../repo log
cd ../repo && git diff
rtk git log
Development
The repository uses Bun for dependency management and local commands.
bun install
bun run check
Release
This package uses Changesets plus the shared GitHub Actions release workflow.
bun run changeset
bun run version-packages
bun run release
License
MIT