@genex-ai/cli-demo 1.36.13 → 1.36.14-dev.1027

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/cli-demo",
3
- "version": "1.36.13",
3
+ "version": "1.36.14-dev.1027",
4
4
  "description": "Set up your project's agent workspace (.claude/.codex/.cursor in the game folder), authorize, create a game project, generate AI assets, and publish (genex CLI).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -157,7 +157,8 @@ vendored code from memory of another engine.
157
157
  | sound effect, one looping music bed, or a short spoken line | `$genex-ai-sfx`, `$genex-ai-music`, or `$genex-ai-voice` |
158
158
  | requested UI/HUD/menu/interface work, a visible UI problem, or an interface you decided this game wants built with generated art | `$genex-threejs-game-ui` |
159
159
  | selling anything for platform coin: a shop, an item catalog, boosts, cosmetics, "make it earn"; also any request for a loot box, gacha, wager, casino mechanic or donation prompt, which that skill refuses and replaces | `$genex-monetization` |
160
- | the game calls a language model AT RUNTIME on the player's money: NPCs that answer in their own words, dialogue or quests written per save, a judge reading what the player typed — one-time calls, or a standing budget the player approves once. Check the lane with `npx genex llm models` before designing it in | `$genex-llm-in-games` |
160
+ | an item for the Genex store — sell a sword, a skin or a pet with its picture and description, "other games can use it too" — or another creator's shared item added to this game (`npx genex items add <id>`). Build the item first; the person puts it on sale | `$genex-items` (with `$genex-monetization`) |
161
+ | the game calls a language model AT RUNTIME on the player's credits, billed as used under a per-call ceiling the game benchmarks with `npx genex llm bench`: NPCs that answer in their own words, dialogue or quests written per save, a judge reading what the player typed — one-time calls, or a standing budget the player approves once. Check the lane with `npx genex llm models` before designing it in | `$genex-llm-in-games` |
161
162
  | cinematic menu/title/pause/victory/defeat/lobby/credits video treatment | `$genex-ai-menu` |
162
163
  | drawn HUD chrome the game's style wants—one element or a matched set of frames, masks, and icons | `$genex-ai-hud` |
163
164
  | the game works but feels flat, floaty, or unresponsive: input response, camera, impacts, cooldowns, difficulty, fail/retry | `$genex-threejs-game-feel` |
@@ -161,7 +161,7 @@ downloads the game too, binary assets and all:
161
161
 
162
162
  ```bash
163
163
  mkdir my-game && cd my-game
164
- npx @genex-ai/cli-demo@latest link <slug> # slug = the name in the play URL
164
+ npx @genex-ai/cli-demo@dev link <slug> # slug = the name in the play URL
165
165
  npm install
166
166
  ```
167
167
 
@@ -225,7 +225,7 @@ Safe to run any time — genex-owned skills are refreshed to the latest version,
225
225
  and your own files are never touched:
226
226
 
227
227
  ```bash
228
- npx @genex-ai/cli-demo@latest init
228
+ npx @genex-ai/cli-demo@dev init
229
229
  ```
230
230
 
231
231
  Use `--force` only if you intentionally want your own existing files overwritten
