@cratis/pi 8.13.0 → 8.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,7 +44,7 @@ in the findings that matter:
44
44
  | A focused Chronicle, database, backend or frontend scalability analysis | `cratis-performance-review`; the performance items here are only those visible in passing, so do not duplicate its findings when both ran |
45
45
  | Scheduling review passes, rounds and re-reviews | `cratis-engineering-review-rounds` |
46
46
  | Reviewing the model itself | `cratis-modeling-review-event-model` |
47
- | The change raises or pins Cratis packages, tools or images | Also read `cratis-platform-upgrade-application` for version pairing, pinning and upgrade order, and `cratis-components-theme-application` (`references/upgrade-from-previous-major.md`) when it crosses the Components major that left PrimeReact |
47
+ | The change raises or pins Cratis packages, tools or images | Also read `cratis-platform-upgrade-application` for version pairing, pinning and upgrade order, and the matching `cratis/migrate/components-<from>-to-<to>` profile when it crosses a Components major |
48
48
 
49
49
  ## How gates and review divide the work
50
50
 
@@ -41,7 +41,7 @@ A screen works when three independent things work. Decide which one failed befor
41
41
  | Symptom | First check | Then |
42
42
  | --- | --- | --- |
43
43
  | A generated command or query import is missing | The backend slice exists, builds, and proxy generation has run. Never hand-write the command or query class. | `cratis-arc-generate-proxies` |
44
- | A component import from the package root does not compile | The package root is setup-only (provider, configuration, messages, icons). Import each component from its own subpath. | `cratis-components-theme-application` (`references/upgrade-from-previous-major.md`) |
44
+ | A component import from the package root does not compile | The package root is setup-only (provider, configuration, messages, icons). Import each component from its own subpath. | `cratis-platform-upgrade-application` (the matching `cratis/migrate/components-<from>-to-<to>` profile) |
45
45
  | Type check rejects a stylesheet import | The package stylesheets are imported from TypeScript. Import them from one local CSS file instead. | `cratis-components-theme-application` |
46
46
  | Components render unstyled | One local CSS file imports `@cratis/components/tokens`, then `@cratis/components/styles`, and the application entry imports that file once. | `cratis-components-theme-application` |
47
47
  | Product CSS loses to Components styles | The product stylesheet loads after the package imports. Unlayered product CSS beats the layered structural rules whatever its specificity; a product with its own cascade layers must declare the layer order. The token and theme defaults are unlayered too, so an override of those wins only on equal or higher selector specificity and later order. Confirm which rule won in the inspector's computed styles. | `cratis-components-theme-application`, Cascade layers |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cratis-components-theme-application
3
- description: Use when wiring Cratis Components CSS (tokens, structural styles, baseline theme, per-area sheets, Designsystemet bridge), branding or replacing the palette through `--cratis-*` tokens, switching light/dark or theming a subtree, styling component parts, configuring `CratisComponentsProvider` (locale, messages, icons, router, dialog header actions, toaster, overlay container) selecting a renderer adapter, authoring one for another design system, or upgrading an application from the PrimeReact-based Components major (which codemods to run and in what order). Not for keyboard and ARIA semantics (`cratis-components-accessibility`), raising toasts or busy feedback (`cratis-components-coordinate-feedback`), or choosing which control to render (`cratis-components-choose-control`).
3
+ description: Use when wiring Cratis Components CSS (tokens, structural styles, baseline theme, per-area sheets, Designsystemet bridge), branding or replacing the palette through `--cratis-*` tokens, switching light/dark or theming a subtree, styling component parts, configuring `CratisComponentsProvider` (locale, messages, icons, router, dialog header actions, toaster, overlay container) selecting a renderer adapter, or authoring one for another design system. Not for keyboard and ARIA semantics (`cratis-components-accessibility`), raising toasts or busy feedback (`cratis-components-coordinate-feedback`), choosing which control to render (`cratis-components-choose-control`), or upgrading an application across a Components major (`cratis-platform-upgrade-application`).
4
4
  compatibility: Requires @cratis/components and a CSS bundler that resolves package imports.
5
5
  ---
6
6
 
@@ -18,7 +18,9 @@ compatibility: Requires @cratis/components and a CSS bundler that resolves packa
18
18
 
19
19
  Cratis Components splits appearance into three package stylesheets and one runtime provider. `tokens` declares the semantic `--cratis-*` CSS variables with light defaults. `styles` holds component structure and interaction-state rules. The optional `theme` adds document colors, dark mode, forced-colors values and themed subtrees. `CratisComponentsProvider` carries locale, labels, icons, routing, dialog header actions, the toast region and renderer selection. It loads no CSS. Product styling goes through tokens and stable parts, never through internal markup.
20
20
 
21
- Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir); only the project's languages are installed. Cratis Components is React-only, so its imports and examples are in the typescript reference whatever SDK the backend uses. Language-neutral references: [tokens](references/tokens.md) (every `--cratis-*` variable), [palette](references/palette.md) (selector blocks for palette overrides), [parts](references/parts.md) (every stable part and its states), [renderer adapters](references/renderer-adapters.md) (adapter coverage and setup), [localization](references/localization.md) (read for UI language, label translations and formats) and [upgrade from the previous major](references/upgrade-from-previous-major.md) (read when the app imports component namespaces from the package root). Names in examples are illustrative.
21
+ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir); only the project's languages are installed. Cratis Components is React-only, so its imports and examples are in the typescript reference whatever SDK the backend uses. Language-neutral references: [tokens](references/tokens.md) (every `--cratis-*` variable), [palette](references/palette.md) (selector blocks for palette overrides), [parts](references/parts.md) (every stable part and its states), [renderer adapters](references/renderer-adapters.md) (adapter coverage and setup) and [localization](references/localization.md) (read for UI language, label translations and formats). Names in examples are illustrative.
22
+
23
+ Major upgrades: see `cratis-platform-upgrade-application` for the migration profile.
22
24
 
23
25
  ## How it works
24
26
 
@@ -145,3 +147,4 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
145
147
  - `cratis-components-accessibility`
146
148
  - `cratis-components-coordinate-feedback`
147
149
  - `cratis-components-choose-control`
