Skip to content

[TASK] Refactor cmd/config.go into parser, env overlay, and defaults #530

Description

@edenreich

Summary

cmd/config.go is roughly 2,134 lines and conflates three responsibilities: YAML parsing, environment-variable overrides, and default population. The interplay between these layers is hard to reason about and makes env-override bugs hard to diagnose (precedence is implicit).

This issue tracks splitting cmd/config.go so each layer is independently testable and the precedence between layers is explicit.

Acceptance Criteria

  • YAML parsing lives in its own file/package and produces a pure config struct with no side effects.
  • Default population is a separate, pure function over the parsed struct.
  • Environment-variable overlay is a separate, pure function with documented precedence (file < defaults < env, or whatever the chosen order is).
  • A single top-level Load() composes the three steps and is the only public entry point.
  • Table-driven tests cover each layer independently and the composed Load().
  • The split does not change observable behavior; existing config files and env vars work as before.
  • Precedence is documented in a code comment on Load() and in the user-facing config docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Task.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions