subsync

package
v0.0.274 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package subsync materialises a versioned config bundle into a repo byte-for-byte (epic:scoped-sync, order:5). It is pure filesystem mechanism — no HTTP, no git — so the client transport (internal/hosted) and the CLI verbs (satelle sync config deploy/pull) layer on top and stay testable separately.

This is the git-agnostic successor to the removed project-substrate backup (25c79c3): scoped sync walks the area dirs directly rather than git-ls-files, and Restore writes the bytes a deploy pulls back. The byte-exact writer and the safe-path + exclusion guard are the only pieces reused from the old code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExcludedLocal added in v0.0.256

func ExcludedLocal(p string) bool

ExcludedLocal reports whether a server-relative path is one Restore will never write, so a caller can skip it before spending a fetch (sty_0fd04503). Restore remains the enforcement point; this is only an early-out.

Returns false when the path fails cleanRel (absolute, "..", empty, …): those are Restore hard-errors, not skips — pre-filtering them would swallow the escape guard.

Types

type File added in v0.0.153

type File struct {
	Path    string
	Content []byte
}

File is one byte-exact restore target: a server-relative path under the data dir (forward slashes, no leading ".satelle/", e.g. "skills/my-skill.md", "agents.toml", "constitution.md", "tasks/tsk_x.md") and its verbatim bytes.

type Result added in v0.0.255

type Result struct {
	Written int
	// Skipped holds the server-relative paths that excludedLocal refused.
	// Empty when nothing was skipped. Paths are never written to disk.
	Skipped []string
}

Result is Restore's outcome: how many files were written and which excluded (local-only) paths were skipped rather than applied (sty_84f14ace).

func Restore

func Restore(dataDir string, files []File) (Result, error)

Restore writes files under <dataDir>, each byte-for-byte (0o644, parent dirs created), overwriting any existing file at the same path. dataDir is the repo's resolved .satelle data dir (the workspace-config root the server paths are relative to).

Unsafe paths (escape dataDir via cleanRel) still hard-error. Excluded (local-only) paths are SKIPPED and listed in Result.Skipped — never written — so a hostile or corrupt manifest cannot drop a satelle.db over a live one, while a batch that also carries legitimate files (or a partition already poisoned with backups/) can still complete and advance a pull cursor (sty_84f14ace).

Jump to

Keyboard shortcuts

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