judgevet.adapters.inbound.cli_policy

Status: draft.

judgevet.adapters.inbound.cli_policy

Compatibility wrapper for the historical CLI policy parser.

Examples:

from judgevet import Noul
from judgevet.adapters.inbound.cli_policy import parse_policy

rules = parse_policy(
    '{"rules":[{"question":"q","pass":{"noul":{"min":0.5}}}]}',
    {"q": Noul()},
)
assert rules[0].minimum == 0.5
See Also

Rule dataclass

A validated policy rule.

Attributes:

Name Type Description
name str

Question name from the policy.

kind str

Question type: 'noul', 'choice', or 'score'.

minimum float | None

Minimum value for range predicates.

maximum float | None

Maximum value for range predicates.

choice str | None

Exact choice label for choice predicates.

min_confidence float | None

Minimum confidence for Choice/Score predicates.

score_min float

Minimum allowed score value (0 for all scores).

score_max float

Maximum allowed score value (len(criteria)-1).

Examples:

rule = Rule("clear", "noul", minimum=0.8)
assert rule.minimum == 0.8

parse_policy(text, questions)

Decode through the shared JSON facade with historical CLI errors.

Parameters:

Name Type Description Default
text str

Raw JSON policy text.

required
questions Mapping[str, Question]

Typed question definitions.

required

Returns:

Type Description
tuple[Rule, ...]

Tuple of historical CLI rules in policy order.

Raises:

Type Description
InputFailure

If policy decoding or validation fails.