@genex-ai/cli-demo 0.27.0 → 0.28.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.
package/dist/index.js
CHANGED
|
@@ -621,6 +621,9 @@ async function createDraftProject(opts) {
|
|
|
621
621
|
return null;
|
|
622
622
|
}
|
|
623
623
|
log.success(`Created project ${c.cyan(project.slug)}.`);
|
|
624
|
+
log.plain(
|
|
625
|
+
` your game's page (live now \u2014 share this link): ${c.cyan(`${new URL(dashboardUrl).origin}/draft/${project.slug}`)}`
|
|
626
|
+
);
|
|
624
627
|
if (project.playUrl) log.dim(` play (after preview/publish): ${project.playUrl}`);
|
|
625
628
|
log.dim(` dashboard: ${dashboardUrl}/dashboard`);
|
|
626
629
|
return {
|
|
@@ -901,21 +904,22 @@ async function runInit(opts) {
|
|
|
901
904
|
return;
|
|
902
905
|
}
|
|
903
906
|
const authBaseUrl = getAuthUrl(opts.authUrl);
|
|
904
|
-
let token;
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
907
|
+
let token = await readUserToken(opts.envPath);
|
|
908
|
+
if (!token) {
|
|
909
|
+
try {
|
|
910
|
+
token = await authorize(authBaseUrl, {
|
|
911
|
+
log,
|
|
912
|
+
timeoutMs: opts.timeoutSec ? opts.timeoutSec * 1e3 : void 0
|
|
913
|
+
});
|
|
914
|
+
} catch (err) {
|
|
915
|
+
log.error(err instanceof Error ? err.message : String(err));
|
|
916
|
+
log.dim("Your workspace files were installed. Re-run `genex init` to finish authorizing.");
|
|
917
|
+
throw err;
|
|
918
|
+
}
|
|
919
|
+
const { path: tokenPath } = await writeUserToken(token, opts.envPath);
|
|
920
|
+
log.success(`Authorized. Saved your token to ${c.cyan(tokenPath)} (${ENV_TOKEN_KEY}).`);
|
|
921
|
+
log.plain("");
|
|
914
922
|
}
|
|
915
|
-
log.success("Authorized.");
|
|
916
|
-
const { path: tokenPath } = await writeUserToken(token, opts.envPath);
|
|
917
|
-
log.success(`Saved your token to ${c.cyan(tokenPath)} (${ENV_TOKEN_KEY}).`);
|
|
918
|
-
log.plain("");
|
|
919
923
|
await writeGitignore(process.cwd(), log);
|
|
920
924
|
const apiUrl = getApiUrl(opts.apiUrl);
|
|
921
925
|
const colyseusUrl = getColyseusUrl(opts.colyseusUrl);
|
|
@@ -1529,6 +1533,8 @@ async function runPublish(opts) {
|
|
|
1529
1533
|
}
|
|
1530
1534
|
log.plain("");
|
|
1531
1535
|
log.success("Published. \u{1F389}");
|
|
1536
|
+
const dashboard = meta.dashboardOrigins?.[0];
|
|
1537
|
+
if (dashboard) log.plain(` world page (share this link): ${c.cyan(`${dashboard}/world/${meta.slug}`)}`);
|
|
1532
1538
|
if (meta.playUrl) log.dim(` play: ${meta.playUrl}`);
|
|
1533
1539
|
}
|
|
1534
1540
|
|
|
@@ -1572,6 +1578,11 @@ async function runPreview(opts) {
|
|
|
1572
1578
|
}
|
|
1573
1579
|
log.plain("");
|
|
1574
1580
|
log.success("Preview deployed \u2014 unlisted draft (run `genex publish` to list it).");
|
|
1581
|
+
const dashboard = meta.dashboardOrigins?.[0];
|
|
1582
|
+
if (dashboard) {
|
|
1583
|
+
const page = meta.status === "published" ? "world" : "draft";
|
|
1584
|
+
log.plain(` your game's page (share this link): ${c.cyan(`${dashboard}/${page}/${meta.slug}`)}`);
|
|
1585
|
+
}
|
|
1575
1586
|
}
|
|
1576
1587
|
|
|
1577
1588
|
// src/lib/sse.ts
|
|
@@ -1774,7 +1785,7 @@ async function poll(apiUrl, token, id, onProgress) {
|
|
|
1774
1785
|
function printHint(kind, files, log) {
|
|
1775
1786
|
const url = files[0]?.url ?? "";
|
|
1776
1787
|
const hint = {
|
|
1777
|
-
model: `
|
|
1788
|
+
model: `Standard GLB \u2014 load with GLTFLoader straight from the URL \u2014 see the genex-ai-model skill. url = "${url}"`,
|
|
1778
1789
|
skybox: `Load as an equirectangular texture \u2192 scene.background + scene.environment \u2014 see genex-ai-skybox. url = "${url}"`,
|
|
1779
1790
|
sfx: `Load with AudioLoader into a THREE.PositionalAudio (camera needs an AudioListener) \u2014 see genex-ai-sfx. url = "${url}"`,
|
|
1780
1791
|
texture: `Load each map with TextureLoader (RepeatWrapping) into a MeshStandardMaterial \u2014 see genex-ai-texture. Use the URLs above by role.`
|
package/package.json
CHANGED
|
@@ -63,18 +63,13 @@ side — reads as broken at a glance.
|
|
|
63
63
|
|
|
64
64
|
## Load it into the scene
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
storage (same visuals, several times smaller — faster loads on every play).
|
|
68
|
-
Wire the decoder once — it's harmless for uncompressed files — then use
|
|
69
|
-
Three.js `GLTFLoader` with the URL the command printed (R2 sends the right
|
|
66
|
+
Use Three.js `GLTFLoader` with the URL the command printed (R2 sends the right
|
|
70
67
|
CORS headers, so cross-origin loading just works):
|
|
71
68
|
|
|
72
69
|
```ts
|
|
73
70
|
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
|
|
74
|
-
import { MeshoptDecoder } from "three/addons/libs/meshopt_decoder.module.js";
|
|
75
71
|
|
|
76
72
|
const loader = new GLTFLoader();
|
|
77
|
-
loader.setMeshoptDecoder(MeshoptDecoder); // required for genex model GLBs
|
|
78
73
|
// the URL `npx genex model` printed:
|
|
79
74
|
const MODEL_URL = "https://assets.genex.technology/generations/<id>/model-glb";
|
|
80
75
|
const gltf = await loader.loadAsync(MODEL_URL);
|
|
@@ -84,6 +79,10 @@ model.position.set(0, 0, 0);
|
|
|
84
79
|
scene.add(model);
|
|
85
80
|
```
|
|
86
81
|
|
|
82
|
+
Never swallow a failed load silently: if you wrap a generated-asset load in a
|
|
83
|
+
`catch`, `console.warn` the asset name in it — your own self-check reads the
|
|
84
|
+
console, and a bare `.catch(() => null)` hides a missing model from you too.
|
|
85
|
+
|
|
87
86
|
To place many copies, `model.clone()` per instance. For animated GLBs, drive
|
|
88
87
|
`gltf.animations` with a `THREE.AnimationMixer`.
|
|
89
88
|
|