Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bun ¶
type Bun struct{}
func (*Bun) ParseInstall ¶
func (b *Bun) ParseInstall(args []string) ([]Pkg, InstallMode, error)
type Cargo ¶
type Cargo struct{}
func (*Cargo) ParseInstall ¶
func (c *Cargo) ParseInstall(args []string) ([]Pkg, InstallMode, error)
type InstallMode ¶
type InstallMode int
InstallMode describes how a package manager resolves packages from a command.
const ( // ModeExplicit means package names/versions were given on the command line. ModeExplicit InstallMode = iota // ModeLockfile means the command installs from a lockfile (npm ci, bun install). // Package names must be read from the lock file — not yet implemented. ModeLockfile // ModePassthrough means the subcommand is not an install (npm run, cargo build). // The shim should exec the real binary immediately with no checks. ModePassthrough )
type Manager ¶
type Manager interface {
// Name returns the canonical name used in CLI output ("npm", "pip", …).
Name() string
// Binaries returns the executable names this manager owns.
// Used to determine which shims to write.
Binaries() []string
// FindReal locates the real binary on PATH, skipping the shims directory.
FindReal(shimsDir string) (string, error)
// ParseInstall inspects the command-line arguments and returns the list of
// packages the user intends to install, plus the install mode.
// It must never return an error for unknown/passthrough subcommands —
// those should return ModePassthrough with a nil package list.
ParseInstall(args []string) ([]Pkg, InstallMode, error)
// ResolveVersion contacts the package registry to find the latest published
// version for a package whose version was not pinned on the command line.
// Returns empty string if resolution fails — the shim should proceed
// without a version check rather than block on a registry error.
ResolveVersion(name string) (string, error)
}
Manager abstracts a single package manager for the shim intercept layer.
type NPM ¶
type NPM struct{}
func (*NPM) ParseInstall ¶
func (n *NPM) ParseInstall(args []string) ([]Pkg, InstallMode, error)
type Pip ¶
type Pip struct{}
func (*Pip) ParseInstall ¶
func (p *Pip) ParseInstall(args []string) ([]Pkg, InstallMode, error)
Click to show internal directories.
Click to hide internal directories.