Skip to content

zoo kcl bounding-box --format is ignored (always a table); export/snapshot/view/api-call status --format are also dead #1748

Description

@sneg55

Several --format flags are parsed but ignored (kcl bounding-box always prints a table), and kcl snapshot --session ignores its rendering flags

Context: API Makeathon participant. Found while reviewing the kcl command surface; the bounding-box no-op was independently confirmed by a second review pass.

1. zoo kcl bounding-box --format is dead

src/cmd_kcl.rs:1189-1191 declares pub format: Option<FormatOutput> with help "Output format", but the run impl (src/cmd_kcl.rs:1246-1286) never reads it. It unconditionally calls bounding_box_rows(...) and ctx.io.write_output_table_for_vec(...), so the output is always an ASCII table.

Every sibling measurement command resolves format via ctx.format(&self.format) (volume, mass, center-of-mass, density, surface-area), and the bounding-box row struct even derives serde::Serialize, so JSON output was clearly intended. The config-file format setting is ignored too, since that is also resolved inside ctx.format.

2. Same dead --format on other commands

kcl export (src/cmd_kcl.rs:121-123), kcl snapshot (:324-326), and kcl view (:603-605) declare "Command output format" but never reference self.format. api-call status (src/cmd_api_call.rs) accepts a format flag but hardcodes JSON output.

3. kcl snapshot --session ignores its rendering flags

The session branch (src/cmd_kcl.rs:394-413) posts only the program and a test name to the local session server and writes back whatever bytes return. --angle, --camera-style, --camera-padding, --replay, --allow-errors, and the requested --output-format are all ignored, so -t jpeg writes PNG bytes into a .jpeg file.

Concrete failure

zoo kcl bounding-box part.kcl --output-unit mm --format json | jq . gets a table and jq fails, while every other zoo kcl measurement command works in that pipeline. zoo kcl snapshot --session -t jpeg --angle ... saves a default-angle PNG under a .jpeg name.

Verify

Grep self.format in src/cmd_kcl.rs: it is referenced by the other measurement commands and nowhere in the bounding-box impl. Run zoo kcl bounding-box some.kcl --output-unit mm --format json: the output is a table. Capture the --session snapshot request with varying flags: the request body does not change.

Suggested fix

Wire ctx.format(&self.format) / ctx.io.write_output into bounding-box (and the other dead-flag commands), and thread the snapshot options into the session request, or remove the flags that cannot take effect.

Environment

Zoo CLI v0.2.184 (33534cd). Reviewed against the current main of KittyCAD/cli.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions