Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Operators — Inspect

Inspect operators are value → bool predicates. They return the string "true" or "false" per item and are used in when and fail guards on val candidates.

All inspect operators support the :not suffix to invert the result.

val:
  - name: content
    data: query_raw
    when: 'is:empty:not' # proceed only if non-empty
    fail: 'contains:ERROR' # bail if the value contains ERROR

Operators

contains — substring test

SyntaxDescription
contains:<X>True if value contains X
when: 'contains:TODO'
when: 'contains:error:not'    # true if value does NOT contain "error"

equals — exact equality

SyntaxDescription
equals:<X>True if value equals X exactly
when: 'equals:true'
when: 'equals:0:not'          # true if value is NOT "0"

matches — regex test

SyntaxDescription
matches:<re>True if value matches the regex

Invalid regex is a hard error.

when: 'matches:^[0-9]+$'          # true if value is digits only
when: 'matches:^(feat|fix):not'   # true if value does NOT start with feat/ or fix:

compare — numeric comparison

SyntaxDescription
compare:<mode>:<N>Compare value against numeric threshold

Modes:

ModeMeaning
gtvalue > N
ltvalue < N
gtevalue ≥ N
ltevalue ≤ N
  • Non-numeric value → "false" (not an error).
  • Non-numeric threshold → hard error.
  • Unknown mode → hard error.
when: 'compare:gt:0'         # true if value is a number greater than 0
when: 'compare:lte:100:not'  # true if value is NOT ≤ 100 (or non-numeric)

is — type/presence predicate

SyntaxDescription
is:<kind>True if value matches the given kind

Kinds:

KindChecks
emptyValue is empty string
numValue parses as a float
intValue parses as an integer
boolValue is "true" or "false"
urlValue parses as a valid URL
pathValue is an existing filesystem path
jsonValue parses as valid JSON
when: 'is:empty:not'    # proceed only if value is non-empty
when: 'is:path'         # proceed only if value is an existing path
when: 'is:json:not'     # true if value is NOT valid JSON

Inversion (:not)

All inspect operators accept :not as a suffix after the arg. It swaps "true" ↔ "false". Applied after the operator, not before:

# Equivalent ways to express "not empty":
when: 'is:empty:not'

Per-item evaluation

All inspect operators are per-item over lists. When the input is a list (separated by ITEM_SEP), each item is evaluated independently, and the results are joined back into a list of "true"/"false" strings.

This matters when when/fail guards evaluate list data — every item must pass for the candidate to proceed.