project

package
v0.44.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath(claudeDir string) string

ConfigPath returns the path to contextspectre.json within the given claude dir.

func Save

func Save(claudeDir string, cfg *Config) error

Save writes the config to disk atomically (temp file + rename).

Types

type Alias

type Alias struct {
	Paths []string `json:"paths"`
}

Alias maps a logical project name to one or more filesystem paths.

type Config

type Config struct {
	Version            int              `json:"version"`
	Aliases            map[string]Alias `json:"aliases"`
	CostAlertThreshold float64          `json:"cost_alert_threshold,omitempty"`
	WeeklyBudgetLimit  float64          `json:"weekly_budget_limit,omitempty"`
	WeeklyLimit        float64          `json:"weekly_limit,omitempty"`
	BillingWeekStart   string           `json:"billing_week_start,omitempty"`
	ExpertMode         bool             `json:"expert_mode,omitempty"`
	HealthContextWarn  float64          `json:"health_context_warn,omitempty"`
	HealthCPDWarn      float64          `json:"health_cpd_warn,omitempty"`
	HealthTTCWarn      int              `json:"health_ttc_warn,omitempty"`
	HealthCDRWarn      float64          `json:"health_cdr_warn,omitempty"`
}

Config holds the contextspectre configuration file.

func Load

func Load(claudeDir string) (*Config, error)

Load reads the config from disk. Returns empty config if file does not exist.

func (*Config) RemoveAlias

func (c *Config) RemoveAlias(name string) error

RemoveAlias removes an alias by name.

func (*Config) Resolve

func (c *Config) Resolve(name string) []string

Resolve returns the paths for a given alias name. Returns nil if not found.

func (*Config) SetAlias

func (c *Config) SetAlias(name string, paths []string) error

SetAlias adds or updates an alias. Validates name format and that paths exist.

func (*Config) SortedNames

func (c *Config) SortedNames() []string

SortedNames returns alias names in sorted order.

Jump to

Keyboard shortcuts

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