@dokebi/cli 0.4.29 → 0.4.31

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
@@ -68,23 +68,23 @@ The `blog` plan, depending on the answers: `init` (when the folder is not a proj
68
68
  | `dokebi plugins list [--compatible] [--online]` | Every Dokebi package (`id`, `package`, `kind`, `version`, `summary`, `maturity`, `provides`, `install`, `core`, `compatible`, `installed`). The catalog is the snapshot inside this CLI (`catalog.json`); `--online` adds the latest and compatible versions from the registry (when it cannot reach it: warning `CATALOG_OFFLINE` and the snapshot) |
69
69
  | `dokebi plugins search <word\|capability>` | `{ query, status: found\|absent\|unknown, matches[], recipes[], absent[{capability, summary, instead, message}] }`. When no package matches it returns the matching absent entries, so "not found" differs from "does not exist" |
70
70
  | `dokebi plugins info <id\|package>` · `plugins doc <id\|package>` | One package: capabilities, variants, what it does not do, dependencies, option keys, installed version and compatibility / the AI.md of the **installed version** (`path`, `content`, `version`). Unknown: `UNKNOWN_PLUGIN` (details hold the search result and absent entries; a guessed short name of an installed package, such as `dokebi-core`, gets `details.package`, `path` and `fix`: `npx dokebi plugins doc @dokebi/core --json (or read node_modules/@dokebi/core/AI.md)`); not installed: `NOT_INSTALLED` (hint: `add --dry-run`); no AI.md: `DOC_MISSING` |
71
- | `dokebi add <package\|tgz> [--set <path>=<value>]... [--adapter <pg\|mysql2\|mariadb\|mongodb>] [--startup <required\|optional>] [--no-first-app] [--dry-run]` | Install and register a plugin. Required plugins named in the manifest (with `package`) are installed with it (`autoInstalled`). **Without a version** it picks the highest version that fits the project core (`resolved{package, version, source: registry\|snapshot, core, registry, deprecated?}`). It also has to fit the installed packages: the peers it names accept the versions the project has (`@dokebi/session` 0.4.4 needs `@dokebi/web` ^0.4.3), and the installed plugins' manifest ranges accept it. A newer version they hold back is the warning `NEWER_VERSION_HELD_BACK` (`path: <package>@<version>`, `hint`: what it needs and the commands, `npx dokebi upgrade <id>` first); when no version fits it is `INCOMPATIBLE_VERSION` (phase `plan`, `details.conflicts`, `details.fix`). The required plugins it brings (`autoInstalled`) get their versions the same way, inside the range its manifest names, in the same npm run (npm alone took the newest of the range, which could need a newer core). A named version whose peers do not fit stops in npm with `ERESOLVE`; that `NPM_FAILED` then has `details.conflicts` and `details.fix` (upgrade the installed package first) instead of the generic `hint`. The registry is the one npm really uses for that package (a scope setting such as `@dokebi:registry` first; environment, project, user and global `.npmrc`; see "Version selection" below). Pre-releases (`-rc.1` and the like) and `0.0.0-…` placeholders are never picked (name one with `add <package>@<version>`); a deprecated version only when there is no other, with the warning `DEPRECATED_VERSION`. Not in the registry: `NOT_PUBLISHED`; no version fits: `NO_COMPATIBLE_VERSION`; outside `@dokebi/`: warning `THIRD_PARTY_PACKAGE`. `--adapter` (@dokebi/db): the adapter file `src/infra/db/adapters/<id>.ts`, an entry file with the connection `main`, `connections.main` (the URL is a placeholder) and the driver (pg also gets `@types/pg`); it works on an installed db too (an edited entry file is kept: `CONNECTIONS_KEPT`). `--startup <required|optional>` (with `--adapter` only, D-0127) writes `connections.main.startup`; left out, nothing is written and the default `required` applies. `--no-first-app` (@dokebi/app): no first app `main`. The version already installed is no change (`changed: []`); with `--set` it is `INVALID_SET` (`details.paths`, `details.fix`: `npx dokebi config set …`), since add writes no options then. When an installed plugin's install module names a secret option (`configSecrets`, for example @dokebi/session's `secrets`) that has no value yet, add writes a generated secret (32 random bytes, base64url, as `config secret`) into dokebi.yaml and reports `generatedSecrets[{plugin, option, file}]` (`option: '<id>.<path>'`, `file: 'dokebi.yaml'`): the name, never the value. `--dry-run` reports the same list. A plugin published before that still names an environment variable (`envSecrets`, deprecated, removed in 0.5) gets it appended to `.env` as before, with the warning `DEPRECATED_PLAN_FIELD` (`deprecated: 'envSecrets'`) |
71
+ | `dokebi add <package\|tgz> [--set <path>=<value>]... [--adapter <id>] [--startup <required\|optional>] [--no-first-app] [--dry-run]` | Install and register a plugin. Required plugins named in the manifest (with `package`) are installed with it (`autoInstalled`). **Without a version** it picks the highest version that fits the project core (`resolved{package, version, source: registry\|snapshot, core, registry, deprecated?}`). It also has to fit the installed packages: the peers it names accept the versions the project has (`@dokebi/session` 0.4.4 needs `@dokebi/web` ^0.4.3), and the installed plugins' manifest ranges accept it. A newer version they hold back is the warning `NEWER_VERSION_HELD_BACK` (`path: <package>@<version>`, `hint`: what it needs and the commands, `npx dokebi upgrade <id>` first); when no version fits it is `INCOMPATIBLE_VERSION` (phase `plan`, `details.conflicts`, `details.fix`). The required plugins it brings (`autoInstalled`) get their versions the same way, inside the range its manifest names, in the same npm run (npm alone took the newest of the range, which could need a newer core). A named version whose peers do not fit stops in npm with `ERESOLVE`; that `NPM_FAILED` then has `details.conflicts` and `details.fix` (upgrade the installed package first) instead of the generic `hint`. The registry is the one npm really uses for that package (a scope setting such as `@dokebi:registry` first; environment, project, user and global `.npmrc`; see "Version selection" below). Pre-releases (`-rc.1` and the like) and `0.0.0-…` placeholders are never picked (name one with `add <package>@<version>`); a deprecated version only when there is no other, with the warning `DEPRECATED_VERSION`. Not in the registry: `NOT_PUBLISHED`; no version fits: `NO_COMPATIBLE_VERSION`; outside `@dokebi/`: warning `THIRD_PARTY_PACKAGE`. `--adapter` (@dokebi/db): the adapter file `src/infra/db/adapters/<id>.ts`, an entry file with the connection `main`, `connections.main` (the URL is a placeholder) and the driver (pg also gets `@types/pg`); it works on an installed db too (an edited entry file is kept: `CONNECTIONS_KEPT`). `--adapter <anthropic\|openai\|gemini>` (@dokebi/ai, D-0186): installs that provider's official SDK only (also on an installed @dokebi/ai); a plugin without adapters refuses the flag (`USAGE`), an unknown id is `UNKNOWN_ADAPTER` (`details.adapters`). `--startup <required|optional>` (with `--adapter` only, D-0127) writes `connections.main.startup`; left out, nothing is written and the default `required` applies. `--no-first-app` (@dokebi/app): no first app `main`. The version already installed is no change (`changed: []`); with `--set` it is `INVALID_SET` (`details.paths`, `details.fix`: `npx dokebi config set …`), since add writes no options then. When an installed plugin's install module names a secret option (`configSecrets`, for example @dokebi/session's `secrets`) that has no value yet, add writes a generated secret (32 random bytes, base64url, as `config secret`) into dokebi.yaml and reports `generatedSecrets[{plugin, option, file}]` (`option: '<id>.<path>'`, `file: 'dokebi.yaml'`): the name, never the value. `--dry-run` reports the same list. A plugin published before that still names an environment variable (`envSecrets`, deprecated, removed in 0.5) gets it appended to `.env` as before, with the warning `DEPRECATED_PLAN_FIELD` (`deprecated: 'envSecrets'`) |
72
72
  | `dokebi config show [<id>[.<path>]]` | Prints the options of dokebi.yaml with every secret hidden (AI-M05): Every config command (`show`, `diff`, `set`, `unset`, `secret`) works on the settings file the app reads (M50): the file `DOKEBI_CONFIG` names when it is set and not empty (a relative path is from the project folder, as `dokebi dev`, the generated `src/main.ts` and dokebi-migrate take it), else dokebi.yaml; the result names it in `file` (and in `changed`, `paths`, `removed[].files`). A named file outside the project is read by `show` and `diff` but never written (`UNSAFE_PATH`, as with a linked dokebi.yaml); a named file that is not there is `READ_FAILED`, never dokebi.yaml instead. The sample stays the project's one dokebi.example.yaml. `{ file, path, value, defaults[], secrets[], warnings? }`. `value` is every section (installed plugins without a section too), one section or one value; options the file does not set are filled from the schema `default` and listed in `defaults` (the human YAML marks them `# default`). Hidden as `<secret: set>`: values the plugin schema marks secret (`writeOnly`, as `dokebi check` secret-in-config reads it, also through `patternProperties`, `prefixItems` or a `then`/`else` branch that may apply; a list of them is one entry of `secrets`), values under a name core's log rule masks (`redaction.isSecretField` of `@dokebi/core/libraries`, the one rule: `password`, `secret`, `token`, `apiKey`, `authorization`, `cookie`, `credentials`, `sessionId`, `jwt`, `pin`, … — text, or the text of a list or of an object whose schema does not declare its fields; a number only under a password, PIN or code name; never a boolean; `key`, `cacheKey`, `maxKeys` are not secret names), unless the schema marks the option plain (`x-dokebi-secret: false`, core option `plain`, as `secretsEnv` and `routeIds.*` are), and the recipe's first admin password (`first-admin.initialPassword`, or the older `blog-admin.initialPassword`); credentials inside text, found by core's `redaction.maskCredentials`, show as `<secret>`: `scheme://user:<secret>@host` (also a password with a raw `/` or `@`), `scheme://<secret>@host` for a user or token without a password, `Password=<secret>` of a connection string. A default under a name that would be hidden is not filled in; a default is not filled in beside a set old name of the option either (D-0071 alias: `bodyLimit` holds `maxBodyBytes`). The plugin id of the logger (`dokebi-logger`, whose section is `logging`) is `PATH_MISMATCH` with the `config show logging.<path>` to use. When a plugin's schema cannot be read, all its text is hidden (warning `OPTIONS_SCHEMA_UNREADABLE`). No value is ever printed, in the human output, `--json`, errors or debug logs. A list item is named by its index, its `name` or the `type` of an item without a name, as `config set` names it (`config show logging.targets.pretty`); a path that is not set and has no default is `UNKNOWN_OPTION` (`details.keys`; in a list `details.items`, how each item is named). Read only, no lock. **Use it instead of cat, sed, grep or head on dokebi.yaml** |
73
73
  | `dokebi config diff [<id>] [--write [--values] [--prune] [--dry-run]]` | Compares dokebi.yaml with dokebi.example.yaml by option path (AI-M45: an agent dumped both files to compare them and printed secrets): `{ file, example, section, inSync, onlyInConfig[], onlyInExample[], different[], secrets[], exampleSecrets[], warnings? }`. A subtree one file lacks is one path, a list one value; `different` names paths both set to other non-secret values (a sample value may differ). Secrets of dokebi.yaml (as `config show` hides them) are never compared and never count as missing from the sample; a secret path that holds a value in the sample is in `exampleSecrets` (remove it; a sample value is judged by the sample's own rule: in a section nothing declares, such as one `dokebi remove` kept, by name and credentials only; a URL without a password, a `<password>` in place of one and the scaffold's `<set … here>` text, also as list items, are placeholders, not leaks). Secret names follow core's rule as in `config show` (text under them is a secret, a count such as `transientLogMaxKeys: 256` or a boolean is compared; a plain option is compared). `inSync` is true when no path is only in one file and the sample holds no secret. `warnings` are `config show`'s for either file: with `OPTIONS_SCHEMA_UNREADABLE` that plugin's text counts as secret in both files, so its sample values are in `exampleSecrets` until its schema can be read again (`npm install`), not values to remove. Values never appear in the result, errors or logs. No sample: `EXAMPLE_MISSING` `--write` (AI-M46: a builder copied set values into the sample with a script of its own) copies the paths only in dokebi.yaml into dokebi.example.yaml in one transaction, comments kept: secrets inside them are left out (a list holding one is left out whole; a path holding nothing else counts as a secret, in `secrets`), paths both files set keep the sample's value — with `--values` (Studio v2) they get dokebi.yaml's value too, every path of `different` (never a secret: secrets are not compared; a list or mapping without its secrets, or left out when one item is secret), listed in `valuesWritten`. The result adds `written` (paths) and `diff` (the comparison after the copy); a copy that would leave a secret in the sample is refused (`SAMPLE_SECRET`, nothing written). `--prune` (with `--write`) also removes from the sample only what nothing reads — a section no installed plugin, settings declaration or core reads (an old `dokebi-logger`), keys a schema does not declare and refuses (an option a plugin dropped; an object without `additionalProperties: false` takes any key, so its keys stay) — and any secret with a value in it (`exampleSecrets`, including one inside a list item such as a log target's `token`); a declared option only the sample shows stays; dokebi.yaml is never changed; the result adds `pruned`. Never edit the sample by hand: `config set` writes dokebi.yaml only, then `config diff --write [--prune]` |
