@dokebi/cli 0.4.1 → 0.4.26
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 +262 -57
- package/README.md +35 -10
- package/catalog.json +2519 -257
- package/describe.schema.json +748 -0
- package/dist/api-app.d.ts +2 -0
- package/dist/api-app.js +35 -0
- package/dist/app-urls.js +3 -2
- package/dist/bin.js +527 -35
- package/dist/capability-guide.d.ts +30 -0
- package/dist/capability-guide.js +122 -0
- package/dist/catalog.d.ts +16 -2
- package/dist/catalog.js +19 -7
- package/dist/check/asset-rules.d.ts +6 -0
- package/dist/check/asset-rules.js +163 -0
- package/dist/check/browser-sources.d.ts +20 -0
- package/dist/check/browser-sources.js +89 -0
- package/dist/check/console-rules.d.ts +6 -0
- package/dist/check/console-rules.js +40 -0
- package/dist/check/error-rules.d.ts +21 -0
- package/dist/check/error-rules.js +212 -0
- package/dist/check/form-rules.d.ts +12 -0
- package/dist/check/form-rules.js +69 -6
- package/dist/check/formatter-rules.d.ts +2 -0
- package/dist/check/formatter-rules.js +71 -0
- package/dist/check/i18n-rules.d.ts +27 -0
- package/dist/check/i18n-rules.js +353 -0
- package/dist/check/index.d.ts +15 -1
- package/dist/check/index.js +89 -11
- package/dist/check/mail-rules.d.ts +4 -0
- package/dist/check/mail-rules.js +72 -0
- package/dist/check/module-rules.d.ts +13 -0
- package/dist/check/module-rules.js +104 -0
- package/dist/check/packages.d.ts +8 -0
- package/dist/check/packages.js +16 -0
- package/dist/check/pool-rules.d.ts +8 -0
- package/dist/check/pool-rules.js +164 -0
- package/dist/check/problems.d.ts +6 -1
- package/dist/check/problems.js +100 -2
- package/dist/check/project-rules.d.ts +23 -3
- package/dist/check/project-rules.js +265 -23
- package/dist/check/seal-rules.d.ts +6 -0
- package/dist/check/seal-rules.js +68 -0
- package/dist/check/security-rules.d.ts +10 -0
- package/dist/check/security-rules.js +450 -0
- package/dist/check/shared-state-rules.d.ts +2 -0
- package/dist/check/shared-state-rules.js +114 -0
- package/dist/check/source-rules.d.ts +26 -3
- package/dist/check/source-rules.js +249 -28
- package/dist/check/structure-rules.d.ts +23 -0
- package/dist/check/structure-rules.js +502 -0
- package/dist/check/timer-rules.d.ts +7 -0
- package/dist/check/timer-rules.js +543 -0
- package/dist/check/typescript.d.ts +35 -5
- package/dist/check/typescript.js +163 -17
- package/dist/check/vite-rules.d.ts +2 -0
- package/dist/check/vite-rules.js +136 -0
- package/dist/check/wait-rules.d.ts +16 -0
- package/dist/check/wait-rules.js +337 -0
- package/dist/commands.d.ts +7 -0
- package/dist/commands.js +307 -31
- package/dist/config-diff.d.ts +42 -0
- package/dist/config-diff.js +289 -0
- package/dist/config-edit.d.ts +35 -2
- package/dist/config-edit.js +145 -13
- package/dist/config-init.d.ts +15 -0
- package/dist/config-init.js +61 -0
- package/dist/config-paths.d.ts +22 -0
- package/dist/config-paths.js +82 -0
- package/dist/config-show.d.ts +82 -0
- package/dist/config-show.js +563 -0
- package/dist/config-values.d.ts +8 -0
- package/dist/config-values.js +68 -0
- package/dist/configuration-scaffold.d.ts +42 -0
- package/dist/configuration-scaffold.js +258 -4
- package/dist/configuration.d.ts +63 -3
- package/dist/configuration.js +178 -4
- package/dist/deployment.d.ts +2 -0
- package/dist/deployment.js +111 -0
- package/dist/describe-db.d.ts +22 -0
- package/dist/describe-db.js +176 -0
- package/dist/describe.d.ts +92 -0
- package/dist/describe.js +417 -0
- package/dist/dev-compose.d.ts +20 -0
- package/dist/dev-compose.js +154 -0
- package/dist/dev-guard.js +44 -0
- package/dist/dev-host.d.ts +13 -0
- package/dist/dev-host.js +55 -0
- package/dist/dev-infra.d.ts +72 -4
- package/dist/dev-infra.js +237 -17
- package/dist/dev-watch.d.ts +34 -0
- package/dist/dev-watch.js +192 -0
- package/dist/diagnostics.d.ts +10 -7
- package/dist/diagnostics.js +22 -4
- package/dist/drift.d.ts +50 -0
- package/dist/drift.js +218 -0
- package/dist/env-file.d.ts +25 -1
- package/dist/env-file.js +64 -6
- package/dist/errors.d.ts +7 -1
- package/dist/example-config.d.ts +2 -0
- package/dist/example-config.js +3 -0
- package/dist/first-admin.d.ts +43 -0
- package/dist/first-admin.js +175 -0
- package/dist/formatter-ignore.d.ts +37 -0
- package/dist/formatter-ignore.js +344 -0
- package/dist/generator.d.ts +45 -3
- package/dist/generator.js +205 -15
- package/dist/guide.d.ts +1 -1
- package/dist/guide.js +42 -21
- package/dist/install-module.d.ts +29 -3
- package/dist/install-module.js +142 -13
- package/dist/install-plan.js +5 -3
- package/dist/layout.d.ts +12 -1
- package/dist/layout.js +19 -6
- package/dist/log-writer-control.d.ts +2 -0
- package/dist/log-writer-control.js +106 -27
- package/dist/log-writer.js +43 -10
- package/dist/logging-config.d.ts +8 -3
- package/dist/logging-config.js +19 -5
- package/dist/manifest.d.ts +29 -1
- package/dist/manifest.js +84 -6
- package/dist/merge-install-defaults.d.ts +0 -1
- package/dist/merge-install-defaults.js +13 -47
- package/dist/npm-client.d.ts +59 -4
- package/dist/npm-client.js +220 -16
- package/dist/npm-paths.js +18 -4
- package/dist/openapi.d.ts +27 -0
- package/dist/openapi.js +649 -0
- package/dist/option-fixes.d.ts +39 -0
- package/dist/option-fixes.js +130 -0
- package/dist/output.d.ts +1 -1
- package/dist/output.js +5 -5
- package/dist/plugin-lifecycle.d.ts +34 -2
- package/dist/plugin-lifecycle.js +206 -20
- package/dist/plugin-options.d.ts +19 -4
- package/dist/plugin-options.js +138 -6
- package/dist/plugins-command.js +44 -7
- package/dist/process-group.d.ts +39 -0
- package/dist/process-group.js +132 -0
- package/dist/project-guide.d.ts +19 -1
- package/dist/project-guide.js +119 -20
- package/dist/project-inspector.d.ts +15 -0
- package/dist/project-inspector.js +481 -33
- package/dist/project-state.d.ts +5 -0
- package/dist/project-state.js +8 -0
- package/dist/project.d.ts +203 -19
- package/dist/project.js +3016 -336
- package/dist/recipe-facts.d.ts +127 -0
- package/dist/recipe-facts.js +563 -0
- package/dist/recipe-login.d.ts +63 -0
- package/dist/recipe-login.js +464 -0
- package/dist/recipe-mail.d.ts +21 -0
- package/dist/recipe-mail.js +214 -0
- package/dist/recipe-members.d.ts +35 -0
- package/dist/recipe-members.js +178 -0
- package/dist/recipe-record.d.ts +82 -7
- package/dist/recipe-record.js +226 -22
- package/dist/recipe-reset.d.ts +2 -0
- package/dist/recipe-reset.js +117 -0
- package/dist/recipe-site.d.ts +48 -0
- package/dist/recipe-site.js +396 -0
- package/dist/recipe-step.d.ts +42 -0
- package/dist/recipe-step.js +89 -0
- package/dist/recipe.d.ts +56 -20
- package/dist/recipe.js +703 -131
- package/dist/registry.d.ts +98 -2
- package/dist/registry.js +171 -5
- package/dist/reloadable.d.ts +35 -0
- package/dist/reloadable.js +257 -0
- package/dist/server.d.ts +50 -4
- package/dist/server.js +790 -103
- package/dist/settings.d.ts +48 -0
- package/dist/settings.js +168 -0
- package/dist/site-auth.d.ts +39 -0
- package/dist/site-auth.js +195 -0
- package/dist/template-fixes.d.ts +26 -0
- package/dist/template-fixes.js +285 -0
- package/dist/test-reporter.d.ts +49 -0
- package/dist/test-reporter.js +190 -0
- package/dist/transaction.d.ts +67 -0
- package/dist/transaction.js +428 -46
- package/dist/verify-tests.d.ts +98 -0
- package/dist/verify-tests.js +449 -0
- package/dist/verify.d.ts +113 -4
- package/dist/verify.js +326 -28
- package/dist/view-choice.d.ts +58 -0
- package/dist/view-choice.js +131 -0
- package/dist/vite-watch.js +4 -2
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
# @dokebi/cli
|
|
2
2
|
|
|
3
|
-
The tool that creates Dokebi projects and installs plugins, version
|
|
3
|
+
The tool that creates Dokebi projects and installs plugins, with the installed version recorded in package.json (0.4.0 was the stage-3 release, D-0067). The command is `dokebi`. What changed since 0.1.1 (YAML settings, migrate, multi-app and module commands) is in the CHANGELOG. Node.js >=24.0.0, ESM; the default CI runs Node 24.
|
|
4
4
|
|
|
5
5
|
## Running it
|
|
6
6
|
|
|
7
7
|
- Outside a project: `npx -y @dokebi/cli@<version> init <new folder>` (the version may be left out). Inside a project: `npx dokebi …` (init puts `@dokebi/cli` in devDependencies, so that copy runs).
|
|
8
8
|
- The npm package named `dokebi` is not this CLI: `npx -y dokebi` runs someone else's code, never use it.
|
|
9
|
-
-
|
|
9
|
+
- Use `--json` for one machine-readable document on stdout, except for interactive `dev`, `logs` and `start --foreground`. Use `--dry-run` only on commands that list it in help (plan only; it may download and install into a temporary folder to read packages, but never applies managed files or node_modules). `dokebi --help` lists every command; `dokebi <command> --help` explains each flag of one command with an example.
|
|
10
10
|
|
|
11
11
|
## AI entry (D-0065)
|
|
12
12
|
|
|
13
13
|
- `dokebi guide`: the AI first page (steps, rules, recipes, what Dokebi does not have, commands). `dokebi --help` starts by pointing to it.
|
|
14
|
-
- `dokebi recipe list` and `dokebi recipe <name>` (`blog`, `api`): without answers they install nothing and return the questions with `waitForUser` (ask the user, end your turn); with answers they plan and apply. Applying needs the source of the answers, `--answers-from user` or `--defaults
|
|
15
|
-
- `dokebi plugins list|search|info|doc`: the catalog inside this CLI (`catalog.json`) and what Dokebi does not have (absent:
|
|
16
|
-
- `dokebi verify`: doctor, check, typecheck, build, start, HTTP checks and stop; say done only when it is `ok`. HTTP counts only answers of the app verify started (the `x-dokebi-verify` token), and stop uses that pid without `ps`.
|
|
17
|
-
- `dokebi
|
|
18
|
-
- `dokebi
|
|
19
|
-
-
|
|
14
|
+
- `dokebi recipe list` and `dokebi recipe <name>` (`blog`, `api`, `site`): without answers they install nothing and return the questions with `waitForUser` (ask the user, end your turn); with answers they plan and apply. Applying needs the source of the answers, `--answers-from user` or `--defaults`; `--answers-from user` only for choices the user or the request explicitly made, and anything the AI decided goes in `--ai-chose` (with `--ai-reason`), so each answer records who made it (D-0095). The result's `report` (answers, defaults, how the forms send the CSRF token, where the admin login is) goes to the user. The `blog` recipe installs @dokebi/csrf for its write forms, and `--admin login` sets up @dokebi/auth with the app's own user table, a login page and a first admin (D-0076 §6).
|
|
15
|
+
- `dokebi plugins list|search|info|doc`: the catalog inside this CLI (`catalog.json`) and what Dokebi does not have (absent: two-factor login, OAuth, markdown, rss, sqlite, React, ORM, admin generator, search). `plugins doc` prints the AI.md of the installed version.
|
|
16
|
+
- `dokebi verify`: doctor, check, typecheck, build, test (the project's `npm test`; with node:test a result per test, a leading `[ID]` of a name as its `id`), start, HTTP checks and stop; say done only when it is `ok`. HTTP counts only answers of the app verify started (the `x-dokebi-verify` token), and stop uses that pid without `ps`.
|
|
17
|
+
- `dokebi describe`: what the app has, without serving (D-0077): routes with their id, schema and login rule, pages (EJS views, Inertia components), jobs, schedules, error codes, option keys and environment variable names (never a value). It loads the project like `start` in core's describe mode: every setup runs, nothing listens or connects. `--json` follows `describe.schema.json` in this package.
|
|
18
|
+
- `dokebi describe --openapi [--app <name>]`: an OpenAPI 3.1 document per app from the same description (D-0077 C): `operationId` is the route id, request and response schemas come from the route schemas, the error answers use the D-0074 body (422 `VALIDATION_FAILED`, 401, 403 for roles, `can` and CSRF), `cookieAuth` and `bearerAuth` follow the login rules, the app's error codes are `x-dokebi-errors`. Several apps without `--app`: `{ apps: { <name>: document } }`.
|
|
19
|
+
- `dokebi check`: user-code convention rules (D-0072): `empty-catch`, `missing-cause` (a catch that throws a new error without the caught one, D-0118), `floating-promise`, `non-erasable-syntax`, `private-import`, `missing-package`, `generated-file`, `secret-in-config`; the warning `inertia-form-only` (D-0074); and, with @dokebi/auth or @dokebi/csrf installed, `plain-password-compare`, `form-without-csrf` and `csrf-exempt-unverified` (D-0076 §6); `background-timer` (periodic work on the app's own timers) and the warnings `responsibility-size` and `memory-filtered-page` (D-0105). Each problem has file, line and fix; `// dokebi-check: allow <rule> <reason>` silences an intended case.
|
|
20
|
+
- `dokebi config show|set|unset|secret` and `dokebi dev-infra` (compose.yaml and the URL of the development database in dokebi.yaml, with its password; no .env is written). `config unset <id>.<path>...` removes options from dokebi.yaml and dokebi.example.yaml without printing them (D-0153; the fix of an unknown key names it). `config show [<id>[.<path>]]` prints the options with every secret hidden (`<secret: set>`): use it instead of cat or sed on dokebi.yaml. `config secret <id>.<path> --rotate` replaces a secret; a list keeps the previous two after the new one, so what they signed still verifies.
|
|
21
|
+
- Secrets live in `dokebi.yaml` (0600, kept out of Git; D-0073 addendum 2): `add` writes the secrets a plugin declares (for example @dokebi/session's `secrets`) and reports only their names (`generatedSecrets`); `config secret <id>.<path>` generates one later. An environment variable is only an optional production override where a plugin documents one. An existing `.env` is still passed to the app by `dev`, `start` and `verify` (a variable already set wins; a malformed line is `ENV_FILE_INVALID`).
|
|
20
22
|
- The full contract is in [AI.md](AI.md) §0.
|
|
21
23
|
|
|
22
24
|
## Commands
|
|
23
25
|
|
|
24
26
|
- dokebi init <folder> [--core <core package spec>] [--dry-run]: prepares a project with core and the required config. devDependencies get this CLI (same version), typescript and @types/node, scripts `start` and `typecheck`, AGENTS.md (with the installed list) and CLAUDE.md, and the result names the next steps (`nextSteps`). The folder must be new or empty (a folder with only `.git`, `.npmrc`, `.npm`, `.npm-cache`, `.DS_Store`, `Thumbs.db`, `.idea`, `.vscode` works too: `init .`). Anything else is `PROJECT_EXISTS`.
|
|
25
|
-
- dokebi add <npm package spec or local tgz> [--set <path>=<value>] [--adapter <id>] [--no-first-app] [--dry-run]: installs and registers an optional plugin (and the plugins it requires). Without a version it picks the newest version for this core.
|
|
27
|
+
- dokebi add <npm package spec or local tgz> [--set <path>=<value>] [--adapter <id>] [--startup <required|optional>] [--no-first-app] [--dry-run]: installs and registers an optional plugin (and the plugins it requires). Without a version it picks the newest version for this core.
|
|
26
28
|
- dokebi upgrade <plugin ID> [--to <version|package|tgz>] [--dry-run]: changes a plugin's version. A changed manifest under the same version is applied again.
|
|
27
29
|
- dokebi remove <plugin ID> [--dry-run]: removes an optional plugin nothing depends on. Required parts cannot be removed.
|
|
28
30
|
- dokebi app add|remove|link|unlink|list: `src/apps/<app>` and its domains (@dokebi/app). `app add --inertia [--ssr]` also prepares the Vue skeleton, the build and server rendering.
|
|
29
31
|
- dokebi module add|remove|list: feature modules `src/shared/modules/<module>` (@dokebi/module).
|
|
30
32
|
- dokebi migrate [--dry-run]: moves an existing JSON project to the YAML contract, explicitly.
|
|
31
33
|
- dokebi inspect, dokebi doctor: read-only checks of installed versions, manifests, schemas and settings (`--verbose` for everything; `--json` is always complete).
|
|
32
|
-
- dokebi dev: a development run that restarts when code or settings change (with a Vite config and a current template-inertia, the Vite dev
|
|
34
|
+
- dokebi dev: a development run that restarts when code or settings change (with a Vite config and a current template-inertia, the CLI shares one Vite dev host with HMR across app workers).
|
|
33
35
|
- dokebi start [--foreground] [--log-max-mb <MB>] [--log-files <n>] · stop [--force] · status · logs [-n <lines>] [-f]: background run, stop, state and logs in `.dokebi/run/app.pid` and `app.log`. Where `ps` is blocked (agent sandboxes), `stop` and `status` prove the recorded pid is this app through its log writer's loopback control port (`proof: log-writer`) or by an HTTP challenge the app answers (@dokebi/web, `proof: http`), both keyed with the per-start `DOKEBI_INSTANCE_TOKEN`; without a proof they refuse with `PROCESS_INFO_FAILED` as before. Where this shell may not even signal the app (a sandbox per command), the log writer, which started the app, stops it on request (`via: log-writer`). A separate writer process takes the log through a pipe, loses no line and rotates by size (default 50 MB, `app.log.1`…`app.log.5`, [D-0053](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0053-cli-log-rotation.md)). `logs -n` reads rotated files too, and `-f` follows across rotations (it tracks files by inode, so it skips no line even when several rotations happen between two checks). There is no automatic restart, so in production use `start --foreground` under systemd or Docker ([D-0044](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0044-cli-server-commands.md)).
|
|
34
36
|
|
|
35
37
|
The generated app runs with npm start. Call the commands with the installed CLI from the project root (or an npm workspace member folder).
|
|
@@ -69,3 +71,26 @@ The catalog entry of a package is `dokebiCatalog` in its package.json (outside t
|
|
|
69
71
|
User-edited templates are kept on remove. Install scripts never run, but package code runs when the app runs, so use plugins you trust. git or URL dependencies and automatic recovery after a forced kill are not supported. Windows and production hardening are outside the verified scope, as the repository records say.
|
|
70
72
|
|
|
71
73
|
MIT license. See the [AI contract](AI.md) and the [repository](https://git.nyx-zone.com/dokebi/framework).
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Development mail (D-0078 MP4)
|
|
77
|
+
|
|
78
|
+
The blog and API recipes ask `--mail none|mailpit|smtp|ses` (default `none`). `mailpit` starts a local Mailpit inbox and NATS queue using `compose.mail.yaml`, with free loopback ports selected and persisted in Compose by the CLI so restart keeps the saved YAML addresses. Existing `compose.yaml` is preserved. Find the inbox with `docker compose -f compose.mail.yaml port mailpit 8025`; stop it with `docker compose -f compose.mail.yaml down` (`-v` also deletes queued messages). SMTP and SES require an installed `@dokebi/mail` with the selected transport and sender configured in `dokebi.yaml`; credentials never belong on a command line. Missing settings produce `MAIL_CONFIGURATION_REQUIRED` before applying. Recovery with mail also needs a provisioned job queue (`MAIL_QUEUE_REQUIRED`). The initial admin name has no email: map an email in the auth extension before using recovery.
|
|
79
|
+
|
|
80
|
+
| Command | Purpose |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `dokebi mail preview <name> [--locale <locale>]` | Render the template's `preview.json` in describe mode, without connecting, sending or running data hooks. `--json` returns subject, html, text and resolved locale in the standard envelope. Missing names are `MAIL_TEMPLATE_NOT_FOUND`. |
|
|
83
|
+
|
|
84
|
+
Mail templates live in `src/shared/mail/`; install writes a user-owned welcome sample. `describe` lists their names, locales and files. With mail installed, `check` adds two warnings: `mail-send-in-request` recommends `queue` in route handlers, and `mail-secret-in-data` recommends `sealed` for sensitive token/password/link-like fields. These name-based source heuristics do not replace a security review.
|
|
85
|
+
|
|
86
|
+
## Deployment skeleton
|
|
87
|
+
|
|
88
|
+
`dokebi init <directory> --deploy` also writes `Dockerfile`, `.dockerignore`, `compose.deploy.yaml` and `DEPLOY.md` inside the new project transaction. `--dry-run --json` reports `deployment.files` without writing or installing. It does not deploy or start services. Read `DEPLOY.md` before building: keep runtime secrets out of the image, mount `dokebi.yaml` read-only, configure the container web host/port and public domains, and prepare databases, queues and migrations separately. A core-only app exits when idle. Use a new folder; init never overlays an existing project.
|
|
89
|
+
|
|
90
|
+
## Multi-app site recipe
|
|
91
|
+
|
|
92
|
+
`dokebi recipe site` asks `--apps` (web/admin/api combinations, or none), `--domains` (app=host pairs, or auto), `--realms` (app=realm pairs, or auto), `--view` and `--worker none|thread|job`. Text questions have `input: "text"` and an empty options list; present their question and accept a text answer. The same answer-source and wait-for-user rules apply. `auto` selects separate `<app>.<project>.localhost` domains (unique to this project, so another project's cookies never collide) and realms; it is used only when explicitly answered or delegated through defaults. Duplicate domains, missing mappings and invalid realm names fail before mutation.
|
|
93
|
+
|
|
94
|
+
The site recipe creates a new project or fills a project without existing apps. Its `.dokebi/site-plan.json` checkpoint permits repeating the same choices after a partial failure; different choices require explicit app/config edits. Admin and API routes require authentication; public web routes are optional. Generated user lookups deny all logins until connected to your own user store. No account database or working login UI is claimed. Shared realms do not automatically share host-only cookies. Read `SITE.md` before running the site. A thread worker uses the generated CPU task module; a job worker needs a configured NATS endpoint and `npx dokebi-job-provision --queue siteWorker`. Both run in the same process; `--apps none` makes a worker-only project.
|
|
95
|
+
|
|
96
|
+
HTTP verification treats 401/403 from this run's instance on an app domain as reachable and reports `accessDenied: true`; it does not verify login. Readiness endpoints still require 2xx/3xx, and 400/404/5xx domain responses fail. Application tests must cover authentication and authorization.
|