@dokebi/cli 0.4.42 → 0.4.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AI.md CHANGED
@@ -238,7 +238,7 @@ Every command also works in an npm workspace member folder. Packages are found t
238
238
  - AI entry (D-0065): `ANSWERS_REQUIRED` (exit 2), `ANSWERS_SOURCE_REQUIRED` (applying without `--answers-from user` or `--defaults`), `AI_CHOICE_UNKNOWN`, `AI_CHOICE_FIXED`, `AI_CHOICE_WITHOUT_ANSWER`, `AI_REASON_WITHOUT_CHOICE`, `INVALID_AI_REASON` (D-0095: `--ai-chose`/`--ai-reason` refused), `UNKNOWN_RECIPE`, `INVALID_ANSWER`, `OPTION_ABSENT`, `OPTION_NOT_APPLICABLE` (an answer another answer rules out: `--admin login` with `--db none`), `RECIPE_FILE_CONFLICT` (a file the recipe writes exists with other content; `details.path`, `fix`), `NOT_A_PROJECT`, `PREFLIGHT_FAILED` (details.preflight: `DOCKER_MISSING`, `PORT_IN_USE`), `RECIPE_STEP_FAILED`, `STEP_COMMAND_FAILED`, `NOT_PUBLISHED`, `NO_COMPATIBLE_VERSION`, `UNKNOWN_ADAPTER`, `ADAPTER_TEMPLATE_MISSING`, `DB_PLUGIN_MISSING`, `CONNECTION_MISSING`, `DEV_INFRA_UNSUPPORTED`, `COMPOSE_CONFLICT`, `COMPOSE_PORT_UNKNOWN`, `COMPOSE_INVALID`, `NOT_INSTALLED`, `DOC_MISSING`, `CATALOG_MISSING`, `CATALOG_INVALID`. check (D-0072): `TYPESCRIPT_UNAVAILABLE`, `TSCONFIG_INVALID`. drift (D-0120): `DRIFT_EXPECTED_INVALID`. verify check codes: `DOCTOR_FAILED`, `CHECK_FAILED` (details: `problems`), `TYPECHECK_FAILED`, `BUILD_FAILED`, `ALREADY_RUNNING`, `PORT_IN_USE`, `DB_URL_MISSING`, `NOT_READY`, `URL_UNKNOWN`, `HTTP_FAILED`, `FOREIGN_SERVER` (another server answered), `NOT_STARTED` (the app did not start, so no HTTP), `STOP_FORCED`, `APP_EXITED`, `CHECK_ERROR`, `TEST_FAILED` (details: `failures`, the counts and `exitCode`), `TEST_TIMEOUT` (the tests did not finish within `--test-timeout-ms`). Before any check, verify refuses a folder without `package.json`, `dokebi.yaml` or `.dokebi/state.json` with `NOT_A_PROJECT` (`details.file`, `details.fix`; the state file is the CLI's and belongs in version control, so a copied project needs it). The changing commands (`add`, `upgrade`, `remove`, `migrate`, `app`, `module`, `settings`, `config set`/`unset`/`secret`) and the app, module and settings lists do the same outside a project: `NOT_A_PROJECT` with `details.file` (`.dokebi/state.json`, or `dokebi.yaml` in a folder that has the state) and `details.fix`. For a missing dokebi.yaml the fix is `npx dokebi config init` (D-0163), which answers `CONFIG_EXISTS` when the file is there and `EXAMPLE_MISSING` without dokebi.example.yaml.
239
239
  - Commands: `USAGE`, `UNKNOWN_COMMAND`, `PROJECT_EXISTS`, `UNSUPPORTED_PROJECT`, `INVALID_SPEC`, `INVALID_PACKAGE`, `INVALID_MANIFEST`, `INCOMPATIBLE_VERSION`, `MISSING_DEPENDENCY`, `DEPENDENCY_CYCLE`, `DUPLICATE_PLUGIN`, `UNKNOWN_PLUGIN`, `REVERSE_DEPENDENCY`, `REQUIRED_PLUGIN`, `INVALID_PLUGIN_OPTIONS`, `INVALID_SET`, `PATH_MISMATCH` (config set, unset and secret: the command would change an option path it was not asked for — the plugin id `dokebi-logger` reaching `options.logging`, an old or renamed section; refused before anything is written, a warning with `--dry-run`; `details.outside` and `details.paths` name them; `config show` of such a plugin id names the section in `details.outside` and `fix`), `SAMPLE_SECRET` (`config diff --write`: the copy would leave a secret in dokebi.example.yaml; nothing written), `FILE_CONFLICT`, `PATH_CONFLICT`, `PACKAGE_CONFLICT`, `NPM_FAILED`, `REGISTRY_MISMATCH`, `INTERRUPTED` (a Ctrl+C, SIGTERM or SIGHUP before the commit: nothing applied, no lock left; run the command again), `LOCK_FAILED` (.dokebi/lock cannot be created: not writable), `PROJECT_LOCKED` (`details`: `pid`, `running`, `since` and `fix`, as doctor says it), `INVALID_ENV`, `CONCURRENT_CHANGE`, `COMMIT_FAILED`, `UPGRADE_DOWNGRADE`, `UPGRADE_IDENTITY_CHANGED`, `UPGRADE_ENTRY_MOVED`, `UPGRADE_CONFIG_CONFLICT`, `APP_EXISTS`, `APP_IN_USE`, `APPS_PRESENT`, `APP_PLUGIN_MISSING`, `DOMAIN_IN_USE`, `UNKNOWN_APP`, `UNKNOWN_DOMAIN`, `MODULE_EXISTS`, `MODULE_PLUGIN_MISSING`, `UNKNOWN_MODULE`, `HOST_MISSING`, `HOST_CONFLICT`, and for the server commands `ENTRY_MISSING`, `START_CHECK_FAILED`, `ALREADY_RUNNING`, `START_IN_PROGRESS`, `START_FAILED`, `STOP_TIMEOUT`, `STOP_FAILED` (verify could not signal the pid it started, or stop could not signal the app and its log writer could not be asked), `PROCESS_INFO_FAILED`, `NO_LOG`, `UNSUPPORTED_PLATFORM`; D-0154 `RELOAD_UNSUPPORTED`, `RELOAD_RESTART_REQUIRED`, `RELOAD_INVALID`, `RELOAD_FAILED` (`dokebi reload`); D-0155 `INVALID_SETTINGS`, `SETTINGS_EXISTS`, `SETTINGS_SECTION_CONFLICT`, `UNKNOWN_SETTINGS`, `SETTINGS_SCHEMA_FAILED`, `UNDECLARED_SECTION` (`settings` commands; doctor also `SETTINGS_SCHEMA_MISSING` and the warning `SETTINGS_SCHEMA_STALE`).
240
240
  - `UNSUPPORTED_PROJECT`: a package.json the CLI cannot install for: npm workspaces of its own, `workspace:` or `link:` specs, URLs. A tarball dependency is fine as an absolute path or a path inside the project (`file:vendor/web-0.4.3.tgz`, as npm writes it when installed from the project; it stays relative, so the project can move). `file:~/…` (npm's form of `npm install ~/x.tgz`) is the home folder for npm, not the project, and is refused, as is an absolute path npm reads the same way (`file:/~/…`, `file://~/…`: not the folder `/~`; `dokebi add` or `upgrade --to` of such a path is `INVALID_SPEC`); a listed tarball the folder lacks (an ignored `vendor/`) is npm's `NPM_FAILED` naming the file, as for an absolute path, and a folder at its path is `UNSUPPORTED_PROJECT` with `details.path`. Outside Windows a backslash in a `file:` tarball path (`file:vendor\x.tgz`) is refused too, with `details.path` and a `fix` that writes it with `/` (npm reads it as part of a file name there and saves the path with `/`, another file; `add` or `upgrade --to` of such a path: `INVALID_SPEC`); on Windows it is a separator, as for npm. `dokebi add ./vendor/web-0.4.3.tgz` and `upgrade --to vendor/web-0.4.3.tgz` write a tarball inside the project relative too; one outside it, reached through a symbolic link that leads out, or in a project folder named `~` (npm would read the home folder), is written absolute. `INVALID_OPTIONS_SCHEMA`: a plugin's options schema cannot be checked — with `details.keyword` and `details.config` it uses an `x-dokebi-*` keyword the @dokebi/config of this CLI does not know (a schema of a newer release: run the @dokebi/cli of the same release as the plugins; nothing is damaged), with `details.validator: true` the validator itself cannot load (restore node_modules), otherwise that plugin's schema is broken (reinstall it).
241
- - Diagnostics (inspect, doctor): `ENV_DOKEBI_CONFIG_IGNORED` (warning, R4CC-7: a `.env` line sets `DOKEBI_CONFIG`, which the app never gets from there; `path` `.env:<line>`, `hint`), `MIGRATION_REQUIRED`, `CONFIG_CONFLICT`, `INVALID_CORE`, `PACKAGE_VERSION_MISMATCH`, `MISSING_CORE_DEPENDENCY`, `MISSING_PACKAGE_DEPENDENCY`, `MODIFIED_REGISTRATION`, `MODIFIED_TEMPLATE` (warning: only `owner: "cli"` files), `MANIFEST_CHANGED`, `INVALID_PLUGIN_OPTIONS`, `ENTRY_MISSING`, `LEGACY_ADMIN_SECTION` (warning, D-0115: `options.blog-admin` of an older recipe keeps working; the hint says how to rename it with the seed), `LEGACY_LAYOUT`, `TEMPLATE_FIX_MISSING` (warning: a `src/infra/db/adapters/<id>.ts` — or a copy moved or renamed under `src/`, a file that imports the driver and @dokebi/db's `ResourceAdapter` — copied from @dokebi/db's template before a fix the installed template has — the handling of a socket error of a client in use (@dokebi/db's client failure code), `lazy`, `usage`, pg `failed-connect` (a client whose connect fails ends its socket, else a URL without a password kept the process alive), mariadb `url-query` (a URL query such as `?ssl=true` is refused, not dropped) and `ipv6`, pg and mariadb `lost` (a lost connection takes readiness down at once), mysql2 and mariadb `idle` (idle connections end after `idleTimeoutMs`), pg, mysql2 and mariadb `repeats` (errors of many pooled connections at once are logged once per `logRepeatWindowMs`, the rest counted), mysql2 `connect-cause` (a pool wait that ran out while the caller's own connect was pending names it, so a frozen server takes readiness down) and `queue-leave` (a caller that gave up leaves mysql2's queue instead of counting against `maxWaiting`); and, with @dokebi/template-inertia installed, a `vite.config.*` or `vite.ssr.config.*` without `build.emptyOutDir: false` (`keep-chunks`: a rolling deploy needs the previous build's chunks) or, when the installed apps host's template has it, without `vue({ script: { fs } })` (`vue-type-files`: a page whose props type is imported from another file fails `vite build`, since TypeScript 7 gives the Vue compiler no file access); and a `src/main.ts` that reads `process.env.DOKEBI_CONFIG ??` (`empty-config-env`, `plugin: null`: an empty `DOKEBI_CONFIG` is taken for a path and the app stops with `CONFIG_READ_FAILED`, while every CLI command reads dokebi.yaml then; the generated main.ts uses `||`; doctor only); `details.missing` and `details.template` name them, `hint` names the file and the change; the copy is yours, compare and bring them over), `RELOAD_NOT_WIRED` (warning: `src/main.ts` passes no `configFile` to `new Application` or `ClusterRunner`, so dokebi.yaml is never read again and `dokebi dev` restarts on every change, saying so; or the cluster workers' `src/infra/runtime/application.ts` builds `new Application` without it, so a worker cannot take the reload its primary asks for), `VUE_TYPECHECK_MISSING` (warning: an Inertia app under `src/apps` and a `typecheck` script without `vue-tsc`, from before `app add --inertia` prepared the Vue check; the hint lists the files and devDependencies to add), `DEV_FILES_UNGUARDED` (D-0129: an Inertia app under `src/apps` and an installed @dokebi/template-inertia without the dev file policy, so `dokebi dev` serves every project file such as `dokebi.yaml?raw`; an error when `options.dokebi-template-inertia.devHosts` is set, a warning otherwise; the hint says to upgrade the package and change secrets that were reachable), `MISSING_REQUIRED_PLUGIN`, `STALE_REQUIREMENTS`, `PLUGIN_CHECK` (details `code`, `optionPath`, and the plugin's `hint`), `GUIDE_BLOCK_MODIFIED` (warning: the installed list in AGENTS.md was edited between its markers by hand, D-0072), `GUIDE_PROJECT_BLOCK_INVALID` (warning: the `dokebi:project` markers of AGENTS.md cannot be read, D-0077), `PROJECT_LOCKED`, `RECOVERY_REQUIRED`, `UNSAFE_PATH`, `INVALID_LOGGING_CONFIG` (error: a level value of `options.logging`, or `options.logging` that is not an object), `LOGGING_PLUGIN_UNKNOWN` (warning: a level for a plugin that is not installed), `LOGGING_OPTIONS_UNUSED` (warning, D-0151: keys other than `level` and `plugins` in `options.logging` without the logger plugin; core warns the same at startup; with @dokebi/logger installed its options schema checks them as `INVALID_PLUGIN_OPTIONS`).
241
+ - Diagnostics (inspect, doctor): `ENV_DOKEBI_CONFIG_IGNORED` (warning, R4CC-7: a `.env` line sets `DOKEBI_CONFIG`, which the app never gets from there; `path` `.env:<line>`, `hint`), `MIGRATION_REQUIRED`, `CONFIG_CONFLICT`, `INVALID_CORE`, `PACKAGE_VERSION_MISMATCH`, `MISSING_CORE_DEPENDENCY`, `MISSING_PACKAGE_DEPENDENCY`, `MODIFIED_REGISTRATION`, `MODIFIED_TEMPLATE` (warning: only `owner: "cli"` files), `MANIFEST_CHANGED`, `INVALID_PLUGIN_OPTIONS`, `ENTRY_MISSING`, `LEGACY_ADMIN_SECTION` (warning, D-0115: `options.blog-admin` of an older recipe keeps working; the hint says how to rename it with the seed), `LEGACY_LAYOUT`, `TEMPLATE_FIX_MISSING` (warning: a `src/infra/db/adapters/<id>.ts` — or a copy moved or renamed under `src/`, a file that imports the driver and @dokebi/db's `ResourceAdapter` — copied from @dokebi/db's template before a fix the installed template has — the handling of a socket error of a client in use (@dokebi/db's client failure code), `lazy`, `usage`, pg `failed-connect` (a client whose connect fails ends its socket, else a URL without a password kept the process alive), mariadb `url-query` (a URL query such as `?ssl=true` is refused, not dropped) and `ipv6`, pg and mariadb `lost` (a lost connection takes readiness down at once), mysql2 and mariadb `idle` (idle connections end after `idleTimeoutMs`), pg, mysql2 and mariadb `repeats` (errors of many pooled connections at once are logged once per `logRepeatWindowMs`, the rest counted), mysql2 `connect-cause` (a pool wait that ran out while the caller's own connect was pending names it, so a frozen server takes readiness down) and `queue-leave` (a caller that gave up leaves mysql2's queue instead of counting against `maxWaiting`); and, with @dokebi/template-inertia installed, a `vite.config.*` or `vite.ssr.config.*` without `build.emptyOutDir: false` (`keep-chunks`: a rolling deploy needs the previous build's chunks) or, when the installed apps host's template has it, without `vue({ script: { fs } })` (`vue-type-files`: a page whose props type is imported from another file fails `vite build`, since TypeScript 7 gives the Vue compiler no file access), an Inertia app's `views/app.js` or `views/ssr.js` that does not import `virtual:dokebi/module-pages` while a module under `src/` keeps Vue pages in its views folder (`module-pages`, D-0218: a module page answers "Unknown page"; `details.page` names one) and a Vite config without `dokebiInertia()` while an entry imports it (`module-pages-plugin`: the build cannot resolve the import); and a `src/main.ts` that reads `process.env.DOKEBI_CONFIG ??` (`empty-config-env`, `plugin: null`: an empty `DOKEBI_CONFIG` is taken for a path and the app stops with `CONFIG_READ_FAILED`, while every CLI command reads dokebi.yaml then; the generated main.ts uses `||`; doctor only); `details.missing` and `details.template` name them, `hint` names the file and the change; the copy is yours, compare and bring them over), `RELOAD_NOT_WIRED` (warning: `src/main.ts` passes no `configFile` to `new Application` or `ClusterRunner`, so dokebi.yaml is never read again and `dokebi dev` restarts on every change, saying so; or the cluster workers' `src/infra/runtime/application.ts` builds `new Application` without it, so a worker cannot take the reload its primary asks for), `VUE_TYPECHECK_MISSING` (warning: an Inertia app under `src/apps` and a `typecheck` script without `vue-tsc`, from before `app add --inertia` prepared the Vue check; the hint lists the files and devDependencies to add), `DEV_FILES_UNGUARDED` (D-0129: an Inertia app under `src/apps` and an installed @dokebi/template-inertia without the dev file policy, so `dokebi dev` serves every project file such as `dokebi.yaml?raw`; an error when `options.dokebi-template-inertia.devHosts` is set, a warning otherwise; the hint says to upgrade the package and change secrets that were reachable), `MISSING_REQUIRED_PLUGIN`, `STALE_REQUIREMENTS`, `PLUGIN_CHECK` (details `code`, `optionPath`, and the plugin's `hint`), `GUIDE_BLOCK_MODIFIED` (warning: the installed list in AGENTS.md was edited between its markers by hand, D-0072), `GUIDE_PROJECT_BLOCK_INVALID` (warning: the `dokebi:project` markers of AGENTS.md cannot be read, D-0077), `PROJECT_LOCKED`, `RECOVERY_REQUIRED`, `UNSAFE_PATH`, `INVALID_LOGGING_CONFIG` (error: a level value of `options.logging`, or `options.logging` that is not an object), `LOGGING_PLUGIN_UNKNOWN` (warning: a level for a plugin that is not installed), `LOGGING_OPTIONS_UNUSED` (warning, D-0151: keys other than `level` and `plugins` in `options.logging` without the logger plugin; core warns the same at startup; with @dokebi/logger installed its options schema checks them as `INVALID_PLUGIN_OPTIONS`).
242
242
 
243
243
  ### Logs (D-0047)
244
244
 
package/catalog.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$comment": "Generated by scripts/catalog/build.ts from package.json dokebiCatalog fields and packages/cli/catalog-src (D-0065). Do not edit; run node scripts/catalog/build.ts.",
3
3
  "schemaVersion": 1,
4
- "cli": "0.4.42",
4
+ "cli": "0.4.44",
5
5
  "core": {
6
6
  "package": "@dokebi/core",
7
7
  "version": "0.4.7"
@@ -446,7 +446,7 @@
446
446
  {
447
447
  "id": "dokebi-app",
448
448
  "package": "@dokebi/app",
449
- "version": "0.4.7",
449
+ "version": "0.4.10",
450
450
  "kind": "plugin",
451
451
  "summary": "Several apps chosen by request domain (src/apps/<app>) with a template each; installs web, controller and template-ejs with it",
452
452
  "description": "Multiple apps per project for Dokebi: pick the app and template by request domain, with EJS and Inertia skeletons.",
@@ -820,7 +820,7 @@
820
820
  {
821
821
  "id": null,
822
822
  "package": "@dokebi/cli",
823
- "version": "0.4.42",
823
+ "version": "0.4.44",
824
824
  "kind": "cli",
825
825
  "summary": "Commands to create a project, browse the plugin catalog, run recipes, install plugins and verify (dokebi)",
826
826
  "description": "Project scaffolding, plugin catalog, recipes, install and verification CLI for Dokebi.",
@@ -1692,7 +1692,7 @@
1692
1692
  {
1693
1693
  "id": "dokebi-job",
1694
1694
  "package": "@dokebi/job",
1695
- "version": "0.4.5",
1695
+ "version": "0.4.6",
1696
1696
  "kind": "plugin",
1697
1697
  "summary": "NATS JetStream job queue (at least once, retries, DLQ)",
1698
1698
  "description": "Bounded durable jobs over the Dokebi NATS provider: retries, delayed redelivery and a dead-letter stream.",
@@ -2138,7 +2138,7 @@
2138
2138
  {
2139
2139
  "id": "dokebi-module",
2140
2140
  "package": "@dokebi/module",
2141
- "version": "0.4.4",
2141
+ "version": "0.4.7",
2142
2142
  "kind": "plugin",
2143
2143
  "summary": "Modules that hold one feature each (src/shared/modules/<module>); an app attaches them under a prefix",
2144
2144
  "description": "Feature modules for Dokebi apps: controllers, models, views and routes in one folder mounted under a prefix.",
@@ -2318,7 +2318,7 @@
2318
2318
  {
2319
2319
  "id": "dokebi-outbox",
2320
2320
  "package": "@dokebi/outbox",
2321
- "version": "0.1.1",
2321
+ "version": "0.1.2",
2322
2322
  "kind": "plugin",
2323
2323
  "summary": "Durable background work in your database: enqueue in the business transaction, fair batch claims across owners, leases, backoff, per-destination breakers that wait out outages, dead items with bulk resend, retention, arrival and drain numbers",
2324
2324
  "description": "Durable database-backed background work for Dokebi: enqueue in the business transaction, fair batch claims across owners, leases, retries with backoff, per-destination breakers, dead items with bulk resend, retention and arrival/drain numbers.",
@@ -3005,7 +3005,7 @@
3005
3005
  {
3006
3006
  "id": "dokebi-scheduler",
3007
3007
  "package": "@dokebi/scheduler",
3008
- "version": "0.4.3",
3008
+ "version": "0.4.4",
3009
3009
  "kind": "plugin",
3010
3010
  "summary": "Submits fixed-interval and cron schedules as @dokebi/job jobs (one leader through Redis)",
3011
3011
  "description": "Interval and cron schedules (with time zones) for Dokebi that submit jobs, with one leader over Redis.",
@@ -3041,6 +3041,7 @@
3041
3041
  "optionKeys": [
3042
3042
  "allowInCluster",
3043
3043
  "coordination",
3044
+ "enabled",
3044
3045
  "logRepeatWindowMs",
3045
3046
  "retryAfterMs",
3046
3047
  "schedules",
@@ -3445,7 +3446,7 @@
3445
3446
  {
3446
3447
  "id": "dokebi-template-inertia",
3447
3448
  "package": "@dokebi/template-inertia",
3448
- "version": "0.4.7",
3449
+ "version": "0.4.8",
3449
3450
  "kind": "plugin",
3450
3451
  "summary": "Inertia (v3) server adapter: Vue 3 views, Vite build files and optional server-side rendering (SSR)",
3451
3452
  "description": "Inertia v3 server adapter for Dokebi: page JSON, Vite manifest assets and optional server-side rendering.",
@@ -3665,7 +3666,7 @@
3665
3666
  {
3666
3667
  "id": "dokebi-web",
3667
3668
  "package": "@dokebi/web",
3668
- "version": "0.4.7",
3669
+ "version": "0.4.8",
3669
3670
  "kind": "plugin",
3670
3671
  "summary": "Fastify 5 HTTP server (503 before ready, health paths, drain, zero-downtime cluster replacement, security headers and overload protection on by default)",
3671
3672
  "description": "Fastify 5 HTTP server owned by a Dokebi app: 503 before ready, health routes, drain and cluster handover.",
@@ -3717,6 +3718,7 @@
3717
3718
  "healthRoutes",
3718
3719
  "host",
3719
3720
  "linger",
3721
+ "listen",
3720
3722
  "logRepeatWindowMs",
3721
3723
  "maxBodyBytes",
3722
3724
  "maxRouteBodyBytes",
@@ -205,7 +205,11 @@ browser = []) {
205
205
  noEmit: true,
206
206
  },
207
207
  files: [...virtual.keys()],
208
- include: [],
208
+ // The project's declaration files (src/infra/inertia/page.d.ts: the shared page props and
209
+ // the module pages of D-0218), as tsconfig.vue.json includes them for vue-tsc. The server
210
+ // tsconfig may exclude them (they type the browser), so its exclude is not inherited.
211
+ include: tsconfig === null ? [] : ['**/*.d.ts'],
212
+ exclude: ['**/node_modules/**', '**/dist/**', '**/.tmp/**', '**/.dokebi/**'],
209
213
  }));
210
214
  }
211
215
  let api;
package/dist/output.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const CLI_VERSION = "0.4.42";
1
+ export declare const CLI_VERSION = "0.4.44";
2
2
  export declare function envelope(command: string, result: unknown, ok?: boolean): object;
3
3
  export declare function failure(command: string, error: unknown, mutationStarted: boolean): object;
package/dist/output.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CliError } from './errors.js';
2
- export const CLI_VERSION = '0.4.42';
2
+ export const CLI_VERSION = '0.4.44';
3
3
  export function envelope(command, result, ok = true) {
4
4
  return { schemaVersion: 1, cliVersion: CLI_VERSION, command, ok, result, error: null };
5
5
  }
@@ -263,6 +263,8 @@ export async function templateFixes(root, base, sources) {
263
263
  hint: `${hints.join('. ')} (the file is yours: the CLI never rewrites it)`,
264
264
  });
265
265
  }
266
+ if (sources.inertia)
267
+ found.push(...(await modulePageFixes(root)));
266
268
  // R4CB-1: the generated src/main.ts read DOKEBI_CONFIG with `??`, so an empty value was taken
267
269
  // for a path (the working folder) and the app failed to start, while every CLI command reads
268
270
  // dokebi.yaml then (D-0154 D4). Not a plugin's template: doctor names it, upgrade does not.
@@ -283,3 +285,113 @@ export async function templateFixes(root, base, sources) {
283
285
  const MAIN_FILE = 'src/main.ts';
284
286
  /** `process.env.DOKEBI_CONFIG ??` in code (comments and strings masked). */
285
287
  const EMPTY_CONFIG_ENV = /\bprocess\.env\.DOKEBI_CONFIG\s*\?\?/;
288
+ /** The specifier of the module pages (D-0218), as an import of views/app.js or views/ssr.js. */
289
+ const MODULE_PAGES_IMPORT = /\bfrom\s+['"]virtual:dokebi\/module-pages['"]/;
290
+ /** A Vue page in a module's views folder: `<…>/views/<template>/Pages/…/*.vue`. */
291
+ const MODULE_PAGE = /(?:^|\/)views\/[^/]+\/Pages\/.+\.vue$/;
292
+ /** Whether some module under src/ (outside src/apps) has a Vue page in its views folder. */
293
+ async function hasModulePages(root) {
294
+ let seen = 0;
295
+ const walk = async (folder, depth) => {
296
+ if (depth > 10 || seen >= MAX_SCANNED_FILES)
297
+ return undefined;
298
+ let entries;
299
+ try {
300
+ entries = await readdir(await securePath(root, folder), { withFileTypes: true });
301
+ }
302
+ catch (error) {
303
+ if (isMissing(error))
304
+ return undefined;
305
+ throw new CliError('READ_FAILED', `Cannot read ${folder}`, { cause: error });
306
+ }
307
+ for (const entry of entries) {
308
+ if (entry.name.startsWith('.') || entry.name === 'node_modules')
309
+ continue;
310
+ const path = `${folder}/${entry.name}`;
311
+ if (entry.isDirectory()) {
312
+ if (path === 'src/apps')
313
+ continue;
314
+ const found = await walk(path, depth + 1);
315
+ if (found)
316
+ return found;
317
+ }
318
+ else if (entry.isFile()) {
319
+ seen++;
320
+ if (MODULE_PAGE.test(path))
321
+ return path;
322
+ }
323
+ }
324
+ return undefined;
325
+ };
326
+ return walk('src', 0);
327
+ }
328
+ /**
329
+ * D-0218: views/app.js and views/ssr.js of the Inertia apps written before module pages (they
330
+ * cannot show a page a module keeps in its own folder), and a Vite config without dokebiInertia()
331
+ * while an entry imports the module pages (the build cannot resolve the import).
332
+ */
333
+ async function modulePageFixes(root) {
334
+ const found = [];
335
+ let apps;
336
+ try {
337
+ apps = await readdir(await securePath(root, 'src/apps'), { withFileTypes: true });
338
+ }
339
+ catch (error) {
340
+ if (isMissing(error))
341
+ return found;
342
+ throw new CliError('READ_FAILED', 'Cannot read src/apps', { cause: error });
343
+ }
344
+ const entries = [];
345
+ for (const app of apps
346
+ .filter((entry) => entry.isDirectory())
347
+ .sort((a, b) => a.name.localeCompare(b.name)))
348
+ for (const kind of ['app', 'ssr']) {
349
+ const path = `src/apps/${app.name}/views/${kind}.js`;
350
+ const text = await readOptional(() => securePath(root, path), path);
351
+ if (text === undefined)
352
+ continue;
353
+ entries.push({ path, kind, imports: MODULE_PAGES_IMPORT.test(withoutComments(text)) });
354
+ }
355
+ if (!entries.length)
356
+ return found;
357
+ const page = entries.some((entry) => !entry.imports) ? await hasModulePages(root) : undefined;
358
+ for (const entry of entries) {
359
+ if (entry.imports || !page)
360
+ continue;
361
+ debug('Inertia entry without module pages', { path: entry.path, page });
362
+ found.push({
363
+ code: 'TEMPLATE_FIX_MISSING',
364
+ severity: 'warning',
365
+ path: entry.path,
366
+ plugin: 'dokebi-template-inertia',
367
+ details: { missing: ['module-pages'], page },
368
+ hint: `${entry.path} looks pages up in its app folder only, while ${page} is a Vue page a module keeps in its own views folder (D-0218): a module page of this app answers "Unknown page". Import modulePages from 'virtual:dokebi/module-pages' and resolve a name the app has no file for with modulePages.page(template, name), as templates/app-inertia/views/${entry.kind}.js of @dokebi/app does, and add /// <reference types="@dokebi/template-inertia/module-pages" /> to src/infra/inertia/page.d.ts for its types (the files are yours: the CLI never rewrites them)`,
369
+ });
370
+ }
371
+ for (const [kind, base] of [
372
+ ['app', 'vite.config'],
373
+ ['ssr', 'vite.ssr.config'],
374
+ ]) {
375
+ if (!entries.some((entry) => entry.kind === kind && entry.imports))
376
+ continue;
377
+ for (const extension of VITE_EXTENSIONS) {
378
+ const path = `${base}.${extension}`;
379
+ const text = await readOptional(() => securePath(root, path), path);
380
+ if (text === undefined)
381
+ continue;
382
+ if (!/\bdokebiInertia\s*\(/.test(maskCode(text))) {
383
+ debug('Vite config without dokebiInertia() for module pages', { path });
384
+ found.push({
385
+ code: 'TEMPLATE_FIX_MISSING',
386
+ severity: 'warning',
387
+ path,
388
+ plugin: 'dokebi-template-inertia',
389
+ details: { missing: ['module-pages-plugin'] },
390
+ hint: `views/${kind}.js imports 'virtual:dokebi/module-pages', which dokebiInertia() of @dokebi/template-inertia/vite writes, and ${path} does not use it: the build cannot resolve the import. Add dokebiInertia() to the plugins of ${path} (the file is yours: the CLI never rewrites it)`,
391
+ });
392
+ }
393
+ break;
394
+ }
395
+ }
396
+ return found;
397
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dokebi/cli",
3
- "version": "0.4.42",
3
+ "version": "0.4.44",
4
4
  "description": "Project scaffolding, plugin catalog, recipes, install and verification CLI for Dokebi.",
5
5
  "keywords": [
6
6
  "dokebi",