How denisdefreyne/ddenv works
Main components
• CLI Entrypoint (cmd/ddenv/main.go)
• Configuration Loader (ddenv.yaml parser)
• Core Orchestration Engine (core/core.go)
• Goal Handlers (goals/*.go)
• Homebrew Submodule (homebrew/main.go)
• External Systems & Services (Homebrew, Shell, Version Managers, Databases, Redis, Shadowenv)
Relationships and data flow
a. User Types ddenv → CLI Entrypoint
b. CLI Entrypoint → reads ddenv.yaml via Configuration Loader
c. Configuration Loader → produces an ordered list of “goal” specifications
d. Core Orchestration Engine → iterates the list, for each goal:
• Instantiates corresponding Goal Handler from the goals package
• Injects any shared dependencies (e.g. logger, file system, environment)
e. Each Goal Handler → executes domain logic:
• Calls Homebrew submodule for brew-related goals
• Invokes external tools (ruby-install, nodenv or node-build, psql, redis-server)
• Manipulates Shadowenv (directory creation, .gitignore patching, env file writes)
f. Goal Handler → returns status and any exported environment variables
g. Core Engine → aggregates results and prints progress in the CLI
Architectural patterns
• Plugin-style pattern: each “goal” is a self-contained handler implementing a common interface (e.g. Goal interface in core)
• Dependency injection: shared services (logger, file system, shell executor) passed into each handler
• Single responsibility: cmd handles CLI parsing, core orchestrates workflow, goals contain domain logic