Map: core / shell / builtins
core/src/shell/builtins/ are the primitives implemented in Rust that run inside the
shell process. shell/builtins.rs holds the builtin_registry! macro: each entry
binds its facets at once — names, type rule (ty),
doc line, and runtime body (call) — into the CORE_BUILTINS static
(&[BuiltinEntry]), so the facets cannot drift apart. A BuiltinEntry is a
Decl (everything the checker may know: name, Convention, doc,
diagnostic, a boundary flag) plus the body only the runtime runs.
Convention::Value(rule) carries the type rule; Convention::Argv carries
none and fixes [String] → Command through Arm::ty, shared with named
handlers. The handlers_ty map member uses that same constant. Its
constructors set boundary from the body they are handed, so the flag and the
body cannot disagree. Application arity is no facet: Decl::fixed_arity
derives it from a value row’s closed scheme, caching it with the
settle-at-Unit fact in one Spine. Argv rows have no application arity.
What a row does with stdout is in its scheme: a writing row (the encoders, echo, help, explain, clear,
reset, ints-to-bytes) ends in Command, F^w Unit, and there is no
separate output facet. Decl::scheme gives ordinary results fresh grades,
while boundaries retain p and already graded results retain their grade
(grades and capture). Settling at Unit is enforced at the
same door as arity:
Decl::settles_at_unit reads the declared result off that curry spine,
and a row whose scheme says Unit answers unit from call_body
whatever its Rust body computed, so no builtin
can hand a value of another type to a name the checker believes is Unit.
The manifest is authored as two, and
that authoring — not the arity — is the classification: a table entry seeds a
ValClos::builtin in Σ, a base-frame row seeds a base handler frame
(Runtime::install_set in shell/runtime/state/construct.rs;
builtins, exec).
A body is a BuiltinBody — a Static fn(&[ValClos], &Mooring, &mut Shell) -> Settled<ValClos>, or a Captured closure of the same shape for a host frontend
with state to carry — so the run’s mooring arrives beside the shell
(shell-state): it is how a body surfaces an event,
enquires, or starts a nested run parented under the run that called it. The
value convention’s type rule is a BuiltinTypeRule, a scheme factory —
fn(&mut Binders) -> Ty, closed by Binders::close — and nothing else. The streaming reducer
fold-lines is an ordinary one whose factory (scheme::fold_lines) is a
plain scheme (typecheck);
there is no separate reducer arm. Beside it sits an optional diagnostic facet,
which is not a typing rule: it diagnoses a decoder handed an argument
(builtins-registry). A caught record handed to
fail instead earns generic shape guidance from shape_hint in
typecheck/explain.rs: it recognises the closed ErrorRecord::ty() shape by
field labels and types, including site, regardless of row order, and points
to raise $e or $e[message].
An entry’s first-class type
is its scheme, so it has one by construction, every entry in the table
having declared its arguments (fixed-arity).
The public ValClos::builtin wraps an entry as ⟨Val::Builtin(entry),∅⟩.
Force enters BuiltinEntry::eta, a λ-chain ending in CompKind::Builtin
(δ), over the captured entry. β binds supplied arguments; a partial is a boxed
λ residual, not a separate native state. Stack::call invokes an entry
at exactly its arity without entering η. Boundary partials retain their
checked site in inference-expanded Exec blocks
(runtime-values-are-value-closures).
Builtins are shell-scoped: each shell’s session carries a BuiltinTable
(shell-state) seeded from CORE_SETS
(the core rows, the boundaries and the base frames, one list), and a host’s
extra sets ride a HostSurface into HostSurface::shell and shell::boot::boot_shell
(core/src/shell/boot.rs), so the checker’s rule table, the base
scope, and the base frames all come from the manifest the shell was booted with
— there is no process-global registry, and every path that builds or hydrates a
shell must be built over a Runtime that carries them or re-link a native by name.
register clones the baked prelude’s bindings into each fresh environment.
BOUNDARY_BUILTINS (from-json, from-jsonl, from-json-at, from-csv,
env) also sits
outside it, for a different reason: each row is a BuiltinEntry::boundary, whose
body takes the Site the checker solved at the call and lets the value in
through Site::admitted (shell/runtime/admit.rs), which words a mismatch as
the door’s refusal (a-boundary-is-checked-against-its-type).
Every registered boundary declares a data result. This is a manifest-wide invariant, not a property of a hand-written decoder list:
- every type variable in its declared result has
Kind::Data; every row variable there is deep, requiring data in all added fields and payloads. Functions and handles are excluded at every depth; - core’s JSON factories (
scheme::from_json,scheme::from_json_at,scheme::from_jsonlincore/src/typecheck/builtins.rs) also typeenvandfrom-csv. Host factories obey the same rule: exarch’s threeanswer_tyvariables inexarch/src/shell_eval/builtins/harness.rs, and_ed-stateinral/src/repl/plugin/ed_builtins.rs; - acceptance tests walk each host’s whole manifest: core, ral’s REPL and
batch surfaces, and exarch. Every
BuiltinBody::Boundaryentry must have data result variables and deep result row variables, so adding a boundary needs no change to a test’s list; - using a boundary result as a function or handle is a kind error at the use, before decoding or readmission. Ordinary data-shape mismatches remain boundary-admission refusals. See codecs.
Three entries sit outside the macro, implemented in core but installed by a
host. The public WATCH_BUILTIN
(&[BuiltinEntry]) wraps the still-private concurrency::builtin_watch /
scheme::watch — a watched worker’s lines leave as `watch [label, line]
surfaces through the session’s deferred sink (Sink::Watch), which outlives
the run — so only a host with a deferred sink installs it, and elsewhere
watch is an unknown-name diagnostic rather than a runtime refusal
(watch-repl-builtin). The second,
DETACH_BUILTIN (cfg(unix), over concurrency::builtin_detach /
scheme::detach), is a value row of arity three — typed
String → String → [String] → F [pid: Int, desc: String] — and is carried
only where a host installs it, so absence is an unknown-name diagnostic rather
than a veto. It seeds a first-class native; handlers cannot intercept it,
and a value binding stubs it. Its program lookup bypasses bindings and the
whole handler stack as ^program does. Whether a given call may spend it is
the live grant stack’s question
(GrantStack::permits(Flag::Shell(ShellVerb::Detach))). The third, SURFACE_BUILTIN, wraps
misc::builtin_surface / scheme::surface_op under the bare name surface;
exarch declares its own entry over the same body under exarch-surface, with
its own doc, so no host’s name enters core’s vocabulary. builtin_surface is
pub for exactly this — the one core body two hosts each name their own way.
Filesystem query schemas live below the shell: fact/fs.rs declares
DirEntry (list-dir) and FileInfo (file-info) and constructs them purely
from observed metadata. shell/builtins/fs.rs owns the queries; the checker
reads the same records’ Typed declarations.
fs.rs also owns builtin_temp_dir and builtin_temp_file: require_rm
calls shell::exec::command::would_run("rm", …) before writable_temp_dir
or creation. It preserves lookup/admission’s error and denial record, adding
one hint explaining the need for rm; checking launches nothing. The parent
and absent leaf retain the normal write judgments and exclusive creation.
Prefer the prelude’s with-temp-dir / with-temp-file for lexical lifetimes
(a-guard-acquires).
The read and CSV schemes live in typecheck/builtins.rs:
env : ∀α:data. Returns αadmits the effective environment against its site’s record or map shape (ambient.rs); values remain text.from-csv : ∀α:data. Returns [α]parses text cells and admits the rows against the site’s type (codecs.rs). Written field reads use records; computed reads use maps. The row stays a decoder for misuse diagnostics.to-csv : ∀α:data. [α] → Commandaccepts record or map rows, requiring the first row’s keys and scalar cells at runtime. Strings, numbers and booleans render asstrrenders them; other cells name their row index and key.nth : ∀α ν. Integer → [α] → Command[ν] α(collections.rs) refuses a negative Int and then reads throughevaluator::expr::position, the read a written position uses; field reads and map lookups areexpr::fieldandexpr::lookup.
Bodies are grouped by concern, one submodule each:
strings.rs— string and regex primitives, includinglines(String -> [String]), the same split asfrom-linesrun over a string’s bytes rather than the channel, sharingutil::read_lines/lossy_line_list.charsreturns the string’s Unicode scalar values in order, each a one-character string.dedentowns the raw-block framing rule: blank lines around a multiline block fall away before the common margin is stripped, while content-line whitespace is preserved;collections.rs(lengthcounts a list’s elements),predicates.rs(keys,has: ordering and equality areValClos::compare/ValClos::equals, andlt,gt,is-empty,sort-list,identityare prelude one-liners over<,>,lengthandsort-list-by),fs.rs,codecs.rs— the last is also home tobuiltin_echo,to-line’s neighbour by nature: every argument rendered through the totalto-string—ValClos’sDisplay, mapped over the argv — single-space intercalation, a newline to stdout.write_encoded(codecs.rs) writes its bytes to stdout and returnsValClos::UNIT, soto-csv,to-bytes,ints-to-bytes,to-string,to-lines,to-json, andto-jsonlare writers: each typesA → Commandat its own operand type, and its encoded bytes are what it writes.to-bytestakesBytesandints-to-bytestakes[Int]— two names, no union in the table.builtin_from_jsonlreads throughutil::stdin_linesand parses each line alone, so an error names the input’s line. Each JSON direction has one typed refusal, worded by each codec in its own terms:json_to_value’sOutOfRange,value_to_json’sUnrepresentable, whichto-jsonlprefixes with the element’s index;shell.rs—cd. No builtin installs or removes a handler; persistent handlers are host-installed through rc or manifesthandlers:, and scoped frames usewithin [handlers: …];concurrency.rs— thespawnform’s door (spawn_form),watch/detach, the handle verbsawait/poll/is-done/first-settled/race/cancel, and theworkerslisting (builtin_workers), split by concern: the root keeps the verbs of birth,concurrency/birth.rstheBirthdoor (spawn_child) and the one exit rule a gather and a worker’s base share (exit_brood),concurrency/eliminate.rsthe eliminators, observations (builtin_poll,builtin_is_done,builtin_first_settled), and the one cancel-aware sweep (first_ready) underawait,race, a gather’s join andfirst-settled(raceends its losers and drains any already-stoppinghandles throughstop_and_drain,core/src/handle/brood.rs), andconcurrency/tests.rsthe tests; the worker’s deferred surface lives incore/src/handle/surface.rs, its cradle, brood andBroodGuardincore/src/handle/brood.rs(builtins under their bare names;par,bothandfirst-ofare prelude code over them, prelude).spawnandgatherare control operators, not rows: the machine formsspawn’s operands and calls its door, and runsgatheras a frame (Frame::Gather) that settles itsBroodGuardbyexit_broodon return,BroodGuard::endon halt, andBroodGuard::stoponabandon/Drop(evaluator). All but the host-installed two seed throughCORE_BUILTINS; the other two live here too but reach a session viaWATCH_BUILTIN/DETACH_BUILTIN, not core.builtin_detachis the surface discipline alone — the birth itself is the ordinary external-command machinery down to the double-fork inshell/exec/command.rs(runtime), and it yields a{pid, desc}receipt, not aHandle, so none of the eliminators below apply to it. A handle is one private lock over aHandleState:Running,Stopping(cancellation requested whileRunning, worker thread still unwinding), orEnded { ended, result }(worker thread finished), whoseresultcell holds theCompletedHandle { stdout, stderr, end }while unclaimed (ready) and is taken once claimed (consumed). Observers see these as the four-waySample(Running,Stopping,Ready,Consumed).HandleInner::newreturns the handle with its oneCompletionPermit, which the worker thread owns:CompletionPermit::finishdrains the buffers, transitionsRunning→ ready orStopping→ consumed, and sets the endStampbefore callingDeferredSurface::flush(DoneEvent), so a host woken by the deferred batch never observes the handle still non-terminal; aCompletionPermitdropped unfinished — a panic — completes the handle as a panic naming the worker and flushes its deferred surface, sopoll/racesee a finished block rather than spinning. Observers read aSample, paired with the elapsed time in one consistentSnapshot(HandleInner::snapshot,snapshot_ioforpoll’s byte peeks), which also feedsworkers/probe rows, and the transitions arecomplete(viaCompletionPermit::finish),claim_ready(moves aReadyresult out and leavesConsumed, in one step) andclaim_and_stop(Running→Stoppingfiring the worker’s node, orReady→Consumeddiscarding the settled result; idempotent onStoppingandConsumed). So a result is claimed at most once, by construction. The registry lock may take a handle’s lock, never the reverse.awaitis exact:first_readypolls the caller’s cancel scope first, before inspecting any handle (so a pending cancellation is never lost to an already-Readyhandle), thenjoinwaits (claim_first) until it claims the handle’sReadyresult or finds it already claimed (StoppingorConsumed);exactreplays the stdout bytes, then the stderr bytes, into the awaiter’s own sinks and callsEnd::into_settledas the block ended — the value, the failure as it stands, anexitor a stop re-raised, a panic resumed — soawaitof a block is that block run there. A handle inStoppingorConsumedfailsawait_handlewith<verb>: this worker's result was already claimed, an ordinary error, andjoinreturnsNonefor it, which a gather’s return rule skips.raceskipsStoppingandConsumedhandles when choosing a winner, failing asawaitdoes only when no handle isRunningorReady(at entry or mid-wait), claims the firstReadywinner in list order, and then claims, stops and drains every remainingRunningor already-Stoppinghandle within one shared cleanup grace before it returns. An empty list is its own error.cancelcallsclaim_and_stop(Running→Stopping,Ready→Consumed, and a no-op onStoppingorConsumed). The handle carries its block’s grade (Ty::Handle(Grade, Ty), printedHandle (Returns α)/Handle Command), soawaitreturns the grade the block had.pollnever writes and never claims, reporting all four states as data:`running [stdout, stderr, elapsed],`stopping [elapsed](a running worker carries a cumulative, non-destructiveCapturedBytes::peeksnapshot of its output so far, peeked before the handle is observed so the buffers stay intact for the worker’s one-shotCapturedBytes::takeat completion),`ready [stdout, stderr, elapsed, outcome: <ok: α | err: ErrorRecord>](the ok/err half ofEnd::outcome, its`errpayload built throughoutcome_value, as plain record data: the recordtryhands its handler), or`consumed [elapsed]. A worker stopped from elsewhere settles with its owncancelled/timed-outerror; on aReadyhandle anexit, a foreign stop or a panic is re-raised, asawaitre-raises them, whilepollnever fails because a handle isStoppingorConsumed.is-done(builtin_is_done) is the boolean predicate over the same states, returningtrueforReadyorConsumedandfalseforRunningorStoppingwithout raising (delimiters-are-handlers-for-poll, the settle decision, partial-poll-pending-output). Aspawnorwatchworker hangs under its shell’s cradle, not the run’s foreground scope: under the durable session root in a run outside any gather, so a foreground cancel never reaps it, and inside a gather — a worker’s body or agather { … }— under the gather’s entry scope. Aguardshield does not change this cradle: a worker is masked only if its owner is inside the shield, as with agatheropened during acquisition or release, not merely because it was spawned there. It is enrolled in itsBrood(Cradle::owningpaired with a uniqueBroodGuard): when the gather exits it closes membership first (rejecting and cancelling any late birth from a stage thread still unwinding against that cradle), awaits each unclaimed child on return, cancels them on a halt (BroodGuard::end), and on every normal or halting exit waits within one shared grace for every child it accepted to reach a terminal state (ReadyorConsumed) (BroodGuard::drain), socancelof a worker reaches its tree and nothing a gather started outlives it by more than the grace.awaitsharesrace’s cancel-aware wait loop (claim_first, overfirst_ready), so a deadline unwinds the wait while a session worker survives (await-is-the-block-run-here, gather).outliveuses the sameclaim_firstandreplaywhenRun.lastreturns: session workers still unclaimed are claimed in birth order, their bytes written and all five endings dropped. Lifetime joins do not make a loose worker’s failure the run’s. The spawn door isspawn_child, which takes aBirth—SpawnorWatch— and reads the owner off the cradle: with a brood in scope the child is the brood’s (Owner::GatherorOwner::Worker, from itsBroodOwner), enrolled (or cancelled and rejected withthe enclosing gather has ended; the new worker was cancelledif the enclosing gather has already closed), writing to the run’s live sink as a pipeline stage does, unannounced and flushing no`done; with none it is the session’s, its surface deferred. Hosts that announce gate itsdoneon a present unclaimed row at notice time (WorkerState::unclaimed); batch announces none. It mints the worker’sWorkerIdfirst and builds the handle around it:HandleInnercarries theid, thetitle, and the worker’s clock, a birthStampand an endStampthat itsCompletionPermitsets on every exit path of the worker thread before flushing its deferred surface, from which aSnapshotderiveselapsedand the end stamp, in one place. The registry entry adds only theOwner. A birth’stitle— the name every eliminator’s error, the trail, and the completion event use — comes from the birth itself: aspawn’s title (non-empty and one line,legible_title), elseshell.call_site()—block at <script>, line N— which the run’sTitlePolicymay refuse before any birth; a watch’s label. The completion event (DoneEvent) carries the handle’s id, title and elapsed time beside its outcome, including on failure and panic. No policy reaps a running worker: it ends by completing, bycancel, or with its owner, and its handle capability is held only in the bindings that received it at birth (there is noworker <id>lookup builtin). The spawn door also enforces the frame’s admission cap (Mooring::worker_cap): a birth reserves its seat at the door (WorkerRegistry::reserve) — refused whilecapworkers areRunning,Stopping, or reserved, with an error naming the verb the caller actually wrote andawait/cancelas the remedies, the reservation held across thread spawn and released into the registered entry, so a racing sibling birth never sees a filling seat as free;ReadyandConsumedentries hold no seat. AReadyentry’s one bound is retention, armed once at boot (Shell::arm_worker_retention, beside the binding lease): the registry keeps its own clock — onetick_epochper source dispatch — and the engine sweeps at each settled run’s ready boundary (sweep_retention, engine housekeeping), stamping an entry at the first sweep that observes itReadywhile its parent worker (if any) is no longer live (RunningorStopping) and expiring it once its unclaimed result has sat stamped a full retention of ral calls. The expiry records aRetention-causeReapNotice, which the engine pushes at the next settled run’s ready boundary as a`noticesurface event (emit_ready_boundary_notices; exarch decodes it back viaNotice::from_surface). An unarmed registry (the REPL) retainsReadyentries indefinitely; a claimer removes an entry when it transitions toConsumed, so the sweep only catchesReadyresults nobody claimed. A worker runs its thunk on a freshstd::threadviaShell::spawn_worker(shell-state), seeded from the parent’s session;worker_bodytakes the thunk’s(Arc<Comp>, Env)and entersmachine::evaluatedirectly (evaluator), deliberately bypassing theToplevel/Phraseboundary, because the worker’s ownShellis the only one its bindings touch and they die with the thread. The worker carries the parent’s grant stack, so a forced block inside the worker still meets the standard boundary rule and any external child it spawns is confined per-command — aspawnunder agrantcannot escape it. Everyspawn_childalso files the freshly-minted handle onshell.local.workers— a per-shell registry, host-independent and carrying no policy (shell-state). A listing is data.workersmaps everyRunning,Stopping, orReadyentry (Consumedentries are omitted), ids ascending, throughworker_row(shell/runtime/state/host.rs, shared with the`workersprobe) to a seven-field record —id,title,owner(`session,`worker id,`gather),state(`running,`stopping, or`readywithDone = Ending<(), ErrorRecord, CancelCause>),started(Unix seconds),elapsed(seconds, off the handle’sStamps),settled(`someUnix seconds iffstateis`ready, else`none) — derived from a single consistent snapshot per handle (HandleInner::snapshot) without claiming it (WorkerRow::ral_value; the probe’s eighth field,retention-left, is the host’s alone). It holds no handle, so a top-levelworkerscrosses the engine protocol. AHandleis shell-local:Shell::marshalwrites its title, and a child on either seat reads it as a withheld handle of the same title, position and type; all observations refuse it withwithheld-handle. A run whose result is or holds any handle projects toErr, status 1 (core/src/shell/run/report.rs);misc.rs—failtakes aString, raisingReason::raised(aClaimof status 1);raisedecodes any closed[frame, message, status, site]record into a claim (ErrorRecord::claim), keeping its four fields, refusing status 0 (InvalidCause::ZeroStatus) and above 255. There is nodescribebuiltin.exitrefuses outside0..=255. See the error record.builtin_surfaceis the bodySURFACE_BUILTIN(above) wraps: it forwards a tagged variant to the host’s `SurfaceSink` and is the identity under a bare REPL;math.rs— the Float rounding builtins (round,floor,ceil,trunc);help.rs—help(arity-0 language and command index) andexplain <name>lookup, both reflecting on the session — its scope and the shell’s registries, never the caller’s block.LANGUAGE_DOCSgives every parser keyword and Boolean literal a standalone guide; a completeness test pairs that table withCONTROL_OPERATORS,FLOW_KEYWORDS, andLANGUAGE_CONSTANTS, so new syntax cannot land undocumented.LANGUAGE_GUIDESadds reference topics to the same lookup and index, includingredirects.withinowns handler and option restrictions, andreturncovers host configuration records;trydetails the error record’s optional source location. Thegrantguide owns the capability schema and examples of exclusions and computed paths; the agent prompt points here for those details. OneWhereanswers both halves of a resolved command entry: the line naming the frame that would run, and the doc ladder that asks that registry — a session binding owning its name outright rather than inheriting the doc of what it shadows. The shared renderer separates a doc’s conventionalusage — proseopening, heads the entryname · source, and labelsusage,type,path, andshadows; absent facts are omitted.locate_allreturns the whole resolution chain, soexplainalso names what a name shadows, a PATH binary included, which is the questionwhichanswers wrongly for every name ral provides. The command head is judged as a launch would be (Command::lookupunder the live grant stack): a bundled tool readsbundled, a refused headdenied by grantnaming the path as requested;print.rs— the shell’s runtime values (PrintableforVClosRef) as a view onto the one value pretty-printer, which lives beneath the shell indata/print.rs(PrintParams,pretty_print; re-exported here), with the REPL’s numbers inREPL_PRINT_PARAMS.Printable::Childcarries variant payloads as well as list/map children (Cow::Ownedof a borrowed copy for runtime values, references forFOValue). The REPL, exarch’s tool-result rendering and a grant shown to its agent share it; a rendering utility, not a registered builtin. One printer, one policy, per-reader numbers: truncation preserves identity — the depth limit summarises (keys and heads) and only the floor beneath it counts, a string elides unless it is the whole value, and a byte budget is spent inside each container, which closes with…N more. An elision must earn its marker: a string prints whole unless cutting it actually shortens the rendering, so nothing is mutilated to save a character. The two readers differ in window, quote fence, and absorbable bytes — and in whether a nested string is capped at all: the REPL cuts at a terminal row, exarch’sVALUEsection cuts nothing, since a payload’s text is the identity a lateredit-hashmatches. One layout rule belongs to the printer, not to any value: a list of two or more non-empty records sharing one key sequence prints one record per line, eachlabel: valuecell padded to its column’s widest, still pasteable surface syntax (rows); a cell that would break a line, or a list past the depth limit, keeps the ordinary layout. So aworkersresult reads as a table in the REPL and in exarch’sVALUEalike, and no worker-specific code renders anything;util.rs— shared helpers.read_linesis the one line reader (codecs’ line rule), generic over its byte source and leaving each line undecoded, since decoding is each caller’s policy;stdin_linesruns it overstdin_reader, andlossy_line_listdecodes its lines into the[String]thatfrom-linesandlinesreturn.
use is a control operator, not a builtin or boundary. Elaboration calls
shell::load::load_module to read and link one written path under the grant
in force at check time. The checker instantiates its decided public schemes;
shell::load::run_module runs that checked tree under Σ and returns its public
bindings. Modules carry no cache; cycles and depth are refused by a check-time
chain, not runtime shell state. See
cacheless-module-loader.
The capability ValClos-map decoder is not a builtin: it lives at
shell/grant/decode.rs (decode_capability_map), consumed by the grant
control operator (shell/evaluator/machine.rs), the --capabilities ceiling
(shell/load/profile.rs) and spawn grants (shell/grant/spawn.rs) — see capabilities,
grant.
Why a capability lands in one of these layers rather than another — builtin vs.
coreutil vs. prelude vs. control operator — is design: name-resolution;
what a builtin is and the shape of the set is design: builtins;
the from-X/to-X byte↔value typing in codecs.rs is design: codecs.
Bundled coreutils, diffutils, and ripgrep
core/src/uutils.rs — a top-level module, since every consumer is exec-side and
the manifest module holds manifest things only — declares the bundled tools as
three feature-gated families and the predicate and dispatch that unify them.
- coreutils —
declare_coreutils!takes two parallel lists:cross(always on under thecoreutilsfeature) andunix(additionally undercoreutils-unix-only,cfg(unix)-gated). It emits one mergedCOREUTILS_TOOLSslice, acoreutils_invokearm, and the platform-unconditionalCOREUTILS_UNIX_ONLY_TOOLSlist — the one authoritative spelling of theunixnames, so a caller that must know a bundled name does not exist off-Unix (a profile loader dropping dead exec grants) reads this list rather than keeping a second copy. - diffutils —
DIFFUTILS_TOOLS(["cmp", "diff"],diffutilsfeature), whosecmp_main/diff_mainshims faithfully translate the upstreamdiffutilslibentrypoints (re-audit on a version bump). - ripgrep —
RIPGREP_TOOLS(["rg"],ripgrepfeature), routed throughral-ripgrep-core::run_clibyrg_main(which drops the argv[0] slot).
uutils_invoke is the bare dispatch over all three families (diffutils and
ripgrep matched ahead of the coreutils fall-through, each arm feature-gated);
bundled_name returns the static name of a bundled tool. bundleable_tools
lists every tool some build bundles, whatever features this one has: the names
a profile may list outright, each admitting the host binary where this build
does not bundle it. These bundled heads share the
capability chokepoint with every other command — part of why ral is a
single-binary. The grep cargo feature separately
backs the re-* regex string builtins.
A bundled head is a resolved command image, not a builtin in CORE_BUILTINS:
it is always an ordinary ral --ral-bundled-tool <tool> child carrying process
semantics (bundled-tools-as-exec-images,
bundled-tools-always-reexec).
That dispatch — the Program::Tool placement and the hidden
entrypoint — is the runtime’s; this page owns only the
registry of names, shims, and the in-binary uutils_invoke they converge on.
docs/SPEC.md §14.7 covers the single-binary tool surface. The utility
subprocess entrypoint retains its own i32 result clamp in uutils.rs; it is
not part of the shell ending family
(endings).