vcs-detect

Detect the active version control system (jj or git) for the current project.

4|Updated May 21, 2020
One-click install
npx skills add https://github.com/eratio08/dotfiles --skill vcs-detect-eratio08
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vcs-detect
Source: https://github.com/eratio08/dotfiles/tree/main/opencode/.config/opencode/skills/vcs-detect
Command: npx skills add https://github.com/eratio08/dotfiles --skill vcs-detect-eratio08

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Detects the active version control system (jj or git) for the current project so you can run the correct CLI commands.

Core Features & Use Cases

  • Detects between jj and git for colocated repositories.
  • Guides users to run the appropriate VCS commands to avoid errors.
  • Works by probing repository roots with jj root and git rev-parse --show-toplevel to determine the VCS.

Quick Start

Run the detection command before performing any VCS operation to determine the appropriate 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 colocated repository uses jj or git?

To detect the active VCS in a colocated repository, probe the repository roots by attempting `jj root` first, then `git rev-parse --show-toplevel`. This detection mechanism ensures you select the appropriate CLI before executing any version control commands.

Why do I get errors running git commands in a jujutsu colocated repo?

Errors occur in a colocated repo when using the wrong VCS CLI. Detecting the active version control system first prevents this by probing `jj root` before `git rev-parse`, guiding you to run the appropriate VCS commands and avoid mismatches.

What is the best way to check the VCS root before running version control commands?

The best way to check the VCS root is attempting `jj root` first, then `git rev-parse --show-toplevel`, falling back to 'none' if neither succeeds. This probing mechanism determines the correct CLI for your current project.

Can I use this VCS detection for projects that only use git?

Yes, you can use this detection for projects that only use git. The mechanism attempts `jj root` first, then falls back to `git rev-parse --show-toplevel`, correctly identifying git as the active version control system when no jujutsu root exists.

Does the detection work when neither jj nor git is initialized in the directory?

The detection handles directories without an active VCS by falling back to 'none' when both `jj root` and `git rev-parse --show-toplevel` fail. This ensures you know no version control system is present before attempting commands.