config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultEnvProbes

func DefaultEnvProbes() []string

DefaultEnvProbes returns the standard list of environment variable names probed.

func FindConfigFile

func FindConfigFile() string

FindConfigFile locates the configuration file in standard precedence order: 1. ./.facet.yaml (or .facet.yaml in current working directory) 2. ~/.config/facet/config.yaml

func FindExecutable

func FindExecutable(names ...string) string

FindExecutable searches for executables across system PATH, extensions, and standard directories.

func RunDoctor

func RunDoctor(cfg *Config) error

RunDoctor executes all system discovery checks and prints the formatted report to stdout.

func RunInit

func RunInit(projectSlug string, engine string, cfg *Config) error

RunInit initializes a project workspace with default packs.

Types

type AgentCLICheck

type AgentCLICheck struct {
	Name      string      `json:"name"`
	Status    CheckStatus `json:"status"`
	Path      string      `json:"path,omitempty"`
	Available bool        `json:"available"`
}

AgentCLICheck represents the discovery status of an agent CLI.

type CheckStatus

type CheckStatus string

CheckStatus represents the health/discovery status of a component.

const (
	StatusOK       CheckStatus = "OK"
	StatusFound    CheckStatus = "Found"
	StatusNotFound CheckStatus = "Not found"
	StatusWarning  CheckStatus = "Warning"
	StatusError    CheckStatus = "Error"
)

type Config

type Config struct {
	Project    string         `yaml:"project,omitempty" json:"project,omitempty"`
	Paths      PathsConfig    `yaml:"paths" json:"paths"`
	Defaults   DefaultsConfig `yaml:"defaults" json:"defaults"`
	EnvProbes  []string       `yaml:"env_probes" json:"env_probes"`
	LoadedFrom string         `yaml:"-" json:"-"`
}

Config represents the complete Facet configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a new Config with standard default values.

func Load

func Load(paths ...string) (*Config, error)

Load loads the configuration. If a path is specified, it loads from that path. Otherwise, it checks ./.facet.yaml then ~/.config/facet/config.yaml. If neither exists, it returns DefaultConfig with AutoDetect populated.

func (*Config) AutoDetect

func (c *Config) AutoDetect() map[string]string

AutoDetect checks exec.LookPath for ffmpeg, ffprobe, node, npm, claude, opencode, copilot, as well as bundle and remotion composer directories, populating missing paths without overwriting already-pinned values.

func (*Config) Save

func (c *Config) Save(paths ...string) error

Save writes the configuration to a YAML file. If path is provided, it writes there; otherwise it uses LoadedFrom if set, or defaults to ./.facet.yaml.

type DefaultsConfig

type DefaultsConfig struct {
	Engine         string `yaml:"engine" json:"engine"`
	Voice          string `yaml:"voice" json:"voice"`
	Resolution     string `yaml:"resolution" json:"resolution"`
	FPS            int    `yaml:"fps" json:"fps"`
	AspectRatio    string `yaml:"aspect_ratio" json:"aspect_ratio"`
	PermissionMode string `yaml:"permission_mode" json:"permission_mode"`
}

DefaultsConfig holds default production and engine parameters.

type DoctorReport

type DoctorReport struct {
	Runtimes []RuntimeCheck  `json:"runtimes"`
	CLIs     []AgentCLICheck `json:"agent_clis"`
	EnvVars  []EnvVarCheck   `json:"env_vars"`
	Tools    []ToolCheck     `json:"tools"`
}

DoctorReport contains the aggregated discovery and health report.

func GenerateDoctorReport

func GenerateDoctorReport(cfg *Config) *DoctorReport

GenerateDoctorReport inspects the environment and produces a structured DoctorReport.

func RunDoctorWithWriter

func RunDoctorWithWriter(cfg *Config, w io.Writer) (*DoctorReport, error)

RunDoctorWithWriter executes all discovery checks, formats and prints the output to w, and returns the report.

func (*DoctorReport) JSON

func (r *DoctorReport) JSON() ([]byte, error)

JSON serialization helper for report

type EnvVarCheck

type EnvVarCheck struct {
	Name    string `json:"name"`
	IsSet   bool   `json:"is_set"`
	Display string `json:"display"` // "set" or "not set"
}

EnvVarCheck represents the masked presence of an environment variable.

