# daveio/dotfiles-fish architecture

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

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

## Overview

This project is a collection of dotfiles for the Fish shell – essentially a configuration repository tailored to customizing and extending the behavior of the Fish shell environment. The repository is structured as a set of configuration files, plugins, completions, and custom scripts that are managed and deployed (using tools like chezmoi and fisher) to ensure a consistent shell experience.

##### Main Components
- Fish Shell Configuration Files: This includes key files such as config.fish, funcs.fish, vars.fish, aliases.fish, abbrs.fish, interactive.fish, and os.fish (which is the only templated file modified based on the OS).
- Completions: The “completions” directory contains fish completions for various tools (e.g., atuin.fish, bun.fish, lefthook.fish, ngrok.fish, zellij.fish).
- Plugins & Themes: The README outlines the usage of fisher for managing plugins and mentions specific plugins (like tide for prompt customization) and themes (rose-pine).
- Tool Scripts: The “tools” directory includes scripts such as “sixkcd”, which is used to display xkcd comics (with Sixel graphics support) as part of the message-of-the-day.
- CI/CD and Quality Checks: Directories like .github and .trunk contain configuration files for GitHub workflows, dependency management (e.g., dependabot.yml), and linting (e.g., markdownlint and yamllint configurations). These aren’t part of the actual Fish configuration runtime but are essential for project maintenance and quality assurance.
- Secret Management: The README also references a “secrets.fish” file (which is intentionally omitted from version control) that holds private configuration variables.

##### Relationships and Interactions
- At the core, the Fish shell uses the various configuration files to set up its environment. Files like config.fish, funcs.fish, and interactive.fish interconnect by being sourced during shell initialization.
- The completions enhance the command-line experience by extending support for various external tools.
- Plugins (managed by fisher) and themes (like “rose-pine” and tide) extend the UI and behavior of the shell prompt.
- The “tools/sixkcd” script operates as an independent utility integrated via shell configuration; it interacts with user’s terminal (like iTerm2) to render Sixel graphics.
- The system also integrates external tools such as asdf (for managing versions of development tools) that may influence the shell environment.
- CI/CD and linting components (.github and .trunk) work independently outside the runtime environment but ensure the consistency and quality of the code being maintained.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The repository cleanly delineates configuration (Fish files), plugin management (fisher), third-party integrations (asdf, tide, rose-pine), and maintenance tools (CI/CD workflows).
- Templating & Dynamic Configuration: The use of chezmoi to manage templated content (e.g., os.fish) demonstrates a dynamic configuration setup based on the user's operating system.
- Extensibility: The folder structure facilitates updates or changes—for example, easily adding new commands in funcs.fish, aliasing commands in aliases.fish, or extending completions in the completions directory.

##### Relevant Technologies
- Shell: Fish shell configuration
- Configuration Management: Chezmoi (for templating and distribution of dotfiles)
- Plugin Manager: Fisher for handling Fish plugins
- Theming and Prompt Customization: tide and rose-pine
- Development Tool Versioning: asdf
- CI/CD: GitHub Actions (as evidenced by workflows in the .github directory)
- Code/Style Linting: Configurations under .trunk
- Sixel Graphics: sixkcd script reliant on terminal support (e.g., iTerm2)

##### Final Assembly
- Branch out to detail how separate configuration files (including those for functions, aliases, completions) feed into the shell's behavior.
- How plugin management via fisher and theming components integrate into this core setup.
- Independent yet supportive roles of maintenance tools (CI workflows, linting) that ensure code quality.
- External integrations like asdf for managing tool versions, and note the conditional logic introduced by the templated os.fish file.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Shell Runtime Cluster
    subgraph "User Shell Runtime"
        FS["Fish Shell Environment"]:::runtime

        subgraph "Configuration Files"
            CF["config.fish"]:::runtime
            FF["funcs.fish"]:::runtime
            VF["vars.fish"]:::runtime
            AF["aliases.fish"]:::runtime
            ABF["abbrs.fish"]:::runtime
            IF["interactive.fish"]:::runtime
            OSF["os.fish (templated)"]:::runtime
        end

        subgraph "Completions"
            AT["atuin.fish"]:::runtime
            BN["bun.fish"]:::runtime
            LH["lefthook.fish"]:::runtime
            NG["ngrok.fish"]:::runtime
            ZE["zellij.fish"]:::runtime
        end

        PM["Plugin Manager (fisher)"]:::runtime
        TS["Tool Script (sixkcd)"]:::runtime
        EX["External Tool: asdf"]:::external
    end

    %% Maintenance & CI/CD Cluster
    subgraph "Maintenance & CI/CD"
        CI["CI Workflows (.github)"]:::maintenance
        LT["Linting & Dependency Config (.trunk)"]:::maintenance
    end

    %% Relationships: Configuration Files to Fish Shell Environment
    CF -->|"sources"| FS
    FF -->|"sources"| FS
    VF -->|"sources"| FS
    AF -->|"sources"| FS
    ABF -->|"sources"| FS
    IF -->|"sources"| FS
    OSF -->|"sources"| FS

    %% Relationships: Completions to Fish Shell Environment
    AT -->|"enhances"| FS
    BN -->|"enhances"| FS
    LH -->|"enhances"| FS
    NG -->|"enhances"| FS
    ZE -->|"enhances"| FS

    %% Relationships: Plugins and Tools
    PM -->|"configures"| FS
    TS -->|"executes"| FS
    EX -->|"integrates"| FS

    %% Relationships: Maintenance supports runtime
    CI -.->|"ensures"| FS
    LT -.->|"validates"| FS

    %% Click Events for Configuration Files
    click CF "https://github.com/daveio/dotfiles-fish/blob/main/config.fish"
    click FF "https://github.com/daveio/dotfiles-fish/blob/main/funcs.fish"
    click VF "https://github.com/daveio/dotfiles-fish/blob/main/vars.fish"
    click AF "https://github.com/daveio/dotfiles-fish/blob/main/aliases.fish"
    click ABF "https://github.com/daveio/dotfiles-fish/blob/main/abbrs.fish"
    click IF "https://github.com/daveio/dotfiles-fish/blob/main/interactive.fish"
    click OSF "https://github.com/daveio/dotfiles-fish/blob/main/os.fish"

    %% Click Events for Completions
    click AT "https://github.com/daveio/dotfiles-fish/blob/main/completions/atuin.fish"
    click BN "https://github.com/daveio/dotfiles-fish/blob/main/completions/bun.fish"
    click LH "https://github.com/daveio/dotfiles-fish/blob/main/completions/lefthook.fish"
    click NG "https://github.com/daveio/dotfiles-fish/blob/main/completions/ngrok.fish"
    click ZE "https://github.com/daveio/dotfiles-fish/blob/main/completions/zellij.fish"

    %% Click Event for Plugin Manager
    click PM "https://github.com/daveio/dotfiles-fish/tree/main/fish_plugins"

    %% Click Event for Tool Script
    click TS "https://github.com/daveio/dotfiles-fish/tree/main/tools/sixkcd"

    %% Click Events for Maintenance Components
    click CI "https://github.com/daveio/dotfiles-fish/blob/main/.github"
    click LT "https://github.com/daveio/dotfiles-fish/blob/main/.trunk"

    %% Styles
    classDef runtime fill:#B3E5FC,stroke:#01579B,stroke-width:2px;
    classDef maintenance fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef external fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
```
