Skip to content

feat(transports/cli): pin table column order via Config#68

Merged
theogravity merged 2 commits into
mainfrom
feat/cli-table-column-order
May 3, 2026
Merged

feat(transports/cli): pin table column order via Config#68
theogravity merged 2 commits into
mainfrom
feat/cli-table-column-order

Conversation

@theogravity
Copy link
Copy Markdown
Contributor

Summary

Resolves #66.

The cli transport's slice-of-map table renderer sorted columns purely lexicographically, which works for ad-hoc tables but produces a readability regression when an identifier column should anchor the row. `monorel` migrated to the cli transport and lost its hand-coded column ordering this way: `bump | changeset | package | summary` instead of `CHANGESET PACKAGE BUMP SUMMARY`.

Add a `Config.TableColumnOrder []string` knob:

```go
cli.New(cli.Config{
TableColumnOrder: []string{"package", "changeset"},
})
```

Keys named here render in the listed order at the front of the table; remaining keys sort lexicographically and follow. The knob is additive (pin only the leading columns; the rest sort). Pinned keys absent from every row are silently skipped, so the same `TableColumnOrder` is safe to reuse across call sites with different row shapes. Empty / nil falls back to the prior fully-lexicographic behavior — zero behavior change for existing users.

Released as a `:minor` bump on `transports/cli/v2` via `.changeset/cli-table-column-order.md`.

Out of scope

  • LLM reference files (`docs/src/public/llms.txt`, `llms-full.txt`) — the cli section in those files only exists on PR docs: address v2 release review findings #67's branch (not yet merged). `TableColumnOrder` will be added there in a small follow-up once docs: address v2 release review findings #67 lands.
  • Per-call column order (e.g. some `WithMetadata([]Metadata{...}, cli.OrderHint(...))` shape). monorel doesn't need it; out of scope per the issue.
  • Header capitalization control. Existing `strings.ToUpper(k)` is fine.

Test plan

  • `go test -race -count=1 ./...` in `transports/cli/` passes (incl. 4 new `TestTableColumnOrder*` tests covering each of the four cases enumerated in feat(transports/cli): pin table column order via Config #66)
  • `go test -race -count=1 ./...` in the main module still passes (no regressions in the broader test suite)
  • `bash scripts/foreach-module.sh build` clean across all modules
  • `bun run docs:build` produces a clean VitePress site
  • No em-dashes introduced (project style rule)
  • Pre-commit (gofmt + vet + staticcheck) and pre-push (`go test -race`) hooks clean

🤖 Generated with Claude Code

theogravity and others added 2 commits May 2, 2026 17:07
The cli transport's slice-of-map table renderer sorted columns purely
lexicographically, which works for ad-hoc tables but produces a
readability regression when an *identifier* column should anchor the
row. monorel migrated to the cli transport and lost its hand-coded
column ordering this way: `bump | changeset | package | summary`
instead of `CHANGESET PACKAGE BUMP SUMMARY`.

Add a `Config.TableColumnOrder []string` knob:

  cli.New(cli.Config{
      TableColumnOrder: []string{"package", "changeset"},
  })

Keys named here render in the listed order at the front of the table;
remaining keys sort lexicographically and follow. The knob is additive
(pin only the leading columns; rest sort). Pinned keys absent from
every row are silently skipped, so the same `TableColumnOrder` is safe
to reuse across call sites with different row shapes. Empty / nil
falls back to the prior fully-lexicographic behavior.

Tests cover the four cases enumerated in #66:
  - Empty TableColumnOrder produces full lex output (regression cover).
  - Pinned keys lead in listed order regardless of row insertion order.
  - Pinned key absent from every row is silently dropped.
  - Un-pinned keys still lex-sort among themselves after the pinned ones.

Resolves #66.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The "When You Add a New Feature" rule listed a manual `## [Unreleased]`
edit to the root `CHANGELOG.md`, and the "Versioning Note" claimed the
repo was a single Go module that shouldn't have per-package CHANGELOGs.
Both predate the monorel migration and contradict the current AGENTS.md
guidance:

- The repo is multi-module; every transport, plugin, and integration
  has its own CHANGELOG.md.
- Both root and per-package CHANGELOGs are written from
  `.changeset/*.md` files by `monorel release` at release time.
- Manually adding `[Unreleased]` entries races the monorel pipeline
  and produces drift.

Replace the CHANGELOG step with the changeset step, and rewrite the
Versioning Note to point at AGENTS.md as the authoritative source.
Also fix the floor-bump instruction in the same file that referenced
manual `CHANGELOG.md` edits for the same reason.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@theogravity theogravity force-pushed the feat/cli-table-column-order branch from 3d6b886 to bacf1fb Compare May 3, 2026 00:07
@theogravity theogravity enabled auto-merge (squash) May 3, 2026 00:08
@theogravity theogravity disabled auto-merge May 3, 2026 00:09
@theogravity theogravity merged commit 5e3f357 into main May 3, 2026
13 checks passed
@theogravity theogravity deleted the feat/cli-table-column-order branch May 3, 2026 00:10
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.

feat(transports/cli): pin table column order via Config

1 participant