@cratis/pi 7.48.0 → 7.48.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.
- package/package/corpus/harnesses/copilot/instructions/local-work-artifacts.instructions.md +6 -2
- package/package/corpus/hooks/README.md +11 -5
- package/package/corpus/hooks/scripts/cratis-cleanup-worktrees.sh +44 -4
- package/package/corpus/prompts/ship-changes.prompt.md +4 -1
- package/package/corpus/rules/local-work-artifacts.md +6 -2
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +110 -167
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +74 -170
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/case-tables-and-whole-numbers.md +15 -35
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/choosing-generation.md +4 -6
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +23 -27
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/rendered-application.md +21 -33
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +61 -92
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/scene-runtime.md +4 -12
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +10 -14
- package/package.json +1 -1
|
@@ -43,8 +43,12 @@ dumps, and similar coordination files. These are **work records, not documentati
|
|
|
43
43
|
main checkout when a pull request merges or you finish a task (hooks also run it after
|
|
44
44
|
`gh pr merge` and at session start where the harness supports them, and **ship-changes**
|
|
45
45
|
ends with it). It removes a worktree and its branch only on evidence the work reached the
|
|
46
|
-
default branch — pushed is not merged — and never forces
|
|
47
|
-
|
|
46
|
+
default branch — pushed is not merged — and never forces. Worktrees with non-empty `.ai-work/`
|
|
47
|
+
directories are kept by default as "has untracked work records (.ai-work/)". Manual
|
|
48
|
+
`--include-work-records` permits deleting those records after you preserve what you need;
|
|
49
|
+
automatic hooks never opt in. Pin a long-lived worktree with `git worktree lock <path>`;
|
|
50
|
+
locked worktrees are always kept, even with opt-in. Other ignored files such as `.env` files
|
|
51
|
+
and local databases can still be deleted with a removed worktree, so move anything you
|
|
48
52
|
still need out first. Do not hand-remove worktrees or `git branch -D` a delivered branch
|
|
49
53
|
when the script can; and `gh pr merge --delete-branch` from inside a worktree leaves the
|
|
50
54
|
worktree and branch behind, which is why the script exists. If the branch must outlive the
|
|
@@ -70,8 +70,9 @@ It removes only on **evidence of delivery**, never on a guess: the tip is merged
|
|
|
70
70
|
and was integrated rather than merely sitting on the default branch's first-parent history (where a
|
|
71
71
|
brand-new empty branch sits), or it is merged and its upstream is gone, or GitHub reports a merged pull
|
|
72
72
|
request whose head is exactly that tip. It never forces: a dirty, locked or current worktree is kept, as
|
|
73
|
-
is anything undelivered, and every kept item is reported with its reason.
|
|
74
|
-
|
|
73
|
+
is anything undelivered, and every kept item is reported with its reason. Worktrees with non-empty
|
|
74
|
+
`.ai-work/` directories are kept as "has untracked work records (.ai-work/)" by default, including
|
|
75
|
+
ignored records. Other ignored files (`node_modules`, build output) go with a delivered worktree.
|
|
75
76
|
|
|
76
77
|
- **When it runs.** After a Bash command that delivers or integrates work, and at the start of every
|
|
77
78
|
session, so orphans left by any earlier session, crash or harness are collected too.
|
|
@@ -79,9 +80,14 @@ build output, `.ai-work/`) go with a delivered worktree; they are the disk being
|
|
|
79
80
|
Harnesses with no hook wiring (Copilot, Cursor, OpenCode) rely on the **ship-changes** prompt, whose
|
|
80
81
|
final step runs the same script, and on running it by hand.
|
|
81
82
|
- **By hand.** `bash .cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh [--dry-run]` from any worktree;
|
|
82
|
-
run from the main checkout to also collect the worktree you are standing in.
|
|
83
|
-
-
|
|
84
|
-
|
|
83
|
+
run from the main checkout to also collect the worktree you are standing in. Add
|
|
84
|
+
`--include-work-records` only after preserving any records you still need: it permits deleting
|
|
85
|
+
`.ai-work/` content, but never overrides locks or other safety checks. Hook mode ignores this flag;
|
|
86
|
+
automatic hooks never opt in.
|
|
87
|
+
- **Pin a long-lived worktree.** Use `git worktree lock <path>` to keep it out of cleanup; release the
|
|
88
|
+
pin with `git worktree unlock <path>` when ready.
|
|
89
|
+
- **Self-test.** `--self-test` plants delivered, dirty, unmerged, brand-new, work-record and locked cases
|
|
90
|
+
(including detached locks), checks manual opt-in and hook protection, and fails if any is handled wrongly.
|
|
85
91
|
- **Opt out.** `CRATIS_HOOKS_SKIP_CLEANUP=1`.
|
|
86
92
|
|
|
87
93
|
## What is enforced
|
|
@@ -12,10 +12,14 @@
|
|
|
12
12
|
# 2. its tip is merged into origin/<default> and its upstream is gone (the PR branch was deleted), or
|
|
13
13
|
# 3. GitHub reports a merged pull request whose head commit is exactly this tip.
|
|
14
14
|
# Anything else is KEPT and reported with the reason. Nothing is ever forced: a dirty, locked or
|
|
15
|
-
# current worktree is kept,
|
|
15
|
+
# current worktree is kept, as is one holding .ai-work/ records unless explicitly opted in.
|
|
16
|
+
# `git worktree remove` is never given --force.
|
|
16
17
|
#
|
|
17
18
|
# Usage:
|
|
18
|
-
# cratis-cleanup-worktrees.sh [--dry-run] [--quiet] [--no-fetch]
|
|
19
|
+
# cratis-cleanup-worktrees.sh [--dry-run] [--quiet] [--no-fetch] [--include-work-records]
|
|
20
|
+
# run in the repository (any worktree)
|
|
21
|
+
# --include-work-records allow deletion of .ai-work/ records
|
|
22
|
+
# by hand only; ignored in hook mode
|
|
19
23
|
# cratis-cleanup-worktrees.sh --hook Claude hook mode: reads the hook JSON
|
|
20
24
|
# on stdin, acts only when relevant
|
|
21
25
|
# cratis-cleanup-worktrees.sh --self-test plants cases and fails if any is wrong
|
|
@@ -25,11 +29,12 @@
|
|
|
25
29
|
# shellcheck disable=SC2016 # the self-test checks are single-quoted on purpose: they are eval-ed later
|
|
26
30
|
set -uo pipefail
|
|
27
31
|
|
|
28
|
-
DRY=0; QUIET=0; FETCH=1; HOOK=0; SELFTEST=0
|
|
32
|
+
DRY=0; QUIET=0; FETCH=1; HOOK=0; SELFTEST=0; INCLUDE_WORK_RECORDS=0
|
|
29
33
|
for a in "$@"; do
|
|
30
34
|
case "$a" in
|
|
31
35
|
--dry-run) DRY=1 ;; --quiet) QUIET=1 ;; --no-fetch) FETCH=0 ;;
|
|
32
36
|
--hook) HOOK=1; QUIET=1 ;; --self-test) SELFTEST=1 ;;
|
|
37
|
+
--include-work-records) INCLUDE_WORK_RECORDS=1 ;;
|
|
33
38
|
*) echo "cratis-cleanup-worktrees: unknown argument '$a'" >&2; exit 2 ;;
|
|
34
39
|
esac
|
|
35
40
|
done
|
|
@@ -37,6 +42,7 @@ done
|
|
|
37
42
|
# ── Hook mode: decide whether this event is worth a sweep ─────────────────────
|
|
38
43
|
EVENT="PostToolUse"
|
|
39
44
|
if [ "$HOOK" = 1 ]; then
|
|
45
|
+
INCLUDE_WORK_RECORDS=0
|
|
40
46
|
payload=''; IFS= read -r -d '' payload || true
|
|
41
47
|
[ "${CRATIS_HOOKS_SKIP_CLEANUP:-}" = 1 ] && exit 0
|
|
42
48
|
case "$payload" in *'"SessionStart"'*) EVENT="SessionStart" ;; esac
|
|
@@ -57,6 +63,7 @@ fi
|
|
|
57
63
|
if [ "$SELFTEST" = 1 ]; then
|
|
58
64
|
self=$(cd "$(dirname "$0")" && pwd)/$(basename "$0")
|
|
59
65
|
t=$(mktemp -d "${TMPDIR:-/tmp}/cleanup-selftest.XXXXXX"); trap 'rm -rf "$t"' EXIT
|
|
66
|
+
t=$(cd "$t" && pwd -P)
|
|
60
67
|
export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t CRATIS_CLEANUP_NO_GH=1
|
|
61
68
|
git init -q --bare -b main "$t/origin.git"
|
|
62
69
|
git clone -q "$t/origin.git" "$t/repo" 2>/dev/null; cd "$t/repo" || exit 2
|
|
@@ -66,6 +73,16 @@ if [ "$SELFTEST" = 1 ]; then
|
|
|
66
73
|
mk dirty; (cd "$t/wt-dirty" && echo x > x && git add x && git commit -qm x)
|
|
67
74
|
mk unmerged; (cd "$t/wt-unmerged" && echo u > u && git add u && git commit -qm u)
|
|
68
75
|
mk fresh # brand new, no commits: must survive
|
|
76
|
+
for b in records empty-records locked locked-detached; do
|
|
77
|
+
mk "$b"; (cd "$t/wt-$b" && echo "$b" > "$b" && git add "$b" && git commit -qm "$b")
|
|
78
|
+
git merge -q --no-ff "$b" -m "merge $b"
|
|
79
|
+
done
|
|
80
|
+
mkdir "$t/wt-records/.ai-work" "$t/wt-empty-records/.ai-work"
|
|
81
|
+
echo '.ai-work/' >> "$t/repo/.git/info/exclude"
|
|
82
|
+
echo handoff > "$t/wt-records/.ai-work/.handoff"
|
|
83
|
+
git -C "$t/wt-locked-detached" checkout -q --detach
|
|
84
|
+
git worktree lock "$t/wt-locked"
|
|
85
|
+
git worktree lock --reason pinned "$t/wt-locked-detached"
|
|
69
86
|
git branch loose-delivered main; (git checkout -q loose-delivered && echo l > l && git add l && git commit -qm l && git checkout -q main)
|
|
70
87
|
git merge -q --no-ff delivered -m "merge delivered" && git merge -q --no-ff dirty -m "merge dirty" && git merge -q --no-ff loose-delivered -m "merge loose"
|
|
71
88
|
git push -q origin main
|
|
@@ -82,7 +99,23 @@ if [ "$SELFTEST" = 1 ]; then
|
|
|
82
99
|
chk "fresh branch kept" 'git rev-parse -q --verify refs/heads/fresh >/dev/null'
|
|
83
100
|
chk "main kept" 'git rev-parse -q --verify refs/heads/main >/dev/null'
|
|
84
101
|
chk "report names the removal" 'printf "%s" "$out" | grep -q "removed worktree"'
|
|
85
|
-
|
|
102
|
+
chk "work records kept" '[ -f "$t/wt-records/.ai-work/.handoff" ]'
|
|
103
|
+
chk "work records branch kept" 'git rev-parse -q --verify refs/heads/records >/dev/null'
|
|
104
|
+
chk "work records reason reported" 'printf "%s" "$out" | grep -Fq "has untracked work records (.ai-work/)"'
|
|
105
|
+
chk "empty work records removed" '[ ! -d "$t/wt-empty-records" ]'
|
|
106
|
+
chk "locked worktree kept" '[ -d "$t/wt-locked" ]'
|
|
107
|
+
chk "locked branch kept" 'git rev-parse -q --verify refs/heads/locked >/dev/null'
|
|
108
|
+
chk "locked reason reported" 'printf "%s" "$out" | grep -Fq "worktree $t/wt-locked (locked): locked"'
|
|
109
|
+
chk "locked detached kept" '[ -d "$t/wt-locked-detached" ]'
|
|
110
|
+
chk "locked detached reported" 'printf "%s" "$out" | grep -Fq "worktree $t/wt-locked-detached (detached): locked"'
|
|
111
|
+
out=$(printf '%s' '{"hook_event_name":"SessionStart"}' | "$self" --no-fetch --include-work-records --hook 2>&1) || { echo "FAIL: hook exit $?"; echo "$out"; exit 1; }
|
|
112
|
+
chk "hook ignores opt-in" '[ -f "$t/wt-records/.ai-work/.handoff" ]'
|
|
113
|
+
out=$("$self" --no-fetch --include-work-records 2>&1) || { echo "FAIL: opt-in exit $?"; echo "$out"; exit 1; }
|
|
114
|
+
chk "opt-in removes work records" '[ ! -d "$t/wt-records" ]'
|
|
115
|
+
chk "opt-in removes branch" '! git rev-parse -q --verify refs/heads/records >/dev/null'
|
|
116
|
+
chk "opt-in keeps locked" '[ -d "$t/wt-locked" ]'
|
|
117
|
+
chk "opt-in keeps locked detached" '[ -d "$t/wt-locked-detached" ]'
|
|
118
|
+
[ "$fail" = 0 ] && echo "cratis-cleanup-worktrees self-test: 24 checks passed" && exit 0
|
|
86
119
|
echo "$out"; exit 1
|
|
87
120
|
fi
|
|
88
121
|
|
|
@@ -134,6 +167,13 @@ process_worktree() {
|
|
|
134
167
|
if ! ev=$(delivered "$sha" "$br" "$([ -n "$br" ] && track_of "$br")"); then
|
|
135
168
|
note_kept "worktree $wt ($name): work not delivered to $default"; return 0
|
|
136
169
|
fi
|
|
170
|
+
if [ "$INCLUDE_WORK_RECORDS" = 0 ] && [ -d "$wt/.ai-work" ]; then
|
|
171
|
+
local records
|
|
172
|
+
if ! records=$(find "$wt/.ai-work/." -mindepth 1 -maxdepth 1 -print -quit); then
|
|
173
|
+
note_kept "worktree $wt ($name): could not inspect work records (.ai-work/)"; return 0
|
|
174
|
+
fi
|
|
175
|
+
if [ -n "$records" ]; then note_kept "worktree $wt ($name): has untracked work records (.ai-work/)"; return 0; fi
|
|
176
|
+
fi
|
|
137
177
|
if [ -n "$(git -C "$wt" status --porcelain 2>/dev/null)" ]; then note_kept "worktree $wt ($name): delivered but has uncommitted changes"; return 0; fi
|
|
138
178
|
local kb; kb=$(du -sk "$wt" 2>/dev/null | awk '{print $1}')
|
|
139
179
|
if [ "$DRY" = 1 ]; then note_removed "worktree $wt ($name): would remove, $ev"; return 0; fi
|
|
@@ -61,7 +61,10 @@ cost real disk and accumulate across sessions. After the merge succeeds:
|
|
|
61
61
|
1. Leave the worktree you worked in: `cd` to the main checkout (`git worktree list` shows it first).
|
|
62
62
|
2. Run `bash .cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh` and report its summary line.
|
|
63
63
|
It fetches, checks out nothing, and removes only worktrees and local branches whose work is
|
|
64
|
-
verifiably on the default branch
|
|
64
|
+
verifiably on the default branch; it never forces and reports what it kept and why. Worktrees holding
|
|
65
|
+
non-empty `.ai-work/` directories are kept by default. Preserve any needed records before a manual
|
|
66
|
+
`--include-work-records` opt-in; automatic hooks never opt in. Use `git worktree lock <path>` to pin a
|
|
67
|
+
long-lived worktree; locked worktrees remain kept even with opt-in.
|
|
65
68
|
3. `git switch main && git pull --ff-only` in the main checkout so it matches the merged result.
|
|
66
69
|
|
|
67
70
|
Claude Code and Pi also run the script from a hook after `gh pr merge` and at session start; running it
|
|
@@ -42,8 +42,12 @@ dumps, and similar coordination files. These are **work records, not documentati
|
|
|
42
42
|
main checkout when a pull request merges or you finish a task (hooks also run it after
|
|
43
43
|
`gh pr merge` and at session start where the harness supports them, and **ship-changes**
|
|
44
44
|
ends with it). It removes a worktree and its branch only on evidence the work reached the
|
|
45
|
-
default branch — pushed is not merged — and never forces
|
|
46
|
-
|
|
45
|
+
default branch — pushed is not merged — and never forces. Worktrees with non-empty `.ai-work/`
|
|
46
|
+
directories are kept by default as "has untracked work records (.ai-work/)". Manual
|
|
47
|
+
`--include-work-records` permits deleting those records after you preserve what you need;
|
|
48
|
+
automatic hooks never opt in. Pin a long-lived worktree with `git worktree lock <path>`;
|
|
49
|
+
locked worktrees are always kept, even with opt-in. Other ignored files such as `.env` files
|
|
50
|
+
and local databases can still be deleted with a removed worktree, so move anything you
|
|
47
51
|
still need out first. Do not hand-remove worktrees or `git branch -D` a delivered branch
|
|
48
52
|
when the script can; and `gh pr merge --delete-branch` from inside a worktree leaves the
|
|
49
53
|
worktree and branch behind, which is why the script exists. If the branch must outlive the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-stage-rendering-and-sandbox
|
|
3
|
-
description: "What Cratis Stage and `cratis render`
|
|
3
|
+
description: "What Cratis Stage and `cratis render` do with a Screenplay `.play` model: the model shape Stage admits and refuses (`STAGE-ESM-*`, `PLAY0268` render refusals), what it emits (C# Arc/Chronicle backend, React/Vite scaffold with Arc `CommandForm` shell emission over Scene typed bindings, Debug specifications), managed publication, `--force`, recovery, scoped renders (`--scope`) and `--check`, authored-UI omission/parity checks, the unmanaged `Customizations/` seam, and the `cratis/stage` sandbox and `cratis/stage-specrunner` job. Use when deciding whether Stage can render a model, reading a blocked render, re-rendering safely, checking generated/runtime screen parity, or running the sandbox. Not for: authoring the model (use `cratis-screenplay-model-authoring`) or the render and gap-fill workflow (use `cratis-screenplay-render-and-gap-fill`)."
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -11,62 +11,22 @@ ships a **renderer** (a .NET library, driven from a terminal by `cratis render`)
|
|
|
11
11
|
disposable **sandbox** container (`cratis/stage`, started by `cratis run`) and a
|
|
12
12
|
**specification runner** container (`cratis/stage-specrunner`).
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
reading in this skill is not a render result.
|
|
18
|
-
|
|
19
|
-
Stage 4.92.0 / CLI 3.59.0 do not render ESM v16 stored names. Keep pins;
|
|
20
|
-
evidence: toolchain `references/versions.md`.
|
|
21
|
-
|
|
22
|
-
Authored UI has its own parity hazard. Historically (Stage 4.24) Stage rendered a default React/Vite
|
|
23
|
-
scaffold and did not prove that modeled screens, templates, forms, toolbars,
|
|
24
|
-
components, outlets, package icons or routes were implemented. The first fully
|
|
25
|
-
passing public browser vector was CLI 3.40.7 with `cratis/stage:4.51.1`: 51
|
|
26
|
-
browser assertions passed, none blocked or pending (Cratis/Screenplay#605).
|
|
27
|
-
Native command forms, required fields, scoped comments, deep links,
|
|
28
|
-
stale-response handling and theme all pass there. On public CLI 3.43.0 (default
|
|
29
|
-
`cratis/stage:4.52.0`) an agent-edited table column was rendered, run and seen in
|
|
30
|
-
the browser. Guarded Close and guarded double-click run since
|
|
31
|
-
Stage 4.65: on CLI 3.53.1 with `cratis/stage:4.73.1` Close shows only while the item is
|
|
32
|
-
open and a double click navigates or notifies by row (Cratis/Screenplay#671). `STAGE-SCENE-ACTION-001` and `STAGE-SCENE-INTERACTION-001` still
|
|
33
|
-
refuse a guard Stage cannot evaluate: no artifacts. Require a generated plan or artifact entry for every
|
|
34
|
-
authored UI construct, and report every unsupported UI directive as a diagnostic.
|
|
35
|
-
Silent fallback to a default screen is a failure, not a partial render.
|
|
36
|
-
|
|
37
|
-
## Specification runner exit codes
|
|
38
|
-
|
|
39
|
-
`cratis/stage-specrunner` exit `0` means the run completed and the results file was written **even when a specification
|
|
40
|
-
failed**: read the outcomes. `1` is a missing or uncompilable input, `2` a missing required
|
|
41
|
-
argument or an invalid semantic option.
|
|
42
|
-
|
|
14
|
+
The admitted model shape is deliberately small. A model Stage cannot render exactly
|
|
15
|
+
produces **no artifacts at all**, never thinner ones. Render the model to find out
|
|
16
|
+
whether it is admitted; reading the admission rules is not a render result.
|
|
43
17
|
|
|
44
|
-
|
|
18
|
+
Requires cratis CLI ≥ 3.57 (`cratis --version`) to render ESM v14 and v15 models; an older CLI refuses newer ESM versions with `CLI-RENDER-004` (or `STAGE-ESM-016` from Stage directly).
|
|
45
19
|
|
|
46
|
-
|
|
47
|
-
source evidence: `references/admission.md`, `references/rendered-application.md`.
|
|
48
|
-
Historical reads: Stage `v4.73.1` (`Source/Rendering.Cratis/**`,
|
|
49
|
-
`Documentation/guides/build-renderer-target.md`, `Documentation/reference/render-plans.md`,
|
|
50
|
-
`Documentation/docker/**`) and cli `v3.53.1` (`Documentation/reference/screenplay.md`,
|
|
51
|
-
`Source/Cli/Commands/Render/**`), not render runs unless labeled *observed*.
|
|
52
|
-
The bundled binder trails standalone (toolchain `references/versions.md`).
|
|
53
|
-
Stage's scaffold pins Arc, Chronicle, Components, Scene and Fundamentals
|
|
54
|
-
([rendered application](references/rendered-application.md)), not latest releases; never bump managed files.
|
|
55
|
-
Scene was re-read at that scaffold tag: `README.md`,
|
|
56
|
-
`Source/JavaScript/{model,engine,react,components}/**`.
|
|
20
|
+
## When to use
|
|
57
21
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
shipped in Cratis/cli#301. Case tables (Stage 4.59.0+) and whole numbers as `long` from ESM v8
|
|
63
|
-
(4.61.0+) apply to the current default; the pinned Stage default applies both rules. The Stage
|
|
64
|
-
4.52.0 renderer applies neither new rule.
|
|
22
|
+
- Deciding whether a model can be rendered, or reading a blocked render.
|
|
23
|
+
- Re-rendering safely after the model or a managed file changed.
|
|
24
|
+
- Checking what the generated UI does and does not prove.
|
|
25
|
+
- Running the sandbox or the specification runner.
|
|
65
26
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
automation needs a test-account decision, so Studio production Play proof is not claimed.
|
|
27
|
+
Not for authoring the model (`cratis-screenplay-model-authoring`), the end-to-end
|
|
28
|
+
render and gap-fill workflow (`cratis-screenplay-render-and-gap-fill`), or the C# of a
|
|
29
|
+
generated command or read model (`cratis-arc-command`, `cratis-chronicle-read-model`).
|
|
70
30
|
|
|
71
31
|
## Model-first rule
|
|
72
32
|
|
|
@@ -80,28 +40,7 @@ The `.play` model is the source of truth; Stage-managed output is derived from i
|
|
|
80
40
|
authorization, validation or personal-data and secret markers to get past a refusal.
|
|
81
41
|
- Never claim a whole-application result from a subset of the model.
|
|
82
42
|
|
|
83
|
-
##
|
|
84
|
-
|
|
85
|
-
Ownership is the destination's **`.cratis-render.json`** manifest (semantic revision,
|
|
86
|
-
identity, path and SHA-256 per artifact); there are no in-file markers. Interrupted
|
|
87
|
-
commits are journaled in the **`.cratis-render/`** control directory (journal, staging,
|
|
88
|
-
backups). Never stage `.cratis-render/` in git; commit the manifest with the output.
|
|
89
|
-
|
|
90
|
-
- An unmanaged file at a planned path is refused, even with `--force`.
|
|
91
|
-
- A user-modified managed file is refused unless it is still active **and** `--force` is
|
|
92
|
-
given; `--force` replaces it. It never overwrites unmanaged files and never deletes a
|
|
93
|
-
modified stale file. A stale managed file is removed only if its bytes still match.
|
|
94
|
-
- Recovery runs before planning, even when planning then fails. **`recovered: true` in the
|
|
95
|
-
result means stop and reconcile**: the receipt does not describe what recovery changed.
|
|
96
|
-
- An unchanged re-render writes nothing (`unchanged` equals the artifact count).
|
|
97
|
-
- Use exclusive access to the destination; a receipt is a filesystem result, not a Git
|
|
98
|
-
commit, and the command creates no branch, commit or PR.
|
|
99
|
-
- Drift: `cratis render ... --check` (CLI 3.44.0 or later) is the first probe; exit `6` means
|
|
100
|
-
pending changes. Otherwise compare successive manifests' `semanticRevision` for renders with the
|
|
101
|
-
same `--name` and inputs. Do not compare the MCP `modelRevision` with the manifest: their
|
|
102
|
-
application identities can differ.
|
|
103
|
-
|
|
104
|
-
## Rendering with `cratis render`
|
|
43
|
+
## Render
|
|
105
44
|
|
|
106
45
|
```bash
|
|
107
46
|
cratis render ./model --name Marina --destination ./out
|
|
@@ -121,32 +60,17 @@ cratis render --workspace ./application.workspace.json --destination ./out
|
|
|
121
60
|
| `--package-set <FILE>` | Approved package set (JSON) of custom runtime packages the `ui profile` may use; the frontend installs exactly these |
|
|
122
61
|
| `--force` | See "Publication and recovery" |
|
|
123
62
|
|
|
124
|
-
### Scoped renders
|
|
125
|
-
|
|
126
|
-
`--scope` (CLI 3.49.0 or later) renders an admitted part while other slices wait for hand-written
|
|
127
|
-
code or renderer support. The whole model must still compile and bind, so a `PLAY0268`, protected identity/enum,
|
|
128
|
-
handler or ESM newer-than-v15 problem anywhere blocks even a scoped render. `PLAN-*` problems in unselected
|
|
129
|
-
slices become warnings and `STAGE-ESM-*` refusals in unselected slices do not block. A scoped plan
|
|
130
|
-
has no application scaffold or default Scene (with no manifest in the destination the plain scaffold
|
|
131
|
-
is added). A dependency in another slice must be rendered first or listed too (`CLI-RENDER-014`);
|
|
132
|
-
unknown scope `-011`, ambiguous `-012`, aggregate policy layout `-013` (render the whole application
|
|
133
|
-
once first). Unselected managed files are preserved. A scoped result is evidence for that scope only.
|
|
134
|
-
|
|
135
63
|
Order of events: recover any interrupted earlier publication, compile, bind, build the
|
|
136
64
|
execution plan, plan the target (Stage admission), validate artifacts, then publish.
|
|
137
65
|
Exit `0` is a published render, `5` is a refusal with nothing published (diagnostics are
|
|
138
|
-
printed), `1` is a missing input. Add `-o json` for the counts and the publication
|
|
139
|
-
receipt.
|
|
66
|
+
printed), `1` is a missing input. Add `-o json` for the counts and the publication receipt.
|
|
140
67
|
|
|
141
68
|
Facts that surprise:
|
|
142
69
|
|
|
143
|
-
- **Binding uses the CLI's bundled Screenplay
|
|
144
|
-
4.89.1 admit ESM v1 to v15, then check each construct. Newer versions report
|
|
145
|
-
`CLI-RENDER-004` (direct Stage: `STAGE-ESM-016`). Supported generation strategies,
|
|
146
|
-
freshness scopes, responses, equality filters, enum numbers and concept compliance render.
|
|
70
|
+
- **Binding uses the CLI's bundled Screenplay compiler**, which differs from a standalone one. A model that binds is not necessarily renderable: Stage admits ESM v1 to v15, then checks each construct. A newer model reports `CLI-RENDER-004` (direct Stage: `STAGE-ESM-016`). Supported generation strategies, freshness scopes, responses, equality filters, enum numbers and concept compliance render.
|
|
147
71
|
- **Render never builds, tests or runs** the output. A published render is admission and
|
|
148
72
|
publication only; build and tests are separate results (see "Verify"). Admission can be
|
|
149
|
-
green while a rendered Debug test fails (
|
|
73
|
+
green while a rendered Debug test fails (for example a query assertion on the key).
|
|
150
74
|
- **Implementation attachments are read from the model root**: the folder, or the single
|
|
151
75
|
file's parent directory. Use a dedicated model folder. A required body that is missing
|
|
152
76
|
or changed blocks the render with `STAGE-ESM-020`. A workspace envelope has no
|
|
@@ -154,10 +78,46 @@ Facts that surprise:
|
|
|
154
78
|
- `cratis render` and `cratis screenplay validate` are different gates: a model can
|
|
155
79
|
validate and still refuse here.
|
|
156
80
|
|
|
157
|
-
|
|
81
|
+
### Scoped renders
|
|
82
|
+
|
|
83
|
+
`--scope` renders an admitted part while other slices wait for hand-written code or
|
|
84
|
+
renderer support. The whole model must still compile and bind, so a `PLAY0268`, protected
|
|
85
|
+
identity/enum, handler or newer-than-v15 problem anywhere blocks even a scoped render.
|
|
86
|
+
`PLAN-*` problems in unselected slices become warnings and `STAGE-ESM-*` refusals in
|
|
87
|
+
unselected slices do not block. A scoped plan has no application scaffold or default Scene
|
|
88
|
+
(with no manifest in the destination the plain scaffold is added). A dependency in another
|
|
89
|
+
slice must be rendered first or listed too (`CLI-RENDER-014`); unknown scope is `-011`,
|
|
90
|
+
ambiguous `-012`, aggregate policy layout `-013` (render the whole application once
|
|
91
|
+
first). Unselected managed files are preserved. A scoped result is evidence for that scope only.
|
|
92
|
+
|
|
93
|
+
## Publication and recovery
|
|
94
|
+
|
|
95
|
+
Ownership is the destination's **`.cratis-render.json`** manifest (semantic revision,
|
|
96
|
+
identity, path and SHA-256 per artifact); there are no in-file markers. Interrupted
|
|
97
|
+
commits are journaled in the **`.cratis-render/`** control directory (journal, staging,
|
|
98
|
+
backups). Never stage `.cratis-render/` in git; commit the manifest with the output.
|
|
99
|
+
|
|
100
|
+
- An unmanaged file at a planned path is refused, even with `--force`.
|
|
101
|
+
- A user-modified managed file is refused unless it is still active **and** `--force` is
|
|
102
|
+
given; `--force` replaces it. It never overwrites unmanaged files and never deletes a
|
|
103
|
+
modified stale file. A stale managed file is removed only if its bytes still match.
|
|
104
|
+
- Recovery runs before planning, even when planning then fails. **`recovered: true` in the
|
|
105
|
+
result means stop and reconcile**: the receipt does not describe what recovery changed.
|
|
106
|
+
- An unchanged re-render writes nothing (`unchanged` equals the artifact count).
|
|
107
|
+
- Use exclusive access to the destination; a receipt is a filesystem result, not a Git
|
|
108
|
+
commit, and the command creates no branch, commit or PR.
|
|
109
|
+
- Drift: `cratis render ... --check` is the first probe; exit `6` means pending changes.
|
|
110
|
+
Otherwise compare successive manifests' `semanticRevision` for renders with the same
|
|
111
|
+
`--name` and inputs. Do not compare the MCP `modelRevision` with the manifest: their
|
|
112
|
+
application identities can differ.
|
|
113
|
+
|
|
114
|
+
A modified managed file reports `Managed artifact 'Program.cs' was modified by the user; pass --force to replace it.`
|
|
115
|
+
Find out why it was edited, move the intent into the model or `Customizations/`, then
|
|
116
|
+
re-render; use `--force` only to discard the edit on purpose.
|
|
158
117
|
|
|
159
|
-
|
|
160
|
-
|
|
118
|
+
## Admission
|
|
119
|
+
|
|
120
|
+
One blocker publishes nothing. Codes, limits and fixes: [references/admission.md](references/admission.md).
|
|
161
121
|
|
|
162
122
|
- **Renders:** concepts/types/collections/optionals; portable StateChange and StateView slices,
|
|
163
123
|
flat/scoped projections, pure reducers and reducer `from` filters; keyed optional snapshots,
|
|
@@ -169,7 +129,7 @@ ledger: `cratis-screenplay-toolchain/references/renderable-subset.md`.
|
|
|
169
129
|
- **Refused:** Translate/captures, non-event triggers, opaque bodies and clock specs (`STAGE-ESM-024`);
|
|
170
130
|
mixed effects (`STAGE-ESM-037`, redelivery duplicates events); unsupported reaction mappings (`-039`),
|
|
171
131
|
protected identities/enums (`-040`), non-text secrets (`-041`); generated types/results (`-028`/`-038`);
|
|
172
|
-
appends beyond single-hop/cascade specs (`-011`), absence (`-027`), evolution (
|
|
132
|
+
appends beyond single-hop/cascade specs (`-011`), absence (`-027`), evolution (`STAGE-ESM-026`), public/foreign events
|
|
173
133
|
(`-032`/`-033`), claim-reading/opaque `runs as` gates (`-034`), legacy filters (`-035`), production
|
|
174
134
|
overrides (`-036`), code validation (`-005`), snapshot lists/DateTime filters (`-010`), conditional
|
|
175
135
|
productions, composite projection keys and `all`. Through v15 is construct admission.
|
|
@@ -178,61 +138,49 @@ ledger: `cratis-screenplay-toolchain/references/renderable-subset.md`.
|
|
|
178
138
|
compliance and subject lineage. Never drop protection.
|
|
179
139
|
|
|
180
140
|
A refusal is not a licence to weaken the model: drop no specification, event generation or
|
|
181
|
-
protection to get a render; keep the model, record the capability gap and gap-fill.
|
|
182
|
-
admission (ESM v1 to v4, keyed optional queries only) is kept as history in `references/admission.md`.
|
|
141
|
+
protection to get a render; keep the model, record the capability gap and gap-fill.
|
|
183
142
|
|
|
184
143
|
**Descriptions and documentation render only as XML documentation comments** (`<summary>`,
|
|
185
|
-
`<remarks
|
|
186
|
-
|
|
144
|
+
`<remarks>`), never as validation, authorization or behavior, so a rule that exists only in
|
|
145
|
+
prose is not enforced. A documentation edit changes managed-file hashes (a `--check` exit
|
|
187
146
|
`6`), and characters invalid in XML block rendering with `CLI-RENDER-005`.
|
|
188
147
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
That reference separates v15 scopes from future Arc freshness and unshipped context/secrets.
|
|
148
|
+
Generated identities: read [shop strategy choices](references/choosing-generation.md) before
|
|
149
|
+
rendering a model with generated values. Case tables and whole numbers:
|
|
150
|
+
[case tables and whole numbers](references/case-tables-and-whole-numbers.md).
|
|
151
|
+
`[ProtectedDecision]` and `DecisionRead<T>` are available to gap-fill code, not
|
|
152
|
+
automatically emitted or protected by Stage; admission and unit-of-work enrollment still matter.
|
|
196
153
|
|
|
197
154
|
## What it emits
|
|
198
155
|
|
|
199
|
-
At application scope the plan holds the scaffold plus the modeled artifacts
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
the `[
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
package ids, host capabilities or the boundary from hand-built Components pages.
|
|
156
|
+
At application scope the plan holds the scaffold plus the modeled artifacts: a `.csproj`
|
|
157
|
+
and `.slnx`, `Program.cs`, `appsettings.json`, `docker-compose.yml`, the Directory props
|
|
158
|
+
files, a policy registration and generated policies, `Common/<Concept>.cs`, one
|
|
159
|
+
`<Module>/<Feature>/<Slice>/` folder per slice with the `[Command]` record and `Handle()`,
|
|
160
|
+
the `[EventType]` event, the validator and the `[ReadModel]` with its query, `scene.json`,
|
|
161
|
+
and a React/Vite frontend scaffold (`.frontend/`, `package.json`, `tsconfig.json`,
|
|
162
|
+
`.gitignore`). Per-file detail, the scaffold's dependency set and the `Customizations/`
|
|
163
|
+
contract: [references/rendered-application.md](references/rendered-application.md). Scene
|
|
164
|
+
package ids, host capabilities and the boundary from hand-built Components pages:
|
|
165
|
+
[references/scene-runtime.md](references/scene-runtime.md). A complete renderable model:
|
|
166
|
+
[references/render-example.md](references/render-example.md).
|
|
211
167
|
|
|
212
168
|
Modeled specifications become xunit classes compiled in **Debug only**
|
|
213
169
|
(`IsTestProject` when Debug): a command spec `when_<snake>` in namespace
|
|
214
170
|
`<slice namespace>.when_<snake>` (so `when_x.when_x`), queries `when_<snake>_is_queried`,
|
|
215
|
-
read models `when_<snake>_is_projected`.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
authored. Before CLI 3.40.7 the generated scaffold was not screen parity evidence.
|
|
229
|
-
On public CLI 3.43.0 / `cratis/stage:4.52.0` the canonical corpus publishes,
|
|
230
|
-
`scene.json` contains Arc `commandForm` components, `src/bindings.ts` registers
|
|
231
|
-
the modeled commands and queries, and the browser acceptance run passes. That is
|
|
232
|
-
not Studio production proof. Require an explicit plan, manifest entry or
|
|
233
|
-
generated artifact for each
|
|
234
|
-
screen/template/form/toolbar/component/outlet/route/package-icon use, or a
|
|
235
|
-
blocking diagnostic explaining why it was not generated.
|
|
171
|
+
read models `when_<snake>_is_projected`. A case table expands to one class per case
|
|
172
|
+
(`<Specification>_<Case>`).
|
|
173
|
+
|
|
174
|
+
### UI parity
|
|
175
|
+
|
|
176
|
+
The scaffold emits Arc `CommandForm` shells over Scene typed bindings, with `scene.json`
|
|
177
|
+
and `src/bindings.ts` registering the modeled commands and queries. Record what the
|
|
178
|
+
generated output claims separately from what the model authored, and claim UI fidelity
|
|
179
|
+
only from a browser run. Require a generated plan entry, manifest entry or artifact for
|
|
180
|
+
each screen, template, form, toolbar, component, outlet, route and package-icon use, or a
|
|
181
|
+
blocking diagnostic explaining why it was not generated. `STAGE-SCENE-ACTION-001` and
|
|
182
|
+
`STAGE-SCENE-INTERACTION-001` refuse a guard Stage cannot evaluate: no artifacts.
|
|
183
|
+
Silent fallback to a default screen is a failure, not a partial render.
|
|
236
184
|
|
|
237
185
|
## Sandbox and specification runner
|
|
238
186
|
|
|
@@ -241,17 +189,27 @@ API on `9090`, Chronicle Workbench on `https://localhost:35000`. It is a **parti
|
|
|
241
189
|
disposable runtime**, not a generated application. The default engine appends modeled
|
|
242
190
|
`produces` facts and echoes the payload but enforces no modeled validation or
|
|
243
191
|
authorization and no query authorization; `Stage__Runtime__Engine=semantic` opts in to
|
|
244
|
-
an engine that does, and refuses what it cannot execute (HTTP 501).
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
from unsigned headers, so authorization there is not a security boundary.
|
|
192
|
+
an engine that does, and refuses what it cannot execute (HTTP 501). The default engine
|
|
193
|
+
also refuses routed models (`STAGE-ESM-030`). Callers are built from unsigned headers, so
|
|
194
|
+
authorization there is not a security boundary.
|
|
248
195
|
|
|
249
196
|
`cratis/stage-specrunner` checks modeled specifications and writes a results file. The
|
|
250
197
|
default `structural` engine is deprecated and model-level only; `--engine semantic`
|
|
251
198
|
executes admitted specs through Arc's in-memory pipeline and reports `Passed`, `Failed`,
|
|
252
|
-
`Unsupported` or `Cancelled`. A green result is Stage semantic-engine evidence: not V4 and
|
|
253
|
-
the
|
|
254
|
-
|
|
199
|
+
`Unsupported` or `Cancelled`. A green result is Stage semantic-engine evidence: not V4 and
|
|
200
|
+
not a rendered Debug test run. Commands, the report schema and limits:
|
|
201
|
+
[references/sandbox-and-specrunner.md](references/sandbox-and-specrunner.md).
|
|
202
|
+
|
|
203
|
+
Specification runner exit codes: `0` means the run completed and the results file was
|
|
204
|
+
written **even when a specification failed**, so read the outcomes; `1` is a missing or
|
|
205
|
+
uncompilable input; `2` a missing required argument or an invalid semantic option.
|
|
206
|
+
|
|
207
|
+
## Legacy direct-write rendering
|
|
208
|
+
|
|
209
|
+
The syntax-based `IRenderer` and the optional `Cratis.Stage.Rendering.Cratis.Scaffolding`
|
|
210
|
+
package write directly to disk, with no managed staging and no safe stale-file removal; a
|
|
211
|
+
failure can leave the target unsafe and incomplete. Use `cratis render` (journaled,
|
|
212
|
+
recoverable publication) instead.
|
|
255
213
|
|
|
256
214
|
## Verify
|
|
257
215
|
|
|
@@ -266,8 +224,8 @@ Read `references/sandbox-and-specrunner.md` before launching either container or
|
|
|
266
224
|
file. The fix is an intent-preserving model change or a recorded gap, never an edit of
|
|
267
225
|
managed output and never a weakened model.
|
|
268
226
|
- No file under `.cratis-render/` is staged; managed files carry no local edits.
|
|
269
|
-
-
|
|
270
|
-
|
|
227
|
+
- Stage's plan is deterministic (same input, same bytes and hashes); that is not a review,
|
|
228
|
+
and Stage never reviews, stages or approves anything.
|
|
271
229
|
- Sandbox expectations account for unenforced validation, authorization and query
|
|
272
230
|
authorization on the default engine.
|
|
273
231
|
- Runtime screen smoke coverage uses the same model root or workspace export as
|
|
@@ -279,25 +237,10 @@ Read `references/sandbox-and-specrunner.md` before launching either container or
|
|
|
279
237
|
- Writing or checking the `.play` model: `cratis-screenplay-model-authoring` (compiler and
|
|
280
238
|
MCP), `cratis-screenplay-event-modeling` (method), and the per-surface
|
|
281
239
|
`cratis-screenplay-*` skills.
|
|
282
|
-
- Which tool says what,
|
|
283
|
-
- Running the render workflow end to end
|
|
284
|
-
`cratis-screenplay-render-and-gap-fill`.
|
|
240
|
+
- Which tool says what, and diagnostics: `cratis-screenplay-toolchain`.
|
|
241
|
+
- Running the render workflow end to end and gap-fill: `cratis-screenplay-render-and-gap-fill`.
|
|
285
242
|
- Understanding the generated command, validator or read model as C#: `cratis-arc-command`
|
|
286
243
|
and `cratis-chronicle-read-model`; checking hand-written code against its slice:
|
|
287
244
|
`cratis-application-slice-conformance`.
|
|
288
245
|
- Inspecting the Chronicle store the sandbox writes into: `cratis-chronicle-cli-operations`
|
|
289
246
|
and `cratis-chronicle-web-workbench`.
|
|
290
|
-
|
|
291
|
-
## Legacy direct-write rendering
|
|
292
|
-
|
|
293
|
-
The syntax-based `IRenderer` and the optional `Cratis.Stage.Rendering.Cratis.Scaffolding`
|
|
294
|
-
package write directly to disk, with no managed staging and no safe stale-file removal; a
|
|
295
|
-
failure can leave the target unsafe and incomplete. They are legacy compatibility only.
|
|
296
|
-
Use `cratis render` (journaled, recoverable publication) instead.
|
|
297
|
-
|
|
298
|
-
## Lineage
|
|
299
|
-
|
|
300
|
-
Rewritten for #493. The earlier version described Stage 3.15.1 (no CLI, eight-file
|
|
301
|
-
backend scaffold, `not empty`-only validation, no frontend, Arc 22.3.0); each claim was
|
|
302
|
-
re-verified at Stage 4.24.0 and cli 3.27.1 and replaced, then re-run on Stage 4.24.1 and cli 3.28.2 and on Stage 4.24.2 and cli 3.28.3 (an evolved event reports `STAGE-ESM-026`). See
|
|
303
|
-
[references/admission.md](references/admission.md) for source disagreements.
|