type InitOptions

type InitOptions struct {
	ProjectDir  string   `json:"project_dir"`
	Engine      string   `json:"engine"`
	Packs       []string `json:"packs"`
	Resolution  string   `json:"resolution,omitempty"`
	FPS         int      `json:"fps,omitempty"`
	AspectRatio string   `json:"aspect_ratio,omitempty"`
	Voice       string   `json:"voice,omitempty"`
}

InitOptions controls workspace creation, engine selection, and packs.

type InitResult

type InitResult struct {
	ProjectDir  string            `json:"project_dir"`
	Engine      string            `json:"engine"`
	SkillsPath  string            `json:"skills_path"`
	LinkMethod  string            `json:"link_method"` // "junction", "symlink", "copy"
	ConfigFile  string            `json:"config_file"`
	TemplateDir string            `json:"template_dir,omitempty"`
	Packs       []string          `json:"packs,omitempty"`
	Projections map[string]string `json:"projections,omitempty"`
}

InitResult records the artifacts and paths created during initialization.

func RunInitWithOptions

func RunInitWithOptions(opts InitOptions, cfg *Config, w io.Writer) (*InitResult, error)

RunInitWithOptions initializes a workspace with custom options.

func RunInitWithWriter

func RunInitWithWriter(projectSlug string, engine string, cfg *Config, w io.Writer) (*InitResult, error)

RunInitWithWriter initializes the workspace and prints progress to w.

type ManagedEntry

type ManagedEntry struct {
	EntryType      string `json:"entry_type"` // "directory-junction", "symlink", "copy", "instruction-section"
	Target         string `json:"target"`
	ContentSHA256  string `json:"content_sha256,omitempty"`
	AddedSeparator bool   `json:"added_separator,omitempty"`
	CreatedOn      string `json:"created_on"`
}

ManagedEntry represents an individual managed path or projection.

type OwnershipRecord

type OwnershipRecord struct {
	Schema         string                  `json:"schema"`
	InstallationID string                  `json:"installation_id"`
	FacetVersion   string                  `json:"facet_version"`
	ManagedEntries map[string]ManagedEntry `json:"managed_entries"`
}

OwnershipRecord tracks entries managed by Facet to prevent clobbering user files.

type PathsConfig

type PathsConfig struct {
	FFmpeg           string `yaml:"ffmpeg,omitempty" json:"ffmpeg,omitempty"`
	FFprobe          string `yaml:"ffprobe,omitempty" json:"ffprobe,omitempty"`
	Node             string `yaml:"node,omitempty" json:"node,omitempty"`
	NPM              string `yaml:"npm,omitempty" json:"npm,omitempty"`
	Bundle           string `yaml:"bundle,omitempty" json:"bundle,omitempty"`
	RemotionComposer string `yaml:"remotion_composer,omitempty" json:"remotion_composer,omitempty"`
	Claude           string `yaml:"claude,omitempty" json:"claude,omitempty"`
	OpenCode         string `yaml:"opencode,omitempty" json:"opencode,omitempty"`
	Copilot          string `yaml:"copilot,omitempty" json:"copilot,omitempty"`
	Codex            string `yaml:"codex,omitempty" json:"codex,omitempty"`
}

PathsConfig holds resolved or pinned executable and directory paths.

type ProjectLock

type ProjectLock struct {
	Version  string   `json:"version"`
	Engine   string   `json:"engine"`
	Packs    []string `json:"packs"`
	LockedAt string   `json:"locked_at"`
}

ProjectLock represents the portable facet.lock.json pinned to a project.

type RuntimeCheck

type RuntimeCheck struct {
	Name      string      `json:"name"`
	Status    CheckStatus `json:"status"`
	Path      string      `json:"path,omitempty"`
	Version   string      `json:"version,omitempty"`
	Details   string      `json:"details,omitempty"`
	Available bool        `json:"available"`
}

RuntimeCheck represents the status of an external or built-in runtime.

type ToolCheck

type ToolCheck struct {
	Name        string   `json:"name"`
	Capability  string   `json:"capability"`
	Configured  bool     `json:"configured"`
	MissingDeps []string `json:"missing_dependencies,omitempty"`
}

ToolCheck represents the configuration status of a toolbox tool.

Jump to

Keyboard shortcuts

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