@dsh-cc/command-config 0.6.1 → 0.6.2

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.
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm check:readme --write
5
+ README.md: 7afa923e6d28a5c5334522d0603f2f4fbbbc0332
6
+ README.zh.md: 312104a076f5226835beba14c44bae65affdaa2e
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @dsh-cc/command-config
2
+
3
+ English | [中文](README.zh.md)
4
+
5
+ Human-facing `/config` slash command for the settings service: render the effective configuration namespaces, or write an allowlisted key/value into a namespace scope. Invalid keys or scopes produce a friendly message, never a thrown error.
6
+
7
+ ## Usage
8
+
9
+ ```ts
10
+ import { apply } from '@dsh-cc/command-config'
11
+
12
+ apply(ctx, {
13
+ defaultScope: 'ui-theme',
14
+ allowlist: ['ui-theme.theme', 'ui-theme.fontSize'],
15
+ })
16
+ ```
17
+
18
+ ## What it provides
19
+
20
+ - `/config` — with no arguments, lists every registered settings namespace as `namespace = value (applies)`.
21
+ - `/config [key] [value] [scope]` — parses the update, defaults the scope to `defaultScope` (default `ui-theme`), parses the value as JSON when it looks structured (else a string), and writes it through the settings service.
22
+ - Writes are gated by a restricted allowlist of `namespace` or `namespace.key` entries; the default allowlist is `ui-theme.theme` and `ui-theme.fontSize`. Everything else is refused with a hint of the writable keys.
23
+
24
+ ## Notes
25
+
26
+ - Injects the `commands` and `settings` services; wraps the command with `@dsh-cc/command-usage` so `help`/`-h`/`--help` render deterministic help.
27
+ - Errors from the settings update are reported as text, not thrown.
package/README.zh.md ADDED
@@ -0,0 +1,27 @@
1
+ # @dsh-cc/command-config
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 面向用户的 `/config` 斜杠命令,对接设置服务:渲染生效的配置命名空间,或向某个命名空间写入白名单内的键值。无效的键或作用域只会返回友好的提示文本,绝不抛出错误。
6
+
7
+ ## 用法
8
+
9
+ ```ts
10
+ import { apply } from '@dsh-cc/command-config'
11
+
12
+ apply(ctx, {
13
+ defaultScope: 'ui-theme',
14
+ allowlist: ['ui-theme.theme', 'ui-theme.fontSize'],
15
+ })
16
+ ```
17
+
18
+ ## 提供的能力
19
+
20
+ - `/config` —— 不带参数时,将每个已注册的设置命名空间渲染为 `namespace = value (applies)` 一行。
21
+ - `/config [key] [value] [scope]` —— 解析更新参数,作用域缺省为 `defaultScope`(默认 `ui-theme`),值在形似结构化数据时按 JSON 解析(否则按字符串),并通过设置服务写入。
22
+ - 写入受 `namespace` 或 `namespace.key` 形式的受限白名单约束;默认白名单为 `ui-theme.theme` 和 `ui-theme.fontSize`。其余写入一律拒绝,并提示可写的键。
23
+
24
+ ## 备注
25
+
26
+ - 注入 `commands` 与 `settings` 服务;命令经 `@dsh-cc/command-usage` 包装,因此 `help`/`-h`/`--help` 会渲染确定性的帮助文本。
27
+ - 设置更新产生的错误以文本形式报告,不会抛出。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dsh-cc/command-config",
3
3
  "description": "Human-facing slash command to show or update effective configuration namespaces",
4
- "version": "0.6.1",
4
+ "version": "0.6.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/dsh-cc/dsh-cc.git",
@@ -44,6 +44,6 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@dsh-cc/command-usage": "^0.6.1"
47
+ "@dsh-cc/command-usage": "^0.6.2"
48
48
  }
49
49
  }