@klok-integration/cli 0.7.327 → 0.9.345

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.
@@ -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
  ```
@@ -757,7 +882,7 @@ Read the platform documentation on docs.klok.dev, and publish this repository’
757
882
  klok docs read [options] <doc-id>
758
883
  ```
759
884
 
760
- Print the llm.txt of a documentation project on docs.klok.dev, the one markdown file with its whole content, read with your GitLab token. Cached under ~/.cache/klok/docs with the ETag, so a second read is one conditional request; without network the cache is served with a warning. A doc id that moved (its project was renamed) is followed once to the new one, said on stderr and cached under the new id; with --json, docId is the id read, requestedDocId the one asked for and movedTo is set. With --json the document carries the content and where it came from; otherwise the content goes to stdout and one status line to stderr.
885
+ Print the llm.txt of a documentation project on docs.klok.dev, the one markdown file with its whole content, read with your GitLab token. Public documentation is read without a token too; documentation that is not public then exits 4 and says that it needs a token. Cached under ~/.cache/klok/docs with the ETag, so a second read is one conditional request; without network the cache is served with a warning. A doc id that moved (its project was renamed) is followed once to the new one, said on stderr and cached under the new id; with --json, docId is the id read, requestedDocId the one asked for and movedTo is set. With --json the document carries the content and where it came from; otherwise the content goes to stdout and one status line to stderr.
761
886
 
762
887
  | Argument | Description |
763
888
  |---|---|
@@ -775,19 +900,47 @@ Print the llm.txt of a documentation project on docs.klok.dev, the one markdown
775
900
  klok docs list [options]
776
901
  ```
777
902
 
778
- List the documentation projects on docs.klok.dev that your GitLab account may read, from the portal’s index: one line per project, its doc id (what `klok docs read` takes), title and description. With --json the document carries every field of the index.
903
+ List the documentation projects on docs.klok.dev that your GitLab account may read, from the portal’s index: one line per project, its doc id (what `klok docs read` takes), title and description. Without a token it lists the public documentation and says that a token lists more. With --json the document carries every field of the index, and anonymous: true when no token was sent.
779
904
 
780
905
  | Option | Description |
781
906
  |---|---|
782
907
  | `--token <token>` | GitLab personal access token with read_api (default: KLOK_GIT_APIKEY, then config klokApiKey) |
783
908
 
909
+ ### klok docs visibility
910
+
911
+ ```
912
+ klok docs visibility [options] [doc-ids...]
913
+ ```
914
+
915
+ Who reads each documentation project of the tenant (--tenant, else the configured one or your login’s), through klok.dev as you (`klok login`): one line per project with the level (public, global, tenant, members or admins) and whether it is the default or set; name doc ids to see only those. With --set <level> or --default it changes the named projects instead: klok.dev checks that you may and commits klok-documentation-settings.json in each documentation project, whose pipeline then publishes the documentation with the new level. Exit 3 when klok.dev refuses every failed change, 1 for any other failure.
916
+
917
+ | Argument | Description |
918
+ |---|---|
919
+ | `[doc-ids...]` | The documentation projects to show or change, by doc id (default: every project of the tenant) |
920
+
921
+ | Option | Description |
922
+ |---|---|
923
+ | `--set <level>` | Set the level of the named projects: public, global, tenant, members or admins |
924
+ | `--default` | Go back to the default of each named project (removes its klok-documentation-settings.json) |
925
+ | `--reason <text>` | Why: the body of the commit klok.dev makes |
926
+
927
+ ```
928
+ Documentation is open by default and narrowed only when someone asks for it. The level reaches docs.klok.dev when the
929
+ documentation project's pipeline has published it, not when this command returns.
930
+
931
+ Examples:
932
+ klok docs visibility
933
+ klok docs visibility klok-user-guide klok-framework-klok-common --set global --reason "Every tenant builds on these"
934
+ klok docs visibility klok-pms --default
935
+ ```
936
+
784
937
  ### klok docs id
785
938
 
786
939
  ```
