@khotan/cli 0.1.1 → 0.3.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 +11 -0
  2. package/dist/khotan.js +140 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -179,6 +179,17 @@ Example MCP client configuration:
179
179
  operation (method, path, operationId) using a snapshot of the OpenAPI document at
180
180
  [`packages/khotan-core/src/catalog/__fixtures__/openapi.snapshot.json`](../khotan-core/src/catalog/__fixtures__/openapi.snapshot.json).
181
181
 
182
+ Because that snapshot is committed, the catalog can validate green against a
183
+ stale contract. Guard against it by regenerating the live operation index
184
+ in-process and diffing it against the snapshot (no running server needed):
185
+
186
+ ```bash
187
+ bun run khotan:snapshot:check # exit 1 on any added/removed/renamed operation
188
+ ```
189
+
190
+ Wire this into CI (it only needs build-minimum env) so a route added, removed,
191
+ or renamed without updating the snapshot fails the build.
192
+
182
193
  Regenerate the snapshot when the API surface changes:
183
194
 
184
195
  ```bash
package/dist/khotan.js CHANGED
@@ -19,7 +19,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
19
19
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
20
20
 
21
21
  // ../khotan-core/src/version.ts
22
- var CATALOG_SCHEMA_VERSION = 1, CATALOG_VERSION = "2026-06-13", KHOTAN_ADAPTER_NAME = "khotan", KHOTAN_ADAPTER_VERSION = "0.1.0", SUPPORTED_CATALOG_SCHEMA_VERSIONS;
22
+ var CATALOG_SCHEMA_VERSION = 1, CATALOG_VERSION = "2026-06-18", KHOTAN_ADAPTER_NAME = "khotan", KHOTAN_ADAPTER_VERSION = "0.3.0", SUPPORTED_CATALOG_SCHEMA_VERSIONS;
23
23
  var init_version = __esm(() => {
24
24
  SUPPORTED_CATALOG_SCHEMA_VERSIONS = [
25
25
  CATALOG_SCHEMA_VERSION
@@ -444,6 +444,128 @@ var init_catalog = __esm(() => {
444
444
  mimeType: "application/json"
445
445
  }
446
446
  }
447
+ },
448
+ {
449
+ id: "databases.branches.list",
450
+ kind: "operation",
451
+ domain: "databases",
452
+ safety: "read",
453
+ auth: true,
454
+ title: "List database branches",
455
+ description: "List a database's branches (no credentials).",
456
+ input: [idField("databaseId", "The database id.")],
457
+ http: { method: "GET", path: "/api/v1/databases/{databaseId}/branches", operationId: "listDatabaseBranches" },
458
+ cli: { command: ["databases", "branches", "list"], summary: "List database branches", defaultOutput: "table" },
459
+ mcp: { tool: { name: "khotan_databases_branches_list", title: "List database branches", description: "List a database's branches (no credentials)." } }
460
+ },
461
+ {
462
+ id: "databases.branches.get",
463
+ kind: "operation",
464
+ domain: "databases",
465
+ safety: "read",
466
+ auth: true,
467
+ title: "Get a database branch",
468
+ description: "Get one branch by id (no credentials).",
469
+ input: [
470
+ idField("databaseId", "The database id."),
471
+ idField("branchId", "The branch id.")
472
+ ],
473
+ http: { method: "GET", path: "/api/v1/databases/{databaseId}/branches/{branchId}", operationId: "getDatabaseBranch" },
474
+ cli: { command: ["databases", "branches", "get"], summary: "Get a database branch", defaultOutput: "detail" },
475
+ mcp: { tool: { name: "khotan_databases_branches_get", title: "Get a database branch", description: "Get one branch by id (no credentials)." } }
476
+ },
477
+ {
478
+ id: "databases.branches.create",
479
+ kind: "operation",
480
+ domain: "databases",
481
+ safety: "write",
482
+ auth: true,
483
+ title: "Create a database branch",
484
+ description: "Branch a ready database, optionally from a parent branch (nested branching).",
485
+ input: [
486
+ idField("databaseId", "The database id."),
487
+ { name: "name", location: "body", type: "string", required: true, description: "The branch name." },
488
+ { name: "initSource", location: "body", type: "string", required: true, description: "parent-data (copy schema + data) or schema-only (blank)." },
489
+ { name: "parentBranchId", location: "body", type: "string", description: "Branch to create from; omit to branch from the database root." },
490
+ { name: "parentTimestamp", location: "body", type: "string", description: "Point-in-time (ISO 8601) for parent-data branches." },
491
+ { name: "expiresAt", location: "body", type: "string", description: "Explicit expiration (ISO 8601); omit for the ephemeral default." },
492
+ { name: "noExpiry", location: "body", type: "boolean", description: "Create a non-expiring branch; mutually exclusive with expiresAt." }
493
+ ],
494
+ http: { method: "POST", path: "/api/v1/databases/{databaseId}/branches", operationId: "createDatabaseBranch", bodyMode: "json" },
495
+ cli: { command: ["databases", "branches", "create"], summary: "Create a database branch", defaultOutput: "detail" },
496
+ mcp: { tool: { name: "khotan_databases_branches_create", title: "Create a database branch", description: "Branch a ready database, optionally from a parent branch (nested branching)." } }
497
+ },
498
+ {
499
+ id: "databases.branches.delete",
500
+ kind: "operation",
501
+ domain: "databases",
502
+ safety: "destructive",
503
+ auth: true,
504
+ title: "Delete a database branch",
505
+ description: "Permanently delete a branch. Delete its child branches first.",
506
+ input: [
507
+ idField("databaseId", "The database id."),
508
+ idField("branchId", "The branch id.")
509
+ ],
510
+ http: { method: "DELETE", path: "/api/v1/databases/{databaseId}/branches/{branchId}", operationId: "deleteDatabaseBranch" },
511
+ cli: { command: ["databases", "branches", "delete"], summary: "Delete a database branch" },
512
+ mcp: { tool: { name: "khotan_databases_branches_delete", title: "Delete a database branch", description: "Permanently delete a branch. Requires confirmation; delete child branches first." } }
513
+ },
514
+ {
515
+ id: "databases.branches.connection",
516
+ kind: "operation",
517
+ domain: "databases",
518
+ safety: "secret",
519
+ auth: true,
520
+ title: "Get a branch connection (secret)",
521
+ description: "Retrieve a branch connection URI. Secret-bearing; explicit-only.",
522
+ input: [
523
+ idField("databaseId", "The database id."),
524
+ idField("branchId", "The branch id.")
525
+ ],
526
+ http: { method: "GET", path: "/api/v1/databases/{databaseId}/branches/{branchId}/connection", operationId: "getDatabaseBranchConnection" },
527
+ cli: { command: ["databases", "branches", "connection"], summary: "Get a branch connection URI (secret)", defaultOutput: "raw" },
528
+ mcp: { tool: { name: "khotan_databases_branches_connection", title: "Get a branch connection URI (secret)", description: "Retrieve a branch connection URI. Secret-bearing — returns a credential." } }
529
+ },
530
+ {
531
+ id: "databases.branches.rotate-credentials",
532
+ kind: "operation",
533
+ domain: "databases",
534
+ safety: "secret",
535
+ auth: true,
536
+ title: "Rotate branch credentials (secret)",
537
+ description: "Rotate a branch's credentials and return the new connection. Secret-bearing.",
538
+ input: [
539
+ idField("databaseId", "The database id."),
540
+ idField("branchId", "The branch id.")
541
+ ],
542
+ http: { method: "POST", path: "/api/v1/databases/{databaseId}/branches/{branchId}/rotate-credentials", operationId: "rotateDatabaseBranchCredentials", bodyMode: "none" },
543
+ cli: { command: ["databases", "branches", "rotate-credentials"], summary: "Rotate branch credentials (secret)", defaultOutput: "raw" },
544
+ mcp: { tool: { name: "khotan_databases_branches_rotate_credentials", title: "Rotate branch credentials (secret)", description: "Rotate a branch's credentials and return the new connection. Secret-bearing." } }
545
+ },
546
+ {
547
+ id: "databases.branches.resource",
548
+ kind: "resource",
549
+ domain: "databases",
550
+ safety: "read",
551
+ auth: true,
552
+ title: "Branch summary",
553
+ description: "Credential-free branch summary addressed by database and branch id.",
554
+ input: [
555
+ idField("databaseId", "The database id."),
556
+ idField("branchId", "The branch id.")
557
+ ],
558
+ readsVia: "databases.branches.get",
559
+ http: { method: "GET", path: "/api/v1/databases/{databaseId}/branches/{branchId}", operationId: "getDatabaseBranch" },
560
+ mcp: {
561
+ resource: {
562
+ uriTemplate: "khotan://databases/{databaseId}/branches/{branchId}",
563
+ name: "database-branch-summary",
564
+ title: "Branch summary",
565
+ description: "Credential-free branch summary as JSON.",
566
+ mimeType: "application/json"
567
+ }
568
+ }
447
569
  }
448
570
  ];
449
571
  fileCapabilities = [
@@ -654,6 +776,23 @@ var init_catalog = __esm(() => {
654
776
  cli: { command: ["context", "list"], summary: "List context documents", defaultOutput: "table" },
655
777
  mcp: { tool: { name: "khotan_context_list", title: "List context documents", description: "List the context document manifest (metadata only)." } }
656
778
  },
779
+ {
780
+ id: "context.search",
781
+ kind: "operation",
782
+ domain: "context",
783
+ safety: "read",
784
+ auth: true,
785
+ title: "Search context documents",
786
+ description: "Hybrid semantic + full-text search; returns ranked passages with their source slug.",
787
+ input: [
788
+ { name: "q", location: "query", type: "string", required: true, description: "Natural-language search query." },
789
+ { name: "k", location: "query", type: "number", default: 10, description: "Maximum number of snippets to return (1-50)." },
790
+ { name: "kind", location: "query", type: "string", description: "Filter by kind: instructions, knowledge, or record." }
791
+ ],
792
+ http: { method: "GET", path: "/api/v1/context/search", operationId: "searchContextDocuments" },
793
+ cli: { command: ["context", "search"], summary: "Search context documents", defaultOutput: "table" },
794
+ mcp: { tool: { name: "khotan_context_search", title: "Search context documents", description: "Hybrid semantic + full-text search over context documents; returns ranked passages, each with its source slug." } }
795
+ },
657
796
  {
658
797
  id: "context.get",
659
798
  kind: "operation",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khotan/cli",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Khotan CLI and MCP server: human- and agent-facing adapters over the Khotan /api/v1 surface.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",