Skip to main content

Module rig

Module rig 

Source
Expand description

Rig discovery + pre-flight (04-01, RIG-01): the RigPlan model, the LOCKED 5-level discovery that always ends in one resolve-then-act config run, and the port-collision pre-flight.

§Resolve-then-act (research Pattern 1)

Discovery only ever finds a compose FILE; resolve_plan then runs docker compose -f <file> --project-directory <dir> config --format json through the runner and the returned .name (which honors the rig’s own .env COMPOSE_PROJECT_NAME) becomes the identity truth every later op passes as explicit -p <name> (Pitfall 8: no implicit directory-name projects, ever).

§Discovery order (LOCKED — must-have truth)

  1. --rig NAME flag → [rigs.NAME]
  2. IGNITION_RIG env → same (the bin folds it into the flag — one env→flag home, the IGNITION_PROFILE precedent)
  3. [rig].default[rigs.<default>] (a stale default is a LOUD error, never a silent scan)
  4. cwd candidates: ./docker/compose.yml, ./docker/docker-compose.yml, ./compose.yml, ./compose.yaml, ./docker-compose.yml
  5. WHK conventions — the git-module repo, then the WHK-Global orchestration repo, each probed under BOTH home roots (plan-checker: machine layouts differ; never pin one root): ~/Documents/whiskeyhouse/ first, ~/whiskeyhouse/ second.

Nothing found → CoreError::Rig carrying the full search trail (agents self-diagnose). Convention roots live in ONE const array; [whk_roots] additionally honors IGNITION_RIG_ROOTS (path-separated) so binary tests can isolate the machine’s real home and agents with rigs elsewhere can redirect the convention scan.

Re-exports§

pub use compose::ComposeOutput;
pub use compose::ComposeRunner;
pub use compose::DockerCompose;
pub use compose::DockerPsEntry;
pub use compose::PortMapping;
pub use compose::Publisher;
pub use compose::ServiceStatus;
pub use compose::VolumeEntry;
pub use compose::compose_version;
pub use compose::config_args;
pub use compose::docker_ps_publish_args;
pub use compose::parse_config;
pub use compose::parse_docker_ps_ldjson;
pub use compose::reset_preview;

Modules§

compose
The compose shell-out engine (04-01, RIG-01): runner seam, version check, LOCKED arg builders, and the LDJSON/array parsers — serde models out, no printing (the TUI rides the actions layer in Phase 6).

Structs§

PortConflict
A host port already held by something that is NOT this rig’s own project (same-project occupants are recreate-safe).
RigPlan
The resolved rig — research Pattern 1’s model, plus the target→ published port pairs (the gateway-URL heuristic in actions::rig needs targets, not just the published half).

Enums§

RigSelection
What the caller wants resolved: an explicit name (the --rig flag, which the bin already folded IGNITION_RIG into) or the auto chain ([rig].default → cwd scan → convention scan).

Constants§

WHK_HOME_ROOTS
WHK convention home roots, tried in this order (plan-checker 2026-08-22: this machine’s whk-environment-orchestration lives under ~/whiskeyhouse/, not ~/Documents/whiskeyhouse/ — layouts differ per machine, so BOTH roots are probed for BOTH convention repos).

Functions§

port_preflight
Port pre-flight (research Pattern 3), run before up: per host port, docker ps --filter publish=<port> --format json first (rich attribution); when docker reports no occupant, an advisory lsof pass attributes non-docker HOST processes. lsof absence is tolerated silently (skip — it is advisory-only). Occupants belonging to THIS project are fine (a recreate); anything else is a conflict.
resolve_plan
Resolve the rig end-to-end: discovery → the one config run → a RigPlan whose .name every later op passes as explicit -p.