@aqian0/dsh-jj
为DSH提供Jujutsu版本控制支持 适合在Jujutsu (jj) 工作区中进行版本控制和提交管理。
安裝
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:AQian0/dsh-jj說明文件
閱讀完整 README ↗使用
安装后自动生效,无需手工写 profile。典型的 agent 用法:
| 你说 | 模型调用 |
|---|---|
| "看下当前 jj 状态" | jj_status |
| "列出最近 10 个提交" | jj_log |
| "把当前改动并进上一个提交" | jj_squash |
| "改一下当前 change 的描述" | jj_describe |
| "撤销刚才那次 jj 操作" | jj_undo |
| "新建一个 workspace 放到 /tmp/wt" | jj_workspace_add |
在 jj 仓库里直接让 agent 跑 git commit 之类的命令时,默认会在工具结果里追加「优先用 jj」的提示;
把 guardMutatingGit 设为 deny 后会直接拒绝并给出等价命令:
Blocked: `git commit` in a Jujutsu (jj) workspace (jj-colocated: /path/to/repo).
Use the jj equivalent instead:
jj commit -m "…" (or: jj describe -m "…" then jj new)
工具一览
| 工具 | 作用 |
|---|---|
jj_status | 工作副本 @ 的状态 |
jj_log | 按 revset 查看提交(@、@-、bookmarks() 等) |
jj_diff | 指定 revset 的 diff |
jj_new | 新建 change 并设为 @ |
jj_describe | 就地修改提交描述(代替 git commit --amend) |
jj_squash | 把改动并进另一个提交 |
jj_undo | 撤销/恢复到某个 operation |
jj_op_log | operation 历史,用于找 jj_undo 的目标 |
jj_workspace_add / jj_workspace_list | 新建/列出 jj workspace |
jj_bookmark_list / jj_bookmark_set | 列出/设置 bookmark |
jj_rebase | rebase 提交及其后代 |
非 jj 仓库会直接拒绝工具调用并说明如何初始化 jj;不会回退到 git。
配置
所有配置键可选,写在 profile 中对应 bundle 行的 config 里:
| 键 | 默认 | 说明 |
|---|---|---|
jjCommand / gitCommand | jj / git | 可执行文件名;gitCommand 只用于探测和提示 |
timeoutMs / graceMs | 30000 / 3000 | 子进程超时,以及超时后强制结束前的宽限时间 |
maxOutputBytes | 262144 | 单个输出流(stdout / stderr)的上限 |
detectCacheTtlMs | 10000 | 仓库检测结果的缓存时长 |
guardMutatingGit | warn | jj 仓库内 mutating git 的处置:warn(放行+提示)/ deny(拒绝)/ off |
guardGitInJjNative | warn | 仅 jj-native 仓库内 git 的处置 |
guardJjRepositoryWide | warn | jj undo / jj op restore 等仓库级 jj 操作的处置 |
guardTools | bash / pwsh / terminal_send | 参与上述守卫判定的 shell 工具名 |
guardCreateWorktree | true | 在 jj 仓库里拒绝 create_worktree,引导用 jj workspace add |
readOnlyGitNotice | true | colocated 仓库内只读 git 命令是否附「优先用 jj」提示 |
preferJjContext | true | 会话开始时注入「优先用 jj」的模型可见上下文 |
defaultLogLimit / maxLogLimit | 30 / 200 | jj_log 的默认与最大返回条数 |
defaultCwd | '' | 工具没有 workdir 时的回退目录(空 = 进程 cwd) |