dsh-instructions-policy 0.6.0 → 0.6.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.
Files changed (3) hide show
  1. package/README.en.md +38 -29
  2. package/README.md +38 -29
  3. package/package.json +5 -2
package/README.en.md CHANGED
@@ -105,69 +105,73 @@ An "Instruction policy" menu appears to the left of the composer (next to the pe
105
105
 
106
106
  - DSH is installed and has been started at least once (`dsh --version` prints a version).
107
107
  - Node.js follows DSH: 0.2.2 requires ≥ 24.9, 0.2.1 requires `^22.19.0 || >=24.0.0`; defer to DSH's `engines`.
108
+ - `pnpm` is on `PATH`: `dsh plugin` forwards its arguments to pnpm in the profile directory.
108
109
  - DSH `>=0.2.1-rc.5 <1.0.0-0` (all 0.x releases are admitted; 1.0 and its prereleases need re-validation).
109
110
 
110
111
  ### Steps
111
112
 
112
- 1. Install the package into a profile (`web` is the default Web profile name):
113
+ 1. Install the plugin into a profile (`web` is the default Web profile name):
113
114
 
114
115
  ```sh
115
- # from npm
116
+ # from npm (recommended)
116
117
  dsh plugin --profile web add dsh-instructions-policy
117
- # from GitHub (replace <owner>/<repo> with the repository)
118
- dsh plugin --profile web add github:<owner>/<repo>
119
- # local development: link the repository directory
120
- dsh plugin --profile web add link:<path-to-repo>
118
+ # from GitHub (source install; see allowBuilds below for pnpm ≥10)
119
+ dsh plugin --profile web add github:Angel-Hair/dsh-instructions-policy
120
+ # local development: run this in the checkout
121
+ dsh plugin --profile web add link:.
121
122
  ```
122
123
 
123
- 2. Make the profile select this bundle. Edit `~/.dsh/profiles/web/package.json` (on Windows: `%USERPROFILE%\.dsh\profiles\web\package.json`) and add the package name to `dsh.profile.bundles`:
124
-
125
- ```json
126
- {
127
- "dsh": {
128
- "profile": {
129
- "bundles": [
130
- "@deepseek-ai/dsh-base",
131
- "@deepseek-ai/dsh-web-app",
132
- "dsh-instructions-policy"
133
- ]
134
- }
135
- }
136
- }
137
- ```
124
+ After a successful install DSH adds the dependency to `dsh.profile.bundles` automatically because the package declares `dsh.bundle.patch`; no manual `package.json` edit is needed. The Plugins page can confirm or toggle it.
138
125
 
139
- Once installed you can also enable it from the Plugins page (equivalent to writing `dsh.profile.bundles`).
126
+ A GitHub source install runs this package's `prepare` build, which pnpm ≥10 blocks for dependencies. If the first `add` fails with `ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED`, add the printed key to `allowBuilds` in `~/.dsh/profiles/web/pnpm-workspace.yaml` and rerun, or install from npm instead.
140
127
 
141
- 3. Restart `dsh web` and confirm the log line:
128
+ 2. Restart `dsh web` and confirm the log line:
142
129
 
143
130
  ```
144
131
  instructions-policy: redirecting @deepseek-ai/dsh-agent-instructions for N preset row(s)
145
132
  ```
146
133
 
147
- 4. Open any new task: the "Instruction policy" chip should appear at the left of the composer tool row; or run `/instructions show` to verify the project root and loaded files.
134
+ 3. Open any new task: the "Instruction policy" chip should appear at the left of the composer tool row; or run `/instructions show` to verify the project root and loaded files.
148
135
 
149
136
  After upgrading, restart `dsh web`; if the interface does not change, force-reload the browser with Ctrl+F5.
150
137
 
151
138
  ### Upgrade / uninstall
152
139
 
153
140
  ```sh
154
- # npm / GitHub install: upgrade
155
- dsh plugin --profile web update dsh-instructions-policy
141
+ # npm / GitHub install: upgrade to the latest version (including minor/major)
142
+ dsh plugin --profile web update --latest dsh-instructions-policy
156
143
 
157
144
  # link install: git pull in the repository, then restart dsh web
158
145
 
159
- # uninstall: remove the package name from dsh.profile.bundles first, then
146
+ # uninstall: removes the dependency and its dsh.profile.bundles entry
160
147
  dsh plugin --profile web remove dsh-instructions-policy
161
148
  ```
162
149
 
163
150
  After uninstalling, the redirect disappears and DSH returns to the default instruction loader; instruction messages already written to session logs stay in the history.
164
151
 
152
+ ## Optional manual acceptance
153
+
154
+ To confirm the plugin is actually taking effect, download the [acceptance fixture](https://github.com/Angel-Hair/dsh-instructions-policy/releases/latest/download/instructions-fixture.zip) and follow the steps below. (The plugin itself does not depend on this fixture.)
155
+
156
+ <details>
157
+ <summary>Expand the manual acceptance steps</summary>
158
+
159
+ 1. Extract it into a standalone directory. (The parent directory must not contain files that could interfere with the test, such as `.git` or `AGENTS.md`.)
160
+ 2. In DSH, create a new task and choose the `/sub` directory under the extracted `/instructions-fixture`.
161
+ 3. Send the sample instruction below to the **AI session in that workspace**, or follow the A–F scenarios in the packaged `VERIFY.md`. (**Setting the reasoning effort to Low/High is recommended to avoid unnecessary cost.**)
162
+
163
+ Sample instruction:
164
+
165
+ > This session is for testing the `dsh-instructions-policy` plugin and is currently a fresh session. Current settings: [root file on/off/custom], [user-global root file on/off], [subdirectory append on/off]. Please confirm whether the state is correct. (Note: you only need to report the state; you do not need to fully understand how the plugin works.)
166
+
167
+ </details>
168
+
165
169
  ## Configuration
166
170
 
167
171
  <details>
168
172
  <summary>Expand the configuration reference</summary>
169
173
 
170
- Defaults live in [cordis.patch.yml](cordis.patch.yml). To change them, override the row by `id` in `~/.dsh/profiles/<profile>/cordis.patch.yml`. **DSH replaces a row's `config` wholesale, with no deep merge**, so restate every field you need:
174
+ Defaults live in [cordis.patch.yml](cordis.patch.yml). To change them, override the row by `id` in `~/.dsh/profiles/web/cordis.patch.yml` (replace `web` with your profile); **DSH replaces a row's `config` wholesale, with no deep merge**, so restate every field you need:
171
175
 
172
176
  ```yaml
173
177
  - id: instructions-policy
@@ -211,12 +215,15 @@ Defaults live in [cordis.patch.yml](cordis.patch.yml). To change them, override
211
215
 
212
216
  ## Feedback
213
217
 
218
+ <details>
219
+ <summary>Expand the feedback</summary>
220
+
214
221
  The plugin ships no logging of its own: it keeps zero runtime dependencies and writes no files. Diagnostics go through DSH's logger to the terminal running `dsh web` (Cordis' console logger). There is no log directory under `~/.dsh`, and the session JSONL records session events only, not logger output — so the "logs" a report needs are those terminal lines.
215
222
 
216
223
  When filing an issue, include:
217
224
 
218
225
  - DSH version (`dsh --version`), plugin version (the profile `package.json` or `node_modules/dsh-instructions-policy/package.json`), and the OS.
219
- - The profile's `dsh.profile.bundles`, plus any line in `~/.dsh/profiles/<profile>/cordis.patch.yml` related to this plugin.
226
+ - The profile's `dsh.profile.bundles`, plus any line in `~/.dsh/profiles/web/cordis.patch.yml` (replace `web` with your profile) related to this plugin.
220
227
  - Every line containing `instructions-policy` in the terminal that started `dsh web` (`redirecting …`, `policy inactive`, `compose failed`, …). If the terminal is gone, redirect and reproduce:
221
228
 
222
229
  ```powershell
@@ -229,6 +236,8 @@ When filing an issue, include:
229
236
 
230
237
  Bar for a report: **reproducible** (steps), **versioned** (DSH + plugin + OS), **logged** (terminal output + `/instructions show`), **differential** (expected vs actual).
231
238
 
239
+ </details>
240
+
232
241
  ## License
233
242
 
234
243
  Released under the [Mozilla Public License 2.0](LICENSE); copyright and Exhibit A notice are in [NOTICE](NOTICE).
package/README.md CHANGED
@@ -104,69 +104,73 @@ profile 启动
104
104
 
105
105
  - 已安装并至少启动过一次 DSH(`dsh --version` 能输出版本)。
106
106
  - Node.js 版本跟随 DSH:0.2.2 起要求 ≥ 24.9,0.2.1 为 `^22.19.0 || >=24.0.0`;以 DSH 的 `engines` 为准。
107
+ - `pnpm` 在 `PATH` 上:`dsh plugin` 会把参数转发给 profile 目录里的 pnpm。
107
108
  - DSH `>=0.2.1-rc.5 <1.0.0-0`(0.x 全量放行;1.0 及其预发布需要重新验证)。
108
109
 
109
110
  ### 步骤
110
111
 
111
- 1. 把包装进 profile(`web` 是默认 Web profile 名):
112
+ 1. 把插件装进 profile(`web` 是默认 Web profile 名):
112
113
 
113
114
  ```sh
114
- # 从 npm
115
+ # 从 npm(推荐)
115
116
  dsh plugin --profile web add dsh-instructions-policy
116
- # 从 GitHub(把 <owner>/<repo> 换成仓库地址)
117
- dsh plugin --profile web add github:<owner>/<repo>
118
- # 本地开发:直接 link 仓库目录
119
- dsh plugin --profile web add link:<path-to-repo>
117
+ # 从 GitHub(源码安装;pnpm ≥10 的 allowBuilds 见下)
118
+ dsh plugin --profile web add github:Angel-Hair/dsh-instructions-policy
119
+ # 本地开发:在仓库目录执行
120
+ dsh plugin --profile web add link:.
120
121
  ```
121
122
 
122
- 2. 让 profile 选中这个 bundle。编辑 `~/.dsh/profiles/web/package.json`(Windows 为 `%USERPROFILE%\.dsh\profiles\web\package.json`),把包名加进 `dsh.profile.bundles`:
123
-
124
- ```json
125
- {
126
- "dsh": {
127
- "profile": {
128
- "bundles": [
129
- "@deepseek-ai/dsh-base",
130
- "@deepseek-ai/dsh-web-app",
131
- "dsh-instructions-policy"
132
- ]
133
- }
134
- }
135
- }
136
- ```
123
+ 安装成功后 DSH 会自动把声明了 `dsh.bundle.patch` 的依赖写入 profile 的 `dsh.profile.bundles`,不需要手工编辑 `package.json`;也可以在 Plugins 页面确认或开关。
137
124
 
138
- 装好之后也可以在 Plugins 页面里启用它(等价于写入 `dsh.profile.bundles`)。
125
+ GitHub 源码安装会触发本包的 `prepare` 构建,pnpm ≥10 默认拦截依赖构建;首次 `add` 报 `ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED` 时,把提示给出的键写进 `~/.dsh/profiles/web/pnpm-workspace.yaml` 的 `allowBuilds` 后重跑,或改用 npm 安装。
139
126
 
140
- 3. 重启 `dsh web`,确认日志出现:
127
+ 2. 重启 `dsh web`,确认日志出现:
141
128
 
142
129
  ```
143
130
  instructions-policy: redirecting @deepseek-ai/dsh-agent-instructions for N preset row(s)
144
131
  ```
145
132
 
146
- 4. 打开任意新任务,输入框工具行左侧应出现「指令策略」chip;或执行 `/instructions show` 核对项目根与已加载文件。
133
+ 3. 打开任意新任务,输入框工具行左侧应出现「指令策略」chip;或执行 `/instructions show` 核对项目根与已加载文件。
147
134
 
148
135
  升级后重启 `dsh web`;如果界面没有变化,再 Ctrl+F5 强制刷新。
149
136
 
150
137
  ### 升级 / 卸载
151
138
 
152
139
  ```sh
153
- # npm / GitHub 安装:升级到新版本
154
- dsh plugin --profile web update dsh-instructions-policy
140
+ # npm / GitHub 安装:升级到最新版本(含跨 minor / major)
141
+ dsh plugin --profile web update --latest dsh-instructions-policy
155
142
 
156
143
  # link 安装:在仓库里 git pull 后重启 dsh web 即可
157
144
 
158
- # 卸载:先从 dsh.profile.bundles 移除该包名,再执行
145
+ # 卸载:依赖和 dsh.profile.bundles 里的条目会一起移除
159
146
  dsh plugin --profile web remove dsh-instructions-policy
160
147
  ```
161
148
 
162
149
  卸载后重定向消失,DSH 恢复官方默认的指令加载;已经写进会话日志的指令消息仍留在历史里。
163
150
 
151
+ ## 可选的手工验收
152
+
153
+ 如果想确认插件功能是否真的生效,可以下载 [验收夹具](https://github.com/Angel-Hair/dsh-instructions-policy/releases/latest/download/instructions-fixture.zip),并按以下步骤测试。(插件本身不依赖这个夹具)
154
+
155
+ <details>
156
+ <summary>点击展开手工验收步骤</summary>
157
+
158
+ 1. 解压到一个独立目录。(父目录里不含有任意如 `.git`、`AGENTS.md` 等干扰测试的文件)
159
+ 2. DSH 新建工作区选解压出来的 `/instructions-fixture` 下的 `/sub` 目录。
160
+ 3. 参考下面给出的样本给**该工作区的AI会话**发送指令,或者按包内 `VERIFY.md` 执行 A–F 场景。(**建议思考强度设置为Low/High,以免造成不必要的开销**)
161
+
162
+ 参考指令:
163
+
164
+ > 本会话用于测试 `dsh-instructions-policy` 插件,目前为初始会话。当前设置为[开启/关闭根文件/自定义根文件],[开启/关闭]用户级根文件,[开启/关闭]子目录追加。你确认下状态对不对。(注意!你只需要汇报状况,不需要完全理解插件原理)
165
+
166
+ </details>
167
+
164
168
  ## 配置
165
169
 
166
170
  <details>
167
171
  <summary>点击展开配置说明</summary>
168
172
 
169
- 默认值见 [cordis.patch.yml](cordis.patch.yml)。要改默认值,在 `~/.dsh/profiles/<profile>/cordis.patch.yml` 里按 `id` 覆盖;**DSH 按行整行替换 `config`,不做深合并**,所以覆盖时要重述所有需要的字段:
173
+ 默认值见 [cordis.patch.yml](cordis.patch.yml)。要改默认值,在 `~/.dsh/profiles/web/cordis.patch.yml`(其他 profile 换成对应目录)里按 `id` 覆盖;**DSH 按行整行替换 `config`,不做深合并**,所以覆盖时要重述所有需要的字段:
170
174
 
171
175
  ```yaml
172
176
  - id: instructions-policy
@@ -210,12 +214,15 @@ dsh plugin --profile web remove dsh-instructions-policy
210
214
 
211
215
  ## 反馈问题
212
216
 
217
+ <details>
218
+ <summary>点击展开约定目录</summary>
219
+
213
220
  本插件没有引入日志系统:它保持零运行时依赖、不写任何文件,诊断信息都通过 DSH 的 logger 输出到启动 `dsh web` 的终端(Cordis 的 console logger)。`~/.dsh` 下没有日志目录,会话 JSONL 也只记录会话事件、不含 logger 输出,所以反馈时需要的"日志"就是那段终端输出。
214
221
 
215
222
  提 issue 时请附上:
216
223
 
217
224
  - DSH 版本(`dsh --version`)、插件版本(profile 的 `package.json` 或 `node_modules/dsh-instructions-policy/package.json`)、操作系统。
218
- - profile 的 `dsh.profile.bundles`,以及 `~/.dsh/profiles/<profile>/cordis.patch.yml` 里与本插件相关的行。
225
+ - profile 的 `dsh.profile.bundles`,以及 `~/.dsh/profiles/web/cordis.patch.yml`(按实际 profile 替换 `web`)里与本插件相关的行。
219
226
  - 启动 `dsh web` 的终端输出中所有含 `instructions-policy` 的行(`redirecting …`、`policy inactive`、`compose failed` 等)。看不到终端时先重定向再复现:
220
227
 
221
228
  ```powershell
@@ -228,6 +235,8 @@ dsh plugin --profile web remove dsh-instructions-policy
228
235
 
229
236
  反馈标准:**能复现**(有步骤)、**有版本**(DSH + 插件 + OS)、**有输出**(终端日志 + `/instructions show`)、**有差异**(预期 vs 实际)。
230
237
 
238
+ </details>
239
+
231
240
  ## 许可
232
241
 
233
242
  本项目以 [Mozilla Public License 2.0](LICENSE) 授权;版权信息与 Exhibit A 声明见 [NOTICE](NOTICE)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-instructions-policy",
3
- "version": "0.6.0",
3
+ "version": "0.6.5",
4
4
  "description": "Session-scoped policy for DSH workspace instructions: choose the root AGENTS.md, toggle user-global instructions, toggle subdirectory discovery.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -39,7 +39,10 @@
39
39
  "build": "tsc -p tsconfig.build.json && node scripts/copy-client.mjs",
40
40
  "typecheck": "tsc -p tsconfig.json",
41
41
  "prepare": "tsc -p tsconfig.build.json && node scripts/copy-client.mjs",
42
- "test": "node tests/policy.test.mjs && node tests/projection.test.mjs && node tests/client.test.mjs && node tests/contract.test.mjs"
42
+ "test": "node tests/policy.test.mjs && node tests/projection.test.mjs && node tests/client.test.mjs && node tests/contract.test.mjs",
43
+ "fixture:check": "node scripts/fixture.mjs check",
44
+ "fixture:prepare": "node scripts/fixture.mjs prepare",
45
+ "fixture:pack": "node scripts/fixture.mjs pack"
43
46
  },
44
47
  "devDependencies": {
45
48
  "@types/node": "^24.3.0",