Skip to main content

Module user

Module user 

Source
Expand description

User-supplied pattern extension per ADR-023 §3.6.

Users can extend the catalogue without rebuilding devboy-tools by dropping TOML files into ~/.devboy/secrets/patterns.d/*.toml. Each file declares one or more patterns:

[[pattern]]
id              = "internal-mfa-token"
display_name    = "Internal MFA Service Token"
format_regex    = "^mfa_[A-Z0-9]{40}$"
severity        = "high"
provider_id     = "internal"
retrieval_url_template = "https://mfa.example.internal/tokens"
default_expiry_days = 180
scopes_hint     = ["read", "write"]

Loading walks the directory once at startup, deserialises each file, compiles every regex up-front (so a malformed pattern is a load-time error, not a hot-path surprise), and merges with the built-in catalogue from crate::builtin.

§Shadowing

A user pattern with the same id as a built-in shadows the built-in: the user version wins from Catalogue::find and is the only one returned by Catalogue::iter. This is by design — a user might want to override the metadata or the regex for a provider whose built-in entry is wrong for their environment. To keep the override visible, a LoadWarning of kind LoadWarningKind::ShadowsBuiltin is recorded.

Structs§

Catalogue
Combined view of the built-in catalogue plus any user patterns loaded from ~/.devboy/secrets/patterns.d/*.toml.
LoadWarning
Non-fatal warning surfaced through doctor after a successful load.
UserPattern
User pattern after deserialisation + regex compilation. Holds owned strings (unlike crate::builtin::Builtin, which is 'static).
UserPatternEntry
On-disk representation of a single user pattern. Mirrors the shape from ADR-023 §3.6.
UserPatternFile
Top-level shape of a single TOML file under patterns.d/.

Enums§

LoadError
Hard errors during user-pattern loading.
LoadWarningKind
Categories of advisory warnings.

Constants§

USER_PATTERNS_SUBDIR
Subdirectory under the user’s ~/.devboy/secrets/ directory that holds extension TOML files.