source-code-mgmt 1.13.0 → 1.15.1
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.en.md +27 -13
- package/README.md +49 -14
- package/lib/client.js +155 -217
- package/lib/index.js +539 -725
- package/package.json +3 -3
package/README.en.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# source-code-mgmt — DSH Source Code Management Plugin
|
|
2
2
|
|
|
3
|
-
> Version: **v1.
|
|
3
|
+
> Version: **v1.15.1** | 中文版见 [README.md](README.md)
|
|
4
4
|
|
|
5
5
|
> A source-code management plugin for the DSH Web GUI: it bundles「environment check → SSH setup → commit/push/upload code」into one「Code Management」panel with GitHub / Gitee dual-platform support.
|
|
6
6
|
|
|
@@ -19,13 +19,20 @@ Entry points (auto-detected, no manual switching):
|
|
|
19
19
|
|
|
20
20
|
> Detection is a single in-memory read at activation time (`ctx.get('betterSidebar')`) — zero I/O, zero network, no impact on DSH startup.
|
|
21
21
|
|
|
22
|
-
The panel has
|
|
22
|
+
The panel has five steps (①②③ are the core three; ④⑤ are the newer extensions, collapsed by default):
|
|
23
23
|
|
|
24
24
|
### ① Environment Check
|
|
25
25
|
- Shows the **OS** (friendly names `Windows` / `macOS` / `Linux`, from the underlying `win32` / `darwin` / `linux` platform ids)
|
|
26
26
|
- Detects **Git** and **GitHub CLI** presence and versions (e.g. `git version 2.55.0`, `gh version 2.97.0`)
|
|
27
27
|
- Detects whether an **SSH** client is available
|
|
28
|
-
- **Missing tools → install guidance + one-click install**: when a tool is missing, the row shows「❌ 未安装」+「复制安装命令」(copy install command) +「安装」(install)
|
|
28
|
+
- **Missing tools → adaptive install guidance + one-click install (mostly sudo-free)**: when a tool is missing, the row shows「❌ 未安装」+「复制安装命令」(copy install command) +「安装」(install):
|
|
29
|
+
- **GitHub CLI (Linux / macOS)**: **user-level install without sudo** — downloads the official binary for the current platform/architecture from GitHub Releases, extracts it and installs to `~/.local/bin/gh` (the directory is created if missing; no admin rights needed); falls back to the system package manager on failure.
|
|
30
|
+
- **Git (Linux)**: apt / dnf / pacman (auto `sudo -n`; **passwordless sudo is probed first** — when a password is required the panel does not run a doomed command, it shows "run this manually in a terminal" guidance with the exact command). **Git (macOS)**: brew, or **Xcode Command Line Tools** (`xcode-select --install`, the OS-provided installer that also ships git/ssh) when brew is absent.
|
|
31
|
+
- **SSH (Windows)**: built-in optional feature (admin); **SSH (Linux)**: openssh-client via apt / dnf / pacman (same sudo probe); **macOS**: bundled with the OS.
|
|
32
|
+
- **Copy install command** and the **Install** button share the same platform-adaptive logic (no more hardcoded Windows winget commands on Linux/macOS).
|
|
33
|
+
- **Live install-progress dialog**: clicking Install opens a progress window showing each step ("fetch latest version → download → extract → install → clean up") with streaming output; success/failure reasons are shown when done.
|
|
34
|
+
- **Restart prompt + one-click restart when needed**: when the running host cannot pick up the tool right away (e.g. gh installed to `~/.local/bin` while it is not on PATH), the dialog shows a「**重启 DSH**」(Restart DSH) button — the host hands off to a detached helper that replays the original launch command (same mechanism as dsh-update), the page briefly disconnects and comes back; when the host already resolves the tool (e.g. `DSH_SCM_GH` set or `~/.local/bin` on PATH), it finishes without interruption.
|
|
35
|
+
- Re-detects automatically after install.
|
|
29
36
|
|
|
30
37
|
### ② SSH Key & Connectivity
|
|
31
38
|
- **Platform selector**: GitHub (default) / Gitee — decides the SSH config target and connectivity test below
|
|
@@ -59,14 +66,10 @@ The panel has six steps (①②③ are the core three; ④⑤⑥ are the newer e
|
|
|
59
66
|
- **Clone into**: optional target parent directory (default = DSH's default workspace; leave empty to clone to the default location); cloning uses the SSH URL and auto-adds the clone to the custom-directory list so ③ can select it directly
|
|
60
67
|
- Repos already present locally can't be re-cloned; every other repo has a「克隆」(clone) button
|
|
61
68
|
|
|
62
|
-
### ⑤
|
|
63
|
-
- **Target repo recorded locally**: paste the repo URL you want to PR to (`https://github.com/owner/repo`, `owner/repo`, …) → saved to `~/.dsh/storages/source-code-mgmt-pr-targets.json` (**not** the plugin directory); saved repos appear as removable chips and can be re-selected
|
|
64
|
-
- **AI PR-rule analysis**: fetches the target repo's README / CONTRIBUTING / PR template / package.json scripts and has the **DSH default model** figure out how to PR to that repo (e.g. awesome-dsh-plugin: create `data/plugins/<owner>__<repo>.yml`, regenerate the README, satisfy the `dsh.bundle`/commit-count/topic gates), producing a structured **step rule cached in the plugin directory `rules/<owner>__<repo>.json`** — the next PR to the same repo runs straight from cache, **no repeated AI spend**;「Re-analyze (ignore cache)」forces a fresh pass
|
|
65
|
-
- **AI PR-content generation**: fill in the plugin info (owner/repo, category, en/zh description) → AI builds the title + description + entry-file content from the rule template — **fully editable, never submitted directly**
|
|
66
|
-
- **Run PR**: executes the rule steps `fork → clone fork → add upstream → fetch → create branch → write entry → (regenerate README) → commit → push → create PR` (GitHub via `gh pr create`, Gitee via OpenAPI) with per-step logs and the PR link; working dir defaults to the default workspace
|
|
67
|
-
|
|
68
|
-
### ⑥ Publish npm package
|
|
69
|
+
### ⑤ Publish npm package
|
|
69
70
|
- Five-step wizard (run in the target directory): **① check registry** `npm config get registry` → **② view auth config** `npm config list` (auto-redacts token/auth/password) → **③ verify identity** `npm whoami` → **④ preview packed files** `npm pack --dry-run` (see exactly what would be published, nothing is packed or uploaded) → **⑤ publish** `npm publish`
|
|
71
|
+
- **Login and publish always use the official registry `https://registry.npmjs.org`**: even when your global npm config points at a mirror (e.g. `registry.npmmirror.com` — mirrors only sync, they do not accept publishes), `whoami` / `npm login` / `npm publish` all carry `--registry=https://registry.npmjs.org`; the status area shows a yellow "publishing uses the official registry" hint when a mirror is configured.
|
|
72
|
+
- **"Open terminal to run npm login" now spawns a terminal safely**: it first probes for a terminal that actually exists on PATH (`konsole` / `gnome-terminal` / xterm-family, etc.), attaches an `error` listener to every child, and uses `konsole --separate` on KDE — fixing the old bug where spawning a missing binary (e.g. no `x-terminal-emulator` on SteamOS) raised an uncaught async ENOENT that **crashed the dsh host process** (which looked like your `pnpm dsh web` terminal dying). When no terminal exists it returns explicit "run manually: <command>" guidance instead of pretending success.
|
|
70
73
|
- Publishing requires ticking「I've reviewed the above — confirm publishing to the npm registry」first, preventing accidental publishes
|
|
71
74
|
|
|
72
75
|
### Data loading timing (fetch on open, "refreshing…" indicator)
|
|
@@ -196,7 +199,7 @@ All routes are **loopback-only** (`sec-fetch-site` + Origin checks) — only the
|
|
|
196
199
|
- Optional explicit binary paths via env vars: `DSH_SCM_GIT` / `DSH_SCM_GH` / `DSH_SCM_SSH` / `DSH_SCM_SSH_KEYGEN`
|
|
197
200
|
- **SSH transport fix**: Git for Windows' bundled MSYS `ssh.exe` (`usr\bin\ssh.exe`) can fail with `couldn't create signal pipe, Win32 error 5` when spawned from a detached/agent process, breaking `git push`/`git pull`. The plugin injects `GIT_SSH` pointing at a working `ssh` (usually the system OpenSSH `C:\Windows\System32\OpenSSH\ssh.exe`) for git remote operations
|
|
198
201
|
- **Non-ASCII filename compatibility**: git's default `core.quotepath` prints paths with non-ASCII bytes as octal-escaped quoted strings (which display as garbled text). The plugin injects `-c core.quotepath=false` into every git invocation (raw UTF-8 output) and additionally unescapes any still-quoted paths via `parseGitPath()` — Chinese filenames display correctly in the changes list and in diff headers
|
|
199
|
-
- **One-click missing-tool install across platforms**:
|
|
202
|
+
- **One-click missing-tool install across platforms (since v1.15.0, adaptive & mostly sudo-free)**: GitHub CLI installs user-level on Linux/macOS (official binary → `~/.local/bin/gh`, no sudo); git/ssh on Linux use apt-get / dnf / pacman (passwordless sudo probed first, manual guidance otherwise); macOS uses brew or the Xcode Command Line Tools; Windows uses winget / built-in features (fallback choco/scoop). The install runs in a live progress dialog, and a one-click DSH restart is offered when the running host needs it. The native folder picker is Windows-only; on macOS/Linux paste the path into the input box instead
|
|
200
203
|
|
|
201
204
|
## Development
|
|
202
205
|
|
|
@@ -212,7 +215,18 @@ dsh plugin --profile web add link:$(pwd)
|
|
|
212
215
|
|
|
213
216
|
## Version history
|
|
214
217
|
|
|
215
|
-
### v1.
|
|
218
|
+
### v1.14.0 (current)
|
|
219
|
+
Per your request the **⑤ "Submit PR" feature has been removed**:
|
|
220
|
+
|
|
221
|
+
- **Front-end**: `lib/client.js` drops the whole `PrSection` (its render in the panel and the "⑤ Submit PR" mention in the panel intro), along with the now-unused `EN_DICT` PR keys.
|
|
222
|
+
- **Host**: `lib/index.js` removes the entire PR implementation — the `/pr/targets`, `/pr/rule`, `/pr/analyze`, `/pr/generate`, `/pr/execute` routes; `prAnalyzeFlow` / `prGenerateFlow` / `prExecuteFlow`; the PR-targets local store (`source-code-mgmt-pr-targets.json`); the PR-rule cache read/write under `rules/` (`readPrRule`/`writePrRule`, etc.); `parseRepoUrl`; `fillPrTemplate`; the safety checks (`safeEntryPath`/`safeRegenerateCommand`); `PRESET_PR_RULES` and the startup rule-seeding call.
|
|
223
|
+
- `llmComplete()` (the generic LLM helper) is kept — it is independent of PR and reusable.
|
|
224
|
+
- Version bumped 1.13.0 → 1.14.0; `package.json` description now drops "AI-assisted Pull Requests". The clone section (by-URL clone, local-exists detection) and ⑥ npm (empty-by-default dir) keep their v1.13.0 behavior unchanged.
|
|
225
|
+
- Scope: `lib/client.js` (refresh to apply), `lib/index.js` (restart dsh web).
|
|
226
|
+
|
|
227
|
+
> Note: the old `rules/awesome-dsh-plugin__awesome-dsh-plugin.json` preset is no longer referenced by any code — you may delete it or leave it (it doesn't affect anything).
|
|
228
|
+
|
|
229
|
+
### v1.13.0 (history)
|
|
216
230
|
Second feedback pass (④⑤⑥ interaction tightening):
|
|
217
231
|
|
|
218
232
|
- **④ "Already local" detection widened to registered dirs**: previously the clone list only checked under the currently-selected clone dir; if you switched the clone target elsewhere (e.g. the `workspace` dir) where a repo already existed, it still showed "cloneable". Now a new `localRepoExistsAnywhere()` checks the selected dir **plus every workspace / favorite dir registered by step ③** (from `~/.dsh/storages/workspace.json` + `source-code-mgmt-dirs.json`) — a repo present in any registered location is marked "Already local". Since clone success already records the destination into favorite dirs, "this location already has the repo" knowledge persists automatically and the list hits on it next time.
|
|
@@ -268,7 +282,7 @@ This release focuses on the changed-files preview experience and Chinese-filenam
|
|
|
268
282
|
- **Profile Bundle distribution — install = activate**: `dsh.bundle` changed from the bare string `"./lib/index.js"` to the object form `{ "patch": "./cordis.patch.yml" }`, with a new `cordis.patch.yml` (inserts the `source-code-mgmt` row). `dsh plugin --profile web add source-code-mgmt` now appends the package to `dsh.profile.bundles` and registers it into the Cordis loader tree automatically — **no manual `cordis.patch.yml` editing**. The「install ≠ activate」warning and the PowerShell activation script were removed from the README. Behavior is otherwise unchanged (same `lib/index.js` host half + `lib/client.js` browser half).
|
|
269
283
|
|
|
270
284
|
### v1.8.0 and earlier (history)
|
|
271
|
-
See the full Chinese changelog in [README.md](README.md#版本历史). Highlights of recent releases: push-staged button (v1.8.0), fetch-on-open with refreshing indicator (v1.7.0), header button + right panel when better-sidebar is absent (v1.6.0), one-click missing-tool install (v1.5.0), SSH key auto-detection (v1.4.0), local Git workflow — stage/unstage, custom commit message, branch switch, history with revert/cherry-pick, side-by-side diff (v1.3.0), adaptive entry + Gitee support (v1.1–1.2), first release (v1.0.0).
|
|
285
|
+
See the full Chinese changelog in [README.md](README.md#版本历史). Highlights of recent releases: npm-login terminal fix (no host crash) + official-registry publish (v1.15.1), adaptive sudo-free installs with live progress dialog and one-click DSH restart (v1.15.0), PR removal (v1.14.0), push-staged button (v1.8.0), fetch-on-open with refreshing indicator (v1.7.0), header button + right panel when better-sidebar is absent (v1.6.0), one-click missing-tool install (v1.5.0), SSH key auto-detection (v1.4.0), local Git workflow — stage/unstage, custom commit message, branch switch, history with revert/cherry-pick, side-by-side diff (v1.3.0), adaptive entry + Gitee support (v1.1–1.2), first release (v1.0.0).
|
|
272
286
|
|
|
273
287
|
## License
|
|
274
288
|
|
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
> [English](README.en.md) | 中文
|
|
4
4
|
|
|
5
|
-
> 版本:**v1.
|
|
5
|
+
> 版本:**v1.15.1** | 更新日志见文末「[版本历史](#版本历史)」
|
|
6
6
|
|
|
7
7
|
> **界面语言跟随 DSH 设置实时切换**:面板与 host 端消息自动使用 DSH 的语言(设置 → 通用 → 语言),中文 ↔ 英文即时生效,无需重启。
|
|
8
8
|
|
|
9
|
-
> DSH Web GUI 源代码管理插件:把「环境检查 → SSH 配置 → 代码上传推送 → 克隆仓库 →
|
|
9
|
+
> DSH Web GUI 源代码管理插件:把「环境检查 → SSH 配置 → 代码上传推送 → 克隆仓库 → 发布 npm 包」整合进「代码管理」面板,支持 GitHub / Gitee 双平台,一键管理代码仓库。
|
|
10
10
|
|
|
11
11
|
> 入口位置自适应:**已安装 [dsh-better-sidebar](https://github.com/omdsh-dev/DSH-better-sidebar) 时**,「代码管理」作为它侧边栏的一个新 Tab 页面出现(全新侧边栏 Tab);**未安装时**,「代码管理」按钮位于 DSH **右上角、常驻可见**——有会话时放在「Session 日志」旁边的右对齐列表里,无会话空态时改为一个固定在**右上角**的浮动按钮,点击后打开一个 **dsh-better-sidebar 外观的右侧集成面板**(推挤主内容区)。两种形态都复用同一套面板 UI。
|
|
12
12
|
|
|
@@ -19,13 +19,20 @@
|
|
|
19
19
|
|
|
20
20
|
> 检测只是激活时一次内存读取(`ctx.get('betterSidebar')`),零 I/O、零网络,不影响 DSH 启动速度;两种形态间自动切换。未安装 better-sidebar 时入口常驻右上角(有会话=Session 日志旁,空态=固定右上角浮动按钮),空态/新对话也可见。
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
面板分五步(①②③ 为核心三步,④⑤ 为新扩展板块,默认折叠按需展开):
|
|
23
23
|
|
|
24
24
|
### ① 环境检查
|
|
25
25
|
- 显示**操作系统**(美化名:`Windows` / `macOS` / `Linux`,对应底层 Node 平台标识 `win32` / `darwin` / `linux`)
|
|
26
26
|
- 自动检测 **Git**、**GitHub CLI** 是否安装及版本(如 `git version 2.55.0`、`gh version 2.97.0`)
|
|
27
27
|
- 检测 **SSH** 客户端是否可用(解析到可用 `ssh` 即显示「已找到」)
|
|
28
|
-
- **缺工具时给安装指引 +
|
|
28
|
+
- **缺工具时给安装指引 + 一键安装(按平台自适应、尽量免 sudo)**:某工具未找到时,该行显示「❌ 未安装」+「**复制安装命令**」+「**安装**」按钮:
|
|
29
|
+
- **GitHub CLI(Linux / macOS)**:**免 sudo 用户级安装**——从官方 GitHub Release 下载对应平台/架构的二进制包,解压后装到 `~/.local/bin/gh`(目录不存在会自动创建,全程不需要管理员权限);失败时自动回退系统包管理器。
|
|
30
|
+
- **Git(Linux)**:apt / dnf / pacman(自动带 `sudo -n`;**先探测 sudo 是否免密**,需要密码时不再盲目执行,而是给出「请在终端手动执行」的指引 + 完整命令)。**Git(macOS)**:brew,无 brew 时走 **Xcode 命令行工具**(`xcode-select --install`,系统自带安装,含 git/ssh)。
|
|
31
|
+
- **SSH(Windows)**:内置可选功能(需管理员);**SSH(Linux)**:apt / dnf / pacman 的 openssh-client(同上 sudo 探测);**macOS** 系统自带。
|
|
32
|
+
- **复制安装命令**与「安装」按钮**走同一套平台自适应逻辑**(不再固定显示 Windows 的 winget 命令)。
|
|
33
|
+
- **安装过程实时进度弹窗**:点「安装」后弹出进度窗口,逐步显示「查询最新版本 → 下载 → 解压 → 安装 → 清理」及实时输出;完成后显示成功/失败原因。
|
|
34
|
+
- **需要重启时提示并一键重启**:检测到安装后当前 host 进程无法立即识别(如 gh 装到了不在 PATH 的 `~/.local/bin`)时,弹窗提示并显示「**重启 DSH**」按钮——点击后 host 通过 detached 辅助进程按原启动命令自动拉起新进程(机制同 dsh-update),页面短暂断开后刷新即可;若 host 已能识别(如设置了 `DSH_SCM_GH` 或 `~/.local/bin` 在 PATH),则不打扰直接完成。
|
|
35
|
+
- 安装完成后自动重新检测。
|
|
29
36
|
|
|
30
37
|
### ② SSH 密钥与连接
|
|
31
38
|
- **平台选择**:下拉选择代码托管平台 **GitHub(默认)** / **Gitee**,决定下面的 SSH 配置写入与连接测试目标
|
|
@@ -65,14 +72,10 @@
|
|
|
65
72
|
- **克隆到目录**:可选目标父目录(默认 = DSH 默认工作区),不选即克隆到默认位置;克隆走 SSH URL(`git@github.com:…` / `git@gitee.com:…`),成功后自动加入自定义目录列表,③ 里可直接选中
|
|
66
73
|
- 列表里「本地已有」的仓库不可重复克隆,其余每个仓库一个「克隆」按钮
|
|
67
74
|
|
|
68
|
-
### ⑤
|
|
69
|
-
- **目标仓库记录到本地**:填写要提交 PR 的仓库网址(`https://github.com/owner/repo` / `owner/repo` 等)→ 记录到 `~/.dsh/storages/source-code-mgmt-pr-targets.json`(**不写入插件目录**);已记录仓库以标签展示、点选回填、可删除
|
|
70
|
-
- **AI 分析 PR 规则**:抓取目标仓库的 README / CONTRIBUTING / PR 模板 / package.json scripts,交给 DSH 默认模型**思考该仓库应如何 PR**(如 awesome-dsh-plugin 收录插件:新建 `data/plugins/<owner>__<repo>.yml`、重生成 README、满足 `dsh.bundle`/提交数/topic 等门槛),输出结构化的**步骤规则并缓存到插件目录 `rules/<owner>__<repo>.json`**——下次对同一仓库直接读缓存执行,**不再重复消耗 AI**;「重新分析(忽略缓存)」可强制重新思考
|
|
71
|
-
- **AI 生成 PR 内容**:填插件信息(owner/repo、分类、中英描述)→ AI 按规则模板生成标题 + 描述 + 条目文件内容,**生成后可自由修改,绝不直接提交**
|
|
72
|
-
- **执行 PR**:按规则步骤执行 `fork → 克隆 fork → 加 upstream → 拉取 → 建分支 → 写条目 → (重生成 README)→ 提交 → 推送 → 开 PR`(GitHub 走 `gh pr create`,Gitee 走 OpenAPI),逐步显示执行日志与 PR 链接;工作目录默认 = 默认工作区
|
|
73
|
-
|
|
74
|
-
### ⑥ 发布 npm 包(npm publish)
|
|
75
|
+
### ⑤ 发布 npm 包(npm publish)
|
|
75
76
|
- 五步向导(在目标目录执行):**① 确认源** `npm config get registry` → **② 查看认证配置** `npm config list`(自动脱敏 token/auth/password)→ **③ 验证身份** `npm whoami` → **④ 预览打包** `npm pack --dry-run`(先看会发布哪些文件,不真正打包发布)→ **⑤ 发布** `npm publish`
|
|
77
|
+
- **登录与发布固定走官方源 `https://registry.npmjs.org`**:即使你的全局 npm 配置是镜像源(如 `registry.npmmirror.com`——镜像只同步、不接受发布),`whoami` / `npm login` / `npm publish` 也统一带 `--registry=https://registry.npmjs.org`;状态区在检测到镜像配置时会黄色提示「发布将使用官方源」。
|
|
78
|
+
- **「打开终端执行 npm login」安全弹终端**:先探测系统真实存在的终端程序(`konsole` / `gnome-terminal` / `xterm` 系等),再 spawn(并挂 error 监听兜底)——修复了旧版 `spawn` 不存在二进制时异步 ENOENT 未捕获、**直接把 dsh host 进程打崩**的问题;KDE 下用 `konsole --separate` 开独立窗口,不与宿主所在终端实例纠缠。找不到终端时明确返回手动命令指引,不再假装成功。
|
|
76
79
|
- 发布前必须勾选「我已核对以上内容,确认发布到 npm registry」才可点「发布」,防止误操作
|
|
77
80
|
|
|
78
81
|
### 数据加载时机(打开时联网、显示刷新中)
|
|
@@ -150,7 +153,8 @@ dsh web
|
|
|
150
153
|
| 路由 | 方法 | 说明 |
|
|
151
154
|
|------|------|------|
|
|
152
155
|
| `/api/source-code-mgmt/env` | GET | 环境检查(git/gh 版本) |
|
|
153
|
-
| `/api/source-code-mgmt/install-tool` | POST | 一键安装缺失工具(body `tool`: `git`/`gh`/`ssh
|
|
156
|
+
| `/api/source-code-mgmt/install-tool` | POST | 一键安装缺失工具(body `tool`: `git`/`gh`/`ssh`,按平台自适应:gh 在 Linux/macOS 免 sudo 装到 `~/.local/bin`;git/ssh 走系统包管理器 / brew / Xcode CLT / winget;响应为 **NDJSON 事件流**:`step`/`out`/`result`,供进度弹窗实时展示) |
|
|
157
|
+
| `/api/source-code-mgmt/restart` | POST | 一键重启 dsh(detached helper 按原启动命令拉起新进程;严格 loopback + origin 同源校验;supervisor 托管时禁用) |
|
|
154
158
|
| `/api/source-code-mgmt/ssh` | GET | SSH 密钥 / config / gh 登录状态 |
|
|
155
159
|
| `/api/source-code-mgmt/gen-key` | POST | 生成 ed25519 密钥 |
|
|
156
160
|
| `/api/source-code-mgmt/write-config` | POST | 写入 SSH config(body `provider`: `github` 默认 / `gitee`) |
|
|
@@ -197,7 +201,7 @@ dsh web
|
|
|
197
201
|
- 如需手动指定二进制路径,可用环境变量覆盖:`DSH_SCM_GIT` / `DSH_SCM_GH` / `DSH_SCM_SSH` / `DSH_SCM_SSH_KEYGEN`
|
|
198
202
|
- **SSH 传输修复**:Git for Windows 自带的 MSYS `ssh.exe`(`usr\bin\ssh.exe`)在被 detached/agent 进程调用时可能报 `couldn't create signal pipe, Win32 error 5`,导致 `git push`/`git pull` 失败。插件执行 git 远程命令时会自动注入 `GIT_SSH` 指向解析到的可用 `ssh`(通常为系统 OpenSSH `C:\Windows\System32\OpenSSH\ssh.exe`),避免该问题。
|
|
199
203
|
- **中文文件名兼容**:git 默认 `core.quotepath` 会把含非 ASCII 字节的路径输出成八进制转义的引号串(显示为乱码)。插件对所有 git 调用统一注入 `-c core.quotepath=false`(直接输出原始 UTF-8 路径),并对仍带引号转义的路径做 `parseGitPath()` 反转义兜底——改动列表 / diff 里的中文文件名显示正常
|
|
200
|
-
-
|
|
204
|
+
- **缺工具一键安装跨平台(v1.15.0 起按平台自适应、尽量免 sudo)**:GitHub CLI 在 Linux/macOS 直接**免 sudo 用户级安装**(官方二进制 → `~/.local/bin/gh`,失败回退系统包管理器);git/ssh 在 Linux 走 apt-get / dnf / pacman(**先探测 sudo 免密**,需要密码时给出手动命令指引而非静默失败),macOS 走 brew / Xcode 命令行工具,Windows 走 winget / 内置功能(回退 choco/scoop)。安装过程有**实时进度弹窗**,需要重启时提供**一键重启 dsh**。SSH 密钥探测、本地 Git 工作流、并排 diff 等在三个平台行为一致;「浏览目录」的原生选择器仅 Windows 可用,macOS/Linux 上请在输入框直接填路径(可手动输入粘贴)。
|
|
201
205
|
|
|
202
206
|
## 开发
|
|
203
207
|
|
|
@@ -213,7 +217,38 @@ dsh plugin --profile web add link:$(pwd)
|
|
|
213
217
|
|
|
214
218
|
## 版本历史
|
|
215
219
|
|
|
216
|
-
### v1.
|
|
220
|
+
### v1.15.1(当前)
|
|
221
|
+
⑤ 发布 npm 包功能修复(v1.15.0 的补丁):
|
|
222
|
+
|
|
223
|
+
- **修复「打开终端执行 npm login」打崩 host**:旧实现 `spawn` 不存在的终端二进制(如 SteamOS 上没有 `x-terminal-emulator`)时,异步 ENOENT 错误无监听器被抛成未捕获异常,**直接把 dsh host 进程打崩**(表现:运行 `pnpm dsh web` 的终端跟着结束)。现改为先 `findTerminal()` 探测 PATH 中真实存在的终端(konsole / gnome-terminal / xterm 系等),并对每个 child 挂 `error` 监听器兜底——绝不再崩宿主。
|
|
224
|
+
- **KDE konsole 用 `--separate` 开独立窗口**:不与宿主所在的 konsole 实例纠缠;找不到任何终端时明确返回「请手动运行:<命令>」指引,不再假装打开成功。
|
|
225
|
+
- **npm 登录/发布固定走官方源**:`npm login` / `npm whoami` / `npm publish` 统一带 `--registry=https://registry.npmjs.org`(镜像源只同步、不接受发布);`npmStatus` 新增 `publishRegistry` / `mirrorConfigured`,面板在检测到镜像配置(如 npmmirror)时黄色提示「发布将使用官方源」;「复制登录命令」也同步为官方源版本。
|
|
226
|
+
- 变更范围:`lib/index.js`(需重启 dsh web)、`lib/client.js`(刷新即生效)。版本号 1.15.0 → 1.15.1。
|
|
227
|
+
|
|
228
|
+
### v1.15.0(历史)
|
|
229
|
+
一键安装全面升级:**平台自适应 + 尽量免 sudo + 实时进度 + 一键重启**。
|
|
230
|
+
|
|
231
|
+
- **修复「复制安装命令」在 Linux/macOS 上错误显示 winget**:客户端写死的 Windows 提示改为取 host `/env` 返回的 `installHints`(与「安装」按钮同一套平台自适应逻辑);非 Windows 且无可用方式时留空,不再误导。
|
|
232
|
+
- **GitHub CLI(Linux/macOS)改免 sudo 用户级安装**:`installCommand()` 对 gh 优先返回官方二进制下载脚本(查最新版本 → 按平台/架构下载 `gh_<ver>_linux_amd64` / `macOS_arm64` 等 → 解压 → 装到 `~/.local/bin/gh`),一键安装失败自动回退系统包管理器。`resolveBin` 新增 `~/.local/bin` 探测——**插件加载时即使 PATH 里没有该目录也能找到用户级 gh**(不再依赖改 PATH / 设环境变量)。
|
|
233
|
+
- **sudo 免密探测(Linux)**:`canSudo()` 用 `sudo -n true` 探测;需要密码时**不再盲目执行**(`-n` 必然失败),返回「请在终端手动执行:<命令>」指引 + 原因,配合复制按钮即可完成。
|
|
234
|
+
- **macOS 兜底**:git/ssh 无 brew 时走 **Xcode 命令行工具**(`xcode-select --install`,系统自带安装、含 git/ssh),弹窗以「⏳ 已触发,按系统提示完成后点重新检查」呈现。
|
|
235
|
+
- **安装后实测复查**:`toolInstalled()` 改为按当前 PATH/落点直接探测(git/ssh 走 `--version`、gh 走 `~/.local/bin` 优先),**不再依赖模块加载时缓存的历史解析结果**——装完立即识别,修掉「装好了还报失败」的隐患。
|
|
236
|
+
- **安装进度弹窗**:`/install-tool` 改为 **NDJSON 事件流**(`step`/`out`/`result`,`runLive()` spawn 流式转发),浏览器端 `jpostStream()` 逐行消费;弹窗逐步显示「▶ 查询最新版本 → 下载 → 解压 → 安装 → 清理」与实时输出尾部。
|
|
237
|
+
- **需要重启时提示 + 一键重启**:`restartNeededFor()` 智能判定(`DSH_SCM_GH` 显式指定或 `~/.local/bin` 在 PATH 时无需重启);需要时弹窗显示「**重启 DSH**」按钮——新增 `POST /restart` 路由(机制同 dsh-update:detached helper 等端口释放后按原启动命令拉起新进程,POSIX detached spawn / Windows PowerShell 隐藏窗口;严格 loopback + origin 同源校验;systemd supervisor 托管或 `DSH_SCM_RESTART=0` 时禁用),点击后页面短暂断开、新进程自动起来。
|
|
238
|
+
- 变更范围:`lib/index.js`(需重启 dsh web)、`lib/client.js`(刷新即生效)。版本号 1.14.0 → 1.15.0。
|
|
239
|
+
|
|
240
|
+
### v1.14.0(历史)
|
|
241
|
+
按你的要求**移除了 ⑤「提交 PR」功能**:
|
|
242
|
+
|
|
243
|
+
- **前端**:`lib/client.js` 删除整个 `PrSection`(含 ⑤ 区块的渲染与面板导语中的「⑤提交 PR」文案),一并清理了对应的 i18n 键(`EN_DICT`)。
|
|
244
|
+
- **host**:`lib/index.js` 删除整套 PR 实现——`/pr/targets`、`/pr/rule`、`/pr/analyze`、`/pr/generate`、`/pr/execute` 五个路由,`prAnalyzeFlow` / `prGenerateFlow` / `prExecuteFlow`,PR 目标仓库本地存储(`source-code-mgmt-pr-targets.json`)、PR 规则缓存读写(`rules/` 下的 `readPrRule`/`writePrRule` 等)、`parseRepoUrl`、`fillPrTemplate`、安全校验(`safeEntryPath` / `safeRegenerateCommand`)、`PRESET_PR_RULES` 与启动时的规则预置写入。
|
|
245
|
+
- 保留 `llmComplete()` 这一通用 LLM 调用助手(与 PR 无关,属可复用能力,本轮暂未用到可直接忽略)。
|
|
246
|
+
- 版本号 1.13.0 → 1.14.0;`package.json` 描述同步去掉「AI-assisted Pull Requests」。克隆板块的「按地址克隆」「本地已有判定」与 ⑥ npm(默认空目录)等仍保持 v1.13.0 行为不变。
|
|
247
|
+
- 变更范围:`lib/client.js`(刷新即生效)、`lib/index.js`(需重启 dsh web)。
|
|
248
|
+
|
|
249
|
+
> 说明:`rules/` 目录下旧预置文件 `rules/awesome-dsh-plugin__awesome-dsh-plugin.json` 已不再被任何代码引用,可自行删除或保留(不影响功能)。
|
|
250
|
+
|
|
251
|
+
### v1.13.0(历史)
|
|
217
252
|
按第二轮反馈继续精化(④⑤⑥ 三处交互收敛):
|
|
218
253
|
|
|
219
254
|
- **④「本地已有」判定扩大到已登记的目录**:此前克隆列表只在「当前选中的克隆目录」下判定本地是否已有,用户若把克隆目录切到别处(如工作区 `workspace`),明明已存在的仓库仍标「可克隆」。现在新增 `localRepoExistsAnywhere()`:除了当前选中目录,还会遍历 ③ 代码管理登记过的**所有工作区 / 自定义目录**(`~/.dsh/storages/workspace.json` + `source-code-mgmt-dirs.json`)逐一判定——任一被登记的位置已有同名仓库即标「本地已有」;克隆成功后目标目录本就会记入自定义目录,因此「某位置已有该仓库」的知识会自动沉淀下来,下次列表直接命中。
|