Stack a commit with intelligent message generation
Intelligently stacks a commit with generated message or describes current commit. Use when you have changes ready to commit or want to create a new commit on top of the current one.
/plugin marketplace add edmundmiller/dotfiles/plugin install jj@dotfiles-pluginsmessageclaude-haiku-4-5!# Source utility scripts
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/../hooks/jj-state.sh" source "$SCRIPT_DIR/../hooks/jj-templates.sh" source "$SCRIPT_DIR/../hooks/jj-diff-context.sh"
!# Determine workflow state
has_description=$(get_commit_state)
is_empty=$(is_empty_commit)
!# Handle workflow logic
if [ "$is_empty" = "empty" ] && [ "$has_description" = "none" ]; then
echo "âšī¸ Current commit is empty with no description" echo "" echo "Current: $(format_commit_short) (empty)" echo "" echo "đĄ Tip: Make some changes first, then use `/jj:commit` to describe and stack" exit 0 fi
!# Track any untracked files before committing
jj file track . 2>/dev/null || true
!# Determine action based on user argument
if [ -n "$ARGUMENTS" ]; then
if [ "$has_description" = "has" ]; then # Current commit already described, create new on top echo "đĻ Creating new commit: $ARGUMENTS" echo "" jj new -m "$ARGUMENTS" 2>/dev/null || true echo "â New commit created, ready for changes" else # Describe current commit using jj commit (describes @ and creates new working copy) echo "đ Committing changes: $ARGUMENTS" echo "" jj commit -m "$ARGUMENTS" 2>/dev/null || { # Fallback to describe if no changes jj describe -m "$ARGUMENTS" echo "đĄ Tip: No changes to commit, description updated" } echo "â Committed and created new working copy" fi exit 0 fi
jj statusget_diff_statsCreate commit for changes above. New files already tracked.
Workflow:
jj commit -m "message"jj new -m "message"jj commit -m "message"Use conventional commit (feat/fix/refactor/docs/test/chore), under 72 chars, -m flag.
Note: jj commit describes @ and creates new working copy in one command.
Result: !format_commit_short