@cratis/pi 6.2.0 → 6.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +90 -15
  2. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/verification.json +5 -1
  3. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +162 -64
  4. package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +20 -8
  5. package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +33 -1
  6. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +63 -31
  7. package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +35 -13
  8. package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +12 -0
  9. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +50 -9
  10. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +78 -22
  11. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +21 -5
  12. package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +16 -0
  13. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +155 -43
  14. package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +81 -37
  15. package/package/corpus/skills/cratis-screenplay-projections/verification.json +6 -1
  16. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +64 -17
  17. package/package/corpus/skills/cratis-screenplay-read-surface/verification.json +4 -1
  18. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +201 -115
  19. package/package/corpus/skills/cratis-screenplay-specifications/verification.json +13 -1
  20. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +133 -24
  21. package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +4 -1
  22. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cratis-screenplay-ui-composition
3
- description: Compose the user interface of a Cratis Screenplay `.play` model — `layout` and its responsive `arrangement`, `screen template` and `dialog template`, command-bound `form` declarations, navigation `contribute` blocks, `ui profile`, `theme`, localized `$strings`, and `file` realization references. Use when declaring the application shell, a reusable screen shape, a command form, a navigation entry, or theming in a `.play` model. Do not use for a screen's own data and actions.
3
+ description: Compose the user interface of a Cratis Screenplay `.play` model — `layout` and its responsive `arrangement`, `screen template` and `dialog template`, command-bound `form` declarations, navigation `contribute` blocks, interaction `behavior`/`on`/`uses` wiring, `ui profile`, `theme`, localized `$strings`, and `file` references. Use when declaring the application shell, a reusable screen shape, a command form, a navigation entry, what a click or submit does, or theming in a `.play` model. Do not use for a screen's own data and actions.
4
4
  license: MIT
5
5
  ---
6
6
 
@@ -25,12 +25,16 @@ source is the single flow model.
25
25
 
26
26
  | Package | Version | Purpose |
27
27
  | --- | --- | --- |
28
- | `Cratis.Screenplay` | `4.12.1` | Layout, template, form, contribution, profile and theme parsers |
28
+ | `Cratis.Screenplay` | `4.31.0` | Layout, template, form, contribution, interaction, profile and theme parsers |
29
29
 
30
- Read from the Screenplay repository at tag `v4.12.1` (commit `122eee8`), against
31
- `Documentation/screenplay/{templates,layout-arrangement,forms,contributions,ui-profile,theme,internationalization,file-references}.md`
32
- and `Source/DotNET/Screenplay/Parsing/`. Reverify before claiming another version
33
- behaves the same.
30
+ Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
31
+ `Documentation/screenplay/{templates,layout-arrangement,forms,contributions,interactions,ui-profile,theme,internationalization,file-references}.md`.
32
+ Every example below compiles with that version's compiler. Reverify before
33
+ claiming another version behaves the same.
34
+
35
+ Every construct on this page is deferred from the executable model with
36
+ information `PLAY0269`: it never blocks binding, and it is not evidence that a
37
+ target renders it.
34
38
 
35
39
  These constructs went unhighlighted and uncompleted by the Monaco and VS Code
36
40
  language service until `Cratis/Screenplay#199` gave every construct the parser
@@ -41,6 +45,7 @@ highlighting was never evidence that a construct is wrong.
41
45
  ## `layout` — the application shell
42
46
 
43
47
  One per application, declared at the top level and selected by a `ui profile`.
48
+ A complete example:
44
49
 
45
50
  ```screenplay
46
51
  layout AppShell
@@ -73,7 +78,8 @@ or `regular` — phone landscape, phone portrait, desktop short, desktop tall.
73
78
  - `when width <class>[, height <class>]` or `when height <class>` **replaces the
74
79
  entire tree** for that condition — it is not a partial override.
75
80
 
76
- **`arrangement freeform`** declares one variant per matrix point:
81
+ **`arrangement freeform`** declares one variant per matrix point. Excerpt, inside
82
+ the `layout` above in place of its `arrangement flow`:
77
83
 
78
84
  ```screenplay
79
85
  arrangement freeform
@@ -90,7 +96,7 @@ arrangement freeform
90
96
 
91
97
  ## `screen template` and `dialog template`
92
98
 
93
- Declared at module level, referenced by screens.
99
+ Declared at module level, referenced by screens. Excerpt, inside a `module`:
94
100
 
95
101
  ```screenplay
96
102
  screen template MasterDetail
@@ -118,6 +124,9 @@ difference. See `cratis-screenplay-read-surface` for the directives that go insi
118
124
 
119
125
  ## `form` — bound to a command
120
126
 
127
+ Excerpt, inside a `module`; the command, query and screen are declared in its
128
+ slices.
129
+
121
130
  ```screenplay
122
131
  form RegisterInvoiceForm for RegisterInvoice
123
132
  populate via query GetInvoiceDefaults by customerId
@@ -131,7 +140,8 @@ form RegisterInvoiceForm for RegisterInvoice
131
140
  `populate from item`.
132
141
  - `field <property>` takes at most one of `from <source>` or `compose using
133
142
  <Callback>`, plus an optional `label`.
