config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config loads and validates limitping's TOML configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir() (string, error)

Dir returns limitping's config directory, honoring $XDG_CONFIG_HOME and falling back to ~/.config/limitping.

func Path

func Path() (string, error)

Path returns the absolute path of the config file.

func WriteDefault

func WriteDefault(force bool) (string, error)

WriteDefault writes a commented default config to Path(). It refuses to overwrite an existing file unless force is true.

Types

type Config

type Config struct {
	// WeeklyThreshold: skip pinging when the weekly window's utilization
	// (0..1) is at or above this value, until the weekly window resets.
	WeeklyThreshold float64 `toml:"weekly_threshold"`
	// ResetBuffer: wait this long after a window's reset time before pinging,
	// to be sure the window has actually rolled over.
	ResetBuffer Duration `toml:"reset_buffer"`
	// Notify: emit macOS notifications on ping success/failure/skip.
	Notify bool `toml:"notify"`
	// UsageDisplay controls the text status percentage: "used" preserves the raw
	// provider usage value; "remaining" shows the complement users see in some UIs.
	UsageDisplay string `toml:"usage_display"`

	Claude ProviderConfig `toml:"claude"`
	Codex  ProviderConfig `toml:"codex"`
}

Config is the full configuration.

func Default

func Default() Config

Default returns the built-in defaults used when no config file exists.

func Load

func Load() (Config, error)

Load reads the config file, applying defaults for any missing fields. If the file does not exist, the full default config is returned.

type Duration

type Duration struct{ time.Duration }

Duration is a time.Duration that (un)marshals from TOML as a string like "10s" so the config file stays human-friendly.

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type ProviderConfig

type ProviderConfig struct {
	Enabled         bool     `toml:"enabled"`
	Prompt          string   `toml:"prompt"`
	ExtraArgs       []string `toml:"extra_args"`
	Model           string   `toml:"model"`
	ReasoningEffort string   `toml:"reasoning_effort"`
	AlignStart      string   `toml:"align_start"`
	// ContinuePrompt is the message injected into a proxied session
	// (`limitping continue <provider>`) when the 5h limit recovers.
	// Empty falls back to "continue".
	ContinuePrompt string `toml:"continue_prompt"`
	// AutoRedeem lets `watch` and `continue` spend a banked reset credit that is
	// about to lapse. Codex-only, and off by default: redeeming is irreversible.
	AutoRedeem bool `toml:"auto_redeem"`
}

ProviderConfig holds the per-provider knobs. ReasoningEffort applies to Codex-backed providers and is ignored by Claude.

Jump to

Keyboard shortcuts

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