@warlock.js/core 5.4.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/esm/application/app.d.mts.map +1 -1
- package/esm/application/app.mjs +7 -1
- package/esm/application/app.mjs.map +1 -1
- package/esm/cli/cli-commands.utils.mjs.map +1 -1
- package/esm/cli/commands/doctor/checks/optional-peers.check.mjs.map +1 -1
- package/esm/cli/commands/doctor/checks/release-hygiene.check.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/column-dsl-parser.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/migration.generator.mjs.map +1 -1
- package/esm/cli/commands/routes/format-routes-table.mjs.map +1 -1
- package/esm/cli/commands/routes/route-row.mjs.map +1 -1
- package/esm/cli/commands/routes.command.mjs.map +1 -1
- package/esm/cli/framework-cli-commands.mjs.map +1 -1
- package/esm/config/locale-configuration.mjs +11 -1
- package/esm/config/locale-configuration.mjs.map +1 -1
- package/esm/container/container-instance-registry.mjs +40 -0
- package/esm/container/container-instance-registry.mjs.map +1 -0
- package/esm/container/index.d.mts +11 -0
- package/esm/container/index.d.mts.map +1 -1
- package/esm/container/index.mjs +11 -0
- package/esm/container/index.mjs.map +1 -1
- package/esm/database/drop-tables-action.mjs.map +1 -1
- package/esm/database/migrate-action.mjs.map +1 -1
- package/esm/database/seed-command-action.mjs.map +1 -1
- package/esm/dev-server/dependency-graph.d.mts.map +1 -1
- package/esm/dev-server/dependency-graph.mjs.map +1 -1
- package/esm/dev-server/dev-logger.mjs.map +1 -1
- package/esm/dev-server/file-event-handler.mjs.map +1 -1
- package/esm/dev-server/layer-executor.mjs.map +1 -1
- package/esm/dev-server/loader/build-transpile-init.mjs.map +1 -1
- package/esm/dev-server/loader/load-hook.mjs.map +1 -1
- package/esm/dev-server/loader/register-loader.mjs.map +1 -1
- package/esm/dev-server/loader/resolve-hook.mjs.map +1 -1
- package/esm/dev-server/loader/transpile-cache.mjs.map +1 -1
- package/esm/dev-server/module-loader.mjs.map +1 -1
- package/esm/dev-server/parse-imports.mjs.map +1 -1
- package/esm/dev-server/type-generator.mjs.map +1 -1
- package/esm/dev-server/types.d.mts.map +1 -1
- package/esm/dev-server/utils.mjs.map +1 -1
- package/esm/errors/container-key-missing-error.mjs +28 -0
- package/esm/errors/container-key-missing-error.mjs.map +1 -0
- package/esm/errors/unknown-locale-error.mjs +28 -0
- package/esm/errors/unknown-locale-error.mjs.map +1 -0
- package/esm/generations/add-command.action.mjs.map +1 -1
- package/esm/generations/features/access.feature.mjs.map +1 -1
- package/esm/generations/features/ai-anthropic.feature.mjs.map +1 -1
- package/esm/generations/features/ai-bedrock.feature.mjs.map +1 -1
- package/esm/generations/features/ai-google.feature.mjs.map +1 -1
- package/esm/generations/features/ai-ollama.feature.mjs.map +1 -1
- package/esm/generations/features/ai-openai.feature.mjs.map +1 -1
- package/esm/generations/features/ai-panoptic.feature.mjs.map +1 -1
- package/esm/generations/features/ai-tools.feature.mjs.map +1 -1
- package/esm/generations/features/ai-workspace.feature.mjs.map +1 -1
- package/esm/generations/features/ai.feature.mjs.map +1 -1
- package/esm/generations/features/herald.feature.mjs.map +1 -1
- package/esm/generations/features/notifications.feature.mjs.map +1 -1
- package/esm/generations/features/scheduler.feature.mjs.map +1 -1
- package/esm/generations/features/shared/patch-tsconfig-include.mjs.map +1 -1
- package/esm/generations/features/shared/resolve-contact-scaffold.mjs +45 -0
- package/esm/generations/features/shared/resolve-contact-scaffold.mjs.map +1 -0
- package/esm/generations/features/tailwind.feature.mjs.map +1 -1
- package/esm/generations/features/types.mjs.map +1 -1
- package/esm/generations/features/web.feature.mjs +14 -4
- package/esm/generations/features/web.feature.mjs.map +1 -1
- package/esm/http/context/request-memo.mjs.map +1 -1
- package/esm/http/middleware/cache-response-middleware.d.mts.map +1 -1
- package/esm/http/middleware/cache-response-middleware.mjs.map +1 -1
- package/esm/http/middleware/concurrency-limit.middleware.mjs.map +1 -1
- package/esm/http/middleware/idempotency.middleware.d.mts.map +1 -1
- package/esm/http/middleware/idempotency.middleware.mjs.map +1 -1
- package/esm/http/middleware/maintenance.middleware.mjs.map +1 -1
- package/esm/http/middleware/max-body-size.middleware.mjs.map +1 -1
- package/esm/http/middleware/rate-limit.middleware.mjs.map +1 -1
- package/esm/http/port-preflight.d.mts.map +1 -1
- package/esm/http/port-preflight.mjs.map +1 -1
- package/esm/http/request.d.mts.map +1 -1
- package/esm/http/request.mjs +2 -2
- package/esm/http/request.mjs.map +1 -1
- package/esm/http/response.d.mts +38 -0
- package/esm/http/response.d.mts.map +1 -1
- package/esm/http/response.mjs +47 -0
- package/esm/http/response.mjs.map +1 -1
- package/esm/http/server.d.mts.map +1 -1
- package/esm/http/server.mjs.map +1 -1
- package/esm/http/types.d.mts.map +1 -1
- package/esm/image/image.d.mts.map +1 -1
- package/esm/image/image.mjs.map +1 -1
- package/esm/mail/send-mail.mjs.map +1 -1
- package/esm/production/build-contributions.mjs.map +1 -1
- package/esm/production/bundle-framework-dependencies.mjs +152 -0
- package/esm/production/bundle-framework-dependencies.mjs.map +1 -0
- package/esm/production/production-builder.mjs +30 -3
- package/esm/production/production-builder.mjs.map +1 -1
- package/esm/production/production-supervisor.mjs.map +1 -1
- package/esm/production/tsconfig-path-aliases.mjs +99 -0
- package/esm/production/tsconfig-path-aliases.mjs.map +1 -0
- package/esm/react/index.d.mts.map +1 -1
- package/esm/react/index.mjs.map +1 -1
- package/esm/repositories/contracts/query-builder.contract.d.mts.map +1 -1
- package/esm/repositories/contracts/types.d.mts.map +1 -1
- package/esm/resource/resource-field-builder.d.mts.map +1 -1
- package/esm/resource/resource-field-builder.mjs.map +1 -1
- package/esm/resource/types.d.mts.map +1 -1
- package/esm/router/router.d.mts.map +1 -1
- package/esm/router/router.mjs +1 -2
- package/esm/router/router.mjs.map +1 -1
- package/esm/router/types.d.mts.map +1 -1
- package/esm/storage/drivers/cloud-driver.d.mts.map +1 -1
- package/esm/storage/drivers/cloud-driver.mjs.map +1 -1
- package/esm/storage/scoped-storage.d.mts.map +1 -1
- package/esm/storage/scoped-storage.mjs.map +1 -1
- package/esm/storage/storage.d.mts.map +1 -1
- package/esm/storage/storage.mjs.map +1 -1
- package/esm/storage/types.d.mts.map +1 -1
- package/esm/storage/utils/contain-path.mjs.map +1 -1
- package/esm/storage/utils/safe-fetch.d.mts.map +1 -1
- package/esm/storage/utils/safe-fetch.mjs.map +1 -1
- package/esm/tests/start-http-development-server.d.mts.map +1 -1
- package/esm/tests/start-http-development-server.mjs.map +1 -1
- package/esm/tests/test-lifecycle-state.mjs.map +1 -1
- package/esm/tests/test-setup-timeout.mjs.map +1 -1
- package/esm/tests/vitest-setup.d.mts.map +1 -1
- package/esm/tests/vitest-setup.mjs.map +1 -1
- package/esm/use-cases/use-cases-registry.d.mts.map +1 -1
- package/esm/use-cases/use-cases-registry.mjs.map +1 -1
- package/esm/utils/app-log.mjs.map +1 -1
- package/esm/utils/queue.mjs.map +1 -1
- package/esm/utils/sleep.mjs.map +1 -1
- package/esm/validation/plugins/database-plugin.mjs.map +1 -1
- package/llms-full.txt +60 -60
- package/llms.txt +3 -3
- package/package.json +12 -12
- package/skills/create-controller/SKILL.md +1 -1
- package/skills/create-module/SKILL.md +11 -11
- package/skills/hash-password/SKILL.md +4 -4
- package/skills/run-app/SKILL.md +16 -16
- package/skills/send-mail/SKILL.md +2 -2
- package/skills/use-model-transformers/SKILL.md +2 -2
- package/skills/use-repository/SKILL.md +1 -1
- package/skills/validate-input/SKILL.md +1 -1
- package/skills/warlock-doctor/SKILL.md +3 -3
- package/skills/warlock-routes/SKILL.md +10 -10
- package/skills/write-cli-command/SKILL.md +1 -1
- package/skills/write-seeder/SKILL.md +8 -8
package/skills/run-app/SKILL.md
CHANGED
|
@@ -11,13 +11,13 @@ Three commands move the app through its lifecycle: `dev` while you're editing, `
|
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
13
|
# Local development
|
|
14
|
-
|
|
14
|
+
npx warlock dev
|
|
15
15
|
|
|
16
16
|
# Production build
|
|
17
|
-
|
|
17
|
+
npx warlock build
|
|
18
18
|
|
|
19
19
|
# Run the built bundle
|
|
20
|
-
|
|
20
|
+
npx warlock start
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
`dev` and `start` are **persistent** (long-running, no auto-exit). `build` is one-shot — it exits when the bundle is written.
|
|
@@ -234,9 +234,9 @@ The three cases that reach it are: never built; a build that failed before promo
|
|
|
234
234
|
### Behavior
|
|
235
235
|
|
|
236
236
|
```bash
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
npx warlock start # → spawns node --enable-source-maps dist/app.js
|
|
238
|
+
npx warlock start --inspect # → spawns node --enable-source-maps --inspect dist/app.js
|
|
239
|
+
npx warlock start --max-old-space-size=4096 # → spawns node --enable-source-maps --max-old-space-size=4096 dist/app.js
|
|
240
240
|
```
|
|
241
241
|
|
|
242
242
|
Everything you pass after `start` is forwarded to the spawned Node process. Use this to attach a debugger (`--inspect`), tune memory (`--max-old-space-size`), or pass any other Node flag without editing the command.
|
|
@@ -288,7 +288,7 @@ The started banner prints **only** when the running application reports a comple
|
|
|
288
288
|
|
|
289
289
|
```bash
|
|
290
290
|
# a CI gate can be this blunt, and it is now correct
|
|
291
|
-
|
|
291
|
+
npx warlock start | grep -q "production server started"
|
|
292
292
|
```
|
|
293
293
|
|
|
294
294
|
### Reading a failed start (5.2)
|
|
@@ -371,17 +371,17 @@ If you need conditional behavior, branch on `Application.environment` (the ortho
|
|
|
371
371
|
}
|
|
372
372
|
```
|
|
373
373
|
|
|
374
|
-
Now `
|
|
374
|
+
Now `npm run dev` / `npm run build` / `npm run start`. Standard Node hosting providers (Render, Fly, Railway, Heroku) recognize this layout.
|
|
375
375
|
|
|
376
376
|
### Production Dockerfile
|
|
377
377
|
|
|
378
378
|
```dockerfile
|
|
379
379
|
FROM node:20-alpine AS build
|
|
380
380
|
WORKDIR /app
|
|
381
|
-
COPY package.json
|
|
382
|
-
RUN
|
|
381
|
+
COPY package.json package-lock.json ./
|
|
382
|
+
RUN npm ci
|
|
383
383
|
COPY . .
|
|
384
|
-
RUN
|
|
384
|
+
RUN npx warlock build
|
|
385
385
|
|
|
386
386
|
FROM node:20-alpine
|
|
387
387
|
WORKDIR /app
|
|
@@ -390,7 +390,7 @@ COPY --from=build /app/node_modules ./node_modules
|
|
|
390
390
|
COPY --from=build /app/package.json ./
|
|
391
391
|
COPY --from=build /app/warlock.config.ts ./
|
|
392
392
|
ENV NODE_ENV=production
|
|
393
|
-
CMD ["
|
|
393
|
+
CMD ["npx", "warlock", "start"]
|
|
394
394
|
```
|
|
395
395
|
|
|
396
396
|
Two-stage build trims `devDependencies` out of the runtime image. Keep `warlock.config.ts` in the runtime stage — `start` reads it to resolve the bundle path.
|
|
@@ -425,7 +425,7 @@ That is deliberate: `build` and `start` do **not** force `production`. Forcing i
|
|
|
425
425
|
### Skip type-gen on machines without write access
|
|
426
426
|
|
|
427
427
|
```bash
|
|
428
|
-
|
|
428
|
+
npx warlock dev --skip-typings
|
|
429
429
|
```
|
|
430
430
|
|
|
431
431
|
Or persist it:
|
|
@@ -443,20 +443,20 @@ Useful in a containerized dev environment where `.warlock/typings.d.ts` is read-
|
|
|
443
443
|
### Memory-tune the production process
|
|
444
444
|
|
|
445
445
|
```bash
|
|
446
|
-
|
|
446
|
+
npx warlock start --max-old-space-size=4096
|
|
447
447
|
```
|
|
448
448
|
|
|
449
449
|
Or via `NODE_OPTIONS` in the deployment env if you don't want to change the start invocation:
|
|
450
450
|
|
|
451
451
|
```bash
|
|
452
|
-
NODE_OPTIONS=--max-old-space-size=4096
|
|
452
|
+
NODE_OPTIONS=--max-old-space-size=4096 npx warlock start
|
|
453
453
|
```
|
|
454
454
|
|
|
455
455
|
## Gotchas
|
|
456
456
|
|
|
457
457
|
- **`warlock dev` is persistent — `Ctrl+C` to stop.** The framework's `persistent: true` flag keeps the process alive after `action` returns. Same for `start`.
|
|
458
458
|
- **`--fresh` only deletes the manifest, not the transpile cache.** If you're chasing a stale-compile bug, `rm -rf .warlock/` clears everything. The manifest restoring is what `--fresh` solves.
|
|
459
|
-
- **`warlock build` does NOT run migrations.** Production bundles ship the migration files but don't apply them. Run `
|
|
459
|
+
- **`warlock build` does NOT run migrations.** Production bundles ship the migration files but don't apply them. Run `npx warlock migrate` against the production DB separately.
|
|
460
460
|
- **`warlock start` requires a build it can vouch for.** Since 5.2 it refuses any `outdir` without the `.warlock-build.json` success marker — a hand-assembled `dist/`, or one left behind by a build that failed, is rejected by that reason instead of being spawned and crashing halfway through boot. Run `warlock build` first.
|
|
461
461
|
- **Do not add `.warlock-build.json` to `.gitignore`-driven artifact pruning.** Stripping it from a `dist/` you ship makes `warlock start` refuse the artifact on the target host. Copy `outdir` whole.
|
|
462
462
|
- **`outdir` is the directory, `outFile` is the filename within it.** A common mistake is putting the full path in one and leaving the other default — you end up with `<full-path>/app.js` or `dist/<full-path>`. They concatenate.
|
|
@@ -85,7 +85,7 @@ const config: MailConfigurations = {
|
|
|
85
85
|
};
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
Requires `@aws-sdk/client-sesv2` installed (`
|
|
88
|
+
Requires `@aws-sdk/client-sesv2` installed (`npm install @aws-sdk/client-sesv2`).
|
|
89
89
|
|
|
90
90
|
## Mail modes
|
|
91
91
|
|
|
@@ -361,7 +361,7 @@ await Mail.to(user.email)
|
|
|
361
361
|
|
|
362
362
|
- **`.send()` validates** — `to`, `subject`, and at least one of `text`/`html`/`component` are required. Missing any throws synchronously.
|
|
363
363
|
- **`@react-email/render` is optional.** Without it you get the basic fallback (inline styles, no MSO conditionals). Install it for production-quality HTML.
|
|
364
|
-
- **`nodemailer` is loaded lazily** at import time. If you see `nodemailer is not installed` errors, run `warlock add mail` (or `
|
|
364
|
+
- **`nodemailer` is loaded lazily** at import time. If you see `nodemailer is not installed` errors, run `warlock add mail` (or `npm install nodemailer`).
|
|
365
365
|
- **`secure: true` requires port 465.** For port 587 use `secure: false` and `tls: true` (STARTTLS).
|
|
366
366
|
- **Test mode is process-global.** Set it in `beforeAll`/`beforeEach`; reset with `setMailMode("production")` (or rely on test runner isolation).
|
|
367
367
|
- **Per-mail handlers don't replace global ones** — both fire. Avoid double-counting metrics.
|
|
@@ -60,7 +60,7 @@ What it does at save time:
|
|
|
60
60
|
| Existing row, password unchanged | Pass through (no re-hashing — stored hash preserved). |
|
|
61
61
|
| Empty / undefined value | Pass through untouched. |
|
|
62
62
|
|
|
63
|
-
Calls `authService.hashPassword(String(value))` under the hood — same bcryptjs path as the standalone `hashPassword()` helper. See [`hash-password/SKILL.md`](../hash-password/SKILL.md) for full bcrypt setup (salt rounds, `
|
|
63
|
+
Calls `authService.hashPassword(String(value))` under the hood — same bcryptjs path as the standalone `hashPassword()` helper. See [`hash-password/SKILL.md`](../hash-password/SKILL.md) for full bcrypt setup (salt rounds, `npm install bcryptjs`).
|
|
64
64
|
|
|
65
65
|
### Why declarative wins
|
|
66
66
|
|
|
@@ -214,7 +214,7 @@ Rule of thumb: transformers are for **pure, deterministic** transforms of the ro
|
|
|
214
214
|
|
|
215
215
|
## See also
|
|
216
216
|
|
|
217
|
-
- [`hash-password/SKILL.md`](../hash-password/SKILL.md) — the bcrypt setup that `useHashedPassword` calls under the hood; salt rounds, `
|
|
217
|
+
- [`hash-password/SKILL.md`](../hash-password/SKILL.md) — the bcrypt setup that `useHashedPassword` calls under the hood; salt rounds, `npm install bcryptjs`.
|
|
218
218
|
- [`use-repository/SKILL.md`](../use-repository/SKILL.md) — where `create` / `save` calls happen that trigger the transformers.
|
|
219
219
|
- [`define-resource/SKILL.md`](../define-resource/SKILL.md) — filtering transformed fields (`password`) out of API responses.
|
|
220
220
|
- [`warlock-conventions/SKILL.md`](../warlock-conventions/SKILL.md) — schema files live in `src/app/<module>/models/<entity>/<entity>.model.ts`.
|
|
@@ -53,7 +53,7 @@ Five lines do the heavy lifting:
|
|
|
53
53
|
4. **`defaultOptions`** — applied to every call (`orderBy`, default `limit`, etc.).
|
|
54
54
|
5. **`new FaqsRepository()`** singleton — import this everywhere; never instantiate again.
|
|
55
55
|
|
|
56
|
-
The class is intentionally private — only the singleton escapes the module. Scaffold with `
|
|
56
|
+
The class is intentionally private — only the singleton escapes the module. Scaffold with `npx warlock generate.repository <module>/<entity>`.
|
|
57
57
|
|
|
58
58
|
## The `filterBy` rules
|
|
59
59
|
|
|
@@ -47,7 +47,7 @@ Two pieces, always:
|
|
|
47
47
|
|
|
48
48
|
No separate `*.request.ts` alias file. `RequestHandler<Request<TSchema>>` types `request.validated()` directly off the schema's inferred type.
|
|
49
49
|
|
|
50
|
-
Scaffold with `
|
|
50
|
+
Scaffold with `npx warlock generate.controller <module>/<action> --with-validation`. If the scaffolder emits a `requests/<action>.request.ts` file, delete it — the inline pattern is the convention.
|
|
51
51
|
|
|
52
52
|
## The `v.*` factory surface
|
|
53
53
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: warlock-doctor
|
|
3
|
-
description: 'Run `warlock doctor` — a read-only diagnostics command that checks routes / config / connectors / optional-peers / health endpoints / release hygiene and prints a pass/warn/fail report, exiting non-zero on any failure. Add your own probe with the `DoctorCheck` contract and `runChecks` / `formatReportLines`. Triggers: `warlock doctor`, `doctorCommand`, `DoctorCheck`, `CheckResult`, `CheckStatus`, `DoctorReport`, `runChecks`, `formatReportLines`, `printReport`, `defaultDoctorChecks`; "diagnose my app", "preflight / preflight check", "is the app healthy", "why are there 0 routes", "pre-release sanity check", "CI smoke check"; run as `
|
|
3
|
+
description: 'Run `warlock doctor` — a read-only diagnostics command that checks routes / config / connectors / optional-peers / health endpoints / release hygiene and prints a pass/warn/fail report, exiting non-zero on any failure. Add your own probe with the `DoctorCheck` contract and `runChecks` / `formatReportLines`. Triggers: `warlock doctor`, `doctorCommand`, `DoctorCheck`, `CheckResult`, `CheckStatus`, `DoctorReport`, `runChecks`, `formatReportLines`, `printReport`, `defaultDoctorChecks`; "diagnose my app", "preflight / preflight check", "is the app healthy", "why are there 0 routes", "pre-release sanity check", "CI smoke check"; run as `npx warlock doctor`. Skip: the live `/health` + `/ready` HTTP probes — `@warlock.js/core/health-checks/SKILL.md`; authoring a general CLI command — `@warlock.js/core/write-cli-command/SKILL.md`; releasing the package — `releasing-warlock-monorepo`; competing tools `npm doctor`, `nest info`, hand-rolled preflight scripts.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Warlock — `warlock doctor`
|
|
@@ -8,7 +8,7 @@ description: 'Run `warlock doctor` — a read-only diagnostics command that chec
|
|
|
8
8
|
`warlock doctor` is a read-only preflight. It boots the app far enough to introspect it — loads every config file and bootstrap code so routes and connectors register — but **starts no connectors**, so it never opens a database, cache, or socket connection. It then runs a set of checks and prints a grouped pass / warn / fail report.
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
|
|
11
|
+
npx warlock doctor
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
```
|
|
@@ -111,7 +111,7 @@ if (report.hasFailures) process.exit(report.exitCode);
|
|
|
111
111
|
### CI / pre-release gate
|
|
112
112
|
|
|
113
113
|
```bash
|
|
114
|
-
|
|
114
|
+
npx warlock doctor || exit 1 # non-zero exit fails the job
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
A red `release-hygiene` line catches the classic "bumped `package.json` but forgot the CHANGELOG heading" mistake before a publish.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: warlock-routes
|
|
3
|
-
description: 'Run `warlock routes` — a read-only command that lists the registered HTTP routes as a verb-colored table (method / path / name / action / middleware-count / source), a sibling of `warlock doctor`. Filter with `--method` / `--path` / `--name`, or emit normalized rows as JSON with `--json`. Also covers `warlock routes:diff`, which compares live page routes against the last `warlock build`''s route snapshot and exits non-zero on drift. Triggers: `warlock routes`, `routesCommand`, `warlock routes:diff`, `routesDiffCommand`, "list my routes", "show all routes", "route table", "what endpoints does my app expose", "dump routes as JSON", "which routes have middleware", "route map for CI", "did my page routes drift from the last build"; run as `
|
|
3
|
+
description: 'Run `warlock routes` — a read-only command that lists the registered HTTP routes as a verb-colored table (method / path / name / action / middleware-count / source), a sibling of `warlock doctor`. Filter with `--method` / `--path` / `--name`, or emit normalized rows as JSON with `--json`. Also covers `warlock routes:diff`, which compares live page routes against the last `warlock build`''s route snapshot and exits non-zero on drift. Triggers: `warlock routes`, `routesCommand`, `warlock routes:diff`, `routesDiffCommand`, "list my routes", "show all routes", "route table", "what endpoints does my app expose", "dump routes as JSON", "which routes have middleware", "route map for CI", "did my page routes drift from the last build"; run as `npx warlock routes` / `npx warlock routes:diff`. Skip: read-only health/preflight checks — `@warlock.js/core/warlock-doctor/SKILL.md`; defining/naming/grouping routes — `@warlock.js/core/register-route/SKILL.md`; authoring a general CLI command — `@warlock.js/core/write-cli-command/SKILL.md`; competing tools `nest`/`express` route listers, `php artisan route:list`.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Warlock — `warlock routes`
|
|
@@ -8,7 +8,7 @@ description: 'Run `warlock routes` — a read-only command that lists the regist
|
|
|
8
8
|
`warlock routes` lists every registered HTTP route as a table. It's the read-only sibling of [`warlock doctor`](../warlock-doctor/SKILL.md): it boots the app far enough to register route modules — but **starts no connectors**, so it never opens a database, cache, or socket connection.
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
|
|
11
|
+
npx warlock routes
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
```
|
|
@@ -39,10 +39,10 @@ The `METHOD` column is verb-colored (GET green, POST blue, PUT/PATCH yellow, DEL
|
|
|
39
39
|
Optional, case-insensitive, AND-combined:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
npx warlock routes --method GET # -m exact HTTP method
|
|
43
|
+
npx warlock routes --path /users # -p path substring
|
|
44
|
+
npx warlock routes --name users # -n route-name substring
|
|
45
|
+
npx warlock routes -m POST -p /users
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
## JSON output
|
|
@@ -50,7 +50,7 @@ pnpm warlock routes -m POST -p /users
|
|
|
50
50
|
`--json` (`-j`) emits the normalized rows instead of the table — for `jq`, a CI diff, or a generated API map. Filters apply before serialization.
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
|
|
53
|
+
npx warlock routes --json
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
```json
|
|
@@ -64,7 +64,7 @@ pnpm warlock routes --json
|
|
|
64
64
|
### Audit which routes are guarded
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
|
-
|
|
67
|
+
npx warlock routes --json | jq '[.[] | select(.middleware == 0)]'
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
Surfaces public routes (no middleware) — a quick check that auth-protected paths actually carry a guard.
|
|
@@ -72,7 +72,7 @@ Surfaces public routes (no middleware) — a quick check that auth-protected pat
|
|
|
72
72
|
### Confirm a route registered
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
|
|
75
|
+
npx warlock routes --name users.create
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
An empty result means the route isn't registered — re-run `warlock dev` and read the boot error (the route-module loader is fail-loud, so a throwing route file aborts boot rather than being silently dropped).
|
|
@@ -82,7 +82,7 @@ An empty result means the route isn't registered — re-run `warlock dev` and re
|
|
|
82
82
|
Compares the **live dev-server page routes** (`router.list().filter(r => r.isPage)`) against a **snapshot written by the last successful `warlock build`** (`page-routes.manifest.json` in `resolveBuildConfig().outdir`, e.g. `dist/page-routes.manifest.json`). Boots the same diagnostic way as `warlock routes` — route modules registered, no connectors started — then diffs.
|
|
83
83
|
|
|
84
84
|
```bash
|
|
85
|
-
|
|
85
|
+
npx warlock routes:diff
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
```
|
|
@@ -39,7 +39,7 @@ export default command({
|
|
|
39
39
|
});
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
Run it: `
|
|
42
|
+
Run it: `npx warlock users.promote --email=hasan@example.com` (or `npx warlock up -e hasan@example.com`).
|
|
43
43
|
|
|
44
44
|
## `CLICommandOptions` — the factory input
|
|
45
45
|
|
|
@@ -36,12 +36,12 @@ export default seeder({
|
|
|
36
36
|
Run them:
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
npx warlock seed # discover + run all
|
|
40
|
+
npx warlock seed --list # show registry, don't run
|
|
41
|
+
npx warlock seed --path=src/app/roles/seeds/default-roles.seed.ts # one file
|
|
42
|
+
npx warlock seed --fresh # truncate every table first, then run all
|
|
43
|
+
npx warlock seed --drop # undo every tracked record, reset the log
|
|
44
|
+
npx warlock seed --drop=default-roles # undo just one seeder's records
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
`--fresh` truncates **every** table in the DB (`datasource.driver.truncateTable(table, { cascade: true })`), including the `seeds` tracking table. After `--fresh`, `once: true` seeds will run again.
|
|
@@ -179,8 +179,8 @@ Every record you `track()` is written to a `seed_records` table (created on firs
|
|
|
179
179
|
`warlock seed --drop` reads those refs and undoes the seed:
|
|
180
180
|
|
|
181
181
|
```bash
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
npx warlock seed --drop # undo every tracked record across all seeders
|
|
183
|
+
npx warlock seed --drop=default-roles # undo just one seeder's records
|
|
184
184
|
```
|
|
185
185
|
|
|
186
186
|
What it does, inside a single transaction:
|