@klok-integration/cli 0.3.1 → 0.3.3

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.
@@ -15,5 +15,5 @@ https://docs.klok.dev/klok-environment-build-ci-templates/llm.txt (docs sync) fo
15
15
  `klok/environment/build-ci-templates:/klok-docs-publish.yml` and nothing else; the job is `klok docs publish`.
16
16
  * Visibility follows `meta.json` `scope` (`global`, `tenant`, `domain`, `system`); a page that must not be seen by
17
17
  another domain belongs in a project with that scope, not behind a note.
18
- * Preview locally with `znai --source-root docs --preview`, and check what a publish would do with
18
+ * Preview locally with `znai preview --source=docs`, and check what a publish would do with
19
19
  `klok docs publish --dry-run`; the `llm.txt` the build generates is what agents read.
@@ -111,8 +111,10 @@ step by step procedure; the contract every agent follows is:
111
111
  tenant with the right to create projects in the domain. That is the supported path and it provisions what the
112
112
  project needs to build. Creating a project by hand is a legitimate fallback under *Git är sanningen*, but it is
113
113
  not the normal path: say up front what a human will still have to do, rather than letting it surface as a red
114
- pipeline. Today that always includes the Vault CI role `<tenant>-ci-project-<gitlab id>`, which needs both
115
- `default` and the tenant CI read policy; see `klok/application/frontend-klok-dev` issue #7.
114
+ pipeline. Vault needs nothing per project: the tenant CI role `<tenant>-ci` accepts every project under the
115
+ tenant's root group. A tenant without it fails every job at `auth/jwt/login` with
116
+ `role "<tenant>-ci" could not be found`; setting a tenant up is described in `klok-docs/ci/tenant-onboarding.md`
117
+ of `klok/environment/build-ci-templates`.
116
118
  * Never push to `main` of an existing repository, never force push, never merge. Work on a branch and open a
117
119
  merge request that is ready for review; only a brand new repository gets its first commit on `main`. A draft
118
120
  merge request is not the default, it is what you open when the work is knowingly unfinished, and you say why.
@@ -152,8 +154,9 @@ step by step procedure; the contract every agent follows is:
152
154
 
153
155
  Klok documentation has three levels, and a change is finished only when all three have been considered:
154
156
 
155
- * **The repository's own `klok-docs/`** (znai markdown, `toc-manifest.json`), which the CI mirrors into the
156
- repository's documentation project. A change that adds or alters a route, a datamodel, a configuration key, a
157
+ * **The repository's own `klok-docs/`** (znai markdown, `toc-manifest.json`), which KlokDocumentationEgress merges
158
+ with the pages it generates from the code into the repository's documentation project on every `main` pipeline.
159
+ That documentation project is output: never edit it; what is generated is set by tenant admins in klok.dev. A change that adds or alters a route, a datamodel, a configuration key, a
157
160
  CI job, a command or a decision updates `klok-docs/` in the same merge request.
158
161
 
159
162
  `klok-docs/` has to answer **two different questions**, and a repository that answers only the first is not
@@ -198,12 +201,11 @@ Klok documentation has three levels, and a change is finished only when all thre
198
201
  ### After the merge
199
202
 
200
203
  The pipeline on `main` publishes the project's documentation payload (`KlokProjectDocumentationV1`: routes,
201
- sources, configuration keys and the whole `klok-docs/` folder with a hash per file). A documentation flow that
202
- reads that payload together with the merge request description and the diff, and proposes the central updates as
203
- merge requests for a human to review, is being built; until it runs, nothing behind you looks at the central
204
- documentation. Either way the steps above are the ones that matter: an author who knows what changed writes
205
- better documentation than a flow that reads the diff afterwards, and a proposal is a safety net for what was
206
- missed, never a reason to skip writing it.
204
+ sources, configuration keys and the whole `klok-docs/` folder with a hash per file). KlokDocumentationEgress
205
+ (`klok/integration/klok-documentation-egress`) turns it into the project's published documentation: your
206
+ `klok-docs/` pages as written, with `KLOK:GENERATED` regions filled, next to generated pages for routes,
207
+ datamodels and configuration. Nothing behind you updates the central platform documentation, so the steps above
208
+ are the ones that matter.
207
209
 
208
210
  ## How to work
209
211
 
@@ -26,9 +26,9 @@ https://docs.klok.dev/klok-environment-build-ci-templates/llm.txt (datamodel pip
26
26
  (`klok-datamodel-project.json`, `klok-template.json`, the agent instruction files, the three page
27
27
  `klok-docs/datamodel/` layout).
