jiayan-xu/dsh-ocr-review

本地 AI 代码评审门禁:对工作区/分支/commit diff 跑评审(托管 ocr.js),返回结构化 findings 与 token 统计;门禁模式发现问题即失败。

Bundle 已验证 未知 JavaScript 未知
Bundle 已验证

已收录

0

Git

Bundle 已验证

版本未知
语言JavaScript
许可证未知
在 GitHub 查看

功能介绍

本地 AI 代码评审门禁:对工作区/分支/commit diff 跑评审(托管 ocr.js),返回结构化 findings 与 token 统计;门禁模式发现问题即失败。

适合

  • 提交前需要评审工作区未提交变更的开发者。
  • 需要对分支 merge-base 范围或单个 commit 做结构化 AI 评审的团队。
  • 希望评审一旦产生 findings 就失败的本地或 CI 门禁。
  • 需要规范化 findings、评审会话信息和 token 统计的用户。

不适合

  • 没有工作区、分支范围或 commit diff 可供评审的全仓库审计。
  • 缺少托管 `ocr.js`、Node.js 可执行文件或已配置 LLM 提供方访问的环境。
  • 关键文件命中默认排除 glob 且未覆盖排除配置的评审。
  • 需要门禁按严重级别区分是否失败的工作流,因为 gate 模式会对任何评论失败。

README

dsh-ocr-review

dsh-ocr-review is a local OpenCodeReview gate for DSH. It runs the managed ocr.js executable against repository changes and returns structured review findings and summary information, including token statistics.

Capabilities

The plugin registers two tools:

  • ocr_review reviews uncommitted workspace changes, a merge-base range, or a single commit.
  • ocr_llm_test runs ocr llm test to check the configured provider and LLM connection.

Review findings are normalized to include path, line, severity, category, and message fields. The result also includes the review status, message, session ID, and summary.

When gate is enabled, ocr_review throws an error if the review returns one or more comments.

Review Options

ocr_review accepts:

  • repo: Absolute repository working directory. Defaults to the current working directory.
  • from: Base ref for a merge-base review. When omitted, workspace changes are reviewed.
  • to: Target ref used with from. Defaults to HEAD.
  • commit: A single commit to review; mutually exclusive with from and to.
  • exclude: Comma-separated exclusion globs.
  • gate: Fail when findings are present.
  • provider: Override the configured provider.
  • model: Override the configured model.

The default exclusions are:

.github/**,.githooks/**,scripts/ocr-review.sh,**/__pycache__/**,**/*.bak,**/*.exe,**/*.csv,**/target/**

ocr_llm_test accepts an optional repo working directory.

Configuration

By default, provider configuration is read from:

~/.opencodereview/config.json

The managed executable paths and default exclusions can be overridden with these environment variables:

  • OCR_NODE_BIN: Node.js executable path.
  • OCR_OCR_BIN: OpenCodeReview ocr.js path.
  • OCR_DEFAULT_EXCLUDE: Default comma-separated exclusion globs.

The package includes a Cordis bundle patch that registers @jhp830901/dsh-ocr-review. It declares DSH >=0.0.1, depends on @deepseek-ai/dsh-tools, and has a peer dependency on @deepseek-ai/cordis.

License

MIT

常见问题常见问题

在启用了 DSH 的终端中执行已验证命令 dsh plugin --profile default add github:jiayan-xu/dsh-ocr-review。命令会解析公开 package 元数据,并保持插件与本页展示的目录身份一致。