@klok-integration/cli 0.7.327 → 0.8.336

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.
@@ -80,7 +80,7 @@ it when a task touches the platform:
80
80
 
81
81
  | File | Holds |
82
82
  |---|---|
83
- | `knowledge/platform-rules.md` | the current platform rules: principles, naming, route ids and legs, topics, datamodel classes, write narrow and consume wide, claim check, tasks, the ODL |
83
+ | `knowledge/platform-rules.md` | the current platform rules: principles, naming, route ids and legs, changes and work (change requests, implementation issues, beads), topics, datamodel classes, write narrow and consume wide, claim check, tasks, the ODL |
84
84
  | `knowledge/glossary.md` | the Klok terms and what they mean |
85
85
  | `knowledge/kloker-identity.md` | Kloker's identity and writing style |
86
86
  | `knowledge/roles/` | the role handbooks of the Kloker role models |
@@ -22,7 +22,7 @@ text of its own.
22
22
  | File | What it is | Composed into |
23
23
  |---|---|---|
24
24
  | `glossary.md` | the Klok terms and their meanings, with the rule never to guess a term | the role models `Kloker-Integration-Architect` and `Kloker-Integration-Developer` |
25
- | `platform-rules.md` | the current platform rules: principles, naming, route ids and legs, topics, datamodel classes, write narrow and consume wide, claim check, tasks, the ODL | the agent runner's doctrine, the role models |
25
+ | `platform-rules.md` | the current platform rules: principles, naming, route ids and legs, solutions, changes and work (change requests, implementation issues, beads), topics, datamodel classes, write narrow and consume wide, claim check, tasks, the ODL | the agent runner's doctrine, the role models |
26
26
  | `kloker-identity.md` | who Kloker is, and the Unslop writing style | every request to the models `Kloker` and `Kloker-nothink` |
27
27
  | `roles/integration-architect.md`, `roles/integration-developer.md` | only what is specific to the role; the rules come from `platform-rules.md` | the role models `Kloker-Integration-Architect` and `Kloker-Integration-Developer` |
28
28
  | `retired-patterns.txt` | conventions the platform no longer has, one pattern per line with the reason | tests that fail when a prompt teaches a retired rule |
@@ -24,6 +24,15 @@ it as the source does.
24
24
  | 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 |
25
25
  | 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 |
26
26
  | 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 |
27
+ | Change request | A change to the integration landscape: an issue in the tenant's `integration-solutions` registry labelled `change-request`, named `<registry path>#<iid>`; its questions, design, issues, beads and merge requests link back to it |
28
+ | Question | An issue in the registry labelled `question` and linked to a change request: something a person answers, in a comment, before the change can be planned |
29
+ | Design merge request | The one merge request in the registry that designs a change request: it brings the solution document to the new steady state and adds the issue manifest |
30
+ | Issue manifest | `ISSUE_MANIFEST.json` in `solutions/<KEY>_<slug>/changes/<iid>/` of the registry: the implementation issues a change request needs, each `planned`, or `approved` by a person; issues are made from it once it is on `main` |
31
+ | Implementation issue | An issue in the project that does the work, made from an approved manifest item; it carries `solution:<KEY>`, a footer that names its change request, and a link to it |
32
+ | `kloker`, `developer` | The labels of an implementation issue that say who builds it: Kloker, bead by bead, or a developer in a capable harness. Never both |
33
+ | Bead | A file in `.beads/` of a repository that describes one small change of an implementation issue, small enough for Kloker with no judgement left (the bead sizing rules); it is done when the merge request that implements it merges |
34
+ | Harness | The program a person runs a coding agent in, such as Claude Code, Codex, Copilot or OpenCode; only in this literal sense |
35
+ | Background Kloker | The agent service's loop that follows a tenant's `kloker/policy.json` in Git: it repairs Kloker's merge requests and picks up the open beads of `kloker` issues |
27
36
  | Correlation id | `klok-correlation-id`: follows one business flow across routes and messages |
28
37
  | 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
38
  | Datamodel | A versioned data contract; the major version is in the name (`CustomerV1`). Classes: public (A), common (B) and domain (C) are XSD in a Git project of their own with generated Java, Python and TypeScript; system (X) models one external system and may be plain Java classes. All four classes may travel on the broker |
