# ecoa-puc-rio/gaide_cli architecture

> Architecture diagram of the GitHub repository ecoa-puc-rio/gaide_cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ecoa-puc-rio/gaide_cli
- Repository: https://github.com/ecoa-puc-rio/gaide_cli

## Overview

GAIDE CLI scaffolds a governed AI development environment into a project. The main workflow gathers project choices, resolves and checks module constraints, composes selected template content, then writes the project and its configuration. After installation, `gaide doctor` reports drift and exercises real gates with canaries; `gaide check` runs fail-closed enforcement, including task-profile-aware checks. The template-fetching, module, and generated-project boundaries are documented in the README. Some init internals were only partially excerpted, so uncertain orchestration links are omitted.

Main entry points: [`gaide/checks/__init__.py`](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/__init__.py) (Check dispatcher), [`gaide/init_cmd.py`](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/init_cmd.py) (Init workflow), [`gaide/doctor/__init__.py`](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/doctor/__init__.py) (Doctor command), [`gaide/cli.py`](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/cli.py) (CLI commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Project setup"]
  node_init["Init workflow<br/>[init_cmd.py]"]
  node_wizard["Setup wizard<br/>[prompts.py]"]
  node_detection["Project detection<br/>[detect.py]"]
  node_solver["Module constraints<br/>[solver.py]"]
  node_config["Project config<br/>[config.py]"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_terminal_ui["Terminal UI<br/>[ui.py]"]
end

subgraph group_template["Template composition"]
  node_template_source["Template source<br/>[template.py]"]
  node_module_catalog["Module manifests<br/>[__init__.py]"]
  node_composer["File composition<br/>[assemble.py]"]
end

subgraph group_enforcement["Runtime enforcement"]
  node_check_dispatch["Check dispatcher<br/>[__init__.py]"]
  node_gate_envelope["Fail-closed envelope<br/>[envelope.py]"]
  node_secret_check["Secret scanning<br/>[secrets.py]"]
  node_syntax_check["Syntax checks<br/>[syntax.py]"]
  node_sast_check["SAST checks<br/>[sast.py]"]
  node_sca_check["Dependency checks<br/>[sca.py]"]
  node_clean_check["Clean-state gate<br/>[clean_state.py]"]
  node_task_check["Task reference gate<br/>[task_ref.py]"]
  node_task_profiles["Task profiles<br/>[tasks.py]"]
end

subgraph group_audit["Installation audit"]
  node_doctor["Doctor command<br/>[__init__.py]"]
  node_install_report["Installation report<br/>[report.py]"]
  node_canaries["Gate canaries<br/>[canary.py]"]
end

node_developer(("Developer"))
node_project[("Generated project")]

node_developer -->|"runs"| node_cli
node_cli -->|"routes init"| node_init
node_cli -->|"routes check"| node_check_dispatch
node_cli -->|"routes doctor"| node_doctor
node_init -->|"collects answers"| node_wizard
node_wizard -->|"offers detected defaults"| node_detection
node_init -->|"checks constraints"| node_solver
node_init -->|"resolves template"| node_template_source
node_template_source -->|"loads manifests"| node_module_catalog
node_init -->|"composes files"| node_composer
node_composer -->|"writes files"| node_project
node_init -->|"records choices"| node_config
node_init -->|"shows walkthrough"| node_terminal_ui
node_check_dispatch -->|"loads settings"| node_config
node_check_dispatch -->|"resolves profile"| node_task_profiles
node_check_dispatch -->|"dispatches"| node_secret_check
node_check_dispatch -->|"dispatches"| node_syntax_check
node_check_dispatch -->|"dispatches"| node_sast_check
node_check_dispatch -->|"dispatches"| node_sca_check
node_check_dispatch -->|"dispatches"| node_clean_check
node_check_dispatch -->|"dispatches"| node_task_check
node_check_dispatch -->|"wraps result"| node_gate_envelope
node_doctor -->|"loads installation"| node_config
node_doctor -->|"resolves recorded source"| node_template_source
node_doctor -->|"builds report"| node_install_report
node_doctor -->|"runs canaries"| node_canaries
node_canaries -->|"exercises binary"| node_cli
node_install_report -->|"checks installation"| node_config

click node_init "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/init_cmd.py"
click node_wizard "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/prompts.py"
click node_detection "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/detect.py"
click node_solver "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/solver.py"
click node_config "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/config.py"
click node_template_source "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/template.py"
click node_module_catalog "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/modules/__init__.py"
click node_composer "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/assemble.py"
click node_cli "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/cli.py"
click node_check_dispatch "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/__init__.py"
click node_gate_envelope "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/envelope.py"
click node_secret_check "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/secrets.py"
click node_syntax_check "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/syntax.py"
click node_sast_check "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/sast.py"
click node_sca_check "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/sca.py"
click node_clean_check "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/clean_state.py"
click node_task_check "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/task_ref.py"
click node_task_profiles "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/tasks.py"
click node_doctor "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/doctor/__init__.py"
click node_install_report "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/doctor/report.py"
click node_canaries "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/doctor/canary.py"
click node_terminal_ui "https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/ui.py"

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_init,node_wizard,node_detection,node_solver,node_config,node_cli,node_terminal_ui toneBlue
class node_template_source,node_module_catalog,node_composer,node_project toneAmber
class node_check_dispatch,node_gate_envelope,node_secret_check,node_syntax_check,node_sast_check,node_sca_check,node_clean_check,node_task_check,node_task_profiles toneMint
class node_doctor,node_install_report,node_canaries toneRose
class node_developer toneIndigo
```

## Components

### Project setup

- [Init workflow](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/init_cmd.py): `gaide/init_cmd.py`
- [Setup wizard](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/prompts.py): `gaide/prompts.py`
- [Project detection](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/detect.py): `gaide/detect.py`
- [Module constraints](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/solver.py): `gaide/solver.py`
- [Project config](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/config.py): `gaide/config.py`
- [CLI commands](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/cli.py): `gaide/cli.py`
- [Terminal UI](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/ui.py): `gaide/ui.py`

### Template composition

- [Template source](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/template.py): `gaide/template.py`
- [Module manifests](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/modules/__init__.py): `gaide/modules/__init__.py`
- [File composition](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/assemble.py): `gaide/assemble.py`

### Runtime enforcement

- [Check dispatcher](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/__init__.py): `gaide/checks/__init__.py`
- [Fail-closed envelope](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/envelope.py): `gaide/envelope.py`
- [Secret scanning](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/secrets.py): `gaide/checks/secrets.py`
- [Syntax checks](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/syntax.py): `gaide/checks/syntax.py`
- [SAST checks](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/sast.py): `gaide/checks/sast.py`
- [Dependency checks](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/sca.py): `gaide/checks/sca.py`
- [Clean-state gate](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/clean_state.py): `gaide/checks/clean_state.py`
- [Task reference gate](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/checks/task_ref.py): `gaide/checks/task_ref.py`
- [Task profiles](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/tasks.py): `gaide/tasks.py`

### Installation audit

- [Doctor command](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/doctor/__init__.py): `gaide/doctor/__init__.py`
- [Installation report](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/doctor/report.py): `gaide/doctor/report.py`
- [Gate canaries](https://github.com/ecoa-puc-rio/gaide_cli/blob/main/gaide/doctor/canary.py): `gaide/doctor/canary.py`

### Other components

- **Developer**
- **Generated project**

## Connections

- Developer → CLI commands: runs (evidence: `README.md`)
- CLI commands → Init workflow: routes init (evidence: `gaide/cli.py`)
- CLI commands → Check dispatcher: routes check (evidence: `gaide/cli.py`)
- CLI commands → Doctor command: routes doctor (evidence: `gaide/cli.py`)
- Init workflow → Setup wizard: collects answers (evidence: `gaide/init_cmd.py`)
- Setup wizard → Project detection: offers detected defaults (evidence: `gaide/prompts.py`)
- Init workflow → Module constraints: checks constraints (evidence: `gaide/init_cmd.py`)
- Init workflow → Template source: resolves template (evidence: `README.md`)
- Template source → Module manifests: loads manifests (evidence: `gaide/template.py`)
- Init workflow → File composition: composes files (evidence: `README.md`)
- File composition → Generated project: writes files (evidence: `README.md`)
- Init workflow → Project config: records choices (evidence: `README.md`)
- Init workflow → Terminal UI: shows walkthrough (evidence: `gaide/init_cmd.py`)
- Check dispatcher → Project config: loads settings (evidence: `gaide/checks/__init__.py`)
- Check dispatcher → Task profiles: resolves profile (evidence: `gaide/checks/__init__.py`)
- Check dispatcher → Secret scanning: dispatches (evidence: `gaide/checks/__init__.py`)
- Check dispatcher → Syntax checks: dispatches (evidence: `gaide/checks/__init__.py`)
- Check dispatcher → SAST checks: dispatches (evidence: `gaide/checks/__init__.py`)
- Check dispatcher → Dependency checks: dispatches (evidence: `gaide/checks/__init__.py`)
- Check dispatcher → Clean-state gate: dispatches (evidence: `gaide/checks/__init__.py`)
- Check dispatcher → Task reference gate: dispatches (evidence: `gaide/checks/__init__.py`)
- Check dispatcher → Fail-closed envelope: wraps result (evidence: `gaide/checks/__init__.py`)
- Doctor command → Project config: loads installation (evidence: `gaide/doctor/__init__.py`)
- Doctor command → Template source: resolves recorded source (evidence: `gaide/doctor/__init__.py`)
- Doctor command → Installation report: builds report (evidence: `gaide/doctor/__init__.py`)
- Doctor command → Gate canaries: runs canaries (evidence: `gaide/doctor/__init__.py`)
- Gate canaries → CLI commands: exercises binary (evidence: `gaide/doctor/canary.py`)
- Installation report → Project config: checks installation (evidence: `gaide/doctor/report.py`)