150
+ - `cratis-platform-upgrade-application`
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: cratis-migrate-arc-22-to-23
3
+ description: Use when upgrading a C# application from Cratis Arc 22 to Arc 23, including commands that start failing with a read-protection refusal, `CommandReadModelKeysMissing` or `ProtectedReadModelKeyAccessorMissing` after raising `Cratis` or `Cratis.Arc.*`, and a host that no longer compiles on `McpToolCeiling` or `McpRequiresGatedEndpoints`. Not for other Arc majors, new applications (`cratis-platform-start-application`) or the general upgrade loop of versions, kernel order and deployment (`cratis-platform-upgrade-application`).
4
+ ---
5
+
6
+ # Move a C# application from Arc 22 to Arc 23
7
+
8
+ Temporary guidance for one upgrade. Reinstall the AI corpus without this profile once the upgrade is merged. Run it inside the loop of `cratis-platform-upgrade-application`, which owns version pairing, kernel order and deployment.
9
+
10
+ ## What changed
11
+
12
+ Moving to the latest Arc 23 release turns two protective options on by default for applications that use Arc with Chronicle, and renames part of the MCP hosting API. The npm packages have no change that breaks a build.
13
+
14
+ | Symptom | Cause | Who is affected |
15
+ | --- | --- | --- |
16
+ | A command that injects a read model is refused, fails on a concurrent change it used to survive, or stops the host at startup | Read protection is `On` for every project that reaches `Cratis.Arc.Chronicle` (directly, through `Cratis` or through a project reference) and does not set `<CratisReadProtection>`. Arc 22 ran such projects as `Off` | Projects with commands, validators, `Provide()` or `Handle()` that take read models and declare no mode |
17
+ | `CommandReadModelKeysMissing` at startup or on the first command | Key lookup needs the metadata the Arc source generator emits; the reflection fallback is off unless `ReadProtection:RequireGeneratedMetadata` is `false` | Every command under `On` that the generator skips, such as a partial command, whether or not it takes a read model; in any mode, a command with a `[LookUpBy]` parameter |
18
+ | `ProtectedReadModelKeyAccessorMissing` at startup or HTTP 500 during command execution | `ProtectedReadModelKeyOptions.Strict` is `true`: a composite key type needs generated or registered accessors | Commands under `On` whose key is a record or class of several parts that the generator cannot cover |
19
+ | A command spec gets `null` for a read model it used to receive | A replaced or substituted `IReadModels` no longer supplies state to a protected read | Command scenarios that arrange state through a replacement reader |
20
+ | Compile error on `McpToolCeiling` or `McpRequiresGatedEndpoints` | `McpToolCeiling` is `McpToolCatalog`, with no forwarder. `McpRequiresGatedEndpoints` is gone, because MCP no longer needs `CapabilitiesOptions.GatedEndpoints` | Hosts that name either type |
21
+ | Obsolete warning (an error with warnings as errors) on `MapCratisArcMcp`, string `ExposeQuery`, `TenancyOptions.DevelopmentTenantId`, `IntrospectionOptions.TrustForwardedIdentityHeaders` or `HostBuilderExtensions.DefaultArcSectionPaths` | Each has a replacement. The MCP messages say the old form goes in Arc 24; it still compiles there, so treat it as a warning to clear now, not a deadline | Hosts that call them |
22
+ | Header tenancy resolves no tenant | A tenant header with several comma-separated values resolves only when all values are equal | Deployments whose ingress appends to the tenant header instead of replacing it |
23
+ | Subscribing to an observable query over server-sent events returns 404 for a signed-in caller | The connection is owned by the caller's name identifier, subject or name; a caller with none of them cannot manage subscriptions | Applications whose principals carry no such claim |
24
+ | A validator's `WhenCommand()` and `WhenQuery()` rules swap on an MVC action | PUT, PATCH and DELETE count as command validation, as POST does | MVC controllers with those verbs and such rules |
25
+ | A React form shows a validation message twice | `CommandForm` renders a summary for failures no field displays | Forms that already render their own summary |
26
+
27
+ An application without Chronicle, MCP hosting or any row above has nothing to change beyond the version raise.
28
+
29
+ ## Inventory before the bump
30
+
31
+ 1. List the versions of `Cratis`, `Cratis.Arc.*` and `@cratis/arc*` in every project file, `Directory.Packages.props` and `package.json`.
32
+ 2. List every project that holds commands and whether it sets `<CratisReadProtection>`. In each one without it, list the commands and validators that take a read model, and the commands marked `[ReadProtection]` or `[Unprotected]`.
33
+ 3. List every command declared `partial`, private, generic or with a base type from another assembly, every read-model key type that is a record or class with more than one property, and every command spec that replaces or substitutes `IReadModels`.
34
+ 4. For an MCP host, list the calls to `MapCratisArcMcp` and `ExposeQuery`, the uses of `McpToolCeiling` and `McpRequiresGatedEndpoints`, and the `GatedEndpoints` selection.
35
+ 5. Run the specs and save the result. Done when the lists exist and the specs pass on Arc 22.
36
+
37
+ ## Order
38
+
39
+ Read `references/<language>.md` for the application's backend (`.csproj` → csharp) before step 1; this profile installs only the C# reference, because the breaking changes are in the .NET packages.
40
+
41
+ 1. **Pin the mode.** Set `<CratisReadProtection>Off</CratisReadProtection>` in every project from inventory step 2 that declares none. This is what Arc 22 did implicitly, so nothing changes yet. Done when the specs still pass.
42
+ 2. **Raise the packages.** Raise every Arc package, NuGet and npm, to the latest Arc 23 release in one change, as `cratis-platform-upgrade-application` describes. Done when `dotnet restore` succeeds.
43
+ 3. **Fix the MCP host and the obsolete calls** with the replacements in the reference. Done when the solution builds without obsolete warnings from Arc.
44
+ 4. **Adopt read protection, one project at a time.** Change `Off` to `Measure`, run the specs and the application, fix what is reported, then remove the property so the project takes the default `On`. Choose to stop at `Off` only when the upgrade must ship without behavior changes; record the adoption as open work, because `Off` leaves every decision unguarded. Done when each project is on `On`, or its `Off` has a recorded reason.
45
+ 5. **Cover the keys.** For each project on `On`, clear the generator and accessor failures as the reference describes. Done when the host starts and every command has run once without either exception.
46
+ 6. **Rebuild and regenerate the proxies** as `cratis-platform-upgrade-application` describes.
47
+
48
+ ## Verify
49
+
50
+ 1. `dotnet build` with warnings as errors, then run the specs. Done when both pass, with command state arranged through the scenario's own `Given`.
51
+ 2. Start the host with its real configuration. Done when startup reports no refused read-model parameter and no command whose mode was lowered.
52
+ 3. Run each command that takes a read model. Under `On`, also test a valid key with no instance for a required protected parameter: expect a `rule` validation result and HTTP 400. A nullable protected parameter receives `null`.
53
+ 4. For an MCP host, request `/mcp` and one other route on the capabilities port without credentials. Done when `/mcp` is refused and the other route answers as its gate selection intends.
54
+ 5. For the tenancy, server-sent-events, MVC and form rows that apply, repeat the affected request and compare with the Arc 22 result.
55
+ 6. Arc 23 brings a newer Chronicle client; apply the kernel order from `cratis-platform-upgrade-application`. Read protection changes how commands read and append, not stored events, so it calls for no replay.
56
+
57
+ ## Finish
58
+
59
+ Merge the upgrade, then reinstall the AI corpus with the previous profile list: `cratis ai install --profiles <previous> --harnesses <previous> --languages <previous>`. Done when `.cratis/ai.json` no longer lists `cratis/migrate/arc-22-to-23` and this skill is gone.
@@ -0,0 +1,121 @@
1
+ # Arc 22 to Arc 23 in a C# application
2
+
3
+ ## Contents
4
+
5
+ - Pin the mode
6
+ - Adopt read protection
7
+ - Generated key metadata
8
+ - Composite key accessors
9
+ - Command specs
10
+ - MCP host
11
+ - Obsolete names
12
+ - Recovery
13
+
14
+ ## Pin the mode
15
+
16
+ Prerequisite: the inventory from the skill is done and the packages are on the latest Arc 23 release, except for "Pin the mode", which is done on Arc 22.
17
+
18
+ Set the mode in the project file, or in a `Directory.Build.props` that covers the project:
19
+
20
+ ```xml
21
+ <PropertyGroup>
22
+ <CratisReadProtection>Off</CratisReadProtection>
23
+ </PropertyGroup>
24
+ ```
25
+
26
+ The value is `Off`, `Measure` or `On`; any other value fails the build. It applies to the commands declared in that project. A declaration on the command wins over the project: `[ReadProtection(ReadProtectionMode.Off)]`, `[ReadProtection(ReadProtectionMode.On)]`, or `[Unprotected("why")]`, which means `Off` for that command.
27
+
28
+ ## Adopt read protection
29
+
30
+ Under `On`, Arc reads each supported read-model parameter fresh from its events, guards the append against what the command read, and refuses reads it cannot guard. A guarded read costs more for a key with a long history, because it folds that history instead of returning stored state.
31
+
32
+ 1. Set `<CratisReadProtection>Measure</CratisReadProtection>` and run the specs and the application. `Measure` changes no outcome; it records what `On` would do.
33
+ 2. Read the counter `cratis.arc.read_protection.events` on the meter `Cratis.Arc.ReadProtection`, grouped by its `category` and `command` tags. The same data appears as Warning log entries and as `read-protection.plan` span events.
34
+ 3. Fix each category that needs it:
35
+
36
+ | Category | Fix |
37
+ | --- | --- |
38
+ | `refused_read` | The `reason` tag names the cause. Change the model to a shape that can be guarded (a flat projection keyed by the event source, or a reducer without an event filter or constructor dependencies), take the model as a parameter instead of calling `IReadModels`, or declare the read advisory |
39
+ | `redirect` | `On` would select a different key. Add `[LookUpBy(nameof(Command.Property))]` to the parameter |
40
+ | `immediate_append` | Return the event from `Handle()` instead of appending through `IEventLog` |
41
+ | `scope_refusal`, `displacement` | Widen or remove the explicit concurrency scope beside the read |
42
+
43
+ A read that may be stale is declared with `[Unprotected("why")]` on the parameter, the read-model type, or the `Handle()` or `Provide()` method whose body reads. Write the real reason; it is reported.
44
+
45
+ 4. Build and clear the warnings ARCCHR0024 (shape cannot be protected), ARCCHR0028 (read not proven protected) and ARCCHR0033 (aggregate and read model on the same key).
46
+ 5. Remove the property so the project takes `On`, and run the specs.
47
+
48
+ Under `On`, a required read-model parameter whose instance does not exist fails the command with a validation result (reason `rule`, message `{ReadModel} does not exist.`, HTTP 400). A nullable parameter receives `null`. A validator must be registered by convention discovery; one that Arc did not construct for the command is refused under `On`.
49
+
50
+ Startup checks the declared parameter shapes after the application has started and stops the host on a refusal under `On`. `ReadProtection:StartupAdmissionCheck` set to `Log` reports without stopping. To back out in production without a build, set `ReadProtection:MaximumMode` to `Measure` or `Off`; it only lowers the mode and is logged per command at startup. Both keys are also read under `Cratis:Arc:ReadProtection`.
51
+
52
+ ## Generated key metadata
53
+
54
+ `CommandReadModelKeysMissing` names a command or read-model type for which the Arc source generator emitted no key metadata. At startup Arc checks every command whose mode is `On`, whether or not it takes a read model. The generator ships in the Arc packages as an analyzer, runs in the project that declares the type, and reaches a project through project references too. Check, in this order:
55
+
56
+ 1. The named command is a non-partial, accessible type declared in the application's own project. The generator skips partial types, private and file-local types, generic definitions, types with a base type from another assembly, and commands with a public property whose getter is obsolete or experimental or whose type is inaccessible. The informational diagnostic ARC0031 marks each skipped command; raise its severity in `.editorconfig` to see it in the build output.
57
+ 2. No package or project reference on the path to the Arc packages removes `analyzers` through `ExcludeAssets`, `IncludeAssets` or `PrivateAssets`.
58
+ 3. The assembly is not marked with `System.Diagnostics.CodeAnalysis.ExperimentalAttribute`; the generator skips such an assembly.
59
+
60
+ Done when the host starts and the command runs. Only if the type must keep a skipped shape, keep the reflection lookup by setting `ReadProtection:RequireGeneratedMetadata` to `false` in configuration. Arc then logs one warning per type. The opt-out has no effect on a runtime without dynamic code, such as Native AOT.
61
+
62
+ ## Composite key accessors
63
+
64
+ `ProtectedReadModelKeyAccessorMissing` names a key type made of several parts for which no accessors exist. The generator covers types it can see completely. The informational diagnostic ARC0030 marks the ones it cannot: partial types, types or base types from another assembly, and types with hidden or overridden members. Register those before the host is built, with every public readable instance property, inherited ones included:
65
+
66
+ ```csharp
67
+ using Cratis.Arc.Chronicle.ReadModels;
68
+
69
+ ProtectedReadModelKeyAccessors.Register<WarehouseKey>(
70
+ new(nameof(WarehouseKey.Warehouse), key => key.Warehouse),
71
+ new(nameof(WarehouseKey.Section), key => key.Section));
72
+
73
+ public partial record WarehouseKey(string Warehouse, string Section);
74
+ ```
75
+
76
+ Register each concrete derived type separately. Registering a type twice throws `ProtectedReadModelKeyAccessorsAlreadyRegistered`. Done when the command that uses the key runs.
77
+
78
+ Only on a runtime that supports dynamic code can `Strict = false` restore the reflection fallback; under Native AOT, register the accessors. Use the fallback only when a key type cannot be registered; a property left out of a registration weakens the check, and so does the fallback:
79
+
80
+ ```csharp
81
+ builder.Services.Configure<ProtectedReadModelKeyOptions>(options => options.Strict = false);
82
+ ```
83
+
84
+ ## Command specs
85
+
86
+ Replace state arranged through a replaced or substituted `IReadModels` with the command scenario's own `Given`:
87
+
88
+ ```csharp
89
+ _scenario.Given.ForEventSource(id).ReadModel(instance);
90
+ _scenario.Given.ForEventSource(id).Events(new MoneyDeposited(100m));
91
+ ```
92
+
93
+ Use `ReadModel` when the case needs a known value and `Events` when the history matters. A plain `new CommandScenario<TCommand>()` selects the right log from the command's mode; an untyped `CommandScenario<object>` calls `EnableDecisionReads()`. Done when the spec passes without a replacement reader.
94
+
95
+ ## MCP host
96
+
97
+ | Arc 22 | Arc 23 |
98
+ | --- | --- |
99
+ | `app.MapCratisArcMcp()` | `app.MapArcMcp()` |
100
+ | `ExposeQuery("Namespace.ReadModel.Method", name, description)` | `ExposeQuery<ReadModel>(nameof(ReadModel.Method), name, description)`, which throws `ArgumentException` when the read model has no such method, or `[ExposeOverMcp]` on the query |
101
+ | `McpToolCeiling` | `McpToolCatalog`, same members |
102
+ | `catch (McpRequiresGatedEndpoints)` | Remove; the type no longer exists |
103
+
104
+ The old `MapCratisArcMcp` and string `ExposeQuery` still work and only warn.
105
+
106
+ Arc 22 required `CapabilitiesOptions.GatedEndpoints` for MCP, so the host has a selection. Keep it and nothing changes: `WithMcp` adds the MCP endpoint to it. Remove it only if every route on the capabilities port may require a verified caller. With no selection, the whole port is gated and only the OAuth protected resource metadata route answers without one, so a health probe on that port starts returning 401. Move such a route to another port, or keep the selection.
107
+
108
+ ## Obsolete names
109
+
110
+ | Obsolete | Use |
111
+ | --- | --- |
112
+ | `TenancyOptions.DevelopmentTenantId` | `TenancyOptions.FixedTenantId`, key `Cratis:Arc:Tenancy:FixedTenantId` |
113
+ | `IntrospectionOptions.TrustForwardedIdentityHeaders` | `ArcOptions.TrustForwardedIdentityHeaders`, key `Cratis:Arc:TrustForwardedIdentityHeaders`, which applies to every request |
114
+ | `Microsoft.Extensions.Hosting.HostBuilderExtensions.DefaultArcSectionPaths` | `Cratis.Arc.HostBuilderExtensions.DefaultSectionPaths` |
115
+
116
+ ## Recovery
117
+
118
+ - A command is refused and the cause is unclear: set that project back to `Measure` and read the `reason` tag of its `refused_read` entries.
119
+ - Header tenancy resolves no tenant: make the ingress remove every incoming tenant header and set exactly one value. A tenant identifier that contains a comma cannot be sent in the header.
120
+ - Server-sent-event subscriptions return 404 for signed-in callers: issue a name identifier, subject or name claim to the principal.
121
+ - A form shows a message twice: remove the application's own summary, or pass `validationSummaryComponent={() => null}` to `CommandForm`.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: cratis-migrate-arc-23-to-24
3
+ description: Use when upgrading a C# application, with or without a TypeScript frontend, from Cratis Arc 23 to Arc 24, including a build that no longer finds the `Cratis.Choreography.Availability` namespace or reports obsolete `[AvailableFor("...")]` and `[AvailableWith("...")]` after raising `Cratis.Arc.*`, and a client that reads `key` or `conflictingEvent...` from a refused command. Not for other Arc majors, new applications (`cratis-platform-start-application`) or the general upgrade loop of versions, kernel order and deployment (`cratis-platform-upgrade-application`).
4
+ ---
5
+
6
+ # Move an application from Arc 23 to Arc 24
7
+
8
+ Temporary guidance for one upgrade. Reinstall the AI corpus without this profile once the upgrade is merged. Run it inside the loop of `cratis-platform-upgrade-application`, which owns version pairing, kernel order and deployment.
9
+
10
+ ## What changed
11
+
12
+ Moving to the latest Arc 24 release brings two groups of changes that can break an application. The first applies to clients and specs that read the details of a command refused because a read it depended on changed. The second applies to hosts that reference `Cratis.Arc.Availability`.
13
+
14
+ | Symptom | Cause | Who is affected |
15
+ | --- | --- | --- |
16
+ | Client code or a spec finds no `key`, `conflictingEventTypeId`, `conflictingEventType` or `conflictingEventSequenceNumber` on a refused command, or a message no longer names an event type and sequence number | A validation result with reason `concurrencyViolation` and detail `ReadChanged` now carries only `readModel` in its `state`, and its message no longer names an event type or sequence number | Applications that use the Arc Chronicle integration with protected decision reads and read that state or assert on that message |
17
+ | The build reports that the namespace `Cratis.Choreography.Availability` does not exist, or that `ChoreographyContextValueSource` is not found | The availability engine moved into `Cratis.Arc.Availability`, which no longer depends on `Cratis.Choreography`. The engine types are in `Cratis.Arc.Availability`, `Cratis.Arc.Availability.Audiences` and `Cratis.Arc.Availability.Context`, and `ChoreographyContextValueSource` is `AvailabilityContextValueSource` | Hosts that reference `Cratis.Arc.Availability` |
18
+ | The build reports a type mismatch between `Cratis.Choreography.Availability` and `Cratis.Arc.Availability` types, or the application's audience source is never asked and every gated part is refused | The host also references `Cratis.Choreography` 2.10 or earlier, which has its own copy of the engine. Arc resolves only the Arc types | Hosts that reference both `Cratis.Arc.Availability` and `Cratis.Choreography` |
19
+ | Obsolete warnings, which fail a build that treats warnings as errors, on `[AvailableFor("...")]`, `[AvailableWith("...")]`, `AvailabilityExpression.For`, `With`, `When`, `AllOf`, `AnyOf` and `GateNamespace` | Availability is declared with types. The string forms still work in Arc 24 | Hosts that gate parts with the string forms |
20
+ | Parts that were served are refused as not available after the raise | Availability configured with `AddArcAvailability` was discarded when `AddCratis()` ran first, so gates were lost and parts were served. The configured gates now apply in either order | Hosts that call `AddCratis()` before `AddArcAvailability` |
21
+ | The host stops at startup on an undefined or circular availability | Startup now verifies that every block built on another is defined and that no blocks build on each other in a cycle | Hosts with such a block in their `AvailabilityCatalog` |
22
+ | A context value resolves for a part where it was absent, or another declaration of the same name wins | A part now runs in the context scope of its namespace by default. It ran in the application scope | Hosts that declare context values at a scope below the application and do not set `ScopeFor` |
23
+ | `IAvailabilityGate.IsGated` answers true for parts that carry no gate | Any part can be suspended, so every part has to be decided | Application code that calls `IsGated` to find the gated parts |
24
+ | A `switch` over `AvailabilityVerdict` is no longer exhaustive | The verdict `Suspended` was added, reported to clients with the reason `Suspended` next to `NotAvailable` | Application code that switches over the verdict or compares the reason |
25
+
26
+ Nothing is suspended until the application suspends a part, so the reason `Suspended` reaches a client only after the application starts using suspensions.
27
+
28
+ The `@cratis/arc`, `@cratis/arc.react`, `@cratis/arc.react.mvvm` and `@cratis/arc.vite` packages have no breaking change of their own in this move; the first row is a change in what the server sends. A host that does not reference `Cratis.Arc.Availability` and never reads the state or message of a `ReadChanged` refusal has nothing to change here beyond the version raise.
29
+
30
+ ## Inventory before the bump
31
+
32
+ 1. List the versions of `Cratis`, `Cratis.Arc.*` and `Cratis.Choreography` in every `.csproj` and `Directory.Packages.props`, and of `@cratis/arc*` in every `package.json`.
33
+ 2. Search the frontend, the specs and every other consumer of command results for `conflictingEventTypeId`, `conflictingEventType`, `conflictingEventSequenceNumber` and for `key` read from the `state` of a validation result. List each use.
34
+ 3. If a project references `Cratis.Arc.Availability`, list:
35
+ - every `using Cratis.Choreography.Availability...` and every use of `ChoreographyContextValueSource`
36
+ - every string form from the table above, with the audience and availability names it uses
37
+ - the registrations of `IAudienceSource`, `IDeclaredAudiences`, `AvailabilityCatalog` and `ContextValueCatalog`, and whether `AddCratis()` runs before `AddArcAvailability`
38
+ - every `ContextValueCatalog.Declare` with its scope, and whether `ScopeFor` is set
39
+ - every call to `IsGated` and every `switch` over `AvailabilityVerdict`
40
+ 4. If availability is in use, start the application and save the answer of `GET /.cratis/availability` for one caller of each kind the application distinguishes, such as a tenant with and a tenant without a paid package. Done when each answer is on disk.
41
+
42
+ ## Order
43
+
44
+ 1. **Raise the packages.** Raise every Arc package, NuGet and npm, to the latest Arc 24 release in one change, as `cratis-platform-upgrade-application` describes. If the host references `Cratis.Choreography`, raise it to 2.11.0 or later in the same change; from that release it uses the engine in `Cratis.Arc.Availability`. Done when `dotnet restore` ends without a downgrade warning or error.
45
+ 2. **Move to the Arc namespaces.** Read `references/<language>.md` for the application's backend (`.csproj` → csharp). Done when no file names `Cratis.Choreography.Availability` and the project compiles apart from obsolete warnings.
46
+ 3. **Declare availability with types.** Follow the same reference. Done when the project builds with warnings as errors, or when every remaining string form is listed with the reason it stays.
47
+ 4. **Stop reading the removed refusal details.** For each use from the inventory, read `readModel` and nothing else from the `state`. Read `references/typescript.md` for a TypeScript client. Change specs that assert on the event type or sequence number in the message. Done when the search from the inventory finds nothing.
48
+ 5. **Rebuild and regenerate the proxies** as `cratis-platform-upgrade-application` describes. Regenerated command and query proxies carry the part they are, which the client needs to ask about one part.
49
+
50
+ ## Verify
51
+
52
+ 1. `dotnet restore`, then `dotnet build` with warnings as errors.
53
+ 2. Run the specs.
54
+ 3. If availability is in use, start the application and ask `GET /.cratis/availability` as the same callers as in the inventory. Each listed part now also carries a `reason`. Done when each answer lists the same parts as the saved one, or every difference is explained by a gate that was discarded before because `AddCratis()` ran first.
55
+ 4. For one gated command and one gated query, call it as a caller the gate admits and as one it does not. Done when the first is served and the second is refused with HTTP status 403 and the reason `NotAvailable`.
56
+ 5. No event, projection or read-model behavior changes in this move, so no replay is needed. The raise brings a newer Chronicle client; apply the kernel order from `cratis-platform-upgrade-application`.
57
+
58
+ ## Finish
59
+
60
+ Merge the upgrade, then reinstall the AI corpus with the previous profile list: `cratis ai install --profiles <previous> --harnesses <previous> --languages <previous>`. Done when `.cratis/ai.json` no longer lists `cratis/migrate/arc-23-to-24` and this skill is gone.
@@ -0,0 +1,91 @@
1
+ # Move availability to the Arc engine and to types
2
+
3
+ Prerequisite: a project references `Cratis.Arc.Availability` and the packages are on the latest Arc 24 release.
4
+
5
+ ## Move to the Arc namespaces
6
+
7
+ Replace the namespaces. The type names are unchanged except for the last row.
8
+
9
+ | Before | After |
10
+ | --- | --- |
11
+ | `Cratis.Choreography.Availability` | `Cratis.Arc.Availability` |
12
+ | `Cratis.Choreography.Availability.Audiences` | `Cratis.Arc.Availability.Audiences` |
13
+ | `Cratis.Choreography.Availability.Context` | `Cratis.Arc.Availability.Context` |
14
+ | `Cratis.Choreography.Availability.Context.Providers` | `Cratis.Arc.Availability.Context.Providers` |
15
+ | `ChoreographyContextValueSource` | `AvailabilityContextValueSource` |
16
+
17
+ Remove a `Cratis.Choreography` package reference that existed only for availability. Keep it, at 2.11.0 or later, when the host uses state machines, jobs, workflows or workers.
18
+
19
+ Observe: the project compiles, with obsolete warnings for the string forms.
20
+
21
+ The existing registration keeps working after the namespace change:
22
+
23
+ ```csharp
24
+ services.AddSingleton<IAudienceSource>(new InMemoryAudienceSource());
25
+ services.AddSingleton<IDeclaredAudiences>(new DeclaredAudiences("Plus", "Preview"));
26
+ services.AddSingleton(new AvailabilityCatalog());
27
+ services.AddSingleton(new ContextValueCatalog());
28
+ services.AddArcAvailability(options => options.GateNamespace("Fleet.DataQuality", AvailabilityExpression.For("Plus")));
29
+ ```
30
+
31
+ ## Declare availability with types
32
+
33
+ Each string form becomes a type or an attribute that names a type.
34
+
35
+ | Before | After |
36
+ | --- | --- |
37
+ | `[AvailableFor("Plus", "Preview")]` | `[AvailableFor<Plus, Preview>]`, with `public class Plus : Audience;` |
38
+ | `[AvailableWith("DataQuality")]` | `[Available<DataQuality>]`, with `public class DataQuality : AvailabilityBlock` |
39
+ | `AvailabilityExpression.For`, `With`, `When`, `AllOf`, `AnyOf` | `For<T>()`, `With<T>()`, `When`, `&` and `\|` in an `AvailabilityBlock` |
40
+ | `AvailabilityCatalog` and `AvailabilityDefinition` | an `AvailabilityBlock` type, which the catalog is built from |
41
+ | `options.GateNamespace("Fleet.DataQuality", expression)` | `[AvailableFor<Plus>] public class Feature : AvailabilityScope;` in that namespace |
42
+ | `ContextValueCatalog.Declare(...)` with a `ReadModelContextValueProvider` | `[ProvideContext<Vessel>(...)]` |
43
+ | `DeclaredAudiences` | audience types, which are discovered |
44
+
45
+ ```csharp
46
+ using Cratis.Arc.Availability;
47
+
48
+ public class Plus : Audience;
49
+
50
+ public class Preview : Audience;
51
+
52
+ public class DataQuality : AvailabilityBlock
53
+ {
54
+ protected override IReadOnlyList<AvailabilityTerm> Lines =>
55
+ [
56
+ For<Plus>(),
57
+ When.On<Vessel>(_ => _.HasReported).IsTrue()
58
+ ];
59
+ }
60
+
61
+ [Command]
62
+ [AvailableFor<Plus, Preview>]
63
+ public record ResetScore(VesselId Vessel);
64
+
65
+ [Available<DataQuality>]
66
+ public class Feature : AvailabilityScope;
67
+ ```
68
+
69
+ Rules that decide whether the result behaves as before:
70
+
71
+ - **The type name is the name.** An audience is known by the name of its type, and a block by the name of its type. Name each type exactly as the string it replaces, including letter case, because the grants your `IAudienceSource` returns are matched by that name. A name that is not a valid C# type name cannot become a type: keep its string form and suppress the warning at that place, or rename the audience in the stored grants first.
72
+ - **One attribute is one line, and every line must hold.** `[AvailableFor<Plus, Preview>]` is open to either audience, as `[AvailableFor("Plus", "Preview")]` was. `[AvailableFor<Plus>, AvailableFor<Preview>]` needs both. One attribute takes up to three audiences; use a block for more.
73
+ - **All the lines of a block hold.** Use `|` inside one line for alternatives of the same form. Different forms combined with `&` are separate lines.
74
+ - **A scope marker gates its namespace and the namespaces beneath it**, as `GateNamespace` did. Put the marker type in the namespace the string named.
75
+ - **A provided read model is named by its type in camelCase.** `[ProvideContext<Vessel>(nameof(Vessel.VesselByKey), "arguments.vesselId")]` provides `vessel` for the namespace of the type that carries the attribute. Conditions that read a value declared under another name have to read the new name. The host registers an `IReadModelQuery` that executes the query; without one the host fails when the context values are first built.
76
+
77
+ Then remove the registrations of `IDeclaredAudiences`, `AvailabilityCatalog` and `ContextValueCatalog`. Arc builds them from the types only when the host has not registered its own, so a registration left in place hides every audience and block that is declared as a type. Keep the `IAudienceSource` over your own storage.
78
+
79
+ ```csharp
80
+ builder.AddCratisArc(configureBuilder: arc => arc
81
+ .WithAvailability());
82
+ ```
83
+
84
+ `WithAvailability` takes the same two callbacks as `AddArcAvailability`, which a host without an Arc builder keeps calling.
85
+
86
+ Observe: the project builds with warnings as errors, and the host starts.
87
+
88
+ - The host stops at startup with `UndefinedAvailabilityException` or `CircularAvailabilityException`: a block uses `With<T>()` or `AvailabilityExpression.With("...")` on a block that is not in the catalog, or blocks build on each other in a cycle. Define the missing block, or remove the hand-registered `AvailabilityCatalog` that hides the typed blocks.
89
+ - A gated part is refused for a caller who holds the audience: the audience type is named differently from the stored grant, or a hand-registered `IDeclaredAudiences` does not list it.
90
+ - A value from `ContextValueCatalog.Declare` behaves differently: a part now runs in the scope made of the segments of its namespace, so a declaration whose scope path is the start of that namespace now applies to it, and the nearest one wins. Set `options.ScopeFor = _ => ContextScope.Application` to keep the previous behavior, or move the declaration to `[ProvideContext<T>]`.
91
+ - A `switch` over `AvailabilityVerdict` needs a case for `Suspended`. Code that used `IAvailabilityGate.IsGated` to find the gated parts reads `IAvailabilityGate.GatedParts` instead.
@@ -0,0 +1,26 @@
1
+ # Read a refused command without the removed details
2
+
3
+ Prerequisite: the application uses the Arc Chronicle integration with protected decision reads, and client code reads the `state` of a validation result on a refused command.
4
+
5
+ A command refused because a read it depended on changed arrives as a validation result with the reason `concurrencyViolation` and the detail `ReadChanged`. Its `state` holds `readModel` only. The server no longer sends `key`, `conflictingEventTypeId`, `conflictingEventType` or `conflictingEventSequenceNumber`, so code that reads them gets `undefined`; `state` is untyped, so the compiler does not report it.
6
+
7
+ ```typescript
8
+ import { ValidationResultReason } from '@cratis/arc/validation';
9
+
10
+ const result = await command.execute();
11
+
12
+ const conflict = result.validationResults.find(
13
+ (_) => _.reason === ValidationResultReason.ConcurrencyViolation && _.reasonDetail === 'ReadChanged',
14
+ );
15
+
16
+ if (conflict) {
17
+ const readModel = conflict.state.readModel as string;
18
+ // Keep the user's input, read fresh state and offer to submit again.
19
+ }
20
+ ```
21
+
22
+ Observe, in a spec or under a debugger: pause a protected command after its server-side read and before commit, commit a competing event covered by the guard, then resume the command. The result is `ReadChanged`, the form keeps its input, and the handler reads nothing but `readModel`.
23
+
24
+ - The client showed which record or which event caused the refusal: the server does not tell any more. Show that the named read model changed, read fresh state with the queries the screen already uses, and let the user compare.
25
+ - The client chose what to reload from `key`: reload from the identity the screen already holds, such as the route parameter or the command's own properties.
26
+ - The message text is shown to users and looks different: it names the read model and the command only, without an event type or sequence number.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: cratis-migrate-components-3-to-4
3
+ description: Use when upgrading a TypeScript application from Cratis Components 3 to Cratis Components 4, including a frontend that no longer compiles or renders unstyled after raising `@cratis/components` (component namespaces missing from the package root, `styledMode` or `CratisPreset` gone, PrimeReact selectors and `pt` keys that match nothing), and running the `@cratis/components.migrator` codemods in order. Not for other Components majors, new applications (`cratis-platform-start-application`), replacing the application's own PrimeReact controls (`cratis-components-choose-control`) or the general upgrade loop of versions, order and deployment (`cratis-platform-upgrade-application`).
4
+ ---
5
+
6
+ # Move a TypeScript application from Components 3 to Components 4
7
+
8
+ Temporary guidance for one upgrade. Reinstall the AI corpus without this profile once the upgrade is merged. Run it inside the loop of `cratis-platform-upgrade-application`, which owns version pairing and the order across products. Paths and names in examples are illustrative.
9
+
10
+ ## What changed
11
+
12
+ Components 3 rendered through PrimeReact 11. Components 4 renders its own markup, with no PrimeReact, PrimeIcons or Prime theme dependency. Imports, provider configuration, CSS selectors and some callbacks change, so this is not a version bump.
13
+
14
+ | Symptom | Cause | Who is affected |
15
+ | --- | --- | --- |
16
+ | `@cratis/components` has no exported member `Canvas`, `Common`, `DataTables` or another component namespace | The package root is setup-only: provider, configuration, message and icon types. Every component comes from its own subpath | Applications that import a namespace from the package root, as `import { Canvas } from '@cratis/components'` |
17
+ | `@cratis/components/styled`, `@cratis/components/compatibility` or `@cratis/components/primereact-v10-palette` cannot be resolved; `styledMode`, `CratisPreset` or `primeReactStyles` is missing | The renderer subpaths and their symbols are removed, with no replacement package | Applications that configured a PrimeReact preset or used the pass-through compatibility contract |
18
+ | Type error on `license`, `theme`, `defaults`, `pt`, `ripple`, `unstyled` or a z-index setting in the `value` of `CratisComponentsProvider` | The provider configures locale, messages, icons, routing and dialog header actions, not a renderer | Applications that passed renderer settings to the provider |
19
+ | Components render without the product's look; selectors on PrimeReact markup (`.p-*` classes, `data-scope` and `data-part` attributes) match nothing; a `pt` key is rejected | Components owns the markup. Parts carry `data-cratis-part`; `pt` takes the component's own parts, with plain HTML attributes as values | Applications with their own CSS or `pt` configuration for Components |
20
+ | A `Dropdown` `onChange` handler reads `event.value` and gets nothing, or fails type checking | `onChange` receives the selected value itself, not an event object | Applications with such handlers |
21
+ | `RadioButtonField` fails type checking for a missing `name` | Options bound to one property must share an explicit `name` | Applications with `RadioButtonField` |
22
+ | An import from the `Canvas` or `PivotViewer` subpath cannot resolve `pixi.js`, or the install reports it as a missing peer | `pixi.js` is an optional peer, no longer a dependency of the package | Applications that use `Canvas` or `PivotViewer` |
23
+ | `PivotViewerOptimized`, `CommandStepperContent` or an internal helper of `Canvas` or `Filter` is missing | Exports that were never a contract are removed | Applications that imported them |
24
+ | The install no longer brings `primeicons` | A string icon is still rendered as a class on an `<i>` element, but `primeicons` is no longer a peer of Components | Applications that pass PrimeIcons class strings |
25
+ | Dates in `DatePickerInput` follow the locale and ignore `dateFormat`; `clientFiltering` on a query table changes nothing | Both props are still accepted and do nothing. Without `serverQuery`, table filtering applies only to the loaded page | Applications that set them |
26
+
27
+ Not a break in Components 4, and still worth doing now: the `Button` props `text`, `link`, `outlined`, `rounded` and `severity` are deprecated and still work. A codemod moves them to `variant`, `tone` and `shape`.
28
+
29
+ An application that imports every component from a subpath, configures no PrimeReact preset, and has no CSS, `pt` configuration or handler from the rows above has nothing to change here beyond the version raise.
30
+
31
+ ## Inventory before the bump
32
+
33
+ Search the frontend source. Each list is done when it is written down, even if it is empty.
34
+
35
+ 1. The version of `@cratis/components`, `@cratis/arc`, `@cratis/arc.react`, `pixi.js` and every PrimeReact, `@primereact/*`, `@primeuix/*` and `primeicons` package in `package.json`. Components 3 is required as the starting point: the codemods accept an installed Components 3 or 4 and refuse anything else.
36
+ 2. Every import from `@cratis/components` (the package root) and from the three removed subpaths.
37
+ 3. Every `CratisComponentsProvider` and the keys of its `value`.
38
+ 4. Every `pt` and `ptOptions` prop on a Cratis component, and every stylesheet rule with a `.p-*` selector or a `data-scope` or `data-part` attribute.
39
+ 5. Every direct import from a PrimeReact package. These imports are the application's own and stay until they are replaced (step 7).
40
+ 6. Every `onChange` on `Dropdown`.
41
+ 7. Every use of `Canvas`, `PivotViewer`, `AutoCommandForm`, `RadioButtonField`, a PrimeIcons class string, `dateFormat` and `clientFiltering`.
42
+
43
+ ## Order
44
+
45
+ Work on a branch. A checkpoint is source, package manifest and lockfile together. Save one only when the application's lint, type check, specs and production build pass. Steps 3 to 6 share one checkpoint: the application does not compile between the package raise and the fixes that follow it, so the checks must pass only at step 6. To abandon a step, return source, manifest and lockfile to the previous checkpoint together, reinstall from that lockfile and rerun its checks.
46
+
47
+ Read `references/<language>.md` for the frontend (`package.json` with `@cratis/components` → typescript) for commands, codemod behavior and the mapping tables. This profile ships only the TypeScript reference.
48
+
49
+ 1. **Baseline on Components 3.** Done when every check passes and the rollback checkpoint is saved.
50
+ 2. **Root imports, still on Components 3.** Preview and apply `cratis-components-remove-root-namespace-imports`, then resolve what it reports. The subpaths it writes exist in both majors. Done when the checks pass on Components 3, no component is imported from the package root, and the import-only checkpoint is saved.
51
+ 3. **Raise the packages.** Raise `@cratis/components` to the latest Components 4 release. Add `pixi.js` when the inventory lists `Canvas` or `PivotViewer`. With `AutoCommandForm`, raise `@cratis/arc` and `@cratis/arc.react` together to 22.16.0 or later, inside the range Components declares. Then change by hand: stylesheet imports, the provider, removed subpaths and symbols, `pt` keys and CSS selectors, and the remaining rows of What changed. Done when the install ends without an unmet-peer report for `@cratis/components` and every item of inventory lists 2 to 4 and 7 is changed or deliberately kept. Type errors remain; do not checkpoint.
52
+ 4. **Button props.** Preview and apply `cratis-components-button-variant-tone`. Done when it reports nothing and its `TODO(cratis-codemod)` comments are resolved.
53
+ 5. **Change handlers.** Preview and apply `cratis-components-change-handler`. Done when it reports nothing and its `TODO(cratis-codemod)` comments are resolved.
54
+ 6. **Run the checks.** Done when lint, type check, specs and production build pass, no `TODO(cratis-codemod)` is left, and the upgrade checkpoint is saved.
55
+ 7. **Replace the application's own PrimeReact usage** in separate batches, as `cratis-components-choose-control` describes (`references/from-primereact.md`). Remove a PrimeReact package only when no import, provider, theme or tool still uses it. This step may follow the upgrade in later changes.
56
+
57
+ Step 2 comes first because the two later codemods find components through their subpath imports. Steps 4 and 5 write source for Components 4, so they come after step 3.
58
+
59
+ ## Verify
60
+
61
+ 1. Install from the lockfile, then run lint, type check and the production build.
62
+ 2. Run the specs.
63
+ 3. Search the source: no import of a component from the package root, no import from a removed subpath, no `TODO(cratis-codemod)`.
64
+ 4. Open a page with a field, a table and a dialog in every host entry. Done when each has layout, the product's colors and a visible focus indicator, in every color scheme the application supports.
65
+ 5. With the keyboard only: open and dismiss a dialog, move through a stepper, filter and page a table, enter a date, pick a dropdown value and act on a toast. Done when each works and every changed handler receives the value it expects.
66
+ 6. No event, projection, read model or HTTP contract changes in this move, so no replay and no document diff is needed.
67
+
68
+ If a changed control loses behavior the application needs, stay on the last passing checkpoint until it is resolved.
69
+
70
+ ## Finish
71
+
72
+ Merge the upgrade, then reinstall the AI corpus with the previous profile list: `cratis ai install --profiles <previous> --harnesses <previous> --languages <previous>`. Done when `.cratis/ai.json` no longer lists `cratis/migrate/components-3-to-4` and this skill is gone.
@@ -0,0 +1,137 @@
1
+ # Components 3 to 4 in TypeScript: codemods and mappings
2
+
3
+ ## Contents
4
+
5
+ - Run a codemod
6
+ - What each codemod does and refuses
7
+ - Dependencies
8
+ - Stylesheets
9
+ - Removed root namespaces
10
+ - Removed subpaths and symbols
11
+ - Provider
12
+ - Parts and selectors
13
+ - Controls that behave differently
14
+ - Avoid
15
+
16
+ ## Run a codemod
17
+
18
+ Prerequisite: the application has `@cratis/components` 3 or 4 installed, and you are following Order in this skill. Paths and names in examples are illustrative.
19
+
20
+ All three commands ship in `@cratis/components.migrator`, which is released with the same version number as `@cratis/components`. Run them from the application directory whose installed Components package is being upgraded. Keep the migrator inside major 4; never use `latest`.
21
+
22
+ ```sh
23
+ TOOLING_RANGE='^4.0.0'
24
+
25
+ # Preview: writes nothing.
26
+ npx --package "@cratis/components.migrator@$TOOLING_RANGE" \
27
+ cratis-components-remove-root-namespace-imports --check src
28
+
29
+ # Apply.
30
+ npx --package "@cratis/components.migrator@$TOOLING_RANGE" \
31
+ cratis-components-remove-root-namespace-imports src
32
+ ```
33
+
34
+ - The other two commands, `cratis-components-button-variant-tone` and `cratis-components-change-handler`, take the same form. With pnpm use `pnpm dlx --package …`, with Yarn 2 or later `yarn dlx --package …`.
35
+ - The path argument (`src` here) only selects the files to scan. The installed `@cratis/components` is resolved from the working directory, so run from the application directory.
36
+ - `--check` exits non-zero when a rewrite is pending or a case needs manual review. That exit does not mean the tool failed.
37
+ - An apply run rewrites the safe cases, reports the rest and exits non-zero while any refused case remains.
38
+ - Before scanning, the migrator checks the installed `@cratis/components`. It accepts Components 3 or Components 4, and otherwise scans and writes nothing.
39
+ - Requires Node.js 20 or later. The codemods bring their own TypeScript, scan `.js`, `.jsx`, `.mjs`, `.cjs`, `.ts`, `.tsx`, `.mts` and `.cts` recursively, skip `node_modules` and `dist`, and are safe to rerun.
40
+ - A codemod does not remove imports it leaves unused. Run the formatter and lint afterwards.
41
+ - Pass `--package <name>` when the application installs Components under another package name.
42
+
43
+ **Coming from Components 2 or older (edge case):** the migrator refuses the installed package. Change the imports by hand, install Components 4, then run the codemods.
44
+
45
+ ## What each codemod does and refuses
46
+
47
+ | Codemod | Rewrites | Leaves for you (reported) |
48
+ | --- | --- | --- |
49
+ | `cratis-components-remove-root-namespace-imports` | `import { X } from '@cratis/components'` to `import * as X from '@cratis/components/<subpath>'`, and `export { X } from '@cratis/components'` to `export * as X from '@cratis/components/<subpath>'`, for every root namespace. Aliases and type-only imports are kept; an import that mixes a setup symbol with a namespace is split. | Whole-package imports (`import * as`, default, `import = require`), dynamic `import()`, `require()`, `export *` re-exports, side-effect imports, unknown symbols, and the `Compatibility` namespace with its pass-through exports. A statement with one refused name is left whole. |
50
+ | `cratis-components-button-variant-tone` | Literal `Button` props: `text` → `variant='ghost'`, `link` → `variant='link'`, `outlined` → `variant='outline'`, `rounded` → `shape='pill'`, and `severity` → `tone` (`secondary`, `contrast` → `neutral`; `info`, `help` → `accent`; `success` → `positive`; `warn` → `caution`; `danger` → `critical`). With several old variant props, `link` wins over `text`, and `text` over `outlined`. `severity='contrast'` also adds `variant='solid'` when no other variant applies. A literal new prop that is already there wins. | Dynamic values, JSX spreads, duplicate props, and a new prop with a non-literal value beside the old prop it replaces. |
51
+ | `cratis-components-change-handler` | A callback that only forwards one event field, on a standalone `Dropdown` `onChange` and on a command form field's `onValueChange`: it now receives the value itself. The field is `event.value` for `Dropdown`, `DropdownField` and `MultiSelectField`, `target.value` for the text, password, text area and color fields, `target.checked` for the checkbox and toggle fields, and `target.valueAsNumber` for the number and slider fields (`currentTarget` likewise). | Callbacks with several statements, several uses of the event, or use of the native event. An `event.value` callback whose parameter is not typed as `DropdownChangeEvent`, because `.value` may belong to the selected value. `onChange` on a command form field. |
52
+
53
+ ```tsx
54
+ // Before
55
+ <Button outlined rounded severity='warn'>Review</Button>
56
+ <Dropdown onChange={(event: DropdownChangeEvent<Role>) => setRole(event.value)} />
57
+
58
+ // After
59
+ <Button variant='outline' shape='pill' tone='caution'>Review</Button>
60
+ <Dropdown onChange={(value) => setRole(value)} />
61
+ ```
62
+
63
+ - The first codemod keeps namespace access (`Canvas.Canvas` still resolves). Converting to named imports is optional cleanup by hand.
64
+ - The Button codemod removes an old prop only when discarding its value cannot change what runs: a bare prop or a literal value. When the value is an expression that would no longer be evaluated, as `text` in `<Button link text={record()} />`, the whole prop group stays unchanged and is reported for manual review.
65
+ - A refused case stays unchanged and is reported. The Button and change-handler codemods also mark it with one `TODO(cratis-codemod)` comment, with three exceptions that are reported only: a Button prop that is not safe to remove (above), an untyped `event.value` callback and `onChange` on a command form field.
66
+ - A command form field's `onValueChange` already receives the value on the latest Components 3 release, and `onChange` is not a prop of a field in either major. Expect no rewrite on fields. If the codemod reports a field `onChange`, move the side effect to the enclosing `CommandForm`'s `onFieldChange(command, fieldName, oldValue, newValue)`.
67
+ - After the change-handler codemod, remove every `DropdownChangeEvent` type import: Components 4 does not export the type.
68
+
69
+ ## Dependencies
70
+
71
+ - Components 4 has no PrimeReact, PrimeIcons or Prime theme dependency. Uninstall those packages only when the application no longer imports them directly; otherwise keep them, with their provider, CSS and license, for the surfaces that still use them.
72
+ - `pixi.js` is an optional peer, `^8.20.0`. Install it when the application imports from the `Canvas` or `PivotViewer` subpath, and keep one resolution of it in the application.
73
+ - Components 4 declares `@cratis/arc` and `@cratis/arc.react` from 20.3.1 up to, not including, 26. `AutoCommandForm` needs 22.16.0 or later, which honors an explicit field name. Raise the two Arc packages together, to the same version.
74
+ - React 19 stays the required React major.
75
+ - Add the recommended config of `@cratis/eslint-plugin-components` (major 4, needs ESLint 9 or later) after `@cratis/eslint-config`. Its `no-root-barrel-import` rule keeps root namespace imports from returning.
76
+
77
+ ## Stylesheets
78
+
79
+ Import `@cratis/components/tokens`, then `@cratis/components/styles`, once in every host entry. Add `@cratis/components/theme` for the Cratis baseline look, or leave it out and assign the `--cratis-*` tokens yourself. The setup, the tokens and the scheme selectors are in `cratis-components-theme-application`.
80
+
81
+ ## Removed root namespaces
82
+
83
+ The package root exports the provider, its configuration, message and icon types, and their helpers. Every component comes from its subpath.
84
+
85
+ | Components 3 root namespace | Subpath |
86
+ | --- | --- |
87
+ | `Canvas`, `Chat`, `CommandDialog`, `CommandForm`, `Common`, `DataPage`, `DataTables`, `Dialogs`, `Display`, `Dropdown`, `Filter`, `Notifications`, `ObjectContentEditor`, `ObjectNavigationalBar`, `PivotViewer`, `SchemaEditor`, `TimeMachine`, `Toolbar` | `@cratis/components/<same name>` |
88
+ | `Types` | `@cratis/components/types` |
89
+ | `CommandStepper` | The codemod maps the namespace to `@cratis/components/CommandDialog`, because the old namespace was that whole module. In new code import the `CommandStepper` component from `@cratis/components/CommandStepper`. |
90
+ | `Compatibility` | None. Replace its contracts with the typed parts of each component, then delete the import. |
91
+
92
+ `@cratis/components/CommandForm/fields` and `@cratis/components/CommandForm` are the same module.
93
+
94
+ ## Removed subpaths and symbols
95
+
96
+ | Removed | Do instead |
97
+ | --- | --- |
98
+ | `@cratis/components/styled`; `styledMode`, `StyledModeOptions`, `CratisPreset`, `primeReactStyles` | Remove the renderer configuration. Import `tokens`, `styles` and optionally `theme`; assign product values to `--cratis-*` tokens directly. |
99
+ | `@cratis/components/compatibility`; the `Compatibility` namespace and its pass-through contract, sentinel and assert helpers | Use each component's typed parts (`DialogParts`, `DataTableParts`, `TablePaginatorParts`, `StepperParts`, `ToolbarParts`) and `data-cratis-part` selectors. |
100
+ | `@cratis/components/primereact-v10-palette` | Map product tokens to `--cratis-*`, or use the baseline theme. |
101
+ | `primeReactCssLayer`, `primeReactCssLayerOrder` | Delete, unless the product still owns direct PrimeReact CSS. Layer order belongs in product CSS. |
102
+ | `cratisDarkModeSelector` | The product's own theme selector, with the matching `--cratis-*` values assigned under it. |
103
+ | `PivotViewerOptimized` | `PivotViewer`. |
104
+ | `CommandStepperContent` | No replacement. Use `CommandStepper` or `StepperCommandDialog`. |
105
+ | Internal helpers of `Canvas` (`getInitials`, `reactionsExcludingUser`, mention and emoji helpers) and `Filter` (`buildFilterValues`, `buildRangeValues`, `RenderedHistogramBucket`) | No replacement. Inline the logic the application needs. |
106
+
107
+ ## Provider
108
+
109
+ - `CratisComponentsProvider` takes locale, messages, icons, routing, dialog header actions and the toast region. Its options are in `cratis-components-theme-application`.
110
+ - Renderer keys in `value` are type errors: `license`, `theme`, `defaults`, `pt`, `ripple`, `unstyled` and z-index settings. Remove them. Configure a PrimeReact provider that is still needed on its own.
111
+ - `value.locales` is still accepted for the old paginator and date labels, and deprecated. Move them to `value.messages`.
112
+
113
+ ## Parts and selectors
114
+
115
+ - `pt` stays, with new keys and plain HTML attributes as values. `ptOptions` and `unstyled` are accepted and do nothing.
116
+ - Check every `pt` key against the component's part type; every part is listed in `cratis-components-theme-application`, `references/parts.md`. Known keys that are no longer parts: `popup` on a dialog, and `theadRow` and `theadCell` on a data table.
117
+ - Replace selectors on PrimeReact markup (`.p-*` classes, `[data-scope]` and `[data-part]` attributes) with `[data-cratis-part='…']` selectors and the state attributes listed there, as `[data-cratis-part='step'][data-active='true']`.
118
+ - `Dropdown` still accepts `inputId` for `id` and `panelClassName` for the class of the `popover` part. Prefer the new names.
119
+
120
+ ## Controls that behave differently
121
+
122
+ | Control | Change | Do |
123
+ | --- | --- | --- |
124
+ | `DatePickerInput` | Still takes and returns `Date \| null`. Formatting follows the locale; `dateFormat` is accepted and ignored. | Set the locale on the provider and remove `dateFormat`. |
125
+ | `DataTableForQuery`, `DataTableForObservableQuery` | Without `serverQuery`, sorting and filtering apply to the loaded page; `clientFiltering` is accepted and does nothing. | Remove `clientFiltering`. Set `serverQuery` to pass filter arguments to the query and apply them before paging. |
126
+ | `RadioButtonField` | `name` is required. | Give every option bound to one property the same `name`. |
127
+ | An icon passed as a PrimeIcons class string | Still rendered as that class on an `<i>` element. `primeicons` is no longer a peer of Components. | Keep `primeicons` installed and its stylesheet imported in the application while class strings are in use, or pass a React icon component. |
128
+
129
+ ## Avoid
130
+
131
+ - Raising the package before the root-import codemod has run and passed on Components 3.
132
+ - Running the Button or change-handler codemod before the raise.
133
+ - Fetching the migrator with `latest`.
134
+ - Treating a non-zero `--check` exit as a tool failure.
135
+ - Deleting a `TODO(cratis-codemod)` without resolving the case it marks.
136
+ - Uninstalling PrimeReact while a direct import of it remains.
137
+ - Recreating a product → PrimeReact → Cratis token chain. Map product values to `--cratis-*` directly.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cratis-platform-upgrade-application
3
- description: Use when moving an existing Cratis application to newer Cratis packages, tools or images, pinning Cratis package and image versions before a first production deployment, planning or reviewing a Cratis dependency upgrade (which package versions pair, and the order of the steps), or when a build or run breaks after such an update. Not for the PrimeReact codemods and the renderer and CSS migration of a Components major (`cratis-components-theme-application`), upgrading the Chronicle kernel itself (`cratis-chronicle-deploy-kernel`) or scaffolding a new application (`cratis-platform-start-application`).
3
+ description: Use when moving an existing Cratis application to newer Cratis packages, tools or images, pinning Cratis package and image versions before a first production deployment, planning or reviewing a Cratis dependency upgrade (which package versions pair, and the order of the steps), or when a build or run breaks after such an update. Not for the codemods and the renderer and CSS migration of a Components major (the matching Components migration profile), upgrading the Chronicle kernel itself (`cratis-chronicle-deploy-kernel`) or scaffolding a new application (`cratis-platform-start-application`).
4
4
  ---
