Clean up jj repository by removing empty commits and handling commits without descriptions
Cleans up jj repositories by removing empty commits and handling commits without descriptions.
/plugin marketplace add schpet/toolbox/plugin install chores@toolboxPerform repository maintenance tasks for jujutsu (jj) repositories.
First, find all empty mutable commits in the current branch and remove them:
Run this command to find empty mutable commits:
jj log --ignore-working-copy --no-graph -r 'mutable() & empty() & ancestors(@)' -T 'change_id ++ " " ++ description.first_line() ++ "\n"'
If any empty commits are found, abandon them using:
jj abandon 'mutable() & empty() & ancestors(@)'
Report to the user how many empty commits were removed.
Next, find mutable commits without descriptions:
Run this command to find commits with empty descriptions:
jj log --ignore-working-copy --no-graph -r 'mutable() & ancestors(@) & description("")' -T 'change_id.short() ++ " " ++ commit_id.short() ++ "\n"'
If any commits without descriptions are found, show them to the user with:
jj log --ignore-working-copy -r 'mutable() & ancestors(@) & description("")'
Use the AskUserQuestion tool to ask what to do with these commits. Present these options:
Option 1: Auto-describe - Run jj llm-describe on each commit to generate descriptions using an LLM
Option 2: Do nothing - Leave the commits as they are
Option 3: User explains - Let the user provide their own descriptions or instructions
Based on the user's choice:
jj llm-describe -r <change_id>mutable() revset ensures only non-immutable commits are affectedancestors(@) constraint limits changes to the current branch--ignore-working-copy for read operations to avoid unnecessary snapshots