open-index/open-npm huggingface dataset:
npm package: @gnsx/genesys.sdk
Description: Genesys SDK - A development toolkit for game development
Author: Directive Games
Latest version: 8.0.9

[![CI](https://github.com/directivegames/genesys.sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/directivegames/genesys.sdk/actions/workflows/ci.yml)
[![Publish](https://github.com/directivegames/genesys.sdk/actions/workflows/publish.yml/badge.svg)](https://github.com/directivegames/genesys.sdk/actions/workflows/publish.yml)

![Version](https://gist.githubusercontent.com/haowang1013/d024d16ac57a7bfd7038ae32bf239d07/raw/genesys.sdk.svg)

# User Workflow
- Download and install the latest version from the [Release](https://github.com/directivegames/genesys.sdk/releases) page.
- Create an empty folder on your disk to store the project.
- Open the empty folder created earlier in this app, select a template and create a project, then start the file server.
- Launch the web editor and cursor to develop.

# Developer

## Run Locally
- `pnpm install`
- `pnpm dev`: to run the dev version, connects to localhost:3000 if available
  - run `pnpm dev` on [genesys.ai](https://github.com/directivegames/genesys.ai) to start localhost:3000
  - if localhost:3000 is started after the sdk, refresh the sdk with Ctrl+R/Ctrl+Shift+R
- `pnpm dev:watch`: same as `pnpm dev` but with auto-restart on file changes using nodemon
- `pnpm dev:hosted`: connects to the hosted genesys.ai site.
- `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.

## CLI Tools
The SDK includes command-line tools for creating and building projects without launching the GUI.

### Available Commands
```bash
# Show help and available commands
genesys-sdk --help

# Show version
genesys-sdk --version

# Create a new project
genesys-sdk new -n <project-name> -t <template-id> [-p <parent-path>]

# Build an existing project (with TypeScript type checking)
genesys-sdk build [-p <project-path>]

# Build without type checking (faster)
genesys-sdk build [-p <project-path>] --no-tsc

# List available project templates
genesys-sdk list-templates
```

## New Project Template
- The logic to setup a new project is in [new-project.ts](src/backend/tools//new-project.ts), it contains a few steps:  
  - Generate `game.ts` and `default.genesys-scene` based on the selected template.
  - Generate `package.json` and `{project}.code-workspace` from code.
  - Copy the files from `assets/new-project` to the project folder.
  - Run `pnpm install` and `pnpm build` in the project folder.

## Add Electron API
Electron API is for exposing code that relies on the nodejs environment to the frontend environment.

To add a new one, following this:
- Define the API in [api.ts](src/api.ts)
- Add the API wrapper in [preload.ts](src/preload.ts)
- Implement the API in [handler.ts](src/backend/handler.ts)