5
5
 
6
6
  # Move an application to newer Cratis packages, tools and images
@@ -68,7 +68,7 @@ Compile-time and changed-default steps belong to the application. Stored-state,
68
68
  | Chronicle kernel: order, backup, rollout, majors | `cratis-chronicle-deploy-kernel`, `references/upgrade-and-recovery.md` |
69
69
  | Chronicle kernel that holds unique constraint claims | `cratis-chronicle-constrain-append`, `references/operations.md` |
70
70
  | Arc on .NET: defaults that changed | `references/csharp.md` in this skill |
71
- | Components across the major that stopped rendering through PrimeReact | `cratis-components-theme-application`, `references/upgrade-from-previous-major.md` |
71
+ | Components across a major | The matching `cratis/migrate/components-<from>-to-<to>` profile |
72
72
  | Specifications across a major | `cratis-specifications-isolate-behavior`, `references/csharp-running.md` |
73
73
  | AuthProxy | Read both its upgrade notes and the release notes of every version you cross: a change to what an unchanged configuration does can be described in only one of them. Settings are in `cratis-authproxy-configure` |
74
74
 
@@ -56,7 +56,7 @@ A Components major is not a version bump: imports, provider setup, styling selec
56
56
  - The migrator refuses an installed version outside the majors it supports. On the direct path from an older major, no command runs on the old release: make the preparatory import changes by hand, and run every command, the import migration included, only after the new major is installed.
57
57
  - After the bump, update the provider setup and the stylesheet imports and make the source changes the guide lists before expecting the frontend to build. A failing build between the bump and those changes is expected, not a defect.
58
58
 
59
- Order, commands and what changes by hand: `cratis-components-theme-application`, `references/upgrade-from-previous-major.md`.
59
+ Order, commands and what changes by hand: the matching `cratis/migrate/components-<from>-to-<to>` profile.
60
60
 
61
61
  ## Node backend and Chronicle client
62
62
 
@@ -1797,6 +1797,62 @@
1797
1797
  ],
1798
1798
  "languages": []
1799
1799
  },
1800
+ {
1801
+ "id": "cratis/migrate/arc-22-to-23",
1802
+ "description": "Temporary: move a C# application from Arc 22 to Arc 23; remove when the upgrade is merged.",
1803
+ "composes": [],
1804
+ "availableTargets": [
1805
+ "cratis-migrate-arc-22-to-23"
1806
+ ],
1807
+ "languages": [
1808
+ "csharp"
1809
+ ],
1810
+ "migration": {
1811
+ "product": "arc",
1812
+ "from": 22,
1813
+ "to": 23,
1814
+ "packages": {
1815
+ "nuget": [
1816
+ "Cratis",
1817
+ "Cratis.Arc",
1818
+ "Cratis.Arc.Core",
1819
+ "Cratis.Arc.Chronicle",
1820
+ "Cratis.Arc.Mcp"
1821
+ ],
1822
+ "npm": [
1823
+ "@cratis/arc",
1824
+ "@cratis/arc.react"
1825
+ ]
1826
+ }
1827
+ }
1828
+ },
1829
+ {
1830
+ "id": "cratis/migrate/arc-23-to-24",
1831
+ "description": "Temporary: move a C# or TypeScript application from Arc 23 to Arc 24; remove when the upgrade is merged.",
1832
+ "composes": [],
1833
+ "availableTargets": [
1834
+ "cratis-migrate-arc-23-to-24"
1835
+ ],
1836
+ "languages": [
1837
+ "csharp",
1838
+ "typescript"
1839
+ ],
1840
+ "migration": {
1841
+ "product": "arc",
1842
+ "from": 23,
1843
+ "to": 24,
1844
+ "packages": {
1845
+ "nuget": [
1846
+ "Cratis.Arc",
1847
+ "Cratis",
1848
+ "Cratis.Arc.Availability"
1849
+ ],
1850
+ "npm": [
1851
+ "@cratis/arc"
1852
+ ]
1853
+ }
1854
+ }
1855
+ },
1800
1856
  {
1801
1857
  "id": "cratis/migrate/arc-24-to-25",
1802
1858
  "description": "Temporary: move a C# application from Arc 24 to Arc 25; remove when the upgrade is merged.",
@@ -1822,6 +1878,28 @@
1822
1878
  }
