# fedeiii/hidden-agenda architecture

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

- Interactive diagram: https://gitdiagram.com/fedeiii/hidden-agenda
- Repository: https://github.com/fedeiii/hidden-agenda

## Overview

##### Project Type and Purpose
- This is a browser-based application focused on implementing an interactive board game.
- Its purpose is to provide a playable game interface featuring various phases (start, play, alignment, end) alongside rich game mechanics and state management.
- The README and file tree indicate a focus on UI interactivity, game-phase handling, state management through reducers and mocks (for testing), and detailed game domain logic.

##### File Structure for Architectural Insights
- Top-Level Structure:
- Configuration and build files (.babelrc, webpack.config.js, package.json) indicate a modern JavaScript (likely React) single-page application.
- The “src” folder is split into “client”, “domain”, and “tests” which clearly separates UI/UX from game logic and testing components.

- Client Directory (src/client):
- Contains main entry points (index.js) and main styling files (globalStyle.js).
- Houses UI components structured into sub-folders; one for generic components (e.g., button, title) and others grouped by game phases (startPhase, playPhase, alignmentPhase, endPhase).
- “hooks” folder indicates usage of custom React hooks for state or behavior management.
- “state” folder holds state logic including reducers (e.g., followMouseReducer, piecesReducer, etc.) as well as mocked states used for testing different game scenarios.

- Domain Directory (src/domain):
- Contains game logic and rules including pieces, teams, cells, and utility functions that encapsulate the board game’s core mechanics.
- This separation suggests a clean layered architecture where the game logic (“domain”) is decoupled from the presentation layer (“client”).

- Tests Directory:
- Contains both unit tests for agents, ceaseO, and other gameplay mechanics, including helper scripts for simulating interactions.

- Documentation Directory (docs):
- Provides site-specific documentation and configuration for the game’s website.

