Tools — Hooks
The tools domain is the consumer side of the hooks platform: a tool package declares the callbacks, the domains fire the actions.
A tool package may expose two lifecycle callables in its facade, next to the required main(argv):
| Callable | Called by | Purpose |
|---|---|---|
register_hooks(hooks) |
a domain checkpoint, or goga hooks |
Subscribe hooks to domain actions — hooks.subscribe(domain, action, name, hook); registration is never cached, package edits apply from the next run |
install(user: str \| None = None) |
goga install, after a successful pip |
The post-install lifecycle hook (see Install — CLI, post-install hooks) |
# inside the goga_tool_<tool> package
def register_hooks(hooks):
hooks.subscribe("statuses", "register_statuses", "published", register_published)
The full registration contract — the hook signature (context / self), the error classes, the diagnostics — is the Hooks domain; the declared actions are listed per domain (today: History — Hooks, the nine lifecycle actions of Topics — Hooks — topics/amend_creation, topics/amend_todo_entry, topics/topic_created, topics/topic_published, topics/topic_switched, topics/topic_todo_entered, topics/topic_deleted, topics/topic_updated, topics/topic_propagated, all soft — the eighteen actions of Pipelines — Hooks — pipeline/amend_workflow (hard), pipeline/run_created, pipeline/run_completed, and the fifteen soft bridged mid-run events (the thirteen stage transitions plus run_resumed / run_interrupted) — the five actions of Build — Hooks — build/validate_build (hard), build/build_started, build/pass_started, build/pass_completed, build/build_completed (soft) — and the config amendment of Configuration — Hooks — config/amend_config (hard) — and the two actions of Schema — Hooks — schema/amend_cell and schema/validate_schema (both hard — the cell amendment and the validation gate over the final tree) — and the contract amendment of Contract — Hooks — contract/amend_contract (hard) — and the four run-level moments of Usages — Hooks — usages/sync_started, usages/sync_completed, usages/status_started, usages/status_completed (soft) — and the onboarding pair of Init — Hooks — onboarding/declare_session and onboarding/amend_config (both soft, the goga init -t <tool> participation)). The main entry point and its optional AST injection are covered in CLI.