infrahub-repo-auditor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInfrahub Repo Auditor
Infrahub仓库审计工具
Overview
概述
Comprehensive audit of an Infrahub repository against
all rules and best practices from the infrahub-skills
plugin. Produces a structured report covering schemas,
objects, checks, generators, transforms, menus,
configuration, and deployment readiness.
.infrahub.yml对照infrahub-skills插件的所有规则与最佳实践,对Infrahub仓库进行全面审计,生成覆盖schema、对象、检查项、生成器、转换器、菜单、配置以及部署就绪度的结构化报告。
.infrahub.ymlWhen to Use
适用场景
- Before deploying a repository to Infrahub
- When onboarding to an existing Infrahub project
- After significant refactoring to catch regressions
- As a periodic quality gate in development workflows
- When troubleshooting schema loading, object sync, or pipeline failures
- 将仓库部署到Infrahub之前
- 接入现有Infrahub项目时
- 大规模重构后排查回归问题
- 作为开发工作流中的定期质量门禁
- 排查schema加载、对象同步或流水线故障时
How It Works
工作原理
When invoked, the auditor:
- Discovers the project structure
(, schemas, objects, checks, generators, transforms, menus)
.infrahub.yml - Validates each component against the rules defined in the infrahub-skills plugin
- Cross-references between components (e.g.,
query names match between Python files and
)
.infrahub.yml - Generates a markdown report with findings organized by severity
调用后,审计工具会执行以下步骤:
- 识别项目结构(、schema、对象、检查项、生成器、转换器、菜单)
.infrahub.yml - 对照infrahub-skills插件中定义的规则验证每个组件
- 交叉校验组件间关联关系(例如Python文件和中的查询名称是否匹配)
.infrahub.yml - 生成按严重程度划分的markdown格式检查结果报告
Audit Categories
审计分类
| Priority | Category | What It Checks |
|---|---|---|
| CRITICAL | Project Structure | |
| CRITICAL | Schema Validation | Naming, relationships, deprecated fields |
| CRITICAL | Object Validation | YAML structure, value types, refs |
| CRITICAL | Python Components | Class inheritance, required methods |
| HIGH | Cross-References | Query names match, target groups |
| HIGH | Relationships | Bidirectional IDs, cardinality |
| HIGH | Registration | All files registered, no orphans |
| MEDIUM | Best Practices | human_friendly_id, display_label |
| MEDIUM | Deployment | Git status, bootstrap placement |
| LOW | Patterns & Style | Code organization, naming |
| 优先级 | 分类 | 检查内容 |
|---|---|---|
| CRITICAL | 项目结构 | |
| CRITICAL | Schema验证 | 命名、关联关系、废弃字段 |
| CRITICAL | 对象验证 | YAML结构、值类型、引用 |
| CRITICAL | Python组件 | 类继承、必填方法 |
| HIGH | 交叉引用 | 查询名称匹配、目标组 |
| HIGH | 关联关系 | 双向ID、基数 |
| HIGH | 注册校验 | 所有文件都已注册、无孤立文件 |
| MEDIUM | 最佳实践 | human_friendly_id、display_label设置 |
| MEDIUM | 部署相关 | Git状态、启动项位置 |
| LOW | 模式与风格 | 代码组织、命名规范 |
Running the Audit
运行审计
Tell Claude: "Audit this Infrahub repo" or "Run the Infrahub repo auditor"
The auditor will scan the current working directory and produce a report.
告诉Claude:"Audit this Infrahub repo" 或者 "Run the Infrahub repo auditor"
审计工具会扫描当前工作目录并生成报告。
Report Format
报告格式
The report is written to in the project root with this structure:
AUDIT_REPORT.mdmarkdown
undefined报告将写入项目根目录的文件,结构如下:
AUDIT_REPORT.mdmarkdown
undefinedInfrahub Repository Audit Report
Infrahub Repository Audit Report
Summary
Summary
- Total findings: N
- Critical: N | High: N | Medium: N | Low: N | Info: N
- Total findings: N
- Critical: N | High: N | Medium: N | Low: N | Info: N
Project Structure
Project Structure
...
...
Schema Audit
Schema Audit
...
...
Object Data Audit
Object Data Audit
...
...
Checks Audit
Checks Audit
...
...
Generators Audit
Generators Audit
...
...
Transforms Audit
Transforms Audit
...
...
Menus Audit
Menus Audit
...
...
Cross-Reference Integrity
Cross-Reference Integrity
...
...
Deployment Readiness
Deployment Readiness
...
undefined...
undefinedAudit Rules Reference
审计规则参考
The auditor checks rules from all skills:
- ../infrahub-schema-creator/ -- Naming, relationships, attributes, hierarchy, display, extensions, uniqueness, migration
- ../infrahub-object-creator/ -- Format, values, children, ranges, organization
- ../infrahub-check-creator/ -- Architecture, Python class, API, registration
- ../infrahub-generator-creator/ -- Architecture, Python class, tracking, API
- ../infrahub-transform-creator/ -- Types, Python/Jinja2, hybrid, artifacts, API
- ../infrahub-menu-creator/ -- Format, item properties, hierarchy, icons
- ../infrahub-common/ -- Git integration,
caching, reference, GraphQL
.infrahub.yml
审计工具会检查所有skill对应的规则:
- ../infrahub-schema-creator/ -- 命名、关联关系、属性、层级、展示、扩展、唯一性、迁移
- ../infrahub-object-creator/ -- 格式、值、子项、范围、组织
- ../infrahub-check-creator/ -- 架构、Python类、API、注册
- ../infrahub-generator-creator/ -- 架构、Python类、追踪、API
- ../infrahub-transform-creator/ -- 类型、Python/Jinja2、混合模式、产物、API
- ../infrahub-menu-creator/ -- 格式、菜单项属性、层级、图标
- ../infrahub-common/ -- Git集成、缓存、引用、GraphQL
.infrahub.yml
Rules
规则
See rules/ for detailed audit rule definitions.
查看rules/目录获取详细的审计规则定义。