Validate commit context
validate_commit_contextValidate commit message, branch name, and author details together in one call, returning pass/fail/warn results with fixes and suggestions before you commit.
Instructions
Run the commit message, branch name and author checks together in one call, for whichever of message, branch, author_name and author_email you pass. Read-only.
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 validate several aspects of a commit you are about to make with a single call. At least one of message, branch, author_name or author_email is required; omitted aspects are not checked. For one aspect use validate_commit_message, validate_branch_name or validate_author_info; for the commit already at HEAD use validate_repository_state.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch | No | Branch name to validate, e.g. 'feature/login'. Omit to validate the branch currently checked out in repo_path, which must then be a git repository. Must be non-empty when provided. | |
| 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}}. | |
| message | No | Commit message text to validate: subject line, optional blank line, body. Omit to skip the message checks. Must be non-empty when provided. | |
| repo_path | No | Path to the git repository to validate against. Its cchk.toml or commit-check.toml (also looked up under .github/) is loaded, and a relative config_path is resolved from it. Omit to use the server's working directory. | |
| author_name | No | Author name to validate, e.g. 'Alice Example'. Omit to read it from repo_path (git config user.name, falling back to the latest commit's author). Must be non-empty when provided. | |
| 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. | |
| author_email | No | Author email to validate, e.g. 'alice@example.com'. Omit to read it from repo_path (git config user.email, falling back to the latest commit's author). Must be non-empty when provided. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||