@doubleelec/dsh-workspace-explorer 0.7.1-fork.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +175 -0
- package/README.zh.md +175 -0
- package/assets/screenshots/edit.png +0 -0
- package/assets/screenshots/insert.png +0 -0
- package/assets/screenshots/panel.png +0 -0
- package/assets/screenshots/preview.png +0 -0
- package/assets/screenshots/tree.png +0 -0
- package/cordis.patch.yml +9 -0
- package/demo/index.html +1129 -0
- package/demo/preview.gif +0 -0
- package/docs/awesome-submission.yml +23 -0
- package/docs/experience.md +252 -0
- package/docs/install.md +26 -0
- package/docs/local-debugging.md +197 -0
- package/docs/publish.md +47 -0
- package/docs/verify-native.md +51 -0
- package/dsh.plugin.json +16 -0
- package/lib/client.js +2709 -0
- package/lib/index.js +385 -0
- package/lib/types/client/format.d.ts +15 -0
- package/lib/types/client/index.d.ts +8 -0
- package/lib/types/client/markdown.d.ts +66 -0
- package/lib/types/client/popupLayout.d.ts +49 -0
- package/lib/types/index.d.ts +39 -0
- package/manifest.json +36 -0
- package/package.json +108 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 dsh-workspace-explorer contributors
|
|
4
|
+
Forked by doubleelec (2026), based on Jiyr0119/dsh-workspace-explorer@0.7.1
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# dsh-workspace-explorer
|
|
2
|
+
|
|
3
|
+
> Self-maintained fork by [doubleelec](https://github.com/doubleelec) — based on
|
|
4
|
+
> [Jiyr0119/dsh-workspace-explorer](https://github.com/Jiyr0119/dsh-workspace-explorer) v0.7.1 (MIT).
|
|
5
|
+
> npm package: `@doubleelec/dsh-workspace-explorer`.
|
|
6
|
+
|
|
7
|
+
**[English](README.md)** | [中文](README.zh.md)
|
|
8
|
+
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://github.com/doubleelec/dsh-workspace-explorer/stargazers)
|
|
11
|
+
[](https://github.com/doubleelec/dsh-workspace-explorer)
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
⭐ If you find this useful, give it a Star — it makes the maintainer's day · <a href="https://github.com/doubleelec/dsh-workspace-explorer">★ Give a Star</a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
> A workspace file explorer for the DeepSeek Harness Web UI: a **“Workspace Files” capsule button in the session header** (feature name + folder icon, beside the Session log button) opens an animated popup showing the current workspace's directory tree — click a file to preview it, share it into the chat with one click, or drag it into the composer.
|
|
18
|
+
|
|
19
|
+
Inspired by the VS Code / Cursor project tree, filling the gap of a missing directory view in DSH after workspaces are added.
|
|
20
|
+
|
|
21
|
+
## Why this plugin
|
|
22
|
+
|
|
23
|
+
- **Preview first, never misfire** — clicking a file row opens it in a dedicated Preview tab instead of unexpectedly injecting text into your draft. Sharing is an explicit act: the arrow button at the row's head, `⏎`, points toward the composer at the bottom-left — the icon says where the file is going.
|
|
24
|
+
- **Markdown that reads like Markdown** — `.md` / `.mdx` files render formatted (headings, lists, code blocks, quotes, tables, task lists) with a one-click source toggle. Zero-dependency renderer built on React elements — XSS-safe by construction, no sanitizer needed.
|
|
25
|
+
- **Reference anything in one motion** — single click to share, drag & drop to the caret, Shift / ⌘ multi-select batch insert, or type `@` in the composer to fuzzy-find any file (up to 5000 entries, 10 levels deep) even with the panel closed.
|
|
26
|
+
- **Edit without leaving** — preview panel turns into an editor (Save / Discard / Cancel) with external-change detection on save; writes go straight to disk.
|
|
27
|
+
- **Fullscreen when it matters** — one click in the header expands the popup over the whole session area for big files and long Markdown; click again (or `Esc`) to go back.
|
|
28
|
+
- **Stays out of the way** — the popup measures itself live between the session header and the composer, never covers the input box; size is corner-draggable with localStorage memory (double-click resets). Noise dirs hidden, sizes shown, relative/absolute reference format — all live-tunable.
|
|
29
|
+
|
|
30
|
+
## 🖥 Demo
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
*Demo GIF (recorded at v0.5.1): the **“Workspace Files” pill entry**, multi-select batch insert, folder drag → compact tree text, paginated preview, and the settings tab. The newer Preview tab, file editing and Markdown rendering are shown in the screenshots below.*
|
|
35
|
+
|
|
36
|
+
<details>
|
|
37
|
+
<summary><b>Screenshots</b> · 截图</summary>
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
</details>
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
- 📂 **Animated popup** — a **“Workspace Files” capsule button** (feature name + folder icon, same style as the native **Session log** download button) sits in the session header and opens a floating panel with a spring-like fade/scale-in animation; the popup is measured live to sit **between the session header and the composer** (the chat area's right side), so it never covers the input box. **Corner-drag to resize** (width + height, persisted to localStorage, double-click resets)
|
|
54
|
+
- 🗂 **Top tab bar** — Files / Preview / Settings; the Settings page tunes behavior live (hide noise dirs, show sizes, reference format) and mirrors into DSH Settings → Workspace Explorer
|
|
55
|
+
- 🗂 **Lazy-loading tree** — directories load on demand; noise dirs (`node_modules`, `.git`, `dist`, `__pycache__`, …) are hidden automatically
|
|
56
|
+
- 🎨 **File-type icons** — filled, color-coded document badges per extension (TS / JS / Python / JSON / Markdown / image / config / shell, …); amber folders that brighten when expanded; the actively previewed file gets a blue dot
|
|
57
|
+
- 🖱 **Click to preview** — click a file row (or `Enter` / `Space`) to open it in the Preview tab; the **⏎ button** at the row's head inserts the `@path` reference into the composer (`@` / `i` shortcut works too)
|
|
58
|
+
- ⛶ **Fullscreen mode** — the header toggle (next to close) expands the popup over the whole session area for big files / long Markdown; click again to restore, `Esc` exits fullscreen first
|
|
59
|
+
- 🖱 **Drag & drop** — drop a file into the composer to insert at the caret (fullscreen dashed hint); dropping elsewhere appends to the end. **Folders are draggable too** — dropping a directory inserts a depth-limited compact tree listing
|
|
60
|
+
- 🖱 **Multi-select & batch insert** — Shift / ⌘ click to select multiple rows, then insert all of them at once (files → references, folders → tree listings)
|
|
61
|
+
- ⌨️ **`@` mention anywhere** — type `@` in the composer to fuzzy-find workspace files (name or path, 50 suggestions, 500-path lexicon highlight) — works even with the panel closed, via sessions-cwd auto-discovery
|
|
62
|
+
- 🌓 **Theme-aware** — built entirely on DSH's `--dsw-alias-*` design tokens; adapts to light/dark with a native dialog look (16px radius, lv3 shadow)
|
|
63
|
+
- 🔍 **Search & filter** — filter files by name across the whole tree (up to 5000 entries / 10 levels, match count shown)
|
|
64
|
+
- 📝 **Markdown rendering** — `.md` / `.mdx` preview rendered by default (headings, bold/italic/strike, code blocks with language tag, quotes, ordered/unordered/task lists, tables, horizontal rules); one-click toggle back to source; oversized paged files fall back to source automatically
|
|
65
|
+
- ✏️ **Preview tab** — whole-file view (≤ 4 MB in one read, paged beyond that with total lines & current page); insert the reference, or paste the full content for small files (≤ 32 KB)
|
|
66
|
+
- 📝 **File editing** — click "Edit" in the preview panel to enter textarea mode; save writes directly to disk with change detection (warns if the file was modified externally)
|
|
67
|
+
- 🌐 **i18n** — zh/en dictionaries registered through DSH's locale service; the panel follows the DSH UI language
|
|
68
|
+
|
|
69
|
+
## Quick Start
|
|
70
|
+
|
|
71
|
+
### Installation & usage
|
|
72
|
+
|
|
73
|
+
One command installs the full plugin — no build step, no config changes. The npm package ships a native host half (`lib/index.js`, webServer JSON routes `/dsh-we/api/list|peek|tree|config|write`) **and** a browser bundle (`lib/client.js` via `dsh.plugin.json`).
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
dsh plugin --profile web add -w @doubleelec/dsh-workspace-explorer@latest
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
(or click the install button in the DSH market). After install, a **“Workspace Files” pill (name + icon)** appears in the session header; restart or hard-refresh the web UI if needed. This is the zero-config, no-build path.
|
|
80
|
+
|
|
81
|
+
> ℹ️ **pnpm note**: modern pnpm (9/10) refuses to add a dependency at the workspace root (`ERR_PNPM_ADDING_TO_ROOT`), hence the `-w` flag above. Alternative: create `~/.dsh/profiles/web/.npmrc` containing `ignore-workspace-root-check=true`.
|
|
82
|
+
|
|
83
|
+
> ⚠️ **Common misconception**: a listing alone never auto-installs anything — users still click install. The full UI now appears after install (native bundle — no boot errors).
|
|
84
|
+
|
|
85
|
+
See [`docs/install.md`](./docs/install.md) for details.
|
|
86
|
+
|
|
87
|
+
### Usage
|
|
88
|
+
|
|
89
|
+
1. Click the **“Workspace Files” pill** (feature name + folder icon) at the top right of the session header, beside the Session log button, to open the popup.
|
|
90
|
+
2. Expand directories to browse files; **click a file to preview it**.
|
|
91
|
+
3. Click the **⏎ button** at a row's head (or drag the file into the composer, or type `@` + filename) to reference it, then send.
|
|
92
|
+
4. Use the **Settings** tab at the top of the popup (or DSH Settings → Workspace Explorer) to adjust panel behavior.
|
|
93
|
+
|
|
94
|
+
## Project Structure
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
dsh-workspace-explorer/
|
|
98
|
+
├── README.md # Docs — English (default)
|
|
99
|
+
├── README.zh.md # Docs — 中文
|
|
100
|
+
├── LICENSE # MIT
|
|
101
|
+
├── CHANGELOG.md # Release notes
|
|
102
|
+
├── manifest.json # Plugin metadata
|
|
103
|
+
├── package.json # npm package (@doubleelec/dsh-workspace-explorer)
|
|
104
|
+
├── demo/
|
|
105
|
+
│ ├── index.html # Interactive mock preview (GitHub Pages)
|
|
106
|
+
│ └── preview.gif # Demo animation (README)
|
|
107
|
+
├── .github/
|
|
108
|
+
│ └── workflows/
|
|
109
|
+
│ └── pages.yml # Deploy demo/ to GitHub Pages (manual; preview hidden)
|
|
110
|
+
├── docs/
|
|
111
|
+
│ ├── install.md # Install guide
|
|
112
|
+
│ ├── local-debugging.md# Local dev setup (symlink + dev profile)
|
|
113
|
+
│ └── publish.md # Publishing workflow (GitHub + npm)
|
|
114
|
+
├── src/
|
|
115
|
+
│ ├── index.ts # Native host half: webServer JSON routes (/dsh-we/api/*)
|
|
116
|
+
│ └── client/
|
|
117
|
+
│ ├── index.tsx # Native client half: popup + tree + preview + drag & drop
|
|
118
|
+
│ ├── markdown.ts # Zero-dep Markdown parser/renderer (XSS-safe)
|
|
119
|
+
│ ├── format.ts # Pure formatting helpers
|
|
120
|
+
│ └── popupLayout.ts# Popup geometry math (unit-tested)
|
|
121
|
+
├── test/ # vitest suites (format / host / popupLayout / markdown)
|
|
122
|
+
└── lib/ # Built artifacts (lib/index.js + lib/client.js)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Implementation Notes
|
|
126
|
+
|
|
127
|
+
| Capability | Mechanism |
|
|
128
|
+
|---|---|
|
|
129
|
+
| Directory listing | Host `fs` via `resolveRel`-guarded root+rel (`/dsh-we/api/list`), directories first, 400-entry cap |
|
|
130
|
+
| File peek | Whole read ≤ 4 MB, paged scan with line-offset cache beyond (`/dsh-we/api/peek`); binary sniffed, ≤ 32 KB inlinable |
|
|
131
|
+
| Tree / search index | Depth/budget-limited recursion (`/dsh-we/api/tree`, up to 10 levels / 5000 entries) |
|
|
132
|
+
| File write | `/dsh-we/api/write` with size-based external-change detection |
|
|
133
|
+
| Host→Client RPC | Same-origin `fetch POST /dsh-we/api/*` (path-confined, no arbitrary-path reads) |
|
|
134
|
+
| Popup | `shell.overlay` slot (`useWorkspaces` / `useSessions`), position measured between session header & composer; corner resize with localStorage memory |
|
|
135
|
+
| Toggle button | `conversation.session.header.utilities` slot (“Workspace Files” pill: name + icon) |
|
|
136
|
+
| Composer write | `conversation.input.dock` → `inputActions.setDraft`, with `conversation.input` service fallback |
|
|
137
|
+
| `@` mention | `inputTriggers.registerSource` (fuzzy candidates + lexicon highlight), root auto-discovered from sessions cwd |
|
|
138
|
+
| Drag & drop | HTML5 DnD; native caret insert in the textarea, append elsewhere |
|
|
139
|
+
| Markdown | Hand-written parser → React elements (no `innerHTML`); source toggle; paged fallback |
|
|
140
|
+
| Theming / i18n | `--dsw-alias-*` CSS variables (light/dark); zh/en via the DSH locale service |
|
|
141
|
+
|
|
142
|
+
## Version
|
|
143
|
+
|
|
144
|
+
Current version **v0.7.1-fork.3** — **Preview-first interaction** (row click previews, ⏎ shares), **Markdown rendering**, and **single-package cleanup** (dynamic paste variant removed).
|
|
145
|
+
See [CHANGELOG.md](./CHANGELOG.md) for release notes.
|
|
146
|
+
|
|
147
|
+
## Roadmap
|
|
148
|
+
|
|
149
|
+
Focused on the two lines that actually matter to the product: the **read path** (pointing the model at code) and the **write path** (editing files). Everything else is parked in the backlog below instead of being listed as a peer track.
|
|
150
|
+
|
|
151
|
+
**Done ✅**
|
|
152
|
+
|
|
153
|
+
- [x] v0.1 core: right-side file tree, click / drag-to-composer references, native DSH look
|
|
154
|
+
- [x] Search & filter across the whole tree; content insertion for small files (≤ 32 KB)
|
|
155
|
+
- [x] i18n (zh/en via the DSH locale service, follows the DSH UI language)
|
|
156
|
+
- [x] `@` mention source with sessions-cwd auto-discovery + lexicon highlight; unified `@path` reference format
|
|
157
|
+
- [x] Demo language toggle, GitHub Pages preview, demo GIF, storefront screenshots
|
|
158
|
+
- [x] npm package + `dsh.bundle` contract + awesome-dsh-plugin listing
|
|
159
|
+
- [x] Multi-target references: folder drag (compact tree) + multi-select batch insert
|
|
160
|
+
- [x] Whole-file preview (≤ 4 MB) with paged fallback for large files
|
|
161
|
+
- [x] Preview-first interaction: row click previews, ⏎ button shares, keyboard `@` / `i`
|
|
162
|
+
- [x] Markdown rendering (zero-dep, XSS-safe) with source toggle
|
|
163
|
+
- [x] In-panel file editing with external-change detection
|
|
164
|
+
- [x] Resizable popup with size memory; Preview as a standalone tab
|
|
165
|
+
|
|
166
|
+
**Parked backlog** (do when real demand shows up)
|
|
167
|
+
|
|
168
|
+
- Content search across loaded dirs (host-side grep); recent files / favorites
|
|
169
|
+
- Full keyboard navigation; copy path / reveal in the OS file manager
|
|
170
|
+
- Virtual scrolling (huge dirs); light/dark theme regression checks; Playwright e2e
|
|
171
|
+
- CI (lint + e2e + automated release)
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
[MIT](./LICENSE)
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# dsh-workspace-explorer
|
|
2
|
+
|
|
3
|
+
> 自维护 fork([doubleelec](https://github.com/doubleelec))—— 基于
|
|
4
|
+
> [Jiyr0119/dsh-workspace-explorer](https://github.com/Jiyr0119/dsh-workspace-explorer) v0.7.1(MIT)。
|
|
5
|
+
> npm 包:`@doubleelec/dsh-workspace-explorer`。
|
|
6
|
+
|
|
7
|
+
[English](README.md) | **中文**
|
|
8
|
+
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://github.com/doubleelec/dsh-workspace-explorer/stargazers)
|
|
11
|
+
[](https://github.com/doubleelec/dsh-workspace-explorer)
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
⭐ 顺手留颗 Star,维护者能高兴一整天 · <a href="https://github.com/doubleelec/dsh-workspace-explorer">行,给你一颗 Star</a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
> 给 DeepSeek Harness Web UI 的工作区文件资源管理器:会话头部一个**「工作区文件」胶囊按钮**(功能名称 + 文件夹图标,与 Session log 按钮同排)打开动画弹窗,展示当前工作区目录树;点击文件即预览,一键分享进对话,也可拖进输入框。
|
|
18
|
+
|
|
19
|
+
灵感来自 VS Code / Cursor 的项目目录树,弥补 DSH 添加工作台后没有目录视图的空白。
|
|
20
|
+
|
|
21
|
+
## 为什么用它
|
|
22
|
+
|
|
23
|
+
- **先预览,绝不误触** — 点击文件行只在独立「预览」Tab 打开,不会往草稿里乱塞文本。分享是显式动作:行首的 ⏎ 箭头按钮指向左下输入框,图标自己就说了文件要去哪。
|
|
24
|
+
- **Markdown 就该是排版的样子** — `.md` / `.mdx` 默认渲染(标题/列表/代码块/引用/表格/任务列表),一键切回源码。零依赖手写渲染器,React 元素构建,天生防 XSS,不用消毒库。
|
|
25
|
+
- **花式引用,一步到位** — 单击分享、拖拽到光标处、Shift / ⌘ 多选批量插入,或在输入框打 `@` 模糊搜全树文件(5000 条 / 10 层),面板不开也能用。
|
|
26
|
+
- **不用离开就能改** — 预览面板一键进编辑态(保存/放弃/取消),保存时检测外部修改,直接写盘。
|
|
27
|
+
- **该大就大** — 头部一键全屏覆盖整个会话区,看大文件/长 MD,再点(或 `Esc`)回来。
|
|
28
|
+
- **绝不挡路** — 弹窗在会话头部与输入框之间实时测量,永不盖住输入框;左下角拖拽调大小并记忆(双击恢复);噪声目录自动隐藏,大小显示、相对/绝对引用格式都可实时调。
|
|
29
|
+
|
|
30
|
+
## 🖥 演示 Demo
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
*演示 GIF(录制于 v0.5.1):「工作区文件」胶囊入口、多选批量插入、目录拖拽 → 紧凑目录树文本、分页预览与设置页。新版预览 Tab、文件编辑与 Markdown 渲染见下方截图。*
|
|
35
|
+
|
|
36
|
+
<details>
|
|
37
|
+
<summary><b>截图</b> Screenshots</summary>
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
</details>
|
|
50
|
+
|
|
51
|
+
## 功能特性
|
|
52
|
+
|
|
53
|
+
- 📂 **动画弹窗** — 会话头部右侧(与 session log 同排)的**「工作区文件」胶囊按钮**(功能名称 + 文件夹图标,与 DSH 原生 **Session log** 下载按钮同款样式)点击后,弹出一个带淡入/缩放动画的浮动面板;弹窗位置实时测量,**位于会话头部与输入框之间**(聊天区右侧),绝不会盖住输入框。**左下角拖拽调大小**(宽+高,localStorage 记忆,双击恢复)
|
|
54
|
+
- 🗂 **顶部 Tab 栏** — 文件 / 预览 / 设置;设置页实时调节行为(隐藏噪声目录、显示大小、引用格式),并同步进 DSH 设置 → 工作区文件
|
|
55
|
+
- 🗂 **懒加载展开** — 目录按需加载,自动隐藏 `node_modules` / `.git` / `dist` / `__pycache__` 等噪声目录
|
|
56
|
+
- 🎨 **文件类型图标** — 按扩展名着色的实心文档徽标(TS / JS / Python / JSON / Markdown / 图片 / 配置 / 脚本等),目录为琥珀色文件夹、展开态高亮;正在预览的文件带蓝色圆点
|
|
57
|
+
- 🖱 **点击预览** — 点击文件行(或 `Enter` / `空格`)在「预览」Tab 打开;行首 **⏎ 按钮**把 `@路径` 引用插入输入框(`@` / `i` 快捷键亦可)
|
|
58
|
+
- ⛶ **全屏模式** — 头部关闭键旁的按钮一键全屏(看大文件/长 MD),再点恢复;`Esc` 先退全屏再关闭
|
|
59
|
+
- 🖱 **拖拽插入** — 文件拖到输入框内任意位置在光标处插入(带全屏虚线提示),拖到其他位置则追加到末尾;**目录也可拖拽**,松开即插入限层数的紧凑目录树文本
|
|
60
|
+
- 🖱 **多选批量插入** — Shift / ⌘ 点击多选,一键批量插入(文件 → 引用,目录 → 目录树)
|
|
61
|
+
- ⌨️ **随处 `@` 引用** — 输入框打 `@` 模糊搜工作区文件(文件名或路径,50 条候选,500 个路径高亮),面板不开也能用(会话 cwd 自动发现)
|
|
62
|
+
- 🌓 **跟随主题** — 全部使用 DSH 的 `--dsw-alias-*` 设计 token,浅色/深色自动适配;原生弹窗外观(16px 圆角、lv3 阴影)
|
|
63
|
+
- 🔍 **搜索过滤** — 按文件名过滤整棵树(5000 条 / 10 层,显示匹配数)
|
|
64
|
+
- 📝 **Markdown 渲染** — `.md` / `.mdx` 默认渲染排版(标题、加粗/斜体/删除线、代码块带语言标签、引用、有序/无序/任务列表、表格、分隔线);一键切回源码;超大分页文件自动回落源码
|
|
65
|
+
- ✏️ **预览 Tab** — 整文件视图(≤4MB 一次读完,更大走分页并显示总行数与当前页);可插入引用,小文件(≤32KB)可直接插入完整内容
|
|
66
|
+
- 📝 **文件编辑** — 预览面板点击「编辑」进入 textarea 编辑态,支持保存/放弃/取消;保存时检测文件外部修改
|
|
67
|
+
- 🌐 **国际化** — 通过 DSH locale 服务注册中/英词典,面板跟随 DSH 界面语言切换
|
|
68
|
+
|
|
69
|
+
## 快速开始
|
|
70
|
+
|
|
71
|
+
### 安装与使用
|
|
72
|
+
|
|
73
|
+
一条命令装好完整插件,无需构建、无需改任何配置。npm 包同时提供原生 Host 半区(`lib/index.js`,webServer JSON 路由 `/dsh-we/api/list|peek|tree|config|write`)和浏览器 bundle(`lib/client.js` 经 `dsh.plugin.json`)。
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
dsh plugin --profile web add -w @doubleelec/dsh-workspace-explorer@latest
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
(或在 DSH 市场点击安装按钮)。安装后会话头部即出现**「工作区文件」胶囊(名称 + 图标)**;必要时重启或硬刷新 Web UI。这是零配置、免构建的路径。
|
|
80
|
+
|
|
81
|
+
> ℹ️ **pnpm 提示**:现代 pnpm(9/10)会拒绝在 workspace root 直接 add(`ERR_PNPM_ADDING_TO_ROOT`),故命令带 `-w`。另一种做法:在 `~/.dsh/profiles/web/.npmrc` 写入 `ignore-workspace-root-check=true`。
|
|
82
|
+
|
|
83
|
+
> ⚠️ **常见误解**:收录本身不会自动安装任何东西 —— 用户仍需点安装。安装后即出现完整 UI(原生 bundle,无启动报错)。
|
|
84
|
+
|
|
85
|
+
详细步骤见 [`docs/install.md`](./docs/install.md)。
|
|
86
|
+
|
|
87
|
+
### 使用
|
|
88
|
+
|
|
89
|
+
1. 点击会话头部右上角的**「工作区文件」胶囊按钮**(功能名称 + 文件夹图标,与 Session log 按钮同排)打开弹窗
|
|
90
|
+
2. 展开目录浏览文件,**点击文件即预览**
|
|
91
|
+
3. 点行首 **⏎ 按钮**(或把文件拖进输入框,或打 `@` + 文件名)引用它,然后发送
|
|
92
|
+
4. 用弹窗顶部的「设置」Tab(或 DSH 设置 → 工作区文件)调整面板行为
|
|
93
|
+
|
|
94
|
+
## 目录结构
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
dsh-workspace-explorer/
|
|
98
|
+
├── README.md # 文档 — English(默认)
|
|
99
|
+
├── README.zh.md # 文档 — 中文
|
|
100
|
+
├── LICENSE # MIT
|
|
101
|
+
├── CHANGELOG.md # 变更记录
|
|
102
|
+
├── manifest.json # 插件元信息
|
|
103
|
+
├── package.json # npm 包(@doubleelec/dsh-workspace-explorer)
|
|
104
|
+
├── demo/
|
|
105
|
+
│ ├── index.html # 交互式模拟预览(GitHub Pages)
|
|
106
|
+
│ └── preview.gif # 演示动图(README)
|
|
107
|
+
├── .github/
|
|
108
|
+
│ └── workflows/
|
|
109
|
+
│ └── pages.yml # 部署 demo/ 到 GitHub Pages(手动;预览已隐藏)
|
|
110
|
+
├── docs/
|
|
111
|
+
│ ├── install.md # 安装指南
|
|
112
|
+
│ ├── local-debugging.md# 本地开发(symlink + dev profile)
|
|
113
|
+
│ └── publish.md # 发布流程(GitHub + npm)
|
|
114
|
+
├── src/
|
|
115
|
+
│ ├── index.ts # 原生 Host 半区:webServer JSON 路由(/dsh-we/api/*)
|
|
116
|
+
│ └── client/
|
|
117
|
+
│ ├── index.tsx # 原生 Client 半区:弹窗 + 文件树 + 预览 + 拖拽
|
|
118
|
+
│ ├── markdown.ts # 零依赖 Markdown 解析/渲染(防 XSS)
|
|
119
|
+
│ ├── format.ts # 纯格式化工具
|
|
120
|
+
│ └── popupLayout.ts# 弹窗几何计算(单测覆盖)
|
|
121
|
+
├── test/ # vitest 套件(format / host / popupLayout / markdown)
|
|
122
|
+
└── lib/ # 构建产物(lib/index.js + lib/client.js)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 实现要点
|
|
126
|
+
|
|
127
|
+
| 能力 | 机制 |
|
|
128
|
+
|---|---|
|
|
129
|
+
| 目录读取 | Host `fs` 经 `resolveRel` 限定的 root+rel(`/dsh-we/api/list`),目录优先,400 条上限 |
|
|
130
|
+
| 文件预览 | ≤4MB 整读,更大走行偏移缓存分页(`/dsh-we/api/peek`);二进制嗅探,≤32KB 可内联 |
|
|
131
|
+
| 目录树/搜索索引 | 限深/限预算递归(`/dsh-we/api/tree`,10 层 / 5000 条) |
|
|
132
|
+
| 文件写入 | `/dsh-we/api/write`,按大小检测外部修改 |
|
|
133
|
+
| Host→Client 通信 | 同源 `fetch POST /dsh-we/api/*`(路径约束,无任意路径读取) |
|
|
134
|
+
| 弹窗 | `shell.overlay` 槽位(`useWorkspaces` / `useSessions`),会话头部与输入框之间实时测量;左下角拖拽调大小并记忆 |
|
|
135
|
+
| 开关按钮 | `conversation.session.header.utilities` 槽位(「工作区文件」胶囊:名称 + 图标) |
|
|
136
|
+
| 写入输入框 | `conversation.input.dock` → `inputActions.setDraft`,另有 `conversation.input` 服务兜底 |
|
|
137
|
+
| `@` 提及 | `inputTriggers.registerSource`(模糊候选 + lexicon 高亮),根目录从 sessions cwd 自动发现 |
|
|
138
|
+
| 拖拽插入 | HTML5 DnD;输入框内走原生光标插入,其他位置追加 |
|
|
139
|
+
| Markdown | 手写解析器 → React 元素(无 `innerHTML`);源码切换;分页回落 |
|
|
140
|
+
| 主题/国际化 | `--dsw-alias-*` CSS 变量(浅/深色);中/英经 DSH locale 服务 |
|
|
141
|
+
|
|
142
|
+
## 版本
|
|
143
|
+
|
|
144
|
+
当前版本 **v0.7.1-fork.3** — **预览优先交互**(点行预览、⏎ 分享)、**Markdown 渲染**、**单包清理**(删除动态粘贴版)。
|
|
145
|
+
变更记录见 [CHANGELOG.md](./CHANGELOG.md)。
|
|
146
|
+
|
|
147
|
+
## Roadmap
|
|
148
|
+
|
|
149
|
+
聚焦两条与产品真正相关的主线:**读路径**(把模型指向代码)与**写路径**(编辑文件)。其余事项全部挪到 Backlog 搁置,不再与产品功能平级。
|
|
150
|
+
|
|
151
|
+
**已完成 ✅**
|
|
152
|
+
|
|
153
|
+
- [x] v0.1 核心:右侧文件树、点击/拖拽插入引用、DSH 原生观感
|
|
154
|
+
- [x] 全树搜索过滤;小文件(≤32KB)内容插入
|
|
155
|
+
- [x] 国际化(zh/en,跟随 DSH 界面语言)
|
|
156
|
+
- [x] `@` 提及源(sessions cwd 自动发现 + lexicon 高亮);统一 `@路径` 引用格式
|
|
157
|
+
- [x] 演示页中英切换、GitHub Pages 预览、演示 GIF、市场截图素材
|
|
158
|
+
- [x] npm 包 + `dsh.bundle` 契约 + awesome 列表
|
|
159
|
+
- [x] 多目标引用:目录拖拽(紧凑目录树)+ 多选批量插入
|
|
160
|
+
- [x] 整文件预览(≤4MB),大文件分页回落
|
|
161
|
+
- [x] 预览优先交互:点行预览、⏎ 分享、`@` / `i` 快捷键
|
|
162
|
+
- [x] Markdown 渲染(零依赖、防 XSS) + 源码切换
|
|
163
|
+
- [x] 面板内文件编辑 + 外部修改检测
|
|
164
|
+
- [x] 弹窗可调大小并记忆;预览独立 Tab
|
|
165
|
+
|
|
166
|
+
**搁置 Backlog**(出现真实需求再做)
|
|
167
|
+
|
|
168
|
+
- 跨已加载目录的内容搜索(host 侧 grep);最近文件 / 收藏夹
|
|
169
|
+
- 完整键盘导航;复制路径 / 在系统文件管理器中显示
|
|
170
|
+
- 虚拟滚动(超大目录);浅/深色主题回归检查;Playwright e2e
|
|
171
|
+
- CI(lint + e2e + 自动发布)
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
[MIT](./LICENSE)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# 组合补丁:安装后把插件行插入 profile 组合 / Composition patch applied on `dsh plugin add`.
|
|
2
|
+
#
|
|
3
|
+
# v0.3.0+:包为原生单包 —— Host 半区(lib/index.js,webServer /dsh-we/api/* JSON 路由,含 config)
|
|
4
|
+
# + 浏览器 bundle(lib/client.js,经 dsh.client 声明),安装后浏览器面板完整出现(顶部 Tab + 设置页)。
|
|
5
|
+
#
|
|
6
|
+
# 注意:作用域包名必须加引号(YAML 中 @ 不能作为裸标量起始字符,否则 dsh web 启动解析补丁直接失败)。
|
|
7
|
+
- insert:
|
|
8
|
+
- id: elec-workspace-explorer
|
|
9
|
+
name: '@doubleelec/dsh-workspace-explorer'
|