Skip to main content

Module cli_parse

Module cli_parse 

Source
Expand description

§Fase 39.f — axon parse subcommand (Rust binary parity).

Multi-file diagnostic aggregator. Walks the given file paths / directories / globs, runs each .axon file through Parser::parse_with_recovery, and aggregates every parse error + type-check error into a single report. Mirrors the Python axon.cli.parse_cmd:cmd_parse from Fase 28.f.

§Flags

  • --max-errors N — cap total errors across all files (D6, default unlimited)
  • --ignore PATTERN — fnmatch-style ignore pattern (may repeat); .axonignore files in walked dirs are honoured automatically
  • --jobs N — worker thread count (default: auto). The Rust implementation currently runs single-threaded; the flag is accepted for Python-parity but the threading is deferred to a future fase (honest scope)
  • --json — emit machine-readable diagnostics (D5)
  • --format array|ndjson — JSON framing when –json is set
  • --strict — opt into legacy fail-on-first behavior (D8); also activated by AXON_PARSER_STRICT env var
  • --no-color — disable ANSI colour codes

§Exit codes (bitwise OR of cause classes)

  • 0 — success (no errors)
  • 1 — parse / type errors observed
  • 2 — I/O errors (file not found, read failed, glob expansion failed)
  • 3 — both classes (1 | 2)

Structs§

AggregatedDiagnostic
Per-file diagnostic emitted by the aggregator. Wire-stable JSON shape for --json mode (rustc-compatible field naming per Fase 28.g D5).
ParseConfig
Configuration for axon parse (mirrors the Python CLI args).

Functions§

exit_code
Compute the exit code from the diagnostics + io_errors observed. Mirrors the Python CLI’s bitwise OR convention (D6).
render_human
Format diagnostics as a human-readable report for stdout.
render_json
Format diagnostics as JSON (array or ndjson framing). Rustc- compatible field shape per Fase 28.g D5.
run_parse
Run axon parse against a configured corpus. Returns a tuple (diagnostics, io_errors, truncated):