28
28
 
29
- A hand created project has **no Vault CI role**, so its first `publish_java_projects` fails with
30
- `role "<tenant>-ci-project-<id>" could not be found`. Say that up front and give the user the command; see
31
- the `klok-release` skill.
29
+ Vault needs nothing per project: the tenant CI role `<tenant>-ci` accepts every project under the tenant's
30
+ root group. If `publish_java_projects` fails at `auth/jwt/login`, the tenant itself is not set up; see the
31
+ `klok-release` skill.
32
32
  2. Write the XSD under `schema-definition-xsd/`: single `xs:` prefix, `targetNamespace` with `xmlns:tns`,
33
33
  `elementFormDefault="qualified"`, one root element `<Name>_vN` that references every complex type. Enumerations
34
34
  as `xs:enumeration`.
@@ -40,17 +40,19 @@ letting them surface as a red pipeline.
40
40
 
41
41
  ## Setting up a new project (what must exist)
42
42
 
43
- * Vault JWT role `<tenant>-ci-project-<gitlab id>` bound to that `project_id`, carrying **both** `default` and
44
- the tenant CI read policy (`klok-cicd-read` for tenant `klok`). A role with only `default` authenticates but
45
- cannot read the shared secrets, and `publish` still fails — that is why the pipelines of projects 175 and 191
46
- were red for months. Without any role at all the job fails at `auth/jwt/login` with
47
- `role "<tenant>-ci-project-<id>" could not be found`.
43
+ * Nothing in Vault per project. Every job logs in with the tenant CI role `<tenant>-ci` (a Vault JWT role bound
44
+ to `namespace_path` `<tenant>` and `<tenant>/*`, carrying `default` and the tenant CI read policy
45
+ `<tenant>-cicd-read`). The templates set `VAULT_AUTH_ROLE: $KLOK_TENANT-ci`. A tenant without the role fails
46
+ every job at `auth/jwt/login` with `role "<tenant>-ci" could not be found`; the tenant setup is in
47
+ `klok-docs/ci/tenant-onboarding.md` of `klok/environment/build-ci-templates`, every credential and the step
48
+ that uses it in `klok-docs/ci/authentication.md` there.
48
49
  * For anything the pipeline resolves from a package registry (framework, plugin, datamodels): the project's
49
50
  top-level group must be on the package project's job token allowlist.
50
51
  * For a deployed service: a manifest under `klok/integration/<name>/`, the Kubernetes service account, a Vault
51
52
  Kubernetes role `<name>-role` with a policy reading `secret/data/<tenant>/integration/<name>/env`, and the env
52
53
  secret itself (broker credentials, service specific keys).
53
- * Documentation projects need the tenant's docs upload client in Keycloak and in Vault (`secret/<tenant>`).
54
+ * Documentation projects need the tenant's docs upload client: Keycloak client `klok-docs-upload-<tenant>` and its
55
+ id and secret in `secret/<tenant>/common/repo/cicd-environment-variables`.
54
56
 
55
57
  Vault is changed by humans only: propose the exact `vault write` / `vault policy write` command with every existing
56
58
  field, and let the user run it.
@@ -59,8 +61,9 @@ field, and let the user run it.
59
61
 
60
62
  | Symptom | Cause |
61
63
  |---|---|
62
- | `role "<tenant>-ci-project-<id>" could not be found` at `auth/jwt/login` | no Vault CI role for the project; it was created without provisioning |
63
- | `permission denied` reading `secret/.../cicd-environment-variables` | CI role exists but lacks the tenant CI read policy (has only `default`) |
64
+ | `role "<tenant>-ci" could not be found` at `auth/jwt/login` | the tenant has no CI role yet (tenant onboarding) |
65
+ | `claim "namespace_path" does not match` at `auth/jwt/login` | the project is outside the tenant's root group, or `VAULT_AUTH_ROLE` names another tenant's role |
66
+ | `permission denied` reading `secret/.../cicd-environment-variables` | the CI role lacks the tenant CI read policy (has only `default`) |
64
67
  | `403` on `groups/<tenant>/-/packages/maven/...` | job token allowlist of the package project lacks the reader's group |
65
68
  | `Could not find dev.klok...:<version>` | the version is not published yet, or the catalog copy is stale (`updateKlokLibsToml`) |
66
69
  | `already deployed` from JReleaser | Maven Central already has that version; a `main` build is a new timestamp, do not retry the same job |