# lancetipton/parkin architecture

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

- Interactive diagram: https://gitdiagram.com/lancetipton/parkin
- Repository: https://github.com/lancetipton/parkin

## Overview

##### Main Components

A. Core Components:
- Parser System
- Feature Parser
- Definition Parser
- Expression Parser
- Matcher System
- Runner System
- World Object Manager
- Test Execution Engine

B. Supporting Components:
- CLI Interface
- Reporters System
- Hooks System
- Types System

##### Component Relationships and Architecture

**Top Layer: Entry Points**

- CLI Interface (src/bin)
- API Interface (src/index.ts)

**Middle Layer: Core Processing**

- Parser System (src/parse)
- Feature Parser
- Definition Parser
- Step Parser

- Matcher System (src/matcher)
- Expression Matcher
- Regex Matcher
- Parameter Types

- Runner System (src/runner.ts)
- Test Execution Engine
- Hooks Manager
- World State Manager

**Bottom Layer: Supporting Systems**

- Reporters (src/bin/reporters)
- Utils (src/utils)
- Types System (src/types)

##### Design Elements

Use the following visual elements:
- Rounded rectangles for supporting systems
- Blue: Core processing components
- Green: Entry points
- Yellow: Supporting systems
- Gray: External interfaces

##### Key Interactions to Highlight

a. Feature Processing Flow:
**Feature Text → Parser → Matcher → Runner → Test Execution → Reporter**

b. Step Definition Flow:
**Step Definition → Parser → Registration → Matcher → Execution**

c. World Object Integration:
**World Object ←→ Parser (for replacements)**
- ↕
- Step Execution

##### Important Implementation Details

- Relationship between the Parser and Matcher systems
- How the World object integrates with different components
- Demonstrate the test execution flow with hooks
- How reporters receive and process execution results

##### Specific Implementation Notes

- The modular nature of the codebase
- The separation between parsing and execution
- The plugin-like nature of reporters
- The extensibility of the matcher system
- The central role of the World object

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Entry
        CLI["CLI Interface"]:::entry
        API["API Interface"]:::entry
    end

    subgraph Core
        subgraph PS["Parser System"]
            FP["Feature Parser"]:::core
            DP["Definition Parser"]:::core
            SP["Step Parser"]:::core
        end

        subgraph MS["Matcher System"]
            EM["Expression Matcher"]:::core
            RM["Regex Matcher"]:::core
            PT["Parameter Types"]:::core
        end

        subgraph RS["Runner System"]
            RN["Main Runner"]:::core
            TE["Test Execution Engine"]:::core
            HM["Hooks Manager"]:::core
            WM["World State Manager"]:::core
        end
    end

    subgraph Support
        REP["Reporters System"]:::support
        UTIL["Utils"]:::support
        TYPES["Types System"]:::support
    end

    %% Relationships
    CLI --> PS
    API --> PS
    PS --> MS
    MS --> RS
    RS --> REP
    WM <--> PS
    WM <--> RS
    HM <--> TE
    TYPES -.-> PS
    TYPES -.-> MS
    TYPES -.-> RS

    %% Click Events
    click PS "https://github.com/lancetipton/parkin/tree/main/src/parse/"
    click FP "https://github.com/lancetipton/parkin/blob/main/src/parse/parseFeature.ts"
    click DP "https://github.com/lancetipton/parkin/blob/main/src/parse/parseDefinition.ts"
    click SP "https://github.com/lancetipton/parkin/blob/main/src/parse/parseStep.ts"
    click MS "https://github.com/lancetipton/parkin/tree/main/src/matcher/"
    click EM "https://github.com/lancetipton/parkin/blob/main/src/matcher/expression.ts"
    click RM "https://github.com/lancetipton/parkin/blob/main/src/matcher/regex.ts"
    click PT "https://github.com/lancetipton/parkin/blob/main/src/matcher/paramTypes.ts"
    click RN "https://github.com/lancetipton/parkin/blob/main/src/runner.ts"
    click TE "https://github.com/lancetipton/parkin/tree/main/src/test/"
    click WM "https://github.com/lancetipton/parkin/blob/main/parkin/world.ts"
    click CLI "https://github.com/lancetipton/parkin/tree/main/src/bin/"
    click REP "https://github.com/lancetipton/parkin/tree/main/src/bin/reporters/"
    click HM "https://github.com/lancetipton/parkin/blob/main/src/hooks.ts"
    click TYPES "https://github.com/lancetipton/parkin/tree/main/src/types/"

    %% Styles
    classDef core fill:#dae8fc,stroke:#6c8ebf
    classDef entry fill:#d5e8d4,stroke:#82b366
    classDef support fill:#fff2cc,stroke:#d6b656
    
    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Entry Points"]:::entry
        L3["Supporting Systems"]:::support
    end
```
