coding-guidelines-verify

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Coding guidelines verifier

编码规范验证器

Goal

目标

Validate that changes follow the nearest nested
AGENTS.md
:
  • default: changed files only
  • default: auto-fix formatting before lint/tests
  • monorepo-aware: each module’s
    AGENTS.md
    is the source of truth for that scope
验证变更符合最近嵌套
AGENTS.md
要求:
  • 默认:仅检查变更文件
  • 默认:在执行lint/测试前自动修复格式问题
  • 支持monorepo:每个模块的
    AGENTS.md
    是该作用域的唯一可信规则源

Workflow (checklist)

工作流(检查清单)

  1. Collect changed files (staged + unstaged + untracked).
  2. For each changed file, find the nearest parent
    AGENTS.md
    .
    • If a file has no scoped
      AGENTS.md
      , report it (suggest running
      coding-guidelines-gen
      ).
  3. Parse the
    codex-guidelines
    block (schema:
    references/verifiable-block.md
    ).
  4. Run, per scope:
    • format (auto-fix) -> lint -> tests
    • apply simple forbid rules (globs/regex) from the block
  5. Produce a short compliance report (template:
    references/report-template.md
    ).
  1. 收集变更文件(暂存区 + 未暂存 + 未跟踪文件)。
  2. 为每个变更文件查找最近的父级
    AGENTS.md
    • 如果文件没有对应作用域的
      AGENTS.md
      ,上报该情况(建议运行
      coding-guidelines-gen
      )。
  3. 解析
    codex-guidelines
    块(模式参考:
    references/verifiable-block.md
    )。
  4. 按每个作用域执行以下操作:
    • 格式化(自动修复)-> lint -> 测试
    • 应用规则块中定义的简单禁用规则(globs/正则表达式)
  5. 生成简洁的合规报告(模板:
    references/report-template.md
    )。

Automation

自动化

Use
scripts/verify_guidelines.py
to group scopes, run commands, and report results.
  • If
    python
    is not available or the script fails, tell the user and ask whether to install Python or proceed with a manual per-scope verification.
使用
scripts/verify_guidelines.py
完成作用域分组、命令执行和结果上报。
  • 如果
    python
    不可用或者脚本运行失败,告知用户并询问是安装Python还是手动执行逐作用域验证。

Deliverable

交付产物

Provide:
  • The per-scope compliance report (use
    references/report-template.md
    ).
  • Any auto-fix formatting changes applied.
  • Lint/test commands run and their results, plus any violations.
需提供:
  • 按作用域划分的合规报告(使用
    references/report-template.md
    模板)。
  • 所有已应用的自动格式修复变更。
  • 执行过的lint/测试命令及其结果,以及所有违规情况。