- User events triggering actions in UI components.
- UI components updating or reading from state management.
- State changes impacting domain logic (e.g., game rule enforcement).
- Data flow from the domain to the UI for rendering updated game states.
- Another for business logic (e.g., ovals for domain functions and game rules).
- Additional differentiation for cross-cutting concerns like testing and build configuration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User("User"):::user

    subgraph "Browser/Client Layer"
        UIComponents("UI Components"):::ui
        GameEntry("Main Game Entry (game.jsx)"):::ui
        StartPhase("Start Phase (startPhase)"):::ui
        PlayPhase("Play Phase (playPhase)"):::ui
        AlignmentPhase("Alignment Phase (alignmentPhase)"):::ui
        EndPhase("End Phase (endPhase)"):::ui
        CustomHooks("Custom Hooks"):::hooks
        StateManagement("State Management (Reducers & Mocks)"):::state
    end

    subgraph "Domain Layer"
        DomainLogic("Domain Logic (Game Rules & Core Mechanics)"):::domain
    end

    subgraph "Build & Configuration"
        Babelrc("Babel Config (.babelrc)"):::build
        Webpack("Webpack Config (webpack.config.js)"):::build
        PackageJson("Package.json"):::build
        ESLint("ESLint Config (.eslintrc.json)"):::build
    end

    subgraph "Testing Suite"
        AgentTest("Agent Tests"):::test
        CeoTest("CEO Tests"):::test
        ClaimControlTest("ClaimControl Tests"):::test
        SmokeTest("Smoke Test"):::test
        SniperTest("Sniper Test"):::test
        SpyTest("Spy Test"):::test
        TestingHelpers("Test Helpers"):::test
    end

    subgraph "Documentation"
        DocsConfig("Docs Config (_config.yml)"):::docs
        DocsIndex("Docs Home (index.html)"):::docs
        DocsMainJS("Docs Main JS (main.js)"):::docs
        DocsMainMap("Docs Main Map (main.js.map)"):::docs
    end

    %% Interactions and Data Flow
    User -->|"triggers"| UIComponents
    UIComponents -->|"loads"| GameEntry
    GameEntry -->|"renders"| StartPhase
    GameEntry -->|"renders"| PlayPhase
    GameEntry -->|"renders"| AlignmentPhase
    GameEntry -->|"renders"| EndPhase
    UIComponents -->|"uses"| CustomHooks
    UIComponents -->|"updates"| StateManagement
    StateManagement -->|"feeds"| UIComponents
    UIComponents -->|"validates"| DomainLogic
    DomainLogic -->|"updates"| UIComponents

    %% Build Tools integrating Client and Domain layers
    Babelrc -->|"bundles"| UIComponents
    Webpack -->|"bundles"| UIComponents
    PackageJson -->|"bundles"| UIComponents
    ESLint -->|"enforces"| UIComponents
    Webpack -->|"bundles"| DomainLogic

    %% Testing Suite interactions
    AgentTest -->|"tests"| DomainLogic
    CeoTest -->|"tests"| DomainLogic
    ClaimControlTest -->|"tests"| StateManagement
    SmokeTest -->|"tests"| UIComponents
    SniperTest -->|"tests"| UIComponents
    SpyTest -->|"tests"| UIComponents
    TestingHelpers -->|"supports"| AgentTest

    %% Documentation providing info to User and system configuration
    DocsConfig -->|"documents"| PackageJson
    DocsIndex -->|"providesInfo"| User
    DocsMainJS -->|"providesInfo"| User
    DocsMainMap -->|"providesInfo"| User

    %% Click Events for Component Mapping
    click UIComponents "https://github.com/fedeiii/hidden-agenda/tree/master/src/client/components"
    click GameEntry "https://github.com/fedeiii/hidden-agenda/blob/master/src/client/game.jsx"
    click StartPhase "https://github.com/fedeiii/hidden-agenda/blob/master/src/client/phases/startPhase/index.jsx"
    click PlayPhase "https://github.com/fedeiii/hidden-agenda/blob/master/src/client/phases/playPhase/index.jsx"
    click AlignmentPhase "https://github.com/fedeiii/hidden-agenda/blob/master/src/client/phases/alignmentPhase/index.jsx"
    click EndPhase "https://github.com/fedeiii/hidden-agenda/blob/master/src/client/phases/endPhase/index.jsx"
    click CustomHooks "https://github.com/fedeiii/hidden-agenda/tree/master/src/client/hooks"
    click StateManagement "https://github.com/fedeiii/hidden-agenda/blob/master/src/client/state/index.js"
    click DomainLogic "https://github.com/fedeiii/hidden-agenda/tree/master/src/domain"
    click Babelrc "https://github.com/fedeiii/hidden-agenda/blob/master/.babelrc"
    click Webpack "https://github.com/fedeiii/hidden-agenda/blob/master/webpack.config.js"
    click PackageJson "https://github.com/fedeiii/hidden-agenda/blob/master/package.json"
    click ESLint "https://github.com/fedeiii/hidden-agenda/blob/master/.eslintrc.json"
    click AgentTest "https://github.com/fedeiii/hidden-agenda/blob/master/src/tests/agent.test.js"
    click CeoTest "https://github.com/fedeiii/hidden-agenda/blob/master/src/tests/ceo.test.js"
    click ClaimControlTest "https://github.com/fedeiii/hidden-agenda/blob/master/src/tests/claimControl.test.js"
    click SmokeTest "https://github.com/fedeiii/hidden-agenda/blob/master/src/tests/smoke.test.js"
    click SniperTest "https://github.com/fedeiii/hidden-agenda/blob/master/src/tests/sniper.test.js"
    click SpyTest "https://github.com/fedeiii/hidden-agenda/blob/master/src/tests/spy.test.js"
    click TestingHelpers "https://github.com/fedeiii/hidden-agenda/tree/master/src/tests/helpers"
    click DocsConfig "https://github.com/fedeiii/hidden-agenda/blob/master/docs/_config.yml"
    click DocsIndex "https://github.com/fedeiii/hidden-agenda/blob/master/docs/index.html"
    click DocsMainJS "https://github.com/fedeiii/hidden-agenda/blob/master/docs/main.js"
    click DocsMainMap "https://github.com/fedeiii/hidden-agenda/blob/master/docs/main.js.map"

    %% Styles
    classDef user fill:#f9e79f,stroke:#d35400,stroke-width:2px;
    classDef ui fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef hooks fill:#a9dfbf,stroke:#27ae60,stroke-width:2px;
    classDef state fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px;
    classDef domain fill:#fadbd8,stroke:#c0392b,stroke-width:2px;
    classDef build fill:#d6eaf8,stroke:#5dade2,stroke-width:2px;
    classDef test fill:#f5cba7,stroke:#e67e22,stroke-width:2px;
    classDef docs fill:#e8daef,stroke:#8e44ad,stroke-width:2px;
```
