Documentation
¶
Overview ¶
Package clientcfg persists client-side settings (things the CLI/TUI need that the daemon doesn't), stored at ~/.dejima/client.json. It is intentionally separate from per-island project configs and from daemon state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddProfile ¶ added in v0.6.0
AddProfile saves a new connection target and persists it. It is the store half of the TUI add-flow, factored out so the CLI (`dejima profile add`) and the TUI share one code path. A duplicate name is rejected so two profiles can't shadow each other in lookups.
func SwitchProfile ¶ added in v0.6.0
SwitchProfile persists name as the active profile — the same write the TUI switcher makes. Unlike LookupProfile (ephemeral), this *does* mutate active_profile in client.json, which is the whole point of `switch` vs `-p`. The synthetic "local" clears the active profile (back to the Unix socket). An unknown name is rejected so `switch` can't leave a dangling reference.
Types ¶
type Config ¶
type Config struct {
// RepoRoot is the directory the TUI repo picker scans for git repos.
// Empty means the user hasn't chosen one yet (first-load prompt pending).
RepoRoot string `json:"repo_root,omitempty"`
// Profiles are saved connection targets (local + remote daemons), switchable
// from the TUI. ActiveProfile records the last one selected.
Profiles []Profile `json:"profiles,omitempty"`
ActiveProfile string `json:"active_profile,omitempty"`
// Editor is the CLI command for the user's preferred Remote-SSH editor
// (e.g. "code", "cursor", "windsurf", "antigravity"). Empty means auto-detect
// the first one on PATH. Set from the TUI settings (',').
Editor string `json:"editor,omitempty"`
}
Config holds client-side preferences.
func (Config) ActiveHost ¶
ActiveHost resolves the currently-active profile to its daemon host. ok is false when the active profile is the local socket, unset, or *dangling* — i.e. ActiveProfile names a profile that no longer exists (e.g. it was deleted while still selected). A dangling reference resolves to local rather than wedging the client on a target it can't look up.
func (Config) LookupProfile ¶ added in v0.6.0
LookupProfile resolves a profile by name to its daemon host, reading nothing but the in-memory config. The synthetic "local" name (and "") resolve to the empty host (the local Unix socket). This is the *ephemeral* lookup behind the `-p/--profile` launch flag: it never touches ActiveProfile, so selecting a profile for one invocation can't stomp the persistent choice shared by concurrent TUIs. An unknown name is an error (vs ActiveHost's silent fall-back), because an explicit `-p typo` should fail loudly, not connect somewhere unexpected.