# ocira-mike/trongate-cli architecture

> Architecture diagram of the GitHub repository ocira-mike/trongate-cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ocira-mike/trongate-cli
- Repository: https://github.com/ocira-mike/trongate-cli

## Overview

Tronggate CLI is a PHP command-line toolkit for working with Trongate projects. The main workflow starts at the `trongate` entry script, routes a command through the CLI, and performs a project task: inspect or check the project, generate CRUD from a database schema, install a framework edition, or start a development server. Separate commands provide help and a guided learning path. The graph includes shared console and file-generation layers. Source excerpts are partial; uncertain entry-script and installer-service connections are omitted.

Main entry points: [`cli/commands/Cli.php`](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Cli.php) (Command router), [`cli/commands/Create.php`](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Create.php) (CRUD generator), [`cli/commands/Serve.php`](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Serve.php) (Development server), [`cli/Support/FileGenerator.php`](https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/FileGenerator.php) (Safe file writer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["CLI routing"]
  node_entry["CLI entry script"]
  node_router["Command router<br/>[Cli.php]"]
  node_help["Command help<br/>[Help.php]"]
  node_logo["CLI logo<br/>[Logo.php]"]
end

subgraph group_project["Project workflows"]
  node_check["Project checks<br/>[Check.php]"]
  node_info["Project info<br/>[Info.php]"]
  node_learn["Learning guide<br/>[Learn.php]"]
  node_create["CRUD generator<br/>[Create.php]"]
  node_installer_command["Install command<br/>[Install.php]"]
  node_installer["Installer engine<br/>[Installer.php]"]
  node_completion["Setup completion<br/>[complete.php]"]
  node_serve["Development server<br/>[Serve.php]"]
end

subgraph group_support["Shared support"]
  node_generator["Safe file writer<br/>[FileGenerator.php]"]
  node_console["Console output<br/>[Console.php]"]
  node_system["System helpers<br/>[System.php]"]
end

node_developer(("Developer"))
node_project_files[("Project files")]
node_project_database[("Project database")]
node_php_server["PHP built-in server"]

node_developer -->|"runs command"| node_entry
node_entry -.->|"routes commands"| node_router
node_router -->|"checks help"| node_help
node_router -->|"dispatches install"| node_installer_command
node_router -->|"dispatches serve"| node_serve
node_router -->|"dispatches info"| node_info
node_router -->|"dispatches learn"| node_learn
node_router -->|"dispatches create"| node_create
node_router -->|"dispatches check"| node_check
node_router -->|"renders logo"| node_logo
node_installer_command -->|"runs installer"| node_installer
node_create -->|"writes generated files"| node_generator
node_create -->|"reads table schema"| node_project_database
node_generator -->|"writes module files"| node_project_files
node_installer -.->|"installs framework"| node_project_files
node_serve -->|"starts server"| node_php_server
node_serve -->|"gets worker count"| node_system
node_console -->|"checks color support"| node_system
node_generator -->|"reports writes"| node_console

click node_entry "https://github.com/ocira-mike/trongate-cli/blob/main/trongate"
click node_router "https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Cli.php"
click node_help "https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Help.php"
click node_logo "https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Logo.php"
click node_check "https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Check.php"
click node_info "https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Info.php"
click node_learn "https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Learn.php"
click node_create "https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Create.php"
click node_installer_command "https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Install.php"
click node_installer "https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/Installer/Installer.php"
click node_completion "https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/Installer/complete.php"
click node_serve "https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Serve.php"
click node_generator "https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/FileGenerator.php"
click node_console "https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/Console.php"
click node_system "https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/System.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_router,node_help,node_logo toneBlue
class node_check,node_info,node_learn,node_create,node_installer_command,node_installer,node_completion,node_serve,node_project_files,node_project_database toneAmber
class node_generator,node_console,node_system,node_php_server toneMint
class node_developer toneIndigo
```

## Components

### CLI routing

- [CLI entry script](https://github.com/ocira-mike/trongate-cli/blob/main/trongate): `trongate`
- [Command router](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Cli.php): `cli/commands/Cli.php`
- [Command help](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Help.php): `cli/commands/Help.php`
- [CLI logo](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Logo.php): `cli/commands/Logo.php`

### Project workflows

- [Project checks](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Check.php): `cli/commands/Check.php`
- [Project info](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Info.php): `cli/commands/Info.php`
- [Learning guide](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Learn.php): `cli/commands/Learn.php`
- [CRUD generator](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Create.php): `cli/commands/Create.php`
- [Install command](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Install.php): `cli/commands/Install.php`
- [Installer engine](https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/Installer/Installer.php): `cli/Support/Installer/Installer.php`
- [Setup completion](https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/Installer/complete.php): `cli/Support/Installer/complete.php`
- [Development server](https://github.com/ocira-mike/trongate-cli/blob/main/cli/commands/Serve.php): `cli/commands/Serve.php`

### Shared support

- [Safe file writer](https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/FileGenerator.php): `cli/Support/FileGenerator.php`
- [Console output](https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/Console.php): `cli/Support/Console.php`
- [System helpers](https://github.com/ocira-mike/trongate-cli/blob/main/cli/Support/System.php): `cli/Support/System.php`

### Other components

- **Developer**
- **Project files**
- **Project database**
- **PHP built-in server**

## Connections

- Developer → CLI entry script: runs command (evidence: `README.md`)
- CLI entry script → Command router: routes commands
- Command router → Command help: checks help (evidence: `cli/commands/Cli.php`)
- Command router → Install command: dispatches install (evidence: `cli/commands/Cli.php`)
- Command router → Development server: dispatches serve (evidence: `cli/commands/Cli.php`)
- Command router → Project info: dispatches info (evidence: `cli/commands/Cli.php`)
- Command router → Learning guide: dispatches learn (evidence: `cli/commands/Cli.php`)
- Command router → CRUD generator: dispatches create (evidence: `cli/commands/Cli.php`)
- Command router → Project checks: dispatches check (evidence: `cli/commands/Cli.php`)
- Command router → CLI logo: renders logo (evidence: `cli/commands/Cli.php`)
- Install command → Installer engine: runs installer (evidence: `cli/commands/Install.php`)
- CRUD generator → Safe file writer: writes generated files (evidence: `cli/commands/Create.php`)
- CRUD generator → Project database: reads table schema (evidence: `README.md`)
- Safe file writer → Project files: writes module files (evidence: `README.md`)
- Installer engine → Project files: installs framework
- Development server → PHP built-in server: starts server (evidence: `cli/commands/Serve.php`)
- Development server → System helpers: gets worker count (evidence: `cli/commands/Serve.php`)
- Console output → System helpers: checks color support (evidence: `cli/Support/Console.php`)
- Safe file writer → Console output: reports writes (evidence: `cli/Support/FileGenerator.php`)
