@cratis/pi 7.164.0 → 7.164.2

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 (49) hide show
  1. package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +1 -1
  2. package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +4 -0
  3. package/package/corpus/skills/cratis-chronicle-projection/references/dictionaries-set-once-ordering.md +47 -0
  4. package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -0
  5. package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +2 -0
  6. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +3 -1
  7. package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +24 -0
  8. package/package/corpus/skills/cratis-screenplay-command-surface/references/routes-and-external-operations.md +1 -1
  9. package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +3 -1
  10. package/package/corpus/skills/cratis-screenplay-delivery-planning/SKILL.md +1 -1
  11. package/package/corpus/skills/cratis-screenplay-delivery-planning/verification.json +3 -1
  12. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +16 -5
  13. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +2 -0
  14. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +6 -6
  15. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +1 -1
  16. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +13 -3
  17. package/package/corpus/skills/cratis-screenplay-model-authoring/references/storylines.md +68 -0
  18. package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +9 -1
  19. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +1 -0
  20. package/package/corpus/skills/cratis-screenplay-model-review/verification.json +2 -1
  21. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +1 -1
  22. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +1 -0
  23. package/package/corpus/skills/cratis-screenplay-projections/references/dictionaries-and-ordering.md +64 -0
  24. package/package/corpus/skills/cratis-screenplay-projections/references/graphs.md +99 -2
  25. package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +5 -0
  26. package/package/corpus/skills/cratis-screenplay-projections/verification.json +7 -1
  27. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +4 -2
  28. package/package/corpus/skills/cratis-screenplay-read-surface/references/screen-levels.md +2 -2
  29. package/package/corpus/skills/cratis-screenplay-read-surface/verification.json +3 -1
  30. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +1 -0
  31. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +8 -0
  32. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +5 -1
  33. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +1 -1
  34. package/package/corpus/skills/cratis-screenplay-slice-design/references/model-reasoning.md +1 -1
  35. package/package/corpus/skills/cratis-screenplay-specifications/references/graph-steps.md +10 -0
  36. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +5 -1
  37. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +1 -1
  38. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +52 -0
  39. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +3 -2
  40. package/package/corpus/skills/cratis-screenplay-toolchain/references/language-admission.md +14 -0
  41. package/package/corpus/skills/cratis-screenplay-toolchain/references/model-export-diff-rename.md +68 -0
  42. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +1557 -42
  43. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
  44. package/package/corpus/skills/cratis-screenplay-toolchain/references/sources-and-streams.md +2 -2
  45. package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +1 -1
  46. package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +1 -2
  47. package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +14 -1
  48. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +1 -1
  49. package/package.json +1 -1
@@ -8,6 +8,7 @@
8
8
  - Storing a graph in a named sink
9
9
  - Reading the graph backwards
10
10
  - Reading a graph with a query
11
+ - Collect nested rows
11
12
  - The five operations
12
13
  - What a graph projection cannot say
13
14
  - Diagnostics
@@ -273,6 +274,97 @@ The read-surface side is in
273
274
  query in a specification with `then query`
274
275
  ([graph steps](../../cratis-screenplay-specifications/references/graph-steps.md)).
275
276
 
