@headband/cli 0.6.0 → 0.7.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.
- package/README.md +36 -16
- package/dist/index.js +588 -91
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -187,7 +187,8 @@ has its own indexes and its own keys.
|
|
|
187
187
|
|
|
188
188
|
```bash
|
|
189
189
|
headband branch list [--project <id>] [--json]
|
|
190
|
-
headband branch create <name> --empty [--parent <name>] [--expires-in <2h|7d>] [--project <id>] [--json]
|
|
190
|
+
headband branch create <name> [--empty] [--parent <name>] [--expires-in <2h|7d>] [--project <id>] [--json]
|
|
191
|
+
headband branch ensure <name> [--from <parent>] [--expires-in <7d>] [--env-out <file>] [--project <id>] [--json]
|
|
191
192
|
headband branch delete <name> [--project <id>] [--yes] [--json]
|
|
192
193
|
headband branch protect <name> [--project <id>] [--json]
|
|
193
194
|
headband branch unprotect <name> [--project <id>] [--json]
|
|
@@ -197,13 +198,25 @@ headband branch checkout <name> [--project <id>] [--json]
|
|
|
197
198
|
|
|
198
199
|
- The project comes from `--project`, else the directory's checkout (below).
|
|
199
200
|
With neither, the command is a usage error.
|
|
200
|
-
- `create`
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
- `create` forks the parent (`--parent`, default: the primary branch): the
|
|
202
|
+
new branch starts with the parent's indexes, documents and settings,
|
|
203
|
+
copy-on-write. `--empty` makes a branch with no indexes instead. A parent
|
|
204
|
+
with an index that cannot fork (Typesense, Visor, your own engine) fails
|
|
205
|
+
with exit `6` (code `fork_not_supported`). Until forking is on for your
|
|
206
|
+
organization, a fork fails with exit `6` (code `fork_not_available`), and
|
|
207
|
+
until branches other than main open, every `create` fails with exit `6`
|
|
208
|
+
(code `branches_not_open`). `--expires-in` deletes the branch on its own
|
|
209
|
+
after that long. Forking by default is new in CLI 0.7.0: before it,
|
|
210
|
+
`create` needed `--empty`.
|
|
211
|
+
- `ensure` is for preview deploys, such as a Vercel build step. It forks the
|
|
212
|
+
branch from `--from` (default: the primary) unless it exists, pushes its
|
|
213
|
+
expiry `--expires-in` out (default `7d`), mints a search key and an admin
|
|
214
|
+
key on it, and writes `HEADBAND_URL`, `HEADBAND_PROJECT_ID`,
|
|
215
|
+
`HEADBAND_BRANCH`, `HEADBAND_BRANCH_ID`, `HEADBAND_SEARCH_KEY`,
|
|
216
|
+
`HEADBAND_ADMIN_KEY` and one `HEADBAND_<ENGINE>_URL` per engine to
|
|
217
|
+
`--env-out <file>`, replacing any `HEADBAND_*` lines there. Without
|
|
218
|
+
`--env-out` it prints them. The name is made branch-safe first, so a git
|
|
219
|
+
branch name works as is. It refuses the primary branch (CLI 0.7.0).
|
|
207
220
|
- `delete` removes the branch with its indexes, keys and engines. It asks
|
|
208
221
|
first. The primary branch, a protected branch, a branch with live child
|
|
209
222
|
branches and a branch with Sync-owned indexes are refused (exit `6`).
|
|
@@ -269,8 +282,7 @@ error, so a name is never matched across projects by accident.
|
|
|
269
282
|
project of their own and would ignore it. The exception is `keys create`, which
|
|
270
283
|
sends the project in its body (see Keys).
|
|
271
284
|
|
|
272
|
-
|
|
273
|
-
parent), `reset`, `rollback`, `restore` and `set-primary`.
|
|
285
|
+
Not available yet: `reset`, `rollback`, `restore` and `set-primary`.
|
|
274
286
|
|
|
275
287
|
### Keys
|
|
276
288
|
|
|
@@ -528,8 +540,11 @@ headband schema forget <index> [--yes] [--json]
|
|
|
528
540
|
- `apply` runs the migration files the server does not have yet, in order. A
|
|
529
541
|
new index is created and backfilled from every source row (rows
|
|
530
542
|
`shouldIndex` rejects are left out). A schema change builds a new index
|
|
531
|
-
beside the live one, backfills it and switches the name over.
|
|
532
|
-
index
|
|
543
|
+
beside the live one, backfills it and switches the name over. Rows your app
|
|
544
|
+
writes during the backfill still go to the live index, so `apply` then
|
|
545
|
+
compares every document of the new index with its source row and writes the
|
|
546
|
+
ones that differ, once before the switch and once after it (CLI 0.6.1).
|
|
547
|
+
Removing an index needs `--allow-destructive`. `--json` prints
|
|
533
548
|
`{appliedFiles, appliedOps, projectId}`.
|
|
534
549
|
- `apply` recognises migrations the server already has from its schema state,
|
|
535
550
|
so a fresh checkout or CI applies without `headband/migrations/.applied.json`.
|
|
@@ -600,7 +615,7 @@ changes to an outbox table, and the worker pushes them to Headband. The
|
|
|
600
615
|
headband sync init [--table <name>] [--write] [--apply] [--json]
|
|
601
616
|
headband sync worker [--loop] [--budget-ms <ms>] [--batch-size <n>] [--reconcile-every <n>] [--project <id>] [--json]
|
|
602
617
|
headband sync worker --scaffold docker [--force] [--json]
|
|
603
|
-
headband sync reconcile [--fix] [--json]
|
|
618
|
+
headband sync reconcile [--content] [--fix] [--json]
|
|
604
619
|
headband sync retry-dead-letters [--json]
|
|
605
620
|
headband sync status [--json]
|
|
606
621
|
```
|
|
@@ -617,7 +632,9 @@ headband sync status [--json]
|
|
|
617
632
|
`--json` sends progress to stderr and prints the report when the worker
|
|
618
633
|
stops. A row that fails is printed with its model, ids and error; a batch
|
|
619
634
|
that fails is retried row by row, so one bad row never fails the others.
|
|
620
|
-
Rows that keep failing move to the dead letters.
|
|
635
|
+
Rows that keep failing move to the dead letters. A batch that fails because
|
|
636
|
+
Headband or the network is unavailable goes back to the queue without
|
|
637
|
+
counting an attempt, so an outage never fills the dead letters (CLI 0.6.1). Each invocation is recorded
|
|
621
638
|
as one run under the connector `orm-sync` (`GET /v1/connectors/runs`); with
|
|
622
639
|
the org-wide login key that needs `--project <id>` or the config's
|
|
623
640
|
`projectId`. `--reconcile-every <n>` runs `reconcile` after every n-th batch.
|
|
@@ -626,8 +643,11 @@ headband sync status [--json]
|
|
|
626
643
|
service for it. The container needs `DATABASE_URL` and `HEADBAND_API_KEY`.
|
|
627
644
|
- `reconcile` compares the source rows that belong in each index (every row
|
|
628
645
|
`shouldIndex` keeps) with the documents in it, and reports how many are
|
|
629
|
-
missing and how many are extra (counts, not ids). `--
|
|
630
|
-
and
|
|
646
|
+
missing and how many are extra (counts, not ids). `--content` also compares
|
|
647
|
+
every document with its freshly resolved source row and counts the stale
|
|
648
|
+
ones; it reads the whole index, so it takes about as long as a backfill (CLI
|
|
649
|
+
0.6.1). `--fix` pushes the missing (and with `--content` the stale) and
|
|
650
|
+
deletes the extra. It exits
|
|
631
651
|
`1` when drift is left. `--json` prints `{indexes, drift}`. The index's ids
|
|
632
652
|
are read by cursor, so a Visor index past 1000 documents is compared id by
|
|
633
653
|
id too.
|