@functional-systems/lambdadb-cli 0.1.7-dev.23 → 0.1.7-dev.24

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 (49) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/CONTRIBUTING.md +29 -0
  3. package/DESIGN.md +9 -3
  4. package/ONBOARDING.md +417 -0
  5. package/README.md +390 -138
  6. package/dist/account.d.ts +50 -0
  7. package/dist/account.js +301 -0
  8. package/dist/account.js.map +1 -0
  9. package/dist/agent-config.d.ts +4 -3
  10. package/dist/agent-config.js +12 -5
  11. package/dist/agent-config.js.map +1 -1
  12. package/dist/agents.d.ts +3 -3
  13. package/dist/agents.js +8 -8
  14. package/dist/agents.js.map +1 -1
  15. package/dist/cli.js +44 -6
  16. package/dist/cli.js.map +1 -1
  17. package/dist/config.d.ts +10 -4
  18. package/dist/config.js +43 -6
  19. package/dist/config.js.map +1 -1
  20. package/dist/credentials.d.ts +29 -0
  21. package/dist/credentials.js +116 -0
  22. package/dist/credentials.js.map +1 -0
  23. package/dist/device-auth.d.ts +16 -0
  24. package/dist/device-auth.js +160 -0
  25. package/dist/device-auth.js.map +1 -0
  26. package/dist/errors.d.ts +7 -0
  27. package/dist/errors.js +35 -1
  28. package/dist/errors.js.map +1 -1
  29. package/dist/init.d.ts +5 -2
  30. package/dist/init.js +50 -31
  31. package/dist/init.js.map +1 -1
  32. package/dist/mcp.js +8 -1
  33. package/dist/mcp.js.map +1 -1
  34. package/dist/projects.d.ts +29 -0
  35. package/dist/projects.js +323 -0
  36. package/dist/projects.js.map +1 -0
  37. package/package.json +6 -2
  38. package/skills/lambdadb/SKILL.md +9 -6
  39. package/src/account.ts +351 -0
  40. package/src/agent-config.ts +14 -8
  41. package/src/agents.ts +8 -8
  42. package/src/cli.ts +46 -6
  43. package/src/config.ts +43 -10
  44. package/src/credentials.ts +138 -0
  45. package/src/device-auth.ts +200 -0
  46. package/src/errors.ts +31 -2
  47. package/src/init.ts +42 -29
  48. package/src/mcp.ts +7 -1
  49. package/src/projects.ts +439 -0
package/README.md CHANGED
@@ -1,8 +1,54 @@
1
1
  # LambdaDB CLI
2
2
 
