Skip to content

Commit 22dfd6e

Browse files
authored
Merge pull request #389 from timescale/fix/output-format-coverage
fix(cli): honor --output-format across structured and artifact commands
2 parents f22cc10 + e997f7f commit 22dfd6e

37 files changed

Lines changed: 2053 additions & 381 deletions

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,26 @@ jobs:
361361
run: |
362362
python3 scripts/mcp-smoke.py --bin target/debug/rsigma
363363
python3 scripts/mcp-smoke.py --http --bin target/debug/rsigma
364+
365+
output-format-smoke:
366+
name: Output Format Smoke
367+
runs-on: ubuntu-latest
368+
permissions:
369+
contents: read # read repo
370+
steps:
371+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
372+
with:
373+
persist-credentials: false
374+
- name: Install Rust stable
375+
run: |
376+
rustup toolchain install stable --profile minimal --no-self-update
377+
rustup override set stable
378+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
379+
with:
380+
save-if: ${{ github.ref == 'refs/heads/main' }}
381+
# Build the full CLI so daemon-gated commands (`pipeline resolve`) and
382+
# the shared output renderer are exercised against a real binary.
383+
- name: Build rsigma with all features
384+
run: cargo build --locked -p rsigma --all-features
385+
- name: Smoke-test --output-format across CLI commands
386+
run: ./scripts/output-format-smoke.sh --bin target/debug/rsigma

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to RSigma are documented in this file. Each entry correspond
44

55
## [Unreleased]
66

7+
### CLI: complete `--output-format` coverage (#389)
8+
9+
- Structured report commands (`backend targets`/`formats`, `rule validate`, `pipeline resolve`/`diff`, `config validate`/`show`/`path`, and the existing eval/lint/fields/report family) honor `json`/`ndjson`/`table`/`csv`/`tsv` through a shared renderer backed by the `csv` crate.
10+
- `backend convert` emits one NDJSON query record per line for `--output-format ndjson`; table/csv/tsv warn and keep raw query text.
11+
- AST commands (`rule parse`/`condition`/`stdin`) warn and fall back to JSON for table/csv/tsv instead of silently ignoring the selector.
12+
- Fixed products (`rule reverse`, `rule draft` YAML, `rule migrate-sources`, `engine tap`, `engine daemon`, `mcp serve`, `config init`/`reload`) keep their wire format and emit a standardized unsupported-format warning when an incompatible selector is set.
13+
- `config validate`/`show` local `--format` wins over global `--output-format` with a precedence warning when both are set.
14+
- CI runs `scripts/output-format-smoke.sh` against a full-featured binary to keep the per-command contract from drifting.
15+
716
### rstix: TAXII collection ingest (`taxii-store` feature) (#387)
817

918
- **`taxii-store`** — meta-feature (`taxii` + `store`).

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Full documentation, including guides, CLI reference, and library API docs, lives
4949

5050
* **[Detection diagnostics](https://rsigma.io/cli/engine/explain/):** Explains why a rule did or did not match an event with `engine explain`, diffs pipeline transformations with `pipeline diff`, and introspects live correlation windows
5151
* **[Corpus backtesting](https://rsigma.io/cli/rule/backtest/):** Replays an event corpus against declared per-rule expectations with `rule backtest`, emitting a JSON or JUnit XML report for CI
52-
* **[Output formats](https://rsigma.io/reference/output/):** Renders every command's results as JSON, NDJSON, table, CSV, or TSV with a TTY-aware default via a global `--output-format` flag
52+
* **[Output formats](https://rsigma.io/reference/output/):** Structured commands render JSON, NDJSON, table, CSV, or TSV with a TTY-aware default via a global `--output-format` flag; artifact and protocol commands keep their fixed wire format (see the per-command contract)
5353

5454
### Deploy
5555

crates/rsigma-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ rsigma-mcp = { path = "../rsigma-mcp", version = "0.20.0", optional = true }
4444
clap = { version = "4", features = ["derive", "env"] }
4545
serde = { version = "1", features = ["derive"] }
4646
serde_json = "1"
47+
csv = "1"
4748
serde_ignored = "0.1"
4849
schemars = "1"
4950
yaml_serde = "0.10"

0 commit comments

Comments
 (0)