shim

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package shim generates the PATH-shadowing wrapper scripts for npm, pip, gem and cargo, and extracts the package names an install-like command line would actually install.

Index

Constants

This section is empty.

Variables

View Source
var Tools = []string{"npm", "pip", "pip3", "gem", "cargo"}

Tools is the fixed set of commands installwall shims.

Functions

func BinDir

func BinDir() (string, error)

BinDir returns the directory installwall writes shim scripts into.

func Ecosystem

func Ecosystem(tool string) string

Ecosystem maps a shimmed tool name to the rules.Ecosystem it checks against. Kept here, not in package rules, to avoid an import cycle between shim and the CLI wiring that already imports rules directly.

func FindReal

func FindReal(tool string) (string, error)

FindReal locates the real (non-shim) binary for a tool by searching PATH with the shim directory removed. This is what a shim script's "installwall exec <tool>" call resolves to once a check passes.

func Install

func Install(installwallPath string) (string, error)

Install writes a shim script for every tool in Tools, pointing at the given installwall binary path. It returns the shim directory.

func Uninstall

func Uninstall() error

Uninstall removes every shim script installwall may have written.

Types

type Plan

type Plan struct {
	// Checked is true when this invocation installs new packages and
	// should be checked. False for things like "npm run build" or
	// "npm ci", which install nothing new and pass straight through.
	Checked  bool
	Packages []Spec
}

Plan is the result of parsing one command line for one tool.

func Parse

func Parse(tool string, args []string) Plan

Parse extracts the packages a shimmed command line would install.

type Spec

type Spec struct {
	Name    string
	Version string
}

Spec is one package the command line would install.

Jump to

Keyboard shortcuts

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