Skip to content

feat: Interactive Environment Hydration View in TUI #58

@drlucaa

Description

@drlucaa

Currently, same performs environment hydration (Nix resolutions and builds) in the background or within a generic "Hydrating Environments" span. This obscures critical information like download progress, build logs, and resolution details.

We want to promote the hydration phase to a first-class view in the TUI. Before the main build plan is shown, users should see a list of unique environments being prepared. This view should be interactive, allowing users to "drill down" into specific environments to view real-time, colored logs (preserving Nix progress bars via PTY).

Goals

  1. Visibility: Explicitly show the unique environments required for the run (e.g., go@1.25.4, lint@2.7.2) before task execution starts.
  2. Rich Feedback: Stream nix print-dev-env output using a Pseudo-Terminal (PTY) to preserve ANSI colors and download progress bars.
  3. Consistency: Ensure the interaction model (navigation, drill-down, log inspection) mirrors the existing Task Graph view.

Acceptance Criteria

  • Scheduler & Flow

  • Scheduler.Run is refactored to calculate unique EnvIDs and call EmitHydration before EmitPlan.

  • The execution flow strictly follows: Emit Hydration Plan Hydrate (Parallel) Emit Build Plan Execute Tasks.

  • Telemetry

  • Tracer interface updated with EmitHydration.

  • New MsgInitHydration message implemented to carry environment metadata to the TUI.

  • TUI Adapter

  • New ViewModeHydration implemented.

  • Renders a flat, selectable list of environments using TaskNode styles (Status Icon, Name, Duration).

  • Interaction: Users can navigate with j/k and press Enter to view full-screen logs (utilizing Vterm).

  • Transition: TUI automatically switches to the Task Graph view (ViewModeTree) when hydration completes.

  • Nix Adapter (PTY Support)

  • EnvFactory uses creack/pty to execute the "visual" nix print-dev-env command, streaming ptmx output directly to the Span.

  • A secondary execution captures the JSON data reliably for environment parsing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions