Insert a new session change after a specific revision
Inserts a session change after a specific revision in the jj repository.
/plugin marketplace add schpet/jjagent/plugin install jjagent@jjagent<ref> [message]claude-haiku-4-5Insert a new session change after a specific revision using jj's --insert-after flag
You must follow these steps:
Parse arguments:
$1 (required): The jj reference to insert after$2 $3 $4... (optional): Custom commit message for the session (all remaining arguments)$1 is empty, inform the user that a reference is requiredGet the current session ID:
Check if a session change already exists:
jjagent change-id <session-id>Validate that ref is an ancestor of @ (working copy):
jj log -r "$1..@" --no-graph -T "change_id.short()"$1 is not an ancestor of @Handle existing session change:
jj rebase -r <change-id> --insert-after "$1"jj log -r <change-id> --no-graphCreate new session change (if no existing change):
$2 is not empty):
$2 onwards into the messagejjagent session-message <session-id> "$2 $3 $4..." (all remaining args)$2 is empty):
jjagent session-message <session-id>jj new --insert-after "$1" --no-edit -m "$(jjagent session-message <session-id> [message if provided])"jj log -r @ --no-graphInform the user:
# Insert session after the parent of working copy
/jjagent:insert-after @-
# Insert with custom message
/jjagent:insert-after @-- "Implement user authentication"
# Insert after a specific change ID
/jjagent:insert-after qwerty123
$1 (ref) must be an ancestor of @ (working copy)$1 to shell commandsjjagent session-message, combine all arguments from $2 onwards