@woosau/dsh-custom-env 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ownduck
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,133 @@
1
- # Temporary Holding Version
1
+ # dsh-custom-env
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
+ English | [中文](README.zh-CN.md)
4
+
5
+ Community DeepSeek Harness (DSH) plugin for managing `$DSH_HOME/.env` from **Settings → Environment**. Not an official DeepSeek AI product.
6
+
7
+ On save, values are applied to the Host `process.env` immediately and synced to the **Windows / macOS** user environment (new terminals pick up OS changes after they start). Linux user-env sync is not supported.
8
+
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
10
+ [![DSH plugin](https://img.shields.io/badge/DSH-plugin-0f766e.svg)](https://github.com/ownduck/dsh-custom-env)
11
+
12
+ ## Features
13
+
14
+ - Settings page CRUD for `$DSH_HOME/.env` (create the file if missing)
15
+ - Hot-apply to the current Host process
16
+ - Sync to OS user environment on Windows and macOS
17
+ - Rejects bootstrap names (`PATH`, `DSH_*`, `XDG_*`, …) that app-boot will not load from `.env`
18
+ - **dsh command panel**: shows the `dsh` on your user PATH vs the launcher that started this Host; when they differ, an **Install** button appears (Windows user PATH / macOS `/usr/local/bin/dsh`). No uninstall button.
19
+
20
+ ## Prerequisites
21
+
22
+ - A working DeepSeek Harness install with `dsh` on your PATH (CLI or Desktop-bundled CLI)
23
+ - Pick a profile: `desktop` (Electron app) or `web` (browser UI). Examples below show both.
24
+
25
+ ## Installation
26
+
27
+ This repository ships a ready-to-run `lib/`. You do **not** need to publish to npmjs to install from GitHub.
28
+
29
+ ### Desktop (recommended)
30
+
31
+ Close Desktop / VertaxWork first if `plugin` fails with `EPERM` on the profile `package.json`.
32
+
33
+ ```powershell
34
+ dsh plugin --profile desktop add github:ownduck/dsh-custom-env
35
+ ```
36
+
37
+ This plugin depends on `koffi` (native). If pnpm blocks its install script, add to the profile’s `pnpm-workspace.yaml`, then re-run `add`:
38
+
39
+ ```yaml
40
+ allowBuilds:
41
+ koffi: true
42
+ ```
43
+
44
+ Restart Desktop. Open **Settings → Environment**.
45
+
46
+ ### Web
47
+
48
+ ```powershell
49
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
50
+ $OutputEncoding = [System.Text.Encoding]::UTF8
51
+ dsh plugin --profile web add github:ownduck/dsh-custom-env
52
+ dsh --profile web --dump-config
53
+ ```
54
+
55
+ Equivalent: `dsh plugin --profile web add https://github.com/ownduck/dsh-custom-env.git`
56
+
57
+ The dump should contain a `# == dsh-custom-env` layer and a `custom-env` plugin row. Restart DSH Web and hard-refresh the browser.
58
+
59
+ ### Ask an agent to install it
60
+
61
+ ```text
62
+ Install the DSH plugin github:ownduck/dsh-custom-env into my local desktop profile by running: dsh plugin --profile desktop add github:ownduck/dsh-custom-env. If pnpm reports ignored build scripts for koffi, add allowBuilds.koffi: true under the profile pnpm-workspace.yaml and re-run add. Then confirm Settings → Environment appears after restarting Desktop.
63
+ ```
64
+
65
+ ### From a local clone (`file:` / `.`)
66
+
67
+ ```powershell
68
+ git clone https://github.com/ownduck/dsh-custom-env.git
69
+ cd dsh-custom-env
70
+ dsh plugin --profile desktop add .
71
+ # or: dsh plugin --profile web add .
72
+ dsh --profile web --dump-config
73
+ ```
74
+
75
+ ### From npm (optional, after publish)
76
+
77
+ ```powershell
78
+ dsh plugin --profile desktop add @woosau/dsh-custom-env@latest --registry=https://registry.npmjs.org/
79
+ ```
80
+
81
+ ## Uninstall / reinstall
82
+
83
+ ```powershell
84
+ dsh plugin --profile desktop remove @woosau/dsh-custom-env
85
+ dsh plugin --profile desktop add github:ownduck/dsh-custom-env
86
+ ```
87
+
88
+ For a `file:` / local checkout, rebuild `lib/` after source changes, then restart DSH. Re-run `plugin add` only when `package.json` or `cordis.patch.yml` changed.
89
+
90
+ ## Usage
91
+
92
+ 1. Open **Settings → Environment**
93
+ 2. Edit as a **draft**: **Confirm** writes `$DSH_HOME/.env` (and Host/OS live); **Cancel** only reverts the input
94
+ 3. After Confirm, rows show a restart tip — **new** items say “added”; **modified** items (relative to Host start) also get **Restore** (writes back the Host-start value)
95
+ 4. Restart DSH / open a new terminal for the full OS effect; after Host restart, tips and Restore clear
96
+ 5. In the **dsh command** block, compare PATH vs expected; click **Install** only when offered
97
+
98
+ Do not store bootstrap names in `.env` (including `PATH`). Prefer ordinary names for app config. Names containing `KEY` / `SECRET` / `TOKEN` remain scrubbed from model-visible shells by existing harness policy.
99
+
100
+ ### Installing the `dsh` CLI from Settings
101
+
102
+ Expected path is inferred from **how this Host was started** (Desktop packaged `resources/runtime/cli/bin`, or the Node/source launcher on `argv`).
103
+
104
+ | Platform | What Install does | Conflict note |
105
+ | --- | --- | --- |
106
+ | **Windows** | Prepends the expected bin directory to the **user** `Path` (registry). Ownership key: `Software\dsh-custom-env\Command` (not DeepSeekHarness). | Can coexist with Desktop’s PATH entry; whichever directory is first wins in new terminals. |
107
+ | **macOS** | Writes symlink `/usr/local/bin/dsh` → expected launcher. Receipt: `.dsh-custom-env-command.json`. | **Same path as Desktop “Manage dsh Command…”** — installing here may replace that link. |
108
+ | **Linux** | Status only; no Install button. | — |
109
+
110
+ Open a **new** terminal after Install. This plugin never calls Desktop `app.relaunch`.
111
+
112
+ ## Development
113
+
114
+ ```powershell
115
+ cd dsh-custom-env
116
+ pnpm test # or: node --import tsx/esm --test tests/*.spec.ts
117
+ pnpm build # rebuilds lib/ (needs sibling vertax-work esbuild for client bundle)
118
+ ```
119
+
120
+ Tests live under [`tests/`](tests/) (`env-file.spec.ts`, `cli-path.spec.ts`). Docs are this README pair only.
121
+
122
+ ## GitHub vs npmjs
123
+
124
+ | Channel | Enough for users? | Install command |
125
+ | --- | --- | --- |
126
+ | **GitHub only** | Yes | `dsh plugin add github:ownduck/dsh-custom-env` |
127
+ | **npmjs** | Optional | `dsh plugin add @woosau/dsh-custom-env` |
128
+
129
+ Pushing to GitHub is enough to share and install. Publishing to npmjs is optional convenience (shorter name, version tags, npm badges), similar to community plugins that also publish `@scope/name` on the registry.
130
+
131
+ ## License
132
+
133
+ MIT
@@ -0,0 +1,133 @@
1
+ # dsh-custom-env
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 社区维护的 DeepSeek Harness(DSH)插件:在 **设置 → 环境变量** 中管理 `$DSH_HOME/.env`。非 DeepSeek AI 官方产品。
6
+
7
+ 保存后立即写入 Host 的 `process.env`,并在 **Windows / macOS** 同步到用户环境(新开终端才能看到 OS 侧变更)。不同步 Linux 用户环境。
8
+
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
10
+ [![DSH plugin](https://img.shields.io/badge/DSH-plugin-0f766e.svg)](https://github.com/ownduck/dsh-custom-env)
11
+
12
+ ## 功能
13
+
14
+ - 设置页对 `$DSH_HOME/.env` 增删改(文件不存在时自动创建)
15
+ - 热写到当前 Host 进程
16
+ - Windows / macOS 用户环境同步
17
+ - 拒绝 bootstrap 名(`PATH`、`DSH_*`、`XDG_*` 等),与 app-boot 对 `.env` 的限制一致
18
+ - **dsh 命令**区块:展示用户 PATH 上的 `dsh` 与启动本 Host 的期望启动器;不一致时显示 **安装** 按钮(Windows 用户 PATH / macOS `/usr/local/bin/dsh`)。无卸载按钮。
19
+
20
+ ## 前置条件
21
+
22
+ - 已安装可用的 DeepSeek Harness,且终端里能运行 `dsh`(CLI 或 Desktop 自带 CLI)
23
+ - 选择 profile:`desktop`(Electron)或 `web`(浏览器)。下文两种都有。
24
+
25
+ ## 安装
26
+
27
+ 本仓库已包含可运行的 `lib/`。**不发 npmjs 也能从 GitHub 安装。**
28
+
29
+ ### Desktop(推荐)
30
+
31
+ 若 `plugin` 报 profile `package.json` 的 `EPERM`,先退出 Desktop / VertaxWork。
32
+
33
+ ```powershell
34
+ dsh plugin --profile desktop add github:ownduck/dsh-custom-env
35
+ ```
36
+
37
+ 本插件依赖原生包 `koffi`。若 pnpm 拦截其 install 脚本,在该 profile 的 `pnpm-workspace.yaml` 中加入后重新 `add`:
38
+
39
+ ```yaml
40
+ allowBuilds:
41
+ koffi: true
42
+ ```
43
+
44
+ 重启 Desktop,打开 **设置 → 环境变量**。
45
+
46
+ ### Web
47
+
48
+ ```powershell
49
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
50
+ $OutputEncoding = [System.Text.Encoding]::UTF8
51
+ dsh plugin --profile web add github:ownduck/dsh-custom-env
52
+ dsh --profile web --dump-config
53
+ ```
54
+
55
+ 等价:`dsh plugin --profile web add https://github.com/ownduck/dsh-custom-env.git`
56
+
57
+ 配置输出中应出现 `# == dsh-custom-env` 层和 `custom-env` 插件行。然后重启 DSH Web,并在浏览器硬刷新。
58
+
59
+ ### 让 Agent 帮你安装
60
+
61
+ ```text
62
+ 请将 DSH 插件 github:ownduck/dsh-custom-env 安装到本机 desktop profile,执行:dsh plugin --profile desktop add github:ownduck/dsh-custom-env。若 pnpm 提示忽略 koffi 的 build scripts,在该 profile 的 pnpm-workspace.yaml 中加入 allowBuilds.koffi: true 后重新 add。重启 Desktop 后确认「设置 → 环境变量」可用。
63
+ ```
64
+
65
+ ### 从本地克隆安装(`file:` / `.`)
66
+
67
+ ```powershell
68
+ git clone https://github.com/ownduck/dsh-custom-env.git
69
+ cd dsh-custom-env
70
+ dsh plugin --profile desktop add .
71
+ # 或:dsh plugin --profile web add .
72
+ dsh --profile web --dump-config
73
+ ```
74
+
75
+ ### 从 npm 安装(可选,发布后)
76
+
77
+ ```powershell
78
+ dsh plugin --profile desktop add @woosau/dsh-custom-env@latest --registry=https://registry.npmjs.org/
79
+ ```
80
+
81
+ ## 卸载 / 重装
82
+
83
+ ```powershell
84
+ dsh plugin --profile desktop remove @woosau/dsh-custom-env
85
+ dsh plugin --profile desktop add github:ownduck/dsh-custom-env
86
+ ```
87
+
88
+ 本地 `file:` 开发:改 `src` 后重建 `lib/`,再重启 DSH。只有改了 `package.json` / `cordis.patch.yml` 才需要重新 `plugin add`。
89
+
90
+ ## 使用
91
+
92
+ 1. 打开 **设置 → 环境变量**
93
+ 2. **草稿编辑**:点 **确定** 才写入 `$DSH_HOME/.env`(并热写 Host/OS);**取消** 只恢复输入框
94
+ 3. 确定后行旁提示需重启——**新增**标为新增项;相对 Host 启动值的 **修改** 另有 **恢复**(写回启动时的值)
95
+ 4. 完整生效请重启 DSH / 新开终端;Host 重启后提示与恢复按钮消失
96
+ 5. 在 **dsh 命令**区块对比 PATH 与期望路径;仅在出现按钮时点击 **安装**
97
+
98
+ 不要把 bootstrap 名(含 `PATH`)写进 `.env`。应用配置用普通名字即可。名称含 `KEY` / `SECRET` / `TOKEN` 时仍会被现有 harness 策略从模型可见 shell 中 scrub。
99
+
100
+ ### 在设置页安装 `dsh` CLI
101
+
102
+ 期望路径由 **当前 Host 的启动方式** 推断(Desktop 打包的 `resources/runtime/cli/bin`,或 Node/源码启动的 `argv` 启动器)。
103
+
104
+ | 平台 | 安装行为 | 冲突说明 |
105
+ | --- | --- | --- |
106
+ | **Windows** | 将期望 bin 目录写入用户 `Path`(注册表)。所有权键:`Software\dsh-custom-env\Command`(不用 DeepSeekHarness)。 | 可与 Desktop 的 PATH 条目并存;新终端里谁排前用谁。 |
107
+ | **macOS** | 写符号链接 `/usr/local/bin/dsh` → 期望启动器。收据:`.dsh-custom-env-command.json`。 | **与 Desktop「管理 dsh 命令…」同一路径**,可能覆盖其链接。 |
108
+ | **Linux** | 仅展示状态,无安装按钮。 | — |
109
+
110
+ 安装后请 **新开** 终端。本插件不会调用 Desktop `app.relaunch`。
111
+
112
+ ## 开发
113
+
114
+ ```powershell
115
+ cd dsh-custom-env
116
+ pnpm test # 或:node --import tsx/esm --test tests/*.spec.ts
117
+ pnpm build # 重建 lib/(client 打包依赖旁路的 vertax-work esbuild)
118
+ ```
119
+
120
+ 测试在 [`tests/`](tests/)(`env-file.spec.ts`、`cli-path.spec.ts`)。文档即本 README 中英双语。
121
+
122
+ ## GitHub 与 npmjs
123
+
124
+ | 渠道 | 够不够用 | 安装命令 |
125
+ | --- | --- | --- |
126
+ | **只推 GitHub** | 够 | `dsh plugin add github:ownduck/dsh-custom-env` |
127
+ | **再发 npmjs** | 可选 | `dsh plugin add @woosau/dsh-custom-env` |
128
+
129
+ 推到 GitHub 即可分享与安装。发 npmjs 只是可选便利(短包名、版本号、徽章),与社区插件同时维护 GitHub + npm 的做法类似。
130
+
131
+ ## 许可证
132
+
133
+ MIT
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: custom-env
3
+ name: '@woosau/dsh-custom-env'