Help us shape the future of Go! Take the 2026 Go Developer Survey

filesystem

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package filesystem implements cap/filesystem.Service over the local disk (filesystem/local) and host-absolute atomic replace for runtime sidecars that already hold a resolved path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New added in v0.3.33

func New(cfg Config, deps Deps) (capfs.Service, error)

New registers filesystem/local: local-disk cap/filesystem.Service over workspace.Resolve.

func NewSandboxed added in v0.3.48

func NewSandboxed(_ SandboxConfig, deps SandboxDeps) (capfs.Service, error)

NewSandboxed registers filesystem/sandbox: a cap/filesystem.Service decorator that enforces the sandbox/bwrap tenant view in-process (CheckRead/CheckWrite). bwrap only confines shell/ACP subprocesses; model file tools (tool/fs-workspace) run Go code inside the runner, so they go through this decorator to share the same view: neighbor tenants and masked paths are unreadable; only the tenant root and rwBinds are writable (everything else is denied, the in-process equivalent of EROFS).

func TrimRedundantFSRootPrefix added in v0.3.33

func TrimRedundantFSRootPrefix(fsRoot, path string) string

TrimRedundantFSRootPrefix drops a leading fsRoot/ prefix when the fs store root is already fsRoot. Used by filesystem/local when models pass paths like work/upload/foo while config.root is work.

func WriteAtomic added in v0.3.33

func WriteAtomic(path string, data []byte, perm os.FileMode) error

WriteAtomic replaces path with data via a temp file in the same directory.

Types

type Config added in v0.3.33

type Config struct {
	// Root is directory relative to the workspace root; may use global: or local: prefix.
	Root string `json:"root"`
	// Unrestricted disables path confinement to Root (absolute paths and .. are allowed).
	Unrestricted bool `json:"unrestricted,omitempty"`
}

Config is filesystem/local: a workspace-rooted disk store.

func (*Config) SetDefaults added in v0.3.48

func (c *Config) SetDefaults()

SetDefaults implements pluginkit.Defaulter.

type Deps added in v0.3.33

type Deps struct {
	Workspace workspace.Service `json:"workspace"`
}

Deps for filesystem/local.

type IgnoreMatcher

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

IgnoreMatcher applies .gitignore-style patterns relative to a workspace root.

func LoadIgnoreMatcher

func LoadIgnoreMatcher(workspaceRoot string) (*IgnoreMatcher, error)

LoadIgnoreMatcher reads the workspace-root .gitignore when present and always ignores .git, node_modules, and .env.

func (*IgnoreMatcher) Ignored

func (m *IgnoreMatcher) Ignored(relPath string, isDir bool) bool

Ignored reports whether relPath (slash-separated, relative to workspace root) should be skipped during directory walks.

type SandboxConfig added in v0.3.48

type SandboxConfig struct{}

SandboxConfig configures filesystem/sandbox (the view config lives on the sandbox/bwrap instance).

type SandboxDeps added in v0.3.48

type SandboxDeps struct {
	FS      capfs.Service      `json:"fs"`
	Sandbox capsandbox.Service `json:"sandbox"`
}

SandboxDeps for filesystem/sandbox.

Jump to

Keyboard shortcuts

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