The plugin extracts the facts about a project's routes at build time, so that documentation and the portal's context
graph are generated from the code rather than written by hand. Everything the receivers need travels in one self
contained payload, KlokProjectDocumentationV1; no receiver ever needs access to the project's git server, which is
what lets a project hosted anywhere be documented and mapped.
initDocsGeneration
Scans the Java sources with Spoon for classes that extend a Klok pattern (dev.klok.framework.patterns.*), directly or
through base classes of the project, and writes the payload to build/klok-docs/project-documentation.json. It carries:
| Part |
Content |
project |
tenant, domain, environment (see below), repository path, commit, branch, pipeline, the documentation project and doc id derived from the repository path, and generatorVersion (see below) |
routes[] |
one entry per route: the class name (which is the route id), the parsed leg id, leg type and solution key, the pattern base class, the datamodels bound as its type arguments, the routes it calls (subRouteRefs), the broker topics it consumes and publishes (consumesTopics, publishesTopics, see below), the javadoc, referencedSourceRefs (see below) and, for a REST handler annotated @KlokMcpTool, mcpTool (MCP tools of a project) |
sources[] |
every source file once, addressed by qualified name: the routes, the framework base classes from the source jars, the datamodel classes |
dataModelDocs[] |
in a datamodel project, one entry per class of the model (see below); empty otherwise |
componentDocs[] |
the classes and packages annotated with @KlokDocs (see below) |
usedDatamodels[] |
the datamodels from jars the routes are bound to, with where each one is documented (see below) |
solutions[] |
the integration solutions the routes claim, from klok-docs/solution.meta.json, the klokDocs { solutionKey } setting or the route class names |
klokDocs[], attachments[], configKeys[] |
the project's klok-docs/ folder, the OpenAPI document (see below) and the schemas, and application.properties with credential values masked |
Tenant, domain and environment of project come from the keys the service runs with: the tenant and the domain set
in klok { } when the build sets them (anything other than the placeholders default-tenant and default-domain),
else klok.tenant and klok.domain in application.properties (a %prod. key first), else the placeholders as
before; the environment is KLOK_ENVIRONMENT, else klok.environment (the default of a ${KLOK_ENVIRONMENT:dev}
placeholder), else dev. The fields and their meaning are unchanged, so a receiver of an earlier payload reads this one
the same way.
generatorVersion names the plugin that wrote the payload, klok-gradle-plugin/<plugin version>, never the version
of the documented project (a datamodel project states that one separately, see The version the documentation states).
The plugin's build writes its own version into the resource klok-gradle-plugin-version.properties; classes run without
that resource state klok-gradle-plugin/unknown. The generator of build/klok-topics/topics.json is the same string.
The task runs in the build template's build_java_job on every pipeline and the payload is an artifact, so a broken
scan shows up in the merge request rather than after the merge.
Routes on base classes, and the routes a route calls
A route is a class that extends a pattern, and it may do so through base classes of its own: KLK002S5_OdlGetCall extends OdlSubRoute<KlokOdlGetV1, KlokOdlGetResultV1>, OdlSubRoute<REQ, RESP> extends OpensearchSubRoute,
OpensearchSubRoute extends KlokSubRoute. Until 2026-09-30 the scan accepted only a direct super class, so every route
on such a base class was missing from the documentation (all ten sub routes of klok-egress-opensearch). The scan now
follows the super classes up to the first pattern (RouteScan):
- The pattern is that class; abstract classes on the way are no routes.
dataModelRefs are the pattern's type arguments resolved down the chain: a type variable of a base class is what
the route binds it to (InvoicingBase<T> extends KlokProcessingRoute<T, InvoiceV1>, KLK001P1 extends InvoicingBase<OrderV1> gives OrderV1, InvoiceV1). A pattern without type parameters, such as KlokSubRoute, takes
the concrete type arguments of the nearest generic base class (KlokOdlGetV1, KlokOdlGetResultV1).
processingPatternRefs include the capabilities a base class implements.
subRouteRefs are the project's other routes a route calls through their direct URI. The framework derives that URI
from the class, so a class literal of another route is the link: directUriOf(KLK003S2_ChatCall.class),
subRoute(X.class), a REST operation's handler op("/{id}", KLK002A7_TaskGetHandler.class, ...). A literal in a
project class the route uses counts too, one level deep like referencedSourceRefs: every route that uses
OpenAiCompatibleClient calls the sub routes whose classes it passes to call(...). The documentation shows the
reverse on the called route's page, as used by.
The topics a route consumes and publishes
Every route carries consumesTopics[] and publishesTopics[] (since 2026-10-06; before that both were always empty and
klok.dev guessed the topics from the pattern and configKeys[], which missed a purpose set in code). The scan resolves
them the way klok-quarkus-extension does when the route starts (RouteTopics), so the names are the ones the broker
sees:
- Simple names only.
<Model>[_<purpose>] and, for a request/reply pair,
ReqRes_<Request>_<Reply>[_<purpose>]_Request and _Response, built with klok-common's KlokNamingConventions from
the simple class names of the pattern's type arguments. Tenant, environment and domain are not in the names: the
framework resolves them at run time (the platform settings, <RouteId>.topic.tenant-override, .topic.domain-override,
which a processing route and an offramp with result apply to their consumed topic only), and a receiver qualifies the
names with persistent://<tenant>[_<env>]/<domain>/. Which topic an override moves is in Broker topics of a
project.
- Data topics only. The topics the pattern consumes and publishes. What the framework adds to every route (the dead
letter queue
<topic>_DLQ, KlokCloudEventV1_events, log and task events) is not listed, and neither is a topic a
route reaches through a broker client or a task initiation of its own. klokTopics lists all of them, with full names,
access and subscriptions, from the same scan (Broker topics of a project).
What each pattern does with the broker, by the position of its type arguments:
| Pattern |
Consumes |
Publishes |
Purpose |
KlokOnrampRoute<SYS, DOMAIN>, KlokWebhookOnrampRoute<SYS, DOMAIN> |
– |
DOMAIN |
topic.purpose, topicPurpose() |
KlokChannelAdapterSourceRoute<MODEL>, KlokWebhookChannelAdapterRoute<MODEL> |
– |
MODEL |
topic.purpose, topicPurpose() |
KlokOfframpRoute<DOMAIN, SYS>, KlokChannelAdapterSinkRoute<MODEL> |
DOMAIN / MODEL |
– |
topic.purpose, topicPurpose() |
KlokOfframpRouteWithResult<DOMAIN, RESULT, SYS, SYS_REPLY> |
DOMAIN |
RESULT |
consumed: topic.purpose, topicPurpose(); result: topic.result-purpose, resultTopicPurpose(), else the consumed purpose |
KlokProcessingRoute<IN, OUT>, KlokSchemaUpgradeBridge, KlokSchemaDowngradeBridge |
IN |
OUT |
consumed: topic.purpose, incomingTopicPurpose(); published: topic.outgoing-purpose, outgoingTopicPurpose() |
KlokAsyncTaskWorkerRoute<REQ, RES> |
REQ |
RES |
consumed: topic.purpose, incomingTopicPurpose(), else taskType(); published: topic.outgoing-purpose, outgoingTopicPurpose(), else none |
KlokOnrampRouteSync<SYS, SYS_REPLY, REQ, REPLY>, KlokRestApiHandlerRoute<…, REQ, REPLY> |
ReqRes_…_Response |
ReqRes_…_Request |
topic.purpose, topicPurpose() |
the same with task.initiate=true (every request becomes a task) |
– |
REQ_<type> for each type of task.type (with header: the pair as well) |
task.type, comma separated |
KlokOfframpRouteSync<REQ, REPLY, SYS, SYS_REPLY> |
ReqRes_…_Request |
ReqRes_…_Response |
topic.purpose, topicPurpose() |
KlokCustomRoute, KlokSubRoute, KlokEnrichSubRoute, KlokRestApi |
– |
– |
no topics |
How the purpose is found, in the framework's order:
- The configuration in
src/main/resources/application.properties, with the framework's fallback chain:
<RouteId>.<key>, then <SolutionId>.<key> (KLK003.topic.purpose), then klok.route-defaults.<key>. A %prod.
variant of a key wins over the plain key, because deployed services run the prod profile; keys of other profiles, such
as %dev., are ignored. An empty value counts as not set, as in MicroProfile Config.
- The code: the nearest override of the pattern's purpose method in the route or a base class of the project (or a
default method of a project interface), including the deprecated 1.x names
producerIntention(),
incomingProducerIntention() and outgoingProducerIntention(). The method's body must be a single return of a String
literal, null, a final String constant (in the project, or a public static final one in a jar on the compile
classpath), a + of those, or a call of another such method of the route. KLK003E1_ChatWorker returns
AiTaskTypes.CHAT ("ai.chat") from taskType() and consumes KlokAiTaskRequestV1_ai.chat;
KLK007E3_AiSectionFailure returns AiTasks.TASK_TYPE from topicPurpose() and consumes
KlokTaskStatusEventV1_ai.chat.
- Otherwise none: the bare
<Model>, the framework's default (topicPurpose() returning null gives the same).
When the scan cannot know, the list is empty. A method that computes its purpose (System.getenv(...), a field that
is not final, a branch), a configured value the payload masks (a key that looks like a credential, see
configKeys[]), a value with ${...} that is only resolved at run time, a taskType() the project's classes do not
implement, or a type argument the scan cannot resolve: the topics of that direction are left empty rather than given a
name that may be wrong, and initDocsGeneration --info logs the route, the direction and the reason. A value set only
in the environment or in Vault (KLK003E1_CHATWORKER_TOPIC_PURPOSE) is not in the repository, so the scan cannot see
it; the broker shows what a running route really uses. An empty list is therefore "none or unknown", and a receiver that
needs the difference keeps its own derivation for empty lists.
Documented components and the classes a route uses
A route's own source rarely says what the classes it calls do. The route page of KLK007T1_PublishKlokStandard got an
invented sequence diagram because the scan never passed on KlokStandard. Two additions fix that (ComponentDocs):
referencedSourceRefs on every route. The project's own top level types the route's class mentions anywhere, method
bodies included (KlokStandard.get(), new OrderMapper(), a field type), in source order. One level deep: what those
classes use in turn is not followed. Other routes (they are subRouteRefs or have their own entry), the pattern base
class, JDK and jar types are left out. Their sources go into sources[], and the documentation gives them to the
route's AI prompts. This needs no annotation.
componentDocs[]. A class, record, enum, interface or package (on package-info.java) annotated with
@dev.klok.framework.common.docs.KlokDocs from klok-common. The scan matches the qualified name; the simple name
KlokDocs counts only when the file imports dev.klok.framework.common.docs.KlokDocs (or .*), so another annotation
that happens to be called KlokDocs is ignored. Each entry carries the kind, the annotation's summary and chapter,
the Javadoc, a sourceRef, one line per public member (public static KlokDocumentationConfigV1 get(); enum constants;
a record's header; for a package, its public types) and usedBy, the route ids whose class references it (for a
package: any type in it). The documentation egress renders one page per component.
Annotate central classes only: configuration or standards several routes read, shared mappers, domain logic used by
several routes. A class used by one route is already in that route's referencedSourceRefs.
| Cap |
Value |
What happens beyond it |
| components per project |
50 (ComponentDocs.MAX_COMPONENTS) |
the first 50 by qualified name are documented, with a warning in the build log |
| referenced types per route |
12 (MAX_REFERENCED_PER_ROUTE) |
the first 12 in source order |
| source size per referenced or component file |
65,536 characters (MAX_SOURCE_CHARS) |
the source is not carried: the type is left out of referencedSourceRefs, and a component keeps its Javadoc and signatures without a sourceRef |
| member signatures per component |
60 (MAX_SIGNATURES) |
the first 60 in declaration order |
With includeSources = false no source is carried, so referencedSourceRefs is empty and components have no
sourceRef. Sources are encoded with the same rules as every other entry in sources[] (PayloadFile: text of 4 KiB
or more is gzip and base64).
The datamodels a project uses, and where they are documented
A datamodel class does not say which repository it comes from: its package is derived from the repository's group, not
its name (klok/datamodel/public/klokprojectdocumentationv1 builds
dev.klok.klok.datamodel.public_.klok_project_documentation_v1), and the published POM carries no real URL
(klok-gradle-plugin#24). So the plugin writes the origin into every datamodel jar it builds, and reads it back from the
jars when it scans a project that uses the datamodel (DatamodelMetadata).
- In a DATAMODEL project,
writeKlokDatamodelMetadata writes META-INF/klok/datamodel.properties into a main
resource directory (build/generated/klok-datamodel/): artifact (group:name:version), repoPath, docsRepoPath
and docId, from the repository path the documentation uses (klokDocs.repoPath, else CI_PROJECT_PATH). A local
build outside CI writes the artifact only. The file has no timestamp, so the jar stays reproducible.
- In every other project, the scan finds the jar on the compile classpath that holds each class of the routes'
dataModelRefs and lists it in usedDatamodels[]: the class, the artifact, the origin from the metadata and usedBy,
the route ids bound to it. JDK types and the project's own classes are left out. A jar built before the metadata existed
gives the class and its artifact (read from where Gradle or Maven keeps the jar) without a documentation link; the next
release of the datamodel carries it.
KlokDocumentationEgress links each datamodel on the route pages to its documentation, and lists the project and its
routes on the datamodel's own documentation.
The OpenAPI document
A service with REST operations is documented from its OpenAPI document. The Quarkus extension puts every KlokRestApi
into the document SmallRye OpenAPI builds at build time (klok-quarkus-extension, The OpenAPI document), JAX-RS
resources are in it anyway, and the plugin sets the Quarkus build property
quarkus.smallrye-openapi.store-schema-directory to build/klok-docs/openapi/ whenever the io.quarkus plugin is
applied, so quarkusBuild writes openapi.json and openapi.yaml there. The directory is below build/klok-docs/,
which the build template already hands from build_java_job to klok_docs_publish, so the scan in the documentation
job finds it without a change to the template. A value the project sets in its own quarkus { } block wins.
The scan attaches the first OpenAPI document it finds, with kind openapi: klokDocs.openApiSpec when it is set, else
build/klok-docs/openapi/openapi.json, build/openapi/openapi.{json,yaml,yml}, src/main/resources/META-INF/openapi.*
and openapi/openapi.*. A JSON document without paths is skipped, because Quarkus stores one for every service: a
service without REST operations has no REST API to document. KlokDocumentationEgress renders every operation with znai's
include-open-api.
Datamodel projects
A project with projectType = DATAMODEL has no routes; the model is what it documents. Its Java project is generated
from the XSD by the datamodel pipeline into generated-java-projects/<name>/ inside the repository, so two things
differ from an integration project:
- The payload describes the repository.
klok-docs/, the README, the schemas (schema-definition-xsd/,
schema-definition-avro/) and the metadata files (klok-datamodel-project.json, klok-template.json) are read from
the repository root: the nearest directory above the project that holds .git. A project not inside a git checkout
falls back to its own directory. tasks.named('publishKlokDocs') { projectDir.set(...) } overrides it.
- Every class of the model is a
dataModelDocs[] entry: name, qualified name, the Javadoc the generator wrote from
the schema's xs:documentation as description, the project version and its major, the scope and the domain or system
from the repository path (common, public, domain/<d>, system/<s>), the Maven coordinates group:name:version
and a sourceRef into sources[]. Enumerations travel in sources[] only; they are the types of fields, not models of
their own. KlokDocumentationEgress builds its DATAMODELS chapter from these entries, one page per class with its fields.
projectType is DATAMODEL in the payload, and the documentation topic, the credentials and the fail soft rules are
those of publishKlokDocs below. The datamodel CI template runs publishKlokDocs in the generated project on main,
after the release, in its klok_docs_publish job (build-ci-templates, build-template-datamodel.yml). By hand, after
generating the Java project:
gradle --project-dir generated-java-projects/<name> initDocsGeneration # writes build/klok-docs/project-documentation.json
The version the documentation states
A datamodel page shows a version and the Maven coordinates a consumer copies, so they have to be ones that were
published. Every Gradle run computes a version of its own from majorVersion, minorVersion, patchVersion and the
build timestamp, and a documentation job that runs after the release job is a run of its own: on 2026-10-01 klok-ai-v1
released 1.0.0-build.261001185344 and its documentation, written a minute later, stated 1.0.0-build.261001185424,
which does not exist. klokDocs.versionFrom says where the stated version comes from:
| versionFrom |
The version stated |
For |
build (default) |
this run's own version |
a build that documents what it builds itself |
release |
the version in build/klok-release.properties as an earlier run left it, when the file is about this group:name. A release writes the file; this run writes it again with its own version, so the plugin reads it first |
a documentation job after a release job that hands over the generated project with its build/klok-release.properties |
catalog |
the version a version catalog of the build holds for this group:name; after updateKlokLibsToml, the newest release |
documenting a change that releases nothing, such as a change to klok-docs/ only |
KLOK_DOCS_VERSION_FROM sets it when the build script does not, so a CI job chooses without touching the generated
project. When the source has no version for the project (no release file, a model no catalog lists yet), the payload
states no version and no coordinates, with a warning, rather than one that was never published. The log line The documentation states version … instead of this build's … shows which one was used.
gradle --project-dir generated-java-projects/<name> updateKlokLibsToml
KLOK_DOCS_VERSION_FROM=catalog gradle --project-dir generated-java-projects/<name> initDocsGeneration
The two runs are separate because Gradle reads the catalog copy when it reads the settings, before any task runs: a
refresh takes effect in the next run.
publishKlokDocs
The same scan, published: the payload is wrapped in the KlokProjectDocumentationV1 CloudEvent (type
dev.klok.documentation.project.prepared) and sent with klok-brokerclient-java to the documentation topic in the
documented repository's own tenant
persistent://<tenant>[_<KLOK_DOCS_ENVIRONMENT>]/common/KlokProjectDocumentationV1_prepared
where KlokDocumentationEgress (klok/integration/klok-documentation-egress) picks it up, generates the project's
documentation and writes it to the project's documentation project. <tenant> is the root group of the documented
repository. Documentation is a shared platform service, and the rule is write narrow, consume wide: a tenant writes
only in its own namespace, the tenant's CI client is granted publish on this one topic, and the documentation service is
granted consume on it. The namespace names the writer, so the egress takes the tenant from it and rejects a payload
whose repository belongs to another (framework development guide, Broker Access And Tenant Isolation). A build has no
deployment environment, so the topic is production's unless KLOK_DOCS_ENVIRONMENT names another installation;
KLOK_ENVIRONMENT, which says where a service runs, plays no part. The name is built with
KlokNamingConventions.fullTopicName, the same rule the egress subscribes with; klokDocs.topic overrides it only for
a build that talks to another installation.
| Setting |
Source |
When it is missing |
| broker |
klok.brokerUrl (KLOK_BROKER_SERVICE_URL) |
the default broker |
| credentials |
KLOK_BROKER_AUTH_CLIENT_ID, KLOK_BROKER_AUTH_CLIENT_SECRET (plus _URL, _AUDIENCE) |
a publish error; nothing is sent |
| platform installation |
KLOK_DOCS_ENVIRONMENT |
production (persistent://klok/...) |
| topic |
klokDocs.topic |
derived as above |
| size |
klokDocs.maxInlinePayloadBytes, default 3 MiB (3,145,728 bytes) |
— |
| claim check store, above that size |
KLOK_BLOBSTORE_ENDPOINT, KLOK_BLOBSTORE_ACCESS_KEY, KLOK_BLOBSTORE_SECRET_KEY (plus _BUCKET, _REGION) |
a payload over the size is not sent, as a publish error; one under it is sent inline as before |
In CI the credentials come from secret/<tenant>/common/repo/cicd-environment-variables, which
login-vault-and-prepare-env.sh exports into the job; until a person has added the fields there, the publish only
warns. The log says whether each secret is set and shows nothing of it.
A payload over maxInlinePayloadBytes goes as a claim check (klok-gradle-plugin#13); sending it inline would only move
the failure to the broker's message size limit:
- The whole payload, the JSON
build/klok-docs/project-documentation.json holds, is stored with the broker client's
KlokClaimCheckStore in the tenant's claim check bucket (klok-<tenant>-claimcheck, RustFS), under its content address
tmp/<tenant>/common/<sha256>, which expires after seven days.
- The event carries the project block,
payloadSizeBytes and payloadSha256, and claimCheck: bucket, key, scope, the
sha256 and size of the stored bytes, application/json, encoding NONE and the klokcc:// reference. Every collection
is empty, as the datamodel's XSD describes a large payload. KlokDocumentationEgress reads the object back and checks it
before it builds anything, so the documentation project is the same as from an inline payload.
- The log names the reference (
stored as the claim check klokcc://…). Without the store's settings, or when the store
refuses, the payload is not sent and the task says which, as a publish error.
- The output file and
publishKlokContext, which posts it to klok.dev over HTTP, keep the whole payload: klok.dev's limit
is not the broker's.
klok docs send (klok-cli) sends a project without the plugin the same way.
A publish error is a warning unless klokDocs.failOnPublishError = true, or the environment variable
KLOK_DOCS_FAIL_ON_PUBLISH_ERROR=true when the build script does not set it: documentation must never fail a customer's
build. The integration CI template sets the variable in klok_docs_publish, a job that is allowed to fail, so a publish
that did not happen shows as a job with a warning instead of a green one, and the build still passes.
publishKlokContext
Posts the payload the scan wrote to the integration context graph on klok.dev (POST <KLOK_DEV_URL>/api/integration-context/documentation), where it becomes projects, solutions, legs, files, datamodels,
the topics derived from the pattern and the naming convention, and citable documents. The task never scans on its own;
it reads build/klok-docs/project-documentation.json, so ./gradlew publishKlokDocs publishKlokContext scans once,
publishes once and posts once. That one line is the whole klok_docs_publish job of the build template: the logic lives
here, not in the pipeline, so the same publish works from a developer's shell and from any other CI system.
| Setting |
Source |
Default |
| portal URL |
KLOK_DEV_URL, else klokDocs.contextUrl |
https://klok.dev |
| ingest token |
KLOK_INTEGRATION_CONTEXT_TOKEN (from the CI environment secret in Vault) |
none: a publish error, so a warning, or a failure when failOnPublishError is on |
| enabled |
klokDocs.enabled && klokDocs.publishContext, and KLOK_CONTEXT_ENABLED is not false |
on |
| on error |
klokDocs.failOnPublishError, else KLOK_DOCS_FAIL_ON_PUBLISH_ERROR |
warn, never fail the build |
The portal answers 202 with an ingest run summary (ingestRunId, nodes, edges and documents upserted), which the task
prints. A refused payload (wrong token, tenant outside the token's scope) or an unreachable portal is reported the same
soft way as a broker publish error.
Bundles the shared Klok knowledge (the glossary, the platform rules, Kloker's identity, the role handbooks) into the
service, so it composes AI system prompts from one source instead of restating the rules by hand. The blocks are written
once in klok-integration-agent packages/cli/assets/agents/knowledge/ and reach the dependency catalog as
agents/knowledge/** in klok-agents.zip, the zip updateKlokAgents installs from. At run time the service reads them
with dev.klok.framework.common.knowledge.KlokKnowledge from klok-common.
| Step |
What happens |
fetchKlokAgentsZip |
Refreshes ~/.gradle/caches/klok-agents/catalog/klok-agents.zip, the same download and cache as updateKlokAgents. The default is the catalog's raw file API, read without a token because the catalog is public; a klokAgentsZipUrl of your own gets klokGitAuthToken / CI_JOB_TOKEN. Next to the zip, klok-agents.properties records the catalog commit (the commit that last changed the zip, GitLab's X-Gitlab-Last-Commit-Id; else the tip it was served from, X-Gitlab-Commit-Id; else unknown), the url and fetchedAt. The zip is only replaced when its content changed, and the record also when the server names another commit for it. |
extractKlokKnowledge |
Unpacks agents/knowledge/** into build/generated/klok-knowledge/klok-knowledge/ and writes klok-knowledge.properties there: commit, fetchedAt and blocks, the index of every .md except README.md, without .md. |
processResources |
Copies them into the jar as /klok-knowledge/.... The output directory is a main resource directory, so processResources runs extractKlokKnowledge first. |
Who gets it. A project asks for it with klokKnowledge=true in gradle.properties (or -PklokKnowledge=true, or
KLOK_KNOWLEDGE), and nothing else turns it on: every project that applies the plugin has the tasks, and a project that
does not ask neither fetches the zip nor bundles it. A project that asks is listed, with the blocks it loads, in
knowledge/consumers.json in klok-integration-agent, which is the list the catalog carries in the same zip. The
integration build template needs no change: quarkusBuild runs processResources.
Up to date and cacheable. The inputs are the cached zip and its record, the project path (klokDocs.repoPath, else
CI_PROJECT_PATH) and whether this is CI, and the output only changes when the knowledge does, so an unchanged catalog
costs one HTTP request and no rebuild of the jar. The task is @CacheableTask. fetchKlokAgentsZip always runs and
logs [KlokPlugin] klok-agents.zip at catalog commit <commit>, so the build log names the commit even when the
extraction comes from the build cache.
In CI the build is the gate. The integration build runs no tests, and a service that starts without a block it loads
is an outage, so extractKlokKnowledge fails a CI build (CI=true) that asks for the knowledge when:
| Finding |
What to do |
| There is no cached zip and the download failed |
run the pipeline again once GitLab answers |
The zip has no knowledge/ |
the catalog lost it; look at the latest chore(catalog): update klok-agents commit |
The project is not in consumers.json |
add it, with its blocks, in klok-integration-agent, or remove klokKnowledge=true |
consumers.json lists a block the zip does not have |
a block was renamed or removed: change the service in the same piece of work |
A zip without consumers.json has nothing to check against, so it warns and bundles, in CI too. A consumers.json that
cannot be read is a finding like the ones above.
On a laptop these are warnings. With --offline or a failed download the build goes on with the cached zip and
names its commit; without one, or with a project that is not listed, it warns, because a developer may be offline or
building against another copy of the text. A build there that cannot tell which repository it is (no
klokDocs.repoPath) checks nothing. The service then builds, and only a KlokKnowledge.get(name) call fails, with a
message that names the block and ./gradlew extractKlokKnowledge.
Working on the knowledge itself. -PklokAgentsAssetsDir=<checkout>/packages/cli/assets/agents takes the blocks from
a local checkout instead (commit=local) and skips the download.
Never edit the generated files; change the source in klok-integration-agent. A knowledge update reaches a service
through its next main build.
Conventions the scan relies on
- One route per class, class name = route id (
<TENANT><NNN><LEG><seq>_<Description>).
- Datamodels are the type parameters of the pattern class, bound by the route or by a base class of the project; a route
that hides them behind a raw type is not documented.
- A route is called through its direct URI, which the framework derives from the class, so the scan links routes by class
literal (
directUriOf(X.class), subRoute(X.class), a REST handler); a URI written as a string is not linked.
- A topic's purpose is configured in
application.properties or returned as a literal or constant by the pattern's
purpose method; a purpose computed at run time leaves the route's topics in that direction empty.