Skip to main content

CLI reference

heph run​

Build and run targets

Resolves the matched target(s), builds their dependency graph, and runs them — reusing cached results when inputs are unchanged. A single argument is a target address; two arguments are a label followed by a package matcher, selecting every target carrying that label. For richer selection use -e '<expr>' with the query language (see --help).

Examples:

heph run //cmd/server:bin — run a single target

heph run test //... — run every target labelled test

heph run //cmd/server:bin --shell — open a shell in the target sandbox

heph run -e '//cmd/... && label(test)' — run via a query expression

heph run -e '//... && !//vendor/...' --allow-all — run every target, excluding a subtree

A -e selection that takes whole packages needs --allow-all.

heph run <TARGET_ADDRESS>
heph run <LABEL> <PACKAGE_MATCHER>
heph run -e <EXPR>
FlagValueDefaultDescription
<ARG1>TARGET_ADDRESS/LABELTarget address (e.g., //pkg:name) OR Label
<ARG2>PACKAGE_MATCHERPackage matcher (only if first argument is a Label)
-e, --exprEXPRSelect targets with a query expression, e.g. -e '//pkg/... && !//vendor/...'. Supports &&, ||, !, parentheses, and the label()/driver()/tree_output() functions. Mutually exclusive with the positional TARGET arguments
--allow-allAllow a selection of every target of whole packages (-e '//pkg', -e '//pkg/...', a negation, or all <pkg>)
--forceForce execution, ignoring any cached result
--shellADDRESSDrop into an interactive shell in the target's sandbox instead of running it
--cat-outPrint output artifacts to stdout
--list-outPrint output file list to stdout
--copy-outDIRCopy output artifacts into DIR (created if needed). Relative paths resolve against the current directory
--outputNAMERestrict --cat-out/--list-out/--copy-out to these output names (repeatable). When omitted, all of the target's outputs are considered. Under --json, also the set the outputs field lists
--frozenFail if generated output differs from the tree (CI check)
--log-linesN10Number of trailing process-log lines to show in a failing target's diagnostic box. The full log is always saved as the log.txt artifact
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--rawPrint only what the target prints: no TUI, no progress, stderr only for failures
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
<ARGS>ARGSArguments for an entrypoint (entrypoint = True) that declares args = True, after --: appended to its command, verbatim. Everything after -- is the program's, flags included (heph run //t:go -- --version)
Selecting targets:
heph run //pkg:name a single target address
heph run <label> //pkg/... all targets with <label> under //pkg
heph run -e '<expr>' a query expression (see below)

A label is [A-Za-z0-9_-]+ — the positional form takes one bare label, never
an expression. For &&, ||, ! or grouping, use -e.

Query language (-e / --expr):
Patterns:
//pkg package //pkg
//pkg/... every package under //pkg
//pkg:name one target address
./sub, ../x, . relative to the current package
Functions:
label(x) targets carrying label x (e.g. label(go-lint))
tree_output(pkg) targets whose codegen tree writes into pkg
driver(name) targets run by that driver, whole name, case-sensitive
(e.g. driver(auth.credential))
addr(//pkg:name) an explicit target address
package(//pkg) an explicit package
package_prefix(//pkg) every package under //pkg
Any argument may be bare or quoted, with the same meaning: label(ci) is
label("ci"). A quoted argument takes escapes: \\ \" \n \r \t \u{..}
Operators (precedence ! > && > ||, group with parentheses):
a && b both a || b either !a negate
Evaluation follows grouping then left-to-right, bailing as early as possible.

label(), driver() and tree_output() are decided from what providers list
where they can, without resolving each target they rule out. `query` then
resolves each match and prints only targets that exist; `query --candidates`
skips that, which is faster but may print a listed target that does not. Set
HEPH_NO_LISTED_FACTS to 1 to resolve every candidate instead; `heph validate`
checks the listings.

Examples:
heph run -e '//some/... && label(foo)'
heph run -e '//app/... && !label(slow)' --allow-all
heph run -e '//... && !//vendor/...' --allow-all
heph run -e '(//a/... || //b/...) && tree_output(gen)'

`run` refuses an expression that takes whole packages unless --allow-all
is passed: one bounded only by package paths or a negation, like //pkg,
//pkg/... or !label(slow). An address, label(), driver() or tree_output()
joined with && bounds it. `query` never asks for the flag.

heph inspect​

Inspect targets, packages, hashes, and deps

Read-only introspection of the build graph. Subcommands print a target's spec, resolved def, input/output hashes, or dependencies, and list packages or plugin functions. Nothing is executed unless a provider must run a target to answer the query.

Examples:

heph inspect packages //...

heph inspect deps //cmd/server:bin

heph inspect hashin //cmd/server:bin

heph inspect [COMMAND]

heph inspect packages​

List packages matching a matcher

Walks providers to discover packages and prints those matching the given matcher, one per line. With no argument, lists every package in the workspace.

Examples:

heph inspect packages

heph inspect packages //cmd/...

heph inspect packages [OPTIONS] [MATCHER]
FlagValueDefaultDescription
<MATCHER>MATCHERPackage matcher (defaults to all packages)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect labels​

List the unique labels declared across matching targets

Enumerates the targets in the packages matching the given matcher and prints the sorted, deduplicated set of their labels one per line. With no argument, scans the whole workspace.

By default the labels are the ones providers list, read without resolving any target: fast, but a listed target that does not exist can contribute a label. --exact resolves every target and prints the exact set.

Examples:

heph inspect labels

heph inspect labels //cmd/...

heph inspect labels --exact

heph inspect labels [OPTIONS] [MATCHER]
FlagValueDefaultDescription
<MATCHER>MATCHERPackage matcher (defaults to all packages)
--exactExact: only labels of targets that exist, at the cost of resolving every target. Without it, labels come from what providers list — fast, but a label carried only by a listed target that does not resolve (a Go test in a package without tests) is printed too
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect hashin​

Print a target's input hash

Computes and prints the content hash of all the target's declared inputs — the key heph uses to decide a cache hit. Does not run the target.

Example: heph inspect hashin //cmd/server:bin

heph inspect hashin [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRTarget address (e.g. //pkg:name)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect hashout​

Print a target's output hashes

Runs the target (or reads its cached result) and prints the content hash of each output artifact, one per line.

Example: heph inspect hashout //cmd/server:bin

heph inspect hashout [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRTarget address (e.g. //pkg:name)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect outputs​

Print the paths a target actually produces

Runs the target (or reads its cached result) and prints every path in its output artifacts, one per line — the paths as a consumer sees them in its sandbox, after any filtering or relocation.

This is the answer to "why did that file land there?" for a group target using include/exclude/strip_prefix/prefix/rename: compare the group's paths with its deps' to see exactly what the transform did.

Examples:

heph inspect outputs //cmd/server:bin

heph inspect outputs //cmd:dist --json — one object, which also lists support files

heph inspect outputs [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRTarget address (e.g. //pkg:name)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect spec​

Print a target's spec, as supplied by its provider

Prints the raw spec — the unresolved definition a provider returns before a driver parses it — as JSON by default (pretty on a terminal, one line when piped). The shape follows the engine and is not stable.

Example: heph inspect spec //cmd/server:bin

heph inspect spec [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRTarget address (e.g. //pkg:name)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect def​

Print a target's resolved def (inputs, outputs, sandbox)

Parses the target's spec into a def and prints it as JSON by default (pretty on a terminal, one line when piped), including declared inputs, outputs, and sandbox configuration. The shape follows the engine and is not stable. By default transitive deps are applied; pass --no-transitive for the direct def only.

Examples:

heph inspect def //cmd/server:bin

heph inspect def //cmd/server:bin --no-transitive

heph inspect def [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRTarget address (e.g. //pkg:name)
--no-transitiveShow the direct def only, without applying transitive deps
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect deps​

Print a target's input dependencies

Resolves the target's def and prints the ref of each declared input, one per line. Pass -i/--interactive to browse the dependency tree in a TUI.

Examples:

heph inspect deps //cmd/server:bin

heph inspect deps //cmd/server:bin -i

heph inspect deps [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRTarget address (e.g. //pkg:name)
-i, --interactiveExplore the dependency tree in an interactive TUI (requires a terminal)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect revdeps​

Print the targets that depend on a target ("where is this used?")

The reverse of deps: scans the workspace (or --scope packages) and prints every target that declares the given target as a direct input, one per line.

Examples:

heph inspect revdeps //lib:core

heph inspect revdeps //lib:core --scope //cmd/...

heph inspect revdeps [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRTarget whose users to find: a //pkg:name or relative (:name, ./pkg:name) address, or a path to an existing file (sugar for its fs file target)
--scopePACKAGE_MATCHERRestrict the search to packages matching this matcher (e.g. //pkg/...); defaults to the whole workspace
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect path​

Print the chain of targets linking two targets

Prints the shortest chain of hops linking A and B, one target per line. Argument order does not matter: both directions are searched, and the chain is printed from the dependent to the dependency. Hops follow each target's resolved deps, so a dep pulled in by another dep's transitives counts; pass --no-transitive to follow only the directly declared ones. When the two are unconnected, nothing is printed on stdout — the reason is logged instead.

Examples:

heph inspect path //cmd/server:bin //lib:core

heph inspect path //lib:core //cmd/server:bin — same chain

heph inspect path //cmd/server:bin main.go

heph inspect path //cmd/server:bin //lib:core --no-transitive

heph inspect path [OPTIONS] <A> <B>
FlagValueDefaultDescription
<A>AOne end of the chain (e.g. //cmd/server:bin)
<B>BThe other end of the chain (e.g. //lib:core) — order does not matter
--no-transitiveFollow only directly declared deps, without applying transitive deps
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect failure​

Print where a target's last failure was kept (log, failure_out, fixes)

Reads the target's failure slot and prints its directory, then the path of each part the failed run left: log (the full process log), out (its failure_out matches, laid out as in the workspace) and fixes (every file an in_place write-back changed). Nothing is built: this reads what the last failure recorded, and a pass or cache hit since has cleared it.

--json prints {addr, slot, hashin, failed_at, log, out, fixes}, the paths absolute and an absent part null, so a CI step or an agent can find a failed run's traces without knowing the slot's key. hashin (the failed run's input hash) and failed_at (milliseconds since the Unix epoch) are in the JSON only.

With no recorded failure, the text form prints no recorded failure for <addr> on stderr and exits 1; --json prints null and exits 0, so a script tells "no failure" from "the command broke".

Examples:

heph inspect failure //web:e2e

heph inspect failure //web:e2e --json

heph inspect failure [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRTarget address (e.g. //pkg:name)
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect states​

Show the provider_state(...) declared across the package tree

A provider_state(provider="X", …) call in a BUILD file configures provider X for that package and — depending on the provider — its descendants. This prints where those declarations live and what they carry: a //pkg header per package, then one line per state as <provider> <field>=<json> …. Packages declaring nothing are omitted, so empty output means "no state here".

Pass --inherited to see the whole chain a provider is handed for a package — its own declarations plus every ancestor's — each line prefixed with the package that declared it, root first. Which of two declarations wins is the provider's own policy; this only reports what applies.

Examples:

heph inspect states — every declaration in the workspace

heph inspect states //cmd/...

heph inspect states //cmd/server --inherited — what applies there

heph inspect states -p go --json

heph inspect states [OPTIONS] [MATCHER]
FlagValueDefaultDescription
<MATCHER>MATCHERPackage matcher (defaults to all packages)
--inheritedAlso show the states a package inherits from its ancestors
-p, --providerPROVIDEROnly show states addressed to this provider
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph inspect functions​

List plugin-exposed functions (heph.<plugin>.<fn>)

Prints every function registered by a plugin for use in BUILD files, in heph.<plugin>.<function> form, one per line.

Example: heph inspect functions

heph inspect functions [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph query​

Query targets

Prints the address of every target matched by the argument(s), one per line. Accepts the same address / label+matcher forms as run, plus -e '<expr>' for the query language (see --help). Useful for scripting and for previewing what a selection matches before running it.

Examples:

heph query //cmd/server:bin — resolve a single address

heph query test //cmd/... — every target labelled test

heph query -e '//...' — every target in the workspace

heph query -e '//... && !//vendor/...' — select with exclusion

heph query -e '//cmd/... && !label(slow)' — select via a query

heph query <TARGET_ADDRESS>
heph query <LABEL> <PACKAGE_MATCHER>
heph query -e <EXPR>
FlagValueDefaultDescription
<ARG1>TARGET_ADDRESS/LABELTarget address (e.g., //pkg:name) OR Label
<ARG2>PACKAGE_MATCHERPackage matcher (only if first argument is a Label)
-e, --exprEXPRSelect targets with a query expression, e.g. -e '//pkg/... && !//vendor/...'. Supports &&, ||, !, parentheses, and the label()/driver()/tree_output() functions. Mutually exclusive with the positional TARGET arguments
--candidatesPrint the candidates as providers list them, without resolving each one. Faster, but the output may include targets that do not exist
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
Selecting targets:
heph run //pkg:name a single target address
heph run <label> //pkg/... all targets with <label> under //pkg
heph run -e '<expr>' a query expression (see below)

A label is [A-Za-z0-9_-]+ — the positional form takes one bare label, never
an expression. For &&, ||, ! or grouping, use -e.

Query language (-e / --expr):
Patterns:
//pkg package //pkg
//pkg/... every package under //pkg
//pkg:name one target address
./sub, ../x, . relative to the current package
Functions:
label(x) targets carrying label x (e.g. label(go-lint))
tree_output(pkg) targets whose codegen tree writes into pkg
driver(name) targets run by that driver, whole name, case-sensitive
(e.g. driver(auth.credential))
addr(//pkg:name) an explicit target address
package(//pkg) an explicit package
package_prefix(//pkg) every package under //pkg
Any argument may be bare or quoted, with the same meaning: label(ci) is
label("ci"). A quoted argument takes escapes: \\ \" \n \r \t \u{..}
Operators (precedence ! > && > ||, group with parentheses):
a && b both a || b either !a negate
Evaluation follows grouping then left-to-right, bailing as early as possible.

label(), driver() and tree_output() are decided from what providers list
where they can, without resolving each target they rule out. `query` then
resolves each match and prints only targets that exist; `query --candidates`
skips that, which is faster but may print a listed target that does not. Set
HEPH_NO_LISTED_FACTS to 1 to resolve every candidate instead; `heph validate`
checks the listings.

Examples:
heph run -e '//some/... && label(foo)'
heph run -e '//app/... && !label(slow)' --allow-all
heph run -e '//... && !//vendor/...' --allow-all
heph run -e '(//a/... || //b/...) && tree_output(gen)'

`run` refuses an expression that takes whole packages unless --allow-all
is passed: one bounded only by package paths or a negation, like //pkg,
//pkg/... or !label(slow). An address, label(), driver() or tree_output()
joined with && bounds it. `query` never asks for the flag.

heph log​

Print a target's log

The log bytes go to stdout, and one status line saying when the run was and where the log is from goes to stderr, so a pipe sees only the log. By default it shows the latest log heph holds for the address, from the run going on, the failure slot or the cache, without building anything. Exits 0 when it printed a log, whatever the target's outcome, and 1 when there is none or the command failed.

Examples:

heph log //cmd/server:bin — the latest log

heph log -f //cmd/server:bin — follow its run until it ends

heph log -n 20 //cmd/server:bin — the last 20 lines

heph log --current //cmd/server:bin — the log of the run matching its current inputs

heph log [OPTIONS] <ADDR>
FlagValueDefaultDescription
-f, --followFollow the run going on until it ends, or wait for one to start
-n, --linesNPrint only the last N lines
--currentThe log of the run matching the target's current inputs
<ADDR>ADDRTarget address (e.g. //pkg:name)

heph validate​

Validate all targets (link graph + check codegen outputs)

heph validate
heph validate <PACKAGE_MATCHER>
FlagValueDefaultDescription
<MATCHER>PACKAGE_MATCHERPackage matcher (e.g. //pkg/...); omit to validate the whole workspace
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph version​

Prints version

Prints the heph version string and exits.

heph version [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph auth​

Sign in, and see which credentials are available here

A credential is a target (driver = "auth.credential") declaring what identity a build needs and how it may be obtained. This is the preflight over them: which apply in this environment, from which source, and until when.

A build never signs anyone in — it fails with the exact command to run, and heph auth login is where a human runs it.

Examples:

heph auth status — one row per declared credential

heph auth explain //auth:aws — why a chain picked what it picked

heph auth login — run whichever sign-ins have gone stale

heph auth <COMMAND>

heph auth status​

One row per declared credential: is it available here, from where, and until when

The preflight. Exits non-zero unless every row is ok, so a caller can branch without parsing and then parse to learn what to run.

Probes each chain; it does not acquire anything, so it runs no vendor CLI and signs nobody in.

Examples:

heph auth status

heph auth status //auth/... --json

heph auth status [OPTIONS] [PACKAGE_MATCHER]
FlagValueDefaultDescription
<MATCHER>PACKAGE_MATCHERPackage matcher limiting which credentials are listed. Defaults to the whole workspace
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph auth explain​

The whole chain walk: every source, why each was skipped, which won

What to run when status says something is unavailable and the reason is not obvious. Prints the same structure the "no source applies" build failure does, so the diagnostic and the failure can never drift apart.

Example: heph auth explain //auth:aws

heph auth explain [OPTIONS] <TARGET_ADDRESS>
FlagValueDefaultDescription
<ADDR>TARGET_ADDRESSThe credential to explain
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph auth login​

Run the sign-in commands of every source that is stale

Stale is a source the probe skipped, or the chosen source when acquiring from it fails — the probe only checks that its tool is there, so an expired session behind an installed tool shows up here. --force signs in to the chosen source regardless.

Never requires a terminal: it runs the vendor's own command with this process's stdio attached, so a browser flow works interactively and an agent sees the URL and code on its own output.

Examples:

heph auth login — everything that has gone stale

heph auth login //auth:aws — one credential

heph auth login //auth:aws --force — sign in again anyway

heph auth login [OPTIONS] [TARGET_ADDRESS]
FlagValueDefaultDescription
<ADDR>TARGET_ADDRESSCredential to sign in to. Defaults to every one that has gone stale
-f, --forceSign in again even where the current session still works, and forget what heph has cached for the credential — to switch accounts, or when a session is broken in a way heph cannot see
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q

heph auth logout​

Forget every acquired credential, in this process and on disk

Clears <home>/auth. The vendor CLIs' own sessions are untouched — heph does not own those, and signing you out of aws because you asked heph to forget a cache entry would be a surprise.

heph auth logout [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph session​

Watch the heph runs going on in other terminals

Every heph run records what it is doing under ~/.heph/sessions. These commands list those sessions, print one, follow one live, and ask one for its in-flight report. They only read: nothing here cancels, signals or cleans up a session. Their own failures exit 125.

Examples:

heph session list — this workspace's sessions, live first

heph session show 02kf5 — what it is doing and what it is stuck on (an id's last 4–5 characters, or a live session's pid)

heph session attach 02kf5 — follow it; q detaches

heph session <COMMAND>

heph session list​

One line per session, live first

Only this workspace's sessions unless --all. Reads each session's meta.json and status.json, never its event log.

STATE is computed by this viewer:

  • running: live, with a target working. - waiting: live, every open target in a lock or admission wait. - quiet: live, no event for longer than --stall-notice (60s when it is off); not a verdict, a long compile is quiet too. - ok / failed: ended, by its exit code. - lost: the process went away without recording its end. - unknown: a session this heph cannot read.

The other commands take an id's last 4–5 characters, or a live session's pid, in place of the full id. The leading characters are the start time, so sessions started minutes apart share them.

Examples:

heph session list

heph session list --all --json

heph session list [OPTIONS]
FlagValueDefaultDescription
--allEvery workspace's sessions, not only this one's
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph session show​

Print a session's progress once, and what it is stuck on

<id> is a full session id, the pid of a live session, or a unique prefix or suffix of an id. Give the suffix (the last 4–5 characters) or the pid: the leading characters are the start time, so sessions started minutes apart share them.

Examples:

heph session show 02kf5

heph session show 48213 --json

heph session show [OPTIONS] <ID>
FlagValueDefaultDescription
<ID>IDSession id, its last 4–5 characters, or a live session's pid (any unique prefix or suffix of an id works)
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph session attach​

Follow a session live, until it ends or you detach

q (or Ctrl-C) detaches and leaves the session running. Exits with the session's exit code once it ends, 0 on detach, and 125 when heph cannot follow it. A 125 that is the session's own is named on stderr.

Examples:

heph session attach 02kf5

heph session attach 48213

heph session attach <ID>
FlagValueDefaultDescription
<ID>IDSession id, its last 4–5 characters, or a live session's pid (any unique prefix or suffix of an id works)

heph session inflight​

Ask a running session for its in-flight report

The same report SIGQUIT writes, without sending any signal: the session answers through its own directory within 5s, or this exits 125.

Examples:

heph session inflight 02kf5

heph session inflight [OPTIONS] <ID>
FlagValueDefaultDescription
<ID>IDSession id, its last 4–5 characters, or a live session's pid (any unique prefix or suffix of an id works)
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool​

Developer tools

Maintenance and housekeeping subcommands that operate on the workspace or the local cache rather than on individual targets.

heph tool [COMMAND]

heph tool gc​

Garbage collect the local cache

Sweeps the local cache under the heph home (.heph by default, homeDir in config) and removes artifacts no longer reachable from any current target, reclaiming disk space. Resolves every cached target's spec, so providers may run.

Last, it gives the cache database's free pages back to the filesystem. The first run on a cache an older version created rewrites the whole database once: minutes on a large one, during which other heph processes' cache writes wait. It is skipped while the disk lacks room for the copy it makes.

Example: heph tool gc

heph tool gc [OPTIONS]
FlagValueDefaultDescription
--scratch-max-sizeSIZECap the total size of persistent scratch caches, e.g. 50GiB. Least recently used caches are dropped whole until the store fits
--scratch-max-age-daysDAYSDrop scratch caches untouched for longer than this many days
--failure-max-age-daysDAYS7Drop a target's last-failure log (<home>/failures/) older than this many days. 0 drops every failure log. Logs of targets that no longer exist are dropped whatever their age
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool clean​

Remove the selected targets' entries from the local cache

Deletes every locally cached revision of the selected target(s) — all of them, whatever their cache.history budget and whether or not the target still exists. gc is the sweep that reclaims space without being told what; this is the one you point at something.

Targets are selected exactly as for run: an address, a label followed by a package matcher, or -e '<expr>' (see --help). The selection is required — there is no whole-cache default, since this command deletes. A selection that needs no resolution — an address, or all <package matcher> — is answered from the cache alone: no BUILD files are read, so an entry whose target has since been deleted is still cleanable. label(...) resolves the graph.

Examples:

heph tool clean //cmd/server:bin — one target (that exact variant)

heph tool clean all //cmd/... — every cached target under a subtree

heph tool clean test //cmd/... — every target labelled test

heph tool clean all //... — clear the entire local cache

heph tool clean <TARGET_ADDRESS>
heph tool clean <LABEL> <PACKAGE_MATCHER>
heph tool clean -e <EXPR>
FlagValueDefaultDescription
<ARG1>TARGET_ADDRESS/LABELTarget address (e.g., //pkg:name) OR Label
<ARG2>PACKAGE_MATCHERPackage matcher (only if first argument is a Label)
-e, --exprEXPRSelect targets with a query expression, e.g. -e '//pkg/... && !//vendor/...'. Supports &&, ||, !, parentheses, and the label()/driver()/tree_output() functions. Mutually exclusive with the positional TARGET arguments
--scratchAlso delete persistent scratch caches. With an ADDRESS, only that declaration's cache; alone, every one in the workspace
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
Selecting targets:
heph run //pkg:name a single target address
heph run <label> //pkg/... all targets with <label> under //pkg
heph run -e '<expr>' a query expression (see below)

A label is [A-Za-z0-9_-]+ — the positional form takes one bare label, never
an expression. For &&, ||, ! or grouping, use -e.

Query language (-e / --expr):
Patterns:
//pkg package //pkg
//pkg/... every package under //pkg
//pkg:name one target address
./sub, ../x, . relative to the current package
Functions:
label(x) targets carrying label x (e.g. label(go-lint))
tree_output(pkg) targets whose codegen tree writes into pkg
driver(name) targets run by that driver, whole name, case-sensitive
(e.g. driver(auth.credential))
addr(//pkg:name) an explicit target address
package(//pkg) an explicit package
package_prefix(//pkg) every package under //pkg
Any argument may be bare or quoted, with the same meaning: label(ci) is
label("ci"). A quoted argument takes escapes: \\ \" \n \r \t \u{..}
Operators (precedence ! > && > ||, group with parentheses):
a && b both a || b either !a negate
Evaluation follows grouping then left-to-right, bailing as early as possible.

label(), driver() and tree_output() are decided from what providers list
where they can, without resolving each target they rule out. `query` then
resolves each match and prints only targets that exist; `query --candidates`
skips that, which is faster but may print a listed target that does not. Set
HEPH_NO_LISTED_FACTS to 1 to resolve every candidate instead; `heph validate`
checks the listings.

Examples:
heph run -e '//some/... && label(foo)'
heph run -e '//app/... && !label(slow)' --allow-all
heph run -e '//... && !//vendor/...' --allow-all
heph run -e '(//a/... || //b/...) && tree_output(gen)'

`run` refuses an expression that takes whole packages unless --allow-all
is passed: one bounded only by package paths or a negation, like //pkg,
//pkg/... or !label(slow). An address, label(), driver() or tree_output()
joined with && bounds it. `query` never asks for the flag.

heph tool codegen​

Manage generated files and the heph section of the root .gitignore

A codegen = copy target writes files into the source tree; heph records which, so globs never read them as source. These subcommands keep the managed .gitignore section in step with the targets, list what needs a decision, and keep, discard or explain a generated file.

Example: heph tool codegen status

heph tool codegen <COMMAND>

heph tool codegen gitignore​

Rewrite the managed section of the root .gitignore from the targets

Prints one + / - line per pattern with its target, then every recorded file the rewrite releases. With a package matcher, only lines from targets under it change. --check writes nothing and exits 1 when the section is stale.

Example: heph tool codegen gitignore --check

heph tool codegen gitignore [--check] [--json]
heph tool codegen gitignore [--check] [--json] <PACKAGE_MATCHER>
FlagValueDefaultDescription
--checkWrite nothing; exit 1 when the section is stale
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
<MATCHER>PACKAGE_MATCHERPackage matcher (e.g. //pkg/...); only lines from targets under it change. Omit to rewrite the whole section
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
Exit codes:
0 OK
1 findings (--check), or a refused or unknown path
2 error; a usage error (an unknown flag, a missing argument) also exits 2

heph tool codegen status​

List the generated files that need a decision

One line per file, sorted by path, each ending with the command that settles it. --check exits 1 when anything is listed.

Example: heph tool codegen status

heph tool codegen status [OPTIONS]
FlagValueDefaultDescription
--checkExit 1 when anything is listed
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
Exit codes:
0 OK
1 findings (--check), or a refused or unknown path
2 error; a usage error (an unknown flag, a missing argument) also exits 2

heph tool codegen keep​

Make generated files source from now on

Drops their rows and the section lines that covered them, then prints the git add to commit them. A path a current target still declares as a copy output is refused.

Example: heph tool codegen keep p/foo.pb.go

heph tool codegen keep [OPTIONS] <PATH>...
FlagValueDefaultDescription
<PATHS>PATHFiles to make source (cwd-relative, //root-relative or absolute)
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
Exit codes:
0 OK
1 findings (--check), or a refused or unknown path
2 error; a usage error (an unknown flag, a missing argument) also exits 2

heph tool codegen discard​

Delete generated files no target produces any more

Deletes a file only when a fresh hash equals what heph recorded; an edited or imported file needs --force. --all covers every file status lists as no longer generated, and drops dangling rows.

Example: heph tool codegen discard --all --dry-run

heph tool codegen discard [OPTIONS] [PATH]...
FlagValueDefaultDescription
<PATHS>PATHFiles to delete (cwd-relative, //root-relative or absolute)
--allEvery file status lists as no longer generated, and every dangling row
--dry-runPrint what would be deleted and dropped; change nothing
--forceDelete an edited or imported file too
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
Exit codes:
0 OK
1 findings (--check), or a refused or unknown path
2 error; a usage error (an unknown flag, a missing argument) also exits 2

heph tool codegen why​

Explain why a path is, or is not, read as generated

Prints its status and reason, the row recording it, how its bytes were verified, and the section line that matched.

Example: heph tool codegen why p/foo.pb.go

heph tool codegen why [OPTIONS] <PATH>...
FlagValueDefaultDescription
<PATHS>PATHPaths to explain (cwd-relative, //root-relative or absolute)
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
Exit codes:
0 OK
1 findings (--check), or a refused or unknown path
2 error; a usage error (an unknown flag, a missing argument) also exits 2

heph tool codegen import​

Record the files an older heph stamped with its xattr

Run once per checkout after upgrading. A second run records nothing new.

Example: heph tool codegen import

heph tool codegen import [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
Exit codes:
0 OK
1 findings (--check), or a refused or unknown path
2 error; a usage error (an unknown flag, a missing argument) also exits 2

heph tool scratch​

Inspect and reclaim persistent scratch caches

A scratch cache is a directory a target declares and carries between runs to go faster — a compiler cache, a dependency cache. Nothing else bounds their growth, so this is where you look when disk is short, and heph tool gc is what sweeps them on a schedule.

Removing one is always safe: a target's outputs are identical whether its scratch is warm, cold or absent, so it costs time and nothing else.

Example: heph tool scratch ls

heph tool scratch <COMMAND>

heph tool scratch ls​

List persistent scratch cache directories

One row per declared cache, largest first, with the lineages (branches) present and the total size on disk. Reads no BUILD files, so a cache whose declaring target is gone still shows up — and can still be removed.

Example: heph tool scratch ls

heph tool scratch ls [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool scratch head​

Explain which lineage a cache would be restored from

Prints the resolution walk: every candidate lineage in the order it is consulted, what each holds, and which one wins. This is the answer to "why did my branch build start cold?" — a question the local directory alone cannot answer, because the interesting part is what was not found.

Example: heph tool scratch head //build:gocache

heph tool scratch head [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRAddress of the scratch target
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool scratch path​

Print the on-disk path of a scratch cache

For pointing another tool at it, or du-ing it by hand.

Example: heph tool scratch path //build:gocache

heph tool scratch path [OPTIONS] <ADDR>
FlagValueDefaultDescription
<ADDR>ADDRAddress of the scratch target, e.g. //build:gocache
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool scratch push​

Publish scratch caches to the remote

The command CI runs as its last step. Publishing is never a side effect of building: it is expensive, it mutates shared state, and whether a given job's cache state deserves to become the branch's published head is a CI-policy question — one answered far better by an if: condition in a workflow than by a heuristic inside heph.

Writes into the current branch's lineage and never into a fallback, even the one the cache was seeded from. That isolation is what makes this safe to enable on untrusted PR CI at all.

Example: heph tool scratch push --all --producer "$GITHUB_RUN_ID"

heph tool scratch push [OPTIONS] [ADDR]
FlagValueDefaultDescription
<ADDR>ADDRAddress of the scratch target to publish
--allPublish every cache declared remote = True
--forcePublish even when the contents are identical to what is already there
--producerPRODUCER``Free-form producer id recorded with the snapshot, e.g. a CI run id
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool scratch pull​

Fetch scratch caches from the remote without building

Builds do this on their own when a cache is cold, so this is for warming a machine ahead of time, or recovering after a local cache went bad.

Example: heph tool scratch pull --all

heph tool scratch pull [OPTIONS] [ADDR]
FlagValueDefaultDescription
<ADDR>ADDRAddress of the scratch target to fetch
--allFetch every cache declared remote = True
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool scratch rm​

Delete scratch cache directories

The remedy when a cache has gone bad: the next build starts cold and repopulates it. Deleting a scratch is always safe — a target's outputs are identical whether its scratch is warm, cold or absent, so this costs time and nothing else.

Examples:

heph tool scratch rm //build:gocache — one cache

heph tool scratch rm --all — every cache

heph tool scratch rm [OPTIONS] [ADDR]
FlagValueDefaultDescription
<ADDR>ADDRAddress of the scratch target to delete
--allDelete every scratch cache in this workspace
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool cache​

Remote cache maintenance

Subcommands for the shared remote cache(s) configured in .hephconfig2.

Example: heph tool cache measure-latency

heph tool cache <COMMAND>

heph tool cache measure-latency​

Measure and persist remote cache latency ordering

Probes each configured remote cache once and prints its round-trip latency, fastest first. The order is persisted (keyed by the cache definitions) so subsequent builds read caches fastest-first without re-probing; this command forces a fresh measurement.

Example: heph tool cache measure-latency

heph tool cache measure-latency [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool coreutils​

Inspect the POSIX utilities compiled into this binary

The binary carries its own cp, install, sha256sum and friends so a recipe behaves the same on Linux and macOS, and puts them on every target's PATH. These subcommands say what is in the set and what a name resolves to.

Example: heph tool coreutils list

heph tool coreutils <COMMAND>

heph tool coreutils list​

List the utilities compiled into this binary

Prints every applet, the toolbox version that reaches a target's cache key, and where the implementations come from.

Example: heph tool coreutils list

heph tool coreutils list [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool coreutils which​

Explain what a name resolves to

Says whether heph ships this utility and what the host would supply instead — the two candidates a target's PATH chooses between.

Example: heph tool coreutils which cp

heph tool coreutils which [OPTIONS] <NAME>
FlagValueDefaultDescription
<NAME>NAMEUtility name, e.g. cp
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool coreutils run​

Run one builtin utility directly

The same code a target gets, without a sandbox — for checking what a flag does. Its exit code becomes heph's.

Example: heph tool coreutils run cp -r src dst

heph tool coreutils run <NAME> [ARGS]...
FlagValueDefaultDescription
<NAME>NAMEUtility name, e.g. cp
<ARGS>ARGSArguments passed to it verbatim

heph tool completions​

Print a shell completion-registration script

Emits the script that enables dynamic tab-completion of subcommands, flags, and target addresses for the given shell. Source it from your shell rc, e.g. source <(heph tool completions zsh).

Example: heph tool completions bash

heph tool completions <SHELL>
FlagValueDefaultDescription
<SHELL>SHELLShell to emit the completion-registration script for

heph tool config-schema​

Print the JSON Schema of .hephconfig

For editors (map it to .hephconfig in yaml-language-server's yaml.schemas) and for CI. It comes from this binary, so a workspace that pins a version gets that version's schema; outside a workspace it still runs.

Stable: exit 0 and exactly one JSON document (draft 2020-12) on stdout, which validates the config of the binary that printed it; the parser stays the authority. Not stable: key order, $defs names and layout, titles and descriptions. Treat the document as opaque and do not $ref into it. See docs/CONFIG_SCHEMA.md.

Example: heph tool config-schema

heph tool config-schema [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool build-fmt​

Format BUILD files

Reformats the Starlark BUILD files of every package, or only those matching a package matcher. Rewrites in place by default; --check reports unformatted files and exits non-zero without writing. Pass - to format stdin to stdout.

Example: heph tool build-fmt //pkg/...

heph tool build-fmt
heph tool build-fmt <PACKAGE_MATCHER>
heph tool build-fmt -
FlagValueDefaultDescription
<MATCHER>PACKAGE_MATCHERPackage matcher (e.g. //pkg/...); omit to format every package's BUILD file. Pass - to read source from stdin and write the formatted result to stdout
--checkCheck mode: exit non-zero if any file is not formatted; do not write
-D, --dashboardOpen the dashboard from the start, and hold the finished build until q
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)
Every package also has cached targets applying the same rule:
heph run //<pkg>:build-format rewrite the package's BUILD files
heph run format-check //... check every package, as CI does

heph tool resolve-plugins​

Download + verify every configured plugin is loadable

Resolves each plugins: entry: built-ins are instantiated and each path:/url: plugin's cdylib is fetched (to ~/.heph/plugins) and load-checked over the stable ABI. Fails if any plugin can't be loaded.

Example: heph tool resolve-plugins --force

heph tool resolve-plugins [OPTIONS]
FlagValueDefaultDescription
--forceRe-download every plugin even if already cached (clears ~/.heph/plugins/<os>-<arch>/ first)
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool plugins​

List the loaded plugins and their components, by full name

Prints every registered plugin (builtins and the plugins: entries) with where it came from, then each provider, driver, function and exec runner it contributes, under the name a BUILD file uses: a driver as driver = "<plugin>.<local>", a function as heph.<plugin>.<fn>.

Example: heph tool plugins --json

heph tool plugins [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)

heph tool telemetry​

Inspect anonymous usage telemetry

What heph reports, and how to turn it off, is in docs/TELEMETRY.md.

Example: heph tool telemetry status

heph tool telemetry <COMMAND>

heph tool telemetry status​

Show whether telemetry is on, why, and what is waiting to be sent

Reports whether this machine and workspace send anonymous usage telemetry, which switch turned it off (HEPH_DISABLE_TELEMETRY, or telemetry.enabled: false in the config), where the spool of unsent events lives, how many are pending and how old the oldest is, how the last flush went, and when the next one is due. The report itself sends nothing; after it is printed, this command is handled like any other — recorded when telemetry is on, and when it is off, a spool left from before the opt-out is sent once and deleted. --json emits the same as a stable object (see docs/TELEMETRY.md for its keys).

Example: heph tool telemetry status --json

heph tool telemetry status [OPTIONS]
FlagValueDefaultDescription
--jsonPrint the result as JSON on stdout, and nothing else there
--fieldsFIELDSThe JSON fields to print (implies --json)
--jqEXPRFilter the JSON through a jq expression (implies --json)