3
- A first, project-scoped CLI for developers, coding agents and CI. It uses
4
- `@functional-systems/lambdadb@0.8.1` for authentication, HTTP, read retries,
5
- pagination, bulk transfers and large response downloads.
3
+ Connect a LambdaDB project, configure coding agents, and import or search data
4
+ from your terminal or CI.
5
+
6
+ - [Quick start](#quick-start)
7
+ - [Install and run](#install-and-run)
8
+ - [First-use setup](#first-use-setup-with-init)
9
+ - [Supported coding agents](#supported-coding-agents)
10
+ - [Account and project management](#account-and-project-management)
11
+ - [Configuration and authentication](#configuration-and-authentication)
12
+ - [Query existing data](#query-existing-data)
13
+ - [Command examples](#command-examples)
14
+ - [Output and exit codes](#output-deadlines-and-exit-codes)
15
+ - [Development](#development-and-boundaries)
16
+
17
+ ## Quick start
18
+
19
+ Requires Node.js 22.14 or newer and npm. Run from your repository root:
20
+
21
+ ```sh
22
+ npx @functional-systems/lambdadb-cli@latest init
23
+ ```
24
+
25
+ If the CLI is already installed, run `lambdadb init` instead. Both entry points
26
+ use the same package and executable. The command examples below assume an
27
+ installed `lambdadb`; with npx, replace that prefix with
28
+ `npx @functional-systems/lambdadb-cli@latest`.
29
+
30
+ 1. Choose Console signup/login or connect an existing project with an API-key
31
+ environment variable.
32
+ 2. For browser setup, sign up or sign in, compare the terminal code, and approve
33
+ **CLI Login**. Return to the terminal to select an Org and project or explicitly
34
+ create a project with a name and region.
35
+ 3. Choose coding agents, project/user scope, and whether to enable MCP write
36
+ tools. Review the displayed paths before approving the file changes.
37
+ 4. After the connection check, restart or reload the selected agents and follow
38
+ the generated first-query guidance.
39
+
40
+ Init checks authentication and collection-list access. It does not create
41
+ collections or documents, and success does not establish search readiness.
42
+ For an existing collection, try this prompt in your agent:
43
+
44
+ > List my LambdaDB collections. Inspect the selected collection's index
45
+ > configuration, then read up to five documents at branch:main before searching
46
+ > an indexed field. Do not create or modify data.
47
+
48
+ Browser setup requires matching Backend and Console support and an accessible
49
+ OS credential store. If either is unavailable, use
50
+ [environment-variable setup](#environment-variable-setup). For CI or a
51
+ non-interactive shell, use [non-interactive init](#non-interactive-setup).
6
52
 
7
53
  ## Install and run
8
54
 
@@ -46,113 +92,136 @@ disabling trust checks. See the
46
92
  [maintainer guide](https://github.com/lambdadb/lambdadb-cli/tree/develop/packaging/homebrew#readme)
47
93
  for packaging and validation details.
48
94
 
49
- ### Build from source
95
+ ## First-use setup with `init`
50
96
 
51
- Requires Node.js 22.14 or newer and npm. From a checkout of this repository:
97
+ ### Connect or reuse a project
52
98
 
53
- ```sh
54
- npm ci
55
- npm run build
56
- node dist/cli.js --help
57
- ```
58
-
59
- Run commands with `node dist/cli.js`, or install the built directory into a local
60
- prefix to use the `lambdadb` executable:
99
+ On a first run, init offers browser setup or an existing environment-held key.
100
+ Reruns reuse the saved connection. To select or create a project through account
101
+ login, run `lambdadb init --connect`; previously saved project keys are reused.
102
+ For SSH or a host without a visible browser, run:
61
103
 
62
104
  ```sh
63
- npm install --prefix "$HOME/.local" /absolute/path/to/lambdadb-cli
64
- export PATH="$HOME/.local/node_modules/.bin:$PATH"
65
- lambdadb --help
105
+ lambdadb init --connect --no-browser
66
106
  ```
67
107
 
68
- `npm start -- ...` also works for human use. For machine-readable stdout, invoke
69
- `node dist/cli.js ... --json` or the executable directly; npm may print banners.
108
+ Approve CLI Login in Console after Google/email signup or login. The printed URL
109
+ and code also work in a browser on another device. Project selection and creation
110
+ continue in the terminal. A default Org is created only on first project
111
+ submission. Pending invitations require a Console decision first; the survey is
112
+ optional.
70
113
 
71
- ## Configuration and authentication
72
-
73
- Obtain the endpoint, existing project name and project API key from the LambdaDB
74
- Console. This CLI does not create projects or issue keys. Endpoint is the API
75
- origin, such as `https://api.lambdadb.ai`, without `/projects/...`. HTTPS is
76
- required, except HTTP on localhost/127.0.0.1/::1 for local testing.
77
-
78
- ```sh
79
- lambdadb configure --endpoint https://api.lambdadb.ai --project YOUR_DEV_PROJECT
80
- ```
114
+ ### Project limits and manual Console steps
81
115
 
82
- Set `LAMBDADB_API_KEY` through your shell's secure input or your CI secret manager.
83
- For example, in Bash, this avoids putting the value into shell history:
84
-
85
- ```bash
86
- read -r -s -p 'LambdaDB project API key: ' LAMBDADB_API_KEY
87
- printf '\n'
88
- export LAMBDADB_API_KEY
89
- ```
116
+ The remaining manual Console steps are signup/login and deliberate CLI approval,
117
+ invitation decisions when present, and any billing activation. If the Org has
118
+ reached its project limit, init offers existing projects and an Org-specific
119
+ billing link. Only the owner can activate billing. After billing, choose retry to
120
+ read the server's updated limits; opening the link does not upgrade or charge.
121
+ New Orgs normally start at one project, but CLI always uses the backend's actual
122
+ limit, including paid/custom limits. A provisioning project can be selected on a
123
+ later run; do not create another project to resume. Device approval expires after
124
+ 15 minutes and provisioning waits up to ten minutes. Remote MCP is outside this
125
+ setup; agents use the existing stdio MCP package.
90
126
 
91
- ### First-use setup with `init`
127
+ ### Non-interactive setup
92
128
 
93
- After securely exporting the key, run either entry point. Both use this same
94
- package and executable:
129
+ Inject a project key securely, then explicitly select agents and scope:
95
130
 
96
131
  ```sh
97
- lambdadb init
98
- npx @functional-systems/lambdadb-cli@latest init
132
+ # Inject LAMBDADB_API_KEY securely before running this command.
133
+ lambdadb init --non-interactive --agents codex,claude,cursor --scope project \
134
+ --endpoint https://api.lambdadb.ai --project YOUR_PROJECT --json
99
135
  ```
100
136
 
101
- `init` guides you through the existing project's endpoint, name and API-key
102
- environment-variable name. It detects Codex, Claude Code, Cursor, VS Code,
103
- Gemini CLI, OpenCode, GitHub Copilot CLI, Kiro IDE/CLI and the Cline VS Code
104
- extension using PATH and configuration directories, then lets you choose any subset (or `none`),
105
- project/user scope, and whether to enable MCP write tools. Detection is a hint,
106
- not proof that an agent is installed or connected. Project scope means the
107
- current working directory; run from your repository root.
108
- Cursor detection recognizes both the editor's `cursor` command and the
109
- `cursor-agent` CLI, which reads the same MCP configuration. With Cursor CLI,
110
- check the generated server with `cursor-agent mcp list-tools lambdadb`.
111
-
112
- The remaining manual step is in [LambdaDB Console](https://console.lambdadb.ai):
113
- select an existing project and obtain its API endpoint, project name and project
114
- API key. Inject the key into your shell or secret manager before running init.
115
- There is no browser login, account/project creation, key issuance, remote MCP,
116
- or backend/Console change in this flow. Init never asks for the key value and
117
- does not load or write `.env` files.
118
-
119
- For automation, explicitly select both agents and scope:
137
+ To configure only the CLI, use `--agents none`. This example expects the key in
138
+ `MY_PROJECT_KEY` instead of `LAMBDADB_API_KEY`; inject that variable securely
139
+ before running it:
120
140
 
121
141
  ```sh
122
- # Inject LAMBDADB_API_KEY securely before running this command.
123
- lambdadb init --non-interactive --agents codex,claude,cursor --scope project \
124
- --endpoint https://api.lambdadb.ai --project YOUR_PROJECT --json
125
- # Configure only the CLI, without changing agent files:
126
142
  lambdadb init --non-interactive --agents none --scope project \
127
143
  --endpoint https://api.lambdadb.ai --project YOUR_PROJECT --api-key-env MY_PROJECT_KEY
128
144
  ```
129
145
 
130
- `--agents` accepts a comma-separated subset of
131
- `codex,claude,cursor,vscode,gemini,opencode,copilot,kiro,cline` or `none`. For example:
146
+ `--agents` accepts comma-separated values from the
147
+ [supported agents](#supported-coding-agents) table, or `none`. Once connection
148
+ settings are saved, you can reuse them:
132
149
 
133
150
  ```sh
134
151
  lambdadb init --non-interactive --agents vscode,gemini,opencode --scope project
135
152
  lambdadb init --non-interactive --agents copilot,kiro,cline --scope user
136
153
  ```
137
154
 
138
- This example reuses your existing CLI settings and environment-held key.
139
- `--scope` accepts `project` or `user`. `--write-tools` explicitly enables MCP
140
- write tools; omission disables them, including on reruns and when the inherited
141
- `LAMBDADB_MCP_ENABLE_WRITE_TOOLS` environment variable is true. The normal global
142
- `--config`, `--endpoint`, `--project`, `--api-key-env`, and `--timeout-ms` flags
143
- apply. Existing settings/environment precedence is unchanged. Non-TTY and
144
- `--json` runs require `--non-interactive`; missing choices, target or key fail
145
- with exit 2 and instructions, without prompting. This mode authorizes applying
155
+ These two examples reuse existing CLI settings and an OS-stored or
156
+ environment-held key. `--scope` accepts `project` or `user`. `--write-tools`
157
+ explicitly enables MCP write tools; omission disables them, including on reruns and when the inherited
158
+ `LAMBDADB_MCP_ENABLE_WRITE_TOOLS` environment variable is true.
159
+
160
+ The global `--config`, `--endpoint`, `--project`, `--api-key-env`, and
161
+ `--timeout-ms` flags apply to existing-credential setup. `--connect` instead
162
+ chooses its target in the terminal after account login. It cannot be combined
163
+ with explicit endpoint/project/key-reference flags and requires an interactive
164
+ terminal. Non-interactive setup never starts browser authorization or requests
165
+ a key. Non-TTY and `--json` runs require `--non-interactive`; missing choices,
166
+ target or key fail with exit 2 and instructions, without prompting. This mode authorizes applying
146
167
  the displayed file plan; it does not silently select detected agents.
147
- Cline's extension supports only user-scope MCP settings. Selecting `cline` with
148
- `--scope project` fails before any file writes or connection; interactive setup
149
- offers user scope when Cline is selected. It never silently broadens the scope.
150
168
 
151
- Before writing, init displays exact paths and create/update/unchanged actions,
152
- then uses the same SDK check as `doctor` to verify authentication and collection-list
153
- access. Failed validation/authentication leaves files untouched. The CLI's
169
+ Cline's extension supports only user-scope MCP settings. Selecting `cline` with
170
+ `--scope project` rejects agent installation; interactive setup offers user scope
171
+ when Cline is selected. It never silently broadens the scope. A browser-approved
172
+ connection may already be saved before agent choices are validated, as described
173
+ under [files and safe reruns](#files-and-safe-reruns). Rerun without `--connect`
174
+ to finish setup.
175
+
176
+ ### Files and safe reruns
177
+
178
+ Before agent installation, init displays exact paths and create/update/unchanged
179
+ actions, then uses the same SDK check as `doctor` to verify authentication and
180
+ collection-list access. Manual setup leaves files untouched on failed validation.
181
+ Browser setup first shows and confirms the CLI settings path and credential store;
182
+ once approved, it saves that connection before doctor/agent installation so a
183
+ failed check or interrupted agent setup can resume without issuing another key.
184
+ Agent files are still untouched until the reviewed plan and check succeed. The CLI's
154
185
  non-secret settings always use its usual configuration path (or `--config`),
155
- independently of agent scope:
186
+ independently of agent scope.
187
+
188
+ Unrelated configuration and comments are preserved where JSONC is accepted.
189
+ Copilot and Cline settings must be strict JSON for init; comments/trailing
190
+ commas cause an actionable failure and leave the file untouched. Shared files
191
+ (such as Claude/Copilot project MCP and VS Code/Copilot skills) are written only
192
+ once when both agents request identical contents; conflicting changes stop
193
+ before connection or writes. Symbolic links are preserved: init displays the
194
+ resolved write target and updates it once. Links with missing targets fail before
195
+ connection or writes; restore their targets before rerunning init.
196
+
197
+ Reruns update only recognizable init-generated `lambdadb` MCP entries;
198
+ existing custom entries or additions inside a generated entry cause an actionable
199
+ conflict. Existing skills are preserved, including user edits; remove the skill
200
+ file deliberately if you want to reinstall the bundled version. Writes use
201
+ atomic replacement per file, not a transaction across files: a disk/permission
202
+ failure can leave a partial installation; inspect the displayed paths and rerun.
203
+
204
+ ## Supported coding agents
205
+
206
+ Init detects agents using PATH and configuration directories, then lets you choose
207
+ any subset or `none`. Detection is a hint, not proof that an agent is installed or
208
+ connected. Project scope means the current working directory, so run from your
209
+ repository root. Cline supports user scope only.
210
+
211
+ | Agent | `--agents` value | Supported scope |
212
+ | --- | --- | --- |
213
+ | Codex | `codex` | Project or user |
214
+ | Claude Code | `claude` | Project or user |
215
+ | Cursor editor/CLI | `cursor` | Project or user |
216
+ | VS Code | `vscode` | Project or user |
217
+ | Gemini CLI | `gemini` | Project or user |
218
+ | OpenCode | `opencode` | Project or user |
219
+ | GitHub Copilot CLI | `copilot` | Project or user |
220
+ | Kiro IDE/CLI | `kiro` | Project or user |
221
+ | Cline VS Code extension | `cline` | User only |
222
+
223
+ <details>
224
+ <summary>MCP and skill paths, agent-specific overrides and reload instructions</summary>
156
225
 
157
226
  | Agent | Project MCP / skill | User MCP / skill |
158
227
  | --- | --- | --- |
@@ -166,6 +235,10 @@ independently of agent scope:
166
235
  | Kiro IDE/CLI | `.kiro/settings/mcp.json` / `.kiro/skills/lambdadb/SKILL.md` | `~/.kiro/settings/mcp.json` / `~/.kiro/skills/lambdadb/SKILL.md` |
167
236
  | Cline VS Code extension | Unsupported; choose user scope | VS Code user profile `globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` / `~/.cline/skills/lambdadb/SKILL.md` |
168
237
 
238
+ Cursor detection recognizes both the editor's `cursor` command and the
239
+ `cursor-agent` CLI, which reads the same MCP configuration. With Cursor CLI,
240
+ check the generated server with `cursor-agent mcp list-tools lambdadb`.
241
+
169
242
  When `CLAUDE_CONFIG_DIR` is set, Claude's user MCP file is
170
243
  `$CLAUDE_CONFIG_DIR/.claude.json` and its user skill is under
171
244
  `$CLAUDE_CONFIG_DIR/skills/lambdadb/SKILL.md`.
@@ -195,34 +268,29 @@ Copilot CLI is separate from the VS Code adapter. It reads `mcpServers`, not
195
268
  VS Code's `servers` map. Project setup reuses `.mcp.json` if present, otherwise
196
269
  an existing `.github/mcp.json`, otherwise creates `.mcp.json`. Both wrapped
197
270
  `mcpServers` and existing bare server maps are preserved. `COPILOT_HOME` overrides
198
- the user MCP and skill directory. Restart with the selected key in the launch
199
- environment, trust the repository, check `/mcp`, and run `/skills reload`.
271
+ the user MCP and skill directory. Restart, trust the repository, check `/mcp`,
272
+ and run `/skills reload`. In environment mode, include the selected key variable
273
+ in the launch environment. In OS-store mode, run as the same OS user with the
274
+ recorded store unlocked and accessible; no key environment variable is required.
200
275
 
201
276
  Kiro IDE and CLI share one `kiro` adapter; detection recognizes both `kiro` and
202
- `kiro-cli` executables. Approve the selected key variable in **Mcp Approved Env
203
- Vars** when prompted. For a custom Kiro agent, ensure it includes the MCP JSON
204
- and skill resources; init does not edit agent definitions or grant tool approvals.
277
+ `kiro-cli` executables. In environment mode, supply the selected key variable
278
+ and approve it in **Mcp Approved Env Vars** when prompted. In OS-store mode,
279
+ run as the same OS user with access to the unlocked recorded store; no key
280
+ variable approval is needed. For a custom Kiro agent, ensure it includes the
281
+ MCP JSON and skill resources; init does not edit agent definitions or grant tool approvals.
205
282
 
206
283
  The `cline` adapter targets the Cline extension in the default stable VS Code
207
284
  user profile, using the same platform/portable user directory rules above.
208
- Reload VS Code from an environment containing the selected key and inspect
209
- Cline's MCP Servers and Skills menus. Cline CLI, other editors and named profiles
285
+ Reload VS Code and inspect Cline's MCP Servers and Skills menus. In environment
286
+ mode, launch VS Code with the selected key variable. In OS-store mode, use the
287
+ same OS user with access to the unlocked recorded store; no key environment
288
+ variable is required. Cline CLI, other editors and named profiles
210
289
  use different configuration locations and are outside this adapter's scope.
211
290
 
212
- Unrelated configuration and comments are preserved where JSONC is accepted.
213
- Copilot and Cline settings must be strict JSON for init; comments/trailing
214
- commas cause an actionable failure and leave the file untouched. Shared files
215
- (such as Claude/Copilot project MCP and VS Code/Copilot skills) are written only
216
- once when both agents request identical contents; conflicting changes stop
217
- before connection or writes. Symbolic links are preserved: init displays the
218
- resolved write target and updates it once. Links with missing targets fail before
219
- connection or writes; restore their targets before rerunning init.
220
- Reruns update only recognizable init-generated `lambdadb` MCP entries;
221
- existing custom entries or additions inside a generated entry cause an actionable
222
- conflict. Existing skills are preserved, including user edits; remove the skill
223
- file deliberately if you want to reinstall the bundled version. Writes use
224
- atomic replacement per file, not a transaction across files: a disk/permission
225
- failure can leave a partial installation; inspect the displayed paths and rerun.
291
+ </details>
292
+
293
+ ### MCP launch and credential forwarding
226
294
 
227
295
  Agent settings launch `npx -y @functional-systems/lambdadb-cli@<installed-version> mcp`,
228
296
  which runs the existing `@functional-systems/lambdadb-mcp@0.1.5` stdio package.
@@ -233,11 +301,16 @@ may download both packages and requires npm registry access.
233
301
  After upgrading the CLI, rerun init for the same agents and scope to refresh
234
302
  their exact CLI version pin, then restart/reload the agent with the key available.
235
303
 
236
- The `mcp` bridge reads the selected key from the agent environment at startup and
237
- maps CLI endpoint/project/key to MCP's `LAMBDADB_BASE_URL`,
304
+ The `mcp` bridge reads the selected OS credential reference or environment
305
+ variable at startup and maps CLI endpoint/project/key to MCP's `LAMBDADB_BASE_URL`,
238
306
  `LAMBDADB_PROJECT_NAME`, and `LAMBDADB_PROJECT_API_KEY`. The bridge sets
239
307
  `LAMBDADB_MCP_ENABLE_WRITE_TOOLS` explicitly. No key value is placed in arguments
240
- or configuration. Codex uses `env_vars` to forward the selected variable;
308
+ or agent configuration. OS references need the same OS user and an accessible
309
+ credential store, with no shell key export. Linux Secret Service also needs access
310
+ to the desktop/user D-Bus session; Codex forwards its non-secret
311
+ `DBUS_SESSION_BUS_ADDRESS` and `XDG_RUNTIME_DIR` names when supplied. Launch other
312
+ agents with that session available, and allow those variables if the agent filters
313
+ its environment. For environment-mode connections, Codex uses `env_vars` to forward the selected variable;
241
314
  Claude, Gemini, Copilot and Kiro use `${VAR}`; Cursor, VS Code and Cline use `${env:VAR}`; and
242
315
  OpenCode uses `{env:VAR}` environment references. Gemini's explicit `env` entry
243
316
  also forwards the key through its inherited-environment sanitization. An unresolved
@@ -247,25 +320,8 @@ after setup or credential changes, check `/mcp` in Codex/Claude or Cursor's MCP
247
320
  settings, and approve/trust project settings if prompted. Higher-priority agent
248
321
  settings or organization policies may override or block these files.
249
322
 
250
- The no-secret-persistence contract covers files written by this CLI. Agents
251
- manage their own runtime storage; for example, Codex shell snapshots can capture
252
- the launch environment. Review your agent's environment/snapshot settings and
253
- protect its runtime directory when forwarding a project key.
254
-
255
- Init does not query documents or create collections/data. Connection success does
256
- not establish search readiness. Its result includes a read-only agent prompt:
257
- list collections, inspect the selected collection's index configuration, then
258
- read up to five documents at `branch:main` with `query` omitted before searching
259
- an actual indexed field. Without an agent, run `lambdadb collections list --json`,
260
- choose an existing collection, save `{"size":5}` in `first-query.json`, and run:
261
-
262
- ```sh
263
- lambdadb collections describe --collection YOUR_COLLECTION --json
264
- lambdadb query --collection YOUR_COLLECTION --ref branch:main --file first-query.json --json
265
- ```
266
-
267
- An empty project needs deliberately supplied data outside init. Empty results
268
- are not evidence of indexing failure or readiness.
323
+ <details>
324
+ <summary>Official agent documentation used for format checks</summary>
269
325
 
270
326
  Agent formats were checked against official documentation on 2026-10-24:
271
327
  [Codex MCP](https://developers.openai.com/codex/mcp),
@@ -292,9 +348,139 @@ Agent formats were checked against official documentation on 2026-10-24:
292
348
  Generated settings still require
293
349
  verification in the actual agent; local contract tests simulate that boundary.
294
350
 
295
- No command accepts a raw key argument. Configuration stores only `endpoint`,
296
- `project` and `apiKeyEnv`. Keys are read from the selected environment variable at
297
- runtime and are never persisted by this CLI. Environment variables are still
351
+ </details>
352
+
353
+ ## Account and project management
354
+
355
+ These commands use a saved account login, independently of project API-key
356
+ configuration. They never prompt for missing arguments. `login` deliberately
357
+ waits for browser approval and prints a URL usable on another device; it does not
358
+ prompt on stdin. Use the same `--config` path throughout if overriding it.
359
+
360
+ ```sh
361
+ lambdadb login --no-browser
362
+ lambdadb orgs list --json
363
+ lambdadb projects regions --json
364
+ lambdadb projects list --org ORG_UUID --json
365
+ lambdadb projects create --org ORG_UUID --name my-project --region REGION --json
366
+ # For a new account with no Org, choose --default-org instead of --org.
367
+ lambdadb projects list --org ORG_UUID --json # wait until ACTIVE
368
+ lambdadb projects use --org ORG_UUID --project-id PROJECT_UUID --issue-key
369
+ lambdadb doctor
370
+ # Later switches reuse a previously saved key without --issue-key:
371
+ lambdadb projects use --org ORG_UUID --project-id PROJECT_UUID
372
+ lambdadb logout
373
+ ```
374
+
375
+ `create` requires exactly one of `--org UUID` or `--default-org`, plus `--name`
376
+ and `--region`. Creation does not select the CLI default or install agents.
377
+ `use` requires both IDs; first connection or deliberate key replacement requires
378
+ `--issue-key` and owner/admin key-management permission. Saved project keys are
379
+ reused without that flag. `projects use` changes only the CLI default: existing
380
+ agent entries stay pinned until you rerun `init` and approve their file plan.
381
+ Expired, missing or unreadable account credentials fail with login/unlock guidance;
382
+ ordinary management commands never start browser login automatically.
383
+
384
+ ### Limits and failures
385
+
386
+ The API-key environment path remains available without account login. Management
387
+ requests do not follow redirects and never retry writes. `--timeout-ms` overrides
388
+ `LAMBDADB_TIMEOUT_MS` (default `30000`, range 1–3600000 milliseconds). For account
389
+ login, logout and project/Organization management, this limits each HTTP request,
390
+ including its response body; sequential requests each receive a fresh budget.
391
+ It does not limit time spent at prompts, the server-issued browser authorization
392
+ window (up to 15 minutes), or project provisioning polling (up to 10 minutes).
393
+ For data API commands such as `doctor`, `query` and `docs import`, it remains a
394
+ shared command budget across sequential requests, retries and transfers. During
395
+ `init --connect`, management uses per-request limits and the subsequent doctor
396
+ check receives its own data API budget.
397
+ A project-limit error includes `organization.max_projects`, `projects_count`,
398
+ `can_upgrade`, and `billing_url` in JSON, plus the link in terminal diagnostics.
399
+ A transport failure or HTTP 408/5xx response to a management mutation, or uncertain
400
+ key delivery (including an incomplete successful issuance response) exits 5
401
+ with `data.state: "unknown"`; inspect existing projects
402
+ or the displayed named key in Console before explicitly retrying.
403
+
404
+ ### Session recovery
405
+
406
+ Account metadata and the per-project connection cache live beside the resolved
407
+ CLI config file as `.account.json` and `.connections.json` suffixes. They contain
408
+ no secrets. The `.management.lock` suffix serializes local login/selection work;
409
+ if a process was killed, confirm it is no longer running before removing its
410
+ stale lock. `logout` needs the saved OS entry and server connectivity to confirm
411
+ revocation; otherwise it retains metadata and fails with an actionable error.
412
+ Undelivered/unavailable account sessions expire within seven days. Project keys
413
+ have their existing lifetime; logout does not revoke them. Explicit replacement
414
+ retains older project entries for agents still pinned to them; revoke unused keys
415
+ in Console and remove their local reference deliberately.
416
+
417
+ ## Configuration and authentication
418
+
419
+ ### Environment-variable setup
420
+
421
+ For an existing project or CI, obtain its endpoint, project name and API key from
422
+ [LambdaDB Console](https://app.lambdadb.ai). No account login is required for this
423
+ path. The endpoint is the API origin, such as `https://api.lambdadb.ai`, without
424
+ `/projects/...`. HTTPS is required, except HTTP on localhost/127.0.0.1/::1 for
425
+ local testing.
426
+
427
+ ```sh
428
+ lambdadb configure --endpoint https://api.lambdadb.ai --project YOUR_DEV_PROJECT
429
+ ```
430
+
431
+ Set `LAMBDADB_API_KEY` through your shell's secure input or your CI secret manager.
432
+ For example, in Bash, this avoids putting the value into shell history:
433
+
434
+ ```bash
435
+ read -r -s -p 'LambdaDB project API key: ' LAMBDADB_API_KEY
436
+ printf '\n'
437
+ export LAMBDADB_API_KEY
438
+ ```
439
+
440
+ `init` never accepts a key value in a prompt or flag and never loads or writes
441
+ `.env` files. Keep keys out of chat, shell history and source files.
442
+
443
+ For development deployments, select the account API origin with
444
+ `--api-url https://api-dev.lambdadb.ai`. Later login renewal reuses that saved
445
+ origin unless explicitly overridden; the server supplies its configured Console
446
+ URL. HTTPS is required except for loopback tests.
447
+
448
+ ### OS credential storage
449
+
450
+ Account login and project credentials use separate OS credential-store namespaces.
451
+ The opaque account session expires after seven days and is valid only for CLI
452
+ management routes. It is never sent to MCP or agents, and is not a Console JWT or
453
+ refresh token. Run `login` again to renew it; `logout` revokes it immediately and
454
+ preserves project keys. Project settings and agent files contain only references.
455
+ Use `--credential-store auto` (default),
456
+ `keychain`, `windows`, `secret-service`, or `keyutils` to select an available OS
457
+ backend. Linux auto selection tries Secret Service, then kernel keyutils for a
458
+ new connection. Kernel storage is a cache: reboot/expiry may remove it. Existing
459
+ references always use their recorded backend; failure never silently switches
460
+ stores or issues another key. There is no plaintext-file fallback.
461
+
462
+ To remove the current connection's local OS key, run `lambdadb credentials remove`.
463
+ It leaves metadata and agent references intact and does **not** revoke the server
464
+ key. Revoke unused keys in Console under Project API Keys, using the saved key
465
+ name/ID. Explicit reconnection creates a fresh credential slot; it does not revoke
466
+ or delete older slots that other agents might still use. If key delivery or local
467
+ storage fails after approval, inspect the named `lambdadb-cli-...` key in Console
468
+ and revoke it if unused before reconnecting. Requests are never blindly retried
469
+ across an uncertain key-issuance response.
470
+
471
+ The no-plaintext-secret-persistence contract covers CLI and agent configuration
472
+ files. Browser setup deliberately persists the project key only in the selected
473
+ OS store. Environment mode does not persist a key. Agents
474
+ manage their own runtime storage; for example, Codex shell snapshots can capture
475
+ the launch environment. Review your agent's environment/snapshot settings and
476
+ protect its runtime directory when forwarding a project key.
477
+
478
+ ### Settings and precedence
479
+
480
+ No command accepts a raw key argument. Environment-mode configuration stores `endpoint`,
481
+ `project` and `apiKeyEnv`. Browser setup adds `credentialStore`, `credentialId`,
482
+ `credentialKeyId` and `credentialKeyName`, all non-secret metadata. Keys are read
483
+ from the selected environment variable or OS store at runtime. Environment variables are still
298
484
  accessible to the current process and appropriately privileged local processes;
299
485
  the CLI is not a secret vault. Avoid shell tracing around secret injection.
300
486
 
@@ -310,9 +496,9 @@ Use a CI secret manager instead of adding credentials to tracked files.
310
496
  | Endpoint | `--endpoint`, `LAMBDADB_ENDPOINT`, saved `endpoint` |
311
497
  | Project | `--project`, `LAMBDADB_PROJECT`, saved `project` |
312
498
  | Key variable name | `--api-key-env`, `LAMBDADB_API_KEY_ENV`, saved `apiKeyEnv`, `LAMBDADB_API_KEY` |
313
- | Key value | Value of the selected variable only; no fallback to another key |
499
+ | Key value | Explicit `--api-key-env` / `LAMBDADB_API_KEY_ENV` selects environment mode; otherwise use a saved OS reference when present, else the selected variable. An explicit OS reference from generated agent arguments stays bound to its store. No automatic fallback on read failure. |
314
500
  | Config path | `--config`, `LAMBDADB_CONFIG`, default user path |
315
- | Network budget | `--timeout-ms`, `LAMBDADB_TIMEOUT_MS`, `30000` milliseconds |
501
+ | Network timeout (scope above) | `--timeout-ms`, `LAMBDADB_TIMEOUT_MS`, `30000` milliseconds |
316
502
 
317
503
  There is no implicit endpoint, project, collection, branch or read ref. Explicit
318
504
  empty values fail validation instead of silently falling back. An explicitly
@@ -328,6 +514,8 @@ lambdadb configure --api-key-env MY_PROJECT_KEY
328
514
  lambdadb doctor --json
329
515
  ```
330
516
 
517
+ ### Check the connection with doctor
518
+
331
519
  `doctor` validates configuration and uses `listCollections({size: 1})` to check
332
520
  authentication and project collection-list access. Success does not prove write
333
521
  permissions, collection readiness, or search visibility. Failure provides a safe
@@ -336,12 +524,40 @@ error category and a recovery hint. SDK debug logging is disabled even when
336
524
  are not printed. The active key is redacted if echoed inside returned data.
337
525
  Other document data remains visible; redirect results to appropriate storage.
338
526
 
339
- ## First-use flow
527
+ ## Query existing data
528
+
529
+ Init does not query documents or create collections/data. Connection success does
530
+ not establish search readiness. The setup result includes a read-only agent
531
+ prompt. To inspect data directly, list collections and choose an existing
532
+ collection:
533
+
534
+ ```sh
535
+ lambdadb collections list --json
536
+ lambdadb collections describe --collection YOUR_COLLECTION --json
537
+ ```
538
+
539
+ Save `{"size":5}` in `first-query.json`, then read up to five documents:
540
+
541
+ ```sh
542
+ lambdadb query --collection YOUR_COLLECTION --ref branch:main --file first-query.json --json
543
+ ```
544
+
545
+ Omitting `query` reads sample documents. Inspect the index configuration before
546
+ searching an actual indexed field.
547
+
548
+ An empty project needs deliberately supplied data outside init. Empty results
549
+ are not evidence of indexing failure or readiness.
550
+
551
+ ## Command examples
552
+
553
+ The JSON files below are included in the package under `examples/`.
554
+
555
+ ### Try sample data in a development project
340
556
 
341
557
  Only run the following against a project explicitly designated for development.
342
- Configuration and the API key must already be supplied as above. Replace
343
- `cli-demo-docs` with a new, unique collection name. Each JSON example is included
344
- in this repository.
558
+ Connect to the project first, then replace `cli-demo-docs` with a new, unique
559
+ collection name. These commands create a collection and write sample documents;
560
+ `init` does neither.
345
561
 
346
562
  ```sh
347
563
  lambdadb doctor
@@ -382,7 +598,11 @@ Both create and update take the index map itself through `--index-config`, not a
382
598
  full request body. Updates are subject to server index-change restrictions and
383
599
  return `state: "updated"`, `searchable: "not_verified"`; acceptance does not prove
384
600
  query readiness.
385
- SDK 0.7.0 accepts 49 fixed lowercase text analyzer presets:
601
+
602
+ <details>
603
+ <summary>Text analyzer presets</summary>
604
+
605
+ The CLI accepts 49 fixed lowercase text analyzer presets:
386
606
  `standard`, `english`, `korean`, `japanese`, `chinese`, `cjk`, `arabic`,
387
607
  `french`, `german`, `hindi`, `indonesian`, `italian`, `portuguese`, `russian`,
388
608
  `spanish`, `turkish`, `armenian`, `basque`, `bengali`, `brazilian`, `bulgarian`,
@@ -398,6 +618,8 @@ analyzer does not confer keyword field sorting/facets. Nepali/Tamil/Telugu are
398
618
  Lucene extensions, not common Elasticsearch/OpenSearch support. See the
399
619
  [SDK analyzer contract](https://github.com/lambdadb/lambdadb-typescript-client/blob/v0.7.0/docs/models/analyzer.md).
400
620
 
621
+ </details>
622
+
401
623
  ### Native embeddings and Bayesian search
402
624
 
403
625
  ```sh
@@ -649,6 +871,33 @@ npm bootstrap, Trusted Publishing and release checks. CI validates Node.js 22
649
871
  and 24 using local contracts and the same CLI contracts against an installed
650
872
  tarball.
651
873
 
874
+ ### Build from source
875
+
876
+ Requires Node.js 22.14 or newer and npm. From a checkout of this repository:
877
+
878
+ ```sh
879
+ npm ci
880
+ npm run build
881
+ node dist/cli.js --help
882
+ ```
883
+
884
+ Run commands with `node dist/cli.js`, or install the built directory into a local
885
+ prefix to use the `lambdadb` executable:
886
+
887
+ ```sh
888
+ npm install --prefix "$HOME/.local" /absolute/path/to/lambdadb-cli
889
+ export PATH="$HOME/.local/node_modules/.bin:$PATH"
890
+ lambdadb --help
891
+ ```
892
+
893
+ `npm start -- ...` also works for human use. For machine-readable stdout, invoke
894
+ `node dist/cli.js ... --json` or the executable directly; npm may print banners.
895
+
896
+ ### Run checks
897
+
898
+ This CLI uses `@functional-systems/lambdadb@0.8.1` for authentication, HTTP,
899
+ read retries, pagination, bulk transfers and large response downloads.
900
+
652
901
  ```sh
653
902
  npm run lint
654
903
  npm run check:version
@@ -664,10 +913,13 @@ They do not contact a LambdaDB service. See [DESIGN.md](DESIGN.md) for contract
664
913
  decisions and [CONTRIBUTING.md](CONTRIBUTING.md#validation-scope) for validation
665
914
  methods and their limits.
666
915
 
667
- This MVP intentionally omits Branch/Tag/Alias management: default `main` supports
668
- first use, while reads can select existing refs. It also omits Console management,
669
- remote MCP, Git collection, chunking, embedding workflows, code-search logic, delete,
670
- plugins and publication. There are no changes to the SDK or reference repositories.
916
+ ### Scope and live validation
917
+
918
+ The CLI supports account login and Org/project setup, plus project-scoped data
919
+ commands. Billing, membership management and account deletion stay in Console.
920
+ Branch/Tag/Alias management, remote MCP, Git collection, chunking, code-search
921
+ workflows, data deletion and plugins are outside this CLI's current scope. Reads
922
+ can select existing refs. This change does not modify the SDK or MCP package.
671
923
 
672
924
  Live verification requires an explicitly designated development project, endpoint
673
925
  and project key. Do not discover or borrow credentials from another repository.