@genex-ai/cli-demo 1.10.0 → 1.10.2-dev.528
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/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import fs from "fs";
|
|
|
8
8
|
import os from "os";
|
|
9
9
|
import path from "path";
|
|
10
10
|
import { fileURLToPath } from "url";
|
|
11
|
-
var RAW_CHANNEL = "
|
|
11
|
+
var RAW_CHANNEL = "dev";
|
|
12
12
|
var CLI_CHANNEL = RAW_CHANNEL === "dev" ? "dev" : "latest";
|
|
13
13
|
var STANDS = {
|
|
14
14
|
prod: { api: "https://api.genex.games", dashboard: "https://genex.games" },
|
|
@@ -5306,6 +5306,7 @@ async function pushSource(cwd, ctx, log, branch = "main", expectStagingCommit, o
|
|
|
5306
5306
|
if (!fresh) return false;
|
|
5307
5307
|
return pushWorktree(cwd, fresh.pushUrl, fresh.managed, log, ref, onCommit);
|
|
5308
5308
|
}
|
|
5309
|
+
var WORKSPACE_SOURCE_REF = "workspace";
|
|
5309
5310
|
async function pushWorktree(cwd, pushUrl, managed, log, branch = "main", onCommit) {
|
|
5310
5311
|
const EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
5311
5312
|
const failed = () => {
|
|
@@ -6658,6 +6659,61 @@ async function runAcceptCommand(opts) {
|
|
|
6658
6659
|
if (!ok) process.exitCode = 1;
|
|
6659
6660
|
}
|
|
6660
6661
|
|
|
6662
|
+
// src/commands/save.ts
|
|
6663
|
+
async function runSave(opts) {
|
|
6664
|
+
const log = createLogger({ quiet: opts.quiet });
|
|
6665
|
+
const meta = await readProject();
|
|
6666
|
+
if (!meta?.id) {
|
|
6667
|
+
log.error("This folder isn't linked to a game.");
|
|
6668
|
+
process.exitCode = 1;
|
|
6669
|
+
return;
|
|
6670
|
+
}
|
|
6671
|
+
const token = await readUserToken(opts.envPath);
|
|
6672
|
+
if (!token) {
|
|
6673
|
+
log.error("Not signed in.");
|
|
6674
|
+
process.exitCode = 1;
|
|
6675
|
+
return;
|
|
6676
|
+
}
|
|
6677
|
+
const apiUrl = meta.apiUrl ?? getApiUrl();
|
|
6678
|
+
let res;
|
|
6679
|
+
try {
|
|
6680
|
+
res = await apiFetch(`${apiUrl}/api/projects/${meta.id}/push-token`, {
|
|
6681
|
+
method: "POST",
|
|
6682
|
+
headers: {
|
|
6683
|
+
Authorization: `Bearer ${token}`,
|
|
6684
|
+
// Says which ref the bytes are headed for, which is what makes this
|
|
6685
|
+
// exempt from the staging-pointer precondition: that guard exists so a
|
|
6686
|
+
// hosted session cannot replace a build pushed from someone's other
|
|
6687
|
+
// machine, and nothing but this session ever writes `workspace`.
|
|
6688
|
+
// Advisory like the `read` intent beside it — the minted token is
|
|
6689
|
+
// read+write either way — so it steers the honest path rather than
|
|
6690
|
+
// enforcing one.
|
|
6691
|
+
"X-Genex-Source-Intent": "workspace"
|
|
6692
|
+
}
|
|
6693
|
+
});
|
|
6694
|
+
} catch (err) {
|
|
6695
|
+
log.error(`Couldn't reach the API to authorize the save: ${String(err)}`);
|
|
6696
|
+
process.exitCode = 1;
|
|
6697
|
+
return;
|
|
6698
|
+
}
|
|
6699
|
+
if (!res.ok) {
|
|
6700
|
+
log.error(`Couldn't authorize the save (HTTP ${res.status}).`);
|
|
6701
|
+
process.exitCode = 1;
|
|
6702
|
+
return;
|
|
6703
|
+
}
|
|
6704
|
+
const data = await res.json().catch(() => null);
|
|
6705
|
+
if (!data?.pushUrl) {
|
|
6706
|
+
log.error("The API didn't return a push URL.");
|
|
6707
|
+
process.exitCode = 1;
|
|
6708
|
+
return;
|
|
6709
|
+
}
|
|
6710
|
+
if (!await pushWorktree(process.cwd(), data.pushUrl, true, log, WORKSPACE_SOURCE_REF)) {
|
|
6711
|
+
process.exitCode = 1;
|
|
6712
|
+
return;
|
|
6713
|
+
}
|
|
6714
|
+
log.success("Workspace saved.");
|
|
6715
|
+
}
|
|
6716
|
+
|
|
6661
6717
|
// src/lib/rollback.ts
|
|
6662
6718
|
async function readPreviousVersion(apiUrl, projectId, token, log) {
|
|
6663
6719
|
let res;
|
|
@@ -22608,6 +22664,11 @@ async function main() {
|
|
|
22608
22664
|
case "accept":
|
|
22609
22665
|
await runAcceptCommand(parsed.options);
|
|
22610
22666
|
break;
|
|
22667
|
+
// Hidden from --help on purpose: plumbing the hosted runner calls on its
|
|
22668
|
+
// way out, not a verb a person needs.
|
|
22669
|
+
case "save":
|
|
22670
|
+
await runSave(parsed.options);
|
|
22671
|
+
break;
|
|
22611
22672
|
case "rollback":
|
|
22612
22673
|
await runRollback(parsed.options);
|
|
22613
22674
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genex-ai/cli-demo",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2-dev.528",
|
|
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": {
|
|
@@ -225,7 +225,7 @@ first one is the one a screenshot of the whole arena will not show you.
|
|
|
225
225
|
|
|
226
226
|
## Troubleshooting
|
|
227
227
|
|
|
228
|
-
- **"Not authorized"** — run `npx @genex-ai/cli-demo@
|
|
228
|
+
- **"Not authorized"** — run `npx @genex-ai/cli-demo@dev init` first (it writes your `GENEX_TOKEN`).
|
|
229
229
|
- **"Out of credits" (`insufficient_credits`)** — the account has no credits left for
|
|
230
230
|
this texture generation. Tell the user the facts the CLI printed: their balance,
|
|
231
231
|
this generation's cost, and when their credits refill. Then offer to continue the
|
|
@@ -151,7 +151,7 @@ set belongs to `$genex-ai-hud` — both build on `npx genex image`/`video`.
|
|
|
151
151
|
|
|
152
152
|
## Troubleshooting
|
|
153
153
|
|
|
154
|
-
- **"Not authorized"** — run `npx @genex-ai/cli-demo@
|
|
154
|
+
- **"Not authorized"** — run `npx @genex-ai/cli-demo@dev init` first (it writes your `GENEX_TOKEN`).
|
|
155
155
|
- **"Prompt rejected"** — the provider's content-safety filter blocked the prompt.
|
|
156
156
|
This is non-retryable; retrying the same wording fails again. Rewrite the prompt.
|
|
157
157
|
- **Nothing plays / black surface** — the first `video.play()` must run inside a user
|
|
@@ -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@
|
|
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@
|
|
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
|
|
@@ -38,7 +38,7 @@ update, so update immediately.)
|
|
|
38
38
|
Run exactly the command the nudge printed, from the game project root:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
npm i -D @genex-ai/cli-demo@
|
|
41
|
+
npm i -D @genex-ai/cli-demo@dev # the genex CLI (a dev dependency)
|
|
42
42
|
npm i @genex-ai/embed-sdk@latest # identity/saves SDK (ships inside the game)
|
|
43
43
|
npm i @genex-ai/multiplayer@latest # multiplayer SDK (only if the game uses it)
|
|
44
44
|
```
|