Skip to content

dpshade/jj-opencode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jj-opencode

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

About

OpenCode plugin enforcing JJ define-before-implement workflow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published