@khotan/cli 0.6.0 → 0.9.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 +34 -1
  2. package/dist/khotan.js +921 -42
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -101,6 +101,7 @@ state is needed in CI or sandboxes:
101
101
  | `KHOTAN_API_URL` | API origin (e.g. `https://app.example.com`) |
102
102
  | `KHOTAN_API_KEY` | Organization-scoped API key |
103
103
  | `KHOTAN_PROFILE` | Select a stored profile by name |
104
+ | `KHOTAN_ORG_ID` | Expected org id; the CLI asserts `whoami.organizationId` matches it and fails closed otherwise |
104
105
 
105
106
  ```bash
106
107
  export KHOTAN_API_URL=https://app.example.com
@@ -108,6 +109,27 @@ export KHOTAN_API_KEY=khk_live_...
108
109
  khotan apps list --json | jq '.apps[].id'
109
110
  ```
110
111
 
112
+ ### Repo-local org isolation (`env.khotan.local`)
113
+
114
+ When an `env.khotan.local` file sits at (or above) the working directory, the CLI
115
+ auto-loads its `KHOTAN_*` values so every command is scoped to that repo's
116
+ organization — never a stray machine-global profile from another customer. The
117
+ file is authoritative: its values win over shell-exported `KHOTAN_*`, which win
118
+ over the stored profile, and CLI flags win over everything (`flag >
119
+ env.khotan.local > shell env > profile`).
120
+
121
+ ```bash
122
+ # env.khotan.local (git-ignored; never commit secrets)
123
+ KHOTAN_API_URL='https://<customer>.khotan.com'
124
+ KHOTAN_API_KEY='<org-scoped key>'
125
+ KHOTAN_ORG_ID='<org id>'
126
+ ```
127
+
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.
132
+
111
133
  ## Command surface
112
134
 
113
135
  Commands are grouped by domain and derived from the capability catalog, so the
@@ -120,7 +142,7 @@ documented surface and the executable surface cannot drift. Run `khotan help` or
120
142
  | App env | `apps env list <id>`, `apps env set <id> <KEY> --value V`, `apps env reveal <id> <KEY>`, `apps env unset <id> <KEY>`, `apps env bulk-set <id> --var A=1 --var B=2` |
121
143
  | Pipelines | same shape as apps under `pipelines …` |
122
144
  | Databases | `databases list`, `databases create --name db`, `databases connection <id>`, `databases rotate-credentials <id>`, `databases delete <id>` |
123
- | Files | `files list`, `files get <id>`, `files upload <path>`, `files download <id> --output <path>`, `files update <id> --name new.txt`, `files delete <id>` |
145
+ | 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>` |
124
146
  | Folders | `folders list`, `folders create --name docs`, `folders rename <id> --name new`, `folders delete <id>` |
125
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>` |
126
148
 
@@ -151,6 +173,17 @@ khotan files upload ./report.pdf --folder-path /reports/2026
151
173
  khotan files download file_123 --output ./report.pdf
152
174
  ```
153
175
 
176
+ To hand a file to a browser instead of saving it locally, mint a short-lived
177
+ presigned URL and load it directly (no API key on the URL; expires in ~5 minutes):
178
+
179
+ ```bash
180
+ khotan files preview-url file_123 # inline disposition, images and PDFs only
181
+ khotan files download-url file_123 # attachment disposition, any file type
182
+ ```
183
+
184
+ See [Serving file attachments](../../docs/files-api-attachments.md) for the full
185
+ preview/download flow and the receiver wiring guidance.
186
+
154
187
  ## MCP server
155
188
 
156
189
  `khotan mcp serve` starts a local stdio MCP server that reuses the same profile,