@directivegames/genesys.sdk 3.2.2 → 3.2.5
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/README.md +60 -60
- package/dist/src/asset-pack/eslint.config.js +4 -4
- package/dist/src/core/cli.js +22 -22
- package/dist/src/core/common.js +2 -2
- package/dist/src/core/tools/build-project.js +1 -1
- package/dist/src/core/tools/new-asset-pack.js +1 -1
- package/dist/src/core/tools/new-project.js +1 -1
- package/dist/src/dependencies.js +1 -1
- package/dist/src/electron/backend/tools/const.js +1 -1
- package/dist/src/electron/backend/tools/open-project.js +1 -1
- package/dist/src/templates/eslint.config.js +4 -4
- package/dist/src/templates/scripts/genesys/calc-bounding-box.js +2 -2
- package/dist/src/templates/scripts/genesys/dev/dump-default-scene.js +1 -1
- package/dist/src/templates/scripts/genesys/dev/generate-manifest.js +1 -1
- package/dist/src/templates/scripts/genesys/dev/launcher.js +1 -1
- package/dist/src/templates/scripts/genesys/dev/storage-provider.js +4 -4
- package/dist/src/templates/scripts/genesys/genesys-mcp.js +26 -26
- package/dist/src/templates/scripts/genesys/mcp/doc-tools.js +2 -2
- package/dist/src/templates/scripts/genesys/mcp/editor-functions.js +5 -5
- package/dist/src/templates/scripts/genesys/mcp/search-actors.js +1 -1
- package/dist/src/templates/scripts/genesys/mcp/search-assets.js +1 -1
- package/dist/src/templates/scripts/genesys/mcp/utils.js +1 -1
- package/dist/src/templates/scripts/genesys/misc.js +1 -1
- package/dist/src/templates/scripts/genesys/mock.js +1 -1
- package/dist/src/templates/scripts/genesys/place-actors.js +1 -1
- package/dist/src/templates/scripts/genesys/post-install.js +1 -1
- package/dist/src/templates/scripts/genesys/storageProvider.js +2 -2
- package/dist/src/templates/src/index.js +1 -1
- package/dist/src/templates/src/templates/firstPerson/src/game.js +1 -1
- package/dist/src/templates/src/templates/firstPerson/src/player.js +1 -1
- package/dist/src/templates/src/templates/fps/src/game.js +1 -1
- package/dist/src/templates/src/templates/fps/src/player.js +1 -1
- package/dist/src/templates/src/templates/fps/src/weapon.js +1 -1
- package/dist/src/templates/src/templates/freeCamera/src/game.js +1 -1
- package/dist/src/templates/src/templates/freeCamera/src/player.js +1 -1
- package/dist/src/templates/src/templates/sideScroller/src/game.js +1 -1
- package/dist/src/templates/src/templates/sideScroller/src/level-generator.js +1 -1
- package/dist/src/templates/src/templates/sideScroller/src/player.js +1 -1
- package/dist/src/templates/src/templates/thirdPerson/src/game.js +1 -1
- package/dist/src/templates/src/templates/thirdPerson/src/player.js +1 -1
- package/dist/src/templates/src/templates/vehicle/src/base-vehicle.js +1 -1
- package/dist/src/templates/src/templates/vehicle/src/game.js +1 -1
- package/dist/src/templates/src/templates/vehicle/src/mesh-vehicle.js +1 -1
- package/dist/src/templates/src/templates/vehicle/src/player.js +1 -1
- package/dist/src/templates/src/templates/vehicle/src/primitive-vehicle.js +1 -1
- package/dist/src/templates/src/templates/vehicle/src/ui-hints.js +31 -31
- package/dist/src/templates/src/templates/vr-game/src/game.js +1 -1
- package/dist/src/templates/src/templates/vr-game/src/sample-vr-actor.js +1 -1
- package/package.json +176 -176
- package/scripts/post-install.ts +143 -143
- package/src/asset-pack/.gitattributes +88 -88
- package/src/asset-pack/eslint.config.js +45 -45
- package/src/asset-pack/gitignore +11 -11
- package/src/asset-pack/scripts/postinstall.ts +81 -81
- package/src/asset-pack/tsconfig.json +33 -33
- package/src/templates/.cursor/mcp.json +20 -20
- package/src/templates/.cursorignore +2 -2
- package/src/templates/.gitattributes +88 -88
- package/src/templates/.vscode/settings.json +6 -6
- package/src/templates/AGENTS.md +86 -86
- package/src/templates/README.md +24 -24
- package/src/templates/eslint.config.js +45 -45
- package/src/templates/gitignore +11 -11
- package/src/templates/index.html +34 -34
- package/src/templates/pnpm-lock.yaml +3676 -3676
- package/src/templates/scripts/genesys/build-project.ts +51 -51
- package/src/templates/scripts/genesys/calc-bounding-box.ts +272 -272
- package/src/templates/scripts/genesys/common.ts +46 -46
- package/src/templates/scripts/genesys/const.ts +9 -9
- package/src/templates/scripts/genesys/dev/dump-default-scene.ts +11 -11
- package/src/templates/scripts/genesys/dev/generate-manifest.ts +146 -146
- package/src/templates/scripts/genesys/dev/launcher.ts +46 -46
- package/src/templates/scripts/genesys/dev/storage-provider.ts +229 -229
- package/src/templates/scripts/genesys/dev/update-template-scenes.ts +84 -84
- package/src/templates/scripts/genesys/doc-server.ts +16 -16
- package/src/templates/scripts/genesys/genesys-mcp.ts +526 -526
- package/src/templates/scripts/genesys/mcp/doc-tools.ts +86 -86
- package/src/templates/scripts/genesys/mcp/editor-functions.ts +151 -151
- package/src/templates/scripts/genesys/mcp/editor-tools.ts +73 -73
- package/src/templates/scripts/genesys/mcp/get-scene-state.ts +35 -35
- package/src/templates/scripts/genesys/mcp/run-subprocess.ts +30 -30
- package/src/templates/scripts/genesys/mcp/search-actors.ts +858 -858
- package/src/templates/scripts/genesys/mcp/search-assets.ts +380 -380
- package/src/templates/scripts/genesys/mcp/utils.ts +281 -281
- package/src/templates/scripts/genesys/misc.ts +42 -42
- package/src/templates/scripts/genesys/mock.ts +6 -6
- package/src/templates/scripts/genesys/place-actors.ts +179 -179
- package/src/templates/scripts/genesys/post-install.ts +30 -30
- package/src/templates/scripts/genesys/prefab.schema.json +84 -84
- package/src/templates/scripts/genesys/remove-engine-comments.ts +134 -134
- package/src/templates/scripts/genesys/run-mcp-inspector.bat +4 -4
- package/src/templates/scripts/genesys/storageProvider.ts +182 -182
- package/src/templates/scripts/genesys/validate-prefabs.ts +138 -138
- package/src/templates/src/index.ts +22 -22
- package/src/templates/src/templates/firstPerson/assets/default.genesys-scene +165 -165
- package/src/templates/src/templates/firstPerson/src/game.ts +39 -39
- package/src/templates/src/templates/firstPerson/src/player.ts +63 -63
- package/src/templates/src/templates/fps/assets/default.genesys-scene +9459 -9459
- package/src/templates/src/templates/fps/src/game.ts +39 -39
- package/src/templates/src/templates/fps/src/player.ts +69 -69
- package/src/templates/src/templates/fps/src/weapon.ts +54 -54
- package/src/templates/src/templates/freeCamera/assets/default.genesys-scene +165 -165
- package/src/templates/src/templates/freeCamera/src/game.ts +39 -39
- package/src/templates/src/templates/freeCamera/src/player.ts +45 -45
- package/src/templates/src/templates/sideScroller/assets/default.genesys-scene +121 -121
- package/src/templates/src/templates/sideScroller/src/const.ts +45 -45
- package/src/templates/src/templates/sideScroller/src/game.ts +122 -122
- package/src/templates/src/templates/sideScroller/src/level-generator.ts +361 -361
- package/src/templates/src/templates/sideScroller/src/player.ts +125 -125
- package/src/templates/src/templates/thirdPerson/assets/default.genesys-scene +165 -165
- package/src/templates/src/templates/thirdPerson/src/game.ts +39 -39
- package/src/templates/src/templates/thirdPerson/src/player.ts +61 -61
- package/src/templates/src/templates/vehicle/assets/default.genesys-scene +225 -225
- package/src/templates/src/templates/vehicle/src/base-vehicle.ts +145 -145
- package/src/templates/src/templates/vehicle/src/game.ts +43 -43
- package/src/templates/src/templates/vehicle/src/mesh-vehicle.ts +191 -191
- package/src/templates/src/templates/vehicle/src/player.ts +109 -109
- package/src/templates/src/templates/vehicle/src/primitive-vehicle.ts +266 -266
- package/src/templates/src/templates/vehicle/src/ui-hints.ts +101 -101
- package/src/templates/src/templates/vr-game/assets/default.genesys-scene +246 -246
- package/src/templates/src/templates/vr-game/src/auto-imports.ts +1 -1
- package/src/templates/src/templates/vr-game/src/game.ts +66 -66
- package/src/templates/src/templates/vr-game/src/sample-vr-actor.ts +26 -26
- package/src/templates/tsconfig.json +34 -34
- package/src/templates/vite.config.ts +52 -52
package/README.md
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
[](https://github.com/directivegames/genesys.sdk/actions/workflows/ci.yml)
|
|
2
|
-
[](https://github.com/directivegames/genesys.sdk/actions/workflows/publish.yml)
|
|
3
|
-
|
|
4
|
-

|
|
5
|
-
|
|
6
|
-
# User Workflow
|
|
7
|
-
- Download and install the latest version from the [Release](https://github.com/directivegames/genesys.sdk/releases) page.
|
|
8
|
-
- Create an empty folder on your disk to store the project.
|
|
9
|
-
- Open the empty folder created earlier in this app, select a template and create a project, then start the file server.
|
|
10
|
-
- Launch the web editor and cursor to develop.
|
|
11
|
-
|
|
12
|
-
# Developer
|
|
13
|
-
|
|
14
|
-
## Run Locally
|
|
15
|
-
- `pnpm install`
|
|
16
|
-
- `pnpm dev`: to run the dev version, connects to localhost:3000 if available
|
|
17
|
-
- run `pnpm dev` on [genesys.ai](https://github.com/directivegames/genesys.ai) to start localhost:3000
|
|
18
|
-
- if localhost:3000 is started after the sdk, refresh the sdk with Ctrl+R/Ctrl+Shift+R
|
|
19
|
-
- `pnpm dev:watch`: same as `pnpm dev` but with auto-restart on file changes using nodemon
|
|
20
|
-
- `pnpm dev:hosted`: connects to the hosted genesys.ai site.
|
|
21
|
-
- `pnpm dist`: to build the app locally. Installer will be generated in the `dist` folder that you can use to install the app directly on your machine.
|
|
22
|
-
|
|
23
|
-
## CLI Tools
|
|
24
|
-
The SDK includes command-line tools for creating and building projects without launching the GUI.
|
|
25
|
-
|
|
26
|
-
### Available Commands
|
|
27
|
-
```bash
|
|
28
|
-
# Show help and available commands
|
|
29
|
-
genesys-sdk --help
|
|
30
|
-
|
|
31
|
-
# Show version
|
|
32
|
-
genesys-sdk --version
|
|
33
|
-
|
|
34
|
-
# Create a new project
|
|
35
|
-
genesys-sdk new -n <project-name> -t <template-id> [-p <parent-path>]
|
|
36
|
-
|
|
37
|
-
# Build an existing project (with TypeScript type checking)
|
|
38
|
-
genesys-sdk build [-p <project-path>]
|
|
39
|
-
|
|
40
|
-
# Build without type checking (faster)
|
|
41
|
-
genesys-sdk build [-p <project-path>] --no-tsc
|
|
42
|
-
|
|
43
|
-
# List available project templates
|
|
44
|
-
genesys-sdk list-templates
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## New Project Template
|
|
48
|
-
- The logic to setup a new project is in [new-project.ts](src/backend/tools//new-project.ts), it contains a few steps:
|
|
49
|
-
- Generate `game.ts` and `default.genesys-scene` based on the selected template.
|
|
50
|
-
- Generate `package.json` and `{project}.code-workspace` from code.
|
|
51
|
-
- Copy the files from `assets/new-project` to the project folder.
|
|
52
|
-
- Run `pnpm install` and `pnpm build` in the project folder.
|
|
53
|
-
|
|
54
|
-
## Add Electron API
|
|
55
|
-
Electron API is for exposing code that relies on the nodejs environment to the frontend environment.
|
|
56
|
-
|
|
57
|
-
To add a new one, following this:
|
|
58
|
-
- Define the API in [api.ts](src/api.ts)
|
|
59
|
-
- Add the API wrapper in [preload.ts](src/preload.ts)
|
|
60
|
-
- Implement the API in [handler.ts](src/backend/handler.ts)
|
|
1
|
+
[](https://github.com/directivegames/genesys.sdk/actions/workflows/ci.yml)
|
|
2
|
+
[](https://github.com/directivegames/genesys.sdk/actions/workflows/publish.yml)
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
# User Workflow
|
|
7
|
+
- Download and install the latest version from the [Release](https://github.com/directivegames/genesys.sdk/releases) page.
|
|
8
|
+
- Create an empty folder on your disk to store the project.
|
|
9
|
+
- Open the empty folder created earlier in this app, select a template and create a project, then start the file server.
|
|
10
|
+
- Launch the web editor and cursor to develop.
|
|
11
|
+
|
|
12
|
+
# Developer
|
|
13
|
+
|
|
14
|
+
## Run Locally
|
|
15
|
+
- `pnpm install`
|
|
16
|
+
- `pnpm dev`: to run the dev version, connects to localhost:3000 if available
|
|
17
|
+
- run `pnpm dev` on [genesys.ai](https://github.com/directivegames/genesys.ai) to start localhost:3000
|
|
18
|
+
- if localhost:3000 is started after the sdk, refresh the sdk with Ctrl+R/Ctrl+Shift+R
|
|
19
|
+
- `pnpm dev:watch`: same as `pnpm dev` but with auto-restart on file changes using nodemon
|
|
20
|
+
- `pnpm dev:hosted`: connects to the hosted genesys.ai site.
|
|
21
|
+
- `pnpm dist`: to build the app locally. Installer will be generated in the `dist` folder that you can use to install the app directly on your machine.
|
|
22
|
+
|
|
23
|
+
## CLI Tools
|
|
24
|
+
The SDK includes command-line tools for creating and building projects without launching the GUI.
|
|
25
|
+
|
|
26
|
+
### Available Commands
|
|
27
|
+
```bash
|
|
28
|
+
# Show help and available commands
|
|
29
|
+
genesys-sdk --help
|
|
30
|
+
|
|
31
|
+
# Show version
|
|
32
|
+
genesys-sdk --version
|
|
33
|
+
|
|
34
|
+
# Create a new project
|
|
35
|
+
genesys-sdk new -n <project-name> -t <template-id> [-p <parent-path>]
|
|
36
|
+
|
|
37
|
+
# Build an existing project (with TypeScript type checking)
|
|
38
|
+
genesys-sdk build [-p <project-path>]
|
|
39
|
+
|
|
40
|
+
# Build without type checking (faster)
|
|
41
|
+
genesys-sdk build [-p <project-path>] --no-tsc
|
|
42
|
+
|
|
43
|
+
# List available project templates
|
|
44
|
+
genesys-sdk list-templates
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## New Project Template
|
|
48
|
+
- The logic to setup a new project is in [new-project.ts](src/backend/tools//new-project.ts), it contains a few steps:
|
|
49
|
+
- Generate `game.ts` and `default.genesys-scene` based on the selected template.
|
|
50
|
+
- Generate `package.json` and `{project}.code-workspace` from code.
|
|
51
|
+
- Copy the files from `assets/new-project` to the project folder.
|
|
52
|
+
- Run `pnpm install` and `pnpm build` in the project folder.
|
|
53
|
+
|
|
54
|
+
## Add Electron API
|
|
55
|
+
Electron API is for exposing code that relies on the nodejs environment to the frontend environment.
|
|
56
|
+
|
|
57
|
+
To add a new one, following this:
|
|
58
|
+
- Define the API in [api.ts](src/api.ts)
|
|
59
|
+
- Add the API wrapper in [preload.ts](src/preload.ts)
|
|
60
|
+
- Implement the API in [handler.ts](src/backend/handler.ts)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import noDefaultClassFields from './node_modules/genesys.js/eslint-rules/no-default-class-fields.js';
|
|
3
|
-
import defaultGetterReturnType from './node_modules/genesys.js/eslint-rules/default-getter-return-type.js';
|
|
4
|
-
import constructorTypeConsistency from './node_modules/genesys.js/eslint-rules/constructor-type-consistency.js';
|
|
5
|
-
import noOverrideMethods from './node_modules/genesys.js/eslint-rules/no-override-methods.js';
|
|
2
|
+
import noDefaultClassFields from './node_modules/@directivegames/genesys.js/eslint-rules/no-default-class-fields.js';
|
|
3
|
+
import defaultGetterReturnType from './node_modules/@directivegames/genesys.js/eslint-rules/default-getter-return-type.js';
|
|
4
|
+
import constructorTypeConsistency from './node_modules/@directivegames/genesys.js/eslint-rules/constructor-type-consistency.js';
|
|
5
|
+
import noOverrideMethods from './node_modules/@directivegames/genesys.js/eslint-rules/no-override-methods.js';
|
|
6
6
|
export default [
|
|
7
7
|
{
|
|
8
8
|
ignores: ['dist/**', '.engine/**', 'node_modules/**']
|
package/dist/src/core/cli.js
CHANGED
|
@@ -276,28 +276,28 @@ async function main() {
|
|
|
276
276
|
printTemplates();
|
|
277
277
|
});
|
|
278
278
|
// Add examples to help
|
|
279
|
-
program.addHelpText('after', `
|
|
280
|
-
Examples:
|
|
281
|
-
# Create a new FPS game project in current directory
|
|
282
|
-
$ genesys-sdk new -n my-fps-game -t fps
|
|
283
|
-
|
|
284
|
-
# Create a new FPS game project in a specific directory
|
|
285
|
-
$ genesys-sdk new -p ./projects -n my-fps-game -t fps
|
|
286
|
-
|
|
287
|
-
# Build current directory project with type checking
|
|
288
|
-
$ genesys-sdk build
|
|
289
|
-
|
|
290
|
-
# Build a specific project with type checking
|
|
291
|
-
$ genesys-sdk build -p ./projects/my-game
|
|
292
|
-
|
|
293
|
-
# Create a new asset pack in current directory
|
|
294
|
-
$ genesys-sdk new-asset-pack -n my-asset-pack
|
|
295
|
-
|
|
296
|
-
# Create a new asset pack in a specific directory
|
|
297
|
-
$ genesys-sdk new-asset-pack -p ./packs -n my-asset-pack
|
|
298
|
-
|
|
299
|
-
# List all available templates
|
|
300
|
-
$ genesys-sdk list-templates
|
|
279
|
+
program.addHelpText('after', `
|
|
280
|
+
Examples:
|
|
281
|
+
# Create a new FPS game project in current directory
|
|
282
|
+
$ genesys-sdk new -n my-fps-game -t fps
|
|
283
|
+
|
|
284
|
+
# Create a new FPS game project in a specific directory
|
|
285
|
+
$ genesys-sdk new -p ./projects -n my-fps-game -t fps
|
|
286
|
+
|
|
287
|
+
# Build current directory project with type checking
|
|
288
|
+
$ genesys-sdk build
|
|
289
|
+
|
|
290
|
+
# Build a specific project with type checking
|
|
291
|
+
$ genesys-sdk build -p ./projects/my-game
|
|
292
|
+
|
|
293
|
+
# Create a new asset pack in current directory
|
|
294
|
+
$ genesys-sdk new-asset-pack -n my-asset-pack
|
|
295
|
+
|
|
296
|
+
# Create a new asset pack in a specific directory
|
|
297
|
+
$ genesys-sdk new-asset-pack -p ./packs -n my-asset-pack
|
|
298
|
+
|
|
299
|
+
# List all available templates
|
|
300
|
+
$ genesys-sdk list-templates
|
|
301
301
|
`);
|
|
302
302
|
// Parse arguments
|
|
303
303
|
await program.parseAsync(process.argv);
|
package/dist/src/core/common.js
CHANGED
|
@@ -3,8 +3,8 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import { promisify } from 'util';
|
|
6
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
6
7
|
import fixPath from 'fix-path';
|
|
7
|
-
import * as ENGINE from 'genesys.js';
|
|
8
8
|
import { JSDOM } from 'jsdom';
|
|
9
9
|
import { ALL_DEPENDENCIES } from '../dependencies.js';
|
|
10
10
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -39,7 +39,7 @@ export function checkEngineVersion(engineVersion) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
export function getEngineVersion() {
|
|
42
|
-
return ALL_DEPENDENCIES['genesys.js'];
|
|
42
|
+
return ALL_DEPENDENCIES['@directivegames/genesys.js'];
|
|
43
43
|
}
|
|
44
44
|
export function getAppVersion() {
|
|
45
45
|
const pkg = JSON.parse(fs.readFileSync(path.join(getProjectRoot(), 'package.json'), 'utf8'));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import * as ENGINE from 'genesys.js';
|
|
3
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
4
4
|
import { findFilesByPredicate, getProjectFolderAndFile, runCommandAsync } from '../index.js';
|
|
5
5
|
function getTscBinaryPath(projectFolder, logger) {
|
|
6
6
|
// Look in the project's node_modules for tsc
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import * as ENGINE from 'genesys.js';
|
|
3
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
4
4
|
import { ALL_DEPENDENCIES } from '../../dependencies.js';
|
|
5
5
|
import { copyAsync, existsAsync, getEngineVersion, getProjectRoot, mkdirAsync, readdirAsync, runCommandAsync, writeFileAsync } from '../common.js';
|
|
6
6
|
import { IgnoredFiles } from '../index.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import * as ENGINE from 'genesys.js';
|
|
3
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
4
4
|
import { ALL_DEPENDENCIES } from '../../dependencies.js';
|
|
5
5
|
import { deletedTemplateItems, sharedTemplateItems } from '../../templates/src/index.js';
|
|
6
6
|
import { copyAsync, existsAsync, getEngineVersion, getProjectRoot, mkdirAsync, readdirAsync, runCommandAsync, writeFileAsync } from '../common.js';
|
package/dist/src/dependencies.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
2
3
|
import isDev from 'electron-is-dev';
|
|
3
|
-
import * as ENGINE from 'genesys.js';
|
|
4
4
|
// MUST be kept in sync with https://github.com/directivegames/genesys.ai/blob/develop/src/const.ts
|
|
5
5
|
export const GENESYS_URL = 'https://web--genesys-ai.us-central1.hosted.app/dashboard';
|
|
6
6
|
export const GENESYS_LOCAL_URL = 'http://localhost:3000/dashboard';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
3
4
|
import { app, dialog } from 'electron';
|
|
4
|
-
import * as ENGINE from 'genesys.js';
|
|
5
5
|
import { copySharedTemplateToProject, createGenesysProjectFile, getEngineVersion, getProjectFolderAndFile, getProjectNameFromPath, getProjectRoot, IgnoredFiles, projectFiles, runCommandAsync } from '../../../core/index.js';
|
|
6
6
|
import { getTemplatePath as getTemplatePathImpl } from '../../../core/tools/new-project.js';
|
|
7
7
|
import { deletedTemplateItems, sharedTemplateItems } from '../../../templates/src/index.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import noDefaultClassFields from './node_modules/genesys.js/eslint-rules/no-default-class-fields.js';
|
|
3
|
-
import defaultGetterReturnType from './node_modules/genesys.js/eslint-rules/default-getter-return-type.js';
|
|
4
|
-
import constructorTypeConsistency from './node_modules/genesys.js/eslint-rules/constructor-type-consistency.js';
|
|
5
|
-
import noOverrideMethods from './node_modules/genesys.js/eslint-rules/no-override-methods.js';
|
|
2
|
+
import noDefaultClassFields from './node_modules/@directivegames/genesys.js/eslint-rules/no-default-class-fields.js';
|
|
3
|
+
import defaultGetterReturnType from './node_modules/@directivegames/genesys.js/eslint-rules/default-getter-return-type.js';
|
|
4
|
+
import constructorTypeConsistency from './node_modules/@directivegames/genesys.js/eslint-rules/constructor-type-consistency.js';
|
|
5
|
+
import noOverrideMethods from './node_modules/@directivegames/genesys.js/eslint-rules/no-override-methods.js';
|
|
6
6
|
export default [
|
|
7
7
|
{
|
|
8
8
|
ignores: ['dist/**', '.engine/**', 'node_modules/**']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs, { readFileSync } from 'fs';
|
|
2
2
|
import path, { resolve } from 'path';
|
|
3
|
-
import * as ENGINE from 'genesys.js';
|
|
3
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js';
|
|
6
6
|
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
@@ -202,4 +202,4 @@ async function fetchBoundingBoxData(manifestFile, gltfPaths) {
|
|
|
202
202
|
}
|
|
203
203
|
// Export the main functions for use as a module
|
|
204
204
|
export { calculateGLBBoundingBox, calculateGLBOriginalBoundingBox, createTransform, degreesToRadians, fetchBoundingBoxData, extractBoundingBoxData, GLBLoadError, BoundingBoxCalculationError };
|
|
205
|
-
export { BoundingBoxSchema } from 'genesys.js';
|
|
205
|
+
export { BoundingBoxSchema } from '@directivegames/genesys.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// pnpm exec tsx ./scripts/genesys/dev/generate-manifest.ts
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path from 'path';
|
|
4
|
-
import * as ENGINE from 'genesys.js';
|
|
4
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
5
5
|
import { ManifestPath } from './storage-provider.js';
|
|
6
6
|
/**
|
|
7
7
|
* Recursively scans a directory and returns file information
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as ENGINE from 'genesys.js';
|
|
1
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
2
2
|
import { DevStorageProvider } from './storage-provider.js';
|
|
3
3
|
// Ensure process is available globally with minimal implementation
|
|
4
4
|
if (typeof globalThis.process === 'undefined') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as ENGINE from 'genesys.js';
|
|
1
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
2
2
|
export const ManifestPath = 'dist/file-manifest.json';
|
|
3
3
|
export class DevStorageProvider {
|
|
4
4
|
manifestCache = null;
|
|
@@ -41,17 +41,17 @@ export class DevStorageProvider {
|
|
|
41
41
|
resolvedUrl = path.initialPath.replace(ENGINE.PROJECT_PATH_PREFIX, ENGINE.BUILT_PROJECT_FOLDER);
|
|
42
42
|
}
|
|
43
43
|
else if (path.initialPath.startsWith(ENGINE.ENGINE_PATH_PREFIX)) {
|
|
44
|
-
resolvedUrl = path.initialPath.replace(ENGINE.ENGINE_PATH_PREFIX, '/node_modules/genesys.js');
|
|
44
|
+
resolvedUrl = path.initialPath.replace(ENGINE.ENGINE_PATH_PREFIX, '/node_modules/@directivegames/genesys.js');
|
|
45
45
|
}
|
|
46
46
|
else if (path.initialPath.startsWith('/')) {
|
|
47
|
-
resolvedUrl = `/node_modules/genesys.js${path.initialPath}`;
|
|
47
|
+
resolvedUrl = `/node_modules/@directivegames/genesys.js${path.initialPath}`;
|
|
48
48
|
}
|
|
49
49
|
else if (path.initialPath.startsWith('http') || path.initialPath.startsWith('https')) {
|
|
50
50
|
resolvedUrl = path.initialPath;
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
// Paths without prefix are treated as engine paths
|
|
54
|
-
resolvedUrl = `/node_modules/genesys.js/${path.initialPath}`;
|
|
54
|
+
resolvedUrl = `/node_modules/@directivegames/genesys.js/${path.initialPath}`;
|
|
55
55
|
}
|
|
56
56
|
path.resolvePath(resolvedUrl, ENGINE.AssetPathEncodeState.Unknown);
|
|
57
57
|
return path;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
//
|
|
6
6
|
// for another MCP client (e.g. cline) that wants to use this, the command is: `pnpm exec tsc ./scripts/genesys/genesys-mcp.ts`
|
|
7
7
|
import pathlib from 'path';
|
|
8
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
8
9
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
10
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
10
|
-
import * as ENGINE from 'genesys.js';
|
|
11
11
|
import * as THREE from 'three';
|
|
12
12
|
import { z } from 'zod';
|
|
13
13
|
import { ActorInfoSchema, TransformSchema } from './common.js';
|
|
@@ -27,9 +27,9 @@ const server = new McpServer({
|
|
|
27
27
|
logging: {} // to support sendLoggingMessage
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
const classRule = `
|
|
31
|
-
The class name should start with '${ENGINE.Prefix.GAME}' or '${ENGINE.Prefix.ENGINE}' to indicate if it is a class from game project or engine.
|
|
32
|
-
If it starts with neither, it will be matched against all registered classes. If none is found, an error will be returned.
|
|
30
|
+
const classRule = `
|
|
31
|
+
The class name should start with '${ENGINE.Prefix.GAME}' or '${ENGINE.Prefix.ENGINE}' to indicate if it is a class from game project or engine.
|
|
32
|
+
If it starts with neither, it will be matched against all registered classes. If none is found, an error will be returned.
|
|
33
33
|
`;
|
|
34
34
|
function requestEditorReload(editorId) {
|
|
35
35
|
const ws = getClientWebSocket(editorId);
|
|
@@ -126,12 +126,12 @@ server.registerTool('addGltf', {
|
|
|
126
126
|
inputSchema: {
|
|
127
127
|
editorId: EditorIdSchema,
|
|
128
128
|
gltfs: z.array(z.object({
|
|
129
|
-
path: z.string().describe(`Path or URL to the GLTF model to add.
|
|
130
|
-
Unless explicitly told by user, otherwise it should always be one of these
|
|
131
|
-
- fetched from the result of searchAssets tool
|
|
132
|
-
- copied from an existing path of an existing placed GLTF actor.
|
|
133
|
-
- use a verified URL to a GLTF model
|
|
134
|
-
Never make up a relative path to a file, because that won't be resolved by the editor.
|
|
129
|
+
path: z.string().describe(`Path or URL to the GLTF model to add.
|
|
130
|
+
Unless explicitly told by user, otherwise it should always be one of these
|
|
131
|
+
- fetched from the result of searchAssets tool
|
|
132
|
+
- copied from an existing path of an existing placed GLTF actor.
|
|
133
|
+
- use a verified URL to a GLTF model
|
|
134
|
+
Never make up a relative path to a file, because that won't be resolved by the editor.
|
|
135
135
|
`),
|
|
136
136
|
transform: TransformSchema.optional().describe('Transform of the GLTF model'),
|
|
137
137
|
info: ActorInfoSchema.describe('Information about the GLTF model actor.'),
|
|
@@ -208,11 +208,11 @@ server.registerTool('placePrefab', {
|
|
|
208
208
|
};
|
|
209
209
|
});
|
|
210
210
|
server.registerTool('searchAssets', {
|
|
211
|
-
description: `Search for assets in the project and engine directories.
|
|
212
|
-
When the user requests to place something in the scene, unless it is clearly a primitive, always try calling this first to see if any assets are fitting the request.
|
|
213
|
-
Before using the assets found, **always** call the \`getAssetsMetadata\` tool to get the metadata about the assets, unless the given metadata is already fetched.
|
|
214
|
-
Here is the list of assets types, including:
|
|
215
|
-
${Object.entries(assetDescriptions).map(([type, description]) => `- ${type}: ${description}`).join('\n')}
|
|
211
|
+
description: `Search for assets in the project and engine directories.
|
|
212
|
+
When the user requests to place something in the scene, unless it is clearly a primitive, always try calling this first to see if any assets are fitting the request.
|
|
213
|
+
Before using the assets found, **always** call the \`getAssetsMetadata\` tool to get the metadata about the assets, unless the given metadata is already fetched.
|
|
214
|
+
Here is the list of assets types, including:
|
|
215
|
+
${Object.entries(assetDescriptions).map(([type, description]) => `- ${type}: ${description}`).join('\n')}
|
|
216
216
|
`,
|
|
217
217
|
inputSchema: {
|
|
218
218
|
acceptedTypes: z.array(z.enum(Object.values(AssetType))).describe('List of types of assets to search for. An empty array means all types.'),
|
|
@@ -261,10 +261,10 @@ server.registerTool('placeJsClassActor', {
|
|
|
261
261
|
actors: z.array(z.object({
|
|
262
262
|
className: z.string().describe(`The name of the JavaScript class to place. ${classRule}`),
|
|
263
263
|
constructorParams: z.array(z.record(z.any())).optional()
|
|
264
|
-
.describe(`Optional constructor parameters to pass to the actor class.
|
|
265
|
-
Use the getAssetsMetadata tool to discover what parameters each actor class requires,
|
|
266
|
-
and the parameters should be an array that corresponds to the "jsClassConstructorParams" from the result of the getAssetsMetadata tool.
|
|
267
|
-
If the actor class has no constructor parameters, the array should be empty.
|
|
264
|
+
.describe(`Optional constructor parameters to pass to the actor class.
|
|
265
|
+
Use the getAssetsMetadata tool to discover what parameters each actor class requires,
|
|
266
|
+
and the parameters should be an array that corresponds to the "jsClassConstructorParams" from the result of the getAssetsMetadata tool.
|
|
267
|
+
If the actor class has no constructor parameters, the array should be empty.
|
|
268
268
|
`),
|
|
269
269
|
info: ActorInfoSchema.describe('Information about the actor.'),
|
|
270
270
|
}).strict().describe('A JavaScript class actor to place.')).describe('A list of JavaScript class actors to place. Each actor can have a transform and constructor parameters.'),
|
|
@@ -290,8 +290,8 @@ server.registerTool('generateTemplateCode', {
|
|
|
290
290
|
description: 'Generate template code for a class of actor or component. When the user asks to create a new actor or component, always try calling this first to see if any template code is available, and iterate on the code it generates until it is correct.',
|
|
291
291
|
inputSchema: {
|
|
292
292
|
className: z.string().describe('The name of the class to generate template code for.'),
|
|
293
|
-
filePath: z.string().describe(`The path to the file to generate the template code for.
|
|
294
|
-
If it is a relative path, it will be relative to the 'src/' directory, so don't include the extra 'src/' in the path.
|
|
293
|
+
filePath: z.string().describe(`The path to the file to generate the template code for.
|
|
294
|
+
If it is a relative path, it will be relative to the 'src/' directory, so don't include the extra 'src/' in the path.
|
|
295
295
|
The file name should be lower camel case, such as 'myActor.ts', or 'fancyMovementComponent.ts'.`),
|
|
296
296
|
baseClassName: z.string().describe(`The name of the base class to generate the template code for. ${classRule}`),
|
|
297
297
|
},
|
|
@@ -324,11 +324,11 @@ The file name should be lower camel case, such as 'myActor.ts', or 'fancyMovemen
|
|
|
324
324
|
};
|
|
325
325
|
});
|
|
326
326
|
server.registerTool('getSceneState', {
|
|
327
|
-
description: `
|
|
328
|
-
Get the current state of the scene to understand the state of the current scene and its actors.
|
|
329
|
-
**DO NOT** try reading the scene file directly unless explicitly asked by the user.
|
|
330
|
-
The first time calling this tool, always call without specifiedActors and getDetailedComponentsInfo to have an overview of the scene.
|
|
331
|
-
And then call this tool with \`specifiedActors\`, and set \`getDetailedComponentsInfo\` to true, to get more detailed information about specific actors, including their bounding boxes info, etc.
|
|
327
|
+
description: `
|
|
328
|
+
Get the current state of the scene to understand the state of the current scene and its actors.
|
|
329
|
+
**DO NOT** try reading the scene file directly unless explicitly asked by the user.
|
|
330
|
+
The first time calling this tool, always call without specifiedActors and getDetailedComponentsInfo to have an overview of the scene.
|
|
331
|
+
And then call this tool with \`specifiedActors\`, and set \`getDetailedComponentsInfo\` to true, to get more detailed information about specific actors, including their bounding boxes info, etc.
|
|
332
332
|
`,
|
|
333
333
|
inputSchema: {
|
|
334
334
|
editorId: EditorIdSchema,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { getProjectRoot } from '../common.js';
|
|
4
|
-
const enginePathName = 'node_modules/genesys.js';
|
|
5
|
-
const docPathName = 'node_modules/genesys.js/docs';
|
|
4
|
+
const enginePathName = 'node_modules/@directivegames/genesys.js';
|
|
5
|
+
const docPathName = 'node_modules/@directivegames/genesys.js/docs';
|
|
6
6
|
const enginePath = path.join(getProjectRoot(), enginePathName);
|
|
7
7
|
const docsPath = path.join(getProjectRoot(), docPathName);
|
|
8
8
|
function listDocs() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import * as ENGINE from 'genesys.js';
|
|
2
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
3
3
|
import getPort from 'get-port';
|
|
4
4
|
import { nanoid } from 'nanoid';
|
|
5
5
|
import { WebSocket, WebSocketServer } from 'ws';
|
|
@@ -66,10 +66,10 @@ function shutdown() {
|
|
|
66
66
|
});
|
|
67
67
|
clients.clear();
|
|
68
68
|
}
|
|
69
|
-
export const EditorIdSchema = z.string().optional().describe(`
|
|
70
|
-
ID of the editor that should respond.
|
|
71
|
-
If not provided, will proceed if there is only one editor connected, will return error if there are multiple editors connected.
|
|
72
|
-
Can always try without providing this, and only ask the user to provide it if there are multiple editors connected.
|
|
69
|
+
export const EditorIdSchema = z.string().optional().describe(`
|
|
70
|
+
ID of the editor that should respond.
|
|
71
|
+
If not provided, will proceed if there is only one editor connected, will return error if there are multiple editors connected.
|
|
72
|
+
Can always try without providing this, and only ask the user to provide it if there are multiple editors connected.
|
|
73
73
|
`);
|
|
74
74
|
export function getClientWebSocket(editorId) {
|
|
75
75
|
if (clients.size === 0) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import * as ENGINE from 'genesys.js';
|
|
3
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
4
4
|
import { ModuleKind, ModuleResolutionKind, Project, ScriptTarget } from 'ts-morph';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import * as ENGINE from 'genesys.js';
|
|
3
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
4
4
|
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
5
5
|
import { BoundingBoxSchema, fetchBoundingBoxData } from '../calc-bounding-box.js';
|
|
6
6
|
import { ENGINE_PREFIX, JS_CLASSES_DIR_NAME, PROJECT_PREFIX, SCENE_EXTENSION } from '../const.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import * as ENGINE from 'genesys.js';
|
|
3
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { isDev } from '../common.js';
|
|
6
6
|
import { mockBrowserEnvironment } from '../mock.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import * as ENGINE from 'genesys.js';
|
|
2
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
3
3
|
import { getProjectRoot } from './common.js';
|
|
4
4
|
import { isSubclass } from './mcp/utils.js';
|
|
5
5
|
import { fixUpClassName, registerGameClasses } from './mcp/utils.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as ENGINE from 'genesys.js';
|
|
1
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
import { ThreeEulerSchema, ThreeVector3Schema } from './mcp/search-actors.js';
|
|
4
4
|
import { loadWorld, registerGameClassesIfAnyNotRegistered } from './mcp/utils.js';
|
|
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { getProjectRoot } from './common.js';
|
|
4
4
|
async function main() {
|
|
5
|
-
const engineInstallFolder = path.join(getProjectRoot(), 'node_modules/genesys.js');
|
|
5
|
+
const engineInstallFolder = path.join(getProjectRoot(), 'node_modules/@directivegames/genesys.js');
|
|
6
6
|
if (!fs.existsSync(engineInstallFolder)) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import * as ENGINE from 'genesys.js';
|
|
4
|
-
import { AssetPath, AssetPathEncodeState } from 'genesys.js';
|
|
3
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
4
|
+
import { AssetPath, AssetPathEncodeState } from '@directivegames/genesys.js';
|
|
5
5
|
import { getProjectRoot } from './common.js';
|
|
6
6
|
export class StorageProvider {
|
|
7
7
|
async resolvePath(assetPath, expiry) {
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import * as ENGINE from 'genesys.js';
|
|
7
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
8
8
|
import * as THREE from 'three';
|
|
9
9
|
/**
|
|
10
10
|
* A first person player class.
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import * as ENGINE from 'genesys.js';
|
|
7
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
8
8
|
import * as THREE from 'three';
|
|
9
9
|
import { DefaultWeapon } from './weapon.js';
|
|
10
10
|
/**
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import * as ENGINE from 'genesys.js';
|
|
7
|
+
import * as ENGINE from '@directivegames/genesys.js';
|
|
8
8
|
import * as THREE from 'three';
|
|
9
9
|
/**
|
|
10
10
|
* A default weapon class.
|