vcs-detect

📁 ajoslin/dot 📅 5 days ago
2
总安装量
2
周安装量
#64123
全站排名
安装命令
npx skills add https://github.com/ajoslin/dot --skill vcs-detect

Agent 安装分布

opencode 2
claude-code 2
github-copilot 2
codex 2
kimi-cli 2
gemini-cli 2

Skill 文档

VCS Detection Skill

Detect the version control system in use before running VCS commands.

Why This Matters

  • jj and git have different CLIs and workflows.
  • Running git commands in a jj repo (or vice versa) causes avoidable errors.
  • Some repos are colocated (both .jj/ and .git/ exist).

Detection Logic

Priority order:

  1. jj root succeeds -> jj
  2. else git rev-parse --show-toplevel succeeds -> git
  3. else -> none

Detection Command

if jj root &>/dev/null; then echo "jj"
elif git rev-parse --show-toplevel &>/dev/null; then echo "git"
else echo "none"
fi

Common Command Mapping

Operation git jj
Status git status jj status
Log git log jj log
Diff git diff jj diff
Commit git commit jj commit / jj describe
Branch list git branch jj branch list
New branch git checkout -b <name> jj branch create <name>
Push git push jj git push
Fetch/Pull git fetch / git pull jj git fetch
Rebase git rebase jj rebase

Usage

Before VCS operations:

  1. Run the detection command.
  2. Use the matching CLI (jj or git).
  3. If none, report that the directory is not version controlled.

Colocated Repos

If both .jj/ and .git/ exist, prefer jj commands and use git compatibility subcommands when needed.