# omniaintranet/omniaclitemplates architecture

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

- Interactive diagram: https://gitdiagram.com/omniaintranet/omniaclitemplates
- Repository: https://github.com/omniaintranet/omniaclitemplates

## Overview

##### Main Components
- Template Pack Versions – Represent each version folder (e.g., 2.0.0, 3.0.0, …, 8.0.0) as a major grouping component since they encapsulate the different sets of templates.
- Item Templates – Within each version, the “items” directory includes folders for various templates (adminjourney, gitignore, manifest, store, etc.). These are the building blocks used when a user invokes a template command like “omnia dev new …”.
- Project Templates – Also within each version, the “projects” directory holds subfolders for “web”, “worker” (and extension types) that provide full-solution scaffolding.
- Template Engine / CLI Interaction – Although not directly in the code, conceptually include a component representing the Omnia CLI (or the Template Engine) that reads these templates (using the index.json and other manifest files) and generates user projects or items.

##### Relationships and Interactions
- The “CLI/Template Engine” sends commands (like “omnia dev new”) and interacts with the Template Pack.
- The Template Engine identifies the appropriate version (by reading index.json) and loads the corresponding items and project templates.
- Within each version, the engine chooses a specific item (or project) type by the user’s command and then processes the related manifest files (e.g., adminjourney.manifest.ts, spfeature.manifest.ts) and source files.
- Components and modules (such as stores or unit test files) are grouped logically under each template type.
- A clear flow exists from the CLI command to selection of a version, then further into item or project extraction, and finally generating the output (i.e., scaffolded project structure).

##### Architectural Patterns and Design Principles
- Modularity: Each version folder is self-contained, and within each version, items and project templates are modular. This structure promotes versioning and backward compatibility.
- Separation of Concerns: The separation between “items” (for small, reusable building blocks) and “projects” (for complete solutions) is core to the design.
- Consistency: The repeated structure in every version (index.json, items, projects) makes it easier to extend and maintain templates.
- Extensibility: The design supports adding new template types (both at an “item” and “project” level) without affecting the rest of the pack.

##### Relevant Technologies and Frameworks
- Languages and frameworks represented in the templates include TypeScript, CSS in TS, React/JSX (e.g., *.tsx files), and even C# files for project templates.
- There are configuration and manifest files (e.g., manifest.ts, settings.json) which indicate integration with code-generation technologies.
- Build files like gulpfile.js point to automation in building or processing the templates.

##### Elements
– Omnia CLI/Template Engine (as an initiating component)
– Each version module (2.0.0 through 8.0.0)
– Inside each version:
▪ Items Container (with sample items like adminjourney, vuewebcomponent, etc.)
▪ Projects Container (with “web” and “worker” sub-components)
▪ Common files (index.json, manifest definitions)
– How a CLI command is processed to determine the correct version.
– How templates are then selected and used to generate a full scaffold.

## Diagram (Mermaid)

```mermaid
flowchart TD
    CLI("Omnia CLI/Template Engine"):::cli
    RootManifest("Root Manifest (src/index.json)"):::manifest
    CLI -->|"selects_version"| RootManifest

    %% Version 2.0.0 Subgraph
    subgraph "Template Pack Version 2.0.0"
        V2Folder("Version 2.0.0 Folder"):::version
        V2Manifest("Manifest (src/2.0.0/index.json)"):::manifest
        V2Folder --> V2Manifest

        subgraph "Item Templates"
            V2admin("adminjourney (src/2.0.0/items/adminjourney)"):::item
            V2git("gitignore (src/2.0.0/items/gitignore)"):::item
        end

        subgraph "Project Templates"
            V2web("web (src/2.0.0/projects/web)"):::project
            V2worker("worker (src/2.0.0/projects/worker)"):::project
        end

        V2Manifest -->|"loads"| V2admin
        V2Manifest -->|"loads"| V2git
        V2Manifest -->|"provides"| V2web
        V2Manifest -->|"provides"| V2worker
    end

    %% Version 3.0.0 Subgraph
    subgraph "Template Pack Version 3.0.0"
        V3Folder("Version 3.0.0 Folder"):::version
        V3Manifest("Manifest (src/3.0.0/index.json)"):::manifest
        V3Folder --> V3Manifest

        subgraph "Item Templates"
            V3sp("spfeature (src/3.0.0/items/spfeature)"):::item
        end

        V3Manifest -->|"loads"| V3sp
    end

    %% Version 7.0.0 Subgraph
    subgraph "Template Pack Version 7.0.0"
        V7Folder("Version 7.0.0 Folder"):::version
        V7Manifest("Manifest (src/7.0.0/index.json)"):::manifest
        V7Folder --> V7Manifest

        subgraph "Project Templates"
            V7web("web (src/7.0.0/projects/web)"):::project
            V7worker("worker (src/7.0.0/projects/worker)"):::project
        end

        V7Manifest -->|"provides"| V7web
        V7Manifest -->|"provides"| V7worker
    end

    %% Link Root Manifest to Version Folders
    RootManifest --> V2Folder
    RootManifest --> V3Folder
    RootManifest --> V7Folder

    %% Styles
    classDef cli fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef version fill:#bbdefb,stroke:#333,stroke-width:2px;
    classDef manifest fill:#fff59d,stroke:#333,stroke-width:2px;
    classDef item fill:#ffab91,stroke:#333,stroke-width:2px;
    classDef project fill:#a5d6a7,stroke:#333,stroke-width:2px;

    %% Click Events
    click RootManifest "https://github.com/omniaintranet/omniaclitemplates/blob/main/src/index.json"
    click V2Folder "https://github.com/omniaintranet/omniaclitemplates/blob/main/src/2.0.0"
    click V2Manifest "https://github.com/omniaintranet/omniaclitemplates/blob/main/src/2.0.0/index.json"
    click V2admin "https://github.com/omniaintranet/omniaclitemplates/tree/main/src/2.0.0/items/adminjourney"
    click V2git "https://github.com/omniaintranet/omniaclitemplates/tree/main/src/2.0.0/items/gitignore"
    click V2web "https://github.com/omniaintranet/omniaclitemplates/tree/main/src/2.0.0/projects/web"
    click V2worker "https://github.com/omniaintranet/omniaclitemplates/tree/main/src/2.0.0/projects/worker"
    click V3Folder "https://github.com/omniaintranet/omniaclitemplates/blob/main/src/3.0.0"
    click V3Manifest "https://github.com/omniaintranet/omniaclitemplates/blob/main/src/3.0.0/index.json"
    click V3sp "https://github.com/omniaintranet/omniaclitemplates/tree/main/src/3.0.0/items/spfeature"
    click V7Folder "https://github.com/omniaintranet/omniaclitemplates/blob/main/src/7.0.0"
    click V7Manifest "https://github.com/omniaintranet/omniaclitemplates/blob/main/src/7.0.0/index.json"
    click V7web "https://github.com/omniaintranet/omniaclitemplates/tree/main/src/7.0.0/projects/web"
    click V7worker "https://github.com/omniaintranet/omniaclitemplates/tree/main/src/7.0.0/projects/worker"
```
