Skip to content

feat(config): switch to TOML config with configurable tabs#3

Merged
ekrist1 merged 8 commits into
ekrist1:masterfrom
tharropoulos:feat/toml-config
Jun 3, 2026
Merged

feat(config): switch to TOML config with configurable tabs#3
ekrist1 merged 8 commits into
ekrist1:masterfrom
tharropoulos:feat/toml-config

Conversation

@tharropoulos

Copy link
Copy Markdown
Contributor
  • add github.com/pelletier/go-toml/v2 dependency
  • move on-disk format to TOML (config.toml), with a legacy config.yaml fallback at the same path
  • introduce tabs.order + tab ID validation so the tab bar can be reordered or pruned from config
  • expose Config.TabOrder() and route the App through tab IDs instead of fixed indices
  • auto-append settings to tabs.order so it can't be hidden by accident
  • add ErrInvalidTabs so unknown or duplicate tab IDs surface as a config error rather than triggering the first-run setup
  • update the README configuration section to show the TOML layout and tabs.order

depends on: #2

@ekrist1 ekrist1 marked this pull request as ready for review June 3, 2026 16:06
Copilot AI review requested due to automatic review settings June 3, 2026 16:06
@ekrist1 ekrist1 merged commit 0a86c3d into ekrist1:master Jun 3, 2026

Copilot AI 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.

Pull request overview

This PR migrates clisense’s on-disk configuration to TOML, adds configurable tab ordering (via tabs.order), and updates the TUI to route by tab IDs rather than fixed indices.

Changes:

  • Switch config persistence to TOML (config.toml) with legacy config.yaml fallback, plus new Config.NeedsSetup() and Config.TabOrder().
  • Add tab ID validation (unknown/duplicate IDs return ErrInvalidTabs) and drive the tab bar from configured tab IDs.
  • Update setup/settings flow to preserve non-connection config fields and add tests/docs for the new config format.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Documents TOML config format and tabs.order, including valid tab IDs and YAML fallback note.
main.go Uses cfg.NeedsSetup() to enter setup when URL/API key are missing even if config loads.
internal/tui/screens/setup.go Preserves the full config when saving URL/API key (prevents clobbering other fields like tabs).
internal/tui/app.go Routes navigation by tab IDs and rebuilds tab list from cfg.TabOrder().
internal/tui/app_test.go Adds tests covering tab ordering, settings save flow, and ctrl+c behavior in initial setup.
internal/config/config.go Implements TOML read/write, YAML fallback, tab validation, and NeedsSetup/TabOrder.
internal/config/config_test.go Updates/expands tests for TOML paths, YAML fallback, tab order, and invalid tab handling.
go.mod Adds github.com/pelletier/go-toml/v2 dependency.
go.sum Adds checksums for the TOML dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/tui/app.go
Comment on lines 228 to 233
// Settings is a form, so keep Tab/digits/q available for the inputs.
// Esc returns to Collections.
if a.active == a.settingsTabIndex() {
if a.activeTabID() == "settings" {
switch m.String() {
case "esc":
return a, a.activateTab(0)
Comment thread go.mod
Comment on lines 27 to 33
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sahilm/fuzzy v0.1.1 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
Comment thread internal/tui/app_test.go
Comment on lines +31 to +33
cfg := config.Config{URL: "http://localhost:8108", APIKey: "xyz"}
path := filepath.Join(t.TempDir(), "config.yaml")
app := NewApp(cfg, path, false)
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