config

package
v1.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package config loads and merges repolens configuration.

Two trust domains (ADR-005): the in-repo .repolens.yml may only affect rendering (site, ignore, render, rules, theme, view, agent), while source, output and access are honored only from the external --config file and CLI flags. Precedence: CLI > external config > in-repo config > defaults. Render rules cascade in order, later rules overriding earlier ones. View.TOCPanel accepts "floating" or "inline"; invalid values are reported as warnings and rendered with the floating fallback by site assembly. View.Search is a site-level browser UI switch and does not cascade.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(repoRoot, externalPath string, flags Flags) (*Config, []Warning, error)

Load reads and merges defaults, repo config, external config, and CLI flags.

Types

type Access

type Access struct {
	NoIndex bool    `yaml:"noindex"`
	Encrypt Encrypt `yaml:"encrypt"`
}

Access configures soft protection and reserved encryption settings.

type Agent

type Agent struct {
	LLMSTxt   bool          `yaml:"llms_txt"`
	LLMSFull  AgentFullText `yaml:"llms_full"`
	IndexJSON bool          `yaml:"index_json"`
}

Agent configures machine-readable outputs.

type AgentFullText

type AgentFullText struct {
	Enabled bool  `yaml:"enabled"`
	MaxSize int64 `yaml:"max_size"`
}

AgentFullText configures llms-full.txt.

type CodeOptions

type CodeOptions struct {
	LineNumbers bool   `yaml:"line_numbers"`
	Theme       string `yaml:"theme"`
}

CodeOptions configures code rendering.

type Config

type Config struct {
	Source Source      `yaml:"source"`
	Output Output      `yaml:"output"`
	Access Access      `yaml:"access"`
	Site   Site        `yaml:"site"`
	Ignore []string    `yaml:"ignore"`
	Render FileOptions `yaml:"render"`
	Rules  []Rule      `yaml:"rules"`
	Theme  Theme       `yaml:"theme"`
	View   View        `yaml:"view"`
	Agent  Agent       `yaml:"agent"`
}

Config is the fully merged repolens configuration.

func (*Config) Ignored

func (c *Config) Ignored(filePath string) bool

Ignored reports whether a repo-relative path is excluded from all outputs.

func (*Config) OptionsFor

func (c *Config) OptionsFor(filePath string) FileOptions

OptionsFor returns the effective rendering options for a repo-relative path.

type Encrypt

type Encrypt struct {
	Enabled     bool     `yaml:"enabled"`
	Paths       []string `yaml:"paths"`
	PasswordEnv string   `yaml:"password_env"`
}

Encrypt reserves the v1 client-side encryption schema.

type FileOptions

type FileOptions struct {
	Render      bool            `yaml:"render"`
	Markdown    MarkdownOptions `yaml:"markdown"`
	HTML        HTMLOptions     `yaml:"html"`
	Code        CodeOptions     `yaml:"code"`
	MaxFileSize int64           `yaml:"max_file_size"`
}

FileOptions are the effective rendering options for one file.

type Flags

type Flags struct {
	Repo      string
	Ref       string
	OutputDir string
	BasePath  string
}

Flags contains trusted CLI overrides. Empty string fields mean "not set".

type HTMLOptions

type HTMLOptions struct {
	View string `yaml:"view"`
}

HTMLOptions configures browser pages for HTML files.

type MarkdownOptions

type MarkdownOptions struct {
	TOC              bool `yaml:"toc"`
	TOCMinHeadings   int  `yaml:"toc_min_headings"`
	Anchors          bool `yaml:"anchors"`
	Mermaid          bool `yaml:"mermaid"`
	Math             bool `yaml:"math"`
	FrontmatterTitle bool `yaml:"frontmatter_title"`
}

MarkdownOptions configures Markdown rendering.

type Output

type Output struct {
	Dir      string `yaml:"dir"`
	BasePath string `yaml:"base_path"`
}

Output configures the generated site destination. It is trusted-only.

type Rule

type Rule struct {
	Match       string           `yaml:"match"`
	Render      *bool            `yaml:"render"`
	Markdown    *MarkdownOptions `yaml:"markdown"`
	HTML        *HTMLOptions     `yaml:"html"`
	Code        *CodeOptions     `yaml:"code"`
	MaxFileSize *int64           `yaml:"max_file_size"`
	// contains filtered or unexported fields
}

Rule applies file option overrides to paths matching Match.

Option fields hold only what the rule explicitly sets; unset fields are Go zero values, not effective defaults. Always resolve effective options through Config.OptionsFor rather than reading these fields directly.

type Site

type Site struct {
	Title    string `yaml:"title"`
	Language string `yaml:"language"`
	Home     string `yaml:"home"`
}

Site configures site-level metadata.

type Source

type Source struct {
	Repo string `yaml:"repo"`
	Ref  string `yaml:"ref"`
}

Source configures where content comes from. It is trusted-only.

type Theme

type Theme struct {
	Vars      map[string]string `yaml:"vars"`
	CSS       string            `yaml:"css"`
	Templates string            `yaml:"templates"`
}

Theme configures user-overridable theme inputs.

type View

type View struct {
	TreePosition    string `yaml:"tree_position"`
	TreeExpandDepth int    `yaml:"tree_expand_depth"`
	// TOCPanel controls Markdown TOC placement: "floating" or "inline".
	TOCPanel string `yaml:"toc_panel"`
	// Search controls the browser-layer filename and heading search UI.
	Search bool `yaml:"search"`
}

View configures browser UI layout.

type Warning

type Warning struct {
	Msg string
}

Warning is a recoverable configuration issue reported to the caller.

Jump to

Keyboard shortcuts

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