Repository navigation
feat(tools/vcs): implement the source-control (VCS) abstraction - #610
Merged
Merged
Conversation
Extract the source-control capability contract (added in #609, tools/github/source-control.md) into a runnable, backend-dispatching tool so a non-Git VCS plugs in at one place instead of in every skill. - tools/vcs/: stdlib-only `magpie-vcs` CLI. Abstract VCSBackend interface mirroring the capability's operation set (status, branch, stage, commit, diff, log, fetch, push, reset-worktree), a complete GitBackend, backend detection (innermost-wins) and override via --backend / MAGPIE_VCS. - Mercurial and Subversion are detected extension points: detection is real (so `magpie-vcs detect` reports the working copy's VCS), but the operations raise an actionable error naming the bridge issue (#601, #602). A bridge lands by replacing the stub base with a concrete backend; dispatch, the CLI, and every skill calling magpie-vcs pick it up unchanged. - 18 tests (git ops against a temp repo, detection/override, stub errors, CLI exit codes); ruff + mypy clean. - Register the tool: uv workspace member + lockfile, capability-to-tool map row, and a back-reference from source-control.md to the implementation. Generated-by: Claude Code (Opus 4.8)
This was referenced Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extracts the source-control (VCS) capability — whose contract landed in
#609 (
tools/github/source-control.md) —into a runnable, tested, backend-dispatching tool:
tools/vcs/(
magpie-vcs). A non-Git VCS now plugs in at one place (a backend class)instead of editing every git-using skill.
The abstraction
VCSBackend— abstract interface with exactly the operations from thecapability's What the skills require table:
status/is_clean,current_branch,diff,log,create_branch,switch,stage,commit,fetch,push,reset_worktree.GitBackend— complete Git binding (the default; GitHub's native VCS).MercurialBackend/SubversionBackend— real detection (somagpie-vcs detectreports the working copy's VCS) but operations raise anactionable
VCSErrornaming the bridge issue (feat(tools/mercurial): Mercurial (Hg) version-control support for the local dev-loop #601 / feat(tools/subversion): Apache Subversion (SVN) support — ASF svn.apache.org / dist.apache.org #602). SVN carriesdistributed = False. A bridge lands by replacing the stub base with aconcrete subclass — dispatch, the CLI, and every skill calling
magpie-vcspick it up unchanged.
--backend/$MAGPIE_VCS.GIT_*env so a skill invoking it from inside agit hook resolves the repo from
--cwd, not a strayGIT_DIR.Write operations stay gated on explicit user confirmation in the calling
skill — the tool adds no prompt of its own.
Registration & wiring
pyproject.toml) + regenerateduv.lockdocs/labels-and-capabilities.md(
capability:setup) — capability-sync validator passestools/github/source-control.md→ the implementationValidation
All hooks green via
prek run:GIT_*regression, stub-backend errors, CLI exit codes)prek run --all-filesFollow-ups
The non-Git backends are deliberate extension points for the VCS bridge
issues: #601 (Mercurial), #602 (Subversion), #603 (Jujutsu), #604 (Fossil),
#605 (Perforce).
Generated-by: Claude Code (Opus 4.8), reviewed by the submitter before opening.