release

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 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 EndpointEnvSince = "0.5.6"

EndpointEnvSince is the first mash version configured by MASH_ENDPOINT. A release older than this reads MASH_NAME, MASH_OWNER, MASH_GROUP and MASH_URL, and needs MASH_INSECURE_PLAINTEXT; this version and later refuse to start with MASH_INSECURE_PLAINTEXT set (config.SkipEncryptionFrom).

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 MaxDocsWalk = 50

MaxDocsWalk bounds how many commits the gate walks back from a docs-only candidate to a tested commit.

View Source
const MigrationScriptLastVersion = "0.5.9"

MigrationScriptLastVersion is the last release that carries MigrationScriptName.

View Source
const MigrationScriptName = "mash-migrate-0.5.5.sh"

MigrationScriptName is the one-time 0.5.5 configuration migration script that releases up to and including MigrationScriptLastVersion carried as a third script (ADR 0152). From 0.5.10 on it is not a release asset (ADR 0181), and scripts/ no longer holds it; the published releases that carry it are still re-verified, so they are still held to it. Every version up to and including 0.5.9 is held to the third script, also those before 0.5.5, which shipped no scripts at all: the check does not tell them apart.

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 provenance asset (the Sigstore bundle) covering the eight binaries, the two scripts and SHA256SUMS.

View Source
const SetupPluginManifest = "mash-setup/.claude-plugin/plugin.json"

SetupPluginManifest is the path of the skills-only mash-setup plugin's manifest. It carries the release version too.

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. A keyless release (at or above the cutover) carries none: CheckAssets refuses it there.

View Source
const SwitchOnVersion = "0.6.0"

SwitchOnVersion is the switch-on release of the 0.6.0 SDK adoption (REQ-019). 0.6.0 is the SDK move, so it is version 0.6.0. From this version the release gate requires the upgrade-proof receipts (AT-011 and AT-012) and refuses a candidate that has none; below it the receipts are checked only when the maintainer gives them.

View Source
const Toolchain = "go1.27.4"

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

Variables

PluginManifests lists every plugin manifest that must name the release version.

View Source
var Programs = []string{"mash", "mashctl"}

Programs are the commands a release builds, one binary each per target: cmd/<name> becomes <name>-<os>-<arch>.

View Source
var RequiredChecks = []string{"test (linux)", "reproducible"}

RequiredChecks are the check runs ci.yml produces that a candidate must have passed. test (macos) is advisory (ADR 0079): it is produced and visible but not required here. TODO(macos-gate): require it again, with pr-check's needs, when we confirm the macOS runner no longer pauses running jobs.

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

Targets are the four platforms a release builds for, in the order SHA256SUMS lists them (sha256sum's glob order). Each platform carries two binaries, mash and mashctl (see Binaries).

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. It is BuildCmd for the mash program.

func BuildCmd added in v0.5.6

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

BuildCmd is Build for one of the Programs (cmd/<program>). The flags are the same for every program: the version is stamped into internal/endpoint, which both programs link, and a -X for a variable a program lacks is a no-op.

func BuildEnv added in v0.5.9

func BuildEnv(base []string, goos, goarch string) []string

BuildEnv is the environment of a release build for goos/goarch ("" means the host's), for tools that must see what the build sees.

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(version string) []string

CIAssetNames are the assets release.yml makes that the gate cannot rebuild: the two scripts, each binary's SBOM in Binaries order, then the SLSA provenance. They are attached by name and listed in SHA256SUMS; the gate verifies their contents (the scripts are compared with the repository's, `release-check`; the rest by their attestations).

func CheckAssets

func CheckAssets(version string, have map[string]string, hashes map[Binary]string, keyless bool) error

CheckAssets judges a draft release's assets (name -> GitHub's "sha256:<hex>" digest) against our own fresh builds of the candidate: exactly the eight binaries (mash and mashctl for each target), the two scripts, their eight SBOMs, the SLSA provenance and SHA256SUMS, nothing else; each binary's digest is the hash of our build for that target; 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. For a keyless release (at or above the cutover) SHA256SUMS omits the provenance bundle (which stays required to be attached), and a SHA256SUMS.sig is not allowed. An asset whose digest GitHub did not give (empty or absent) is reported as "digest not available" by name, still a refusal, and the empty value is never compared.

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 CheckCIWalk added in v0.5.7

func CheckCIWalk(x string, chain []Commit, runsFor func(sha string) ([]CheckRun, error)) error

CheckCIWalk is CheckCIWalkCited without the citation.

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 CheckManifestVersion added in v0.5.6

func CheckManifestVersion(path string, manifest []byte, version string) error

CheckManifestVersion is CheckPluginVersion for the manifest at path (named in the error).

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 CheckScripts added in v0.5.6

func CheckScripts(version string, have map[string]string, content map[string][]byte) error

