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

    Jj Opencode

    v0.2.0智能体编排
    jj-opencode

    OpenCode plugin for JJ VCS - enforces 'define change before implementation' workflow

    GitHub 星标

    24

    月装机量

    50

    近 7 天 27

    综合评分SCORE

    29.7

    生态多维模型

    最近提交

    7 个月前

    2026-01-06

    快速安装与配置

    opencode.json

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

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["jj-opencode@0.2.0"]
    }

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

    Describe intent. Edit. Commit. Repeat.

    npm version License: MIT

    An OpenCode plugin that blocks edits until you declare intent.

    How It Works

    AI: jj describe -m "Add validation"  ← declare intent, unlocks
    AI: [edits files]                    ← all edits in this commit
    [session ends]                       ← auto-commits, locks again
    
    AI: jj describe -m "Add tests"       ← declare intent, unlocks
    AI: [edits files]
    [session ends]                       ← auto-commits, locks again
    
    User: "undo that"
    AI: jj undo                          ← reverts last commit
    

    jj new runs automatically when the session goes idle — can't accidentally mix work.

    Installation

    npm install -g jj-opencode
    

    Add to ~/.config/opencode/config.json:

    {
      "plugin": ["jj-opencode"]
    }
    

    Commands

    Task Command
    Start work jj describe -m "what you're doing"
    Finish work (automatic)
    Undo jj undo
    Status jj st
    History jj log
    Push jj_push tool

    Tools

    jj_push

    Safely pushes changes to a bookmark.

    jj_push                      ← push to main (default)
    jj_push bookmark="feature"   ← push to specific branch
    

    Auto-detects what to push:

    • If @ has changes → pushes @
    • If @ is empty (common after session idle) → pushes @-
    • If both empty → searches for unpushed commits, requires confirmation

    Flow:

    1. Shows preview with commits and files
    2. Requires user confirmation
    3. Moves bookmark → pushes → verifies clean working copy

    Only specify bookmark if user explicitly requested it.

    JJ ≠ Git

    JJ uses bookmarks, not branches. Key difference for pushing:

    Git Model JJ Model
    Push commits one by one Move bookmark to tip, push once
    Can rewrite after push (with force) Commits are immutable after push

    Anti-pattern: Don't try to push commits sequentially or squash after pushing.

    Subagents

    Subagents that hit the edit gate are blocked and told to return to the parent agent. JJ workflow (describe/new/push) should only be managed by the primary agent.

    Why?

    • Guaranteed separationjj new runs automatically on session idle
    • Never lose work — every edit is in a described commit
    • Clear history — every commit has meaning

    License

    MIT