validate

Validation normative de fichiers Markdown OKF (exit 0 si conforme, exit 1 sinon).

Normative validation of OKF Markdown files — exit 0 if conformant, 1 otherwise.

class okflint.validate.Diagnostic(code, tier, severity, file, message)[source]

Bases: object

OKF validation error or warning.

code: str
file: str
message: str
severity: str
tier: str
exception okflint.validate.ManifestError[source]

Bases: Exception

Invalid or unreadable OKF manifest.

okflint.validate.run_validate(manifest_path, targets, *, vault_index=None)[source]

Orchestrate OKF validation over a list of targets.

When vault_index is provided it is used as the wikilink resolution index instead of rebuilding one from the manifest roots, allowing the caller to pass a vault-wide union index built once for all bundles.

Parameters:
  • manifest_path (Path) – Path to the OKF YAML manifest.

  • targets (list[Path]) – Files or directories to validate.

  • vault_index (dict[str, list[str]] | None) – Pre-built file index (stem → list of relative paths). When provided, the per-manifest index build is skipped.

Return type:

tuple[list[Diagnostic], int]

Returns:

Tuple (list of diagnostics, exit code 0 or 1).

Raises:

ManifestError – If the manifest is invalid or unreadable.