config

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 8 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 resolves where the task files live and which settings the process runs under. It is the Go counterpart of lib/tasks/config.rb, ported as far as the read-only surfaces and the probe need it.

Precedence, highest first, exactly as the Ruby module states it:

  1. TASKS_FILE / TASKS_ARCHIVE / TASKS_MEMORY (per-file overrides)
  2. TASKS_DIR (a directory holding tasks.jsonl + archive.jsonl)
  3. the config file at $XDG_CONFIG_HOME/tasks/config
  4. default_dir

Index

Constants

View Source
const (
	DefaultUrgentDays = 3
	DefaultMaxDepth   = 4
	DefaultDateOrder  = "mdy"
	DefaultTheme      = "default"
	DefaultTimeFormat = 12
)

The built-in defaults, spelled where Ruby spells them.

Variables

View Source
var PathKeys = []string{"dir", "file", "archive", "memory"}

PathKeys are the config-file keys whose value is expanded as a path.

View Source
var PromptFactDefaults = map[string]bool{"datetime": true, "hostname": true}

PromptFactDefaults is the registry lib/tasks/prompt_facts.rb owns: the facts an agent's "Current environment" block can carry, and whether each is on when nothing says otherwise. Rendering the block belongs to the agent surface; what config owns is the effective on/off map, because `tasks config` reports it and a `prompt.<name>` line is what changes it.

Functions

func ConfigFile

func ConfigFile(env determinism.Env) string

ConfigFile is $XDG_CONFIG_HOME/tasks/config, with the XDG fallback applied.

func ConfigurationRequiredMessage

func ConfigurationRequiredMessage(paths Paths) string

func ExpandPath

func ExpandPath(path string, env determinism.Env) string

ExpandPath is Ruby's File.expand_path: `~` expansion, then resolution against the process's working directory, then lexical cleaning. It never touches the filesystem, so a missing path expands exactly like a present one.

func ResolvePromptFacts

func ResolvePromptFacts(overrides map[string]bool) map[string]bool

ResolvePromptFacts is PromptFacts.resolve: every REGISTERED fact, with the config file's override where there is one. A name the registry does not know is dropped rather than reported — parseFile keeps it for forward compatibility, but only a fact this binary can render may claim to be on.

func XDGBase

func XDGBase(env determinism.Env, key string, defaults ...string) string

XDGBase resolves an XDG base directory, falling back to ~/<default...> when the variable is unset or empty and expanding either form to an absolute path — a relative XDG value would otherwise resolve against each process's cwd, so two invocations from different directories would disagree about where state lives.

Types

type Paths

type Paths struct {
	Configured              bool
	Org                     string
	Archive                 string
	Memory                  string
	UrgentDays              int
	MaxDepth                int
	Theme                   string
	Colors                  map[string]string
	Mouse                   bool
	Timezone                string
	TimeFormat              int
	TimezoneFallbackWarning bool
	DateOrder               string
	Links                   map[string]string
	LinkSystems             map[string]string
	Hostname                string
	HostContext             string
	HostContextSource       string
	HostContexts            map[string]string
	PromptFacts             map[string]bool
	Sources                 map[string]string
	ConfigFile              string
	// Warnings are the resolution notes a surface should show the user, in the
	// order resolution produced them — today, one per time zone that was
	// configured and could not be loaded. Ruby writes these straight to stderr
	// from inside Config.resolve; a library that printed would be untestable and
	// would decide for every surface, so they are returned instead and the
	// adapter chooses where they go.
	Warnings []string
}

Paths is the resolved answer: every path and setting a surface needs, plus `Sources`, which records WHICH input decided each one. The probe reads Sources["theme"] rather than re-deriving the theme precedence, so a port that got the precedence wrong reports it rather than hides it.

func ForDir

func ForDir(dir string, env determinism.Env) Paths

ForDir pins every path to one directory, ignoring the environment and the config file. It is what a sandbox uses so a test can never reach the user's real task files — the settings are the built-in defaults, and the hostname provider is never called, so nothing about the host leaks into the answer.

func Resolve

func Resolve(defaultDir string, env determinism.Env, hostname func() string) Paths

Resolve answers where the task files live for this process. `hostname` may be nil, in which case it defaults through Determinism so every adapter honours the harness's host pin without each one remembering to.

Jump to

Keyboard shortcuts

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