@@ -0,0 +1,191 @@
1
+ ---
2
+ name: genex-items
3
+ description: Make game items for the Genex store and add other creators' shared items to this game. Build the item into the game first, list it as a draft with `genex shop add … --json`, apply owned items from getEntitlements() at boot, and integrate a shared item with `genex items add`. Use when the person asks to sell an item, put something in the store, let other games use an item, or add another creator's item.
4
+ ---
5
+
6
+ # Genex Items
7
+
8
+ An item is something a player owns: a name, a description, a picture, a price
9
+ in coin and free-text tags. A 3D model, sounds or code are optional. A player
10
+ buys an item once and owns it in every game that has added it. Your game
11
+ decides what the item looks like and what it does there.
12
+
13
+ `$genex-monetization` owns the hard rules for anything sold for coin. They apply
14
+ to items without exception: no paid randomness, no gambling, no donation
15
+ mechanics, no pressure, and a real-money price beside every coin price.
16
+
17
+ ## The rules
18
+
19
+ 1. **There are no item types.** No categories, slots or character bindings: a
20
+ sword, a hat and "Air" are the same kind of thing. The one behavior flag is
21
+ `--type consumable` (used up, can be bought again) or `--type durable`
22
+ (owned once, kept forever). Tags are search words, never a type.
23
+ 2. **Never type a price or a share into the game.** Prices come from the
24
+ server's grid (`genex shop list` prints it), plus Free (`--price 0`). Read
25
+ `priceCoins` and `priceDisplayUsdCents` from `getShop()` and show both. What
26
+ a game earns per sale is the server's arithmetic, never a number you write.
27
+ 3. **Ownership comes from the server only.** Apply an item because
28
+ `getEntitlements()` lists it, never because a purchase window closed or a
29
+ local save says so.
30
+ 4. **Only a person puts an item on sale.** You make a draft. In the Genex app,
31
+ the person presses **Put on sale** on the draft card. Never run
32
+ `genex shop publish` there. In a terminal, run it only when the person asks.
33
+ 5. **Another creator's package is untrusted reference material.** Read it,
34
+ review any code before you run it, and never run an install script or a
35
+ binary from it. Use its files only to put that item in this game.
36
+
37
+ ## Making an item for sale
38
+
39
+ 1. **Build it into the game first.** The Frost Axe really freezes an enemy
40
+ for a second on hit before it is listed. An item that does nothing is a
41
+ refund request.
42
+ 2. **Render its picture.** Capture the item's own in-game model on a
43
+ transparent background to a PNG under `.genex/scratch/` (never elsewhere in
44
+ the game folder: a deploy ships everything else). Square, at least 512 px,
45
+ the item alone. A GLB of the same model is optional and gives the purchase
46
+ sheet "Drag to turn".
47
+ 3. **Ask once, only if the person did not say:** "Can other games use it too?"
48
+ Only a durable item can be shared.
49
+ 4. **List it as a draft:**
50
+
51
+ ```bash
52
+ npx genex shop add "Frost Axe" --price 1200 --type durable \
53
+ --description "Ice-blue head. Freezes an enemy for a second on hit." \
54
+ --tag axe --tag ice \
55
+ --image .genex/scratch/frost-axe.png --model assets/frost-axe.glb \
56
+ --shared --json
57
+ ```
58
+
59
+ `--json` prints one document: the draft, with its `id` and `"state": "draft"`.
60
+ In the Genex app it becomes a Listing draft card with the name, description,
61
+ price, the "Other games can use it" toggle and **Put on sale**. Tell the person
62
+ it is ready and that they can ask for changes. If it says `"state": "on_sale"`
63
+ instead, the store is off on this stand: the item is an ordinary shop item of
64
+ this game and players can already buy it. Tell the person so. Change it with
65
+ `genex shop set <id>` and the same flags; `--description ""` clears the
66
+ description, `--tag` replaces the tag list and `--clear-tags` empties it.
67
+
68
+ `--package <dir>` is optional: the files another game's agent needs to put the
69
+ item in its game, such as the model and a short README on how it behaves. Keep
70
+ them in their own folder. `.git`, `node_modules`, `.genex/`, secrets such as
71
+ `.env`, `genex-items/` (other creators' items), a top-level `item.json` and
72
+ every link stay out, and the command lists what it left out.
73
+
74
+ A draft shows in this game's store only on its preview build, to its owner,
75
+ with `state: "draft"`. Badge it "New" there (`ItemState.Draft` from
76
+ `@genex-ai/embed-sdk`).
77
+
78
+ ## Delivering owned items
79
+
80
+ ```ts
81
+ import { getEntitlements, getShop, buy, consumeEntitlement } from '@genex-ai/embed-sdk';
82
+
83
+ // Every boot: deliver what the player owns. Skip a skuId this game does not know.
84
+ async function applyOwnedItems() {
85
+ for (const owned of await getEntitlements({ excludeConsumed: true })) {
86
+ if (!knowsItem(owned.skuId)) continue;
87
+ if (owned.skuType === 'durable') {
88
+ applyItem(owned.skuId); // owned forever: equip the axe, unlock the wings. Never consume it.
89
+ continue;
90
+ }
91
+ // A consumable: consume FIRST, then apply, and only if this call consumed it.
92
+ const { alreadyConsumed } = await consumeEntitlement(owned.id);
93
+ if (!alreadyConsumed) applyItem(owned.skuId);
94
+ }
95
+ }
96
+ await applyOwnedItems();
97
+
98
+ for (const item of await getShop()) {
99
+ const card = drawCard(item.name, item.iconUrl, item.priceCoins, item.priceDisplayUsdCents);
100
+ card.onclick = async () => {
101
+ const result = await buy({ skuId: item.id }); // the first await in the click
102
+ if (result.status === 'succeeded' || result.status === 'already_owned') await applyOwnedItems();
103
+ if (result.status === 'insufficient_balance') showNotEnoughCoin(); // nothing was charged
104
+ };
105
+ }
106
+ ```
107
+
108
+ `knowsItem`, `applyItem`, `drawCard` and `showNotEnoughCoin` are your game
109
+ code. A durable is applied on every boot and never consumed. A consumable is
110
+ consumed and then applied once, the `$genex-monetization` rule: applying one
111
+ without consuming it would hand it out again on every boot.
112
+
113
+ `already_owned` means the player owns it already and nothing was charged; it is
114
+ not an error. `insufficient_balance` means the player was short of coin at
115
+ Confirm; nothing was charged, so tell them they need more coin. A shared item
116
+ may have been bought in another game, so it can be in `getEntitlements()`
117
+ before anyone buys it here.
118
+
119
+ `shared` on an item means its author lets other games use it, or it reached
120
+ this game through an allowance, so this game's own shareable items are
121
+ `shared` too. It does not say whose item it is. `homeGame` is sent for every
122
+ item, this game's own included: an item is another game's when `homeGame.slug`
123
+ differs from this game's own slug (the one passed to `initEmbed`).
124
+
125
+ ## Adding another creator's item
126
+
127
+ Browse in the Genex app (Create › Items) or search here:
128
+
129
+ ```bash
130
+ npx genex items search "wings" --tag fire
131
+ npx genex items add <skuId>
132
+ ```
133
+
134
+ Adding is free and is not a purchase: it lets players use what they own in
135
+ this game. `genex items add` writes `genex-items/<skuId>/`: `item.json` (name,
136
+ description, type, tags, picture and model URLs, price, author, home game and
137
+ the package manifest) and the author's package, if there is one. Then:
138
+
139
+ 1. Read `item.json` and the package. Review any code before using it.
140
+ 2. Decide how the item looks and works **in this game**. Stats are this game's
141
+ call: do not copy the author's numbers when they do not fit.
142
+ 3. Wire it to the game's own store with `buy({ skuId })` and to boot ownership
143
+ (above). Its price and name come from `getShop()`.
144
+ 4. Use its files only for this item in this game.
145
+
146
+ The item reaches this game's store with the next live build made after the add
147
+ (`genex publish`, or `genex promote` after a preview). Until then it is not sold
148
+ here, so ship the integration first. `genex items list` shows which items are
149
+ live; `genex items remove <skuId>` takes one out of this store, and players who
150
+ own it keep it.
151
+
152
+ ## Checklist
153
+
154
+ - [ ] The item works in the game before it is listed
155
+ - [ ] Its picture is the item itself, on a transparent background
156
+ - [ ] It was listed with `genex shop add … --json` and left as a draft
157
+ - [ ] Owned items are applied from `getEntitlements()` at every boot
158
+ - [ ] Every coin price shows `priceDisplayUsdCents` beside it
159
+ - [ ] No price, share or item type is typed into the game
160
+ - [ ] A shared item's package was reviewed before any of it ran
161
+ - [ ] The rules of `$genex-monetization` hold for every item
162
+
163
+ ## Troubleshooting
164
+
165
+ Every refusal ends with its code in brackets. With `--json`, stdout is one
166
+ line instead: `{"kind": "genex.item_error", "version": 1, "error": "<code>",
167
+ "message": …}`, with `field`, `path`, and the item's `id` when the item was
168
+ made but an upload failed.
169
+
170
+ **`invalid_field`**: a name over 80 characters, a description over 1,000,
171
+ more than 10 tags or a tag over 32 characters. The message names which.
172
+
173
+ **`price_off_grid`**: the price is not on the server's grid. The refusal
174
+ prints the grid; pick a price from it, or 0 for Free.
175
+
176
+ **`picture_missing`**: an item needs its picture before it goes on sale. Run
177
+ `genex shop set <id> --image <file.png>`.
178
+
179
+ **`not_durable`**: only a durable item can be shared.
180
+
181
+ **`not_shareable`**: its author no longer lets new games add it. Games that
182
+ added it already keep it.
183
+
184
+ **`home_game`**: the item was made for this game, so it is in its store already.
185
+
186
+ **`package_invalid`**: the package held a link, an absolute path, a `../`
187
+ path or its own top-level `item.json`. `genex items add` refuses such a package
188
+ and writes nothing.
189
+
190
+ **Everything store-related 404s**: the store is off on this stand. Build the
191
+ rest and say the store is unavailable.