Development Setup¶
Prerequisites¶
- Go 1.25+
- git
Clone and build¶
git clone https://github.com/ugiordan/architecture-analyzer.git
cd architecture-analyzer
go build -o arch-analyzer ./cmd/arch-analyzer/
Project structure¶
architecture-analyzer/
cmd/arch-analyzer/
main.go # CLI entry point with subcommands
pkg/
extractor/ # 18 architecture extractors
renderer/ # 7 diagram/report renderers
aggregator/ # Platform-wide aggregation
validator/ # CRD contract validation
parser/ # Tree-sitter Go parser
builder/ # Code property graph builder
graph/ # CPG data structure
annotator/ # Annotation engine
query/ # Query engine + taint analysis
domains/ # Pluggable domain framework
security/ # Security domain
testing/ # Testing domain
upgrade/ # Upgrade domain
arch/ # Architecture data types
linker/ # Storage linker
config/ # Configuration types
scripts/
analyze-repo.sh # Clone + analyze + cleanup wrapper
.github/workflows/
analyze-all.yml # Scheduled weekly analysis
extract-schemas.yml # CRD schema extraction
validate-contracts.yml # Contract validation on PR
testdata/ # Test fixtures
scan-config.yaml # RHOAI repos list
Running tests¶
Key test files:
pkg/extractor/extract_test.go: Extractor integration testspkg/graph/cpg_test.go: CPG data structure testspkg/parser/go_parser_test.go: Tree-sitter parser testspkg/renderer/renderer_test.go: Renderer output testspkg/query/engine_test.go: Query engine testspkg/domains/*/queries_test.go: Per-domain query tests
Testing against real repos¶
# Analyze a repo (e.g. an RHOAI component)
./arch-analyzer analyze /path/to/odh-model-controller --output-dir /tmp/analysis
# Run security scan
./arch-analyzer scan /path/to/odh-model-controller --format json --output /tmp/findings.json
Adding new functionality¶
New extractor¶
See Adding Extractors.
New renderer¶
- Create
pkg/renderer/myformat.go - Implement the renderer function reading from
ComponentArchitecture - Register in
pkg/renderer/renderer.go - Add format name to CLI
--formatsflag - Add tests
New domain¶
- Create
pkg/domains/mydomain/with analyzer, annotations, annotator, queries - Register in
main.go - Add tests for annotator and queries
New CLI command¶
- Add command definition in
cmd/arch-analyzer/main.go - Wire to appropriate pkg functions
- Add usage documentation