Skip to content
dsh.fish
Bundle

dsh-workspace-trust

Per-workspace trust for DSH, used by other plugins to decide whether project code may run · 为 DSH 工作区记录信任,供其他插件决定是否运行项目里的代码

Source
RicardoYan
License
MIT
Updated
Updated 6 days ago

Readme

# dsh-workspace-trust

给 DSH 工作区记录「信任 / 不信任」,供其他插件决定是否运行项目里的代码、能否访问工作区外的路径。

DSH 自带的没有工作区信任:克隆来的仓库里配了什么,插件就照着运行什么。

## 安装

```sh
dsh plugin --profile desktop add github:RicardoYan/dsh-workspace-trust#v0.1.0
```

Web 端把 `desktop` 换成你的 profile 名(一般是 `web`)。装完重启 DSH。

卸载:`dsh plugin --profile desktop remove dsh-workspace-trust`

## 使用

- 每个工作区第一次开会话时弹一次:**信任** / **不信任**,选完记住,不再问
- 工作区 = 从会话目录往上最近的含 `.dsh/settings.yml` 或 `.git` 的目录;都没有就是会话目录本身。同一工作区的子目录共用一个选择
- `/workspace-trust` 查看状态;`/workspace-trust trust` 或 `untrust` 修改,当前会话立即生效
- 记录在 `~/.dsh/workspace-trust/workspaces.json`,按路径保存;删除工作区目录不会清掉记录。之后同一路径放了别的项目(例如重新克隆了另一个仓库),会沿用原来的选择,必要时用 `/workspace-trust untrust` 改回

## 禁止访问列表

以下目录即使工作区已信任也不允许插件读取:`~/.dsh ~/.ssh ~/.gnupg ~/.aws ~/.azure ~/.kube ~/.docker ~/.git-credentials ~/.config/gh ~/.netrc ~/.npmrc ~/.pypirc ~/.claude ~/.codex ~/.cc-switch`。在 profile 的 `cordis.patch.yml` 里调整:

```yaml
- id: dsh-workspace-trust
  name: 'dsh-workspace-trust'
  config:
    deniedPaths: ['~/.my-secrets', '%APPDATA%/some-tool']   # 追加
    useDefaultDeniedPaths: true                             # false = 不用上面的默认列表
```

## 注意

- 本插件只记录和检查,本身不运行项目代码;哪些功能受信任控制,由使用它的插件决定
- 依赖 DSH 的 `agent/pre-step`、`userQuestions`、`commands` 接口,适用于 `@deepseek-ai/dsh` `>=0.2.0-rc.2 <0.3.0-0`
- 没有界面(如 headless)时不弹询问,按未信任处理;`enabled: false` 可整体关闭
- 界面文字跟随 DSH 的语言设置(设置 → 常规 → 语言),只显示中文或英文;语言设为自动时跟随系统语言。斜杠命令列表里的命令说明在 DSH 启动时确定,切换语言后重启才更新

## 许可证

MIT

Install

dsh plugin --profile web add github:RicardoYan/dsh-workspace-trust

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source