Pull Request已成功合入, 合并人@CANN-robot
(感谢 yanhaifeng5 的贡献)变更摘要
本次 PR 将 install-helper 从 1.1.7 升级到 1.1.8,核心目标是确立 plugin.json 作为 agents 和 version 的单一真相源(Single Source of Truth),消除 yml 配置与 plugin.json 之间的数据漂移问题。为此移除了所有 plugins.d/*.yml 中硬编码的 agents、installAgents 和 version 字段,新增了 validate-plugins.cjs 验证器(含 V1–V7 七项检查),并将验证集成到构建流程(gen-embedded.cjs)和 CI 门禁(gate_check.sh Phase 2.5)中。同时补充了多项回归测试,修复了部分插件的 skills 计数与实际条目不一致的问题。
主要改动
-
确立
plugin.json为 agents/version 单一真相源:所有plugins.d/*.yml(共 10 个文件)移除了agents、installAgents、version字段,gen-embedded.cjs和metadata-sync.ts的enrichPluginMetadata函数改为始终从plugin.json派生installAgents和version,不再读取 yml 中的硬编码值,也不再仅在 installAgents 为空时才填充。 -
新增插件元数据一致性验证器
validate-plugins.cjs:实现了 V1–V7 七项检查,包括plugin.json可解析性(V1)、agent.md文件存在性(V2)、installSkills 源目录与 skill 目录存在性(V3)、yml 中skills计数与实际条目一致性(V4)、yml 不得包含agents/installAgents(V5)、optionalDependencies版本与主版本一致(V6)、yml 不得包含version且plugin.json必须有非空 version(V7)。 -
构建时强制验证:
gen-embedded.cjs在生成embedded-plugins.json之前调用validatePlugins(),验证失败则拒绝写入并退出,确保不会产出携带过期数据的构建产物。 -
CI 门禁集成:
gate_check.sh新增 Phase 2.5,调用tests/unit/test-install-helper-plugins.sh在无 NPU/AI 依赖的情况下执行插件元数据一致性检查,拦截 yml/plugin.json 漂移问题。 -
skills 计数修正与 installSkills 列表更新:
ops-direct-invoke.yml(skills: 20→21,新增ascendc-mc2-best-practice)、ops-registry-invoke.yml(skills: 27→29,新增ascendc-perf-optimize和ops-simulator)、pypto-op-orchestrator.yml(skills: 8→17,大幅扩展 installSkills 列表)、triton-op-generator.yml(skills: 6→8,新增triton-precision-debug和triton-simulator-optimizer)。


代码审查
审查结论
| 优先级 | 数量 |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
各文件审查结果:
| 文件 | 结论 |
|---|---|
plugins-community/install-helper/package.json |
发现 1 个问题(lockfile 未同步) |
plugins-community/install-helper/plugins.d/_defaults.yml |
无问题 |
plugins-community/install-helper/plugins.d/catlass-op-generator.yml |
无问题 |
plugins-community/install-helper/plugins.d/model-infer-optimize.yml |
无问题 |
plugins-community/install-helper/plugins.d/ops-code-reviewer.yml |
无问题 |
plugins-community/install-helper/plugins.d/ops-direct-invoke-flash.yml |
无问题 |
plugins-community/install-helper/plugins.d/ops-direct-invoke.yml |
无问题 |
plugins-community/install-helper/plugins.d/ops-registry-invoke.yml |
无问题 |
整体风险评估:低风险。 本次变更的核心逻辑(将 agents/version/installAgents 从 YAML 中移除、统一由 plugin.json 管理)与现有的校验规则和测试断言完全一致,skills 计数与实际列表匹配。唯一需要注意的问题是 package-lock.json 未随 package.json 版本升级而更新,可能导致 CI 中 npm ci 失败,建议补充提交更新后的 lockfile。
All 8 changed files have been reviewed. Now let me provide the closing summary.
审查总结
本 diff 共涉及 8 个文件,均已完成审查:
| 文件 | 审查结论 |
|---|---|
plugins-community/install-helper/plugins.d/pypto-op-orchestrator.yml |
无问题 — skills 数量(17)与列表一致,正确移除了 agents/installAgents/version 字段 |
plugins-community/install-helper/plugins.d/tilelang-op-orchestrator.yml |
无问题 — skills 数量(9)与列表一致,正确移除了冗余字段 |
plugins-community/install-helper/plugins.d/torch-compile.yml |
无问题 — skills 数量(6)与列表一致,正确移除了冗余字段 |
plugins-community/install-helper/plugins.d/triton-op-generator.yml |
无问题 — skills 数量(8)与列表一致,正确移除了冗余字段 |
plugins-community/install-helper/scripts/gen-embedded.cjs |
无独立问题 — 与 validate-plugins.cjs 的重复代码已纳入共享报告的 P3 建议 |
plugins-community/install-helper/scripts/validate-plugins.cjs |
2 个 P3 问题(代码重复 + 缺少 dir 防护) |
plugins-community/install-helper/src/core/metadata-sync.ts |
无问题 — installAgents 始终从 plugin.json 覆盖的语义变更正确,.length 访问安全(函数始终返回数组) |
plugins-community/install-helper/tests/metadata-sync.test.ts |
无问题 — 新增的回归测试正确覆盖了 stale installAgents 被覆盖的场景 |
按优先级统计:
- P0:0
- P1:0
- P2:0
- P3:2(均为健壮性/可维护性建议,非功能缺陷)
整体风险判断:低。 核心变更(将 agents/installAgents/version 的单一事实来源统一到 plugin.json)在两个消费端(build-time 的 gen-embedded.cjs 和 runtime 的 metadata-sync.ts)中语义一致,校验脚本能有效防止漂移,测试覆盖了关键回归场景。两个 P3 建议不影响正确性,可在后续迭代中改进。
现在我对所有三个变更文件进行了完整的审查。以下是我的最终报告。
关闭摘要
| 文件 | 审查结果 |
|---|---|
plugins-community/install-helper/tests/plugins-consistency.test.ts |
3 个问题(P2: 2, P3: 1) |
tests/gate_check.sh |
无问题 |
tests/unit/test-install-helper-plugins.sh |
1 个问题(P3: 1) |
按优先级统计:P2 × 2, P3 × 2,共 4 个发现。
总体风险评估:此变更风险较低。引入的测试文件和门禁脚本整体设计合理,能有效拦截插件元数据漂移。发现的 2 个 P2 问题(临时目录泄漏、embedded-plugins.json 静默通过)在 CI 环境中长期运行后可能累积影响,但不会导致即时功能故障。2 个 P3 问题为代码整洁性改进,不影响正确性。建议在合入前处理 P2 问题。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 0 |
| 🟡 建议 | 3 |
💬 仅评论


描述
根因
install-helper 的插件元数据(agents/version)散落在 yml、plugin.json、embedded-plugins.json、optionalDependencies 四处,采用"yml 非空即采信"的回退式调和,无任何交叉校验。agent 改名后 yml 变陈旧,非空即静默覆盖正确值,导致安装时报「Agent 未找到」。同时发现 external repo git pull 失败后
continue跳过 symlink 创建、skill-registry 离线回退陈旧、yml 与 init.sh INCLUDED_SKILLS 漂移、externalRepos 配置不完整等问题。修复内容
Bug 修复
installAgents引用 3 个已废弃的 agent 名(pypto-op-analyst/developer/perf-tuner),与 plugin.json 的 8 个实际 agent 零交集。修复后正确安装 8 agents。spec-to-designskill 位于插件本地skills/目录,findSkillSourceDir仅查 scanDirs 被静默丢弃。修复后正确安装 7 agents + 30 skills。installExternalRepos中 pull 失败的continue跳过了后续 symlink 逻辑,导致项目目录缺少 external repo 符号链接。删除continue,pull 失败后仅 warn 并继续创建 symlink(与 init.sh 行为一致)。d853845a在 init.sh INCLUDED_SKILLS 中新增了该 skill,但 yml 未同步更新,导致 install-helper 只装 6 个 skill(init.sh 装 7 个)。修复后 yml skills 6→7。https://gitcode.com/cann/ops-tensor.git(depth=1 + recursive),但 yml externalRepos 未声明,导致 install-helper 安装后缺少 Blaze/tensor_api 源码,5 个 Blaze 相关 skill 工作流中断。修复后 yml 补齐 ops-tensor externalRepo。reference/cann/asc-devkit(depth=1),yml 声明为asc-devkit(无 depth),导致 install-helper 克隆到错误路径,API 文档搜索路径不匹配。修复后 yml 路径改为reference/cann/asc-devkit+ depth=1。特性增强
installAgents作为文档 + Layer 3 兜底(与 installSkills 同构),V5 一致性校验确保 yml 与 plugin.json 不漂移。./AGENTS.md)→ Layer 2 init.shINCLUDED_AGENT_PATTERN(globSync 匹配,支持 extglob)→ Layer 3 ymlinstallAgents/embedded 兜底。INCLUDED_SKILLS(mergeInitSkills 补充)→ Layer 3 init.shALL_SKILLS(静态解析,动态$()跳过)→ Layer 4<plugin>/skills/目录查找(findSkillSourceDir 扩展)。cuda2ascend-simt(source: ops-lab/,已删除);新增 4 个 skill(model-train-accuracy-debug、model-train-log-visualization、model-train-oom-analysis、ge-fusion-pass-skill)。INCLUDED_SKILLS完整列表。src/config/repository.yaml读取(与 scanner.ts/metadata-sync.ts 统一单一来源),消除三处硬编码漂移风险。测试看护增强(+28 用例,212→234)
reference/cann// embedded externalRepos URL 匹配 yml / 无重复 URL关联的Issue
测试
文档更新
类型标签