validator-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/validator-setup
/validator-setup
Scan the project to discover tooling and configure checks and reviews for agent-validator.
Before starting, read for check category details, YAML schemas, and example configurations.
references/check-catalog.md扫描项目以发现工具链,并为agent-validator配置检查与评审。
开始操作前,请阅读以了解检查类别详情、YAML schema及配置示例。
references/check-catalog.mdStep 1: Check config exists
步骤1:检查配置文件是否存在
Read . If the file does not exist, tell the user to run first and STOP — do not proceed with any further steps.
.validator/config.ymlagent-validate init读取。若该文件不存在,请告知用户先运行并停止后续操作——请勿继续执行任何步骤。
.validator/config.ymlagent-validate initStep 2: Check existing config
步骤2:检查现有配置
Read the field from .
entry_points.validator/config.ymlIf is empty (): This is a fresh setup. Proceed to Step 3 (detect project structure).
entry_points[]If is populated: Show the user a summary of the current configuration:
entry_points-
List each entry point with its,
path, andchecksreviews -
Then ask the user which action to take:
- Add checks — Scan for tools not already configured. Proceed to Step 3, but filter out any checks that already appear in .
entry_points - Add custom — User describes what they want to add. Skip to Step 7.
- Reconfigure — Start fresh. Back up existing config first:
- Rename each file to
.validator/checks/*.yml(overwrite any previous.yml.bakfiles) — these are legacy file-based checks.bak - Rename each custom file to
.validator/reviews/*.md(overwrite any previous.md.bakfiles).bak - Do NOT rename files (these are built-in review configs)
.validator/reviews/*.yml - Clear to
entry_pointsin[]config.yml - Proceed to Step 3
- Rename each
- Add checks — Scan for tools not already configured. Proceed to Step 3, but filter out any checks that already appear in
读取中的字段。
.validator/config.ymlentry_points若为空(): 这是全新配置,继续执行步骤3(检测项目结构)。
entry_points[]若已填充内容: 向用户展示当前配置的摘要:
entry_points-
列出每个入口点的、
path和checksreviews -
然后询问用户要执行以下哪个操作:
- 添加检查 —— 扫描未配置的工具。继续执行步骤3,但过滤掉中已存在的检查项。
entry_points - 添加自定义项 —— 用户描述需添加的内容。跳至步骤7。
- 重新配置 —— 从头开始。先备份现有配置:
- 将每个文件重命名为
.validator/checks/*.yml(覆盖之前的.yml.bak文件)——这些是基于文件的旧版检查项.bak - 将每个自定义文件重命名为
.validator/reviews/*.md(覆盖之前的.md.bak文件).bak - 请勿重命名文件(这些是内置评审配置)
.validator/reviews/*.yml - 将中的
config.yml清空为entry_points[] - 继续执行步骤3
- 将每个
- 添加检查 —— 扫描未配置的工具。继续执行步骤3,但过滤掉
Step 3: Detect project structure
步骤3:检测项目结构
Scan for signals to classify the project as monorepo, split project, or single project.
扫描项目特征,将其归类为单体仓库(monorepo)、拆分项目或单一项目。
Monorepo signals
单体仓库特征
- with a
package.jsonfieldworkspaces pnpm-workspace.yaml- ,
lerna.json,nx.jsonturbo.json - with a
Cargo.tomlsection[workspace] - Multiple subdirectories under ,
packages/, orapps/each containing their own project manifest (services/,package.json,go.mod,Cargo.toml)pyproject.toml
- 包含字段的
workspacespackage.json pnpm-workspace.yaml- 、
lerna.json、nx.jsonturbo.json - 包含章节的
[workspace]Cargo.toml - 、
packages/或apps/目录下存在多个子目录,每个子目录都有自己的项目清单(services/、package.json、go.mod、Cargo.toml)pyproject.toml
Split project signals
拆分项目特征
- +
frontend/(orbackend/+client/,server/+web/) directories each containing source code and/or their own project manifestapi/ - Multiple apps or libraries of the same language under a common parent directory (e.g., ,
apps/web/,apps/api/each with their own source and config) — suggests a wildcard entry point likeapps/worker/apps/*
- +
frontend/(或backend/+client/、server/+web/)目录,每个目录都包含源代码和/或自己的项目清单api/ - 同一语言的多个应用或库位于同一父目录下(例如、
apps/web/、apps/api/,每个都有自己的源代码和配置)——建议使用通配符入口点如apps/worker/apps/*
Single project signals
单一项目特征
- or
src/as sole source directory, or source files at project rootlib/ - No monorepo or split project signals found
If monorepo or split project: Read for detailed multi-project entry point guidance, then follow it for Steps 4 through 8. The rest of this file covers the single-project flow.
references/project-structure.mdIf single project: Tell the user what you detected and continue below.
- 或
src/作为唯一的源代码目录,或源代码文件位于项目根目录lib/ - 未发现单体仓库或拆分项目的特征
若为单体仓库或拆分项目: 阅读获取多项目入口点的详细指南,然后按照该指南执行步骤4至8。本文档剩余部分介绍单一项目的流程。
references/project-structure.md若为单一项目: 告知用户检测结果,然后继续执行后续步骤。
Step 4: Determine entry point path
步骤4:确定入口点路径
Infer the source directory:
- If exists and contains source code, suggest
src/src - If exists and contains source code, suggest
lib/lib - Otherwise suggest (project root — safer default since it captures all changes)
.
Skip this step if adding checks to an existing entry point that already has a path.
推断源代码目录:
- 若存在且包含源代码,建议使用
src/src - 若存在且包含源代码,建议使用
lib/lib - 否则建议使用(项目根目录——更安全的默认选项,因为它能捕获所有变更)
.
若为向现有入口点添加检查项,则跳过此步骤(该入口点已包含路径)。
Step 5: Scan for tooling
步骤5:扫描工具链
Scan the project for tooling signals across the 6 check categories listed in .
references/check-catalog.mdFor the "add checks" path: Filter out checks already configured in .
entry_pointsIf no tools discovered: Offer the custom flow (skip to Step 7). Still include review.
code-quality扫描项目中属于列出的6个检查类别的工具特征。
references/check-catalog.md对于「添加检查」流程: 过滤掉中已配置的检查项。
entry_points若未发现任何工具: 提供自定义流程(跳至步骤7)。仍需包含评审。
code-qualityStep 6: Present findings and confirm
步骤6:展示检测结果并确认
Show a table of discovered checks:
Category | Tool | Command | Confidence
----------------|-----------------|--------------------------------------|-----------
Build | npm | npm run build | High
Lint | ESLint | npx eslint . | High
Typecheck | TypeScript | npx tsc --noEmit | High
Test | Jest | npx jest | High
Security (deps) | npm audit | npm audit --audit-level=moderate | Medium
Security (code) | Semgrep | semgrep scan --config auto --error . | MediumConfidence levels:
- High — Tool config file found AND/OR explicit script in package.json/Makefile
- Medium — Tool found in devDependencies or inferred from CI workflow but no dedicated config
- Low — Only indirect evidence (e.g., test directory exists but no runner config found)
If a category has no discovered tool, show with for command and confidence.
(not found)—Ask the user:
- Which checks to enable (default: all)
- Whether any commands need adjustment
If the user declines ALL checks, still include review and offer the custom flow (Step 7).
code-qualityAfter confirmation, proceed to Step 8 (create files).
展示已发现检查项的表格:
Category | Tool | Command | Confidence
----------------|-----------------|--------------------------------------|-----------
Build | npm | npm run build | High
Lint | ESLint | npx eslint . | High
Typecheck | TypeScript | npx tsc --noEmit | High
Test | Jest | npx jest | High
Security (deps) | npm audit | npm audit --audit-level=moderate | Medium
Security (code) | Semgrep | semgrep scan --config auto --error . | Medium置信度等级:
- 高 —— 发现工具配置文件,且/或/Makefile中有明确的脚本
package.json - 中 —— 在devDependencies中发现工具,或从CI工作流推断出工具,但无专用配置文件
- 低 —— 仅存在间接证据(例如存在测试目录但未发现运行器配置)
若某类别未发现工具,显示,命令和置信度栏显示。
(未找到)—询问用户:
- 要启用哪些检查项(默认:全部)
- 是否需要调整任何命令
若用户拒绝所有检查项,仍需包含评审,并提供自定义流程(步骤7)。
code-quality确认后,继续执行步骤8(创建文件)。
Step 7: Add custom
步骤7:添加自定义项
Ask the user: check (shell command) or review (AI code review)?
For checks: Ask for command, name, and optional settings (run_in_ci, run_locally).
For reviews: Built-in () or custom prompt? Ask for name and write the review content.
code-quality询问用户:添加check(Shell命令)还是review(AI代码评审)?
对于check: 询问命令、名称及可选设置(、)。
run_in_cirun_locally对于review: 使用内置()还是自定义提示?询问名称并编写评审内容。
code-qualityStep 8: Create files and update config
步骤8:创建文件并更新配置
Checks — Add checks inline in the entry point's array. Each inline check is a single-key object (check name → config object). Include . Add optional fields (, ) only when they differ from defaults. See for schema. Do NOT add a top-level map — inline checks belong under entry_points.
checkscommandrun_in_cirun_locallyreferences/check-catalog.mdchecksCustom reviews — Create with YAML frontmatter () and review prompt.
.validator/reviews/<name>.mdnum_reviews: 1Built-in reviews — Add built-in reviews inline in the entry point's array (e.g. ). Do not create a separate file for built-in reviews.
reviews- code-quality: { builtin: code-quality }Update entry_points in :
.validator/config.ymlyaml
entry_points:
- path: "<source_dir>"
checks:
- build:
command: npm run build
- lint:
command: npx eslint .
reviews:
- code-quality:
builtin: code-qualityAlways include in for fresh setups. For "add checks" / "add custom": append to the appropriate entry point's lists, or add a new entry point if needed. A check or review defined inline in one entry point can be referenced by name (as a string) in other entry points.
code-qualityreviewsChecks —— 在入口点的数组中内联添加检查项。每个内联检查项是一个单键对象(检查名称 → 配置对象)。需包含。仅当与默认值不同时,才添加可选字段(、)。请参考中的schema。请勿添加顶层映射——内联检查项应放在下。
checkscommandrun_in_cirun_locallyreferences/check-catalog.mdchecksentry_points自定义reviews —— 创建文件,包含YAML前置元数据()和评审提示。
.validator/reviews/<name>.mdnum_reviews: 1内置reviews —— 在入口点的数组中内联添加内置评审(例如)。无需为内置评审创建单独文件。
reviews- code-quality: { builtin: code-quality }更新中的:
.validator/config.ymlentry_pointsyaml
entry_points:
- path: "<source_dir>"
checks:
- build:
command: npm run build
- lint:
command: npx eslint .
reviews:
- code-quality:
builtin: code-quality全新配置时,务必在中包含。对于「添加检查」/「添加自定义项」:将内容追加到对应入口点的列表中,或根据需要添加新的入口点。在一个入口点中内联定义的check或review,可以通过名称(字符串形式)在其他入口点中引用。
reviewscode-qualityStep 9: "Add something else?"
步骤9:“是否需要添加其他内容?”
Ask the user. If yes, loop to Step 7. If no, proceed.
询问用户。若需要,循环至步骤7。若不需要,继续执行后续步骤。
Step 10: Validate
步骤10:验证配置
Run . If it fails, apply one corrective attempt and re-validate. If it still fails, STOP and ask the user.
agent-validate validate运行。若验证失败,尝试一次修正后重新验证。若仍失败,停止操作并询问用户。
agent-validate validateStep 11: Commit configuration
步骤11:提交配置
Commit all validator configuration and skills so the setup is preserved in version control:
- Stage all new/modified files: ,
.validator/,.claude/skills/validator-*/,.claude/settings.local.json.gitignore - Create a commit:
git commit -m "chore: configure agent-validator checks and reviews"
If there are no changes to commit (everything already committed), skip this step silently.
提交所有验证器配置及技能,确保设置被保存到版本控制中:
- 暂存所有新增/修改的文件:、
.validator/、.claude/skills/validator-*/、.claude/settings.local.json.gitignore - 创建提交:
git commit -m "chore: configure agent-validator checks and reviews"
若无需要提交的变更(所有内容已提交),则静默跳过此步骤。
Step 12: Advance validator baseline
步骤12:更新验证器基线
Run to advance the execution state baseline to the current working tree, so the next run only diffs against future changes.
/validator-skip运行将执行状态基线更新至当前工作树,以便下次运行仅对比未来的变更。
/validator-skipStep 13: Suggest next steps
步骤13:建议下一步操作
Tell the user: configuration is complete. Run to execute, or again to add more.
/validator-run/validator-setup告知用户:配置已完成。运行执行检查,或再次运行添加更多配置。",
/validator-run/validator-setup