Skip to content

feat(jay): add config infrastructure (#406)#407

Merged
plastikfan merged 1 commit intomainfrom
feat/add-config
Mar 18, 2026
Merged

feat(jay): add config infrastructure (#406)#407
plastikfan merged 1 commit intomainfrom
feat/add-config

Conversation

@plastikfan
Copy link
Copy Markdown
Contributor

@plastikfan plastikfan commented Mar 18, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added comprehensive configuration system supporting YAML, JSON, and TOML formats
    • Introduced default video workflow with multi-quality transcoding, thumbnail generation, and cloud upload
    • Added flag override system with CLI, command-specific, and component-level defaults
    • Added configurable logging with rotation, level control, and custom time formatting
  • Tests

    • Added extensive test coverage for configuration loading, validation, and flag resolution

@plastikfan plastikfan self-assigned this Mar 18, 2026
@plastikfan plastikfan added the feature New feature or request label Mar 18, 2026
@plastikfan plastikfan linked an issue Mar 18, 2026 that may be closed by this pull request
@plastikfan plastikfan merged commit ce12d1e into main Mar 18, 2026
4 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 18, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0ce9230e-120c-444b-98ac-676cc576c976

📥 Commits

Reviewing files that changed from the base of the PR and between dcb26f8 and ff82af3.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (14)
  • .vscode/settings.json
  • cmd/internal/cfg/cfg_suite_test.go
  • cmd/internal/cfg/default-config.yml
  • cmd/internal/cfg/doc.go
  • cmd/internal/cfg/fixtures_test.go
  • cmd/internal/cfg/flags.go
  • cmd/internal/cfg/flags_test.go
  • cmd/internal/cfg/helpers_test.go
  • cmd/internal/cfg/loader.go
  • cmd/internal/cfg/loader_test.go
  • cmd/internal/cfg/types.go
  • cmd/internal/cfg/validate.go
  • cmd/internal/cfg/validate_test.go
  • go.mod

📝 Walkthrough

Walkthrough

This PR introduces a comprehensive configuration management system for the project. It includes typed configuration structures, file loading with multiple format support, validation framework with error aggregation, and flag resolution logic with precedence rules.

Changes

Cohort / File(s) Summary
Package Setup
.vscode/settings.json, cmd/internal/cfg/doc.go, go.mod
Added spell-check words, package documentation, and dependencies (mapstructure, pflag).
Configuration Types
cmd/internal/cfg/types.go, cmd/internal/cfg/default-config.yml
Defined typed config structures (TUIConfig, InteractionConfig, AdvancedConfig, LoggingConfig, FlagsConfig) and raw sections (Actions, Pipelines); added example default configuration with video workflow, thumbnail, and S3 upload actions.
Configuration Loading
cmd/internal/cfg/loader.go
Implemented extensible loader supporting YAML/JSON/TOML formats, environment variable binding, and mapstructure decoding of mapped sections with validation.
Flag Resolution
cmd/internal/cfg/flags.go
Added FlagResolver with precedence-based flag resolution (CLI > command-specific > wildcard > component > defaults) and short flag override application.
Configuration Validation
cmd/internal/cfg/validate.go
Introduced ValidationError aggregation and per-section validators for LoggingConfig, AdvancedConfig, InteractionConfig, FlagsConfig; validation of actions (non-empty commands) and pipelines (action existence).
Test Suite Infrastructure
cmd/internal/cfg/cfg_suite_test.go, cmd/internal/cfg/fixtures_test.go, cmd/internal/cfg/helpers_test.go
Added Ginkgo test bootstrap, YAML fixture constants covering success and failure validation paths, and in-memory Viper helper.
Loader Tests
cmd/internal/cfg/loader_test.go
Validated config loading with complete and minimal YAML, verifying mapped section decoding (durations, booleans, lists, maps) and raw section structure.
Flag Resolution Tests
cmd/internal/cfg/flags_test.go
Tested ResolveInt/ResolveString precedence paths and ApplyShortOverrides behavior across CLI, command-specific, wildcard, component, and Cobra defaults.
Validation Tests
cmd/internal/cfg/validate_test.go
Comprehensive validation coverage: invalid/valid log levels, negative durations, empty commands, missing action references, and multi-failure aggregation.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Loader as cfg.Load()
    participant Viper
    participant Decoder
    participant Validator
    
    Client->>Loader: LoadOptions (path, format, env)
    Loader->>Viper: Configure (format, paths, env bindings)
    Viper->>Viper: Read config file
    Loader->>Decoder: Decode sections
    Decoder->>Viper: Read each section
    Decoder->>Decoder: mapstructure decode mapped sections<br/>(Interaction, Advanced, Logging)
    Decoder->>Decoder: Raw sections as map[string]any<br/>(Actions, Pipelines, Flags)
    Loader->>Validator: Validate(*Config)
    Validator->>Validator: Validate LoggingConfig (log level, sizes)
    Validator->>Validator: Validate AdvancedConfig (extensions)
    Validator->>Validator: Validate Actions (non-empty cmd)
    Validator->>Validator: Validate Pipelines (known actions)
    Validator->>Validator: Validate FlagsConfig (short overrides)
    Validator-->>Loader: Aggregated errors or nil
    Loader-->>Client: *Config or error
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 Configuration springs forth with mapstructure's might,
Flags dance in precedence, each one set just right,
Validation gathers errors, speaking truth in tones,
From YAML files to structs, a builder's delight!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-config
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.

OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.

@plastikfan plastikfan deleted the feat/add-config branch March 18, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add config support to jay

1 participant