@dokebi/cli 0.4.59 → 0.4.60
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/AI.md +1 -0
- package/catalog.json +11 -11
- package/dist/output.d.ts +1 -1
- package/dist/output.js +1 -1
- package/dist/transaction.js +67 -5
- package/package.json +1 -1
package/AI.md
CHANGED
|
@@ -193,6 +193,7 @@ Nothing else sits right under `src/shared/`: `dokebi check` warns `shared-folder
|
|
|
193
193
|
|
|
194
194
|
## 5. Settings rules
|
|
195
195
|
|
|
196
|
+
- **A settings folder on another file system (0.4.60).** Every change the CLI makes (dokebi.yaml with `config set`, `config secret --stdin`, generated files) is staged in `.dokebi/transaction-*` and renamed into place; when the target sits on another file system — a settings folder mounted into a container, `DOKEBI_CONFIG` on a mounted volume — that rename fails (EXDEV), so the CLI stages beside the target instead (a hidden `.<name>.transaction-*` file in its own folder, renamed from there: still one atomic replace) and keeps the original there until the commit stands. A symlink is still refused (`UNSAFE_PATH`): mount the folder, do not link it.
|
|
196
197
|
- **Reloadable options (D-0154).** Options marked `reloadable` in their schema (`x-dokebi-reloadable: true`; `(reloadable)` in the option tables of the plugin guides) apply while the app runs: saving dokebi.yaml (the app watches it, `options.reload.watch`), `npx dokebi reload` after `dokebi start`, or `dokebi dev` reloading in place. The CLI writes `# reloadable` after each such key it writes into dokebi.yaml and dokebi.example.yaml, and `config show` marks them (JSON `reloadable`). A change of any other option needs a restart: the app refuses the whole reload (`CONFIG_RELOAD_RESTART_REQUIRED`, nothing applied) and keeps running. `options.reload` (core): `watch` (true), `debounceMs` (50–60000, 300), `signal` (true; SIGHUP), `prepareTimeoutMs` (1000–600000, 30000), `watchRetryMs` (1000–3600000, 5000), all reloadable; `config set reload.<key>=…` checks them.
|
|
197
198
|
- **Settings of the application (D-0155).** Settings your own code needs (limits, sizes, times of a feature) go into a section declared with `npx dokebi settings add <section>`, never a hand-made `options.<name>` read with your own parser: only a declared section is checked at start and known to `config`, doctor, the example and reloads.
|
|
198
199
|
- On install, the safe defaults and descriptions the schema states go into the YAML, and existing values and comments are kept. Secrets and connection URLs are never generated (`writeOnly: true` marks a sensitive value).
|
package/catalog.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Generated by scripts/catalog/build.ts from package.json dokebiCatalog fields and packages/cli/catalog-src (D-0065). Do not edit; run node scripts/catalog/build.ts.",
|
|
3
3
|
"schemaVersion": 1,
|
|
4
|
-
"cli": "0.4.
|
|
4
|
+
"cli": "0.4.60",
|
|
5
5
|
"core": {
|
|
6
6
|
"package": "@dokebi/core",
|
|
7
|
-
"version": "0.4.
|
|
7
|
+
"version": "0.4.8"
|
|
8
8
|
},
|
|
9
9
|
"capabilities": {
|
|
10
10
|
"admin.ui": {
|
|
@@ -825,7 +825,7 @@
|
|
|
825
825
|
{
|
|
826
826
|
"id": null,
|
|
827
827
|
"package": "@dokebi/cli",
|
|
828
|
-
"version": "0.4.
|
|
828
|
+
"version": "0.4.60",
|
|
829
829
|
"kind": "cli",
|
|
830
830
|
"summary": "Commands to create a project, browse the plugin catalog, run recipes, install plugins and verify (dokebi)",
|
|
831
831
|
"description": "Project scaffolding, plugin catalog, recipes, install and verification CLI for Dokebi.",
|
|
@@ -972,7 +972,7 @@
|
|
|
972
972
|
{
|
|
973
973
|
"id": null,
|
|
974
974
|
"package": "@dokebi/core",
|
|
975
|
-
"version": "0.4.
|
|
975
|
+
"version": "0.4.8",
|
|
976
976
|
"kind": "core",
|
|
977
977
|
"summary": "Application core: settings loading, plugin registration, lifecycle, logger and shared libraries (required)",
|
|
978
978
|
"description": "Minimal composable Node.js application and plugin lifecycle framework.",
|
|
@@ -1697,7 +1697,7 @@
|
|
|
1697
1697
|
{
|
|
1698
1698
|
"id": "dokebi-job",
|
|
1699
1699
|
"package": "@dokebi/job",
|
|
1700
|
-
"version": "0.4.
|
|
1700
|
+
"version": "0.4.7",
|
|
1701
1701
|
"kind": "plugin",
|
|
1702
1702
|
"summary": "NATS JetStream job queue (at least once, retries, DLQ)",
|
|
1703
1703
|
"description": "Bounded durable jobs over the Dokebi NATS provider: retries, delayed redelivery and a dead-letter stream.",
|
|
@@ -1710,7 +1710,7 @@
|
|
|
1710
1710
|
"jetstream"
|
|
1711
1711
|
],
|
|
1712
1712
|
"maturity": "preview",
|
|
1713
|
-
"core": "^0.4.
|
|
1713
|
+
"core": "^0.4.8",
|
|
1714
1714
|
"provides": [
|
|
1715
1715
|
"job.durable"
|
|
1716
1716
|
],
|
|
@@ -2179,7 +2179,7 @@
|
|
|
2179
2179
|
{
|
|
2180
2180
|
"id": "dokebi-nats",
|
|
2181
2181
|
"package": "@dokebi/nats",
|
|
2182
|
-
"version": "0.4.
|
|
2182
|
+
"version": "0.4.3",
|
|
2183
2183
|
"kind": "plugin",
|
|
2184
2184
|
"summary": "Named NATS connections (Core and JetStream publishing, durable consumers)",
|
|
2185
2185
|
"description": "Named NATS connections and bounded JetStream publication for Dokebi.",
|
|
@@ -2191,7 +2191,7 @@
|
|
|
2191
2191
|
"messaging"
|
|
2192
2192
|
],
|
|
2193
2193
|
"maturity": "preview",
|
|
2194
|
-
"core": "^0.4.
|
|
2194
|
+
"core": "^0.4.8",
|
|
2195
2195
|
"provides": [
|
|
2196
2196
|
"messaging.nats"
|
|
2197
2197
|
],
|
|
@@ -2866,7 +2866,7 @@
|
|
|
2866
2866
|
{
|
|
2867
2867
|
"id": "dokebi-rollups",
|
|
2868
2868
|
"package": "@dokebi/rollups",
|
|
2869
|
-
"version": "0.2.
|
|
2869
|
+
"version": "0.2.1",
|
|
2870
2870
|
"kind": "plugin",
|
|
2871
2871
|
"summary": "Report roll-ups by @dokebi/db AI.md 6.9: facts recorded as small rows in the caller's transaction (no hot row), folded in parallel by outbox lanes into UTC hour rows and day and month rows per whole-hour time zone (rebuilt from the hours when a zone is added), bounded reads with an as-of time, running totals and a report budget (429, 503)",
|
|
2872
2872
|
"description": "Report roll-ups for Dokebi by @dokebi/db AI.md 6.9: facts recorded as small rows in the caller's transaction, folded by outbox lanes into UTC hour rows and day and month rows per time zone, bounded reads with an as-of time and a report budget.",
|
|
@@ -3061,7 +3061,7 @@
|
|
|
3061
3061
|
{
|
|
3062
3062
|
"id": "dokebi-seal",
|
|
3063
3063
|
"package": "@dokebi/seal",
|
|
3064
|
-
"version": "0.4.
|
|
3064
|
+
"version": "0.4.5",
|
|
3065
3065
|
"kind": "plugin",
|
|
3066
3066
|
"summary": "Seals WebSocket frames and HTTP bodies (obfuscation, replay protection) with a browser client (WASM)",
|
|
3067
3067
|
"description": "Payload sealing (obfuscation, replay defence, in-transit encryption) for seal hosts: @dokebi/websocket frames and @dokebi/web HTTP bodies, with browser socket, fetch and Inertia clients and their WASM loader",
|
|
@@ -3751,7 +3751,7 @@
|
|
|
3751
3751
|
{
|
|
3752
3752
|
"id": "dokebi-websocket",
|
|
3753
3753
|
"package": "@dokebi/websocket",
|
|
3754
|
-
"version": "0.4.
|
|
3754
|
+
"version": "0.4.6",
|
|
3755
3755
|
"kind": "plugin",
|
|
3756
3756
|
"summary": "WebSocket routes, rooms and broadcast on top of dokebi-web (at most once)",
|
|
3757
3757
|
"description": "WebSocket routes on @dokebi/web with rooms and broadcast across servers through @dokebi/websocket-hub.",
|
package/dist/output.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.4.
|
|
1
|
+
export declare const CLI_VERSION = "0.4.60";
|
|
2
2
|
export declare function envelope(command: string, result: unknown, ok?: boolean): object;
|
|
3
3
|
export declare function failure(command: string, error: unknown, mutationStarted: boolean): object;
|
package/dist/output.js
CHANGED
package/dist/transaction.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { constants as fsConstants } from 'node:fs';
|
|
2
|
+
import { copyFile, link, lstat, mkdir, mkdtemp, open, readdir, readFile, rename, rm, rmdir, unlink, writeFile, } from 'node:fs/promises';
|
|
2
3
|
import { basename, dirname, join, relative } from 'node:path';
|
|
3
4
|
import { hash as hashing } from '@dokebi/core/libraries';
|
|
4
5
|
import { debug, debugEnabled, describeError, reportError } from './diagnostics.js';
|
|
@@ -421,11 +422,15 @@ export class Transaction {
|
|
|
421
422
|
}
|
|
422
423
|
await mkdir(dirname(target), { recursive: true });
|
|
423
424
|
if (change.existed) {
|
|
424
|
-
|
|
425
|
+
// A target on another file system (a settings folder mounted into a container) cannot
|
|
426
|
+
// be renamed into the transaction folder (EXDEV): its original goes beside it instead,
|
|
427
|
+
// under a hidden name, and the journal says where.
|
|
428
|
+
change.backup = await this.#moveAside(target, change.backup, `old-${index}`);
|
|
425
429
|
change.backedUp = true;
|
|
430
|
+
await writeFile(join(this.directory, 'journal.json'), json(journal));
|
|
426
431
|
}
|
|
427
432
|
if (change.source) {
|
|
428
|
-
await
|
|
433
|
+
await this.#install(change.source, target, index);
|
|
429
434
|
change.installed = true;
|
|
430
435
|
}
|
|
431
436
|
}
|
|
@@ -439,6 +444,11 @@ export class Transaction {
|
|
|
439
444
|
});
|
|
440
445
|
await this.#rollback(journal, cause);
|
|
441
446
|
}
|
|
447
|
+
// The commit stands: originals kept beside their targets (another file system) go now; the
|
|
448
|
+
// ones in the transaction folder go with it in close(). A leftover is said, never hidden.
|
|
449
|
+
for (const change of journal)
|
|
450
|
+
if (change.backedUp && dirname(change.backup) !== this.directory)
|
|
451
|
+
await rm(change.backup, { force: true }).catch((error) => reportError('TRANSACTION_BACKUP_LEFT', `Transaction could not remove the original kept beside ${relative(this.root, change.backup)}`, error));
|
|
442
452
|
}
|
|
443
453
|
async #rollback(journal, cause) {
|
|
444
454
|
const failures = [];
|
|
@@ -522,9 +532,9 @@ export class Transaction {
|
|
|
522
532
|
return { path: change.path, reason: differs(change.installs, now), ...backup };
|
|
523
533
|
// Move it aside (atomic), then look again: an edit between the look and the move is
|
|
524
534
|
// found here and put back, never deleted.
|
|
525
|
-
|
|
535
|
+
let aside = join(this.directory, `rollback-${index}`);
|
|
526
536
|
try {
|
|
527
|
-
await
|
|
537
|
+
aside = await this.#moveAside(target, aside, `rollback-${index}`);
|
|
528
538
|
}
|
|
529
539
|
catch (error) {
|
|
530
540
|
if (error.code !== 'ENOENT')
|
|
@@ -548,6 +558,58 @@ export class Transaction {
|
|
|
548
558
|
return { path: change.path, reason: 'created', ...backup };
|
|
549
559
|
return undefined;
|
|
550
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* Renames `target` to `aside`; across file systems (EXDEV: `target` on a mount) to a hidden name
|
|
563
|
+
* in `target`'s own folder instead. Returns where it went.
|
|
564
|
+
*/
|
|
565
|
+
async #moveAside(target, aside, label) {
|
|
566
|
+
try {
|
|
567
|
+
await rename(target, aside);
|
|
568
|
+
return aside;
|
|
569
|
+
}
|
|
570
|
+
catch (error) {
|
|
571
|
+
if (error.code !== 'EXDEV')
|
|
572
|
+
throw error;
|
|
573
|
+
}
|
|
574
|
+
const beside = this.#beside(target, label);
|
|
575
|
+
debug('Transaction keeps an original beside it (another file system)', { path: target });
|
|
576
|
+
await rename(target, beside);
|
|
577
|
+
return beside;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Puts a staged file at `target`. Across file systems (EXDEV) it is copied to a hidden name in
|
|
581
|
+
* `target`'s folder first and renamed from there, so the replacement stays one atomic rename.
|
|
582
|
+
*/
|
|
583
|
+
async #install(source, target, index) {
|
|
584
|
+
try {
|
|
585
|
+
await rename(source, target);
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
catch (error) {
|
|
589
|
+
if (error.code !== 'EXDEV')
|
|
590
|
+
throw error;
|
|
591
|
+
}
|
|
592
|
+
if ((await lstat(source)).isDirectory())
|
|
593
|
+
throw new CliError('UNSAFE_PATH', `A folder cannot be installed across file systems: ${relative(this.root, target)}`);
|
|
594
|
+
const beside = this.#beside(target, `new-${index}`);
|
|
595
|
+
debug('Transaction installs through a file beside the target (another file system)', {
|
|
596
|
+
path: target,
|
|
597
|
+
});
|
|
598
|
+
try {
|
|
599
|
+
// COPYFILE_EXCL: never over a file of that name; the mode (0600) comes along.
|
|
600
|
+
await copyFile(source, beside, fsConstants.COPYFILE_EXCL);
|
|
601
|
+
await rename(beside, target);
|
|
602
|
+
}
|
|
603
|
+
catch (error) {
|
|
604
|
+
await rm(beside, { force: true });
|
|
605
|
+
throw error;
|
|
606
|
+
}
|
|
607
|
+
await rm(source, { force: true });
|
|
608
|
+
}
|
|
609
|
+
/** A hidden name in `target`'s folder that belongs to this transaction. */
|
|
610
|
+
#beside(target, label) {
|
|
611
|
+
return join(dirname(target), `.${basename(target)}.${basename(this.directory)}.${label}`);
|
|
612
|
+
}
|
|
551
613
|
/**
|
|
552
614
|
* Moves `from` to `to` without replacing anything at `to`: false when something is there. A
|
|
553
615
|
* file goes by link + unlink (link fails on an existing name); a folder (or a file system
|