@functional-systems/lambdadb-cli 0.1.0-dev.1
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/CHANGELOG.md +45 -0
- package/CONTRIBUTING.md +105 -0
- package/DESIGN.md +112 -0
- package/LICENSE +202 -0
- package/README.md +309 -0
- package/RELEASING.md +239 -0
- package/VALIDATION.md +222 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +208 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.js +105 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.js +41 -0
- package/dist/errors.js.map +1 -0
- package/dist/import-workflow.d.ts +27 -0
- package/dist/import-workflow.js +60 -0
- package/dist/import-workflow.js.map +1 -0
- package/dist/input.d.ts +15 -0
- package/dist/input.js +127 -0
- package/dist/input.js.map +1 -0
- package/dist/output.d.ts +17 -0
- package/dist/output.js +68 -0
- package/dist/output.js.map +1 -0
- package/dist/runtime.d.ts +7 -0
- package/dist/runtime.js +39 -0
- package/dist/runtime.js.map +1 -0
- package/examples/documents.jsonl +3 -0
- package/examples/index-config.json +4 -0
- package/examples/query.json +5 -0
- package/package.json +56 -0
- package/src/cli.ts +209 -0
- package/src/config.ts +96 -0
- package/src/errors.ts +45 -0
- package/src/import-workflow.ts +73 -0
- package/src/input.ts +105 -0
- package/src/output.ts +69 -0
- package/src/runtime.ts +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
# LambdaDB CLI
|
|
2
|
+
|
|
3
|
+
A first, project-scoped CLI for developers, coding agents and CI. It uses
|
|
4
|
+
`@functional-systems/lambdadb@0.5.1` for authentication, HTTP, read retries,
|
|
5
|
+
pagination, bulk transfers and large response downloads.
|
|
6
|
+
|
|
7
|
+
## Install and run
|
|
8
|
+
|
|
9
|
+
Requires Node.js 22.14 or newer and npm.
|
|
10
|
+
|
|
11
|
+
### Install from npm
|
|
12
|
+
|
|
13
|
+
After the first development version is published, install the `dev` channel:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install --global @functional-systems/lambdadb-cli@dev
|
|
17
|
+
lambdadb --version
|
|
18
|
+
lambdadb --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The `dev` channel contains prerelease versions. For reproducible CI runs, pin an
|
|
22
|
+
exact published version instead of the moving `dev` tag. See
|
|
23
|
+
[RELEASING.md](RELEASING.md#current-status) for release preparation status and
|
|
24
|
+
[VALIDATION.md](VALIDATION.md) for verification results and remaining limitations.
|
|
25
|
+
|
|
26
|
+
### Build from source
|
|
27
|
+
|
|
28
|
+
From a checkout of this repository:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm ci
|
|
32
|
+
npm run build
|
|
33
|
+
node dist/cli.js --help
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Run commands with `node dist/cli.js`, or install the built directory into a local
|
|
37
|
+
prefix to use the `lambdadb` executable:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm install --prefix "$HOME/.local" /absolute/path/to/lambdadb-cli
|
|
41
|
+
export PATH="$HOME/.local/node_modules/.bin:$PATH"
|
|
42
|
+
lambdadb --help
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`npm start -- ...` also works for human use. For machine-readable stdout, invoke
|
|
46
|
+
`node dist/cli.js ... --json` or the executable directly; npm may print banners.
|
|
47
|
+
|
|
48
|
+
## Configuration and authentication
|
|
49
|
+
|
|
50
|
+
Obtain the endpoint, existing project name and project API key from the LambdaDB
|
|
51
|
+
Console. This CLI does not create projects or issue keys. Endpoint is the API
|
|
52
|
+
origin, such as `https://api.lambdadb.ai`, without `/projects/...`. HTTPS is
|
|
53
|
+
required, except HTTP on localhost/127.0.0.1/::1 for local testing.
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
lambdadb configure --endpoint https://api.lambdadb.ai --project YOUR_DEV_PROJECT
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Set `LAMBDADB_API_KEY` through your shell's secure input or your CI secret manager.
|
|
60
|
+
For example, in Bash, this avoids putting the value into shell history:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
read -r -s -p 'LambdaDB project API key: ' LAMBDADB_API_KEY
|
|
64
|
+
printf '\n'
|
|
65
|
+
export LAMBDADB_API_KEY
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
No command accepts a raw key argument. Configuration stores only `endpoint`,
|
|
69
|
+
`project` and `apiKeyEnv`. Keys are read from the selected environment variable at
|
|
70
|
+
runtime and are never persisted by this CLI. Environment variables are still
|
|
71
|
+
accessible to the current process and appropriately privileged local processes;
|
|
72
|
+
the CLI is not a secret vault. Avoid shell tracing around secret injection.
|
|
73
|
+
|
|
74
|
+
The default configuration is
|
|
75
|
+
`${XDG_CONFIG_HOME:-$HOME/.config}/lambdadb/config.json`. Writes use an atomic
|
|
76
|
+
rename and file mode `0600`; newly created directories use `0700` (POSIX).
|
|
77
|
+
Configuration is user-local, not discovered from the working repository.
|
|
78
|
+
`.env` files are not automatically loaded, and are ignored by this repository.
|
|
79
|
+
Use a CI secret manager instead of adding credentials to tracked files.
|
|
80
|
+
|
|
81
|
+
| Setting | Precedence, highest first |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| Endpoint | `--endpoint`, `LAMBDADB_ENDPOINT`, saved `endpoint` |
|
|
84
|
+
| Project | `--project`, `LAMBDADB_PROJECT`, saved `project` |
|
|
85
|
+
| Key variable name | `--api-key-env`, `LAMBDADB_API_KEY_ENV`, saved `apiKeyEnv`, `LAMBDADB_API_KEY` |
|
|
86
|
+
| Key value | Value of the selected variable only; no fallback to another key |
|
|
87
|
+
| Config path | `--config`, `LAMBDADB_CONFIG`, default user path |
|
|
88
|
+
| Network budget | `--timeout-ms`, `LAMBDADB_TIMEOUT_MS`, `30000` milliseconds |
|
|
89
|
+
|
|
90
|
+
There is no implicit endpoint, project, collection, branch or read ref. Explicit
|
|
91
|
+
empty values fail validation instead of silently falling back. An explicitly
|
|
92
|
+
selected missing config file fails except when `configure` creates it.
|
|
93
|
+
`configure` applies the same precedence and saves the selected non-secret values;
|
|
94
|
+
it does not contact the service. To reference a different secret variable:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
lambdadb configure --api-key-env MY_PROJECT_KEY
|
|
98
|
+
lambdadb doctor --json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`doctor` validates configuration and uses `listCollections({size: 1})` to check
|
|
102
|
+
authentication and project collection-list access. Success does not prove write
|
|
103
|
+
permissions, collection readiness, or search visibility. Failure provides a safe
|
|
104
|
+
error category and a recovery hint. SDK debug logging is disabled even when
|
|
105
|
+
`LAMBDADB_DEBUG` is set. Error bodies, raw SDK errors and presigned response URLs
|
|
106
|
+
are not printed. The active key is redacted if echoed inside returned data.
|
|
107
|
+
Other document data remains visible; redirect results to appropriate storage.
|
|
108
|
+
|
|
109
|
+
## First-use flow
|
|
110
|
+
|
|
111
|
+
Only run the following against a project explicitly designated for development.
|
|
112
|
+
Configuration and the API key must already be supplied as above. Replace
|
|
113
|
+
`cli-demo-docs` with a new, unique collection name. Each JSON example is included
|
|
114
|
+
in this repository.
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
lambdadb doctor
|
|
118
|
+
lambdadb collections list --size 20
|
|
119
|
+
lambdadb collections create --collection cli-demo-docs --index-config examples/index-config.json
|
|
120
|
+
lambdadb collections describe --collection cli-demo-docs
|
|
121
|
+
lambdadb docs import --collection cli-demo-docs --branch main --file examples/documents.jsonl
|
|
122
|
+
lambdadb query --collection cli-demo-docs --ref branch:main --file examples/query.json
|
|
123
|
+
lambdadb docs fetch --collection cli-demo-docs --ref branch:main --ids doc-1 doc-2 doc-3
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Collection creation returns `state: "created"`. Import returns accepted counts,
|
|
127
|
+
not committed or searchable counts. Both explicitly report
|
|
128
|
+
`searchable: "not_verified"`. The sample query uses `consistentRead: false`.
|
|
129
|
+
The first query/fetch can therefore be empty or encounter a transient loading
|
|
130
|
+
error. Repeat reads after an appropriate delay and inspect expected IDs and
|
|
131
|
+
contents; do not recreate the collection or blindly replay the import as a wait
|
|
132
|
+
mechanism. There is no CLI readiness endpoint or readiness polling claim.
|
|
133
|
+
|
|
134
|
+
For eligible ordinary writes, `docs fetch --consistent-read` or a query file
|
|
135
|
+
with `"consistentRead": true` can overlay pending writes when reading a direct
|
|
136
|
+
branch. This does not establish committed indexing, excludes pending bulk
|
|
137
|
+
imports, can return `429`, and is rejected for tag/alias refs.
|
|
138
|
+
|
|
139
|
+
### Collections
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
lambdadb collections list --all --size 100 --json
|
|
143
|
+
lambdadb collections list --page-token 'TOKEN_FROM_PREVIOUS_RESULT' --json
|
|
144
|
+
lambdadb collections describe --collection cli-demo-docs --json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
One page is the default; `nextPageToken` is an opaque continuation token.
|
|
148
|
+
`--all` uses the SDK page iterator and buffers its result within the total network
|
|
149
|
+
budget. No partial list is printed on failure. Collection statistics describe
|
|
150
|
+
the committed head of `main`, not the selected read ref or whole-index readiness.
|
|
151
|
+
The create input file is the index map itself, not a full create request body.
|
|
152
|
+
|
|
153
|
+
### Import JSONL
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
lambdadb docs import --collection cli-demo-docs --branch main \
|
|
157
|
+
--file examples/documents.jsonl --batch-size 1000 --json
|
|
158
|
+
|
|
159
|
+
lambdadb docs import --collection cli-demo-docs --branch main \
|
|
160
|
+
--file examples/documents.jsonl --mode bulk --timeout-ms 120000 --json
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Input must be a UTF-8 regular file of at most 64 MiB and 100,000 documents.
|
|
164
|
+
Each nonblank line must be a JSON object; blank lines do not count toward the
|
|
165
|
+
document limit. Split files that exceed either limit before importing.
|
|
166
|
+
If supplied, `id` must be a nonempty string. Omitted IDs are
|
|
167
|
+
generated by the service and are not returned in the acceptance response; replay
|
|
168
|
+
can create duplicates. Existing IDs are upserted and can replace existing data.
|
|
169
|
+
|
|
170
|
+
The entire file is parsed and all batch sizes are checked before any network
|
|
171
|
+
call. This keeps a malformed later line from causing a partial write, at the
|
|
172
|
+
cost of buffering the input. Lines are scanned without allocating a separate
|
|
173
|
+
array of every line, and document retention stops at the count limit. This bounds
|
|
174
|
+
the overhead of many small documents, not the total process memory: large or
|
|
175
|
+
complex documents can still use much more memory than the raw file size. Batches run
|
|
176
|
+
sequentially and stop on the first failure. Counts count input records, not unique
|
|
177
|
+
IDs. Repeated IDs are sent in input order; server resolution within a batch is
|
|
178
|
+
not a CLI guarantee.
|
|
179
|
+
|
|
180
|
+
Ordinary upsert defaults to 1,000 documents and a 4,000,000-byte serialized
|
|
181
|
+
request cap including branch/envelope overhead. Bulk defaults to 1,000 documents
|
|
182
|
+
and 16,000,000 bytes; `--batch-bytes` allows up to 64,000,000. These are conservative
|
|
183
|
+
CLI limits, not advertised server maxima. The SDK also enforces the bulk limit
|
|
184
|
+
returned by the server. `--mode bulk` calls the existing SDK `bulkUpsertDocs`
|
|
185
|
+
helper with the selected branch, including signed upload headers and finalization.
|
|
186
|
+
Bulk is unsupported for managed embedding vector fields; use ordinary upsert.
|
|
187
|
+
|
|
188
|
+
Import result fields are stable under `schemaVersion: 1`:
|
|
189
|
+
|
|
190
|
+
- `total`, `accepted`, `failed`, `unknown`, `notAttempted`: input record counts;
|
|
191
|
+
their outcome counts sum to `total`.
|
|
192
|
+
- `batches`: attempted batch number, first/last physical JSONL lines, document
|
|
193
|
+
count, state and a sanitized error where applicable.
|
|
194
|
+
- `state`: `accepted`, `failed`, `partial` or `unknown`.
|
|
195
|
+
- `searchable`: always `not_verified` in this MVP.
|
|
196
|
+
|
|
197
|
+
A definite HTTP rejection is `failed`. A disconnect, timeout, server error or
|
|
198
|
+
invalid success response after dispatch is conservatively `unknown`. An unknown
|
|
199
|
+
batch takes precedence over partial success in the exit code. The bulk SDK does
|
|
200
|
+
not expose structured failure stages for local/upload exceptions, so those also
|
|
201
|
+
use `unknown`; it can overstate uncertainty when upload failed before finalization.
|
|
202
|
+
The CLI does not parse SDK error strings to guess the stage. A deadline reached
|
|
203
|
+
between batches leaves unsent records `notAttempted`.
|
|
204
|
+
|
|
205
|
+
There are no durable checkpoints, automatic resume, exactly-once guarantees,
|
|
206
|
+
write retries or server mutation receipts. Inspect the selected branch and batch
|
|
207
|
+
line ranges before constructing a deliberate retry. Do not treat accepted counts
|
|
208
|
+
as a readiness check. A hard process kill may prevent any final report.
|
|
209
|
+
|
|
210
|
+
### Query and fetch at explicit refs
|
|
211
|
+
|
|
212
|
+
```sh
|
|
213
|
+
lambdadb query --collection cli-demo-docs --ref tag:release-one --file examples/query.json --json
|
|
214
|
+
lambdadb docs fetch --collection cli-demo-docs --ref alias:production --ids doc-1 --json
|
|
215
|
+
lambdadb docs fetch --collection cli-demo-docs --ref branch:main --ids doc-1 --consistent-read --json
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
These examples require the named ref to exist. Query files use the SDK/API
|
|
219
|
+
request body, including a `query` object and optional `size`, `sort`, `fields`,
|
|
220
|
+
`partitionFilter`, `consistentRead` and `includeVectors`. The query DSL is forwarded
|
|
221
|
+
to the API, not reimplemented in the CLI. Unknown top-level fields are rejected.
|
|
222
|
+
`size` accepts 1–100, `null`, or omission; null is normalized to SDK omission.
|
|
223
|
+
An optional file `ref` must match the mandatory `--ref`; conflicting selectors
|
|
224
|
+
are rejected. Fetch accepts up to 100 IDs and reports `missingIds` without
|
|
225
|
+
turning a successful missing-document response into an error.
|
|
226
|
+
|
|
227
|
+
The SDK downloads large query/fetch responses from `docsUrl` automatically using
|
|
228
|
+
its separate unauthenticated transfer client. Results are buffered, not streamed
|
|
229
|
+
or truncated. The CLI omits the consumed signed URL. No ref is resolved to or
|
|
230
|
+
claimed to pin a snapshot by the CLI. Branches and aliases can move between calls.
|
|
231
|
+
|
|
232
|
+
## Output, deadlines and exit codes
|
|
233
|
+
|
|
234
|
+
`--json` emits exactly one JSON object plus a newline on stdout for an executed
|
|
235
|
+
command, including failures. It contains `schemaVersion`, `command`, `ok`, optional
|
|
236
|
+
`target`, `data` and `error`. Target includes endpoint/project and, where relevant,
|
|
237
|
+
collection and explicit ref/branch. Errors use stable categories and safe hints.
|
|
238
|
+
API-specific response data may grow as the upstream API evolves. Help/version
|
|
239
|
+
remain plain text even with `--json`. Default output adds a readable summary and
|
|
240
|
+
pretty-printed data. Progress and diagnostics go only to stderr. No ANSI styling
|
|
241
|
+
or interactive prompts are used.
|
|
242
|
+
|
|
243
|
+
Credential redaction preserves fixed protocol field names and command, status,
|
|
244
|
+
ref-kind and error-code tokens, even when a short credential coincides with one
|
|
245
|
+
of them. It redacts variable string values and arbitrary document, index-config
|
|
246
|
+
and tag-map keys. Returned data can therefore differ from the stored data when
|
|
247
|
+
it contains the selected credential; public protocol tokens remain unchanged.
|
|
248
|
+
If redacted map keys collide, unchanged keys keep their names and renamed keys
|
|
249
|
+
receive unique `#N` suffixes, skipping existing names. Every entry is retained,
|
|
250
|
+
with values still subject to credential redaction. Suffixes are local to each map.
|
|
251
|
+
|
|
252
|
+
| Exit | Meaning |
|
|
253
|
+
| --- | --- |
|
|
254
|
+
| `0` | Success, including empty search/fetch results and write acceptance |
|
|
255
|
+
| `2` | Invalid CLI input, file, request shape or configuration/missing credentials |
|
|
256
|
+
| `3` | Authentication/API/request failure, or import with no accepted/unknown batches |
|
|
257
|
+
| `4` | Incomplete import with some accepted records, no unknown outcomes |
|
|
258
|
+
| `5` | At least one write outcome is unknown; inspect before retrying |
|
|
259
|
+
|
|
260
|
+
The shared network deadline defaults to 30 seconds, covers retries, all pages,
|
|
261
|
+
batches and signed transfers, and accepts 1–3,600,000 milliseconds. It starts
|
|
262
|
+
after import/query input preflight. SIGINT/SIGTERM abort active network work;
|
|
263
|
+
imports preserve acknowledged progress where the process can still report it.
|
|
264
|
+
File parsing and formatting are outside the network budget. Read calls use the
|
|
265
|
+
SDK backoff with a two-second retry budget; its sleep can add up to approximately
|
|
266
|
+
500 ms after cancellation. Writes and bulk steps disable automatic retries.
|
|
267
|
+
|
|
268
|
+
## Development and boundaries
|
|
269
|
+
|
|
270
|
+
Development changes target the Git `develop` branch; reviewed release promotions
|
|
271
|
+
for rc/stable target `main`. Once npm setup is complete and automatic publication
|
|
272
|
+
is enabled, successful develop push CI publishes uniquely versioned packages on
|
|
273
|
+
the `dev` channel. CI generates the number; developers do not increment it for
|
|
274
|
+
every merge. Newer work may supersede pending builds. Stable releases remain
|
|
275
|
+
explicit and use `latest`. See [CONTRIBUTING.md](CONTRIBUTING.md) for branch roles, PR checks
|
|
276
|
+
and the release boundary. [RELEASING.md](RELEASING.md) covers version channels,
|
|
277
|
+
npm bootstrap, Trusted Publishing and release checks. CI validates Node.js 22
|
|
278
|
+
and 24 using local contracts and the same CLI contracts against an installed
|
|
279
|
+
tarball.
|
|
280
|
+
|
|
281
|
+
```sh
|
|
282
|
+
npm run lint
|
|
283
|
+
npm run check:version
|
|
284
|
+
npm run typecheck
|
|
285
|
+
npm test
|
|
286
|
+
npm run test:package
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Tests execute the real CLI and installed SDK against loopback HTTP servers. They
|
|
290
|
+
cover the complete first-use flow, ref forwarding, signed transfers, pagination,
|
|
291
|
+
partial and unknown writes, validation, output, credentials and exit codes.
|
|
292
|
+
They do not contact a LambdaDB service. See [DESIGN.md](DESIGN.md) for contract
|
|
293
|
+
evidence and [VALIDATION.md](VALIDATION.md) for measured verification scope.
|
|
294
|
+
|
|
295
|
+
This MVP intentionally omits Branch/Tag/Alias management: default `main` supports
|
|
296
|
+
first use, while reads can select existing refs. It also omits Console management,
|
|
297
|
+
MCP, Git collection, chunking, embedding workflows, code-search logic, delete,
|
|
298
|
+
plugins and publication. There are no changes to the SDK or reference repositories.
|
|
299
|
+
|
|
300
|
+
Live verification requires an explicitly designated development project, endpoint
|
|
301
|
+
and project key. Do not discover or borrow credentials from another repository.
|
|
302
|
+
Use `npm run test:live` with the explicit opt-in settings in
|
|
303
|
+
[RELEASING.md](RELEASING.md#explicit-live-smoke). It exercises ordinary/bulk import
|
|
304
|
+
and committed query/fetch contents in a random temporary collection, then uses
|
|
305
|
+
the SDK to clean up that collection. The normal test suite and CI never run it.
|
|
306
|
+
|
|
307
|
+
## License
|
|
308
|
+
|
|
309
|
+
Licensed under the [Apache License, Version 2.0](LICENSE).
|
package/RELEASING.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Releasing LambdaDB CLI
|
|
2
|
+
|
|
3
|
+
## Current status
|
|
4
|
+
|
|
5
|
+
The first public development candidate is `0.1.0-dev.1`, targeting npm's `dev`
|
|
6
|
+
channel. Release preparation sets `private: false`; metadata now permits
|
|
7
|
+
publication, but no package has been published by this project workflow.
|
|
8
|
+
The CLI is licensed under [Apache-2.0](LICENSE), with matching package metadata.
|
|
9
|
+
The development-project smoke is recorded in [VALIDATION.md](VALIDATION.md).
|
|
10
|
+
npm organization permission verification and an authorized first bootstrap from
|
|
11
|
+
reviewed `develop` remain required. Main promotion is required for rc/stable
|
|
12
|
+
releases, not for development publication. Automatic dev publication is disabled
|
|
13
|
+
until the repository variable `NPM_DEV_PUBLISH_ENABLED` is set to `true` after
|
|
14
|
+
bootstrap and Trusted Publishing setup.
|
|
15
|
+
The public npm lookup for `@functional-systems/lambdadb-cli` returned E404 on
|
|
16
|
+
2026-09-18; this is not proof that the name is available or that ownership exists.
|
|
17
|
+
|
|
18
|
+
The workflow rejects private packages and missing license metadata. Explicit
|
|
19
|
+
rc/stable releases also require matching tags, prerelease flags and dated
|
|
20
|
+
changelog entries. Passing metadata validation does not establish live-service
|
|
21
|
+
verification. Enabling automatic dev publication authorizes eligible develop
|
|
22
|
+
pushes to publish after CI; rc/stable publication remains an explicit action.
|
|
23
|
+
|
|
24
|
+
## Branch and version policy
|
|
25
|
+
|
|
26
|
+
Follow [CONTRIBUTING.md](CONTRIBUTING.md): feature/fix PRs target `develop`,
|
|
27
|
+
promotion PRs target `main`. Development versions publish from `develop` after
|
|
28
|
+
CI, while rc/stable releases publish from reviewed `main` history. npm `latest`,
|
|
29
|
+
not the main branch tip, identifies the stable npm version.
|
|
30
|
+
|
|
31
|
+
| Source | Package version | Trigger | npm dist-tag |
|
|
32
|
+
| --- | --- | --- | --- |
|
|
33
|
+
| `develop` | `X.Y.Z-dev.N` | Push CI succeeds and automatic publication is enabled | `dev` |
|
|
34
|
+
| `main` history | `X.Y.Z-rc.N` | GitHub prerelease `vX.Y.Z-rc.N` is published | `rc` |
|
|
35
|
+
| `main` history | `X.Y.Z` | GitHub release `vX.Y.Z` is published | `latest` |
|
|
36
|
+
|
|
37
|
+
Only these canonical version forms are supported. No leading zeroes or build
|
|
38
|
+
suffixes. For reviewed version changes, update package.json and both root version
|
|
39
|
+
entries in package-lock.json together; `npm version VERSION --no-git-tag-version`
|
|
40
|
+
prepares this without a tag. For explicit releases, move release notes from
|
|
41
|
+
Unreleased to a dated `## [VERSION] - YYYY-MM-DD` section.
|
|
42
|
+
The executable reads package.json, so it has no independently maintained version.
|
|
43
|
+
|
|
44
|
+
## Automatic development publication
|
|
45
|
+
|
|
46
|
+
The `CI` workflow lives in `.github/workflows/publish.yaml`. Its Node 22 and 24
|
|
47
|
+
jobs must both succeed for the exact push commit. Only a push to this repository's
|
|
48
|
+
`develop` can enter automatic publication; PRs, main pushes and manual CI runs
|
|
49
|
+
cannot. Only the publishing job receives `id-token: write`. No LambdaDB service
|
|
50
|
+
keys are available to CI, so automatic dev builds do not imply a fresh live smoke.
|
|
51
|
+
|
|
52
|
+
Keep a reviewed development base such as `0.1.0-dev.1` in Git. The publishing job
|
|
53
|
+
uses the `X.Y.Z` prefix and sets `N` to `git rev-list --first-parent --count HEAD`
|
|
54
|
+
from a full checkout. For example, count 12 produces `0.1.0-dev.12`. The counter
|
|
55
|
+
includes commits that were never published; it is not necessarily consecutive
|
|
56
|
+
in npm. A rerun of the same commit produces the same version. Force pushes and
|
|
57
|
+
history rewrites must remain disabled. When starting the next release line,
|
|
58
|
+
review a new base such as `0.2.0-dev.1`, including when synchronizing main back.
|
|
59
|
+
|
|
60
|
+
Generated package/lock versions and `gitHead` are changed only in the runner;
|
|
61
|
+
there are no version-bump commits, Git tags or GitHub Releases for automatic dev
|
|
62
|
+
builds. The source changelog remains a reviewed summary rather than generating
|
|
63
|
+
a dated entry for every build. npm `gitHead` and provenance identify the source.
|
|
64
|
+
The workflow packs once, tests that exact tarball, and publishes it with
|
|
65
|
+
`--tag dev --provenance`; `latest` is not changed.
|
|
66
|
+
|
|
67
|
+
Dev publication jobs are serialized without interrupting an active registry
|
|
68
|
+
write. A newer pending job can replace an older pending job. The current remote
|
|
69
|
+
develop head is checked before preparation and immediately before publishing;
|
|
70
|
+
stale jobs are skipped. The existing dev tag is also compared numerically to
|
|
71
|
+
prevent an older version from moving it backward. This follows the latest
|
|
72
|
+
eligible develop head rather than guaranteeing an artifact for every rapid merge.
|
|
73
|
+
|
|
74
|
+
If a version already exists, a rerun checks its source commit and tarball integrity
|
|
75
|
+
and skips publication only when they agree and the dev tag already points there.
|
|
76
|
+
Conflicts fail; missing or older tag state requires maintainer investigation.
|
|
77
|
+
Registry authentication, transport and invalid-response failures are not treated
|
|
78
|
+
as missing versions. A publish request is never retried automatically. After a
|
|
79
|
+
successful write, bounded registry reads verify the manifest and dev tag. If
|
|
80
|
+
propagation is delayed, retry reads before rerunning the job. Newer dev versions
|
|
81
|
+
and stale commits are skipped without changing tags.
|
|
82
|
+
|
|
83
|
+
After setup, an eligible push is sufficient; no manual version increment is
|
|
84
|
+
needed. Users update with `npm install -g @functional-systems/lambdadb-cli@dev`,
|
|
85
|
+
or pin an exact published version for reproducible CI. Installed CLIs do not
|
|
86
|
+
update themselves. Disable `NPM_DEV_PUBLISH_ENABLED` to stop future automatic
|
|
87
|
+
publications; do not cancel an active registry write to simulate rollback.
|
|
88
|
+
|
|
89
|
+
Treat command/flag changes, required target changes, JSON envelope changes and
|
|
90
|
+
exit-code reinterpretations as compatibility changes. Describe migrations before
|
|
91
|
+
shipping them. Additive optional fields can remain schemaVersion 1; incompatible
|
|
92
|
+
JSON envelope changes require a new schemaVersion. During 0.x, put incompatible
|
|
93
|
+
changes in a minor release; after 1.0, use a major release. Keep patch releases
|
|
94
|
+
compatible. Human summaries are not a scripting interface.
|
|
95
|
+
|
|
96
|
+
## Bootstrap and explicit rc/stable release preflight
|
|
97
|
+
|
|
98
|
+
1. Prepare and review the release version, license file/metadata, changelog,
|
|
99
|
+
dependency changes and package inventory. Set `private: false` only in this
|
|
100
|
+
explicitly approved preparation. Preserve the exact repository URL.
|
|
101
|
+
2. Run the following in a clean checkout of the candidate commit with Node
|
|
102
|
+
22.14+ (CI tests current Node 22 and 24). Do not load production credentials.
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
npm ci
|
|
106
|
+
npm run lint
|
|
107
|
+
npm run check:version
|
|
108
|
+
npm run typecheck
|
|
109
|
+
npm test
|
|
110
|
+
npm run test:package
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
3. Run the live smoke below against an explicitly designated development project.
|
|
114
|
+
Record commit, SDK version, endpoint/project, command, outcome and cleanup
|
|
115
|
+
without keys or signed URLs. Missing credentials are a blocked release
|
|
116
|
+
prerequisite, not a skipped success. PR CI deliberately has no service keys.
|
|
117
|
+
4. For rc/stable releases, promote to main by reviewed PR with required CI
|
|
118
|
+
checks. The first development bootstrap can use reviewed develop directly.
|
|
119
|
+
Re-run checks/live smoke if release contents changed. Record the verified
|
|
120
|
+
commit in release notes.
|
|
121
|
+
5. Obtain explicit authorization for the immutable tag and publication. Tag the
|
|
122
|
+
verified main commit with `vVERSION`, push that tag, and publish a GitHub
|
|
123
|
+
Release with `prerelease: true` for rc and `false` for stable. Draft releases
|
|
124
|
+
do not publish npm. For the first development bootstrap, use the separate
|
|
125
|
+
procedure below; do not publish a dev GitHub Release.
|
|
126
|
+
6. `.github/workflows/publish.yaml` validates main ancestry and metadata, runs
|
|
127
|
+
lint/types/local tests, packs once, installs and tests that exact tarball, then
|
|
128
|
+
publishes it with the selected dist-tag and provenance. The release workflow
|
|
129
|
+
does not rerun the credentialed live prerequisite; release owners must retain
|
|
130
|
+
that evidence before publishing the GitHub Release.
|
|
131
|
+
7. Verify the workflow, npm version/dist-tag, provenance's repository/commit and
|
|
132
|
+
a clean consumer install of the exact version. Test the installed binary's
|
|
133
|
+
version/help and basic JSON behavior. Confirm a dev/rc release did not move
|
|
134
|
+
`latest`. Synchronize release-only main changes back to develop by PR.
|
|
135
|
+
|
|
136
|
+
Useful read-only checks after publication:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
npm view @functional-systems/lambdadb-cli@VERSION version dist.integrity dist.attestations --json
|
|
140
|
+
npm view @functional-systems/lambdadb-cli dist-tags --json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Do not move published tags or republish a used version. If registry metadata is
|
|
144
|
+
slow to propagate, retry reads; do not initiate another publication. For a bad
|
|
145
|
+
release, stop promotion, document the impact and prepare a new patch version.
|
|
146
|
+
Deprecation or dist-tag changes are explicit maintainer actions, not automatic
|
|
147
|
+
rollback. Never silently downgrade consumers.
|
|
148
|
+
|
|
149
|
+
## First publication and npm Trusted Publishing
|
|
150
|
+
|
|
151
|
+
Trusted Publishers are package-specific. The SDK's configuration does not cover
|
|
152
|
+
this CLI. npm requires an existing package before configuring its trust policy.
|
|
153
|
+
See the official [npm trust prerequisites](https://docs.npmjs.com/cli/v11/commands/npm-trust/).
|
|
154
|
+
|
|
155
|
+
For a new package, first complete the reviewed release preparation and preflight.
|
|
156
|
+
An authorized npm organization owner performs the bootstrap from the verified
|
|
157
|
+
develop commit, using interactive `npm login` and the account's MFA, then
|
|
158
|
+
publishing the tested `0.1.0-dev.1` tarball with `--access public --tag dev`.
|
|
159
|
+
Verify that the account has publication rights in npm's `functional-systems`
|
|
160
|
+
organization; GitHub organization membership does not supply npm permissions.
|
|
161
|
+
Use a real prerelease, not an empty placeholder. This
|
|
162
|
+
one-time local publication does not provide GitHub Actions provenance. Do not
|
|
163
|
+
also trigger the publish workflow for that same already-published version.
|
|
164
|
+
|
|
165
|
+
After bootstrap, open the CLI package's npm **Settings → Trusted Publisher** and
|
|
166
|
+
select GitHub Actions. Use these values for the workflow in this repository:
|
|
167
|
+
|
|
168
|
+
| npm setting | Value |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| Package | `@functional-systems/lambdadb-cli` |
|
|
171
|
+
| Organization or user | `lambdadb` |
|
|
172
|
+
| Repository | `lambdadb-cli` |
|
|
173
|
+
| Workflow filename | `publish.yaml` (filename only) |
|
|
174
|
+
| Environment name | Leave empty; the job currently declares no environment |
|
|
175
|
+
| Allowed actions | Enable direct `npm publish` |
|
|
176
|
+
|
|
177
|
+
After those settings are saved, enable automatic publication in GitHub repository
|
|
178
|
+
**Settings → Secrets and variables → Actions → Variables** by setting
|
|
179
|
+
`NPM_DEV_PUBLISH_ENABLED=true`. This grants ongoing publication to eligible
|
|
180
|
+
develop pushes. The next develop push (or rerun of its existing push workflow)
|
|
181
|
+
validates and publishes an automatically numbered version. Keep the variable
|
|
182
|
+
unset until bootstrap and trust configuration are complete. `workflow_dispatch`
|
|
183
|
+
runs validation only. Push-triggered dev publication does not require main to
|
|
184
|
+
contain the workflow; explicit GitHub Release handling does require the workflow
|
|
185
|
+
on the default branch.
|
|
186
|
+
|
|
187
|
+
The workflow uses a GitHub-hosted runner, Node 24, npm >=11.5.1 and
|
|
188
|
+
`id-token: write`. No long-lived npm secret is required. If a GitHub Environment
|
|
189
|
+
is later added, its exact name must also be configured on npm. Saving settings
|
|
190
|
+
does not prove OIDC works; verify the next authorized publication. Current npm
|
|
191
|
+
configurations can default to staged publishing only, which is insufficient for
|
|
192
|
+
this direct-publish workflow. See [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/).
|
|
193
|
+
|
|
194
|
+
## Explicit live smoke
|
|
195
|
+
|
|
196
|
+
Provision a disposable development project/key outside this tool, with create,
|
|
197
|
+
ordinary and bulk write, query/fetch and temporary-collection delete access.
|
|
198
|
+
Supply the key through secure shell input or a secret manager, never in history.
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
export LAMBDADB_ENDPOINT=https://YOUR_DEV_API_ORIGIN
|
|
202
|
+
export LAMBDADB_PROJECT=YOUR_DEV_PROJECT
|
|
203
|
+
# Inject LAMBDADB_API_KEY securely; no .env file is loaded automatically.
|
|
204
|
+
export LAMBDADB_RUN_LIVE_TESTS=1
|
|
205
|
+
export LAMBDADB_LIVE_CONFIRM_PROJECT="$LAMBDADB_PROJECT"
|
|
206
|
+
npm run test:live
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The test fails before API calls when required settings are absent. It creates a
|
|
210
|
+
random temporary collection, imports two 3 MiB documents plus a bulk document,
|
|
211
|
+
and checks committed query/fetch contents with a maximum 300-second observation
|
|
212
|
+
window per stage. Request timeouts and polling sleeps are capped to the remaining
|
|
213
|
+
budget, and responses at or after the deadline cannot pass. Process termination
|
|
214
|
+
and event-loop scheduling may delay reporting. It reports elapsed time and
|
|
215
|
+
matched-document counts; a timeout is a failed smoke, not proof that accepted
|
|
216
|
+
writes were rejected or lost.
|
|
217
|
+
Collection cleanup uses the SDK because deletion is outside the public CLI MVP.
|
|
218
|
+
Only the test's own collection is eligible for cleanup. An interrupted process
|
|
219
|
+
or failed cleanup may leave that named collection; inspect it manually.
|
|
220
|
+
|
|
221
|
+
This sample does not prove global index readiness, ranking quality, every ref's
|
|
222
|
+
live behavior, or exactly-once writes. A large result alone does not prove the
|
|
223
|
+
service selected docsUrl; mock tests explicitly exercise that transport path.
|
|
224
|
+
Use existing known development tag/alias refs for additional live ref evidence.
|
|
225
|
+
|
|
226
|
+
## Design references
|
|
227
|
+
|
|
228
|
+
- LambdaDB TypeScript client `RELEASING.md` and `publish.yaml`: canonical channels,
|
|
229
|
+
separate live evidence, same tested artifact and OIDC. This CLI intentionally
|
|
230
|
+
publishes dev from develop, while rc/stable releases require main history.
|
|
231
|
+
- LambdaDB migration `.goreleaser.yml`/release workflow and `install.sh`: verify
|
|
232
|
+
installed artifacts and explicit versions. Go binaries, GoReleaser and Docker
|
|
233
|
+
distribution are unnecessary for this npm CLI's first release.
|
|
234
|
+
- [Command Line Interface Guidelines](https://clig.dev/): preserve machine output,
|
|
235
|
+
separate diagnostics, avoid interactive CI requirements, protect secrets and
|
|
236
|
+
test cancellation. The CLI contract suite exercises these boundaries.
|
|
237
|
+
|
|
238
|
+
External documentation checked on 2026-09-18. Consult current npm documentation
|
|
239
|
+
when configuring the package; registry requirements can change independently.
|