134
- - At most one `on submit navigate to <Screen> [by <param>]`.
143
+ - At most one `on submit navigate to <Screen> [by <param>]`, the one-line form.
144
+ Any other `on` in a form body is a behavior attached to the form.
135
145
 
136
146
  ⚠️ **A form is discovered, not referenced.** It never appears in a screen's
137
147
  directive tree the way a `table` or `summary` does — it is found by its
@@ -140,6 +150,9 @@ level, so it disambiguates by module rather than by feature or slice.
140
150
 
141
151
  ## `contribute` — navigation from elsewhere
142
152
 
153
+ Excerpt, inside a `module` or `feature`; `Navigation` is the contribution point
154
+ the layout above declares.
155
+
143
156
  ```screenplay
144
157
  contribute to Navigation
145
158
  navigate to InvoiceList
@@ -162,8 +175,83 @@ same typed navigate binding a screen action uses.
162
175
  flat ordered list, and an explicit override for when nearest-enclosing is not the
163
176
  point you mean, are deliberately left for later.
164
177
 
178
+ ## Interactions — what a click does
179
+
180
+ A screen can say what it shows; an interaction says what happens when someone
181
+ acts. Three words carry it:
182
+
183
+ | Word | What it is |
184
+ | --- | --- |
185
+ | **Interaction trigger** | the `on <thing>` clause: `click`, `double click`, `select`, `submit`, `change`, `load`/`unload`, `enter`/`leave`, `event <Event>`, `interval <n> <unit>`, or a declared application trigger |
186
+ | **Action** | a closed set: `execute`, `navigate to`/`navigate back`, `open dialog`/`close dialog`, `refresh`, `set … to`, `notify`, `confirm`, `raise` |
187
+ | **Behavior** | a bundle of trigger-to-action bindings; inline (`on …`) or named (`behavior` + `uses`) |
188
+
189
+ A complete example — a named behavior with parameters, attached with `uses`, and
190
+ an inline `on` block with a continuation:
191
+
192
+ ```screenplay
193
+ concept InvoiceId : Uuid
194
+
195
+ behavior ConfirmThenExecute
196
+ parameter command
197
+ parameter message
198
+ on click
199
+ confirm message
200
+ on success
201
+ execute command
202
+
203
+ module Invoicing
204
+ feature InvoiceManagement
205
+ slice StateChange CancelInvoice
206
+ command CancelInvoice
207
+ invoiceId InvoiceId identifier
208
+ produces InvoiceCancelled
209
+ invoiceId = invoiceId
210
+ event InvoiceCancelled
211
+ invoiceId InvoiceId
212
+ screen CancelInvoiceScreen
213
+ data InvoiceStatusView via query InvoiceStatusById by invoiceId
214
+ uses ConfirmThenExecute
215
+ command CancelInvoice
216
+ message "Cancel this invoice?"
217
+ on enter
218
+ refresh InvoiceStatusById
219
+ on failure
220
+ notify error "The invoice could not be loaded"
221
+ slice StateView InvoiceStatus
222
+ readmodel InvoiceStatusView
223
+ invoiceId InvoiceId
224
+ cancelled Bool
225
+ projection InvoiceStatuses => InvoiceStatusView
226
+ from InvoiceCancelled key invoiceId
227
+ cancelled = true
228
+ query InvoiceStatusById => InvoiceStatusView?
229
+ by invoiceId InvoiceId
230
+ ```
231
+
232
+ - Write the one-off case inline; name it with `behavior` when several places need
233
+ the same wiring. A `uses` site must supply exactly the declared parameters
234
+ (`PLAY0337`, `PLAY0338`).
235
+ - `on`/`uses` attach at every level — `layout`, `module`, `feature`, templates,
236
+ `form`, `screen`, `section`, slot, `table` — and are **additive**: outer
237
+ attachments run first unless a behavior declares `order`.
238
+ - `on success`/`on failure` belong only on actions that can fail (`execute`,
239
+ `refresh`, `confirm`, `open dialog`, `raise`); `on result` only on `open dialog`.
240
+ A continuation on `navigate`, `notify`, `set` or `close dialog` is an error
241
+ (`PLAY0320`). Actions after an unconditional `navigate` are unreachable
242
+ (`PLAY0339`).
243
+ - Unknown commands, screens, queries, dialogs and behaviors are warnings, like
244
+ every other reference (`PLAY0330`–`PLAY0336`).
245
+ - **A declared `trigger` is not a UI event.** Use `on click`, not `trigger`, for a
246
+ button. `on <Trigger>` observes an application trigger and `raise <Trigger>`
247
+ fires one; that is where the two meet.
248
+ - Interactions are a closed vocabulary, not a scripting language. Validation stays
249
+ on the command; the UI surfaces it.
250
+
165
251
  ## `ui profile` and `theme`
166
252
 
253
+ Excerpt: `AppShell` is the layout above.
254
+
167
255
  ```screenplay
168
256
  ui profile Desktop
169
257
  target platform web