787
940
  klok docs id [options] [path]
788
941
  ```
789
942
 
790
- The doc id and documentation identity of a repository path (default: this repository, from CI_PROJECT_PATH or the git remote)
943
+ The doc id and documentation identity of a repository path (default: this repository, from CI_PROJECT_PATH or the git remote): its documentation project, its owning scope and the visibility it has while its documentation project sets none
791
944
 
792
945
  | Argument | Description |
793
946
  |---|---|
@@ -852,7 +1005,7 @@ Publish this repository’s klok-docs/ to the documentation chain (projects not
852
1005
  klok docs publish [options]
853
1006
  ```
854
1007
 
855
- Build the znai project and upload it under this project’s doc id. When klok-documented-project.json at the repository root says state "retired", unpublish its docId and every previousDocIds entry instead (DELETE with the upload token; 404 counts as done) and upload nothing.
1008
+ Build the znai project and upload it under this project’s doc id. The visibility that klok-documentation-settings.json at the repository root sets (public, global, tenant, members or admins) is written into the uploaded meta.json, never into the working tree; without it the portal applies the default of the documented repository’s path, and a level that is not one fails the command before anything is built. When klok-documented-project.json at the repository root says state "retired", unpublish its docId and every previousDocIds entry instead (DELETE with the upload token; 404 counts as done) and upload nothing.
856
1009
 
857
1010
  | Option | Description |
858
1011
  |---|---|
@@ -860,7 +1013,7 @@ Build the znai project and upload it under this project’s doc id. When klok-do
860
1013
  | `--doc-id <id>` | Publish under this doc id instead of the derived one |
861
1014
  | `--repo-path <path>` | Repository path to derive from (default: CI_PROJECT_PATH or the git remote) |
862
1015
  | `--znai <path>` | The znai executable (default: znai on PATH) |
863
- | `-n, --dry-run` | Resolve what would be published and build it with znai, upload nothing; for a retired project, say what would be unpublished |
1016
+ | `-n, --dry-run` | Resolve what would be published, its visibility included, and build it with znai, upload nothing; for a retired project, say what would be unpublished |
864
1017
  | `--no-build` | With --dry-run: only resolve the plan, do not run znai |
865
1018
 
866
1019
  ## klok file-transfer
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  name: klok-docs
3
- description: Look up Klok platform documentation on docs.klok.dev with `klok docs read <doc-id>` (one markdown file per documentation project, read with your GitLab token) before designing or changing anything on the Klok integration platform. Use when a task mentions Klok, routes, datamodels, topics, the ODL, tasks, the dependency catalog, CI templates or klok.dev.
3
+ description: Look up Klok platform documentation on docs.klok.dev with `klok docs read <doc-id>` (one markdown file per documentation project, read with your GitLab token; public documentation without one) before designing or changing anything on the Klok integration platform. Use when a task mentions Klok, routes, datamodels, topics, the ODL, tasks, the dependency catalog, CI templates or klok.dev.
4
4
  ---
5
5
 
6
6
  # Reading Klok documentation
7
7
 
8
8
  The platform documentation is published on https://docs.klok.dev, one documentation project per repository. Each
9
9
  project exposes its whole content as a single markdown file, generated by znai (`/<doc-id>/llm.txt`). The portal
10
- serves it to a browser session and to a GitLab personal access token, which is what klok-cli sends:
10
+ serves it to a browser session and to a GitLab personal access token, which is what klok-cli sends. Public
11
+ documentation needs no token: without one, klok-cli reads it anonymously and says so.
11
12
 
12
13
  ```
13
14
  klok docs list # the projects you may read: doc id, title, description
@@ -18,20 +19,26 @@ klok docs id [tenant/group/.../repo] # the doc id of a repository, this one by d
18
19
  ```
19
20
 
20
21
  `klok docs list` reads the portal's index, so it is where to find the doc id of a project you do not know yet. A
