# daneroo/dotfiles architecture

> Architecture diagram of the GitHub repository daneroo/dotfiles, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/daneroo/dotfiles
- Repository: https://github.com/daneroo/dotfiles

## Overview

##### Main Components

a) Entry Points Layer:
- `check.sh` as the primary entry point
- To `installDotLinks.sh` for dotfile symlink management
- `go/cmd/checkdeps/main.go` as the core reconciliation engine

b) Configuration Layer:
- Configuration handling components:
- YAML config files (config.yaml)
- Go config package (go/pkg/config)
- Deno config handlers (deno/config)

c) Core Reconciliation Engines:
- Create three main parallel reconciliation blocks:
1. Homebrew Manager (go/pkg/brewdeps)
2. ASDF Version Manager (go/pkg/asdf)
3. NPM Package Manager (go/pkg/npm)

##### Component Relationships

- Entry point → Configuration Layer (reads)
- Configuration Layer → Reconciliation Engines (provides settings)
- Reconciliation Engines → System State (modifies)

##### Important Details

a) Configuration Flow:
- How config merging works (base → shared → host-specific)
- Validation points

b) Reconciliation Patterns:
- Common reconciliation pattern:
- Current state detection
- Desired state comparison
- Action determination
- Execution

c) External Dependencies:
- Homebrew
- ASDF
- NPM/Node.js
- System shell

##### Specific Implementation Details

Key architectural patterns:
- Idempotent reconciliation loops
- Status reporting system (✓/✗)
- Type-safe configuration handling
- Plugin-based version management

##### The extensibility of the system

- Status indicators
- Component types

This will create a comprehensive yet understandable representation of the system's architecture while maintaining the necessary detail level for a principal software engineer to understand the system's complete workflow and interactions.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef entryPoint fill:#f9f,stroke:#333,stroke-width:2px
    classDef config fill:#9cf,stroke:#333,stroke-width:2px
    classDef reconciliation fill:#9f9,stroke:#333,stroke-width:2px
    classDef manager fill:#fc9,stroke:#333,stroke-width:2px
    classDef system fill:#ccc,stroke:#333,stroke-width:2px

    %% Entry Points Layer
    subgraph EntryPoints
        Check["check.sh"]:::entryPoint
        DotLinks["installDotLinks.sh"]:::entryPoint
        CoreEngine["Core Reconciliation Engine"]:::entryPoint
    end

    %% Configuration Layer
    subgraph Config
        YAMLConfig["config.yaml"]:::config
        GoConfig["Go Config Package"]:::config
        DenoConfig["Deno Config Handler"]:::config
        Schema["Configuration Schema"]:::config
    end

    %% Reconciliation Engines
    subgraph Reconciliation
        direction TB
        HomeBrew["Homebrew Manager"]:::reconciliation
        ASDF["ASDF Version Manager"]:::reconciliation
        NPM["NPM Package Manager"]:::reconciliation
    end

    %% System State
    subgraph SystemState
        BrewState["Homebrew State"]:::system
        ASDFState["ASDF State"]:::system
        NPMState["NPM State"]:::system
    end

    %% Relationships
    Check --> CoreEngine
    Check --> DotLinks
    CoreEngine --> Config
    Config --> Reconciliation
    HomeBrew --> BrewState
    ASDF --> ASDFState
    NPM --> NPMState

    %% Component Details
    subgraph HomebrewDetails
        BrewActual["Actual State"]:::manager
        BrewReconcile["Reconciliation Logic"]:::manager
        BrewTypes["Types"]:::manager
    end

    subgraph ASDFDetails
        ASDFPlugins["Plugin Management"]:::manager
        ASDFReconcile["Reconciliation Logic"]:::manager
        ASDFVersions["Version Management"]:::manager
    end

    HomeBrew --> HomebrewDetails
    ASDF --> ASDFDetails

    %% Click events for component mapping
    click Check "https://github.com/daneroo/dotfiles/blob/master/check.sh"
    click DotLinks "https://github.com/daneroo/dotfiles/blob/master/installDotLinks.sh"
    click CoreEngine "https://github.com/daneroo/dotfiles/blob/master/go/cmd/checkdeps/main.go"
    click YAMLConfig "https://github.com/daneroo/dotfiles/blob/master/config.yaml"
    click GoConfig "https://github.com/daneroo/dotfiles/tree/master/go/pkg/config/"
    click DenoConfig "https://github.com/daneroo/dotfiles/blob/master/deno/config/config.ts"
    click HomeBrew "https://github.com/daneroo/dotfiles/tree/master/go/pkg/brewdeps/"
    click BrewActual "https://github.com/daneroo/dotfiles/blob/master/go/pkg/brewdeps/actual/actual.go"
    click BrewReconcile "https://github.com/daneroo/dotfiles/blob/master/go/pkg/brewdeps/reconcile/reconcile.go"
    click BrewTypes "https://github.com/daneroo/dotfiles/blob/master/go/pkg/brewdeps/types/types.go"
    click ASDF "https://github.com/daneroo/dotfiles/tree/master/go/pkg/asdf/"
    click ASDFPlugins "https://github.com/daneroo/dotfiles/blob/master/go/pkg/asdf/plugins.go"
    click ASDFReconcile "https://github.com/daneroo/dotfiles/blob/master/go/pkg/asdf/reconcile.go"
    click ASDFVersions "https://github.com/daneroo/dotfiles/blob/master/go/pkg/asdf/versions.go"
    click NPM "https://github.com/daneroo/dotfiles/tree/master/go/pkg/npm/"
    click Schema "https://github.com/daneroo/dotfiles/blob/master/config.schema.json"

    %% Legend
    subgraph Legend
        L1["Entry Points"]:::entryPoint
        L2["Configuration"]:::config
        L3["Reconciliation"]:::reconciliation
        L4["Managers"]:::manager
        L5["System State"]:::system
    end
```
