gs2-studio-dsl 2026.11.13 → 2026.11.15
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/LLM.md +119 -29
- package/README.md +5 -4
- package/REFERENCE.md +251 -47
- package/index.d.ts +305 -239
- package/package.json +1 -1
package/LLM.md
CHANGED
|
@@ -51,6 +51,8 @@ commands below with the executable's path; the first build writes the ledger. It
|
|
|
51
51
|
4. Type-check: `npx tsc --noEmit -p <dsl>`. Fix every error before building.
|
|
52
52
|
5. First build of a new package:
|
|
53
53
|
`"<GS2 Studio>" dsl build --dir <project> --entry <dsl>/index.ts --write-ledger`
|
|
54
|
+
It adds the package with the id `definePackage({ id })` declares beside the project's other packages, which stay as
|
|
55
|
+
they are; later builds replace that package. Only a DSL that declares the id `local-project` replaces `local-project`.
|
|
54
56
|
6. Later builds: the same command without `--write-ledger`. Add `--write-ledger` only when the build reports missing
|
|
55
57
|
ledger tokens for things you added (a type, property, row or transform) and reports no token as "not current".
|
|
56
58
|
A "not current" token means a rename or removal: handle it as in section 4 first.
|
|
@@ -59,7 +61,8 @@ commands below with the executable's path; the first build writes the ledger. It
|
|
|
59
61
|
generation will do wrong or leave out. Fix each one the DSL can fix (section 6) and build again; tell the user about a
|
|
60
62
|
line on another package that the DSL does not change. Then open the project in GS2 Studio and fix what it reports:
|
|
61
63
|
what Unity code generation alone refuses is not printed (see
|
|
62
|
-
[Building with dsl build](REFERENCE.md#building-with-dsl-build)).
|
|
64
|
+
[Building with dsl build](REFERENCE.md#building-with-dsl-build)). A build with no such line prints
|
|
65
|
+
`project check (without Unity code generation): no errors or warnings` last.
|
|
63
66
|
8. Keep `id-ledger.json` and `dependency-surface.json` with `index.ts`; commit them together.
|
|
64
67
|
|
|
65
68
|
A build that fails a check writes nothing. On failure, read every listed problem, fix the DSL, and rerun.
|
|
@@ -77,47 +80,94 @@ MUST:
|
|
|
77
80
|
- Name domain types in PascalCase and properties in camelCase. Never declare a property named `id`.
|
|
78
81
|
- Bind every `.masterData()` property in some master data resource and every `.userData()` property in some user data
|
|
79
82
|
resource, or remove the hint.
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
of
|
|
83
|
-
|
|
83
|
+
- Put a `defineUiComponent`, and the type of a `UiSource.rowProp`, only on a type that gets a Handler; `dsl build`
|
|
84
|
+
refuses either on a type without one and says why. A dependency's type gets one when `types.<Type>.generatedHandlers`
|
|
85
|
+
of its surface is not `[]` (`mountedBy` names the dependency's resources that mount it), or when your package mounts
|
|
86
|
+
its overlay of the type itself. A type gets one only when a user data resource, or a master data resource of a model
|
|
87
|
+
other than a namespace, mounts it.
|
|
88
|
+
- To use what a dependency does as it is (for example "make the wallet usable" with `foundation-economy-currency`),
|
|
89
|
+
declare the dependency and call its transforms; add rows, resources or UI only for what the surface or a build asks
|
|
90
|
+
for. The dependency's own UI components (`types.<Type>.uiComponents`) are generated with it, and the game places
|
|
91
|
+
the Handler that holds the row they show, such as a `WalletHandler` set to the slot (`"0"`). See
|
|
92
|
+
[Rows in the game](REFERENCE.md#rows-in-the-game).
|
|
93
|
+
- With `micro-economy-quest`, use its `QuestStartButton` and `ProgressCompleteButton` (surface keys `StartButton` on
|
|
94
|
+
`Quest` and `CompleteButton` on `Progress`) instead of writing Start and Complete buttons, and gate the quest list's
|
|
95
|
+
Start buttons with `ProgressIdleActiveToggle` (surface key `IdleActiveToggle` on `Progress`), or with an
|
|
96
|
+
`interactable` on `Quest` that reads the progress row `"progress"` with `UiSource.rowProp`: GS2 refuses a second
|
|
97
|
+
Start while a quest is in progress (`alreadyExists`). See [Rows in the game](REFERENCE.md#rows-in-the-game).
|
|
98
|
+
- Place an `activeToggle` such as `ProgressIdleActiveToggle` on a GameObject that stays active below the type's
|
|
99
|
+
Handler, with what it shows or hides as its targets, never on a GameObject it hides: once hidden it stops listening
|
|
100
|
+
and never shows it again. See [UI components](REFERENCE.md#ui-components).
|
|
101
|
+
- Before adding UI to a dependency's type, read `types.<Type>.uiComponents` of its surface. Its keys are the class
|
|
102
|
+
names items are declared with; the generated Unity class is the type's generated name followed by the key (surface
|
|
103
|
+
key `StartButton` on `Quest` → generated class `QuestStartButton`; a rename of the type changes the prefix, see
|
|
104
|
+
[Item options](REFERENCE.md#item-options)). Reuse a listed item instead of adding one that shows the same, and give
|
|
105
|
+
new items unlisted class names: a listed one replaces that item.
|
|
106
|
+
- Give a single-entry type's row the type name in lower case as its id (`GameSettings` → `gamesettings`). The same id
|
|
107
|
+
is the row its Handler holds and the row id to pass to `UiSource.rowProp`. For a dependency's type, read it from
|
|
108
|
+
`types.<Type>.singleEntryRowId` of the surface, also when the surface lists no row (`micro-economy-quest`'s
|
|
109
|
+
`Progress` → `"progress"`); an overlay that renames the type keeps it. See
|
|
110
|
+
[Keys and identity](REFERENCE.md#keys-and-identity).
|
|
84
111
|
- Refer to anything of another package only through `dependencyPackage(surface)` built from a surface file that
|
|
85
112
|
`dsl surfaces` wrote (or, for a package you build yourself, the `dependency-surface.json` beside its ledger, which
|
|
86
113
|
has the same content): `dep.type(...)`, `dep.overlay(...)`, `dep.typeId(...)`, `dep.propertyId(...)`,
|
|
87
114
|
`dep.transformId(...)`, `dep.transformCall(...)`, `dep.transformProgram(...)`, `dep.resourceId(...)`. Declare the
|
|
88
115
|
dependency in `definePackage({ dependencies: { [dep.packageId]: spec } })`. The spec of a package authored in the same
|
|
89
116
|
project is `"*"`. An installed package has the spec of its source, as the `dependencies` of
|
|
90
|
-
`<project>/packages/<packageId>/package.json` of the package that installed it declare it: a package
|
|
91
|
-
GitHub is `github:<owner>/<repo>[@<range>]` without its subdirectory, and every package of the GS2
|
|
92
|
-
repository is `github:gs2io/gs2-studio-package`.
|
|
93
|
-
|
|
117
|
+
`<project>/packages/<packageId>/package.json` of the package that installed it declare it, range included: a package
|
|
118
|
+
installed from GitHub is `github:<owner>/<repo>[@<range>]` without its subdirectory, and every package of the GS2
|
|
119
|
+
Studio package repository is `github:gs2io/gs2-studio-package`. A package that came in as a dependency of another one
|
|
120
|
+
appears in no `package.json` there: derive the spec from its entry in `<project>/project-lock.json`
|
|
121
|
+
(`github:<owner>/<repo>` for `"sourceKind": "github"`, `npm:<packageName>@<version>` for `"sourceKind": "npm"`).
|
|
122
|
+
Never give an installed package `"*"`; `dsl build` refuses it and prints the spec to declare (see
|
|
123
|
+
[Dependencies](REFERENCE.md#dependencies)).
|
|
94
124
|
- Learn what a dependency needs from its surface file, not from its package files: `types.<Type>.propertyDetails`
|
|
95
|
-
gives each property's `type`, `requirement
|
|
96
|
-
|
|
125
|
+
gives each property's `type`, `requirement` (for `conditional`, also its `condition`, in the form `Cond` returns,
|
|
126
|
+
and `requiredWhenMet`; see [Conditions](REFERENCE.md#conditions)), `bindingHint` and, when it has
|
|
127
|
+
one, its `display` (label and description per locale); `actionTransformSignatures.<Name>` gives each transform's category and parameters (name, type,
|
|
97
128
|
required and, when it has one, description); `types.<Type>.delegatedActions.<Method>.parameters` gives what a
|
|
98
129
|
`UiItem.buttonAction` on that method takes as `args`; `types.<Type>.sort` gives the order of its rows, which an overlay of
|
|
99
130
|
the type keeps unless it sets a `sort` other than id ascending. A `ref<T>` parameter or property takes a row id of `T`.
|
|
100
131
|
- Call a dependency's transform with `dep.transformCall(name, { <parameter>: source })` (spread into an
|
|
101
132
|
`actionPropertyTransforms` entry) or `dep.transformProgram(name, { <parameter>: source })` (in `actionProgram`),
|
|
102
133
|
not with `dep.transformId(...)` and hand-written arguments, so `tsc` and `dsl build` check the parameter names. The
|
|
103
|
-
two name a property differently:
|
|
104
|
-
row>"
|
|
105
|
-
[
|
|
134
|
+
two name a property differently: write `actionPropertyTransforms: prop => [...]` and give `transformCall`
|
|
135
|
+
`prop("<property of the row>")`; `transformProgram` takes `{ kind: "domainProperty", source: Source.direct(...) }`.
|
|
136
|
+
In the `prop => [...]` form `tsc` reports a wrong `prop("x")` on `"x"`, but any other mistake in its entries (a wrong
|
|
137
|
+
`targetProperty` or `mode`) on `actionPropertyTransforms` itself, where the array form would point at the value; the
|
|
138
|
+
message's last line names it. See the examples in [Overlay types](REFERENCE.md#overlay-types) and
|
|
139
|
+
[Action programs](REFERENCE.md#action-programs-and-arguments).
|
|
106
140
|
- Add the rows a dependency's type needs from the project with `instance(dep.type("<Type>"), id, values)` in
|
|
107
141
|
`definePackage({ instances: [...] })`: every type a build names in `No master data is registered for domain model
|
|
108
142
|
"<Type>"`. Never author a row whose id a surface lists for the same type (`shippedRowIds`,
|
|
109
143
|
`shippedRowsOfDependencyTypes`): a package ships it, and a row with its id replaces it (use `overlayInstance`). Take
|
|
110
144
|
the values from `types.<Type>.propertyDetails` of the surface. Give a value to every `requirement: "always"` property
|
|
111
145
|
except `id` (the row id), `userData` properties and action lists
|
|
112
|
-
(`list<consumeAction>` and the other action kinds): a missing one fails the build.
|
|
113
|
-
|
|
146
|
+
(`list<consumeAction>` and the other action kinds): a missing one fails the build. Give one also to each
|
|
147
|
+
`conditional` property with `requiredWhenMet: true` unless the row's values rule out its `condition`. An action list
|
|
148
|
+
you leave out deploys as what `actionPropertyTransforms` add to it, or empty.
|
|
149
|
+
- A property or parameter of type `ref<<packageId>:<Type>>` takes a row of that package's type. Declare that package
|
|
150
|
+
as a dependency if it is not one yet (its own surface file and spec), author the row with
|
|
151
|
+
`instance(other.type("<Type>"), id, values)`, and give the row id as the value. Example, a limited-time quest:
|
|
152
|
+
`micro-economy-quest` keeps the period on `QuestCollection.schedule` (`ref<foundation-economy-schedule:Schedule>`),
|
|
153
|
+
not on `Quest`, so put the quest in a quest collection of its own with an absolute `Schedule` row, and have the game
|
|
154
|
+
list that collection too. See [A row of another package's type](REFERENCE.md#a-row-of-another-packages-type).
|
|
114
155
|
- Choose each property's binding hint by what reads its value, also for a property an overlay adds: the client, from
|
|
115
156
|
the rows you author (a UI component shows it) → `.assetDelivery()`; only an `actionPropertyTransforms` argument → no
|
|
116
157
|
hint; a field a master data resource of this package binds → `.masterData()`. See the table in
|
|
117
158
|
[Property modifiers](REFERENCE.md#property-modifiers).
|
|
118
|
-
-
|
|
119
|
-
|
|
120
|
-
(`
|
|
159
|
+
- Write property names as string literals where the DSL takes them. `tsc` checks each against the type it names
|
|
160
|
+
(`UiSource.prop` against the `defineUiComponent` target, `sort`, `compositeKey`, `localizedProperties`,
|
|
161
|
+
`targetProperty` and a transform argument's `prop(...)` against the type that declares them, `UiSource.rowProp`,
|
|
162
|
+
`Source.direct` and row value keys against their type), reports a wrong one on the literal itself (but see the
|
|
163
|
+
`prop => [...]` form above), and lists the names the type has. Write `UiItem` / `UiCond` / `UiSource` calls directly
|
|
164
|
+
in `defineUiComponent`'s `items`. In a variable, a helper function or a `...` spread they name no property unless
|
|
165
|
+
annotated: `function attackLabel(): UiItemSpec<PropertyNameOf<typeof Hero>>`, `const limited: UiConditionSpec<...> = ...`
|
|
166
|
+
(a name parameter of such a helper is `name: PropertyNameOf<typeof Hero>`; a helper generic in the name instead
|
|
167
|
+
passes it as the type argument: `UiItem.label<T>(className, UiSource.prop(name))`). A name typed as a plain `string`
|
|
168
|
+
does not compile; any other helper that passes one on takes `<TName extends string>(name: TName)`. A computed row value key
|
|
169
|
+
escapes `tsc`; `dsl build` still refuses it. See
|
|
170
|
+
[Property names are type-checked](REFERENCE.md#property-names-are-type-checked).
|
|
121
171
|
- Regenerate surface files after a dependency changes. Never edit them by hand.
|
|
122
172
|
- In master data, use `Bind.domainProperty` only in a resource mounted on a domain type, and never use
|
|
123
173
|
`Bind.domainProperties` (user data only). `dsl build` accepts both mistakes; the editor and code generation refuse
|
|
@@ -141,12 +191,23 @@ MUST NOT:
|
|
|
141
191
|
Names and ids:
|
|
142
192
|
|
|
143
193
|
- You write names; GS2 Studio stores ids. The ledger maps names (tokens such as `property:Item.count`) to ids.
|
|
194
|
+
- Renaming a property: rename it in `properties` first and run `tsc --noEmit`, which lists every place that still uses
|
|
195
|
+
the old name (rows, `sort`, `localizedProperties`, transform arguments, UI sources, bindings). Change each, then build
|
|
196
|
+
and move the id as below.
|
|
144
197
|
- Renaming a type, property, row or transform: the build reports the old token as "not current" and the new one as
|
|
145
|
-
missing
|
|
146
|
-
|
|
147
|
-
`
|
|
198
|
+
missing, in one line that says it looks like a rename and names the id to move when it can pair them. In
|
|
199
|
+
`id-ledger.json`, move the old token's id to the new token in `random`, keeping its tokens sorted (otherwise
|
|
200
|
+
`CLI_DSL_LEDGER_INVALID ... not canonical`), then build without `--write-ledger`. Never let
|
|
201
|
+
`--write-ledger` record a new id for a renamed thing. Renaming a type also renames its `property:<Type>.<name>` and
|
|
202
|
+
row tokens; move each of them, all before the next build. It also changes, without a message, the ids of the
|
|
148
203
|
type's UI component and its items and of user data resources mounted on the type; keep them with
|
|
149
204
|
`deterministicOverrides`. See [The id ledger](REFERENCE.md#the-id-ledger).
|
|
205
|
+
- Renaming a UI item (its class name) changes its id the same way. Keep it in `deterministicOverrides`
|
|
206
|
+
(`"ui:<Type>:item:<NewClassName>": "<old item id>"`) so Unity scenes and prefabs keep the renamed component.
|
|
207
|
+
- Renaming a property needs no change to the class names of the UI items that show it (`HpLabel` may stay after `hp`
|
|
208
|
+
becomes `health`): an item is keyed by its class name, not by the property. Rename the item
|
|
209
|
+
only if asked, and then keep its id as above; only a kept id carries the generated script's GUID over, so scenes and
|
|
210
|
+
prefabs stay wired. See [The id ledger](REFERENCE.md#the-id-ledger).
|
|
150
211
|
- A row id is letters, digits, `_`, `.` and `-`, at most 128 characters; a resource that binds `id` to a GS2 name sends
|
|
151
212
|
it as that name (a `micro-economy-quest` `Quest` row id is the quest model name), and some GS2 fields take fewer.
|
|
152
213
|
- A row token contains the row id. Before you treat a "not current" + "missing" row token pair as a rename of a
|
|
@@ -178,16 +239,17 @@ Names and ids:
|
|
|
178
239
|
| Map GS2 user data to properties | `defineUserDataResource({ model: GS2.svc.Model, linkedMaster?, mount?, bindings: {...}, children? })` | [User data resources](REFERENCE.md#user-data-resources) |
|
|
179
240
|
| Field values | `Bind.*`, `Source.direct(T, "prop")`, `Source.parent(...)`, `transactionSettingV2()` | [Bindings](REFERENCE.md#bindings) |
|
|
180
241
|
| Actions of an action entry | `ActionProgram.transform(transform, [Arg...])`; a dependency's: `dep.transformProgram(name, { count: { kind: "domainProperty", source: Source.parent(Source.direct(T, "count")) } })` | [Action programs and arguments](REFERENCE.md#action-programs-and-arguments) |
|
|
181
|
-
| Add a dependency's transform to an inherited action property | `actionPropertyTransforms: [{ targetProperty, mode: "append", ...dep.transformCall(name, { count:
|
|
242
|
+
| Add a dependency's transform to an inherited action property | `actionPropertyTransforms: prop => [{ targetProperty, mode: "append", ...dep.transformCall(name, { count: prop("price") }) }]` | [Overlay types](REFERENCE.md#overlay-types) |
|
|
243
|
+
| A row of another package's type (a `ref<pkg:Type>` value, such as a quest collection's schedule) | Declare that package too, `instance(other.type("Schedule"), id, values)`, pass the row id | [A row of another package's type](REFERENCE.md#a-row-of-another-packages-type) |
|
|
182
244
|
| Produce GS2 actions from parameters | `defineActionTransform(name, { category, parameters, outputs })` + `OutputMap.*` | [Action transforms](REFERENCE.md#action-transforms) |
|
|
183
245
|
| A method that runs a GS2 action | `delegatedActions: { Method: { targetActionKey, targetResource } }` on the type, or `definePackage({ delegatedActions: [{ target, methodName, action: { targetActionKey, targetResource } }] })` | [Delegated actions](REFERENCE.md#delegated-actions) |
|
|
184
246
|
| Generated UI | `defineUiComponent(T, { items: [UiItem.label(...), UiItem.buttonAction(...)] })`, `UiSource.*`, `UiCond.*` | [UI components](REFERENCE.md#ui-components) |
|
|
185
|
-
| Enable a button by another type's row (stamina, coins) | `UiItem.interactable("StartInteractable", UiCond.gte(UiSource.rowProp(energy.type("Energy"), "stamina", "currentValue"), UiSource.prop("
|
|
247
|
+
| Enable a button by another type's row (stamina, coins) | `UiItem.interactable("StartInteractable", UiCond.gte(UiSource.rowProp(energy.type("Energy"), "stamina", "currentValue"), UiSource.prop("cost")))` | [Another type's row](REFERENCE.md#another-types-row) |
|
|
186
248
|
| Choose a UI item and its options | `label` shows text, `templateLabel` text around values, `value` sends a typed value the game formats; a button never disables itself (add `interactable`). `{ name, description }` only label the item in GS2 Studio's editor; leave them out | [UI components](REFERENCE.md#ui-components), [Item options](REFERENCE.md#item-options) |
|
|
187
249
|
| Show every row in the game, in order | A UI component describes one row; the generated `<T>ListHandler` makes one instance of a prefab per row, in the order of `sort` (an overlay: the dependency's order unless it sets a `sort` other than id ascending) | [Rows in the game](REFERENCE.md#rows-in-the-game) |
|
|
188
|
-
| A button on a dependency's delegated action | `UiItem.buttonAction("
|
|
250
|
+
| A button on a dependency's delegated action | `UiItem.buttonAction("ReceiveButton", "Receive", args, options)` (first check `types.<T>.uiComponents`, keyed by class name without the `<T>` prefix: a package may already ship the button); `args` takes only the names under `types.<T>.delegatedActions.Receive.parameters` of the surface and needs each `required: true` one; with none required it may be `undefined` | [Dependencies](REFERENCE.md#dependencies) |
|
|
189
251
|
| Code template | `codeTemplates: [{ outputFileName: "File.cs", templateSource: text }]` with a `?raw` import | [Code templates](REFERENCE.md#code-templates) |
|
|
190
|
-
| Use another package of the project | `dependencyPackage(surface)`, `dependencies: { [dep.packageId]: spec }`; spec `"*"` (authored in the project), or for an installed package the spec the package that installed it declares (`"github:gs2io/gs2-studio-package"` for an official package) | [Dependencies](REFERENCE.md#dependencies) |
|
|
252
|
+
| Use another package of the project | `dependencyPackage(surface)`, `dependencies: { [dep.packageId]: spec }`; spec `"*"` (authored in the project), or for an installed package the spec the package that installed it declares, or for one only in `project-lock.json` the spec its entry gives (`"github:gs2io/gs2-studio-package"` for an official package) | [Dependencies](REFERENCE.md#dependencies) |
|
|
191
253
|
|
|
192
254
|
## 6. Common mistakes
|
|
193
255
|
|
|
@@ -201,11 +263,16 @@ Names and ids:
|
|
|
201
263
|
| `CLI_DSL_EXPORT_INVALID` | Zero or several built packages exported. | Export exactly one `definePackage({...})` or `.build()` result. |
|
|
202
264
|
| `{"kind":"domainTypeDefinitionNotRegistered",...}`, `{"kind":"invalidInstanceType",...}`, `{"kind":"uiComponentTargetTypeUnknown",...}` | A definition used (in a mount or binding, a row, a UI component) without being listed in `domainTypes: [...]`. | Include it in `definePackage({ domainTypes: [...] })`. |
|
|
203
265
|
| `{"kind":"reservedPropertyName",...}` | A property named `id`. | Rename it; `id` exists already. |
|
|
204
|
-
| `
|
|
205
|
-
|
|
|
266
|
+
| `tsc`: `Type '"x"' is not assignable to type '"a" \| "b" \| ...'`, `Argument of type '"x"' is not assignable to parameter of type '"a" \| "b" \| ...'` or `'x' does not exist in type ...`, on the name | A property name the type does not have: misspelled, or left behind by a rename. The message lists the names it has. | Use one of them; after a rename, the new name. |
|
|
267
|
+
| `<where>: "x" is not a property of "T" (properties: ...)` | The same, in a name `tsc` could not check, or a build run without `tsc`. One line per place. | Use one of the listed names. |
|
|
268
|
+
| `tsc`: `Type '{ ...; arguments: readonly DomainTypeTransformArgumentDef<"x">[]; ... }' is not assignable to type 'OverlayActionPropertyTransformDef<...>'`, on the `{` of an `actionPropertyTransforms` entry | A wrong property name in a `{ kind: "domainProperty", propertyName: "x" }` argument of that entry's `dep.transformCall(...)`: `tsc` cannot point inside the call. | Fix `"x"` in that entry's arguments; write them as `prop("x")` in `actionPropertyTransforms: prop => [...]`, which reports the name itself. |
|
|
269
|
+
| `tsc`: `Type '(prop: ...) => ...' is not assignable to type ...` on `actionPropertyTransforms` | A wrong value in an entry of `actionPropertyTransforms: prop => [...]` other than a `prop("x")` name, such as `targetProperty` or `mode`. The last line of the message names it. | Fix that value. |
|
|
270
|
+
| `tsc`: `Argument of type '"x"' is not assignable to parameter of type 'never'` on `UiSource.prop("x")` | A UI helper written in a variable, a helper function or a `...` spread instead of directly in `defineUiComponent`'s `items`, where no type gives the names. | Write it directly in `items`, or annotate the helper's return type or the variable with the component's names: `UiItemSpec<PropertyNameOf<typeof T>>`, `UiConditionSpec<...>`, `UiValueSourceSpec<...>`. A helper generic in the name passes it as the type argument: `UiItem.label<N>(className, UiSource.prop(name))`. |
|
|
271
|
+
| `{"kind":"uiComponentUnknownDelegatedAction",...}` | `UiItem.buttonAction` names a method the target lacks. | Register the delegated action on that type. |
|
|
206
272
|
| `{"kind":"duplicateUiComponentClassName",...}` | Two items of the same type share a class name. | Make class names unique per type. |
|
|
207
273
|
| `{"kind":"uiComponentTemplateLabelKeyMismatch",...}` | `{key}` placeholders and `sources` keys differ. | Make them match one to one. |
|
|
208
274
|
| `{"kind":"singleEntryInstanceIdMismatch",...,"expectedId":"..."}` | Wrong row id on a single-entry type. | Use `expectedId`. |
|
|
275
|
+
| `{"kind":"uiComponentForeignRowSingleEntryIdMismatch",...,"expectedId":"..."}` | A `UiSource.rowProp` names another row of a single-entry type than its one row, which is the only row its Handler holds. | Use `expectedId` (`types.<Type>.singleEntryRowId` of the surface). |
|
|
209
276
|
| `{"kind":"invalidCompositeKey","reason":"unsupportedMemberBindingHint",...}` | A key member without `masterData` / `assetDelivery`. | Add the hint. |
|
|
210
277
|
| `{"kind":"invalidSortKey","reason":"notRequired",...}` | Sorting by an optional property. | Make it `.required()` or sort by `"id"`. |
|
|
211
278
|
| `{"kind":"invalidBindingValue",...}` | A binding kind the resource does not accept (for example `Bind.resourceKey()` on user data), a malformed directive, or an inline schema used twice. | Read `context`; use an accepted kind. |
|
|
@@ -214,11 +281,13 @@ Names and ids:
|
|
|
214
281
|
| `{"kind":"unresolvedParentBinding",...}` | `Source.parent(...)` on a root resource. | Use `Source.direct(...)`, or move the resource under a parent. |
|
|
215
282
|
| `CLI_DSL_LEDGER_MISSING` | First build without `--write-ledger`. | Add `--write-ledger`. |
|
|
216
283
|
| `CLI_DSL_LEDGER_MISMATCH` ... `random token ... is missing from the ledger`, and no token is "not current" | You added something. | Check the tokens, then rebuild with `--write-ledger`. |
|
|
284
|
+
| `CLI_DSL_LEDGER_MISMATCH` ... `looks like a rename: ... move its id "<id>" from "<old>" to "<new>"` | You renamed something, or changed a row id. | If you renamed it, move the id as the line says (a changed composite-key row id: first check it against the composite key rule) and rebuild without `--write-ledger`. Only if you removed it and added another: move the old token and its id to `retired`, then rebuild with `--write-ledger`. |
|
|
217
285
|
| `CLI_DSL_LEDGER_MISMATCH` ... `is not current; move it to retired` | You renamed or removed something, or changed a row id. | A changed composite-key row id: first check it against the composite key rule. Renamed: move the old token's id to the new token. Removed: move token and id to `retired`. Then rebuild without `--write-ledger`. |
|
|
218
286
|
| `CLI_DSL_LEDGER_INVALID` ... `not canonical` | The ledger's key order, entry order, indentation or final newline differs from what GS2 Studio writes. | Restore that form (section 4). |
|
|
219
287
|
| `CLI_DSL_VALIDATION_FAILED` ... `No master data resource binds this property.` | A `.masterData()` property no resource binds. | Bind it with `Bind.domainProperty(Source.direct(T, "prop"))` in a resource mounted on `T`, or remove the hint. |
|
|
220
288
|
| `CLI_DSL_VALIDATION_FAILED` ... `No user data resource binds this property.` | A `.userData()` property no resource binds. | Bind it in a user data resource (`Bind.domainProperty` / `Bind.domainProperties` with `Source.direct(T, "prop")`), or remove the hint. |
|
|
221
|
-
| `CLI_DSL_VALIDATION_FAILED` ... `is
|
|
289
|
+
| `CLI_DSL_VALIDATION_FAILED` ... `No Handler is generated for the target domain model` | A UI component on a type that gets no Handler (`generatedHandlers: []` in its surface). | Mount the type with a user data resource or a master data resource of a model other than a namespace, or remove the component. |
|
|
290
|
+
| `CLI_DSL_VALIDATION_FAILED` ... `the condition cannot read a value of another domain model's row` | A `UiSource.rowProp` of a type that gets no Handler. | Read a type whose `generatedHandlers` is not `[]`, or remove the item. |
|
|
222
291
|
| `CLI_DSL_VALIDATION_FAILED` ... `instance ids that no longer match their composite-key values` | Row ids not composed from key values in property-id order. | Recompose ids per [Keys and identity](REFERENCE.md#keys-and-identity). |
|
|
223
292
|
| `CLI_DSL_DEPENDENCY_NOT_INSTALLED` | `dependencies` names a package the project lacks. | A package authored in the project: build it with `dsl build` first. Another package: add it in GS2 Studio. |
|
|
224
293
|
| `CLI_DSL_PACKAGE_INVALID` ... `Invalid GitHub dependency spec: github:<owner>/<repo>/<dir>` | A subdirectory in a GitHub spec. | Use `github:<owner>/<repo>`; the project's lock records the directory. |
|
|
@@ -227,6 +296,7 @@ Names and ids:
|
|
|
227
296
|
| `... is a dependency the DSL cannot change, so these are fixed through the dependency that brings it in: ...` | A defect of the dependency itself, not of this DSL. | If the message says to remove the dependency `"X"` from the DSL and the package does not need X, remove it and what refers to it. Otherwise tell the user: the project's owner updates or removes the dependency in GS2 Studio, as the message says. |
|
|
228
297
|
| A successful build prints `[warning] ... No master data is registered for domain model "T"` | A dependency's GS2 resource needs rows of `T` from the project; it is not deployed without them. | Add the row the message names, `instance(dep.type("T"), id, values)`, with the values it names, and build again. `dep.type("<Type>")` means the message names no type `dep.type()` takes: for an inline schema, add elements to the host type's list property with `dep.inlineElements(...)`; for an unresolved type, find it in the surfaces. |
|
|
229
298
|
| A successful build prints `[error] ... the required arguments (...) of action transform ... have no value for row "r"` | An `actionPropertyTransforms` argument reads a property row `r` has no value for. | Give the row the value; for a row a dependency ships, use `overlayInstance(type, "r", { overrides })`. |
|
|
299
|
+
| `CLI_DSL_VALIDATION_FAILED` ... `is not a UTC ISO 8601 timestamp` | A `PT.timestamp()` value in another form, such as with an offset (`+09:00`). The message says `In package "<your package>"` when the row is yours, even of a dependency's type. | Write it in UTC with `Z`, such as `"2026-11-30T15:00:00Z"`, in that `instance(...)` (see [Property types](REFERENCE.md#property-types)). |
|
|
230
300
|
| A UI item of a property you added shows nothing (or `0`) in the game | The property has no binding hint, so the client never gets its value. | Give it `.assetDelivery()`. |
|
|
231
301
|
|
|
232
302
|
## 7. Minimal complete example
|
|
@@ -393,3 +463,23 @@ Its `id-ledger.json` after the first `dsl build --write-ledger`:
|
|
|
393
463
|
For dependencies, overlays, delegated actions and code templates, read the `example-gift-shop` sections of
|
|
394
464
|
[REFERENCE.md](REFERENCE.md#dependencies). For an overlay that appends a dependency's transform to an inherited action
|
|
395
465
|
property with `dep.transformCall`, read `example-gift-sale` in [Overlay types](REFERENCE.md#overlay-types).
|
|
466
|
+
|
|
467
|
+
## 8. The game's GS2 client credentials
|
|
468
|
+
|
|
469
|
+
The game signs in to GS2 with a client ID and a client secret. Take them from the project.
|
|
470
|
+
|
|
471
|
+
- They are the outputs `ApplicationClientId` and `ApplicationClientSecret` of the GS2-Deploy stack `Default`, which GS2
|
|
472
|
+
creates with every project (some projects name them `ClientID` and `ClientSecret`, which GS2 Studio also reads). The
|
|
473
|
+
client has ApplicationAccess permission and is made to be embedded in the game, so the two values are low-sensitivity.
|
|
474
|
+
- Never create a GS2-Identifier user or client for the game, and never put the developer's GS2 sign-in (email,
|
|
475
|
+
password, credentials file) or any other management credential into the game.
|
|
476
|
+
- In Unity, they go into a `Gs2Environment` asset (Create > Game Server Services > Core > Environment) with `region`,
|
|
477
|
+
`clientId`, `clientSecret` and `name`. `Gs2ClientHolder` lists the asset under Environments, and its Active
|
|
478
|
+
Environment Name must equal the asset's `name` field, not its file name.
|
|
479
|
+
- The GS2 Studio executable runs only `dsl` commands, so ask the user for the values: in GS2 Studio, they sign in to
|
|
480
|
+
GS2 and choose the destination on Publish, then press "Copy settings" under "Gs2Environment settings" on the Usage
|
|
481
|
+
tab of a table in Simple mode (Region, Client ID, Client Secret). Until GS2 Studio has read the values, it copies
|
|
482
|
+
`YOUR_CLIENT_ID` and `YOUR_CLIENT_SECRET`; never put those into the game.
|
|
483
|
+
- In a checkout of the GS2 Studio repository, its development CLI (`npx vite-node cli/gs2studio.ts`) reads them:
|
|
484
|
+
`deploy outputs --stack Default --project <project> --region <region>`. It signs in with the developer's account only
|
|
485
|
+
to read them; only the two output values go into the game.
|
package/README.md
CHANGED
|
@@ -9,11 +9,11 @@ type-check; use these declarations in your editor and with `tsc --noEmit`.
|
|
|
9
9
|
- For LLM coding agents: [LLM.md](LLM.md)
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install --save-dev gs2-studio-dsl@2026.11.
|
|
12
|
+
npm install --save-dev gs2-studio-dsl@2026.11.15
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
The version is the GS2 Studio version whose DSL these declarations describe: a DSL written
|
|
16
|
-
against gs2-studio-dsl 2026.11.
|
|
16
|
+
against gs2-studio-dsl 2026.11.15 builds with GS2 Studio 2026.11.15 and later. Install the version that
|
|
17
17
|
matches the oldest GS2 Studio you build with.
|
|
18
18
|
|
|
19
19
|
```ts
|
|
@@ -67,8 +67,9 @@ The GS2 Studio executable runs the `dsl` commands headless and exits with their
|
|
|
67
67
|
"<GS2 Studio>" dsl init --dir <project> --out <dsl> --package-id <id>
|
|
68
68
|
# write <out>/<packageId>.json for each package of the project (installed or authored in it)
|
|
69
69
|
"<GS2 Studio>" dsl surfaces --dir <project> --out <out>
|
|
70
|
-
# evaluate the DSL, check it, and save the package into the project
|
|
71
|
-
# after saving it prints the [error] and [warning] lines project check reports,
|
|
70
|
+
# evaluate the DSL, check it, and save the package it declares into the project beside the project's other packages
|
|
71
|
+
# (--write-ledger the first time); after saving it prints the [error] and [warning] lines project check reports, or a
|
|
72
|
+
# line saying there are none, and exits with 0
|
|
72
73
|
"<GS2 Studio>" dsl build --dir <project> --entry <dsl/index.ts> --write-ledger
|
|
73
74
|
```
|
|
74
75
|
|