Skip to main content

Module context

Module context 

Source
Expand description

Per-invocation context for haz subcommands.

Every commands/*/execute function opens with the same sequence: load the discovered workspace + validated graph, locate the bearing project from cwd, and (for cache-touching commands) construct a cache handle keyed by the workspace’s configured hash function (CFG-027).

Context centralises that sequence. A single Context::open call replaces the per-command preamble; per-command code then reaches the workspace, graph, bearing project, filesystem, and cache handles through stable accessors. Adding a new subcommand no longer requires reading an existing command to crib the preamble shape.

The cache hash algorithm flows from workspace.settings.cache.hash (CFG-027), not a per-command constant. A workspace whose cache.hash is sha256 produces a Context whose Context::hash_algo returns HashAlgo::Sha256, and every command transitively consumes that value. The previous per- command const HASH_ALGO: HashAlgo = HashAlgo::Blake3; constants are gone.

Structs§

Context
Per-invocation handle binding the cwd, the discovered workspace, the validated task graph, and the host filesystem.