Problem / motivation
We are adding a Cratis.Arc.Screenplay package to the Arc repo that generates a Screenplay .play file describing an Arc application's full event model — concepts, modules, features, slices, commands, events, validation, authorization, constraints, queries, reactors and projections.
It surfaces the result the same way Arc already surfaces its other introspection data: a new endpoint
GET /.cratis/screenplay → text/plain, the .play source
alongside the existing /.cratis/commands and /.cratis/queries.
What is missing is the CLI side. The point of generating a .play file is to get it into Cratis Studio, and today there is no command to fetch one, write it to disk, or import it.
Proposed solution
A cratis arc screenplay command under the existing arc branch, following the exact pattern of arc commands list / arc queries list (Source/Cli/Commands/Arc/):
cratis arc screenplay # print .play to stdout
cratis arc screenplay -o Library.play # write to a file
cratis arc screenplay --url http://localhost:5100 # non-default app URL
It should subclass ArcCommand<T> so it inherits ArcSettings.ResolveUrl() (flag → ARC_URL env var → launch settings → default) and the standard "cannot connect" handling, then GET {url}/.cratis/screenplay and emit the body.
Note this endpoint returns text/plain, not JSON — unlike the existing introspection commands, the response is the artifact itself. So OutputFormatter's table/JSON shaping does not apply; the raw body is the output. Worth confirming how that should interact with the global -o/--output format flag, since -o is currently the format switch — an output file may need a different flag name (e.g. --file/-f) to avoid a collision.
Alternatives considered
- Generating the file in the CLI itself, by loading the app's assemblies offline. Rejected upstream: fluent
IProjectionFor<T> and IConstraint definitions only materialise when Define() is actually executed, which needs a live DI container. The in-process endpoint gets full fidelity; an offline loader silently drops DI-dependent artifacts.
- Having Studio pull directly from the running app. Skips the CLI entirely, but loses the ability to diff a
.play file in source control, and requires Studio to reach the developer's machine.
Additional context
Depends on the Arc-side endpoint landing first — that work is in progress in the Arc repo (Cratis.Arc.Screenplay). This issue can be picked up as soon as /.cratis/screenplay is available.
Acceptance criteria
Follow-up (separate issue, not this one)
Importing the generated .play into Studio — either cratis arc screenplay --import or a dedicated cratis studio import command. Worth designing once the fetch path exists and we know what Studio's import contract looks like.
Problem / motivation
We are adding a
Cratis.Arc.Screenplaypackage to the Arc repo that generates a Screenplay.playfile describing an Arc application's full event model — concepts, modules, features, slices, commands, events, validation, authorization, constraints, queries, reactors and projections.It surfaces the result the same way Arc already surfaces its other introspection data: a new endpoint
alongside the existing
/.cratis/commandsand/.cratis/queries.What is missing is the CLI side. The point of generating a
.playfile is to get it into Cratis Studio, and today there is no command to fetch one, write it to disk, or import it.Proposed solution
A
cratis arc screenplaycommand under the existingarcbranch, following the exact pattern ofarc commands list/arc queries list(Source/Cli/Commands/Arc/):It should subclass
ArcCommand<T>so it inheritsArcSettings.ResolveUrl()(flag →ARC_URLenv var → launch settings → default) and the standard "cannot connect" handling, thenGET {url}/.cratis/screenplayand emit the body.Note this endpoint returns
text/plain, not JSON — unlike the existing introspection commands, the response is the artifact itself. SoOutputFormatter's table/JSON shaping does not apply; the raw body is the output. Worth confirming how that should interact with the global-o/--outputformat flag, since-ois currently the format switch — an output file may need a different flag name (e.g.--file/-f) to avoid a collision.Alternatives considered
IProjectionFor<T>andIConstraintdefinitions only materialise whenDefine()is actually executed, which needs a live DI container. The in-process endpoint gets full fidelity; an offline loader silently drops DI-dependent artifacts..playfile in source control, and requires Studio to reach the developer's machine.Additional context
Depends on the Arc-side endpoint landing first — that work is in progress in the Arc repo (
Cratis.Arc.Screenplay). This issue can be picked up as soon as/.cratis/screenplayis available.Acceptance criteria
cratis arc screenplayfetches/.cratis/screenplayfrom the resolved URL and writes the.playsource to stdout.\n).arc commands listbehavior.[CliCommand],[CliExample]and[LlmDescription]attributes consistent with the sibling Arc commands.Source/Cli.Specscovering: successful fetch, write-to-file, server error, and connection failure.Documentation/arc/.Follow-up (separate issue, not this one)
Importing the generated
.playinto Studio — eithercratis arc screenplay --importor a dedicatedcratis studio importcommand. Worth designing once the fetch path exists and we know what Studio's import contract looks like.