@jayyuen66/dsh-quality-gate 0.1.3 → 0.1.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.
- package/CHANGELOG.md +40 -0
- package/LICENSE +1 -1
- package/README.md +15 -14
- package/README.zh-CN.md +14 -13
- package/THIRD_PARTY_NOTICES.md +4 -1
- package/client.js +602 -270
- package/cordis.patch.yml +4 -2
- package/docs/DETAIL.md +24 -0
- package/docs/DETAIL.zh.md +24 -0
- package/host.js +353 -84
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +52 -34
package/cordis.patch.yml
CHANGED
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
# 之后二次检查 inbox:有排队项就再开一轮。此处刻意不写行号——那是另一个包的源码位置,
|
|
9
9
|
# 随宿主升级漂移,而它恰恰是本插件唯一的机制前提);
|
|
10
10
|
# 探测只提项目自己声明过的命令,拿不到脚本清单时宁可不给门禁(防假失败注入);
|
|
11
|
-
# -
|
|
11
|
+
# - 防跑飞:每会话至多 N 次注入(默认 2,按会话跨回合累计、所有根共用一份,
|
|
12
|
+
# 门禁干净通过后重置);总预算封顶;超时按「未执行」注入不静默通过;
|
|
12
13
|
# inbox 有待处理时不抢话。
|
|
13
14
|
# 设置卡:enabled / 注入配额 / 门禁预算 / 记忆反馈(开关 + 网关地址 + 密钥凭据引用,
|
|
14
15
|
# 记忆反馈默认关闭且地址默认为空 = 不启用;密钥走 dsh 凭据通道,不落设置)。
|
|
15
16
|
#
|
|
16
17
|
# 组合包层:本文件由 package.json 的 dsh.bundle.patch
|
|
17
|
-
# 指向,随 `dsh plugin --profile web add/remove
|
|
18
|
+
# 指向,随 `dsh plugin --profile web add/remove @jayyuen66/dsh-quality-gate` 维护。
|
|
19
|
+
# 本地开发形态可用 `add .`;`./plugins/quality-gate` 不是本仓路径。
|
|
18
20
|
# 行按裸包名引用本包(client-modules 只扫描裸包名条目的 dsh.client 声明)。
|
|
19
21
|
# 注意 pnpm ≥12.3.0:12.0.0 的 add 本地目录有 #14437 bug。
|
|
20
22
|
- insert:
|
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Quality gate
|
|
2
|
+
|
|
3
|
+
Runs the project's own checks when a turn ends and hands the failure back to the model, so a turn does not close with a red gate.
|
|
4
|
+
|
|
5
|
+
## What the card changes
|
|
6
|
+
|
|
7
|
+
- **Gate** — `enabled` (on) off means the gate never runs and the model may close a broken turn. `maxInjectsPerTurn` (1–5, default 2) caps how many repair instructions one session receives across turns, which is the runaway brake. `gateBudgetMs` (10000–600000, default 300000, shown in seconds) is the whole-gate budget: exceeding it is injected as "could not run", never treated as a pass.
|
|
8
|
+
- **Memory feedback** — `memoryFeedback` (off by default) writes failing-gate evidence to the memory gateway's L0 layer; lesson-bus reporting is unaffected by it. `memoryGatewayUrl` (empty) has no shipped default — with it empty the plugin falls back to the `TDAI_GATEWAY_URL` environment variable, and if both are empty the feedback is simply unconfigured. `memoryGatewayKeyRef` (default `TDAI_GATEWAY_KEY`) stores only the credential **name**; the secret lives in the host's credential service and never in settings. Clearing the field restores the default name rather than turning feedback off.
|
|
9
|
+
|
|
10
|
+
These are read per turn, so a change applies on the next turn without restarting the host. Feedback reaches the gateway only when the switch is on, the URL resolves, and the credential service holds a value under the referenced name.
|
|
11
|
+
|
|
12
|
+
## Restart-only values
|
|
13
|
+
|
|
14
|
+
`maxRootDepth` (default 10, how far up a file's directory tree the plugin looks for the project root) and `gateStdoutMaxBytes` (65536) are deployment assumptions kept off the card. Set them in the `config:` block of this plugin's row in `cordis.patch.yml`; they take effect on restart.
|
|
15
|
+
|
|
16
|
+
Also worth knowing: after a host restart the turn cursor resets to the fork point, so the first turn after a restart re-runs the gates.
|
|
17
|
+
|
|
18
|
+
## What it needs from outside
|
|
19
|
+
|
|
20
|
+
The gate commands are resolved per project root and never invented: `pnpm check` only when that root's `package.json` declares a `check` script, otherwise `cargo check`, `ruff check .` only with a `ruff.toml` or a `[tool.ruff]` section, otherwise `tsc --noEmit`. They run through the host sandbox, so `SANDBOX_UNAVAILABLE` means the command never ran rather than that it passed. Talking to a memory gateway needs a reachable URL and a credential under the referenced name.
|
|
21
|
+
|
|
22
|
+
## Further detail
|
|
23
|
+
|
|
24
|
+
The detection precedence and why a wrong pick looks like a false failure, the edit ledger and spill mechanics are in the package README (`README.md` / `README.zh-CN.md`).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 回合收口质量门禁
|
|
2
|
+
|
|
3
|
+
回合结束时跑项目自己的检查,把失败证据交回模型,让回合不会带着红灯收口。
|
|
4
|
+
|
|
5
|
+
## 设置卡上改的是什么
|
|
6
|
+
|
|
7
|
+
- **门禁** — `enabled`(默认开)关掉后门禁完全不跑,模型可能带着坏检查收回合。`maxInjectsPerTurn`(1–5,默认 2)限制一个会话跨回合最多收到几次修复指令,这是防失控的闸。`gateBudgetMs`(10000–600000,默认 300000,卡上按秒显示)是整趟门禁的预算:超时按「未能执行」注入,绝不当成通过。
|
|
8
|
+
- **记忆反馈** — `memoryFeedback`(默认关)开了才会把失败证据写进记忆网关的 L0 层;教训总线的上报不受这一位影响。`memoryGatewayUrl` 没有随包默认值:留空时回落到环境变量 `TDAI_GATEWAY_URL`,两者都空就是未配置,功能不跑。`memoryGatewayKeyRef`(默认 `TDAI_GATEWAY_KEY`)存的只是凭据**引用名**,密钥留在宿主凭据服务里,不进设置。清空这一格是恢复默认引用名,不是关掉反馈。
|
|
9
|
+
|
|
10
|
+
这些值每回合现读,改完下一回合生效,不用重启宿主。反馈要真正送出去,需要开关打开、地址能解析出值,并且凭据服务里确实存着引用名指向的那份值。
|
|
11
|
+
|
|
12
|
+
## 要重启的值
|
|
13
|
+
|
|
14
|
+
`maxRootDepth`(默认 10,决定从被改文件往上找项目根的最深层数)与 `gateStdoutMaxBytes`(65536)属于部署假定值,刻意不进设置卡:写在本插件注册行的 `config:` 块,改值随重启生效。
|
|
15
|
+
|
|
16
|
+
还有一条要提前知道:宿主重启后回合游标回到 fork 点,所以重启后的第一个回合会把门禁重跑一遍。
|
|
17
|
+
|
|
18
|
+
## 需要外部提供什么
|
|
19
|
+
|
|
20
|
+
门禁命令按项目根现场探测,绝不虚构:该根 `package.json` 声明了 `check` 脚本才用 `pnpm check`,否则依次试 `cargo check`、只有存在 `ruff.toml` 或 `[tool.ruff]` 时才用 `ruff check .`、再否则 `tsc --noEmit`。命令经宿主沙箱执行,所以 `SANDBOX_UNAVAILABLE` 说的是「根本没跑成」,不是「跑过了」。要连记忆网关还得有可达地址与被引用名指向的凭据。
|
|
21
|
+
|
|
22
|
+
## 更完整的说明
|
|
23
|
+
|
|
24
|
+
探测优先次序与它为什么会造成假失败、编辑台账与溢出落盘机制,都写在随包的 README(`README.md` / `README.zh-CN.md`)。
|