release

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PluginHooks = "plugin/hooks/hooks.json"
	PluginMCP   = "plugin/.mcp.json"
)

PluginHooks and PluginMCP are the paths of the plugin's hook and MCP server definitions, relative to the repository root.

View Source
const CIApp = "github-actions"

CIApp is the GitHub App whose check runs count: Actions. Another integration can write check runs under any name, so a name alone proves nothing: another app's run is ignored unless it carries a required check's name, which is refused as a spoof.

View Source
const HookSince = "0.2.0"

HookSince is the first mash version that has `mash hook`; a release older than this answers it "unknown command", which the plugin's tolerant hook wrapper exists to absorb. It is cmd/mash's pluginMinMash (plugin_hook_test.go).

View Source
const LauncherCommand = "${CLAUDE_PLUGIN_ROOT}/scripts/mash"

LauncherCommand is the MCP command of a plugin that runs mash through its bundled launcher script.

View Source
const PluginManifest = "plugin/.claude-plugin/plugin.json"

PluginManifest is the path of the Claude Code plugin manifest, relative to the repository root.

View Source
const ProvenanceName = "mash.intoto.jsonl"

ProvenanceName is the SLSA Build L3 provenance asset covering the four binaries.

View Source
const ScriptName = "quickstart-synadia.sh"

ScriptName is the quickstart script's release asset name; the asset is the tagged scripts/quickstart-synadia.sh.

View Source
const SumsName = "SHA256SUMS"

SumsName is the checksums asset.

View Source
const SumsNamespace = "mash-release"

SumsNamespace is the ssh-keygen -Y namespace of SHA256SUMS.sig. It is specific to mash, so a signature this key makes for any other purpose cannot be replayed as a mash release signature.

View Source
const SumsSigName = "SHA256SUMS.sig"

SumsSigName is the detached SSH signature of SHA256SUMS (ssh-keygen -Y sign, namespace SumsNamespace). The draft release.yml makes does not carry it: `release-check --assets` adds it. CheckAssets allows it, and the signing step judges it.

View Source
const Toolchain = "go1.27.3"

Toolchain is the Go toolchain every release is built with; go.mod's go directive and the workflows pin the same value.

Variables

View Source
var RequiredChecks = []string{"test (ubuntu-latest)", "test (macos-latest)", "reproducible"}

RequiredChecks are the check runs ci.yml produces that a candidate must have passed.

View Source
var Targets = []Target{
	{"darwin", "amd64"}, {"darwin", "arm64"}, {"linux", "amd64"}, {"linux", "arm64"},
}

