config

package
v0.0.77 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InferVersion

func InferVersion(cwd string) string

InferVersion attempts to determine a version or project identifier from common metadata files in cwd. It checks (in order):

  1. package.json — returns the "version" field
  2. go.mod — returns the module name (no version field exists)
  3. Cargo.toml — returns the "version" field under [package]
  4. pyproject.toml — returns the "version" field under [project]

Returns the first non-empty match, or "" if none is found.

func LoadDotenv

func LoadDotenv() error

LoadDotenv loads .env from CWD if it exists, and verifies it is listed in .gitignore. Returns nil if no .env file is present. When no .git entry exists in CWD there is no git repository that could leak secrets, so the gitignore check is skipped.

func Token

func Token() string

Token returns the GitHub token, preferring FABRIK_TOKEN over GITHUB_TOKEN.

func WarnIfConfigIgnored

func WarnIfConfigIgnored()

WarnIfConfigIgnored prints a warning to stderr if .fabrik/config.yaml is listed in .gitignore. The config file should be committed to git so it travels with the repo; ignoring it defeats that purpose. The warning is suppressed when no .git entry is present — there is no repo to leak into.

Types

type ProjectConfig

type ProjectConfig struct {
	Owner                     string   `yaml:"owner"`
	Repo                      string   `yaml:"repo"`
	ProjectNum                *int     `yaml:"project"`
	OwnerType                 string   `yaml:"owner_type"`
	User                      string   `yaml:"user"`
	StagesDir                 string   `yaml:"stages"`
	Poll                      *int     `yaml:"poll"`
	MaxConcurrent             *int     `yaml:"max_concurrent"`
	MaxRetries                *int     `yaml:"max_retries"`
	Yolo                      bool     `yaml:"yolo"`
	AutoUpgrade               bool     `yaml:"auto_upgrade"`
	GitSSH                    bool     `yaml:"git_ssh"`
	TUI                       *bool    `yaml:"tui"`
	DebugOutput               bool     `yaml:"debug_output"`
	SymlinkEnv                bool     `yaml:"symlink_env"`
	WorktreeBoundaryAudit     bool     `yaml:"worktree_boundary_audit"`
	Version                   string   `yaml:"version"`
	Webhooks                  bool     `yaml:"webhooks"`
	WebhookPort               *int     `yaml:"webhook_port"`
	WebhookEvents             []string `yaml:"webhook_events"`
	StatusPoll                *int     `yaml:"status_poll"`
	JanitorIntervalHours      *int     `yaml:"janitor_interval_hours"`
	LogRetentionDays          *int     `yaml:"log_retention_days"`
	LogMaxBytes               *int64   `yaml:"log_max_bytes"`
	SessionRetentionDays      *int     `yaml:"session_retention_days"`
	MergeTrain                string   `yaml:"merge_train"`
	AutoMergeStrategy         string   `yaml:"auto_merge_strategy"`
	MaxBatchSize              *int     `yaml:"max_batch_size"`
	MaxBisectValidations      *int     `yaml:"max_bisect_validations"`
	MaxTrainRebaseCycles      *int     `yaml:"max_train_rebase_cycles"`
	MaxTrainTrialsPerWindow   *int     `yaml:"max_train_trials_per_window"`
	TrainTrialWindow          *int     `yaml:"train_trial_window"`
	MaxCommentCyclesPerWindow *int     `yaml:"max_comment_cycles_per_window"`
	CommentCycleWindow        *int     `yaml:"comment_cycle_window"`
	// RequiredStatusContexts lists, per "owner/repo", the status/check-run
	// context names that must report a confirmed success on a PR's exact head
	// SHA before the ci-gate will clear it. Unconfigured repos get no
	// behavior change (ADR-933). Checked against the union of check-run names
	// and classic commit-status contexts observed on the head SHA.
	RequiredStatusContexts map[string][]string `yaml:"required_status_contexts"`
}

ProjectConfig holds the non-secret, project-level settings read from .fabrik/config.yaml. All fields are optional; absent fields stay zero/nil.

func LoadProjectConfig

func LoadProjectConfig() (ProjectConfig, error)

LoadProjectConfig reads .fabrik/config.yaml from CWD. If the file does not exist, a zero-value struct is returned with no error.

Jump to

Keyboard shortcuts

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