LoserFox/dsh-git-identity 预览 preview

LoserFox/dsh-git-identity

DSH 插件:git 提交固定使用环境自身作者身份(优先 gh CLI 登录账号,GitHub noreply 邮箱),GIT_AUTHOR_*/GIT_COMMITTER_* 环境变量注入压过一切 git config

Project Overview项目介绍

This plugin is built exclusively for DeepSeek Harness (DSH) version 0812 and newer, running on DSH’s official profile bundle plugin system. It solves a common problem where DSH git commits end up with the wrong author identity because of hardcoded DSH Agent configuration in the agent session. The core feature forces all git commits made inside DSH to use the user’s correct git identity, following a fixed four-level priority order for identity resolution. To install the plugin, you check out the repository, then run DSH’s plugin add command to register it to your target DSH profile, such as web or headless.

The four priority levels start with explicitly configured name and email set by the user in the plugin’s config, which is the most reliable option for users not logged into the gh CLI. Next, it pulls the currently logged-in user from the gh CLI, taking the login as the name and using GitHub’s standard no-reply email format. Third, it picks up existing GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL variables from the DSH startup environment. Finally, it falls back to the user’s existing global git config name and email.

After installation, you need to restart the DSH process for your target profile because composition layer changes do not support hot module replacement. Once loaded, the plugin writes the resolved identity to four git environment variables that DSH passes to all child bash processes, and since git prioritizes these environment variables over all config files, every commit will use the correct identity. It also syncs the identity to the global git config idempotently to keep external terminal commits consistent. The plugin is pure ESM JavaScript with zero dependencies, so no build step is needed after editing.

这是一个专门为 DeepSeek Harness 0812+版本官方插件系统开发的原生配置包插件,核心作用是让DSH内所有git提交都使用正确的用户身份,避免因会话默认配置导致提交作者错误。它遵循固定的身份解析优先级:最高优先级是用户显式配置的信息,其次是gh CLI登录账号,接着是DSH启动环境变量,最后用全局git配置兜底,解析失败时只会告警,不会生成无效身份。

它的工作原理是,插件加载时会把解析好的身份写入GIT_AUTHOR_NAME、GIT_AUTHOR_EMAIL等四个环境变量,DSH的子进程层会把处理后的环境变量传递给每个bash子进程,而git本身的环境变量优先级高于所有配置文件,所以能保证DSH内任何路径发起的提交都使用正确身份。它还会幂等同步身份到全局git配置,让DSH外的普通终端提交也保持身份一致。

安装需要使用DSH的内置插件管理命令,将本仓库检出后通过dsh plugin --profile <名称> add命令添加到对应配置文件,安装完成后必须重启对应profile的DSH进程,因为组合层变更不支持热更新。用户可以通过YAML配置显式钉住姓名和邮箱,插件本身是零依赖的纯ESM代码,修改后直接生效不需要重新构建。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • Only 6 stars - very few users, little community feedback星标只有 6,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:LoserFox/dsh-git-identity

把 LoserFox/dsh-git-identity 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

git-identity

DSH profile bundle(0812+ 的官方插件系统):让 DSH 内产生的所有 git 提交使用 环境自身的作者身份。优先读取 gh CLI 的登录账号(name 取 login,email 取 GitHub noreply 地址 <id>+<login>@users.noreply.github.com),其次启动环境的 GIT_AUTHOR_*、git config --global 兜底。

为什么需要它

DSH 的 agent 会话通过 bash 工具执行 git commit。历史上一旦某个会话显式 -c user.name="DSH Agent" 或改掉了 git 配置,后续提交就会带着错误的作者。 本插件在加载时把解析到的身份写入 GIT_AUTHOR_* / GIT_COMMITTER_* 四个环境变量, DSH 的 subprocess 层会把 process.env(剔除凭据)传给每个 bash 子进程,而 git 的 环境变量优先级高于一切 git config——所以 DSH 内任何路径发起的提交都必然使用该身份。

同时幂等同步回 git config --global,让插件进程外的普通终端提交也保持一致 (仅当 global 配置缺失或被改错时写回)。

安装(0812 profile bundle 系统)

# 从本仓库 checkout 安装到 profile(web / headless 等),bundle 声明自动加入组合层
dsh plugin --profile web add /path/to/dsh-git-identity
dsh plugin --profile headless add /path/to/dsh-git-identity
# 验证
dsh --profile web --dump-config | grep git-identity

安装后需重启目标 profile 的 DSH 进程(组合层变更不参与 HMR 热更新)。

身份解析优先级

  1. 插件配置 { name, email }(显式钉死,最稳;未登录 gh 时可在此配置)
  2. gh CLI 登录账号(gh api user)
  3. 启动环境的 GIT_AUTHOR_NAME / GIT_AUTHOR_EMAIL
  4. git config --global user.name / user.email 兜底

全部解析不到时只告警、不注入,绝不凭空编造身份。

配置

# 在 bundle 的 patch 里给行加 config(可选;不配置则按上述优先级自动解析)
- insert:
    - id: git-identity
      name: '@loserfox/git-identity'
      config:
        name: LoserFox
        email: 57448027+LoserFox@users.noreply.github.com

开发

编辑 index.mjs 后无需构建(纯 ESM,零依赖)。package.json 的 dsh.bundle.patch 声明本包是一个 profile bundle;cordis.patch.yml 是它贡献的 组合层。

← 上一个 Prev dsh-bubble-explain 下一个 Next browser-mcp →