cabloy 5.1.59 → 5.1.60

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.
Files changed (102) hide show
  1. package/.claude/skills/cabloy-contract-loop/SKILL.md +16 -0
  2. package/.claude/skills/cabloy-contract-loop/references/contract-loop-map.md +26 -0
  3. package/.claude/skills/cabloy-contract-loop/references/resource-custom-state-pattern.md +144 -0
  4. package/.claude/skills/cabloy-contract-loop/references/verification-checklist.md +18 -0
  5. package/.claude/skills/cabloy-resource-field-update/SKILL.md +267 -0
  6. package/.claude/skills/cabloy-resource-field-update/evals/evals.json +53 -0
  7. package/.claude/skills/cabloy-resource-field-update/references/custom-renderer-demo-checklist.md +102 -0
  8. package/.claude/skills/cabloy-resource-field-update/references/field-update-decision-tree.md +120 -0
  9. package/.claude/skills/cabloy-resource-field-update/references/follow-up-checklist.md +80 -0
  10. package/.claude/skills/cabloy-resource-field-update/references/verification-checklist.md +97 -0
  11. package/.github/workflows/docs-pages.yml +2 -0
  12. package/.github/workflows/vona-cov-pg.yml +2 -0
  13. package/.github/workflows/vona-test-crud.yml +4 -2
  14. package/.github/workflows/vona-test-mysql.yml +2 -0
  15. package/.github/workflows/vona-test-pg.yml +2 -0
  16. package/.github/workflows/vona-test-sqlite3.yml +2 -0
  17. package/.github/workflows/vona-tsc.yml +2 -0
  18. package/.github/workflows/zova-ui.yml +2 -0
  19. package/.gitignore +0 -4
  20. package/CHANGELOG.md +30 -0
  21. package/CLAUDE.md +2 -0
  22. package/README.md +15 -0
  23. package/cabloy-docs/.vitepress/config.mjs +43 -0
  24. package/cabloy-docs/ai/class-placement-rule.md +2 -0
  25. package/cabloy-docs/ai/cli-to-skill-map.md +7 -0
  26. package/cabloy-docs/ai/future-skill-roadmap.md +17 -2
  27. package/cabloy-docs/backend/bean-scene-authoring.md +350 -0
  28. package/cabloy-docs/backend/cli.md +26 -1
  29. package/cabloy-docs/backend/foundation.md +28 -3
  30. package/cabloy-docs/backend/introduction.md +8 -0
  31. package/cabloy-docs/backend/service-guide.md +2 -0
  32. package/cabloy-docs/backend/websocket-call-flow.md +435 -0
  33. package/cabloy-docs/backend/websocket-guide.md +455 -0
  34. package/cabloy-docs/backend/websocket-protocol-guide.md +381 -0
  35. package/cabloy-docs/backend/websocket-usage-guide.md +356 -0
  36. package/cabloy-docs/frontend/bean-scene-authoring.md +372 -0
  37. package/cabloy-docs/frontend/behavior-guide.md +449 -0
  38. package/cabloy-docs/frontend/cli.md +12 -0
  39. package/cabloy-docs/frontend/introduction.md +5 -0
  40. package/cabloy-docs/frontend/ioc-and-beans.md +10 -9
  41. package/cabloy-docs/frontend/router-tabs-admin-web-comparison.md +206 -0
  42. package/cabloy-docs/frontend/router-tabs-introduction.md +106 -0
  43. package/cabloy-docs/frontend/router-tabs-mechanism.md +469 -0
  44. package/cabloy-docs/frontend/router-tabs-overview.md +227 -0
  45. package/cabloy-docs/frontend/router-tabs-route-meta-cookbook.md +343 -0
  46. package/cabloy-docs/frontend/ssr-architecture-overview.md +211 -0
  47. package/cabloy-docs/frontend/ssr-build-deploy-guide.md +308 -0
  48. package/cabloy-docs/frontend/ssr-review-checklist.md +184 -0
  49. package/cabloy-docs/frontend/ssr-troubleshooting-guide.md +301 -0
  50. package/cabloy-docs/fullstack/framework-performance.md +3 -3
  51. package/cabloy-docs/fullstack/introduction.md +29 -0
  52. package/cabloy-docs/fullstack/quickstart.md +7 -1
  53. package/cabloy-docs/fullstack/tutorial-1-first-module.md +111 -0
  54. package/cabloy-docs/fullstack/tutorial-2-first-crud.md +122 -0
  55. package/cabloy-docs/fullstack/tutorial-3-frontend-metadata-sharing.md +131 -0
  56. package/cabloy-docs/fullstack/tutorial-4-custom-level-renderers.md +119 -0
  57. package/cabloy-docs/fullstack/tutorial-5-backend-contract-sharing.md +144 -0
  58. package/cabloy-docs/fullstack/tutorial-6-one-contract-four-uses.md +168 -0
  59. package/cabloy-docs/fullstack/tutorials-overview.md +179 -0
  60. package/cabloy-docs/index.md +4 -3
  61. package/cabloy-docs/reference/bean-scene-boilerplates.md +73 -0
  62. package/cabloy-docs/reference/cli-reference.md +2 -0
  63. package/package.json +6 -2
  64. package/scripts/init.ts +18 -2
  65. package/vona/packages-cli/cabloy-cli/package.json +2 -2
  66. package/vona/packages-cli/cli/package.json +1 -1
  67. package/vona/packages-cli/cli-set-api/package.json +1 -1
  68. package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.module.ts +4 -0
  69. package/vona/packages-vona/vona/package.json +1 -1
  70. package/vona/pnpm-lock.yaml +133 -1088
  71. package/vona/pnpm-workspace.yaml +0 -1
  72. package/vona/src/suite-vendor/a-vona/modules/a-core/assets/static/img/vona.svg +1 -1
  73. package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
  74. package/vona/src/suite-vendor/a-vona/modules/a-permission/package.json +1 -1
  75. package/vona/src/suite-vendor/a-vona/modules/a-permission/src/bean/bean.permission.ts +1 -1
  76. package/vona/src/suite-vendor/a-vona/modules/a-upload/package.json +2 -2
  77. package/vona/src/suite-vendor/a-vona/package.json +1 -1
  78. package/zova/package.original.json +1 -1
  79. package/zova/packages-cli/cli/package.json +3 -3
  80. package/zova/packages-cli/cli-set-front/cli/templates/init/icon/boilerplate/icons/default/zova.svg +1 -1
  81. package/zova/packages-cli/cli-set-front/package.json +3 -3
  82. package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.module.ts +4 -0
  83. package/zova/packages-cli/cli-set-front/src/lib/command/create.bean.ts +5 -1
  84. package/zova/packages-utils/zova-vite/package.json +2 -2
  85. package/zova/packages-zova/zova/package.json +2 -2
  86. package/zova/pnpm-lock.yaml +284 -1313
  87. package/zova/pnpm-workspace.yaml +0 -1
  88. package/zova/src/suite/a-home/modules/home-icon/icons/social/cabloy.svg +1 -1
  89. package/zova/src/suite/a-home/modules/home-icon/icons/social/vona.svg +1 -1
  90. package/zova/src/suite/a-home/modules/home-icon/icons/social/zova.svg +1 -1
  91. package/zova/src/suite/a-home/modules/home-icon/src/.metadata/icons/groups/social.svg +3 -3
  92. package/zova/src/suite/cabloy-basic/modules/basic-select/src/component/formFieldSelect/controller.tsx +9 -0
  93. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/package.json +1 -1
  94. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts +66 -16
  95. package/zova/src/suite-vendor/a-cabloy/package.json +2 -2
  96. package/zova/src/suite-vendor/a-zova/modules/a-routertabs/package.json +1 -1
  97. package/zova/src/suite-vendor/a-zova/modules/a-routertabs/src/model/tabs.ts +60 -18
  98. package/zova/src/suite-vendor/a-zova/modules/a-table/cli/tableActionRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
  99. package/zova/src/suite-vendor/a-zova/modules/a-table/cli/tableCell/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
  100. package/zova/src/suite-vendor/a-zova/modules/a-table/package.json +1 -1
  101. package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
  102. package/zova/src/suite-vendor/a-zova/package.json +4 -4
