@gluztm/dsh-guard 0.0.0-stage → 2.4.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 ADDED
@@ -0,0 +1,64 @@
1
+ # @gluztm/dsh-guard — Official Companion Plugin for DSHGuard
2
+
3
+ > **💡 Want the Full Windows Desktop Control Shell? (Companion + Desktop Pairing)**
4
+ >
5
+ > This plugin is the **cross-platform read-only companion** inside DSH (Web UI right sidebar, Agent tools, and `/guard` command). Full write-side features — **1-click service start/stop, 40+ plugin toggles, CC Switch credential & model library hub, and pre-write backup snapshots with 1-click rollback** — live in the desktop app **[DSHGuard (`DSHGuard.exe`)](https://github.com/gluztm/DSHGuard)**:
6
+ > - **[📥 Direct Download Windows Installer `DSHGuard-Setup-2.4.1.exe` (Non-Admin · Bundled Runtime Wizard)](https://github.com/gluztm/DSHGuard/releases/download/2.4.1/DSHGuard-Setup-2.4.1.exe)**
7
+ > - When `DSHGuard.exe` is installed on Windows, the sidebar automatically switches to a **1-click Launch DSHGuard** button; otherwise it surfaces a direct installer download card.
8
+ >
9
+ > <p align="center">
10
+ > <img src="../../docs/screenshots/241-companion-sidebar.png" alt="DSHGuard Companion 2.4.1 Sidebar Preview (Dark Missing-EXE Guide / Credentials Audit / Light Installed Snapshots)" width="100%" />
11
+ > </p>
12
+ > <p align="center">
13
+ > <img src="../../docs/screenshots/240-showcase.gif" alt="DSHGuard Desktop Showcase" width="100%" />
14
+ > </p>
15
+
16
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](../../LICENSE)
17
+ [![DSH Bundle](https://img.shields.io/badge/DSH%20Plugin-Web%20%2B%20Backend-10B981?style=flat-square)](#install-into-dsh)
18
+
19
+ [简体中文](README.md) · [DSHGuard Main Repository](../../README.en.md)
20
+
21
+ `@gluztm/dsh-guard` is the official read-only companion plugin for **[DSHGuard](https://github.com/gluztm/DSHGuard)**. It brings a native **DSH Web UI sidebar panel**, **3 read-only Agent tools**, a **`/guard` slash command**, and a **standalone CLI** that work cross-platform across Windows, macOS, and Linux:
22
+
23
+ - **Web UI Sidebar & Extension Panel (`lib/client.js`)**: Adapts cleanly to DSH light/dark themes (`--dsw-alias-*` tokens) with an inline EN/ZH toggle:
24
+ - **Dual-Track Manifest Audit**: Checks Web and Desktop `package.json` (`dsh.bundles` vs. `dependencies`), disabled entries, and `cordis.patch.yml` YAML integrity.
25
+ - **Masked Credential Readiness (Zero Secret Read)**: Verifies whether `apiKeyEnv` keys referenced in `cordis.patch.yml` are non-empty inside `.credentials.yaml` — **without ever reading, slicing, logging, or returning secret values**.
26
+ - **Pre-Change Snapshot History**: Lists recent DSHGuard pre-change snapshots stored under `~/.dsh-guard/snapshots/`.
27
+ - **Windows Supervisor Bridge**: On Windows, launches local out-of-band `DSHGuard.exe` in one click for crash rescue, snapshot rollback, or CC Switch import; on macOS/Linux (or when not yet installed), points cleanly to the official GitHub Releases download.
28
+ - **Agent Tools & `/guard` Command**:
29
+ - `dsh_guard_status`: Read-only health check and diagnostics across Web & Desktop tracks
30
+ - `dsh_guard_snapshots`: Pre-change snapshot listing filtered by track
31
+ - `dsh_guard_open`: Locate or launch local Windows `DSHGuard.exe`, or return the official release link
32
+ - `/guard [status|snapshots|open]`: Quick slash-command access
33
+
34
+ > Scoped package note: the unscoped name `dsh-guard` is already taken by another author on npm, so this official companion package uses `@gluztm/dsh-guard` and distributes signed release `.tgz` tarballs directly via [GitHub Release 2.4.1](https://github.com/gluztm/DSHGuard/releases/tag/2.4.1) alongside `DSHGuard-Setup-2.4.1.exe`.
35
+
36
+ ---
37
+
38
+ ## Install into DSH
39
+
40
+ ```powershell
41
+ # Add to DSH Web profile (Sidebar UI + Agent tools + /guard)
42
+ dsh plugin --profile web add https://github.com/gluztm/DSHGuard/releases/download/2.4.1/dsh-guard-2.4.1.tgz
43
+
44
+ # Add to DSH Desktop profile
45
+ dsh plugin --profile desktop add https://github.com/gluztm/DSHGuard/releases/download/2.4.1/dsh-guard-2.4.1.tgz
46
+
47
+ # Pair with the Windows Desktop Control Shell (Lifecycle / Credential Vault / Snapshots)
48
+ # https://github.com/gluztm/DSHGuard/releases/download/2.4.1/DSHGuard-Setup-2.4.1.exe
49
+ ```
50
+
51
+ ### Standalone CLI (Node.js >= 18)
52
+
53
+ ```powershell
54
+ node packages/dsh-guard/bin/dsh-guard.mjs status
55
+ node packages/dsh-guard/bin/dsh-guard.mjs snapshots --json
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Security & Read-Only Boundaries
61
+
62
+ - **Zero Secret Leakage**: Only inspects key names and empty/non-empty presence in `.credentials.yaml`. Secret values never enter tool responses, HTTP payloads, or logs.
63
+ - **Same-Origin Request Gating**: HTTP routes (`/api/dsh-guard/overview` and `/api/dsh-guard/open`) enforce DSH's `connection.requestRejection` check and never accept arbitrary filesystem path parameters from HTTP callers.
64
+ - **Strictly Read-Only**: Never mutates DSH profiles or third-party plugins. Config/plugin mutations, snapshot rollback, and CC Switch import remain isolated in the out-of-band Windows `DSHGuard.exe` supervisor.
package/README.md CHANGED
@@ -1,3 +1,68 @@
1
- # Temporary Holding Version
1
+ # @gluztm/dsh-guard — DSH 守护壳官方伴生插件
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **💡 想用完整图形化管控桌面端?(Windows 推荐搭配)**
4
+ >
5
+ > 本插件是 **跨平台只读伴生面板**(提供 Web 右侧栏双轨体检、Agent 工具与 `/guard` 命令);**一键启停服务、40+ 插件开关、CC Switch 凭据与模型库托管、写入前自动快照/一键回滚** 均由桌面端主体 **[DSHGuard (`DSHGuard.exe`)](https://github.com/gluztm/DSHGuard)** 提供:
6
+ > - **[📥 直链下载 Windows 安装包 `DSHGuard-Setup-2.4.1.exe`(免管理员 · 自带运行环境向导)](https://github.com/gluztm/DSHGuard/releases/download/2.4.1/DSHGuard-Setup-2.4.1.exe)**
7
+ > - 已安装 `DSHGuard` 时,侧边栏顶部会自动切换为 **「启动 DSHGuard」** 一键拉起按钮;未安装时直接展示直链下载卡。
8
+ >
9
+ > <p align="center">
10
+ > <img src="../../docs/screenshots/241-companion-sidebar.png" alt="DSHGuard 伴生插件 2.4.1 侧边栏三态预览(深色未安装引导 / 凭据就绪审计 / 浅色已安装快照)" width="100%" />
11
+ > </p>
12
+ > <p align="center">
13
+ > <img src="../../docs/screenshots/240-showcase.gif" alt="DSHGuard 桌面端总览" width="100%" />
14
+ > </p>
15
+
16
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](../../LICENSE)
17
+ [![DSH Bundle](https://img.shields.io/badge/DSH%20Plugin-Web%20%2B%20Backend-10B981?style=flat-square)](#安装到-dsh)
18
+
19
+ [English](README.en.md) · [DSHGuard 主仓主页](../../README.md)
20
+
21
+ `@gluztm/dsh-guard` 是 **[DSHGuard(DSH 守护壳)](https://github.com/gluztm/DSHGuard)** 的官方只读伴生插件,兼顾 **DSH Web UI 侧边栏可视化面板**、**Agent 只读工具**、**/guard 聊天命令** 与 **独立体检 CLI**,跨平台(Windows / macOS / Linux)均可使用:
22
+
23
+ - **Web UI 右侧栏 / 面板(`lib/client.js`)**:安装后自动出现在 DSH 右侧工具栏与扩展面板中,深浅色主题自适应(`--dsw-alias-*` 令牌)且支持一键中/英切换:
24
+ - **Web / 桌面双轨配置对账**:检查 `package.json` 依赖清单与 `dsh.bundles` 漂移、禁用插件数及 `cordis.patch.yml` YAML 语法完整度;
25
+ - **凭据脱敏就绪度(零秘密读取)**:仅核对 `.credentials.yaml` 中的键是否非空、是否覆盖 `cordis.patch.yml` 引用的 `apiKeyEnv`,**绝不读取、截断或传输任何真实密钥内容**;
26
+ - **变更前快照历史**:展示本机 `~/.dsh-guard/snapshots/` 下的最近预检与操作前快照;
27
+ - **守护壳联动**:在 Windows 本机可一键唤起进程外 `DSHGuard.exe`(执行崩溃救援、快照回滚、8 套模型预设与 CC Switch 导入);在 macOS / Linux 或未安装桌面壳时显示 GitHub Releases 官方下载指引。
28
+ - **Agent 只读工具 & `/guard` 命令**:
29
+ - `dsh_guard_status`:跨 Web / 桌面双轨的只读体检与诊断建议
30
+ - `dsh_guard_snapshots`:读取按端分类的变更前快照列表
31
+ - `dsh_guard_open`:定位或唤起本机 Windows `DSHGuard.exe`(未安装时返回官方下载链接)
32
+ - `/guard [status|snapshots|open]`:聊天内直达命令
33
+
34
+ > 为什么包名是 `@gluztm/dsh-guard`?因为无作用域名称 `dsh-guard` 在 npm 上已被其他作者占用,为避免社区清单路由冲突,伴生插件统一采用 `@gluztm/dsh-guard` 命名并随 [GitHub Release 2.4.1](https://github.com/gluztm/DSHGuard/releases/tag/2.4.1) 直接分发签名 `.tgz` 安装包;桌面端安装包 `DSHGuard-Setup-2.4.1.exe` 亦在同一 Release 页分发。
35
+
36
+ ---
37
+
38
+ ## 安装到 DSH
39
+
40
+ ### 方式 A:通过 `awesome-dsh-plugin` 插件市场(推荐)
41
+
42
+ 在 DSH 桌面端 / Web 端「插件市场」搜索 **`@gluztm/dsh-guard`** 一键安装,或在终端直接从 GitHub Release 安装:
43
+
44
+ ```powershell
45
+ # 安装到 DSH Web 版(包含右侧栏面板 + 工具 + /guard)
46
+ dsh plugin --profile web add https://github.com/gluztm/DSHGuard/releases/download/2.4.1/dsh-guard-2.4.1.tgz
47
+
48
+ # 同步安装到 DSH 桌面版
49
+ dsh plugin --profile desktop add https://github.com/gluztm/DSHGuard/releases/download/2.4.1/dsh-guard-2.4.1.tgz
50
+
51
+ # 配套安装 Windows 完整桌面端管控壳(含启停/凭据保险箱/自动快照回滚)
52
+ # https://github.com/gluztm/DSHGuard/releases/download/2.4.1/DSHGuard-Setup-2.4.1.exe
53
+ ```
54
+
55
+ ### 方式 B:从源码子包本地运行只读 CLI(Node.js >= 18)
56
+
57
+ ```powershell
58
+ node packages/dsh-guard/bin/dsh-guard.mjs status
59
+ node packages/dsh-guard/bin/dsh-guard.mjs snapshots --json
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 隐私与安全边界
65
+
66
+ - **严格零秘密泄露**:插件仅检查 `.credentials.yaml` 中的环境键名与是否非空,从不读取、切片、打印或通过 HTTP/工具返回值输出任何 API Key、Token 或完整配置文件原文。
67
+ - **同源校验鉴权**:服务端暴露的 `/api/dsh-guard/overview` 与 `/api/dsh-guard/open` 路由复用 DSH 的 `connection.requestRejection` 校验,仅使用服务端 `DSH_HOME` / `DSHGUARD_HOME` 环境变量路径,不接受外部路径参数。
68
+ - **只读原则**:本插件不会改写 DSH 配置、卸载或更新第三方插件;所有高风险变更(装卸更新、快照回滚、CC Switch 多源导入)均交由进程外的 Windows 桌面壳 `DSHGuard.exe` 先自动存档后隔离执行。
Binary file
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ formatHealthText,
4
+ formatSnapshotsText,
5
+ inspectHealth,
6
+ inspectSnapshots,
7
+ openGuard,
8
+ } from '../lib/inspector.mjs'
9
+
10
+ function parseArgs(argv) {
11
+ const args = argv.slice(2)
12
+ let command = 'status'
13
+ let dshHome = null
14
+ let guardHome = null
15
+ let snapshotsDir = null
16
+ let target = 'all'
17
+ let limit = 20
18
+ let launch = false
19
+ let json = false
20
+ let help = false
21
+
22
+ for (let i = 0; i < args.length; i++) {
23
+ const a = args[i]
24
+ if (a === '--help' || a === '-h') help = true
25
+ else if (a === '--json') json = true
26
+ else if (a === '--launch') launch = true
27
+ else if (a === '--dsh-home' && i + 1 < args.length) dshHome = args[++i]
28
+ else if (a === '--guard-home' && i + 1 < args.length) guardHome = args[++i]
29
+ else if (a === '--snapshots-dir' && i + 1 < args.length) snapshotsDir = args[++i]
30
+ else if (a === '--target' && i + 1 < args.length) target = args[++i]
31
+ else if (a === '--limit' && i + 1 < args.length) limit = Number(args[++i]) || 20
32
+ else if (!a.startsWith('-')) command = a
33
+ }
34
+
35
+ return { command, dshHome, guardHome, snapshotsDir, target, limit, launch, json, help }
36
+ }
37
+
38
+ const opts = parseArgs(process.argv)
39
+
40
+ if (opts.help) {
41
+ console.log([
42
+ 'dsh-guard — Companion read-only inspector & snapshot bridge for DSHGuard',
43
+ '',
44
+ 'Usage:',
45
+ ' dsh-guard status [--target all|web|desktop] [--dsh-home <dir>] [--guard-home <dir>] [--json]',
46
+ ' dsh-guard snapshots [--target all|web|desktop] [--limit N] [--guard-home <dir>] [--json]',
47
+ ' dsh-guard open [--launch] [--guard-home <dir>] [--json]',
48
+ ].join('\n'))
49
+ process.exit(0)
50
+ }
51
+
52
+ if (opts.command === 'snapshots') {
53
+ const report = inspectSnapshots(opts)
54
+ console.log(opts.json ? JSON.stringify(report, null, 2) : formatSnapshotsText(report))
55
+ process.exit(0)
56
+ }
57
+
58
+ if (opts.command === 'open') {
59
+ const res = openGuard(opts)
60
+ console.log(opts.json ? JSON.stringify(res, null, 2) : res.message)
61
+ process.exit(0)
62
+ }
63
+
64
+ const health = inspectHealth(opts)
65
+ console.log(opts.json ? JSON.stringify(health, null, 2) : formatHealthText(health))
66
+ process.exit(0)
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: dsh-guard
3
+ name: "@gluztm/dsh-guard"