From 9e1f8fd9137873ba69a31f4ee1bfa1cc809601fe Mon Sep 17 00:00:00 2001 From: clover caruso Date: Mon, 18 May 2026 12:20:22 -0700 Subject: [PATCH] clover: more stuff --- users/clover/AGENTS.md | 2 +- users/clover/home.nix | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/users/clover/AGENTS.md b/users/clover/AGENTS.md index bde349a50e0f995db9f87a6231fb78e8bbe5a6ec..de6704406e2e6aaa547dce5ab17be8e50fd359a2 100644 --- a/users/clover/AGENTS.md +++ b/users/clover/AGENTS.md @@ -19,7 +19,7 @@ You are working with Clover, an intelligent web/systems engineer. Please avoid e ## Comments -Comments must always be placed and edited with intent to serialize codebase theory for future versions of ourselves and coworkers. They are professionally written, containing relevant context to the current iteration. Clover's comments are always timeless and rarely written from the first person (no `I`, `we`) -- refer directly to the code. Rewording comments this way helps solidify your own understanding, and can even reveal logic bugs in the designed systems. Prefer documentation comments over line comments. +Comments must always be placed and edited with intent to serialize codebase theory for future versions of ourselves and coworkers. They are professionally written, containing relevant context to the current iteration. Clover's comments are always timeless and rarely written from the first person (no `I`, `we`) -- refer directly to the code. Rewording comments this way helps solidify your own understanding, and can even reveal logic bugs in the designed systems. Prefer documentation comments on declarations over inline comments. ## Code Quality diff --git a/users/clover/home.nix b/users/clover/home.nix index 23e38b3503e15fa36676fa9e02ea1437eef2ae6e..727e7ec822eb862ba5e98b0f03104000fe3d9c14 100644 --- a/users/clover/home.nix +++ b/users/clover/home.nix @@ -76,6 +76,8 @@ in bup = "jj b m --from 'heads(::@- & bookmarks()) ~ (master | bookmarks(glob:\"deployment*\"))' --to '@'"; moveself = "jj rebase -s @ -d"; logall = "jj log -r 'all()'"; + unmerged = "jj log -r 'unmerged()'"; + um = "jj log -r 'unmerged()'"; cherry = "jj git fetch && jj split -i -p -m 'SPLIT_CHANGES' && jj edit -r 'description(\"SPLIT_CHANGES\")' && jj desc -m '' --edit"; }; initContent = '' @@ -146,13 +148,26 @@ in } function jj() { - if [[ "$*" = "git push"* ]] && [[ "$*" != *"--dry-run"* ]]; then + if [[ "$1" = "new" && "$#" -eq 2 && "$2" != *@* && "$2" != -* ]]; then + local stderr status + stderr="$(mktemp)" + command jj "$@" 2>"$stderr" + status=$? + if [[ $status -ne 0 ]] && command grep -Fq "Revision \`$2\` doesn't exist" "$stderr" && command grep -Fq "\`$2@origin\`" "$stderr"; then + rm -f "$stderr" + command jj new "$2@origin" + return $? + fi + command cat "$stderr" >&2 + rm -f "$stderr" + return $status + elif [[ "$*" = "git push"* ]] && [[ "$*" != *"--dry-run"* ]]; then if command jj "$@" --dry-run; then printf "Press any key to continue... " read -r command jj "$@" fi - else if [[ "$*" != "undo" ]] || [[ "$*" != "redo" ]] + elif [[ "$*" != "undo" && "$*" != "redo" ]]; then # auto-install deps when switching commits wrapWithAutoInstall jj "$@" fi @@ -254,6 +269,28 @@ in revsets = { short-prefixes = "(trunk()..@)::"; }; + "template-aliases" = { + "format_log_author(commit)" = '' + if(commit.mine(), "You", commit.author().name().match("[^ ]+")) + ''; + "format_log_timestamp(timestamp)" = '' + if(timestamp.after("1 day ago"), timestamp.ago(), timestamp.local().format("%Y-%m-%d")) + ''; + "format_short_commit_header(commit)" = '' + separate(" ", + format_short_change_id_with_change_offset(commit), + label("author", format_log_author(commit)), + label("timestamp", format_log_timestamp(commit_timestamp(commit))), + commit.bookmarks(), + commit.tags(), + commit.working_copies(), + format_commit_labels(commit), + if(config("ui.show-cryptographic-signatures").as_boolean(), + format_short_cryptographic_signature(commit.signature()) + ), + ) + ''; + }; aliases = { "ab" = [ "abandon" ]; "ci" = [ -- 2.54.0