dsh-file-manager turns DeepSeek Harness workspaces into an editable file tree
File Management (dsh-file-manager)
A workspace file management plugin that runs inside DSH (DeepSeek Harness). The left sidebar provides an entry point, and the central panel lets you browse the current workspace's files, preview and edit text, and perform basic file/folder create, delete, and modify operations.
Plugin Info
- Package name:
@oakzhong/dsh-file-manager - Version: 1.0.2
- Entry: Left sidebar "File Management"
- Type: Host + Client dual-part plugin (bundle)
Tech Stack
| Layer | Technology |
|---|---|
| Plugin framework | DSH Cordis scoped bundle (cordis.patch.yml) |
| Host side | ESM apply(ctx), registers 7 API routes via ctx.connection.fetch.register |
| File system | Node.js fs/promises (readdir/stat/readFile/writeFile/mkdir/rename/rm), zero third-party dependencies |
| Path safety | resolveRoot + inside() validation, all operations restricted to registered workspaces |
| HTTP requests | Client uses fetch with credentials: same-origin, responses explicitly UTF-8 decoded to avoid Chinese garbled text |
| Client side | Registered via window.__ModuleLoader__.load, React without JSX (React.createElement) |
| UI styling | Injects <style> into components, uses DSH theme tokens, independent scroll container |
| i18n | ctx.locale.register / bind, bilingual (zh / en) |
Features
1. Workspace Browsing
- Dropdown at the top to switch registered workspaces
- Breadcrumb navigation (root / nested directories), clickable, with up-one-level
- Search: fuzzy filter by name on the current directory's files/folders for quick location
- Show hidden files: checkbox to control whether dot-prefixed files/folders are displayed (hidden by default)
- File list shows name, size, modification time; icons distinguish file types
- When the list is long, the left side scrolls independently, with a fixed header
- Automatically skips irrelevant directories like
node_modulesand.git
2. File Preview
- Click a text file to display content, supports UTF-8 / GBK encoding switching
- Binary files (images/PDFs/archives, etc.) show a size hint
- Bottom stats show line and character counts
3. File Editing
- Text files can switch to "Edit" mode, modify content in a textarea, then save
- Save writes back to disk and refreshes the list and preview
4. File and Folder Operations
- New folder: creates in the current directory, with an input box
- New file: creates an empty file and automatically enters edit mode (adds
.txtif no extension) - Rename: inline edit for file/folder names, Enter saves / Esc cancels
- Delete: both files and folders can be deleted, requires second confirmation (folders delete recursively, root deletion is forbidden)
Host API Routes
All routes are prefixed with /api/dsh-file-manager/:
| Route | Method | Description |
|---|---|---|
meta |
GET | Get registered workspace list |
list |
GET | List directory contents (root + path) |
read |
GET | Read text file (supports encoding parameter) |
mkdir |
POST | Create folder (root + parent + name) |
write |
POST | Write/create file (root + path + content) |
rename |
POST | Rename (root + path + name) |
remove |
POST | Delete (root + path, recursive for directories) |
Security and Limitations
- All path operations are restricted to the registered workspace root; out-of-bounds access is rejected
- Single-file read/write limit is 4MB
- On macOS, if the workspace is in a protected directory like
~/Documents, system TCC permissions may return EPERM; in that case the plugin prompts the user to grant DSH access under "System Settings → Privacy & Security → Files and Folders" - Responses always include
content-type: application/json; charset=utf-8, and the client explicitly decodes UTF-8 to avoid garbled Chinese names
Directory Structure
dsh-file-manager/
├── package.json # Manifest (scoped package name), bundle config, client injection declaration
├── cordis.patch.yml # Loader insertion line
├── index.js # Host side: 7 file operation routes
├── client.js # Client side: UI, file list, editing, scrolling, styles
├── locale/
│ ├── zh.json # Chinese display metadata
│ └── en.json # English display metadata
├── icon.svg # Plugin icon
├── README.md # English documentation
└── README.zh.md # This document (Chinese)
Installation and Usage
Install via the plugin manager
1.1 Install from GitHub URL: https://github.com/gougou1993/dsh-file-manager.git
1.2 Install via npm package name: @oakzhong/dsh-file-manager
- Click "File Management" in the left sidebar
- Select a workspace, browse directories, click a file to preview
- Use the toolbar buttons to create files/folders, and the list item icons on the right to rename or delete
- Interface overview