Documentation
¶
Index ¶
- Constants
- Variables
- func Init(projectRoot, name, version string) error
- func ValidContentHash(value string) bool
- type Config
- type ContentHashError
- type MCPServer
- type Meta
- type NPMTreeEntry
- type PackLock
- func (lock PackLock) MCPServer(name string) (MCPServer, bool)
- func (lock PackLock) PluginCount() int
- func (lock PackLock) Plugins() []Package
- func (lock PackLock) Save(projectRoot string) error
- func (lock PackLock) SkillCount() int
- func (lock PackLock) Skills() []Package
- func (lock PackLock) UnverifiedPackages() []string
- type Package
- type PackageKind
Constants ¶
const ( MCPPinned = "pinned" MCPUnpinnable = "unpinnable" MCPUnpinned = "unpinned" )
const ContentHashPrefix = "sha256-tree-v1:"
ContentHashPrefix names the tree digest algorithm stored in content_hash.
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 ¶
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 ValidContentHash ¶
ValidContentHash reports whether value is a complete sha256-tree-v1 digest.
Types ¶
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 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 LoadFromPath ¶
func LoadUnguarded ¶ added in v0.12.7
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) PluginCount ¶
func (PackLock) SkillCount ¶
func (PackLock) UnverifiedPackages ¶
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 ¶
type PackageKind ¶
type PackageKind string
const ( PackageSkill PackageKind = "skill" PackagePlugin PackageKind = "plugin" )
func (*PackageKind) UnmarshalText ¶
func (kind *PackageKind) UnmarshalText(text []byte) error