How gemaraproj/gemara works
Gemara is a CUE-based model for representing governance, risk, and security data, with a Go CLI that projects schemas to OpenAPI and checks schema changes for backward compatibility. The main user workflow is to run the CLI against the CUE package, generate and normalize an OpenAPI document, then optionally write a source manifest. The CUE files define the model’s catalogs, policies, mappings, and logs. The excerpts show CLI orchestration and projection internals; relationships among individual schema definitions are not established, so they are shown without invented links.
Main entry points: projection/cmd.go Projection command · converter.go Converter lifecycle · diff/cmd.go Breaking check command · root.go Command root
Components 30
CUE Data Model
- CUE package
- Audit log
auditlog.cue - Capability catalog
capabilitycatalog.cue - Collections
collections.cue - Control catalog
controlcatalog.cue - Enforcement log
enforcementlog.cue - Entities
entities.cue - Evaluation log
evaluationlog.cue - Guidance catalog
guidancecatalog.cue - Lexicon
lexicon.cue - Inline mapping
mapping_inline.cue - Mapping document
mappingdocument.cue - Metadata
metadata.cue - Policy
policy.cue - Principle catalog
principlecatalog.cue - Risk catalog
riskcatalog.cue - Threat catalog
threatcatalog.cue - Vector catalog
vectorcatalog.cue
OpenAPI Projection
- Projection command
cmd/internal/cmd/projection/cmd.go - Converter lifecycle
cmd/internal/cmd/projection/converter.go - CUE preparation
cmd/internal/cmd/projection/prep.go - Schema annotations
cmd/internal/cmd/projection/annotate.go - OpenAPI generation
cmd/internal/cmd/projection/generate.go - OpenAPI normalization
cmd/internal/cmd/projection/post.go - Projection options
cmd/internal/cmd/projection/options.go
Compatibility Checks
- Breaking check command
cmd/internal/cmd/diff/cmd.go - Compatibility analysis
cmd/internal/cmd/diff/breaking.go
CLI Runtime
- Program entry
cmd/main.go - Command root
cmd/internal/cmd/root.go
Other components
- CLI user
Connections 13
- CLI user → Program entry: runs
README.md - Program entry → Command root: executes
cmd/main.go - Command root → Projection command: registers
cmd/internal/cmd/root.go - Command root → Breaking check command: registers
cmd/internal/cmd/root.go - Projection command → Converter lifecycle: configures and runs
cmd/internal/cmd/projection/cmd.go - Converter lifecycle → OpenAPI generation: generates document
cmd/internal/cmd/projection/converter.go - Projection command → CUE preparation: prepares package
cmd/internal/cmd/projection/cmd.go - Projection command → OpenAPI normalization: normalizes output
cmd/internal/cmd/projection/cmd.go - Converter lifecycle → OpenAPI normalization: postprocesses
- Converter lifecycle → Schema annotations: uses metadata
- Projection command → Projection options: sets options
cmd/internal/cmd/projection/cmd.go - Breaking check command → Converter lifecycle: generates candidate
cmd/internal/cmd/diff/cmd.go - Breaking check command → Compatibility analysis: checks changes