Usage modes¶
YAGA is designed to be used at different points in a development lifecycle. The same provider rules and stable reports can run interactively, in local hooks, in ordinary CI, or through the unified root GitHub Action.
Choose the right execution surface¶
The command name tells you which boundary YAGA is checking; it does not automatically select every possible check. The command index lists each checker's source, prerequisites, formats, and execution surfaces. Keep each concern on the narrowest surface that can express it:
| Surface | Selects | Reads | Writes or trusts | Best use |
|---|---|---|---|---|
commit check |
One message, commit, or range | Message text and, for Git sources, local history | Nothing; no network or fetch | Deterministic commit policy in a hook or ordinary CI |
github pull-request check |
One event title plus its exact commit range | Event file, checked-out head, complete local history | Nothing; no GitHub API calls | Unprivileged pull-request validation |
pull-request description check / github pull-request description check |
One description from a file, stdin, event, or explicit PR selector | Explicit policy, description, and optional template; --pr fetches the current body through gh |
Nothing; local and event sources stay offline | Required PR sections, meaningful content, and optional spelling before or after publication |
pull-request review check |
One offline review snapshot (--file) or live pull request (--pr) |
Explicit [agent-review] policy plus head-bound reviews, comments, reactions, or check runs via gh |
Read-only by default; opt-in --submit-review posts a commit-bound review on open non-draft PRs |
Enforcing Codex, Copilot, Claude, or custom bot reviews and publishing PR verdicts |
repo check |
An explicit provider list or versioned plan | Selected policies plus the explicit commit/revision inputs | Nothing; provider reports stay separate | One repeatable repository quality gate |
workflow check / security / lint |
Explicit workflow files or documented defaults | Workflow YAML and local Action metadata | Nothing; lint runs in a hardened container | Actions supply-chain and syntax checks |
commit quality |
One message, commit, or range | Complete selected message, sent to an optional provider | Nothing; model output is advisory | Finding vague or low-information prose |
gate agent-review <operation> |
A trusted review lifecycle operation | Provider evidence, requests, and bounded GitHub state | Trusted workflows may post comments or publish commit statuses | Coordinating external review agents |
The deterministic and read-only default surfaces require no write permissions. The Agent review gate is different: its write-capable operations belong only in a trusted default-branch workflow and must not consume pull-request code, artifacts, or caches. A pull-request workflow can report findings, but it is not merge-security authority. Combine checks explicitly in CI or a repository plan rather than assuming that one provider implies another.
A practical layering¶
For a repository that wants strong local feedback and a defensible merge gate, use the layers in this order:
- Run
commit check --message,--file, or--stdinbefore a commit is created. This gives immediate deterministic feedback without requiring Git history. - Install the
commit-msgpre-commit adapter for editors and normal local commits. Treat it as a convenience because it can be bypassed and cannot inspect merge parents. - Run
commit check --rangeand the selected repository/workflow providers in unprivileged CI with a complete checkout. Pass exact event SHAs through quoted environment variables. - Add
commit qualityonly as an advisory signal. Keep body layout, scope, footer, and other repository requirements in deterministic policy. - Run
gate agent-reviewonly from the trusted publisher workflow when external agents need to request, authorize, or publish review outcomes.
This layering keeps local commands fast, CI reproducible, and privileged writes isolated. It also
makes ordinary check failures actionable: a policy finding is exit 1, while a missing input,
malformed event, missing Git object, unavailable model, or invalid provider result is exit 2.
Trusted lifecycle operations retain their own exit behavior: a GateError returns 1.
Interactive CLI¶
Use the installed command when a developer is diagnosing one input:
yaga commit check --message "feat(cli): explain a policy"
yaga config show --format text
yaga workflow security .github/workflows/ci.yml
The command writes human-readable findings to standard output. Invocation, configuration, Git,
and other operational errors use standard error and exit 2; policy findings use exit 1.
This describes the policy-check commands above, not the trusted lifecycle operations. CLI usage
errors may be plain text even when --format json was supplied; see
exit-aware capture.
The standalone policy-check commands commit check, branch check, change check, mode check,
path check, size check, tree check, policy check, both pull-request description commands,
pull-request review check, and test policy check / test plan / test evaluate accept
--quiet when a caller needs only the exit status (test evaluate suppresses only successful
output and retains failure reports). commit quality accepts the same option for advisory
findings. Quiet mode suppresses policy or advisory reports on standard output; operational errors
still use standard error and exit 2. Use --format json when another program needs the
versioned document.
The same policy checkers (except test *), plus github pull-request check,
pull-request triage check, workflow check, workflow security, workflow lint, and
repo check, support --format github for escaped workflow annotations where documented.
Configuration reports remain text/JSON; commit quality also supports GitHub warning/error
annotations, while gate agent-review policy evaluate additionally supports GitHub output for
adapter result evaluation.
For multi-lens adapters, agent-review policy template emits a complete pending JSON receipt
scaffold whose digest and lens entries can be filled as provider work completes.
Explicit commit sources¶
Commit checking has one deliberate source-selection contract:
yaga commit check --message "feat(cli): explain a policy"
yaga commit check --file .git/COMMIT_EDITMSG
yaga commit check --stdin < message.txt
yaga commit check --commit HEAD~1
yaga commit check --range origin/main..HEAD
With no source option, it checks HEAD. Supplying two sources is an operational error. A range
preserves deterministic oldest-first order. Git selection never fetches, does not use a shell, and
requires complete history when parent relationships matter.
Local pre-commit hook¶
The hook is a thin direct adapter around yaga commit check --file; policy remains in the
repository configuration:
repos:
- repo: https://github.com/dariuszpanas/yaga
rev: <audited-40-character-commit-sha>
hooks:
- id: yaga-commit-check
It catches malformed messages before they are committed, but it is bypassable and cannot know a merge commit's parent count. Keep the complete-history CI check as the authoritative repository guard.
Ordinary CI¶
CI should install a pinned environment, check out complete history, and pass event-derived values through quoted environment variables:
- uses: actions/checkout@<audited-full-sha>
with:
fetch-depth: 0
persist-credentials: false
- name: Check the pull request range
env:
YAGA_RANGE: ${{ format('{0}..{1}', github.event.pull_request.base.sha, github.event.pull_request.head.sha) }}
run: >-
yaga commit check
--range "$YAGA_RANGE"
--format github
Do not interpolate untrusted branch names, commit messages, paths, or event fields into shell source. Pull-request CI is an unprivileged quality signal; it is not trusted merge authority.
Aggregate repository plan¶
Use a plan when a repository wants one repeatable set of independent checks:
The plan chooses providers; runtime options still choose the commit and revision. Plan v1 contains
the original commit/workflow providers. Plan v2 can add the committed-tree providers. There is no
implicit all, automatic plan discovery, or provider-specific argument when that provider was not
selected. Exit 2 wins if any selected provider has an operational error, even when another has a
policy finding.
Unified GitHub Action (YAGA Checks)¶
The root composite Action (uses: dariuszpanas/yaga@..., listed on GitHub Marketplace as
YAGA Checks) defaults check to commit and dispatches into isolated runtimes for read-only
pull-request commit checks, installed-CLI checks (pr-review, pr-triage, pr-description, repo,
branch, change, workflow*, mode, path, size, tree), and the write-capable gate
lifecycle adapter. See GitHub Actions for per-mode inputs and token isolation.
Write-capable review gate¶
The retained gate is a separate trusted workflow adapter:
Consumers should use the supplied composite Action and trusted default-branch workflow model, not invoke write operations from pull-request code. See GitHub review adapter for the lifecycle, evidence, authorization, and quota requirements.
For documentation development, see Contributing.