dsh-env-manager-plugin 0.1.0 → 0.1.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.
Files changed (78) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +273 -250
  3. package/client.js +2581 -2581
  4. package/cordis.patch.yml +4 -4
  5. package/docs/00-project/current-state.md +32 -6
  6. package/docs/00-project/glossary.md +215 -215
  7. package/docs/00-project/project-brief.md +114 -114
  8. package/docs/00-project/roadmap.md +89 -89
  9. package/docs/01-architecture/DSH_Environment_Service_Memory_Skill_Brainstorm.md +493 -493
  10. package/docs/01-architecture/api-verification.md +416 -416
  11. package/docs/01-architecture/architecture-overview.md +222 -222
  12. package/docs/01-architecture/data-model.md +930 -930
  13. package/docs/01-architecture/decisions/ADR-0001-plugin-as-bundle.md +29 -29
  14. package/docs/01-architecture/decisions/ADR-0002-file-based-storage.md +25 -25
  15. package/docs/01-architecture/decisions/ADR-0003-skill-router-over-search.md +25 -25
  16. package/docs/01-architecture/decisions/ADR-0004-typescript-host-js-client.md +31 -31
  17. package/docs/01-architecture/decisions/ADR-0005-layered-rule-resolution.md +36 -36
  18. package/docs/01-architecture/decisions/ADR-0006-credentials-as-references.md +30 -30
  19. package/docs/01-architecture/decisions/ADR-0007-session-scoped-default-environment.md +28 -28
  20. package/docs/01-architecture/decisions/ADR-0008-memory-bridge-not-second-store.md +31 -31
  21. package/docs/01-architecture/decisions/ADR-0009-client-host-http-transport.md +87 -87
  22. package/docs/01-architecture/decisions/ADR-0010-environment-plane-model.md +87 -87
  23. package/docs/01-architecture/decisions/ADR-0011-k8s-node-execution-model.md +92 -92
  24. package/docs/01-architecture/design.md +666 -666
  25. package/docs/01-architecture/detailed-design.md +961 -961
  26. package/docs/01-architecture/implementation-plan.md +323 -323
  27. package/docs/01-architecture/module-boundaries.md +306 -306
  28. package/docs/01-architecture/security-model.md +227 -227
  29. package/docs/01-architecture/storage-contract.md +224 -224
  30. package/docs/01-architecture/tool-contract.md +438 -438
  31. package/docs/01-architecture/ui-design.md +587 -587
  32. package/docs/02-harness/agent-behavior.md +36 -36
  33. package/docs/02-harness/change-snapshot-policy.md +29 -29
  34. package/docs/02-harness/client-ui-integration.md +110 -110
  35. package/docs/02-harness/context-policy.md +43 -43
  36. package/docs/02-harness/harness-standard.md +91 -91
  37. package/docs/02-harness/task-execution-policy.md +26 -26
  38. package/docs/02-harness/verification-policy.md +97 -97
  39. package/docs/03-openspec/archive-rule.md +25 -25
  40. package/docs/03-openspec/bugfix-rule.md +30 -30
  41. package/docs/03-openspec/design-rule.md +33 -33
  42. package/docs/03-openspec/openspec-usage-guide.md +31 -31
  43. package/docs/03-openspec/proposal-rule.md +70 -70
  44. package/docs/03-openspec/spec-rule.md +33 -33
  45. package/docs/03-openspec/tasks-rule.md +31 -31
  46. package/docs/04-development/coding-style.md +67 -67
  47. package/docs/04-development/dependency-policy.md +43 -43
  48. package/docs/04-development/development-guide.md +85 -85
  49. package/docs/04-development/directory-convention.md +105 -105
  50. package/docs/04-development/local-run-guide.md +61 -55
  51. package/docs/04-development/testing-guide.md +102 -102
  52. package/docs/05-domain/deployment-template.md +76 -76
  53. package/docs/05-domain/environment-template.md +165 -165
  54. package/docs/05-domain/operation-binding-template.md +55 -55
  55. package/docs/05-domain/operation-record-template.md +55 -55
  56. package/docs/05-domain/prompt-template.md +90 -90
  57. package/docs/05-domain/rule-template.md +73 -73
  58. package/docs/05-domain/service-template.md +39 -39
  59. package/docs/06-operations/deployment-guide.md +54 -54
  60. package/docs/06-operations/release.md +198 -188
  61. package/docs/06-operations/security-policy.md +53 -53
  62. package/docs/06-operations/troubleshooting.md +141 -91
  63. package/docs/07-templates/adr-template.md +21 -21
  64. package/docs/07-templates/bugfix-template.md +11 -11
  65. package/docs/07-templates/case-template.md +15 -15
  66. package/docs/07-templates/design-template.md +29 -29
  67. package/docs/07-templates/proposal-template.md +19 -19
  68. package/docs/07-templates/spec-template.md +15 -15
  69. package/docs/07-templates/tasks-template.md +12 -12
  70. package/docs/99-archive/README.md +13 -13
  71. package/docs/README.md +142 -142
  72. package/icon.svg +4 -4
  73. package/index.js +31 -8
  74. package/lib/skill.js +37 -37
  75. package/locale/en.json +6 -6
  76. package/locale/zh.json +6 -6
  77. package/package.json +101 -99
  78. package/scripts/repair-profile.mjs +141 -0
