@cratis/pi 8.7.0 → 8.8.0
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/skills/cratis-arc-migrate-relational-schema/SKILL.md +2 -0
- package/package/corpus/skills/cratis-arc-migrate-relational-schema/references/provenance.md +11 -0
- package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +2 -0
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/provenance.md +15 -0
- package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +2 -0
- package/package/corpus/skills/cratis-event-model-diagram/references/provenance.md +16 -0
- package/package/corpus/skills/cratis-modeling-design-event-model/LICENSE +18 -0
- package/package/corpus/skills/cratis-modeling-design-event-model/SKILL.md +9 -4
- package/package/corpus/skills/cratis-modeling-design-event-model/references/modeling-discipline.md +71 -0
- package/package/corpus/skills/cratis-modeling-design-event-model/references/provenance.md +39 -0
- package/package/corpus/skills/cratis-modeling-discover-timeline/LICENSE +14 -0
- package/package/corpus/skills/cratis-modeling-discover-timeline/SKILL.md +8 -2
- package/package/corpus/skills/cratis-modeling-discover-timeline/references/discovery-questions.md +28 -0
- package/package/corpus/skills/cratis-modeling-discover-timeline/references/provenance.md +22 -0
- package/package/corpus/skills/cratis-modeling-discover-timeline/references/story-retelling.md +66 -0
- package/package/corpus/skills/cratis-modeling-review-event-model/LICENSE +17 -0
- package/package/corpus/skills/cratis-modeling-review-event-model/SKILL.md +11 -0
- package/package/corpus/skills/cratis-modeling-review-event-model/references/business-review.md +58 -0
- package/package/corpus/skills/cratis-modeling-review-event-model/references/event-log-hygiene.md +1 -1
- package/package/corpus/skills/cratis-modeling-review-event-model/references/provenance.md +15 -0
- package/package/corpus/skills/cratis-modeling-review-event-model/references/resilience-review.md +27 -2
- package/package/corpus/skills/cratis-modeling-review-event-model/references/structural-shapes.md +33 -0
- package/package/corpus/skills/cratis-modeling-trace-existing-behavior/LICENSE +11 -0
- package/package/corpus/skills/cratis-modeling-trace-existing-behavior/SKILL.md +19 -15
- package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/provenance.md +18 -0
- package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/reading-lenses.md +76 -0
- package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/resuming-a-trace.md +12 -0
- package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +2 -0
- package/package/corpus/skills/cratis-platform-deliver-slice/references/provenance.md +16 -0
- package/package/corpus/skills/cratis-screenplay-handoff-slice/SKILL.md +2 -0
- package/package/corpus/skills/cratis-screenplay-handoff-slice/references/provenance.md +18 -0
- package/package/corpus/skills/cratis-screenplay-model-automation/LICENSE +14 -0
- package/package/corpus/skills/cratis-screenplay-model-automation/SKILL.md +8 -4
- package/package/corpus/skills/cratis-screenplay-model-automation/references/provenance.md +25 -0
- package/package/corpus/skills/cratis-screenplay-model-automation/references/reaction-boundaries.md +2 -2
- package/package/corpus/skills/cratis-screenplay-model-automation/references/statemachines-and-workflows.md +3 -1
- package/package/corpus/skills/cratis-screenplay-model-automation/references/to-do-lists.md +186 -0
- package/package/corpus/skills/cratis-screenplay-model-interaction/LICENSE +14 -0
- package/package/corpus/skills/cratis-screenplay-model-interaction/SKILL.md +16 -12
- package/package/corpus/skills/cratis-screenplay-model-interaction/references/provenance.md +42 -0
- package/package/corpus/skills/cratis-screenplay-model-interaction/references/screen-design.md +212 -0
- package/package/corpus/skills/cratis-screenplay-model-translation/SKILL.md +3 -1
- package/package/corpus/skills/cratis-screenplay-model-translation/references/provenance.md +14 -0
- package/package/corpus/skills/cratis-screenplay-model-translation/references/webhook-contract.md +22 -0
- package/package/corpus/skills/cratis-screenplay-recover-intent/LICENSE +11 -0
- package/package/corpus/skills/cratis-screenplay-recover-intent/SKILL.md +3 -0
- package/package/corpus/skills/cratis-screenplay-recover-intent/references/provenance.md +16 -0
- package/package/corpus/skills/cratis-screenplay-recover-intent/references/running-system.md +5 -2
- package/package/corpus/skills/cratis-screenplay-specify-outcome/LICENSE +13 -0
- package/package/corpus/skills/cratis-screenplay-specify-outcome/SKILL.md +10 -5
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/case-questions.md +1 -1
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/coverage-worksheet.md +23 -0
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/provenance.md +15 -0
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/scenario-discipline.md +126 -0
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/scenario-narrative.md +61 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +2 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/provenance.md +18 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +2 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/provenance.md +15 -0
- package/package.json +1 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Model a process over time as a to-do list
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- The shape
|
|
6
|
+
- Rules for the list
|
|
7
|
+
- Rules for the automation
|
|
8
|
+
- Waits, approvals and deadlines
|
|
9
|
+
- When a second automation is redundant
|
|
10
|
+
- Translation needs no to-do list
|
|
11
|
+
- Example: a to-do list an automation drains
|
|
12
|
+
- What the example proves
|
|
13
|
+
|
|
14
|
+
A process that runs over time is modeled as facts, reactions and a to-do list. It is not modeled as a `workflow` or a `statemachine` unless the owner chose those constructs or a construct requires one; `SKILL.md` names those cases under "Choose the mechanism". The method is in `cratis-modeling-design-event-model` under "Process over time". This file is the Screenplay form.
|
|
15
|
+
|
|
16
|
+
## The shape
|
|
17
|
+
|
|
18
|
+
A to-do list holds work that stays pending over time: a wait, an approval, a deadline, a retry or per-item work. An automation that finishes in one step from its trigger needs no list. For pending work, model four things:
|
|
19
|
+
|
|
20
|
+
1. **An opening fact.** The fact that creates the work, such as `CoursePassed`.
|
|
21
|
+
2. **A to-do read model.** A projection adds one item `from` the opening fact and takes it out with `remove with` for every fact that ends the work.
|
|
22
|
+
3. **A reaction** in a `slice Automation` that follows the opening fact and `invokes` a command.
|
|
23
|
+
4. **A command that rechecks.** The command reads the pending item, decides from current state and produces the closing fact.
|
|
24
|
+
|
|
25
|
+
The list only nominates work. An item can be closed between the fact and the reaction, and the same fact can be delivered again, so the command decides every time.
|
|
26
|
+
|
|
27
|
+
## Rules for the list
|
|
28
|
+
|
|
29
|
+
- **Membership is the state.** An item in the list is pending. Do not add a status field to the item. A consumer that needs history or a status reads a different read model over the same facts; that status is display only and never decides whether a command is allowed.
|
|
30
|
+
- **Name every opening and closing fact.** Several facts can open an item, and several can close it: completion, cancellation, withdrawal and a recorded expiry. A closing fact that nothing produces leaves the item open for ever.
|
|
31
|
+
- **Opening and closing keys address the same item.** Key the item by the identity of the work. When one entity can owe several independent jobs, the entity's id alone does not identify one job.
|
|
32
|
+
- **Map every field.** For each field of the item, state the fact property or key it comes from, its type and whether it is one value or a list. A field the model cannot map is a recorded gap with the intended behavior, never an invented mapping. The same holds for every input of the invoked command.
|
|
33
|
+
- **Give the list a keyed query** so a specification can assert the item is present, and a list query for the screen that shows open work.
|
|
34
|
+
- **Specify the list as a story:** an opened item, a closed item, and a fact that must not open one.
|
|
35
|
+
|
|
36
|
+
## Rules for the automation
|
|
37
|
+
|
|
38
|
+
- **The command rechecks current state.** Declare `command reads protected` at the application root and let the command `reads` the to-do read model by its identifier. A missing item refuses the command with a validation rejection before it produces anything. Add `require` conditions over the item for rules beyond presence. Which read models a protected read admits: `cratis-screenplay-declare-slice`.
|
|
39
|
+
- **A missing item or target is a recorded outcome, never a silent skip.** The default is a refusal branch that `produces` a fact carrying `$refusal.message`, so a person can see what was refused and act. The one exception is an item that is already closed: handle that refusal with `acknowledge`, as the example does, because nothing is owed.
|
|
40
|
+
- **Acknowledge a validation refusal only when the missing item is the only one possible.** `on refused by validation` matches every validation refusal of the command, not only the missing item. Use it with `acknowledge` only after checking that the invoked command can refuse with validation for no other reason: no property rule, concept rule, `require` or `validate` body, no input that request validation can reject, and a read key that always comes from the item's own fact. If you cannot show that, do not acknowledge: use the default branch that records `$refusal.message`, or leave the refusal unhandled so a real error stops the reaction and stays visible.
|
|
41
|
+
- **A named constraint absorbs a repeat only when the constraint is what refuses it.** `on refused by constraint <Name>` with `acknowledge` fits a command that does not read the list and relies on a uniqueness constraint over the closing fact. A missing item refuses the command before any constraint is checked, so it never selects that branch.
|
|
42
|
+
- **Never use a bare `on refused`** to swallow a refusal you did not plan for. It matches every validation and constraint refusal.
|
|
43
|
+
- **Per-item work needs a fact per item.** A list path in a mapping never fans out, and a reaction cannot iterate. Record one fact per item where the items are decided, so that each fact opens its own to-do item. The only construct that iterates a collection is a workflow `foreach`; use it when the iteration itself must be stated in the model, and otherwise record the gap.
|
|
44
|
+
- **The pending item is not a claim.** Two deliveries can both find the item open. The command's protected read or constraint keeps the second decision from being recorded; it does not stop a second external call. For an effect outside the application, see [external effects](external-effects.md).
|
|
45
|
+
|
|
46
|
+
## Waits, approvals and deadlines
|
|
47
|
+
|
|
48
|
+
A wait is an open to-do item. Nothing in the model sleeps.
|
|
49
|
+
|
|
50
|
+
| The process waits for | Model |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| A person's approval or answer | The item appears on that person's screen through the list query. The screen issues the approving or rejecting command, and each resulting fact closes the item. |
|
|
53
|
+
| A fact from elsewhere | The item stays open until that fact is recorded; the projection removes it with that fact. The next step is a reaction to the same fact. |
|
|
54
|
+
| A deadline | A clock reaction (`every` or `at`) is the schedule. A command records the expiry as a fact, the fact closes the item, and the next step reacts to it. |
|
|
55
|
+
| A retry | The item is still open, so the work is still owed. A clock reaction retries the open items; the command's recheck makes a repeat harmless. |
|
|
56
|
+
|
|
57
|
+
A clock trigger carries no values, so it cannot address one item, and a reaction has no construct that iterates the items of a read model. Declare the clock reaction with its schedule and a `description` of the sweep, as the example does. That records intent only. The sweep that visits each open item is code: `cratis-chronicle-react-to-fact`. State in the verdict that the model does not prove the sweep.
|
|
58
|
+
|
|
59
|
+
Specify the timeout path for every wait: what is recorded when nothing arrives in time. A wait with no timeout path can stay open for ever.
|
|
60
|
+
|
|
61
|
+
## When a second automation is redundant
|
|
62
|
+
|
|
63
|
+
Add a second automation only when a second decision exists. For a proposed follow-up automation ask:
|
|
64
|
+
|
|
65
|
+
- What does our side still decide or perform?
|
|
66
|
+
- Which outcome disappears if the automation is removed?
|
|
67
|
+
|
|
68
|
+
When the follow-up fact has the same identity as the first, adds no field, checks no rule and makes no choice, it restates the first fact under another name. Remove the automation, its list and its fact, and project the view from the first fact. A fact named `...Synced` is the usual sign.
|
|
69
|
+
|
|
70
|
+
Equal payloads alone do not prove the stage is redundant. Keep it when it adds a local obligation or an effect, such as notifying a member.
|
|
71
|
+
|
|
72
|
+
## Translation needs no to-do list
|
|
73
|
+
|
|
74
|
+
An outside record or another application's public event must not drive a local decision directly. Translate it first in a `Translate` slice; `cratis-screenplay-model-translation` decides whether that is a capture or a reaction. The translation appends its private fact and nothing closes it, so do not give it a pending view that its own private fact removes.
|
|
75
|
+
|
|
76
|
+
A to-do list starts after translation, and only when a local decision or effect remains. Its opening fact is the private fact, never the outside record.
|
|
77
|
+
|
|
78
|
+
## Example: a to-do list an automation drains
|
|
79
|
+
|
|
80
|
+
`CoursePassed` opens the item. `CertificateSent` or `EnrolmentWithdrawn` closes it. The reaction hands over to `SendCertificate`, which reads the pending item and is refused when it is gone. `SendCertificate` has no property rule, concept rule, `require` or `validate` body, and its key comes from the item's own fact, so the missing item is its only validation refusal and the reaction may acknowledge it. The identifiers are illustrative.
|
|
81
|
+
|
|
82
|
+
```play
|
|
83
|
+
command reads protected
|
|
84
|
+
|
|
85
|
+
concept EnrolmentId : Uuid
|
|
86
|
+
|
|
87
|
+
module Certification
|
|
88
|
+
feature Certificates
|
|
89
|
+
slice StateChange RecordCompletion
|
|
90
|
+
command RecordCompletion
|
|
91
|
+
enrolmentId EnrolmentId identifier
|
|
92
|
+
produces CoursePassed
|
|
93
|
+
for enrolmentId
|
|
94
|
+
event CoursePassed
|
|
95
|
+
screen RecordCompletion
|
|
96
|
+
action RecordCompletion for screen
|
|
97
|
+
|
|
98
|
+
slice StateChange WithdrawEnrolment
|
|
99
|
+
command WithdrawEnrolment
|
|
100
|
+
enrolmentId EnrolmentId identifier
|
|
101
|
+
produces EnrolmentWithdrawn
|
|
102
|
+
for enrolmentId
|
|
103
|
+
event EnrolmentWithdrawn
|
|
104
|
+
screen WithdrawEnrolment
|
|
105
|
+
action WithdrawEnrolment for screen
|
|
106
|
+
|
|
107
|
+
slice StateChange SendCertificate
|
|
108
|
+
command SendCertificate
|
|
109
|
+
enrolmentId EnrolmentId identifier
|
|
110
|
+
reads PendingCertificate by enrolmentId
|
|
111
|
+
produces CertificateSent
|
|
112
|
+
for enrolmentId
|
|
113
|
+
event CertificateSent
|
|
114
|
+
specification SendingAPendingCertificate
|
|
115
|
+
given CoursePassed
|
|
116
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
117
|
+
when SendCertificate
|
|
118
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
119
|
+
then CertificateSent
|
|
120
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
121
|
+
specification RefusingAClosedItem
|
|
122
|
+
given CoursePassed
|
|
123
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
124
|
+
given EnrolmentWithdrawn
|
|
125
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
126
|
+
when SendCertificate
|
|
127
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
128
|
+
then error
|
|
129
|
+
|
|
130
|
+
slice StateView CertificatesToSend
|
|
131
|
+
readmodel PendingCertificate
|
|
132
|
+
enrolmentId EnrolmentId
|
|
133
|
+
query PendingCertificateById => PendingCertificate optional
|
|
134
|
+
by enrolmentId EnrolmentId
|
|
135
|
+
projection CertificatesToSend => PendingCertificate
|
|
136
|
+
from CoursePassed
|
|
137
|
+
enrolmentId = $eventSourceId
|
|
138
|
+
remove with CertificateSent
|
|
139
|
+
remove with EnrolmentWithdrawn
|
|
140
|
+
specification OpeningAnItem
|
|
141
|
+
given CoursePassed
|
|
142
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
143
|
+
then query PendingCertificateById
|
|
144
|
+
arguments
|
|
145
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
146
|
+
result
|
|
147
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
148
|
+
specification ClosingAnItem
|
|
149
|
+
given CoursePassed
|
|
150
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
151
|
+
when append CertificateSent
|
|
152
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
153
|
+
then no readmodel PendingCertificate for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
154
|
+
|
|
155
|
+
slice Automation SendCertificates
|
|
156
|
+
reaction CertificateSender
|
|
157
|
+
when CoursePassed
|
|
158
|
+
invokes SendCertificate
|
|
159
|
+
enrolmentId = $eventSourceId
|
|
160
|
+
on refused by validation
|
|
161
|
+
acknowledge
|
|
162
|
+
specification SendingAfterAPass
|
|
163
|
+
when append CoursePassed
|
|
164
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
165
|
+
then invokes SendCertificate
|
|
166
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
167
|
+
specification AcknowledgingAClosedItem
|
|
168
|
+
given CoursePassed
|
|
169
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
170
|
+
given EnrolmentWithdrawn
|
|
171
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
172
|
+
when redelivered CoursePassed to CertificateSender
|
|
173
|
+
then invokes SendCertificate
|
|
174
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
175
|
+
then no events
|
|
176
|
+
reaction CertificateRetrySweep
|
|
177
|
+
description "Retries certificates still pending after a day. Each retry invokes SendCertificate for one pending enrolment."
|
|
178
|
+
every 1 day
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## What the example proves
|
|
182
|
+
|
|
183
|
+
- **Proven by its specifications:** the item opens and closes, the command produces `CertificateSent` for a pending item and is refused for a closed one, `CoursePassed` hands over to `SendCertificate`, and a redelivery for a closed item is acknowledged with no new fact.
|
|
184
|
+
- **Not proven:** that a certificate reaches the person once, or that the retry sweep runs. `CertificateRetrySweep` has no effects, so it records intent only.
|
|
185
|
+
- **Check the target.** `command reads protected`, refusal branches and `then invokes` each select a later executable model version. Confirm that the target admits them: [what Stage admits](stage-subset.md).
|
|
186
|
+
- The two commands a person issues have a screen each, because a command without an issuer is a warning.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
Licensed under the MIT license. See LICENSE file in the canonical Cratis/AI repository for the full license text.
|
|
3
|
+
|
|
4
|
+
Third-party notices
|
|
5
|
+
|
|
6
|
+
This skill adapts material from the Eventmodelers Build-Kits skills by Martin Dilger and
|
|
7
|
+
Nebulit GmbH (https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits; https://nebulit.de), used
|
|
8
|
+
with the explicit consent of Martin Dilger and Nebulit GmbH. The adapted material remains credited
|
|
9
|
+
to Martin Dilger and Nebulit GmbH. See references/provenance.md.
|
|
10
|
+
|
|
11
|
+
This skill also draws on ideas from agentic-engineer by Martin Dilger and Nebulit GmbH
|
|
12
|
+
(https://github.com/Nebulit-GmbH/agentic-engineer, commit 07b0f30648d663cb588d7e2c7aa031af9dfc21f2;
|
|
13
|
+
https://nebulit.de), used with the explicit consent of Martin Dilger and Nebulit GmbH. The adapted
|
|
14
|
+
material remains credited to Martin Dilger and Nebulit GmbH.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-screenplay-model-interaction
|
|
3
3
|
description: Use when modeling a Screenplay UI - screens over queries and commands, forms, toolbars, navigation, interactions, behaviors, templates, layouts, outlets, UI profiles, design systems, themes, sample data and strings. Not for command, event or query shape (cratis-screenplay-declare-slice), audience gates (cratis-screenplay-availability) or React implementation (cratis-arc-react-bind-slice).
|
|
4
|
+
license: LICENSE
|
|
4
5
|
compatibility: Requires the Screenplay CLI.
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -45,11 +46,13 @@ The compiler checks references and shapes but never runs UI or evaluates a guard
|
|
|
45
46
|
|
|
46
47
|
## Default path
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
Plan the flow first: [Screen design](references/screen-design.md).
|
|
50
|
+
|
|
51
|
+
1. Put the list screen in the StateView slice: `title`, `data <ReadModel>[] via query <Query>`, a `table` with columns, and `on row-click navigate to <Detail> by <key>`.
|
|
49
52
|
2. For a command that needs no selection (create), add `action <Command> for screen` with a `label`.
|
|
50
53
|
3. Put the item action on the list. Use `presentation placement "row-menu"` so the one table supplies the row without triggering navigation. Put a keyed query and a read-only `summary` on the detail screen.
|
|
51
54
|
4. Add a `form` only for what the defaults get wrong, such as labels or opening the new item after submit.
|
|
52
|
-
5. Compile, inspect the UI contract, and check ESM admission
|
|
55
|
+
5. Compile, inspect the UI contract, and check ESM admission. Check the list-to-detail navigation and run each action in the intended renderer.
|
|
53
56
|
|
|
54
57
|
```play
|
|
55
58
|
module Facilities
|
|
@@ -81,25 +84,25 @@ module Facilities
|
|
|
81
84
|
field location label "Location"
|
|
82
85
|
```
|
|
83
86
|
|
|
84
|
-
`ReportFault` returns `id
|
|
87
|
+
`ReportFault` returns `id`; `with id from id` in `on submit` reads it.
|
|
85
88
|
|
|
86
89
|
## Capability catalog
|
|
87
90
|
|
|
88
91
|
### Screens and data
|
|
89
92
|
|
|
90
|
-
- `screen <Name>` —
|
|
93
|
+
- `screen <Name>` — owned by a slice, or free at document, module or feature level.
|
|
91
94
|
- `title "…"|$strings.<key>`; `description "…"` (one per screen).
|
|
92
95
|
- `data <ReadModel>` | `data <ReadModel>[]`, then `via query <Query> [by <param>]` — what the screen shows; `by` takes a scalar argument only (a composite key is refused, `PLAY0661`).
|
|
93
96
|
- `available for|when|with …` on `data` or `action` — narrow who sees the element; never widens the command or query (`PLAY1172`).
|
|
94
97
|
- `data <Shape>[] [as <alias>]` (no `via`) — a free screen's *need*; `shape <Name>` (top level) declares typed fields for it.
|
|
95
98
|
- `uses screen <Screen>` in a slice, then `data <need|alias> via query <Query> [by <param>]` and `<field> from <path>` where the names differ — adopt a free screen. An unadopted screen is design-only (`PLAY1164`); an unprovided need warns (`PLAY1155`).
|
|
96
99
|
- Name resolution runs inside-out (slice, feature, module, document). Qualify with a trailing scope (`Queue.All`) when ambiguous.
|
|
97
|
-
- `sketch|mockup|image <path>` — authoring visuals
|
|
100
|
+
- `sketch|mockup|image <path>` — authoring visuals beside the model, never executed.
|
|
98
101
|
- `file <path>` — an external file realizes the whole screen; a fenced `react|typescript|html|csharp` block in a section or slot realizes that part inline.
|
|
99
102
|
|
|
100
103
|
### Actions and subjects
|
|
101
104
|
|
|
102
|
-
- `action <Command> [for item|screen]` — offer a command; children: `label "…"`, `with <input> from <binding>`, `navigate to <Screen
|
|
105
|
+
- `action <Command> [for item|screen]` — offer a command; children: `label "…"`, `with <input> from <binding>`, `navigate to <Screen>`.
|
|
103
106
|
- `presentation <key> "…"` — renderer hints for a plain `action <Command> for item`. With `placement "row-menu"`, Stage moves the action into each row’s menu only if the composed screen has exactly one table. Otherwise it stays inline and needs one selected row.
|
|
104
107
|
- `action "<label>" [for item|screen]` + `when <cond> execute <Command>` (with nested `with`) … + `otherwise hidden` | `otherwise execute <Command>` — a guarded action; at most one `navigate to`.
|
|
105
108
|
- Conditions: `item.<path>` `== != > >= < <= contains` or `starts with` a literal, combined with `and`, `or` and parentheses.
|
|
@@ -127,7 +130,7 @@ module Facilities
|
|
|
127
130
|
|
|
128
131
|
### Forms
|
|
129
132
|
|
|
130
|
-
|
|
133
|
+
[Decision inputs](references/decision-inputs.md) separates user input from server-owned values.
|
|
131
134
|
|
|
132
135
|
- `form <Name> for <Command>` (module level) — found through the action that runs the command.
|
|
133
136
|
- `description "…"`; `generation auto` (fields generated from command metadata) | `generation manual` (the authored fields are the contract).
|
|
@@ -167,23 +170,24 @@ See [Shell and design](references/shell-and-data.md) for the shell skeleton, `ar
|
|
|
167
170
|
|
|
168
171
|
### Profiles, design, sample data and strings
|
|
169
172
|
|
|
170
|
-
|
|
173
|
+
Companion file rules: [Localized strings](references/localized-strings.md).
|
|
171
174
|
|
|
172
175
|
- `ui profile <Name>` (top level; several allowed) — `target platform`, `target size compact|regular|expanded`, `theme`, `root template [blueprint <Bp>] <Name> [version "<range>"]` with `option <n> <v>`, `identity` (`name`, `logo initials|icon|image`, `show name`), `appearance` → `color scheme light|dark|system`, `new screens use template …`, `packages` (in priority order, `core` as fallback), `icons` and `sample data` (`active <Pack>`, `shape <S> maps to <ReadModel>`, `bind <ReadModel> to <Pack>`). A screen never names a profile.
|
|
173
176
|
- `design system <Name>` (top level, once) — `modes`, `default theme` (required), `tokens` by category (color, space, size, radius, border, shadow, font, type, motion, opacity, z), `components` with `parts`, `variant` and `state`, `words` (`voice`, `naming`) and `rules contrast <part> on <part> at least <ratio>`.
|
|
174
177
|
- `theme <Name>` (top level) — `implements <DesignSystem>`, `compatible with <Package>`, `palette`, `values`, and per-mode blocks. Every color token needs a value in every mode. A profile's theme must implement the design system.
|
|
175
178
|
- `sample data <Name>` (top level) — `title`, `locale`, and `shape <ReadModel>` with `row` and `<field> = <literal>` (nested rows for collections). Activate it from a profile.
|
|
176
|
-
- `<base>.<locale>.strings` companion files with `key = "value"` — use `$strings.<key>` for screen and section titles, labels (action, column, summary field, form field, contribution), toolbar button titles, notify
|
|
179
|
+
- `<base>.<locale>.strings` companion files with `key = "value"` — use `$strings.<key>` for screen and section titles, labels (action, column, summary field, form field, contribution), toolbar button titles, notify, confirm and validation messages.
|
|
177
180
|
|
|
178
181
|
### Tools and SDK surfaces
|
|
179
182
|
|
|
180
183
|
- `screenplay <root>` — compile; `screenplay export <root> --format ui [--scope <scope>] --output screens.json` — export the source UI contract.
|
|
181
|
-
- `screenplay export <root> --screens [--scope <scope>] --output model.esm.json` — admit screens into ESM (the default export format); `--screens` is ESM-only. Both
|
|
184
|
+
- `screenplay export <root> --screens [--scope <scope>] --output model.esm.json` — admit screens into ESM (the default export format); `--screens` is ESM-only. Both take module, nested feature or slice scopes.
|
|
182
185
|
- MCP `read-workspace`: `view: "ui-contract"` reads the source contract; `view: "executable-model"` needs `screens: true` to admit screens. `ui-profiles` reads shell, design system and themes; optionally select `name`.
|
|
183
186
|
- In-process UI-contract and admission APIs and Stage query performer bodies are C#-only.
|
|
184
|
-
- Studio Design: read the active catalogue and template set, then use checked edits or offer choices without applying them.
|
|
187
|
+
- Studio Design: read the active catalogue and template set, then use checked edits or offer choices without applying them. Operation catalog and refusal workflow: [Design in Studio](references/shell-and-data.md).
|
|
185
188
|
|
|
186
189
|
## References and hand-offs
|
|
187
190
|
|
|
188
191
|
- Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir); only the project's languages are installed.
|
|
189
|
-
- Command, query and read-model shape: `cratis-screenplay-declare-slice`. Audience gates: `cratis-screenplay-availability` (a module gate covers its forms, screens, commands and queries). Stage output: `cratis-stage-render-slice`.
|
|
192
|
+
- Command, query and read-model shape: `cratis-screenplay-declare-slice`. Audience gates: `cratis-screenplay-availability` (a module gate covers its forms, screens, commands and queries). Stage output: `cratis-stage-render-slice`. React implementation: `cratis-arc-react-bind-slice`.
|
|
193
|
+
- Read [provenance](references/provenance.md) when checking attribution.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Provenance
|
|
2
|
+
|
|
3
|
+
This skill uses material from the Eventmodelers Build-Kits skills by Martin Dilger and Nebulit GmbH (https://nebulit.de), with the explicit consent of Martin Dilger and Nebulit GmbH. The adapted material remains credited to them. The notice is in this skill's `LICENSE`.
|
|
4
|
+
|
|
5
|
+
Source repository: https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits at commit `bfab031`. Skill paths are relative to `eventmodelers-cli/stacks/modeling-kit/templates/.claude/skills/`. All of the material is used in `references/screen-design.md`.
|
|
6
|
+
|
|
7
|
+
| Source | Idea used | Form |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `experience-model` | Sorting what happens on a screen around the slice's command: pre is what the person does to supply the inputs, the slice is the submission and is modeled once, post is only what follows. The test question "does the command need this to have happened first?". The reading of a view slice, which has no submission. | close adaptation |
|
|
10
|
+
| `experience-model` | One result per step: one screen over one view, seen from the question the person has; a submission step shows no view; navigation to a single-record screen hands over the identifying value, which is one the slice already has. | close adaptation |
|
|
11
|
+
| `experience-model` | Steps are presentation only, never business rules. Add only the step the request names; list a further screen for the person to pick. No state before the step that leads to it. | close adaptation |
|
|
12
|
+
| `eventmodeling-storyboarding-events` | Telling the flow from one actor's perspective: "whose turn is it in the story?", changing actor only at a real hand-off, and no screen per role for symmetry. | close adaptation |
|
|
13
|
+
| `eventmodeling-storyboarding-events` | The common patterns input screen, status screen and error state (the command is refused, no fact is recorded, the person is told why and can retry or take another action). | close adaptation |
|
|
14
|
+
| `eventmodeling-storyboarding-events`, `storyboard`, `html-screen` | Every value a screen displays or captures names its source: a view for displayed data, an input, or a value the system supplies. A value with no source is a gap in the model. | close adaptation |
|
|
15
|
+
| `storyboard` | Planning every screen of a flow before building any, with a short description per screen. | idea |
|
|
16
|
+
| `html-screen` | Reading the existing screen before changing it, changing only what was asked and keeping the rest. | idea |
|
|
17
|
+
| `eventmodeling-identifying-outputs` | The list view among its common patterns, as the starting point for the list screen pattern. | idea |
|
|
18
|
+
|
|
19
|
+
## Credits carried over from earlier skills
|
|
20
|
+
|
|
21
|
+
This skill is the successor of three earlier skills in this corpus: `cratis-screenplay-read-surface`, `cratis-screenplay-ui-composition` and `cratis-arc-react-page`. They took the ideas below from the same authors' agentic-engineer repository (https://github.com/Nebulit-GmbH/agentic-engineer, commit `07b0f30648d663cb588d7e2c7aa031af9dfc21f2`), under the same consent. Skill paths are relative to `.claude/skills/`.
|
|
22
|
+
|
|
23
|
+
| Earlier skill | Source | Idea used |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `cratis-screenplay-read-surface` | `eventmodeling-storyboarding-events`, "Common Patterns" | Input screen, status screen and error state, mapped to `screen`, `data`, `action` and a refusal specification. |
|
|
26
|
+
| `cratis-screenplay-ui-composition` | `storyboard` | Planning every screen of the flow before building any. |
|
|
27
|
+
| `cratis-screenplay-ui-composition` | `html-screen` | Reading the existing screen first and changing only what was asked. |
|
|
28
|
+
| `cratis-screenplay-ui-composition` | `eventmodeling-storyboarding-events`, `storyboard` | Every displayed or captured value has a named source. |
|
|
29
|
+
| `cratis-screenplay-ui-composition` | `storyboard-screen` | A short description per screen. |
|
|
30
|
+
| `cratis-arc-react-page` | `html-screen`, `eventmodeling-storyboarding-events` | Every displayed value has a named origin. |
|
|
31
|
+
| `cratis-arc-react-page` | `eventmodeling-storyboarding-events`, `discover-storyboard` | Designing the alternative states of a screen, here the empty list and the refusal. |
|
|
32
|
+
|
|
33
|
+
`cratis-arc-react-page` also credited the Eventmodelers Build-Kits skills `build-state-change` and `build-state-view` for page composition and for checking an implementation against its source of truth. That material is about the React page, not about modeling a screen, and is not used in this skill.
|
|
34
|
+
|
|
35
|
+
## Not adopted
|
|
36
|
+
|
|
37
|
+
- Board mechanics: chapters, lanes, columns, one screen per column, cells, nodes, marks, linked copies and the tools that read and write them.
|
|
38
|
+
- The catalog of interaction kinds and its command and event titles. Screenplay has its own interactions, listed in `SKILL.md`.
|
|
39
|
+
- Drawn screens: HTML pages, wireframe sketches, the grid description language, CSS frameworks and mandatory rendering. Screenplay screens are declarative and a renderer draws them.
|
|
40
|
+
- Breaking a screen with several areas into one copy per view. Which views a screen needs is decided in `cratis-modeling-design-event-model`.
|
|
41
|
+
- The timeline view and processor decision patterns. They belong to view design and automation, which other skills own.
|
|
42
|
+
- A confirmation screen as a fixed part of the input screen pattern. This skill names where the person lands after success and adds a confirmation only when the request names one.
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Screen design
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Plan the flow before any screen
|
|
6
|
+
- Interaction steps around a command
|
|
7
|
+
- One result per step
|
|
8
|
+
- One actor per screen
|
|
9
|
+
- Name the source of every value
|
|
10
|
+
- Screen patterns
|
|
11
|
+
- Worked example
|
|
12
|
+
- Change a screen in place
|
|
13
|
+
- What screen design is not
|
|
14
|
+
|
|
15
|
+
Decide what each screen is for before deciding how it is laid out. This file is the planning walk; the `SKILL.md` capability catalog is the syntax. The steps below are a way to think about a flow, not declarations: one `screen` can appear in several steps.
|
|
16
|
+
|
|
17
|
+
## Plan the flow before any screen
|
|
18
|
+
|
|
19
|
+
Plan every screen of a flow before declaring any of them.
|
|
20
|
+
|
|
21
|
+
1. List the screens in the order a person meets them. For an existing model, read the `screen` declarations; do not list them from memory.
|
|
22
|
+
2. Write one entry per screen in the shape below. Two or three sentences per screen is enough.
|
|
23
|
+
3. Follow every navigation. The target screen must exist and its entry must say how the person arrived.
|
|
24
|
+
4. Mark a gap; do not fill it. Gaps are a value with no source, a screen with neither data nor an action, an action nobody can reach, and a state nobody designed.
|
|
25
|
+
5. Ask the person who owns the flow to confirm or correct the entries. Declare screens only after that, and layout after the screens.
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
<Screen>
|
|
29
|
+
Actor: <the one persona whose turn it is>
|
|
30
|
+
Shows: <the view and the fields that matter, in plain words>
|
|
31
|
+
Arrived by: <entry point, action or navigation, and the identifier passed>
|
|
32
|
+
Can do: <each intent: one command or one navigation>
|
|
33
|
+
States: <empty, refused, not allowed: what the person sees and can do next>
|
|
34
|
+
Gaps: <none, or what has no source or no target>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Add only the screens, dialogs and confirmations the request names. When another one would help, list it with what it would show and let the person choose.
|
|
38
|
+
|
|
39
|
+
## Interaction steps around a command
|
|
40
|
+
|
|
41
|
+
For a `StateChange` slice, sort what happens on the screen by the command:
|
|
42
|
+
|
|
43
|
+
| Step | What it holds | Typical declarations |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| Pre | What the person does to supply the command's inputs: select a row, filter the list, open the dialog that holds the form, fill in the form. | `on select`, a filter, `open dialog`, `form` fields, `populate` |
|
|
46
|
+
| Slice | The submission, once. | `action <Command>`, or the form's submit |
|
|
47
|
+
| Post | Only what follows the command: go somewhere, confirm, re-read. | `on submit`, `on success`, `navigate to`, `notify`, `refresh`, `close dialog` |
|
|
48
|
+
|
|
49
|
+
- Test each step with "does the command need this to have happened first?". If yes, it is a pre step. A dialog or wizard page that holds the form is a pre step.
|
|
50
|
+
- Read the steps as a story: prepare, submit, what follows. If preparation comes after the submission and the same command runs again, the order is wrong.
|
|
51
|
+
- A step is one action by the person and one result. Add a step only for an action the request names.
|
|
52
|
+
- Steps are presentation only. Validation, a guard on what the command accepts and a computed value belong to the slice and its specifications (`cratis-screenplay-declare-slice`, `cratis-screenplay-specify-outcome`).
|
|
53
|
+
|
|
54
|
+
For a `StateView` slice there is no submission. Pre is what happens on entry (an availability gate, a preset filter). Post is what the person does with the data: select a row, narrow the list, open the details. If the person can also change something there, that is another slice; model only the action or navigation that reaches it.
|
|
55
|
+
|
|
56
|
+
## One result per step
|
|
57
|
+
|
|
58
|
+
- A step that shows state shows one screen and one view: the view that answers the question the person has at that point. Which views a screen with several areas needs is decided in `cratis-modeling-design-event-model`.
|
|
59
|
+
- A submission step shows no view. What the person sees next is its own post step.
|
|
60
|
+
- Navigation to a screen that shows one record passes that record's identifier: `navigate to <Screen> by <param>` from a row, or `with <name> from <binding>` after a submit. Pass a value the slice already has; do not invent a field to carry it.
|
|
61
|
+
- Order the steps so that no state appears before the step that leads to it.
|
|
62
|
+
|
|
63
|
+
## One actor per screen
|
|
64
|
+
|
|
65
|
+
- Before adding a screen ask "whose turn is it in the story?". While the answer is the same persona, stay with that persona's screens.
|
|
66
|
+
- Move to another persona's screen only at a real hand-off, where the work cannot continue until someone else acts.
|
|
67
|
+
- Do not add a screen per persona for symmetry. A change that another persona could see earns a screen only when that person would look at it as the next step of the story.
|
|
68
|
+
- A persona the story names who has no screen in the flow is a gap to raise. Either a screen is missing or the persona does not act in this flow.
|
|
69
|
+
|
|
70
|
+
## Name the source of every value
|
|
71
|
+
|
|
72
|
+
Every value a screen shows or captures has exactly one named source:
|
|
73
|
+
|
|
74
|
+
| Source | Use it for | Rule |
|
|
75
|
+
| --- | --- | --- |
|
|
76
|
+
| A view field | Anything displayed | Name the read model and the field. The screen reads it through a query. |
|
|
77
|
+
| An input | What the person types or picks | It is an input of the command. A picker's choices are displayed values, so they come from a view. |
|
|
78
|
+
| Trusted context | The caller, the tenant, the time, a generated identifier | The server supplies it. The form never asks for it. See [Decision inputs](decision-inputs.md). |
|
|
79
|
+
|
|
80
|
+
- A displayed value never takes the command it submits as its source.
|
|
81
|
+
- A value with no source is a model gap. Record it in the screen's `Gaps` line and take it back to the model; do not invent a field or a default on the screen.
|
|
82
|
+
- List only what the screen shows or captures. Do not add fields in case they are needed later.
|
|
83
|
+
- For a compiled model, check the trace with the lineage command in `cratis-screenplay-accept-model`.
|
|
84
|
+
|
|
85
|
+
## Screen patterns
|
|
86
|
+
|
|
87
|
+
Decide which pattern a screen is before writing its `data` and `action` lines. The pattern tells which view and which command the screen needs.
|
|
88
|
+
|
|
89
|
+
### Input screen
|
|
90
|
+
|
|
91
|
+
The person fills in a form and submits, and a fact is recorded.
|
|
92
|
+
|
|
93
|
+
- The form fields are the command's inputs.
|
|
94
|
+
- A blank creation form needs no view. An input screen that shows current state before the person acts (what is still available, what is still owed) also needs `data <ReadModel> via query <Query>`.
|
|
95
|
+
- Name where the person lands after success: the screen for the new record, or the list that now contains it.
|
|
96
|
+
|
|
97
|
+
### Status screen
|
|
98
|
+
|
|
99
|
+
The person looks at where something stands and decides what to do next.
|
|
100
|
+
|
|
101
|
+
- `data <ReadModel> via query <Query> by <param>` supplies the current state. A status screen with no view is a gap.
|
|
102
|
+
- An action that is always offered is a plain `action`. An action that depends on the record's state is a guarded action. Never describe the difference only in prose.
|
|
103
|
+
|
|
104
|
+
### List with an empty state
|
|
105
|
+
|
|
106
|
+
- A list screen is `data <ReadModel>[] via query <Query>`. Make the query `observable` when the screen's own commands change the list.
|
|
107
|
+
- An empty list is a state of the same screen, not another screen. Write in the plan what the person sees and can do when there are no rows.
|
|
108
|
+
- Offer the creating command as `action <Command> for screen`. It needs no selected row, so an empty list is never a dead end.
|
|
109
|
+
- How the empty state is drawn belongs to the renderer or the hand-written page (`cratis-arc-react-bind-slice`).
|
|
110
|
+
|
|
111
|
+
### Error state
|
|
112
|
+
|
|
113
|
+
The person acts and the command is refused: no fact is recorded, and the person is told why.
|
|
114
|
+
|
|
115
|
+
- The reason the person is given is the `message` of the rule or constraint that refuses the command. Write it in the domain's language, so the person knows what to do next.
|
|
116
|
+
- A refusal is not a screen. One screen covers its refusals. Pin each refusal with a specification (`cratis-screenplay-specify-outcome`).
|
|
117
|
+
- Name the way out: correct the input and submit again, or take another action on the same screen. If neither is possible the flow has a dead end; record it as an open question.
|
|
118
|
+
- Where an interaction runs the command itself with `execute`, put what happens after a refusal under `on failure`.
|
|
119
|
+
|
|
120
|
+
## Worked example
|
|
121
|
+
|
|
122
|
+
One flow for one actor, the harbour clerk. The list is the status screen, and `BookBerth` is offered `for screen`, so it works on an empty list. The form is the pre step, its submit is the slice step, and `on submit` is the post step, passing the new booking's identifier to the single-record screen. The constraint's message is the error state.
|
|
123
|
+
|
|
124
|
+
```play
|
|
125
|
+
domain Example.Marina
|
|
126
|
+
|
|
127
|
+
concept BookingId : Uuid
|
|
128
|
+
concept BerthName : String
|
|
129
|
+
validate
|
|
130
|
+
not empty message "A berth needs a name"
|
|
131
|
+
concept BoatName : String
|
|
132
|
+
|
|
133
|
+
module Marina
|
|
134
|
+
form BookBerthForm for BookBerth
|
|
135
|
+
field berth label "Berth"
|
|
136
|
+
field boat label "Boat"
|
|
137
|
+
on submit
|
|
138
|
+
navigate to BookingDetails
|
|
139
|
+
with id from id
|
|
140
|
+
|
|
141
|
+
feature Bookings
|
|
142
|
+
slice StateChange BookBerth
|
|
143
|
+
command BookBerth
|
|
144
|
+
id BookingId generated identifier
|
|
145
|
+
berth BerthName
|
|
146
|
+
boat BoatName
|
|
147
|
+
produces BerthBooked
|
|
148
|
+
for id
|
|
149
|
+
berth = berth
|
|
150
|
+
boat = boat
|
|
151
|
+
returns id
|
|
152
|
+
|
|
153
|
+
event BerthBooked
|
|
154
|
+
berth BerthName
|
|
155
|
+
boat BoatName
|
|
156
|
+
|
|
157
|
+
constraint OneBookingPerBerth
|
|
158
|
+
unique berth on BerthBooked
|
|
159
|
+
message "This berth is already booked"
|
|
160
|
+
|
|
161
|
+
slice StateView OpenBookings
|
|
162
|
+
readmodel Booking
|
|
163
|
+
id BookingId key
|
|
164
|
+
berth BerthName
|
|
165
|
+
boat BoatName
|
|
166
|
+
|
|
167
|
+
projection BookingProjection => Booking
|
|
168
|
+
from BerthBooked
|
|
169
|
+
id = $eventSourceId
|
|
170
|
+
|
|
171
|
+
query OpenBookings => observable Booking[]
|
|
172
|
+
query BookingById => Booking optional
|
|
173
|
+
by id BookingId
|
|
174
|
+
|
|
175
|
+
screen Bookings
|
|
176
|
+
title "Open bookings"
|
|
177
|
+
data Booking[] via query OpenBookings
|
|
178
|
+
action BookBerth for screen
|
|
179
|
+
label "Book a berth"
|
|
180
|
+
table Booking
|
|
181
|
+
column berth label "Berth"
|
|
182
|
+
column boat label "Boat"
|
|
183
|
+
on row-click navigate to BookingDetails by id
|
|
184
|
+
|
|
185
|
+
screen BookingDetails
|
|
186
|
+
title "Booking"
|
|
187
|
+
data Booking via query BookingById by id
|
|
188
|
+
summary Booking
|
|
189
|
+
field berth label "Berth"
|
|
190
|
+
field boat label "Boat"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
| Where | Value | Source |
|
|
194
|
+
| --- | --- | --- |
|
|
195
|
+
| `BookBerthForm` | `berth`, `boat` | inputs of `BookBerth` |
|
|
196
|
+
| `BookBerth` | `id` | generated by the server and returned |
|
|
197
|
+
| `Bookings`, `BookingDetails` | `berth`, `boat` | `Booking`, projected from `BerthBooked` |
|
|
198
|
+
|
|
199
|
+
The example declares no entry point, so `--check navigation` reports its screens; see [Navigation reachability](navigation-reachability.md).
|
|
200
|
+
|
|
201
|
+
## Change a screen in place
|
|
202
|
+
|
|
203
|
+
1. Read the existing screen, its form and the entries of the flow it belongs to before changing anything.
|
|
204
|
+
2. Change only what was asked. Keep every other line, including its order.
|
|
205
|
+
3. A new step in the story is a new slice or screen, not a rewrite of an existing one.
|
|
206
|
+
4. After the change, redo the source table for the values you touched and follow the navigations that lead to and from the screen.
|
|
207
|
+
|
|
208
|
+
## What screen design is not
|
|
209
|
+
|
|
210
|
+
- Not a position on a timeline. A screen is a declaration in a slice. It hosts every action the person can reasonably take there, and an action can be offered on several screens.
|
|
211
|
+
- Not a mockup. A drawn page is never evidence for the model. A sketch or mockup can travel with the screen as authoring metadata, and it changes nothing the compiler checks.
|
|
212
|
+
- Not a business rule. A guard on a screen decides what is offered; the command decides what is accepted.
|
|
@@ -46,7 +46,7 @@ Always declare `direction`. A `Translate` slice without one is treated as inboun
|
|
|
46
46
|
|
|
47
47
|
Declare an inbound slice, its private events and a capture keyed by stable provider identity. Translate values in `map`, guard appends by the change that matters, and specify first observation, unchanged redelivery and meaningful changes.
|
|
48
48
|
|
|
49
|
-
Before appending, the adapter must verify source authenticity and tenant/entity ownership, and validate shape, business preconditions and nonblank identities. Test unauthorized and malformed inputs at the adapter and assert no append. Source metadata and record fixtures do not enforce this boundary. Map provider time from a validated input field, not `$context.occurred` (observation time for records).
|
|
49
|
+
Before appending, the adapter must verify source authenticity and tenant/entity ownership, and validate shape, business preconditions and nonblank identities. Test unauthorized and malformed inputs at the adapter and assert no append. Source metadata and record fixtures do not enforce this boundary. For `source webhook`, verify the provider's own signature and publish the [endpoint contract](references/webhook-contract.md). Map provider time from a validated input field, not `$context.occurred` (observation time for records).
|
|
50
50
|
|
|
51
51
|
```play
|
|
52
52
|
module Rentals
|
|
@@ -291,3 +291,5 @@ Model authoring is SDK-independent; this skill has no SDK-specific steps. Use `c
|
|
|
291
291
|
- **Raw data:** exclude provider-only detail unless a local consumer needs it.
|
|
292
292
|
- **Reusable provider packages** belong in `cratis-screenplay-author-extension`; declarations do not activate a backend.
|
|
293
293
|
- **Specification shape** beyond these steps: see `cratis-screenplay-specify-outcome`.
|
|
294
|
+
|
|
295
|
+
Read [provenance](references/provenance.md) when checking attribution.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Provenance
|
|
2
|
+
|
|
3
|
+
This skill uses material from the Eventmodelers Build-Kits skills by Martin Dilger and Nebulit GmbH (https://nebulit.de), with the explicit consent of Martin Dilger and Nebulit GmbH. The adapted material remains credited to them.
|
|
4
|
+
|
|
5
|
+
Source repository: https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits at commit `bfab031`. Skill paths are relative to `eventmodelers-cli/stacks/`.
|
|
6
|
+
|
|
7
|
+
| Source | Idea used | Form |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `supabase/templates/.claude/skills/build-webhook` | An inbound webhook verifies the provider's own signature, because the provider cannot obtain an application token. | idea |
|
|
10
|
+
| `supabase/templates/.claude/skills/build-webhook` | The endpoint contract is written for an integrator who cannot read the code: path, payload fields, authentication header and responses, with examples taken from the model only. | idea |
|
|
11
|
+
|
|
12
|
+
An earlier version of this corpus carried the same two ideas in `cratis-screenplay-automations-and-translations`, under the same consent.
|
|
13
|
+
|
|
14
|
+
Not adopted: the function registration, configuration and local-serve mechanics; the OpenAPI block and its type table; generating an identifier when the caller omits one (it breaks the retry identity); the status codes of that stack.
|
package/package/corpus/skills/cratis-screenplay-model-translation/references/webhook-contract.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Contract of an inbound webhook
|
|
2
|
+
|
|
3
|
+
Use this when an inbound translation captures records with `source webhook`.
|
|
4
|
+
|
|
5
|
+
## Verify the provider before capture
|
|
6
|
+
|
|
7
|
+
The adapter that receives the request verifies the provider's own signature or shared secret before it hands a record to the capture. A provider cannot obtain an application user token, so never ask for one.
|
|
8
|
+
|
|
9
|
+
`source webhook` and `path` describe the source. They do not enforce the signature check, the ownership check or the payload shape. Each of those is a requirement on the adapter, with a negative case that asserts no append.
|
|
10
|
+
|
|
11
|
+
## Publish the endpoint contract
|
|
12
|
+
|
|
13
|
+
The provider's integrator cannot read this codebase. Write the contract of the endpoint for that reader:
|
|
14
|
+
|
|
15
|
+
- **Path.** The route named by `path` in the capture.
|
|
16
|
+
- **Payload.** Exactly the fields the capture's record declares, with their types and which are required. Take examples from the model only; never invent one.
|
|
17
|
+
- **Authentication.** The name of the signature header or the shared secret the provider sends.
|
|
18
|
+
- **Responses.** One for an accepted record, one for a duplicate delivery and one for each refusal. Answer a duplicate delivery as already handled.
|
|
19
|
+
|
|
20
|
+
Keep the provider's occurrence or delivery id as the retry identity. A new id for each delivery defeats deduplication.
|
|
21
|
+
|
|
22
|
+
Keep the contract in the slice's `documentation` block, so it changes with the model.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
Licensed under the MIT license. See LICENSE file in the canonical Cratis/AI repository for the full license text.
|
|
3
|
+
|
|
4
|
+
Third-party notices
|
|
5
|
+
|
|
6
|
+
The bounded live walk in `references/running-system.md` adapts material from the Eventmodelers
|
|
7
|
+
Build-Kits skills by Martin Dilger and Nebulit GmbH
|
|
8
|
+
(https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits; https://nebulit.de), used with the
|
|
9
|
+
explicit consent of Martin Dilger and Nebulit GmbH. The adapted material remains credited to
|
|
10
|
+
Martin Dilger and Nebulit GmbH. The upstream skill and the ideas taken from it are listed in
|
|
11
|
+
`references/provenance.md`.
|