@@ -96,6 +96,52 @@ documentation or the dependency catalog can give you.
96
96
  * New development and maintenance are one process: a change to a leg brings the solution document to the new steady
97
97
  state in the same change set, and `klok solutions check` compares the documents with the code on `main`.
98
98
 
99
+ ## Changes and work
100
+
101
+ * A change to the integration landscape starts as a **change request**: an issue in `<tenant>/integration-solutions`
102
+ labelled `change-request`, `solution:<KEY>` (`solution:new` while the solution has no id) and `change:<kind>`, named
103
+ `<registry path>#<iid>` (`acme/integration-solutions#12`). Everything made for it links back to it. A question to a
104
+ person is an issue in the registry labelled `question` and linked to the change request; the answer is a comment, and
105
+ closing the question says it is answered. A comment a tool writes to say where a change stands carries
106
+ `<!-- klok:status -->`, and the planner reads past it.
107
+ * **The design is one merge request** in the registry that mentions the change request (`Refs <registry>#<iid>`). It
108
+ brings the solution document to the new steady state, where every leg the change adds is `planned` on every line
109
+ that names it, and adds the plan: `solutions/<KEY>_<slug>/changes/<iid>/ISSUE_MANIFEST.json` with one
110
+ `issues/<stableKey>.md` per implementation issue. Planning again while it is open adds to the same merge request. A
111
+ person approves an item by setting it `approved` in the manifest; issues are created only from a plan on `main`, so
112
+ merging the design is what lets them be made.
113
+ * **An implementation issue** lives in the project that does the work. It carries `solution:<KEY>`, a `relates_to` link
114
+ to the change request and to the issues it depends on, and a footer that names its change request, solution, stable
115
+ key, manifest path and dependencies. Every merge request Kloker opens carries `klok-integration-agent`; a draft whose
116
+ build never passed also `build-failed`.
117
+ * **Kloker or a developer builds an issue, never both.** Bead creation either splits the issue into beads, labels it
118
+ `kloker` and opens a merge request with the bead files, or labels it `developer` and says in a comment why it cannot
119
+ be split. A developer builds a `developer` issue in a capable harness (Claude Code, Codex, Copilot, OpenCode), and
120
+ Kloker takes no bead of it.
121
+ * **Claim before you start.** Whoever works on a bead reports it `in_progress` before the work starts and `open` again
122
+ when they let it go, and nobody starts a bead someone else holds. A bead with an open merge request is
123
+ `needs_review`.
124
+ * **A bead is done when its merge request merges.** The merge request that implements a bead sets the bead file to
125
+ `done` with a progress entry, so the merge is what makes it done. A bead file on `main` that is `done` or `cancelled`
126
+ wins over any report, and a bead whose `dependsOn` are not all done on `main` waits.
127
+ * **Two failures hand a bead to a developer.** When Kloker has failed on a bead twice since its file last changed, the
128
+ bead is reported `blocked`, its issue's label `kloker` is replaced by `developer`, and a comment says why and links
129
+ the draft merge requests. Changing the bead file gives Kloker two new attempts.
130
+ * **The close rule.** A change request is ready to close when every implementation issue linked to it is closed and the
131
+ solution document on `main` describes what is built: no leg it added is still `planned`. A person closes it.
132
+
133
+ **Bead sizing.** A bead is small enough for Kloker, a cheap model with no judgement left, or it is not a bead:
134
+
135
+ * it changes one thing in one repository;
136
+ * every decision is already named: the paths, the route id, the topics with their purpose, the datamodel and its
137
+ version, the configuration keys;
138
+ * its acceptance criteria can be checked from the build and the diff;
139
+ * it builds on its own;
140
+ * it needs no missing fact and no step only a person may take (Vault, Ansible, Keycloak, a merge);
141
+ * it is small, under a day's work for a person.
142
+
143
+ An issue that cannot be split like that is a developer's.
144
+
99
145
  ## Topics and CloudEvents
100
146
 
101
147
  * `persistent://<tenant>[_<env>]/<domain>/<Model>[_<purpose>]`. Production has no environment suffix
@@ -46,6 +46,16 @@ topic-dlq # dead letters are <topic>_DLQ
46
46
  (?i)\ba topic created in advance # every topic is listed in its tenant's Pulsar file before it is used; "in advance" is the only way
47
47
  (?i)\b(enable|turn on|switch on) (automatic|auto-?)[ -]?topic[ -]creation # the Klok broker runs with allowAutoTopicCreation=false; request the topic in klok.dev
48
48
  #
49
+ # klok.dev's work package model is retired (2026-10-29): a change request's work is implementation issues and beads in
50
+ # GitLab, linked to the change request.
51
+ (?i)\bwork[- ]packages?\b # the work package model is retired; a change request's work is implementation issues and beads in GitLab
52
+ (?i)\bTodo 360\b # the work package model is retired; a change request's work is implementation issues and beads in GitLab
53
+ # The planner loads the platform rules instead of restating the 11-step process of the old strategy chapter
54
+ # (klok-integration-agent#47); issues are linked with relates_to, and an issue is split into beads, not planned again.
55
+ (?i)\b11-step\b # the development process is described once, in the Klok user guide; a prompt loads the platform rules instead of restating a process
56
+ (?i)\bGitLab Free has no issue links\b # implementation issues are linked to their change request and their dependencies with relates_to, which every GitLab edition has
57
+ (?i)\blocal GSD\b # an implementation issue is split into beads by bead creation; there is no local planning step before it
58
+ #
49
59
  # Framework classes that do not exist in the Quarkus extension 2.0 and later.
50
60
  KlokSoapApi # removed in 2.0; SOAP is a KlokCustomRoute with camel-cxf
51
61
  KlokTenantBridgeRoute # does not exist; a KlokProcessingRoute in the reading tenant maps a granted topic