74
74
  | `dokebi config init [--dry-run]` | **A fresh copy of the project** (a clone, a CI checkout: dokebi.yaml stays out of version control, D-0163): writes dokebi.yaml (0600) from dokebi.example.yaml with a new generated secret for each one `add` writes (the install plans' `configSecrets`, such as `dokebi-session.secrets`) and each required secret of a settings section (D-0155); a secret someone supplies (an SMTP password) is never made up. `{ file, generatedSecrets[{plugin, option, file}], placeholders[], nextSteps }`: names only, values never shown; `placeholders` are the sample's `<…>` values still to fill (the database URL: `npx dokebi dev-infra`, the first next step). An existing file is `CONFIG_EXISTS` (never replaced); no sample is `EXAMPLE_MISSING`. Without dokebi.yaml, `doctor` (one `NOT_A_PROJECT` error), `dev-infra up`, `verify` and the other config commands answer `NOT_A_PROJECT` with this command in `details.fix` |
75
- | `dokebi config secret <id>.<path> [--stdin] [--rotate]` | Writes a random secret (32 bytes; a one-item list when the schema wants a list) into dokebi.yaml, or with `--stdin` a secret you were given (the token of a log receiver: `config secret logging.targets.studio.token --stdin < token.txt`, or typed without echo when stdin is a terminal; one line, at most 64 KiB, nothing or several lines is `INVALID_SET`; the result has `generated: false, stdin: true`). The value never appears in output or logs; an existing value stays (`SECRET_KEPT`, with a `hint` naming `--rotate`); an empty one (`token:`, `''`, `[]`) holds no secret and is filled, and so is the sample's placeholder (`<set the postgres URL here or run npx dokebi dev-infra>`, what `config init` lists in `placeholders`). An address (a key `url` or `uri`, or one ending in `Url` or `Uri`) is never generated: without `--stdin` it is `INVALID_SET` with `details.fix` (`config secret dokebi-db.connections.main.options.url --stdin < url.txt`). Example: `config secret dokebi-websocket-hub.secret`. `logging.<path>` is `options.logging` (the @dokebi/logger options); a list item is named by its `name` (else its `type`) or its index (`logging.targets.studio.token`, `logging.targets.3.token`); a name that is not there is `INVALID_SET` with `details.items`. A secret a plugin declares (such as `dokebi-session.secrets`) is already written by `add`; run it after you removed one. `--rotate` replaces an existing value (AI-M05): a list (`dokebi-session.secrets`, `dokebi-csrf.secrets`, `dokebi-auth.secrets`: the first signs, all verify) gets the new secret **first** and keeps the previous ones after it, at most 2 (`kept`); older ones are dropped (`dropped`, warning `SECRETS_DROPPED` with `count`), and fewer are kept when the schema allows fewer items; when the schema takes no list with a kept one (only a new string or a one-item list), every previous secret is dropped and counted the same way. A string is replaced. The result is `secret{path, list, generated, rotated, kept, dropped}` and a next step to restart the app (`dev` restarts on its own); never a value. What a rotation changes: session cookies signed with a kept secret still verify and are re-signed with the new one as they are used (@dokebi/session); CSRF tokens of a kept secret still verify (@dokebi/csrf); auth stamps signed with a kept key still verify, and remember-me and API tokens are never re-signed, so keep the old key for their longest lifetime (@dokebi/auth AI.md §9). A dropped secret (or a replaced string) invalidates what it signed: sessions end, open forms fail once, logins end. An environment override of the option (`secretsEnv`), where it is set, still wins over dokebi.yaml |
75
+ | `dokebi config secret <id>.<path> [--stdin] [--rotate]` | Writes a random secret (32 bytes; a one-item list when the schema wants a list) into dokebi.yaml, or with `--stdin` a secret you were given (the token of a log receiver: `config secret logging.targets.studio.token --stdin < token.txt`, or typed without echo when stdin is a terminal; one line, at most 64 KiB, nothing or several lines is `INVALID_SET`; the result has `generated: false, stdin: true`). The value never appears in output or logs; an existing value stays (`SECRET_KEPT`, with a `hint` naming `--rotate`); an empty one (`token:`, `''`, `[]`) holds no secret and is filled, and so is the sample's placeholder (`<set the postgres URL here or run npx dokebi dev-infra>`, what `config init` lists in `placeholders`). An address (a key `url` or `uri`, or one ending in `Url` or `Uri`) is never generated: without `--stdin` it is `INVALID_SET` with `details.fix` (`config secret dokebi-db.connections.main.options.url --stdin < url.txt`). A key a provider issues (a key `apiKey` or `api_key`, or one ending in `ApiKey`, such as `dokebi-ai.connections.main.apiKey`) is never generated either: `INVALID_SET` with `details.fix` (`--stdin`). Example: `config secret dokebi-websocket-hub.secret`. `logging.<path>` is `options.logging` (the @dokebi/logger options); a list item is named by its `name` (else its `type`) or its index (`logging.targets.studio.token`, `logging.targets.3.token`); a name that is not there is `INVALID_SET` with `details.items`. A secret a plugin declares (such as `dokebi-session.secrets`) is already written by `add`; run it after you removed one. `--rotate` replaces an existing value (AI-M05): a list (`dokebi-session.secrets`, `dokebi-csrf.secrets`, `dokebi-auth.secrets`: the first signs, all verify) gets the new secret **first** and keeps the previous ones after it, at most 2 (`kept`); older ones are dropped (`dropped`, warning `SECRETS_DROPPED` with `count`), and fewer are kept when the schema allows fewer items; when the schema takes no list with a kept one (only a new string or a one-item list), every previous secret is dropped and counted the same way. A string is replaced. The result is `secret{path, list, generated, rotated, kept, dropped}` and a next step to restart the app (`dev` restarts on its own); never a value. What a rotation changes: session cookies signed with a kept secret still verify and are re-signed with the new one as they are used (@dokebi/session); CSRF tokens of a kept secret still verify (@dokebi/csrf); auth stamps signed with a kept key still verify, and remember-me and API tokens are never re-signed, so keep the old key for their longest lifetime (@dokebi/auth AI.md §9). A dropped secret (or a replaced string) invalidates what it signed: sessions end, open forms fail once, logins end. An environment override of the option (`secretsEnv`), where it is set, still wins over dokebi.yaml |
76
76
  | `dokebi config set <id>.<path>=<value>...` | Non-secret options into dokebi.yaml (the value is JSON when it parses, otherwise text; checked against the plugin schema, only a missing required value becomes `configRequired`). A plugin id that is not installed is `UNKNOWN_PLUGIN`; any other section nothing declares is `UNDECLARED_SECTION` (D-0155: declare it with `npx dokebi settings add <name>`). `logging.<path>` sets `options.logging` (D-0151): with @dokebi/logger every key of its schema (`config set logging.level=debug logging.targets.file.enabled=true`; list items by `name`, else `type`, or index); without it only `logging.level` and `logging.plugins.<plugin>` (core's levels), anything else is `INVALID_SET` with the add command in `fix`. An old option name (D-0071 alias, `dokebi-web.bodyLimit` of `maxBodyBytes`) and its new name both set is `INVALID_PLUGIN_OPTIONS` (`details.errors[]` with `keyword: "conflict"` and the `field`; `fix`: `config unset` the old name), since the plugin refuses both at start; nothing is written. `add` and `upgrade` write no default beside a set old name for the same reason. The results of `config set`, `unset`, `secret` and `diff --write` carry `paths`: for each file it changed, the option paths it `removed`, `set` and `added` (`{ "dokebi.yaml": { removed: ["logging.redact"], set: [], added: [] } }`; a list is one path; never a value). A path outside the ones asked for (named list items count as their list) is `PATH_MISMATCH`: refused, or a warning in a `--dry-run`, which therefore shows exactly what a run would change. Spell paths as the files do (`npx dokebi config show`; the logger's are `logging.<path>`). |
77
77
  | `dokebi config unset <id>[.<path>]...` | Removes options ([D-0153](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0153-config-unset.md)) from dokebi.yaml and from dokebi.example.yaml where the sample has them, in one transaction, with the mappings left empty (the plugin section stays): `{ removed: [{ option, files }], changed, warnings?, configRequired? }`. Values are never printed. A path that is not set is the warning `OPTION_NOT_SET` (a repeated call changes nothing); a secret may be removed (warning `SECRET_REMOVED`: what it signed no longer verifies; to replace one use `config secret --rotate`). The plugin need not be installed (a section `dokebi remove` kept). `logging.<path>` removes from `options.logging`, list items by `name` (else `type`) or index (`config unset logging.targets.studio` removes that target); an item that is not there is `OPTION_NOT_SET`. The removal may only leave missing required values (`configRequired`) or issues the options already had (warning `OPTIONS_STILL_INVALID` with the next `hint`); a new issue is `INVALID_PLUGIN_OPTIONS` and nothing is written. Use it for a key a plugin does not know: `INVALID_PLUGIN_OPTIONS` (from add, config set, doctor) names `npx dokebi config unset <id>.<key>` in its `fix`, and a key that moved to another plugin (`dokebi-web.files` → `dokebi-static.mounts`, D-0147) says where it went and the commands that carry it over A section a file still holds as written is that section, never the plugin the name belongs to: in a sample with the old `options.dokebi-logger` (now `options.logging`), `config unset dokebi-logger.level` removes that old key and warns `SECTION_NOT_READ`, and the live `logging.level` stays (AI-M47 report: it removed the live one before); with no such section the plugin id is `PATH_MISMATCH` (name it `logging.<path>`). List indexes and names are of each file as it is before the call, whichever name reaches the section; one item named twice (`logging.targets.studio` and its index) is removed once. A section alone (`config unset dokebi-logger`) removes a whole section nothing reads; a plugin's, the settings' or a core section (`logging`, `reload`) that way is `INVALID_SET` |
78
78
  | `dokebi config secrets` | The secret option paths the app needs, **by name, never values** ([D-0184](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0184-production-deploy.md)): `{ file, secretsFile, listed, secrets[{path, source, listed, required, type}], missing }` from the settings the app reads (`DOKEBI_CONFIG`, else dokebi.yaml) merged with the secrets file `DOKEBI_SECRETS` names. `source` is `config`, `secrets` or `null` (not set: absent, empty or a `<placeholder>`); `listed` means the document's `secrets:` list names it (the app refuses to start without it), `required` that an installed plugin's install plan generates it (`dokebi-session.secrets`). A secret inside a list item is named by the item where the settings name it (`logging.targets.studio.token` for `logging.targets.1.token`: its `name`, else the `type` of an item without a name, when no other item shares it): the key a secrets file fills that field with, the list staying in the settings (@dokebi/config 0.4.4). `type` is the option's JSON Schema type (`string`; `array` for a list such as `dokebi-session.secrets`, `dokebi-auth.secrets`, `dokebi-csrf.secrets`, `dokebi-mail.secrets`; several as a list; `null` without a schema): a tool that writes the secrets file writes an `array` as a YAML list, even of one value (a text there is `INVALID_PLUGIN_OPTIONS`). Exit 1 with `ok: false` while `missing` is not empty. Warnings `SECRET_IN_CONFIG_FILE` (with `DOKEBI_SECRETS` set, the settings file still holds a secret) and `SECRETS_PLAN_UNREADABLE` (a plugin's install module could not run: npm install). A secrets file readable by others, the same option in both files, or a list item the settings do not have, fails as the app would (`CONFIG_SECRETS_UNSAFE`, `CONFIG_SECRETS_CONFLICT`, `CONFIG_SECRETS_UNMATCHED`) |
79
79
  | `dokebi deploy init [--target <systemd\|compose>] [--instance <name>]... [--port <n>] [--dry-run]` | **An existing project made ready for a server** (D-0184, §11): per instance (with @dokebi/web: `production` port 3000, `staging` 3001, another name needs `--port`, two instances never share a port: `PORT_IN_USE`; without it nothing listens: no port (0, `— (no web server)` in DEPLOY.md) and `--port` is `USAGE`) `deploy/<instance>/dokebi.example.yaml` (the sample without its secrets, with the instance's web host/port/trustProxy, storage folder and a `secrets:` list), `deploy/<instance>/secrets.example.yaml` (the secret paths with placeholders; a secret inside a list item is that field only, named by the item: `logging.targets.studio.token`, the list staying in the settings sample), `deploy/systemd/<app>-<instance>.service` (or `deploy/compose/<instance>.yaml` with `--target compose`, and Dockerfile/.dockerignore when missing), with @dokebi/db also `deploy/systemd/<app>-<instance>-backup.service`/`.timer`, `deploy/backup.mjs` and `deploy/restore-drill.mjs`, and `DEPLOY.md`. Result `{ app, target, instances[{instance, port, unit, settings, secrets, code, data, logs, backups, database}], secrets, changed, unchanged, kept }`. A second run changes nothing; a file you edited since is kept (`kept`, warning `DEPLOY_FILE_KEPT`); an untouched one is rewritten (DEPLOY.md gains a new instance). Errors `NOT_A_PROJECT`, `APP_NAME_INVALID` (package.json name), `EXAMPLE_MISSING`, `PORT_REQUIRED`, `PORT_IN_USE`, `OPTIONS_SCHEMA_UNREADABLE` (npm install first: without a plugin's schema its secrets cannot be told apart) |
