verify

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Verify

Verify

.skilly/verify.json
says what each gate runs. Hooks and CI call a stage of it, so the local gate and the pipeline cannot drift into disagreeing about what green means.
.skilly/verify.json
说明每个 gate 会运行什么。Hooks 和 CI 都会调用其中的一个阶段,因此本地 gate 与流水线不会对“green(通过)”的含义产生分歧。

Usage

用法

sh
node .agents/skills/verify/scripts/verify.mjs <stage>           # run the stage
node .agents/skills/verify/scripts/verify.mjs <stage> --steps   # resolved steps as JSON, runs nothing
Works from anywhere in the Consumer. Exit 0 passed, 2 config or usage error, anything else is the failing step's code.
sh
node .agents/skills/verify/scripts/verify.mjs <stage>           # 运行该阶段
node .agents/skills/verify/scripts/verify.mjs <stage> --steps   # 输出解析后的步骤为 JSON,不运行任何内容
从 Consumer 中的任何位置均可运行。退出码 0 表示通过,2 表示配置或用法错误,其他值为失败步骤的退出码。

Config

配置

json
{
  "budgetTicket": "https://github.com/owner/repo/issues/1",
  "stages": {
    "commit": { "budgetSeconds": 10, "steps": [{ "name": "lint-staged", "run": "npx lint-staged", "why": "the reason this step exists" }] },
    "push": { "extends": "commit", "budgetSeconds": 120, "steps": [] },
    "ci": { "extends": "push", "budgetSeconds": 600, "steps": [] },
    "nightly": { "tier": "product", "budgetSeconds": 1800, "steps": [{ "name": "e2e", "run": "npm run e2e", "target": "e2e" }] }
  }
}
extends
is cumulative:
push
runs every
commit
step first, so no stage can skip a check the stage below it runs.
A budget warns and never fails. A gate that fails on slowness teaches you to bypass the gate, and the bypass outlives the slowness.
budgetTicket
says where a stage that outgrew its budget gets split.
json
{
  "budgetTicket": "https://github.com/owner/repo/issues/1",
  "stages": {
    "commit": { "budgetSeconds": 10, "steps": [{ "name": "lint-staged", "run": "npx lint-staged", "why": "the reason this step exists" }] },
    "push": { "extends": "commit", "budgetSeconds": 120, "steps": [] },
    "ci": { "extends": "push", "budgetSeconds": 600, "steps": [] },
    "nightly": { "tier": "product", "budgetSeconds": 1800, "steps": [{ "name": "e2e", "run": "npm run e2e", "target": "e2e" }] }
  }
}
extends
是累积的:
push
会先运行所有
commit
步骤,因此没有任何阶段能跳过其下阶段运行的检查。
budget(预算)只发出警告,不会导致失败。如果 gate 因为运行缓慢而失败,会教会你绕过 gate,而这种绕过会比缓慢本身更持久。
budgetTicket
指明了超出预算的阶段将如何拆分。

Tier

Tier(层级)

tier
in
.skilly/config.json
, default
sandbox
, order
sandbox
<
tool
<
product
. A step's
tier
is the minimum a repo needs to run it; below that the step is skipped. A stage's
tier
is that rule for the whole stage: below it nothing runs and the exit is 0. Tier sets the size of the net, not the standard.
tier
位于
.skilly/config.json
,默认为
sandbox
,顺序为
sandbox
<
tool
<
product
。步骤的
tier
是仓库运行它所需的最低层级;低于该层级时步骤会被跳过。阶段的
tier
是对整个阶段施加的规则:低于它时什么都不会运行,退出码为 0。Tier 决定的是网眼的大小,而不是标准的高低。

Target

Target(目标)

A step's
target
is a path relative to the repo root; missing, the step is skipped. That is how one stage list fits repos that do not all have an
e2e/
or a Dockerfile.
步骤的
target
是相对于仓库根目录的路径;如果缺失,则跳过该步骤。这样,同一份阶段列表就能适配那些并非都有
e2e/
目录或 Dockerfile 的仓库。

Adding a check

添加检查

One step in
.skilly/verify.json
, never a line in a hook or a workflow. Give it a
why
: it prints the moment the step goes red, when the reader is least likely to go looking for it.
在
.skilly/verify.json
中添加一个步骤,绝不要写成 hook 或 workflow 中的一行。给它一个
why
:当步骤变红时,阅读者最不可能主动去找原因,而这一说明会在那一刻打印出来。