@warlock.js/core 5.34.1 → 5.34.3
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 +24 -0
- package/esm/e2e/browser.d.mts.map +1 -1
- package/esm/e2e/browser.mjs +3 -1
- package/esm/e2e/browser.mjs.map +1 -1
- package/esm/e2e/types.d.mts +6 -0
- package/esm/e2e/types.d.mts.map +1 -1
- package/esm/e2e/types.mjs.map +1 -1
- package/esm/http/error-response.d.mts +12 -0
- package/esm/http/error-response.d.mts.map +1 -0
- package/esm/http/error-response.mjs +41 -0
- package/esm/http/error-response.mjs.map +1 -0
- package/esm/http/index.d.mts +3 -2
- package/esm/http/response.d.mts +2 -0
- package/esm/http/response.d.mts.map +1 -1
- package/esm/http/response.mjs +2 -0
- package/esm/http/response.mjs.map +1 -1
- package/esm/http/server.d.mts.map +1 -1
- package/esm/http/server.mjs +2 -0
- package/esm/http/server.mjs.map +1 -1
- package/esm/http/types.d.mts +7 -0
- package/esm/http/types.d.mts.map +1 -1
- package/esm/index.d.mts +3 -2
- package/esm/upgrade/codemods/toolchain-templates.mjs +3 -1
- package/esm/upgrade/codemods/toolchain-templates.mjs.map +1 -1
- package/llms-full.txt +323 -60
- package/llms.txt +56 -54
- package/package.json +13 -13
- package/skills/configure-app/SKILL.md +27 -0
- package/skills/generate-openapi/SKILL.md +1 -1
- package/skills/index.md +4 -4
- package/skills/{report-framework-issue.md → report-framework-issue/SKILL.md} +5 -0
- package/skills/send-response/SKILL.md +27 -0
- package/skills/test-browser/SKILL.md +1 -0
- package/skills/upgrade-from-5-29/SKILL.md +4 -0
- package/skills/warlock-check/SKILL.md +1 -1
- package/skills/warlock-trace/SKILL.md +2 -2
- package/skills/write-cli-command/SKILL.md +2 -2
- package/skills/README.md +0 -76
|
@@ -421,3 +421,30 @@ export default {
|
|
|
421
421
|
Keep the domain error class in an app module imported by both the service and
|
|
422
422
|
this config. Return `undefined` for errors you do not recognize; a mapped 5xx
|
|
423
423
|
is opaque unless the mapper explicitly chooses a public message.
|
|
424
|
+
|
|
425
|
+
## Format every JSON error response
|
|
426
|
+
|
|
427
|
+
`http.errorMapper` classifies thrown non-`HttpError` errors as `{ status, message?, payload? }`. It does not see existing `HttpError` subclasses, returned validation errors, helper responses, unmatched routes, or global rate-limit failures.
|
|
428
|
+
|
|
429
|
+
Use `http.errorResponse` when the application needs one JSON error envelope across those paths:
|
|
430
|
+
|
|
431
|
+
```ts title="src/config/http.ts"
|
|
432
|
+
import type { HttpConfigurations } from "@warlock.js/core";
|
|
433
|
+
|
|
434
|
+
export default {
|
|
435
|
+
errorMapper: () => ({ status: 500 }),
|
|
436
|
+
errorResponse({ status, requestId }) {
|
|
437
|
+
return {
|
|
438
|
+
error: {
|
|
439
|
+
code: status >= 500 ? "serverError" : `http${status}`,
|
|
440
|
+
message: status >= 500 ? "Internal server error." : "Request failed.",
|
|
441
|
+
},
|
|
442
|
+
requestId,
|
|
443
|
+
};
|
|
444
|
+
},
|
|
445
|
+
} satisfies HttpConfigurations;
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
The synchronous formatter receives `HttpErrorResponseContext`: `{ status: number, body: unknown, requestId: string }`. Narrow `body` before reading fields; it is the parsed, serialized JSON body. Return a JSON-serializable object or `undefined` to keep the original. The formatter changes only the body, preserving the HTTP status and headers except for recalculated content length, a `private, no-store` cache policy, and the correlation header. If it throws or cannot serialize its result, core logs the formatter error and retains the original body.
|
|
449
|
+
|
|
450
|
+
The hook covers status 400–599 with `application/json` or an `application/*+json` content type, including Fastify parsing errors, unmatched-route 404s, validation 422s, rate-limit 429s, and 500s. Warlock responses use the ID already stamped from `request.id`. Before Warlock creates a Request, the formatter receives Fastify's `request.id` and echoes that same value under `http.requestId.header` (default `X-Request-Id`). Setting `http.requestId.enabled: false` suppresses that header; without a stamped Warlock ID, the formatter falls back to Fastify's request ID even for routed responses. Keep request-ID headers enabled when the body must correlate with Warlock request logs. HTML pages, files, raw text, streams, and errors after headers have been sent are not reformatted. With no formatter configured, existing response shapes are unchanged.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: generate-openapi
|
|
3
|
-
description: 'Generate an OpenAPI 3.1 document from the registered routes with `warlock generate.openapi` (default `storage/openapi/openapi.json`), write a Postman collection from it with `warlock generate.postman` (default `storage/postman/collection.json`), and read it live in the dev-only API docs page at `/__warlock/docs`. Documents paths, path/query parameters, request bodies from Seal validation, responses from `handler.responseSchema`, 401/422 and bearer/cookie security from `authMiddleware()`. Triggers: `generate.openapi`, `openApiGeneratorCommand`, `buildOpenApiDocument`, `getDevelopmentOpenApiDocument`, `generate.postman`, `openApiToPostmanCollection`, `getDevelopmentPostmanCollection`, `responseSchema`, `--include-pages`, `/__warlock/docs`; "OpenAPI", "Swagger", "API docs", "import my API into Postman or Insomnia", "document my routes". Skip: declaring response types on a handler — the `create-controller` topic; the devtools dashboard — the `
|
|
3
|
+
description: 'Generate an OpenAPI 3.1 document from the registered routes with `warlock generate.openapi` (default `storage/openapi/openapi.json`), write a Postman collection from it with `warlock generate.postman` (default `storage/postman/collection.json`), and read it live in the dev-only API docs page at `/__warlock/docs`. Documents paths, path/query parameters, request bodies from Seal validation, responses from `handler.responseSchema`, 401/422 and bearer/cookie security from `authMiddleware()`. Triggers: `generate.openapi`, `openApiGeneratorCommand`, `buildOpenApiDocument`, `getDevelopmentOpenApiDocument`, `generate.postman`, `openApiToPostmanCollection`, `getDevelopmentPostmanCollection`, `responseSchema`, `--include-pages`, `/__warlock/docs`; "OpenAPI", "Swagger", "API docs", "import my API into Postman or Insomnia", "document my routes". Skip: declaring response types on a handler — the `create-controller` topic; the devtools dashboard — the `warlock-js-devtools` skill; listing routes — the `warlock-routes` topic.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Warlock — generate an OpenAPI document
|
package/skills/index.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: 'Warlock application runtime: `router`, `Request`, `Response`, `config`, `env`, `sendMail` and `defineConfig`. Use for "add an API route", controllers, middleware, CLI commands, config, uploads, mail, sockets, OpenAPI, testing or upgrades. Not this package → @warlock.js/web for React SSR pages; @warlock.js/cascade for database queries; @warlock.js/seal for standalone schemas; @warlock.js/auth for login.'
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# @warlock.js/core
|
|
@@ -14,11 +14,11 @@ Core is the application runtime: it boots the app, auto-loads each module's spec
|
|
|
14
14
|
4. Return via `response.*` (`send-response.md`) and shape output with a resource (`define-resource.md`); declare `responseSchema` for typed clients and docs (`create-controller.md`, `generate-openapi.md`).
|
|
15
15
|
5. Configure and run (`configure-app.md`, `run-app.md`); check setup with `warlock-doctor.md`, read the app with `warlock-inspect.md` (or serve it to an agent with `warlock-mcp.md`), verify a change with `warlock-check.md`, and a request's runtime behaviour with `warlock-trace.md`.
|
|
16
16
|
|
|
17
|
-
When the framework is wrong or missing a capability, follow `report-framework-issue
|
|
17
|
+
When the framework is wrong or missing a capability, follow the `report-framework-issue` topic to prepare a public report and ask the user before filing.
|
|
18
18
|
|
|
19
19
|
## Topics by area
|
|
20
20
|
|
|
21
|
-
- **Foundations:** warlock-conventions, create-module, make-endpoint, configure-app, use-app-context, resolve-path, build-url, update-packages, lower-stage3-decorators
|
|
21
|
+
- **Foundations:** warlock-conventions, create-module, make-endpoint, configure-app, use-app-context, resolve-path, build-url, update-packages, lower-stage3-decorators, upgrade-from-5-29
|
|
22
22
|
- **HTTP & routing:** register-route, warlock-routes, create-controller, use-middleware, write-middleware, validate-input, use-request-locals, build-restful, wire-socket
|
|
23
23
|
- **Responses & resources:** send-response, define-resource, use-model-transformers, use-localization
|
|
24
24
|
- **Domain layers:** write-use-case, use-repository, write-seeder
|
|
@@ -26,7 +26,7 @@ When the framework is wrong or missing a capability, follow `report-framework-is
|
|
|
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
28
|
- **Security & utilities:** hash-password, encrypt-data, store-secrets, retry-operation, benchmark-code, request-memo, request-tracing
|
|
29
|
-
- **Testing:** test-http, test-service, test-fakes, model-factories
|
|
29
|
+
- **Testing:** test-browser, test-http, test-service, test-fakes, model-factories
|
|
30
30
|
|
|
31
31
|
## Conventions and pitfalls
|
|
32
32
|
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: report-framework-issue
|
|
3
|
+
description: "Report a confirmed Warlock.js framework bug or missing capability. Read when behavior contradicts the installed docs, a crash appears to originate in @warlock.js packages, or no documented API meets a requirement; covers minimal reproduction, duplicate searches, sanitized warlock issue output and user approval before filing."
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# Report a Warlock.js framework issue
|
|
2
7
|
|
|
3
8
|
Use this topic when behavior contradicts the installed version's docs or skills,
|
|
@@ -481,3 +481,30 @@ export function requireProduct<T>(product: T | null | undefined): T {
|
|
|
481
481
|
return product;
|
|
482
482
|
}
|
|
483
483
|
```
|
|
484
|
+
|
|
485
|
+
## Format every JSON error response
|
|
486
|
+
|
|
487
|
+
`http.errorMapper` classifies thrown non-`HttpError` errors as `{ status, message?, payload? }`. It does not see existing `HttpError` subclasses, returned validation errors, helper responses, unmatched routes, or global rate-limit failures.
|
|
488
|
+
|
|
489
|
+
Use `http.errorResponse` when the application needs one JSON error envelope across those paths:
|
|
490
|
+
|
|
491
|
+
```ts title="src/config/http.ts"
|
|
492
|
+
import type { HttpConfigurations } from "@warlock.js/core";
|
|
493
|
+
|
|
494
|
+
export default {
|
|
495
|
+
errorMapper: () => ({ status: 500 }),
|
|
496
|
+
errorResponse({ status, requestId }) {
|
|
497
|
+
return {
|
|
498
|
+
error: {
|
|
499
|
+
code: status >= 500 ? "serverError" : `http${status}`,
|
|
500
|
+
message: status >= 500 ? "Internal server error." : "Request failed.",
|
|
501
|
+
},
|
|
502
|
+
requestId,
|
|
503
|
+
};
|
|
504
|
+
},
|
|
505
|
+
} satisfies HttpConfigurations;
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
The synchronous formatter receives `HttpErrorResponseContext`: `{ status: number, body: unknown, requestId: string }`. Narrow `body` before reading fields; it is the parsed, serialized JSON body. Return a JSON-serializable object or `undefined` to keep the original. The formatter changes only the body, preserving the HTTP status and headers except for recalculated content length, a `private, no-store` cache policy, and the correlation header. If it throws or cannot serialize its result, core logs the formatter error and retains the original body.
|
|
509
|
+
|
|
510
|
+
The hook covers status 400–599 with `application/json` or an `application/*+json` content type, including Fastify parsing errors, unmatched-route 404s, validation 422s, rate-limit 429s, and 500s. Warlock responses use the ID already stamped from `request.id`. Before Warlock creates a Request, the formatter receives Fastify's `request.id` and echoes that same value under `http.requestId.header` (default `X-Request-Id`). Setting `http.requestId.enabled: false` suppresses that header; without a stamped Warlock ID, the formatter falls back to Fastify's request ID even for routed responses. Keep request-ID headers enabled when the body must correlate with Warlock request logs. HTML pages, files, raw text, streams, and errors after headers have been sent are not reformatted. With no formatter configured, existing response shapes are unchanged.
|
|
@@ -103,6 +103,7 @@ port-file handshake above when the app supports binding `0` itself.
|
|
|
103
103
|
document. Selector helpers do not enter frames or closed shadow roots.
|
|
104
104
|
|
|
105
105
|
Use `--browser /path/to/chrome` or `WARLOCK_E2E_BROWSER` if discovery fails.
|
|
106
|
+
Set `browser.startupTimeoutMs` (default 30 seconds) when the browser is slow to start, for example on shared CI runners.
|
|
106
107
|
`browser: { args: ["--no-sandbox"] }` is an explicit option for controlled root
|
|
107
108
|
containers; it is not a default. On Windows, command arrays should invoke JS tools
|
|
108
109
|
through `process.execPath`, avoiding `.cmd` executables that require a shell.
|
|
@@ -476,6 +476,10 @@ It replaces standard scripts/dependencies, pins TypeScript 7.0.2, updates genera
|
|
|
476
476
|
editor settings, removes `healthCheckers.eslint` and selects Oxlint. A generated
|
|
477
477
|
`.prettierignore` becomes `.oxfmtignore`; Oxfmt scripts read it explicitly.
|
|
478
478
|
|
|
479
|
+
Generated migration configs enable `typescript/no-explicit-any`, `curly`, and
|
|
480
|
+
`no-console` as errors, matching new apps. Fix those diagnostics before running
|
|
481
|
+
`npm run lint:check` and `npx warlock check` again.
|
|
482
|
+
|
|
479
483
|
The `oxc-toolchain` codemod also updates generated VS Code settings and literal
|
|
480
484
|
ESLint/Oxlint health-check switches. Custom editor settings, checker arrays,
|
|
481
485
|
computed options and nonstandard scripts require review. Oxc diagnostics keep
|
|
@@ -127,7 +127,7 @@ const types = runTypecheck({ files: ["src/app/posts/services/publish.service.ts"
|
|
|
127
127
|
|
|
128
128
|
## See also
|
|
129
129
|
|
|
130
|
-
- `report-framework-issue
|
|
130
|
+
- the `report-framework-issue` topic — confirm a framework bug or missing capability, collect `warlock issue` output, and get the user's approval before filing.
|
|
131
131
|
- The `warlock-doctor` topic — boot-time diagnostics; `doctor --json` uses the same codes and fields.
|
|
132
132
|
- The `warlock-inspect` topic — the app's routes, models and config as JSON.
|
|
133
133
|
- The `warlock-conventions` topic — the rules behind `WL9001`–`WL9012`, with the fix for each.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: warlock-trace
|
|
3
|
-
description: 'Verify runtime behaviour without a browser: `warlock trace <method> <url> [--body json|@file] [--header k:v] [--json]` sends one request to the running `warlock dev` server and prints what devtools recorded for it — middleware chain with timings, validation result and errors, handler time, queries with N+1 flags, logs, cache operations, captured mails, the response and timings — as a versioned report (`schemaVersion: 1`); `traceRequest()` returns the same object. Triggers: `warlock trace`, `traceRequest`, `TraceReport`, `buildTraceReport`, `x-request-id`, `.warlock/dev-server.json`, `WL8008`, `WL8009`, `WL5004`, `--id-header`; "did validation pass for this request", "which queries does this endpoint run", "is there an N+1 on this route", "what middleware runs on this route", "check the endpoint after my change", "request timeline as JSON". Skip: the devtools dashboard in a browser — the `devtools
|
|
3
|
+
description: 'Verify runtime behaviour without a browser: `warlock trace <method> <url> [--body json|@file] [--header k:v] [--json]` sends one request to the running `warlock dev` server and prints what devtools recorded for it — middleware chain with timings, validation result and errors, handler time, queries with N+1 flags, logs, cache operations, captured mails, the response and timings — as a versioned report (`schemaVersion: 1`); `traceRequest()` returns the same object. Triggers: `warlock trace`, `traceRequest`, `TraceReport`, `buildTraceReport`, `x-request-id`, `.warlock/dev-server.json`, `WL8008`, `WL8009`, `WL5004`, `--id-header`; "did validation pass for this request", "which queries does this endpoint run", "is there an N+1 on this route", "what middleware runs on this route", "check the endpoint after my change", "request timeline as JSON". Skip: the devtools dashboard in a browser — the `warlock-js-devtools` skill; static route facts (guard, rate limit, schemas) — the `warlock-inspect` topic; typecheck/lint/tests — the `warlock-check` topic.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Warlock — `warlock trace`
|
|
@@ -78,4 +78,4 @@ Devtools is checked before anything is sent. With `--json` a failure prints `{ "
|
|
|
78
78
|
|
|
79
79
|
- The `warlock-inspect` topic — the static facts of a route (guard, rate limit, schemas).
|
|
80
80
|
- The `warlock-check` topic — typecheck, lint, tests and conventions in one run.
|
|
81
|
-
- The `devtools
|
|
81
|
+
- The `warlock-js-devtools` skill — the dashboard behind the timeline.
|
|
@@ -337,5 +337,5 @@ Set a unique owner and registry per app instance, then import `processes` from
|
|
|
337
337
|
the generated module and await `processes.spawn({ kind: "worker", command,
|
|
338
338
|
args, labels })`. Consume output and await `handle.exited`. Use handle stops or
|
|
339
339
|
label filters; never stop processes by command or name. `spawnPty()` lazily
|
|
340
|
-
loads separately installed optional peer `node-pty`. The `
|
|
341
|
-
skill
|
|
340
|
+
loads separately installed optional peer `node-pty`. The `warlock-js-process`
|
|
341
|
+
skill contains complete working examples.
|
package/skills/README.md
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# @warlock.js/core — skills index
|
|
2
|
-
|
|
3
|
-
Each folder holds one `SKILL.md` (an agent-facing how-to for a single task). The `llms.txt` / `llms-full.txt` at the package root are **generated projections** of this folder — run `node scripts/generate-llms.mjs` from the package root after any skill change; never hand-edit them.
|
|
4
|
-
|
|
5
|
-
## HTTP layer
|
|
6
|
-
|
|
7
|
-
- `register-route` — register single routes, prefix groups, middleware-guarded blocks, and RESTful resource chains.
|
|
8
|
-
- `build-restful` — generate standard CRUD endpoints via the `router.route(...)` chain or the `Restful` base class.
|
|
9
|
-
- `create-controller` — author HTTP controllers: `RequestHandler` signature, validated input, response helpers, middleware, `responseSchema` response types.
|
|
10
|
-
- `send-response` — `Response` helpers: success/error variants, status helpers, redirects, files, streams, SSE.
|
|
11
|
-
- `validate-input` — author seal schemas, attach them to controllers, infer types, layer DTOs.
|
|
12
|
-
- `use-middleware` — attach built-in HTTP middleware (rateLimit, concurrencyLimit, maxBodySize, …) via the `middleware` namespace.
|
|
13
|
-
- `write-middleware` — author HTTP middleware: the `({ request, response })` signature, short-circuit, request enrichment.
|
|
14
|
-
- `build-url` — HTTP URL helpers (`url`, `publicUrl`, `assetsUrl`, `uploadsUrl`) anchored at `app.baseUrl`.
|
|
15
|
-
- `upload-file` — handle multipart uploads: `request.file()`, `v.file()` validation, `UploadedFile.save()`.
|
|
16
|
-
- `health-checks` — built-in `/health` + `/ready` endpoints, the `health` registry, and graceful request draining.
|
|
17
|
-
|
|
18
|
-
## Data layer
|
|
19
|
-
|
|
20
|
-
- `use-repository` — subclass `RepositoryManager`: `source`/`filterBy`/`defaultOptions`, list/find/CRUD, cached/cursor variants, and the `filterBy`-aware aggregates (`sum`/`avg`/`min`/`max`/`groupBy`/`aggregate`).
|
|
21
|
-
- `use-model-transformers` — schema-side helpers: `useHashedPassword()`, `useComputedSlug()`, and friends.
|
|
22
|
-
- `define-resource` — map model fields to wire-shape via `defineResource()` / `Resource` subclasses (output-only); typed output with `ResourceOutput`, `Serialized<T, W>` and `ModelResourceRegistry`.
|
|
23
|
-
- `write-seeder` — author a seed file with `seeder()` — `name`/`dependsOn`/`once`/`order`/`batchSize`, `run({ track, now, batchSize })`, `warlock seed --drop`.
|
|
24
|
-
|
|
25
|
-
## Files, media, mail
|
|
26
|
-
|
|
27
|
-
- `store-file` — read/write/delete files via the `storage` singleton (local/S3/R2/DO Spaces), `StorageFile` handles, presigned URLs.
|
|
28
|
-
- `process-image` — transform images with the `Image` class (resize, crop, rotate, format, watermark, …) on a deferred pipeline.
|
|
29
|
-
- `send-mail` — send transactional email: the `Mail` fluent builder, `sendMail()`, React Email, test-mode capture.
|
|
30
|
-
|
|
31
|
-
## App, config, lifecycle
|
|
32
|
-
|
|
33
|
-
- `configure-app` — the two config layers (`warlock.config.ts` vs `src/config/*.ts`), `.env` + `env()`.
|
|
34
|
-
- `use-app-context` — read app-wide context via the `Application` static class and the `app` runtime accessor.
|
|
35
|
-
- `add-connector` — extend the lifecycle with a `BaseConnector` subclass (`start`/`shutdown`/`watchedFiles`).
|
|
36
|
-
- `wire-socket` — configure Socket.IO, reach the live server via `getSocketServer()` / `app.socket`.
|
|
37
|
-
- `use-localization` — multi-locale translations: `groupedTranslations`, `t()` (always, never `request.t()`), locale resolution.
|
|
38
|
-
|
|
39
|
-
## Use-cases & services
|
|
40
|
-
|
|
41
|
-
- `write-use-case` — author `useCase()` pipelines: guards, schema, before/after, retry, benchmark, broadcast, lifecycle.
|
|
42
|
-
- `create-module` — scaffold a feature module under `src/app/<name>/` via `warlock generate.module` + follow-up generators.
|
|
43
|
-
- `make-endpoint` — `warlock make endpoint <module>/<name>`: one spec-first endpoint (schema → service, resource, controller, route, locale key, OpenAPI response, HTTP test); `--dry-run` / `--json` on every generator.
|
|
44
|
-
|
|
45
|
-
## CLI & operations
|
|
46
|
-
|
|
47
|
-
- `warlock-doctor` — `warlock doctor`: read-only diagnostics (routes/config/connectors/optional-peers/health/release-hygiene) with a pass/warn/fail report and non-zero exit on failure.
|
|
48
|
-
- `warlock-inspect` — `warlock inspect [--json] [--section ...]`: the app's routes, models, resources, config keys, events, pages, jobs, schedules and package versions from the booted registries, as a versioned JSON report; `inspectApp()` from `@warlock.js/core/tooling`.
|
|
49
|
-
- `warlock-check` — `warlock check` / `typecheck` / `explain`: one verify command (typecheck, lint, affected tests, conventions) with one JSON object per problem, stable `WL` error codes, and exit 1 for your code vs 2 for this machine.
|
|
50
|
-
- `warlock-mcp` — `warlock mcp [--http] [--allow-writes]` and `warlock dev --mcp`: the app as an MCP server for coding agents — `inspect_*`, `db_schema`, offline `docs_search` over installed skills, `explain`, `check_run`, `test_run`, devtools `requests_recent`, and `generate_make` / `generate_add` that return a diff by default.
|
|
51
|
-
- `warlock-trace` — `warlock trace <method> <url> [--json]`: send one request to the running dev server and print its devtools timeline (middleware, validation, queries with N+1 flags, logs, response, timings).
|
|
52
|
-
- `warlock-agents-md` — `warlock agents-md [--write]`: the app-specific AGENTS.md section between `warlock:generated` markers, refreshed by `warlock dev`.
|
|
53
|
-
- `warlock-board` — `warlock board init|add|status|send|watch`: a git-ignored task board with review states and append-only messages for an implementer and a reviewer agent.
|
|
54
|
-
- `warlock-routes` — `warlock routes`: list the registered HTTP routes as a verb-colored table (method/path/name/action/middleware/source); filter by method/path/name or emit JSON. Read-only, no connectors.
|
|
55
|
-
- `write-cli-command` — author a custom `warlock <cmd>` via the `command()` factory, or inspect built-in `warlock add` feature scaffolding such as the Web starter.
|
|
56
|
-
- `generate-openapi` — `warlock generate.openapi`: an OpenAPI 3.1 document from the routes (validation, `responseSchema`, auth), plus the dev-only API docs page.
|
|
57
|
-
- `run-app` — `warlock dev` / `warlock build` / `warlock start` operational commands.
|
|
58
|
-
- `update-packages` — bump every `@warlock.js/*` dependency with `warlock update`.
|
|
59
|
-
|
|
60
|
-
## Testing
|
|
61
|
-
|
|
62
|
-
- `test-http` — integration tests against a real HTTP server (`startHttpTestServer()`, `testGet` / `testPost`).
|
|
63
|
-
- `test-service` — pure unit tests against services/repositories/models/use-cases via `setupTest({ connectors })`.
|
|
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.
|
|
66
|
-
- `model-factories` — `defineFactory(Model, (seed) => attrs)`: deterministic `make()` / `create(n)` / states.
|
|
67
|
-
|
|
68
|
-
## Utilities
|
|
69
|
-
|
|
70
|
-
- `encrypt-data` — reversible AES-256-GCM `encrypt`/`decrypt`, plus one-way `hmacHash` fingerprints.
|
|
71
|
-
- `hash-password` — one-way bcrypt `hashPassword`/`verifyPassword` and the `useHashedPassword()` transformer.
|
|
72
|
-
- `resolve-path` — path helpers anchored at `process.cwd()` (`rootPath`, `srcPath`, `appPath`, …).
|
|
73
|
-
- `benchmark-code` — time a function with `measure(name, fn, options?)` and classify the latency.
|
|
74
|
-
- `retry-operation` — wrap a flaky operation with `retry(fn, options)` (now from `@mongez/reinforcements`).
|
|
75
|
-
- `lower-stage3-decorators` — the `lowerStage3Decorators()` Vite/Vitest plugin for native decorators.
|
|
76
|
-
- `warlock-conventions` — framework-wide invariants: module layout, canonical imports, layered flow, file naming.
|