80
- | `dokebi deploy proxy --caddy\|--nginx --domain <host>... [--instance <name>] [--dry-run]` | The reverse proxy file of an instance (D-0184): `deploy/proxy/<app>-<instance>.Caddyfile` or `.nginx.conf`, from `deploy/<instance>/dokebi.example.yaml` (port, health routes, body limit, request timeout): TLS (Caddy's automatic certificates; nginx with certbot's paths and an http → https redirect), `X-Forwarded-For/Proto/Host`, WebSocket upgrades, unbuffered SSE (the app sends `X-Accel-Buffering: no`) and a long read timeout when the app keeps streams (SSE, WebSocket, MCP), `/health/live` and `/health/ready` passed through uncached, the app's own `Cache-Control` and compression left as they are. Warnings `TRUST_PROXY_MISSING` (the sample's `dokebi-web.trustProxy` lacks 127.0.0.1 or ::1) and `DOMAIN_NOT_MAPPED` (a domain not in `dokebi-app.domains`). Errors `WEB_NOT_INSTALLED`, `INSTANCE_UNKNOWN` (deploy init first) |
80
+ | `dokebi deploy proxy --caddy\|--nginx --domain <host>... [--instance <name>] [--dry-run]` | The reverse proxy file of an instance (D-0184): `deploy/proxy/<app>-<instance>.Caddyfile` or `.nginx.conf`, from `deploy/<instance>/dokebi.example.yaml` (port, health routes, body limit, request timeout): TLS (Caddy's automatic certificates; nginx with certbot's paths and an http → https redirect), `X-Forwarded-For/Proto/Host`, WebSocket upgrades (nginx: other requests send no `Connection` upstream, so `keepalive 16` reuses connections, idle for at most 60 s, below the app's 72 s), unbuffered SSE (the app sends `X-Accel-Buffering: no`) and a long read timeout when the app keeps streams (SSE, WebSocket, MCP), only the listed names (nginx answers another `Host` with 421; Caddy serves only its site names), `/health/live` and `/health/ready` passed through with one `Cache-Control: no-store` (the app's own replaced), the app's own `Cache-Control` and compression left as they are. Warnings `TRUST_PROXY_MISSING` (the sample's `dokebi-web.trustProxy` lacks 127.0.0.1 or ::1) and `DOMAIN_NOT_MAPPED` (a domain not in `dokebi-app.domains`). Errors `WEB_NOT_INSTALLED`, `INSTANCE_UNKNOWN` (deploy init first) |
81
81
  | `dokebi dev-infra [up\|start\|stop\|down\|status] [--file <path>] [--db-port <n>] [--dry-run]` | Without an action: prepare compose.yaml and the database URL in dokebi.yaml; no .env is generated. With an action: run Docker Compose using the YAML password in the child environment only. Repeat --file for additional Compose files. down retains data volumes. --db-port and --dry-run apply only to preparation. On a kept compose.yaml (`COMPOSE_KEPT`, its published port is the URL's) `--db-port <n>` changes only the published host port of `services.db` in it (every other byte of the file stays) and the URL in dokebi.yaml, with the warning `COMPOSE_PORT_CHANGED` (`hint`: `dev-infra up` recreates a running container on the new port and keeps its data volume); a taken port is `PORT_IN_USE`. A port entry the CLI cannot read (a variable, a range) refuses `--db-port` with `COMPOSE_PORT_UNKNOWN` (`details.file`, `details.fix`: set the entry yourself) and nothing is written; without the flag the run keeps the URL's port and warns `COMPOSE_PORT_UNKNOWN`. A MongoDB is a single-node replica set (`rs0`, D-0103): the generated mongod gets `--replSet rs0` and a key file made inside the container at each start (mongod needs one for a replica set with authentication), the healthcheck initiates the set once and passes when the member is the writable primary (so `up` returns when transactions work), and the URL ends with `replicaSet=rs0&directConnection=true`; `service.replicaSet` says so. A kept compose.yaml whose server is standalone (written before) keeps a standalone URL and gives the warning `DEV_INFRA_STANDALONE`, whose `hint` is the switch: `dev-infra down`, move compose.yaml away, `dev-infra --db-port <its port>`, `dev-infra up` (password and data volume kept). `DEV_INFRA_CONFIG_INVALID` means the main database URL is invalid/unset; `DEV_INFRA_FAILED` means the Compose action failed. |
82
82
  | `dokebi verify [--wait-ms <n>] [--test-timeout-ms <n>]` · `verify --remote <https-url> [--timeout-ms <ms>]` | With `--remote` (D-0184) only that site is checked, nothing local runs: `{ ok, url, checks[{name, ok, warning?, status?, detail, ms}], certificate? }` with the checks `tls` (the certificate is valid for the host; under 14 days left is a warning), `redirect` (http answers a redirect to https; a warning otherwise), `live` and `ready` (the health routes of the settings when run in a project, else `/health/live` and `/health/ready`, must answer 200), `headers` (HSTS and `X-Content-Type-Options: nosniff`; on an HTML answer also `X-Frame-Options` or CSP `frame-ancestors`, and `Referrer-Policy` (a warning); `X-Powered-By` fails; HSTS under 180 days is a warning); exit 1 when a check fails. Without it: `{ ok, checks[{name, ok, skipped?, ms, code?, message?, details?}], urls[], listen[], tests?, tellUser?, relay?, finalReport?, warnings? }` (`warnings`: `ENV_DOKEBI_CONFIG_IGNORED` when `.env` sets `DOKEBI_CONFIG`, §2.2): doctor → check (`dokebi check` below, reusing the doctor result) → typecheck (skipped without the script) → build (Vite) → test (the package.json `test` script, skipped without one: `no test script`; see **Tests in verify** below) → preflight (`ALREADY_RUNNING`, `PORT_IN_USE`, `DB_URL_MISSING`; a taken web port is the user's call as in the recipe preflight: the problem has `alternative` (the first free port after it), `fix` (`npx dokebi config set dokebi-web.port=<alternative>`), `waitForUser`, `question` and `next`, and the result repeats `waitForUser`, `question` and `next`; `waitForUser` is false when the last recipe ran with `--defaults`) → start (`--wait-ms`, default 30000) → HTTP (connects to the listening address: `/health/ready`, and `GET /` with the Host header of every app domain; with neither a readiness route (`healthRoutes: false`) nor an app domain, one identity probe `GET /` that passes with any status below 500 carrying this run's header, so HTTP never passes without a request: `details.requests[].identity: true`; each request must complete within 5 s, a response cut off or never finished is `HTTP_FAILED`) → stop. `urls` are the addresses the app answers (see `start`), `listen` the bound addresses. `ok` only when everything passes (otherwise exit 1). A doctor or preflight failure skips the start; a check failure does not. It never stops an app that already runs. **HTTP counts only answers from the app verify started**: it passes a random token in `DOKEBI_VERIFY_TOKEN` and @dokebi/web echoes it in the response header `x-dokebi-verify` (only while that variable is set, no cost in production). An answer without the token comes from another server on the port: `FOREIGN_SERVER` (`details.requests[].instance: other`). When the app did not start, HTTP is skipped and fails (`NOT_STARTED`). stop ends the processes verify started by the pid start returned (no `ps` needed, works in a sandbox); `APP_EXITED` when the app ended by itself first, `STOP_FAILED` when a signal cannot be sent; a SIGINT, SIGTERM or SIGHUP to verify while its app runs stops that app first (forced after 5 s), then verify ends as the signal says (also while the start step still waits for the app: nothing it started is left running). With `ok: true` and an applied recipe (`.dokebi/recipe.json`), `tellUser: string[]` holds the lines your final message must include (each choice with who made it: `<id> = <value>: your answer`, `: chosen by the AI (you left the choice to it)` followed by `: <aiReason>` when you gave one, `: chosen by default (<reason>)`; then the notices); a notice that names the app address (the admin login) is filled in with the address the app has now (`urls`, else `dokebi-web.port`), so a later port change shows the new one; with them comes `relay: { tellUser: 'verbatim', instruction }` (AI-M05 F6): copy the lines unchanged into your final message, never translated, reworded or summarized, and add your own summary only after them; when verify also has `finalReport`, the instruction adds that the table or list a heading announces (Database practice, Silenced check rules) is written right under it in the same message — a results file or a link does not replace it; the human output ends with them under `Tell the user exactly these lines.` and the same instruction. An EJS blog without @dokebi/session gets a notice that offers it to the user (AI-M05 F3: with `--defaults` the next step says not to add it, since the defaults are the plan; with `--answers-from user` the next step says to ask first). Without a recipe record there is no `tellUser`. With `ok: true` and @dokebi/db installed, `finalReport: string[]` (D-0105 §4) says what your final message must also contain, written by you rather than copied: the table of section 6 of `node_modules/@dokebi/db/AI.md`, one row per rule with the queries or jobs it applies to, the measurement and the verdict (pass, or the fix you made) (a results file does not replace it); the human output lists it under `Your final message must also contain:`, and when there are `tellUser` lines they end with a heading for each (`Database practice (@dokebi/db AI.md section 6): the table below, here in this message, has one row per rule of that section (6.1 Cost follows the page, not the table; …), …`, naming the rules of the installed AI.md, `Silenced check rules (dokebi-check allow markers), each followed below, here in this message, by why the rule does not apply there: …`): relay them as they are and write the table or the reasons under them |
83
83
  | `dokebi mail preview <name> [--locale <locale>]` | Render preview.json without network connections or data hooks; JSON includes subject, html, text and locale |
84
84
  | `dokebi describe [--with-db] [--timeout-ms <ms>]` | What the app has, without serving (D-0077): it loads the project like `start` (the settings file — `DOKEBI_CONFIG`, else dokebi.yaml —, `src/dokebi.generated.ts`, the project's `.env` under the environment, the doctor check first: `START_CHECK_FAILED`) in core's describe mode: every plugin's setup runs, no start or ready hook, so nothing listens, no database, Redis or NATS connection is opened and no job is bound. `--json` is `{ schemaVersion: 1, app: { name, core, plugins[{name, version, described}], apps[], domains[], unknownDomain, web, session, csrf, auth, … }, routes[{method, url, id?, app?, host?, constraints?, schema?{body, querystring, params, headers, response}, config?{auth, can, roles, csrf, …}, auth?{mode, realm, via, can?}, seal?, health?}], pages[{app, engine: ejs\|inertia, template, name, file}], jobs[], schedules[], errors[{code, status, message, hint?}], config: { keys[], env[{name, plugin, purpose}] }, db: { connections[{name, adapter, startup?, dialect?, schemas?, tables?, collections?, unavailable?}], unavailable? }, unavailable[{plugin, section?, code, reason}], warnings?, ms }`, checked by the JSON Schema `describe.schema.json` of this package. `route.auth` is the login rule @dokebi/auth applies (its `default` included); `config.keys` are option paths and `config.env` variable names, **never a value**; `errors` are the codes of `src/shared/errors.ts`. A plugin whose setup fails is listed in `unavailable` (with the plugins that need it, `DEPENDENCY_UNAVAILABLE`) and the rest is still described; a database, Redis, NATS, SMTP or S3 that is not running is never the reason (D-0133: plugins on never-connected clients still set up; a nats event bus refuses only `publish`, with `DESCRIBING`), while a real configuration error (an unknown connection name, a connection of the wrong kind) still is. Without `--with-db` the tables are not read (`db.unavailable` says so; describe mode never connects). **`--with-db`** adds a separate step that connects: for each dokebi-db connection it runs the project's `dokebi-migrate schema --connection <name> --json` (@dokebi/migrate 0.4.2) and puts its `dialect` and `tables` (columns with type, nullable, default, identity, generated; primary key, unique, indexes, foreign keys, checks; `isMigrationHistory` on `dokebi_migrations`) or MongoDB `collections` into `db.connections[]`; a connection it cannot read (not listed in `options.dokebi-migrate.connections`, @dokebi/migrate missing, the database refused, `--timeout-ms` passed) gets its own `unavailable` reason and describe still answers. `startup: 'optional'` marks a connection dokebi.yaml lets the app run without ([D-0127](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0127-optional-db-startup.md); the default `required` is left out); `dokebi-migrate schema` opens it as required, so while it is down it is `unavailable` with the open or check error, and `drift` lists it in `unavailable`. No URL or password is printed. Run it before writing a migration so you change what the database really has. Errors: `DESCRIBE_TIMEOUT` (default 30000 ms), `DESCRIBE_FAILED` (the app exited first; `details.output` holds its last lines), `DESCRIBE_UNSUPPORTED` (@dokebi/core older than 0.4.2), or the app's own code (`INVALID_PLUGIN_OPTIONS`, …). Read it before you change an app you did not write |
85
85
  | `dokebi describe --openapi [--app <name>]` | OpenAPI 3.1 of the same description (D-0077 C), **one document per app** (route ids are unique per app): `info.title` the app, `servers` its domains (`http://<host>:<port>` for local hosts, `https://<host>` otherwise), `operationId` the route `config.id` (`<id>_<method>` on every operation when the id names several: a route of several methods, or the routes of one plugin route key such as `oauth.authorize_get` and `oauth.authorize_post`, D-0142), else `<method>_<path>` (`get_posts_id`), numbered `_2` on a collision. Request parameters and bodies (JSON, and form bodies with `formBody`) and responses come from the route schemas (draft-07 `items` tuples, `dependencies`, `nullable` and local `#/definitions` refs rewritten for JSON Schema 2020-12; a ref to an `addSchema` schema becomes an open schema with `x-dokebi-ref`). `components.schemas.DokebiError` is the D-0074 body; operations list 422 `VALIDATION_FAILED` (body or query schema), 400 `INVALID_REQUEST` (params or headers schema), 401 `UNAUTHENTICATED` (a login needed), 403 `FORBIDDEN` (`roles` or `can`) and 403 `CSRF_FAILED` (POST, PUT, PATCH, DELETE under @dokebi/csrf unless `config.csrf: false` or `exclude`, with the token header). Security: `cookieAuth` (the session cookie) and `bearerAuth` (`via: token` or `any`), `{}` added for `optional`; `x-dokebi-auth` keeps `{ mode, realm, via, roles?, can? }` (also `routes[].auth.roles` in `--json`). Health and Vite dev routes are left out; routes outside apps are in every app's document. The app's `defineErrors` codes are `x-dokebi-errors`. Without `--app` and with several apps: `{ apps: { <name>: document } }`; an unknown name is `UNKNOWN_APP`. Without `--json` the document is printed as JSON |
86
86
  | `dokebi drift --expected <file> [--timeout-ms <ms>]` | The databases against an expected file (D-0120): `<file>` is JSON of the describe shape, written by hand or by a design tool (only `db.connections` is read; a whole `describe --with-db --json` envelope works too). The actual side is `describe --with-db` (it connects the same way). Only what the file names is compared: each connection, its `tables` (or MongoDB `collections`) when the file lists them, a table's `columns` when it lists them, and a column's `comment` when it is a non-empty string (empty, `null` or absent means "not decided" and is not compared; whitespace runs and the ends are normalized). `--json` is `{ ok, drift[{kind, connection, target, expected_value, code_value}], unavailable[{connection, reason}], compared{connections, tables, columns, comments}, ms }`; `kind` is `connection`, `table`, `collection`, `column` or `column_comment`; `target` is the connection, `<table>` (`<schema>.<table>` outside the first PostgreSQL schema) or `<table>.<column>`; `expected_value` null = only the database has it, `code_value` null = the database has it not (for `column_comment`: no comment). `dokebi_migrations` is never compared. A connection that cannot be read is in `unavailable` and nothing is compared for it. `ok` only without drift and unavailable connections (otherwise exit 1). A comment comes from the migrations: PostgreSQL `COMMENT ON COLUMN <table>.<column> IS '<text>'` (`IS NULL` removes it), MySQL and MariaDB `COMMENT '<text>'` in the column definition (`ALTER TABLE … MODIFY` repeats the whole definition); `describe --with-db` shows it as `columns[].comment`. MongoDB has no column comments. Errors: `DRIFT_EXPECTED_INVALID` (the file cannot be read, is not JSON or not of the describe shape; `details.path`), and those of describe |
87
- | `dokebi check` | User-code conventions (D-0072). `{ ok, problems[{rule, severity?, file, line, message, fix}], allowed[{rule, file, line, reason}], files, rules, typescript, ms: { total, typescript } }` (`allowed`: every `// dokebi-check: allow <rule> <reason>` marker with a reason under `src/`, the problems silenced on purpose; the human output prints one `allowed` line each, and verify ok asks the final message to list them), exit 1 on a problem (a `severity: 'warning'` problem is reported but never fails: `ok` stays true). The human output prints `file:line rule message` and a `fix:` line per problem, then a summary (`check ok` or `check FAILED: N problems`, files, time). Rules: `empty-catch` (an empty `catch`, `.catch(() => {})`, an empty onRejected of `then`, an empty `on('error', …)`, and the same handlers when they only give back nothing: `() => undefined`, `() => null`, `() => void 0`, `{ return; }`; a fallback value such as `() => false` is not flagged), `missing-cause` (a `catch` that throws a new error and never reads the one it caught — `catch { throw new X() }`, `catch { throw fail() }` (a call that makes the error counts the same) or a named error left unused: the original message and stack are lost; fix `catch (error) { throw new X(…, { cause: error }) }`; a destructured binding counts as read, and throws inside nested functions are not the catch's; D-0118), `floating-promise` (a statement that calls something returning a Promise without await, return, `void` or `.catch`; the project's TypeScript decides the type; `test()` of node:test is exempt), `non-erasable-syntax` (enum, namespaces with values, parameter properties, decorators, `import x =`, `export =`, `<T>x`), `private-import` (a path of `@dokebi/*` outside its exports, such as `@dokebi/core/dist/…`), `missing-package` (an @dokebi package that is not installed → `add`; a feature Dokebi does not have → the absent `instead`; an unknown name), `generated-file` (doctor `MODIFIED_REGISTRATION`, `GUIDE_BLOCK_MODIFIED` and `MODIFIED_TEMPLATE` of CLI-owned files), `secret-in-config` (an option the plugin schema marks secret (`writeOnly`, such as `dokebi-session.secrets`), a plugin check `SECRET_IN_CONFIG`, or any dokebi.yaml value that is a URL with a password such as `postgres://user:password@host`, while dokebi.yaml could be committed; the value is never shown). Warning (D-0074): `inertia-form-only` — an Inertia form submit (`form.post/put/patch/delete/submit(…)` of a `useForm(…)` result, `router.post/put/patch/delete(…)`) whose options are missing or an object literal without `only`; the GET after its redirect would send every prop of the page again. Fix: `form.post(url, { only: ['<props it changes>'] })` (`errors` always comes along). It reads the text of `src/**` files that import `@inertiajs/` (the `<script>` blocks of .vue and .svelte files; comments and strings masked); calls inside a template attribute are not read, and options passed as a variable or with a spread are taken as fine. Security rules (D-0076 §6), on only when their plugin is installed: `plain-password-compare` (an error, with @dokebi/auth) — a value whose name has the word password, passwd, passphrase, pass, pw or pwd compared with `===`, `!==`, `==` or `!=` (not with `''`, `null`, `undefined`, a boolean, a number or `typeof`, and not a password with its confirmation field such as `passwordConfirm` and not two values that both come from the request input, such as `next !== body.confirmPassword` where `next` was read from `body`: a field of `body`, `query`, `params` or a form, or a local made from one; a typed value against a stored one, such as `body.password !== user.passwordHash` (a hash, a field of a user, row, account or credentials object, or a local loaded from one) stays an error), or passed to node:crypto `timingSafeEqual`, `scrypt`, `pbkdf2`, `argon2`, the `update()` of `createHash`/`createHmac`, or a `bcrypt`/`argon2` package; fix: `request.auth.attempt` and `passwords.verify`/`passwords.hash`. `form-without-csrf` (a warning, with @dokebi/csrf) — an EJS `<form method="post">` (any case) without `csrf.field` (also `csrf?.field`) or a `_csrf` field up to its `</form>` (a multipart form may carry `?_csrf=` in its action); fix: `<%- data.csrf.field %>`; EJS is read as text, so a form split over includes is not seen as one. `csrf-exempt-unverified` (a warning, with @dokebi/csrf) — a route `config: { csrf: false }` whose registration call (and its handler functions named in the same file) shows no `rawBody`, signature check (`signature`, `createHmac`, `timingSafeEqual`, `.verify(`), `seal` or @dokebi/auth token refresh (`tokens.refresh(`), and whose `config` has no `oauth` and no `auth: { via: 'token' }` (Bearer only; `via: 'any'` or `'session'` does not count); fix: send the token, or verify the sender. `unknown-error-code` (a warning, [D-0077](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0077-app-self-description.md) D, only when `src/shared/errors.ts` exports a `defineErrors({ … })` result written as an object literal) — app code under `src/apps/` or `src/shared/modules/` that writes an error code as a string: `new DokebiError('CODE', …)`, `Object.assign(new Error(…), { code: 'CODE' })`, `throw { code: 'CODE' }` or `.send({ error: 'CODE' })`. A code missing from the list is unknown (fix: add it to the list and throw `errors.CODE()`), a listed one is written by hand (fix: `throw errors.CODE()`, with the import path from that file). The codes of web, auth and csrf answers (`VALIDATION_FAILED`, `NOT_FOUND`, `INVALID_REQUEST`, `INTERNAL_SERVER_ERROR`, `UNAUTHENTICATED`, `FORBIDDEN`, `CSRF_FAILED`) are fine. The list is read from the file's syntax tree, never by running it; a spread or a computed key turns the rule off. Background work ([D-0103](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0105-check-background-timers-and-structure.md) §1): `background-timer` (an error) — server code under `src/` (not `views/` or `public/`; tests are not read) that runs periodic work on its own timer instead of @dokebi/scheduler and @dokebi/job: any `setInterval` (global, `node:timers`, or the async iterator of `node:timers/promises`), and a `setTimeout` or `setImmediate` whose callback comes back to a function around the call through the functions and methods of the same file (`const tick = () => { …; setTimeout(tick, ms) }`, `#schedule() { setTimeout(() => this.#tick()) }` with `#tick` calling `#schedule`). Fine: one-shot delays and time limits (`setTimeout(() => controller.abort(), ms)`, `new Promise((resolve) => setTimeout(resolve, ms))`), awaited sleeps of `node:timers/promises` (`await setTimeout(ms, undefined, { signal })` between bounded batches of a job handler), and timers inside a function that takes a `request`, `req`, `reply`, `res`, `response`, `socket`, `ws`, `websocket` or `stream` parameter or is passed to a route method (`get`, `post`, …, `route`), unless the timer is stored where it outlives that function: `this.ticker = setInterval(…)` (also `??=`, `||=`) or a variable declared outside it is reported (one worker-wide timer the first request starts). Fix: a job handler registered in the setup of the module that owns the work (`queue(<queue>).handle(<type>, …)`) and an entry of `options.dokebi-scheduler.schedules`. Structure warnings (D-0103 §2–§3): `responsibility-size` — a model (`…/models/…`) with at least 400 code lines (blank and comment-only lines do not count) over at least 8 tables or collections (names after FROM, JOIN, INTO and UPDATE in SQL text, CTE names and upsert columns excluded; Mongo `.collection('x')` and a local helper that wraps it; Kysely `selectFrom`/`insertInto`/`updateTable`/`deleteFrom`), a controller with at least 20 route handlers (public methods and function-valued fields) or 300 code lines, and a service class with at least 5 methods that only pass their parameters on to one call on a field (`return this.model.list(user, filter)`) when they are at least 60% of its methods; files whose first lines say `@generated`, `generated by` or `do not edit` are not read. `memory-filtered-page` — in a model or service, rows an awaited query returned that are skipped by comparing a field of the row with an input of the function and then cut to a page (`for (const row of rows) { if (row.status !== filter.status) continue; …; if (page.length === size) break; }`, or `rows.filter((row) => row.org === input.org).slice(…)`); fix: the filter in the query's WHERE with an index that ends in the sort key, and LIMIT the page size + 1. A search that checks its other terms on a capped candidate set (@dokebi/db AI.md 6.10) compares no input and is not matched; the rule sees only these two shapes, so a clean result does not prove the lists are paged in the database. Dev files ([D-0129](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0129-inertia-dev-file-policy.md)): `vite-dev-files` (a warning, in a project with an Inertia app or @dokebi/template-inertia) — the `vite.config.*` does not use `dokebiInertia()` (a plain `vite` then serves the whole project root: dokebi.yaml, .env, the server code), sets `server.fs.strict: false`, sets `server.fs.deny` (a list of its own replaces Vite's defaults where the framework's policy does not run), or an `allow` list names the project root or server code (`'.'`, `'src'`, `'tests'`, `'scripts'`, `'tools'`, `process.cwd()`, `__dirname`, `searchForWorkspaceRoot(…)`); fix: keep `dokebiInertia()` and drop `server.fs`, add browser folders with `dokebiInertia({ allow: [...] })` and entries with `dokebiInertia({ deny: [...] })`. @dokebi/template-inertia enforces the policy anyway (strict on, its deny entries kept); `formatter-migrations` (a warning, D-0145, when the migrations folder `<dokebi-migrate directory>/migrations` exists) — a code formatter of the project would format it: prettier (a config, a `prettier` key or dependency in package.json) without the folder in `.prettierignore`, biome without `!<folder>` in `files.includes` (biome 1: the folder in `files.ignore`), ESLint with formatting rules (eslint-plugin-prettier, `@stylistic`) whose config does not name it; an applied migration must keep its contents (a reformat is warned as `MIGRATE_REFORMATTED` by @dokebi/migrate, an edit refused); fix: the ignore entry the problem names (`npx dokebi add` writes it for prettier and biome); the rule says that the config asks for less. `formatter-generated` (a warning, R1 measurement) — the same formatters would format `src/dokebi.generated.ts`, which the CLI writes and compares with its record: a reformatted copy is doctor `MODIFIED_REGISTRATION` and add, upgrade and remove refuse to run; fix: `src/dokebi.generated.ts` in `.prettierignore`, `"!src/dokebi.generated.ts"` in biome `files.includes` (`npx dokebi add` writes both). `asset-in-views` (a warning, R1 measurement) — a browser file (a style sheet, an image, a font) in the views of an EJS app (`src/apps/<app>/views/`; an Inertia app with `views/app.js` is not read): move it to `src/apps/<app>/public/` and link `/assets/<path>`, which @dokebi/app serves through @dokebi/static. `asset-route` (a warning, R6 measurement) — a GET or HEAD route of server code for a browser file (`.css`, an image, a font): its path is a fixed file name (`/site.css`), or ends in such an extension and its handler reads a file itself (`createReadStream`, `readFile`, `readFileSync`); such a route sends the file without the validator, 304 and Range of `public/`; fix: put the file in `src/apps/<app>/public/` (a file a package ships, such as a font of @dokebi/font-noto-kr, is copied there with its licence file) and link `/assets/<path>`; a file the route makes per request takes `// dokebi-check: allow asset-route <reason>`. `seal-head-copied` (a warning, R7 measurement; only with @dokebi/app) — a file under `src/` (`.ts`, `.js`, `.mjs`, `.ejs`, `.html`; not in a comment) that loads `/dokebi/seal/forms.mjs` itself, a copied seal `<script>` or import map: write `<%- data.seal?.head ?? '' %>` in the layout of an app page, and for a page rendered outside an app route (an oauth consent page) take `context.getDependency(apps).seal(request).head` (`AppGroupApi` of @dokebi/app ^0.4.5, empty on a plain host); a page that is no app page takes `// dokebi-check: allow seal-head-copied <reason>`. `i18n-missing-key` (a warning, community request A2; only with @dokebi/i18n and `src/shared/locales/`) — a fixed translation key a page or server code asks for (`t('ns.a.b')`, `$t(…)`, `request.i18n.t(…)` in `.vue`, `.ts`, `.js`, `.ejs` under `src/`; the first part a namespace of the catalogs) that the catalogs of the default locale (`dokebi-i18n.defaultLocale` of dokebi.yaml, `en`) lack — the end of every fallback chain, so @dokebi/i18n throws `MISSING_MESSAGE` for it (everywhere but under `npx dokebi dev`) in each locale without it; a key only the default locale has falls back and is not reported; keys built at run time, keys with an explicit default (`t('k', 'Text')`) and lines in a comment are not read, and a catalog that is not JSON is reported; fix: add the key to `src/shared/locales/<default locale>/<namespace>.json`; a key another catalog provides takes `// dokebi-check: allow i18n-missing-key <reason>`. With catalog layers (D-0181) code under `src/apps/<app>/` is checked against that app's layer, the modules and the shared catalogs, other code against the modules and the shared ones. `i18n-layer-override` (a warning) — one key in one language in two layers: an app's `src/apps/<app>/locales/` over a module's `src/shared/modules/<module>/locales/` or the shared `src/shared/locales/`, a module's over the shared ones, or two modules (the first by name wins, always reported); fix: list an intended override in the overriding file's top-level `"$overrides": ["key", …]` (keys inside the namespace), otherwise rename the key or remove it from one layer; a listed key that overrides nothing is reported too. `i18n-layer-missing` (a warning) — a layer gives keys in one language and lacks them in another language of the project, one problem per layer, language and namespace; fix: add them to that file or remove them from the layer's other languages. `shared-state-memory` (an error, [D-0161](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0161-shared-state-redis.md)) — `options.application-runtime.workers` above 1 while an installed plugin keeps the state its workers share in process memory: the dokebi-session store, dokebi-auth `tokens` or `throttle.store`, the dokebi-oauth store, the dokebi-rate-limit driver (`local`), dokebi-seal `nonces` that are not shared, or a dokebi-websocket-hub not in `mode: cluster`; the plugins refuse to start that way in a cluster worker and in production. Fix: `{ driver: redis, connection: <the project's dokebi-redis connection> }` for each (`npx dokebi add @dokebi/redis` first when there is none); the problem's line is that option in dokebi.yaml. `console-output` (a warning, D-0151) — server code under `src/` (not `views/` or `public/`) that calls `console.log`, `console.info`, `console.warn`, `console.error`, `console.debug`, `console.trace`, `process.stdout.write` or `process.stderr.write`: those lines skip the logger level, the redaction and the targets (the rotated files, the JSON lines `dokebi logs` reads); fix: `context.logger.log(level, 'Fixed message', { code, … })` in a plugin or module hook, `app.logger` in `src/main.ts`. A command line tool of the project that prints its results takes `// dokebi-check: allow console-output <reason>` before its first statement (it covers the whole file), or on or above one line. The framework's own sources pass the same rule as the `check:console` gate. `polling-loop` (an error no marker silences, AI-M35) — a loop that sleeps inside a task started in the background (an immediately invoked async function, or a function the file calls without awaiting or returning it), such as `(async () => { while (!stopped) { await step(); await sleep(ms); } })()` in a module's `start`: move it to an @dokebi/outbox handler (one coalesced item per owner and window) or a @dokebi/job handler with a schedule; per-process upkeep uses a timer (`background-timer` with a marker), never a sleeping loop. A `setInterval` or self-rescheduling timer whose callback reaches database work (a `query`, `execute` or `transaction` call, or a call on a model, repository, pool, client, transaction or outbox object, through the functions of the same file) is reported as `polling-loop` too, marker or not. `in-process-queue` (a warning, AI-M35) — the resolve of a `new Promise` stored in a collection (`.push`, `.unshift`, `.set`, `.add`), directly or through a variable that holds it (`const pending = { input, resolve }`), to be called later: callers wait in a queue of one worker without a bound or deadline; send the work at once and let the pool's `waitTimeoutMs` bound the wait (503 with Retry-After). `wait-count-refusal` (a warning, @dokebi/db AI.md 1.2 and 6.4) — server code under `src/` that compares how many callers wait for a pool connection with a number (pg `pool.waitingCount`, mariadb `pool.taskQueueSize()`, MongoDB `waitQueueSize`, mysql2 `pool._connectionQueue.length`): the count of waiters is not overload, so refusing on it refuses work the database can still do; fix: bound the wait by its deadline (`waitTimeoutMs`, then 503 with Retry-After) and shed a tenant by time, not by waiters; a metric or log line that only reports the number takes `// dokebi-check: allow wait-count-refusal <reason>`. `private-pool` (an error, AI-M37) — server code under `src/` outside `src/infra/db/` that makes a database pool or client with the driver itself (`new Pool`/`new Client` of `pg`, `createPool`/`createConnection`/`createPoolCluster` of `mysql2` and `mariadb`, `new MongoClient` of `mongodb`): it escapes dokebi.yaml (its size and `waitTimeoutMs`, past which the caller gets 503 with Retry-After), the connection sum and the cleanup at stop (M37: private pools with a 30 s wait held callers for 22–51 s); fix: the configured connection (`context.getDependency(db).connection(main)`), `derive('main', { purpose, overrides: { max } })` for a pool of one kind of work, or one more connection in dokebi.yaml; a connection that must stay outside (a LISTEN client) takes `// dokebi-check: allow private-pool <reason>`. `overload-off` (an error, AI-M37) — a route `config: { overload: false }`: under a burst its callers queue behind a stalled worker instead of getting 503 `OVERLOADED` with Retry-After (@dokebi/web AI.md 2.5); fix: remove it (raise `overload.maxEventLoopDelayMs` if it refuses too early); a metrics scrape or an operator status page takes `// dokebi-check: allow overload-off <reason>`. `readiness-off` (an error, M51) — a route `config: { readiness: false }`: it is served while a required dependency is down and while the app drains, so an API route runs its handler against a missing database or Redis; fix: remove it; a metrics scrape or status page that must answer during an outage takes `// dokebi-check: allow readiness-off <reason>`. `fixed-owner-cap` (a warning, AI-M37) — a per-owner count of requests in progress (a Map entry that goes up and down by one, read into a variable) compared with a fixed limit by an `if` that throws or returns, without a free or idle connection in the condition: it refuses work while the database is idle; fix: the owner share of @dokebi/db, `share(main).enter(owner)`, which refuses only while the pool is full (@dokebi/db AI.md 6.4, D-0156); a budget that bounds something else (the report CPU budget of db AI.md 6.9, a plan's quota) takes `// dokebi-check: allow fixed-owner-cap <reason>`. `undeclared-section` (a warning, D-0155) — a section of dokebi.yaml nothing declares (code reads `options.<name>` by hand); fix: `npx dokebi settings add <name>`. `template-fix-missing` (a warning) — doctor's `TEMPLATE_FIX_MISSING` and `RELOAD_NOT_WIRED`: a copied template file lacks a later fix, or an entry passes no `configFile`; fix: doctor's hint. `module-point-not-installed` (D-0130) — a point in `contributes` of `defineModule` imported from an `@dokebi/*` plugin package that is in node_modules but not installed in the project (`dokebi add`): nothing registers its collector, so the app drops the values (warn `POINT_NOT_COLLECTED`); fix: `npx dokebi add <package>` or remove the point (a plugin you register yourself takes the allow marker with a reason). When an empty catch, a background promise, a full-page form submit (a login) or one of the security cases is really intended, put `// dokebi-check: allow <rule> <reason>` on that line or the line above (EJS: `<%# dokebi-check: allow form-without-csrf <reason> %>` on the line above the form; only `empty-catch`, `missing-cause`, `floating-promise`, `inertia-form-only`, `unknown-error-code`, the three security rules, the two mail warnings, the three D-0103 rules, `untyped-browser-import`, `vite-dev-files`, `module-point-not-installed`, `asset-route`, `seal-head-copied`, `i18n-missing-key`, `console-output`, `wait-count-refusal`, `in-process-queue`, `fixed-owner-cap`, `private-pool` and `overload-off` — for example a per-process eviction of in-memory state that no job can reach; without a reason the marker is ignored). The sources are the program of `tsconfig.json` (generated files, `.d.ts` and node_modules excluded), read with the API of the TypeScript 7 installed in the project (`typescript/unstable/sync`). Browser code outside that program is read too (D-0120): the `<script>` and `<script setup>` blocks (`lang` ts or js) of every `.vue` file under `src/`, and the `.js`/`.mjs` files under a `views/` folder (files above 1 MiB are skipped). They get `empty-catch`, `missing-cause` and `floating-promise` only, typed by a second program that extends `tsconfig.json` but resolves imports as the bundler does (`moduleResolution: bundler`, `module: esnext`, the DOM in `lib`; relative imports resolve from the file's folder). An import whose bound names all have no type (the module did not resolve) is the warning `untyped-browser-import` on its line, since floating-promise cannot judge what comes from it; an import of a `.vue`, style, image or JSON file and `import type` are not judged; a module that really has no types takes `// dokebi-check: allow untyped-browser-import <reason>`, and the problems name the `.vue` or `.js` file and its line; the markers work the same inside a script block. A browser promise left floating is an unhandled rejection the page never handles: `await` it, or end it with `.catch(error => …)` that shows or reports the error. When it cannot be loaded `TYPESCRIPT_UNAVAILABLE` (`npm install`), when tsconfig cannot be opened `TSCONFIG_INVALID` |
87
+ | `dokebi check` | User-code conventions (D-0072). `{ ok, problems[{rule, severity?, file, line, message, fix}], allowed[{rule, file, line, reason}], files, rules, typescript, ms: { total, typescript } }` (`allowed`: every `// dokebi-check: allow <rule> <reason>` marker with a reason under `src/`, the problems silenced on purpose; the human output prints one `allowed` line each, and verify ok asks the final message to list them), exit 1 on a problem (a `severity: 'warning'` problem is reported but never fails: `ok` stays true). The human output prints `file:line rule message` and a `fix:` line per problem, then a summary (`check ok` or `check FAILED: N problems`, files, time). Rules: `empty-catch` (an empty `catch`, `.catch(() => {})`, an empty onRejected of `then`, an empty `on('error', …)`, and the same handlers when they only give back nothing: `() => undefined`, `() => null`, `() => void 0`, `{ return; }`; a fallback value such as `() => false` is not flagged), `missing-cause` (a `catch` that throws a new error and never reads the one it caught — `catch { throw new X() }`, `catch { throw fail() }` (a call that makes the error counts the same) or a named error left unused: the original message and stack are lost; fix `catch (error) { throw new X(…, { cause: error }) }`; a destructured binding counts as read, and throws inside nested functions are not the catch's; D-0118), `floating-promise` (a statement that calls something returning a Promise without await, return, `void` or `.catch`; the project's TypeScript decides the type; `test()` of node:test is exempt), `non-erasable-syntax` (enum, namespaces with values, parameter properties, decorators, `import x =`, `export =`, `<T>x`), `private-import` (a path of `@dokebi/*` outside its exports, such as `@dokebi/core/dist/…`), `missing-package` (an @dokebi package that is not installed → `add`; a feature Dokebi does not have → the absent `instead`; an unknown name), `generated-file` (doctor `MODIFIED_REGISTRATION`, `GUIDE_BLOCK_MODIFIED` and `MODIFIED_TEMPLATE` of CLI-owned files), `secret-in-config` (an option the plugin schema marks secret (`writeOnly`, such as `dokebi-session.secrets`), a plugin check `SECRET_IN_CONFIG`, or any dokebi.yaml value that is a URL with a password such as `postgres://user:password@host`, while dokebi.yaml could be committed; the value is never shown). Warning (D-0074): `inertia-form-only` — an Inertia form submit (`form.post/put/patch/delete/submit(…)` of a `useForm(…)` result, `router.post/put/patch/delete(…)`) whose options are missing or an object literal without `only`; the GET after its redirect would send every prop of the page again. Fix: `form.post(url, { only: ['<props it changes>'] })` (`errors` always comes along). It reads the text of `src/**` files that import `@inertiajs/` (the `<script>` blocks of .vue and .svelte files; comments and strings masked); calls inside a template attribute are not read, and options passed as a variable or with a spread are taken as fine. Security rules (D-0076 §6), on only when their plugin is installed: `plain-password-compare` (an error, with @dokebi/auth) — a value whose name has the word password, passwd, passphrase, pass, pw or pwd compared with `===`, `!==`, `==` or `!=` (not with `''`, `null`, `undefined`, a boolean, a number or `typeof`, and not a password with its confirmation field such as `passwordConfirm` and not two values that both come from the request input, such as `next !== body.confirmPassword` where `next` was read from `body`: a field of `body`, `query`, `params` or a form, or a local made from one; a typed value against a stored one, such as `body.password !== user.passwordHash` (a hash, a field of a user, row, account or credentials object, or a local loaded from one) stays an error), or passed to node:crypto `timingSafeEqual`, `scrypt`, `pbkdf2`, `argon2`, the `update()` of `createHash`/`createHmac`, or a `bcrypt`/`argon2` package; fix: `request.auth.attempt` and `passwords.verify`/`passwords.hash`. `form-without-csrf` (a warning, with @dokebi/csrf) — an EJS `<form method="post">` (any case) without `csrf.field` (also `csrf?.field`) or a `_csrf` field up to its `</form>` (a multipart form may carry `?_csrf=` in its action); fix: `<%- data.csrf.field %>`; EJS is read as text, so a form split over includes is not seen as one. `csrf-exempt-unverified` (a warning, with @dokebi/csrf) — a route `config: { csrf: false }` whose registration call (and its handler functions named in the same file) shows no `rawBody`, signature check (`signature`, `createHmac`, `timingSafeEqual`, `.verify(`), `seal` or @dokebi/auth token refresh (`tokens.refresh(`), and whose `config` has no `oauth` and no `auth: { via: 'token' }` (Bearer only; `via: 'any'` or `'session'` does not count); fix: send the token, or verify the sender. `unknown-error-code` (a warning, [D-0077](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0077-app-self-description.md) D, only when `src/shared/errors.ts` exports a `defineErrors({ … })` result written as an object literal) — app code under `src/apps/` or `src/shared/modules/` that writes an error code as a string: `new DokebiError('CODE', …)`, `Object.assign(new Error(…), { code: 'CODE' })`, `throw { code: 'CODE' }` or `.send({ error: 'CODE' })`. A code missing from the list is unknown (fix: add it to the list and throw `errors.CODE()`), a listed one is written by hand (fix: `throw errors.CODE()`, with the import path from that file). The codes of web, auth and csrf answers (`VALIDATION_FAILED`, `NOT_FOUND`, `INVALID_REQUEST`, `INTERNAL_SERVER_ERROR`, `UNAUTHENTICATED`, `FORBIDDEN`, `CSRF_FAILED`) are fine. The list is read from the file's syntax tree, never by running it; a spread or a computed key turns the rule off. Background work ([D-0103](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0105-check-background-timers-and-structure.md) §1): `background-timer` (an error) — server code under `src/` (not `views/` or `public/`; tests are not read) that runs periodic work on its own timer instead of @dokebi/scheduler and @dokebi/job: any `setInterval` (global, `node:timers`, or the async iterator of `node:timers/promises`), and a `setTimeout` or `setImmediate` whose callback comes back to a function around the call through the functions and methods of the same file (`const tick = () => { …; setTimeout(tick, ms) }`, `#schedule() { setTimeout(() => this.#tick()) }` with `#tick` calling `#schedule`). Fine: one-shot delays and time limits (`setTimeout(() => controller.abort(), ms)`, `new Promise((resolve) => setTimeout(resolve, ms))`), awaited sleeps of `node:timers/promises` (`await setTimeout(ms, undefined, { signal })` between bounded batches of a job handler), and timers inside a function that takes a `request`, `req`, `reply`, `res`, `response`, `socket`, `ws`, `websocket` or `stream` parameter or is passed to a route method (`get`, `post`, …, `route`), unless the timer is stored where it outlives that function: `this.ticker = setInterval(…)` (also `??=`, `||=`) or a variable declared outside it is reported (one worker-wide timer the first request starts). Fix: a job handler registered in the setup of the module that owns the work (`queue(<queue>).handle(<type>, …)`) and an entry of `options.dokebi-scheduler.schedules`. Structure warnings (D-0103 §2–§3): `responsibility-size` — a model (`…/models/…`) with at least 400 code lines (blank and comment-only lines do not count) over at least 8 tables or collections (names after FROM, JOIN, INTO and UPDATE in SQL text, CTE names and upsert columns excluded; Mongo `.collection('x')` and a local helper that wraps it; Kysely `selectFrom`/`insertInto`/`updateTable`/`deleteFrom`), a controller with at least 20 route handlers (public methods and function-valued fields) or 300 code lines, and a service class with at least 5 methods that only pass their parameters on to one call on a field (`return this.model.list(user, filter)`) when they are at least 60% of its methods; files whose first lines say `@generated`, `generated by` or `do not edit` are not read. `memory-filtered-page` — in a model or service, rows an awaited query returned that are skipped by comparing a field of the row with an input of the function and then cut to a page (`for (const row of rows) { if (row.status !== filter.status) continue; …; if (page.length === size) break; }`, or `rows.filter((row) => row.org === input.org).slice(…)`); fix: the filter in the query's WHERE with an index that ends in the sort key, and LIMIT the page size + 1. A search that checks its other terms on a capped candidate set (@dokebi/db AI.md 6.10) compares no input and is not matched; the rule sees only these two shapes, so a clean result does not prove the lists are paged in the database. Dev files ([D-0129](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0129-inertia-dev-file-policy.md)): `vite-dev-files` (a warning, in a project with an Inertia app or @dokebi/template-inertia) — the `vite.config.*` does not use `dokebiInertia()` (a plain `vite` then serves the whole project root: dokebi.yaml, .env, the server code), sets `server.fs.strict: false`, sets `server.fs.deny` (a list of its own replaces Vite's defaults where the framework's policy does not run), or an `allow` list names the project root or server code (`'.'`, `'src'`, `'tests'`, `'scripts'`, `'tools'`, `process.cwd()`, `__dirname`, `searchForWorkspaceRoot(…)`); fix: keep `dokebiInertia()` and drop `server.fs`, add browser folders with `dokebiInertia({ allow: [...] })` and entries with `dokebiInertia({ deny: [...] })`. @dokebi/template-inertia enforces the policy anyway (strict on, its deny entries kept); `formatter-migrations` (a warning, D-0145, when the migrations folder `<dokebi-migrate directory>/migrations` exists) — a code formatter of the project would format it: prettier (a config, a `prettier` key or dependency in package.json) without the folder in `.prettierignore`, biome without `!<folder>` in `files.includes` (biome 1: the folder in `files.ignore`), ESLint with formatting rules (eslint-plugin-prettier, `@stylistic`) whose config does not name it; an applied migration must keep its contents (a reformat is warned as `MIGRATE_REFORMATTED` by @dokebi/migrate, an edit refused); fix: the ignore entry the problem names (`npx dokebi add` writes it for prettier and biome); the rule says that the config asks for less. `formatter-generated` (a warning, R1 measurement) — the same formatters would format `src/dokebi.generated.ts`, which the CLI writes and compares with its record: a reformatted copy is doctor `MODIFIED_REGISTRATION` and add, upgrade and remove refuse to run; fix: `src/dokebi.generated.ts` in `.prettierignore`, `"!src/dokebi.generated.ts"` in biome `files.includes` (`npx dokebi add` writes both). `asset-in-views` (a warning, R1 measurement) — a browser file (a style sheet, an image, a font) in the views of an EJS app (`src/apps/<app>/views/`; an Inertia app with `views/app.js` is not read): move it to `src/apps/<app>/public/` and link `/assets/<path>`, which @dokebi/app serves through @dokebi/static. `asset-route` (a warning, R6 measurement) — a GET or HEAD route of server code (a `get` or `head` call with a path and a handler; a lookup by one key such as `manifest.get('main.css')` is none) for a browser file (`.css`, an image, a font): its path is a fixed file name (`/site.css`), or ends in such an extension and its handler reads a file itself (`createReadStream`, `readFile`, `readFileSync`); such a route sends the file without the validator, 304 and Range of `public/`; fix: put the file in `src/apps/<app>/public/` (a file a package ships, such as a font of @dokebi/font-noto-kr, is copied there with its licence file) and link `/assets/<path>`; a file the route makes per request takes `// dokebi-check: allow asset-route <reason>`. `seal-head-copied` (a warning, R7 measurement; only with @dokebi/app) — a file under `src/` (`.ts`, `.js`, `.mjs`, `.ejs`, `.html`; not in a comment) that loads `/dokebi/seal/forms.mjs` itself, a copied seal `<script>` or import map: write `<%- data.seal?.head ?? '' %>` in the layout of an app page, and for a page rendered outside an app route (an oauth consent page) take `context.getDependency(apps).seal(request).head` (`AppGroupApi` of @dokebi/app ^0.4.5, empty on a plain host); a page that is no app page takes `// dokebi-check: allow seal-head-copied <reason>`. `i18n-missing-key` (a warning, community request A2; only with @dokebi/i18n and `src/shared/locales/`) — a fixed translation key a page or server code asks for (`t('ns.a.b')`, `$t(…)`, `request.i18n.t(…)` in `.vue`, `.ts`, `.js`, `.ejs` under `src/`; the first part a namespace of the catalogs) that the catalogs of the default locale (`dokebi-i18n.defaultLocale` of dokebi.yaml, `en`) lack — the end of every fallback chain, so @dokebi/i18n throws `MISSING_MESSAGE` for it (everywhere but under `npx dokebi dev`) in each locale without it; a key only the default locale has falls back and is not reported; keys built at run time, keys with an explicit default (`t('k', 'Text')`) and lines in a comment are not read; locale folders and the default locale are read as @dokebi/i18n reads them (`Intl.Locale(name).baseName`: a folder `en-us` is the locale `en-US`), and a catalog that is not JSON or a folder that is no locale (or a second folder of one locale) is reported; fix: add the key to `src/shared/locales/<default locale>/<namespace>.json`; a key another catalog provides takes `// dokebi-check: allow i18n-missing-key <reason>`. With catalog layers (D-0181) code under `src/apps/<app>/` is checked against that app's layer, the modules and the shared catalogs, other code against the modules and the shared ones. `i18n-layer-override` (a warning) — one key in one language in two layers: an app's `src/apps/<app>/locales/` over a module's `src/shared/modules/<module>/locales/` or the shared `src/shared/locales/`, a module's over the shared ones, or two modules (the first by name wins, always reported); fix: list an intended override in the overriding file's top-level `"$overrides": ["key", …]` (keys inside the namespace), otherwise rename the key or remove it from one layer; a listed key that overrides nothing is reported too. `i18n-layer-missing` (a warning) — a layer gives keys in one language and lacks them in another language of the project, one problem per layer, language and namespace; fix: add them to that file or remove them from the layer's other languages. `shared-state-memory` (an error, [D-0161](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0161-shared-state-redis.md)) — `options.application-runtime.workers` above 1 while an installed plugin keeps the state its workers share in process memory: the dokebi-session store, dokebi-auth `tokens` or `throttle.store`, the dokebi-oauth store, the dokebi-rate-limit driver (`local`), dokebi-seal `nonces` that are not shared, or a dokebi-websocket-hub not in `mode: cluster`; the plugins refuse to start that way in a cluster worker and in production. Fix: `{ driver: redis, connection: <the project's dokebi-redis connection> }` for each (`npx dokebi add @dokebi/redis` first when there is none); the problem's line is that option in dokebi.yaml. `console-output` (a warning, D-0151) — server code under `src/` (not `views/` or `public/`) that calls `console.log`, `console.info`, `console.warn`, `console.error`, `console.debug`, `console.trace`, `process.stdout.write` or `process.stderr.write`: those lines skip the logger level, the redaction and the targets (the rotated files, the JSON lines `dokebi logs` reads); fix: `context.logger.log(level, 'Fixed message', { code, … })` in a plugin or module hook, `app.logger` in `src/main.ts`. A command line tool of the project that prints its results takes `// dokebi-check: allow console-output <reason>` before its first statement (it covers the whole file), or on or above one line. The framework's own sources pass the same rule as the `check:console` gate. `polling-loop` (an error no marker silences, AI-M35) — a loop that sleeps inside a task started in the background (an immediately invoked async function, or a function the file calls without awaiting or returning it), such as `(async () => { while (!stopped) { await step(); await sleep(ms); } })()` in a module's `start`: move it to an @dokebi/outbox handler (one coalesced item per owner and window) or a @dokebi/job handler with a schedule; per-process upkeep uses a timer (`background-timer` with a marker), never a sleeping loop. A `setInterval` or self-rescheduling timer whose callback reaches database work (a `query`, `execute` or `transaction` call, or a call on a model, repository, pool, client, transaction or outbox object, through the functions of the same file) is reported as `polling-loop` too, marker or not. `in-process-queue` (a warning, AI-M35) — the resolve of a `new Promise` stored in a collection (`.push`, `.unshift`, `.set`, `.add`), directly or through a variable that holds it (`const pending = { input, resolve }`), to be called later: callers wait in a queue of one worker without a bound or deadline; send the work at once and let the pool's `waitTimeoutMs` bound the wait (503 with Retry-After). `wait-count-refusal` (a warning, @dokebi/db AI.md 1.2 and 6.4) — server code under `src/` that compares how many callers wait for a pool connection with a number (pg `pool.waitingCount`, mariadb `pool.taskQueueSize()`, MongoDB `waitQueueSize`, mysql2 `pool._connectionQueue.length`): the count of waiters is not overload, so refusing on it refuses work the database can still do; fix: bound the wait by its deadline (`waitTimeoutMs`, then 503 with Retry-After) and shed a tenant by time, not by waiters; a metric or log line that only reports the number takes `// dokebi-check: allow wait-count-refusal <reason>`. `private-pool` (an error, AI-M37) — server code under `src/` outside `src/infra/db/` that makes a database pool or client with the driver itself (`new Pool`/`new Client` of `pg`, `createPool`/`createConnection`/`createPoolCluster` of `mysql2` and `mariadb`, `new MongoClient` of `mongodb`): it escapes dokebi.yaml (its size and `waitTimeoutMs`, past which the caller gets 503 with Retry-After), the connection sum and the cleanup at stop (M37: private pools with a 30 s wait held callers for 22–51 s); fix: the configured connection (`context.getDependency(db).connection(main)`), `derive('main', { purpose, overrides: { max } })` for a pool of one kind of work, or one more connection in dokebi.yaml; a connection that must stay outside (a LISTEN client) takes `// dokebi-check: allow private-pool <reason>`. `overload-off` (an error, AI-M37) — a route `config: { overload: false }`: under a burst its callers queue behind a stalled worker instead of getting 503 `OVERLOADED` with Retry-After (@dokebi/web AI.md 2.5); fix: remove it (raise `overload.maxEventLoopDelayMs` if it refuses too early); a metrics scrape or an operator status page takes `// dokebi-check: allow overload-off <reason>`. `readiness-off` (an error, M51) — a route `config: { readiness: false }`: it is served while a required dependency is down and while the app drains, so an API route runs its handler against a missing database or Redis; fix: remove it; a metrics scrape or status page that must answer during an outage takes `// dokebi-check: allow readiness-off <reason>`. `fixed-owner-cap` (a warning, AI-M37) — a per-owner count of requests in progress (a Map entry that goes up and down by one, read into a variable) compared with a fixed limit by an `if` that throws or returns, without a free or idle connection in the condition: it refuses work while the database is idle; fix: the owner share of @dokebi/db, `share(main).enter(owner)`, which refuses only while the pool is full (@dokebi/db AI.md 6.4, D-0156); a budget that bounds something else (the report CPU budget of db AI.md 6.9, a plan's quota) takes `// dokebi-check: allow fixed-owner-cap <reason>`. `undeclared-section` (a warning, D-0155) — a section of dokebi.yaml nothing declares (code reads `options.<name>` by hand); fix: `npx dokebi settings add <name>`. `template-fix-missing` (a warning) — doctor's `TEMPLATE_FIX_MISSING` and `RELOAD_NOT_WIRED`: a copied template file lacks a later fix, or an entry passes no `configFile`; fix: doctor's hint. `module-point-not-installed` (D-0130) — a point in `contributes` of `defineModule` imported from an `@dokebi/*` plugin package that is in node_modules but not installed in the project (`dokebi add`): nothing registers its collector, so the app drops the values (warn `POINT_NOT_COLLECTED`); fix: `npx dokebi add <package>` or remove the point (a plugin you register yourself takes the allow marker with a reason). When an empty catch, a background promise, a full-page form submit (a login) or one of the security cases is really intended, put `// dokebi-check: allow <rule> <reason>` on that line or the line above (EJS: `<%# dokebi-check: allow form-without-csrf <reason> %>` on the line above the form; only `empty-catch`, `missing-cause`, `floating-promise`, `inertia-form-only`, `unknown-error-code`, the three security rules, the two mail warnings, the three D-0103 rules, `untyped-browser-import`, `vite-dev-files`, `module-point-not-installed`, `asset-route`, `seal-head-copied`, `i18n-missing-key`, `console-output`, `wait-count-refusal`, `in-process-queue`, `fixed-owner-cap`, `private-pool` and `overload-off` — for example a per-process eviction of in-memory state that no job can reach; without a reason the marker is ignored). The sources are the program of `tsconfig.json` (generated files, `.d.ts` and node_modules excluded), read with the API of the TypeScript 7 installed in the project (`typescript/unstable/sync`). Browser code outside that program is read too (D-0120): the `<script>` and `<script setup>` blocks (`lang` ts or js) of every `.vue` file under `src/`, and the `.js`/`.mjs` files under a `views/` folder (files above 1 MiB are skipped). They get `empty-catch`, `missing-cause` and `floating-promise` only, typed by a second program that extends `tsconfig.json` but resolves imports as the bundler does (`moduleResolution: bundler`, `module: esnext`, the DOM in `lib`; relative imports resolve from the file's folder). An import whose bound names all have no type (the module did not resolve) is the warning `untyped-browser-import` on its line, since floating-promise cannot judge what comes from it; an import of a `.vue`, style, image or JSON file and `import type` are not judged; a module that really has no types takes `// dokebi-check: allow untyped-browser-import <reason>`, and the problems name the `.vue` or `.js` file and its line; the markers work the same inside a script block. A browser promise left floating is an unhandled rejection the page never handles: `await` it, or end it with `.catch(error => …)` that shows or reports the error. When it cannot be loaded `TYPESCRIPT_UNAVAILABLE` (`npm install`), when tsconfig cannot be opened `TSCONFIG_INVALID` |
88
88
  | `dokebi upgrade <plugin id> [--to <version\|package\|tgz>] [--dry-run]` | Change the version. Do not use remove and add instead. Without `--to` it picks the highest version that fits the core and the installed packages, as `add` does (`NEWER_VERSION_HELD_BACK` names a newer one and what it waits for; the same version again changes nothing); an unreachable registry or a workspace package takes npm's `latest`. The copies of templates the project owns (the @dokebi/db adapters, `vite.config.ts` and `vite.ssr.config.ts`) are never rewritten: fixes of the new templates they lack are the warnings `TEMPLATE_FIX_MISSING` (`path`, `plugin`, `hint`: the change to make), as doctor reports them. With the same version and a changed manifest it applies the manifest again (D-0037, `reason: MANIFEST_CHANGED`); with the same version and manifest but other package content (an unpublished version rebuilt, given as `--to <tgz>`; the package-lock integrity differs) it installs the new code (`reason: PACKAGE_CHANGED`) — the way to replace a local snapshot. After package.json moved several plugins at once, upgrade them one by one, dependencies first: each result lists the ones still to do as `MANIFEST_CHANGED` warnings with their `hint`. A required plugin the new version needs and the project lacks is installed with it, as `add` would (`autoInstalled`, D-0116), when its manifest names the package and it needs no choice or settings; otherwise nothing is written and it is `MISSING_DEPENDENCY` (`mutation: none`) whose `details.fix` is the command to run first (`npx dokebi add <package>`, then the same upgrade again) |
89
89
  | `dokebi remove <plugin id> [--dry-run]` | Remove a plugin. `REVERSE_DEPENDENCY` when a remaining plugin depends on it, `REQUIRED_PLUGIN` for a required part. An id that is not installed is no change; the package name of an installed plugin is `UNKNOWN_PLUGIN` (`details.fix`: `npx dokebi remove <id>`) |
90
90
  | `dokebi migrate [--dry-run]` | Move a 0.1.x project with JSON settings to YAML |
@@ -245,7 +245,7 @@ Every command also works in an npm workspace member folder. Packages are found t
245
245
  - The dokebi.yaml and dokebi.example.yaml that `init` writes have `options.logging: { level: info }` and a commented `plugins` example. `options.logging` is the log setting core reads, and the options of @dokebi/logger (its targets) when it is installed; adding the logger writes its `targets` into both files (an older project whose sample lacks them: `npx dokebi config diff --write`). Existing projects are not changed automatically: `npx dokebi config set logging.level=info` adds it (`logging.plugins.<plugin>=<level>` a plugin level), with or without the logger.
246
246
  - At run time `DOKEBI_LOG_LEVEL` wins over the YAML (`DOKEBI_LOG_LEVEL=debug npx dokebi dev`).
247
247
  - With `DOKEBI_LOG_LEVEL=debug` the CLI itself writes its decisions about npm runs, install modules, transaction rollbacks and start/stop to stderr, one JSON line each. Errors it recovers from (an unreadable pid file, a workspace package.json and the like) are written to stderr as one `level: error` line (`code`, `error`) at any level. stdout (the `--json` envelope) does not change.
248
- - Warnings: `COMPOSE_VARIABLES_UNSET` (doctor and `dev-infra`: compose.yaml needs variables without a default that `dev-infra up` does not set — it passes the passwords of dokebi.yaml (`DOKEBI_DB_PASSWORD`, and for every connection `DOKEBI_<PLUGIN>_<CONNECTION>_PASSWORD` or `_TOKEN`, without the connection for `main`: `DOKEBI_REDIS_PASSWORD`; D-0165) and Compose reads `.env` — so `dev-infra up` would fail; `details.variables`, `hint`: give each a default `${NAME:-value}` or set it in `.env`; the `dev-infra up` next step says so first), `COMPOSE_PUBLISHES_APP_PORT` (doctor: a compose.yaml service publishes the port of `options.dokebi-web.port`, so `dev-infra up` starts it and `start`, `dev` and `verify` find the port taken; `details.services`, `details.port`; compose.yaml is the development infrastructure — a container of the app goes in its own Compose file such as `compose.deploy.yaml`), `COMPOSE_BUILDS_APP` (doctor: a compose.yaml service is built from the project folder — `build: .`, or `build:` with `context: .` or none — so it is the app itself, also when its port is a variable the port rule cannot read: `dev-infra up` builds and starts it with the infrastructure; `details.services`, `details.variables` (the unset variables only those services use); the same fix: its own Compose file), `ENV_DOKEBI_CONFIG_IGNORED` (a `.env` line sets `DOKEBI_CONFIG`, which the app does not get from `.env`; `path` `.env:<line>`, §2.2), `LOGGER_NOT_INSTALLED` (D-0151: init could not add @dokebi/logger; `hint` names the error code, `nextSteps` the command), `LOGGER_MAIN_MANUAL` (D-0151: `add @dokebi/logger` found a `src/main.ts` of your own without `createLogger(`; `hint` is the line to write: `new Application({ config: document.options, logger: createLogger(document.options) })` with `createLogger` from `./dokebi.generated.ts`; an unchanged generated one is rewritten), `OPTION_NOT_SET`, `SECTION_NOT_READ` (config unset: the typed section is an old one a file still holds, removed as written; the plugin reads another section such as `options.logging`), `SECRET_REMOVED`, `OPTIONS_STILL_INVALID` (`config unset`, D-0153), `BUILD_SCRIPT_KEPT`, `TYPECHECK_SCRIPT_KEPT` (`app add --inertia` kept a `typecheck` script of the project's own: add the Vue check, `node typecheck-vue.mjs -p tsconfig.vue.json`, to it), `VITE_PLUGIN_MISSING` (an Inertia app added to a project whose own vite config lacks `dokebiInertia()`), `INERTIA_PLUGIN_MISSING`, `SEAL_PLUGIN_MISSING`, `FORMATTER_FORMATS_MIGRATIONS` (D-0145: a formatter `add` cannot configure would format the migrations folder, a biome.jsonc with comments or an ESLint config with formatting rules; `path` the config, `hint` the entry to add — `add` itself writes a CLI-owned entry into `.prettierignore` and `!<folder>` into a plain biome.json `files.includes`, in the shape biome prints), `FORMATTER_FORMATS_GENERATED` (the same for `src/dokebi.generated.ts`, which `add` keeps out of prettier and plain biome.json too), `VIEW_SOURCE_UNSTATED` (D-0098: an EJS app, from `app add` or the first app of `add @dokebi/app`, without `--answers-from user` or `--ai-chose view`), `EXAMPLE_MISSING`, `EXAMPLE_INVALID`, `THIRD_PARTY_PACKAGE`, `CATALOG_OFFLINE`, `DEPRECATED_VERSION`, `GUIDE_BLOCK_MISSING` (also a doctor warning), `GUIDE_PROJECT_BLOCK_INVALID` (also a doctor warning: AGENTS.md was left as it is), `ADAPTER_FILE_KEPT`, `CONNECTIONS_KEPT`, `CONNECTION_KEPT`, `COMPOSE_KEPT`, `COMPOSE_PORT_CHANGED`, `COMPOSE_PORT_UNKNOWN`, `URL_REPLACED`, `SECRET_KEPT`.
248
+ - Warnings: `COMPOSE_VARIABLES_UNSET` (doctor and `dev-infra`: compose.yaml needs variables without a default that `dev-infra up` does not set — it passes the passwords of dokebi.yaml (`DOKEBI_DB_PASSWORD`, and for every connection `DOKEBI_<PLUGIN>_<CONNECTION>_PASSWORD` or `_TOKEN`, without the connection for `main`: `DOKEBI_REDIS_PASSWORD`; D-0165) and Compose reads `.env` — `${NAME:?…}` makes `dev-infra up` fail, and a bare `${NAME}` becomes an empty value with only a Compose warning, which breaks a port or a password; a variable in a YAML comment is not counted; `details.variables`, `hint`: give each a default `${NAME:-value}` or set it in `.env`; the `dev-infra up` next step says so first), `COMPOSE_PUBLISHES_APP_PORT` (doctor: a compose.yaml service publishes the port of `options.dokebi-web.port`, so `dev-infra up` starts it and `start`, `dev` and `verify` find the port taken; `details.services`, `details.port`; compose.yaml is the development infrastructure — a container of the app goes in its own Compose file such as `compose.deploy.yaml`), `COMPOSE_BUILDS_APP` (doctor: a compose.yaml service is built from the project folder — `build: .`, or `build:` with `context: .` or none — so it is the app itself, also when its port is a variable the port rule cannot read: `dev-infra up` builds and starts it with the infrastructure; `details.services`, `details.variables` (the unset variables only those services use); the same fix: its own Compose file), `ENV_DOKEBI_CONFIG_IGNORED` (a `.env` line sets `DOKEBI_CONFIG`, which the app does not get from `.env`; `path` `.env:<line>`, §2.2), `LOGGER_NOT_INSTALLED` (D-0151: init could not add @dokebi/logger; `hint` names the error code, `nextSteps` the command), `LOGGER_MAIN_MANUAL` (D-0151: `add @dokebi/logger` found a `src/main.ts` of your own without `createLogger(`; `hint` is the line to write: `new Application({ config: document.options, logger: createLogger(document.options) })` with `createLogger` from `./dokebi.generated.ts`; an unchanged generated one is rewritten), `OPTION_NOT_SET`, `SECTION_NOT_READ` (config unset: the typed section is an old one a file still holds, removed as written; the plugin reads another section such as `options.logging`), `SECRET_REMOVED`, `OPTIONS_STILL_INVALID` (`config unset`, D-0153), `BUILD_SCRIPT_KEPT`, `TYPECHECK_SCRIPT_KEPT` (`app add --inertia` kept a `typecheck` script of the project's own: add the Vue check, `node typecheck-vue.mjs -p tsconfig.vue.json`, to it), `VITE_PLUGIN_MISSING` (an Inertia app added to a project whose own vite config lacks `dokebiInertia()`), `INERTIA_PLUGIN_MISSING`, `SEAL_PLUGIN_MISSING`, `FORMATTER_FORMATS_MIGRATIONS` (D-0145: a formatter `add` cannot configure would format the migrations folder, a biome.jsonc with comments or an ESLint config with formatting rules; `path` the config, `hint` the entry to add — `add` itself writes a CLI-owned entry into `.prettierignore` and `!<folder>` into a plain biome.json `files.includes`, in the shape biome prints), `FORMATTER_FORMATS_GENERATED` (the same for `src/dokebi.generated.ts`, which `add` keeps out of prettier and plain biome.json too), `VIEW_SOURCE_UNSTATED` (D-0098: an EJS app, from `app add` or the first app of `add @dokebi/app`, without `--answers-from user` or `--ai-chose view`), `EXAMPLE_MISSING`, `EXAMPLE_INVALID`, `THIRD_PARTY_PACKAGE`, `CATALOG_OFFLINE`, `DEPRECATED_VERSION`, `GUIDE_BLOCK_MISSING` (also a doctor warning), `GUIDE_PROJECT_BLOCK_INVALID` (also a doctor warning: AGENTS.md was left as it is), `ADAPTER_FILE_KEPT`, `CONNECTIONS_KEPT`, `CONNECTION_KEPT`, `COMPOSE_KEPT`, `COMPOSE_PORT_CHANGED`, `COMPOSE_PORT_UNKNOWN`, `URL_REPLACED`, `SECRET_KEPT`.
249
249
 
250
250
  ### Start screen (logo)
251
251
 
@@ -291,7 +291,7 @@ One server, several instances (a staging and a production one), installed from t
291
291
  4. Before a start, on the server: `NODE_ENV=production DOKEBI_CONFIG=… DOKEBI_SECRETS=… npx -y @dokebi/cli doctor --production --json`.
292
292
  5. A release, in DEPLOY.md's order: a new release folder (`npm ci`, `npm run build --if-present`, `npm prune --omit=dev`) → `npx dokebi-migrate up --phase pre-deploy --json` (exit 0, else stop; `LOCK_TIMEOUT`: another run holds the lock) → switch `current` and restart → `npx -y @dokebi/cli verify --remote https://<domain> --json` → `npx dokebi-migrate up --json` (post-deploy). Rollback: `current` back to the previous release; the pre-deploy migrations only added, so the database stays.
293
293
  6. `npx dokebi deploy proxy --caddy --domain <host> --instance <name>` (or `--nginx`) for the reverse proxy.
294
- 7. Backups (@dokebi/db): the timer runs `node deploy/backup.mjs` daily (`pg_dump -Fc` or `mongodump --archive --gzip` of every postgres or mongodb connection, mode 0600, the newest of 7 days, 4 weeks and 6 months kept, passwords only in the environment or a 0600 file, one JSON line); `node deploy/restore-drill.mjs` with `DOKEBI_RESTORE_URL` (a scratch database) proves the newest backup restores, monthly. Copy the backups off the server. MySQL and MariaDB: `mysqldump --single-transaction` from your scheduler (not scripted).
294
+ 7. Backups (@dokebi/db): the timer runs `node deploy/backup.mjs` daily (`pg_dump -Fc` or `mongodump --archive --gzip` of every postgres or mongodb connection, mode 0600, the newest of 7 days, 4 weeks and 6 months kept, passwords only in the environment or a 0600 file, one JSON line); `node deploy/restore-drill.mjs` with `DOKEBI_RESTORE_URL` (a new, empty scratch database: the live database, by any spelling of its URL, and a database that holds a table or collection are refused) proves the newest backup restores, monthly. Copy the backups off the server. MySQL and MariaDB: `mysqldump --single-transaction` from your scheduler (not scripted).
295
295
 
296
296
  `examples/77-production-deploy` runs all of it on one machine (the app in production behind TLS, nginx and Caddy checking the generated files, a backup and a restore drill on PostgreSQL).
297
297
 
package/catalog.json CHANGED
@@ -1,16 +1,32 @@
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.29",
4
+ "cli": "0.4.31",
5
5
  "core": {
6
6
  "package": "@dokebi/core",
7
- "version": "0.4.5"
7
+ "version": "0.4.6"
8
8
  },
9
9
  "capabilities": {
10
10
  "admin.ui": {
11
11
  "summary": "generated admin screens (CRUD generator)",
12
12
  "en": "admin dashboard crud backoffice"
13
13
  },
14
+ "ai.anthropic": {
15
+ "summary": "Claude models through the official Anthropic SDK (@anthropic-ai/sdk)",
16
+ "en": "anthropic claude opus sonnet haiku"
17
+ },
18
+ "ai.gemini": {
19
+ "summary": "Google Gemini models through the official Google Gen AI SDK (@google/genai, Gemini Developer API)",
20
+ "en": "google gemini genai"
21
+ },
22
+ "ai.models": {
23
+ "summary": "one API for Claude (Anthropic), ChatGPT (OpenAI) and Gemini (Google) over their official SDKs: generate, stream, tool calls and a tool loop, structured output, image input, embeddings and token usage with named connections and coded errors",
24
+ "en": "ai llm large language model chatbot chat completion prompt generate stream tools function calling json schema embeddings vectors usage tokens"
25
+ },
26
+ "ai.openai": {
27
+ "summary": "OpenAI models through the official OpenAI SDK (openai, Responses API)",
28
+ "en": "openai chatgpt gpt responses"
29
+ },
14
30
  "auth": {
15
31
  "summary": "session login, route protection and permissions on your own user table (authentication and authorization)",
16
32
  "en": "auth authentication authorization login logout user password session signin"
@@ -337,6 +353,84 @@
337
353
  }
338
354
  },
339
355
  "packages": [
356
+ {
357
+ "id": "dokebi-ai",
358
+ "package": "@dokebi/ai",
359
+ "version": "0.1.0",
360
+ "kind": "plugin",
361
+ "summary": "One API for Claude, ChatGPT and Gemini over their official SDKs: generate, stream, tool calls and a tool loop, structured output, image input, embeddings and token usage, with named connections and coded errors",
362
+ "description": "One API for Claude (Anthropic), ChatGPT (OpenAI) and Gemini (Google) over their official SDKs: named connections in dokebi.yaml, text generation, streaming, tool calls and a tool loop, structured output, image input, embeddings, token usage, and coded errors.",
363
+ "keywords": [
364
+ "dokebi",
365
+ "dokebi-plugin",
366
+ "ai",
367
+ "llm",
368
+ "anthropic",
369
+ "claude",
370
+ "openai",
371
+ "chatgpt",
372
+ "gemini"
373
+ ],
374
+ "maturity": "experimental",
375
+ "core": "^0.4.2",
376
+ "provides": [
377
+ "ai.anthropic",
378
+ "ai.gemini",
379
+ "ai.models",
380
+ "ai.openai"
381
+ ],
382
+ "variants": [
383
+ {
384
+ "name": "anthropic",
385
+ "capability": "ai.anthropic",
386
+ "adapter": "anthropic",
387
+ "driver": {
388
+ "package": "@anthropic-ai/sdk",
389
+ "version": "1.5.0"
390
+ }
391
+ },
392
+ {
393
+ "name": "openai",
394
+ "capability": "ai.openai",
395
+ "adapter": "openai",
396
+ "driver": {
397
+ "package": "openai",
398
+ "version": "7.51.0"
399
+ }
400
+ },
401
+ {
402
+ "name": "gemini",
403
+ "capability": "ai.gemini",
404
+ "adapter": "gemini",
405
+ "driver": {
406
+ "package": "@google/genai",
407
+ "version": "2.32.0"
408
+ }
409
+ }
410
+ ],
411
+ "doesNot": [
412
+ "Installs no SDK by itself: npx dokebi add @dokebi/ai --adapter anthropic|openai|gemini installs the one you choose",
413
+ "No common temperature, top-p or stop sequences (not every provider has them): pass them in providerOptions",
414
+ "No embeddings on Anthropic connections (the Anthropic API has none): AI_NOT_SUPPORTED",
415
+ "No image URLs, audio, files, prompt caching or thinking settings in the common request: providerOptions or raw() reach them",
416
+ "No routes and no chat storage: the app keeps the conversation and decides who may call a model"
417
+ ],
418
+ "recipes": [],
419
+ "requires": [],
420
+ "optional": [],
421
+ "optionKeys": [
422
+ "connections",
423
+ "default",
424
+ "maxEmbedInputs",
425
+ "maxImageBytes",
426
+ "maxSteps"
427
+ ],
428
+ "docs": {
429
+ "ai": "AI.md",
430
+ "readme": "README.md"
431
+ },
432
+ "install": "npx dokebi add @dokebi/ai"
433
+ },
340
434
  {
341
435
  "id": "dokebi-app",
342
436
  "package": "@dokebi/app",
@@ -415,7 +509,7 @@
415
509
  {
416
510
  "id": "dokebi-audit",
417
511
  "package": "@dokebi/audit",
418
- "version": "0.1.0",
512
+ "version": "0.1.1",
419
513
  "kind": "plugin",
420
514
  "summary": "Audit and activity logs in your database: written in the change's transaction, a declared code tree, the actor from auth or an OAuth grant (AI clients by name), masking before the write, indexed keyset lists, retention",
421
515
  "description": "Audit and activity logs for Dokebi: rows written in the change's transaction, a declared code tree, the actor from auth or an OAuth grant, masking before the write, indexed keyset lists and retention.",
@@ -578,7 +672,7 @@
578
672
  {
579
673
  "id": "dokebi-bulk-send",
580
674
  "package": "@dokebi/bulk-send",
581
- "version": "0.1.0",
675
+ "version": "0.1.1",
582
676
  "kind": "plugin",
583
677
  "summary": "Bulk sends over @dokebi/outbox: a send row, recipient rows per person and channel fixed when it goes (excluded and failed with reasons), channels and audiences your app registers (mail through @dokebi/mail, an inbox of your own), scheduling and cancel, progress per channel, stop, and failed deliveries sent again",
584
678
  "description": "Bulk sends for Dokebi over @dokebi/outbox: recipient rows fixed when a send goes, channels and audiences your app registers, scheduling and cancel, progress per channel, stop, and failures sent again.",
@@ -713,7 +807,7 @@
713
807
  {
714
808
  "id": null,
715
809
  "package": "@dokebi/cli",
716
- "version": "0.4.29",
810
+ "version": "0.4.31",
717
811
  "kind": "cli",
718
812
  "summary": "Commands to create a project, browse the plugin catalog, run recipes, install plugins and verify (dokebi)",
719
813
  "description": "Project scaffolding, plugin catalog, recipes, install and verification CLI for Dokebi.",
@@ -751,7 +845,7 @@
751
845
  {
752
846
  "id": null,
753
847
  "package": "@dokebi/cluster",
754
- "version": "0.4.1",
848
+ "version": "0.4.2",
755
849
  "kind": "library",
756
850
  "summary": "Runner that starts several app workers from a node:cluster parent process, watches them and replaces them one by one",
757
851
  "description": "node:cluster runner for Dokebi: starts, watches and rolls independent application workers.",
@@ -785,7 +879,7 @@
785
879
  {
786
880
  "id": "dokebi-config",
787
881
  "package": "@dokebi/config",
788
- "version": "0.4.4",
882
+ "version": "0.4.5",
789
883
  "kind": "required",
790
884
  "summary": "Required part of the core that reads and validates dokebi.yaml into read-only settings per app (installed automatically)",
791
885
  "description": "Validated immutable YAML configuration for Dokebi applications.",
@@ -860,7 +954,7 @@
860
954
  {
861
955
  "id": null,
862
956
  "package": "@dokebi/core",
863
- "version": "0.4.5",
957
+ "version": "0.4.6",
864
958
  "kind": "core",
865
959
  "summary": "Application core: settings loading, plugin registration, lifecycle, logger and shared libraries (required)",
866
960
  "description": "Minimal composable Node.js application and plugin lifecycle framework.",
@@ -1007,7 +1101,7 @@
1007
1101
  {
1008
1102
  "id": "dokebi-db",
1009
1103
  "package": "@dokebi/db",
1010
- "version": "0.4.1",
1104
+ "version": "0.4.2",
1011
1105
  "kind": "plugin",
1012
1106
  "summary": "Named database connections (pools) with readiness checks and shutdown; you use the driver API as it is",
1013
1107
  "description": "Named database connections for Dokebi: create, readiness check and close pools of pg, mysql2, mariadb or mongodb.",
@@ -1265,7 +1359,7 @@
1265
1359
  {
1266
1360
  "id": "dokebi-files",
1267
1361
  "package": "@dokebi/files",
1268
- "version": "0.1.0",
1362
+ "version": "0.1.1",
1269
1363
  "kind": "plugin",
1270
1364
  "summary": "A record of every stored file: uploads recorded without an owner, claimed by a feature in its transaction, removals whose bytes go after the commit through @dokebi/outbox, unowned files swept after a grace, read rules per owner type in front of downloads and thumbnails, lists by owner, kind and time",
1271
1365
  "description": "A record of every stored file for Dokebi: owners claimed in the caller's transaction, removals whose bytes are deleted after the commit (@dokebi/outbox), a sweep of unowned files after a grace, read rules per owner type, uploads, downloads and thumbnails behind them.",
@@ -1461,7 +1555,7 @@
1461
1555
  {
1462
1556
  "id": "dokebi-i18n",
1463
1557
  "package": "@dokebi/i18n",
1464
- "version": "0.2.0",
1558
+ "version": "0.2.1",
1465
1559
  "kind": "plugin",
1466
1560
  "summary": "Compiled translations, locale negotiation, cardinal plurals and named number/date formats",
1467
1561
  "description": "Compiled translation catalogs, locale negotiation, cardinal plurals and named Intl formats.",
@@ -1517,7 +1611,7 @@
1517
1611
  {
1518
1612
  "id": "dokebi-image",
1519
1613
  "package": "@dokebi/image",
1520
- "version": "0.1.0",
1614
+ "version": "0.1.1",
1521
1615
  "kind": "plugin",
1522
1616
  "summary": "Server-side WebP thumbnails of stored png, jpeg, gif, webp and avif images, made once and deleted with their source",
1523
1617
  "description": "Bounded server-side WebP thumbnails of stored images, made once and deleted with their source.",
@@ -1585,7 +1679,7 @@
1585
1679
  {
1586
1680
  "id": "dokebi-job",
1587
1681
  "package": "@dokebi/job",
1588
- "version": "0.4.3",
1682
+ "version": "0.4.4",
1589
1683
  "kind": "plugin",
1590
1684
  "summary": "NATS JetStream job queue (at least once, retries, DLQ)",
1591
1685
  "description": "Bounded durable jobs over the Dokebi NATS provider: retries, delayed redelivery and a dead-letter stream.",
@@ -1974,7 +2068,7 @@
1974
2068
  {
1975
2069
  "id": "dokebi-migrate",
1976
2070
  "package": "@dokebi/migrate",
1977
- "version": "0.4.3",
2071
+ "version": "0.4.4",
1978
2072
  "kind": "plugin",
1979
2073
  "summary": "Migration and seed runner for dokebi-db connections (dokebi-migrate up in the deploy step)",
1980
2074
  "description": "Migrations and seeds for dokebi-db connections: history and lock for PostgreSQL, MySQL, MariaDB and MongoDB, run from the deployment.",
@@ -2417,7 +2511,7 @@
2417
2511
  {
2418
2512
  "id": "dokebi-permissions",
2419
2513
  "package": "@dokebi/permissions",
2420
- "version": "0.1.0",
2514
+ "version": "0.1.1",
2421
2515
  "kind": "plugin",
2422
2516
  "summary": "Roles, grades and scoped permissions: keys declared in code, grants saved in your database in the caller's transaction, can(actor, key, target) from memory over the holding tree (all, subtree, direct, own), list conditions as SQL, every worker refreshed by a revision; plugs into @dokebi/auth's authorize",
2423
2517
  "description": "Roles, grades and scoped permissions for Dokebi: permissions declared in code, grants saved in your database in the caller's transaction, checks from memory over the holding tree (all, subtree, direct, own), list conditions as SQL, every worker refreshed by a revision.",
@@ -2556,7 +2650,7 @@
2556
2650
  {
2557
2651
  "id": null,
2558
2652
  "package": "@dokebi/rich-text",
2559
- "version": "0.1.0",
2653
+ "version": "0.1.1",
2560
2654
  "kind": "library",
2561
2655
  "summary": "Editor documents (Tiptap or ProseMirror JSON) checked whole against a declared schema of nodes, marks, links and image sources, with coded 422 errors, then safe HTML, plain text and excerpts",
2562
2656
  "description": "Rich text documents for Dokebi: editor JSON (Tiptap, ProseMirror) checked whole against a declared schema with coded 422 errors, then safe HTML, plain text and excerpts.",
@@ -2592,7 +2686,7 @@
2592
2686
  {
2593
2687
  "id": "dokebi-rollups",
2594
2688
  "package": "@dokebi/rollups",
2595
- "version": "0.1.0",
2689
+ "version": "0.1.1",
2596
2690
  "kind": "plugin",
2597
2691
  "summary": "Report roll-ups by @dokebi/db AI.md 6.9: facts recorded as small rows in the caller's transaction (no hot row), folded in parallel by outbox lanes into UTC hour rows and day and month rows per whole-hour time zone (rebuilt from the hours when a zone is added), bounded reads with an as-of time, running totals and a report budget (429, 503)",
2598
2692
  "description": "Report roll-ups for Dokebi by @dokebi/db AI.md 6.9: facts recorded as small rows in the caller's transaction, folded by outbox lanes into UTC hour rows and day and month rows per time zone, bounded reads with an as-of time and a report budget.",
@@ -2686,7 +2780,7 @@
2686
2780
  {
2687
2781
  "id": "dokebi-runtime-settings",
2688
2782
  "package": "@dokebi/runtime-settings",
2689
- "version": "0.1.0",
2783
+ "version": "0.1.1",
2690
2784
  "kind": "plugin",
2691
2785
  "summary": "Settings operators change while the app runs: definitions in code (a group tree, text, number, numbers per choice, boolean, select, multiselect, json and file with rules, choices from your data), common and personal values saved in your database in the caller's transaction (the changes answered for the audit log), common values read from memory, every worker refreshed by a revision",
2692
2786
  "description": "Settings operators change while the app runs, for Dokebi: definitions in code (a group tree, nine types with rules, choices from your data), common and personal values in your database saved in the caller's transaction, common values read from memory, every worker refreshed by a revision.",
@@ -2835,7 +2929,7 @@
2835
2929
  {
2836
2930
  "id": "dokebi-search",
2837
2931
  "package": "@dokebi/search",
2838
- "version": "0.1.0",
2932
+ "version": "0.1.1",
2839
2933
  "kind": "plugin",
2840
2934
  "summary": "Search in your lists that stays bounded on a growing table: a term table in display order written in the text's transaction, Korean word prefixes, the rarest word leads, capped requests and searches with a signed cursor; answers item ids",
2841
2935
  "description": "Search in an application's lists for Dokebi by @dokebi/db AI.md 6.10: a term table in display order written in the text's transaction, Korean word prefixes, the rarest word leads, bounded requests and searches with a signed cursor.",
@@ -2888,7 +2982,7 @@
2888
2982
  {
2889
2983
  "id": "dokebi-session",
2890
2984
  "package": "@dokebi/session",
2891
- "version": "0.4.5",
2985
+ "version": "0.4.6",
2892
2986
  "kind": "plugin",
2893
2987
  "summary": "Server-side sessions for @dokebi/web (signed cookie, memory or redis store, flash)",
2894
2988
  "description": "Server-side sessions for @dokebi/web: signed cookie, memory or Redis store, flash.",
@@ -2960,7 +3054,7 @@
2960
3054
  {
2961
3055
  "id": "dokebi-sse",
2962
3056
  "package": "@dokebi/sse",
2963
- "version": "0.4.3",
3057
+ "version": "0.4.4",
2964
3058
  "kind": "plugin",
2965
3059
  "summary": "Server-sent events (SSE) streams and rooms, delivery across workers, and a browser client",
2966
3060
  "description": "Server-sent events for @dokebi/web: authenticated streams, rooms, cross-worker fan-out over @dokebi/event-bus, and a browser client",
@@ -3172,7 +3266,7 @@
3172
3266
  {
3173
3267
  "id": "dokebi-template-inertia",
3174
3268
  "package": "@dokebi/template-inertia",
3175
- "version": "0.4.4",
3269
+ "version": "0.4.5",
3176
3270
  "kind": "plugin",
3177
3271
  "summary": "Inertia (v3) server adapter: Vue 3 views, Vite build files and optional server-side rendering (SSR)",
3178
3272
  "description": "Inertia v3 server adapter for Dokebi: page JSON, Vite manifest assets and optional server-side rendering.",
@@ -3266,7 +3360,7 @@
3266
3360
  {
3267
3361
  "id": "dokebi-tree",
3268
3362
  "package": "@dokebi/tree",
3269
- "version": "0.1.0",
3363
+ "version": "0.1.1",
3270
3364
  "kind": "plugin",
3271
3365
  "summary": "Trees in your own tables (categories, a members' holding tree): materialized paths kept on place and move, a subtree moved in one UPDATE in the caller's transaction and never under itself, sibling order with the parent locked, ancestors, subtree SQL conditions, and keyset pages in tree order that keep their parent context",
3272
3366
  "description": "Trees in your own tables for Dokebi: materialized paths, places and subtree moves in the caller's transaction (never under itself), sibling order, ancestors, subtree conditions, and pages in tree order that keep their parent context.",
@@ -3322,7 +3416,7 @@
3322
3416
  {
3323
3417
  "id": "dokebi-two-factor",
3324
3418
  "package": "@dokebi/two-factor",
3325
- "version": "0.1.0",
3419
+ "version": "0.1.1",
3326
3420
  "kind": "plugin",
3327
3421
  "summary": "Two-factor sign-in for @dokebi/auth: TOTP codes of authenticator apps (secrets encrypted at rest, a code good once), ten recovery codes kept as HMACs, a second step after the password, remembered devices, lockout after wrong codes, and a code confirmation for the re-authentication page",
3328
3422
  "description": "Two-factor sign-in for @dokebi/auth: TOTP codes of authenticator apps (secrets encrypted at rest), recovery codes stored as HMACs, a second step after the password, remembered devices, lockout, and a code confirmation for re-authentication.",
@@ -3386,7 +3480,7 @@
3386
3480
  {
3387
3481
  "id": "dokebi-web",
3388
3482
  "package": "@dokebi/web",
3389
- "version": "0.4.3",
3483
+ "version": "0.4.4",
3390
3484
  "kind": "plugin",
3391
3485
  "summary": "Fastify 5 HTTP server (503 before ready, health paths, drain, zero-downtime cluster replacement, security headers and overload protection on by default)",
3392
3486
  "description": "Fastify 5 HTTP server owned by a Dokebi app: 503 before ready, health routes, drain and cluster handover.",
@@ -146,7 +146,10 @@ export function assetRouteRules(file, kinds, report) {
146
146
  const visit = (node) => {
147
147
  if (node.kind === kinds.CallExpression &&
148
148
  field(node, 'expression')?.kind === kinds.PropertyAccessExpression &&
149
- /^(?:get|head)$/.test(called(node) ?? '')) {
149
+ /^(?:get|head)$/.test(called(node) ?? '') &&
150
+ // A route takes a path and a handler; a lookup by one key (`manifest.get('src/main.css')`,
151
+ // a Map, FormData or Headers) is no route (audit R8-g5b-4).
152
+ nodes(node, 'arguments').length >= 2) {
150
153
  const path = nodes(node, 'arguments')[0];
151
154
  const last = tail(path);
152
155
  if (path && last && ASSET.test(last)) {