ZSLlearn/dsh-git-tools ↗★ 1

dsh-git-tools

Structured, safety-guarded git tools (status/log/diff/branch/repo/stage/commit/reset/push/fetch) for DeepSeek Harness agent presets. Zero runtime dependencies. 核心用途是赋予 Agent 安全、规范的 Git 版本控制操作能力。适合需要 Agent 自动管理代码提交、分支切换及代码比对,且要求操作安全的开发任务。

Package
dsh-git-tools
Compatibility
Unverified
Version
0.1.0
Last updated
Aug 14, 2026

Other repositories with this package name

Install

This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗

dsh-git-tools

Structured, safety-guarded git tools for DeepSeek Harness agent presets — a zero-dependency Cordis plugin (plain ESM, no npm dependencies), hardened through real-repo testing.

Contents

PathWhat it is
src/index.jsThe plugin: apply registers 10 git tools; consumes only ctx.get('subprocess') / ctx.get('fs') / ctx.tools.register
test/register-check.mjsZero-dependency self-check: runs apply against a mock context, asserts 10 complete tool schemas + guardrails
docs/dsh-git-tools-plan.mdDesign document: architecture decisions, safety-guardrail list, full test matrix, iteration/fix log
testdata/Test fixtures (throwaway, gitignored): a diverged repo with a bare remote, a Chinese-named repo, a scratch repo, a non-repo dir

The plugin

10 model tools: git_repo, git_status, git_log, git_branch, git_diff, git_stage, git_commit, git_reset, git_push, git_fetch.

ToolWhat it doesGuardrails
git_reporepo root, current branch, HEAD, remotes, git versionread-only
git_statusbranch, upstream tracking, ahead/behind, staged/unstaged/untracked/conflictsread-only
git_logrecent commits (hash, author, date, subject); count/branch/path filtersread-only
git_branchbranches with current marker, upstream, ahead/behind counts; all for remote refsread-only
git_diffname-status / numstat / --stat / full unified diff; base/target/pathread-only
git_stagegit add / git restore --staged for explicit pathspaths required
git_commitcommit staged changes; allow_empty/amend opt-inmessage required
git_resetsoft / mixed / hard resethard requires confirm: true
git_pushpush branch or tagsforce requires confirm: true (uses --force-with-lease)
git_fetchfetch from a remote or all; prune by defaultread-only-ish

Design highlights:

  • Safety-first: reset --hard / push --force refuse to run unless the model passes confirm: true; force-push uses --force-with-lease; no git clean / checkout -- . / branch -D / push --delete; interactive prompts disabled everywhere (no hang); commands run as raw argv, never through a shell.
  • Structured output: porcelain-format parsing into typed fields instead of free-form shell text.
  • Context-safe: per-list truncation with truncated flags, cooperative cancellation via exec.signal, explicit timeouts.

Install / use in DeepSeek Harness

Point a preset row straight at the source file (absolute paths work everywhere; Windows drive letters are converted to file: URLs by the preset loader):

# agent.cordis.yml under ~/.dsh/.agent-presets//
- id: dsh-git-tools
  name: 'D:/absolute/path/to/dsh-git-tools/src/index.js'

Or npm install dsh-git-tools and reference the package name. See the plan doc for the full design, test matrix, and iteration log.

Self-check

node test/register-check.mjs

Runs apply against a mock Cordis context and asserts all 10 tools register with complete schemas, guarded tools expose confirm, and executes fail gracefully without the subprocess service — catching schema-compilation regressions that preset mount-validation cannot see.

Requirements

  • git on PATH (or a known C:\Program Files\Git\cmd\git.exe fallback on Windows)
  • A harness subprocess service (standard in DeepSeek Harness)

License

MIT