@yiln-dsh/dsh-plugin-file-explorer 0.4.0
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/README.md +103 -0
- package/client.js +1625 -0
- package/cordis.patch.yml +11 -0
- package/index.js +519 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# dsh-plugin-file-explorer
|
|
2
|
+
|
|
3
|
+
A DSH `dsh.bundle` that replaces the built-in **details** column of the Web
|
|
4
|
+
GUI with a workspace file explorer.
|
|
5
|
+
|
|
6
|
+
- Replaces the built-in tool-details right column while the bundle row is
|
|
7
|
+
mounted (it is restored automatically when the plugin is disabled/removed).
|
|
8
|
+
- Auto-opens when a conversation (non-blank session) starts.
|
|
9
|
+
- **Files** tab: lists the active session's workspace directory, with folder
|
|
10
|
+
navigation, editable path input, parent/refresh buttons, file and folder
|
|
11
|
+
icons, and file sizes. File rows reveal view / download / delete buttons on
|
|
12
|
+
hover; delete uses a second-click confirm.
|
|
13
|
+
- **Git Graph** tab: a vscode/le-git-graph style commit graph rendered from
|
|
14
|
+
the repository containing the current directory —
|
|
15
|
+
- colored lane graph with commit dots and merge curves (all branches or the
|
|
16
|
+
current branch, refreshable),
|
|
17
|
+
- pill decorations for branches / remotes / tags / HEAD,
|
|
18
|
+
- an "Uncommitted changes" row from `git status` (count + changed files vs
|
|
19
|
+
HEAD),
|
|
20
|
+
- click a commit to expand its full message and changed-file list with
|
|
21
|
+
A/M/D/R status badges,
|
|
22
|
+
- click a file to open its diff patch (commit shows `git show`, working tree
|
|
23
|
+
shows `git diff HEAD`) in a dialog.
|
|
24
|
+
- The column is a real layout column: it squeezes the conversation and its
|
|
25
|
+
width can be dragged between 300–520px with the native splitter handle.
|
|
26
|
+
- The chosen width persists across sessions and page reloads (localStorage):
|
|
27
|
+
the plugin captures the shell layout store actions when the root entry wires
|
|
28
|
+
them, restores the saved width right after `openDetails()`, and saves the
|
|
29
|
+
column width after every resizer drag.
|
|
30
|
+
- **Collapse to icon bar**: a collapse button sits left of the header title
|
|
31
|
+
(chevrons pointing right, matching the DSH session menu's compact icon
|
|
32
|
+
style). Clicking it closes the details column and leaves a slim rail pinned
|
|
33
|
+
to the right edge with two icons — **Files** and **Git Graph** — clicking
|
|
34
|
+
either reopens the drawer on that tab at the last chosen width. The layout
|
|
35
|
+
keeps the slot subtree mounted at width 0, so the rail survives and the
|
|
36
|
+
panel state is preserved.
|
|
37
|
+
|
|
38
|
+
## Layout
|
|
39
|
+
|
|
40
|
+
| File | Content |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `index.js` | Host half: registers exact `/ _dsh/file-explorer/*` routes backed by the Host `fs`/`subprocess` services, plus read-only git routes (`/ _dsh/file-explorer/git-log`, `git-commit`, `git-diff`, `git-status`) that run `git` with machine-readable separators and return JSON only. |
|
|
43
|
+
| `client.js` | Client half: a static DSH client module registered into the `details` slot; Files + Git Graph tabs. |
|
|
44
|
+
| `cordis.patch.yml` | Composition patch that mounts the host row — declared with `inject: [webServer]`, so it activates only after the stock webserver service (`127.0.0.1`) is up. |
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
The plugin is version `0.3.0` from its own `package.json`.
|
|
49
|
+
|
|
50
|
+
### Local source directory
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
dsh plugin --profile web add file:/path/to/dsh-plugin-file-explorer
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Tarball
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
cd /path/to/dsh-plugin-file-explorer
|
|
60
|
+
pnpm pack
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
dsh plugin --profile web add ./dsh-plugin-file-explorer-0.2.0.tgz
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### npm package
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cd /path/to/dsh-plugin-file-explorer
|
|
71
|
+
npm publish
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
dsh plugin --profile web add dsh-plugin-file-explorer
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The profile must be the `web` profile. The host row serves the API routes and
|
|
79
|
+
the client bundle loads with the web shell; restart `dsh web` after install to
|
|
80
|
+
apply the new profile composition.
|
|
81
|
+
|
|
82
|
+
## Behavior notes
|
|
83
|
+
|
|
84
|
+
- The Host falls back to `sandboxPolicy.workspaceRoot` when no path is passed,
|
|
85
|
+
and returns `{ ok, path, parent, entries }` JSON — never live objects.
|
|
86
|
+
- `read` previews up to 256 KiB of UTF-8 text; `download` returns a base64
|
|
87
|
+
data URL (64 MiB cap) that the browser triggers with `<a download>`.
|
|
88
|
+
- `delete` removes regular files (`rm -f`) and directories recursively
|
|
89
|
+
(`rm -rf`); both are called only after a second-click confirm in the UI.
|
|
90
|
+
- Git routes are read-only. They resolve the repository root with
|
|
91
|
+
`git rev-parse --show-toplevel` from the requested directory (or the
|
|
92
|
+
workspace root), then run `git log --all --date-order` (default 300 commits,
|
|
93
|
+
`req.all === false` for the current branch only), `git diff-tree -m
|
|
94
|
+
--first-parent` for commit file lists, `git show` / `git diff HEAD` for
|
|
95
|
+
patches, and `git status --porcelain=v1 -b` for the working tree. Commit
|
|
96
|
+
hashes are validated against `^[0-9a-fA-F]{6,40}$` (or the `WORKING`
|
|
97
|
+
sentinel) and file paths against a non-option, non-control-character check.
|
|
98
|
+
- Rows have a fixed 34px height, so the hover action swap never changes the
|
|
99
|
+
row height; directories reveal a delete-only action set on hover.
|
|
100
|
+
- The browser module uses the `details` slot (scope: session), registering at
|
|
101
|
+
priority `-6` to shadow the built-in tool-details occupant (priority `0`),
|
|
102
|
+
the `layout` service (`openDetails` / `closeDetails`), the standard
|
|
103
|
+
`useSessions` hook, and its own stylesheet.
|