@warlock.js/core 5.32.0 → 5.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/esm/application/application-config-types.d.mts +8 -0
  3. package/esm/application/application-config-types.d.mts.map +1 -1
  4. package/esm/application/boot-signal.d.mts +8 -8
  5. package/esm/application/boot-signal.d.mts.map +1 -1
  6. package/esm/application/boot-signal.mjs +15 -9
  7. package/esm/application/boot-signal.mjs.map +1 -1
  8. package/esm/cli/commands/ai/ai-command.action.mjs +140 -0
  9. package/esm/cli/commands/ai/ai-command.action.mjs.map +1 -0
  10. package/esm/cli/commands/ai.command.mjs +50 -0
  11. package/esm/cli/commands/ai.command.mjs.map +1 -0
  12. package/esm/cli/commands/check/check-command.action.mjs +3 -0
  13. package/esm/cli/commands/check/check-command.action.mjs.map +1 -1
  14. package/esm/cli/commands/check.command.mjs +6 -1
  15. package/esm/cli/commands/check.command.mjs.map +1 -1
  16. package/esm/cli/commands/pm2/pm2-command.action.mjs +91 -0
  17. package/esm/cli/commands/pm2/pm2-command.action.mjs.map +1 -0
  18. package/esm/cli/commands/pm2/pm2-config.mjs +115 -0
  19. package/esm/cli/commands/pm2/pm2-config.mjs.map +1 -0
  20. package/esm/cli/commands/pm2.command.mjs +53 -0
  21. package/esm/cli/commands/pm2.command.mjs.map +1 -0
  22. package/esm/cli/framework-cli-commands.mjs +4 -0
  23. package/esm/cli/framework-cli-commands.mjs.map +1 -1
  24. package/esm/connectors/connectors-manager.d.mts.map +1 -1
  25. package/esm/connectors/connectors-manager.mjs +1 -4
  26. package/esm/connectors/connectors-manager.mjs.map +1 -1
  27. package/esm/connectors/shutdown-timeout.mjs +7 -0
  28. package/esm/connectors/shutdown-timeout.mjs.map +1 -0
  29. package/esm/connectors/socket-connector.d.mts.map +1 -1
  30. package/esm/connectors/socket-connector.mjs +8 -1
  31. package/esm/connectors/socket-connector.mjs.map +1 -1
  32. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs +6 -8
  33. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs.map +1 -1
  34. package/esm/dev-server/health-checker/default-health-checkers.mjs +6 -15
  35. package/esm/dev-server/health-checker/default-health-checkers.mjs.map +1 -1
  36. package/esm/dev-server/health-checker/eslint-support.mjs +27 -0
  37. package/esm/dev-server/health-checker/eslint-support.mjs.map +1 -0
  38. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts +2 -1
  39. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts.map +1 -1
  40. package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs +2 -11
  41. package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs.map +1 -1
  42. package/esm/generations/features/index.mjs +2 -0
  43. package/esm/generations/features/index.mjs.map +1 -1
  44. package/esm/generations/features/process.feature.mjs +65 -0
  45. package/esm/generations/features/process.feature.mjs.map +1 -0
  46. package/esm/http/port-preflight.d.mts.map +1 -1
  47. package/esm/http/port-preflight.mjs +2 -0
  48. package/esm/http/port-preflight.mjs.map +1 -1
  49. package/esm/index.d.mts +7 -2
  50. package/esm/index.mjs +7 -2
  51. package/esm/secrets/errors.d.mts +9 -0
  52. package/esm/secrets/errors.d.mts.map +1 -0
  53. package/esm/secrets/errors.mjs +22 -0
  54. package/esm/secrets/errors.mjs.map +1 -0
  55. package/esm/secrets/file-backend.mjs +167 -0
  56. package/esm/secrets/file-backend.mjs.map +1 -0
  57. package/esm/secrets/index.d.mts +6 -0
  58. package/esm/secrets/index.mjs +6 -0
  59. package/esm/secrets/keyring-backend.mjs +50 -0
  60. package/esm/secrets/keyring-backend.mjs.map +1 -0
  61. package/esm/secrets/memory-backend.d.mts +12 -0
  62. package/esm/secrets/memory-backend.d.mts.map +1 -0
  63. package/esm/secrets/memory-backend.mjs +28 -0
  64. package/esm/secrets/memory-backend.mjs.map +1 -0
  65. package/esm/secrets/secret-store.d.mts +25 -0
  66. package/esm/secrets/secret-store.d.mts.map +1 -0
  67. package/esm/secrets/secret-store.mjs +117 -0
  68. package/esm/secrets/secret-store.mjs.map +1 -0
  69. package/esm/secrets/secrets.d.mts +11 -0
  70. package/esm/secrets/secrets.d.mts.map +1 -0
  71. package/esm/secrets/secrets.mjs +63 -0
  72. package/esm/secrets/secrets.mjs.map +1 -0
  73. package/esm/secrets/types.d.mts +22 -0
  74. package/esm/secrets/types.d.mts.map +1 -0
  75. package/esm/socket/index.d.mts +2 -2
  76. package/esm/socket/index.mjs +2 -2
  77. package/esm/socket/utils.d.mts +7 -0
  78. package/esm/socket/utils.d.mts.map +1 -1
  79. package/esm/socket/utils.mjs +12 -1
  80. package/esm/socket/utils.mjs.map +1 -1
  81. package/esm/tests/fakes/index.d.mts +2 -1
  82. package/esm/tests/fakes/index.mjs +2 -1
  83. package/esm/tests/fakes/secrets-fake.d.mts +13 -0
  84. package/esm/tests/fakes/secrets-fake.d.mts.map +1 -0
  85. package/esm/tests/fakes/secrets-fake.mjs +50 -0
  86. package/esm/tests/fakes/secrets-fake.mjs.map +1 -0
  87. package/esm/tests/fakes/test-fakes.d.mts +2 -2
  88. package/esm/tests/fakes/test-fakes.d.mts.map +1 -1
  89. package/esm/tests/fakes/test-fakes.mjs +5 -2
  90. package/esm/tests/fakes/test-fakes.mjs.map +1 -1
  91. package/esm/tests/index.d.mts +2 -1
  92. package/esm/tests/index.mjs +2 -1
  93. package/esm/tests/vitest-setup.d.mts +1 -1
  94. package/esm/tests/vitest-setup.mjs.map +1 -1
  95. package/esm/tooling/check/lint-step.d.mts +2 -8
  96. package/esm/tooling/check/lint-step.d.mts.map +1 -1
  97. package/esm/tooling/check/lint-step.mjs +14 -11
  98. package/esm/tooling/check/lint-step.mjs.map +1 -1
  99. package/esm/tooling/check/run-check.d.mts +2 -0
  100. package/esm/tooling/check/run-check.d.mts.map +1 -1
  101. package/esm/tooling/check/run-check.mjs +2 -2
  102. package/esm/tooling/check/run-check.mjs.map +1 -1
  103. package/esm/upgrade/codemods/index.mjs +2 -0
  104. package/esm/upgrade/codemods/index.mjs.map +1 -1
  105. package/esm/upgrade/codemods/oxc-toolchain.mjs +142 -0
  106. package/esm/upgrade/codemods/oxc-toolchain.mjs.map +1 -0
  107. package/esm/upgrade/codemods/toolchain-templates.mjs +244 -0
  108. package/esm/upgrade/codemods/toolchain-templates.mjs.map +1 -0
  109. package/esm/upgrade/run-upgrade.mjs +25 -6
  110. package/esm/upgrade/run-upgrade.mjs.map +1 -1
  111. package/esm/warlock-config/types.d.mts +2 -1
  112. package/esm/warlock-config/types.d.mts.map +1 -1
  113. package/llms-full.txt +326 -19
  114. package/llms.txt +3 -2
  115. package/package.json +23 -13
  116. package/skills/README.md +2 -1
  117. package/skills/index.md +1 -1
  118. package/skills/run-app/SKILL.md +114 -5
  119. package/skills/store-secrets/SKILL.md +102 -0
  120. package/skills/test-fakes/SKILL.md +13 -11
  121. package/skills/upgrade-from-5-29/SKILL.md +39 -2
  122. package/skills/warlock-check/SKILL.md +5 -1
  123. package/skills/warlock-doctor/SKILL.md +9 -0
  124. package/skills/wire-socket/SKILL.md +19 -0
  125. package/skills/write-cli-command/SKILL.md +21 -0
