@jayyuen66/dsh-ocr-review 0.1.9 → 0.1.11
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 +68 -4
- package/LICENSE +1 -1
- package/README.md +14 -14
- package/README.zh-CN.md +13 -13
- package/THIRD_PARTY_NOTICES.md +36 -6
- package/client.js +101 -47
- package/docs/DETAIL.md +5 -5
- package/docs/DETAIL.zh.md +5 -5
- package/host.js +659 -313
- package/package.json +53 -42
- package/scripts/get-cred.mjs +124 -59
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,77 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
本文件遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 的格式,版本号遵循
|
|
4
|
-
[语义化版本](https://semver.org/lang/zh-CN/)
|
|
4
|
+
[语义化版本](https://semver.org/lang/zh-CN/),最新版本在最上。这里的偏离是刻意的:版本标题不写
|
|
5
|
+
发布日期(各版发布时间以 npm registry 为准,`npm view <包名> time` 取得到),并按需增设标准六类
|
|
6
|
+
之外的小节(如 `Docs`、`Verification`)。条目自 0.1.0 起;更早的
|
|
5
7
|
1.0.0 / 0.6.x 是作用域迁移前的历史编号,npm 已永久记录,不在本文件重建。
|
|
6
8
|
|
|
9
|
+
## 0.1.11
|
|
10
|
+
|
|
11
|
+
这一版把宿主开发基线抬到 `0.2.2-alpha.3`,同步 shared `0.2.3`,并把外部 `ocr`
|
|
12
|
+
契约抬到 `1.13.4`;随包文档的版本声明改由门禁与 manifest / catalog 对齐,测试补上
|
|
13
|
+
平台桩与几处会随环境变脸的断言。对外工具与 Remote 方法名单不变。
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **宿主开发基线与支持窗口**:`devDependencies` 的 dsh 家族抬到 `0.2.2-alpha.3`,
|
|
18
|
+
cordis 抬到 `4.0.6-alpha.2`,schemastery fork 抬到 `3.18.6-alpha.2`;`engines.dsh`
|
|
19
|
+
与 dsh 家族 peer 保持 `^0.2.1-rc.3 || ^0.2.2-alpha.2` 并集窗口,同时覆盖 rc 线与
|
|
20
|
+
alpha 线。
|
|
21
|
+
- **shared 抬到 `0.2.3`**:catalog、单仓 overrides 与 lockfile 同源到 0.2.3;
|
|
22
|
+
THIRD_PARTY_NOTICES 的依赖表同步。
|
|
23
|
+
- **OCR 契约抬到 `1.13.4`**:`package.json` 的 `ocrCliVersion`、`lib/cli.ts` 的
|
|
24
|
+
`EXPECTED_OCR_CLI_VERSION`、两侧 README、两份 DETAIL 与 THIRD_PARTY_NOTICES 的验证
|
|
25
|
+
版本/运行期依赖行都由门禁核对到同一枚数字。
|
|
26
|
+
- **发布链**:CI 与 publish 的 pnpm 固定到 `12.11.2`;registry 预检的包名与 shared
|
|
27
|
+
依赖名改从 `package.json` 读取,不再维护第二份字面量。
|
|
28
|
+
- **测试**:新增 `test/fixtures/platform-stub.ts`,平台相关用例统一走它;Windows
|
|
29
|
+
非提权环境跳过符号链接越界用例(跳过的是 symlink 前提,不是用例意图);CLI
|
|
30
|
+
默认解析改用全新记忆槽;临时目录回收移到文件顶层;飞行中的 `busy` 断言收紧为必须
|
|
31
|
+
为 `true`。
|
|
32
|
+
- **随包文档**:图标来源补上上游 path 的几何取值;README 说明本地目录安装需要
|
|
33
|
+
Node ≥ 22.18;DETAIL 明确 `startupVerify` 同时门控装载期的端点自检与版本测量。
|
|
34
|
+
|
|
35
|
+
### Verification
|
|
36
|
+
|
|
37
|
+
- `npm run check`:typecheck、lint、双构建、全套用例、四项 100% 覆盖率与 oxfmt 全绿。
|
|
38
|
+
- `pnpm install --frozen-lockfile --ignore-scripts`(pnpm `12.11.2`)通过;
|
|
39
|
+
`pnpm run sync --check` 与 `node scripts/bump-manifests.mjs` 无漂移。
|
|
40
|
+
- `smoke dsh-ocr-review --tarball` 在 dsh `0.2.2-alpha.3` 沙箱命中本包层;tarball
|
|
41
|
+
含 `host.js`、`client.js`、`docs/`、`locale/`、`CHANGELOG.md` 与
|
|
42
|
+
`THIRD_PARTY_NOTICES.md`。
|
|
43
|
+
|
|
44
|
+
## 0.1.10
|
|
45
|
+
|
|
46
|
+
一轮跨面审查修复:路径闸、MCP 配置写面与并发覆盖、provider 面与解析判据收口;设置卡与工具出口同步加固。对外工具与 Remote 方法名单不变。
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- **MCP 写面加 revision 基线**:`mcp()` 回执新增 `revision`,`saveMcp` 入参加可选 `revision`——带基线时锁内比对,过期整笔拒绝回 `mcpSaveConflict`;不带基线沿用旧的后写覆盖语义(旧客户端兼容)。双开卡片或手改 config.json 时后保存者不再静默抹掉他人更新。
|
|
51
|
+
- **发布链加固**(`.github/workflows/publish.yml`):发布步 `pnpm install --ignore-scripts`、构建移至无凭据步、`pnpm publish --ignore-scripts`,生命周期脚本不再能接触发布凭据;`prepack` 删除改 `prepare`(同为双构建)。
|
|
52
|
+
- **依赖与元数据**:js-yaml 改精确钉 `5.4.3`;`@deepseek-ai/schemastery` peer 放宽为 `^3.18.6-alpha.1`;catalog 的 shared 抬到 0.2.2;author 改对象形(name+url)。
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- **路径闸**(`lib/argv-guard.ts`):归一后落在文件系统根(`/`、盘符根、UNC 根)一律拒绝,堵 `--rule /etc/passwd` 被当仓内文件读进 OCR;`statSync` 改 `throwIfNoEntry: false`;会话根判定改 `path.isAbsolute`(Windows `C:/…` 不再落相对分支)。
|
|
57
|
+
- **Remote 拒绝判据**(`lib/remote-shape.ts`):`isRemoteRefused` 收 `unknown`,须同时满足 `ok===false`、非空 `error`、整数 `status`,null/NaN/原始值不再误判;状态码集中为导出常量 `OCR_REFUSE_STATUS`。
|
|
58
|
+
- **MCP 配置**(`lib/mcp-config.ts`):写失败独立文案;输出容器改 null 原型(`__proto__` 键不再丢失/污染);写侧把盘上同条目的未知字段接回;providers.chatgpt 非法改显式报错;读侧加 64 KiB 上限;URL 判据拒空主机。
|
|
59
|
+
- **OCR config 迁移**(`lib/ocr-config.ts`):不覆写已有非空 `api_key_cmd`;provider/model 入口一次 trim;空白 `language` 不落键;迁移写回统一走 `renderConfigDoc`。
|
|
60
|
+
- **provider 面**(`lib/provider-projection.ts`、`lib/provider-source.ts`):baseURL 禁内嵌 `user:pass@`、空白/控制字符与无主机;`apiKeyEnv` 按导出白名单收口,非法 ref 单独暴露;health 与探测异常收口,失败出口统一 `settingsFailed()`。
|
|
61
|
+
- **解析与聚合**(`lib/parse.ts`、`lib/severity.ts`):`isCount` 限安全整数域、`toolCallsOf` 总数口径、warnings 限流;`hitsContract` 只认 reviewable 文件/组,`{"error":…}` 载荷不再假报 0 文件;`byCategory` 落 null 原型。
|
|
62
|
+
- **工具出口守卫**(`lib/output.ts`):新增容器形状闸;违规收集改 `ViolationSink`,收集期截断 20 条/2000 字,不再先攒几十万条。
|
|
63
|
+
- **host**(`host.ts`):后台作业剪枝与取文案包 try 并先 killProc(不留无主 OCR 进程);saveMcp/chatGpt 加外层 try 回可读回执;装载期 fire-and-forget 自检包 try(防未处理 rejection 终止宿主);effort 未知值回落设置卡值。
|
|
64
|
+
- **设置卡**(`src/client-entry.ts`):channel 改逐值比对;MCP 未读成功时禁编辑/保存;llmTest 失败按失败着色;refresh 并发只认最后一次。
|
|
65
|
+
- **CLI 与凭据脚本**(`lib/cli.ts`、`scripts/get-cred.mjs`):pgrep 探针退出码 1(无匹配)不再算被拒;preview 也转发 `--max-tokens`;YAML 报错不再读 message/toString,防明文 snippet 外泄。
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
|
|
69
|
+
- **测试三层**:`test/e2e/stub-ocr.e2e.test.ts`(官方执行器真 spawn stub 全链路)、`test/e2e/real-cli.e2e.test.ts`(真 ocr 二进制对照,缺席显式跳过)、`test/platform/guards.platform.test.ts`、`test/property/parse-chain.property.test.ts`(fast-check)、`test/ref-syntax-parity.test.ts`、`test/write-surface.test.ts`;devDependencies 新增 fast-check 4.10.2 与 `@deepseek-ai/dsh-bash-local` / `@deepseek-ai/dsh-subprocess-local`。
|
|
70
|
+
|
|
7
71
|
## 0.1.9
|
|
8
72
|
|
|
9
73
|
这一版把后台评审的作业归属钉到发起会话,并把设置卡与读面校验统一到 shared 组件和 zod;
|
|
10
|
-
插件页展示面进包,宿主开发线抬到 0.2.2-alpha.2。对外工具与 Remote
|
|
74
|
+
插件页展示面进包,宿主开发线抬到 0.2.2-alpha.2。对外工具与 Remote 方法名单不变,后台作业的可见性按发起会话收紧。
|
|
11
75
|
|
|
12
76
|
### Changed
|
|
13
77
|
|
|
@@ -23,7 +87,7 @@
|
|
|
23
87
|
- **插件页展示面进包**:新增 `locale/en.json`、`locale/zh.json` 与 `docs/DETAIL.md`、
|
|
24
88
|
`docs/DETAIL.zh.md`;`exports` 增加 `./locale/*.json`,`files` 收进 locale 与 docs。
|
|
25
89
|
- **宿主开发线抬到 `0.2.2-alpha.2`**:devDependencies 与 catalog/overrides 同值;`engines.dsh`
|
|
26
|
-
与 peer
|
|
90
|
+
与 peer 写支持窗口 `^0.2.1-rc.3`,README 补滚动窗口说明。
|
|
27
91
|
- **正则常量提升**:argv-guard / config-store / mcp-config / output / parse / provider-projection
|
|
28
92
|
的内联正则提取为命名常量,行为不变,满足 lint 的重复字面量门禁。
|
|
29
93
|
|
|
@@ -149,7 +213,7 @@
|
|
|
149
213
|
### Changed
|
|
150
214
|
|
|
151
215
|
- **外部 ocr CLI 改由用户自装**:判据先扫 PATH、其次才是随包兜底,装法由用户自选;版本声明
|
|
152
|
-
一处(package.json 的 `ocrCliVersion
|
|
216
|
+
一处(package.json 的 `ocrCliVersion`,初值 1.13.0;此前的随包 CLI 不记版本),代码镜像与两侧 README 由门禁对齐。按安装来源
|
|
153
217
|
(brew / npm)给对应的那条安装命令;来源判不出来时退回部署项 `ocrInstallHint` 的偏好。
|
|
154
218
|
- **实测版本与声明不符时不只说给人听**:probe 端点回 `expectedVersion`/`consistent`,工具回执
|
|
155
219
|
的 hint 也带上那句不一致说明。
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
- **One settings card also carries the admin surfaces**: a validated MCP servers JSON editor (saving touches only `mcp_servers`) and a ChatGPT section that reports `ocr auth` status and switches OCR's provider/model. Both are human-managed; neither is a model tool (a stdio MCP server runs commands, and OAuth sign-in needs a browser plus a local callback).
|
|
54
54
|
- **Wraps the external `ocr` (open-code-review) CLI into seven model tools.** The host validates tool arguments not at all, so every shape, type and enum gate lives in this package: user-controlled strings are single-quote escaped, enums are whitelist-clamped, and wrong-typed values error instead of silently narrowing or widening a review.
|
|
55
55
|
- **One settings card** (the web client half) picks provider/model from the host's own `llm-pi-ai` settings entry and key status from the host credentials service. When either service is absent the card shows the degradation reason; tools and settings keep working.
|
|
56
|
-
- **Applying a selection writes the CLI's own `~/.opencodereview/config.json`** — as an `api_key_cmd` command that reads the host credential ref at OCR runtime.
|
|
56
|
+
- **Applying a selection writes the CLI's own `~/.opencodereview/config.json`** — as an `api_key_cmd` command that reads the host credential ref at OCR runtime. The plugin never writes a plaintext key into `config.json`; the `.bak` it copies before the first rewrite keeps whatever the file held before, which may include a pre-migration plaintext key (mode 0600) — delete that backup after migrating.
|
|
57
57
|
- **Results are a structured summary with two distinct notions**: what OCR found (`status`, `aggregation`, `topComments`, `warnings`) and whether the run actually covered the selected files (`coverage`, `budgetExceeded`, `toolCalls`). The CLI is invoked with `--audience agent`, which suppresses its progress output — the second notion is only reachable through those fields.
|
|
58
58
|
- **CLI availability is one judgement** (`resolveOcrAvailability` in `lib/cli.ts`): pure filesystem, never a spawn, re-read per call. The card status row, the detail-page badge and the activation guidance all render that one answer, so "which copy is in use" cannot be told three ways.
|
|
59
59
|
- **Background runs (`wait: false`) are official host jobs**: `job_list` / `job_output` / `job_kill` can observe and stop a review that outlives the tool call.
|
|
@@ -67,10 +67,10 @@ dsh plugin --profile web add @jayyuen66/dsh-ocr-review
|
|
|
67
67
|
Remove with `dsh plugin --profile web remove @jayyuen66/dsh-ocr-review`. The package is on the public npm registry, so installation needs no credentials.
|
|
68
68
|
|
|
69
69
|
- **Upgrading an installed copy is remove-then-add.** On a profile running HMR (the shipped ones do), `add` on a package the profile already depends on refuses before pnpm runs (`already-installed`) — run `remove` first, then `add` the target version; the new one starts without a restart. Without HMR the same `add` runs pnpm and reports `restart-required`.
|
|
70
|
-
- **Requires Node.js `>= 22.12` and host `dsh` on the `0.2.1-rc.3` line.** The host reads `engines.dsh` (`^0.2.1-rc.3`) and decides on it alone; prereleases participate in the comparison. An incompatible host needs the explicit risk grant `dsh plugin --profile <p> allow-version @jayyuen66/dsh-ocr-review@<version> --dsh-version <exact> --accept-risk`. The support window rolls: this package is verified against
|
|
70
|
+
- **Requires Node.js `>= 22.12` and host `dsh` on the `0.2.1-rc.3` or `0.2.2-alpha.2` line.** The host reads `engines.dsh` (`^0.2.1-rc.3 || ^0.2.2-alpha.2`) and decides on it alone; prereleases participate in the comparison. An incompatible host needs the explicit risk grant `dsh plugin --profile <p> allow-version @jayyuen66/dsh-ocr-review@<version> --dsh-version <exact> --accept-risk`. The support window rolls: this package is verified against every released host version inside the window at publish time and re-verified once the window moves, so the version number in this bullet is not a standing promise.
|
|
71
71
|
- **No `@deepseek-ai/*` under `dependencies`, by contract** (`test/publish-manifest.test.ts` enforces it). Consumer profiles install with `nodeLinker: hoisted` and `autoInstallPeers: false`, so a host package there is materialized as a real directory next to the copy the running host already loaded. `@deepseek-ai/dsh-tools` keys its scheduler with a plain `Symbol` (not `Symbol.for`), so symbol identity is per instance and **every native tool call in that profile throws** — while this package's build, typecheck and coverage gates stay green right up to that moment.
|
|
72
|
-
- **The five host packages `host.js` imports as values are required peers**: `@deepseek-ai/schemastery` (the host fork — only it resolves `.volatile()` fields), `@deepseek-ai/dsh-credentials`, `@deepseek-ai/dsh-home-paths`, `@deepseek-ai/dsh-atomic-write` and `@deepseek-ai/dsh-typert-protocol` (the Remote service base). Each
|
|
73
|
-
- **What ships
|
|
72
|
+
- **The five host packages `host.js` imports as values are required peers**: `@deepseek-ai/schemastery` (the host fork — only it resolves `.volatile()` fields), `@deepseek-ai/dsh-credentials`, `@deepseek-ai/dsh-home-paths`, `@deepseek-ai/dsh-atomic-write` and `@deepseek-ai/dsh-typert-protocol` (the Remote service base). Each also appears in `devDependencies` pinned to the compile-time host line (which may differ from the peer support window above) so this repository's own typecheck resolves them; the build externalizes all manifest tables, keeping bare specifiers in the artifact.
|
|
73
|
+
- **What ships** (see `files` in `package.json`): `host.js`, `client.js`, `cordis.patch.yml`, `scripts/`, `locale/*.json`, `docs/`, `icon.svg`, `CHANGELOG.md` and `THIRD_PARTY_NOTICES.md`. `prepare` rebuilds the bundles, so nothing stale is published.
|
|
74
74
|
|
|
75
75
|
### <img src="https://api.iconify.design/lucide/arrow-down-to-line.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Shared version floor
|
|
76
76
|
|
|
@@ -78,11 +78,11 @@ If your profile pins `@jayyuen66/dsh-plugin-shared` with a pnpm `overrides` entr
|
|
|
78
78
|
|
|
79
79
|
## <img src="https://api.iconify.design/lucide/terminal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> The external CLI
|
|
80
80
|
|
|
81
|
-
This package spawns `ocr`; it never installs or upgrades it. The command contract is verified against **1.13.
|
|
81
|
+
This package spawns `ocr`; it never installs or upgrades it. The command contract is verified against **1.13.4** (`EXPECTED_OCR_CLI_VERSION` in `lib/cli.ts`, declared once as `ocrCliVersion` in package.json — tests pin the manifest, the code constant and both READMEs to the same string).
|
|
82
82
|
|
|
83
83
|
```sh
|
|
84
84
|
brew install open-code-review # the formula tracks the newest release
|
|
85
|
-
npm i -g @alibaba-group/open-code-review@1.13.
|
|
85
|
+
npm i -g @alibaba-group/open-code-review@1.13.4 # pinned to the version this plugin verifies against
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
- **brew cannot pin.** `homebrew/core` carries one stable formula and no versioned variant, so `brew install` / `brew upgrade` always yields whatever is newest upstream. The npm command is the only one that can carry the verified version.
|
|
@@ -105,7 +105,7 @@ npm i -g @alibaba-group/open-code-review@1.13.3 # pinned to the version thi
|
|
|
105
105
|
- **It does not install or upgrade the CLI.** The brew/npm commands are shown, never run; there is no update action and no clipboard API (a non-secure context would fail silently, looking like a dead button).
|
|
106
106
|
- **No HTTP route of its own.** The data plane is one official Typert Remote namespace (`ocrReview`) through the host `/api` gateway; authentication, Host / DNS-rebinding / Origin checks and body limits are the gateway's. This package holds no CSRF token, no body cap and no route disposer.
|
|
107
107
|
- **No CLI subcommand.** `dsh ocr …` does not exist.
|
|
108
|
-
- **
|
|
108
|
+
- **The plugin itself reads no file outside** the CLI's config path, the host credential document and `$DSH_HOME/.env` (through `scripts/get-cred.mjs`), the PATH directories it probes for the `ocr` binary, the OCR session store it lists, the temp files it creates, and the host settings / credentials services it is handed. Repository contents are read by the `ocr` child process as the reviewed input.
|
|
109
109
|
- What it *does* consume: the host `settings` and `credentials` services (provider list, key status), `shell` (every `ocr` subprocess), `jobs` (background runs) and `systemPrompt` (one routing section). A missing settings or credentials service degrades the card only — the tools keep working.
|
|
110
110
|
|
|
111
111
|
## <img src="https://api.iconify.design/lucide/plug.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Enabling it in dsh
|
|
@@ -128,7 +128,7 @@ npm i -g @alibaba-group/open-code-review@1.13.3 # pinned to the version thi
|
|
|
128
128
|
| `ocr_llm` | action providers/models: read-only LLM catalogue queries; no review and no connectivity test |
|
|
129
129
|
| List caps | exclude and path take up to 2000 entries each; exceeding the cap rejects the call. Entries are never silently dropped — "reviewed fewer files than the list" must not be reportable as success |
|
|
130
130
|
|
|
131
|
-
`wait: false` starts a background run with no host deadline (poll `ocr_session`; the subprocess is also an official job, see [Background runs as host jobs](#background-runs-as-host-jobs)), and the reaper guard takes the OCR process tree down when dsh exits in any way. Cancelling the tool call stops the corresponding background process.
|
|
131
|
+
`wait: false` starts a background run with no host deadline (poll `ocr_session`; the subprocess is also an official job, see [Background runs as host jobs](#background-runs-as-host-jobs)), and on POSIX the reaper guard takes the OCR process tree down when dsh exits in any way (Windows has no reaper, see [Platforms](#platforms)). Cancelling the tool call stops the corresponding background process.
|
|
132
132
|
|
|
133
133
|
## <img src="https://api.iconify.design/lucide/sliders-horizontal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Settings
|
|
134
134
|
|
|
@@ -165,8 +165,8 @@ One official Typert Remote namespace, `ocrReview` (`OCR_REMOTE_NAMESPACE` in `li
|
|
|
165
165
|
| `migrate()` | — | `{ok, migrated, skippedUnknown}` |
|
|
166
166
|
| `test()` | — | `{ok, output}` — `ok` is the **test verdict**, not whether the call ran; output is redacted first, then cut to 8000 characters |
|
|
167
167
|
| `probe()` | — | `{ok, version, expectedVersion, consistent, output, reason, changeText}` — one `ocr version` under a 15 s wall clock, with `OCR_NO_UPDATE=1`. `consistent` is three-state (`null` = nothing was measured, where claiming a mismatch would be claiming without evidence); `reason` names the failure arm; `changeText` carries the install/upgrade sentence only when there is a command to give |
|
|
168
|
-
| `mcp()` | — | `{ok, json}` — only the `mcp_servers` object as pretty JSON, never providers or keys |
|
|
169
|
-
| `saveMcp(request)` | `{json}` — raw JSON text, at most 64 KiB; stdio/remote entries are validated field by field | `{ok, count}` — writes only `mcp_servers`; other config is preserved |
|
|
168
|
+
| `mcp()` | — | `{ok, json, revision}` — only the `mcp_servers` object as pretty JSON, never providers or keys; `revision` is that branch's digest |
|
|
169
|
+
| `saveMcp(request)` | `{json, revision?}` — raw JSON text, at most 64 KiB; stdio/remote entries are validated field by field; `revision` is the digest from `mcp()` | `{ok, count, revision}` — writes only `mcp_servers`; other config is preserved. A stale `revision` refuses the whole write (nothing is written) and returns a readable "changed after it was read" error; omitting it keeps the old last-writer-wins behavior |
|
|
170
170
|
| `auth()` | — | `{ok, output, loginCommand}` — read-only `ocr auth status --provider chatgpt`; sign-in itself stays a terminal action because it needs a browser and a local callback |
|
|
171
171
|
| `chatGpt(request)` | `{model}` | `{ok, model}` — sets `provider: "chatgpt"` and `providers.chatgpt.model`, writes no key |
|
|
172
172
|
|
|
@@ -201,7 +201,7 @@ Refusals answer `{ok: false, error, status}` where `status` is a **retained sema
|
|
|
201
201
|
| --- | --- |
|
|
202
202
|
| Process boundary | The reviewed repository's paths and diff content go into the `ocr` child process, and the CLI sends them to the LLM endpoint configured in its own config.json — that egress is the review feature itself and does not pass through the dsh host. Plaintext keys never appear in tool results or Remote payloads; a value resolved by the host is used only to confirm "it resolves right now" and is discarded on the spot |
|
|
203
203
|
| Redaction | All raw CLI stdout/stderr leaving this package (failure details, llm test, parse-failure echoes, session passthrough) goes through `redactKeyMaterial()`: bearer and assignment forms strictly, the standalone-key form only with random-string features, so file paths handed to the model are not erased with it |
|
|
204
|
-
| On disk |
|
|
204
|
+
| On disk | The CLI's `config.json` (plus its temp sibling, the `.bak` backup and the short-lived lock), the `ocr-review-*` / `ocr-scan-*` temp files (deleted right after reading), and `ocr-session-export-*` directories, which hold the HTML returned by `ocr_session` `export` and are left in place for the caller. Pre-migration plaintext may persist in that `.bak` (mode 0600) — delete the backup yourself to be rid of it. Outside these, the only writer is the CLI's own npm wrapper unless `ocrNoAutoUpdate` is on |
|
|
205
205
|
|
|
206
206
|
## <img src="https://api.iconify.design/lucide/triangle-alert.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Known boundaries
|
|
207
207
|
|
|
@@ -219,7 +219,7 @@ Refusals answer `{ok: false, error, status}` where `status` is a **retained sema
|
|
|
219
219
|
| Exit 0 was taken as a successful review | Exit 0 is not success: any `status` outside success / complete / partial / completed_with_warnings / completed_with_errors / skipped reports as failure. `partial` means some files failed while coverage and the comments stand. A parse failure echoes the first 500 redacted UTF-16 code units of the raw output |
|
|
220
220
|
| Did the summary cover everything? | Two notions, neither replaces the other. `droppedCount` / `invalidCommentCount` say whether **this summary** listed every comment (raise `maxComments` or set 0 and re-check). Whether **the run** covered the selected files is `coverage` (`selected` is the denominator, `failedItems` names the files with their reasons) plus `budgetExceeded` and `toolCalls` |
|
|
221
221
|
| `add` was refused with `already-installed` | HMR profiles refuse `add` on an already-installed package before pnpm runs — `remove` first, then `add` the target version (see Install) |
|
|
222
|
-
| What happens to background processes when dsh exits? |
|
|
222
|
+
| What happens to background processes when dsh exits? | On POSIX the reaper guard takes the review/scan process tree down with TERM→1s→KILL on any host exit (including kill -9 followed by adoption); Windows has no reaper, so a hard host exit can leave an orphaned process. Cancelling the tool call stops the corresponding background process |
|
|
223
223
|
| Where might a plaintext key still sit? | Nowhere this package writes. A pre-migration config's plaintext may survive in the `.bak` produced by the first write after you migrate (mode 0600); delete that backup to be rid of it |
|
|
224
224
|
|
|
225
225
|
## <img src="https://api.iconify.design/lucide/wrench.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Development
|
|
@@ -231,8 +231,8 @@ pnpm run check # typecheck (both sides) → lint → client build → host bui
|
|
|
231
231
|
|
|
232
232
|
- Coverage thresholds are **100%** across four metrics over the surface `vitest.config.ts` opts into (`coverageInclude`: `host.ts` + `lib/**`); two areas are deliberately outside it: the client half (`src/**`) is exercised through the bundle and the settings-card tests, and `scripts/get-cred.mjs` is driven by process-level tests spawning a child (v8 coverage cannot see a child process) — its behavioral gate lives in `test/get-cred.test.ts`.
|
|
233
233
|
- Adding this package's **local directory** to a profile (`pnpm add <path>`) needs pnpm ≥ 12.3.0: earlier pnpm 12 releases resolve an unaliased local path as a registry package name (upstream #14437, fixed in 12.3.0). Installing from the registry is unaffected.
|
|
234
|
-
- Bundle freshness is pinned by `test/build-host.test.ts`: a stale `host.js` / `client.js` fails the suite. Never hand-edit the bundles; `
|
|
235
|
-
- The plugin source is TypeScript loaded directly by the host's cordis loader (Node ≥ 22.18 type stripping); the bundles exist for the published npm surface.
|
|
234
|
+
- Bundle freshness is pinned by `test/build-host.test.ts`: a stale `host.js` / `client.js` fails the suite. Never hand-edit the bundles; `prepare` rebuilds them.
|
|
235
|
+
- The plugin source is TypeScript loaded directly by the host's cordis loader (Node ≥ 22.18 type stripping); the bundles exist for the published npm surface. Installing from a local path (`pnpm add <path>`) therefore needs Node ≥ 22.18 — the `>= 22.12` floor above applies to the published bundles only.
|
|
236
236
|
|
|
237
237
|
## <img src="https://api.iconify.design/lucide/scale.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> License
|
|
238
238
|
|
package/README.zh-CN.md
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
- **设置卡还承载两块管理面**:可校验的 MCP servers JSON 编辑器(保存只改 `mcp_servers`),以及报告 `ocr auth` 登录态并切换 OCR provider/model 的 ChatGPT 区。两块都由人操作,不是模型工具(stdio MCP server 会执行命令,OAuth 登录需要浏览器与本地回调)。
|
|
54
54
|
- **把外部 `ocr`(open-code-review)CLI 封装成七个模型工具。** 宿主对工具入参零校验,形状、类型与枚举闸全在本包内:用户可控字符串一律单引号转义,枚举一律白名单钳制,错类型直接报错——绝不静默收窄或放宽审查范围。
|
|
55
55
|
- **一张设置卡片**(client 半)从宿主自己的 `llm-pi-ai` 设置条目取 provider/model 清单、从宿主凭据服务取 key 状态。两个服务缺席时卡片显示降级原因,工具与设置照常可用。
|
|
56
|
-
- **应用一次选择写的是 CLI 自己的 `~/.opencodereview/config.json`**——写进去的是 `api_key_cmd` 命令,OCR 运行期经它读宿主凭据 ref
|
|
56
|
+
- **应用一次选择写的是 CLI 自己的 `~/.opencodereview/config.json`**——写进去的是 `api_key_cmd` 命令,OCR 运行期经它读宿主凭据 ref;本包不把明文 key 写进 `config.json`,但首次改写前复制的 `.bak` 保留改写前的整份内容,其中可能有迁移前的明文 key(权限 0600),迁移后自行删除该备份。
|
|
57
57
|
- **评审结果是一份结构化摘要,字段分两套口径**:OCR 审出了什么(`status`/`aggregation`/`topComments`/`warnings`),以及这一场有没有真把选中的文件审完(`coverage`/`budgetExceeded`/`toolCalls`)。CLI 以 `--audience agent` 被调用,进度输出被它压掉——后一套口径只能从这些字段里读。
|
|
58
58
|
- **CLI 可得性只有一份判据**(`lib/cli.ts` 的 `resolveOcrAvailability`):纯读文件系统、绝不起进程、每次调用现读。设置卡状态行、插件详情页徽标与启用指引渲染的都是这同一份答案,「用的是哪一份」不许有三套说法。
|
|
59
59
|
- **后台运行(`wait: false`)是官方宿主作业**:`job_list` / `job_output` / `job_kill` 看得见、读得到、也停得掉一场超出工具调用生命周期的评审。
|
|
@@ -67,10 +67,10 @@ dsh plugin --profile web add @jayyuen66/dsh-ocr-review
|
|
|
67
67
|
卸载用 `dsh plugin --profile web remove @jayyuen66/dsh-ocr-review`。包在公共 npm 上,安装不需要凭据。
|
|
68
68
|
|
|
69
69
|
- **升级已装的那一份要「先 remove 再 add」。** profile 跑着 HMR(出厂那几个都跑)时,`add` 一个 profile 已经依赖着的包会在 pnpm 动手之前就被拒(`already-installed`)——先 `remove` 再 `add` 目标版本,新版不必重启就起跑。没跑 HMR 时同一个 `add` 照样走 pnpm,报 `restart-required`。
|
|
70
|
-
- **要求 Node.js `>= 22.12`,宿主 dsh 在 `0.2.1-rc.3` 线上。** 宿主只读 `engines.dsh`(`^0.2.1-rc.3`)并独立裁决,预发布号参与比较。不合的宿主要显式登记风险豁免:`dsh plugin --profile <p> allow-version @jayyuen66/dsh-ocr-review@<版本> --dsh-version <确切运行版本> --accept-risk
|
|
70
|
+
- **要求 Node.js `>= 22.12`,宿主 dsh 在 `0.2.1-rc.3` 或 `0.2.2-alpha.2` 线上。** 宿主只读 `engines.dsh`(`^0.2.1-rc.3 || ^0.2.2-alpha.2`)并独立裁决,预发布号参与比较。不合的宿主要显式登记风险豁免:`dsh plugin --profile <p> allow-version @jayyuen66/dsh-ocr-review@<版本> --dsh-version <确切运行版本> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证,窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
|
|
71
71
|
- **`dependencies` 里不放任何 `@deepseek-ai/*`,这是契约**(`test/publish-manifest.test.ts` 钉着)。消费方 profile 用 `nodeLinker: hoisted` 与 `autoInstallPeers: false` 安装,宿主包进了那张表就会落成真实目录,与宿主进程已加载的那份并存。`@deepseek-ai/dsh-tools` 的调度器键是普通 `Symbol`(不是 `Symbol.for`),符号身份按实例计算——那个 profile 里**每一次原生工具调用都抛**,而本包的构建、类型检查与覆盖率门在此前一路绿。
|
|
72
72
|
- **`host.js` 以值导入的五枚宿主包是非 optional 的 peer**:`@deepseek-ai/schemastery`(宿主 fork——`.volatile()` 的解析只在它有实现)、`@deepseek-ai/dsh-credentials`、`@deepseek-ai/dsh-home-paths`、`@deepseek-ai/dsh-atomic-write` 与 `@deepseek-ai/dsh-typert-protocol`(Remote 的 Service 基类)。五枚同时以同一钉版另列进 `devDependencies`,本仓自己的类型检查才解析得到;构建对 manifest 三张表一律外部化,产物里保持裸说明符。
|
|
73
|
-
-
|
|
73
|
+
- **发布面**(以 `package.json` 的 `files` 为准):`host.js`、`client.js`、`cordis.patch.yml`、`scripts/`、`locale/*.json`、`docs/`、`icon.svg`、`CHANGELOG.md` 与 `THIRD_PARTY_NOTICES.md`。`prepare` 重建两个 bundle,发出去的永远是当前源码的产物。
|
|
74
74
|
|
|
75
75
|
### <img src="https://api.iconify.design/lucide/arrow-down-to-line.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> shared 的版本下限
|
|
76
76
|
|
|
@@ -78,11 +78,11 @@ dsh plugin --profile web add @jayyuen66/dsh-ocr-review
|
|
|
78
78
|
|
|
79
79
|
## <img src="https://api.iconify.design/lucide/terminal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 外部 CLI
|
|
80
80
|
|
|
81
|
-
本包只 spawn `ocr`,从不安装或升级它。命令契约按 **1.13.
|
|
81
|
+
本包只 spawn `ocr`,从不安装或升级它。命令契约按 **1.13.4** 核对(`lib/cli.ts` 的 `EXPECTED_OCR_CLI_VERSION`,版本号只在 package.json 的 `ocrCliVersion` 声明一次——测试把 manifest、代码常量与两侧 README 钉成同一个串)。
|
|
82
82
|
|
|
83
83
|
```sh
|
|
84
84
|
brew install open-code-review # formula 只跟上游最新版
|
|
85
|
-
npm i -g @alibaba-group/open-code-review@1.13.
|
|
85
|
+
npm i -g @alibaba-group/open-code-review@1.13.4 # 钉在本包核对的那一版
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
- **brew 钉不住版本。** `homebrew/core` 里只有一份 stable formula、没有版本化变体,`brew install` / `brew upgrade` 拿到的永远是上游最新。带得上核对版本的只有 npm 那条。
|
|
@@ -105,7 +105,7 @@ npm i -g @alibaba-group/open-code-review@1.13.3 # 钉在本包核对的那
|
|
|
105
105
|
- **它不安装、不升级 CLI。** brew/npm 命令只展示、不执行;没有更新动作,也不接剪贴板 API(非安全上下文会静默失败,看上去像按钮没反应)。
|
|
106
106
|
- **没有自己的 HTTP 路由。** 数据面是一枚官方 Typert Remote 命名空间(`ocrReview`),经宿主 `/api` 网关到达;认证、Host / DNS 重绑定 / Origin 判据与请求体上限都是网关的。本包没有 CSRF token、没有 body 上限,也没有路由释放器。
|
|
107
107
|
- **没有 CLI 子命令。** 不存在 `dsh ocr …`。
|
|
108
|
-
-
|
|
108
|
+
- **本插件自己不读以下范围之外的文件**:CLI 配置路径、宿主凭据文档与 `$DSH_HOME/.env`(经 `scripts/get-cred.mjs`)、为找 `ocr` 二进制而探测的 PATH 目录、`ocr_session` 列出的会话存储、自己创建的临时文件,以及宿主交给它的设置 / 凭据服务。被审查仓库的内容由 `ocr` 子进程作为评审输入读取。
|
|
109
109
|
- 它*确实*消费的:宿主 `settings` 与 `credentials` 服务(provider 清单、key 状态)、`shell`(每一条 `ocr` 子进程)、`jobs`(后台运行)与 `systemPrompt`(一段路由)。settings 或 credentials 缺席只降级卡片——工具照常可用。
|
|
110
110
|
|
|
111
111
|
## <img src="https://api.iconify.design/lucide/plug.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 在 dsh 里启用
|
|
@@ -128,7 +128,7 @@ npm i -g @alibaba-group/open-code-review@1.13.3 # 钉在本包核对的那
|
|
|
128
128
|
| `ocr_llm` | action providers/models:只读查询 LLM 清单;不评审、不测连通性 |
|
|
129
129
|
| 清单上限 | exclude 与 path 各收 2000 条;超限直接拒绝整次调用。条目绝不静默丢弃——「比清单少审了几份」不许以成功的口径上报 |
|
|
130
130
|
|
|
131
|
-
`wait: false` 起后台运行、不挂宿主 deadline(用 `ocr_session` 轮询;该子进程同时是一枚官方作业,见[后台运行与官方作业](#后台运行与官方作业));dsh 以任何方式退出时,收割守护把 OCR
|
|
131
|
+
`wait: false` 起后台运行、不挂宿主 deadline(用 `ocr_session` 轮询;该子进程同时是一枚官方作业,见[后台运行与官方作业](#后台运行与官方作业));POSIX 上 dsh 以任何方式退出时,收割守护把 OCR 进程树收走(Windows 没有收割,见「已知边界」)。取消工具调用即终止对应的后台进程。
|
|
132
132
|
|
|
133
133
|
## <img src="https://api.iconify.design/lucide/sliders-horizontal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 设置项
|
|
134
134
|
|
|
@@ -163,10 +163,10 @@ npm i -g @alibaba-group/open-code-review@1.13.3 # 钉在本包核对的那
|
|
|
163
163
|
| `providers()` | — | `{providers(每条附 hasKey 布尔), current, getCredReady, source, endpointVerify, ocrBinary}`,不含任何明文 key。`ocrBinary` 是那份纯文件系统的可得性判定再补上版本上下文(`source`、`channel`、`expectedVersion`、`measuredVersion: string \| null`、`installHint`);读这个方法不起进程 |
|
|
164
164
|
| `select(request)` | `{provider, model}`,两者必须命中 `describe()` 给的清单 | `{ok, applied, llmTest}`(`autoVerify` 关闭时 `llmTest` 为 null) |
|
|
165
165
|
| `migrate()` | — | `{ok, migrated, skippedUnknown}` |
|
|
166
|
-
| `test()` | — | `{ok, output}`——`ok` 是**测试结论**,不是这次调用成没成;output
|
|
166
|
+
| `test()` | — | `{ok, output}`——`ok` 是**测试结论**,不是这次调用成没成;output 先脱敏再截前 8000 个 UTF-16 码元 |
|
|
167
167
|
| `probe()` | — | `{ok, version, expectedVersion, consistent, output, reason, changeText}`——15 秒墙钟内跑一次 `ocr version`,恒定带 `OCR_NO_UPDATE=1`。`consistent` 是三态(`null` = 没量到,此时宣称「不一致」就是把没证据的事说成结论);`reason` 点名失败那一档;`changeText` 只在真有一条该给的命令时非空 |
|
|
168
|
-
| `mcp()` | — | `{ok, json}`——只回 `mcp_servers` 对象(pretty JSON),不含 providers/keys |
|
|
169
|
-
| `saveMcp(request)` | `{json}`——原始 JSON 文本,上限 64 KiB;stdio/remote
|
|
168
|
+
| `mcp()` | — | `{ok, json, revision}`——只回 `mcp_servers` 对象(pretty JSON),不含 providers/keys;`revision` 是这一支的摘要 |
|
|
169
|
+
| `saveMcp(request)` | `{json, revision?}`——原始 JSON 文本,上限 64 KiB;stdio/remote 条目逐字段校验;`revision` 取 `mcp()` 交回的那一枚 | `{ok, count, revision}`——只写 `mcp_servers`,其他配置原样保留。基线过期时整笔拒绝(盘上不动)并回可读的「读取之后已被改动」;不带基线则沿用原来的后写覆盖 |
|
|
170
170
|
| `auth()` | — | `{ok, output, loginCommand}`——只读 `ocr auth status --provider chatgpt`;登录本身要浏览器与本地回调,仍留在终端执行 |
|
|
171
171
|
| `chatGpt(request)` | `{model}` | `{ok, model}`——写 `provider: "chatgpt"` 与 `providers.chatgpt.model`,不写 key |
|
|
172
172
|
|
|
@@ -201,7 +201,7 @@ npm i -g @alibaba-group/open-code-review@1.13.3 # 钉在本包核对的那
|
|
|
201
201
|
| --- | --- |
|
|
202
202
|
| 进程边界 | 被审查仓库的路径与 diff 内容进 `ocr` 子进程,CLI 再把它们发给自己在 config.json 里配置的 LLM 端点——这条外发是审查功能本身,不经 dsh 宿主。明文 key 不进工具返回、也不进 Remote 应答;宿主侧解析到的值只用于确认「现在解析得到」,当场丢弃 |
|
|
203
203
|
| 原始输出脱敏 | 本包出去的 CLI 原始 stdout/stderr(失败详情、llm test、解析失败回显、session 透传)统一过 `redactKeyMaterial()`:Bearer 与赋值形态从严抹除,独立 key 形态额外要求随机串特征,免得把要交给模型的文件路径一起抹掉 |
|
|
204
|
-
| 写盘范围 |
|
|
204
|
+
| 写盘范围 | CLI 的 `config.json`(含临时文件、`.bak` 备份与短暂的锁)、系统临时目录下的 `ocr-review-*` / `ocr-scan-*`(读完即删),以及 `ocr-session-export-*` 目录——那是 `ocr_session` 的 `export` 返回的 HTML,留给调用方,不自动删除。迁移前的明文可能留在那次写入产生的 `.bak` 里(权限 0600)——要彻底清掉需自行删除该备份。这些之外,`ocrNoAutoUpdate` 没置真时唯一的写者就是 CLI 自己那层 npm 包装 |
|
|
205
205
|
|
|
206
206
|
## <img src="https://api.iconify.design/lucide/triangle-alert.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 已知边界
|
|
207
207
|
|
|
@@ -216,7 +216,7 @@ npm i -g @alibaba-group/open-code-review@1.13.3 # 钉在本包核对的那
|
|
|
216
216
|
|
|
217
217
|
| 现象 / 问题 | 结论 |
|
|
218
218
|
| --- | --- |
|
|
219
|
-
| 把 exit 0 当成评审成功 | exit 0 不等于成功:`status` 不在 success / complete / partial / completed_with_warnings / completed_with_errors / skipped 白名单内即按失败报。`partial` 指部分文件失败、但覆盖与评论仍有效。解析失败时回显脱敏后原文的前 500 个 UTF-16 码元 |
|
|
219
|
+
| 把 exit 0 当成评审成功 | exit 0 不等于成功:`status` 不在 success / complete / partial / completed_with_warnings / completed_with_errors / skipped 白名单内即按失败报。`failed` 在名单里但**单独判成不成功**——它是 CLI 非零退出时照发的那份回执,覆盖明细(哪些文件没审成)由它承载,不与「解析失败、回显原文」混同。`partial` 指部分文件失败、但覆盖与评论仍有效。解析失败时回显脱敏后原文的前 500 个 UTF-16 码元 |
|
|
220
220
|
| 摘要有没有覆盖全部产出? | 两件不同的事,不能互相替代。`droppedCount` / `invalidCommentCount` 只说明**本摘要**有没有列全评论(调大 `maxComments` 或置 0 再复核)。**这一场**有没有把选中的文件审完看 `coverage`(`selected` 是分母,`failedItems` 给出文件名与原因)、`budgetExceeded` 与 `toolCalls` |
|
|
221
221
|
| `add` 被拒,报 `already-installed` | HMR profile 对已装包的 `add` 在 pnpm 动手之前就拒——先 `remove` 再 `add` 目标版本(见「安装」) |
|
|
222
222
|
| dsh 退出时后台进程怎么办? | 收割守护在任何宿主退出方式下(含 kill -9 后被收养)以 TERM→1s→KILL 收走 review/scan 的进程树;取消工具调用即终止对应的后台进程 |
|
|
@@ -231,7 +231,7 @@ pnpm run check # typecheck(两侧)→ lint → client 构建 → host 构
|
|
|
231
231
|
|
|
232
232
|
- 覆盖率阈值**四项 100%**,分母是 `vitest.config.ts` 里 `coverageInclude` 选定的那一面(`host.ts` + `lib/**`);两块刻意在分母外:客户端半(`src/**`)经 bundle 与设置卡用例覆盖,`scripts/get-cred.mjs` 由进程级用例另起进程驱动(v8 覆盖率看不到子进程),它的行为门禁在 `test/get-cred.test.ts`。
|
|
233
233
|
- 往 profile 加本包的**本地目录**(`pnpm add <路径>`)需要 pnpm ≥ 12.3.0:更早的 pnpm 12 把无别名的本地路径当 registry 包名解析(上游 #14437,12.3.0 修复)。从 registry 装不受影响。
|
|
234
|
-
- 产物新鲜度由 `test/build-host.test.ts` 钉着:`host.js` / `client.js` 落后于源码就红。发布物不手改;`
|
|
234
|
+
- 产物新鲜度由 `test/build-host.test.ts` 钉着:`host.js` / `client.js` 落后于源码就红。发布物不手改;`prepare` 重建。
|
|
235
235
|
- 插件源码是 TypeScript,由宿主的 cordis Loader 直接加载(Node ≥ 22.18 类型剥离);bundle 只为 npm 发布面存在。
|
|
236
236
|
|
|
237
237
|
## <img src="https://api.iconify.design/lucide/scale.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 许可
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -20,17 +20,46 @@
|
|
|
20
20
|
- 上游许可:MIT,Copyright (c) Paweł Kuna
|
|
21
21
|
- 取用图标:`code`(https://icones.js.org/icons/tabler/code)
|
|
22
22
|
|
|
23
|
-
`icon.svg`
|
|
24
|
-
|
|
23
|
+
`icon.svg` 的形状取自该图标的**两枚尖括号**(上游 outline `code` 的 path 实量:左枚
|
|
24
|
+
`M7 8l-4 4 4 4`、右枚 `M17 8l4 4-4 4`):左枚平移 (+1, −1) 落到 `m8 7`;右枚纵坐标同样收 1,
|
|
25
|
+
横坐标从 17 落到 14——按同一平移本该落在 18,这里比它多收 4,两枚起点的间距因此由 10 变 6;
|
|
26
|
+
中间的斜杠笔画(`M14 4l-4 16`)去掉。另加一枚
|
|
27
|
+
对勾段(形态对齐 Tabler `check` 的圆角折线笔画)。改动都不引入新的第三方形状:把
|
|
25
28
|
`currentColor` 换成本包插件图标配色(`#658EFF` 主色 + `#54ECE7` 底衬),并把外层 `<g>` 与
|
|
26
29
|
画布尺寸对齐本族插件统一的 `36×36` / `viewBox 0 0 24 24` 规格。
|
|
27
30
|
|
|
31
|
+
`icon.svg` 随包分发,没有独立的 npm 包承载上游许可文本,因此在下文完整保留 MIT 正文:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
MIT License
|
|
35
|
+
|
|
36
|
+
Copyright (c) Paweł Kuna
|
|
37
|
+
|
|
38
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
39
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
40
|
+
in the Software without restriction, including without limitation the rights
|
|
41
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
42
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
43
|
+
furnished to do so, subject to the following conditions:
|
|
44
|
+
|
|
45
|
+
The above copyright notice and this permission notice shall be included in all
|
|
46
|
+
copies or substantial portions of the Software.
|
|
47
|
+
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
51
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
52
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
53
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
54
|
+
SOFTWARE.
|
|
55
|
+
```
|
|
56
|
+
|
|
28
57
|
## 机制与接口来源:open-code-review(ocr CLI)
|
|
29
58
|
|
|
30
59
|
- 上游项目:`open-code-review`
|
|
31
60
|
- 上游仓库:https://github.com/alibaba/open-code-review
|
|
32
61
|
- 上游许可:Apache-2.0,Copyright 2026 Alibaba
|
|
33
|
-
- 验证版本:1.13.
|
|
62
|
+
- 验证版本:1.13.4(声明在 package.json 的 `ocrCliVersion`,代码里的镜像常量、两侧 README 与随包文档由门禁对齐同一枚数字)
|
|
34
63
|
|
|
35
64
|
本包**使用**而非**包含**以下接口(`host.ts` / `lib/cli.ts` 的头注释按该版本源码逐条核对):
|
|
36
65
|
|
|
@@ -55,8 +84,9 @@
|
|
|
55
84
|
|
|
56
85
|
| 依赖 | 版本 | 许可 | 引入方 |
|
|
57
86
|
| --- | --- | --- | --- |
|
|
58
|
-
| `@alibaba-group/open-code-review` | 1.13.
|
|
59
|
-
| `js-yaml` |
|
|
87
|
+
| `@alibaba-group/open-code-review` | 1.13.4(核对版本,非依赖) | Apache-2.0(Alibaba) | **不在依赖表里**:用户自选 `brew install open-code-review` 或 `npm i -g @alibaba-group/open-code-review@<版本>`,本包只 spawn 它 |
|
|
88
|
+
| `js-yaml` | 5.4.3(精确钉版) | MIT | `scripts/get-cred.mjs` 读 dsh 托管凭据文档 |
|
|
89
|
+
| `@jayyuen66/dsh-plugin-shared` | catalog(伞根 0.2.3) | MIT | `host.ts` / `lib/*` / `src/*` 的 job-outcome、locale、record、errors、card-* 等公共面(值导入,构建时外部化) |
|
|
60
90
|
| `zod` | catalog(伞根 4.6.7) | MIT | 设置卡 `src/remote.ts` 的 strict codec 形状校验;client 产物由宿主 `PLATFORM_MODULES` 提供 |
|
|
61
91
|
|
|
62
|
-
dsh 宿主侧的包分两档:产物里以**值**导入、且列在 `peerDependencies` 的五枚(`@deepseek-ai/schemastery` 宿主 fork、`@deepseek-ai/dsh-credentials`、`@deepseek-ai/dsh-home-paths`、`@deepseek-ai/dsh-atomic-write` 与 `@deepseek-ai/dsh-typert-protocol`)由宿主在场提供、不随本包分发;其余 `@deepseek-ai/dsh-*` 与 `@deepseek-ai/cordis` 只在 `devDependencies` 里,用途是把类型绑到官方声明上(type-only 绑定),产物里不留说明符。本包按 dsh `0.2.2-alpha.
|
|
92
|
+
dsh 宿主侧的包分两档:产物里以**值**导入、且列在 `peerDependencies` 的五枚(`@deepseek-ai/schemastery` 宿主 fork、`@deepseek-ai/dsh-credentials`、`@deepseek-ai/dsh-home-paths`、`@deepseek-ai/dsh-atomic-write` 与 `@deepseek-ai/dsh-typert-protocol`)由宿主在场提供、不随本包分发;其余 `@deepseek-ai/dsh-*` 与 `@deepseek-ai/cordis` 只在 `devDependencies` 里,用途是把类型绑到官方声明上(type-only 绑定),产物里不留说明符。本包按 dsh `0.2.2-alpha.3` 逐条核对过(同版的 cordis `4.0.6-alpha.2` 与 schemastery `3.18.6-alpha.2` fork 一并核对)。
|