# internal/core/workspace

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

## ChangesByPath

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

ChangesByPath indexes a raw snapshot by changed path.

## Diff

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

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

## EvidenceRoots

```go
func EvidenceRoots(root string, additional []string) []string
```

EvidenceRoots returns absolute roots under which workspace evidence may be read or cited. The primary scafld root is always first.

## Filter

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

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

## FilterIntersections

```go
func FilterIntersections(snapshot []string, scope []string) []string
```

FilterIntersections returns snapshot entries that can affect scope, including an ancestor entry such as a parent repository's gitlink.

## InsideAnyRoot

```go
func InsideAnyRoot(path string, roots []string) bool
```

InsideAnyRoot reports whether path is equal to or under any root.

## InsideRoot

```go
func InsideRoot(path string, root string) bool
```

InsideRoot reports whether path is equal to or under root.

## MutationStrings

```go
func MutationStrings(mutations []Mutation) []string
```

MutationStrings renders mutations in deterministic order.

## NormalizeScope

```go
func NormalizeScope(scope []string) []string
```

NormalizeScope canonicalizes workspace-relative path prefixes.

## ParseChange

```go
func ParseChange(raw string) Change
```

ParseChange parses the raw line format emitted by workspace adapters.

## PartitionMutations

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

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

## PathInScope

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

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

## PathIntersectsScope

```go
func PathIntersectsScope(path string, scope []string) bool
```

PathIntersectsScope reports whether a changed path is inside scope or is an ancestor whose replacement or repository state affects a scoped descendant.

## Paths

```go
func Paths(snapshot []string) []string
```

Paths returns sorted paths from a raw snapshot.

## Change

```go
type Change struct {
	Raw         string
	Status      string
	Fingerprint string
	Path        string
}
```

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

- `Raw: string`: 
- `Status: string`: 
- `Fingerprint: string`: 
- `Path: string`: 

## State

```go
func (c Change) State() string
```

State returns a compact status+fingerprint value for diagnostics.

## InitResult

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

InitResult describes the workspace paths created during bootstrap.

- `Root: string` (json:"root"): 
- `Created: []string` (json:"created"): 
- `Updated: []string` (json:"updated"): 
- `Skipped: []string` (json:"skipped"): 

## Changed

```go
func (r InitResult) Changed() bool
```

Changed reports whether bootstrap created or updated any workspace files.

## Merge

```go
func (r *InitResult) Merge(created []string, updated []string, skipped []string)
```

Merge appends another installer result into the workspace bootstrap result.

## Mutation

```go
type Mutation struct {
	Kind   string
	Path   string
	Before Change
	After  Change
}
```

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

- `Kind: string`: 
- `Path: string`: 
- `Before: Change`: 
- `After: Change`: 

## String

```go
func (m Mutation) String() string
```

String renders a stable, human-readable mutation summary.
