meta

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package meta manages the .sdd/ metadata directory: discovery, config reading, and path resolution. This is project-level infrastructure, separate from the domain model (pure) and graph finders (query-driven).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverRoot

func DiscoverRoot(startDir string) string

DiscoverRoot walks up from startDir looking for a directory named ".sdd". Returns the repo root (parent of .sdd/) or empty string if not found.

func IsSDDMetaDir

func IsSDDMetaDir(d fs.DirEntry) bool

IsSDDMetaDir returns true if the directory entry is the .sdd metadata directory. Used by graph scanning to skip .sdd/ contents.

func LastFetchPath added in v0.3.0

func LastFetchPath(sddDir string) string

LastFetchPath returns the path to the background-sync last-fetch marker. The file's mtime records the last time sdd attempted git fetch; its presence short-circuits further fetches within the configured cooldown.

func ReadConfig

func ReadConfig(sddDir string) (*model.PerRepoConfig, error)

ReadConfig reads and parses .sdd/config.yaml from the given .sdd directory, then overlays any .sdd/config.local.yaml present. Returns nil config with nil error if neither file exists. The local file is gitignored, parses as the same PerRepoConfig schema, and carries genuinely machine-specific overrides (API keys, endpoints).

func ReadConfigLayers added in v0.15.0

func ReadConfigLayers(sddDir string) (committed, local *model.PerRepoConfig, err error)

ReadConfigLayers returns the two per-repo config layers separately — committed .sdd/config.yaml and machine-local .sdd/config.local.yaml — each nil when its file is absent. The effective-config view needs the layers for per-value provenance; everything else wants ReadConfig's merged result.

func ReadLastFetch added in v0.3.0

func ReadLastFetch(sddDir string) (time.Time, error)

ReadLastFetch returns the mtime of the last-fetch marker, or the zero time if the marker does not exist. A zero result means "never fetched," treat as stale.

func ResolveConfig added in v0.15.0

func ResolveConfig(global model.BaseConfig, sddDir string) (*model.PerRepoConfig, error)

ResolveConfig builds the effective per-repo config from the full overlay: the user-global base settings under the committed .sdd/config.yaml under .sdd/config.local.yaml. CLI flags apply on top at the call site. Returns nil (no config) only when the global base is empty and neither per-repo file exists — with global settings present, a repo without config files still resolves to them.

func ResolveGraphDir

func ResolveGraphDir(repoRoot string, cfg *model.PerRepoConfig) string

ResolveGraphDir returns the absolute graph directory path from a config and the repo root (parent of .sdd/). If cfg is nil or GraphDir is empty, falls back to model.DefaultGraphDir.

func SDDDir

func SDDDir(repoRoot string) string

SDDDir returns the absolute path to .sdd/ given the repo root.

func TmpDir

func TmpDir(sddDir string) string

TmpDir returns the path to .sdd/tmp/ given the .sdd/ directory path.

func TouchLastFetch added in v0.3.0

func TouchLastFetch(sddDir string) error

TouchLastFetch stamps the last-fetch marker with the current time, creating the .sdd/tmp/ directory and the file itself as needed. Called whether the fetch succeeded or failed — the cooldown applies to attempts, not successes, so transient offline periods don't re-fetch per command.

Types

This section is empty.

Jump to

Keyboard shortcuts

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