config

package
v0.1.694 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeLocal  = "local"
	ModeRemote = "remote"
)

Variables

This section is empty.

Functions

func ClearCredentials

func ClearCredentials() error

func CredentialsPath

func CredentialsPath() (string, error)

func Home

func Home() (string, error)

Home returns the ticket home directory used for config and (in local mode) the database. Resolution order:

  1. $TICKET_HOME if set
  2. Walk up from CWD looking for an existing .ticket directory
  3. ${CWD}/.ticket (default, may not yet exist)

func Path

func Path() (string, error)

Path returns the path to the config file ($TICKET_HOME/config.json).

func Save

func Save(cfg Config) error

func SaveCredentials

func SaveCredentials(creds Credentials) error

Types

type Config

type Config struct {
	ServerURL      string `json:"server_url"`
	Token          string `json:"token"`
	Username       string `json:"username"`
	CurrentProject string `json:"current_project"`
	CurrentEpicID  string `json:"current_epic_id"`

	// TUI state — persisted between sessions by default.
	// Set TUIDisablePersist=true to skip save/restore.
	TUIDisablePersist bool     `json:"tui_disable_persist,omitempty"`
	TUITheme          string   `json:"tui_theme,omitempty"`
	TUIMode           string   `json:"tui_mode,omitempty"` // "summary" | "projects" | "ideas" | "list" | "settings"
	TUICursor         int      `json:"tui_cursor,omitempty"`
	TUIExpandedEpics  []string `json:"tui_expanded_epics,omitempty"`

	// Temporary delete confirmation state
	DeleteConfirmToken   string `json:"delete_confirm_token,omitempty"`
	DeleteConfirmProject string `json:"delete_confirm_project,omitempty"`
}

func Load

func Load() (Config, error)

type Credentials

type Credentials struct {
	Token string `json:"token"`
}

func LoadCredentials

func LoadCredentials() (Credentials, error)

type Resolved

type Resolved struct {
	Mode      string // "local" or "remote"
	DBPath    string // populated when Mode == "local"
	ServerURL string // populated when Mode == "remote"
}

Resolved holds the parsed result of TICKET_URL.

func ResolveURL

func ResolveURL() (Resolved, error)

ResolveURL determines mode and target from environment.

TICKET_URL=http(s)://host  → remote mode
(unset)                    → local mode, DBPath = <Home()>/ticket.db

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL