Skip to content

feat(cli): add text list column controls (#165)#252

Open
naufalfx805-source wants to merge 2 commits into
TestSprite:mainfrom
naufalfx805-source:fix/list-text-columns
Open

feat(cli): add text list column controls (#165)#252
naufalfx805-source wants to merge 2 commits into
TestSprite:mainfrom
naufalfx805-source:fix/list-text-columns

Conversation

@naufalfx805-source

@naufalfx805-source naufalfx805-source commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds text-table shaping controls for the list surfaces from #165:

  • --columns <list> selects and reorders text table columns by normalized header key.
  • --no-header suppresses the text table header row.
  • Applies to project list, test list, and test result --history in text mode.
  • Leaves JSON output unchanged and ignores the text-only flags under --output json.

The implementation centralizes text-table column parsing/rendering in src/lib/text-table.ts, while keeping each command's column definitions local to the existing renderer.

Related issue

Closes #165

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Documentation only
  • Build / CI / chore

Checklist

  • PR targets the main branch.
  • Commits follow Conventional Commits.
  • npm run lint passes.
  • npm run typecheck passes.
  • New behavior is covered by unit tests.
  • No secrets, API keys, internal endpoints, or personal data are included.

Notes for reviewers

Local verification:

  • npm run lint
  • npm run build
  • npm run typecheck
  • npm test -- src/commands/project.test.ts src/commands/test.test.ts src/commands/test.result.history.spec.ts (381 passed)
  • Built CLI smoke checks for project list, test list, and test result --history with --columns ... --no-header

npm test -- test/help.snapshot.test.ts is blocked on this Windows host before snapshot comparison by spawnSync npm ENOENT in the test harness. I updated the affected help snapshots manually from the built CLI output.

Summary by CodeRabbit

  • New Features
    • Added --columns <list> to customize, select, and reorder columns in project and test list outputs.
    • Added --no-header to suppress table headers (including test result history).
    • Standardized text-table rendering across project and test commands for consistent alignment and layout.
  • Bug Fixes
    • Unknown --columns values now fail fast with a clear VALIDATION_ERROR (details.field: columns, exit code 5).
    • JSON output remains unaffected, ignoring text-only options like --columns and --no-header.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 26205cd1-875f-4f75-bc66-fff0682f6435

📥 Commits

Reviewing files that changed from the base of the PR and between 4189f1f and 5321839.

📒 Files selected for processing (5)
  • src/commands/project.test.ts
  • src/commands/project.ts
  • src/commands/test.result.history.spec.ts
  • src/commands/test.test.ts
  • src/commands/test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/commands/test.test.ts
  • src/commands/project.test.ts
  • src/commands/test.ts
  • src/commands/project.ts

Walkthrough

The CLI adds --columns and --no-header controls for project lists, test lists, and test result history text output. A shared renderer handles column validation, ordering, sizing, formatting, and header suppression; JSON output ignores these text-only options.

Changes

Text table column controls

Layer / File(s) Summary
Shared text-table renderer
src/lib/text-table.ts
Adds reusable column resolution, validation, width measurement, row formatting, and optional header/separator rendering.
Project list table controls
src/commands/project.ts, src/commands/project.test.ts
Adds --columns and --no-header to project listing and routes text output through the shared renderer, with text and JSON coverage.
Test list table controls
src/commands/test.ts, src/commands/test.test.ts
Adds configurable test-list columns and header suppression, including validation and JSON-mode tests.
Result history table controls
src/commands/test.ts, src/commands/test.result.history.spec.ts
Adds configurable history columns and header suppression, including validation, detail-line, and JSON-mode tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: ruili-testsprite

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title concisely names the main CLI change and matches the implemented text list column controls.
Linked Issues check ✅ Passed The PR adds --columns and --no-header for the requested text tables, with validation and JSON passthrough.
Out of Scope Changes check ✅ Passed The changes stay focused on the requested text-table controls, shared renderer, and supporting tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/project.ts`:
- Line 90: Validate and resolve --columns before credentials or network access:
in src/commands/project.ts lines 90-90, preflight text columns before
makeClient; in src/commands/test.ts lines 541-543, add the same preflight for
test list; and in src/commands/test.ts lines 4524-4524, validate history columns
before listTestRuns, including empty results. Ensure unknown column keys
consistently produce validation exit code 5.

In `@src/commands/test.ts`:
- Line 4446: Update the run-history output branching around
renderRunHistoryTable so JSON, CSV, and NDJSON all use their existing machine
serializers before processing table options. Ensure --columns and --noHeader are
ignored in every machine-output mode, while preserving the current table
rendering only for text output.
- Around line 4526-4547: Update the history formatting flow around
includeDetailLines in src/commands/test.ts:4526-4547 so options.noHeader
suppresses only the header and separator, while targetUrl detail lines remain
enabled whenever custom columns are not selected. Update the expected output in
src/commands/test.result.history.spec.ts:260-264 to retain the targetUrl: line
while omitting only the header and separator.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: aa362466-4282-4b03-8536-ced07cfe82a3

📥 Commits

Reviewing files that changed from the base of the PR and between 60d55e4 and 4189f1f.

⛔ Files ignored due to path filters (1)
  • test/__snapshots__/help.snapshot.test.ts.snap is excluded by !**/*.snap, !**/*.snap
📒 Files selected for processing (6)
  • src/commands/project.test.ts
  • src/commands/project.ts
  • src/commands/test.result.history.spec.ts
  • src/commands/test.test.ts
  • src/commands/test.ts
  • src/lib/text-table.ts

Comment thread src/commands/project.ts
Comment thread src/commands/test.ts
Comment thread src/commands/test.ts
@naufalfx805-source naufalfx805-source changed the title feat(cli): add text list column controls feat(cli): add text list column controls (#165) Jul 16, 2026
@naufalfx805-source

Copy link
Copy Markdown
Contributor Author

All code checks are passing (CI, coverage, CodeRabbit). The remaining failing \gate\ check is crashing before it reaches the issue-link/assignment validation with \Cannot find module '@actions/github'\ inside \�ctions/github-script. Issue #165 is now assigned to @naufalfx805-source and the PR body closes #165.

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.

[Hackathon] feat(cli): add --columns and --no-header to text-mode list tables

1 participant