Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.243.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

App-dir namespacing. The consumer-supplied directory name (e.g. ward ".ward") roots every per-user path; umbra hardcodes no consumer.

Path defaults and per-repo audit derivation, rooted at the consumer's app dir (see appdir.go) so umbra hardcodes no consumer's directory.

Index

Constants

View Source
const AuditSubdir = "audit"

AuditSubdir is the subdirectory under the global dir where per-repo audit logs live. One JSONL file per repo slug.

View Source
const CacheSubdir = "cache"

CacheSubdir is the subdirectory under the app dir holding the ttl caches.

View Source
const FallbackAppDir = ".umbra"

FallbackAppDir is the app dir used when the consumer never calls SetAppDir. It is the framework's own name, so an unconfigured deployment owns nobody.

View Source
const UnrootedAuditName = "_unrooted"

UnrootedAuditName is the slug used when the consumer is invoked outside any git repo (or inside one with no origin remote). All such invocations land in

Variables

View Source
var GitBinary = func() (string, []string, error) {
	path, err := exec.LookPath("git")
	return path, nil, err
}

GitBinary resolves the git the slug lookup runs, plus env entries for it. A generated git replacement skips itself, or the lookup audits itself in a loop.

Functions

func AppDir

func AppDir() string

AppDir returns the value the consumer set, or FallbackAppDir when unset. Always begins with a dot so it lands hidden under $HOME and the repo root.

func BaseName

func BaseName() string

BaseName returns the app dir with leading dots stripped, e.g. ".ward" -> "ward", for the non-hidden cache env var and dispatch queue dir.

func CacheDir

func CacheDir() string

CacheDir resolves the ttl-cache root: the <BASE>_CACHE_DIR env override, else ~/<app-dir>/cache, else $TMPDIR/<app-dir>/cache when $HOME is unset.

func CacheDirEnv

func CacheDirEnv() string

CacheDirEnv derives the cache-dir override env var from the app dir so no consumer name is baked in: ".ward" -> "WARD_CACHE_DIR".

func DefaultAuditPath

func DefaultAuditPath() (string, error)

DefaultAuditPath returns ~/<app-dir>/audit/<slug>.jsonl, slug derived from the origin remote. Called only by the generated main.go, so deadcode misreads it.

func EnvName

func EnvName(suffix string) string

EnvName derives a consumer-scoped env var from the app dir base (".ward" + "_CACHE_DIR" -> "WARD_CACHE_DIR"); unset falls back to the "UMBRA" token.

func GlobalDir

func GlobalDir() (string, error)

GlobalDir returns ~/<app-dir> (e.g. ~/.ward), expanded against $HOME. Returns an error only if $HOME cannot be resolved.

func RepoAuditSlug

func RepoAuditSlug() string

RepoAuditSlug returns the audit slug for the current working directory. Format: "<owner>-<repo>" lowercased and reduced to [a-z0-9-]. Returns

func ResetRepoSlugCacheForTest

func ResetRepoSlugCacheForTest()

ResetRepoSlugCacheForTest clears the cache. Test-only.

func SanitizeSlug

func SanitizeSlug(s string) string

SanitizeSlug normalizes input to lowercase, replaces every non-[a-z0-9-] run with a single dash, and trims leading and trailing dashes. Exported

func SetAppDir

func SetAppDir(name string)

SetAppDir registers the directory name rooting every per-user path. The consumer calls it once at startup - e.g. ward ".ward".

Types

This section is empty.

Jump to

Keyboard shortcuts

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