1823
1879
  }
1824
1880
  },
1881
+ {
1882
+ "id": "cratis/migrate/components-3-to-4",
1883
+ "description": "Temporary: move a TypeScript application from Components 3 to Components 4; remove when the upgrade is merged.",
1884
+ "composes": [],
1885
+ "availableTargets": [
1886
+ "cratis-migrate-components-3-to-4"
1887
+ ],
1888
+ "languages": [
1889
+ "typescript"
1890
+ ],
1891
+ "migration": {
1892
+ "product": "components",
1893
+ "from": 3,
1894
+ "to": 4,
1895
+ "packages": {
1896
+ "npm": [
1897
+ "@cratis/components",
1898
+ "@cratis/components.migrator"
1899
+ ]
1900
+ }
1901
+ }
1902
+ },
1825
1903
  {
1826
1904
  "id": "cratis/modeling/screenplay-stage",
1827
1905
  "composes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "8.13.0",
3
+ "version": "8.14.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,141 +0,0 @@
1
- # Upgrade Cratis Components from the previous major
2
-
3
- ## Contents
4
-
5
- - When this applies
6
- - Order
7
- - Run a codemod
8
- - What each codemod does and refuses
9
- - Dependencies
10
- - Removed root namespaces
11
- - Removed subpaths and symbols
12
- - Provider and pass-through changes
13
- - Verify
14
- - Avoid
15
-
16
- A one-time task. General package upgrades are in `cratis-platform-upgrade-application`; this reference holds the Components-specific steps. Paths and names in examples are illustrative.
17
-
18
- ## When this applies
19
-
20
- The application is on the major of `@cratis/components` that rendered through PrimeReact, and moves to the major that owns its own markup. You recognise the old major by any of these in the application:
21
-
22
- - Component namespaces imported from the package root: `import { Canvas } from '@cratis/components'` used as `<Canvas.Canvas>`.
23
- - `styledMode()`, `CratisPreset` or `primeReactStyles` in the provider setup.
24
- - Imports from `@cratis/components/styled` or `@cratis/components/compatibility`.
25
-
26
- This is not a version bump: imports, provider configuration, CSS selectors and some callbacks change. "Old major" and "new major" below mean these two.
27
-
28
- ## Order
29
-
30
- Work on a branch. A checkpoint is source, package manifest and lockfile together. Save one only when the application's lint, type check, specs and production build pass. Steps 3 to 6 share one checkpoint: the application does not compile between the package upgrade and the fixes that follow it, so errors left by steps 3 to 5 are expected and the checks must pass only at step 6.
31
-
32
- 1. **Baseline.** Make every check pass on the old major. Save the rollback checkpoint.
33
- 2. **Root imports, still on the old major.** Preview and apply `cratis-components-remove-root-namespace-imports`. The subpaths it writes exist in both majors. Review the diff and every diagnostic, rerun the checks on the old major and save the import-only checkpoint.
34
- 3. **Upgrade the package** to the new major. Then, by hand: the stylesheet imports (Default path in this skill), the provider (below), removed presets and symbols (below), and part names in `pt` and CSS. Type errors remain until step 6 is done; do not checkpoint here.
35
- 4. **Button props.** Preview and apply `cratis-components-button-variant-tone`, then resolve its diagnostics and `TODO(cratis-codemod)` comments.
36
- 5. **Change handlers.** Preview and apply `cratis-components-change-handler`, then resolve its diagnostics and `TODO(cratis-codemod)` comments. A command form field's `onChange` stays a type error until you move it by hand (below).
37
- 6. **Run the checks.** When they pass with no diagnostic and no `TODO(cratis-codemod)` left, save the upgrade checkpoint.
38
- 7. **Replace remaining direct PrimeReact usage** in separate batches (see `cratis-components-choose-control`, `references/from-primereact.md`). Remove PrimeReact packages only when no import, provider, theme or tool still uses them.
39
-
40
- Steps 4 and 5 produce source for the new major, so they come after step 3. Step 2 comes first because the two later codemods find components through their subpath imports.
41
-
42
- To abandon a step, return source, manifest and lockfile to the previous checkpoint together, reinstall from that lockfile and rerun its checks.
43
-
44
- ## Run a codemod
45
-
46
- All three commands ship in `@cratis/components.migrator`. Run them from the application directory whose installed Components package is being upgraded, with the migrator in the same major as the new Components major. Never use `latest`.
47
-
48
- ```sh
49
- # The caret range of the Components major you are upgrading to.
50
- TOOLING_RANGE='^<new major>.0.0'
51
-
52
- npx --package "@cratis/components.migrator@$TOOLING_RANGE" \
53
- cratis-components-remove-root-namespace-imports --check src
54
- npx --package "@cratis/components.migrator@$TOOLING_RANGE" \
55
- cratis-components-remove-root-namespace-imports src
56
- ```
57
-
58
- - The path argument (`src` here) only selects the files to scan. The installed `@cratis/components` is resolved from the working directory, so run from the application directory rather than passing a path into the app from elsewhere.
59
- - Replace `<new major>` with the number; the other two commands take the same form. With pnpm use `pnpm dlx --package …`, with Yarn 2 or later `yarn dlx --package …`.
60
- - `--check` writes nothing. It exits non-zero when a rewrite is pending or a case needs manual review; that exit does not mean the tool failed.
61
- - An apply run rewrites the safe cases, reports the rest and exits non-zero while any refused case remains.
62
- - Before scanning, the migrator checks the installed `@cratis/components`. It accepts only the old major or the new major, and otherwise scans and writes nothing.
63
- - Requires Node.js 20 or later. The codemods bring their own TypeScript, scan `.js`, `.jsx`, `.mjs`, `.cjs`, `.ts`, `.tsx`, `.mts` and `.cts` recursively, skip `node_modules` and `dist`, and are safe to rerun.
64
- - A codemod does not remove imports it leaves unused. Run the formatter and lint afterwards.
65
-
66
- **Coming from a major older than the old major (edge case):** the migrator refuses the installed package. Change the imports by hand, install the new major, then run the codemods.
67
-
68
- ## What each codemod does and refuses
69
-
70
- | Codemod | Rewrites | Leaves for you (reported) |
71
- | --- | --- | --- |
72
- | `cratis-components-remove-root-namespace-imports` | `import { X } from '@cratis/components'` to `import * as X from '@cratis/components/<subpath>'`, and `export { X } from '@cratis/components'` to `export * as X from '@cratis/components/<subpath>'`, for every root namespace. Aliases and type-only imports are kept; mixed setup and namespace imports are split. | Whole-package imports (`import * as`, default, `import = require`), dynamic `import()`, `require()`, `export *` re-exports, side-effect imports, unknown symbols, and the `Compatibility` namespace. |
73
- | `cratis-components-button-variant-tone` | Literal `Button` props: `text` → `variant='ghost'`, `link` → `variant='link'`, `outlined` → `variant='outline'`, `rounded` → `shape='pill'`, and `severity` → `tone` (`secondary`, `contrast` → `neutral`; `info`, `help` → `accent`; `success` → `positive`; `warn` → `caution`; `danger` → `critical`). | Dynamic values, JSX spreads, duplicate props, and a new prop with a non-literal value beside the old prop it replaces. |
74
- | `cratis-components-change-handler` | A callback that only forwards one event field, on a standalone `Dropdown` `onChange` and on a command form field's `onValueChange`: it now receives the value itself. The field is `event.value` for `Dropdown`, `DropdownField` and `MultiSelectField`, `target.value` for the text, password, text area and color fields, `target.checked` for the checkbox and toggle fields, and `target.valueAsNumber` for the number and slider fields (`currentTarget` likewise). | Callbacks with several statements, several uses of the event, or use of the native event. An `event.value` callback whose parameter is not typed as the old change event, because `.value` may belong to the selected value. `onChange` on a command form field (see below). |
75
-
76
- - The first codemod keeps namespace access (`Canvas.Canvas` still resolves). Converting to named imports is optional cleanup by hand.
77
- - When several of `link`, `text` and `outlined` are set, the Button codemod keeps one variant in that order of precedence. A literal new prop (`variant`, `tone`, `shape`) wins over the old prop it replaces.
78
- - The Button codemod removes an old prop only when discarding its value cannot change what runs: a bare prop or a literal value. When the value is an expression that would no longer be evaluated, as `text` in `<Button link text={record()} />`, the whole prop group stays unchanged and is reported for manual review.
79
- - A refused case stays unchanged and is reported. The Button and change-handler codemods also mark it with one `TODO(cratis-codemod)` comment, with three exceptions that are reported only: a Button prop that is not safe to remove (above), an untyped `event.value` callback and `onChange` on a command form field.
80
- - **`onChange` on a command form field** is no longer a prop and fails type checking. Move the side effect to the enclosing `CommandForm`'s `onFieldChange(command, fieldName, oldValue, newValue)`.
81
- - After the change-handler codemod, remove a `DropdownChangeEvent` type import that is no longer used.
82
-
83
- ## Dependencies
84
-
85
- - The new major has no PrimeReact, PrimeIcons or Prime theme dependency. Uninstall those packages only when the application no longer imports them directly; otherwise keep them, with their provider, CSS and license, for the surfaces that still use them.
86
- - `pixi.js` is now an optional peer. Install it when the application imports from the `Canvas` or `PivotViewer` subpath; keep one resolution of it in the application.
87
- - `AutoCommandForm` needs an Arc release that honours an explicit field name. Update `@cratis/arc` and `@cratis/arc.react` together, to the same version, inside the range the Components package declares.
88
- - Add the recommended config of `@cratis/eslint-plugin-components` (same major as Components) after `@cratis/eslint-config`; its `no-root-barrel-import` rule keeps root namespace imports from returning.
89
-
90
- ## Removed root namespaces
91
-
92
- The package root is setup-only: provider, configuration and message types. Every component comes from its subpath.
93
-
94
- | Old root namespace | Subpath |
95
- | --- | --- |
96
- | `Canvas`, `Chat`, `CommandDialog`, `CommandForm`, `Common`, `DataPage`, `DataTables`, `Dialogs`, `Display`, `Dropdown`, `Filter`, `Notifications`, `ObjectContentEditor`, `ObjectNavigationalBar`, `PivotViewer`, `SchemaEditor`, `TimeMachine`, `Toolbar` | `@cratis/components/<same name>` |
97
- | `Types` | `@cratis/components/types` |
98
- | `CommandStepper` | The codemod maps the namespace to `@cratis/components/CommandDialog`, because the old namespace was that whole module. In new code import the `CommandStepper` component from `@cratis/components/CommandStepper`. |
99
- | `Compatibility` | None. Replace its contracts with the typed parts of each component, then delete the import. |
100
-
101
- `@cratis/components/CommandForm/fields` and `@cratis/components/CommandForm` are the same module.
102
-
103
- ## Removed subpaths and symbols
104
-
105
- | Removed | Do instead |
106
- | --- | --- |
107
- | `@cratis/components/styled`; `styledMode`, `StyledModeOptions`, `CratisPreset`, `primeReactStyles` | Remove the renderer configuration. Import `tokens`, `styles` and optionally `theme`; assign product values to `--cratis-*` tokens directly. |
108
- | `@cratis/components/compatibility`; the `Compatibility` namespace and its pass-through contract, sentinel and assert helpers | Use each component's typed parts (`DialogParts`, `DataTableParts`, `TablePaginatorParts`, `StepperParts`, `ToolbarParts`) and `data-cratis-part` selectors. |
109
- | `@cratis/components/primereact-v10-palette` | Map product tokens to `--cratis-*`, or use the baseline theme. |
110
- | `primeReactCssLayer`, `primeReactCssLayerOrder` | Delete, unless the product still owns direct PrimeReact CSS. Layer order belongs in product CSS. |
111
- | `cratisDarkModeSelector` | The product's own theme selector, with the matching `--cratis-*` values assigned under it. |
112
- | `PivotViewerOptimized` | `PivotViewer`. |
113
- | `CommandStepperContent` | No replacement. Use `CommandStepper` or `StepperCommandDialog`. |
114
- | Internal helpers that were exported by accident from `Canvas` (`getInitials`, `reactionsExcludingUser`, mention and emoji helpers) and `Filter` (`buildFilterValues`, `buildRangeValues`, `RenderedHistogramBucket`) | No replacement. Inline the logic the application needs. |
115
-
116
- ## Provider and pass-through changes
117
-
118
- - `CratisComponentsProvider` takes locale, labels, icons, routing, dialog header actions and the toast region (Provider configuration in this skill). Renderer keys are type errors: `license`, `theme`, `defaults`, `pt`, `ripple`, `unstyled` and z-index settings. Remove them; configure a PrimeReact provider that is still needed on its own.
119
- - `value.locales` is still accepted for the old paginator and date labels. Move them to `value.messages`.
120
- - `pt` stays, with new keys and plain HTML attributes as values. `ptOptions` and `unstyled` are accepted and do nothing.
121
- - Rename pass-through keys to Cratis parts. Dialog: `mask` → `backdrop`, `headerTitle` → `title`, `closeButton` → `close`. DataTable: `thead` → `head`, `tbody` → `body`, `bodyRow` → `row`. Every part is in [parts](parts.md).
122
- - Replace `.p-*` selectors with `[data-cratis-part='…']` selectors and the state attributes in this skill.
123
-
124
- ## Verify
125
-
126
- - No component is imported from the package root, and no `TODO(cratis-codemod)` remains.
127
- - `tokens` and `styles` load in every host entry.
128
- - `pt` keys and CSS selectors name Cratis parts.
129
- - With the keyboard only: open and dismiss a dialog, move through a stepper, filter and page a table, enter a date, pick a dropdown value, act on a toast.
130
- - Check each scheme the application supports, then run the checks in Verify in this skill.
131
- - If a changed control loses behaviour the application needs, stay on the last passing checkpoint until it is resolved.
132
-
133
- ## Avoid
134
-
135
- - Upgrading the package before the root-import codemod has run and passed on the old major.
136
- - Running the Button or change-handler codemod before the upgrade.
137
- - Fetching the migrator with `latest`.
138
- - Treating a non-zero `--check` exit as a tool failure.
139
- - Deleting a `TODO(cratis-codemod)` without resolving the case it marks.
140
- - Uninstalling PrimeReact while a direct import of it remains.
141
- - Recreating a product → PrimeReact → Cratis token chain. Map product values to `--cratis-*` directly.