Documentation
¶
Overview ¶
Package layout is the single source of truth for where asset files live inside a file-based vault (git or path), across storage format versions.
Format v1 stores every version under the asset directory:
assets/{name}/list.txt
assets/{name}/{version}/...
Format v2 materializes the latest version directly at the asset directory so the vault is usable in place (point an editor, Obsidian, or .claude/skills at assets/{name}), and keeps the immutable version archive under .sx alongside the audit and usage logs:
assets/{name}/... (latest version, materialized copy)
.sx/versions/{name}/list.txt
.sx/versions/{name}/{version}/... (immutable archive)
The manifest's schema_version selects the layout: 1 → v1, 2 → v2. All methods return vault-root-relative paths; callers join them with the root.
Index ¶
- type Layout
- func (l Layout) AssetDir(name string) string
- func (l Layout) AssetsRoot() string
- func (l Layout) MetadataPath(name, version string) string
- func (l Layout) SourcePathRel(name, version string) string
- func (l Layout) Version() Version
- func (l Layout) VersionDir(name, version string) string
- func (l Layout) VersionListPath(name string) string
- func (l Layout) VersionsDir(name string) string
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
Layout computes storage paths for one vault format version. The zero value is not valid; obtain one via ForVersion or Detect.
func Detect ¶
Detect determines the storage format of the vault rooted at vaultRoot.
The manifest's schema_version is authoritative when sx.toml exists. Vaults without a manifest are classified by directory shape — see manifest.DetectShapeVersion.
func ForVersion ¶
ForVersion returns the layout for a storage format version.
func (Layout) AssetDir ¶
AssetDir is the vault-relative directory for an asset. In v1 it contains version directories and list.txt; in v2 it contains the materialized latest version's files.
func (Layout) AssetsRoot ¶
AssetsRoot is the vault-relative directory containing asset directories.
func (Layout) MetadataPath ¶
MetadataPath is the vault-relative path of a stored version's metadata.toml.
func (Layout) SourcePathRel ¶
SourcePathRel is the slash-separated vault-relative path recorded in manifest and lock source-path entries for a stored version. It always points at the immutable version directory, never the mutable v2 root view, so pinned resolution and caching stay stable across publishes.
func (Layout) VersionDir ¶
VersionDir is the vault-relative directory for one stored version of an asset. In v2 this is the immutable archive copy.
func (Layout) VersionListPath ¶
VersionListPath is the vault-relative path of an asset's list.txt.
func (Layout) VersionsDir ¶
VersionsDir is the vault-relative directory holding an asset's version directories and its list.txt.