[PR #7254] [MERGED] feat(cli): add CSV and TSV analysis views #7748

Closed
opened 2026-11-03 13:40:07 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7254
Author: @Tapraj-Pathak
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @gensokyo-dev

Base: main ← Head: feature/csv-tsv-analysis-views


📝 Commits (10+)

  • 901d290 feat(cli): add CSV and TSV analysis views
  • f7dd684 Merge branch 'main' into feature/csv-tsv-analysis-views
  • 4e87fa4 Update tests/boundary/cli/filteredArrayOutput.test.ts
  • 7a0f97f Merge branch 'main' into feature/csv-tsv-analysis-views
  • bdff015 Update src/cli.ts
  • 82f9269 fix(cli): address delimited export review feedback
  • c9af53d Merge branch 'feature/csv-tsv-analysis-views' of https://github.com/Tapraj-Pathak/rea into feature/csv-tsv-analysis-views
  • 884569b fix(cli): format delimited output block in cliResultOutput
  • fdbe0b2 Merge remote-tracking branch 'origin/main' into fix/5482-csv-tsv-followup
  • 2d73733 fix(cli): retain delimited view uncertainty and align completions

📊 Changes

13 files changed (+1014 additions, -36 deletions)

View changed files

📝 docs/cli.md (+29 -0)
📝 src/cli.ts (+8 -2)
📝 src/cli/cliOutputFormatter.ts (+193 -3)
📝 src/cli/cliResultOutput.ts (+190 -4)
📝 src/cli/completions.ts (+15 -4)
📝 src/cliBuiltinArguments.ts (+31 -0)
📝 src/cliOutput.ts (+89 -14)
📝 src/mcpDoctor.ts (+3 -4)
📝 tests/boundary/cli/cliOutput.test.ts (+90 -0)
➕ tests/boundary/cli/cliOutputFormatter.test.ts (+136 -0)
📝 tests/boundary/cli/completions.test.ts (+14 -2)
➕ tests/boundary/cli/delimitedAnalysisViewCli.test.ts (+71 -0)
📝 tests/boundary/cli/filteredArrayOutput.test.ts (+145 -3)

📄 Description

Summary

Fixes #5482. Adds opt-in CSV/TSV export of explicitly selected CLI row collections, with ordered scalar columns and a versioned metadata preamble. JSON remains the complete Evidence representation.

The CLI output owner validates the full selected page before writing, rejects nested cells and spreadsheet formula-leading text with tagged input errors, and streams records with backpressure. Row selection retains enclosing view provenance, coverage, limitations and unknowns. One document-format definition now serves MCP doctor and completion; regular commands additionally advertise CSV/TSV. MCP and provider behavior are unchanged. This is a presentation change within existing scope; a new execution/provider scope decision is not applicable.

Example: rea inspect-analysis-view request.json --format csv --filter-output normalized_result.items --columns logical_path,artifact_id.

Validation performed

Linux, Node 24.22.1 / npm 11.16.0; at most two test workers.

  • Final focused completion, filtered-output and public delimited CLI regressions: 60/60 passed after the uncertainty-preservation fix.
  • Earlier five-file output/completion suite: 132/133 passed. The remaining existing retains closed slices and multiple filter paths subprocess exceeded its 3000 ms deadline. The identical test also failed on unchanged main 40b9c03f9, so its deadline was not changed here. Serializer and output-option tests passed in that run.
  • npm run check:fast: passed on the final source; pre-push rechecked the same inputs successfully.
  • npm run docs:check: passed, including 9 README checks.
  • git diff --check: passed. Full npm run check completed its other stages but was stopped in whole-repository typed lint after roughly 9 minutes and ~8 GiB combined resident memory. A bounded GOMEMLIMIT=2GiB timeout --kill-after=5s 90s oxlint --type-aware --threads 1 run on the seven changed TypeScript files then passed (warnings only). Full-repository typed lint remains unverified.

Real-data and efficiency evidence

Packaged the installed Incur 0.6.1 distribution files, LICENSE and package metadata into a local 235,631-byte ZIP, then read it through public inspect-artifact and exported the resulting inventory through inspect-analysis-view. Verified all 159 selected path/artifact-ID pairs against JSON, along with identical page coverage and parent Evidence identity. This is real installed package content in a locally created archive, not a vendor firmware or real-provider run.

For the same selected-fields question (JSON also retains mandatory occurrence IDs), output including the metadata preamble was JSON 51,696 bytes / ~12,634 tokens, CSV 15,852 / ~3,928, TSV 15,691 / ~3,769. Tokens use the repository's tokenx estimator, not a model tokenizer. The command arguments add a small uncounted input cost; schemas and the common initial inventory acquisition were not included. These figures describe the view retrieval, not total investigation savings.

Each observation used a fresh CLI process; filesystem cache state was uncontrolled. Initial / mean of two subsequent runs:

Workflow Elapsed seconds CPU seconds Sampled process-family peak MiB
main JSON 6.60 / 7.19 4.27 / 4.63 211.6 / 212.0
updated JSON 4.71 / 3.70 3.55 / 2.81 211.1 / 211.0
CSV 4.67 / 3.46 3.42 / 2.68 211.8 / 211.7
TSV 4.90 / 4.05 2.86 / 2.74 211.0 / 212.3

Shared-host load varied; these measurements do not establish a speedup. Family RSS was sampled every 10 ms; CPU came from wait4. No application cache or new provider startup was involved. Complete source Evidence remains in the local input file and can be retrieved independently.

Compatibility and limits

CSV uses CRLF, TSV LF; delimiter/quote/newline escaping preserves Unicode. Missing and null cells are empty by the documented table format; use JSON for typed round-trip fidelity. Output requires one row path and explicit columns. Token slicing/counting is rejected for delimited records. No new target authority, dependencies, packaged metadata or real-provider claims.

Expected effects of this change:

  • Documentation or usability only; no target interaction.

Author readiness

Human owner: @Tapraj-Pathak

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/7254 **Author:** [@Tapraj-Pathak](https://github.com/Tapraj-Pathak) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `feature/csv-tsv-analysis-views` --- ### 📝 Commits (10+) - [`901d290`](https://github.com/morluto/rea/commit/901d290514e13e31dffd68993604ce6e4621e115) feat(cli): add CSV and TSV analysis views - [`f7dd684`](https://github.com/morluto/rea/commit/f7dd6849e45bce87c4c4fe00e8dc1fbf7237c7e2) Merge branch 'main' into feature/csv-tsv-analysis-views - [`4e87fa4`](https://github.com/morluto/rea/commit/4e87fa4796541be691dff9c74e8d9b6e015eee88) Update tests/boundary/cli/filteredArrayOutput.test.ts - [`7a0f97f`](https://github.com/morluto/rea/commit/7a0f97f7c68c1ef47808991b577f940e887f7e0f) Merge branch 'main' into feature/csv-tsv-analysis-views - [`bdff015`](https://github.com/morluto/rea/commit/bdff01520f5e4a44fa4bba1bfc319533c443d146) Update src/cli.ts - [`82f9269`](https://github.com/morluto/rea/commit/82f926982082a62929366e477a8cfe0e80b382bb) fix(cli): address delimited export review feedback - [`c9af53d`](https://github.com/morluto/rea/commit/c9af53d84165d00f849e833be1eca991f4e9159f) Merge branch 'feature/csv-tsv-analysis-views' of https://github.com/Tapraj-Pathak/rea into feature/csv-tsv-analysis-views - [`884569b`](https://github.com/morluto/rea/commit/884569bc77e0d4a83e3baba7cd3e0306ac96f26f) fix(cli): format delimited output block in cliResultOutput - [`fdbe0b2`](https://github.com/morluto/rea/commit/fdbe0b20bfbc31a8a212aa36e0fc16bed0edf7a5) Merge remote-tracking branch 'origin/main' into fix/5482-csv-tsv-followup - [`2d73733`](https://github.com/morluto/rea/commit/2d7373357f3e78a2d14698bf4028399ba6dbff72) fix(cli): retain delimited view uncertainty and align completions ### 📊 Changes **13 files changed** (+1014 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `docs/cli.md` (+29 -0) 📝 `src/cli.ts` (+8 -2) 📝 `src/cli/cliOutputFormatter.ts` (+193 -3) 📝 `src/cli/cliResultOutput.ts` (+190 -4) 📝 `src/cli/completions.ts` (+15 -4) 📝 `src/cliBuiltinArguments.ts` (+31 -0) 📝 `src/cliOutput.ts` (+89 -14) 📝 `src/mcpDoctor.ts` (+3 -4) 📝 `tests/boundary/cli/cliOutput.test.ts` (+90 -0) ➕ `tests/boundary/cli/cliOutputFormatter.test.ts` (+136 -0) 📝 `tests/boundary/cli/completions.test.ts` (+14 -2) ➕ `tests/boundary/cli/delimitedAnalysisViewCli.test.ts` (+71 -0) 📝 `tests/boundary/cli/filteredArrayOutput.test.ts` (+145 -3) </details> ### 📄 Description ## Summary Fixes #5482. Adds opt-in CSV/TSV export of explicitly selected CLI row collections, with ordered scalar columns and a versioned metadata preamble. JSON remains the complete Evidence representation. The CLI output owner validates the full selected page before writing, rejects nested cells and spreadsheet formula-leading text with tagged input errors, and streams records with backpressure. Row selection retains enclosing view provenance, coverage, limitations and unknowns. One document-format definition now serves MCP doctor and completion; regular commands additionally advertise CSV/TSV. MCP and provider behavior are unchanged. This is a presentation change within existing scope; a new execution/provider scope decision is not applicable. Example: `rea inspect-analysis-view request.json --format csv --filter-output normalized_result.items --columns logical_path,artifact_id`. ## Validation performed Linux, Node 24.22.1 / npm 11.16.0; at most two test workers. - Final focused completion, filtered-output and public delimited CLI regressions: **60/60 passed** after the uncertainty-preservation fix. - Earlier five-file output/completion suite: **132/133 passed**. The remaining existing `retains closed slices and multiple filter paths` subprocess exceeded its 3000 ms deadline. The identical test also failed on unchanged main `40b9c03f9`, so its deadline was not changed here. Serializer and output-option tests passed in that run. - `npm run check:fast`: passed on the final source; pre-push rechecked the same inputs successfully. - `npm run docs:check`: passed, including 9 README checks. - `git diff --check`: passed. Full `npm run check` completed its other stages but was stopped in whole-repository typed lint after roughly 9 minutes and ~8 GiB combined resident memory. A bounded `GOMEMLIMIT=2GiB timeout --kill-after=5s 90s oxlint --type-aware --threads 1` run on the seven changed TypeScript files then passed (warnings only). Full-repository typed lint remains unverified. ## Real-data and efficiency evidence Packaged the installed Incur **0.6.1** distribution files, LICENSE and package metadata into a local 235,631-byte ZIP, then read it through public `inspect-artifact` and exported the resulting inventory through `inspect-analysis-view`. Verified all **159** selected path/artifact-ID pairs against JSON, along with identical page coverage and parent Evidence identity. This is real installed package content in a locally created archive, not a vendor firmware or real-provider run. For the same selected-fields question (JSON also retains mandatory occurrence IDs), output including the metadata preamble was JSON **51,696 bytes / ~12,634 tokens**, CSV **15,852 / ~3,928**, TSV **15,691 / ~3,769**. Tokens use the repository's `tokenx` estimator, not a model tokenizer. The command arguments add a small uncounted input cost; schemas and the common initial inventory acquisition were not included. These figures describe the view retrieval, not total investigation savings. Each observation used a fresh CLI process; filesystem cache state was uncontrolled. Initial / mean of two subsequent runs: | Workflow | Elapsed seconds | CPU seconds | Sampled process-family peak MiB | | --- | --- | --- | --- | | main JSON | 6.60 / 7.19 | 4.27 / 4.63 | 211.6 / 212.0 | | updated JSON | 4.71 / 3.70 | 3.55 / 2.81 | 211.1 / 211.0 | | CSV | 4.67 / 3.46 | 3.42 / 2.68 | 211.8 / 211.7 | | TSV | 4.90 / 4.05 | 2.86 / 2.74 | 211.0 / 212.3 | Shared-host load varied; these measurements do **not** establish a speedup. Family RSS was sampled every 10 ms; CPU came from `wait4`. No application cache or new provider startup was involved. Complete source Evidence remains in the local input file and can be retrieved independently. ## Compatibility and limits CSV uses CRLF, TSV LF; delimiter/quote/newline escaping preserves Unicode. Missing and null cells are empty by the documented table format; use JSON for typed round-trip fidelity. Output requires one row path and explicit columns. Token slicing/counting is rejected for delimited records. No new target authority, dependencies, packaged metadata or real-provider claims. Expected effects of this change: - [x] Documentation or usability only; no target interaction. ## Author readiness <!-- The human owner completes these declarations before requesting review. The PR author is the owner by default. A different owner must explicitly accept ownership on this PR. AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA. Draft PRs may leave them unchecked. These declarations record initial readiness when opening the PR for review; later pushes do not require a new human sign-off. Keep the description and validation evidence current as work changes. See CONTRIBUTING.md#pull-request-ownership-and-readiness. --> Human owner: @Tapraj-Pathak - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 13:40:07 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7748
No description provided.