Skip to main content

Module user_beholders

Module user_beholders 

Source
Expand description

@arch:layer(kg_store) @arch:role(substrate) @arch:see(.yah/docs/working/yah-task-runs.md)

User-extensible drop-in beholder definitions.

Users place .toml files in ~/.yah/beholders/. Each file describes one beholder: which command it matches, its mode (parser | rewriter), and — for parser mode — a set of regex patterns that turn output lines into structured events.

§File format

name    = "my-linter"
version = "1.0"

# argv0 after wrapper stripping; string or array of strings
argv0 = "my-linter"

# Decline when any of these flags appear in argv (optional)
decline_if_has = ["--version", "--help"]

mode = "parser"         # "parser" | "rewriter"

# Rewriter only: args to append to argv when not already present
add_args = ["--json"]

# Parser: one or more line-matching patterns (tried in order; all matches fire)
[[patterns]]
regex  = '(.+):(\d+): (error|warning): (.+)'
level  = "$3"           # literal "error"/"warn"/etc., or "$N" capture group
target = "my-linter"   # optional; defaults to beholder name
msg    = "$4"           # optional; defaults to the full matched line
[patterns.fields]
"file.path" = "$1"
"file.line" = "$2"

§Discovery

load_user_beholders reads every *.toml file in the given directory. Files that fail to parse or are semantically invalid are skipped; a warning is written to stderr so users can debug their definitions without crashing the daemon.

Structs§

UserBeholderFactory
Dynamic beholder factory loaded from a user TOML drop-in.

Functions§

load_user_beholders
Load all user-defined beholder factories from *.toml files in dir.