@dokebi/cli 0.4.54 → 0.4.55
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 +1 -1
- package/catalog.json +3 -3
- package/dist/capability-guide.js +1 -1
- package/dist/output.d.ts +1 -1
- package/dist/output.js +1 -1
- package/package.json +1 -1
package/AI.md
CHANGED
|
@@ -181,7 +181,7 @@ One document on stdout: `{ schemaVersion, cliVersion, command, ok, result?, erro
|
|
|
181
181
|
| `src/dokebi.modules.generated.ts` | CLI | The registered modules (D-0227, with `@dokebi/module`): `registeredModules` (`{ <name>: module }` in registration order) and the type `RegisteredModuleName`. It imports the modules only, so apps and project files import it where code needs every module (an app that mounts each one, permission keys or menu entries collected from each module's declarations); never keep a module list of your own (D-0032 §5). `module add`, `remove` and `sync` write it; an edited copy is doctor `MODULE_LIST_MODIFIED` (error), a missing one `MODULE_LIST_MISSING` (warning: `npx dokebi module sync`) |
|
|
182
182
|
| `src/main.ts` | user | The entry point (YAML loading → Application → create and register plugins → start). Every plugin factory checks its options against its own declaration: a wrong value stops the start with `INVALID_PLUGIN_OPTIONS` (`plugin`, `fix`, and the cause `INVALID_OPTIONS` naming `options.<plugin>.<path>`). The generated code carries no JSON Schema validator (D-0070) |
|
|
183
183
|
| `src/apps/<app>/` | user | One app (app.ts, routes.ts or routes/, controllers, services, models, validation, views) |
|
|
184
|
-
| `src/shared/modules/<module>/` | user | Feature modules (module.ts, routes.ts and the same folders); job handlers and event subscriptions are registered in the owning module's setup. Declarations the project adds to every module (menu entries, permission keys) are files at the module root named for what they declare (`menu.ts`, `permissions.ts`) that `module.ts` passes on; pages declared but not built yet are routes (`routes.ts`) (D-0227). A pure rule the module's server code and its pages both use (a code check, a rich-text schema) stays in its `validation/`, imports neither Node nor browser APIs, and the pages import it with a relative path |
|
|
184
|
+
| `src/shared/modules/<module>/` | user | Feature modules (module.ts, routes.ts and the same folders); job handlers and event subscriptions are registered in the owning module's setup. Declarations the project adds to every module (menu entries, permission keys) are files at the module root named for what they declare (`menu.ts`, `permissions.ts`) that `module.ts` passes on; pages declared but not built yet are routes (`routes.ts`) (D-0227). A pure rule the module's server code and its pages both use (a code check, a rich-text schema) stays in its `validation/`, imports neither Node nor browser APIs, and the pages import it with a relative path. A module whose screens show parts of other modules offers slots (`slots.ts`); the others fill them from `slot-entries.ts` in their setup (D-0228, @dokebi/module AI.md §3b) |
|
|
185
185
|
| `src/shared/{models,services,views,locales,mail}/` · `src/shared/errors.ts` | user | Shared models and services, layouts and partials, translation catalogs (`locales/<locale>/<namespace>.json`), mail templates (`mail/<template>/<locale>/`) and the app error catalog |
|
|
186
186
|
| `src/shared/validation/` | user | Input rules several apps or modules share (D-0227): reading a list query (`?page`, `?sort`, `?ids`), a reason field. They take the values (query, body), never import app or module code; the rules of one app or module stay in its own `validation/` |
|
|
187
187
|
| `src/shared/browser/` | user | Browser code several apps or modules share (D-0226): `components/` (a design system's UI components), `layouts/`, `composables/`, `styles/` (CSS, tokens) and `lib/` (browser modules that are not Vue: a socket client, formatters); a project with two looks puts one folder per look first (`browser/staff/components/`). Pages import it with a relative path and the dev server serves what they import; server code never imports it. Browser code — this folder and the `views/` of apps and modules — is checked by `tsconfig.vue.json` (vue-tsc, Vite's types), not `tsconfig.json`: a project made before cli 0.4.53 adds `"exclude": ["src/apps/*/views/**", "src/shared/modules/*/views/**", "src/shared/browser/**"]` to `tsconfig.json`, and to `tsconfig.vue.json` the include entries `"src/apps/*/views/**/*.ts"`, `"src/shared/modules/*/views/**/*.ts"`, `"src/shared/browser/**/*.ts"` with `"exclude": ["node_modules", "dist"]`. Code one app or module uses stays in its `views/` |
|
package/catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Generated by scripts/catalog/build.ts from package.json dokebiCatalog fields and packages/cli/catalog-src (D-0065). Do not edit; run node scripts/catalog/build.ts.",
|
|
3
3
|
"schemaVersion": 1,
|
|
4
|
-
"cli": "0.4.
|
|
4
|
+
"cli": "0.4.55",
|
|
5
5
|
"core": {
|
|
6
6
|
"package": "@dokebi/core",
|
|
7
7
|
"version": "0.4.7"
|
|
@@ -825,7 +825,7 @@
|
|
|
825
825
|
{
|
|
826
826
|
"id": null,
|
|
827
827
|
"package": "@dokebi/cli",
|
|
828
|
-
"version": "0.4.
|
|
828
|
+
"version": "0.4.55",
|
|
829
829
|
"kind": "cli",
|
|
830
830
|
"summary": "Commands to create a project, browse the plugin catalog, run recipes, install plugins and verify (dokebi)",
|
|
831
831
|
"description": "Project scaffolding, plugin catalog, recipes, install and verification CLI for Dokebi.",
|
|
@@ -2143,7 +2143,7 @@
|
|
|
2143
2143
|
{
|
|
2144
2144
|
"id": "dokebi-module",
|
|
2145
2145
|
"package": "@dokebi/module",
|
|
2146
|
-
"version": "0.4.
|
|
2146
|
+
"version": "0.4.10",
|
|
2147
2147
|
"kind": "plugin",
|
|
2148
2148
|
"summary": "Modules that hold one feature each (src/shared/modules/<module>); an app attaches them under a prefix",
|
|
2149
2149
|
"description": "Feature modules for Dokebi apps: controllers, models, views and routes in one folder mounted under a prefix.",
|
package/dist/capability-guide.js
CHANGED
|
@@ -37,7 +37,7 @@ export const INTEGRATION_RULES = [
|
|
|
37
37
|
'- Background work (D-0141): deliveries (webhooks, mail, notifications), exports, imports, copies, grace periods and cleanups are work items of @dokebi/outbox, not loops you write. Enqueue with outbox.enqueue(tx, { type, owner, destination, payload, dedupeKey, notBefore }) inside the business transaction and register outbox.handle(type, handler, { onDone }) in the setup of the module that owns the work; its runner claims fair batches across owners through one due-time index, retries with backoff, waits out a destination that is down (a breaker per destination, dead only after a horizon of days), keeps dead items for outbox.resend and removes finished rows after a retention. It derives its own small pool of the main connection (pool.max, default 4), so add nothing but run the migration that npx dokebi add @dokebi/outbox writes, keep handlers idempotent with item.key, query in handlers through context.db (the outbox handler pool, never the main pool: an owner whose handlers wait on a locked row then holds at most runner.maxInFlightPerOwner of them while the other owners keep flowing), and put the arrival and drain per second of npx dokebi-outbox stats in the section 6 table of the final report. Never hand-write a claim loop, a retry or dead-letter table or a timer for such work. A destination is one endpoint (one webhook id or URL, one mailbox provider), never a whole host or a shared name such as database: items of one failing endpoint must not pause the others. Database-only cleanup has no destination, and a batch handler records a failing row and skips it rather than failing the whole item. Best-effort signals after a commit (an SSE change notice, a cache invalidation) are not outbox work: send them directly.',
|
|
38
38
|
'- Recipe fit: pick the recipe whose scaffold matches the app (npx dokebi recipe list shows each recipe and its match); when you build on a scaffold made for something else, rename or remove its sample names (tables, option keys, routes, view titles) so none of them remains in the finished app.',
|
|
39
39
|
'- Responsibility boundaries: use Controller -> Service -> Model for application data. Controllers translate HTTP input/output and call services; models own SQL, services provide data and coordinate workflows, and jobs invoke those services. Put app-specific services in src/apps/<app>/services, cross-app services in src/shared/services, and feature-module services in src/shared/modules/<module>/services. Shared services must not import app-specific code. Services accept explicit inputs and return DTOs, never request/reply or template objects; do not expose models or SQL pools through a service for controllers/routes to bypass it. Compose dependencies once during setup. Periodic and background work runs only through the scheduler and job plugins, registered by the module that owns it; never start timers, intervals or background loops in controllers, services or setup code. Keep auth extension wiring separate from reusable member persistence. Audit the final route and registration graph after replacing scaffold flows; remove obsolete unreferenced implementations that duplicate the active behavior, while preserving required engine entries, mail templates and user-owned resources. Split by responsibility, not by arbitrary file counts. When a browser UI is present, keep views/runtime for browser integration and requested reusable editor/upload UI in the template components, and display helpers separate from transport. Use explicit DTO types through services, browser adapters and Vue props; a default any response or any page state defeats SFC checking. Keep readable formatting. Keep original TS/JS/Vue source formatted; minification belongs only to generated build output. Declare a formatter that supports the source formats, include its check in project verification, and inspect the final source rather than claiming readability from build success. Include Vue SFC scripts/templates in type checking; a successful Vite build or server-only tsc is not a Vue type check. dokebi app add --inertia prepares it: npm run typecheck runs tsc and then vue-tsc (typecheck-vue.mjs with tsconfig.vue.json), so keep that step, write pages as <script setup lang="ts">, and type the shared page props in src/infra/inertia/page.d.ts. Preserve the shared error catalog at src/shared/errors.ts.',
|
|
40
|
-
'- Files and folders (maintained layout; refreshed by guide --sync like every rule here): src holds only main.ts and the files the CLI writes at its root: dokebi.generated.ts and dokebi.modules.generated.ts (the registered modules; import registeredModules from it where code needs every module, an app that mounts each one or keys collected from each, and never keep a module list of your own). One app per src/apps/<app>: app.ts, routes.ts (or routes/ for route groups), controllers/, services/, models/, validation/ and views/<template>/ (Inertia pages in views/<template>/Pages, components in components/, browser integration in views/runtime/). Shared code: src/shared/models, src/shared/services, src/shared/views (layouts, partials), src/shared/locales/<locale>/<namespace>.json, src/shared/mail/<template>/<locale>/, application settings in src/shared/settings, input rules several apps or modules share (reading a list query, a reason) in src/shared/validation and the error catalog src/shared/errors.ts. Browser code several apps or modules share (a design system, shared layouts, composables, a socket client) goes in src/shared/browser: components/, layouts/, composables/, styles/ and lib/ (a project with two looks, an operator console and a member site, puts one folder per look first, src/shared/browser/staff/components/); pages import it with a relative path, server code never imports it. Browser code (the views of apps and modules and src/shared/browser) is type-checked by tsconfig.vue.json with vue-tsc, not by tsconfig.json. Code one app or module uses stays in the views/ of that app or module. src/shared holds nothing else (dokebi check warns shared-folder). One feature per module in src/shared/modules/<module> (module.ts, routes.ts and the same controllers/services/models/validation/views folders; create it with npx dokebi module add). Declarations the project adds to every module (its menu entries, its permission keys) are files at the module root named for what they declare (menu.ts, permissions.ts) that module.ts passes on; pages declared but not built yet are routes and stay in routes.ts. A feature several apps show is one module, a login of two apps included; when each app needs route ids of its own, each app mounts a set of its own whose routes carry those ids and call the same controllers. Plugin connection and extension code in src/infra/<name> (src/infra/db/connections.ts, src/infra/auth/extension.ts), including the project wrapper of a plugin (a defineModule wrapper in src/infra/module/) and code several apps share that reads a request through a plugin (the viewer from request.auth in src/infra/auth/, Inertia props several apps build the same way beside src/infra/inertia/shared.ts, a gate of every route of an app, a dokebi-web routeHook each app registers in its setup, in src/infra/web/); services never take the request; your own plugins in src/plugins/<name>. Migrations in src/infra/db/migrations/<connection> and seeds in src/infra/db/seeds/<connection> (npx dokebi-migrate make writes the file). Job handlers and event subscriptions are registered in the setup of the module that owns the feature (src/shared/modules/<module>/module.ts) and call its services; schedules are entries of options.dokebi-scheduler.schedules in dokebi.yaml whose job type such a handler takes; CPU tasks go in src/infra/worker/tasks.ts, event payload types in src/infra/events/types.ts and the cluster worker factory in src/infra/runtime/application.ts. Input validation (route schemas and validators) lives in validation/ of the app or module that owns the route; a pure rule both the server and the pages of that app or module use (a code check, a rich-text schema) stays in that validation/ folder, imports neither Node nor browser APIs, and the pages import it with a relative path (one several apps or modules use goes in src/shared/validation); a DTO type is exported by the service that returns it (cross-app DTOs with their service in src/shared/services). Tests: tests/unit (no external service), tests/integration (a real database, HTTP or broker) and tests/support (helpers and fixtures, never named *.test.ts); npm test runs node --test "tests/**/*.test.ts", which covers both test folders, and tsconfig.json includes tests/**/*.ts. Development tools (imports, measurements, one-off maintenance) go in scripts/ at the project root, run with node scripts/<name>.ts and never imported by src. Name .ts files and folders in kebab-case (Vue components and Inertia pages are PascalCase, as Pages/Posts/Show.vue), and give each file one responsibility.',
|
|
40
|
+
'- Files and folders (maintained layout; refreshed by guide --sync like every rule here): src holds only main.ts and the files the CLI writes at its root: dokebi.generated.ts and dokebi.modules.generated.ts (the registered modules; import registeredModules from it where code needs every module, an app that mounts each one or keys collected from each, and never keep a module list of your own). One app per src/apps/<app>: app.ts, routes.ts (or routes/ for route groups), controllers/, services/, models/, validation/ and views/<template>/ (Inertia pages in views/<template>/Pages, components in components/, browser integration in views/runtime/). Shared code: src/shared/models, src/shared/services, src/shared/views (layouts, partials), src/shared/locales/<locale>/<namespace>.json, src/shared/mail/<template>/<locale>/, application settings in src/shared/settings, input rules several apps or modules share (reading a list query, a reason) in src/shared/validation and the error catalog src/shared/errors.ts. Browser code several apps or modules share (a design system, shared layouts, composables, a socket client) goes in src/shared/browser: components/, layouts/, composables/, styles/ and lib/ (a project with two looks, an operator console and a member site, puts one folder per look first, src/shared/browser/staff/components/); pages import it with a relative path, server code never imports it. Browser code (the views of apps and modules and src/shared/browser) is type-checked by tsconfig.vue.json with vue-tsc, not by tsconfig.json. Code one app or module uses stays in the views/ of that app or module. src/shared holds nothing else (dokebi check warns shared-folder). One feature per module in src/shared/modules/<module> (module.ts, routes.ts and the same controllers/services/models/validation/views folders; create it with npx dokebi module add). Declarations the project adds to every module (its menu entries, its permission keys) are files at the module root named for what they declare (menu.ts, permissions.ts) that module.ts passes on; pages declared but not built yet are routes and stay in routes.ts. A module whose screens show parts of other modules (detail sections, list columns, filters, row menu items, dashboard cards) offers slots in slots.ts at its root, returned from its setup; a module that fills them requires it and adds data entries from slot-entries.ts in its own setup, open while its set is (module.enabled(set)); pages never import components of another module: entries are drawn by generic components of src/shared/browser, and a section with a screen of its own is a page of the filling module. A feature several apps show is one module, a login of two apps included; when each app needs route ids of its own, each app mounts a set of its own whose routes carry those ids and call the same controllers. Plugin connection and extension code in src/infra/<name> (src/infra/db/connections.ts, src/infra/auth/extension.ts), including the project wrapper of a plugin (a defineModule wrapper in src/infra/module/) and code several apps share that reads a request through a plugin (the viewer from request.auth in src/infra/auth/, Inertia props several apps build the same way beside src/infra/inertia/shared.ts, a gate of every route of an app, a dokebi-web routeHook each app registers in its setup, in src/infra/web/); services never take the request; your own plugins in src/plugins/<name>. Migrations in src/infra/db/migrations/<connection> and seeds in src/infra/db/seeds/<connection> (npx dokebi-migrate make writes the file). Job handlers and event subscriptions are registered in the setup of the module that owns the feature (src/shared/modules/<module>/module.ts) and call its services; schedules are entries of options.dokebi-scheduler.schedules in dokebi.yaml whose job type such a handler takes; CPU tasks go in src/infra/worker/tasks.ts, event payload types in src/infra/events/types.ts and the cluster worker factory in src/infra/runtime/application.ts. Input validation (route schemas and validators) lives in validation/ of the app or module that owns the route; a pure rule both the server and the pages of that app or module use (a code check, a rich-text schema) stays in that validation/ folder, imports neither Node nor browser APIs, and the pages import it with a relative path (one several apps or modules use goes in src/shared/validation); a DTO type is exported by the service that returns it (cross-app DTOs with their service in src/shared/services). Tests: tests/unit (no external service), tests/integration (a real database, HTTP or broker) and tests/support (helpers and fixtures, never named *.test.ts); npm test runs node --test "tests/**/*.test.ts", which covers both test folders, and tsconfig.json includes tests/**/*.ts. Development tools (imports, measurements, one-off maintenance) go in scripts/ at the project root, run with node scripts/<name>.ts and never imported by src. Name .ts files and folders in kebab-case (Vue components and Inertia pages are PascalCase, as Pages/Posts/Show.vue), and give each file one responsibility.',
|
|
41
41
|
'- Apps split by host (D-0132): with several @dokebi/app apps on different hosts, routes that plugins add answer on every host unless they are bound to apps. Bind each plugin endpoint to its app in dokebi.yaml: dokebi-mcp.app: mcp (the MCP route), dokebi-oauth.app: studio (the authorization server: metadata, authorize with the consent page, token, revoke, register; the issuer origin is a domain of that app) and dokebi-oauth.resources.<id>.app: mcp (the protected resource metadata, on the app of the resource uri host). Every other host then answers the 404 of an unknown route. Put the sign-in page on the issuer app. A route of your own module or plugin on web takes app: <name> or app: [<name>, ...] the same way. Never write an onRequest hook that compares the Host header to hide an endpoint, and never answer 403 on the wrong host. Without @dokebi/app a bound route fails the start (ROUTE_APP_UNAVAILABLE), an unknown app name too (ROUTE_APP_UNKNOWN), and an issuer or resource uri on a domain of another app fails it with INVALID_OPTIONS naming the option to set; health routes stay on every host.',
|
|
42
42
|
'- Module contributions (D-0130): a feature module that offers values to a plugin point (MCP tools, prompts and resources of @dokebi/mcp, mail template folders) declares the points in defineModule({ contributes: [mcpTools] }) and calls module.contribute(point, value) in its own setup, after it builds its services; the contributed objects (an McpTool subclass) take those services in their constructors. Core sets the module up before the plugin that collects the point, so the services exist when the collector reads them, and contributions close when every setup has finished. A module never collects. Never rebuild module services in a separate definePlugin, and never register an app plugin by hand in src/main.ts or src/infra/runtime/application.ts to reach them: describe, the tests and the other entry do not see such a plugin, and doctor and check do not read it. A second module reaches the services through requires: [workspace] and module.get(workspace). Values that no registered plugin collects are dropped with warn POINT_NOT_COLLECTED, npx dokebi check reports module-point-not-installed when the plugin package of a point is not installed, and npx dokebi describe lists each module point and its collector. MCP tool names are unique across modules and plugins (INVALID_TOOL names both owners).',
|
|
43
43
|
"- What `npx dokebi check` enforces from these rules (D-0105), so a broken one fails before you report: background-timer (an error, so verify fails) is a setInterval, a setTimeout/setImmediate that reschedules itself, or a loop that sleeps inside a task started in the background (an immediately invoked async function or a function called without await, such as a polling loop in a module start), in server code under src/ (views and tests are not read): move the work to a @dokebi/job handler registered in the owning module's setup and an entry of options.dokebi-scheduler.schedules; one-shot delays, time limits, awaited sleeps of node:timers/promises and timers of one request or socket are fine (a timer a request stores on this or in an outer variable outlives it and is reported). polling-loop (an error no marker silences) is a loop that sleeps inside a task started in the background, or a timer whose callback does database work: move it to an @dokebi/outbox or @dokebi/job handler. private-pool (an error) is a database pool or client made with the driver outside src/infra/db (new pg.Pool, mysql2 createPool, new MongoClient): take connections from @dokebi/db (connection(main), derive('main', { purpose, overrides: { max } }) for a pool of one kind of work, or another connection in dokebi.yaml) so dokebi.yaml sets their size and waitTimeoutMs and a caller past the wait gets 503 with Retry-After. overload-off (an error) is a route config overload: false: keep the overload protection on every API route (a metrics scrape or status page takes a marker). readiness-off (an error) is a route config readiness: false: an API route keeps refusing with 503 NOT_READY while a required dependency is down (a metrics scrape or status page that must answer then takes a marker). Warnings: in-process-queue (the resolve of a new Promise stored in a collection to call later: a queue of one worker without bound or deadline), fixed-owner-cap (a per-owner count of requests in progress compared with a fixed limit: use the owner share of @dokebi/db, share(main).enter(owner), which refuses only while the pool is full, @dokebi/db AI.md 6.4), wait-count-refusal (a comparison of the callers waiting for a pool connection, such as pool.waitingCount, with a number: refuse by the wait deadline, never by how many wait), responsibility-size (a model of 400+ code lines over 8+ tables or collections, a controller with 20+ route handlers or 300+ code lines, a service whose methods mostly only pass their arguments to a model) and memory-filtered-page (rows a query returned, skipped in code by an input such as filter.status and then cut to a page). A warning is still a broken rule: fix it, or keep it with // dokebi-check: allow <rule> <reason> and say why in your final message. An allow marker on background-timer is only for per-process upkeep of in-memory state (a cache of this worker); a loop that reads or writes the database (claiming, folding, polling a queue table) is never a valid reason: move it to a job or an outbox handler. check lists every marker with a reason under allowed, and verify ok asks your final message to list them with their reasons. With @dokebi/db installed, verify ok lists finalReport: the section 6 table your final message must contain.",
|
package/dist/output.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.4.
|
|
1
|
+
export declare const CLI_VERSION = "0.4.55";
|
|
2
2
|
export declare function envelope(command: string, result: unknown, ok?: boolean): object;
|
|
3
3
|
export declare function failure(command: string, error: unknown, mutationStarted: boolean): object;
|
package/dist/output.js
CHANGED