docs/projects/regal/architecture.md
Or "How does Regal work?"
As you might have read, Regal uses Rego for linting Rego — or rather, Rego policies turned into a JSON representation of their abstract syntax tree (AST).
When running Regal against a directory, like regal lint my-policies/, Regal does the following:
The main entrypoint for Rego rule evaluation is unsurprisingly found in
main.rego, in which we query the report
rule from the Go application.
The report rule in turn uses
dynamic policy composition to query all rules named
report under data.regal.rules[category][title] for built-in rules, and data.custom.regal.rules[category][title]
for custom rules. The violations reported from each rule is added to the report set and sent back to the application,
which will compile a final report and present it to the user.