21
- docs server without the index answers 404; derive the doc id with `klok docs id` instead.
22
+ docs server without the index answers 404; derive the doc id with `klok docs id` instead. Without a token the index
23
+ holds only the public documentation, and the command says that a token lists more.
22
24
 
23
25
  Read it; it is the authoritative version of the repository's `klok-docs/` plus the generated route, datamodel and
24
26
  configuration pages. Do not answer from memory when a page exists. The answer is cached under
25
27
  `~/.cache/klok/docs/` with its ETag, so reading a page twice costs one conditional request; without network the
26
28
  cached copy is served with a warning.
27
29
 
30
+ Who may read a project is its visibility (`public`, `global`, `tenant`, `members` or `admins`;
31
+ `knowledge/platform-rules.md`, *Documentation*). It is set in the documentation project's
32
+ `klok-documentation-settings.json`, and `klok docs visibility` lists it for your tenant.
33
+
28
34
  ## Doc ids
29
35
 
30
36
  The doc id is the repository path without the leading slash, with `/` replaced by `-`, lower case:
31
37
  `/klok/framework/klok-quarkus-extension` becomes `klok-framework-klok-quarkus-extension`;
32
38
  `/acme/integration/domain/finance/acme-egress-fortnox` becomes
33
- `acme-integration-domain-finance-acme-egress-fortnox`. Global documentation under `/klok/documentation/<name>`
34
- drops the `klok-` prefix of the name (`klok-integration-strategy-and-tactics`). `klok docs id` derives it.
39
+ `acme-integration-domain-finance-acme-egress-fortnox`. A standalone documentation project of tenant klok,
40
+ `/klok/documentation/<name>`, drops the `klok-` prefix of the name (`klok-integration-strategy-and-tactics`).
41
+ `klok docs id` derives it.
35
42
 
36
43
  | Need | Doc id |
37
44
  |---|---|
@@ -60,8 +67,10 @@ question is about what a project does.
60
67
  |---|---|---|
61
68
  | the content, `source: server` or `source: cache` | the page as published, or the cached copy | read it |
62
69
  | `klok docs read: <old-id> moved to <new-id>` on stderr, then the content | the project was renamed or moved; the content is the new id's | read it, cite the new id (`docId` of `--json`), and fix the link or note the old id came from |
63
- | exit 4, "No or invalid GitLab token" | no `KLOK_GIT_APIKEY` (or `--token`), or the token is not valid | say so and ask for a token with `read_api`; do not guess |
64
- | "not a member of the tenant or domain that owns …" (403) | the page exists and your GitLab account may not read it | say so and ask for access; do not guess and do not try another way in |
70
+ | exit 4, "No or invalid GitLab token" | the token sent (`KLOK_GIT_APIKEY` or `--token`) is not valid | say so and ask for a token with `read_api`; do not guess |
71
+ | exit 4, "… is not public documentation, so reading it needs a GitLab token" | no token was sent, and the project is not public | say so and ask for a token with `read_api`; do not guess |
72
+ | "not among the readers of …" (403) | the page exists and its visibility leaves your GitLab account out: another tenant's project that is not global, or one narrowed to its domain's members or to the admins | say so and ask for access, which an owner or admin of the owning tenant or domain gives; do not guess and do not try another way in |
73
+ | `klok docs list` says on stderr "This is the public documentation" | no token was sent, so the list holds the public projects only | set `KLOK_GIT_APIKEY` (`read_api`) to list what your account may read |
65
74
  | "… is not published; read the repository's klok-docs/ on main" (404) | the project has no published documentation yet | read the source pages: `git -C <repo> fetch origin && git show origin/main:klok-docs/<page>.md`; `klok-docs/toc-manifest.json` lists them. The generated pages (routes, datamodels, configuration) exist only on the portal |
66
75
  | "could not reach …" | no network, and nothing cached | say so |
67
76
 
@@ -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.