@@ -0,0 +1,372 @@
1
+ # Frontend Bean Scene Authoring
2
+
3
+ This guide explains the **advanced** Zova workflow for creating a **new frontend bean scene**.
4
+
5
+ This is not the same as creating one more bean inside an existing scene such as `api`, `model`, `service`, `controller`, or `render`.
6
+
7
+ For ordinary bean creation inside an existing scene, use the existing CLI workflow documented in [Frontend CLI](/frontend/cli) and the scene-specific frontend guides. This page is for framework extension work where you need to define a new scene contract.
8
+
9
+ ## When you need this guide
10
+
11
+ Use this guide when you need to extend the frontend bean system itself, for example:
12
+
13
+ - define a new decorator such as `@Something()`
14
+ - teach `:create:bean` how to scaffold that scene
15
+ - add new scene-level metadata behavior
16
+ - decide the scene’s container scope
17
+ - decide whether the scene should be isolated under its own folder
18
+
19
+ If you only need a new `api`, `model`, or `service` bean, you do **not** need this page.
20
+
21
+ ## Mental model
22
+
23
+ In Zova, a bean scene is not only a naming family. It also helps define runtime resolution behavior.
24
+
25
+ A frontend scene usually determines:
26
+
27
+ - which decorator marks the class
28
+ - which container scope the scene uses
29
+ - whether generated files go to `src/bean` or `src/<scene>/`
30
+ - whether generated bean typing lands in a general or local record surface
31
+ - whether scene-specific metadata generation runs
32
+
33
+ This is why frontend scene authoring must explain both **scene name** and **container scope** together.
34
+
35
+ ## The smallest built-in patterns
36
+
37
+ Representative built-in patterns are thin wrappers over `createBeanDecorator(...)`.
38
+
39
+ Examples:
40
+
41
+ ```typescript
42
+ export function Bean(): ClassDecorator {
43
+ return createBeanDecorator('bean', 'ctx');
44
+ }
45
+
46
+ export function Service(): ClassDecorator {
47
+ return createBeanDecorator('service', 'ctx');
48
+ }
49
+
50
+ export function Tool(): ClassDecorator {
51
+ return createBeanDecorator('tool', 'app');
52
+ }
53
+ ```
54
+
55
+ Some scenes also carry decorator options:
56
+
57
+ ```typescript
58
+ export function Model<T extends IDecoratorModelOptions>(options?: T): ClassDecorator {
59
+ return createBeanDecorator('model', 'ctx', true, options);
60
+ }
61
+ ```
62
+
63
+ This shows the first scene-authoring contract clearly:
64
+
65
+ - give the scene a stable scene name
66
+ - choose the container scope deliberately
67
+ - optionally support decorator options
68
+
69
+ ## The frontend authoring surfaces
70
+
71
+ A new frontend bean scene usually touches five surfaces.
72
+
73
+ ### 1. Decorator surface
74
+
75
+ Define the scene decorator and export it from the owning module.
76
+
77
+ Representative built-in decorators include:
78
+
79
+ - `@Bean()` -> `ctx`
80
+ - `@Service()` -> `ctx`
81
+ - `@Tool()` -> `app`
82
+ - `@Data()` -> `new`
83
+ - `@Api()` -> `app`
84
+ - `@Model()` -> `ctx`
85
+
86
+ This container choice is part of the scene contract, not only an implementation detail.
87
+
88
+ ### 2. Scene typing surface
89
+
90
+ Register the scene through declaration merging.
91
+
92
+ Representative pattern:
93
+
94
+ ```typescript
95
+ declare module 'zova' {
96
+ export interface IBeanSceneRecord {
97
+ api: never;
98
+ }
99
+ }
100
+ ```
101
+
102
+ Some scenes also extend module-specific type surfaces. For example, model contributes to `ConfigOnions` and to a service-like onion options surface in its owning module.
103
+
104
+ ### 3. Onion metadata surface
105
+
106
+ Register the scene in `package.json` under `zovaModule.onions`.
107
+
108
+ Representative built-in pattern:
109
+
110
+ ```json
111
+ {
112
+ "service": {
113
+ "sceneIsolate": true,
114
+ "beanGeneral": true,
115
+ "optionsNone": false,
116
+ "optionsGlobalInterfaceFrom": "zova-module-a-bean",
117
+ "boilerplate": "service/boilerplate"
118
+ }
119
+ }
120
+ ```
121
+
122
+ This metadata is one of the main contracts for both bean creation and metadata generation.
123
+
124
+ ### 4. CLI boilerplate and placement surface
125
+
126
+ The frontend `:create:bean` flow is scene-meta driven.
127
+
128
+ The command surface is:
129
+
130
+ ```bash
131
+ npm run zova :create:bean sceneName beanName -- --module=...
132
+ ```
133
+
134
+ The generator reads scene metadata and decides where the file lives:
135
+
136
+ - isolated scene -> `src/<scene>/`
137
+ - non-isolated scene -> `src/bean/`
138
+
139
+ The public Zova CLI help currently exposes `--module` for this command, while boilerplate selection itself comes from scene metadata.
140
+
141
+ That means placement and scaffolding are part of scene definition, not later manual preferences.
142
+
143
+ Representative built-in boilerplate:
144
+
145
+ ```typescript
146
+ import { BeanBase } from 'zova';
147
+ import { Bean } from 'zova-module-a-bean';
148
+
149
+ @Bean()
150
+ export class Bean<%=argv.beanNameCapitalize%> extends BeanBase {
151
+ protected async __init__() {}
152
+ }
153
+ ```
154
+
155
+ ### 5. Metadata generation surface
156
+
157
+ Frontend metadata generation is broader than simple file scaffolding.
158
+
159
+ The metadata flow scans frontend bean files and can generate:
160
+
161
+ - scene onion output
162
+ - scope resources
163
+ - bean typing in general or local record surfaces
164
+ - scene-specific custom metadata
165
+ - package and index side effects
166
+
167
+ That is why a new scene should be validated against generated `.metadata/index.ts`, not only against the decorator source.
168
+
169
+ ## How `zovaModule.onions` drives scene behavior
170
+
171
+ When authoring a scene, the most important design step is deciding the scene flags.
172
+
173
+ ### `sceneIsolate`
174
+
175
+ Use this when the scene should live in its own first-class folder such as `src/service/`.
176
+
177
+ If the flag is false, the generator normally places files under `src/bean/` using the `{scene}.{bean}` naming pattern.
178
+
179
+ ### `beanGeneral`
180
+
181
+ Use this when the scene’s generated bean records should land in `IBeanRecordGeneral` rather than `IBeanRecordLocal`.
182
+
183
+ A practical distinction is:
184
+
185
+ - `beanGeneral: true` -> generated bean records go to `IBeanRecordGeneral`
186
+ - `beanGeneral: false` -> generated bean records still exist, but they go to `IBeanRecordLocal`
187
+
188
+ ### `optionsNone`
189
+
190
+ Use this to describe whether the scene decorator has no options payload.
191
+
192
+ If the scene decorator accepts structured options, this should align with the real decorator shape.
193
+
194
+ ### `optionsGlobalInterfaceName` and `optionsGlobalInterfaceFrom`
195
+
196
+ Use these when the scene needs a shared interface contract for decorator options.
197
+
198
+ This is especially useful when the scene’s options must be visible beyond one local file.
199
+
200
+ ### `boilerplate`
201
+
202
+ Use this to tell the CLI which template should be used when a bean of the scene is created.
203
+
204
+ ### Multiple boilerplate variants
205
+
206
+ A frontend scene can also expose more than one named template.
207
+
208
+ A practical rule is:
209
+
210
+ - `boilerplate` provides the default template
211
+ - `--boilerplate=commandRow` maps to `boilerplateCommandRow`
212
+ - more generally, `--boilerplate=name` maps to `boilerplateName`
213
+
214
+ This is useful when one scene needs multiple scaffold shapes for distinct frontend authoring paths.
215
+
216
+ Representative built-in examples include the `command` scene, which exposes `commandBulk` and `commandRow` variants, and the `tableCell` scene, which exposes a `tableActionRow` variant in module metadata.
217
+
218
+ ### `metadataCustom`
219
+
220
+ Use this only when the scene needs additional generated output beyond the standard metadata passes.
221
+
222
+ A good rule is:
223
+
224
+ - start with the default metadata flow
225
+ - add custom metadata only when the scene has a real emitted contract that the default passes cannot express
226
+
227
+ ## Container-scope design is part of scene design
228
+
229
+ In Zova, the container scope is a core architectural decision.
230
+
231
+ Representative built-in scopes include:
232
+
233
+ - `sys`: system-level singleton-style behavior
234
+ - `app`: app-scoped shared behavior
235
+ - `ctx`: component-instance or local-context behavior
236
+ - `new`: fresh-instance behavior
237
+
238
+ Examples from built-in scenes:
239
+
240
+ - `@Sys()` -> `sys`
241
+ - `@Bean()` -> `ctx`
242
+ - `@Service()` -> `ctx`
243
+ - `@Tool()` -> `app`
244
+ - `@Data()` -> `new`
245
+ - `@Api()` -> `app`
246
+ - `@Model()` -> `ctx`
247
+
248
+ When adding a new scene, do not choose the scope cosmetically. The chosen scope affects how developers will resolve, share, and reason about that bean family.
249
+
250
+ ## Authoring flow for a new frontend scene
251
+
252
+ A practical Zova scene-authoring workflow is:
253
+
254
+ 1. choose the owning module for the scene
255
+ 2. decide the scene’s container scope
256
+ 3. add the scene decorator
257
+ 4. export it from the module `src/lib/index.ts`
258
+ 5. add the scene declaration-merging type and export it from `src/types/index.ts`
259
+ 6. add the scene under `zovaModule.onions`
260
+ 7. create the scene boilerplate for `:create:bean`
261
+ 8. add custom metadata generation if the scene needs extra emitted output
262
+ 9. run bean creation in a representative module
263
+ 10. inspect generated `.metadata/index.ts` and file placement
264
+ 11. only then write any additional scene-specific docs or business examples
265
+
266
+ ## What generated output should prove
267
+
268
+ A new scene is usually correct only if generated metadata proves the intended contract.
269
+
270
+ Depending on scene flags, inspect for output such as:
271
+
272
+ - scene registration in generated metadata
273
+ - scope resource output
274
+ - bean typing in the intended general or local record surface
275
+ - package/index export side effects
276
+ - correct placement under `src/bean` or `src/<scene>/`
277
+
278
+ A useful point from the current source is that metadata generation does more than emit one file. It also updates package and index surfaces so the module stays coherent.
279
+
280
+ If the generated metadata or placement does not match the intended design, fix the scene contract first rather than patching generated output manually.
281
+
282
+ ## A useful split: adding a scene vs adding a bean
283
+
284
+ Keep these two tasks separate.
285
+
286
+ ### Add a bean inside an existing scene
287
+
288
+ Example:
289
+
290
+ ```bash
291
+ npm run zova :create:bean model menu -- --module=demo-student
292
+ ```
293
+
294
+ This uses an already-defined scene.
295
+
296
+ ### Add a new scene
297
+
298
+ This requires framework extension work:
299
+
300
+ - new decorator
301
+ - new scene type registration
302
+ - new container-scope decision
303
+ - new onion metadata entry
304
+ - new boilerplate
305
+ - optional metadata generation
306
+
307
+ That is why this topic belongs in an advanced guide.
308
+
309
+ ## Design rules for new scenes
310
+
311
+ Before adding a scene, ask these questions.
312
+
313
+ ### Which container should own the scene?
314
+
315
+ This is the most important frontend-specific question.
316
+
317
+ Choose the scope based on the real sharing and lifecycle contract:
318
+
319
+ - `sys` for system-wide singleton behavior
320
+ - `app` for app-shared behavior
321
+ - `ctx` for local or component-context behavior
322
+ - `new` for fresh-instance behavior
323
+
324
+ ### Should the scene be isolated?
325
+
326
+ Choose an isolated scene when it deserves a first-class folder and operational identity.
327
+
328
+ Choose a non-isolated scene when it is better modeled as a bean-family variant under `src/bean`.
329
+
330
+ ### Should the scene use the general bean record surface?
331
+
332
+ Enable `beanGeneral` only when the scene should publish its generated bean records through `IBeanRecordGeneral` instead of the local record surface.
333
+
334
+ ### Does the scene need custom metadata?
335
+
336
+ Do not add custom metadata only because some built-in scenes do. Add it when the scene needs real emitted structures beyond the default metadata flow.
337
+
338
+ ## Relationship to existing guides
339
+
340
+ Read this guide together with:
341
+
342
+ - [IoC and Beans](/frontend/ioc-and-beans)
343
+ - [Frontend CLI](/frontend/cli)
344
+ - [API Guide](/frontend/api-guide)
345
+ - [Model Architecture](/frontend/model-architecture)
346
+ - [Model State Guide](/frontend/model-state-guide)
347
+ - [Page Guide](/frontend/page-guide)
348
+
349
+ Use the basic guides for normal bean creation. Use this page only when extending the scene system itself.
350
+
351
+ ## Verification checklist
352
+
353
+ When authoring or documenting a new frontend scene, verify in this order:
354
+
355
+ 1. confirm the CLI command shape still exists:
356
+
357
+ ```bash
358
+ npm run zova :create:bean --help
359
+ ```
360
+
361
+ 2. confirm the scene decorator, scene typing, container scope, and `zovaModule.onions` entry agree
362
+ 3. create a test bean in a representative module
363
+ 4. inspect whether the generated file goes to `src/bean/` or `src/<scene>/`
364
+ 5. inspect `src/.metadata/index.ts` in that module
365
+ 6. confirm scope-resource, typing, and package/index output match the design
366
+ 7. run the narrowest meaningful type or docs verification for the change
367
+
368
+ For repo-wide docs verification, also run:
369
+
370
+ ```bash
371
+ npm run docs:build
372
+ ```