I use Nushell as my main shell. I love it for the UX, the UI, and the syntax. I do sometimes hate it for not being POSIX, but since that’s the whole point of the thing, I cannot really complain.

I also use JuJutsu as my main VCS. I love it for the UX, the UI, and the commands.

Say what you want, I’m a tech romantic.

So let me share a little bit of NuJutsu love with those two small Nu functions I use daily at work:

jj-desc

This one interactively asks me for the JIRA ticket number, and the title of issue. It builds a formatted description out of it.

 def jj-desc [] {
    let ticket = input "Ticket number: "
    let title = input "Title: "
    jj desc -m $"[($ticket)] ($title)"
  }

jj-bookmark-from-desc

This one creates a bookmark from the current JJ description — provided it uses the correct format specified above, so [PROJ-12345] Add feature A to project C will yield a bookmark like feature/proj-12345-add-feature-a-to-project-c.

def jj-bookmark-from-desc [] {
      let desc = (jj log -r @ --no-graph -T 'description.first_line()')
      let bookmark = ($desc
        | str downcase
        | str replace --all --regex '[^a-z0-9\s-]' ''
        | str replace --all --regex '\s+' '-'
        | str replace --all --regex '-+' '-'
        | str trim --right --char '-')
      jj bookmark create $"feature/($bookmark)"
    }

The icing on the cake: Neovim counterparts

I use [jj.nvim] to manage my JJ log in Neovim.

Here is part of my LazyVim plugin definition:

return {
  "nicolasgb/jj.nvim",
  branch = "main",
  lazy = false,
  config = function()
    require("jj").setup({})
    local cmd = require("jj.cmd")
    vim.keymap.set("n", "<leader>ji", function()
      if not utils.is_jj_repo() then
        vim.notify("Not in a jj repository", vim.log.levels.WARN)
        return
      end
      vim.ui.input({ prompt = "Jira ticket: " }, function(ticket)
        if not ticket then return end
        vim.ui.input({ prompt = "Title: " }, function(title)
          if not title then return end
          cmd.describe(string.format("[%s] %s", ticket, title))
        end)
      end)
    end, { desc = "JJ describe interactive" })
    vim.keymap.set("n", "<leader>jc", function()
      if not utils.is_jj_repo() then
        vim.notify("Not in a jj repository", vim.log.levels.WARN)
        return
      end
      vim.cmd("!nu -lc jj-bookmark-from-desc")
    end, { desc = "JJ bookmark from desc" })
  end,
}

The jj-desc command is rewritten in lua and gets a nice UX with two prompts popping up in your face when you launch it.

The jj-bookmark-from-desc command is just a plain keybinding.

In Emacs, I tend to open Vterm more often, so I just use my custom Nushell functions from there.