Targets are the four binaries a release carries, in the order SHA256SUMS lists them (sha256sum's glob order).

Functions

func AcceptedMCPCommand

func AcceptedMCPCommand(cmd string) bool

AcceptedMCPCommand reports whether an MCP server command is one the gate can check: bare `mash` (the binary on PATH) or the plugin's launcher script.

func Build

func Build(ctx context.Context, srcDir, out, goos, goarch, version, commit string) (string, error)

Build compiles cmd/mash from srcDir into out for goos/goarch ("" means the host's) with the release flags, CGO off and the pinned toolchain, and returns the binary's SHA-256. The same source built in any directory gives the same hash.

func BuildFlags

func BuildFlags(version, commit string) []string

BuildFlags are the release build flags. They carry no build tags.

func CIAssetNames added in v0.3.2

func CIAssetNames() []string

CIAssetNames are the assets release.yml makes that the gate cannot rebuild: each target's SBOM, in target order, then the SLSA provenance. They are attached by name and listed in SHA256SUMS; the gate verifies their contents.

func CheckAssets

func CheckAssets(have map[string]string, hashes map[Target]string, scriptHash string) error

CheckAssets judges a draft release's assets (name -> GitHub's "sha256:<hex>" digest) against our own fresh builds of the candidate: exactly the four binaries, their four SBOMs, the SLSA provenance, the quickstart script and SHA256SUMS, nothing else; each binary's digest is the hash of our build for that target, the script's is scriptHash (the tagged source's); the SBOMs and the provenance must be attached (their contents are verified separately, as they cannot be rebuilt); and SHA256SUMS is exactly the file those hashes and the attached digests produce. It names every problem.

func CheckCI

func CheckCI(runs []CheckRun, x string) error

CheckCI requires every required check run to exist and have succeeded, all for commit x. A run for another commit, or two different results under one run id, means the response is not what was asked for and is refused. When a check ran more than once the latest run (highest id) decides. Only CIApp's runs count: a run from another app is ignored unless it carries a required check's name, which is refused as a spoof.

func CheckHookMatchers

func CheckHookMatchers(hooks []HookCommand) error

CheckHookMatchers refuses hooks whose matchers stop the plugin's hooks from running on what they exist for: PostToolUse must match every tool ("*" or no matcher), UserPromptSubmit takes no matcher, and each must run a `mash hook` command.

func CheckPluginVersion

func CheckPluginVersion(manifest []byte, version string) error

CheckPluginVersion refuses a plugin manifest whose version is not the release version (N.N.N, no leading v). Claude Code updates an installed plugin only when its manifest version changes.

func CheckSource

func CheckSource(srcDir, commit, out string) error

CheckSource refuses a source tree that is not exactly the candidate: HEAD must be the full commit X, the working tree clean, and the output outside the tree. A release binary stamped X must be built from X.

func ExpectedSums

func ExpectedSums(hashes map[Target]string, scriptHash string, ci map[string]string) string

ExpectedSums is the exact SHA256SUMS content for the given per-target hashes (hex SHA-256 of each binary), the quickstart script's hash and the hex SHA-256 of each CIAssetNames file (ci, by name): the binaries, the script, the SBOMs and the provenance, in that order, as release.yml's draft job lists them. A name missing from ci is left out.

func IsLauncherCommand

func IsLauncherCommand(cmd string) bool

IsLauncherCommand reports whether an MCP server command is the plugin's launcher script.

func IsMashHook

func IsMashHook(cmd string) bool

IsMashHook reports whether a hook command runs `mash hook`: directly, or through the plugin's launcher script.

func MCPCommand

func MCPCommand(mcp []byte) (command string, args []string, err error)

MCPCommand is the command and arguments of the plugin's "mash" MCP server.

func MCPServer

func MCPServer(mcp []byte) (command string, args []string, env map[string]string, err error)

MCPServer is MCPCommand and the server's env block too: the plugin launches serve with it (MASH_SPOOL_FROM_START), so a check of serve's behaviour must run it the same way.

func PinnedEnv

func PinnedEnv(base []string) []string

PinnedEnv is the environment for running the project's tests from a candidate checkout: the caller's environment with the same ambient Go configuration removed and the same toolchain pinned as a release build (no GOFLAGS, workspace, go env file, GOEXPERIMENT or arch tuning), so the tests that run are the tests in X.

func PreviousTag

func PreviousTag(tags []string, version string) (string, bool)

PreviousTag is the highest vN.N.N tag strictly below version (N.N.N), ignoring every other tag; false when none.

func TagBelow

func TagBelow(tag, version string) bool

TagBelow reports whether the vN.N.N tag is numerically below version (N.N.N); false when either does not parse.

Types

type CheckRun

type CheckRun struct {
	ID         int64  `json:"id"`
	HeadSHA    string `json:"head_sha"`
	Name       string `json:"name"`
	Status     string `json:"status"`
	Conclusion string `json:"conclusion"`
	App        struct {
		Slug string `json:"slug"`
	} `json:"app"`
}

CheckRun is one GitHub check run on the candidate commit.

type HookCommand

type HookCommand struct{ Event, Matcher, Command string }

HookCommand is one command of the plugin's hooks.json, with the event that runs it and the "matcher" of its hook group (empty when the group has none).

func HookCommands

func HookCommands(hooks []byte) ([]HookCommand, error)

HookCommands lists the commands hooks.json runs, events in name order, commands in file order, each with its group's matcher.

type Target

type Target struct{ GOOS, GOARCH string }

Target is one build target.

func (Target) AssetName

func (t Target) AssetName() string

AssetName is the release asset's name for the target.

func (Target) SBOMName added in v0.3.2

func (t Target) SBOMName() string

SBOMName is the CycloneDX SBOM asset of the target's binary.

type ToolError

type ToolError struct{ Err error }

ToolError is a failure of git itself (not a checkout, a corrupt repository, git missing) as opposed to a finding about the source: the caller could not decide.

func (*ToolError) Error

func (e *ToolError) Error() string

func (*ToolError) Unwrap

func (e *ToolError) Unwrap() error

Jump to

Keyboard shortcuts

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