@@ -30,12 +30,23 @@ CLI version, generated from the program itself; when it is missing (an installer
30
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
31
  | a pipeline's image in its deploy manifest | `klok manifest update --dry-run` (CI runs it without) |
32
32
  | a release pinned in an infrastructure repository | `klok pin update ... --dry-run` |
33
+ | a change request with its questions, design merge requests and implementation issues, and who builds each | `klok change show <registry>#<iid>` (or the URL of an implementation issue) |
34
+ | a change request planned into its solution document and one issue manifest | `klok agent plan --change <registry>#<iid>` |
33
35
  | the beads of the current repository | `klok bead list`, `klok bead show <id>`, `klok bead report <id>` |
36
+ | a bead taken before you start, let go, or done in the merge request that implements it | `klok bead claim <id>`, `klok bead release <id>`, `klok bead done <id> --merge-request <url>` |
34
37
  | the repository, root element and namespace a datamodel's class and name give | `klok datamodel names` |
35
38
  | an XSD checked the way the datamodel pipeline checks it | `klok datamodel validate` |
36
39
  | this repository's `klok-docs/` checked before the merge request | `klok docs build`, `klok docs verify` |
37
40
  | a sealing key for a tenant's klok-file-transfer, a secret sealed for a file flow, or flows written to the ODL from Git | `klok file-transfer keygen`, `seal`, `apply --dry-run` (then without) |
38
41
 
42
+ ## Working on a change request
43
+
44
+ Who builds an implementation issue, when a bead is claimed and when it is done are in `knowledge/platform-rules.md`,
45
+ *Changes and work*, next to `KLOK-AGENTS.md`. Follow it when a task names a change request, an implementation issue
46
+ or a bead: `klok change show` reads where the change stands, `klok bead claim` takes a bead before you start (a bead
47
+ someone else holds is refused), and `klok bead done --merge-request` sets it done in the merge request that implements
48
+ it. Never take a bead of an issue labelled `developer` unless you are that developer.
49
+
39
50
  ## The workspace
40
51
 
41
52
  `klok sync pull` brings the workspace current before you read it: every repository under the workspace root (config
@@ -32,9 +32,12 @@ Examples:
32
32
  klok agent ask "Which legs consume InvoiceV1?"
33
33
  klok agent ask "..." --json | jq .task.resultSummary
34
34
  klok agent impact InvoiceV1 --change major --json
35
+ klok agent plan --change acme/integration-solutions#12
35
36
  klok agent plan KLK001 --change-request change.md
37
+ klok change show acme/integration-solutions#12
36
38
  klok agent serve
37
- klok bead report fortnox-egress-1 --status done --message "Merged MR !12"
39
+ klok bead claim issue-4-route
40
+ klok bead done issue-4-route --merge-request https://git.klok.dev/acme/r/-/merge_requests/12
38
41
  klok code # the bundled terminal agent: tools in src/klokcode/, MCP from klokcode.jsonc
39
42
  klok agents init # KLOK-AGENTS.md, harness rows, platform and tenant skills, the session hook
40
43
  klok agents update # fetch the platform and tenant catalogs, write what moved, prune by marker
@@ -186,21 +189,33 @@ Impact analysis for a node id or datamodel name
186
189
  ### klok agent plan
187
190
 
188
191
  ```
189
- klok agent plan [options] <solutionKey>
192
+ klok agent plan [options] [solutionKey]
190
193
  ```
191
194
 
192
- Plan a solution change from a change request file (or - for stdin)
195
+ Plan a change request into its solution document and one issue manifest, delivered as the design merge request (--change), or a change written in a file (--change-request)
193
196
 
194
197
  | Argument | Description |
195
198
  |---|---|
196
- | `<solutionKey>` | required |
199
+ | `[solutionKey]` | optional |
197
200
 
198
201
  | Option | Description |
199
202
  |---|---|
203
+ | `--change <ref>` | The change request, <registry path>#<iid>; its issue, comments and questions are read |
200
204
  | `--change-request <file>` | Path to the change request text, or - for stdin |
201
205
  | `--answer <questionId=text...>` | Clarification answers |
206
+ | `--git-url <url>` | GitLab base URL, to read the solution of --change (default: config gitUrl) |
207
+ | `--token <token>` | GitLab personal access token, to read the solution of --change (default: KLOK_GIT_APIKEY, then config klokApiKey) |
202
208
  | `--no-wait` | Create the task and return immediately |
203
209
 
210
+ ```
211
+ With --change, the solution is the change request's label solution:<KEY> unless [solutionKey] names it, and the plan
212
+ goes onto the change request's open design merge request when it has one.
213
+
214
+ Examples:
215
+ klok agent plan --change acme/integration-solutions#12
216
+ klok agent plan KLK001 --change-request change.md
217
+ ```
218
+
204
219
  ### klok agent implement
205
220
 
206
221
  ```
@@ -323,6 +338,80 @@ Print one bead
323
338
  |---|---|
324
339
  | `<beadId>` | required |
325
340
 
341
+ ### klok bead claim
342
+
343
+ ```
344
+ klok bead claim [options] <beadId>
345
+ ```
346
+
347
+ Take a bead before you start on it: report it in_progress to klok.dev, without changing its file
348
+
349
+ | Argument | Description |
350
+ |---|---|
351
+ | `<beadId>` | required |
352
+
353
+ | Option | Description |
354
+ |---|---|
355
+ | `--message <text>` | What you are about to do |
356
+ | `--by <name>` | Reporter name; defaults to the logged-in user |
357
+ | `--repo-path <path>` | GitLab project path, when it cannot be derived from the origin remote |
358
+ | `--force` | Claim it even though someone else holds it unfinished |
359
+
360
+ ```
361
+ The agent service refuses the claim (409) when someone else holds the bead unfinished (in_progress or needs_review)
362
+ in klok.dev; --force takes it anyway, so agree with them first.
363
+
364
+ Examples:
365
+ klok bead claim issue-4-route
366
+ klok bead claim issue-4-route --message "Mapping the currency first"
367
+ ```
368
+
369
+ ### klok bead done
370
+
371
+ ```
372
+ klok bead done [options] <beadId>
373
+ ```
374
+
375
+ Set a bead to done in its file, for the merge request that implements it, and report the merge request
376
+
377
+ | Argument | Description |
378
+ |---|---|
379
+ | `<beadId>` | required |
380
+
381
+ | Option | Description |
382
+ |---|---|
383
+ | `--merge-request <url>` | The merge request that implements the bead |
384
+ | `--message <text>` | What the merge request does |
385
+ | `--by <name>` | Reporter name; defaults to the logged-in user |
386
+ | `--repo-path <path>` | GitLab project path, when it cannot be derived from the origin remote |
387
+ | `--local-only` | Update the bead file without reporting to klok.dev |
388
+
389
+ ```
390
+ A bead is done when the merge request that implements it merges: commit the changed bead file in that merge request.
391
+ klok.dev shows the bead needs_review until then.
392
+
393
+ Examples:
394
+ klok bead done issue-4-route --merge-request https://git.klok.dev/acme/integration/domain/finance/acme-fortnox-egress/-/merge_requests/7
395
+ ```
396
+
397
+ ### klok bead release
398
+
399
+ ```
400
+ klok bead release [options] <beadId>
401
+ ```
402
+
403
+ Let a bead go: report it open to klok.dev, so someone else or Kloker can take it
404
+
405
+ | Argument | Description |
406
+ |---|---|
407
+ | `<beadId>` | required |
408
+
409
+ | Option | Description |
410
+ |---|---|
411
+ | `--message <text>` | Why you let it go |
412
+ | `--by <name>` | Reporter name; defaults to the logged-in user |
413
+ | `--repo-path <path>` | GitLab project path, when it cannot be derived from the origin remote |
414
+
326
415
  ### klok bead report
327
416
 
328
417
  ```
@@ -339,10 +428,46 @@ Append progress to a bead and report it to klok.dev
339
428
  |---|---|
340
429
  | `--status <status>` | open \| blocked \| in_progress \| needs_review \| done \| cancelled |
341
430
  | `--message <text>` | What happened |
431
+ | `--merge-request <url>` | The merge request of the work |
342
432
  | `--by <name>` | Reporter name; defaults to the logged-in user |
343
433
  | `--repo-path <path>` | GitLab project path, when it cannot be derived from the origin remote |
344
434
  | `--local-only` | Update the bead file without reporting to klok.dev |
345
435
 
436
+ ## klok change
437
+
438
+ ```
439
+ klok change [options] [command]
440
+ ```
441
+
442
+ Change requests: an issue in the solution registry, and the questions, design and issues linked to it
443
+
444
+ ### klok change show
445
+
446
+ ```
447
+ klok change show [options] <target>
448
+ ```
449
+
450
+ Print a change request, read from GitLab: its comments, questions, status, design merge requests and implementation issues with who builds each
451
+
452
+ | Argument | Description |
453
+ |---|---|
454
+ | `<target>` | required |
455
+
456
+ | Option | Description |
457
+ |---|---|
458
+ | `--git-url <url>` | GitLab base URL (default: config gitUrl) |
459
+ | `--token <token>` | GitLab personal access token with read_api (default: KLOK_GIT_APIKEY, then config klokApiKey) |
460
+
461
+ ```
462
+ <target> is the change request (<registry path>#<iid>), the URL of its issue, or the URL of an implementation issue,
463
+ whose footer names its change request.
464
+
465
+ Examples:
466
+ klok change show acme/integration-solutions#12
467
+ klok change show https://git.klok.dev/acme/integration/domain/finance/acme-fortnox-egress/-/issues/4
468
+ klok change show acme/integration-solutions#12 --json | jq '.changeRequest.implementationIssues'
469
+ ```
470
+
346
471
  ## klok agents
347
472
 
348
473
  ```
@@ -71,6 +71,15 @@ shared platform service) in `klok/integration-solutions`.
71
71
  carries `planned` in the Status column of its table row; `klok solutions check` relies on it. After the merges,
72
72
  run `klok solutions check` again.
73
73
 
74
+ ## Working on a change request
75
+
76
+ A change often arrives as a change request: an issue in `<tenant>/integration-solutions` labelled `change-request`.
77
+ How it becomes one design merge request with its plan under `changes/<iid>/`, implementation issues that Kloker or a
78
+ developer builds, and beads that are done when their merge request merges, is in `knowledge/platform-rules.md`,
79
+ *Changes and work*, next to `KLOK-AGENTS.md`. Read the change request with its comments and its linked `question`
80
+ issues before step 3, and mention it (`Refs <registry>#<iid>`) in the merge request that brings the document to the new
81
+ steady state.
82
+
74
83
  ## Maintenance is the same process
75
84
 
76
85
  * A fix or a change in one route starts at step 1: find its solution and read it before touching the code.