workspace

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LockDirName  = ".dagger"
	LockFileName = "lock"
)
View Source
const (
	LockModeDisabled LockMode = "disabled"
	LockModeLive     LockMode = "live"
	LockModePinned   LockMode = "pinned"
	LockModeFrozen   LockMode = "frozen"

	// Backward-compatible aliases for the previous experimental names.
	LockModeAuto   = LockModePinned
	LockModeStrict = LockModeFrozen

	// DefaultLockMode is used when no mode is explicitly set.
	DefaultLockMode = LockModeDisabled
)
View Source
const (
	// ModuleConfigFileName is the module config filename.
	ModuleConfigFileName = "dagger.json"
)

Variables

This section is empty.

Functions

func ExtractConfigDefaults added in v0.21.0

func ExtractConfigDefaults(customizations []*modules.ModuleConfigArgument) map[string]any

ExtractConfigDefaults returns constructor arg defaults from customizations.

Types

type LegacyBlueprint

type LegacyBlueprint struct {
	Name   string
	Source string
	Pin    string
}

LegacyBlueprint represents a blueprint extracted from a legacy dagger.json.

func ParseLegacyBlueprint

func ParseLegacyBlueprint(data []byte) (*LegacyBlueprint, error)

ParseLegacyBlueprint parses a legacy dagger.json and extracts its blueprint. Returns nil if no blueprint is present.

type LegacyToolchain

type LegacyToolchain struct {
	Name           string
	Source         string
	Pin            string
	ConfigDefaults map[string]any
	Customizations []*modules.ModuleConfigArgument
}

LegacyToolchain represents a toolchain extracted from a legacy dagger.json, with constructor arg defaults already resolved from customizations.

func ParseLegacyToolchains

func ParseLegacyToolchains(data []byte) ([]LegacyToolchain, error)

ParseLegacyToolchains parses a legacy dagger.json and extracts its toolchains with their constructor arg defaults. Returns nil if no toolchains are present.

type Lock added in v0.21.0

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

Lock is the workspace lockfile wrapper.

func NewLock added in v0.21.0

func NewLock() *Lock

NewLock returns an empty workspace lock.

func ParseLock added in v0.21.0

func ParseLock(data []byte) (*Lock, error)

ParseLock parses .dagger/lock data.

func (*Lock) Clone added in v0.21.0

func (l *Lock) Clone() (*Lock, error)

Clone returns a deep copy of the lock.

func (*Lock) DeleteLookup added in v0.21.0

func (l *Lock) DeleteLookup(namespace, operation string, inputs []any) bool

DeleteLookup removes a generic lookup tuple entry.

func (*Lock) Entries added in v0.21.0

func (l *Lock) Entries() ([]LookupEntry, error)

Entries returns a deterministic snapshot of all lookup entries.

func (*Lock) GetLookup added in v0.21.0

func (l *Lock) GetLookup(namespace, operation string, inputs []any) (LookupResult, bool, error)

GetLookup retrieves the lock result for a generic lookup tuple.

func (*Lock) GetModuleResolve added in v0.21.0

func (l *Lock) GetModuleResolve(source string) (LookupResult, bool, error)

GetModuleResolve retrieves the lock result for a module source lookup.

func (*Lock) Marshal added in v0.21.0

func (l *Lock) Marshal() ([]byte, error)

Marshal serializes lock entries.

func (*Lock) Merge added in v0.21.0

func (l *Lock) Merge(other *Lock) error

Merge applies all entries from other onto l.

func (*Lock) SetLookup added in v0.21.0

func (l *Lock) SetLookup(namespace, operation string, inputs []any, result LookupResult) error

SetLookup sets the lock result for a generic lookup tuple.

func (*Lock) SetModuleResolve added in v0.21.0

func (l *Lock) SetModuleResolve(source string, result LookupResult) error

SetModuleResolve sets the lock result for a module source lookup.

type LockMode added in v0.21.0

type LockMode string

LockMode controls where lookup results come from for a run.

func ParseLockMode added in v0.21.0

func ParseLockMode(mode string) (LockMode, error)

ParseLockMode validates an explicitly configured lock mode.

func ResolveLockMode added in v0.21.0

func ResolveLockMode(mode string) (LockMode, error)

ResolveLockMode applies the branch default when the mode is unspecified.

type LockPolicy added in v0.21.0

type LockPolicy string

LockPolicy controls update intent for a lock entry.

const (
	PolicyPin   LockPolicy = "pin"
	PolicyFloat LockPolicy = "float"
)

type LookupEntry added in v0.21.0

type LookupEntry struct {
	Namespace string
	Operation string
	Inputs    []any
	Result    LookupResult
}

LookupEntry is a structured lockfile lookup tuple.

type LookupResult added in v0.21.0

type LookupResult struct {
	Value  string     `json:"value"`
	Policy LockPolicy `json:"policy"`
}

LookupResult is the stored lock result for a lookup tuple.

type PathExistsFunc

type PathExistsFunc func(ctx context.Context, path string) (parentDir string, exists bool, err error)

PathExistsFunc checks whether a filesystem path exists. Returns the canonical parent directory and whether the path exists.

type Workspace

type Workspace struct {
	// Root is the outer filesystem boundary (git root, or cwd if no git).
	Root string

	// Path is the workspace location relative to Root (e.g., "apps/frontend" or ".").
	Path string
}

Workspace represents a detected workspace boundary.

func Detect

func Detect(
	ctx context.Context,
	pathExists PathExistsFunc,
	_ func(ctx context.Context, path string) ([]byte, error),
	cwd string,
) (*Workspace, error)

Detect finds the workspace boundary from the given working directory.

Uses a 2-step fallback chain:

  1. FindUp .git → workspace root = directory containing .git
  2. No .git → cwd is workspace root

Jump to

Keyboard shortcuts

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