Skip to main content

Module config_schema

Module config_schema 

Source
Expand description

Typed settings and their defaults. What: The typed settings a validated cli-git.config.jsonc produces, with defaults. Why: The policy engine and transactions read plain typed values, never JSON.

In TS you’d write (pseudocode):

// type CliGitConfig = { policies: PolicyConfig; concurrency: ConcurrencyConfig };

Structs§

CliGitConfig
What: The complete validated configuration of one repository. Why: A repository without a file and a repository with an empty {} file both yield CliGitConfig::defaults(): a policy that is off unless listed stays off either way.
ConcurrencyConfig
What: The three concurrent-commit tuning groups together. Why: None of them disables the commit transaction; they only tune it.
ForbiddenStringsOptions
What: Validated options of security/forbidden-strings. Option<String> is “a configured file name or nothing”. Why: The scanner is linked into cli-git, so the remaining choices are whether its embedded baseline rules run and which repository file holds the private rules. There is deliberately no executable path.
HooksConfig
What: Hook serialization tuning (hooks key). Why: false serializes preparation and post-landing hooks through the hook lock.
IndexLockConfig
What: Foreign index.lock patience (indexLock key). Why: A lock whose owner cannot be proven alive is waited on only this long.
LandingConfig
What: Landing starvation tuning (landing key). Why: A commit that keeps losing landing races eventually reserves the next slot.
MarkdownAutofixOptions
What: Validated options of markdown/autofix. Vec<T> is an owned growable list (siblings: &[T] borrowed, [T; N] fixed). String is owned text (sibling: &str borrowed). Why: The settings outlive the parsed document, so they own their lists and text. There is deliberately no command or executable field.
PolicyConfig
What: Every policy’s severity plus the option records of option-bearing policies. Why: One value answers “does this policy run, how strictly, with what options”.
PolicySetting
What: The effective severity of one shipped policy. #[derive(...)] generates copy, debug printing and == for the struct. Why: explicit separates “the repository chose this” from “the default applied”; only an explicit unsafe warn earns a configuration warning.

Enums§

MarkdownRule
What: The closed set of Markdown rules the commit-time policy may run. Why: The shipped policy runs the owned linter with a fixed rule list; an unknown rule name is a configuration error, never a pass-through argument.

Constants§

DEFAULT_RESERVE_AFTER_LOST_RACES
Incumbent default: reserve the next landing slot after one lost landing race.
DEFAULT_UNPROVEN_OWNER_TIMEOUT_MS
What: u64 constant, an unsigned 64-bit integer (siblings u32, usize, i64). Why: Milliseconds up to 2^53 - 1 are accepted, which u32 cannot hold. This is the incumbent’s default patience for an unproven index.lock owner.

Functions§

markdown_rule_from_name
What: Translate a configured rule name into its typed rule. Option<T> is “value or nothing”: Some(rule) or None. Why: Only shipped rules exist; the caller reports any other name with its key.
markdown_rule_name
What: Translate a typed rule back to its configuration spelling. &'static str borrows text compiled into the executable for its whole run. Why: Diagnostics and the later linter invocation print the accepted spelling.
unlisted_severity
What: The severity of a policy the repository configuration does not name. &PolicyDescriptor borrows the policy’s registry row. Why: The five built-in policies run everywhere at their default severity. The four policies that plugins used to provide run only where cli-git.config.jsonc names them, whether or not a file exists, so an empty file and no file behave alike.