config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config handles Runefile discovery and settings resolution.

Index

Constants

View Source
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).

View Source
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

View Source
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

func Compatible(f *ast.File) bool

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

func Compose(f *ast.File, src diag.SourceProvider) diag.List

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

func Discover(startDir string) (string, error)

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

func Resolve(fileFlag, startDir string) (string, error)

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

func ResolveModPath(base string, m *ast.Mod, src diag.SourceProvider) string

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

func RuneVersion(f *ast.File) string

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", "-euo", "pipefail"]
	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.

func ResolveSettings

func ResolveSettings(f *ast.File, ev *eval.Evaluator) (Settings, diag.List)

ResolveSettings evaluates a file's settings into a Settings value. String and list settings are evaluated with ev; boolean settings use their bare form.

Jump to

Keyboard shortcuts

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