Internal

internal/core/workspace

Package workspace defines workspace bootstrap and dirty-state snapshot models.

import "github.com/nilstate/scafld/v2/internal/core/workspace"

Package workspace defines workspace bootstrap and dirty-state snapshot models.

Functions

func ChangesByPath(snapshot []string) map[string]Change

Source: internal/core/workspace/snapshot.go:69

ChangesByPath indexes a raw snapshot by changed path.

func Diff(before []string, after []string) []Mutation

Source: internal/core/workspace/snapshot.go:79

Diff returns stable path-level mutations from before to after.

func Filter(snapshot []string, scope []string) []string

Source: internal/core/workspace/snapshot.go:167

Filter returns only snapshot entries under scope. Empty scope keeps all entries.

func MutationStrings(mutations []Mutation) []string

Source: internal/core/workspace/snapshot.go:113

MutationStrings renders mutations in deterministic order.

func NormalizeScope(scope []string) []string

Source: internal/core/workspace/snapshot.go:135

NormalizeScope canonicalizes workspace-relative path prefixes.

func ParseChange(raw string) Change

Source: internal/core/workspace/snapshot.go:46

ParseChange parses the raw line format emitted by workspace adapters.

func PartitionMutations(mutations []Mutation, scope []string) ([]Mutation, []Mutation)

Source: internal/core/workspace/snapshot.go:181

PartitionMutations splits mutations into inside-scope and outside-scope sets.

func PathInScope(path string, scope []string) bool

Source: internal/core/workspace/snapshot.go:156

PathInScope reports whether path is equal to or under one of the scope prefixes.

func Paths(snapshot []string) []string

Source: internal/core/workspace/snapshot.go:122

Paths returns sorted paths from a raw snapshot.

Types

type Change

Source: internal/core/workspace/snapshot.go:10

Change is one fingerprinted workspace path from a source-control adapter.

type Change struct {
	Raw         string
	Status      string
	Fingerprint string
	Path        string
}
Fields
  • Raw string
  • Status string
  • Fingerprint string
  • Path string

func State() string

Source: internal/core/workspace/snapshot.go:38

State returns a compact status+fingerprint value for diagnostics.

type InitResult

Source: internal/core/workspace/model.go:4

InitResult describes the workspace paths created during bootstrap.

type InitResult struct {
	Root    string   `json:"root"`
	Created []string `json:"created"`
	Updated []string `json:"updated"`
	Skipped []string `json:"skipped"`
}
Fields
  • Root string `json:"root"`
  • Created []string `json:"created"`
  • Updated []string `json:"updated"`
  • Skipped []string `json:"skipped"`

func Changed() bool

Source: internal/core/workspace/model.go:19

Changed reports whether bootstrap created or updated any workspace files.

func Merge(created []string, updated []string, skipped []string)

Source: internal/core/workspace/model.go:12

Merge appends another installer result into the workspace bootstrap result.

type Mutation

Source: internal/core/workspace/snapshot.go:18

Mutation describes one path-level difference between two workspace snapshots.

type Mutation struct {
	Kind   string
	Path   string
	Before Change
	After  Change
}
Fields
  • Kind string
  • Path string
  • Before Change
  • After Change

func String() string

Source: internal/core/workspace/snapshot.go:26

String renders a stable, human-readable mutation summary.