277
+ ## Collect nested rows
278
+
279
+ Requires Screenplay 6.29.0 or later (`screenplay --version`); a collecting query selects ESM v54.
280
+
281
+ A query returns nested rows with a `return` assignment of the form
282
+ `<property> = collect <root> -[alias:]TYPE-> [alias:]Label` (or `<-[alias:]TYPE-` for an incoming
283
+ edge), followed by one line per row property:
284
+
285
+ ```screenplay
286
+ concept PersonId : Uuid
287
+ concept GroupId : Uuid
288
+ concept Name : String
289
+
290
+ type GroupMembership
291
+ id GroupId
292
+ name Name
293
+ since DateTime optional
294
+
295
+ type GroupSummary
296
+ id GroupId
297
+ name Name
298
+
299
+ module Organization
300
+ feature Chart
301
+ slice StateView OrganizationViews
302
+ graph Organization
303
+ node Person
304
+ personId PersonId key
305
+ name Name
306
+ node Group
307
+ groupId GroupId key
308
+ name Name
309
+ edge MEMBER_OF source Person target Group
310
+ since DateTime optional
311
+ edge PART_OF source Group target Group
312
+
313
+ readmodel PersonWithGroups
314
+ id PersonId key
315
+ name Name
316
+ groups GroupMembership[]
317
+
318
+ readmodel GroupWithParent
319
+ id GroupId key
320
+ name Name
321
+ parent GroupSummary optional
322
+
323
+ query PeopleInGroup => PersonWithGroups[] graph Organization
324
+ filter groupId GroupId
325
+ match person:Person
326
+ where group.groupId = $groupId
327
+ return
328
+ id = person.personId
329
+ name = person.name
330
+ groups = collect person -membership:MEMBER_OF-> group:Group
331
+ id = group.groupId
332
+ name = group.name
333
+ since = membership.since
334
+
335
+ query GroupsWithParent => GroupWithParent[] graph Organization
336
+ match group:Group
337
+ return
338
+ id = group.groupId
339
+ name = group.name
340
+ parent = collect group -PART_OF-> parent:Group
341
+ id = parent.groupId
342
+ name = parent.name
343
+ ```
344
+
345
+ - **The root.** The query reads like a view: one `match <alias>:<Label>` of its root alone, no hops
346
+ and no `optional match`. Scalar returns come from the root; each result row is one root node,
347
+ distinct by key and ordered by the key (`PLAY1147` otherwise).
348
+ - **The edge.** A collect follows one declared edge from the root, outgoing or incoming; the arrow
349
+ settles the direction, so an edge whose source and target share a label (`PART_OF`) is never
350
+ ambiguous. Name the edge (`-membership:MEMBER_OF->`) to read one of its properties.
351
+ - **The rows.** The property is a list of a composite type (`GroupMembership[]`) or an optional one
352
+ (`GroupSummary optional`), and the lines under the collect assign every required property of the
353
+ type (`PLAY1145`). A list has one row per edge reached, ordered by the reached node's key and then
354
+ the edge's `identified by` value, and is empty when nothing is reached; an optional row is the
355
+ first of those, or null.
356
+ - **Conditions select roots.** A `where` on a collected node keeps the roots with at least one
357
+ reached node that satisfies every condition on that alias; it never narrows what is collected. A
358
+ condition on a collected edge is `PLAY1147`.
359
+ - **Absent properties.** A node created only by an edge has none of its other properties yet; a row
360
+ reads them as null.
361
+ - **One level.** A collect inside a collect is `PLAY1146`; a malformed collect is `PLAY1144`.
362
+
363
+ Assert collected rows in a specification with structured values: see
364
+ [graph steps](../../cratis-screenplay-specifications/references/graph-steps.md#asserting-collected-rows).
365
+ Stage may not render a collecting query; see the ESM v54 row in
366
+ [language admission](../../cratis-screenplay-toolchain/references/language-admission.md).
367
+
276
368
  ## The five operations
277
369
 
278
370
  Every sink applies the same idempotent operations: `UpsertNode`, `SetProperties`,
@@ -281,8 +373,9 @@ identified by label and key; edges by type, source, target and the `identified b
281
373
 
282
374
  ## What a graph projection cannot say
283
375
 
284
- `children`, `nested`, `join`, `all`, `clear with`, `remove via join`, `variant`, a
285
- projection-level `key` or `sequence`, and `automap` blocks are `PLAY0872`. There is
376
+ `children`, `nested`, `join`, `all`, `clear with`, `variant`, a
377
+ projection-level `key` or `sequence`, and `automap` blocks are `PLAY0872`;
378
+ `remove via join` is read as a malformed removal and is `PLAY0873`. There is
286
379
  no engine-native block: whatever the language cannot say is not supported. The event
287
380
  model board, find-references and rename do not follow graph projections, so renaming
288
381
  an event leaves a graph projection reported as unknown.
@@ -316,3 +409,7 @@ an event leaves a graph projection reported as unknown.
316
409
  | `PLAY0884` | Graph query uses the same alias twice |
317
410
  | `PLAY0885` | Graph query uses variable-length paths, `or`, ranges, functions or aggregates |
318
411
  | `PLAY0886` | `foreach` names a collection inside another, or something that is not a list of a composite type of the event |
412
+ | `PLAY1144` | Malformed `collect` (shape, start at the root, row lines) |
413
+ | `PLAY1145` | `collect` does not fit the read model: not `Row[]` or `Row optional`, or a row property unknown, duplicate, missing or mistyped |
414
+ | `PLAY1146` | `collect` nested inside another `collect` |
415
+ | `PLAY1147` | Collecting query is not view-shaped, or has a `where` condition on a collected edge |
@@ -114,6 +114,11 @@ LiteralKeyword = "literal", " ", Literal ; (* parsed at the Expr level *)
114
114
  | Counters | `^(increment\|decrement\|count\|clear)\s+(@?[$\w.]+)$` |
115
115
  | Arithmetic | `^(add\|subtract)\s+(@?[$\w.]+)\s+by\s+(.+)$` |
116
116
  | Assignment | `^(@?[$\w.@]+)\s*=(?!=\|>)\s*(.+)$` |
117
+ | Set once | `^set\s+once\s+(@?[$\w.]+)\s+(?:=\|to)\s+(.+)$` |
118
+ | Remove entry | `^remove\s+(@?[$\w.]+)$` (target ends in a dynamic key) |
119
+ | Children ordering | `insert first`, `insert last`, `sort by <property> [ascending\|descending]` |
120
+
121
+ Diagnostics `PLAY0956`-`PLAY0963` for these lines are in [dictionaries and ordering](dictionaries-and-ordering.md#diagnostics).
117
122
 
118
123
  ## Diagnostics
119
124
 
@@ -38,6 +38,12 @@
38
38
  { "kind": "skill-contains", "value": "Requires Screenplay 5.10.0 or later", "file": "references/graphs.md" },
39
39
  { "kind": "skill-contains", "value": "runs in the reference runner as UTC text" },
40
40
  { "kind": "skill-contains", "value": "`PLAY1142` (`SecretConceptProjected`)", "file": "references/secret-concepts.md" },
41
- { "kind": "skill-contains", "value": "references/secret-concepts.md" }
41
+ { "kind": "skill-contains", "value": "references/secret-concepts.md" },
42
+ { "kind": "skill-contains", "value": "## Collect nested rows", "file": "references/graphs.md" },
43
+ { "kind": "skill-contains", "value": "Requires Screenplay 6.29.0 or later", "file": "references/graphs.md" },
44
+ { "kind": "skill-contains", "value": "insert first", "file": "references/dictionaries-and-ordering.md" },
45
+ { "kind": "skill-contains", "value": "sort by", "file": "references/dictionaries-and-ordering.md" },
46
+ { "kind": "skill-contains", "value": "`PLAY0963`", "file": "references/dictionaries-and-ordering.md" },
47
+ { "kind": "skill-contains", "value": "Requires Screenplay 6.9.0", "file": "references/dictionaries-and-ordering.md" }
42
48
  ]
43
49
  }
@@ -74,7 +74,9 @@ It is never inferred, and a query or screen that consumes it is error `PLAY0859`
74
74
 
75
75
  ## `query`
76
76
 
77
- A query that ends in `graph <Graph>` reads a graph: see [graph queries](references/graph-queries.md).
77
+ A query's HTTP shape and a screen's data contract are exported (`screenplay export --format openapi|ui`; [formats](../cratis-screenplay-toolchain/references/model-export-diff-rename.md#openapi-and-ui-contract-formats)).
78
+
79
+ A query that ends in `graph <Graph>` reads a graph: see [graph queries](references/graph-queries.md). Such a query may return nested rows with `collect` (a view-shaped query; see [collect nested rows](../cratis-screenplay-projections/references/graphs.md#collect-nested-rows)).
78
80
 
79
81
  Excerpt: the concepts, the read model and the policy are declared elsewhere.
80
82
 
@@ -216,7 +218,7 @@ screen InvoiceList
216
218
  `html`, `csharp`). A screen's `data` and `action` declarations are the typed context for UI
217
219
  composition: if a generated app shows a default list or empty panel because it could not consume
218
220
  one of those directives, treat that as a dropped UI construct, not an acceptable Level 1 screen.
219
- Screens and interactions are deferred from the executable model (information `PLAY0269`); what a
221
+ Screens and interactions are deferred by default (information `PLAY0269`); `screenplay export --screens` admits the neutral parts as ESM v42 (data, actions, navigation, layout; never blocking binding); what a
220
222
  click or submit *does* is an interaction (`cratis-screenplay-ui-composition`). Read
221
223
  [screen levels](references/screen-levels.md) for the Level 2 example and the construct list.
222
224
 
@@ -47,5 +47,5 @@ a dropped UI construct, not as an acceptable Level 1 screen.
47
47
  selection, submit or screen entry *does* beyond that — confirm, execute, refresh,
48
48
  open a dialog, branch on success or failure — is an interaction: an inline `on`
49
49
  block or a named `behavior` attached with `uses`. See
50
- `cratis-screenplay-ui-composition`. Screens and interactions are deferred from the
51
- executable model (information `PLAY0269`); they never block binding.
50
+ `cratis-screenplay-ui-composition`. Screens and interactions are deferred by default
51
+ (information `PLAY0269`) and admitted on request as ESM v42 with `screenplay export --screens`; they never block binding.
@@ -37,6 +37,8 @@
37
37
  { "kind": "skill-contains", "value": "[passive read models](references/passive.md) before declaring one" },
38
38
  { "kind": "skill-contains", "value": "| `PLAY0859` | Error | A `query` returns a passive read model", "file": "references/passive.md" },
39
39
  { "kind": "skill-contains", "value": "Requires Screenplay 5.3.0", "file": "references/passive.md" },
40
- { "kind": "skill-contains", "value": "[graph queries](references/graph-queries.md)" }
40
+ { "kind": "skill-contains", "value": "[graph queries](references/graph-queries.md)" },
41
+ { "kind": "skill-contains", "value": "collect nested rows" },
42
+ {"kind":"skill-contains","value":"ESM v42"}
41
43
  ]
42
44
  }
@@ -217,6 +217,7 @@ whole re-render. What to do:
217
217
  - Screens reported as `PLAY0269` are information that the backend profile defers them. They are not
218
218
  proof of a rendered screen: check the running app (`cratis-screenplay-toolchain` `references/fast-path.md`)
219
219
  and list any authored screen that is missing as not rendered.
220
+ - Scope a re-render with `screenplay diff --format json` (`slices`, `modelWide`); other stacks read ESM v42 or `--format ui`: [exports](references/renderability-gate.md#cli-exports-and-diffs).
220
221
 
221
222
  ## Gate
222
223
 
@@ -80,6 +80,14 @@ generated values/responses Stage#175 (now render on the pinned bundle). Closed:
80
80
  Stage#178, ESM v7 Stage#201. Check that an issue is still open before citing
81
81
  it, and cite only numbers you have just read. A closed issue is a trigger to probe again.
82
82
 
83
+ ## CLI exports and diffs
84
+
85
+ - `screenplay diff <before> <after> --format json` finds what changed between two model versions; `screenplay export --scope <slice>` hands one slice's ESM to a builder ([CLI reference](../../cratis-screenplay-toolchain/references/model-export-diff-rename.md)).
86
+ - After a model change, read `slices` (MCP `semantic-diff`, `ModelDifference.Slices` or `screenplay diff --format json`) to choose the slices to re-render or re-gap-fill; a non-empty `modelWide` may affect every slice.
87
+ - A builder for another stack can read screens from an ESM v42 export (`screenplay export --screens`; .NET `UiContractBuilder.For(model)`); refresh, state, notifications and dialogs are not carried.
88
+ - A builder for another stack reads routes and payloads from `screenplay export --format openapi` and screens from `--format ui` instead of copying a renderer's conventions ([formats](../../cratis-screenplay-toolchain/references/model-export-diff-rename.md#openapi-and-ui-contract-formats)).
89
+ - A graph query that `collect`s nested rows is ESM v54: Stage must admit v54 before it renders it. A refusal is a drift event, so keep the query ([graphs](../../cratis-stage-rendering-and-sandbox/references/graphs.md)).
90
+
83
91
  ## Reference outcomes
84
92
  - The complete marina model of `cratis-stage-rendering-and-sandbox` `references/render-example.md`:
85
93
  admission ok, Debug build ok and its tests passed on the public CLI.
@@ -52,6 +52,10 @@
52
52
  { "kind": "skill-contains", "value": "responsible tool version" },
53
53
  { "kind": "skill-contains", "value": "`GraphSinks` into its render input, or a changed `sink` line never triggers a re-render" },
54
54
  { "kind": "skill-contains", "value": "unknown-preserving-reader.md" },
55
- { "kind": "skill-contains", "value": "not a constructor-order promise" }
55
+ { "kind": "skill-contains", "value": "not a constructor-order promise" },
56
+ {"kind":"skill-contains","value":"screenplay diff"},
57
+ {"kind":"skill-contains","value":"ESM v42"},
58
+ {"kind":"skill-contains","value":"--format ui"},
59
+ {"kind":"skill-contains","value":"modelWide"}
56
60
  ]
57
61
  }
@@ -243,7 +243,7 @@ rules, gates, mappings or contracts to make an example pass.
243
243
  and booleans, quoted declared enum members. Dates are concrete ISO dates in the story's
244
244
  future, instants offset-qualified; fix `given clock` when asserting occurrence-time values.
245
245
  No `{uuid}`/`{now}` placeholders. No real personal data.
246
- - Structured values: single-line JSON with quoted keys and required members; empty, single and
246
+ - Structured values: indented `item` blocks (no JSON, `PLAY0833`) with every required member; empty, single and
247
247
  several items where that changes behaviour.
248
248
  - Competing claim: different source ids, same constrained value. Retry: same source id and inputs.
249
249
  Removal: an existing target, plus a second row that must survive. Branch: inputs that flip the
@@ -6,7 +6,7 @@
6
6
  Use `description` for a short summary and `documentation` for assumptions,
7
7
  boundaries, trade-offs and rejected alternatives. Put reasoning on the declaration
8
8
  it explains, not in comments or disconnected session notes. Modules, features,
9
- slices, commands, events, read models and reactions accept one nonempty block,
9
+ slices, commands, events, read models, graphs and reactions accept one nonempty block,
10
10
  directly in their body (not beneath a reaction trigger). Queries, personas and other
11
11
  declarations do not accept `documentation`: keep their intent in `description` (a
12
12
  query's ordering, "oldest first", for example). A short status marker such as **NOT
@@ -5,6 +5,7 @@
5
5
  - Steps
6
6
  - Example
7
7
  - Asserting a graph query
8
+ - Asserting collected rows
8
9
  - Rules
9
10
 
10
11
  ## Steps
@@ -161,6 +162,15 @@ module Organization
161
162
  since = "2026-10-05T07:00:00Z"
162
163
  ```
163
164
 
165
+ ## Asserting collected rows
166
+
167
+ Requires Screenplay 6.29.0 or later (`screenplay --version`). A query that `collect`s nested rows
168
+ (see [collect nested rows](../../cratis-screenplay-projections/references/graphs.md#collect-nested-rows))
169
+ is asserted under `then query` with structured values (an indented `item` block per row; Screenplay has no JSON, `PLAY0833`): the collected
170
+ property on its own line, one `item` block per row, in order; `<property> none` asserts an empty
171
+ list and `<property> = null` an absent optional row. List rows compare in order: the reached node's
172
+ key, then the edge's `identified by` value.
173
+
164
174
  ## Rules
165
175
 
166
176
  - Keys are the values of the node's `key` property, written as literals.
@@ -88,7 +88,7 @@ Independent results, not a ladder. Read `references/verdicts.md` for the command
88
88
  | --- | --- | --- |
89
89
  | V1 | authorable (compiles, warnings as errors) | the folder command above |
90
90
  | V2 | executable diagnostics read | MCP `open-workspace`, then `read-workspace view=executable-diagnostics` |
91
- | V3 | binding-ready (binds, no blocking executable diagnostics) | `executableReady` true and no error-severity diagnostic in V2; informational PLAY0269/0270 are reported separately |
91
+ | V3 | binding-ready (binds, no blocking executable diagnostics) | `executableReady` true and no error-severity diagnostic in V2; informational PLAY0269/0270 are reported separately; screens are deferred by default and admitted on request as ESM v42 (`export --screens`) |
92
92
  | V4 | reference specifications run | `screenplay test` or MCP `run-specifications`; unsupported/unbound is not a pass; rendered Debug tests are V5.tests, never V4 |
93
93
  | V5 | rendered and target-verified | `cratis render`, then Debug build and tests; report admission, publication, build and tests separately |
94
94
 
@@ -236,6 +236,10 @@ unresolved questions: the standalone tool has `--open-questions fail`; `cratis s
236
236
  does through `--open-questions report|fail`. It is separate from compilation and `--warnaserror`.
237
237
  Requires Cratis CLI 3.60.0 or later (`cratis --version`) for that option; older CLIs lack it.
238
238
 
239
+ Read [language admission](references/language-admission.md#esm-json-schemas) for the published ESM JSON Schemas (shape, not admission).
240
+
241
+ Read [export, compare and rename](references/model-export-diff-rename.md) for `screenplay export`, `diff` and `rename` and persisted identities.
242
+
239
243
  Read [fast path](references/fast-path.md) for the ordered requirements-to-running-app checklist (validate, `render --check`, render, build, run, check in a browser, run the specs).
240
244
 
241
245
  ## Route near misses
@@ -99,7 +99,7 @@ remain unadmitted. Compile and test each relevant fixture with the chosen tool.
99
99
  at most once. Canonical printing may place it first, but the parser does not
100
100
  require that position. Source preambles precede declarations.
101
101
  - Strings: `"..."`, escapes `\" \\ \n \r \t`; other backslashes kept (regex `"^INV-\d{6}$"` works).
102
- - Structured values: single-line JSON, quoted keys (`[{"sku": "A-1", "quantity": 2}]`).
102
+ - Structured values: the property name, then an indented `item` block per list row; `<property> none` for an empty list. Screenplay has no JSON (`PLAY0833`).
103
103
  - Literal property/concept text rules use `contains`, `not contains`, `starts with`,
104
104
  `ends with` with quoted operands (v24, ordinal UTF-16). Portable `matches` refuses
105
105
  nonportable constructs with PLAY0699; exact Studio patterns warn PLAY0787.
@@ -22,6 +22,10 @@
22
22
  - Sinks (PLAY0931-PLAY0939)
23
23
  - Passive read models (PLAY0858-PLAY0860)
24
24
  - Graph queries and `foreach` (PLAY0878-PLAY0886)
25
+ - Graph query `collect` (PLAY1144-PLAY1147)
26
+ - Set once, dictionary keys and children ordering (PLAY0956-PLAY0963)
27
+ - Development users (PLAY0888-PLAY0889)
28
+ - Storylines (PLAY0940-PLAY0943)
25
29
  - Screen visuals and slice placements (PLAY0950-PLAY0955)
26
30
  - Structural completeness and timeline checks
27
31
  - Editor versus C# verdicts
@@ -440,6 +444,54 @@ codes PLAY0862-PLAY0877 are listed there too.
440
444
  | PLAY0885 | E | It uses variable-length paths, `or`, ranges, functions or aggregates; none exist. |
441
445
  | PLAY0886 | E | A graph handler's `foreach` names a collection inside another, or something that is not a list of a composite type of the event. |
442
446
 
447
+ ## Graph query `collect` (PLAY1144-PLAY1147)
448
+
449
+ Requires Screenplay 6.29.0 or later (`screenplay --version`); a collecting query selects ESM v54.
450
+ Both compilers report these codes. The rules are in
451
+ `../../cratis-screenplay-projections/references/graphs.md#collect-nested-rows`.
452
+
453
+ | Code | Severity | Meaning / fix |
454
+ | --- | --- | --- |
455
+ | `PLAY1144` | E | A `collect` is malformed: not `<property> = collect <root> -[alias:]TYPE-> [alias:]Label` (or `<-[alias:]TYPE-`), not starting at the query's root, without row lines, or a row line that is not `<property> = <alias>.<property>`. |
456
+ | `PLAY1145` | E | A `collect` does not fit the read model: the property is not `Row[]` or `Row optional` of a composite type, or a row assigns an unknown, duplicate or mistyped property or leaves a required one out. |
457
+ | `PLAY1146` | E | A `collect` is nested inside another; collect from the root in a collect of its own. |
458
+ | `PLAY1147` | E | The query does not have the shape of a view: one `match <alias>:<Label>` of the root alone, scalar returns from the root, and no `where` condition on a collected edge. |
459
+
460
+ ## Set once, dictionary keys and children ordering (PLAY0956-PLAY0963)
461
+
462
+ Requires Screenplay 6.9.0 or later (`screenplay --version`). Rules and fixes: `../../cratis-screenplay-projections/references/dictionaries-and-ordering.md`.
463
+
464
+ | Code | Severity | Meaning / fix |
465
+ | --- | --- | --- |
466
+ | PLAY0956 | E | `remove <target>` without a dynamic key; end the target in `.$eventContent.<property>`, `.$eventContext.<path>` or `.$causedBy.<member>`, or use `clear` to empty the property. |
467
+ | PLAY0957 | E | `.$eventContent` names no event property, or `.$causedBy` names a member other than `subject`, `name`, `userName`. |
468
+ | PLAY0958 | E | A children ordering line is malformed, has indented lines, or stands outside `children`. |
469
+ | PLAY0959 | E | A `children` block declares more than one ordering line. |
470
+ | PLAY0960 | W | `sort by` names a property the child type does not declare. |
471
+ | PLAY0961 | W | A `.$eventContent` path the handled event does not have. |
472
+ | PLAY0962 | W | A dynamic key writes into a declared read-model property; Screenplay has no dictionary type. |
473
+ | PLAY0963 | E | `clear` with a dynamic key; write `remove`. |
474
+
475
+ ## Development users (PLAY0888-PLAY0889)
476
+
477
+ Requires Screenplay 5.11.0 or later (`screenplay --version`). See `../../cratis-screenplay-command-surface/references/policy-persona-seed.md#users`.
478
+
479
+ | Code | Severity | Meaning / fix |
480
+ | --- | --- | --- |
481
+ | `PLAY0888` | E | A `user` plays a persona that no `persona` declaration names. |
482
+ | `PLAY0889` | E | Two `user` declarations carry the same name. |
483
+
484
+ ## Storylines (PLAY0940-PLAY0943)
485
+
486
+ Requires Screenplay 6.6.0 or later (`screenplay --version`). Authoring metadata; see `../../cratis-screenplay-model-authoring/references/storylines.md`.
487
+
488
+ | Code | Severity | Meaning / fix |
489
+ | --- | --- | --- |
490
+ | `PLAY0940` | E | A `storyline` declaration is not `storyline <Name> ["<title>"]`. |
491
+ | `PLAY0941` | E | A step is not `<kind> <reference> ["<note>"]`, has an unknown kind, or has a nested line. |
492
+ | `PLAY0942` | W | A step names an element that no declaration of that kind matches; remove it or point it at its replacement. An ambiguous step is `PLAY0198`: qualify it. |
493
+ | `PLAY0943` | E | Two storylines carry the same name. |
494
+
443
495
  ## Screen visuals and slice placements (PLAY0950-PLAY0955)
444
496
 
445
497
  Requires Screenplay 6.7.0 or later (`screenplay --version`). Both are presentation-only; neither
@@ -22,7 +22,8 @@
22
22
  What the binder admits, and what it refuses with which code, depends on the compiler: the
23
23
  standalone tool binds the newest ESM versions, while the compiler bundled in the CLI (and the
24
24
  renderer that uses it) admits through an older version. Operations, the `numbers exact`
25
- **source mode** (PLAY0268) remain unadmitted. Routes bind as
25
+ **source mode** (PLAY0268) and systems in a model where none declares an ability remain
26
+ unadmitted; any ability admits every system at v50. Routes bind as
26
27
  ESM v8, public/direction constructs as v9, identity/overrides/filters as v10, qualifying
27
28
  non-route Double literals (exact lowering of Double-mode literals) as v11, non-positional enum
28
29
  numbers as v12, concept compliance as v13, caller-supplied collection equality filters as v14,
@@ -420,7 +421,7 @@ standalone single-event reaction body (Requires Screenplay 4.258.0; see
420
421
  | `$eventContext.occurred.Week` | PLAY0273 | derived value |
421
422
  | Projection `parent p` where `p` is not on the child event | PLAY0273 | "Event property not found" |
422
423
  | `generated` or `returns` on an older compiler | PLAY0268 | admitted from ESM v7, see above |
423
- | Operations or systems, `numbers exact` source mode | PLAY0268 | not admitted by any supported ESM version; one such construct leaves the **whole** application without an executable model. Event sources/streams/routes instead bind as ESM v8 on the current compiler (`sources-and-streams.md`) |
424
+ | Operations, systems when no system declares an ability, `numbers exact` source mode | PLAY0268 | not admitted by any supported ESM version (once any system declares an ability, all systems bind at v50); one such construct leaves the **whole** application without an executable model. Event sources/streams/routes instead bind as ESM v8 on the current compiler (`sources-and-streams.md`) |
424
425
  | Spec of a gated command or query without `given caller` | PLAY0389 | module and feature gates count |
425
426
  | `given` or `then readmodel` missing key parts | PLAY0351 | explicit `key` marks replace inference; composite fixtures need every part (v27) |
426
427
  | When-less spec asserting events or errors | PLAY0352 | |
@@ -6,6 +6,7 @@
6
6
  ## Contents
7
7
 
8
8
  - Version selection
9
+ - ESM JSON Schemas
9
10
  - Compiler and target minimums
10
11
  - Construct guidance
11
12
  - Stage admission and execution
@@ -33,13 +34,20 @@ exact language/semantic pairs; binding, reference execution and rendering are se
33
34
  | v34 | A specification `then invokes <Command>` (decision 0115; PLAY0815/PLAY0816) | Writes `thenInvocations` only when present. When one is stated, the slice's recorded invocations must match in count and order, comparing only stated values; a refused invocation counts | Stage spec runner compares it; the Cratis renderer refuses models after v33 with `STAGE-ESM-016` |
34
35
  | v35 | Reserved for handler result contract v2 (decision 0119); no construct selects it | | |
35
36
  | v36 | `statemachine` and `workflow` declarations (decision 0124; PLAY0834-PLAY0851) | Serializes `stateMachines` and `workflows`; specifications run them; earlier models keep their version and bytes | Stage refuses v36 models with `STAGE-ESM-016` |
37
+ | v42 | Screens admitted on request with `screenplay export --screens` (decision 0149) | Adds optional `screens` to each slice (data, actions, navigation, layout); screens are not a version selector by default and earlier models keep their bytes | Admission by Stage is separate; screens are not evidence a target renders them |
38
+ | v43 | `set once` or a `children` ordering line (PLAY0956-PLAY0963) | Serializes the `setOnce` operation and `ordering`; earlier models keep their version and bytes | Admission by Stage is separate; a refusal means the model is not renderable yet |
36
39
  | v53 | `audience`, `availability` and `available` gates (decision 0162; PLAY1130-PLAY1141) | Serializes the gates; specifications and the reference evaluator treat every gate as available and report opaque `provide` sources as unsupported; earlier models keep their version and bytes | Admission by Stage is separate: a refusal such as `STAGE-ESM-016` means the model is not renderable yet, never a reason to drop the gate. See `../../cratis-screenplay-availability/SKILL.md` |
40
+ | v54 | A graph query `collect` (decision 0163; PLAY1144-PLAY1147) | Serializes the collects on the query; earlier models keep their version and bytes | Admission by Stage is separate: a refusal means the model is not renderable yet, never a reason to drop the collect. Check `cratis render` |
37
41
 
38
42
  Constructs of decision 0098 with no executable-model content need no version: application-level hooks in a layout's actions outlet (`default <id> title "..." slice <Slice>` with an optional indented `authorize <Policy>`), and a capture over events that copies a list (`lines = $.lines`) or fans out with `children lines identified by sku`. Check `screenplay --version` against the release that admitted v29 and v30 before relying on them. Decision 0115 withdrew 0098's command specification that states the public event its outbound Translate slice publishes: a specification runs only its own slice, so the Translate slice states the public event in its own `when append` specification.
39
43
 
40
44
  Read-model property order is opt-in ESM 37.1 metadata: see
41
45
  [read-model property order](read-model-property-order.md).
42
46
 
47
+ ## ESM JSON Schemas
48
+
49
+ Requires Screenplay 6.2.0 or later (`screenplay --version`). A JSON Schema (draft 2020-12) is published per released ESM version from 1.0 (v39 was never released) at `https://raw.githubusercontent.com/Cratis/Screenplay/main/Documentation/screenplay/esm/esm-v<major>.schema.json` (`.0` versions) or `.../esm-v<major>.<minor>.schema.json` (minors); pick it from the document's `semanticVersion`. A schema checks shape, not admission: a document that validates is well-formed, but only the Screenplay reader (and a consumer's admission rules) accepts it. Ajv needs `allowUnionTypes`. In .NET, `EsmJsonSchema.For(version)` returns the same text.
50
+
43
51
  ## Compiler and target minimums
44
52
 
45
53
  Requires Screenplay 4.181.0 or later (`screenplay --version`) for atomic batches; older compilers cannot admit the preamble.
@@ -58,8 +66,14 @@ Requires Screenplay 4.204.0 (ESM v27; `screenplay --version`) for composite read
58
66
 
59
67
  Requires Screenplay 4.205.0 (ESM v28; `screenplay --version`) for Uuid equality in command conditions; older binders report PLAY0268.
60
68
 
69
+ Requires Screenplay 6.8.0 (ESM v42; `screenplay --version`) for screens in the executable model via `export --screens`.
70
+
71
+ Requires Screenplay 6.9.0 (ESM v43; `screenplay --version`) for `set once` and children ordering.
72
+
61
73
  Requires Screenplay 6.26.0 (ESM v53; `screenplay --version`) for audiences, availabilities and gates, and 6.25.0 for `provide`; older compilers report the lines as unknown.
62
74
 
75
+ Requires Screenplay 6.29.0 (ESM v54; `screenplay --version`) for graph query `collect`; older compilers do not admit it.
76
+
63
77
  Current renderer versus semantic-execution support is owned by
64
78
  [Stage target boundaries](../../cratis-stage-rendering-and-sandbox/references/current-boundaries.md),
65
79
  at the product inventory's reviewed baseline; the CLI still applies its independent version gate.
@@ -0,0 +1,68 @@
1
+ <!-- Copyright (c) Cratis. All rights reserved. -->
2
+ <!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
3
+
4
+ # Export, compare and rename from the CLI
5
+
6
+ Read this when a script or a builder needs a model's executable bytes, the difference between two model versions, or an identity-preserving rename without an MCP session.
7
+ Requires Screenplay 6.1.0 or later (`screenplay --version`).
8
+
9
+ ## Export
10
+
11
+ `screenplay export [PATH] [--format esm|openapi|ui] [--screens] [--scope <Module>[.<Feature>[.<Slice>]]] [--output <path>]`
12
+
13
+ - `esm` (the default) writes the executable semantic model, byte-identical to `SemanticModelSerializer.Serialize`, including `schemaVersion` and `revision`. `PATH` defaults to the current folder; without `--output` the bytes go to stdout; an identical existing file is left untouched.
14
+ - `--scope` keeps one module, feature or slice plus the application-wide declarations (concepts, types, policies, triggers, event sources, lifecycles, graphs). The excerpt's `revision` identifies the excerpt.
15
+
16
+ | Exit | Meaning |
17
+ | --- | --- |
18
+ | 0 | Written |
19
+ | 1 | No executable model for the sources, or `--screens` refused |
20
+ | 2 | Invalid arguments or scope, or unreadable sources |
21
+
22
+ ### OpenAPI and UI contract formats
23
+
24
+ Requires Screenplay 6.5.0 or later (`screenplay --version`).
25
+
26
+ | `--format` | Output | Needs an executable model | Exit |
27
+ | --- | --- | --- | --- |
28
+ | `openapi` | OpenAPI 3.1 of every command and query | Yes | 1 without one; `--scope` narrows |
29
+ | `ui` | Stack-neutral `screenplay-ui/1` JSON: data, actions, navigation, layout, optional Scene layer | No, only sources | 0 even without one (identities and routes are then absent and stderr says so); `--scope` keeps that module, feature or slice's screens |
30
+
31
+ `--format openapi`: a command is a `POST` with its inputs as the JSON body plus `POST <route>/validate`; a query is a `GET` with the `by` key and filters in the query string, and list queries take `page`, `pageSize`, `sortBy`, `sortDirection`. Observable queries carry `x-screenplay-observable` (open them as a WebSocket). `x-screenplay-authorization` is `anonymous: true` when nothing applies, else `requires` with the policy names; `x-screenplay-policies` lists the policies; each operation has `x-screenplay-kind` (`command`, `query`, `validation`), `x-screenplay-id` and `x-screenplay-slice`. Responses use the `CommandResult` and `QueryResult` envelopes, `info.version` is the executable-model revision, and the same model gives the same bytes.
32
+
33
+ MCP `read-workspace` `view: "api-description"` (format `openapi-3.1.0`) and `"ui-contract"` (`screenplay-ui/1`) page the decoded bytes like `executable-model` (`limit` 1 to 196608, `expectedRevision`, `expectedModelRevision`). `api-description` reports `available: false` without bytes when there is no executable model; `ui-contract` stays available with `modelRevision: null`.
34
+
35
+ ### Screens in the export
36
+
37
+ Requires Screenplay 6.8.0 or later (`screenplay --version`). Screens are deferred from the executable model by default (`PLAY0269`, information) and an export keeps its version and bytes. `screenplay export --screens` (ESM format only; with another format it is rejected) admits them as ESM v42 (language and semantic `42.0`, `schemaVersion: 42`); a screen that places an extension component makes it ESM v52 and lists the extensions needed. MCP `read-workspace` with `view: "executable-model"` and `screens: true` does the same (pass it on every page so `modelRevision` stays pinned).
38
+
39
+ Each slice then carries an optional final `screens` member: `id`, `name`, `title`, optional `description`, ordered `data` (query identity, optional `by`, shown `fields`), `actions` (command identity, `label`, `subject`, every command input as a property identity with optional `from`, optional `when`, optional `then` screen), `navigation` (target screen, `trigger`, optional `by`, `opens`) and a `layout` of `fits` and nested `regions`. Refresh, state, notifications and dialogs are not carried.
40
+
41
+ A reference the executable model does not hold refuses admission: CLI exit 1 with the reasons on stderr, MCP `ScreensRefused`. A model without an executable model has nothing to admit. In .NET, `ExecutableScreens.Admit(workspace)` admits them and `UiContractBuilder.For(ExecutableSemanticModel)` in `Cratis.Screenplay.Ui` reads them.
42
+
43
+ ## Compare two model versions
44
+
45
+ `screenplay diff <before> <after> [--format text|json]` over `.play` files or folders. It reports added, removed, renamed and moved elements, member changes, event-contract changes (marked `[contract-breaking]`), enumeration changes, specification-outcome changes, and identity changes with their direct dependants.
46
+
47
+ - Elements match by persisted identity when both folders hold `.screenplay/identities.json` for the same application; otherwise by address. The report says which.
48
+ - `--format json` carries `before` and `after` (path, source revision, persisted identities used, model revision) and a `difference` object.
49
+ - Exit 0 compared; exit 2 could not run (including identities of two different applications).
50
+ - `--format json` also carries `difference.slices`, the per-slice change summary: `slices` (each with `change`, `changes`, `beforeAddress`, `afterAddress`, `semanticId`, `declarations`, `dependentSlices`; change kinds `added`, `removed`, `renamed`, `moved`, `changed`), `modelWide` (changed declarations no slice owns: modules, features, concepts, types, policies, personas) and `affectedSlices` (unchanged slices that directly reference a changed slice or a model-wide declaration). Renames and moves appear only under identity matching; address matching reports one removed and one added slice. Dependencies are direct, not transitive: rebuild everything when `modelWide` is not empty.
51
+ - To compare two commits, `git worktree add` each into its own folder and diff the folders.
52
+
53
+ ## Rename
54
+
55
+ `screenplay rename <address> <new-name> [<folder>] [--kind <Command|EventContract|ReadModel|...>]` is the scriptable form of MCP `propose-rename` plus `apply`: it repairs references across files, keeps the element's semantic identity, pins a renamed event's stored type name with `id`, and writes (creating on the first rename) `.screenplay/identities.json`. Exit 0 renamed, 1 refused, 2 could not run.
56
+
57
+ ## Trace a value's lineage
58
+
59
+ Requires Screenplay 6.6.0 or later (`screenplay --version`) for command, event and screen-field addresses and the direction option.
60
+
61
+ `screenplay lineage <address> [PATH] [--direction upstream|downstream|both] [--format json]` prints the tree MCP `trace-lineage` pages, all at once: `->` is where the value goes, `<-` where it comes from, and a break (missing mapping, ambiguous name, code the trace cannot read) appears in brackets with its reason. `--format json` prints every hop. Exit 0 complete, 1 with breaks, 2 cannot run (for example the address names nothing).
62
+
63
+ ## Persisted identities
64
+
65
+ `test`, `export`, `diff` and `rename` open a folder with `.screenplay/identities.json` when one exists, so the CLI and the MCP server report the same persisted identities the MCP server uses.
66
+
67
+ - `export` and `diff` refuse a source that drifted from the identities (`IdentityReconciliationRequired`, `IdentityMappingConflict`). Restore the names, then rename through the CLI or MCP.
68
+ - `test` falls back to address-derived ids and never refuses; any printed semantic id is accepted by `--filter`. A single file, a folder without identities or a drifted folder use address ids.