Skip to content

osrforge.cli

The osrforge console script: convert, rerun, assemble, check, report, preview, and estimate.

House-scale argparse. Runtime failures (OsrForgeError, pydantic validation errors from malformed workdirs or bad --set values, and YAML syntax errors from a hand-edited overrides.yaml) render as a one-line message and exit code 1; a convert/rerun failure whose workdir records a failed stage appends the exact osrforge rerun command that resumes it. Tracebacks are for bugs. check exits 1 exactly when validation failed or any error-severity finding exists — warnings don't break the assemble && check loop.

format_report

format_report(report: ExtractionReport) -> str

Format the review summary osrforge report prints over a report.json.

Presentation only — machine consumers keep reading the artifact. The sections mirror the review loop's reading order: validation, flags grouped by kind with their locations (module-scope entries at location module), the monster-resolution summary with the unresolved names, and the playability findings by severity. A flag kind whose entries carry details lists one location per line — a real module's treasure_unparsed group is dozens of sentences, unreadable comma-joined; a detail-less kind is a comma-joined address list, wrapped to terminal width.

Parameters:

Name Type Description Default
report ExtractionReport

The parsed report.

required

Returns:

Type Description
str

The summary text, ending in a newline.

main

main(argv: list[str] | None = None) -> None

Run the CLI.

Parameters:

Name Type Description Default
argv list[str] | None

Argument list, defaulting to sys.argv[1:].

None

parse_set_values

parse_set_values(values: list[str] | None) -> dict[str, object]

Parse repeated --set KEY=VALUE pairs; values coerce through YAML.

yaml.safe_load makes 21, [21, 30], and best-effort all coerce naturally; pydantic validation against ConversionSettings happens in the library call. Shared with the eval harness driver, whose convert takes the same flag.

Parameters:

Name Type Description Default
values list[str] | None

The raw KEY=VALUE strings, or None.

required

Returns:

Type Description
dict[str, object]

Key → YAML-coerced value.

Raises:

Type Description
ValueError

If an item is not of the form KEY=VALUE.