@@ -201,21 +289,39 @@ summary field `label`; a screen or section `title`; a contribution `label`; and
201
289
  form field `label`. The value is stored as the literal text `$strings.<key>`, and
202
290
  the printer emits it unquoted so a round trip preserves it.
203
291
 
204
- ## `file` — realization metadata, never a substitute
205
-
206
- Two meanings, one word. On a construct **with an implementation body** — a command
207
- `handler`, a validation rule predicate, a query `performer`, a reducer rule, a
208
- reaction trigger, a `constraint` and a `screen` — `file` stands in for the inline
209
- body. It sits on the **screen itself**, not on a directive inside it: `File` is a
210
- member of `ScreenSyntax`, and the directive types have no such member. On a **pure declaration** — `concept`, `type`, `event`, `readmodel`,
211
- `projection`, `slice`, `specification`, top-level `trigger` — it only records
212
- which file realizes it.
213
-
214
- The rules: **repository relative, never absolute** (an absolute path is warning
215
- `PLAY0264`); **never resolved** — the compiler does not look for the file, so a
216
- stale path does not invalidate the document; and **never replaces the
217
- declaration** — a `projection` still declares its blocks, an `event` still declares
218
- its properties.
292
+ ## `file` — implementation or provenance, never a substitute
293
+
294
+ Three meanings, one word:
295
+
296
+ - **Backend implementation attachment.** On a command `handler`, a validation
297
+ rule predicate, a query `performer`, a reducer rule, a reaction trigger, a
298
+ `constraint` and a `policy`, `file` stands in for the inline body: the
299
+ implementation lives there. These are the files a host inventories.
300
+ - **UI realization file.** On a `screen`, `file` names the file that realizes
301
+ the screen. It sits on the **screen itself**, not on a directive inside it:
302
+ `File` is a member of `ScreenSyntax`, and the directive types have no such
303
+ member. Screens are deferred from the executable model (`PLAY0269`), and the
304
+ attachment loader does not collect screen files: they are never loaded, hashed
305
+ or checked, so a missing screen file gets no `PLAY0430`–`PLAY0434` warning.
306
+ - **Provenance.** On a **pure declaration** — `concept`, `type`, `event`,
307
+ `readmodel`, `projection`, `slice`, `specification`, top-level `trigger` — it
308
+ only records which file realizes it.
309
+
310
+ The rules:
311
+
312
+ - **Repository relative, never absolute** (an absolute path is warning `PLAY0264`).
313
+ - **Syntax compilation never resolves it.** The `screenplay` tool and
314
+ `PlayFileCompiler` do not read files, so a stale path does not invalidate the
315
+ document. A host that loads attachments (the MCP server, `AttachmentFiles.Load`)
316
+ reads **backend implementation** files only, resolved from the model root
317
+ rather than the `.play` file's directory, to hash their content; a refused or
318
+ missing file stays unresolved with a `PLAY0430`–`PLAY0434` warning. Screen
319
+ files and declaration-only `file` references are never read; check a screen
320
+ file's path yourself.
321
+ - **It never replaces the declaration** — a `projection` still declares its
322
+ blocks, an `event` still declares its properties.
323
+ - **Loaded is not run.** Screenplay hashes attached code and can map an inline
324
+ body back to its source for an editor, but never compiles or executes it.
219
325
 
220
326
  ⚠️ `file <Identifier>` is read as a **property** named `file`, not a directive —
221
327
  the type-reference shape wins the tie. `file Invoices/Register.cs` is a directive;
@@ -234,9 +340,12 @@ a trigger value named `file` is written `@file`.
234
340
  checks them.
235
341
  - [ ] User-visible text is `$strings.` where the application is localized.
236
342
  - [ ] No `file` reference is doing work the declaration should be doing.
343
+ - [ ] Every click, submit and screen entry that does something has an `on` or
344
+ `uses`; continuations sit only on actions that can fail.
237
345
 
238
346
  ## Route near misses
239
347
 
240
348
  - A screen's own data, actions and name resolution: `cratis-screenplay-read-surface`.
349
+ - Application triggers and reactions: `cratis-screenplay-captures-and-reactions`.
241
350
  - Deriving wireframes from the model (step 4): `cratis-screenplay-event-modeling`.
242
351
  - Building the actual React application: `cratis-arc-react-page`, `cratis-components-styling`.
@@ -7,6 +7,9 @@
7
7
  { "kind": "skill-contains", "value": "`cratis ai install` manages `.cratis/ai/`, not `.cratis/screenplay/`" },
8
8
  { "kind": "skill-contains", "value": "A form is discovered, not referenced" },
9
9
  { "kind": "skill-contains", "value": "declares no\n`fits slot`" },
10
- { "kind": "skill-contains", "value": "override-priority order" }
10
+ { "kind": "skill-contains", "value": "override-priority order" },
11
+ { "kind": "skill-contains", "value": "A declared `trigger` is not a UI event" },
12
+ { "kind": "skill-contains", "value": "**Loaded is not run.**" },
13
+ { "kind": "skill-contains", "value": "belong only on actions that can fail" }
11
14
  ]
12
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "6.2.0",
3
+ "version": "6.3.1",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [