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

    Jj Enforcer

    v0.1.2Git 与版本控制
    @xesrevinu/opencode-jj-enforcer

    OpenCode plugin that enforces jj over git when a workspace contains a .jj repository.

    GitHub 星标

    1

    月装机量

    51

    近 7 天 23

    综合评分SCORE

    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"]
    }

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

    OpenCode plugin that blocks git usage inside Jujutsu workspaces and forces agents onto jj.

    Highlights

    • inspects bash tool calls before execution instead of relying on post-hoc review
    • detects .jj roots from the workspace, git -C, and cd ... && 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