package/llms-full.txt CHANGED
@@ -4430,7 +4430,7 @@ const result = await measure("publish-event", () =>
4430
4430
 
4431
4431
  ---
4432
4432
  name: run-app
4433
- description: 'Three operational commands — `warlock dev` (HMR + type-gen + health checks), `warlock build` (esbuild bundle), `warlock start` (spawn the production bundle). All flags, all `warlock.config.ts` knobs that shape them. Triggers: `warlock dev`, `warlock build`, `warlock start`, `devServer`, `--fresh`, `--skip-typings`, `--skip-health`, `outdir`, `outFile`, `sourcemap`, `PortInUseError`, `assertPortIsAvailable`, `EADDRINUSE`, `EsbuildBinaryMissingError`, `detectJavaScriptRuntime`, `assertNodeOnlyCommand`, Bun, Deno, `bun dist/app.js`, `deno run -A`; "start the dev server", "build for production", "run the bundle", "skip type generation", "tune watch globs", "dev server keyboard shortcuts", "press r to restart", "press q to quit", "restart the dev server", "port already in use", "run on Bun", "run on Deno", "supported runtimes"; typical config `warlock.config.ts > devServer / build`. Skip: writing a custom CLI — the `write-cli-command` topic; config shape — the `configure-app` topic; competing tooling `nodemon`, `tsx`, `ts-node-dev`, `esbuild` direct.'
4433
+ description: 'Operational commands — `warlock dev` (HMR + type-gen + health checks), `warlock build` (esbuild bundle), `warlock start` (spawn the production bundle), `warlock pm2 init` / `reload` (optional deployment tooling). All flags, all `warlock.config.ts` knobs that shape them. Triggers: `warlock pm2`, `ecosystem.config.cjs`, `wait_ready`, `kill_timeout`, `app.shutdownTimeout`, `warlock dev`, `warlock build`, `warlock start`, `devServer`, `--fresh`, `--skip-typings`, `--skip-health`, `outdir`, `outFile`, `sourcemap`, `PortInUseError`, `assertPortIsAvailable`, `EADDRINUSE`, `EsbuildBinaryMissingError`, `detectJavaScriptRuntime`, `assertNodeOnlyCommand`, Bun, Deno, `bun dist/app.js`, `deno run -A`; "start the dev server", "build for production", "run the bundle", "skip type generation", "tune watch globs", "dev server keyboard shortcuts", "press r to restart", "press q to quit", "restart the dev server", "port already in use", "run on Bun", "run on Deno", "supported runtimes"; typical config `warlock.config.ts > devServer / build`. Skip: writing a custom CLI — the `write-cli-command` topic; config shape — the `configure-app` topic; competing tooling `nodemon`, `tsx`, `ts-node-dev`, `esbuild` direct.'
4434
4434
  ---
4435
4435
 
4436
4436
  # Warlock — run the app
@@ -4580,13 +4580,13 @@ export default defineConfig({
4580
4580
 
4581
4581
  - **`watch.include` / `watch.exclude`** — globs piped into the file watcher. Override when you have non-`.ts(x)` files driving reloads (e.g. SQL fixtures), or to exclude a generated folder.
4582
4582
  - **`generateTypings`** — turn off if you're committing generated typings and don't want them rewritten on every boot. The `--skip-typings` flag is the per-run version.
4583
- - **`healthCheckers`** — built-in switches (`{ typescript?, eslint?, oxlint? }`), custom file health checker contracts, or `false` to disable. The `--skip-health` flag disables all checkers for that run. TypeScript runs by default. ESLint uses core's dependency and requires only an app-root flat config; Oxlint requires its package installed in the app plus a config. Both run when configured.
4583
+ - **`healthCheckers`** — built-in switches (`{ typescript?, eslint?, oxlint? }`), custom file health checker contracts, or `false` to disable. The `--skip-health` flag disables all checkers for that run. TypeScript runs by default. ESLint uses core's dependency and requires only an app-root flat config; Oxlint requires its package installed in the app plus a config. ESLint is disabled by default; explicitly set `eslint: true` to retain it until removal in 5.34.0. Enabling it prints one deprecation warning and the Oxc migration command.
4584
4584
  - **`transpileCacheDebug`** — diagnostic only. Names `.warlock/transpile/*.js` files `<slug>.<hash>.js` and appends `// @source <path>` markers so you can eyeball which cache entry came from which source. Leave off in normal use.
4585
4585
  - **`checkForUpdates`** — on `warlock dev` start, check npm for a newer `@warlock.js/core` and print a one-line notice if one exists. Best-effort and non-blocking; auto-skipped in CI and non-TTY shells. In an interactive terminal the notice arms a **`u` shortcut** that updates every `@warlock.js/*` package, installs, and restarts the server; elsewhere it prints `npx warlock update` instead. The registry answer is cached for 24h in `.warlock/update-check.json`, so a day of restarts costs one lookup. See the `update-packages` topic.
4586
4586
  - **`restartOnConfigChange`** — restart the dev server when `warlock.config.ts` or any `.env*` changes (default `true`). Set `false` to get a warning instead and restart by hand. Neither file can be hot-reloaded, so without a restart the running services keep the old values.
4587
4587
  - **`timings`** — print a one-line, per-phase breakdown next to the `hmr update` line on every hot reload: `watcher`, `debounce`, `graph`, `reimport`, `connectors`. `watcher` is the raw-fs-notification-to-stabilised-event gap (chokidar's `awaitWriteFinish` window); `debounce` is the handler's own adaptive wait; the rest are self-explanatory. Opt-in, off by default — a disabled flag costs one boolean check per reload, since the watcher-settle bookkeeping only runs when this is on. Use it to see which phase a slow reload is actually spending time in.
4588
4588
 
4589
- ### Optional Oxlint file checks
4589
+ ### Default Oxlint file checks
4590
4590
 
4591
4591
  Install `oxlint` in the app (`npm install --save-dev oxlint`) and add `.oxlintrc.json` at the app root:
4592
4592
 
@@ -4608,7 +4608,7 @@ export default defineConfig({
4608
4608
  });
4609
4609
  ```
4610
4610
 
4611
- Omit the switches to run TypeScript and every installed/configured linter; `true` still requires the linter's config, and Oxlint also requires its app-installed package. Set `oxlint: false` to disable only Oxlint while leaving other defaults intact. A custom checker array replaces the built-in list. Config discovery also accepts `.oxlintrc.jsonc`, `oxlint.config.ts` and `oxlint.config.mts`; use JSON/JSONC on Node 22.15 because current Oxlint TypeScript configs need Node 22.18 or newer.
4611
+ Omit the switches to run TypeScript and installed/configured Oxlint; ESLint is off by default and requires `eslint: true`; `true` still requires the linter's config, and Oxlint also requires its app-installed package. Set `oxlint: false` to disable only Oxlint while leaving other defaults intact. A custom checker array replaces the built-in list. Config discovery also accepts `.oxlintrc.jsonc`, `oxlint.config.ts` and `oxlint.config.mts`; use JSON/JSONC on Node 22.15 because current Oxlint TypeScript configs need Node 22.18 or newer.
4612
4612
 
4613
4613
  ## `warlock build` — production bundle
4614
4614
 
@@ -4842,11 +4842,120 @@ Configured http.port "03999" normalised to 3999.
4842
4842
  Three consequences worth knowing:
4843
4843
 
4844
4844
  1. **A queue worker with no http connector still reports.** Readiness hangs on a completed boot, not on a bound port. `port` is simply absent.
4845
- 2. **Running the bundle any other way changes nothing.** `node dist/app.js`, a Docker `CMD`, or pm2 — the signal is a strict no-op without both the IPC channel and the handshake flag, so Warlock never writes into a channel that belongs to another supervisor.
4845
+ 2. **PM2 receives its own readiness message (5.33.0+).** With an IPC channel and PM2's `pm_id` present, core sends `"ready"` after completed boot and leaves the channel open. Plain Node/Docker launches without IPC remain silent. `warlock start` takes priority when its handshake is present.
4846
4846
  3. **A bundle built before 4.11.0 has no signal.** It starts and runs normally, and after ten seconds prints a note on **stderr only** telling you to re-run `warlock build`. An absent signal is never an error, never fails the run, and never kills a slow boot.
4847
4847
 
4848
4848
  If you need the same fact inside the app, use `Application.onceBooted()` / `Application.whenBooted()` — the signal and your listeners fire from the same latch.
4849
4849
 
4850
+ ## `warlock pm2 init` / `reload` — optional production supervision
4851
+
4852
+ PM2 is operator tooling, never a core dependency. Install it separately and
4853
+ put `pm2` on `PATH`. Generate from the app root with the target environment:
4854
+
4855
+ ```bash
4856
+ NODE_ENV=production npx warlock build
4857
+ NODE_ENV=production npx warlock pm2 init
4858
+ # package.json name=store, app.appName=api → store-api-production
4859
+ pm2 start ecosystem.config.cjs --only store-api-production
4860
+
4861
+ # Deploy a fresh successful build, then reload only this app:
4862
+ NODE_ENV=production npx warlock pm2 reload
4863
+ NODE_ENV=production npx warlock pm2 reload --id 7
4864
+ ```
4865
+
4866
+ `init` reads app/http/socket config and resolved build paths without starting
4867
+ connectors, bootstrap or prestart. It creates `ecosystem.config.cjs` exclusively;
4868
+ an existing file is an error. It works without PM2 installed or a prior build.
4869
+ The file runs the built entry directly, with an absolute `cwd`, Node interpreter
4870
+ and source maps matching `build.sourcemap`.
4871
+
4872
+ The identity is `<project>-<app>-<NODE_ENV>`; project defaults to `package.json`
4873
+ name (`@team/store` → `team-store`), app to `app.appName` or `app`, environment
4874
+ to `NODE_ENV` or `development`. Use `--project store --app api` to override the
4875
+ components, and repeat those overrides on reload. Components accept letters,
4876
+ digits, `_` and `-`, starting with a letter/digit. Choose a combination unique
4877
+ within the daemon; no patterns or broad selectors are supported.
4878
+
4879
+ ```bash
4880
+ NODE_ENV=production npx warlock pm2 init --project store --app api \
4881
+ --cluster --instances 2 --listen-timeout 60000
4882
+ NODE_ENV=production npx warlock pm2 reload --project store --app api
4883
+ ```
4884
+
4885
+ Defaults: `exec_mode: "fork"`, `instances: 1`, `wait_ready: true`,
4886
+ `listen_timeout: 30000`. `--cluster` opts into two workers by default;
4887
+ `--instances` accepts a positive integer or `max`, only with `--cluster`.
4888
+ Fork reload falls back to restart and may interrupt traffic. PM2 cluster reload
4889
+ can replace workers while others serve, but a boot/readiness timeout can still
4890
+ cause downtime. Keep both the PM2 daemon and app on Node 22.15+; cluster uses
4891
+ the daemon's runtime.
4892
+
4893
+ `kill_timeout` equals the existing overall connector budget,
4894
+ `app.shutdownTimeout` (default 10000ms), now typed on `AppConfigurations`:
4895
+
4896
+ ```ts
4897
+ import type { AppConfigurations } from "@warlock.js/core";
4898
+
4899
+ export default {
4900
+ appName: "api",
4901
+ shutdownTimeout: 20000,
4902
+ } satisfies AppConfigurations;
4903
+ ```
4904
+
4905
+ Keep `http.gracefulShutdown.timeout` lower (e.g. 10000ms), with room for other
4906
+ connectors, hooks and log flushes. PM2's kill timer covers the whole exit;
4907
+ core's connector timer starts after app hooks and finishes before log flushing.
4908
+ The generated comment and CLI output show the configured readiness URL (or an
4909
+ unavailable notice for no HTTP, disabled health or ephemeral ports). PM2 itself
4910
+ does not poll it. Use an external deployment probe.
4911
+
4912
+ Core emits `process.send("ready")` once at completed boot when PM2's `pm_id`
4913
+ and IPC are present, after HTTP and the connectors have started. It never
4914
+ disconnects PM2's channel. Socket-only apps also await the listener and reject
4915
+ bind failures before completing boot. Rebuild with core 5.33+ before using `wait_ready`.
4916
+ `listen_timeout` limits waiting for readiness; `kill_timeout` limits shutdown
4917
+ before PM2's forced kill. Core handles PM2's default `SIGINT` gracefully.
4918
+
4919
+ With sockets enabled, cluster generation/reload refuse a missing
4920
+ `socket.adapter` factory and require `socket.options.transports: ["websocket"]`
4921
+ with WebSocket-only clients. The adapter handles broadcasts; polling still
4922
+ needs sticky routing to each worker, which this generator does not install.
4923
+ For polling, use individual fork listeners behind a sticky proxy or a custom
4924
+ cluster primary. See the `wire-socket` topic. Avoid duplicating worker jobs
4925
+ and in-memory sessions across HTTP workers.
4926
+
4927
+ `reload` requires a successful build marker, reads `pm2 jlist`, verifies **all**
4928
+ exact-name matches against the app's absolute cwd and entry, then calls
4929
+ `pm2 reload <numeric-id>` sequentially. `--id` narrows to one verified worker.
4930
+ Foreign cwd/script, invalid selectors, offline cluster workers or cluster
4931
+ workers without `wait_ready` are refused before reload. Reload uses settings
4932
+ already registered in PM2; regenerate/reapply the ecosystem when they change.
4933
+
4934
+ On shared servers, inspect the current PM2 id and path before stopping:
4935
+
4936
+ ```bash
4937
+ pm2 list
4938
+ pm2 show 7
4939
+ pm2 stop 7
4940
+ ```
4941
+
4942
+ Repeat for each intended worker id. Never stop by pattern or broad name, and
4943
+ avoid daemon-wide operations. PM2 ids are not OS PIDs and can change after an
4944
+ app is deleted/recreated.
4945
+
4946
+ To put logger entries in PM2's captured stdout, configure
4947
+ `src/config/log.ts` with `production: { channels: [new ConsoleLog()] }`
4948
+ (`ConsoleLog` comes from `@warlock.js/logger`). Keep `time: false` and omit
4949
+ `log_date_format` to preserve the logger's timestamp/module/action format.
4950
+ Generated `merge_logs: false` keeps worker logs separate. PM2 JSON output wraps
4951
+ captured text; it does not recover logger fields. Use `JSONFileLog` with a
4952
+ distinct per-worker storage path for structured persistent entries.
4953
+
4954
+ Official references: [PM2 readiness/shutdown](https://pm2.keymetrics.io/docs/usage/signals-clean-restart/),
4955
+ [cluster reload](https://pm2.keymetrics.io/docs/usage/cluster-mode/),
4956
+ [Socket.IO multiple nodes](https://socket.io/docs/v4/using-multiple-nodes/).
4957
+ Full docs: `docs/src/content/docs/v/latest/core/cli/pm2.mdx`.
4958
+
4850
4959
  ## Runtimes — Node, Bun, Deno
4851
4960
 
4852
4961
  | Command | Node.js 22.15+ | Bun 1.4.3 | Deno 2.9.7 |
@@ -6378,25 +6487,132 @@ Client `PUT`s the bytes straight to R2 — your server never sees them.
6378
6487
  - The `send-response` topic — `response.sendFile(absPath)` for serving local files.
6379
6488
 
6380
6489
 
6490
+ ## store-secrets `@warlock.js/core/store-secrets/SKILL.md`
6491
+
6492
+ ---
6493
+ name: store-secrets
6494
+ description: "Store app credentials with secrets.get/set/remove/has and environmentName; lazy optional OS keychain, read-only scoped environment variables, encrypted file fallback, typed SecretStoreError and memory-backed secretsFake. Use for provider keys and OAuth credentials the app must read back. Skip user passwords (hash-password) and encrypted database columns (encrypt-data)."
6495
+ ---
6496
+
6497
+ # Application secret store
6498
+
6499
+ Use core's facade; there is no separate package or preparation step:
6500
+
6501
+ ```ts
6502
+ import { secrets, SecretStoreError } from "@warlock.js/core";
6503
+ // The same API is available from "@warlock.js/core/secrets".
6504
+
6505
+ await secrets.set("vendor-token", "provider-credential");
6506
+ const token = await secrets.get("vendor-token"); // string | undefined
6507
+ const exists = await secrets.has("vendor-token"); // boolean; true for ""
6508
+ const removed = await secrets.remove("vendor-token"); // boolean
6509
+ const variable = secrets.environmentName("vendor-token"); // variable name, not value
6510
+
6511
+ try {
6512
+ await secrets.remove("vendor-token");
6513
+ } catch (error) {
6514
+ if (error instanceof SecretStoreError && error.code === "READ_ONLY") {
6515
+ // Change the deployment environment instead.
6516
+ } else {
6517
+ throw error;
6518
+ }
6519
+ }
6520
+ ```
6521
+
6522
+ Names are case-sensitive, nonempty strings of at most 256 UTF-16 code units. Values are strings, including empty strings. Every operation is async, except `environmentName()`.
6523
+
6524
+ ## Configuration and backend decisions
6525
+
6526
+ - Default namespace: app name plus the SHA-256 hash of the absolute project root. For changing release directories, configure a stable unique namespace including the deployment environment.
6527
+ - Reads: OS keychain → exact scoped environment variable → encrypted file.
6528
+ - Optional peer: `npm install @napi-rs/keyring`. Core lazily uses its 2.1.1 `AsyncEntry` API. Linux requires `secret-service` for persistence; it does not use the memory-only keyutils fallback. Sources: [official README](https://github.com/Brooooooklyn/keyring-node#readme), [published declarations](https://www.npmjs.com/package/@napi-rs/keyring?activeTab=code), verified 2026-10-19.
6529
+ - One initial read-only probe selects the keychain for that store lifetime. Missing peer/initially unavailable service falls back automatically. A later keychain failure throws `UNAVAILABLE`; do not silently change backends mid-operation. Keep backend availability consistent between deployments; independent backend writes are not reconciled automatically.
6530
+ - Environment names are `WARLOCK_SECRET_<namespace UTF-8 uppercase hex>_<name UTF-8 uppercase hex>`; use `environmentName()` to avoid guessing. No unscoped environment fallback. Both mutation methods throw `READ_ONLY` if that variable is present, including `""` and shadowed environment values.
6531
+ - File fallback derives a per-namespace HKDF-SHA256 key from `encryption.key` (64 hex characters, conventionally `APP_ENCRYPTION_KEY`) and uses AES-256-GCM with name/namespace authenticated data. It never stores an unencrypted value/key file. Core's global `encrypt()` helper cannot accept a derived key, so the backend uses Node crypto without changing global config. Consult `encrypt-data` for app key provisioning.
6532
+ - Default files: `storage/secrets/<namespace hash>/<name hash>.secret`. Directories `0700`, files `0600`, owner checks, no symlinks/hardlinks, synced temporary writes and rename. Parent directories must be trusted. Same-key concurrent writes use last completed rename.
6533
+ - File fallback fails closed on Windows because Node modes cannot enforce owner-only ACLs; use keychain/environment. See [Node file modes](https://nodejs.org/docs/latest-v22.x/api/fs.html#file-modes).
6534
+ - Keychain writes clear an old file copy; removal clears both writable layers. Retry errors after fixing the backend; a multi-layer operation may partially complete.
6535
+
6536
+ ```ts title="src/config/secrets.ts"
6537
+ import type { SecretsConfigurations } from "@warlock.js/core";
6538
+
6539
+ export default {
6540
+ namespace: "sample-app-production",
6541
+ // directory: "/srv/sample-app/private-secrets",
6542
+ } satisfies SecretsConfigurations;
6543
+ ```
6544
+
6545
+ Never change namespace or encryption key without a migration. Keep file storage outside publicly served paths, and secure the app key separately from encrypted backups.
6546
+
6547
+ ## Isolated tests and explicit stores
6548
+
6549
+ `setupTest()` and the HTTP test harness install `secretsFake` by default. `NODE_ENV=test` alone does not install it. Opt out with `tests.fakes: { secrets: false }` only for real-backend tests. Memory is per process; HTTP server and test worker do not share it.
6550
+
6551
+ ```ts
6552
+ import { secrets } from "@warlock.js/core";
6553
+ import { secretsFake } from "@warlock.js/core/tests";
6554
+
6555
+ secretsFake.install(); // only needed without the standard test harness
6556
+ try {
6557
+ secretsFake.clear();
6558
+ await secrets.set("vendor-token", "test-credential");
6559
+ await secretsFake.assertHas("vendor-token");
6560
+ await secretsFake.assertStored("vendor-token", "test-credential");
6561
+ await secrets.remove("vendor-token");
6562
+ await secretsFake.assertMissing("vendor-token");
6563
+ const installed = secretsFake.isInstalled();
6564
+ } finally {
6565
+ secretsFake.restore();
6566
+ }
6567
+ ```
6568
+
6569
+ For standalone unit tests or distinct app instances:
6570
+
6571
+ ```ts
6572
+ import { MemorySecretBackend, SecretStore } from "@warlock.js/core/secrets";
6573
+ import type { SecretBackend, SecretStoreOptions } from "@warlock.js/core/secrets";
6574
+
6575
+ const backend: SecretBackend = new MemorySecretBackend();
6576
+ const options: SecretStoreOptions = { namespace: "test-app", backend };
6577
+ const store = new SecretStore(options);
6578
+ await store.set("vendor-token", "test-credential");
6579
+ await store.get("vendor-token");
6580
+ await store.has("vendor-token");
6581
+ await store.remove("vendor-token");
6582
+
6583
+ const memory = new MemorySecretBackend();
6584
+ memory.clear();
6585
+ ```
6586
+
6587
+ Options also allow a `directory` and `encryptionKey` (string or lazy callback); the default key reads `encryption.key` lazily. A custom `SecretBackend` implements async namespace-aware `get`, `set`, and `remove`. Explicit backends bypass keychain, environment and files; the test fake only swaps the shared facade.
6588
+
6589
+ ## Error and logging contract
6590
+
6591
+ `SecretStoreError.code` is `INVALID_NAME`, `INVALID_VALUE`, `INVALID_NAMESPACE`, `READ_ONLY`, `KEY_REQUIRED`, `UNAVAILABLE`, `UNSAFE_FILE` or `CORRUPT_FILE`. Errors never include names, values, paths or vendor causes. `KEY_REQUIRED` means provision/fix the app encryption key; `CORRUPT_FILE` means wrong key, invalid format or failed authentication. Never replace an unreadable store with an empty one.
6592
+
6593
+ The store never logs credentials. It registers encountered names and literal values with `@warlock.js/logger` for process-lifetime masking, including old/removed/failed-write values, interpolated messages, Error text/causes, and channel error reports. Keys and exact values stay protected even with permissive custom censors. Registration retains values in memory. It cannot mask direct console/third-party logging, earlier logs, transformed/encoded values, or credentials never encountered by the store. Keep secrets out of logs even with masking enabled. Fake assertion errors do not print values.
6594
+
6595
+
6381
6596
  ## test-fakes `@warlock.js/core/test-fakes/SKILL.md`
6382
6597
 
6383
6598
  ---
6384
6599
  name: test-fakes
6385
- description: 'The test fakes Warlock installs by default in the test environment — `mailFake`, `queueFake`, `cacheFake`, `storageFake`, `clockFake`, `idsFake` — and their assertions (`assertSent`, `assertPushed`, `assertHas`, `assertExists`, `travel`), plus how to opt out (`tests.fakes`, `setupTest({ fakes })`). Triggers: `mailFake`, `queueFake`, `cacheFake`, `storageFake`, `clockFake`, `idsFake`, `installTestFakes`, `restoreTestFakes`, `tests.fakes`, `FakeAssertionError`, `clock.now`, `ids.uuid`, `setDispatchInterceptor`; "assert an email was sent", "assert a job was dispatched", "freeze time in a test", "deterministic ids", "tests without Redis", "keep the real cache driver in tests". Typical import `import { mailFake, queueFake } from "@warlock.js/core/tests"`. Skip: HTTP request helpers — the `test-http` topic; fixtures — the `model-factories` topic.'
6600
+ description: 'The test fakes Warlock installs by default in the test environment — `mailFake`, `queueFake`, `cacheFake`, `storageFake`, `clockFake`, `idsFake`, `secretsFake` — and their assertions (`assertSent`, `assertPushed`, `assertHas`, `assertExists`, `travel`), plus how to opt out (`tests.fakes`, `setupTest({ fakes })`). Triggers: `mailFake`, `queueFake`, `cacheFake`, `storageFake`, `clockFake`, `idsFake`, `secretsFake`, `installTestFakes`, `restoreTestFakes`, `tests.fakes`, `FakeAssertionError`, `clock.now`, `ids.uuid`, `setDispatchInterceptor`; "assert an email was sent", "assert a job was dispatched", "freeze time in a test", "deterministic ids", "tests without Redis", "keep the real cache driver in tests". Typical import `import { mailFake, queueFake } from "@warlock.js/core/tests"`. Skip: HTTP request helpers — the `test-http` topic; fixtures — the `model-factories` topic.'
6386
6601
  ---
6387
6602
 
6388
6603
  # Warlock — test fakes
6389
6604
 
6390
- In the test environment six fakes are installed for you: `setupTest()` installs them in every test file once its connectors are up, `startHttpTestServer()` installs them in the shared server, and teardown restores them. Nothing is delivered, pushed to Redis, uploaded to a bucket, and time and ids are deterministic.
6605
+ In the test environment seven fakes are installed for you: `setupTest()` installs them in every test file once its connectors are up, `startHttpTestServer()` installs them in the shared server, and teardown restores them. Nothing is delivered, pushed to Redis, uploaded to a bucket, and time and ids are deterministic.
6391
6606
 
6392
- | Fake | Replaces |
6393
- | ------------- | --------------------------------------------------------------- |
6394
- | `mailFake` | Mail delivery: `sendMail()` / `Mail` sends are captured |
6395
- | `queueFake` | `@warlock.js/queue` dispatch: jobs are recorded, not pushed |
6396
- | `cacheFake` | The cache's current driver: a fresh in-memory driver |
6397
- | `storageFake` | Every storage driver (local, S3, R2, Spaces): a temp directory |
6398
- | `clockFake` | `clock` from `@warlock.js/core`: frozen at 2026-01-01T00:00:00Z |
6399
- | `idsFake` | `ids` from `@warlock.js/core`: numbered UUIDs and tokens |
6607
+ | Fake | Replaces |
6608
+ | ------------- | --------------------------------------------------------------------- |
6609
+ | `mailFake` | Mail delivery: `sendMail()` / `Mail` sends are captured |
6610
+ | `queueFake` | `@warlock.js/queue` dispatch: jobs are recorded, not pushed |
6611
+ | `cacheFake` | The cache's current driver: a fresh in-memory driver |
6612
+ | `storageFake` | Every storage driver (local, S3, R2, Spaces): a temp directory |
6613
+ | `clockFake` | `clock` from `@warlock.js/core`: frozen at 2026-01-01T00:00:00Z |
6614
+ | `idsFake` | `ids` from `@warlock.js/core`: numbered UUIDs and tokens |
6615
+ | `secretsFake` | The `secrets` facade: namespace-aware memory, no OS/environment/files |
6400
6616
 
6401
6617
  ## Assert what your code did
6402
6618
 
@@ -6424,7 +6640,8 @@ it("queues the report, mails the requester and caches the request", async () =>
6424
6640
  - **queue** — `assertPushed(jobOrName, payloadSubset?)`, `assertNotPushed`, `assertPushedCount(n, job?)`, `assertNothingPushed()`, `pushed(job?, matcher?)`. Each record has `id`, `name`, `queue`, `payload`, `options` (`delay`, `priority`, `jobId`) and `pushedAt`. An explicit `jobId` stays idempotent and `job.find(id)` answers from the record. Jobs are not run — call the handler to test it.
6425
6641
  - **cache** — `assertHas(key)`, `assertMissing(key)`, `assertStored(key, value)` (deep equality), `driver()`, `clear()`. TTLs, tags, namespaces and locks are the real memory driver's.
6426
6642
  - **storage** — `assertExists(path, driver?)`, `assertMissing(path, driver?)`, `files(driver?)`, `root()`. Each configured driver name gets a folder under one temp root, shared with the HTTP test server through `WARLOCK_TEST_STORAGE_ROOT`; the process that created it deletes it.
6427
- - A failed assertion throws `FakeAssertionError` listing what was recorded.
6643
+ - **secrets** — async `assertHas(name)`, `assertMissing(name)`, `assertStored(name, value)`, plus `clear()` and `isInstalled()`. Assertion errors never reveal values. See `store-secrets` for examples and explicit memory stores.
6644
+ - A failed assertion throws `FakeAssertionError`; secret assertions omit values. Other fakes list what was recorded.
6428
6645
 
6429
6646
  ## Time and ids
6430
6647
 
@@ -8021,8 +8238,45 @@ npm install --save-dev --save-exact typescript@6.0.3
8021
8238
  npx tsc --noEmit
8022
8239
  ```
8023
8240
 
8024
- The same tsconfig cleanups work with TS6. ESLint mode prints a compatibility
8025
- notice and is planned for deprecation in 5.33 and removal in 5.34.
8241
+ The same tsconfig cleanups work with TS6. Starting in 5.33, ESLint mode prints
8242
+ a deprecation warning naming removal in 5.34.0 and the Oxc migration command.
8243
+
8244
+ ## 5.32 to 5.33
8245
+
8246
+ **BREAKING:** ESLint background health checking and automatic ESLint selection
8247
+ in `warlock check` are disabled by default. Oxlint/Oxfmt replace ESLint/Prettier
8248
+ as the default toolchain. Legacy support is deprecated now and removed in
8249
+ 5.34.0. Temporary opt-ins are `devServer.healthCheckers: { eslint: true }`,
8250
+ `warlock check --lint eslint`, and `create-warlock --lint=eslint`; each warns
8251
+ about removal and migration. The legacy scaffold stays on TypeScript 6.0.3;
8252
+ Oxc apps use TypeScript 7.0.2.
8253
+
8254
+ ESLint + Prettier are deprecated in 5.33.0 and will be removed in **5.34.0**.
8255
+ New apps should use `--lint=oxc`. To migrate an existing app, install the new
8256
+ core release and `ts-morph`, then run:
8257
+
8258
+ ```bash
8259
+ npx warlock upgrade --from 5.32 --to 5.33.0 --dry-run
8260
+ npx warlock upgrade --from 5.32 --to 5.33.0
8261
+ npm install
8262
+ npm run format
8263
+ npm run lint:check
8264
+ npx warlock check
8265
+ ```
8266
+
8267
+ Review every reported `file:line`: customized configs are preserved and need
8268
+ manual translation before removal. The codemod installs the template's Oxlint
8269
+ and Oxfmt versions and pins TypeScript to 7.0.2. It replaces standard lint/format
8270
+ scripts, removes legacy dependencies, and deletes only recognized generated
8271
+ configs. A generated `.prettierignore` becomes `.oxfmtignore`. Existing Oxc
8272
+ configs are preserved. `--dry-run --json` reports the same planned changes
8273
+ without writing files.
8274
+
8275
+ The `oxc-toolchain` codemod also updates generated VS Code settings and literal
8276
+ ESLint/Oxlint health-check switches. Custom editor settings, checker arrays,
8277
+ computed options and nonstandard scripts require review. Oxc diagnostics keep
8278
+ framework conventions in `warlock check`. Re-run the migration after addressing
8279
+ manual findings if needed; an app with only Oxc tooling is a no-op for this codemod.
8026
8280
 
8027
8281
 
8028
8282
  ## upload-file `@warlock.js/core/upload-file/SKILL.md`
@@ -10836,7 +11090,7 @@ const types = runTypecheck({ files: ["src/app/posts/services/publish.service.ts"
10836
11090
  ## Gotchas
10837
11091
 
10838
11092
  - `check` boots nothing — no config, no connection, no port — so it runs the same with or without services; only tests that need them fail, and those report `WL8003`/`WL8004`.
10839
- - Lint runs only the linters the app configures (`eslint.config.*`; an oxlint config + the `oxlint` package). No config → the step is skipped, not failed.
11093
+ - Lint defaults to Oxlint (an app-root config + the app-installed package). No Oxlint config skips lint. A missing package reports `WL8002`. ESLint requires `--lint eslint` (or `runCheck({ lint: "eslint" })`); its flat config alone never enables it. This deprecated selection prints one warning on stderr and is removed in 5.34.0.
10840
11094
  - Tests use the app's own vitest (`vitest run`, or `vitest related <files> --run` with `--changed`). Test files without vitest installed → `WL8002`.
10841
11095
  - The typecheck runs in a child `warlock typecheck` process; running out of memory is reported as `WL8007` instead of ending the run.
10842
11096
  - The convention checks are the framework's own and run the same with ESLint, Oxlint or no linter. A deliberate exception gets `// warlock-check-ignore WL9006 -- why` on the problem's line or the line above (no code = every code on that line).
@@ -10848,6 +11102,10 @@ const types = runTypecheck({ files: ["src/app/posts/services/publish.service.ts"
10848
11102
  - The `warlock-inspect` topic — the app's routes, models and config as JSON.
10849
11103
  - The `warlock-conventions` topic — the rules behind `WL9001`–`WL9012`, with the fix for each.
10850
11104
 
11105
+ Migrate lint and format tooling with
11106
+ `npx warlock upgrade --from 5.32 --to 5.33.0 --dry-run`, then remove `--dry-run`
11107
+ and work through the manual-review list. Use `--lint=oxc` for new apps.
11108
+
10851
11109
 
10852
11110
  ## warlock-conventions `@warlock.js/core/warlock-conventions/SKILL.md`
10853
11111
 
@@ -11279,6 +11537,15 @@ A `⚠ routes: 0 routes registered` line is the tell that a route module threw o
11279
11537
  - The `warlock-check` topic — `warlock check` / `typecheck` / `explain` and the error-code registry the findings use.
11280
11538
  - The `warlock-inspect` topic — `warlock inspect`, the same boot pass printed as a versioned JSON report of the app.
11281
11539
 
11540
+ ## Lint and format checks
11541
+
11542
+ `warlock doctor` checks application wiring and HTTP health probes. Use
11543
+ `npx warlock check` for source lint diagnostics and `npm run format:check` for
11544
+ formatting. In 5.33, Oxlint/Oxfmt are the defaults; ESLint requires
11545
+ `warlock check --lint eslint` or `devServer.healthCheckers.eslint: true` for
11546
+ background checks. ESLint/Prettier are deprecated and removed in 5.34.0.
11547
+ Migrate with `npx warlock upgrade --from 5.32 --to 5.33.0` (preview with `--dry-run`).
11548
+
11282
11549
 
11283
11550
  ## warlock-inspect `@warlock.js/core/warlock-inspect/SKILL.md`
11284
11551
 
@@ -11884,6 +12151,25 @@ Reading `app.socket` (or `getSocketServer()`) at the top level of `main.ts` retu
11884
12151
 
11885
12152
  ## Emitting from a controller or service
11886
12153
 
12154
+ Use `broadcastSocketEvent` when a framework integration should tolerate an
12155
+ absent connector and broadcast through the configured adapter:
12156
+
12157
+ ```ts
12158
+ import { broadcastSocketEvent } from "@warlock.js/core";
12159
+
12160
+ const dispatched = broadcastSocketEvent("inventory:changed", { tags: ["products"] });
12161
+ // false without a booted socket server; true means dispatched, not delivered.
12162
+ ```
12163
+
12164
+ This broadcasts to all default-namespace clients, so payloads must be public.
12165
+ It uses `io.emit` (not `io.local.emit`), allowing `socket.adapter` to forward to
12166
+ other app processes. Each publisher, including a queue/CLI process, must boot
12167
+ the socket connector with the same adapter. See Socket.IO's official
12168
+ [Redis adapter](https://socket.io/docs/v4/redis-adapter/) and
12169
+ [multiple-node guidance](https://socket.io/docs/v4/using-multiple-nodes/).
12170
+ Web's `invalidatePageCache(tags)` uses this path for opt-in `config.live` pages;
12171
+ shared cache storage is also required when evicting across processes.
12172
+
11887
12173
  Once the server is up, anything with access to `app.socket` can emit:
11888
12174
 
11889
12175
  ```ts title="src/app/notifications/services/notify-user.service.ts"
@@ -12284,6 +12570,7 @@ warlock generate (alias: g) — interactive picker
12284
12570
  | `postman` | `@warlock.js/postman` |
12285
12571
  | `herald` | `@warlock.js/herald` + `amqplib` + types; ejects `src/config/communicator.ts` |
12286
12572
  | `test` | `vitest` + `@mongez/vite` + coverage; drops `test-global-setup.ts` / `test-setup.ts` / `vite.config.ts` |
12573
+ | `process` | `@warlock.js/process` pinned to installed Core; typed config, supervisor export, recovery/shutdown lifecycle and optional devtools process panel |
12287
12574
  | `devtools` | `@warlock.js/devtools` as a dev dependency; `warlock dev` auto-loads its development dashboard at `/__warlock` |
12288
12575
 
12289
12576
  Run `warlock add --list` to see what's currently registered. Pass `--packageManager <yarn\|pnpm\|npm>` to override auto-detection (defaults to whichever lockfile is present).
@@ -12294,6 +12581,10 @@ production install with dev dependencies excluded.
12294
12581
 
12295
12582
  The Web starter keeps the page's universal non-component setup in `src/web/index.register.ts`, while `src/web/index.page.tsx` re-exports `register`. Warlock still discovers and runs the hook from the page namespace in both SSR and the browser, but editing the page component remains inside React's Fast Refresh boundary. Do not move the `register()` declaration inline beside the component: React Refresh treats that non-component export as incompatible and reloads the page, losing component state.
12296
12583
 
12584
+ ### AI input measurement
12585
+
12586
+ `warlock ai measure --model <id> [--tools <module>] [--system <file>] [--skills <dir>] [--json]` loads `@warlock.js/ai` lazily without app bootstrap. Model IDs default to OpenAI Responses or use `openai:`, `anthropic:`, `google:` prefixes and the corresponding installed adapter/environment API key. `--model-module <module>` accepts `model`, `default`, or `resolveModel(id)` for custom providers/prices. Tools modules export a `tools` or default array; paths resolve from cwd. The report breaks down messages, system, skills catalogue, and tools, labels native counts versus estimates, and includes uncached input USD only when priced. CLI reports include an explicit `.` user probe and do not preload skill bodies or add skill tools. JSON stdout contains one report. No CLI config registration is required.
12587
+
12297
12588
  ### Misc
12298
12589
 
12299
12590
  | Command | Purpose |
@@ -12378,6 +12669,22 @@ export default command({
12378
12669
  - The `configure-app` topic — wiring `defineConfig` and `warlock.config.ts`.
12379
12670
  - The `warlock-conventions` topic — module layout, canonical imports.
12380
12671
 
12672
+ ## App-owned processes
12673
+
12674
+ `npx warlock add process` creates typed `src/config/process.ts` (owner, registry,
12675
+ default limits), `src/app/processes/index.ts` (the `processes` supervisor export),
12676
+ lifecycle hooks, and a read-only devtools list source. It imports lifecycle from
12677
+ `src/app/main.ts`. Startup awaits `recover()` using `Application.onValidateBoot`;
12678
+ graceful shutdown awaits `stopAll()` using `Application.onShutdown`. Recovery
12679
+ failure aborts boot. Repeated installation preserves existing files.
12680
+
12681
+ Set a unique owner and registry per app instance, then import `processes` from
12682
+ the generated module and await `processes.spawn({ kind: "worker", command,
12683
+ args, labels })`. Consume output and await `handle.exited`. Use handle stops or
12684
+ label filters; never stop processes by command or name. `spawnPty()` lazily
12685
+ loads separately installed optional peer `node-pty`. The `supervise-processes`
12686
+ skill in `@warlock.js/process` contains complete working examples.
12687
+
12381
12688
 
12382
12689
  ## write-middleware `@warlock.js/core/write-middleware/SKILL.md`
12383
12690
 
package/llms.txt CHANGED
@@ -27,11 +27,12 @@
27
27
  - [request-tracing](@warlock.js/core/request-tracing/SKILL.md): Vendor-neutral request tracing hooks (`http.tracing`) — observe request start/end and named phase spans (`route.match`, `middleware`, `validation`, `handler`, `response.write`) without adopting an OTel/vendor dependency in `core`. Covers the `TracingHooks` shape, trace id derivation from an inbound W3C `traceparent` vs `request.id`, that a throwing hook is caught and reported once (never breaks the request), and zero overhead when disabled. Triggers: `http.tracing`, `TracingHooks`, `onRequestStart`, `onRequestEnd`, `onPhase`, `traceparent`, `traceId`, `dispatchPhase`, "instrument requests", "trace a request", "slow phase logging", "APM / OTel bridge for Warlock". Skip: request-id header echo/inheritance (`X-Request-Id`) — the `use-middleware` topic; app-level structured logging — the `logger-basics` topic of the `warlock-js-logger` skill; competing libs `@opentelemetry/api` direct instrumentation, `express-request-id`, hand-rolled `X-Trace-Id` middleware.
28
28
  - [resolve-path](@warlock.js/core/resolve-path/SKILL.md): Path helpers anchored at `process.cwd()` — `rootPath`, `srcPath`, `appPath`, `configPath`, `publicPath`, `storagePath`, `uploadsPath`, `cachePath`, `logsPath`, `tempPath`, `warlockPath`, `sanitizePath`. Optional `uploads.root` config overrides the uploads anchor. Triggers: `appPath`, `configPath`, `uploadsPath`, `storagePath`, `publicPath`, `cachePath`, `logsPath`, `tempPath`, `sanitizePath`, `paths`; "resolve a path inside src/app", "absolute upload destination", "sanitize a user filename", "ship uploads to a mounted volume"; typical import `import { appPath, uploadsPath } from "@warlock.js/core"`. Skip: HTTP URL helpers — the `build-url` topic; app metadata — the `use-app-context` topic; storage abstraction — the `store-file` topic; competing patterns: `path.join(process.cwd(), ...)`, hand-rolled directory constants.
29
29
  - [retry-operation](@warlock.js/core/retry-operation/SKILL.md): Wrap a flaky operation with `retry(fn, options)` — now provided by `@mongez/reinforcements` (not `@warlock.js/core`). `attempts` total tries, `delay` + `backoff` (linear/exponential/fn), `maxDelay`, `jitter`, `shouldRetry` to bail on permanent errors, `signal` to cancel, plus `retryable()` to pre-bind options. Triggers: `retry`, `retryable`, `RetryOptions`, `attempts`, `backoff`, `jitter`, `maxDelay`, `shouldRetry`, `signal`; "retry a flaky API call", "handle transient errors", "exponential backoff with jitter", "wrap an external request"; typical import `import { retry } from "@mongez/reinforcements"`. Skip: timing the retried op — the `benchmark-code` topic; use-case-level `retry` option — the `write-use-case` topic; competing libs `p-retry`, `async-retry`, `cockatiel`.
30
- - [run-app](@warlock.js/core/run-app/SKILL.md): Three operational commands — `warlock dev` (HMR + type-gen + health checks), `warlock build` (esbuild bundle), `warlock start` (spawn the production bundle). All flags, all `warlock.config.ts` knobs that shape them. Triggers: `warlock dev`, `warlock build`, `warlock start`, `devServer`, `--fresh`, `--skip-typings`, `--skip-health`, `outdir`, `outFile`, `sourcemap`, `PortInUseError`, `assertPortIsAvailable`, `EADDRINUSE`, `EsbuildBinaryMissingError`, `detectJavaScriptRuntime`, `assertNodeOnlyCommand`, Bun, Deno, `bun dist/app.js`, `deno run -A`; "start the dev server", "build for production", "run the bundle", "skip type generation", "tune watch globs", "dev server keyboard shortcuts", "press r to restart", "press q to quit", "restart the dev server", "port already in use", "run on Bun", "run on Deno", "supported runtimes"; typical config `warlock.config.ts > devServer / build`. Skip: writing a custom CLI — the `write-cli-command` topic; config shape — the `configure-app` topic; competing tooling `nodemon`, `tsx`, `ts-node-dev`, `esbuild` direct.
30
+ - [run-app](@warlock.js/core/run-app/SKILL.md): Operational commands — `warlock dev` (HMR + type-gen + health checks), `warlock build` (esbuild bundle), `warlock start` (spawn the production bundle), `warlock pm2 init` / `reload` (optional deployment tooling). All flags, all `warlock.config.ts` knobs that shape them. Triggers: `warlock pm2`, `ecosystem.config.cjs`, `wait_ready`, `kill_timeout`, `app.shutdownTimeout`, `warlock dev`, `warlock build`, `warlock start`, `devServer`, `--fresh`, `--skip-typings`, `--skip-health`, `outdir`, `outFile`, `sourcemap`, `PortInUseError`, `assertPortIsAvailable`, `EADDRINUSE`, `EsbuildBinaryMissingError`, `detectJavaScriptRuntime`, `assertNodeOnlyCommand`, Bun, Deno, `bun dist/app.js`, `deno run -A`; "start the dev server", "build for production", "run the bundle", "skip type generation", "tune watch globs", "dev server keyboard shortcuts", "press r to restart", "press q to quit", "restart the dev server", "port already in use", "run on Bun", "run on Deno", "supported runtimes"; typical config `warlock.config.ts > devServer / build`. Skip: writing a custom CLI — the `write-cli-command` topic; config shape — the `configure-app` topic; competing tooling `nodemon`, `tsx`, `ts-node-dev`, `esbuild` direct.
31
31
  - [send-mail](@warlock.js/core/send-mail/SKILL.md): Send transactional email — `Mail` fluent builder, `sendMail()` direct call, React Email components. Test mode auto-captures into an in-memory mailbox; dev mode logs. Triggers: `Mail.to`, `sendMail`, `setMailMode`, `mailEvents`, `assertMailSent`, `getTestMailbox`, `wasMailSentTo`, `closeAllMailers`; "send a transactional email", "build a React Email template", "configure SMTP or SES", "assert an email was sent in tests"; typical import `import { Mail, sendMail } from "@warlock.js/core"`. Skip: per-config wiring — the `configure-app` topic; layered service patterns — the `warlock-conventions` topic; competing libs `nodemailer` direct, `@sendgrid/mail`, `resend`, `mailgun.js`.
32
32
  - [send-response](@warlock.js/core/send-response/SKILL.md): Send HTTP responses via @warlock.js/core's Response helpers — success/error variants, status helpers, redirects, files, streams, and SSE. Picking the right helper carries the HTTP semantic without manual status codes. Triggers: `response.success`, `response.successCreate`, `response.notFound`, `response.forbidden`, `response.badRequest`, `response.sendFile`, `response.stream`, `response.sse`, `response.replay`, `retainEvents`, `retainChunks`, `backpressure`, `@warlock.js/core/errors`, `ResourceNotFoundError`, `ForbiddenError`, `request.cookie`, `request.hasCookie`, `CookieJarUnavailableError`; "return a 201 from a controller", "send a file", "stream Server-Sent Events", "throw HTTP-shaped errors from services"; typical import `import type { RequestHandler, Response } from "@warlock.js/core"`. Skip: controller shape — the `create-controller` topic; route registration — the `register-route` topic; competing patterns: hand-rolled status codes via `reply.code(404).send(...)`, raw Fastify reply.
33
33
  - [store-file](@warlock.js/core/store-file/SKILL.md): Read/write/delete files via the `storage` singleton — disks, drivers (local/S3/R2/DO Spaces), `storage.use(name)`, `StorageFile` handles, presigned URLs. Triggers: `storage.put`, `storage.get`, `storage.use`, `StorageFile`, `storageConfigurations`, `getPresignedUrl`, `getPresignedUploadUrl`; "save an uploaded file", "switch between local and S3", "generate a presigned URL", "read file metadata"; typical import `import { storage } from "@warlock.js/core"`. Skip: multipart parsing + image chain — the `upload-file` topic; image transforms — the `process-image` topic; storage config shape — the `configure-app` topic; competing libs `@aws-sdk/client-s3`, `multer`, `formidable`.
34
- - [test-fakes](@warlock.js/core/test-fakes/SKILL.md): The test fakes Warlock installs by default in the test environment — `mailFake`, `queueFake`, `cacheFake`, `storageFake`, `clockFake`, `idsFake` — and their assertions (`assertSent`, `assertPushed`, `assertHas`, `assertExists`, `travel`), plus how to opt out (`tests.fakes`, `setupTest({ fakes })`). Triggers: `mailFake`, `queueFake`, `cacheFake`, `storageFake`, `clockFake`, `idsFake`, `installTestFakes`, `restoreTestFakes`, `tests.fakes`, `FakeAssertionError`, `clock.now`, `ids.uuid`, `setDispatchInterceptor`; "assert an email was sent", "assert a job was dispatched", "freeze time in a test", "deterministic ids", "tests without Redis", "keep the real cache driver in tests". Typical import `import { mailFake, queueFake } from "@warlock.js/core/tests"`. Skip: HTTP request helpers — the `test-http` topic; fixtures — the `model-factories` topic.
34
+ - [store-secrets](@warlock.js/core/store-secrets/SKILL.md): Store app credentials with secrets.get/set/remove/has and environmentName; lazy optional OS keychain, read-only scoped environment variables, encrypted file fallback, typed SecretStoreError and memory-backed secretsFake. Use for provider keys and OAuth credentials the app must read back. Skip user passwords (hash-password) and encrypted database columns (encrypt-data).
35
+ - [test-fakes](@warlock.js/core/test-fakes/SKILL.md): The test fakes Warlock installs by default in the test environment — `mailFake`, `queueFake`, `cacheFake`, `storageFake`, `clockFake`, `idsFake`, `secretsFake` — and their assertions (`assertSent`, `assertPushed`, `assertHas`, `assertExists`, `travel`), plus how to opt out (`tests.fakes`, `setupTest({ fakes })`). Triggers: `mailFake`, `queueFake`, `cacheFake`, `storageFake`, `clockFake`, `idsFake`, `secretsFake`, `installTestFakes`, `restoreTestFakes`, `tests.fakes`, `FakeAssertionError`, `clock.now`, `ids.uuid`, `setDispatchInterceptor`; "assert an email was sent", "assert a job was dispatched", "freeze time in a test", "deterministic ids", "tests without Redis", "keep the real cache driver in tests". Typical import `import { mailFake, queueFake } from "@warlock.js/core/tests"`. Skip: HTTP request helpers — the `test-http` topic; fixtures — the `model-factories` topic.
35
36
  - [test-http](@warlock.js/core/test-http/SKILL.md): Integration tests against a real HTTP server — `startHttpTestServer()` boots one shared server in globalSetup, then `testGet` / `testPost` / `expectJson` make typed requests against it. Triggers: `startHttpTestServer`, `startHttpTestServer({ port })`, `startHttpTestServer({ port: 0 })`, `stopHttpTestServer`, `createTestHttpServer`, `TestHttpServer`, `createTestRequestClient`, `snapshotResponse`, `actingAs`, `AuthenticatedTestClient`, `testGet`, `testPost`, `testPut`, `testPatch`, `testDelete`, `expectJson`, `getTestServerUrl`, `testRequest`, `PortInUseError`, `assertPortIsAvailable`, `isPortAvailable`; "integration-test a controller", "end-to-end HTTP test", "globalSetup HTTP server", "assert status and body shape", "test server port already in use", "EADDRINUSE while running tests", "run tests while the dev server is up", "ephemeral test port", "test with the real Fastify plugins", "assert mail sent by a request", "response snapshot"; typical import `import { testGet, testPost, expectJson } from "@warlock.js/core/tests"`. Skip: pure unit tests — the `test-service` topic; controller shape — the `create-controller` topic; competing libs `supertest`, `light-my-request`, `nock`.
36
37
  - [test-service](@warlock.js/core/test-service/SKILL.md): Pure unit tests against services, repositories, models, and use-cases — `setupTest({ connectors })` bootstraps the framework with its own DB/cache connections so you can call your code directly, and `teardownTest()` closes it. Triggers: `setupTest`, `teardownTest`, `setupTest({ fakes })`, `tests.fakes`, `src/test-setup.ts`, `tests.connectors`, `tests.setupTimeout`, `Application.setEnvironment`, `clock`, `ids`, `warlock test --changed`; "unit-test a service", "test a repository query", "vitest setupFiles", "skip connectors for pure-logic tests", "run only the tests my change affects", "deterministic time in a test"; typical import `import { setupTest, teardownTest } from "@warlock.js/core/tests"`. Skip: HTTP integration — the `test-http` topic; warlock add test scaffold — the `write-cli-command` topic; competing tooling: jest direct, `supertest`, `nock`.
37
38
  - [update-packages](@warlock.js/core/update-packages/SKILL.md): Keep a project current with `warlock update` — bump every `@warlock.js/*` dependency in package.json to its latest published version (range operator preserved), then run the lockfile-detected package manager install. Also covers the `warlock dev` update notice, its `u` update-and-restart keyboard shortcut, and the `devServer.checkForUpdates` toggle. Triggers: `warlock update`, `--no-install`, `--dry-run`, `--check`, `checkForUpdates`, `fetchLatestVersion`, `isNewerVersion`; "update warlock packages", "upgrade the framework", "is there a new warlock version", "update notice in the dev server", "press u to update", "dev server keyboard shortcut", "update check offline", "bump @warlock.js/* to latest"; typical CLI `warlock update`. Skip: dev/build/start runtime — the `run-app` topic; writing a custom command — the `write-cli-command` topic; installing a NEW feature package (auth, mail, storage) — that is `warlock add`; releasing/publishing the framework — workspace release tooling, not this command.
package/package.json CHANGED
@@ -25,12 +25,12 @@
25
25
  "@mongez/slug": "^1.0.7",
26
26
  "@mongez/supportive-is": "^3.0.0",
27
27
  "@mongez/time-wizard": "^1.0.6",
28
- "@warlock.js/cache": "5.32.0",
29
- "@warlock.js/cascade": "5.32.0",
30
- "@warlock.js/context": "5.32.0",
31
- "@warlock.js/fs": "5.32.0",
32
- "@warlock.js/logger": "5.32.0",
33
- "@warlock.js/seal": "5.32.0",
28
+ "@warlock.js/cache": "5.33.0",
29
+ "@warlock.js/cascade": "5.33.0",
30
+ "@warlock.js/context": "5.33.0",
31
+ "@warlock.js/fs": "5.33.0",
32
+ "@warlock.js/logger": "5.33.0",
33
+ "@warlock.js/seal": "5.33.0",
34
34
  "bcryptjs": "^3.0.3",
35
35
  "chokidar": "^5.0.0",
36
36
  "dayjs": "^1.11.19",
@@ -50,17 +50,18 @@
50
50
  "typescript": "7.0.2"
51
51
  },
52
52
  "peerDependencies": {
53
+ "@napi-rs/keyring": "^2.1.1",
53
54
  "@aws-sdk/client-s3": "^3.955.0",
54
55
  "@aws-sdk/client-sesv2": "^3.1025.0",
55
56
  "@aws-sdk/lib-storage": "^3.955.0",
56
57
  "@aws-sdk/s3-request-presigner": "^3.955.0",
57
58
  "@react-email/render": "^2.0.5",
58
- "@warlock.js/access": "5.32.0",
59
- "@warlock.js/ai": "5.32.0",
60
- "@warlock.js/ai-tools": "5.32.0",
61
- "@warlock.js/devtools": "5.32.0",
62
- "@warlock.js/herald": "5.32.0",
63
- "@warlock.js/notifications": "5.32.0",
59
+ "@warlock.js/access": "5.33.0",
60
+ "@warlock.js/ai": "5.33.0",
61
+ "@warlock.js/ai-tools": "5.33.0",
62
+ "@warlock.js/devtools": "5.33.0",
63
+ "@warlock.js/herald": "5.33.0",
64
+ "@warlock.js/notifications": "5.33.0",
64
65
  "nodemailer": "^8.0.5",
65
66
  "react": "^19.2.3",
66
67
  "react-dom": "^19.2.3",
@@ -69,6 +70,9 @@
69
70
  "ts-morph": ">=27.0.0"
70
71
  },
71
72
  "peerDependenciesMeta": {
73
+ "@napi-rs/keyring": {
74
+ "optional": true
75
+ },
72
76
  "sharp": {
73
77
  "optional": true
74
78
  },
@@ -142,7 +146,7 @@
142
146
  "engines": {
143
147
  "node": ">=22.15"
144
148
  },
145
- "version": "5.32.0",
149
+ "version": "5.33.0",
146
150
  "type": "module",
147
151
  "main": "./esm/index.mjs",
148
152
  "module": "./esm/index.mjs",
@@ -184,6 +188,12 @@
184
188
  "default": "./esm/net/index.mjs"
185
189
  }
186
190
  },
191
+ "./secrets": {
192
+ "import": {
193
+ "types": "./esm/secrets/index.d.mts",
194
+ "default": "./esm/secrets/index.mjs"
195
+ }
196
+ },
187
197
  "./tooling": {
188
198
  "import": {
189
199
  "types": "./esm/tooling/index.d.mts",
package/skills/README.md CHANGED
@@ -61,7 +61,8 @@ Each folder holds one `SKILL.md` (an agent-facing how-to for a single task). The
61
61
 
62
62
  - `test-http` — integration tests against a real HTTP server (`startHttpTestServer()`, `testGet` / `testPost`).
63
63
  - `test-service` — pure unit tests against services/repositories/models/use-cases via `setupTest({ connectors })`.
64
- - `test-fakes` — mail, queue, cache, storage, clock and ids fakes, on by default in tests, and their assertions; opting out.
64
+ - `store-secrets` — app-scoped credentials, lazy keychain/environment/encrypted file storage, memory backends and safe errors.
65
+ - `test-fakes` — mail, queue, cache, storage, clock, ids and secrets fakes, on by default in tests, and their assertions; opting out.
65
66
  - `model-factories` — `defineFactory(Model, (seed) => attrs)`: deterministic `make()` / `create(n)` / states.
66
67
 
67
68
  ## Utilities
package/skills/index.md CHANGED
@@ -25,7 +25,7 @@ When the framework is wrong or missing a capability, follow `report-framework-is
25
25
  - **CLI & running the app:** run-app, write-cli-command, add-connector, health-checks, warlock-doctor, warlock-inspect, warlock-check, generate-openapi
26
26
  - **Agent tooling:** warlock-mcp, warlock-trace, warlock-agents-md, warlock-board
27
27
  - **Storage, files & mail:** store-file, upload-file, process-image, send-mail
28
- - **Security & utilities:** hash-password, encrypt-data, retry-operation, benchmark-code, request-memo, request-tracing
28
+ - **Security & utilities:** hash-password, encrypt-data, store-secrets, retry-operation, benchmark-code, request-memo, request-tracing
29
29
  - **Testing:** test-http, test-service, test-fakes, model-factories
30
30
 
31
31
  ## Conventions and pitfalls