A native IntelliJ IDEA plugin for Jujutsu (jj) version control, built around JJ's "describe-first" workflow: the working copy is always a commit, and the core loop is describe → change → new.
- Language: Kotlin
- Build: Gradle + IntelliJ Platform Gradle Plugin 2.0
- Target Platform: IntelliJ IDEA 2025.2+, Java 21
- VCS integration is CLI-based behind an interface (
JujutsuCommandExecutor), leaving room for a future native-library implementation
See ROADMAP.md for the prioritized feature list.
Audience: JJ CLI power users — already comfortable with the jj command line, seeking IDE convenience and visual feedback without losing JJ's workflow.
Key differentiator: best-in-class support for JJ's "describe-first" workflow — the working copy is always a commit, and the core loop is describe → change → new. The plugin should feel like a first-class native IntelliJ VCS, not a CLI wrapper.
Critical success factors:
- Core operations work flawlessly (edit, abandon, describe, new)
- UI polish — professional, consistent, proper icons and theming
- Stability — comprehensive testing, graceful error handling, no crashes
- Discoverability — clear documentation, marketing materials, keyboard shortcuts
JujutsuVcs (extends AbstractVcs)
├── root: VirtualFile - Auto-discovers .jj directory
├── JujutsuChangeProvider - Detects file changes via `jj status`
├── JujutsuDiffProvider - Provides diff content
├── BulkFileListener - Auto-refresh on file system changes
└── JujutsuCommandExecutor (interface)
└── JujutsuCliExecutor(root) - CLI implementation
Critical for proper error handling. Each method is on Project and VirtualFile:
possibleJujutsuVcs→JujutsuVcs?— use in actionupdate()and helpers that merely check whether VCS exists.getVcsWithUserErrorHandling(actionName, logger)→JujutsuVcs?— use in user-facing actions (context menus, toolbar). Shows a friendly error dialog if VCS isn't configured; logs at INFO (user error), e.g.:ApplicationManager.getApplication().executeOnPooledThread { val vcs = JujutsuVcs.getVcsWithUserErrorHandling(project, "Action Name", log) ?: return@executeOnPooledThread // ... use vcs }
jujutsuVcs→JujutsuVcs(throwsVcsException) — use when VCS must exist (tool windows, VCS providers, log panels); a thrown exception here is a plugin bug. Logs at ERROR.
Logging: INFO = expected user error (VCS not configured, action used outside a Jujutsu project). ERROR = plugin bug (VCS should exist but doesn't).
Threading: always call VCS lookup methods on a background thread
(ApplicationManager.getApplication().executeOnPooledThread { }) — lookup does
filesystem checks and can block.
See: vcs/JujutsuVcs.kt companion object
JujutsuCommandExecutor is the abstraction for all jj commands; JujutsuCliExecutor is
the CLI-based implementation. This indirection is what allows a future native-library
swap. See: jj/CommandExecutor.kt, jj/cli/CliExecutor.kt
UX-priority tenet (tie-breaker) — When a look-and-feel or behaviour decision has no clear answer, resolve it in this order: (1) IntelliJ-native conventions — match what the IDE and its built-in VCS log already do; (2) jj-native semantics — match jj's model and terminology; (3) other-VCS or bespoke conventions — only when neither above applies. Prefer reusing/rebinding existing IntelliJ mechanisms (keymap actions, standard data keys) over inventing plugin-specific settings.
Example: GitHub #51 asked for double-click-to-checkout in the log. IntelliJ's own
VcsLogGraphTable has no double-click-to-checkout/diff — commit actions are
keymap-bound and mouseClicked only handles link clicks — so jj-idea-th9h routes
double-click through the same keymap-bound action as Enter (default: Show Diff) rather
than adding a bespoke "double-click behaviour" setting.
Action-availability hints go in the text, not the icon (tenet) — When an action
might not succeed for a reason the plugin can only predict (not guarantee), never
hide, disable, or re-icon it based on that prediction alone — jj (or whatever the
plugin fronts) is the actual authority, and a wrong prediction that blocks the action is
a silent dead end. Instead, append a short parenthetical to the action's text (and
update its tooltip), leaving the icon and enabled/visible state untouched:
"Untrack (may not be ignored)". This keeps the action discoverable, mirrors how the
platform's own disabled-but-hinted actions read, and avoids the "this looks broken"
alarm a warning icon creates for what's usually a correct guess.
Example: jj-idea-i9ol's "Untrack" action can't fully verify jj's own ignore-status
without asking jj itself, so an uncertain prediction changes its text to "Untrack (may not be ignored)" rather than swapping to a warning icon or hiding/disabling the item —
mirroring the existing action.resolve.conflicts.needsEdit pattern ("Resolve Conflicts…" → "Resolve Conflicts… (edit this change first)").
1. Log parsing with null-byte separator — jj log templates use \0 as the field
separator (descriptions can contain newlines/special chars) and ++ concatenation, not
separate() (which skips empty values and would misalign fields). See:
jj/cli/CliLogService.kt
2. TextCanvas pattern for rendering — a TextCanvas interface
(fun append(text: String, style: SimpleTextAttributes)) plus typed extension functions
(append(changeId), append(description), append(bookmarks), etc.) is the single
source of truth for formatting, used consistently across renderers. See:
ui/TextCanvas.kt, ui/DateTimeFormatter.kt, ui/Formatters.kt, ui/JujutsuColors.kt
3. Settings — three-tier model — fallback resolution: repo override → project default → global default.
| Tier | Service | Storage | Settings |
|---|---|---|---|
| Global (app) | JujutsuApplicationSettings |
~/Library/.../jujutsu.xml, RoamingType.DISABLED |
jjExecutablePath |
| Project | JujutsuSettings |
.idea/jujutsu.xml |
UI prefs, log defaults |
| Repository | RepositoryConfig |
.idea/jujutsu.xml, map keyed by repo path |
logChangeLimit overrides (nullable = "use project default") |
Adding a setting: global → field on JujutsuApplicationSettingsState; project → field on
JujutsuSettingsState; per-repo → nullable field on RepositoryConfig + accessor on
JujutsuSettings. Version migrations live in loadState() (v2 moved jjExecutablePath
project→global). See: settings/ package
4. Auto-refresh via BulkFileListener — batched file-change detection, disposed
through the message bus. See: JujutsuVcs.kt
5. Auto-open custom log on startup — PostStartupActivity opens the custom log tab
and suppresses IntelliJ's default VCS log tabs via ContentManagerListener. See:
JujutsuStartupActivity.kt
6. Reusing actions in custom context menus via uiDataSnapshot — when a custom tree
(e.g. JujutsuChangesTree) needs a context menu of existing actions (restore, compare,
etc.), don't duplicate their logic in static helpers or local DumbAwareAction wrappers.
Instead: override uiDataSnapshot on the tree to populate standard data keys
(VcsDataKeys.CHANGES, CommonDataKeys.VIRTUAL_FILE_ARRAY), look up the registered
action via ActionManager, and set the tree as the popup's target component so the
action's AnActionEvent extension properties (in ActionEventExtensions.kt) resolve
correctly. This makes any file/change action work unmodified in any tree that supplies
the right data context. See: ui/JujutsuChangesTree.kt,
vcs/actions/ActionEventExtensions.kt, ui/workingcopy/UnifiedWorkingCopyPanel.kt
7. Action factory pattern — VCS actions are built with factory functions, not classes:
fun editChangeAction(project: Project, changeId: ChangeId?) =
nullAndDumbAwareAction(changeId, "log.action.edit", AllIcons.Actions.Edit) {
project.jujutsuVcs.commandExecutor
.createCommand { edit(target) }
.onSuccess { project.refreshAfterVcsOperation(selectWorkingCopy = true) }
.onFailureTellUser("log.action.edit.error", project, log)
.executeAsync()
}nullAndDumbAwareAction/emptyAndDumbAwareAction(NullAndDumbAwareAction.kt) auto-disable on null/empty target and supply anActionContext<T>.- The command builder (
CommandExecutor.kt) —createCommand { },.onSuccess { }(EDT),.onFailureTellUser(prefix, project, log),.executeAsync()— handles all thread switching; never callexecuteOnPooledThreadmanually from an action. - Message keys follow
log.action.<name>[.tooltip],log.action.<name>.error.title/.message,dialog.<name>.input.message/.title(JujutsuBundle.properties). project.requestDescription(prefix, initial)(Inputs.kt) is the multiline input dialog helper, returningDescription?.project.refreshAfterVcsOperation(selectWorkingCopy = true|false)(ChangeActions.kt) invalidates state and marks VCS dirty after an operation.- One file per action in
vcs/actions/, lowercase filename,Actionsuffix (editChangeAction.kt).
8. Custom log architecture — the custom log fully replaces IntelliJ's built-in VCS
log, built from JBTable + AbstractTableModel + custom TableCellRenderers.
JujutsuCustomLogTabManager (@Service — tab lifecycle, singleton Content)
└── UnifiedJujutsuLogPanel (multi-root) or JujutsuLogPanel (single-root)
├── Toolbar (search, root, reference, author, date filters; column menu)
├── OnePixelSplitter
│ ├── JujutsuLogTable (JBTable + JujutsuLogTableModel)
│ └── JujutsuCommitDetailsPanel
└── JujutsuColumnManager (visibility + inlining state)
The two panels are parallel implementations (no shared inheritance); JujutsuLogPanel
adds a Paths filter, UnifiedJujutsuLogPanel adds a root filter and root gutter column,
which both auto-hide for single-root projects.
Data flow: jj log (CLI) → CliLogService (template + null-byte parse) → List<LogEntry>
→ DataLoader (background) → CommitGraphBuilder → LayoutCalculatorImpl → EDT:
tableModel.setEntries() + table.updateGraph(graphNodes). Graph layout is computed
alongside data load, not on demand — LayoutCalculatorImpl does a two-pass
foldIndexed (pass 1: lane + parent-child assignment; pass 2: build RowLayouts), and
lane assignment prefers staying in a child's lane for continuity.
Template parsing (CliLogService.kt) is a composable parser algebra: LogSpec<T> →
SingleField<T> (one null-byte field) or MultipleFields<T>/LogTemplate<T> (nested
specs). Templates compose by take()-ing a sub-template then extending it (e.g.
fullLogTemplate wraps basicLogTemplate). LogFields provides typed constructors
(stringField, booleanField, timestampField, SignatureFields).
Multi-repo: UnifiedJujutsuLogDataLoader loads all repos in parallel
(CountDownLatch + ConcurrentHashMap), merging by
flatten().sortedByDescending { authorTimestamp ?: committerTimestamp }. Selection
matching requires both repo and revision to avoid cross-repo collisions.
State/refresh (JujutsuStateModel.kt, Messaging.kt): JujutsuStateModel is the
project-level event hub for all VFS/VCS subscriptions, exposing
initializedRoots/repositoryStates (NotifiableState<T>, wraps MessageBus,
invalidate() runs on a pooled thread and publishes on EDT only if changed — never
auto-invalidates on construction), logRefresh (Notifier<Unit>, fed by exactly 3
non-overlapping sources), and changeSelection (fire-and-forget). File changes debounce
through a 300ms MutableSharedFlow. Bootstrap: JujutsuStartupActivity →
ToolWindowEnabler → JujutsuStateModel subscribes and fires initial
initializedRoots.invalidate(). suppressRefresh()/resumeRefresh() bracket batch
operations to avoid redundant refreshes. Both data loaders use a pending-selection
pattern (volatile pendingSelection/hasPendingSelection) to resolve the race between
VCS-operation completion and refresh data arrival.
Column inlining (JujutsuColumnManager.kt): hiding a column (Change ID, Description,
Decorations) moves its content into the graph column via computed flags like
val showChangeId: Boolean get() = !showChangeIdColumn && showChangeIdInGraph, read by
JujutsuGraphAndDescriptionRenderer.paintComponent().
See: ui/log/ package, jj/JujutsuStateModel.kt, jj/util/Messaging.kt,
jj/cli/CliLogService.kt
src/main/kotlin/in/kkkev/jjidea/
├── jj/ # Core JJ domain types
│ ├── ChangeId.kt # JJ change identifier
│ ├── FileChange.kt # File change DTO
│ ├── LogEntry.kt # Parsed log entry
│ ├── JujutsuCommandExecutor.kt
│ ├── LogService.kt
│ └── cli/
│ ├── CliExecutor.kt
│ ├── CliLogService.kt
│ └── AnnotationParser.kt
├── vcs/ # IntelliJ VCS integration
│ ├── JujutsuVcs.kt
│ ├── actions/ # VCS operation actions (see Key Design Decisions §6, §7)
│ ├── changes/
│ ├── diff/
│ └── history/
├── settings/ # Plugin settings
│ ├── JujutsuSettings.kt
│ ├── JujutsuSettingsState.kt
│ └── JujutsuConfigurable.kt
└── ui/ # User interface
├── JujutsuToolWindowPanel.kt
├── TextCanvas.kt
├── DateTimeFormatter.kt
├── Formatters.kt
└── log/ # Custom VCS log
├── JujutsuLogPanel.kt
├── JujutsuLogTable.kt
├── JujutsuCommitGraph.kt
└── JujutsuLogContextMenuActions.kt
| Command | Purpose | Implementation |
|---|---|---|
jj status |
List working copy changes | JujutsuChangeProvider |
jj describe -r @ -m "msg" |
Set working copy description | "Describe" button |
jj new [revision] |
Create new change | "New Change" button, context menu |
jj log -r @ --no-graph -T template |
Get log entries | CliLogService |
jj file show -r @ path |
Get file content at revision | JujutsuContentRevision |
jj file annotate -r @ -T template path |
Line-by-line attribution | JujutsuAnnotationProvider |
jj bookmark list |
List all bookmarks | Compare actions |
jj diff path |
Show diff for file | JujutsuDiffProvider |
jj --version |
Check availability | isAvailable() |
- Respect
.editorconfig: prefer code on one line where it fits. - Use expression bodies where possible (
fun foo() = bar, notfun foo() { return bar }). - Omit the return type when it's an unambiguous single-line expression
(
fun foo() = bar, notfun foo(): String = bar) — except when the expression is a platform call with ambiguous nullity, where the type should be explicit. - Avoid multiple return points: prefer chaining with
?.letover early returns (vcs?.let { executeOperation(it) }instead ofif (vcs == null) return; executeOperation(vcs)). equalsoverrides usewhenexpression style:override fun equals(other: Any?) = when { this === other -> true other !is MyClass -> false else -> field == other.field }
- Always import symbols rather than fully-qualifying them, and keep imports optimized.
Never fail silently — silent failures are hard to debug. Distinguish:
- System errors (bugs, invariant violations) — throw immediately, let them bubble
up. Use
!!when something must exist (registered action, required service), andcheck()/require()for invariants. E.g.ActionManager.getInstance().getAction("Jujutsu.Init")!!— null here is a bug. - User errors (misconfiguration, invalid input, missing prerequisites) — show a
helpful message and, ideally, a direct fix UX (e.g. VCS root configured but
.jjmissing → notification with "Initialize"/"Configure VCS" buttons viaJujutsuNotifications).
Anti-patterns: if (x != null) { ... } with no else when null means a bug; ?.let { }
that silently no-ops on an unexpected null; empty catch blocks; logging an error and
continuing as if nothing happened.
Prefer automated tests. The manual checklist (docs/manual-tests.md) is a fallback
for surfaces automation can't reach — not a substitute for tests that can be written.
Framework: JUnit 5 + Kotest assertions + MockK.
./gradlew test # Unit tests with IntelliJ Platform classes on classpathimport io.kotest.matchers.shouldBe
import org.junit.jupiter.api.Test
class ExampleTest {
@Test
fun `descriptive test name`() {
someFunction() shouldBe expected
}
}Covered today: core domain types, log parsing, formatters, tree models, annotation parsing.
- Automate: parser round-trips, data model invariants, template field changes,
argument-building functions — no UI dependency, cheap regression coverage. See
LogTemplateTest.kt,CliExecutorBookmarkTest.kt,JujutsuCompareWithPopupTest.kt,LogServiceIntegrationTest.ktfor patterns. - Manual (via
./gradlew runIde): anything affecting visible rendering — cell renderers, TextCanvas output, icon placement, tooltip text, context menus, dialog content, keyboard shortcuts. Automated tests can't catch these. - After every implementation, state the exact manual smoke steps for that specific
change so it can be verified without guessing — and update
docs/manual-tests.mdif it adds or changes a manual-testable surface. That checklist is the canonical pre-release regression list; it only stays useful if every PR that touches a manual surface updates it.
The checklist is a description of how the plugin should behave now, not a changelog. When a change touches a manual surface, edit the existing item or section in place:
- Group by feature, not by bead. Don't add a subsection named after the bead. Find the feature's subsection and extend it; a new subsection is only for a new feature.
- Fix an existing item before adding one. A bug fix usually changes an expectation in an existing item (add a clause, or tighten it). Add a new item only for a behaviour no item covers. Don't repeat a check that another section already makes — cross-reference it.
- State the expected behaviour only. No "previously…", "regression:", "no longer…", "as before" or a story of the bug. A bead id is fine as a trailing tag when it points to a design or repro; it is not a substitute for saying what should happen.
- No one-off checks. Migration steps ("a tab saved before this change…"), checks that the fix itself is wired, and "graduated from preview" availability checks can't be re-run after the release; leave them in the PR description.
- Delete what's automated. When a test now covers a manual item, remove the item (and any
→ automate:marker) in the same PR. - Keep the Release smoke list short.
docs/manual-tests.mdopens with a one-line-per-check smoke list run before every release. Add to it only for a surface a user would notice broken within a minute, and tag the line with the section holding the deep checks.
docs/manual-tests.md has grown too large to run end-to-end for every change (~1,400
checkboxes across 21 sections as of 2026-10; compression is tracked in jj-idea-pt25). Any change touching a manual-testable
surface must:
(a) identify which existing docs/manual-tests.md sections its blast radius reaches,
not just describe new steps for the change itself.
(b) report a Manual regression scope block listing the MT-* section IDs to
re-run, with a one-line reason each.
The procedure:
- List the files/components the change touches.
grep -n 'Code:' docs/manual-tests.mdfor each touched path, to find every section whoseCode:tag names it.- Check the doc's own Shared Surfaces table for
anything cross-cutting the change also hits, and each matched section's
Also re-run:line for coupled sections. - Take the union and report it. If nothing matches, say so explicitly — "no manual
surface affected." If a manual surface was touched but no section covers it, add one
(this is also when
docs/manual-tests.mdgets updated, per the bullet above). - Escalation: if more than ~6 sections match, the change hit a shared surface — say so and flag it as warranting a broader pass rather than silently listing 15 IDs.
Ask this question on any review touching a renderer, dialog, panel, or action wired into more than one entry point:
Does this component feed more than one manual-tests.md section? If so, are all of them in the reported scope, or does the mapping in
docs/manual-tests.mdneed updating?
Worked examples of the scoping procedure above:
- Log state changes: use
jj bookmark create/delete/set/trackin the sandbox repo, trigger a refresh (file save or toolbar button), verify the log updates (~300ms auto-refresh debounce) — this is MT-LOG-REFRESH, but the same op-heads watch feeds the reactive labels in MT-BOOKMARK, so a change to it needs both re-run. - Popup filter correctness:
RevisionSelectorPopup("Compare with Another Commit…") must only show bookmarks that are valid revision targets — verify unusual states (deleted, conflict) are filtered or displayed correctly.RevisionSelectorPopupis a Shared Surface (MT-CTXMENU, MT-DIFF) — see the table. - Tooltip content: hover icons/decorated names, confirm text matches
JujutsuBundle.propertieskeys.HtmlTextCanvastooltips render Swing HTML — check for tag mismatches when editing it.HtmlTextCanvasis also a Shared Surface (MT-LOG- DETAILS, MT-WORKINGCOPY, MT-BOOKMARK).
For the full cross-cutting component list (the renderer trio, the shared commit picker, the diff preview-tab helper, multi-repo scoping), see Shared Surfaces — that table is the one place this mapping is maintained; don't duplicate it here.
./gradlew build # Build plugin
./gradlew runIde # Run in IDE for testing
./gradlew buildPlugin # Package plugin (output: build/distributions/)
./gradlew check # Tests + lintingAdding a new JJ command: add a method to the CommandExecutor interface, implement
in CliExecutor, use from UI/VCS providers.
Adding UI features: update the relevant panel/component, add toolbar actions, wire
event handlers, verify with ./gradlew runIde.
Debugging: Logger.getInstance(MyClass::class.java) for debug logging,
./gradlew runIde --debug-jvm to attach a debugger. All jj invocations are logged by
CliExecutor.
Platform tests failing wholesale on missing actions: if many platformTests fail with
ActionManager.getAction("Jujutsu.…") returning null, missing keymap bindings, or null cannot be cast to non-null type …ActionGroup, the plugin wasn't loaded into the test
application at all. Check .intellijPlatform/sandbox/<product>/log-test/idea.log for a
dependent plugin 'Jujutsu VCS Integration' … excluded chain — it names the real missing
dependency (e.g. Groovy Scripting → a platform module IJPGP failed to resolve). The usual
cause is a truncated .intellijPlatform/layoutIndex/*.json: compare its entry count against
another workspace's index for the same cache key (filename), or just rm -rf .intellijPlatform/layoutIndex and re-run to force a fresh index of the shared IDE
distribution. Most likely trigger: two jj workspace lanes (see the jj-parallel-lanes skill)
running their first Gradle build at the same time against that shared distribution.
plugin.xml:
<extensions defaultExtensionNs="com.intellij">
<vcs name="Jujutsu" vcsClass="in.kkkev.jjidea.JujutsuVcs" />
<toolWindow id="Jujutsu" anchor="left" ... />
</extensions>Settings live under Version Control → Jujutsu: JJ executable path, auto-refresh, change ID format (short/long), log change limit. See Settings — three-tier model above for how these are stored and overridden.
Version-gated features (jj/JjFeature.kt, jj/JjVersion.MINIMUM) need a way to exercise
both sides of the gate — a jj new enough to support the feature, and one that isn't.
jj on PATH should stay whatever's newest (upgrade it normally, e.g. brew upgrade jj
on macOS); pin specific older/newer versions alongside it as separate, version-named
binaries rather than juggling one jj install:
# Fetches a prebuilt release binary for the current platform from
# https://github.com/jj-vcs/jj/releases and installs it as jj-<version> (plus a
# jj-<major.minor> alias) into ~/.local/bin by default.
scripts/jj-install-version.sh 0.39.0 # -> ~/.local/bin/jj-0.39.0, jj-0.39
scripts/jj-install-version.sh 0.37.0 # -> ~/.local/bin/jj-0.37.0, jj-0.37Put ~/.local/bin on PATH once and every pinned version and its alias become directly
runnable from anywhere (jj-0.39), without shadowing plain jj. Optionally symlink the
script itself onto PATH too (e.g. ln -s "$(pwd)/scripts/jj-install-version.sh" ~/.local/bin/jj-install-version) so it's callable without cd-ing into the repo first.
To exercise the plugin against a specific pinned version: Settings → Version Control →
Jujutsu → JJ executable path, point it at e.g. ~/.local/bin/jj-0.39, then Test.
Clear the field (or point it back at plain jj) to return to default resolution. See
MT-BOOKMARK's "Version gating" checklist in docs/manual-tests.md for the Advance-action
scenario this setup was built for.
Hot paths emit structured perf lines to idea.log via util/Perf.kt::measurePerf:
perf: ignore-scan took 41000ms [visited=1,843,201, ignored=12] (myrepo)
perf: log-load took 320ms [entries=5000] (myrepo:∞)
perf: graph-layout took 85ms [rows=5000]
INFO for normal operation; WARN when duration > 500ms or any count > 50,000
(PERF_DURATION_WARN_MS/PERF_COUNT_WARN in util/Perf.kt; runtime overrides planned
under jj-idea-edjs.7). A WARN line in a user-submitted log — especially a large visited
count — is a strong scale-regression signal (GitHub #35 hit 1.8M entries). Grep for
perf: in idea.log to find all instrumented operations.
The compile target (gradle.properties's platformVersion) is the newest supported IDE;
sinceBuild (build.gradle.kts's pluginConfiguration.ideaVersion) is the oldest. Compiling
against the newest platform surfaces that platform's deprecation warnings, but a deprecation's
documented replacement is sometimes @ApiStatus.Internal on older builds still within
sinceBuild — the replacement API simply wasn't made public yet on the floor. When that
happens, take the documented replacement anyway, unless it is @ApiStatus.Internal on a build still
within sinceBuild: JetBrains Marketplace rejects uploads with internal-API usages (0.8.11,
and 0.9.2 for a single ProgressManager.getInstanceOrNull()), so the release never goes live.
Prefer a public equivalent; if there isn't one and Marketplace is known to accept it (it
approved 0.9.1 with the ToolWindowFactory ones), add the exact verifier line to
config/plugin-verifier/internal-api-baseline.txt with a written reason.
The other risk an internal API carries is that its signature, not just its visibility, can
differ between IDE versions — surfacing as a NoSuchMethodError at runtime on a user's older
IDE rather than a build failure. pluginVerification in build.gradle.kts guards against
both: it pins every supported IDE from sinceBuild up (currently 2025.1–2026.2),
failureLevel covers COMPATIBILITY_PROBLEMS, MISSING_DEPENDENCIES, INVALID_PLUGIN,
OVERRIDE_ONLY_API_USAGES and NON_EXTENDABLE_API_USAGES, and the checkVerifierBaseline
task (a finalizer of verifyPlugin) fails on any internal-API usage that is not in the
baseline. Never suppress a COMPATIBILITY_PROBLEMS finding — a compatibility problem on any
pinned IDE means the code will not run there. Add each new minor platform release to the ides
list as it ships. CI runs this in the build job (.github/workflows/build.yml) on every non-release run.
verifyPlugin only checks the packaged plugin's bytecode, not whether sources compile against
the floor — a platform-API shape change (e.g. a Java interface becoming Kotlin) can break
compileKotlin/compileTestKotlin without tripping it. scripts/pre-push.sh runs both:
./gradlew check verifyPlugin -PverifierEdgesOnly (the verifier runs only on the oldest and
newest IDE; CI runs it on all of them), then main and test compilation against 2025.1 (into a
separate build-compat-*/ directory). It does not run tests on the older platforms; CI's
compat matrix does, and it is the only CI job that runs unit tests. Run it (jj verify, in the background) before every push to master.
The plugin must stay responsive at: ~1M working-tree files, ~500k ignored files (node_modules/build-output style trees), ~100k commits in the log, ~1k-change working sets, and multi-root projects (work multiplies per root).
- Nothing O(repo-size) on the refresh path — only O(working-set). Ignored-file
computation is decoupled from
JujutsuChangeProvider.getChangesinto the asyncVcsManagedFilesHolder(seeJujutsuIgnoredFilesService); refresh latency must stay independent of ignored-tree size. - Prune ignored directories before descending. At each
onEnter, report an ignored directory as a single entry and don't recurse — a child can't be re-included under an excluded parent (git semantics), so pruning eliminates O(ignored-tree) visits entirely. - Every file/commit loop must be cancellable. Call
progress.checkCanceled()per directory or batch — the missing check in GitHub #35 caused a 10s shutdown hang. - Never assume a colocated git repo. Most large repos aren't colocated, especially
in jj workspaces. Pruned + cancellable JVM tree traversal (as in
GitignoreCache.collectIgnored) is the standard path, not a fallback — don't write a git-delegating fast path with a broken slow path for the non-colocated case. - Listener callbacks must be O(1)/debounced.
BulkFileListener/ChangeListListenercallbacks must do constant work and post to a debounced background task — never fan out inline per event (repositoryStates.invalidate()uses a 300msMutableSharedFlowdebounce).
Any change adding a filesystem traversal or a per-file/per-commit loop must:
(a) state its complexity against the scale envelope above in the PR/implementation summary — e.g. "visits O(non-ignored entries), O(1) per VFS event."
(b) ship an operation-count test that injects a counting collaborator and asserts on work performed, not wall-clock time (CI-flaky). See "Writing a scale test" below for the pattern and exemplars.
Ask this question on any review touching file traversal, log parsing, change-provider logic, or VFS listener fan-out:
Does this change do work that grows with any scale dimension — total files in the working copy, ignored files, commits in the log, changes in the working set, or number of roots? If yes, what bounds it, and where is the scale test?
A perf: WARN line in a user-submitted idea.log (see Performance Logging above) is the
runtime signal that this has regressed — the visited count is the key indicator.
Operation-count tests are deterministic and PR-blocking (unlike wall-clock timing, which is CI-flaky and only ever advisory). The recipe, generalised from the ignore-scan fix (GitHub #35, jj-idea-2570.1):
- Inject a counting collaborator, or return a work-count value. Either give the hot
method a narrow interface seam for its expensive collaborator (e.g. a filesystem
walker) and feed it an in-memory fake that increments a counter per call, or — when
the algorithm is pure in-memory already — have it return/expose a
Longwork count (e.g. anoperationCountfield) alongside its normal result. - Assert on the count, never on elapsed time. A correct-but-quadratic regression
often produces identical output — only a work-count assertion catches it. Pick a
bound that a quadratic regression would clearly blow through at the chosen N (e.g.
< 5*Nwhen N²/2 would be orders of magnitude larger). - Use synthetic in-memory structures, no real repos, sized so the test runs in
<1s and lives in the default
testtask (notplatformTest/contractTest). - Add output-equivalence and cancellation tests where applicable — pin the fast
path's output against a brute-force baseline, and confirm a
checkCanceledcallback aborts promptly rather than exhausting the input.
Exemplars:
vcs/ignore/GitignoreScanTest.kt— injected fake (TrackingNode) + work-count return (ScanStats) + output-equivalence + cancellation; the canonical example.jj/RepoLogCacheScaleTest.kt— injected counting collaborator (a mockkLogService); asserts a bulk load issues one log call (not one per entry) and that incrementalstore()stays correctly ordered/deduplicated at scale.ui/log/graph/GraphLayoutScaleTest.kt— work-count return (LayoutCalculatorImpl .operationCount); asserts graph layout stays linear (not quadratic) for both a linear chain and a wide DAG with bounded passthrough width.
Two remotes: origin (primary, GitLab) and github (public). GitHub Actions
automatically creates tags and advances master on github in the background, so
always fetch from it before pushing.
Standard push sequence. The pre-push gate (scripts/pre-push.sh, ~10–15 min) runs
ahead of time and in the background so it doesn't hold up the push:
jj verify [REV]runs the gate on REV's content (default@, or@-if@is empty) in a separate lane-specific workspace (verify-<lane>, e.g.verify-lane2, in<checkout>-verify), created on first use, and raises a notification when it finishes. The workspace is forgotten and its scratch change abandoned after each run (the directory stays, for warm build caches), so no "verify scratch" changes accumulate. It records a pass/fail stamp keyed by the tree, so re-describing or rebasing without changing files keeps it valid. Use--waitto run in the foreground.jj shippushesmastertogithubandorigin, but only ifmaster's tree has a pass stamp, which makes it instant. Otherwise it refuses: runjj verify master, orjj ship --nowto run the gate synchronously first. Extra arguments (e.g.--dry-run) go tojj git push.- One-time setup per clone:
jj config set --repo aliases.ship '["util", "exec", "--", "scripts/ship.sh"]'andjj config set --repo aliases.verify '["util", "exec", "--", "scripts/verify.sh"]'.
Manual equivalent:
0. scripts/pre-push.sh — the gate itself.
bd export -o .beads/issues.jsonl— jj bypasses git hooks, so beads must be exported manually before pushing.jj git push --remote originjj git fetch --remote github— pick up automated updates.- If diverged:
jj new master@github master@origin -m "Merge github and origin master branches" jj bookmark set masterjj git push --remote origin && jj git push --remote github
Releases are cut via the GitHub Actions "Build and Release" workflow
(.github/workflows/build.yml), triggered manually:
gh workflow run "Build and Release" --repo kkkev/jj-idea -f bump=patchbump is patch/minor/major (empty = snapshot build, the default on every push).
The workflow bumps the version, moves [Unreleased] changelog content to the new
version section, creates the GitHub release, and publishes to the JetBrains Marketplace.
(The "Patch Release" workflow, .github/workflows/patch-release.yml, is a one-click
bump=patch wrapper.)
A release run does not repeat the checks that CI already ran when the commit was pushed
(compat matrix, Plugin Verifier, lint, changelog check). It instead requires that commit's
push-triggered run to have succeeded, waiting for it if it's still running, so let CI go
green on master before releasing. skip_ci_check overrides that. The release job itself
takes a few minutes; the separate marketplace-approval job then polls the Marketplace API
until the version is listed and approved (typically 10–40 min) and goes red if it never is —
a green build job does not mean the Marketplace accepted the upload.
Released sections are frozen. Once X.Y.Z is tagged, new entries go under
[Unreleased] only — never under the now-released ## [X.Y.Z] heading. check fails
(ChangelogReleaseDriftTest, jj-idea-j8s6) if the newest released section gains a bullet
that wasn't present at the tag, since that means it never actually shipped despite the
CHANGELOG saying so (the 2026-09-13 incident this guards against). A genuine correction to
an entry that did ship (e.g. a rewording) is allowed by adding, directly under that
version's heading:
<!-- changelog-guard: edited-after-release — <reason> -->
Preview features (preview/PreviewFeature.kt) are gated behind a JJP1-... access code a tester
enters in Settings. Nothing is in preview right now (the last gated feature, paged log loading,
graduated in jj-idea-2570.4), so the Settings group is hidden and the enum is empty; add an entry
to PreviewFeature to gate the next one, using a bit that has never been used (see the retired-bit
comments there). Gated work records its changelog entries in docs/preview-changelog.md (recreate
it, and re-add it to the changelog gate in .github/workflows/build.yml) until it graduates -
see docs/design/graduating-preview-features.md. Minting a code needs no build or release:
./gradlew previewCode --args="mint --features <featureId> --for someUser --ref 'GitHub #123'"
./gradlew previewCode --args="inspect JJP1-ABCD-EFGH-JKMN-PQRS"See PreviewCodeMinter's KDoc (src/test/kotlin/in/kkkev/jjidea/preview/) for the full command
set and docs/design/preview-gating-and-dnd-sequencing.md for the code format, key custody, and
revocation. Issued codes are tracked in a private registry outside this repo — ask kkkev.
When making changes that affect users (features, fixes, behavior changes):
- Add an entry to the
[Unreleased]section ofCHANGELOG.md, under Added, Fixed, Changed, or Removed. Keep it user-facing — no implementation detail. Never refer to beads; refer to Github issues if necessary. - CI fails if source code changes without a changelog update. For internal-only changes
(refactoring, tests, docs), add
[skip changelog]to the commit message.
- Verify quality:
scripts/pre-push.sh(./gradlew checkplusverifyPluginand the 2025.1/2025.2 compile legs). Fix failures before proceeding. - Update beads: close completed issues (
bd close <id1> <id2> ..., with a comment if non-trivial); file new issues (bug/task/feature) for anything left unresolved. - Manual verification: state the exact
./gradlew runIdesmoke steps for any UI-affecting change, and updatedocs/manual-tests.mdif it adds/changes a manual-testable surface. Report the Manual regression scope (theMT-*sections to re-run) per § Manual regression scope as a deliverable above. For parser/model-only changes, confirm automated tests cover it and say so explicitly. - Update
CHANGELOG.mdper Contributing Changes above. - Sync remotes and push per Git Workflow above.
- Release decision: ask whether to release. If yes, run the GitHub Actions
"Build and Release" workflow per Release Process above; if no, the code stays on
originonly.
Tasks (features, bugs, etc.) are managed in Beads. When asking a reporter for repo-size context, point them at docs/reporting-bugs.md.
bd list --status=open # All open issues
bd ready # Issues ready to work on
bd show <issue-id> # Detailed issue view
bd create # New issue
bd update <id> -p P0 # Update priority
bd close <id> # Complete an issuePriority levels (see ROADMAP.md for the 1.0 vision these support):
- P0: blocks 1.0 release (crashes, data loss, missing essential features, marketplace requirements)
- P1: important for 1.0 quality (performance, polish, testing, discoverability)
- P2: enhances experience, not blocking (nice-to-have, advanced UI)
- P3: minor (visual tweaks, edge cases)
- P4: future releases (advanced operations, major new features)
- A root is an IDEA VCS root — a folder in the project with its own VCS configuration (IDEA's VCS/Directory Mappings). A Jujutsu root points at the same directory as a Jujutsu repository.
- A repository is a Jujutsu repository — the top-level folder of a Jujutsu-controlled directory tree.
- A repository is initialised if it contains a
.jjdirectory.
Jujutsu: Official Tutorial · JJ Best Practices · Squash Workflow · Chris Krycho's JJ Init
IntelliJ Platform: Plugin SDK · VCS Integration · IntelliJ Platform Gradle Plugin 2.0
Other JJ IDE plugins: Selvejj (IntelliJ) · VisualJJ (VSCode) · Jujutsu Kaizen (jjk) (VSCode)