DeepSHPlugins
dsh-workspace-snapshot 專案預覽
GITHUB / COMMUNITY PROJECT

dsh-workspace-snapshot

工具與整合TypeScriptMIT

以結構化資料返回有界、相對倉庫根的 Git 狀態,不暫存、不提交,也不切換分支。

2 Starstxy-ucas 更新時間 2026-08-16
訪問 GitHub 倉庫
dsh-workspace-snapshot 專案預覽

專案介紹

中文

以結構化資料返回有界、相對倉庫根的 Git 狀態,不暫存、不提交,也不切換分支。

English

Reports bounded, repository-relative Git status as structured data without staging, committing, or changing branches.

專案資訊與收錄訊號

快照 2026-09-11
作者 / 組織
txy-ucas
倉庫
txy-ucas/dsh-workspace-snapshot
GitHub Stars
2
Forks
0
開發語言
TypeScript
許可證
MIT
最近推送
2026-08-16
Manifest
資料中檢測到宣告

公開倉庫不自動等於可商用;許可證與當前相容性以原專案文件為準。Manifest 和資料評分不構成安裝安全認證。

資料評分

56/ 100
維護活躍
82
文件與實用資訊
85
生態關注度
14
安裝便捷訊號
100
專案宣告訊號
100

README 含完整安裝與使用說明;關注度尚低(2);標準命令一鍵安裝。

評分來自已有資料快照的五維模型,僅作瀏覽參考,不是實際使用評測或安全檢測結論。

安裝與使用

所有專案資料與許可均以對應 GitHub 倉庫為準。

dsh plugin --profile web add github:txy-ucas/dsh-workspace-snapshot

複製命令不會自動執行。請先閱讀倉庫文件,確認環境要求與許可證。

專案截圖

倉庫 README

GitHub 原文

已儲存的倉庫文件快照;文件抓取時間未記錄,可能與上方目錄介紹處於不同版本。安裝前請核對當前倉庫說明。

儲存庫檔案保留原文,指令與授權文字不作自動改寫。

dsh-workspace-snapshot

CI DSH compatibility Release License

A bounded, read-only Git workspace status tool for DeepSeek Harness. It adds one model-facing workspace_snapshot tool that reports branch tracking and repository-relative path states as validated structured data.

The plugin never stages files, changes branches, writes Git configuration, creates commits, or pushes.

Scope

This plugin is intentionally a status probe, not a complete Git workflow. It answers which paths are staged, unstaged, conflicted, or untracked without exposing repository mutation operations or file-content diffs. Use a dedicated review or Git workflow plugin when the agent must inspect changed lines, create commits, or manage branches. The narrower scope keeps this plugin useful in read-only deployments and complementary to broader Git tooling.

Requirements

  • Node.js ^22.19.0 || >=24.0.0
  • DeepSeek Harness 0.1.0-rc.6
  • Git available in the Harness subprocess provider's execution world

The package pins the exact Cordis and DSH peer API versions it was tested against. An incompatible Harness upgrade fails package resolution instead of silently loading an unverified API combination.

Install

Install the prebuilt v0.1.0 release into the profile you use:

dsh plugin --profile web add https://github.com/txy-ucas/dsh-workspace-snapshot/releases/download/v0.1.0/dsh-workspace-snapshot-0.1.0.tgz

The release tarball needs no package build allowance. A pinned source install is also supported:

dsh plugin --profile web add github:txy-ucas/dsh-workspace-snapshot#v0.1.0

Git installations run the package's prepare build. pnpm 10 or newer may require this entry in the profile's pnpm-workspace.yaml before repeating the install:

allowBuilds:
  dsh-workspace-snapshot: true

For local development, run this from the checkout's parent directory:

dsh plugin --profile web add ./dsh-workspace-snapshot

Verify composition without starting the UI:

dsh --profile web --dump-config

The output must include the workspace-snapshot row.

Use

Ask the agent:

Inspect the Git workspace before making changes.

The model can call workspace_snapshot and receives a canonical object such as:

{
  "status": "ok",
  "repositoryRoot": ".",
  "branch": "feature/status-tool",
  "detached": false,
  "upstream": "origin/feature/status-tool",
  "ahead": 2,
  "behind": 0,
  "clean": false,
  "entries": [
    { "kind": "changed", "path": "src/index.ts", "indexStatus": "M", "worktreeStatus": "." },
    { "kind": "changed", "path": "README.md", "indexStatus": ".", "worktreeStatus": "M" },
    { "kind": "untracked", "path": "notes.txt" }
  ],
  "totalPaths": 3,
  "conflictCount": 0,
  "stagedCount": 1,
  "unstagedCount": 1,
  "untrackedCount": 1,
  "omittedPaths": 0,
  "truncated": false
}

Every path appears once in entries. A changed entry separates Git's index and worktree status characters; rename and copy entries also carry originalPath. A conflict entry carries one validated unmerged status, and an untracked entry carries only its path.

