Skip to content

feat(tui): add configurable VCS column#51

Merged
mabd-dev merged 7 commits into
mabd-dev:feat/jjSupportfrom
frittlechasm:feat/jjsupport
Jun 9, 2026
Merged

feat(tui): add configurable VCS column#51
mabd-dev merged 7 commits into
mabd-dev:feat/jjSupportfrom
frittlechasm:feat/jjsupport

Conversation

@frittlechasm

@frittlechasm frittlechasm commented May 30, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Description

Adds a new [tui] showVCS configuration option for the interactive TUI output. This lets users hide the VCS column when they do not need it, while keeping the existing default behavior of showing the column.

As there might be more similar TUI options in the future have implemented a small Config Layer that can be passed to the repo table renderer instead of passing the full application config around.

This should close #49

Changes Made

  • Added Tui config support with showVCS, defaulting to true for existing configs.
  • Passed a narrow repostable.Options value into the TUI table renderer instead of exposing full config to the table package.
  • Refactored TUI table column rendering to use shared column definitions so headers and row cells stay aligned when columns are toggled.
  • Updated README and sample config with the new [tui] showVCS option.
  • Added tests for config defaulting and VCS column rendering behavior.

Testing

  • Tested locally with example workflows
  • Added new tests
  • Tested with different filters, output, etc...

Screenshots (if applicable)

ShowVCS = false
image

ShowVCS true
image

Checklist

  • I have starred the repository
  • My code follows the project's code style
  • I have updated the documentation (README, cli-flags, etc...)
  • My changes generate no new warnings
  • I have tested my changes in a real workflow
  • All tests pass locally

Additional Notes

The config layer owns the defaulting behavior through ShowVCSColumn(), so existing config files without [tui] showVCS continue to show the VCS column.

The TUI table uses a small rendering options model and derives both headers and row cells from the same active column list. This avoids header/cell drift if more optional columns are added later.

Greptile Summary

This PR adds a [tui] showVCS configuration option that lets users hide the VCS column in the interactive table. It introduces a narrow repostable.Options struct so the table renderer doesn't take a full application config, and refactors column/row creation to share a single columnDef list so headers and cells always stay aligned when columns are toggled.

  • internal/config/types.go adds a Tui struct with ShowVCS *bool and a ShowVCSColumn() method that defaults to true for backward compatibility; internal/render/tui/repostable/ui.go replaces the old parallel column/row arrays with a declarative columnDef slice and a redistributeHiddenWidth helper that reclaims space from hidden columns.
  • internal/vcs/jj/jj_test.go replaces a dependency on the /usr/bin/false binary with os.Args[0] so the "failing binary" test works cross-platform; the expected error substring is loosened from \"failed: exit status 1\" to \"failed:\" because the test binary exits with status 2 on unrecognized flags.
  • Tests covering all new code paths — config defaulting, column toggling, width redistribution, and row cell alignment — are added across three test files.

Confidence Score: 5/5

Safe to merge — the change is additive, defaults preserve existing behavior, and all toggling logic is well-covered by tests.

The config defaulting path (nil ShowVCS → show column) is exercised by dedicated unit tests. The column/row alignment refactor uses a shared columnDef list, eliminating any header-cell drift. Width redistribution is tested for both the expand-column and last-column fallback paths. The jj test fix removes a Unix-only binary dependency without introducing flakiness. No regressions were identified across the changed files.

No files require special attention.

Important Files Changed

Filename Overview
internal/config/types.go Adds Tui struct with ShowVCS *bool and ShowVCSColumn() method; nil pointer defaults to true for backward compat with existing configs
internal/config/defaults_test.go Adds table-driven test covering ShowVCSColumn() for nil, &true, and &false cases; boolPtr helper defined once in this file
internal/render/tui/repostable/ui.go Replaces hardcoded column/row arrays with declarative columnDef slice; redistributeHiddenWidth now falls back to last column when no expand column exists
internal/render/tui/repostable/main.go Threads Options through all createColumns/createRows call sites; empty placeholder row now uses make(table.Row, len(cols)) instead of hardcoded 4-element literal
internal/render/tui/repostable/types.go Adds Options struct with ShowVCS bool and stores it in the Model
internal/render/tui/repostable/ui_test.go Good coverage: VCS column omission, width reclaim, cell count with VCS off, and redistributeHiddenWidth fallback all tested
internal/render/tui/main.go Passes repostable.Options{ShowVCS: configs.ShowVCSColumn()} cleanly; no full config exposed to renderer
internal/vcs/jj/jj_test.go Replaces /usr/bin/false dependency with os.Args[0]; test binary exits status 2 on unrecognized -R flag so warnings are reliably produced cross-platform
README.md Documents new [tui] showVCS option with default value and use-case note
sample/config.toml Adds [tui] showVCS = true example with inline comment to the sample config

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["config.Config\n(TOML / CLI flags)"] -->|"ShowVCSColumn()"| B["repostable.Options\n{ShowVCS bool}"]
    B --> C["repostable.New()\nrepostable.Model"]
    C --> D["activeColumnDefs(options)"]
    D -->|"ShowVCS == true"| E["5 columnDefs\nRepo, Branch, VCS, Stash, State"]
    D -->|"ShowVCS == false"| F["4 columnDefs\nRepo, Branch, Stash, State"]
    F --> G["redistributeHiddenWidth\n+VCSW% to expand col or last col"]
    E --> H["createColumns → []table.Column"]
    G --> H
    E --> I["createRows → []table.Row"]
    F --> I
    H --> J["bubbles/table render"]
    I --> J
Loading

Reviews (2): Last reviewed commit: "test(ui): cover VCS column review feedba..." | Re-trigger Greptile

AnthonyGeorgeAZ and others added 3 commits May 30, 2026 13:17
Comment thread internal/render/tui/repostable/ui.go Outdated
Comment thread internal/config/types.go

@mabd-dev mabd-dev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looking good. The only big thing is a ColumnDef.cell can be nil which crashes the app

Comment thread internal/config/types.go
Comment thread internal/render/tui/repostable/ui.go Outdated
Comment thread internal/render/tui/repostable/ui.go Outdated
Comment thread internal/render/tui/repostable/ui.go
@mabd-dev

mabd-dev commented Jun 9, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@mabd-dev

mabd-dev commented Jun 9, 2026

Copy link
Copy Markdown
Owner

@frittlechasm thanks for the contribution. PR looks great

@mabd-dev
mabd-dev merged commit 71b1aeb into mabd-dev:feat/jjSupport Jun 9, 2026
7 checks 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