# dsh-side-dir [![dsh-plugin](https://img.shields.io/badge/topic-dsh--plugin-blue)](https://github.com/topics/dsh-plugin) [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)Web 界面的**项目目录预览**插件:侧栏「目录」开关 → 右侧 details 面板浏览当前会话工作目录的文件树,点击文件只读预览内容。 English | [简体中文](./README.zh.md) ## How it works - **目录树**:懒加载。展开目录时经 `/dirpreview list` 命令(`ctx.fs.listDir`)列出该层全部子项——含文件、类型与大小,单层上限 500 条。 - **文件内容**:核心 wire 契约封闭(插件不能新增 RPC),内容通过插件注册的 `/dirpreview read` 命令经 `command.execute` RPC 返回——官方允许的 host→client 数据通道。 - **安全围栏**:所有路径 `ctx.fs.resolve` 到会话 cwd 并用 `ctx.fs.contains` 校验,越界拒绝;只读(handler 无任何写入);内容上限 256KiB;二进制文件由 `ctx.fs.readText` 原生拒绝。 - **入口**:侧栏底部「目录」按钮切换。ON 时以 priority 遮蔽 details 单槽渲染面板(原生面板在 OFF 后完整恢复);OFF 释放。 ## Install ```sh dsh plugin --profile web add github:NonchalantLudens/dsh-side-dir # 或 npm 发布后: # dsh plugin --profile web add dsh-side-dir ``` 重启 `dsh web`,侧栏底部点「目录」。 ## Structure - `lib/index.js` — host 半边:注册 `/dirpreview` 命令(root / list / read 三个子命令) - `lib/client.js` — 客户端产物(加载器闭包工厂格式,手写维护):侧栏开关 + details 面板(目录树 + 文件预览) - `cordis.patch.yml` — 安装时插入 host 行;`dsh.client` 声明使客户端产物自动进入 web roster ## Design doc [docs/specs/2026-08-23-side-dir-design.md](./docs/specs/2026-08-23-side-dir-design.md) ## License MIT