Skip to content

feat(jj): add Jujutsu VCS widgets#205

Open
seanb4t wants to merge 7 commits intosirmalloc:mainfrom
seanb4t:feat/jj-widgets
Open

feat(jj): add Jujutsu VCS widgets#205
seanb4t wants to merge 7 commits intosirmalloc:mainfrom
seanb4t:feat/jj-widgets

Conversation

@seanb4t
Copy link

@seanb4t seanb4t commented Mar 7, 2026

Summary

  • Adds 8 new jj (Jujutsu VCS) widgets: JjBookmark, JjChange, JjChanges, JjInsertions, JjDeletions, JjRootDir, JjDescription, JjWorkspace
  • Adds jj utility functions (runJj, isInsideJjWorkspace, resolveJjCwd, getJjChangeCounts, getJjCurrentWorkspace) mirroring the existing git utility pattern
  • Adds shared hide-no-jj toggle behavior (mirrors hide-no-git)
  • Registers all widgets in the manifest and widget index
  • Comprehensive test coverage: unit tests per widget + shared behavior tests across all 8 widgets

Design

Follows the existing git widget architecture:

  • Each widget implements the Widget interface
  • Shared VCS-absent toggle via jj-no-jj.ts (mirrors git-no-git.ts)
  • runJj utility with allowEmpty parameter to distinguish empty output from command failure
  • Widgets categorized under "Jujutsu" in the TUI

Test plan

  • bun run lint — passes (pre-existing dist/ tsc errors only)
  • bun test — all jj tests pass (107 tests), zero new failures
  • Verified runJj allowEmpty behavior (empty string vs null)
  • Verified JjRootDir single subprocess per render
  • Verified JjDescription respects hideNoJj on command failure

🤖 Generated with Claude Code

seanb4t and others added 7 commits March 7, 2026 15:04
Add jj VCS utility module mirroring the existing git utilities with
workspace detection, command execution, and diff stat parsing. Add
shared jj-no-jj toggle for hiding 'no jj' messages in jj widgets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add two new Jujutsu VCS widgets mirroring the GitBranch pattern:
- JjChange: displays current jj change ID with `jj:` prefix
- JjBookmark: displays current jj bookmark name(s) with `@` prefix,
  showing `(none)` when no bookmarks are set
- Add `runJjRaw` utility to distinguish empty output from errors

Both widgets support raw value mode, hide-no-jj configuration,
and include full test coverage (17 tests).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Description widgets

Add five new Jujutsu VCS widgets with full test coverage:
- JjChanges: combined insertions/deletions count (+ins,-del)
- JjInsertions: insertion count from jj diff --stat
- JjDeletions: deletion count from jj diff --stat
- JjRootDir: workspace root directory name extraction
- JjDescription: current change description via jj log

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add getJjCurrentWorkspace() utility that parses `jj workspace list` output
to extract the current workspace name from the first line. Implement
JjWorkspaceWidget with blue color, W: prefix, raw value support, and
hide-no-jj toggle. Include tests for both the utility function and widget.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… tests

Add all 8 jj widgets (JjChange, JjBookmark, JjChanges, JjInsertions,
JjDeletions, JjRootDir, JjDescription, JjWorkspace) to the widget
exports and manifest registry. Add shared behavior test suite validating
hide-no-jj keybind, metadata toggling, editor display, and Jujutsu
category across all jj widgets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Jj invariant

- Merge runJjRaw into runJj with allowEmpty parameter to eliminate
  duplication while preserving semantic distinction between empty
  output and command failure
- Fix JjRootDir calling jj workspace root twice per render by
  removing redundant isInsideJjWorkspace guard
- Extract getRootDirName to module-level function (matches project
  convention of no private helper methods)
- Fix JjDescription ignoring hideNoJj flag when command fails after
  workspace check passes
- Fix JjDescription preview string inconsistency ('(no description
  set)' vs '(no description)')
- Add tests for allowEmpty behavior and JjDescription hideNoJj
  command failure case

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…aces

Add a new per-widget toggle that hides git widgets when a jj workspace
is detected, enabling clean colocated repo support. Users can press 'j'
in the TUI items editor to enable this on any git widget.

- Add git-hide-when-jj.ts shared module with metadata flag, keybind,
  and editor display helpers
- Update all 6 git widgets (Branch, Changes, Insertions, Deletions,
  RootDir, Worktree) with the new toggle
- Compose modifier text from both hideNoGit and hideWhenJj flags
- Chain action handlers via nullish coalescing
- Add shared behavior tests for toggle, keybind, and modifier display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant