repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
jj.zshShell82 lines4.4 KiBraw download
#!/usr/bin/env zsh
# ── jj.zsh : jujutsu (jj) VCS ────────────────────────────────────────────────
# User config lives in ~/.config/jj/config.toml (`jj config edit --user`).
# Completions ship with the brew formula in /opt/homebrew/share/zsh/site-functions.

command -v jj >/dev/null 2>&1 || return

# ── core verbs ───────────────────────────────────────────────────────────────
alias j='jj'
alias js='jj status'
alias jl='jj log'
alias jll='jj log -T builtin_log_detailed'
alias jd='jj diff'
alias jsh='jj show'
alias jn='jj new'              # start a fresh change on top of @
alias je='jj edit'             # move the working copy onto an existing change
alias jdm='jj describe -m'     # set the description of @
alias jsq='jj squash'          # fold @ into its parent
alias jsp='jj split'
alias jr='jj rebase'
alias jab='jj abandon'

# ── bookmarks (jj's branches) ────────────────────────────────────────────────
alias jb='jj bookmark list'
alias jbc='jj bookmark create'
alias jbm='jj bookmark move'
alias jtug='jj tug'            # drag nearest bookmark up to @-

# ── git remotes ──────────────────────────────────────────────────────────────
alias jf='jj git fetch --all-remotes'
alias jpush='jj git push'
alias jpushc='jj git push --change @'   # auto-name a bookmark for this change

# Commit with an ISO date + hostname in the description. With --push, the
# completed change is @- because `jj commit` creates a fresh working-copy child.
alias jcm='jj-commit'
alias jcmp='jj-commit --push'

# Let the message write itself: jj-msg (~/.local/bin) reads the diff of @, gets
# a conventional-commit subject + bullets from `claude -p`, strips any
# attribution so the commit is signed as you, and commits through jj-commit so
# the Commit-Date/Commit-Host trailers come from one place. -t "subject" keeps
# your own first line; --no-ai (or VCS_MSG_AI=0) summarises the file list
# instead. The message is the only thing on stdout:  jj commit -m "$(jm)"
alias jm='jj-msg'               # just print it
alias jmd='jj-msg describe'     # describe @ with it
alias jme='jj-msg edit'         # describe, then polish it in $EDITOR
alias jmc='jj-msg commit'       # seal @ with it
alias jmcp='jj-msg commit --push'

# ── operation log : jj's undo history for the whole repo ─────────────────────
alias jop='jj op log'
alias jundo='jj undo'
alias jrestore='jj op restore'  # jump the whole repo back to an operation id

# ── repo bootstrap ───────────────────────────────────────────────────────────
# Colocated = .jj and .git side by side, so git commands keep working.
jjinit()  { jj git init --colocate "${1:-.}"; }
jjclone() { jj git clone --colocate "$@"; }

# ── cheatsheet ───────────────────────────────────────────────────────────────
jjhelp() {
  print -P "%F{#c4a7e7}  jj quick reference%f"
  print -P "%F{#908caa}  no staging area — the working copy IS a commit (@)%f"
  cat <<'HELP'

    jj st / js            what changed in @
    jj new / jn           begin a new change on top
    jj describe -m "x"    (re)write @'s message — no --amend needed
    jj-commit "x" / jcm   commit with Commit-Date + Commit-Host trailers
    jcmp "x"              commit, then push the completed change (@-)
    jm / jmd / jme / jmc  the message, written from the diff: print / describe / edit / commit
    jj squash / jsq       fold @ into its parent
    jj edit <rev> / je    make any change the working copy
    jj bookmark move ...  bookmarks replace branches; nothing is checked out
    jj git push --change @  push @ under an auto-named bookmark
    jj op log / jop       every repo mutation, undoable
    jj undo / jundo       revert the last operation (yes, even a rebase)

    revsets: @ = working copy, @- = parent, mine, wip, stack, trunk()
HELP
}