vcs-detect

Detect whether jj or git is the active VCS for the current project.

Updated Jan 18, 2026
One-click install
npx skills add https://github.com/deloreyj/.dotfiles --skill vcs-detect-deloreyj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vcs-detect
Source: https://github.com/deloreyj/.dotfiles/tree/main/home/.config/opencode/skill/vcs-detect
Command: npx skills add https://github.com/deloreyj/.dotfiles --skill vcs-detect-deloreyj

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Detect the active version control system (jj or git) for the current project before running any VCS command to ensure the correct CLI is used.

Core Features & Use Cases

  • Detects whether jj or git is present as the repo root tools, including handling colocated setups with both .jj/ and .git/ directories.
  • Uses a priority detection: first try 'jj root', then 'git rev-parse --show-toplevel', else report 'none' to indicate no VCS.
  • Provides a mapping guide so commands are run with the correct CLI depending on the detected VCS.
  • Works in colocated repos to prefer jj commands while keeping git available for compatibility.

Quick Start

Run the detection command to identify the VCS (jj or git) and then use the corresponding CLI.

Frequently Asked Questions about vcs-detect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect whether a project uses jj or git before running version control commands?

You can detect the active VCS by running 'jj root' first and then 'git rev-parse --show-toplevel'. The tool prioritizes jj in colocated setups and maps operations to the correct CLI based on detection results.

What happens when both .jj and .git directories exist in a colocated repository?

In colocated repositories with both .jj/ and .git/ directories, the detection tool prefers jj commands while keeping git available for compatibility. It tries 'jj root' first before falling back to git rev-parse.

How does VCS detection work when no version control system is initialized?

When neither jj nor git is detected, the tool reports 'none' to indicate no VCS is present. It relies on the failure of both 'jj root' and 'git rev-parse --show-toplevel' to determine the repository has no active VCS.

Can I use this tool to map commands to the correct CLI in a jj and git workflow?

Yes, the tool provides a mapping guide so commands are run with the correct CLI depending on the detected VCS. It ensures the right version control operations execute based on whether jj or git is identified.

What is the best way to handle version control command mapping for jj and git?

The best way is to use a detection tool that identifies the active VCS before executing any commands. This tool checks 'jj root' and 'git rev-parse --show-toplevel' to map operations to the appropriate CLI automatically.

Why does my VCS command fail when switching between jj and git repositories?

VCS commands fail when the wrong CLI is used for the active version control system. The detection tool solves this by identifying whether jj or git is present at the repo root before executing any commands.