infrahub-repo-auditor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Infrahub 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,
.infrahub.yml
configuration, and deployment readiness.
对照infrahub-skills插件的所有规则与最佳实践,对Infrahub仓库进行全面审计,生成覆盖schema、对象、检查项、生成器、转换器、菜单、
.infrahub.yml
配置以及部署就绪度的结构化报告。

When 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:
  1. Discovers the project structure (
    .infrahub.yml
    , schemas, objects, checks, generators, transforms, menus)
  2. Validates each component against the rules defined in the infrahub-skills plugin
  3. Cross-references between components (e.g., query names match between Python files and
    .infrahub.yml
    )
  4. Generates a markdown report with findings organized by severity
调用后,审计工具会执行以下步骤:
  1. 识别项目结构(
    .infrahub.yml
    、schema、对象、检查项、生成器、转换器、菜单)
  2. 对照infrahub-skills插件中定义的规则验证每个组件
  3. 交叉校验组件间关联关系(例如Python文件和
    .infrahub.yml
    中的查询名称是否匹配)
  4. 生成按严重程度划分的markdown格式检查结果报告

Audit Categories

审计分类

PriorityCategoryWhat It Checks
CRITICALProject Structure
.infrahub.yml
exists, paths valid
CRITICALSchema ValidationNaming, relationships, deprecated fields
CRITICALObject ValidationYAML structure, value types, refs
CRITICALPython ComponentsClass inheritance, required methods
HIGHCross-ReferencesQuery names match, target groups
HIGHRelationshipsBidirectional IDs, cardinality
HIGHRegistrationAll files registered, no orphans
MEDIUMBest Practiceshuman_friendly_id, display_label
MEDIUMDeploymentGit status, bootstrap placement
LOWPatterns & StyleCode organization, naming
优先级分类检查内容
CRITICAL项目结构
.infrahub.yml
是否存在、路径是否有效
CRITICALSchema验证命名、关联关系、废弃字段
CRITICAL对象验证YAML结构、值类型、引用
CRITICALPython组件类继承、必填方法
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
AUDIT_REPORT.md
in the project root with this structure:
markdown
undefined
报告将写入项目根目录的
AUDIT_REPORT.md
文件,结构如下:
markdown
undefined

Infrahub 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
...
undefined

Audit 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,
    .infrahub.yml
    reference, GraphQL
审计工具会检查所有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集成、缓存、
    .infrahub.yml
    引用、GraphQL

Rules

规则

See rules/ for detailed audit rule definitions.
查看rules/目录获取详细的审计规则定义。