Skip to content

Tools

parc.tools.ecs_inspect

CLI to inspect ECS references inside text or files.

app module-attribute

app = Typer(
    help="Inspect ECS references in free text or files."
)

extract_command

extract_command(text)

Extract canonical ECS references from a raw text.

Source code in parc/tools/ecs_inspect.py
@app.command("extract")
def extract_command(text: str) -> None:
    """Extract canonical ECS references from a raw text."""

    raise typer.Exit(_emit_extract_report(text))

extract_file_command

extract_file_command(path)

Extract canonical ECS references from a text file.

Source code in parc/tools/ecs_inspect.py
@app.command("extract-file")
def extract_file_command(path: Path) -> None:
    """Extract canonical ECS references from a text file."""

    if not path.exists():
        typer.secho(f"File not found: {path}", err=True, fg=typer.colors.RED)
        raise typer.Exit(2)
    if not path.is_file():
        typer.secho(f"Not a file: {path}", err=True, fg=typer.colors.RED)
        raise typer.Exit(2)

    text = path.read_text(encoding="utf-8")
    raise typer.Exit(_emit_extract_report(text))

validate_command

validate_command(query, limit=10, list_only=False)

Validate an ECS reference of any supported type, with RF fallback.

Source code in parc/tools/ecs_inspect.py
@app.command("validate")
def validate_command(query: str, limit: int = 10, list_only: bool = False) -> None:
    """Validate an ECS reference of any supported type, with RF fallback."""

    raise typer.Exit(_emit_reference_validation_report(query, limit, list_only=list_only))