CheckScripts holds the release scripts to the repository: each of ScriptNamesFor(version) must be attached with exactly the digest of the bytes the repository holds at the release commit (content, by name; read with `git show <commit>:scripts/<name>`). A script that differs, or that is missing from either side, is named.

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 CheckTrackedFiles added in v0.5.9

func CheckTrackedFiles(root string) ([]string, error)

CheckTrackedFiles lists the files git tracks under root (git ls-files) and returns one message per problem: a file over maxTrackedFileSize that is not in largeFileAllowlist, a file that starts with an executable magic number, or a file with a NUL byte in its first 8 KiB whose extension is not a binary asset. It returns an error when git cannot list root's files (git missing, or root is not a git checkout).

func ExpectedSums

func ExpectedSums(version string, hashes map[Binary]string, ci map[string]string, keyless bool) string

ExpectedSums is the exact SHA256SUMS content for the given per-binary hashes (hex SHA-256 of each binary) and the hex SHA-256 of each CIAssetNames file (ci, by name): the binaries, the two scripts, the SBOMs and the provenance, in that order, as release.yml's draft job lists them. A name missing from ci is left out. A keyless release (at or above the cutover) lists the same names except the provenance bundle: it cannot list itself, as release.yml makes the sums before the job that attests.

func IsDocsPath added in v0.5.7

func IsDocsPath(p string) bool

IsDocsPath reports whether a repository path is documentation: any *.md file, or any path under docs/ except the four data files the release tooling reads. It is scripts/ci-changes' is_docs, ported; docsonly_test.go runs both over the same table so they cannot drift. Everything else is code: the default is code, so a new top-level path is code.

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 RequiresProofs added in v0.5.10

func RequiresProofs(version string) bool

RequiresProofs reports whether the release gate requires the upgrade proofs for version (N.N.N): true when the version is at or above SwitchOnVersion by numeric comparison (0.10.0 is above 0.6.0, 0.5.10 is below). A version that does not parse as N.N.N is not held to it here; the callers refuse such a version earlier.

func ScriptNamesFor added in v0.5.10

func ScriptNamesFor(version string) []string

ScriptNamesFor are the scripts the release of version (N.N.N) carries beside the binaries (ADR 0150), named exactly as the repository's scripts/ files are, in the order SHA256SUMS lists them (after the binaries, before the SBOMs). They are the repository's own files at the release commit, copied unchanged, and are subjects of the provenance attestation like the binaries. They have no SBOM. From 0.5.10 (and for an empty or unparsable version) they are install.sh and mash-local-nats-setup.sh; releases up to and including 0.5.9 carry MigrationScriptName as a third.

func SumsCINames added in v0.4.0

func SumsCINames(version string, keyless bool) []string

SumsCINames are the CIAssetNames that SHA256SUMS lists: all of them, or, for a keyless release, all but the provenance bundle.

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 Binary added in v0.5.6

type Binary struct {
	Program string
	Target
}

Binary is one release binary: a program (one of Programs) built for a target.

func Binaries added in v0.5.6

func Binaries() []Binary

Binaries are the eight binaries a release carries: mash for every target, then mashctl for every target, in the order SHA256SUMS lists them.

func (Binary) AssetName added in v0.5.6

func (b Binary) AssetName() string

AssetName is the release asset's name of the binary: <program>-<os>-<arch>.

func (Binary) SBOMName added in v0.5.6

func (b Binary) SBOMName() string

SBOMName is the CycloneDX SBOM asset of the binary.

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"`
	HTMLURL    string `json:"html_url"`
	App        struct {
		Slug string `json:"slug"`
	} `json:"app"`
}

CheckRun is one GitHub check run on the candidate commit.

func CheckCIWalkCited added in v0.5.10

func CheckCIWalkCited(x string, chain []Commit, runsFor func(sha string) ([]CheckRun, error)) (cited []CheckRun, at string, above int, err error)

CheckCIWalkCited is CheckCI for a candidate that may be docs-only, and names the runs that decided. If x's required checks passed, it is CheckCI. If they were skipped or never ran, x must change only documentation (IsDocsPath), and so must every commit back along main's first parent until one whose required checks ran and succeeded; that commit decides. A docs-only commit therefore can neither break the gate nor stand in for tests: the code it carries is the tested ancestor's code. A code commit without passing checks, a failed or cancelled run, a spoofed run, or no tested ancestor within MaxDocsWalk is refused. chain lists x first, then its first parents, newest first; runsFor reads one commit's check runs.

func CitedRuns added in v0.5.10

func CitedRuns(runs []CheckRun, x string) []CheckRun

CitedRuns is the run the gate accepts for each required check on commit x: the highest-id completed, successful, not-skipped run of the CI app for x. Checks with no such run are omitted. A release record cites these runs.

type Commit added in v0.5.7

type Commit struct {
	SHA   string
	Paths []string
}

Commit is one commit of main's first-parent history with the paths it changed against its first parent.

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) CtlAssetName added in v0.5.6

func (t Target) CtlAssetName() string

CtlAssetName is the release asset's name of mashctl 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 mash 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