feat(config): switch to TOML config with configurable tabs#3
Merged
Conversation
This was referenced Jun 2, 2026
There was a problem hiding this comment.
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 legacyconfig.yamlfallback, plus newConfig.NeedsSetup()andConfig.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 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 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 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
github.com/pelletier/go-toml/v2dependencyconfig.toml), with a legacyconfig.yamlfallback at the same pathtabs.order+ tab ID validation so the tab bar can be reordered or pruned from configConfig.TabOrder()and route the App through tab IDs instead of fixed indicessettingstotabs.orderso it can't be hidden by accidentErrInvalidTabsso unknown or duplicate tab IDs surface as a config error rather than triggering the first-run setuptabs.orderdepends on: #2