@khotan/cli 0.9.0 → 0.11.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.
Files changed (3) hide show
  1. package/README.md +21 -56
  2. package/dist/khotan.js +16545 -1473
  3. package/package.json +2 -3
package/README.md CHANGED
@@ -1,10 +1,9 @@
1
- # Khotan CLI & MCP server
1
+ # Khotan CLI
2
2
 
3
- `@khotan/cli` is the first-party command-line interface and Model Context
4
- Protocol (MCP) server for the Khotan API. Both surfaces are thin adapters over
5
- the public `/api/v1` HTTP API, driven by the shared capability catalog in
6
- [`@khotan/core`](../khotan-core). They add nothing the API cannot do they make
7
- the same operations ergonomic for humans (CLI) and agents (MCP).
3
+ `@khotan/cli` is the first-party command-line interface for the Khotan API. It
4
+ is a thin adapter over the public `/api/v1` HTTP API, driven by the shared
5
+ capability catalog in [`@khotan/core`](../khotan-core). It adds nothing the API
6
+ cannot do it makes the same operations ergonomic for humans and agents alike.
8
7
 
9
8
  ## Install & run
10
9
 
@@ -32,27 +31,24 @@ own agents (Cursor, Devin, …) can drive setup. It is non-destructive and
32
31
  re-runnable, and never writes secrets.
33
32
 
34
33
  ```bash
35
- khotan init # Cursor: .cursor/mcp.json + .cursor/rules/khotan.mdc
36
- khotan init --client generic # root mcp.json + khotan-agents.md
34
+ khotan init # Cursor: .cursor/rules/khotan.mdc
35
+ khotan init --client generic # khotan-agents.md
37
36
  khotan init --force # regenerate managed assets, overwriting edits
38
37
  khotan init --json # machine-readable summary on stdout
39
38
  ```
40
39
 
41
- It writes an MCP config wired to `khotan mcp serve` (credentials referenced by
42
- `KHOTAN_API_URL` / `KHOTAN_API_KEY`, placeholders only) plus agent guidance. The
43
- MCP config merges into an existing one, preserving any other servers. Authenticate
44
- separately with `khotan auth set-key` or environment variables — never commit a key.
40
+ It writes agent guidance for using the CLI. Authenticate separately with
41
+ `khotan auth set-key` or environment variables never commit a key.
45
42
 
46
43
  `init` also installs catalog-derived agent **skills** for using the CLI into
47
44
  `.cursor/skills/`, `.agents/skills/`, and `.claude/skills/` (regardless of
48
45
  `--client`): an overview `khotan` skill plus one per command domain
49
46
  (`khotan-apps`, `khotan-databases`, …). The skills are generated from the same
50
- capability catalog that drives the commands, MCP tools, and `khotan help`, so
51
- they can never drift. They are **managed assets**: every `khotan init` run
52
- regenerates them in place (no `--force` needed), so re-running `init` is how a
53
- workspace picks up new CLI commands — like the `databases branches` group. Your
54
- hand-authored rule/guide and any MCP edits stay non-destructive (preserved
55
- unless `--force`).
47
+ capability catalog that drives the commands and `khotan help`, so they can
48
+ never drift. They are **managed assets**: every `khotan init` run regenerates
49
+ them in place (no `--force` needed), so re-running `init` is how a workspace
50
+ picks up new CLI commands — like the `databases branches` group. Your
51
+ hand-authored rule/guide stays non-destructive (preserved unless `--force`).
56
52
 
57
53
  ## Authentication & profiles
58
54
 
@@ -125,10 +121,10 @@ KHOTAN_API_KEY='<org-scoped key>'
125
121
  KHOTAN_ORG_ID='<org id>'
126
122
  ```
127
123
 
128
- When `KHOTAN_ORG_ID` (or `--assert-org <id>`) is set, every operation and
129
- `khotan mcp serve` verifies `whoami.organizationId` matches before trusting
130
- output and fails closed on mismatch (`error [org_mismatch]`). With no expected
131
- org id set, behavior is unchanged.
124
+ When `KHOTAN_ORG_ID` (or `--assert-org <id>`) is set, every operation verifies
125
+ `whoami.organizationId` matches before trusting output and fails closed on
126
+ mismatch (`error [org_mismatch]`). With no expected org id set, behavior is
127
+ unchanged.
132
128
 
133
129
  ## Command surface
134
130
 
@@ -144,7 +140,9 @@ documented surface and the executable surface cannot drift. Run `khotan help` or
144
140
  | Databases | `databases list`, `databases create --name db`, `databases connection <id>`, `databases rotate-credentials <id>`, `databases delete <id>` |
145
141
  | Files | `files list`, `files get <id>`, `files upload <path>`, `files download <id> --output <path>`, `files download-url <id>`, `files preview-url <id>`, `files update <id> --name new.txt`, `files delete <id>` |
146
142
  | Folders | `folders list`, `folders create --name docs`, `folders rename <id> --name new`, `folders delete <id>` |
147
- | Context | `context list`, `context get <slug>`, `context raw <slug>`, `context create --title T --kind knowledge --content '...'`, `context update <slug> --expected-revision 3 --content '...'`, `context delete <slug>` |
143
+ | Context | `context list`, `context get <slug>`, `context raw <slug>`, `context create --title T --kind knowledge --content '...' --folder-id <id>`, `context update <slug> --expected-revision 3 --content '...' --folder-id <id>`, `context delete <slug>` |
144
+ | Context folders | `context folders list`, `context folders create --name docs --parent-id <id>`, `context folders update <id> --name new --parent-id <id>`, `context folders delete <id> --recursive` |
145
+ | Context revisions | `context revisions list <slug>`, `context revisions get <slug> <revision>`, `context revisions restore <slug> <revision>` |
148
146
 
149
147
  ### Output modes
150
148
 
@@ -184,39 +182,6 @@ khotan files download-url file_123 # attachment disposition, any file type
184
182
  See [Serving file attachments](../../docs/files-api-attachments.md) for the full
185
183
  preview/download flow and the receiver wiring guidance.
186
184
 
187
- ## MCP server
188
-
189
- `khotan mcp serve` starts a local stdio MCP server that reuses the same profile,
190
- environment overrides, API client, and catalog as the CLI. It advertises
191
- **tools** (operations) and **resources** (URI-addressed read data) during
192
- initialization.
193
-
194
- - Operations become tools (e.g. `khotan_apps_create`). Destructive tools require
195
- `{ "confirm": true }`; secret tools are labelled `[secret]`. The password-bearing
196
- credential exchange is **not** exposed as a tool.
197
- - Durable read data is exposed as resource templates: `khotan://apps/{appId}`,
198
- `khotan://pipelines/{pipelineId}`, `khotan://databases/{databaseId}`,
199
- `khotan://files/{fileId}`, `khotan://context/{slug}`.
200
- - Secret-bearing values (env var values, connection URIs) are never resources.
201
- - stdout carries JSON-RPC only; all logs go to stderr.
202
-
203
- Example MCP client configuration:
204
-
205
- ```json
206
- {
207
- "mcpServers": {
208
- "khotan": {
209
- "command": "khotan",
210
- "args": ["mcp", "serve"],
211
- "env": {
212
- "KHOTAN_API_URL": "https://app.example.com",
213
- "KHOTAN_API_KEY": "khk_live_..."
214
- }
215
- }
216
- }
217
- }
218
- ```
219
-
220
185
  ## Catalog ↔ OpenAPI consistency
221
186
 
222
187
  `@khotan/core` validates that every catalog operation maps to a real `/api/v1`