Skip to content

更新过期 Skill - #37

Merged
HengXin666 merged 1 commit into
mainfrom
hygiene/skills-4-20261018220222
Oct 18, 2026
Merged

HengXin666 merged 1 commit into
mainfrom
hygiene/skills-4-20261018220222

Conversation

@HengXin666

Copy link
Copy Markdown
Owner

由仓库卫生审阅单执行.

  • .agents/skills/hx-agent-notes 1.0 -> 2.3 (来自 HXLoLi .agents/skills/hx-agent-notes)

@HengXin666
HengXin666 merged commit 04f65c7 into main Oct 18, 2026
@HengXin666
HengXin666 deleted the hygiene/skills-4-20261018220222 branch October 18, 2026 14:02
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

升级 hx-agent-notes 至 2.3,建立严格的决策双向校验

✨ Enhancement ⚙️ Configuration changes 📝 Documentation 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• 将决策记录与源码的关联升级为精确路径、AST 声明锚点和双端 diff 校验。
• 重建安装、迁移与退役流程,让本地检查和提交钩子共用严格扫描器。
• 新增容错 CI 诊断与 GitHub 代码评论,并补充跨语言和 Git 快照测试。
Diagram

graph TD
  A["项目安装器"] --> B["精确路径配置"] --> C["Git 快照"] --> D["AST 锚点"] --> E["双向关系图"] --> F["JSON 诊断"] --> G["CI 评论"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. 延续 v1 文本与路径门禁
  • ➕ 无需引入 uv 和 Tree-sitter
  • ➕ 现有项目迁移成本较低
  • ➖ 无法确认引用是否位于真实声明
  • ➖ 无关 note 仍可能掩盖源码改动
2. 将 CI 诊断改为阻断检查
  • ➕ 可直接配合分支保护阻止违规合并
  • ➖ 需要人工判断的单边改动也会被机械阻断
  • ➖ 不符合本次区分结构错误与待审核事项的策略

Recommendation: 严格 AST 扫描器更符合精确双向关联的目标。保留本地严格退出码与 CI 容错报告的区分,并在迁移时独立审核保护范围和评论权限。

Files changed (55) +3401 / -405

Enhancement (12) +1388 / -0
base.py解析 PR 与 push 的精确比较端点 +26/-0

解析 PR 与 push 的精确比较端点

• 计算 PR merge-base,并为首次分支 push 使用空树基线。

.agents/skills/hx-agent-notes/scripts/github/base.py

collect.py容错收集严格扫描诊断 +49/-0

容错收集严格扫描诊断

• 扫描器失败或工具缺失时也生成明确的 JSON 诊断。

.agents/skills/hx-agent-notes/scripts/github/collect.py

diagnostics.ts验证并定位 GitHub 报告 +142/-0

验证并定位 GitHub 报告

• 校验附件归属、路径和行号,聚合问题并映射 diff 位置。

.agents/skills/hx-agent-notes/scripts/github/diagnostics.ts

report.ts发布并更新 GitHub 诊断评论 +120/-0

发布并更新 GitHub 诊断评论

• 发布 PR 行内或提交评论,无法定位时汇总,并复用已有机器人评论。

.agents/skills/hx-agent-notes/scripts/github/report.ts

anchors.py新增多语言 AST 声明锚点解析 +121/-0

新增多语言 AST 声明锚点解析

• 核对决策引用是否位于合法声明注释或 Python docstring。

.agents/skills/hx-agent-notes/scripts/redline/anchors.py

graph.py新增决策双向图与 diff 配对检查 +214/-0

新增决策双向图与 diff 配对检查

• 验证 note 格式、Code 路径、唯一锚点及两端同步变化。

.agents/skills/hx-agent-notes/scripts/redline/graph.py

snapshot.py新增精确 Git 快照与保护范围读取 +131/-0

新增精确 Git 快照与保护范围读取

• 读取工作区、暂存区或提交树,验证 v2 配置并保留显式迁移的旧保护范围。

.agents/skills/hx-agent-notes/scripts/redline/snapshot.py

verify.py新增统一严格校验 CLI +102/-0

新增统一严格校验 CLI

• 编排全量、diff 和暂存区检查,生成 JSON 诊断及相应退出码。

.agents/skills/hx-agent-notes/scripts/redline/verify.py

install.py新增项目级 v2 安装器 +122/-0

新增项目级 v2 安装器

• 安装 vendored skill、精确路径配置、项目入口、Agent 指令与可选工作流。

.agents/skills/hx-agent-notes/scripts/setup/install.py

maintain.py新增决策清单和显式退役工具 +56/-0

新增决策清单和显式退役工具

• 列出决策;删除前检查入站引用,并要求显式 --apply。

.agents/skills/hx-agent-notes/scripts/setup/maintain.py

new_note.py新增精确路径 note 骨架生成器 +44/-0

新增精确路径 note 骨架生成器

• 要求现存源码代表文件及每目录唯一 Code 路径。

.agents/skills/hx-agent-notes/scripts/setup/new_note.py

note-triage.py新增非阻断的 note 写作辅助工具 +261/-0

新增非阻断的 note 写作辅助工具

• 依据显式配置的外部客户端评估改动,不参与严格门禁。

.agents/skills/hx-agent-notes/scripts/triage/note-triage.py

Refactor (16) +572 / -7
archive-note.ts修正旧归档工具的库导入 +1/-1

修正旧归档工具的库导入

• 改从拆分后的共享库读取存量归档函数。

.agents/skills/hx-agent-notes/scripts/authoring/archive-note.ts

build-board.ts适配看板工具的新目录布局 +2/-2

适配看板工具的新目录布局

• 调整共享库导入和 HTML 模板路径。

.agents/skills/hx-agent-notes/scripts/authoring/build-board.ts

init-agent-notes.ts将旧安装入口委托给 v2 安装器 +15/-0

将旧安装入口委托给 v2 安装器

• 转发参数和退出码到 Python 安装工具。

.agents/skills/hx-agent-notes/scripts/authoring/init-agent-notes.ts

new-note.ts将旧新建入口委托给 v2 骨架工具 +6/-0

将旧新建入口委托给 v2 骨架工具

• 转发参数和退出码到 Python note 生成器。

.agents/skills/hx-agent-notes/scripts/authoring/new-note.ts

seal-archive.ts适配旧 seal 命令的共享库路径 +1/-1

适配旧 seal 命令的共享库路径

• 继续为 v1 存量调研提供归档校验。

.agents/skills/hx-agent-notes/scripts/cli/seal-archive.ts

verify-all.ts让旧完整校验入口执行 v2 门禁 +11/-0

让旧完整校验入口执行 v2 门禁

• 将命令参数转交统一扫描器,避免绕开新规则。

.agents/skills/hx-agent-notes/scripts/cli/verify-all.ts

verify-backlinks.ts让旧反向链接入口执行 v2 门禁 +2/-0

让旧反向链接入口执行 v2 门禁

• 通过共享转发器运行完整双向校验。

.agents/skills/hx-agent-notes/scripts/cli/verify-backlinks.ts

verify-coverage.ts让旧覆盖率入口执行 v2 门禁 +2/-0

让旧覆盖率入口执行 v2 门禁

• 通过共享转发器运行完整 AST 与 diff 校验。

.agents/skills/hx-agent-notes/scripts/cli/verify-coverage.ts

verify-format.ts适配存量格式工具的库路径 +2/-2

适配存量格式工具的库路径

• 修正类型和共享函数导入;该工具不作为 v2 放行依据。

.agents/skills/hx-agent-notes/scripts/cli/verify-format.ts

verify-tree.ts适配存量目录工具的库路径 +1/-1

适配存量目录工具的库路径

• 将共享函数导入指向拆分后的 lib 模块。

.agents/skills/hx-agent-notes/scripts/cli/verify-tree.ts

config.ts拆出旧配置与仓库定位工具 +184/-0

拆出旧配置与仓库定位工具

• 保留 v1 配置发现和工作树边界判断,供存量工具使用。

.agents/skills/hx-agent-notes/scripts/lib/config.ts

glob.ts拆出旧 glob 和参数解析工具 +83/-0

拆出旧 glob 和参数解析工具

• 保留路径匹配与参数处理;v2 决策关联不使用 glob。

.agents/skills/hx-agent-notes/scripts/lib/glob.ts

manifest.ts拆出存量归档 manifest 工具 +63/-0

拆出存量归档 manifest 工具

• 提供哈希、读写及相对基线的追加校验。

.agents/skills/hx-agent-notes/scripts/lib/manifest.ts

notes-lib.ts建立旧共享库的统一导出入口 +9/-0

建立旧共享库的统一导出入口

• 重新导出拆分后的配置、目录、glob 与归档模块。

.agents/skills/hx-agent-notes/scripts/lib/notes-lib.ts

seal.ts拆出存量归档 seal 校验 +72/-0

拆出存量归档 seal 校验

• 保留冻结文件与 manifest 哈希一致性检查。

.agents/skills/hx-agent-notes/scripts/lib/seal.ts

tree.ts拆出旧目录遍历与链接提取 +118/-0

拆出旧目录遍历与链接提取

• 提供存量生命周期扫描及 Markdown 链接读取。

.agents/skills/hx-agent-notes/scripts/lib/tree.ts

Documentation (12) +401 / -324
SKILL.md重写 v2.3 Skill 任务指南 +82/-104

重写 v2.3 Skill 任务指南

• 规定精确 Code 路径、AST 锚点、双端 diff 校验及显式迁移流程。

.agents/skills/hx-agent-notes/SKILL.md

AGENTS.snippet.md简化根目录 Agent 指令 +7/-28

简化根目录 Agent 指令

• 要求先读决策记录、维护双向关联并运行新门禁,替代旧豁免与归档指引。

.agents/skills/hx-agent-notes/assets/AGENTS.snippet.md

notes-contract.md新增项目 notes 目录的机械契约 +19/-0

新增项目 notes 目录的机械契约

• 明确格式、声明锚点、目录覆盖、diff 配对与人工审核边界。

.agents/skills/hx-agent-notes/assets/notes-contract.md

ast-contract.md记录 AST 锚点支持与失败边界 +25/-0

记录 AST 锚点支持与失败边界

• 说明语言解析器、合法声明位置和解析失败规则。

.agents/skills/hx-agent-notes/references/ast-contract.md

github.md说明 GitHub 诊断与评论模型 +27/-0

说明 GitHub 诊断与评论模型

• 记录工作流权限、可信报告、评论定位及容错行为。

.agents/skills/hx-agent-notes/references/github.md

mechanism.md将维护策略改为显式退役 +17/-56

将维护策略改为显式退役

• 说明决策保留、更新、合并或删除的判断标准,不再创建永久归档。

.agents/skills/hx-agent-notes/references/mechanism.md

note-format.md定义 v2 决策格式与源码关联 +44/-45

定义 v2 决策格式与源码关联

• 加入 Decision-ID、逐行 Code 路径和每目录唯一锚点要求。

.agents/skills/hx-agent-notes/references/note-format.md

verify.md重写安装、扫描和迁移说明 +34/-51

重写安装、扫描和迁移说明

• 说明精确 guarded 配置、Git 快照模式、退出码与 v1 迁移审核。

.agents/skills/hx-agent-notes/references/verify.md

writing.md整合写作和语义自检指南 +105/-0

整合写作和语义自检指南

• 集中说明正文精简、备选方案审阅和全库审计方法。

.agents/skills/hx-agent-notes/references/writing.md

implemented.md更新已落地决策模板 +12/-14

更新已落地决策模板

• 加入 Decision-ID、Code 路径和统一必需章节。

.agents/skills/hx-agent-notes/templates/implemented.md

proposed.md更新提案决策模板 +13/-16

更新提案决策模板

• 加入代表源码路径及统一决策章节。

.agents/skills/hx-agent-notes/templates/proposed.md

rejected.md更新否决决策模板 +16/-10

更新否决决策模板

• 统一状态格式,并加入 Decision-ID、Code 和后果章节。

.agents/skills/hx-agent-notes/templates/rejected.md

Other (15) +1040 / -74
github-actions.yml改用默认分支实现收集 diff 诊断 +32/-31

改用默认分支实现收集 diff 诊断

• 对 PR 和 push 扫描精确比较范围,容错上传 JSON 报告。

.agents/skills/hx-agent-notes/assets/ci/github-actions.yml

github-full.yml新增默认分支全量扫描工作流 +33/-0

新增默认分支全量扫描工作流

• 在主线 push 后检查完整决策图并上传诊断。

.agents/skills/hx-agent-notes/assets/ci/github-full.yml

github-report.yml新增受信任的评论工作流 +33/-0

新增受信任的评论工作流

• 通过 workflow_run 读取扫描附件,在默认分支上下文中发布评论。

.agents/skills/hx-agent-notes/assets/ci/github-report.yml

gitlab-ci.yml将 GitLab MR 检查改为容错诊断收集 +9/-24

将 GitLab MR 检查改为容错诊断收集

• 使用 uv 环境运行共享收集器,并保存 JSON artifact。

.agents/skills/hx-agent-notes/assets/ci/gitlab-ci.yml

pre-commit让提交钩子校验精确暂存区 +3/-19

让提交钩子校验精确暂存区

• 改为运行项目红线入口的 --staged 模式。

.agents/skills/hx-agent-notes/assets/hooks/pre-commit

package.json固定报告模块为 CommonJS +1/-0

固定报告模块为 CommonJS

• 确保 GitHub 报告脚本兼容采用 ESM 的宿主项目。

.agents/skills/hx-agent-notes/scripts/github/package.json

requirements.txt固定 AST 解析器版本 +7/-0

固定 AST 解析器版本

• 声明 Tree-sitter 和所支持语言的解析器依赖。

.agents/skills/hx-agent-notes/scripts/redline/requirements.txt

run.ts统一旧命令到 Python 门禁的转发 +10/-0

统一旧命令到 Python 门禁的转发

• 经 uv 启动严格扫描器并传递其退出码。

.agents/skills/hx-agent-notes/scripts/redline/run.ts

test_grouping.ts测试按决策聚合评论 +69/-0

测试按决策聚合评论

• 覆盖多源码列表、未关联资源和重跑更新。

.agents/skills/hx-agent-notes/scripts/tests/github/test_grouping.ts

test_anchors.py测试跨语言 AST 锚点 +87/-0

测试跨语言 AST 锚点

• 用真实解析器验证合法声明与错误引用位置。

.agents/skills/hx-agent-notes/scripts/tests/test_anchors.py

test_collect.py测试 CI 诊断收集容错 +51/-0

测试 CI 诊断收集容错

• 覆盖正常扫描、违规、非法基线及 uv 缺失。

.agents/skills/hx-agent-notes/scripts/tests/test_collect.py

test_gate.py测试隔离 Git 仓库中的门禁语义 +222/-0

测试隔离 Git 仓库中的门禁语义

• 覆盖配对、删除改名、暂存区、策略变更与豁免绕过。

.agents/skills/hx-agent-notes/scripts/tests/test_gate.py

test_links.py测试双向链接与目录覆盖 +111/-0

测试双向链接与目录覆盖

• 验证锚点、入站链接、非 AST 资源和迁移诊断。

.agents/skills/hx-agent-notes/scripts/tests/test_links.py

test_report.ts测试 GitHub 评论定位与回退 +283/-0

测试 GitHub 评论定位与回退

• 模拟 API 验证评论、附件校验、删除文件定位与失败兜底。

.agents/skills/hx-agent-notes/scripts/tests/test_report.ts

test_setup.py测试安装、骨架和退役 +89/-0

测试安装、骨架和退役

• 检查安装幂等、冲突保护、引用阻断和首次 push 基线。

.agents/skills/hx-agent-notes/scripts/tests/test_setup.py

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (7) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. 新增归档文件时封存命令崩溃 🔴 P0 ●●● Strong 🐞 Bug ≡ Correctness
Description
verifyArchive() 在写入清单时调用了未导入的 mkdirSync、dirname 和 writeFileSync。当 seal-archive --write
发现尚未封存且其他检查均通过的归档文件时,该分支抛出 ReferenceError,清单无法更新。
Code

.agents/skills/hx-agent-notes/scripts/lib/seal.ts[R68-69]

+    mkdirSync(dirname(manifestPathFor(loaded)), { recursive: true })
+    writeFileSync(manifestPathFor(loaded), renderManifest(manifest.files))
Relevance

●●● Strong

Missing imports cause deterministic runtime failure in an explicitly supported write path.

PR-#37
PR-#31

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
导入列表不包含写入分支使用的三个函数;新条目会进入该分支,而命令行入口直接传入写入模式。

.agents/skills/hx-agent-notes/scripts/lib/seal.ts[6-7]
.agents/skills/hx-agent-notes/scripts/lib/seal.ts[52-69]
.agents/skills/hx-agent-notes/scripts/cli/seal-archive.ts[10-13]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`seal-archive --write` 新增归档条目时因未导入的函数而崩溃。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/scripts/lib/seal.ts[6-7]
- .agents/skills/hx-agent-notes/scripts/lib/seal.ts[66-69]
## Recommended Fix
从 `node:fs` 导入 `mkdirSync`、`writeFileSync`,从 `node:path` 导入 `dirname`,并验证新增归档条目的写入路径。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


2. 笔记门禁 CI 和 npm 脚本都找不到入口文件 🔴 P0 ●●● Strong 🐞 Bug ☼ Reliability
Description
本 PR 删除了
scripts/verify-all.ts、scripts/verify-backlinks.ts、scripts/verify-coverage.ts、scripts/new-note.ts
和 scripts/notes-lib.ts,替代入口移到了 scripts/cli/ 和 scripts/authoring/ 下。但
.github/workflows/agent-notes.yml、package.json 里的
verify-notes/verify-notes:staged/verify-notes:coverage/verify-notes:backlinks/notes:new,以及
.agents/notes/AGENTS.md 都没改,仍然指向旧路径,合并后每次 PR/push 的 agent-notes job 都会因为文件不存在而直接失败,本地 hook 和 npm
命令也一样跑不起来。
Code

.agents/skills/hx-agent-notes/scripts/verify-all.ts[L1-3]

-/**
- * Run every Agent Notes gate in order and report one aggregate verdict.
- * Usage: npx tsx scripts/verify-all.ts [--staged | --base <ref>] [--repo <dir>]
Relevance

●●● Strong

Deleted entrypoints remain referenced by CI, npm scripts, and documentation, causing deterministic
repository-wide failures.

PR-#37

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
工作流和 package.json 调用的路径已被本 PR 删除。新入口 scripts/cli/verify-all.ts 位置不同,而且要经 uv 运行 Python,但 CI 只装了
Node,没有装 uv。

.github/workflows/agent-notes.yml[28-43]
package.json[24-32]
.agents/notes/AGENTS.md[22-22]
.agents/skills/hx-agent-notes/scripts/redline/run.ts[1-10]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
skill 升级时删除了 `scripts/verify-all.ts` 等旧入口,但仓库里的 CI 工作流、package.json 脚本和 notes 文档还在引用这些旧路径,门禁会直接失败。

## Fix Focus Areas
- .github/workflows/agent-notes.yml[28-43]
- package.json[24-32]
- .agents/notes/AGENTS.md[22-22]
- .agents/notes/archived/AGENTS.md[7-7]
- .agents/notes/implemented/AGENTS.md[7-7]

## Recommended Fix
把这些引用改到新路径(`scripts/cli/*.ts`、`scripts/authoring/*.ts`),或者直接调用 `uv run --with-requirements .../scripts/redline/requirements.txt python .../scripts/redline/verify.py`。CI 中要加 `astral-sh/setup-uv`,也可以参考新的 `assets/ci/github-actions.yml` 重写工作流。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


3. 仓库仍是 v1 配置,新门禁一运行就报配置错误 🔴 P0 ●●● Strong 🐞 Bug ≡ Correctness
Description
Snapshot.config() 要求 .agents/notes.config.json 只能包含 version 和 guarded,并且 version == 2,否则抛出
ValueError,门禁以退出码 2 结束。本仓库的配置仍是 v1 结构(root/coverage/backlinks 等字段),本 PR 没有运行
setup/install.py,也没有迁移配置;因此即使把调用改到新入口(包括保留旧命令名的
cli/verify-all.ts、cli/verify-backlinks.ts、cli/verify-coverage.ts 这几个 shim),所有校验也都会以 gate-error
失败。
Code

.agents/skills/hx-agent-notes/scripts/redline/snapshot.py[R69-71]

+        data = json.loads(text)
+        if set(data) != {'version', 'guarded'} or data['version'] != 2:
+            raise ValueError('须使用 v2 配置, 且只能包含 version 和 guarded; 请显式迁移旧配置')
Relevance

●●● Strong

Strict v2 validation immediately breaks this repository’s v1 configuration without the required
migration.

PR-#37

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
新门禁会拒绝 v1 配置,而仓库里的配置正是 v1 格式;verify.py 一开始就读取当前快照的配置,配置无效时抛出 ValueError,最终输出 gate-error 并以退出码 2 退出。

.agents/skills/hx-agent-notes/scripts/redline/snapshot.py[65-77]
.agents/notes.config.json[1-27]
.agents/skills/hx-agent-notes/scripts/redline/verify.py[24-31]
.agents/skills/hx-agent-notes/scripts/redline/verify.py[81-89]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
升级到 v2 之后,门禁只接受 `{version: 2, guarded: [...]}` 这种配置,但仓库的 `.agents/notes.config.json` 还是 v1 格式,所有校验入口都会报配置错误。

## Fix Focus Areas
- .agents/notes.config.json[1-63]
- .agents/skills/hx-agent-notes/scripts/redline/snapshot.py[65-77]

## Recommended Fix
在本 PR 中运行 `uv run .agents/skills/hx-agent-notes/scripts/setup/install.py --repo . --guarded src --guarded scripts --guarded bin --guarded dashboard`,或者手动把配置改成 v2 格式,并按 v2 规则检查现有 notes 和源码锚点能否通过;如果暂时不打算迁移,就不要合入这次 skill 升级。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗



Remediation recommended

4. 自定义安装目录使提交钩子失效 🟠 P1 ●●● Strong 🐞 Bug ≡ Correctness
Description
新钩子始终执行 scripts/redlines/agent_notes.py,但安装器会按 --redline-dir
在指定目录生成入口。使用非默认目录后,钩子仍指向不存在的默认路径,暂存区校验无法运行。
Code

.agents/skills/hx-agent-notes/assets/hooks/pre-commit[4]

+uv run scripts/redlines/agent_notes.py --staged
Relevance

●●● Strong

Concrete configurable-path integration bug; recent team precedent accepts cross-component runtime
mismatches.

PR-#37
PR-#36

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
钩子写死默认路径,安装器则公开目录参数并用它计算生成文件的位置。

.agents/skills/hx-agent-notes/assets/hooks/pre-commit[1-4]
.agents/skills/hx-agent-notes/scripts/setup/install.py[62-75]
.agents/skills/hx-agent-notes/scripts/setup/install.py[107-113]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
指定 `--redline-dir` 后,提交钩子仍调用默认目录中的入口。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/assets/hooks/pre-commit[4-4]
- .agents/skills/hx-agent-notes/scripts/setup/install.py[62-75]
## Recommended Fix
安装时按实际入口路径生成钩子,或让钩子从安装配置定位入口;验证非默认目录下的暂存区校验。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


5. 非法配置无法生成门禁诊断报告 🟠 P1 ●●● Strong 🐞 Bug ☼ Reliability
Description
Snapshot.config() 在检查 guarded 元素类型前执行 set(roots),遇到对象或数组元素时会抛出 TypeError。verify.main()
未捕获此异常,因此这类格式错误的配置不会写出请求的 JSON 诊断文件,而是直接产生回溯信息。
Code

.agents/skills/hx-agent-notes/scripts/redline/snapshot.py[R73-75]

+        if not isinstance(roots, list) or not roots or len(set(roots)) != len(roots):
+            raise ValueError('guarded 必须是非空列表, 只含不重复的精确仓库路径')
+        if not all(canonical(p) for p in roots):
Relevance

●●● Strong

Uncaught TypeError bypasses the promised diagnostic output; this is a deterministic malformed-input
bug.

PR-#37
PR-#31

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
set(roots) 先于逐项路径验证执行;异常处理列表没有 TypeError,JSON 写入又位于异常处理之后。

.agents/skills/hx-agent-notes/scripts/redline/snapshot.py[65-77]
.agents/skills/hx-agent-notes/scripts/redline/verify.py[81-92]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`guarded` 包含不可哈希的 JSON 值时,校验器在生成门禁诊断前崩溃。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/scripts/redline/snapshot.py[72-76]
- .agents/skills/hx-agent-notes/scripts/redline/verify.py[81-92]
## Recommended Fix
先确认每个元素都是合法路径字符串,再执行去重检查,并测试非法配置仍能生成 JSON 门禁诊断。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


6. 多提交推送的部分诊断失去行内位置 🟠 P1 ●●● Strong 🐞 Bug ≡ Correctness
Description
publish() 对推送仅用 run.head_sha 调用 repos.getCommit
获取文件列表,而扫描器比较的是整个推送区间。当某个受检文件只在较早的提交中修改时,locate() 在末次提交的文件列表中找不到它,该诊断只能进入汇总评论。
Code

.agents/skills/hx-agent-notes/scripts/github/report.ts[R20-22]

+  const diff = pr
+    ? {files: await github.paginate(github.rest.pulls.listFiles, {...params, pull_number: pr.number}), base: pr.base.sha}
+    : await commitFiles(github, params, run.head_sha)
Relevance

●●● Strong

Multi-commit reporting loses required inline locations; analogous state-handling correctness issues
were accepted.

PR-#37
PR-#31

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
推送基线取自事件的 before,扫描器比较它与最终 head;评论定位却只使用最终提交的文件列表,找不到位置时走汇总分支。

.agents/skills/hx-agent-notes/scripts/github/base.py[12-20]
.agents/skills/hx-agent-notes/scripts/redline/verify.py[29-43]
.agents/skills/hx-agent-notes/scripts/github/report.ts[5-22]
.agents/skills/hx-agent-notes/scripts/github/report.ts[31-48]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
推送扫描覆盖多个提交,但评论定位只查看最后一个提交的文件。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/scripts/github/report.ts[5-22]
- .agents/skills/hx-agent-notes/scripts/github/report.ts[31-48]
## Recommended Fix
取得完整推送区间的改动文件,并为不属于末次提交的诊断选用可定位的提交或评论方式;增加多提交推送用例。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


7. 异常账户数据使辅助分诊崩溃 🟠 P1 ●●● Strong 🐞 Bug ☼ Reliability
Description
load_key() 解析 JSON 后直接对每个元素调用 row.get(),没有确认顶层及元素的数据类型。账户文件含有合法 JSON 但元素为 null 或标量时,调用在
main() 的异常处理之外抛错,无法进入缺少可用密钥时的非阻断跳过路径。
Code

.agents/skills/hx-agent-notes/scripts/triage/note-triage.py[R162-164]

+    for row in rows:
+        if row.get("usable") and row.get("api_key"):
+            return str(row["api_key"])
Relevance

●●● Strong

Malformed but valid JSON crashes before the documented graceful no-key path.

PR-#37
PR-#31

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
解析阶段的异常处理不涵盖之后的 row.get();主流程在调用 load_key() 后才进入处理客户端调用异常的代码块。

.agents/skills/hx-agent-notes/scripts/triage/note-triage.py[153-165]
.agents/skills/hx-agent-notes/scripts/triage/note-triage.py[214-241]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
可解析但结构异常的账户文件使辅助分诊抛出未处理异常。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/scripts/triage/note-triage.py[153-165]
- .agents/skills/hx-agent-notes/scripts/triage/note-triage.py[214-228]
## Recommended Fix
确认顶层是列表且元素为对象,再读取账户字段;结构无效时返回无可用密钥,使分诊走现有的非阻断跳过路径。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗



Informational

No findings for this group

Grey Divider

Context sources
❌ Tickets: failed to load — Ticket collection could not establish complete evidence
✅ Cross-repo context — repo relationships
  Explored: repo: HengXin666/deepseek-harness (sha: f981800f) — View relationship
  Explored: repo: HengXin666/HX-Jungle (sha: aea60824) — View relationship
Review mode: Auto: 🧠 Deep: 多套脚本与流水线逻辑同时变更,独立风险密集。

Grey Divider

Tip of the day
💡 Did you know, you can move or hide resolved findings to focus on what still needs action

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment on lines +68 to +69
mkdirSync(dirname(manifestPathFor(loaded)), { recursive: true })
writeFileSync(manifestPathFor(loaded), renderManifest(manifest.files))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. 新增归档文件时封存命令崩溃 🐞 Bug ≡ Correctness

verifyArchive() 在写入清单时调用了未导入的 mkdirSync、dirname 和 writeFileSync。当 seal-archive --write
发现尚未封存且其他检查均通过的归档文件时,该分支抛出 ReferenceError,清单无法更新。
Agent Prompt
## Issue description
`seal-archive --write` 新增归档条目时因未导入的函数而崩溃。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/scripts/lib/seal.ts[6-7]
- .agents/skills/hx-agent-notes/scripts/lib/seal.ts[66-69]
## Recommended Fix
从 `node:fs` 导入 `mkdirSync`、`writeFileSync`,从 `node:path` 导入 `dirname`,并验证新增归档条目的写入路径。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

exit 0
set -eu
# Install uv first; inspect the staged tree, not unstaged repairs
uv run scripts/redlines/agent_notes.py --staged

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

4. 自定义安装目录使提交钩子失效 🐞 Bug ≡ Correctness

新钩子始终执行 scripts/redlines/agent_notes.py,但安装器会按 --redline-dir
在指定目录生成入口。使用非默认目录后,钩子仍指向不存在的默认路径,暂存区校验无法运行。
Agent Prompt
## Issue description
指定 `--redline-dir` 后,提交钩子仍调用默认目录中的入口。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/assets/hooks/pre-commit[4-4]
- .agents/skills/hx-agent-notes/scripts/setup/install.py[62-75]
## Recommended Fix
安装时按实际入口路径生成钩子,或让钩子从安装配置定位入口;验证非默认目录下的暂存区校验。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +73 to +75
if not isinstance(roots, list) or not roots or len(set(roots)) != len(roots):
raise ValueError('guarded 必须是非空列表, 只含不重复的精确仓库路径')
if not all(canonical(p) for p in roots):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

5. 非法配置无法生成门禁诊断报告 🐞 Bug ☼ Reliability

Snapshot.config() 在检查 guarded 元素类型前执行 set(roots),遇到对象或数组元素时会抛出 TypeError。verify.main()
未捕获此异常,因此这类格式错误的配置不会写出请求的 JSON 诊断文件,而是直接产生回溯信息。
Agent Prompt
## Issue description
`guarded` 包含不可哈希的 JSON 值时,校验器在生成门禁诊断前崩溃。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/scripts/redline/snapshot.py[72-76]
- .agents/skills/hx-agent-notes/scripts/redline/verify.py[81-92]
## Recommended Fix
先确认每个元素都是合法路径字符串,再执行去重检查,并测试非法配置仍能生成 JSON 门禁诊断。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +20 to +22
const diff = pr
? {files: await github.paginate(github.rest.pulls.listFiles, {...params, pull_number: pr.number}), base: pr.base.sha}
: await commitFiles(github, params, run.head_sha)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

6. 多提交推送的部分诊断失去行内位置 🐞 Bug ≡ Correctness

publish() 对推送仅用 run.head_sha 调用 repos.getCommit
获取文件列表,而扫描器比较的是整个推送区间。当某个受检文件只在较早的提交中修改时,locate() 在末次提交的文件列表中找不到它,该诊断只能进入汇总评论。
Agent Prompt
## Issue description
推送扫描覆盖多个提交,但评论定位只查看最后一个提交的文件。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/scripts/github/report.ts[5-22]
- .agents/skills/hx-agent-notes/scripts/github/report.ts[31-48]
## Recommended Fix
取得完整推送区间的改动文件,并为不属于末次提交的诊断选用可定位的提交或评论方式;增加多提交推送用例。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +162 to +164
for row in rows:
if row.get("usable") and row.get("api_key"):
return str(row["api_key"])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

7. 异常账户数据使辅助分诊崩溃 🐞 Bug ☼ Reliability

load_key() 解析 JSON 后直接对每个元素调用 row.get(),没有确认顶层及元素的数据类型。账户文件含有合法 JSON 但元素为 null 或标量时,调用在
main() 的异常处理之外抛错,无法进入缺少可用密钥时的非阻断跳过路径。
Agent Prompt
## Issue description
可解析但结构异常的账户文件使辅助分诊抛出未处理异常。
## Fix Focus Areas
- .agents/skills/hx-agent-notes/scripts/triage/note-triage.py[153-165]
- .agents/skills/hx-agent-notes/scripts/triage/note-triage.py[214-228]
## Recommended Fix
确认顶层是列表且元素为对象,再读取账户字段;结构无效时返回无可用密钥,使分诊走现有的非阻断跳过路径。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines -1 to -3
/**
* Run every Agent Notes gate in order and report one aggregate verdict.
* Usage: npx tsx scripts/verify-all.ts [--staged | --base <ref>] [--repo <dir>]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. 笔记门禁 ci 和 npm 脚本都找不到入口文件 🐞 Bug ☼ Reliability

本 PR 删除了
scripts/verify-all.ts、scripts/verify-backlinks.ts、scripts/verify-coverage.ts、scripts/new-note.ts
和 scripts/notes-lib.ts,替代入口移到了 scripts/cli/ 和 scripts/authoring/ 下。但
.github/workflows/agent-notes.yml、package.json 里的
verify-notes/verify-notes:staged/verify-notes:coverage/verify-notes:backlinks/notes:new,以及
.agents/notes/AGENTS.md 都没改,仍然指向旧路径,合并后每次 PR/push 的 agent-notes job 都会因为文件不存在而直接失败,本地 hook 和 npm
命令也一样跑不起来。
Agent Prompt
## Issue description
skill 升级时删除了 `scripts/verify-all.ts` 等旧入口,但仓库里的 CI 工作流、package.json 脚本和 notes 文档还在引用这些旧路径,门禁会直接失败。

## Fix Focus Areas
- .github/workflows/agent-notes.yml[28-43]
- package.json[24-32]
- .agents/notes/AGENTS.md[22-22]
- .agents/notes/archived/AGENTS.md[7-7]
- .agents/notes/implemented/AGENTS.md[7-7]

## Recommended Fix
把这些引用改到新路径(`scripts/cli/*.ts`、`scripts/authoring/*.ts`),或者直接调用 `uv run --with-requirements .../scripts/redline/requirements.txt python .../scripts/redline/verify.py`。CI 中要加 `astral-sh/setup-uv`,也可以参考新的 `assets/ci/github-actions.yml` 重写工作流。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +69 to +71
data = json.loads(text)
if set(data) != {'version', 'guarded'} or data['version'] != 2:
raise ValueError('须使用 v2 配置, 且只能包含 version 和 guarded; 请显式迁移旧配置')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. 仓库仍是 v1 配置,新门禁一运行就报配置错误 🐞 Bug ≡ Correctness

Snapshot.config() 要求 .agents/notes.config.json 只能包含 version 和 guarded,并且 version == 2,否则抛出
ValueError,门禁以退出码 2 结束。本仓库的配置仍是 v1 结构(root/coverage/backlinks 等字段),本 PR 没有运行
setup/install.py,也没有迁移配置;因此即使把调用改到新入口(包括保留旧命令名的
cli/verify-all.ts、cli/verify-backlinks.ts、cli/verify-coverage.ts 这几个 shim),所有校验也都会以 gate-error
失败。
Agent Prompt
## Issue description
升级到 v2 之后,门禁只接受 `{version: 2, guarded: [...]}` 这种配置,但仓库的 `.agents/notes.config.json` 还是 v1 格式,所有校验入口都会报配置错误。

## Fix Focus Areas
- .agents/notes.config.json[1-63]
- .agents/skills/hx-agent-notes/scripts/redline/snapshot.py[65-77]

## Recommended Fix
在本 PR 中运行 `uv run .agents/skills/hx-agent-notes/scripts/setup/install.py --repo . --guarded src --guarded scripts --guarded bin --guarded dashboard`,或者手动把配置改成 v2 格式,并按 v2 规则检查现有 notes 和源码锚点能否通过;如果暂时不打算迁移,就不要合入这次 skill 升级。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

@qodo-code-review

Copy link
Copy Markdown

Qodo Fixer

Found 7 findings, but none include a fix that can be applied automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant