lockfile

package
v0.14.4-dev.36 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MCPPinned     = "pinned"
	MCPUnpinnable = "unpinnable"
	MCPUnpinned   = "unpinned"
)
View Source
const ContentHashPrefix = "sha256-tree-v1:"

ContentHashPrefix names the tree digest algorithm stored in content_hash.

View Source
const (
	Version uint32 = 4
)

Version is the newest lockfile schema. Version 3 adds package content_hash values and [[mcp_servers]] to version 2; version 4 adds the locked npm dependency tree of an MCP server (tree, tree_digest, bin). A lock is written at the oldest version that holds what it records, so binaries that predate a version keep reading locks that do not need it.

Variables

View Source
var ErrContentHash = errors.New("invalid content hash in lockfile")

ErrContentHash marks a lock whose content_hash key is present but is not a digest this build can check. Such a lock is never regenerated automatically.

Functions

func Init

func Init(projectRoot, name, version string) error

func ValidContentHash

func ValidContentHash(value string) bool

ValidContentHash reports whether value is a complete sha256-tree-v1 digest.

Types

type Config

type Config struct {
	DisabledPlugins []string `toml:"disabled_plugins,omitempty"`
}

type ContentHashError

type ContentHashError struct{ Module, Value, Path string }

ContentHashError is the ErrContentHash for one package.

func (*ContentHashError) Details

func (err *ContentHashError) Details() string

func (*ContentHashError) Error

func (err *ContentHashError) Error() string

func (*ContentHashError) Summary

func (err *ContentHashError) Summary() string

func (*ContentHashError) Unwrap

func (err *ContentHashError) Unwrap() error

type MCPServer

type MCPServer struct {
	Name          string `toml:"name"`
	Source        string `toml:"source"`
	Launcher      string `toml:"launcher"`
	Status        string `toml:"status"`
	Definition    string `toml:"definition"`
	Requested     string `toml:"requested,omitempty"`
	Package       string `toml:"package,omitempty"`
	Version       string `toml:"version,omitempty"`
	Integrity     string `toml:"integrity,omitempty"`
	Registry      string `toml:"registry,omitempty"`
	Host          string `toml:"host,omitempty"`
	Command       string `toml:"command,omitempty"`
	AllowUnpinned bool   `toml:"allow_unpinned,omitempty"`
	Reason        string `toml:"reason,omitempty"`
	// Bin is the package's executable that npx would run, relative to the
	// package directory. TreeDigest and Tree lock every package npm installs
	// for the server, so its dependencies cannot change between launches.
	Bin        string         `toml:"bin,omitempty"`
	TreeDigest string         `toml:"tree_digest,omitempty"`
	Tree       []NPMTreeEntry `toml:"tree,omitempty"`
}

MCPServer records what one merged MCP server definition runs. Environment values and arguments are never stored; Definition is a digest of them.

type Meta

type Meta struct {
	Name    string `toml:"name"`
	Version string `toml:"version"`
}

type NPMTreeEntry added in v0.7.0

type NPMTreeEntry struct {
	Path      string   `toml:"path"`
	Version   string   `toml:"version"`
	Integrity string   `toml:"integrity"`
	Resolved  string   `toml:"resolved,omitempty"`
	Optional  bool     `toml:"optional,omitempty"`
	OS        []string `toml:"os,omitempty"`
	CPU       []string `toml:"cpu,omitempty"`
}

NPMTreeEntry is one installed package of a locked npm tree: where npm puts it (node_modules/...), the exact version and the registry tarball integrity. OS and CPU hold npm's platform constraints of optional packages.

type PackLock

type PackLock struct {
	LockfileVersion uint32      `toml:"lockfile_version"`
	Meta            Meta        `toml:"meta"`
	Config          Config      `toml:"config,omitempty"`
	Packages        []Package   `toml:"packages,omitempty"`
	MCPServers      []MCPServer `toml:"mcp_servers,omitempty"`
}

func EmptyForProject

func EmptyForProject(projectRoot string) PackLock

func Load

func Load(projectRoot string) (PackLock, error)

func LoadFromPath

func LoadFromPath(path string) (PackLock, error)

func LoadUnguarded added in v0.12.7

func LoadUnguarded(path string) (PackLock, error)

LoadUnguarded reads a lock only the caller can reach. It leaves no guard directory behind, which LoadFromPath does for every project path it sees.

func (PackLock) MCPServer

func (lock PackLock) MCPServer(name string) (MCPServer, bool)

func (PackLock) PluginCount

func (lock PackLock) PluginCount() int

func (PackLock) Plugins

func (lock PackLock) Plugins() []Package

func (PackLock) Save

func (lock PackLock) Save(projectRoot string) error

func (PackLock) SkillCount

func (lock PackLock) SkillCount() int

func (PackLock) Skills

func (lock PackLock) Skills() []Package

func (PackLock) UnverifiedPackages

func (lock PackLock) UnverifiedPackages() []string

UnverifiedPackages lists modules whose lock entry has no content hash.

type Package

type Package struct {
	Module   string      `toml:"module"`
	Direct   bool        `toml:"direct,omitempty"`
	Kind     PackageKind `toml:"kind"`
	URL      string      `toml:"url"`
	Owner    string      `toml:"owner"`
	Repo     string      `toml:"repo"`
	Path     string      `toml:"path,omitempty"`
	Commit   string      `toml:"commit"`
	CacheKey string      `toml:"cache_key"`
	// ContentHash is the tree digest of the cached package. Empty means the
	// lock predates content hashes and the package is not verified.
	ContentHash string `toml:"content_hash,omitempty"`
	Name        string `toml:"name,omitempty"`
}

func (Package) NeedsBackfill

func (pkg Package) NeedsBackfill() bool

type PackageKind

type PackageKind string
const (
	PackageSkill  PackageKind = "skill"
	PackagePlugin PackageKind = "plugin"
)

func (*PackageKind) UnmarshalText

func (kind *PackageKind) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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