Skip to main content

Module hooks

Module hooks 

Source
Expand description

The hooks of a project: the [hooks] of speccoder.toml, each hook’s digest, whether a person trusted it, and its recent runs. Gates run in gate; events are projected in events and delivered in deliver. Nothing here runs before a person trusted the exact bytes.

Modules§

deliver
Telling observers what speccoder decided, at least once. Events are read from git (see super::events) past each observer’s cursor, oldest first; the cursor moves only after the observer took one (2xx, or exit 0). Whichever speccoder process runs delivers; a run does it beside its own work and never waits on an observer beyond a short grace at its end.
events
task.ticked and task.stopped, read back from git: a tick commit on a unit’s branch and an attempt saved under refs/speccoder/attempts/…. The same record gives the same event, with the same id, in any process; the projection carries ids, counts and words speccoder wrote, never test names, file contents, model words or tool arguments.
gate
Gates at their point: each runs where the checks run, in the same sandbox, and only a clean exit 0 lets the point through. A gate that is not trusted, cannot run sandboxed, crashes, times out or changes a file the tick would commit blocks — never passes. Its words are for the person; nothing here reaches a model.
report
speccoder hooks: every hook with its trust and recent runs, and the three things a person does with one — trust it, test it, deliver what waits.
trust
Who trusted which hook’s bytes. A record lives in speccoder’s state for the project, never in the checkout; it holds until the definition or a file the hook runs changes. The one before it is kept, so trusting a changed hook shows what changed.

Structs§

Digested
A hook with the digest of what it would run here.
HookDef
One [hooks.<name>] table.
HookFile
A file a hook runs, and its content’s digest.
HookRun
One run of a hook.

Enums§

Point
Where a gate stands.
Role
A gate or an observer.
Runner
What a hook runs.
TrustState
Whether a hook may run.

Constants§

RECENT
How many runs each hook keeps.

Functions§

digest
def’s digest with the files it runs as they are under root.
dir
Where hooks keep their state for the project at root, under speccoder’s state directory state.
gate_tables
The hooks of a configuration’s gate tables, as the judge’s configuration hashes them: an observer’s change does not move the hash.
judge_files
The files every hook of the project at project runs, relative to the worktree wt_root: judge files, which the model may not write.
load
The hooks of the project at root (none without a configuration).
parse
Every [hooks.<name>] of the configuration text, by name.
project_id
The project’s id, as an event’s source names it.
record_run
Adds run to hook’s recent runs, keeping the last RECENT.
runs
Every hook’s recent runs, oldest first.