judgevet.adapters.inbound.cli_policy_run
Status: draft.
judgevet.adapters.inbound.cli_policy_run
Compose policy judgments with explicit adapter ownership and safe diagnostics.
Examples:
from judgevet.adapters.inbound.cli_policy_run import run_policy
assert callable(run_policy)
See Also
- judgevet.adapters.inbound.cli: Legacy parsing and output callbacks.
- judgevet.adapters.inbound.cli_policy: Local policy validation.
- judgevet.adapters.inbound.cli_policy_eval: Typed answer evaluation.
CliCallbacks
dataclass
Reuse the legacy CLI parsing and rendering boundaries.
Attributes:
| Name | Type | Description |
|---|---|---|
parse |
Callable
|
Parse question JSON into typed questions. |
build |
Callable
|
Format a typed answer envelope. |
output |
Callable
|
Render the envelope in the selected mode. |
Examples:
from judgevet.adapters.inbound.cli import (
parse_questions,
build_response_data,
output_response,
)
callbacks = CliCallbacks(parse_questions, build_response_data, output_response)
assert callable(callbacks.parse)
run_policy(state, questions, model, api_key, as_json, policy_file, callbacks)
Validate policy, build its configured adapter and close after judgment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
str
|
Existing state string interpretation. |
required |
questions
|
str
|
Existing question JSON. |
required |
model
|
str
|
Explicit model argument. |
required |
api_key
|
str | None
|
Explicit key override, if supplied. |
required |
as_json
|
bool
|
Select machine output. |
required |
policy_file
|
str
|
Explicit policy file path. |
required |
callbacks
|
CliCallbacks
|
Existing parsing and rendering boundaries. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Zero for met policy, three for unmet policy, or one for an input/service error. |