config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindProjectConfigDir

func FindProjectConfigDir() string

FindProjectConfigDir searches for a .devx directory starting from the current working directory and walking up the directory tree. Returns the path to the .devx directory if found, or empty string if not found.

func GetConfigDir

func GetConfigDir() string

GetConfigDir returns the config directory path, checking project-level first

func GetConfigPath

func GetConfigPath() string

GetConfigPath returns the path to the config file, checking project-level first

func GetConfigValue

func GetConfigValue(key string) interface{}

func GetGlobalTmuxTemplatePath added in v0.3.0

func GetGlobalTmuxTemplatePath() string

GetGlobalTmuxTemplatePath returns the path to the global session.yaml.tmpl file without any CWD-based project discovery.

func GetProjectConfigDir

func GetProjectConfigDir(projectPath string) string

GetProjectConfigDir returns the .devx directory path for a project

func GetProjectRegistryPath

func GetProjectRegistryPath() string

GetProjectRegistryPath returns the path to the projects.json file

func GetSessionsPath

func GetSessionsPath() string

GetSessionsPath returns the path to the sessions.json file For multi-project support, we always use the global sessions file

func GetTmuxTemplatePath

func GetTmuxTemplatePath() string

GetTmuxTemplatePath returns the path to the session.yaml.tmpl file, checking project-level first. Project discovery uses os.Getwd(), so this is only reliable when the caller's working directory is inside the project. Prefer passing projectPath explicitly and using GetGlobalTmuxTemplatePath for the fallback when the project root is known.

func GetUpdateCheckPath added in v0.1.1

func GetUpdateCheckPath() (string, error)

GetUpdateCheckPath returns the path to the update check state file

func LoadTUISessionView added in v0.4.0

func LoadTUISessionView() (string, error)

func ResolveProjectTarget added in v0.4.0

func ResolveProjectTarget(projectPath, globalTarget string) string

ResolveProjectTarget returns the effective default session target for a project: the project's .devx/config.yaml "target" if set, otherwise the provided global default, otherwise "host". It is the canonical statement of the project-or-global target precedence used by the web new-session form (web/api.go).

cmd/session_create.go applies the same precedence inline rather than calling this helper: it already holds the loaded *Config (so it avoids a second config read), layers the --target flag on top, and validates via target.Resolve. The two implementations must stay in agreement; this helper is the reference. It deliberately performs no flag handling and no target validation, so callers that need either must do it themselves.

func SaveConfig

func SaveConfig(cfg *Config) error

func SaveUpdateCheckState added in v0.1.1

func SaveUpdateCheckState(state *UpdateCheckState) error

SaveUpdateCheckState saves the update check state to disk

func SetConfigValue

func SetConfigValue(key string, value interface{}) error

func SetTUISessionView added in v0.4.0

func SetTUISessionView(view string) error

func ShouldCheckForUpdates added in v0.1.1

func ShouldCheckForUpdates(lastCheck time.Time, interval time.Duration) bool

ShouldCheckForUpdates determines if we should check for updates based on interval

Types

type AgentResponderConfig added in v0.4.0

type AgentResponderConfig struct {
	Enabled  bool     `mapstructure:"enabled"`
	Mode     string   `mapstructure:"mode"`
	Command  string   `mapstructure:"command"`
	Args     []string `mapstructure:"args"`
	Timeout  string   `mapstructure:"timeout"`
	ReadOnly bool     `mapstructure:"read_only"`
}

type Config

type Config struct {
	Target                 string               `mapstructure:"target"`
	BaseDomain             string               `mapstructure:"basedomain"`
	CaddyAPI               string               `mapstructure:"caddy_api"`
	TmuxpTemplate          string               `mapstructure:"tmuxp_template"`
	Ports                  []string             `mapstructure:"ports"`
	BootstrapFiles         []string             `mapstructure:"bootstrap_files"`
	ExternalDomain         string               `mapstructure:"external_domain"`
	CloudflareTunnelID     string               `mapstructure:"cloudflare_tunnel_id"`
	CloudflareTunnelConfig string               `mapstructure:"cloudflare_tunnel_config"`
	WebSecretToken         string               `mapstructure:"web_secret_token"`
	WebPort                int                  `mapstructure:"web_port"`
	WebAutostart           bool                 `mapstructure:"web_autostart"`
	ArtifactTriggerKey     string               `mapstructure:"artifact_trigger_key"`
	AgentResponder         AgentResponderConfig `mapstructure:"agent_responder"`
	Usage                  UsageConfig          `mapstructure:"usage"`
	Gatepost               struct {
		Root                     string `mapstructure:"root"`
		AgentImage               string `mapstructure:"agent_image"`
		LogsCommand              string `mapstructure:"logs_command"`
		ProviderBootstrapCommand string `mapstructure:"provider_bootstrap_command"`
		AuthHome                 string `mapstructure:"auth_home"`
		RequiredProviders        string `mapstructure:"required_providers"`
	} `mapstructure:"gatepost"`
}

func GetProjectConfig

func GetProjectConfig(projectPath string) (*Config, error)

GetProjectConfig loads the config for a specific project

func LoadConfig

func LoadConfig() (*Config, error)

type Project

type Project struct {
	Name             string `json:"name"`
	Path             string `json:"path"`
	Description      string `json:"description,omitempty"`
	DefaultBranch    string `json:"default_branch,omitempty"`
	AutoPullOnCreate bool   `json:"auto_pull_on_create,omitempty"`
}

Project represents a registered project in devx

type ProjectRegistry

type ProjectRegistry struct {
	Projects map[string]*Project `json:"projects"`
}

ProjectRegistry manages multiple projects

func LoadProjectRegistry

func LoadProjectRegistry() (*ProjectRegistry, error)

LoadProjectRegistry loads the project registry from the projects.json file

func (*ProjectRegistry) AddProject

func (r *ProjectRegistry) AddProject(alias string, project *Project) error

AddProject adds a new project to the registry

func (*ProjectRegistry) FindProjectByPath

func (r *ProjectRegistry) FindProjectByPath(path string) (string, *Project, error)

FindProjectByPath searches for a project by its path

func (*ProjectRegistry) GetProject

func (r *ProjectRegistry) GetProject(alias string) (*Project, error)

GetProject retrieves a project by alias

func (*ProjectRegistry) RemoveProject

func (r *ProjectRegistry) RemoveProject(alias string) error

RemoveProject removes a project from the registry

func (*ProjectRegistry) Save

func (r *ProjectRegistry) Save() error

Save saves the project registry to disk

type UpdateCheckState added in v0.1.1

type UpdateCheckState struct {
	LastCheck           time.Time `json:"last_check"`
	LastNotifiedVersion string    `json:"last_notified_version,omitempty"`
}

UpdateCheckState stores the last update check information

func LoadUpdateCheckState added in v0.1.1

func LoadUpdateCheckState() (*UpdateCheckState, error)

LoadUpdateCheckState loads the update check state from disk

type UsageConfig added in v0.4.0

type UsageConfig struct {
	Enabled      bool   `mapstructure:"enabled"`
	PollInterval string `mapstructure:"poll_interval"`
	Redline      struct {
		URL       string `mapstructure:"url"`
		TokenFile string `mapstructure:"token_file"`
		// AllowRemote permits a non-loopback Redline URL, which puts the API
		// token on the network and so must be opted into explicitly.
		AllowRemote bool `mapstructure:"allow_remote"`
	} `mapstructure:"redline"`
}

UsageConfig configures the provider usage widget, which reads Claude/Codex allowances from a Redline service on this host.

Jump to

Keyboard shortcuts

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