@@ -1,188 +1,198 @@
1
- # Release Guide
2
-
3
- 发布由 [`.github/workflows/release.yml`](../../.github/workflows/release.yml) 自动完成:
4
- 推送 `v*` tag 后,在 Windows runner 上运行 typecheck、build、test,打包 npm tarball,
5
- 通过 npm Trusted Publisher(OIDC)发布到 npm,并创建 GitHub Release。
6
-
7
- ## 包名说明
8
-
9
- npm 上的 `dsh-env-manager` 已经被另一个**不同功能的包**占用,因此本插件发布为:
10
-
11
- ```text
12
- dsh-env-manager-plugin
13
- ```
14
-
15
- 插件运行时 id、Skill 名和数据目录仍是 `dsh-env-manager`;只有 npm 包名和
16
- `cordis.patch.yml` 的模块名使用 `dsh-env-manager-plugin`。
17
-
18
- ## 触发方式
19
-
20
- ### 推荐:推送 tag
21
-
22
- ```sh
23
- git tag -a v0.1.0 -m "v0.1.0"
24
- git push origin v0.1.0
25
- ```
26
-
27
- 也可以一次推送提交和 tag:
28
-
29
- ```sh
30
- git push origin main --follow-tags
31
- ```
32
-
33
- `--follow-tags` 只推送 annotated tag;如果使用 lightweight tag,必须显式
34
- `git push origin v0.1.0`。
35
-
36
- ### 手动触发
37
-
38
- GitHub → Actions → Release → Run workflow,输入已存在的 tag(例如 `v0.1.0`)。
39
-
40
- ## 发布前检查
41
-
42
- 1. `package.json` 的 `version` 必须与 tag 去掉 `v` 后完全一致;不一致时 workflow 会在
43
- 第一步失败。
44
- 2. 本地运行 `npm run check`(typecheck + build + test + client 语法检查)。
45
- 3. 确认 `lib/` 已重新构建;`npm pack` 的 `prepack` 也会构建,但本地检查应提前暴露错误。
46
- 4. 确认 `README.md`、`docs/00-project/current-state.md` 已更新。
47
- 5. 检查 tarball:
48
-
49
- ```sh
50
- npm pack --dry-run
51
- ```
52
-
53
- 确认包含 `index.js`、`client.js`、`cordis.patch.yml`、`lib/`、`locale/`、`icon.svg`、
54
- `README.md`、`LICENSE` 和 `docs/`。
55
- 6. 提交所有发布内容,再打 tag;tag 指向的 commit 应包含完整发布内容。
56
-
57
- ## 首次发布与 Trusted Publisher
58
-
59
- Trusted Publisher 只能在 npm 包已经存在后绑定,因此**第一次发布需要先手动完成**。
60
- 之后的版本由 GitHub Actions 自动发布,不需要 `NPM_TOKEN`。
61
-
62
- ### 1. 首次发布(bootstrap)
63
-
64
- Trusted Publisher 只能在包存在后绑定,因此第一次用一个不会占用 `latest` 的
65
- placeholder 版本把包名注册下来:
66
-
67
- ```sh
68
- npm version 0.0.0-stage --no-git-tag-version
69
- npm publish --access public --tag stage
70
- ```
71
-
72
- 这一步需要交互式 2FA/OTP;不能用没有 OTP 的自动化 shell 代替。发布成功后,
73
- npm 上会出现 `dsh-env-manager-plugin@0.0.0-stage`,当前账号成为 maintainer;
74
- `stage` tag 不会覆盖 `latest`。
75
-
76
- 然后把版本恢复为本次正式发布版本:
77
-
78
- ```sh
79
- npm version 0.1.0 --no-git-tag-version
80
- ```
81
-
82
- > 如果 `npm publish` 报 `EOTP`,请在交互终端完成 2FA;不要把一次性密码写进脚本或仓库。
83
- > 也可以使用 `0.0.0-bootstrap`,只要 tag 用 `stage` 而不是 `latest`。
84
-
85
- ### 2. 绑定 GitHub Actions
86
-
87
- 打开 npmjs.com → `dsh-env-manager-plugin` → Settings → Trusted publishing →
88
- Add GitHub Actions publisher:
89
-
90
- | 字段 | 值 |
91
- |---|---|
92
- | Organization or user | `zhiwuli0228` |
93
- | Repository | `dsh-env-manager` |
94
- | Workflow filename | `release.yml` |
95
- | Environment | 留空 |
96
-
97
- 绑定后可以检查:
98
-
99
- ```sh
100
- npm trust list dsh-env-manager-plugin
101
- ```
102
-
103
- `npm trust` 也可能要求 2FA;失败时以 npm 网页设置页为准。
104
-
105
- ### 3. 之后的自动发布
106
-
107
- ```sh
108
- git tag -a v0.1.1 -m "v0.1.1"
109
- git push origin v0.1.1
110
- ```
111
-
112
- workflow 使用 `id-token: write` 获取 OIDC token,执行:
113
-
114
- ```sh
115
- npm publish --access public --provenance
116
- ```
117
-
118
- 不需要 `NPM_TOKEN`,也不需要 `.npmrc`。`--provenance` 只生成供应链证明;
119
- 它本身不授予发布权限,授权来自 npm 侧的 Trusted Publisher 绑定。
120
-
121
- ### 备选:NPM_TOKEN
122
-
123
- 如果暂时不绑定 Trusted Publisher,可以创建 npm Automation token,配置为仓库
124
- secret `NPM_TOKEN`,并在 publish 前写入 `.npmrc`。当前 workflow 不使用该方案;
125
- 不要把 token 提交到仓库。
126
-
127
- ## Workflow 步骤
128
-
129
- 1. Checkout tag。
130
- 2. 校验 tag 与 `package.json` 版本。
131
- 3. `npm ci`。
132
- 4. `npm run check`(typecheck + build + test + client 语法检查)。
133
- 5. `npm pack`,生成 `dsh-env-manager-plugin-<version>.tgz`。
134
- 6. 升级 npm CLI,然后用 Trusted Publisher / OIDC 发布到 npm。
135
- 7. 创建 GitHub Release,自动生成 release notes,并上传 tarball。
136
-
137
- ## 权限
138
-
139
- ```yaml
140
- permissions:
141
- contents: write # 创建 Release
142
- id-token: write # Trusted Publisher + npm provenance
143
- ```
144
-
145
- 不要使用 `write-all`。
146
-
147
- ## 发布后验证
148
-
149
- 1. 等待 registry 传播(通常 1–5 分钟):
150
-
151
- ```sh
152
- npm view dsh-env-manager-plugin version
153
- ```
154
-
155
- 2. 验证元数据:
156
-
157
- ```sh
158
- npm view dsh-env-manager-plugin@0.1.0 dist.shasum dist.integrity gitHead dist.attestations
159
- ```
160
-
161
- `gitHead` 应等于 tag commit;provenance 的 `predicateType` 应为
162
- `https://slsa.dev/provenance/v1`。
163
-
164
- 3. 验证 Release:
165
-
166
- ```sh
167
- gh release view v0.1.0
168
- ```
169
-
170
- 确认 `dsh-env-manager-plugin-0.1.0.tgz` 附件存在。
171
-
172
- 4. 更新 `docs/00-project/current-state.md` 的发布状态和测试计数。
173
-
174
- ## 常见失败
175
-
176
- - **`private: true` / npm 拒绝发布**:当前 `package.json` 已移除 `private`。
177
- - **tag 与版本不一致**:先改 `package.json`,提交后再打 tag。
178
- - **npm 版本已存在**:npm 不允许覆盖同版本;提升版本并重新打 tag,不要重复 publish。
179
- - **`EOTP` / 2FA**:交互式发布需要 OTP;CI 使用 Trusted Publisher。
180
- - **`ENEEDAUTH`**:没有 token 且 Trusted Publisher 未绑定,或 workflow 缺少
181
- `id-token: write`。
182
- - **`E403` / 版本已存在**:先确认 `npm view`,不要立即重试。
183
- - **`npm view` 仍显示旧版本**:registry 传播/缓存,先看 workflow 日志。
184
- - **首次 workflow 发布失败**:Trusted Publisher 必须在包存在且绑定后才能用;
185
- 先完成上面的 bootstrap。
186
- - **lightweight tag 没被推送**:用 annotated tag 或显式 `git push origin <tag>`。
187
- - **Release 已存在**:`softprops/action-gh-release` 会更新已有 Release;
188
- 需要全新发布时使用新 tag。
1
+ # Release Guide
2
+
3
+ 发布由 [`.github/workflows/release.yml`](../../.github/workflows/release.yml) 自动完成:
4
+ 推送 `v*` tag 后,在 Windows runner 上运行 typecheck、build、test,打包 npm tarball,
5
+ 通过 npm Trusted Publisher(OIDC)发布到 npm,并创建 GitHub Release。
6
+
7
+ ## 包名说明
8
+
9
+ npm 上的 `dsh-env-manager` 已经被另一个**不同功能的包**占用,因此本插件发布为:
10
+
11
+ ```text
12
+ dsh-env-manager-plugin
13
+ ```
14
+
15
+ 插件运行时 id、Skill 名和数据目录仍是 `dsh-env-manager`;只有 npm 包名和
16
+ `cordis.patch.yml` 的模块名使用 `dsh-env-manager-plugin`。
17
+
18
+ ## 触发方式
19
+
20
+ ### 推荐:推送 tag
21
+
22
+ ```sh
23
+ git tag -a v0.1.0 -m "v0.1.0"
24
+ git push origin v0.1.0
25
+ ```
26
+
27
+ 也可以一次推送提交和 tag:
28
+
29
+ ```sh
30
+ git push origin main --follow-tags
31
+ ```
32
+
33
+ `--follow-tags` 只推送 annotated tag;如果使用 lightweight tag,必须显式
34
+ `git push origin v0.1.0`。
35
+
36
+ ### 手动触发
37
+
38
+ GitHub → Actions → Release → Run workflow,输入已存在的 tag(例如 `v0.1.0`)。
39
+
40
+ ## 发布前检查
41
+
42
+ 1. `package.json` 的 `version` 必须与 tag 去掉 `v` 后完全一致;不一致时 workflow 会在
43
+ 第一步失败。
44
+ 2. 本地运行 `npm run check`(typecheck + build + test + client 语法检查)。
45
+ 3. 确认 `lib/` 已重新构建;`npm pack` 的 `prepack` 也会构建,但本地检查应提前暴露错误。
46
+ 4. 确认 `README.md`、`docs/00-project/current-state.md` 已更新。
47
+ 5. 检查 tarball:
48
+
49
+ ```sh
50
+ npm pack --dry-run
51
+ ```
52
+
53
+ 确认包含 `index.js`、`client.js`、`cordis.patch.yml`、`lib/`、`locale/`、`icon.svg`、
54
+ `README.md`、`LICENSE` 和 `docs/`。
55
+ 6. 提交所有发布内容,再打 tag;tag 指向的 commit 应包含完整发布内容。
56
+
57
+ ## 首次发布与 Trusted Publisher
58
+
59
+ Trusted Publisher 只能在 npm 包已经存在后绑定,因此**第一次发布需要先手动完成**。
60
+ 之后的版本由 GitHub Actions 自动发布,不需要 `NPM_TOKEN`。
61
+
62
+ ### 1. 首次发布(bootstrap)
63
+
64
+ Trusted Publisher 只能在包存在后绑定,因此第一次用一个不会占用 `latest` 的
65
+ placeholder 版本把包名注册下来:
66
+
67
+ ```sh
68
+ npm version 0.0.0-stage --no-git-tag-version
69
+ npm publish --access public --tag stage
70
+ ```
71
+
72
+ 这一步需要交互式 2FA/OTP;不能用没有 OTP 的自动化 shell 代替。发布成功后,
73
+ npm 上会出现 `dsh-env-manager-plugin@0.0.0-stage`,当前账号成为 maintainer;
74
+ `stage` tag 不会覆盖 `latest`。
75
+
76
+ 然后把版本恢复为本次正式发布版本:
77
+
78
+ ```sh
79
+ npm version 0.1.0 --no-git-tag-version
80
+ ```
81
+
82
+ > 如果 `npm publish` 报 `EOTP`,请在交互终端完成 2FA;不要把一次性密码写进脚本或仓库。
83
+ > 也可以使用 `0.0.0-bootstrap`,只要 tag 用 `stage` 而不是 `latest`。
84
+
85
+ ### 2. 绑定 GitHub Actions
86
+
87
+ 打开 npmjs.com → `dsh-env-manager-plugin` → Settings → Trusted publishing →
88
+ Add GitHub Actions publisher:
89
+
90
+ | 字段 | 值 |
91
+ |---|---|
92
+ | Organization or user | `zhiwuli0228` |
93
+ | Repository | `dsh-env-manager` |
94
+ | Workflow filename | `release.yml` |
95
+ | Environment | 留空 |
96
+
97
+ 绑定后可以检查:
98
+
99
+ ```sh
100
+ npm trust list dsh-env-manager-plugin
101
+ ```
102
+
103
+ `npm trust` 也可能要求 2FA;失败时以 npm 网页设置页为准。
104
+
105
+ ### 3. 之后的自动发布
106
+
107
+ ```sh
108
+ git tag -a v0.1.1 -m "v0.1.1"
109
+ git push origin v0.1.1
110
+ ```
111
+
112
+ workflow 使用 `id-token: write` 获取 OIDC token,执行:
113
+
114
+ ```sh
115
+ npm publish --access public --provenance
116
+ ```
117
+
118
+ 不需要 `NPM_TOKEN`,也不需要 `.npmrc`。`--provenance` 只生成供应链证明;
119
+ 它本身不授予发布权限,授权来自 npm 侧的 Trusted Publisher 绑定。
120
+
121
+ ### 备选:NPM_TOKEN
122
+
123
+ 如果暂时不绑定 Trusted Publisher,可以创建 npm Automation token,配置为仓库
124
+ secret `NPM_TOKEN`,并在 publish 前写入 `.npmrc`。当前 workflow 不使用该方案;
125
+ 不要把 token 提交到仓库。
126
+
127
+ ## Workflow 步骤
128
+
129
+ 1. Checkout tag。
130
+ 2. 校验 tag 与 `package.json` 版本。
131
+ 3. `npm ci`。
132
+ 4. `npm run check`(typecheck + build + test + client 语法检查)。
133
+ 5. `npm pack`,生成 `dsh-env-manager-plugin-<version>.tgz`。
134
+ 6. 查询 npm 上是否已经存在该版本;已存在则跳过 publish,但仍然创建 GitHub Release。
135
+ 7. 升级 npm CLI,然后用 Trusted Publisher / OIDC 发布到 npm。
136
+ 8. 创建 GitHub Release,自动生成 release notes,并上传 tarball。
137
+
138
+ 第 6 步让 workflow 可以安全地补做 Release:如果某个版本已经在本地手动发布成功,
139
+ 但 workflow 在 publish 阶段因“版本已存在”失败,重新手动触发同一个 tag 即可跳过
140
+ publish 并完成 Release,不需要删除或覆盖 npm 版本。
141
+
142
+ ## 权限
143
+
144
+ ```yaml
145
+ permissions:
146
+ contents: write # 创建 Release
147
+ id-token: write # Trusted Publisher + npm provenance
148
+ ```
149
+
150
+ 不要使用 `write-all`。
151
+
152
+ ## 发布后验证
153
+
154
+ 1. 等待 registry 传播(通常 1–5 分钟):
155
+
156
+ ```sh
157
+ npm view dsh-env-manager-plugin version
158
+ ```
159
+
160
+ 2. 验证元数据:
161
+
162
+ ```sh
163
+ npm view dsh-env-manager-plugin@0.1.0 dist.shasum dist.integrity gitHead dist.attestations
164
+ ```
165
+
166
+ `gitHead` 应等于 tag commit;provenance 的 `predicateType` 应为
167
+ `https://slsa.dev/provenance/v1`。
168
+
169
+ > `0.1.0` 是在绑定 Trusted Publisher 之前手动 bootstrap 的,因此可能没有
170
+ > `dist.attestations`;由 workflow 发布的后续版本才带 OIDC provenance。
171
+
172
+ 3. 验证 Release:
173
+
174
+ ```sh
175
+ gh release view v0.1.0
176
+ ```
177
+
178
+ 确认 `dsh-env-manager-plugin-0.1.0.tgz` 附件存在。
179
+
180
+ 4. 更新 `docs/00-project/current-state.md` 的发布状态和测试计数。
181
+
182
+ ## 常见失败
183
+
184
+ - **`private: true` / npm 拒绝发布**:当前 `package.json` 已移除 `private`。
185
+ - **tag 与版本不一致**:先改 `package.json`,提交后再打 tag。
186
+ - **npm 版本已存在**:npm 不允许覆盖同版本。正常发版应提升版本并重新打 tag;
187
+ 如果该版本已手动发布、只缺 GitHub Release,则手动触发同一个 tag,workflow 会
188
+ 跳过 publish 并补建 Release。
189
+ - **`EOTP` / 2FA**:交互式发布需要 OTP;CI 使用 Trusted Publisher。
190
+ - **`ENEEDAUTH`**:没有 token 且 Trusted Publisher 未绑定,或 workflow 缺少
191
+ `id-token: write`。
192
+ - **`E403` / 版本已存在**:先确认 `npm view`,不要立即重试。
193
+ - **`npm view` 仍显示旧版本**:registry 传播/缓存,先看 workflow 日志。
194
+ - **首次 workflow 发布失败**:Trusted Publisher 必须在包存在且绑定后才能用;
195
+ 先完成上面的 bootstrap。
196
+ - **lightweight tag 没被推送**:用 annotated tag 或显式 `git push origin <tag>`。
197
+ - **Release 已存在**:`softprops/action-gh-release` 会更新已有 Release;
198
+ 需要全新发布时使用新 tag。
@@ -1,53 +1,53 @@
1
- # Security Policy (Operations)
2
-
3
- Operational rules for users and agents. Design rationale is in
4
- [security-model.md](../01-architecture/security-model.md).
5
-
6
- ---
7
-
8
- ## 1. Credentials
9
-
10
- 1. Every host, cluster, endpoint and future adapter uses a `credentialRef`.
11
- 2. Never write a password, token, private key or kubeconfig into a registry file, a test fixture or a Git commit.
12
- 3. The plugin reports only `configured`, `missing` or `unavailable`.
13
- 4. If a credential is missing, fix the reference; do not paste the value into the registry.
14
-
15
- ## 2. Production changes
16
-
17
- 1. `category: production` environments are gated.
18
- 2. Operation bindings that target production must set `allowProduction: true` explicitly; otherwise routing fails.
19
- 3. Management writes that affect production records require approval when performed by
20
- the Agent.
21
- 4. The UI writes as actor `'ui'` and is denied for production records unless
22
- `writePolicy.allowUiProductionWrites` is enabled.
23
- 5. A denied approval is final for that attempt; nothing is written.
24
-
25
- ## 3. Rule templates
26
-
27
- 1. Only `${...}` interpolation is allowed.
28
- 2. Do not attempt to inject JavaScript, shell or environment lookups. They are rejected.
29
- 3. If a path must differ per environment, use an override, not a new template language feature.
30
- 4. Review rule profiles that resolve to sensitive directories. V1 does not read them, but future adapters will.
31
-
32
- ## 4. Data handling
33
-
34
- 1. `data/` is git-ignored. Do not commit registry data.
35
- 2. Do not place real internal hostnames, IPs or URLs in `tests/fixtures/`.
36
- 3. Redact command output and evidence before recording it.
37
- 4. Keep summaries short; evidence lives behind opaque references.
38
-
39
- ## 5. Sharing and scope
40
-
41
- 1. Registry data is profile-global. Treat it as internal documentation.
42
- 2. Session defaults are per session. Do not design flows that rely on a global default.
43
- 3. Memory entries must carry environment/service/deployment scope.
44
- 4. A conclusion from one environment is not a global rule.
45
-
46
- ## 6. Incident handling
47
-
48
- If a secret is committed by mistake:
49
-
50
- 1. Rotate the secret immediately.
51
- 2. Remove it from Git history, not only from the working tree.
52
- 3. Record the incident outside this repository.
53
- 4. Add a check or test that would have caught it.
1
+ # Security Policy (Operations)
2
+
3
+ Operational rules for users and agents. Design rationale is in
4
+ [security-model.md](../01-architecture/security-model.md).
5
+
6
+ ---
7
+
8
+ ## 1. Credentials
9
+
10
+ 1. Every host, cluster, endpoint and future adapter uses a `credentialRef`.
11
+ 2. Never write a password, token, private key or kubeconfig into a registry file, a test fixture or a Git commit.
12
+ 3. The plugin reports only `configured`, `missing` or `unavailable`.
13
+ 4. If a credential is missing, fix the reference; do not paste the value into the registry.
14
+
15
+ ## 2. Production changes
16
+
17
+ 1. `category: production` environments are gated.
18
+ 2. Operation bindings that target production must set `allowProduction: true` explicitly; otherwise routing fails.
19
+ 3. Management writes that affect production records require approval when performed by
20
+ the Agent.
21
+ 4. The UI writes as actor `'ui'` and is denied for production records unless
22
+ `writePolicy.allowUiProductionWrites` is enabled.
23
+ 5. A denied approval is final for that attempt; nothing is written.
24
+
25
+ ## 3. Rule templates
26
+
27
+ 1. Only `${...}` interpolation is allowed.
28
+ 2. Do not attempt to inject JavaScript, shell or environment lookups. They are rejected.
29
+ 3. If a path must differ per environment, use an override, not a new template language feature.
30
+ 4. Review rule profiles that resolve to sensitive directories. V1 does not read them, but future adapters will.
31
+
32
+ ## 4. Data handling
33
+
34
+ 1. `data/` is git-ignored. Do not commit registry data.
35
+ 2. Do not place real internal hostnames, IPs or URLs in `tests/fixtures/`.
36
+ 3. Redact command output and evidence before recording it.
37
+ 4. Keep summaries short; evidence lives behind opaque references.
38
+
39
+ ## 5. Sharing and scope
40
+
41
+ 1. Registry data is profile-global. Treat it as internal documentation.
42
+ 2. Session defaults are per session. Do not design flows that rely on a global default.
43
+ 3. Memory entries must carry environment/service/deployment scope.
44
+ 4. A conclusion from one environment is not a global rule.
45
+
46
+ ## 6. Incident handling
47
+
48
+ If a secret is committed by mistake:
49
+
50
+ 1. Rotate the secret immediately.
51
+ 2. Remove it from Git history, not only from the working tree.
52
+ 3. Record the incident outside this repository.
53
+ 4. Add a check or test that would have caught it.