Skip to content

feat(format): add core:columns-rows formatter for HQL table output - #78

Merged
sawka-harness merged 10 commits into
mainfrom
feat/hql-columns-rows-table
Aug 5, 2026
Merged

feat(format): add core:columns-rows formatter for HQL table output#78
sawka-harness merged 10 commits into
mainfrom
feat/hql-columns-rows-table

Conversation

@vinaysrini

Copy link
Copy Markdown
Contributor

Summary

  • Add a reusable core:columns-rows text formatter and ExpandColumnsRows helpers for the standard {columns, rows} query result shape
  • Route --format table|csv|tsv|markdown|jsonl through FormatArrayOutput when execute/get payloads match that shape
  • Wire execute hql:run to use the new formatter so tabular output works out of the box

Test plan

  • go test ./pkg/format/ ./pkg/registry/
  • go build -o bin/harness ./cmd/harness/
  • ./bin/harness execute hql:run --query 'find entity "platform:project" | select {name} | limit 5' --format table
  • Same query with default format (text → table) and --format csv
  • Confirm non-columns/rows execute commands still reject --format table

Made with Cursor

Enable --format table/csv/tsv on execute hql:run by expanding the
standard {columns, rows} query result shape through FormatArrayOutput,
and register a reusable core:columns-rows text formatter for others.

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant

CLAassistant commented Aug 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Preserve unique generated column IDs, enforce raw JSON semantics, and surface truncation in human-readable table output while covering empty and raw result paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vinaysrini

Copy link
Copy Markdown
Contributor Author

Addressed all review findings in 0e914a7:

  1. Duplicate column name collisions — dedup now tracks every generated ID (used) and advances a per-base suffix until unique. Covered by x, x_2, x → x, x_2, x_3.
  2. --raw + tabular formats — reject early with the standard --raw is only supported with --format json (same as list path). Tests: RawTableRejected, RawJSONKeepsEnvelope.
  3. Empty result (columns: []) — still recognized as columns/rows shape; table renders empty and exits 0. Covered by TestExpandColumnsRows_EmptyResult.
  4. Dispatch / --raw test coverage — added tests for item_expr extraction into table output, raw rejection, and raw JSON envelope preservation.
  5. Truncation notice consistency(truncated) now also appears for --format table / markdown via PageMeta.Notice (human-readable only; csv/tsv/jsonl stay clean). Covered by TruncatedTableNotice.

@sawka-harness
sawka-harness merged commit 3600b80 into main Aug 5, 2026
1 check passed
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.

3 participants