projectconfig

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Filename = ".makeslop.yaml"

Filename is the project-local config file name, relative to the project root.

Variables

View Source
var ErrConfigSymlink = errors.New(Filename + " is a symlink — the project config must be a regular file")

ErrConfigSymlink is returned when Filename is a symlink rather than a regular file.

View Source
var Stub = []byte(`exclude:
  scan:
    patterns:
      - "*.env"
      - ".env.*"
      - "*.pem"
      - "*.key"
      - "*.p12"
      - "*.pfx"
      - "*.tfstate"
      - "id_rsa*"
      - "id_ed25519*"
      - ".npmrc"
      - ".netrc"
      - ".git-credentials"
      - ".pypirc"
      - ".htpasswd"
      - "service-account*.json"
      - "kubeconfig"
      - "*.kubeconfig"
    skip-dirs:
      - .git
      - node_modules
      - vendor
      - .venv
  files: []
  dirs: []
cache:
  shared: []
  local: []
  static: []
  # shared: [.claude, .codex]  # shared storage -> container home
  # local: [docs]             # workspace storage -> container project
  # static: ["~/.claude.json:~/.claude.json"]  # existing file or directory
  # Append :ro for read-only or :rw for read-write (default) to any entry.
  # local: [docs:ro]
  # static: ["./tools:/opt/tools:ro"]
  # Relative container paths resolve from the main project's container root.
  # static: ["~/.makeslop/settings.json:./settings.json:ro"]
# Container networking (compose names; makeslop attaches, never creates):
# network_mode: "container:proxy"   # bridge | host | none | container:<name> | <network>
# networks: [myapp_default]         # alternative to network_mode; not both
`)

Stub enables secret masking but leaves all persistent mounts opt-in.

Functions

func Scaffold

func Scaffold(root string) error

Scaffold preserves existing regular configs. Symlinks are rejected because Load and the read-only self-bind require a real file. root must be resolved.

Types

type CacheBind added in v0.5.0

type CacheBind struct {
	Host, Container string
	ReadOnly        bool
}

CacheBind preserves the host and container path spellings until CLI resolution.

type CacheDirectory added in v0.5.0

type CacheDirectory struct {
	Name     string
	ReadOnly bool
}

CacheDirectory declares a managed directory and its container mount mode.

type CacheMounts added in v0.5.0

type CacheMounts struct {
	Shared []CacheDirectory
	Local  []CacheDirectory
	Static []CacheBind
}

CacheMounts declares opt-in persistent directories and existing host binds.

type Config added in v0.3.3

type Config struct {
	// Excludes holds file/dir masks and scan patterns. Excludes.Warnings
	// carries human-readable notices for symlinked entries (dropped with a
	// warning); missing entries and non-symlink wrong-type drops stay silent.
	Excludes Excludes
	// Cache contains only explicitly configured mounts; its zero value mounts nothing.
	Cache CacheMounts
	// Env holds static "KEY=VALUE" pairs and host variable names from
	// environments:; zero Env{} when the block is absent. Load never reads the
	// process environment: callers resolve Env.Host themselves.
	Env Env
	// Network holds network_mode / networks; zero Network{} (Docker default)
	// when both are absent or empty.
	Network Network
}

Config is the parsed, validated result of Load.

func Load

func Load(root string) (Config, error)

Load parses the project config. It rejects symlinks because following one can bypass masking or the read-only bind. root must be absolute and resolved.

func LoadExisting added in v0.4.0

func LoadExisting(root string) (Config, error)

LoadExisting requires the config so removal after validation cannot disable masking.

type Env added in v0.3.1

type Env struct {
	Static []string // "KEY=VALUE" in file order
	Host   []string // sorted, deduped variable names to copy from the host
}

Env is the parsed environments: block.

type Excludes

type Excludes struct {
	// DeclaredPaths retains relative declarations even when stat filtering drops them.
	DeclaredPaths []string
	Files         []string // absolute host paths; /dev/null overlay targets
	Dirs          []string // absolute host paths; tmpfs overlay targets
	Patterns      []string // basename globs for the WalkDir secret scan; deduped and sorted
	SkipDirs      []string // bare directory names pruned during the WalkDir scan; deduped and sorted
	Warnings      []string // human-readable notices about dropped entries (e.g. symlinks); callers should surface these
}

Excludes is the parsed, validated, host-resolved result of Load. Files/Dirs are absolute beneath root; DeclaredPaths retains relative declarations. Each list is deduplicated and sorted.

type Network

type Network struct {
	Mode     string   // "" = Docker default; bridge|host|none|container:<x>|<network>
	Networks []string // file order kept; the first is the primary network
}

Network is the parsed container networking configuration. The zero value means Docker's default (bridge, no --network flag). At most one field is set.

func (Network) ContainerTarget added in v0.3.3

func (n Network) ContainerTarget() (string, bool)

ContainerTarget returns the container name of a container:<name> mode.

func (Network) NeedsInspect added in v0.3.3

func (n Network) NeedsInspect() bool

NeedsInspect reports whether n references a container or network the daemon must be asked about (false for unset and built-in modes).

Jump to

Keyboard shortcuts

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