Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Fish functions for jj workspace management (flakes-rhqy)

StatusDone · archived
TypeFeature
Prioritynormal

Convention-based jj workspace management via fish shell functions. All workspaces at ~/workspaces// with a registry file at ~/.config/workspaces.conf for mapping project names to main repo paths.

Functions

AbbrFull nameBehavior
wlworkspace-listList all workspaces across all projects with bookmark + dirty/conflict status
wworkspace-cdcd to a workspace + show brief status. Tab-completes /
wcworkspace-createFrom inside a repo, create ~/workspaces// via jj workspace add
workspace-delete(no abbr)Forget + remove a workspace

Design Details

Convention

  • All workspaces at ~/workspaces//
  • = basename of the main repo root
  • Default workspace = the main repo itself

Registry (~/.config/workspaces.conf)

  • Maps project name to main repo path (e.g. llm-triage=/home/yj/code/llm-triage)
  • Auto-populated by wc on first use
  • Needed to discover default workspace / run jj commands from the right root

workspace-list (wl)

  • Iterates all registered projects
  • For each: runs jj workspace list from main repo, then for each workspace shows:
    • Workspace name (default or feature name)
    • Path (main repo or ~/workspaces//)
    • Bookmark name (or ‘no bookmark’)
    • Change-id (short)
    • Status: clean / dirty / conflicts
  • Grouped by project

workspace-cd (w)

  • w / → cd to workspace path + print one-line status (bookmark, change-id, dirty/conflicts)
  • w /default → cd to main repo root
  • Tab completion for all / combos
  • w with no args → do nothing

workspace-create (wc)

  • Must be run from inside a jj repo
  • wc → jj workspace add ~/workspaces//
  • Auto-registers project in ~/.config/workspaces.conf if not present
  • cd to the new workspace after creation

workspace-delete

  • workspace-delete / → jj workspace forget (from main repo) + rm -rf the directory
  • No abbreviation (destructive operation)
  • Tab completion same as w

Tasks

  • Create workspace-list.fish function
  • Create workspace-cd.fish function with completions
  • Create workspace-create.fish function
  • Create workspace-delete.fish function
  • Add abbrs (wl, w, wc) to abbrs.nix
  • Wire functions into fish module via nix (autowired automatically)