FieldMeaning
repositoryRootStable "." path base. Every entry path and optional originalPath is relative to the repository root, without exposing its host absolute path.
branchCurrent branch name, or null for detached or unknown HEAD state.
detachedWhether Git reports a detached HEAD.
upstreamTracking branch, or null when none is configured.
ahead / behindCommit distance from the configured upstream. Both are zero when Git reports no branch comparison.
cleanWhether Git reported no tracked changes, conflicts, or untracked paths. The tool always requests untracked paths.
entriesBounded path records discriminated by kind: changed, conflict, or untracked. Each path appears once.
totalPathsComplete number of Git path records parsed from bounded stdout.
conflictCountComplete number of conflict paths, including omitted entries.
stagedCount / unstagedCountComplete changed-path counts derived from non-dot index/worktree statuses. One changed path may increment both.
untrackedCountComplete number of untracked paths.
omittedPathsPath records excluded from entries by maxPathRecords or maxResultBytes.
truncatedWhether entries is incomplete. The count fields remain complete when this is true.

Native and Code Mode consumers receive the same canonical object. Native rendering is exactly its JSON serialization; paths containing control characters are JSON-escaped.

Errors

Expected external failures are returned as structured values rather than raw exceptions:

{
  "status": "error",
  "code": "NOT_A_REPOSITORY",
  "message": "The session working directory is not inside a Git repository.",
  "retryable": false
}

Stable codes are NOT_A_REPOSITORY, GIT_UNAVAILABLE, TIMEOUT, CANCELLED, OUTPUT_LIMIT, INVALID_GIT_OUTPUT, and GIT_FAILED. Raw stderr, thrown values, and stack traces are never returned to the model.

Configuration

The installable bundle inserts the plugin with defaults. Override the complete row configuration in the profile's later cordis.patch.yml layer when needed:

- id: workspace-snapshot
  config:
    timeoutMs: 5000
    maxGitStdoutBytes: 262144
    maxPathRecords: 500
    maxResultBytes: 131072
FieldDefaultContract
timeoutMs5000Shared deadline for executable lookup and status, from 100 to 120000 ms.
maxGitStdoutBytes262144Retained Git stdout limit, from 1024 to 4000000. Exceeding it returns OUTPUT_LIMIT; partial output is never parsed.
maxPathRecords500Maximum path records initially retained in entries, from 1 to 10000. All records in bounded stdout still contribute to complete counts.
maxResultBytes131072UTF-8 byte limit for the complete canonical JSON result, from 1024 to 4000000. Entries are removed whole until it fits; JSON is never cut.

Configuration is intentionally flat. Invalid limits fail plugin loading.

Safety and lifecycle

  • The plugin declares inject = ['tools', 'subprocess']; Cordis activates it only while both services are available.
  • Tool registration is owned by ctx.effect() and disappears on HMR, unload, or uninstall.
  • Every call runs one fixed read-only argv: git --no-pager --no-optional-locks -c core.fsmonitor=false -c core.untrackedCache=false -c status.relativePaths=false status --porcelain=v2 --branch -z --untracked-files=all.
  • Git runs through ctx.subprocess, never node:child_process, so the selected execution-world provider and its process-tree cleanup remain authoritative.
  • The child environment removes every inherited GIT_* value, then sets only GIT_CONFIG_COUNT=0, GIT_OPTIONAL_LOCKS=0, and LC_ALL=C. Ambient repository, index, object-store, and config injection cannot redirect the query.
  • Optional locks, repository FSMonitor hooks, the untracked cache, and relative-to-cwd status paths are disabled explicitly. No model- or user-controlled string enters argv.
  • The NUL-delimited parser handles spaces, newlines, Unicode paths, and rename/copy source paths without shell quoting.
  • The parser requires complete branch headers and validates record tags, submodule state, file modes, object IDs, rename/copy scores, and status enums before accepting output.
  • The caller's abort signal and the configured timeout bound executable lookup, the Git process, and complete process-tree exit. Captured stdout is not accepted while descendants remain live. Timer and signal-listener ownership ends before the tool settles.
  • Git stdout, retained path records, and canonical result bytes are independently bounded. The plugin keeps no cache, watcher, socket, interval, or cross-session mutable state.
  • UI presentation is a pure generic read card. The model-facing result is derived only from the validated canonical value.

Scope and limitations

  • Ignored paths are not returned.
  • Submodule state appears through Git's porcelain status fields but is not expanded recursively.
  • Git may read repository metadata and working-tree paths. The plugin disables known status-time hooks and write optimizations; it does not claim that Git itself performs no operating-system reads.
  • The snapshot is point-in-time information. Another process may modify the repository immediately after Git exits.
  • This tool does not replace git diff, review tools, permission policy, or commit tooling.
  • DeepSeek Harness is in developer preview. Exact peer versions deliberately reject unverified Harness APIs; the scheduled compatibility workflow reports when @deepseek-ai/dsh@latest requires a plugin update.

Uninstall

dsh plugin --profile web remove dsh-workspace-snapshot

Development

corepack enable
pnpm install
pnpm run check
node tests/install.e2e.mjs
DSH_VERSION=latest node tests/install.e2e.mjs

The suite covers strict porcelain headers and record metadata, path classification and complete counts, result-byte truncation, fixed argv, inherited Git-environment isolation, a real FSMonitor hook sentinel, lingering process-tree timeout and cancellation, structured external failures, canonical rendering, Cordis fiber disposal, package construction, and installation into an isolated Harness profile.

License

MIT

使用前核對

安裝步驟、相容版本與授權範圍以原專案當前文件為準。Stars 和評分是快照中的導航訊號。

安裝與排錯 · 專案問題反饋

同類專案