@klok-integration/cli 0.2.0

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/LICENSE.md ADDED
@@ -0,0 +1,74 @@
1
+ # Klok CLI End User Licence Agreement
2
+
3
+ Version 1.0
4
+
5
+ This agreement is between you ("you") and Klok ("Klok") and governs your use of the Klok CLI,
6
+ distributed on the public npm registry as `@klok-integration/cli` (the "Software"). By installing or
7
+ using the Software you accept these terms. If you do not accept them, do not install or use the
8
+ Software.
9
+
10
+ ## 1. Licence grant
11
+
12
+ Klok grants you a non-exclusive, non-transferable, revocable, worldwide licence to install and run the
13
+ Software on any number of machines you control, for the purpose of using the Klok integration platform
14
+ and services. The licence is granted free of charge and for as long as these terms are observed.
15
+
16
+ ## 2. Ownership
17
+
18
+ The Software is licensed, not sold. Klok retains all right, title and interest in the Software,
19
+ including all intellectual property rights. The Software is proprietary and is not open source. No
20
+ rights are granted other than those expressly stated in this agreement.
21
+
22
+ ## 3. Restrictions
23
+
24
+ You may not:
25
+
26
+ a. redistribute, sublicense, sell, rent, lease or host the Software for third parties;
27
+ b. modify the Software, or create derivative works from it;
28
+ c. decompile, disassemble, deobfuscate or otherwise attempt to reconstruct the source code of the
29
+ Software, except to the extent that this restriction is prohibited by applicable law;
30
+ d. remove or obscure any proprietary notice contained in the Software; or
31
+ e. use the Software to build a product or service that competes with the Klok platform.
32
+
33
+ Nothing in section 3(c) limits the rights you have under Article 6 of Directive 2009/24/EC on the legal
34
+ protection of computer programs, or under any other mandatory provision of applicable law.
35
+
36
+ ## 4. Instruction assets
37
+
38
+ The Software installs instruction and skill files intended to be read and used by AI coding agents in
39
+ your own repositories. You may use, adapt and keep those files in your repositories for your own
40
+ development work. Section 3 otherwise continues to apply to them.
41
+
42
+ ## 5. Third party components
43
+
44
+ The Software includes open source components that are licensed under their own terms. Those terms are
45
+ reproduced in `THIRD-PARTY-NOTICES.md` in this package, and they prevail over this agreement in respect
46
+ of the components they cover.
47
+
48
+ ## 6. Services and data
49
+
50
+ The Software is a client for Klok services. Use of those services is governed by the separate agreement
51
+ between Klok and the organisation whose account you authenticate with. The Software stores credentials
52
+ locally on the machine it runs on.
53
+
54
+ ## 7. No warranty
55
+
56
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
57
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
58
+
59
+ ## 8. Limitation of liability
60
+
61
+ TO THE EXTENT PERMITTED BY LAW, KLOK SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR
62
+ CONSEQUENTIAL DAMAGES, OR FOR LOSS OF PROFITS, REVENUE OR DATA, ARISING OUT OF OR IN CONNECTION WITH THE
63
+ SOFTWARE. Nothing in this agreement excludes liability that cannot be excluded by law.
64
+
65
+ ## 9. Term and termination
66
+
67
+ This licence terminates automatically if you breach it. On termination you must stop using the Software
68
+ and remove it from your machines.
69
+
70
+ ## 10. Governing law
71
+
72
+ This agreement is governed by the laws of Sweden, and disputes shall be settled by the courts of Sweden.
73
+
74
+ Contact: https://klok.dev
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # klok
2
+
3
+ The command line client for the [Klok integration platform](https://klok.dev). It runs tasks on your
4
+ tenant's Klok agent, publishes documentation, keeps your workspace in sync, and exposes the platform to
5
+ your IDE and coding agents over MCP and A2A.
6
+
7
+ ```sh
8
+ npm install -g @klok-integration/cli
9
+ klok --help
10
+ ```
11
+
12
+ Node 22.14 or newer. The package has no dependencies and runs no install scripts.
13
+
14
+ ## First run
15
+
16
+ ```sh
17
+ klok config set agentUrl https://agent.klok.dev
18
+ klok login # device flow; add --browser for the browser flow
19
+ klok whoami
20
+ klok # opens the terminal UI
21
+ ```
22
+
23
+ Configuration lives in `~/.config/klok/config.json`. Every value can be overridden by an environment
24
+ variable: `KLOK_AGENT_URL`, `KLOK_TENANT`, `KLOK_DOMAIN`, `KLOK_DEV_URL`, `KLOK_KEYCLOAK_ISSUER`,
25
+ `KLOK_KEYCLOAK_CLIENT_ID`, `KLOK_GIT_URL`, `KLOK_GIT_LOCAL_WORKSPACE`. Run `klok config list` to see
26
+ what is set and where it comes from.
27
+
28
+ Credentials are written to `~/.config/klok/credentials.json` with mode 0600.
29
+
30
+ ## Commands
31
+
32
+ | Command | What it does |
33
+ | --- | --- |
34
+ | `klok` | Terminal UI. `j`/`k` or arrows move, `enter` opens a task, `a` asks a question, `b` shows beads, `r` refreshes, `q` quits. |
35
+ | `klok login`, `klok logout`, `klok whoami` | Session against your tenant's identity provider. |
36
+ | `klok config list\|get\|set\|delete` | Configuration. |
37
+ | `klok agent ask "<question>"` | Ask a question about the integration landscape and get a cited answer. |
38
+ | `klok agent impact <nodeId\|datamodel> --change minor\|major\|remove` | Impact analysis. |
39
+ | `klok agent plan <solutionKey> --change-request <file\|->` | Integration plan following the Klok process. |
40
+ | `klok agent tasks`, `klok agent open <taskId>`, `klok agent cancel <taskId>` | Work with tasks. |
41
+ | `klok agent answer <taskId> --question <qid> --text "..."` | Answer a clarification and continue. |
42
+ | `klok agent serve [--port 3091]` | Loopback MCP and A2A proxy for IDEs and other agents. |
43
+ | `klok agents init` | Write the Klok agent instructions and skills into a repository. |
44
+ | `klok bead list\|show\|report` | Progress beads in the current repository. |
45
+ | `klok docs publish` | Build this repository's znai documentation and upload it to the docs portal. |
46
+ | `klok sync clone\|pull\|status` | Clone and refresh every repository you can see, in one workspace folder. |
47
+
48
+ Global flags: `--json`, `--no-tui`, `--stream`, `--tenant <slug>`, `--domain <slug>`,
49
+ `--agent-url <url>`.
50
+
51
+ ## Scripting
52
+
53
+ `klok` prints a terminal UI when stdout is a terminal, and a single JSON document otherwise, so it works
54
+ unchanged in a shell pipeline or a CI job.
55
+
56
+ ```sh
57
+ klok agent ask "which routes consume CustomerV1?" --json | jq -r '.result.answer'
58
+ klok agent plan KLK002 --change-request ./change.md --stream # NDJSON events, then the result
59
+ ```
60
+
61
+ | Exit code | Meaning |
62
+ | --- | --- |
63
+ | 0 | ok |
64
+ | 1 | error |
65
+ | 2 | the task needs input; the document carries `details.questionId` and `details.question` |
66
+ | 3 | denied by policy; `details.decisions` lists capability, decision and reason |
67
+ | 4 | not authenticated; run `klok login` |
68
+
69
+ ## Use it from your IDE and coding agents
70
+
71
+ ```sh
72
+ klok agent serve # 127.0.0.1:3091
73
+ ```
74
+
75
+ - `http://127.0.0.1:3091/mcp` — MCP over streamable HTTP, with tools for context search, impact
76
+ analysis, planning, issues, beads and task control. Long tasks send progress notifications.
77
+ - `http://127.0.0.1:3091/a2a` — Agent2Agent JSON-RPC proxied to your tenant's cloud agent with your
78
+ identity.
79
+ - `http://127.0.0.1:3091/.well-known/agent-card.json` — the agent card.
80
+
81
+ ```sh
82
+ claude mcp add klok --transport http http://127.0.0.1:3091/mcp
83
+ codex mcp add klok --url http://127.0.0.1:3091/mcp
84
+ ```
85
+
86
+ Cursor (`.cursor/mcp.json`):
87
+
88
+ ```json
89
+ { "mcpServers": { "klok": { "url": "http://127.0.0.1:3091/mcp" } } }
90
+ ```
91
+
92
+ ## Agent instructions
93
+
94
+ `klok agents init` writes `KLOK-AGENTS.md` with the rules, one managed row in every harness file
95
+ (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.cursorrules`, `.clinerules`,
96
+ `.github/copilot-instructions.md`), the klok named rule files (`.cursor/rules`, `.agents/rules`) and the
97
+ Klok skills. `KLOK-AGENTS.md`, the klok rule files and the `klok-*` skills belong to Klok and are
98
+ replaced wholesale; every other file keeps its content and only has its single row created or replaced,
99
+ so an update can never duplicate text. Klok skills the CLI no longer ships are removed.
100
+ `klok agents status` shows whether a repository is up to date with the CLI version you have installed.
101
+
102
+ ## Licence and support
103
+
104
+ Proprietary. See `LICENSE.md` in this package; third party notices are in `THIRD-PARTY-NOTICES.md`.
105
+
106
+ Documentation: https://docs.klok.dev — support: https://klok.dev/support