Validate repository state
validate_repository_stateValidate a local git repository's latest commit message, author, branch name, and optional force-push safety in one call, returning pass/fail checks with actionable fixes.
Instructions
Validate what is already in a local git repository: the latest commit's message and author,
the checked-out branch name and, optionally, whether pushing that branch to its upstream would
be a force push. Leaves the working tree and commits untouched; the push check may run
git fetch, which updates FETCH_HEAD and remote-tracking refs.
Returns {status, warnings, checks[]}. status is 'pass', 'fail' or 'skip': only 'fail' is a rejection; 'skip' means every check skipped, so nothing was validated and the result is not approval. warnings is the number of checks with status 'warn'. Each check has: rule_id (stable rule id, e.g. 'CC001'); check (rule name, e.g. 'message'); status 'pass' | 'fail' | 'warn' | 'skip' ('warn' = the config lists the check under warn, so the finding is reported without failing the run; 'skip' = the rule did not run, e.g. the author is in ignore_authors or there was nothing to check); value (what was checked); error (why it failed); suggest (advice for a person); fix (the corrected value when the correction is unambiguous, else ''); docs_url (documentation for the rule). On 'fail', apply a non-empty fix verbatim; when fix is '', rewrite following suggest; then validate again.
Use this to check a repository's current state in one call, e.g. after committing and before pushing, or in a hook. The include_* flags select the checks; at least one must be true. To validate values that are not yet committed use validate_commit_context or the single-aspect tools.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| config | No | Inline commit-check config overrides as a JSON object, merged on top of the built-in defaults and any config file, e.g. {"warn": ["message"]} or {"commit": {"require_body": true}}. | |
| repo_path | No | Path to the git repository to inspect; its cchk.toml or commit-check.toml is loaded and a relative config_path is resolved from it. Omit to use the server's working directory, which must then be a git repository. | |
| config_path | No | Path to a commit-check TOML config file, used instead of the repository's own cchk.toml/commit-check.toml; a relative path is resolved from repo_path. | |
| include_push | No | Also check that pushing the current branch to its upstream would not be a force push; may run git fetch (updating FETCH_HEAD), and passes when the branch has no upstream. Default false. | |
| include_author | No | Validate the author name and email of the latest commit (falling back to git config user.name/user.email). Default true. | |
| include_branch | No | Validate the name of the currently checked-out branch. Default true. | |
| include_message | No | Validate the message of the latest commit (HEAD). Default true. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||