# feature-sliced/steiger architecture

> Architecture diagram of the GitHub repository feature-sliced/steiger, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/feature-sliced/steiger
- Repository: https://github.com/feature-sliced/steiger

## Overview

##### Main Components Identification
The system consists of several key packages that should be represented as primary components:

a. Core Components:
- steiger (main package)
- steiger-plugin-fsd (Feature-Sliced Design plugin)
- pretty-reporter (formatting/reporting)
- toolkit (shared utilities)
- types (shared type definitions)

**┌─ CLI Interface Layer ─────────────────────────────────┐**
- steiger/cli.ts                    │
- ┬─┤
- Core Engine Layer                 │ │
- ┌─────────────┐  ┌──────────────┐  ┌───────────┐  │ │
- Config    │  │    Runner    │  │  Parser   │  │ │
- Processor  │──▶│   Engine    │──▶│          │  │ │
- ┘  └──────────────┘  └───────────┘  │ │
- ┤ │
- Plugin System                      │ │
- ┌─────────────────────────────────────────────┐    │ │
- steiger-plugin-fsd                  │    │ │
- ┌─────────┐  ┌─────────┐  ┌────────────┐  │    │ │
- Rules  │  │  Fixes  │  │ Validators │  │    │ │
- ┘  └─────────┘  └────────────┘  │    │ │
- ┘    │ │
- ┤ │
- Support Libraries                    │ │
- ┌────────────┐  ┌───────────┐  ┌──────────────┐   │ │
- Toolkit   │  │   Types   │  │    Pretty    │   │ │
- Reporter   │   │ │
- ┘  └───────────┘  └──────────────┘   │ │
- ┘ │
- ┘

##### Key Interactions to Highlight

a. Input Flow:
- CLI receives file paths and config
- Config processor validates and normalizes settings
- Runner engine processes files
- Plugin system applies rules

b. Output Flow:
- Diagnostics collection
- Pretty reporter formatting
- CLI output

##### Additional Elements

Annotations for:
- Watch mode functionality
- Configuration options
- Rule severity levels
- File system interactions

**Symbols:**
**▶ Required dependency**
**⇢ Optional dependency**
**□ Core component**
**◇ Plugin**
**○ Support library**

**Blue   - Core system components**
**Green  - Plugin system**
**Yellow - Support libraries**
**Red    - Critical paths/validations**

##### The configuration system's flexibility

Keep the abstraction level focused on the architectural components while providing enough detail to understand the system's operation and extension points. This will help developers understand both the current system and how to extend it with new plugins or rules.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph CLI
        cli["CLI Interface"]
    end
    click cli "https://github.com/feature-sliced/steiger/blob/master/packages/steiger/src/cli.ts"

    subgraph CoreEngine
        config["Config Processor"]
        runner["Runner Engine"]
        parser["Parser"]
        app["App Core"]
        vfs["Virtual File System"]
        
        config --> runner
        runner --> parser
        app --> runner
        vfs --> runner
    end
    click config "https://github.com/feature-sliced/steiger/tree/master/packages/steiger/src/models/config/"
    click runner "https://github.com/feature-sliced/steiger/tree/master/packages/steiger/src/features/run-rule/"
    click app "https://github.com/feature-sliced/steiger/blob/master/packages/steiger/src/app.ts"
    click vfs "https://github.com/feature-sliced/steiger/blob/master/packages/steiger/src/models/vfs.ts"

    subgraph PluginSystem
        plugin["Plugin Framework"]
        rules["FSD Rules"]
        utils["Plugin Utils"]
        
        plugin --> rules
        utils --> rules
    end
    click plugin "https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/"
    click rules "https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/"
    click utils "https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/_lib/"

    subgraph Features
        autofix["Autofix"]
        diagnostic["Diagnostic Calculation"]
        
        autofix --> runner
        diagnostic --> runner
    end
    click autofix "https://github.com/feature-sliced/steiger/blob/master/packages/steiger/src/features/autofix.ts"
    click diagnostic "https://github.com/feature-sliced/steiger/tree/master/packages/steiger/src/features/calculate-diagnostic-severities/"

    subgraph SharedUtils
        glob["Glob Handling"]
        fsutils["File System Utils"]
        
        glob --> runner
        fsutils --> vfs
    end
    click glob "https://github.com/feature-sliced/steiger/tree/master/packages/steiger/src/shared/globs/"
    click fsutils "https://github.com/feature-sliced/steiger/blob/master/packages/steiger/src/shared/file-system.ts"

    subgraph SupportLibraries
        toolkit["Toolkit"]
        types["Types"]
        reporter["Pretty Reporter"]
    end
    click toolkit "https://github.com/feature-sliced/steiger/tree/master/packages/toolkit/"
    click types "https://github.com/feature-sliced/steiger/tree/master/packages/types/"
    click reporter "https://github.com/feature-sliced/steiger/tree/master/packages/pretty-reporter/"

    cli --> app
    CoreEngine --> PluginSystem
    SupportLibraries --> CoreEngine
    SharedUtils --> CoreEngine

    classDef core fill:#2374ab
    classDef plugin fill:#2a9d8f
    classDef support fill:#e9c46a
    classDef feature fill:#f4a261
    classDef utils fill:#8ecae6

    class cli,config,runner,parser,app,vfs core
    class plugin,rules,utils plugin
    class toolkit,types,reporter support
    class autofix,diagnostic feature
    class glob,fsutils utils

    %% Legend
    subgraph Legend
        core_leg["Core Components"]:::core
        plugin_leg["Plugin System"]:::plugin
        support_leg["Support Libraries"]:::support
        feature_leg["Features"]:::feature
        utils_leg["Utilities"]:::utils
    end
```
