contentfiles

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

@index Symlink-safe atomic filesystem access rooted beneath one generated-content directory.

@index Atomic filesystem adapter for built-in Wiki compatibility snapshots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadWikiIndex

func LoadWikiIndex(path string) (*wiki.Index, error)

LoadWikiIndex decodes one persisted built-in Wiki compatibility snapshot. @intent round-trip compatibility fixtures and fallback readers through the outbound file adapter. @sideEffect reads the configured JSON file from disk.

Types

type Root

type Root struct {
	// contains filtered or unexported fields
}

Root provides safe relative access below one generated-content directory. @intent centralize containment, symlink rejection, and atomic replacement for generated docs.

func NewRoot

func NewRoot(dir string) *Root

NewRoot binds safe generated-file operations to one output directory. @intent prevent application policy from handling absolute output paths.

func (*Root) MarkdownFiles

func (r *Root) MarkdownFiles() (map[string]time.Time, error)

MarkdownFiles inventories generated Markdown paths and modification times. @intent provide default-namespace lint fallback when no manifest exists.

func (*Root) ModTime

func (r *Root) ModTime(rel string) (time.Time, bool, error)

ModTime returns generated-file freshness metadata without exposing os.FileInfo. @intent let docs lint compare source and generated timestamps through a narrow port.

func (*Root) Read

func (r *Root) Read(rel string) ([]byte, bool, error)

Read returns a generated file and distinguishes absence from read failure. @intent support manifest and managed-file policy without exposing absolute paths.

func (*Root) Remove

func (r *Root) Remove(rel string) error

Remove deletes one validated stale generated file. @intent prune only the relative generated path selected by application manifest policy. @domainRule missing files are treated as an already-complete prune. @sideEffect removes a file below the configured root.

func (*Root) Validate

func (r *Root) Validate(rel string) error

Validate checks a generated path before a multi-file write begins. @intent fail generation preflight before any output when a path could escape or traverse a symlink.

func (*Root) Write

func (r *Root) Write(rel string, data []byte) error

Write atomically replaces one generated file below the root. @intent persist generated output only after safe-root validation and durable temporary-file completion. @sideEffect creates parent directories and renames a synced temporary file.

type WikiIndexWriter

type WikiIndexWriter struct{ Root string }

WikiIndexWriter maps namespaces to compatibility snapshot paths and atomically replaces JSON. @intent prevent readers from observing partial built-in Wiki index snapshots.

func NewWikiIndexWriter

func NewWikiIndexWriter(root string) *WikiIndexWriter

NewWikiIndexWriter binds Wiki snapshots to the configured state directory. @intent preserve the default .ccg output root while allowing CLI-configured state paths.

func (*WikiIndexWriter) WriteWikiIndex

func (w *WikiIndexWriter) WriteWikiIndex(_ context.Context, namespace string, idx *wiki.Index) error

WriteWikiIndex writes indented JSON through a same-directory temporary file and rename. @intent preserve the versioned built-in Wiki snapshot format at its namespace-specific path. @sideEffect creates the namespace directory and atomically replaces wiki-index.json.

Jump to

Keyboard shortcuts

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