Skip to content

feat(config): named Typesense clusters with picker#5

Merged
ekrist1 merged 14 commits into
ekrist1:masterfrom
tharropoulos:feat/named-clusters
Jun 3, 2026
Merged

feat(config): named Typesense clusters with picker#5
ekrist1 merged 14 commits into
ekrist1:masterfrom
tharropoulos:feat/named-clusters

Conversation

@tharropoulos
Copy link
Copy Markdown
Contributor

@tharropoulos tharropoulos commented Jun 2, 2026

  • add [clusters.<name>] plus global.default_cluster. legacy flat url/api_key migrates to a default cluster
  • expose Config.URL() / APIKey() / ActiveCluster() / ClusterNames() helpers and update the app to route through them
  • gain a Cluster field in the Setup form
  • in Settings, cycle through configured clusters (and a trailing + new slot) with / on the Cluster field; URL and API key auto-replace from the selected cluster
  • open a global cluster picker with c from any normal tab. Enter saves global.default_cluster, rebuilds the client/screens, and refreshes the current tab
  • render the global picker as a centered overlay on top of the current page (new internal/tui/overlay.go)
  • support j/k aliases alongside / in the global picker
  • document the named-clusters config layout and picker keys in the README

depends on: #4

@ekrist1 ekrist1 marked this pull request as ready for review June 3, 2026 16:14
Copilot AI review requested due to automatic review settings June 3, 2026 16:14
@ekrist1 ekrist1 merged commit a542c7d into ekrist1:master Jun 3, 2026
Copy link
Copy Markdown

Copilot AI left a comment

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 introduces named Typesense clusters backed by a TOML config format, and adds TUI affordances to switch clusters both from Settings and via a global cluster picker overlay, routing all connection usage through new config.Config helper methods.

Changes:

  • Replace legacy flat YAML connection config with TOML [clusters.<name>] plus global.default_cluster, including legacy YAML fallback/migration and tab-order validation.
  • Add a global cluster picker (c) rendered as a centered overlay, plus Settings/setup support for selecting/creating clusters and auto-filling URL/API key.
  • Update the TUI app wiring to use configurable tab ordering and Config.URL()/APIKey()/ActiveCluster... helpers, with new tests covering these behaviors.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Documents TOML config layout, named clusters, and picker/navigation keys.
main.go Uses cfg.NeedsSetup() to decide whether to enter setup even when a config file loads.
internal/tui/screens/setup.go Adds Cluster field and cluster cycling/new-cluster slot behavior in the setup form.
internal/tui/overlay.go Introduces overlay composition helpers for rendering a centered modal over existing content.
internal/tui/app.go Adds global cluster picker state/handlers, tab ID/title configuration, and routes client creation through config helpers.
internal/tui/app_test.go Adds tests for tab ordering, settings save behavior, cluster switching, overlay rendering, and Ctrl+C behavior in setup.
internal/config/config.go Implements TOML config (plus legacy YAML fallback), cluster selection helpers, tab-order validation, and migration utilities.
internal/config/config_test.go Adds/updates tests for TOML round-trips, legacy YAML fallback, NeedsSetup, tab order, and invalid tabs errors.
go.mod Adds go-toml/v2 dependency.
go.sum Adds go-toml/v2 checksums.

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

Comment thread internal/tui/app.go
Comment on lines +448 to +452
a.cfg.Global.DefaultCluster = names[a.pickIx]
if err := config.Save(a.cfgPath, a.cfg); err != nil {
a.pickErr = "save failed: " + err.Error()
return nil
}
Comment thread go.mod
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
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