dsh-oh-my-terminal 0.2.4 → 0.2.5
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 +40 -28
- package/README.zh.md +40 -28
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dsh-oh-my-terminal
|
|
2
2
|
|
|
3
|
-
[](package.json)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](package.json)
|
|
6
6
|
|
|
@@ -13,10 +13,11 @@ A bottom terminal panel plugin for DSH Web GUI. Powered by `@lydell/node-pty`, i
|
|
|
13
13
|
- **Multiple terminal sessions**: manage several sessions simultaneously; a side list replaces the traditional horizontal tab bar, with right-click rename support
|
|
14
14
|
- **Split terminals**: horizontal splits within the same group; a VSCode-style dropdown next to the `+` button (new / split / new by kind)
|
|
15
15
|
- **Session persistence**: sessions survive panel close/reopen and are automatically restored on startup
|
|
16
|
-
- **Configurable shortcut**: toggle the panel with a keyboard shortcut;
|
|
16
|
+
- **Configurable shortcut**: toggle the panel with a keyboard shortcut; integrates with the host shortcut system and the panel label updates to reflect the current binding
|
|
17
17
|
- **Resizable panel**: drag the top edge of the panel to adjust its height
|
|
18
18
|
- **Cross-platform**: Windows ConPTY and POSIX openpty are selected automatically by `@lydell/node-pty`; pre-compiled binaries ship with the package, nothing to compile
|
|
19
|
-
- **
|
|
19
|
+
- **Profile-driven terminals**: a configurable terminal profile table (type / name / path) drives new-terminal creation; profiles are auto-detected at startup and can be added, renamed, and edited in the settings UI
|
|
20
|
+
- **Configurable fonts**: font family, size, and line height are adjustable and hot-reload on open terminals
|
|
20
21
|
|
|
21
22
|
## Installation
|
|
22
23
|
|
|
@@ -30,16 +31,22 @@ dsh plugin --profile web add github:btsd321/dsh-oh-my-terminal
|
|
|
30
31
|
|
|
31
32
|
| Option | Description | Default |
|
|
32
33
|
|---|---|---|
|
|
33
|
-
| `toggleShortcut` | Shortcut to toggle the terminal panel (legacy host only; see below) | `` Ctrl+` `` |
|
|
34
|
-
| `
|
|
34
|
+
| `toggleShortcut` | Shortcut to toggle the terminal panel (legacy host only; see below) | `` Ctrl+Shift+` `` |
|
|
35
|
+
| `fontFamily` | Terminal font family (CSS `font-family` string); empty = built-in default stack with CJK fallback | `''` |
|
|
36
|
+
| `fontSize` | Terminal font size in pixels | `12.5` |
|
|
37
|
+
| `lineHeight` | Terminal line height multiplier | `1.25` |
|
|
38
|
+
| `terminalProfiles` | Terminal profile table (JSON array); empty = use auto-detected $PATH terminals | `''` |
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
### Terminal profiles
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
The terminal profile table is a JSON array of `{ id, type, name, path, origin }` entries:
|
|
39
43
|
|
|
40
|
-
- **
|
|
41
|
-
- **
|
|
42
|
-
- **
|
|
44
|
+
- **type**: determines spawn semantics — `pwsh` / `powershell` / `cmd` / `bash` / `zsh` / `fish` / `gitbash` / `nushell` / `custom`
|
|
45
|
+
- **name**: display name shown in the dropdown menu (user-editable)
|
|
46
|
+
- **path**: executable path; empty = resolve by `type` in `$PATH`
|
|
47
|
+
- **origin**: `auto` (startup-detected) or `user` (manually added)
|
|
48
|
+
|
|
49
|
+
Auto-detected profiles (`origin: auto`) cannot be deleted and their path is read-only, but the name is always editable. The profile table is editable in the settings UI with inline editing, add-row, and delete support.
|
|
43
50
|
|
|
44
51
|
## Development
|
|
45
52
|
|
|
@@ -75,25 +82,30 @@ The host side lazy-loads the package (`await import()` on first session creation
|
|
|
75
82
|
|
|
76
83
|
```
|
|
77
84
|
src/
|
|
78
|
-
├── index.ts
|
|
79
|
-
├── routes.ts
|
|
80
|
-
├── ws-handler.ts
|
|
81
|
-
├── client.tsx
|
|
85
|
+
├── index.ts # Host entry (Cordis plugin + settings + session lifecycle)
|
|
86
|
+
├── routes.ts # HTTP route handlers
|
|
87
|
+
├── ws-handler.ts # WebSocket handler (pty data forwarding)
|
|
88
|
+
├── client.tsx # Browser entry (React components + plugin registration)
|
|
82
89
|
├── client/
|
|
83
|
-
│ ├── types.ts
|
|
84
|
-
│ ├── hooks.ts
|
|
85
|
-
│ ├── term-pane.tsx
|
|
86
|
-
│ ├── dropdown.tsx
|
|
87
|
-
│ ├── side-list.tsx
|
|
88
|
-
│ ├── styles.ts
|
|
89
|
-
│ ├── icons.tsx
|
|
90
|
-
│
|
|
91
|
-
├──
|
|
92
|
-
├──
|
|
93
|
-
|
|
94
|
-
├──
|
|
95
|
-
├──
|
|
96
|
-
|
|
90
|
+
│ ├── types.ts # Shared types
|
|
91
|
+
│ ├── hooks.ts # useReducer state management + custom hooks
|
|
92
|
+
│ ├── term-pane.tsx # xterm.js terminal pane component
|
|
93
|
+
│ ├── dropdown.tsx # Dropdown menu next to the + button
|
|
94
|
+
│ ├── side-list.tsx # Right-side terminal list panel
|
|
95
|
+
│ ├── styles.ts # CSS constants + Campbell dark theme
|
|
96
|
+
│ ├── icons.tsx # SVG icon components
|
|
97
|
+
│ ├── clipboard.ts # Clipboard utility functions
|
|
98
|
+
│ ├── shortcut-bridge.ts # Shortcuts service integration (command registration + toggle bridge)
|
|
99
|
+
│ ├── settings/ # Settings UI (types / store / card / profile-table / api / styles)
|
|
100
|
+
│ └── terminal/ # Terminal tab state (use-tabs / reducer / use-terminal-state / geometry)
|
|
101
|
+
├── persistence.ts # Session persistence (log storage, metadata, startup restore)
|
|
102
|
+
├── platform.ts # Platform adapter (POSIX / Windows + shell detection)
|
|
103
|
+
├── terminal/ # Terminal kinds, detection, resolution, profile store
|
|
104
|
+
├── settings/ # Settings bridge (namespace, bridge routes, patch ops)
|
|
105
|
+
├── constants.ts # Protocol, size, shortcut, and env var constants
|
|
106
|
+
├── server-command.ts # Command-line parsing utilities
|
|
107
|
+
├── shortcut.ts # Shortcut parsing utilities
|
|
108
|
+
└── logger.ts # Structured logger
|
|
97
109
|
```
|
|
98
110
|
|
|
99
111
|
The host side and browser side communicate over WebSocket at `/api/dsh-oh-my-terminal` and do not import each other directly.
|
package/README.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dsh-oh-my-terminal
|
|
2
2
|
|
|
3
|
-
[](package.json)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](package.json)
|
|
6
6
|
|
|
@@ -11,10 +11,11 @@ DSH Web GUI 的底部终端面板插件,基于 `@lydell/node-pty` 提供多终
|
|
|
11
11
|
- **多标签终端**:同时管理多个会话,右侧列表替代水平 tab 栏,支持右键重命名
|
|
12
12
|
- **拆分终端**:同组内水平并排,+号旁下拉菜单(新建 / 拆分 / 按种类新建),VSCode 风格操作
|
|
13
13
|
- **会话持久化**:面板收起后会话保持存活,重新打开后自动恢复
|
|
14
|
-
-
|
|
14
|
+
- **快捷键开关**:可配置快捷键呼出/收起面板;接入宿主统一快捷键系统,在设置界面改键后标签跟随更新
|
|
15
15
|
- **拖拽调高**:拖拽面板上边缘调整高度
|
|
16
16
|
- **跨平台**:Windows ConPTY / POSIX openpty,由 `@lydell/node-pty` 自动选择,二进制随 tarball 分发,安装即用
|
|
17
|
-
-
|
|
17
|
+
- **配置表驱动终端**:终端配置表(type / name / path)驱动新建终端;启动时自动探测 $PATH 中的终端,可在设置界面新增、改名、编辑路径
|
|
18
|
+
- **字体可配置**:字体族、字号、行高可配置,配置变更对已打开终端即时生效
|
|
18
19
|
|
|
19
20
|
## 安装
|
|
20
21
|
|
|
@@ -28,16 +29,22 @@ dsh plugin --profile web add github:btsd321/dsh-oh-my-terminal
|
|
|
28
29
|
|
|
29
30
|
| 配置项 | 说明 | 默认值 |
|
|
30
31
|
|---|---|---|
|
|
31
|
-
| `toggleShortcut` | 呼出/收起终端面板的快捷键(仅旧宿主生效,见下方适配说明) | `` Ctrl+` `` |
|
|
32
|
-
| `
|
|
32
|
+
| `toggleShortcut` | 呼出/收起终端面板的快捷键(仅旧宿主生效,见下方适配说明) | `` Ctrl+Shift+` `` |
|
|
33
|
+
| `fontFamily` | 终端字体族(CSS `font-family` 串);留空使用内置默认字体栈(含 CJK 回退) | `''` |
|
|
34
|
+
| `fontSize` | 终端字号(像素) | `12.5` |
|
|
35
|
+
| `lineHeight` | 终端行高倍数 | `1.25` |
|
|
36
|
+
| `terminalProfiles` | 终端配置表(JSON 数组);留空 = 用启动时探测到的 $PATH 终端 | `''` |
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
### 终端配置表
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
终端配置表是 `{ id, type, name, path, origin }` 条目的 JSON 数组:
|
|
37
41
|
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
42
|
+
- **type**:决定 spawn 语义 — `pwsh` / `powershell` / `cmd` / `bash` / `zsh` / `fish` / `gitbash` / `nushell` / `custom`
|
|
43
|
+
- **name**:下拉菜单显示名(用户可改)
|
|
44
|
+
- **path**:可执行文件路径;留空 = 按 type 在 `$PATH` 中解析
|
|
45
|
+
- **origin**:`auto`(启动探测)/ `user`(手动新增)
|
|
46
|
+
|
|
47
|
+
自动探测项(`origin: auto`)不可删除、路径不可改,但名称始终可编辑。配置表可在设置界面内 inline 编辑、新增行、删除。
|
|
41
48
|
|
|
42
49
|
## 开发
|
|
43
50
|
|
|
@@ -73,25 +80,30 @@ pnpm exec tsx --test tests/unit/*.test.ts
|
|
|
73
80
|
|
|
74
81
|
```
|
|
75
82
|
src/
|
|
76
|
-
├── index.ts
|
|
77
|
-
├── routes.ts
|
|
78
|
-
├── ws-handler.ts
|
|
79
|
-
├── client.tsx
|
|
83
|
+
├── index.ts # 宿主半入口(Cordis 插件 + settings + 会话生命周期)
|
|
84
|
+
├── routes.ts # HTTP 路由处理器
|
|
85
|
+
├── ws-handler.ts # WebSocket 处理器(pty 数据转发)
|
|
86
|
+
├── client.tsx # 浏览器半入口(React 组件 + 插件注册)
|
|
80
87
|
├── client/
|
|
81
|
-
│ ├── types.ts
|
|
82
|
-
│ ├── hooks.ts
|
|
83
|
-
│ ├── term-pane.tsx
|
|
84
|
-
│ ├── dropdown.tsx
|
|
85
|
-
│ ├── side-list.tsx
|
|
86
|
-
│ ├── styles.ts
|
|
87
|
-
│ ├── icons.tsx
|
|
88
|
-
│
|
|
89
|
-
├──
|
|
90
|
-
├──
|
|
91
|
-
|
|
92
|
-
├──
|
|
93
|
-
├──
|
|
94
|
-
|
|
88
|
+
│ ├── types.ts # 共享类型
|
|
89
|
+
│ ├── hooks.ts # useReducer 状态管理 + 自定义 Hooks
|
|
90
|
+
│ ├── term-pane.tsx # xterm.js 终端面板组件
|
|
91
|
+
│ ├── dropdown.tsx # +号旁下拉菜单
|
|
92
|
+
│ ├── side-list.tsx # 右侧终端列表
|
|
93
|
+
│ ├── styles.ts # CSS 常量 + Campbell 暗色主题
|
|
94
|
+
│ ├── icons.tsx # SVG 图标组件
|
|
95
|
+
│ ├── clipboard.ts # 剪贴板工具函数
|
|
96
|
+
│ ├── shortcut-bridge.ts # shortcuts 服务接入桥(命令注册 + 面板切换回调)
|
|
97
|
+
│ ├── settings/ # 设置界面(types / store / card / profile-table / api / styles)
|
|
98
|
+
│ └── terminal/ # 终端标签页状态(use-tabs / reducer / use-terminal-state / geometry)
|
|
99
|
+
├── persistence.ts # 会话持久化层(日志落盘 / 元数据 / 启动恢复)
|
|
100
|
+
├── platform.ts # 平台适配层(POSIX / Windows + shell 探测)
|
|
101
|
+
├── terminal/ # 终端种类、探测、解析、配置表校验
|
|
102
|
+
├── settings/ # Settings 桥接层(命名空间 / 路由 / patch 操作)
|
|
103
|
+
├── constants.ts # 协议 / 尺寸 / 快捷键 / 环境变量常量
|
|
104
|
+
├── server-command.ts # 命令行解析工具
|
|
105
|
+
├── shortcut.ts # 快捷键解析工具
|
|
106
|
+
└── logger.ts # 统一日志工具
|
|
95
107
|
```
|
|
96
108
|
|
|
97
109
|
宿主半与浏览器半经 WebSocket 通信,路由前缀 `/api/dsh-oh-my-terminal`,不直接 import。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-oh-my-terminal",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "DSH Web GUI 底部终端面板插件——node-pty 驱动的多标签交互式终端(Windows ConPTY / POSIX openpty)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,12 +35,11 @@
|
|
|
35
35
|
"@deepseek-ai/schemastery": "^3.18.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@deepseek-ai/dsh-brand": "0.
|
|
39
|
-
"@deepseek-ai/dsh-client-shortcuts": "0.
|
|
40
|
-
"@deepseek-ai/dsh-client-store": "0.
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
42
|
-
"@deepseek-ai/dsh-
|
|
43
|
-
"@deepseek-ai/dsh-settings": "0.1.7-rc.2",
|
|
38
|
+
"@deepseek-ai/dsh-brand": "0.2.0-rc.1",
|
|
39
|
+
"@deepseek-ai/dsh-client-shortcuts": "0.2.0-rc.1",
|
|
40
|
+
"@deepseek-ai/dsh-client-store": "0.2.0-rc.1",
|
|
41
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.0-rc.1",
|
|
42
|
+
"@deepseek-ai/dsh-settings": "0.2.0-rc.1",
|
|
44
43
|
"@types/node": "^22.0.0",
|
|
45
44
|
"@types/react": "^18.2.0",
|
|
46
45
|
"@types/ws": "^8.5.0",
|