Documentation
¶
Overview ¶
Package config handles Runefile discovery and settings resolution.
Index ¶
- Constants
- Variables
- func Compatible(f *ast.File) bool
- func Compose(f *ast.File, src diag.SourceProvider) diag.List
- func Discover(startDir string) (string, error)
- func Resolve(fileFlag, startDir string) (string, error)
- func ResolveModPath(base string, m *ast.Mod, src diag.SourceProvider) string
- func RuneVersion(f *ast.File) string
- type MinimumRequirement
- type Settings
Constants ¶
const CurrentVersion = "1"
CurrentVersion is the Runefile semantics version this build implements. Breaking changes are opt-in per file via `set rune_version := "..."`; the default interpretation never changes under a user (FR-033).
const UpgradeURL = "https://github.com/rune-task-runner/rune/releases"
UpgradeURL is where an incompatibility diagnostic points users to obtain a newer Rune binary.
Variables ¶
var ErrNotFound = errors.New("no Runefile found in this directory or any parent")
ErrNotFound is returned when no Runefile can be located by upward discovery.
Functions ¶
func Compatible ¶
Compatible reports whether this build can interpret the file's declared version. An empty pragma (the common case) is always compatible and uses the default interpretation.
func Compose ¶
Compose resolves a file's imports (spliced into the same namespace) and mods (loaded as child namespaces addressable as name::task). It mutates f in place and returns any diagnostics (including reported name collisions, FR-011). Imported and mod files are read through src (spec FR-003): when a document is open in an editor overlay, its unsaved content is used; otherwise src falls back to disk. A nil src (or one that does not resolve a path) falls back to the filesystem, preserving the original disk-only behavior.
func Discover ¶
Discover walks startDir and its ancestors, returning the absolute path of the nearest Runefile / .runefile (case-insensitive). It returns ErrNotFound if none exists up to the filesystem root.
func Resolve ¶
Resolve picks the Runefile to use. If fileFlag is non-empty it is used directly (and must exist); otherwise discovery walks up from startDir.
func ResolveModPath ¶ added in v0.3.0
ResolveModPath resolves a mod declaration to its target file path using the same rules as Compose (explicit path, else <name>.rune / <name>/Runefile / <name>/.runefile), consulting src for open overlays. It returns "" when the mod cannot be resolved. Exposed so the analysis layer can build a complete import graph that includes directory-resolved mods.
func RuneVersion ¶
RuneVersion returns the version pragma declared by a file, or "" if none.
Types ¶
type MinimumRequirement ¶ added in v0.3.0
type MinimumRequirement struct {
Present bool // whether the root file declared minimum_version
Raw string // the raw literal value, e.g. "0.8.0"
Version semver.Version // parsed requirement (valid only when the diags were empty)
Span token.Span // source span of the value literal, for diagnostics
}
MinimumRequirement is the minimum Rune version a root Runefile requires.
func MinimumVersion ¶ added in v0.3.0
func MinimumVersion(f *ast.File) (MinimumRequirement, diag.List)
MinimumVersion extracts and validates the root Runefile's `minimum_version` setting. It MUST be called on the root file BEFORE imports are spliced, so a child/imported file can never impose or relax the requirement (FR-012).
The value must be a static string literal holding a valid single semantic version. A non-literal value or an invalid semantic version is returned as a diagnostic (with the caret on the offending value); in that case the returned requirement's Version is unusable. Absence of the setting yields Present=false and no diagnostics.
func (MinimumRequirement) Satisfied ¶ added in v0.3.0
func (req MinimumRequirement) Satisfied(installed string) (ok, dev bool)
Satisfied reports whether the installed version meets the requirement. A build whose version is not a recognized semantic version — notably a local "dev" build — is treated as a development build (dev=true) that is not blocked, so `go build` binaries keep working against Runefiles that pin a minimum version; integration tests inject a concrete version to exercise real comparisons.
type Settings ¶
type Settings struct {
WorkingDir string // set working-directory := "path"
Quiet bool // set quiet
Export bool // set export (export all variables to the task env)
Fallback bool // set fallback
Dotenv string // set dotenv := ".env"
Shell []string // set shell := ["bash", "-cu"]
Python []string // set python := ["python3"]
Node []string // set node := ["node"]
AgentCmd []string // set agent_cmd := ["claude", "-p"]
Secrets []string // set secrets := ["NAME", ...] — extra names whose values are masked
Unmasked []string // set unmasked := ["NAME", ...] — names exempt from built-in mask patterns
}
Settings holds the resolved module settings that influence execution.