SuperAPI AI Directory

jj-init

Coding & development

View repository

Updated 10-16 05:01

About this skill

JJ Init

Two modes:

  1. Auto mode — .git/ exists, .jj/ does not → colocate-init the repo, then run config audit.
  2. Manual mode — user invokes /jj-init in 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 jj for 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:

  1. Identity (user.name, user.email)
  2. Signing (signing.backend, signing.behavior, signing.key, git.sign-on-push)
  3. Tools (ui.editor, ui.diff-editor, merge-tools.*)
  4. Workflow/UI (ui.default-command, ui.color, ui.graph.style, ui.log-word-wrap, ui.movement.edit)
  5. 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.md when you need concrete wording.

Scope rules

  • Default to --user for identity, signing, editor, and UI preferences.
  • Use --repo for repo-specific workflow choices.
  • If the user does not specify scope, state which scope you will use before writing.

Writing config safely

  • jj config set expects TOML values. Quote strings with spaces or special characters.
  • In sandboxed environments, if jj config set fails 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