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
- Variables
- func AppDir() string
- func BaseName() string
- func CacheDir() string
- func CacheDirEnv() string
- func DefaultAuditPath() (string, error)
- func EnvName(suffix string) string
- func GlobalDir() (string, error)
- func RepoAuditSlug() string
- func ResetRepoSlugCacheForTest()
- func SanitizeSlug(s string) string
- func SetAppDir(name string)
Constants ¶
const AuditSubdir = "audit"
AuditSubdir is the subdirectory under the global dir where per-repo audit logs live. One JSONL file per repo slug.
const CacheSubdir = "cache"
CacheSubdir is the subdirectory under the app dir holding the ttl caches.
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.
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
SanitizeSlug normalizes input to lowercase, replaces every non-[a-z0-9-] run with a single dash, and trims leading and trailing dashes. Exported
Types ¶
This section is empty.