Documentation
¶
Index ¶
- Constants
- Variables
- func AcceptedMCPCommand(cmd string) bool
- func Build(ctx context.Context, srcDir, out, goos, goarch, version, commit string) (string, error)
- func BuildFlags(version, commit string) []string
- func CIAssetNames() []string
- func CheckAssets(have map[string]string, hashes map[Target]string, scriptHash string) error
- func CheckCI(runs []CheckRun, x string) error
- func CheckHookMatchers(hooks []HookCommand) error
- func CheckPluginVersion(manifest []byte, version string) error
- func CheckSource(srcDir, commit, out string) error
- func ExpectedSums(hashes map[Target]string, scriptHash string, ci map[string]string) string
- func IsLauncherCommand(cmd string) bool
- func IsMashHook(cmd string) bool
- func MCPCommand(mcp []byte) (command string, args []string, err error)
- func MCPServer(mcp []byte) (command string, args []string, env map[string]string, err error)
- func PinnedEnv(base []string) []string
- func PreviousTag(tags []string, version string) (string, bool)
- func TagBelow(tag, version string) bool
- type CheckRun
- type HookCommand
- type Target
- type ToolError
Constants ¶
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.
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.
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).
const LauncherCommand = "${CLAUDE_PLUGIN_ROOT}/scripts/mash"
LauncherCommand is the MCP command of a plugin that runs mash through its bundled launcher script.
const PluginManifest = "plugin/.claude-plugin/plugin.json"
PluginManifest is the path of the Claude Code plugin manifest, relative to the repository root.
const ProvenanceName = "mash.intoto.jsonl"
ProvenanceName is the SLSA Build L3 provenance asset covering the four binaries.
const ScriptName = "quickstart-synadia.sh"
ScriptName is the quickstart script's release asset name; the asset is the tagged scripts/quickstart-synadia.sh.
const SumsName = "SHA256SUMS"
SumsName is the checksums asset.
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.
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.
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 ¶
var RequiredChecks = []string{"test (ubuntu-latest)", "test (macos-latest)", "reproducible"}
RequiredChecks are the check runs ci.yml produces that a candidate must have passed.
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
IsLauncherCommand reports whether an MCP server command is the plugin's launcher script.
func IsMashHook ¶
IsMashHook reports whether a hook command runs `mash hook`: directly, or through the plugin's launcher script.
func MCPCommand ¶
MCPCommand is the command and arguments of the plugin's "mash" MCP server.
func MCPServer ¶
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 ¶
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 ¶
PreviousTag is the highest vN.N.N tag strictly below version (N.N.N), ignoring every other tag; false when none.
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.