rego4k docs

I want to

The code on these pages

Each block of Kotlin and Rego on these pages is a part of a program in site/examples. The generator of the site reads the lines between // example <name> and // example end from the program. Below each block, a link goes to these lines on GitHub. A test runs each program and examines its result, in each build. Thus a page cannot show code that does not compile, or code that gives another result. A test of the site fails if a page of the docs has a block of Kotlin or Rego that is not from site/examples.

The programs read the policy of the guides, authz.rego. An admin can do anything, and a viewer can read:

authz.rego
package authz

default allow := false

allow if "admin" in input.user.roles

allow if {
	input.method == "GET"
	"viewer" in input.user.roles
}

reasons contains "the user is not an admin" if not "admin" in input.user.roles
authz.rego, lines 2 to 13, on GitHub

The sections

Section Content
Modules Each module: what it does, its Maven coordinates, its dependencies and its README.
Rego and its parts The engine, its parser, compiler, evaluator and cache, and how to replace or decorate each part.
Values and conversion The documents as Values, and their conversion from Kotlin data and JSON.
Queries and results allowed, eval, query, prepare and result, errors, and the trace of a query.
Builtins The sets of builtins, the three kinds, and builtins of your own.
Bundles Read, compile and write a bundle, tree shaking, and signed bundles.
Tests of Rego TestRunner, the report of opa test, JUnit, and http.send in a test.
The decision server DecisionServer, its modules, the hosted bundles and Mount.
Signed decisions and inputs Sign a decision, verify it, reproduce it, and sign an input.
The debugger The debugger alone, on your pages, and on the decision server.
The command line rego4k and the commands of opa, and a command line with your own builtins.
OPA and rego4k The capabilities of OPA as interfaces, and the differences from OPA.

The README of each module has the details of the module, for example its packages, its tests and its dependencies. Modules lists them.