jujutsu-workflow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJujutsu Workflow
Jujutsu 工作流
Prefer (Jujutsu) over raw whenever a repo is present. Git stays the canonical remote/PR/CI/audit interface: mutate with , verify with read-only Git.
jjgit.jj/jj**只要仓库中存在 ,就优先使用 (Jujutsu),而非直接执行 。Git 仍作为规范的远程仓库/PR/CI/审计接口:使用 修改状态,使用只读 Git 进行验证。
.jj/jjgitjj1. Detect & gate first
1. 首先检测并执行门禁
Run , or check manually:
${CLAUDE_SKILL_DIR}/scripts/detect_jj_state.sh- present → jj repo: use
.jj/, never mutating rawjj.git - and
.jj/→ colocated: mutate with.git/, read with git, never touch the git index/staging.jj - only → plain Git repo: do not introduce
.git/unless asked.jj - in a git worktree, ≠
jj root→ shadowed (exit 3): jj answers for the parent repo. Run nogit rev-parse --show-toplevel; use git, then ask.jj
See references/git-interop.md.
运行 ,或手动检查:
${CLAUDE_SKILL_DIR}/scripts/detect_jj_state.sh- 存在 → jj 仓库:使用
.jj/,绝不执行会修改状态的原生jj。git - 且
.jj/存在 → 共置仓库:使用.git/修改,使用 git 读取,绝不触碰 git index/staging。jj - 只有 → 普通 Git 仓库:除非用户要求,否则不要引入
.git/。jj - 在 git worktree 中,≠
jj root→ 被遮蔽(退出码 3):jj 返回的是父仓库的结果。不运行任何git rev-parse --show-toplevel;使用 git,然后询问。jj
参见 references/git-interop.md。
2. Agent-safety rules (non-negotiable)
2. Agent 安全规则(不可协商)
- Always on commands that print. Do not write
--no-pagerinto the user's config —ui.paginateoutlives the session and takes paging away from their interactive--usertoo.jj - Always . Never run editor/TUI forms — bare
-m,jj describe|commit|squash(interactive),jj split,jj squash -i,jj resolve— they hang agents.jj diffedit - snapshots the working copy only when a jj command runs, not on every file write.
jj
See references/agent-safety.md.
- 对会输出内容的命令,始终使用 。不要将
--no-pager写入用户配置——ui.paginate的设置会持续到会话结束之后,并且会让用户交互式使用--user时也失去分页。jj - 始终使用 。绝不运行需要编辑器或 TUI 的形式——不帶参数的
-m、交互式jj describe|commit|squash、jj split、jj squash -i、jj resolve——这些命令会让 Agent 卡住。jj diffedit - 仅在运行 jj 命令时对 working copy 创建快照,而不是在每次文件写入时创建。
jj
参见 references/agent-safety.md。
3. Edit loop
3. 编辑循环
bash
jj --no-pager statusbash
jj --no-pager statusedit files (snapshotted on the next jj command)
edit files (snapshotted on the next jj command)
jj --no-pager diff
jj describe -m "<project-conventional message>"
jj new -m "<next unit>" # one change per logical unit
Split non-interactively: `jj split <path> -m "<msg>"`. See [references/command-map.md](references/command-map.md).jj --no-pager diff
jj describe -m "<project-conventional message>"
jj new -m "<next unit>" # one change per logical unit
以非交互方式拆分:`jj split <path> -m "<msg>"`。参见 [references/command-map.md](references/command-map.md)。4. Recover (reversible)
4. 恢复(可逆)
jj --no-pager op logjj undojj op restore <id>jj statusjj --no-pager op logjj undojj op restore <id>jj status5. Hand off via Git
5. 通过 Git 移交
bash
jj git fetch
jj rebase -d <default-branch>
jj bookmark create <branch> -r @- # every pushed commit needs a description
jj git push --bookmark <branch> # new bookmarks push directlyNever push to a protected/default branch; never rewrite public history unless allowed. Open the PR with /. See references/pr-handoff.md.
ghglabbash
jj git fetch
jj rebase -d <default-branch>
jj bookmark create <branch> -r @- # every pushed commit needs a description
jj git push --bookmark <branch> # new bookmarks push directly绝不推送到受保护的分支或默认分支;除非获得允许,否则绝不重写公开历史。使用 / 创建 PR。参见 references/pr-handoff.md。
ghglab6. Parallel agents
6. 并行 Agent
One per concurrent agent — never share a working copy. See references/parallel-agents.md.
jj workspace每个并发 Agent 使用一个 ——绝不共享 working copy。参见 references/parallel-agents.md。
jj workspace7. Verify before "done"
7. 声称“完成”前进行验证
Run , or report , , , . Never claim "done/tested/ready" without that output; disclose force-pushes, recoveries, conflicts.
${CLAUDE_SKILL_DIR}/scripts/verify_handoff.shjj --no-pager statusjj --no-pager log --limit 10jj --no-pager diff --statgit status --short --branchWhen jj helps, and when it doesn't: references/why-jj-for-agents.md.
运行 ,或者报告 、、、 的输出。在未输出上述结果前,绝不要声称“已完成/已测试/已就绪”;应披露 force-push、恢复操作和冲突。
${CLAUDE_SKILL_DIR}/scripts/verify_handoff.shjj --no-pager statusjj --no-pager log --limit 10jj --no-pager diff --statgit status --short --branch何时 jj 有帮助,何时无帮助:references/why-jj-for-agents.md。