@cratis/pi 7.14.1 → 7.14.3
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/package/corpus/agents/security-reviewer.md +2 -1
- package/package/corpus/rules/concepts.md +13 -7
- package/package/corpus/rules/glossary.md +2 -1
- package/package/corpus/rules/vertical-slices.md +5 -4
- package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +11 -2
- package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +8 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +10 -6
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +11 -7
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +12 -2
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +16 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +7 -0
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +9 -0
- package/package/corpus/skills/cratis-arc-command/SKILL.md +24 -16
- package/package/corpus/skills/cratis-arc-command/references/command-result.md +7 -0
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +10 -3
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +5 -1
- package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +12 -0
- package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +10 -3
- package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +20 -116
- package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +11 -8
- package/package/corpus/skills/cratis-arc-command-typescript/references/command-specifications.md +63 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +10 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +38 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +19 -0
- package/package/corpus/skills/cratis-arc-command-typescript/verification.json +1 -1
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +11 -10
- package/package/corpus/skills/cratis-arc-react-page/SKILL.md +30 -19
- package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/data-tables.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +12 -10
- package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/mvvm.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +7 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +58 -122
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +26 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +22 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +31 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +52 -131
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +19 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +73 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +29 -232
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +20 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +44 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/java-api.md +33 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +54 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +77 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +26 -102
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +23 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +63 -0
- package/package/corpus/skills/cratis-chronicle-compliance/SKILL.md +11 -2
- package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -13
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -4
- package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +10 -0
- package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +14 -6
- package/package/corpus/skills/cratis-chronicle-projection/references/variants.md +9 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +7 -49
- package/package/corpus/skills/cratis-chronicle-reactor/references/domain-failures.md +19 -0
- package/package/corpus/skills/cratis-chronicle-reactor/references/specifications.md +33 -0
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +11 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +1 -0
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +24 -24
- package/package/corpus/skills/cratis-content-length/SKILL.md +1 -1
- package/package/corpus/skills/cratis-content-length/references/length-evidence.md +12 -0
- package/package/corpus/skills/cratis-developer-marketing/SKILL.md +19 -19
- package/package/corpus/skills/cratis-developer-marketing/references/measurement.md +10 -0
- package/package/corpus/skills/cratis-developer-marketing/references/playbook-evidence.md +10 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +5 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/code-style.md +15 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +9 -4
- package/package/corpus/skills/cratis-engineering-decision-record/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-decision-record/references/record-format.md +8 -0
- package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +10 -0
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +4 -4
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +1 -1
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +18 -18
- package/package/corpus/skills/cratis-performance-review/SKILL.md +1 -1
- package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +29 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +16 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +4 -15
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +6 -2
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +1 -6
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +45 -245
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/capture-map-and-example.md +42 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +155 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/specifying-triggers-and-clock.md +27 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/trigger-reads-example.md +21 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +70 -221
- package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +10 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +51 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/inline-events.md +62 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +46 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/validate-rules.md +36 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +11 -11
- package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +10 -3
- package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +1 -6
- package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +13 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +8 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +11 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +7 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +75 -198
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/file-layout.md +89 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/naming-primitives.md +26 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +14 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +8 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +10 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/slice-type-rules.md +12 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +12 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +5 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/candidate-inventory.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +8 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +33 -10
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +8 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +13 -17
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +11 -0
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +9 -9
- package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +16 -1
- package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +9 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +17 -8
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +8 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +1 -6
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +19 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +1 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +11 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +2 -2
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +3 -4
- package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +8 -0
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +3 -3
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +1 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +1 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +10 -10
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +4 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +17 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +10 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +11 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +12 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +7 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +8 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +16 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +10 -0
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +52 -360
- package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md +34 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/concept-rules.md +77 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +39 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/reactions-and-cascades.md +72 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/worked-example.md +110 -0
- package/package/corpus/skills/cratis-screenplay-specifications/verification.json +6 -6
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +23 -3
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +13 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +3 -3
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +16 -20
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +16 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +13 -7
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +12 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/generated-responses-example.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +2 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +15 -5
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +11 -13
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +1 -1
- package/package/corpus/skills/cratis-security-review/SKILL.md +13 -8
- package/package/corpus/skills/cratis-social-feed-post/SKILL.md +10 -10
- package/package/corpus/skills/cratis-social-feed-post/references/engagement-evidence.md +12 -0
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +13 -2
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +10 -10
- package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +10 -0
- package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +9 -0
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +1 -2
- package/package/corpus/skills/cratis-specifications-typescript/references/typescript-patterns.md +11 -1
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +30 -21
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +9 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +5 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +2 -4
- package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +2 -2
- package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +39 -39
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/ai-tells.md +10 -0
- package/package.json +1 -1
|
@@ -36,10 +36,19 @@ Verified against `Cratis/Arc.TypeScript` `main` at commit `94d398d` (tag
|
|
|
36
36
|
Chronicle SDK: `@cratis/chronicle` peer `^6.7.0`; the Library sample pins
|
|
37
37
|
`6.14.0`. Fundamentals: `@cratis/fundamentals` `^7.19.6`.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Chronicle
|
|
42
|
-
|
|
39
|
+
Read [references/hosting-and-storage.md](references/hosting-and-storage.md) when setting up a host, using the Fetch entry, or wiring storage integrations. Read [references/chronicle-events.md](references/chronicle-events.md) when returning Chronicle events or specifying those commands.
|
|
40
|
+
|
|
41
|
+
## Chronicle traps
|
|
42
|
+
|
|
43
|
+
- Appending and projecting are separate: a query sent right after the command
|
|
44
|
+
may not see the event yet. Prefer an observable query on the client.
|
|
45
|
+
`completionTimeoutMs` makes the command wait for observers, but Chronicle waits
|
|
46
|
+
for **every** observer on the log (Cratis/Chronicle#4132), so a projection or
|
|
47
|
+
reactor that does not handle the event makes every command time out with 500.
|
|
48
|
+
|
|
49
|
+
- The in-memory scenario does **not** run projections, aggregates, constraints
|
|
50
|
+
or concurrency checks. `ChronicleKernelScenario` runs against a live kernel at
|
|
51
|
+
`ARC_CHRONICLE_TEST_URL` for those.
|
|
43
52
|
|
|
44
53
|
## Set up a project
|
|
45
54
|
|
|
@@ -129,23 +138,9 @@ local machine only.
|
|
|
129
138
|
|
|
130
139
|
## Lay out the slice
|
|
131
140
|
|
|
132
|
-
House convention (not a runtime requirement): one folder per behavior, one
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
Specs sit beside the slice in `for_<Subject>/when_<action>/<case>.ts`, which
|
|
136
|
-
`discover()` skips.
|
|
137
|
-
|
|
138
|
-
```text
|
|
139
|
-
Features/Tasks/
|
|
140
|
-
├── TaskId.ts
|
|
141
|
-
├── TaskTitle.ts
|
|
142
|
-
├── Tasks.ts
|
|
143
|
-
├── Registration/
|
|
144
|
-
│ ├── Registration.ts
|
|
145
|
-
│ └── for_RegisterTask/when_registering/with_valid_title.ts
|
|
146
|
-
└── Listing/
|
|
147
|
-
└── Listing.ts
|
|
148
|
-
```
|
|
141
|
+
House convention (not a runtime requirement): one folder per behavior, one TypeScript file holding the command, its validator and its events; specs in `for_<Subject>/when_<action>/`, which `discover()` skips.
|
|
142
|
+
|
|
143
|
+
Read [references/slice-layout.md](references/slice-layout.md) when creating a new feature folder.
|
|
149
144
|
|
|
150
145
|
## Declare the command
|
|
151
146
|
|
|
@@ -358,42 +353,9 @@ are in [references/chronicle-events.md](references/chronicle-events.md).
|
|
|
358
353
|
|
|
359
354
|
## Generate metadata and proxies
|
|
360
355
|
|
|
361
|
-
`arc-proxygenerator` (
|
|
362
|
-
reads the TypeScript source with the compiler API — it never queries a running
|
|
363
|
-
server. It writes server metadata and client proxies in one run. The CLI
|
|
364
|
-
rejects relative paths, and the output folder must exist:
|
|
365
|
-
|
|
366
|
-
```javascript
|
|
367
|
-
import { spawnSync } from 'node:child_process';
|
|
368
|
-
import { mkdirSync } from 'node:fs';
|
|
369
|
-
import process from 'node:process';
|
|
370
|
-
import { fileURLToPath } from 'node:url';
|
|
371
|
-
|
|
372
|
-
const path = relative => fileURLToPath(new URL(relative, import.meta.url));
|
|
373
|
-
const cli = fileURLToPath(new URL('./cli.js', import.meta.resolve('@cratis/arc.proxygenerator')));
|
|
374
|
-
mkdirSync(path('./generated'), { recursive: true });
|
|
375
|
-
const result = spawnSync(process.execPath, [cli,
|
|
376
|
-
'--project', path('./tsconfig.json'),
|
|
377
|
-
'--artifacts', path('./Features'),
|
|
378
|
-
'--output', path('./generated'),
|
|
379
|
-
'--metadata', path('./Features/generatedMetadata.ts'),
|
|
380
|
-
...process.argv.slice(2)], { stdio: 'inherit' });
|
|
381
|
-
process.exitCode = result.status ?? 1;
|
|
382
|
-
```
|
|
356
|
+
`arc-proxygenerator` (`@cratis/arc.proxygenerator`, unpublished) reads the TypeScript source and writes server metadata and client proxies in one run. Regenerate after **every** change to a command, read model or validator — `useGeneratedMetadata` throws `Stale generated artifact metadata for <Type>` otherwise — and gate CI with `--check-metadata`. Never edit the committed metadata module.
|
|
383
357
|
|
|
384
|
-
-
|
|
385
|
-
to a command, read model or validator — `useGeneratedMetadata` throws
|
|
386
|
-
`Stale generated artifact metadata for <Type>` otherwise. Reordering
|
|
387
|
-
parameters without changing their count goes undetected, so gate CI with
|
|
388
|
-
`--check-metadata` and keep `--watch` running beside `tsx` while developing.
|
|
389
|
-
- `--artifacts` must be the folder passed to `discover()`. Match route options
|
|
390
|
-
(`--api-prefix`, `--segments-to-skip`, `--root-namespace`) to the server's
|
|
391
|
-
`generatedApis` options, or proxies call URLs the server does not serve.
|
|
392
|
-
- Generated proxies import the **published** `@cratis/arc` and
|
|
393
|
-
`@cratis/arc.react` (the docs pin `22.19.1`) plus `@cratis/fundamentals`.
|
|
394
|
-
Compile them in `Bundler` resolution with `experimentalDecorators: true`, and
|
|
395
|
-
import `reflect-metadata` once in the frontend entry. Consuming the proxies in
|
|
396
|
-
React is `cratis-arc-react-page`.
|
|
358
|
+
Read [references/proxy-generation.md](references/proxy-generation.md) when wiring the generator script, matching route options to the server, or compiling the generated proxies in a frontend.
|
|
397
359
|
|
|
398
360
|
## Host the application
|
|
399
361
|
|
|
@@ -410,67 +372,9 @@ Start with a direct `handle()` call for pure command decisions, passing any
|
|
|
410
372
|
provided values explicitly. Add `CommandScenario` only where binding,
|
|
411
373
|
authorization, validation or dependency wiring contribute proof.
|
|
412
374
|
|
|
413
|
-
`@cratis/arc.testing` runs a command through the real pipeline in-process —
|
|
414
|
-
binding, authorization, validators, services, `provide()`, `handle()` — without
|
|
415
|
-
a listener. From `Samples/Tasks`:
|
|
416
|
-
|
|
417
|
-
```typescript
|
|
418
|
-
import { CommandScenario } from '@cratis/arc.testing';
|
|
419
|
-
import { Tasks } from '../../../Tasks.js';
|
|
420
|
-
import { RegisterTask, RegisterTaskValidator } from '../../Registration.js';
|
|
421
|
-
import { metadata } from '../../../../generatedMetadata.js';
|
|
422
|
-
|
|
423
|
-
export class a_task_registration {
|
|
424
|
-
tasks = new Tasks();
|
|
425
|
-
scenario = CommandScenario.for(RegisterTask, RegisterTaskValidator);
|
|
426
|
-
|
|
427
|
-
constructor() {
|
|
428
|
-
this.scenario.extend(builder => builder.useGeneratedMetadata(metadata));
|
|
429
|
-
this.scenario.services.addSingleton(Tasks, this.tasks);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
```typescript
|
|
435
|
-
import { given, type ScenarioCommandResult } from '@cratis/arc.testing';
|
|
436
|
-
import { TaskId } from '../../../TaskId.js';
|
|
437
|
-
import { TaskTitle } from '../../../TaskTitle.js';
|
|
438
|
-
import { a_task_registration } from '../given/a_task_registration.js';
|
|
439
|
-
|
|
440
|
-
describe('when registering a task with a valid title', given(a_task_registration, context => {
|
|
441
|
-
const id = TaskId.create();
|
|
442
|
-
let result: ScenarioCommandResult;
|
|
443
|
-
|
|
444
|
-
beforeAll(async () => {
|
|
445
|
-
result = await context.scenario.execute({ id, title: new TaskTitle('Plan release') });
|
|
446
|
-
});
|
|
447
|
-
afterAll(async () => { await context.scenario.dispose(); });
|
|
448
|
-
|
|
449
|
-
it('should succeed through the command pipeline', () => { result.shouldBeSuccessful(); });
|
|
450
|
-
}));
|
|
451
|
-
```
|
|
375
|
+
`CommandScenario` from `@cratis/arc.testing` runs a command through the real pipeline in-process, without a listener. Register fakes on `scenario.services` before the first call, create one context per `describe` (act in `beforeAll`, dispose in `afterAll`), and specify authorization for three callers — anonymous, without the role, with it — and on `validate()` too.
|
|
452
376
|
|
|
453
|
-
- `CommandScenario
|
|
454
|
-
artifacts the command needs; it cannot discover classes that were never
|
|
455
|
-
imported.
|
|
456
|
-
- Register fakes on `scenario.services` **before** the first call.
|
|
457
|
-
`extend(builder => ...)` installs builder setup such as generated metadata.
|
|
458
|
-
- `execute(values)` runs everything; `validate(values)` stops before
|
|
459
|
-
`provide()`/`handle()`. `withContext({ principal, tenantId, correlationId })`
|
|
460
|
-
sets a trusted caller.
|
|
461
|
-
- `given(Context, ...)` creates **one** context per `describe`: act in
|
|
462
|
-
`beforeAll`, dispose in `afterAll`. A disposed scenario cannot run again.
|
|
463
|
-
- Assertions on the result: `shouldBeSuccessful()`, `shouldNotBeSuccessful()`,
|
|
464
|
-
`shouldBeValid()`, `shouldHaveValidationErrors()`,
|
|
465
|
-
`shouldHaveValidationErrorForMember(member)`, `shouldHaveValidationErrorFor(text)`,
|
|
466
|
-
`shouldHaveValidationErrorBecauseOf(reason)`, `shouldBeAuthorized()`,
|
|
467
|
-
`shouldNotBeAuthorized()`, `shouldHaveExceptions()`, `shouldNotHaveExceptions()`.
|
|
468
|
-
Do not assert presentation text by default; assert exact wording only when it
|
|
469
|
-
is the specified behavior, named in the fact. A text-matching helper alone
|
|
470
|
-
does not prove exact equality; compare the actual message when equality is
|
|
471
|
-
the requirement.
|
|
472
|
-
- Specify authorization for three callers — anonymous, without the role, with
|
|
473
|
-
it — and on `validate()` too.
|
|
377
|
+
Read [references/command-specifications.md](references/command-specifications.md) when writing a `CommandScenario` spec, choosing result assertions, or setting up the scenario context.
|
|
474
378
|
|
|
475
379
|
Folder and naming conventions for specs are `cratis-specifications-typescript`.
|
|
476
380
|
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Returning Chronicle events from an Arc for TypeScript command
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Register the integration
|
|
6
|
+
- What `handle()` may return
|
|
7
|
+
- The event source
|
|
8
|
+
- Routing defaults and concurrency
|
|
9
|
+
- Rejections and the batch
|
|
10
|
+
- Read current state in the command
|
|
11
|
+
- Reactors that return commands
|
|
12
|
+
- Specify it without a kernel
|
|
13
|
+
|
|
3
14
|
Verified against `Cratis/Arc.TypeScript` `main` at commit `94d398d` (tag
|
|
4
15
|
`v0.33.0` plus three commits): `Documentation/chronicle/**`,
|
|
5
16
|
`Documentation/testing/chronicle.md`, `Source/Chronicle/index.ts`, and
|
|
@@ -88,11 +99,6 @@ sample's `UniqueAuthorName` does).
|
|
|
88
99
|
exception, because Arc cannot tell what was stored.
|
|
89
100
|
- An SDK `eventLog.append(...)` inside `handle()` is outside the batch. Return
|
|
90
101
|
events instead.
|
|
91
|
-
- Appending and projecting are separate: a query sent right after the command
|
|
92
|
-
may not see the event yet. Prefer an observable query on the client.
|
|
93
|
-
`completionTimeoutMs` makes the command wait for observers, but Chronicle waits
|
|
94
|
-
for **every** observer on the log (Cratis/Chronicle#4132), so a projection or
|
|
95
|
-
reactor that does not handle the event makes every command time out with 500.
|
|
96
102
|
|
|
97
103
|
## Read current state in the command
|
|
98
104
|
|
|
@@ -136,6 +142,3 @@ await scenario.dispose();
|
|
|
136
142
|
6.14.0 or later).
|
|
137
143
|
- `shouldHaveAppendedEvent` does not check count or order — assert
|
|
138
144
|
`appendedEvents` when either matters.
|
|
139
|
-
- The in-memory scenario does **not** run projections, aggregates, constraints
|
|
140
|
-
or concurrency checks. `ChronicleKernelScenario` runs against a live kernel at
|
|
141
|
-
`ARC_CHRONICLE_TEST_URL` for those.
|
package/package/corpus/skills/cratis-arc-command-typescript/references/command-specifications.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
## Specify the command with CommandScenario
|
|
2
|
+
|
|
3
|
+
`@cratis/arc.testing` runs a command through the real pipeline in-process —
|
|
4
|
+
binding, authorization, validators, services, `provide()`, `handle()` — without
|
|
5
|
+
a listener. From `Samples/Tasks`:
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { CommandScenario } from '@cratis/arc.testing';
|
|
9
|
+
import { Tasks } from '../../../Tasks.js';
|
|
10
|
+
import { RegisterTask, RegisterTaskValidator } from '../../Registration.js';
|
|
11
|
+
import { metadata } from '../../../../generatedMetadata.js';
|
|
12
|
+
|
|
13
|
+
export class a_task_registration {
|
|
14
|
+
tasks = new Tasks();
|
|
15
|
+
scenario = CommandScenario.for(RegisterTask, RegisterTaskValidator);
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
this.scenario.extend(builder => builder.useGeneratedMetadata(metadata));
|
|
19
|
+
this.scenario.services.addSingleton(Tasks, this.tasks);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { given, type ScenarioCommandResult } from '@cratis/arc.testing';
|
|
26
|
+
import { TaskId } from '../../../TaskId.js';
|
|
27
|
+
import { TaskTitle } from '../../../TaskTitle.js';
|
|
28
|
+
import { a_task_registration } from '../given/a_task_registration.js';
|
|
29
|
+
|
|
30
|
+
describe('when registering a task with a valid title', given(a_task_registration, context => {
|
|
31
|
+
const id = TaskId.create();
|
|
32
|
+
let result: ScenarioCommandResult;
|
|
33
|
+
|
|
34
|
+
beforeAll(async () => {
|
|
35
|
+
result = await context.scenario.execute({ id, title: new TaskTitle('Plan release') });
|
|
36
|
+
});
|
|
37
|
+
afterAll(async () => { await context.scenario.dispose(); });
|
|
38
|
+
|
|
39
|
+
it('should succeed through the command pipeline', () => { result.shouldBeSuccessful(); });
|
|
40
|
+
}));
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- `CommandScenario.for(Command, ...artifacts)` — pass the validators and other
|
|
44
|
+
artifacts the command needs; it cannot discover classes that were never
|
|
45
|
+
imported.
|
|
46
|
+
- Register fakes on `scenario.services` **before** the first call.
|
|
47
|
+
`extend(builder => ...)` installs builder setup such as generated metadata.
|
|
48
|
+
- `execute(values)` runs everything; `validate(values)` stops before
|
|
49
|
+
`provide()`/`handle()`. `withContext({ principal, tenantId, correlationId })`
|
|
50
|
+
sets a trusted caller.
|
|
51
|
+
- `given(Context, ...)` creates **one** context per `describe`: act in
|
|
52
|
+
`beforeAll`, dispose in `afterAll`. A disposed scenario cannot run again.
|
|
53
|
+
- Assertions on the result: `shouldBeSuccessful()`, `shouldNotBeSuccessful()`,
|
|
54
|
+
`shouldBeValid()`, `shouldHaveValidationErrors()`,
|
|
55
|
+
`shouldHaveValidationErrorForMember(member)`, `shouldHaveValidationErrorFor(text)`,
|
|
56
|
+
`shouldHaveValidationErrorBecauseOf(reason)`, `shouldBeAuthorized()`,
|
|
57
|
+
`shouldNotBeAuthorized()`, `shouldHaveExceptions()`, `shouldNotHaveExceptions()`.
|
|
58
|
+
Do not assert presentation text by default; assert exact wording only when it
|
|
59
|
+
is the specified behavior, named in the fact. A text-matching helper alone
|
|
60
|
+
does not prove exact equality; compare the actual message when equality is
|
|
61
|
+
the requirement.
|
|
62
|
+
- Specify authorization for three callers — anonymous, without the role, with
|
|
63
|
+
it — and on `validate()` too.
|
package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Hosting and storage for Arc for TypeScript
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- The host only delivers requests
|
|
6
|
+
- Express
|
|
7
|
+
- Fastify
|
|
8
|
+
- Hono
|
|
9
|
+
- Fetch API entry
|
|
10
|
+
- Observable-query WebSockets from a dev server
|
|
11
|
+
- Storage integrations
|
|
12
|
+
|
|
3
13
|
Verified against `Cratis/Arc.TypeScript` `main` at commit `94d398d` (tag
|
|
4
14
|
`v0.33.0` plus three commits): `Documentation/overview.md`, `hosts/**`,
|
|
5
15
|
`mongodb/getting-started.md`, `sql/getting-started.md`,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Generate metadata and proxies
|
|
2
|
+
|
|
3
|
+
`arc-proxygenerator` (package `@cratis/arc.proxygenerator`, also unpublished)
|
|
4
|
+
reads the TypeScript source with the compiler API — it never queries a running
|
|
5
|
+
server. It writes server metadata and client proxies in one run. The CLI
|
|
6
|
+
rejects relative paths, and the output folder must exist:
|
|
7
|
+
|
|
8
|
+
```javascript
|
|
9
|
+
import { spawnSync } from 'node:child_process';
|
|
10
|
+
import { mkdirSync } from 'node:fs';
|
|
11
|
+
import process from 'node:process';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
|
|
14
|
+
const path = relative => fileURLToPath(new URL(relative, import.meta.url));
|
|
15
|
+
const cli = fileURLToPath(new URL('./cli.js', import.meta.resolve('@cratis/arc.proxygenerator')));
|
|
16
|
+
mkdirSync(path('./generated'), { recursive: true });
|
|
17
|
+
const result = spawnSync(process.execPath, [cli,
|
|
18
|
+
'--project', path('./tsconfig.json'),
|
|
19
|
+
'--artifacts', path('./Features'),
|
|
20
|
+
'--output', path('./generated'),
|
|
21
|
+
'--metadata', path('./Features/generatedMetadata.ts'),
|
|
22
|
+
...process.argv.slice(2)], { stdio: 'inherit' });
|
|
23
|
+
process.exitCode = result.status ?? 1;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- Commit the metadata module; never edit it. Regenerate after **every** change
|
|
27
|
+
to a command, read model or validator — `useGeneratedMetadata` throws
|
|
28
|
+
`Stale generated artifact metadata for <Type>` otherwise. Reordering
|
|
29
|
+
parameters without changing their count goes undetected, so gate CI with
|
|
30
|
+
`--check-metadata` and keep `--watch` running beside `tsx` while developing.
|
|
31
|
+
- `--artifacts` must be the folder passed to `discover()`. Match route options
|
|
32
|
+
(`--api-prefix`, `--segments-to-skip`, `--root-namespace`) to the server's
|
|
33
|
+
`generatedApis` options, or proxies call URLs the server does not serve.
|
|
34
|
+
- Generated proxies import the **published** `@cratis/arc` and
|
|
35
|
+
`@cratis/arc.react` (the docs pin `22.19.1`) plus `@cratis/fundamentals`.
|
|
36
|
+
Compile them in `Bundler` resolution with `experimentalDecorators: true`, and
|
|
37
|
+
import `reflect-metadata` once in the frontend entry. Consuming the proxies in
|
|
38
|
+
React is `cratis-arc-react-page`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## Lay out the slice
|
|
2
|
+
|
|
3
|
+
House convention (not a runtime requirement): one folder per behavior, one
|
|
4
|
+
TypeScript file named for the behavior holding the command, its validator and —
|
|
5
|
+
for Chronicle — its events. Concepts shared by several slices live one level up.
|
|
6
|
+
Specs sit beside the slice in `for_<Subject>/when_<action>/<case>.ts`, which
|
|
7
|
+
`discover()` skips.
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
Features/Tasks/
|
|
11
|
+
├── TaskId.ts
|
|
12
|
+
├── TaskTitle.ts
|
|
13
|
+
├── Tasks.ts
|
|
14
|
+
├── Registration/
|
|
15
|
+
│ ├── Registration.ts
|
|
16
|
+
│ └── for_RegisterTask/when_registering/with_valid_title.ts
|
|
17
|
+
└── Listing/
|
|
18
|
+
└── Listing.ts
|
|
19
|
+
```
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
{ "kind": "skill-contains", "value": "Authorization belongs on the **class**." },
|
|
11
11
|
{ "kind": "skill-contains", "value": "is created through its **constructor** in `handle()`" },
|
|
12
12
|
{ "kind": "skill-contains", "value": "`--check-metadata`" },
|
|
13
|
-
{ "kind": "skill-contains", "value": "CommandScenario.for(RegisterTask, RegisterTaskValidator)" }
|
|
13
|
+
{ "kind": "skill-contains", "value": "CommandScenario.for(RegisterTask, RegisterTaskValidator)", "file": "references/command-specifications.md" }
|
|
14
14
|
]
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-arc-command-validation
|
|
3
|
-
description: Add a rejection rule to an existing Arc command — choosing between ConceptValidator, CommandValidator, a short-circuiting Provide, and a read-model-injected Handle returning Result
|
|
3
|
+
description: Add a rejection rule to an existing Arc command — choosing between ConceptValidator, CommandValidator, a short-circuiting Provide, and a read-model-injected Handle returning a Result of either the event or a ValidationResult. Use when a command must refuse work under some condition. Do not use to define a new command, and do not use for append-time Chronicle constraints.
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -9,6 +9,17 @@ license: MIT
|
|
|
9
9
|
Arc applies paging and sorting for you. You never write `Skip`/`Take` or read
|
|
10
10
|
the query string — you choose a **return shape** that the framework can narrow.
|
|
11
11
|
|
|
12
|
+
- An accepted `.play` model under the model root covers the behavior, or the
|
|
13
|
+
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
14
|
+
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
15
|
+
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
16
|
+
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
17
|
+
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
18
|
+
say so and do not author `.play` from memory.
|
|
19
|
+
Edit code here only for infrastructure, clients, adapters, Screenplay code
|
|
20
|
+
attachments, or gap-fill scope (`cratis-screenplay-render-and-gap-fill`);
|
|
21
|
+
never edit Stage-managed output.
|
|
22
|
+
|
|
12
23
|
## Verified product sources
|
|
13
24
|
|
|
14
25
|
| Package | Version | Purpose |
|
|
@@ -181,13 +192,3 @@ pinning, keep it in a method a specification can supply arguments to.
|
|
|
181
192
|
- Creating the read model or its projection: the Chronicle read-model guidance.
|
|
182
193
|
- Inspecting an observable query over HTTP: `cratis-arc-observable-query-http`.
|
|
183
194
|
- Whole-slice performance work: the performance review guidance.
|
|
184
|
-
- An accepted `.play` model under the model root covers the behavior, or the
|
|
185
|
-
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
186
|
-
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
187
|
-
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
188
|
-
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
189
|
-
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
190
|
-
say so and do not author `.play` from memory.
|
|
191
|
-
Edit code here only for infrastructure, clients, adapters, Screenplay code
|
|
192
|
-
attachments, or gap-fill scope (`cratis-screenplay-render-and-gap-fill`);
|
|
193
|
-
never edit Stage-managed output.
|
|
@@ -9,6 +9,19 @@ license: MIT
|
|
|
9
9
|
Build the page from the generated Arc proxies and the Cratis Components
|
|
10
10
|
wrappers. Do not hand-roll a table, a dialog, or a fetch.
|
|
11
11
|
|
|
12
|
+
- An accepted `.play` model under the model root covers the behavior, or the
|
|
13
|
+
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
14
|
+
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
15
|
+
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
16
|
+
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
17
|
+
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
18
|
+
say so and do not author `.play` from memory.
|
|
19
|
+
Read the model's `screen` and `form` with
|
|
20
|
+
[from-screenplay.md](references/from-screenplay.md). Edit code here only for
|
|
21
|
+
infrastructure, clients, adapters, Screenplay code attachments, or gap-fill
|
|
22
|
+
scope (`cratis-screenplay-render-and-gap-fill`); never edit Stage-managed
|
|
23
|
+
output.
|
|
24
|
+
|
|
12
25
|
## Verified product sources
|
|
13
26
|
|
|
14
27
|
This skill is verified against these exact package contracts:
|
|
@@ -38,6 +51,16 @@ import { Dialog } from '@cratis/components/Dialogs';
|
|
|
38
51
|
import { DialogProps, DialogResult, useDialog } from '@cratis/arc.react/dialogs';
|
|
39
52
|
```
|
|
40
53
|
|
|
54
|
+
## Initial focus
|
|
55
|
+
|
|
56
|
+
`DialogInitialFocus.Confirm` is the default and *arms* the confirm button — a
|
|
57
|
+
browser fires `click` from the `keydown` of Enter, so a held Enter confirms.
|
|
58
|
+
For a destructive dialog use `DialogInitialFocus.Cancel`, which focuses the
|
|
59
|
+
least destructive action and degrades to `Content` when the button set has
|
|
60
|
+
nothing to dismiss with. `DialogInitialFocus.Content` focuses the title so
|
|
61
|
+
nothing is armed. There is deliberately no "focus nothing" option — a modal
|
|
62
|
+
must move focus into itself.
|
|
63
|
+
|
|
41
64
|
## Step 1 — Prerequisites
|
|
42
65
|
|
|
43
66
|
- The backend query and command must already exist, and a Debug build must have
|
|
@@ -112,7 +135,7 @@ compound members; `MenuItem` and `Column` are also **named exports** of the
|
|
|
112
135
|
subpath (there is no `DataPage.Column`). Pass `dataKey` whenever the read model has an
|
|
113
136
|
identity.
|
|
114
137
|
|
|
115
|
-
|
|
138
|
+
Read [data-page.md](references/data-page.md) when configuring DataPage props; it lists every prop, and
|
|
116
139
|
[data-tables.md](references/data-tables.md) when you need a table without the
|
|
117
140
|
page chrome.
|
|
118
141
|
|
|
@@ -142,8 +165,8 @@ const [CreateAccountWrapper, showCreateAccount] = useDialog(CreateAccountDialog)
|
|
|
142
165
|
<CreateAccountWrapper />
|
|
143
166
|
```
|
|
144
167
|
|
|
145
|
-
Render the wrapper returned by `useDialog` once in the tree.
|
|
146
|
-
[dialogs.md](references/dialogs.md)
|
|
168
|
+
Render the wrapper returned by `useDialog` once in the tree. Read
|
|
169
|
+
[dialogs.md](references/dialogs.md) when implementing dialog opening, closing, input, response, validation, or focus behavior; it gives the full dialog contract.
|
|
147
170
|
|
|
148
171
|
## Step 5 — Command dialogs
|
|
149
172
|
|
|
@@ -248,7 +271,7 @@ and picks the snapshot or observable table itself. Pass an observable query and
|
|
|
248
271
|
the page stays live; pass a snapshot query and call `onRefresh` after a command
|
|
249
272
|
succeeds.
|
|
250
273
|
|
|
251
|
-
Read [queries-and-commands.md](references/queries-and-commands.md)
|
|
274
|
+
Read [queries-and-commands.md](references/queries-and-commands.md) when using generated proxy hooks, implementing paging, or handling command results; it covers the
|
|
252
275
|
generated proxy hooks, their exact return tuples, paging, and how to read a
|
|
253
276
|
command result.
|
|
254
277
|
|
|
@@ -280,8 +303,8 @@ export const AccountsPage = withViewModel(AccountsViewModel, ({ viewModel }) =>
|
|
|
280
303
|
```
|
|
281
304
|
|
|
282
305
|
`withViewModel` applies `makeAutoObservable` itself — do not call it in the
|
|
283
|
-
constructor.
|
|
284
|
-
props handling,
|
|
306
|
+
constructor. Read [mvvm.md](references/mvvm.md) when implementing view-model injection, route parameters,
|
|
307
|
+
props handling, or teardown.
|
|
285
308
|
|
|
286
309
|
## Quick decision guide
|
|
287
310
|
|
|
@@ -336,19 +359,7 @@ props handling, and teardown.
|
|
|
336
359
|
- The backend command or read model behind the page: `cratis-arc-command`,
|
|
337
360
|
`cratis-chronicle-read-model`.
|
|
338
361
|
- Specifying page behavior with specs: `cratis-application-react-specifications`.
|
|
339
|
-
- An accepted `.play` model under the model root covers the behavior, or the
|
|
340
|
-
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
341
|
-
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
342
|
-
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
343
|
-
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
344
|
-
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
345
|
-
say so and do not author `.play` from memory.
|
|
346
|
-
Read the model's `screen` and `form` with
|
|
347
|
-
[from-screenplay.md](references/from-screenplay.md). Edit code here only for
|
|
348
|
-
infrastructure, clients, adapters, Screenplay code attachments, or gap-fill
|
|
349
|
-
scope (`cratis-screenplay-render-and-gap-fill`); never edit Stage-managed
|
|
350
|
-
output.
|
|
351
362
|
|
|
352
363
|
## Lineage
|
|
353
364
|
|
|
354
|
-
|
|
365
|
+
Read [references/provenance.md](references/provenance.md) when checking source attribution or adaptation permissions.
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# DataPage reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Compound members
|
|
6
|
+
- `DataPageProps`
|
|
7
|
+
- Snapshot versus observable
|
|
8
|
+
- `MenuItemProps`
|
|
9
|
+
- `IDetailsComponentProps<TDataType>`
|
|
10
|
+
- `Column`
|
|
11
|
+
- Type name caution
|
|
12
|
+
- Layout
|
|
13
|
+
|
|
3
14
|
`DataPage` is the standard list page: an action menubar, a data table, and an
|
|
4
15
|
optional details pane in one component. Import from
|
|
5
16
|
`@cratis/components/DataPage`.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Data tables reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Pick the component by query kind
|
|
6
|
+
- Shared props
|
|
7
|
+
- Paging, sorting and filtering scope
|
|
8
|
+
- Selection event
|
|
9
|
+
- Column filtering
|
|
10
|
+
- Filter state shape
|
|
11
|
+
- Custom match modes
|
|
12
|
+
|
|
3
13
|
Use a standalone table when you need query-backed rows **without** the
|
|
4
14
|
`DataPage` chrome — embedded in a panel, a card, or a dialog. Import from
|
|
5
15
|
`@cratis/components/DataTables`.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Dialogs reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Choose the dialog
|
|
6
|
+
- Opening a dialog
|
|
7
|
+
- The enums
|
|
8
|
+
- `CommandDialog`
|
|
9
|
+
- `CommandForm` fields
|
|
10
|
+
- `Dialog` — data without a command
|
|
11
|
+
- Host-registered confirmation and busy indicators
|
|
12
|
+
|
|
3
13
|
The Cratis dialog wrappers own command execution, validation timing, busy
|
|
4
14
|
state, and footer buttons. Never use a vendor or hand-rolled modal — dialogs are Components-owned.
|
|
5
15
|
|
|
@@ -221,20 +231,12 @@ const handleConfirm = async (): Promise<boolean> => {
|
|
|
221
231
|
`onClose(result)` is the combined handler for both outcomes and closes unless it
|
|
222
232
|
returns `false`.
|
|
223
233
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
`DialogInitialFocus.Confirm` is the default and *arms* the confirm button — a
|
|
227
|
-
browser fires `click` from the `keydown` of Enter, so a held Enter confirms.
|
|
228
|
-
For a destructive dialog use `DialogInitialFocus.Cancel`, which focuses the
|
|
229
|
-
least destructive action and degrades to `Content` when the button set has
|
|
230
|
-
nothing to dismiss with. `DialogInitialFocus.Content` focuses the title so
|
|
231
|
-
nothing is armed. There is deliberately no "focus nothing" option — a modal
|
|
232
|
-
must move focus into itself.
|
|
234
|
+
See "Initial focus" in SKILL.md.
|
|
233
235
|
|
|
234
236
|
## Host-registered confirmation and busy indicators
|
|
235
237
|
|
|
236
238
|
`ConfirmationDialog` takes no props at all; it reads its title, message, and
|
|
237
239
|
buttons from the dialog request. `BusyIndicatorDialog` takes the busy-indicator
|
|
238
240
|
request. Register both once at the app root through `DialogComponents` and
|
|
239
|
-
raise them by hook — see the skill's
|
|
241
|
+
raise them by hook — see the skill's Step 6. From a view model, use the
|
|
240
242
|
injectable `IDialogs` abstraction instead of the hooks.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# From a Screenplay model to an Arc React page
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- What is verified, and what is not
|
|
6
|
+
- Worked model
|
|
7
|
+
- Level 1 and 2: `screen`
|
|
8
|
+
- `form` and `field`
|
|
9
|
+
- Interactions: `on`, `uses`, `behavior`
|
|
10
|
+
- Reconcile before you finish
|
|
11
|
+
- Verify
|
|
12
|
+
|
|
3
13
|
Use this when the page you are asked to build, or change, is described by a
|
|
4
14
|
`screen` or `form` in a `.play` model. The model is the specification; the page
|
|
5
15
|
is how that specification looks in React. Read the model first, build the page
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# MVVM reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- When to use it
|
|
6
|
+
- Setup
|
|
7
|
+
- The view model
|
|
8
|
+
- `withViewModel`
|
|
9
|
+
- Props, route parameters, and query parameters
|
|
10
|
+
- Injectable abstractions
|
|
11
|
+
- `observer`
|
|
12
|
+
- Testing
|
|
13
|
+
|
|
3
14
|
The Arc MVVM layer keeps page logic in plain TypeScript classes and leaves the
|
|
4
15
|
component declarative. `@cratis/arc.react.mvvm` builds on tsyringe for
|
|
5
16
|
injection and MobX for reactivity.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Queries and commands reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Query proxy hooks
|
|
6
|
+
- Observable query transport
|
|
7
|
+
- Command proxy
|
|
8
|
+
- `<Arc>` configuration
|
|
9
|
+
|
|
3
10
|
A Debug build generates one typed proxy class per query and per command. The
|
|
4
11
|
proxy exposes static React hooks; the page calls those. Never edit a generated
|
|
5
12
|
file — fix the C# source and rebuild.
|