Two modes:
- Auto mode —
.git/exists,.jj/does not → colocate-init the repo, then run config audit. - Manual mode — user invokes
/jj-initin a repo that already has.jj/→ skip init, go straight to config audit and dialog.
Auto mode: initialize
Prerequisite
command -v jj
If jj is not on PATH, stop. Do not proceed.
Detect and init
test -d .git && ! test -d .jj
If the condition is true, run:
jj git init --colocate
This creates .jj/ alongside the existing .git/. All git history is preserved.
After init succeeds, confirm to the user:
This git repo has been initialized as a colocated Jujutsu repo. You can now use
jjfor all version control operations.
Then proceed to the config audit below.
If jj git init --colocate fails, show the error and stop. Do not retry automatically.
Manual mode: reconfigure
When the user calls /jj-init and .jj/ already exists, skip the init step and go directly to
the config audit.
Config audit
Run the audit script:
python3 scripts/audit_jj_config.py
Show the output to the user, then summarize the important gaps in a few bullets.
Config dialog
Walk the user through configuration one category at a time:
- Identity (
user.name,user.email) - Signing (
signing.backend,signing.behavior,signing.key,git.sign-on-push) - Tools (
ui.editor,ui.diff-editor,merge-tools.*) - Workflow/UI (
ui.default-command,ui.color,ui.graph.style,ui.log-word-wrap,ui.movement.edit) - Advanced (
aliases.*,revset-aliases."immutable_heads()",templates.log)
Dialog rules
- Ask one question at a time. Wait for the user's answer before continuing.
- When a category is already configured, say so briefly and move on.
- If the user says "skip", "next", or "done", honor it immediately.
- Before executing any
jj config set, show the exact command first. - After each change, verify with
jj config list <key>. - Use the question prompts in
references/checklist.mdwhen you need concrete wording.
Scope rules
- Default to
--userfor identity, signing, editor, and UI preferences. - Use
--repofor repo-specific workflow choices. - If the user does not specify scope, state which scope you will use before writing.
Writing config safely
jj config setexpects TOML values. Quote strings with spaces or special characters.- In sandboxed environments, if
jj config setfails due to permissions, retry with escalated permissions. If that also fails, show the command and ask the user for help.
End of flow
When all categories are reviewed or the user says done, present a brief summary:
- What was initialized (if auto mode)
- Which config keys were set or changed
- Any remaining gaps the user chose to skip
Resources
- Audit script:
scripts/audit_jj_config.py - Dialog checklist and question prompts:
references/checklist.md