gleamunison/cli_run

gleamunison run <content-hash> [args...] [--store path] — execute a definition the store already holds. The hash is the identity: there is no name to resolve and no source to paste. publish prints the hash this command takes.

A function is a value: run <hash> 2 3 applies a two-parameter function one argument at a time. Arguments are Erlang terms (integers, floats, true/false/nil, “quoted text”); anything that does not parse as one is passed as raw text, so run <hash> hello reaches a text parameter.

The store comes from GLEAMUNISON_STORE_DIR (or –store), and the evidence gate is on unless GLEAMUNISON_STORE_ALLOW_UNVERIFIED says otherwise.

Values

pub fn branch_scope_note(
  adapter: storage.StorageAdapter,
  branch: option.Option(String),
  ref: identity.DefinitionRef,
) -> Result(option.Option(String), #(Int, String))

The branch-scope decision as data, so the wording is testable: Error when the named branch does not exist, Ok(Some(warning)) when it exists but does not bind this content, Ok(None) when there is nothing to say.

The target itself is content: its hash is the same on every branch, so a branch that exists but does not bind it is legitimate — and worth saying out loud, because the caller may believe --branch selected a version of the target rather than the names around it.

pub fn command(args: List(String)) -> Nil
pub fn preflight_branch(
  adapter: storage.StorageAdapter,
  branch: option.Option(String),
  ref: identity.DefinitionRef,
) -> Result(Nil, #(Int, String))

--branch names the namespace a run resolves dependency names through. An explicit branch that nobody committed must not read as “no bindings”: a typo would select an empty namespace, and a definition needing no name refs would run as though the branch had been applied. The default branch stays optional because a fresh store has no namespace and a self-contained definition still runs.

pub fn run(args: List(String)) -> Result(String, #(Int, String))

The exit-code contract: 1 when the run gate refuses (the request was understood and declined), 2 when the target cannot be resolved (absent from the store, unreadable, or a store that disagrees with its own refs). A script can tell “no such definition” from “you called it wrong”.

✨ Search Document