# gustavo2358/analysis-cfg architecture

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

- Interactive diagram: https://gitdiagram.com/gustavo2358/analysis-cfg
- Repository: https://github.com/gustavo2358/analysis-cfg

## Overview

Analysis CFG builds a structural control-flow graph from an Analysis IR Publication. The documented local workflow reads AIR JSON, uses the shared air-java JSON binding to obtain a Publication, builds and projects a CFG, then writes CFG JSON. Projection supports known-subset and strict policies, preserves source coverage and gaps, and represents instructions, jumps, branches, returns, and halts. The graph follows the README’s documented flow and the supplied source tree; detailed launcher and adapter call wiring was not sampled, so uncertain links are omitted. Other analysis modules in the tree are not shown as workflow stages because the README describes dataflow and possible-values analysis as not yet part of this product.

Main entry points: [`cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgBuildCoordinator.java`](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgBuildCoordinator.java) (Build coordinator), [`cfg-launcher/src/main/java/io/github/gustavo2358/analysis/cfg/launcher/AnalysisCfg.java`](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-launcher/src/main/java/io/github/gustavo2358/analysis/cfg/launcher/AnalysisCfg.java) (CFG launcher), [`cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgGraph.java`](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgGraph.java) (CFG graph), [`cfg-adapters/src/main/java/io/github/gustavo2358/analysis/cfg/adapters/AirJsonFileReader.java`](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-adapters/src/main/java/io/github/gustavo2358/analysis/cfg/adapters/AirJsonFileReader.java) (AIR file reader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_transport["JSON transport"]
  node_airfile["AIR JSON input"]
  node_airreader["AIR file reader"]
  node_airjson["Shared AirJson"]
  node_writer["CFG JSON writer<br/>[CfgJsonWriter.java]"]
  node_cfgfile["CFG JSON output"]
end

subgraph group_build["CFG build"]
  node_publication["Publication"]
  node_launcher["CFG launcher<br/>[AnalysisCfg.java]"]
  node_coordinator["Build coordinator"]
  node_preflight["CFG preflight<br/>[CfgPreflight.java]"]
  node_options["Build policy<br/>[BuildOptions.java]"]
  node_registry["Interpreter registry"]
  node_projector["Core projection"]
  node_result["Build result"]
end

subgraph group_model["CFG model"]
  node_graph["CFG graph<br/>[CfgGraph.java]"]
  node_nodes["CFG nodes<br/>[CfgNode.java]"]
  node_transitions["CFG transitions<br/>[CfgTransition.java]"]
end

node_user(("CLI caller"))

node_user -->|"invokes"| node_launcher
node_airfile -->|"reads"| node_airreader
node_airreader -->|"decodes via"| node_airjson
node_airjson -->|"produces"| node_publication
node_launcher -->|"reads input"| node_airreader
node_launcher -->|"requests build"| node_coordinator
node_coordinator -->|"validates"| node_preflight
node_coordinator -->|"applies"| node_options
node_coordinator -->|"uses"| node_registry
node_coordinator -->|"projects"| node_projector
node_projector -->|"constructs"| node_graph
node_graph -->|"contains"| node_nodes
node_graph -->|"contains"| node_transitions
node_coordinator -->|"returns"| node_result
node_launcher -->|"serializes result"| node_writer
node_writer -->|"writes"| node_cfgfile

click node_airreader "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-adapters/src/main/java/io/github/gustavo2358/analysis/cfg/adapters/AirJsonFileReader.java"
click node_launcher "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-launcher/src/main/java/io/github/gustavo2358/analysis/cfg/launcher/AnalysisCfg.java"
click node_coordinator "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgBuildCoordinator.java"
click node_preflight "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgPreflight.java"
click node_options "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/BuildOptions.java"
click node_registry "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/extension/SemanticInterpreterRegistry.java"
click node_projector "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CoreCfgProjection.java"
click node_result "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgBuildResult.java"
click node_graph "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgGraph.java"
click node_nodes "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgNode.java"
click node_transitions "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgTransition.java"
click node_writer "https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-adapters/src/main/java/io/github/gustavo2358/analysis/cfg/adapters/CfgJsonWriter.java"

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_airfile,node_airreader,node_airjson,node_writer,node_cfgfile toneBlue
class node_publication,node_launcher,node_coordinator,node_preflight,node_options,node_registry,node_projector,node_result toneAmber
class node_graph,node_nodes,node_transitions toneMint
class node_user toneIndigo
```

## Components

### JSON transport

- **AIR JSON input**
- [AIR file reader](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-adapters/src/main/java/io/github/gustavo2358/analysis/cfg/adapters/AirJsonFileReader.java): `cfg-adapters/src/main/java/io/github/gustavo2358/analysis/cfg/adapters/AirJsonFileReader.java`
- **Shared AirJson**
- [CFG JSON writer](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-adapters/src/main/java/io/github/gustavo2358/analysis/cfg/adapters/CfgJsonWriter.java): `cfg-adapters/src/main/java/io/github/gustavo2358/analysis/cfg/adapters/CfgJsonWriter.java`
- **CFG JSON output**

### CFG build

- **Publication**
- [CFG launcher](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-launcher/src/main/java/io/github/gustavo2358/analysis/cfg/launcher/AnalysisCfg.java): `cfg-launcher/src/main/java/io/github/gustavo2358/analysis/cfg/launcher/AnalysisCfg.java`
- [Build coordinator](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgBuildCoordinator.java): `cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgBuildCoordinator.java`
- [CFG preflight](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgPreflight.java): `cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgPreflight.java`
- [Build policy](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/BuildOptions.java): `cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/BuildOptions.java`
- [Interpreter registry](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/extension/SemanticInterpreterRegistry.java): `cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/extension/SemanticInterpreterRegistry.java`
- [Core projection](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CoreCfgProjection.java): `cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CoreCfgProjection.java`
- [Build result](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgBuildResult.java): `cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/application/CfgBuildResult.java`

### CFG model

- [CFG graph](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgGraph.java): `cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgGraph.java`
- [CFG nodes](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgNode.java): `cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgNode.java`
- [CFG transitions](https://github.com/gustavo2358/analysis-cfg/blob/main/cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgTransition.java): `cfg-kernel/src/main/java/io/github/gustavo2358/analysis/cfg/domain/CfgTransition.java`

### Other components

- **CLI caller**

## Connections

- CLI caller → CFG launcher: invokes
- AIR JSON input → AIR file reader: reads
- AIR file reader → Shared AirJson: decodes via
- Shared AirJson → Publication: produces
- CFG launcher → AIR file reader: reads input
- CFG launcher → Build coordinator: requests build
- Build coordinator → CFG preflight: validates
- Build coordinator → Build policy: applies
- Build coordinator → Interpreter registry: uses
- Build coordinator → Core projection: projects
- Core projection → CFG graph: constructs
- CFG graph → CFG nodes: contains
- CFG graph → CFG transitions: contains
- Build coordinator → Build result: returns
- CFG launcher → CFG JSON writer: serializes result
- CFG JSON writer → CFG JSON output: writes
