@klok-integration/cli 0.6.245 → 0.7.269
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/assets/agents/AGENTS.datamodel.md +11 -7
- package/assets/agents/AGENTS.documentation.md +4 -0
- package/assets/agents/AGENTS.integration.md +5 -2
- package/assets/agents/AGENTS.workspace.md +22 -5
- package/assets/agents/knowledge/glossary.md +2 -1
- package/assets/agents/knowledge/platform-rules.md +10 -5
- package/assets/agents/knowledge/retired-patterns.txt +11 -0
- package/assets/agents/knowledge/roles/integration-architect.md +5 -4
- package/assets/agents/knowledge/roles/integration-developer.md +8 -7
- package/assets/agents/skills/klok-cli/SKILL.md +71 -0
- package/assets/agents/skills/klok-cli/reference.md +1174 -0
- package/assets/agents/skills/klok-datamodel/SKILL.md +19 -11
- package/assets/agents/skills/klok-docs/SKILL.md +10 -3
- package/assets/agents/skills/klok-route/SKILL.md +4 -3
- package/assets/agents/skills/klok-solution/SKILL.md +11 -4
- package/assets/agents/skills/klok-worktree/SKILL.md +4 -1
- package/dist/cli.js +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,8 +25,8 @@ variable: `KLOK_AGENT_URL`, `KLOK_TENANT`, `KLOK_DOMAIN`, `KLOK_DEV_URL`, `KLOK_
|
|
|
25
25
|
`KLOK_KEYCLOAK_CLIENT_ID`, `KLOK_GIT_URL`, `KLOK_GIT_LOCAL_WORKSPACE`, `KLOK_GIT_APIKEY`. Run
|
|
26
26
|
`klok config list` to see what is set and where it comes from.
|
|
27
27
|
|
|
28
|
-
The GitLab token can be stored with `klok config set klokApiKey
|
|
29
|
-
history
|
|
28
|
+
The GitLab token can be stored with `klok config set klokApiKey`: it asks `Enter API key:` and shows a `*` for
|
|
29
|
+
each character, so the token stays off the screen and out of the shell history. It is shown as `****` everywhere unless you run `klok config get klokApiKey --reveal`, and the file
|
|
30
30
|
is kept at mode 0600.
|
|
31
31
|
|
|
32
32
|
Credentials are written to `~/.config/klok/credentials.json` with mode 0600.
|
|
@@ -48,11 +48,14 @@ Credentials are written to `~/.config/klok/credentials.json` with mode 0600.
|
|
|
48
48
|
| `klok agents update [--check] [--global]` | Fetch what moved in the platform and tenant catalogs; `--check` writes nothing and exits 5 when something is outdated. |
|
|
49
49
|
| `klok agents status` | Per file and per catalog: current, outdated, missing or unreachable. |
|
|
50
50
|
| `klok bead list\|show\|report` | Progress beads in the current repository. |
|
|
51
|
+
| `klok docs list` | The documentation projects on docs.klok.dev you may read, by doc id. |
|
|
51
52
|
| `klok docs read <doc-id>` | Print a documentation project's `llm.txt` from docs.klok.dev, read with your GitLab token and cached. |
|
|
52
53
|
| `klok docs id [path]` | The doc id of a repository path. |
|
|
53
54
|
| `klok docs publish` | Build this repository's znai documentation and upload it to the docs portal. |
|
|
54
55
|
| `klok docs build` | Build this repository's `klok-docs/` with znai the way its documentation project will, uploading nothing. |
|
|
55
|
-
| `klok solutions
|
|
56
|
+
| `klok solutions next` | The next free solution id of the tenant, from the registry, its open merge requests and the route classes on every branch of the workspace. |
|
|
57
|
+
| `klok solutions new "<name>"` | Reserve the next solution id by a merge request in the registry, from a task worktree. |
|
|
58
|
+
| `klok solutions validate` | Check the descriptors of an integration solution registry against the descriptor contract and, in a merge request, that no solution is removed and no solution id reused or taken twice. |
|
|
56
59
|
| `klok ci env` | Show what klok-cli detected about the CI job it runs in. |
|
|
57
60
|
| `klok fleet status\|rebuild` | Every deployed service: what it was built from, whether that is the latest commit and the catalog's broker client, and which clients the broker sees; rebuild the stale ones one pipeline at a time. |
|
|
58
61
|
| `klok manifest update` | Set a container's image in a deploy manifest of your GitOps repository, then commit and push. |
|
|
@@ -8,19 +8,23 @@ dependency catalog. Read `klok docs read klok-framework-klok-common` for naming
|
|
|
8
8
|
### Rules
|
|
9
9
|
|
|
10
10
|
* One root element `<Name>_vN` that references every complex type; a single `xs:` prefix; `targetNamespace` and
|
|
11
|
-
`xmlns:tns` set; `elementFormDefault="qualified"`. Validate with
|
|
12
|
-
|
|
11
|
+
`xmlns:tns` set; `elementFormDefault="qualified"`. Validate with `klok datamodel validate` before pushing; it
|
|
12
|
+
applies the rules of the pipeline's `generate_avro_from_xsd`.
|
|
13
13
|
* One name, in kebab case, from the repository down: `customer-v1` is the repository, the XSD file
|
|
14
14
|
(`customer-v1.xsd`), the Maven artifact and the npm and Python packages, and `customer_v1` ends the Java package.
|
|
15
15
|
Inside the XSD the model keeps its PascalCase form: root element `Customer_v1`, root type and class `CustomerV1`.
|
|
16
16
|
* The major version is part of the model name; a breaking change is a new major version and a new topic, never a
|
|
17
17
|
silent change of an existing one.
|
|
18
|
-
* `
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
* `klok-datamodel-project.json` at the root is the model's metadata (name, description, class, model type,
|
|
19
|
+
`targetNamespace`, template version), rendered from `klok/environment/project-template-datamodel`; klok.dev and
|
|
20
|
+
the documentation payload read it. The pipeline takes the artifact and the Java package from the repository path
|
|
21
|
+
and the XSD file name, never from metadata.
|
|
22
|
+
* Consumers reference the artifact only through the catalog alias (`klokLibs.<key>` for tenant klok's models,
|
|
23
|
+
`tenantLibs.<key>` for another tenant's), never by literal version.
|
|
21
24
|
* Datamodel documentation lives in `klok-docs/` (purpose, fields that need explanation, producers and consumers,
|
|
22
|
-
design decisions)
|
|
23
|
-
|
|
25
|
+
design decisions); `klok-docs/README.md` says which page holds which, and is never published. The datamodel
|
|
26
|
+
pipeline's `klok_docs_publish` job sends it with the XSD to docs.klok.dev, where the model is documented from the
|
|
27
|
+
XSD (a structure page, then AI sections from the complex types up) under
|
|
24
28
|
`<tenant>/documentation/datamodel/<same path>`. Put `xs:documentation` on types and fields; that is what the
|
|
25
29
|
generated text is written from.
|
|
26
30
|
* The repository's path is its class: `public` (A), `common` (B), `domain/<d>` (C) or `system/<s>` (X). The wider
|
|
@@ -24,6 +24,10 @@ content arrives here. There are two kinds, and they are edited differently:
|
|
|
24
24
|
* The doc id must start with the tenant prefix (`<tenant>-...`); the pipeline refuses others. Do not set the
|
|
25
25
|
tenant, the Vault path or upload tokens in the project CI. This project's `.gitlab-ci.yml` is the include of
|
|
26
26
|
`klok/environment/build-ci-templates:/klok-docs-publish.yml` and nothing else; the job is `klok docs publish`.
|
|
27
|
+
* `klok-documented-project.json` at the root names the source project and the doc ids, and KlokDocumentationEgress
|
|
28
|
+
writes it. `"state": "retired"` there makes `klok docs publish` take every doc id it names (`docId`,
|
|
29
|
+
`previousDocIds`) off the portal instead of uploading; `--dry-run` lists them. Do not edit it to keep a project
|
|
30
|
+
published: its state follows the source project.
|
|
27
31
|
* Visibility follows `meta.json` `scope` (`global`, `tenant`, `domain`, `system`); a page that must not be seen by
|
|
28
32
|
another domain belongs in a project with that scope, not behind a note.
|
|
29
33
|
* Preview locally with `znai preview --source=docs`, and check what a publish would do with
|
|
@@ -18,7 +18,8 @@ needs. Read `klok docs read klok-framework-klok-quarkus-extension` before writin
|
|
|
18
18
|
|
|
19
19
|
### Rules
|
|
20
20
|
|
|
21
|
-
* Route class name = route id `<TENANTSHORT><NNN><LEG><seq>_<Description>`; one solution id per business flow
|
|
21
|
+
* Route class name = route id `<TENANTSHORT><NNN><LEG><seq>_<Description>`; one solution id per business flow, and
|
|
22
|
+
its prefix is a solution registered in `<tenant>/integration-solutions` (a new one: `klok solutions new`).
|
|
22
23
|
Configuration keys are `<RouteId>.<key>` with fallback to `<SolutionId>.<key>` and `klok.route-defaults.<key>`.
|
|
23
24
|
* Datamodels are the type parameters of the pattern class and come from the catalog bundles; never hand write DTOs
|
|
24
25
|
for something a datamodel project should own.
|
|
@@ -50,7 +51,9 @@ needs. Read `klok docs read klok-framework-klok-quarkus-extension` before writin
|
|
|
50
51
|
reached with `<RouteId>.topic.tenant-override`. Never reuse another service's credentials.
|
|
51
52
|
* `application.properties` keeps every `klok.*` key explicit; secrets come from environment variables that the
|
|
52
53
|
Vault env secret provides in Kubernetes (`KLOK_BROKER_AUTH_CLIENT_ID`, ...).
|
|
53
|
-
* Update `klok-docs/` (overview, design decisions, routes, operations) in the same merge request as the
|
|
54
|
+
* Update `klok-docs/` (overview, design decisions, routes, usage, operations) in the same merge request as the
|
|
55
|
+
change. `klok-docs/README.md` says which page answers which question and how the folder reaches docs.klok.dev;
|
|
56
|
+
it is the folder's guide and is never published.
|
|
54
57
|
* On `main` the pipeline builds the image, updates the deployment manifest and publishes the documentation payload
|
|
55
58
|
that KlokDocumentationEgress turns into the documentation project; check it.
|
|
56
59
|
* The `Dockerfile` copies `build/quarkus-app/lib/` in a `COPY` of its own before `quarkus-run.jar`, `quarkus/`
|
|
@@ -12,11 +12,19 @@ Before anything else, run `klok agents update --check`. Exit 5 means the install
|
|
|
12
12
|
run `klok agents update` and read the refreshed files. Exit 0 means they are current, and any other code names
|
|
13
13
|
what went wrong (no token, no network); say so instead of guessing.
|
|
14
14
|
|
|
15
|
+
On a workstation, `klok sync pull` then brings the workspace current before you read it: it fast-forwards every
|
|
16
|
+
canonical checkout under the workspace root, never merges or resets one, and skips `<root>/worktrees`. It is the one
|
|
17
|
+
sanctioned update of a canonical checkout. A checkout whose GitLab project moved, was archived or is gone is reported
|
|
18
|
+
with the commands that fix it, and those are the person's to run. A service never clones a repository just to read it: klok.dev and the agent
|
|
19
|
+
read through the GitLab API, docs.klok.dev and the integration context. The `klok-cli` skill says which klok command
|
|
20
|
+
does what.
|
|
21
|
+
|
|
15
22
|
The platform documentation is published at https://docs.klok.dev, one documentation project per repository, each
|
|
16
23
|
exposing its whole content as one markdown file. Read it with klok-cli, which sends your GitLab token and caches
|
|
17
|
-
the answer:
|
|
24
|
+
the answer. `klok docs list` comes first when you do not know the doc id:
|
|
18
25
|
|
|
19
26
|
```
|
|
27
|
+
klok docs list # the documentation projects you may read, by doc id
|
|
20
28
|
klok docs read <doc-id> # the markdown on stdout, one status line on stderr; --json adds fetchedAt
|
|
21
29
|
klok docs id [tenant/group/.../repo] # the doc id of a repository, this one by default
|
|
22
30
|
```
|
|
@@ -46,7 +54,7 @@ The `klok-docs` skill describes the lookup in detail. Cite the doc id you relied
|
|
|
46
54
|
|
|
47
55
|
## Tenant skills
|
|
48
56
|
|
|
49
|
-
Next to the platform skills (`klok-docs`, `klok-solution`, `klok-route`, `klok-datamodel`, `klok-release`,
|
|
57
|
+
Next to the platform skills (`klok-docs`, `klok-cli`, `klok-solution`, `klok-route`, `klok-datamodel`, `klok-release`,
|
|
50
58
|
`klok-worktree`) the skill directories hold your tenant's own skills, generated by KlokDocumentationEgress from the
|
|
51
59
|
tenant's documentation publishes and served from the tenant's private catalog. The egress reads only tenant klok's
|
|
52
60
|
publishes today, so another tenant has no tenant skills yet:
|
|
@@ -124,8 +132,9 @@ step by step procedure; the contract every agent follows is:
|
|
|
124
132
|
exists, use a new id; never delete, reset or force reuse it.
|
|
125
133
|
* Leave the canonical checkout's branch, files and uncommitted changes exactly as found. Never run `checkout`,
|
|
126
134
|
`switch`, `pull`, `reset`, `clean`, `stash`, rebase or merge in the canonical checkout or in another session's
|
|
127
|
-
worktree.
|
|
128
|
-
|
|
135
|
+
worktree. The one exception is `klok sync pull`, which only fast-forwards a canonical checkout and reports one it
|
|
136
|
+
cannot fast-forward. Dirty canonical files are not a blocker: a worktree starts from committed history and does
|
|
137
|
+
not copy uncommitted or ignored files; if the task needs them, ask for an explicit handoff.
|
|
129
138
|
* Do every edit, build and test in the task worktree, with explicit working directories or `git -C`. Recreate
|
|
130
139
|
dependencies there; do not copy or symlink `.env`, credentials, `node_modules` or build output from another
|
|
131
140
|
checkout. A worktree is not a sandbox: use isolated ports, containers and output directories where parallel
|
|
@@ -292,6 +301,11 @@ solution it belongs to, and new development and maintenance follow the same proc
|
|
|
292
301
|
* Route ids: `<TENANTSHORT><NNN><LEG><seq>_<Description>` (`KLK002I1_OdlScheduledQuery`); legs `I` ingress,
|
|
293
302
|
`P` processing, `E` egress, `A` API, `S` sub route, `T` timer. The class name is the route id, the config prefix
|
|
294
303
|
and the solution key.
|
|
304
|
+
* `<TENANTSHORT>` is the tenant's `shortname` in tenants.yml of `klok/environment/klok-environment-setup`: the first
|
|
305
|
+
three consonants of the tenant slug in upper case (`klok` KLK, `degerfors` DGR, `konvoj` KNV), decided by the
|
|
306
|
+
platform. A solution id `<TENANTSHORT><NNN>` is allocated by the merge request that adds its folder to
|
|
307
|
+
`<tenant>/integration-solutions` (`klok solutions new`) and never reused; a solution that stops running is retired
|
|
308
|
+
with `"status": "retired"`.
|
|
295
309
|
* Topics: `persistent://<tenant>[_<env>]/<domain>/<Model>[_<purpose>]`, request/reply
|
|
296
310
|
`ReqRes_<Req>_<Res>_Request|_Response`, dead letters `<topic>_DLQ`. The datamodel major version is in the class
|
|
297
311
|
name (`CustomerV1`). The purpose is optional and the publisher's: the solution requires it so that one datamodel
|
|
@@ -319,7 +333,7 @@ access, Keycloak broker clients or a service that serves several tenants.
|
|
|
319
333
|
* **Write narrow, consume wide.** A tenant publishes only in its own namespace, `<tenant>[_<env>]/<domain>`; nobody
|
|
320
334
|
holds `publish` in another tenant's namespace, not even on one topic. Reading elsewhere is a `consume` grant on a
|
|
321
335
|
named topic, approved by the owner and recorded in Git in the owning tenant. The topic keeps its own name; the
|
|
322
|
-
reader is known by its subscription (its route id, `
|
|
336
|
+
reader is known by its subscription (its route id, `DGR012E1_...`). When the content belongs to one reader, the
|
|
323
337
|
publisher may choose that reader's tenant slug as the purpose
|
|
324
338
|
(`persistent://konvoj/hr/PersonnelScheduleExportV1_degerfors`); that is the publisher's choice, not a condition
|
|
325
339
|
for reading across tenants.
|
|
@@ -384,6 +398,9 @@ Klok documentation has three levels, and a change is finished only when all thre
|
|
|
384
398
|
Write both **as the work happens**, not at the end of the branch. By the end nobody remembers why a choice was
|
|
385
399
|
made, and a guide written from memory describes the product somebody meant to build.
|
|
386
400
|
|
|
401
|
+
`klok-docs/README.md` is the folder's own guide for the people and agents who write it: a project made from a
|
|
402
|
+
Klok template has one that says which page answers which question. It is neither published nor read by Kloker.
|
|
403
|
+
|
|
387
404
|
Keep `klok-docs/` as the single copy. Do not mirror a page into a second `docs/` folder: two copies of one page
|
|
388
405
|
are two pages that quietly stop agreeing. `docs/` may hold what is genuinely not product documentation, such as
|
|
389
406
|
a strategy document that predates the code.
|
|
@@ -16,7 +16,8 @@ it as the source does.
|
|
|
16
16
|
| Domain | A business area inside a tenant. `common` is shared by the tenant's domains, `public` is open to anyone |
|
|
17
17
|
| Route, route id | One Camel route per Java class. Its id is `<TENANTSHORT><NNN><LEG><seq>_<Description>`, for example `KLK007T1_PublishKlokStandard`; the class name is the id |
|
|
18
18
|
| Leg | The letter in a route id: I ingress (onramp, brings data in), P processing, E egress (offramp, delivers data out), A API, S sub route, T timer |
|
|
19
|
-
|
|
|
19
|
+
| Tenant short name | `TENANTSHORT`, three upper case letters that start every solution and route id of a tenant: the first three consonants of the tenant's name (`KLK` for klok, `DGR` for degerfors), decided by the platform |
|
|
20
|
+
| Solution | The business flow a set of routes implements; its id is the route id's prefix, for example `KLK007`. The id is allocated once, by a merge request in the tenant's `integration-solutions` registry, and never reused; a solution is reserved, active or retired |
|
|
20
21
|
| Solution document | The `README.md` of a solution in the tenant's `integration-solutions` registry: its services, legs and flows, kept true to what is built |
|
|
21
22
|
| Correlation id | `klok-correlation-id`: follows one business flow across routes and messages |
|
|
22
23
|
| Task | Long-running work tracked by the platform (`KlokTaskV1` events, visible in klok.dev and the task API), for example an `ai.chat` task that asks Kloker for text |
|
|
@@ -29,9 +29,11 @@ documentation or the dependency catalog can give you.
|
|
|
29
29
|
## Routes and naming
|
|
30
30
|
|
|
31
31
|
* One Camel route per Java class. The route id is the class name, the configuration prefix and the solution key:
|
|
32
|
-
`<TENANTSHORT><NNN><LEG><seq>_<Description>` (`KLK002I1_OdlScheduledQuery`, `
|
|
33
|
-
* `TENANTSHORT`: the tenant short name, upper case
|
|
34
|
-
|
|
32
|
+
`<TENANTSHORT><NNN><LEG><seq>_<Description>` (`KLK002I1_OdlScheduledQuery`, `ACM001E1_FortnoxInvoiceOfframp`).
|
|
33
|
+
* `TENANTSHORT`: the tenant's short name, three upper case letters: the first three consonants of the tenant
|
|
34
|
+
slug (`klok` KLK, `degerfors` DGR, `konvoj` KNV), decided by the platform and recorded as `shortname` in
|
|
35
|
+
tenants.yml of `klok/environment/klok-environment-setup`. `NNN`: the solution number, three digits; 900–999
|
|
36
|
+
are the framework's. The solution id is `<TENANTSHORT><NNN>` (`KLK002`).
|
|
35
37
|
* Legs: `I` ingress, `P` processing, `E` egress, `A` API (REST, SOAP, MCP), `S` sub route or custom route,
|
|
36
38
|
`T` timer. `seq` numbers the routes of one leg in a solution.
|
|
37
39
|
* Every route extends exactly one pattern base class; never write a bare Camel `RouteBuilder`:
|
|
@@ -65,7 +67,10 @@ documentation or the dependency catalog can give you.
|
|
|
65
67
|
|
|
66
68
|
* Every route belongs to a solution, and every solution has a document: `README.md` and `solution.meta.json` in
|
|
67
69
|
`<tenant>/integration-solutions/solutions/<SOLUTIONID>_<slug>/`. A new solution gets its id and its document before
|
|
68
|
-
its first route
|
|
70
|
+
its first route. The id is allocated by the merge request that adds the folder (`klok solutions new`; `klok
|
|
71
|
+
solutions next` shows the next free number and why), and a number is never reused, not even a removed
|
|
72
|
+
solution's. A solution is `reserved`, `active` or `retired` (`status` in `solution.meta.json`); one that stops
|
|
73
|
+
running is retired, not deleted. A leg and sequence (`KLK002A11`) names one route.
|
|
69
74
|
* The document classifies every service the solution needs: new project, new routes in an existing project, reused
|
|
70
75
|
with a change, reused as is, client change. It maps the legs (route id, project, pattern, topics with purpose,
|
|
71
76
|
datamodels) and links each project's `klok-docs/` for the details.
|
|
@@ -87,7 +92,7 @@ documentation or the dependency catalog can give you.
|
|
|
87
92
|
several flows, the publisher sets it and the reader consumes the purpose the publisher chose. A topic name has at
|
|
88
93
|
most one purpose, never a second suffix.
|
|
89
94
|
* A reader is identified by its subscription, whose name is its route id (`<RouteId>.subscription.name` overrides
|
|
90
|
-
it), so the reading tenant's short name is in it (`
|
|
95
|
+
it), so the reading tenant's short name is in it (`DGR012E1_...`). A reader never appears in the topic name.
|
|
91
96
|
When the content belongs to one reader, the publisher may choose that reader's tenant slug as the purpose
|
|
92
97
|
(`persistent://konvoj/hr/PersonnelScheduleExportV1_degerfors`); that is the publisher's choice, not a condition
|
|
93
98
|
for reading across tenants.
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
# Route ids are <TENANTSHORT><NNN><LEG><seq>_<Description>, legs I P E A S T.
|
|
18
18
|
\bS<(NNNN|ID|SolutionID|Solution|NNN)> # old S-prefixed integration ids; use <TENANTSHORT><NNN><LEG><seq>_<Description>
|
|
19
19
|
\bS[0-9]{4}[IEP][0-9] # old S-prefixed route id such as S0001I1; use KLK002I1_... style ids
|
|
20
|
+
# Solution ids are allocated by a merge request in <tenant>/integration-solutions and never reused (2026-10-08); the
|
|
21
|
+
# tenant short name is the first three consonants of the tenant slug, shortname in tenants.yml.
|
|
22
|
+
(?i)\bsolution (number|id)s?\s+(is\s+|are\s+)?(taken\s+)?from\s+the\s+(klok\.dev|portal|klok\.dev\s+solution|portal\s+solution)\s+registry # a solution id is allocated by a merge request in <tenant>/integration-solutions (klok solutions new), never reused
|
|
23
|
+
(?i)\bid is taken from the code # a solution id is allocated by a merge request in <tenant>/integration-solutions (klok solutions new); the code on every branch only counts as used
|
|
24
|
+
(?i)\bfirst\s+(three|3)\s+letters\s+of\s+the\s+tenant # the tenant short name is the first three consonants of the tenant slug, its shortname in tenants.yml
|
|
25
|
+
(?i)\bshort\s+(name|code)s?\s+(is|are)\s+the\s+(tenant'?s?\s+)?(name'?s?\s+|slug'?s?\s+)?first\s+(three|3)\s+letters # the tenant short name is the first three consonants of the tenant slug, its shortname in tenants.yml
|
|
20
26
|
#
|
|
21
27
|
# Topics are persistent://<tenant>[_<env>]/<domain>/<Model>[_<purpose>].
|
|
22
28
|
pulsar:// # topics are persistent://<tenant>[_<env>]/<domain>/<Model>[_<purpose>]
|
|
@@ -56,3 +62,8 @@ klok-(ingress|egress)-< # integration repositories are named <tenant>-<system>-<
|
|
|
56
62
|
(^|[^<`\\])/think\b # a prompt token of an old Qwen model; the model name is the only switch (a quoted mention in a rule is fine)
|
|
57
63
|
(^|[^`])/no_think\b # a prompt token of an old Qwen model; the model name is the only switch
|
|
58
64
|
Kloker-Long # not a gateway model name; use Kloker-nothink or Kloker
|
|
65
|
+
#
|
|
66
|
+
# A datamodel's metadata is klok-datamodel-project.json, rendered from project-template-datamodel; the pipeline reads
|
|
67
|
+
# no metadata, and klok.dev does not create datamodel repositories yet (frontend-klok-dev#33, 2026-10-10).
|
|
68
|
+
(?i)meta\.json`? (uses|in) the flat form # a datamodel's metadata is klok-datamodel-project.json; *.meta.json is only klok.dev's fallback for an older repository
|
|
69
|
+
(?i)create it with klok\.dev's datamodel wizard # klok.dev's wizard edits existing models; it does not create datamodel repositories yet (frontend-klok-dev#33), they are made by hand from project-template-datamodel
|
|
@@ -13,7 +13,8 @@ name the parts, and say what is wrong when it is wrong.
|
|
|
13
13
|
1. Name the datamodel class of every payload you mention (A, B, C or X) and who reads it.
|
|
14
14
|
2. Name the legs: ingress, processing, egress, API, or a solution of several legs.
|
|
15
15
|
3. Choose one pattern base class per leg, as a design decision.
|
|
16
|
-
4. Propose the
|
|
16
|
+
4. Propose the route ids and the topic names, following the platform rules. A new solution's id is never made up:
|
|
17
|
+
it is the next free number, reserved by a merge request in the tenant's registry (`klok solutions new`).
|
|
17
18
|
5. Flag every tactical deviation with `[TACTICAL]`, its cost and its unwind condition, or say the design is
|
|
18
19
|
strategy-pure.
|
|
19
20
|
|
|
@@ -21,7 +22,7 @@ A correct answer looks like this:
|
|
|
21
22
|
|
|
22
23
|
"Visma exports invoices in its own format, a class X model. Finance and sales both read invoices, so the ingress
|
|
23
24
|
maps each invoice to the class B model `InvoiceV1` before it reaches the broker. Use `KlokOnrampRoute` as
|
|
24
|
-
`
|
|
25
|
+
`ACM001I1_VismaInvoiceOnramp`, split the nightly file into one fact event per invoice, and publish on
|
|
25
26
|
`persistent://acme/finance/InvoiceV1`. If a consumer later needs Visma's format, that mapping belongs in an egress."
|
|
26
27
|
|
|
27
28
|
A rejection names the problem and gives the broker-shaped replacement:
|
|
@@ -164,10 +165,10 @@ direct database or file share only for a system older than the team).
|
|
|
164
165
|
Imitate the density of these answers, with the user's names.
|
|
165
166
|
|
|
166
167
|
**Visma nightly invoice file.** The export is class X. Invoices are read by more than one domain, so the target is
|
|
167
|
-
the class B model `InvoiceV1`. Ingress: `KlokOnrampRoute` as `
|
|
168
|
+
the class B model `InvoiceV1`. Ingress: `KlokOnrampRoute` as `ACM001I1_VismaInvoiceOnramp`, splitting the file
|
|
168
169
|
into one fact event per invoice (a processing splitter if the mapping is heavy), published on
|
|
169
170
|
`persistent://acme/finance/InvoiceV1`. Do not publish the file as one large message unless the claim check carries
|
|
170
|
-
it and the event holds only the reference. A later Visma-shaped export is an egress, `
|
|
171
|
+
it and the event holds only the reference. A later Visma-shaped export is an egress, `ACM001E1_...`, mapping B to
|
|
171
172
|
X. Strategy-pure while each message stays small.
|
|
172
173
|
|
|
173
174
|
**A front end that wants a JSON body now.** Ingress that cannot be fire and forget: `KlokOnrampRouteSync` as a
|
|
@@ -62,7 +62,7 @@ as the CloudEvent's data.
|
|
|
62
62
|
|
|
63
63
|
```java
|
|
64
64
|
@ApplicationScoped
|
|
65
|
-
public class
|
|
65
|
+
public class ACM001I1_OrderOnramp extends KlokOnrampRoute<ShopOrder, OrderV1> {
|
|
66
66
|
@Override
|
|
67
67
|
protected String fromUri() {
|
|
68
68
|
return "platform-http:/orders";
|
|
@@ -84,7 +84,7 @@ system's reply type; the framework handles the request/reply topics and the time
|
|
|
84
84
|
|
|
85
85
|
```java
|
|
86
86
|
@ApplicationScoped
|
|
87
|
-
public class
|
|
87
|
+
public class ACM002I1_CustomerLookup
|
|
88
88
|
extends KlokOnrampRouteSync<CustomerRequest, CustomerResponse, CustomerLookupV1, CustomerV1> {
|
|
89
89
|
@Override
|
|
90
90
|
protected String fromUri() {
|
|
@@ -118,7 +118,7 @@ dead letters. Override `toUri()` and `transformBody(DOMAIN_MODEL body, Message m
|
|
|
118
118
|
|
|
119
119
|
```java
|
|
120
120
|
@ApplicationScoped
|
|
121
|
-
public class
|
|
121
|
+
public class ACM001E1_InvoiceOfframp extends KlokOfframpRoute<InvoiceV1, LegacyInvoice> {
|
|
122
122
|
@Override
|
|
123
123
|
protected String toUri() {
|
|
124
124
|
return "https://legacy-invoice-system/invoices";
|
|
@@ -198,7 +198,8 @@ blindly. `klok-mock-*` headers are for test and staging and are stripped in prod
|
|
|
198
198
|
choose between a splitter and the claim check.
|
|
199
199
|
2. **Reuse.** Before a new model, search the existing class B and C models, topics and routes, in klok.dev's
|
|
200
200
|
context and on docs.klok.dev. A new topic only for a new contract.
|
|
201
|
-
3. **Solution design.**
|
|
201
|
+
3. **Solution design.** The solution id, reserved by a merge request in `<tenant>/integration-solutions` (`klok
|
|
202
|
+
solutions new`), the legs and their route ids, the models per leg,
|
|
202
203
|
`[TACTICAL]` for any deviation, written in the solution document before the code and kept current by every change
|
|
203
204
|
of a leg (platform rules, *Solutions*).
|
|
204
205
|
4. **Design per leg.** Base class, exchange pattern, URI, authentication (a Vault path reference, never a secret),
|
|
@@ -237,11 +238,11 @@ blindly. `klok-mock-*` headers are for test and staging and are stripped in prod
|
|
|
237
238
|
|
|
238
239
|
## Worked answers
|
|
239
240
|
|
|
240
|
-
**CRM over HTTP to Visma over JMS.** `
|
|
241
|
+
**CRM over HTTP to Visma over JMS.** `ACM001I1_CrmCustomerOnramp extends KlokOnrampRoute<CrmCustomer, CustomerV1>`
|
|
241
242
|
with `fromUri` on the CRM webhook and a `transformBody` that sets `customerId`, `fullName` and `email`; it publishes
|
|
242
|
-
`persistent://acme/sales/CustomerV1`. `
|
|
243
|
+
`persistent://acme/sales/CustomerV1`. `ACM001E1_VismaCustomerOfframp extends KlokOfframpRoute<CustomerV1,
|
|
243
244
|
VismaCustomer>` with `toUri` on the JMS queue and a `transformBody` into Visma's model. Validation that is a business
|
|
244
|
-
rule is `
|
|
245
|
+
rule is `ACM001P1_CustomerValidation`, a `KlokProcessingRoute` between two topics, not extra code in the onramp.
|
|
245
246
|
|
|
246
247
|
**Synchronous lookup.** First choice: `KlokOnrampRoute` answering 202 with a task reference and a status the caller
|
|
247
248
|
can poll. If the UI must have a synchronous answer: `KlokOnrampRouteSync` as above, a timeout of 10 to 20 seconds, the
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: klok-cli
|
|
3
|
+
description: Which klok command does what on the Klok platform (klok-cli, `@klok/cli`), with the full reference of every command and option in reference.md. Use before running a klok command you have not run in this task, when a task needs the local workspace current (`klok sync pull`), a list of the documentation (`klok docs list`), an answer about the integration landscape (`klok agent ask`), or a check of the solution registry, the deployed fleet, the catalog, a CI job, a deploy manifest, a pin, a bead or a datamodel.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# The klok command line
|
|
7
|
+
|
|
8
|
+
`klok` is the Klok platform's command line tool. It reads with your GitLab token (`KLOK_GIT_APIKEY`, or `--token`)
|
|
9
|
+
and your Keycloak login (`klok login`), and every command takes `--json` for one machine-readable document on stdout.
|
|
10
|
+
This page says which command to reach for. `reference.md` next to it lists every command, option and example of this
|
|
11
|
+
CLI version, generated from the program itself; when it is missing (an installer that copies `SKILL.md` only), run
|
|
12
|
+
`klok --help` and `klok <command> --help`.
|
|
13
|
+
|
|
14
|
+
## When to use what
|
|
15
|
+
|
|
16
|
+
| You need | Run |
|
|
17
|
+
|---|---|
|
|
18
|
+
| to know the agent instructions and skills are current, at the start of a task | `klok agents update --check` (exit 5: run `klok agents update`) |
|
|
19
|
+
| the local workspace current before you read it | `klok sync pull` |
|
|
20
|
+
| a repository you can see in GitLab but do not have locally | `klok sync clone --dry-run`, then `klok sync clone` |
|
|
21
|
+
| what is dirty, unpushed or behind in the workspace, or moved, archived or gone in GitLab | `klok sync status` (`--fetch` for a current "behind") |
|
|
22
|
+
| the documentation projects you may read | `klok docs list` |
|
|
23
|
+
| one project's documentation | `klok docs read <doc-id>`; `klok docs id <tenant/group/.../repo>` derives a doc id |
|
|
24
|
+
| an answer about the integration landscape, with links | `klok agent ask "<question>"`; `--session <first task id>` for a follow-up |
|
|
25
|
+
| the impact of a datamodel change | `klok agent impact <datamodel> --change minor\|major\|remove` |
|
|
26
|
+
| the next free solution id of the tenant, with why, or a new solution's id reserved by a merge request | `klok solutions next`, `klok solutions new "<name>" --dry-run`, then without `--dry-run` |
|
|
27
|
+
| the solution registry checked against its contract, or against the code | `klok solutions validate`, `klok solutions check` |
|
|
28
|
+
| whether the deployed services run what `main` and the catalog say | `klok fleet status` |
|
|
29
|
+
| the platform catalog's agent assets or its dependents | `klok catalog publish-agents`, `klok catalog release-dependents` (both run in CI) |
|
|
30
|
+
| what a CI job is, whether a change is documentation only, where CI time goes | `klok ci env`, `klok ci docs-only`, `klok ci timings` |
|
|
31
|
+
| a pipeline's image in its deploy manifest | `klok manifest update --dry-run` (CI runs it without) |
|
|
32
|
+
| a release pinned in an infrastructure repository | `klok pin update ... --dry-run` |
|
|
33
|
+
| the beads of the current repository | `klok bead list`, `klok bead show <id>`, `klok bead report <id>` |
|
|
34
|
+
| the repository, root element and namespace a datamodel's class and name give | `klok datamodel names` |
|
|
35
|
+
| an XSD checked the way the datamodel pipeline checks it | `klok datamodel validate` |
|
|
36
|
+
| this repository's `klok-docs/` checked before the merge request | `klok docs build`, `klok docs verify` |
|
|
37
|
+
|
|
38
|
+
## The workspace
|
|
39
|
+
|
|
40
|
+
`klok sync pull` brings the workspace current before you read it: every repository under the workspace root (config
|
|
41
|
+
key `workspace`, `KLOK_GIT_LOCAL_WORKSPACE`, default `~/devklok`) is fetched and fast-forwarded (`git pull
|
|
42
|
+
--ff-only`). It never merges, rebases or resets, so a checkout with local commits or a diverged branch is reported,
|
|
43
|
+
not changed, and `<root>/worktrees` (the task worktrees) is skipped. It is the one sanctioned update of a canonical
|
|
44
|
+
checkout, made on a workstation. `pull` and `status` also ask GitLab about each checkout and report one whose project
|
|
45
|
+
moved, was archived or is gone, with the commands that fix it (`remote set-url`, `mv`, `git worktree repair`); they
|
|
46
|
+
move nothing, and those commands are the person's to run. `klok sync clone` does not clone a project that is already
|
|
47
|
+
checked out under its old path. Edits still happen in a task worktree (the `klok-worktree` skill). A service never
|
|
48
|
+
clones a repository just to read it: klok.dev and the agent read through the GitLab API, docs.klok.dev and the
|
|
49
|
+
integration context.
|
|
50
|
+
|
|
51
|
+
## Reading
|
|
52
|
+
|
|
53
|
+
`klok docs list`, then `klok docs read <doc-id>`, is how to read the platform's documentation; the `klok-docs` skill
|
|
54
|
+
has the doc ids that matter most and what a 401, 403 or 404 means. A doc id that moved with its renamed project is
|
|
55
|
+
followed to the new one, and stderr says `<old-id> moved to <new-id>`: use the new id from then on. `klok agent ask` asks Kloker, which reads the
|
|
56
|
+
solution registry, the integration context and the documentation you may read, and answers with links; it is the
|
|
57
|
+
quickest way to find which project, leg or topic handles something.
|
|
58
|
+
|
|
59
|
+
## klok.dev
|
|
60
|
+
|
|
61
|
+
The CLI is meant to do everything klok.dev does, as the person, but only part of the portal has its command yet
|
|
62
|
+
(`klok whoami`, the agent commands, `klok solutions`). When a task needs something klok.dev shows and no klok command
|
|
63
|
+
prints it, such as a broker topic's publishers and subscriptions, an ODL record or a task's events, say so and ask the
|
|
64
|
+
person to look it up in klok.dev or to send it. Do not scrape the portal, and do not reach for credentials the task
|
|
65
|
+
was not given (a service token, a secret read out of Vault) to get around the gap. `klok fleet status --broker` is an
|
|
66
|
+
operator command for the person to run, not a way in.
|
|
67
|
+
|
|
68
|
+
## Exit codes
|
|
69
|
+
|
|
70
|
+
`0` ok, `1` error, `2` a task waits for input, `3` denied by policy, `4` not authenticated, `5` outdated (instructions,
|
|
71
|
+
or a deployed service). With `--json`, the document says what happened; messages go to stderr.
|