Skip to content

chore(cli): canonical --output jsonl (ndjson kept as hidden alias) - #4

Draft
h4x0r wants to merge 2 commits into
mainfrom
chore/output-format-vocab
Draft

chore(cli): canonical --output jsonl (ndjson kept as hidden alias)#4
h4x0r wants to merge 2 commits into
mainfrom
chore/output-format-vocab

Conversation

@h4x0r

@h4x0r h4x0r commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

mem4n6 spelled newline-delimited JSON --output ndjson; the rest of the fleet spells it jsonl. This makes jsonl the canonical spelling here and keeps ndjson working as a hidden alias, so no existing invocation breaks.

Why jsonl is canonical (measured, not preferred)

Counted across ronin-issen/components (all tracked files — source, docs, READMEs, CI, tests, fixtures), excluding target/:

Spelling Occurrences (any case) Repos
jsonl 1381 20
ndjson 338 6

The fleet machine-view list in CLAUDE.core.md reads "JSON, JSONL, CSV, bodyfile", and prefers JSONL over a pretty JSON array for streams. Both the docs and the code lean the same way.

Of the 6 repos mentioning ndjson, only two ever exposed it as a CLI value: this one and srum-cli. In blazehash and winevt-cli the string appears only as prose describing what some other flag emits (--stream, -f ecs), not as a format name a user types.

What changes

OutputFormat::Ndjson -> Jsonl, carrying #[value(name = "jsonl", alias = "ndjson")]:

  • --output jsonl — canonical, and the only spelling --help lists
  • --output ndjson — still parses, resolves to the same variant

Plus 49 rewritten match arms, the six --output help strings, and two stale in-code references.

The alias is hidden rather than deprecated-with-a-warning: the rename carries no semantic change, so a warning would be noise on every piped run.

Invocations that would break without the alias

Every mem4n6 <subcommand> ... --output ndjson, across the six subcommands that accept --output: framebuf, and the five others whose help strings previously read "table, json, csv, ndjson". With the alias, none break.

Semver

CLI surface, not Rust API — the crate's public API is unchanged. The removed spelling is still accepted, so this is not a breaking UX change either.

TDD

Two commits, RED then GREEN.

RED (4765266) — four failing tests, output pasted in the commit:

--output jsonl must parse (fleet-canonical spelling): "invalid variant: jsonl"
assertion `left == right` failed: `ndjson` must be an alias of `jsonl`, ...
  left: "ndjson"
 right: "jsonl"
help must list `jsonl`, got ["table", "json", "csv", "ndjson"]
`memf framebuf test.dmp --output jsonl` must parse: ... InvalidValue ...

The alias test is the load-bearing one — it protects users, and it is written so it would fail if the alias were ever dropped.

GREEN (fba5a34) — implementation. All four pass.

Gate

cargo build, cargo test (232 passed, 18 ignored), cargo clippy --all-targets -- -D warnings, cargo fmt --check — all clean.

🤖 Generated with Claude Code

h4x0r and others added 2 commits August 2, 2026 03:13
mem4n6 spells newline-delimited JSON `ndjson`; the rest of the fleet spells it
`jsonl` (1381 occurrences across 20 repos vs 338 across 6, and the fleet
machine-view list reads "JSON, JSONL, CSV, bodyfile"). Two names for one
concept.

Four failing tests pin the intended contract:

  - `--output jsonl` parses and its canonical name is `jsonl`
  - legacy `--output ndjson` still parses and resolves to the SAME variant
  - `--help` advertises `jsonl` only (the alias stays hidden)
  - both spellings parse end-to-end through clap on a real subcommand

The alias test is the load-bearing one: every existing
`mem4n6 <cmd> --output ndjson` invocation, script and runbook must keep working
after the rename.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…dden alias

`OutputFormat::Ndjson` becomes `Jsonl` with `#[value(name = "jsonl", alias =
"ndjson")]`, so:

  - `--output jsonl` is the canonical spelling and the only one `--help` lists
  - `--output ndjson` keeps parsing, resolving to the same variant

No invocation breaks. The alias is deliberately hidden rather than deprecated-
with-a-warning: the spelling change carries no semantic change, so a warning
would be noise on every piped run.

Also rewritten: 49 `OutputFormat::Ndjson` match arms, the six `--output`
help strings ("table, json, csv, ndjson" -> "... jsonl"), and two stale
in-code references to the old name.

Chosen by measured fleet usage, not preference: `jsonl` appears 1381 times
across 20 repos, `ndjson` 338 times across 6, and the fleet machine-view list
is "JSON, JSONL, CSV, bodyfile".

Gate: cargo build, cargo test (232 passed), cargo clippy --all-targets
-D warnings, cargo fmt --check - all clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant