diff --git a/.agents/notes/implemented/architecture/2026-11-27-nsgo-game-extension-decoupling.md b/.agents/notes/implemented/architecture/2026-11-27-nsgo-game-extension-decoupling.md new file mode 100644 index 000000000..7d9d9c4fc --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-11-27-nsgo-game-extension-decoupling.md @@ -0,0 +1,36 @@ +# Agent Note: Decoupling `nsgo game` from NSGo via `cmd/nsgo-game` and `internal/gamecli` + +Status: implemented + +## Problem + +NSGo previously shipped a hardcoded built-in `nsgo game` command (`cmd/nsgo/gamecommand.go`) that knew `github.com/nsgo-dev/game/packages/game/cmd/game`, pinned a game release version, and read `NSGO_GAME_VERSION` when invoked outside a Go module. That coupled the core `nsgo` CLI to `nsgo-dev/game`'s repository layout and release schedule. + +Removing that built-in leaves `nsgo game` to NSGo's generic extension mechanism: + +1. Inside a module whose `go.mod` declares `tool github.com/nsgo-dev/game/packages/game/cmd/game`, `nsgo game ` automatically runs `go tool github.com/nsgo-dev/game/packages/game/cmd/game `. +2. Outside a module (such as before scaffolding a project with `nsgo game new`), `nsgo game ` looks up an executable named `nsgo-game` on `PATH`. + +`packages/game/cmd/game` installs a binary named `game`, not `nsgo-game`, so outside-a-module `nsgo game` could not find an installed extension binary without a `cmd/nsgo-game` package. + +## Decision + +Extract the entire CLI implementation (including `_templates/` and `testdata/`) from `packages/game/cmd/game` into `packages/game/internal/gamecli`, exposing `gamecli.Main()` and `gamecli.Run(args []string) int`, and wire two tiny `main` packages to it: + +- `packages/game/cmd/game`: thin wrapper calling `gamecli.Main()`, preserving the module `tool` path (`github.com/nsgo-dev/game/packages/game/cmd/game`) for `go tool game`, in-module `nsgo game`, and zero-install `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest`. +- `packages/game/cmd/nsgo-game`: thin wrapper calling `gamecli.Main()`, providing `go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest` so `nsgo game` works outside a Go module via `PATH` discovery. + +`packages/game/internal/gamecli` sits at the exact same directory depth below the repository root (4 levels) as `packages/game/cmd/game`, so all relative repository paths in tests (`reference_test.go`, `templates_test.go`, `library_test.go`, `skill_e2e_test.go`, `navmesh_test.go`, `playtest_test.go`, `replay_test.go`) remain unchanged. `packages/game/conformance_test.go`'s `notFormats` allowlist moves from `cmd/game` to `internal/gamecli`, and `docs/{en,zh}/stability.md` plus `skills/nsgo-game/references/packages.md` register `game/cmd/nsgo-game` as `Experimental`. + +This partly supersedes the built-in dispatch mechanism recorded in [nsgo game as the documented form](../../implemented/process/2026-11-25-nsgo-game-main-form.md): `nsgo game` stays the documented CLI form, while dispatch now relies exclusively on NSGo's generic extension mechanism rather than a hardcoded built-in in `nsgo`. + +## Alternatives considered + +- **Keep the hardcoded `nsgo game` built-in in `nsgo-dev/nsgo`** — Avoids a one-time `go install .../cmd/nsgo-game@latest` for outside-a-module `nsgo game`, which was why the earlier note ([nsgo game as the documented form](../../implemented/process/2026-11-25-nsgo-game-main-form.md)) accepted it. Rejected because it permanently couples `nsgo` to `nsgo-dev/game`'s module path, version pinning, and `NSGO_GAME_VERSION` override. +- **Rename `packages/game/cmd/game` to `packages/game/cmd/nsgo-game`** — Avoids adding a second `cmd/` package and an `internal/gamecli` package. Rejected because it breaks every existing project's `tool github.com/nsgo-dev/game/packages/game/cmd/game`, `go tool game` (used by the editor, workflows, MCP configs, and Git merge drivers), and `go run .../cmd/game@latest`. +- **Tell users outside a module to only use `go run .../cmd/game@latest` with no `cmd/nsgo-game`** — Avoids maintaining a second binary entrypoint. Rejected because users who already run `nsgo game` inside projects expect `nsgo game new` to work outside a project too once installed, matching standard `git-` / `nsgo-` PATH extensions. + +## Consequences + +- **Benefits**: `nsgo` has zero compile-time or runtime coupling to `nsgo-dev/game`; `cmd/game` and `cmd/nsgo-game` share 100% of CLI code via `internal/gamecli`; existing `go tool game`, `go.mod` `tool` directives, and `go run .../cmd/game@latest` remain completely compatible. +- **Costs**: Running `nsgo game` outside a Go module requires a one-time `go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest` (or using `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest` directly); contributors updating embedded project templates now copy into `packages/game/internal/gamecli/_templates/projects/` instead of `packages/game/cmd/game/_templates/projects/`. diff --git a/.agents/notes/implemented/process/2026-11-25-nsgo-game-main-form.md b/.agents/notes/implemented/process/2026-11-25-nsgo-game-main-form.md index 81067e00a..3add251e7 100644 --- a/.agents/notes/implemented/process/2026-11-25-nsgo-game-main-form.md +++ b/.agents/notes/implemented/process/2026-11-25-nsgo-game-main-form.md @@ -8,9 +8,9 @@ The game layer's command was documented only as `go tool game`, a second entry p ## Decision -The docs (`docs/en`, `docs/zh`), the agent skill (`skills/nsgo-game`) and the READMEs that show the command write it as `nsgo game `. `docs/en/cli.md#install` says it is a command of `nsgo` since v0.3.3, that a project's own `nsgo` tool needs v0.3.3 or later as well since an `nsgo` of another version hands a project's commands to the project's, and that `go tool game` runs the same command in a project. `packages/game`, every template's `go.mod.tmpl` (and its copy under `cmd/game/_templates`), the examples and the agent-eval fixtures require NSGo v0.3.4 for that reason (#1126), rather than v0.3.3, which skips depth-tested draws into a window's own depth buffer (nsgo-dev/nsgo#2395), so a project made from any template runs `nsgo game` with no extra step. The generated command reference (`cmd/game/reference.go`) prints each usage line as `nsgo game …`; the command's own help and errors keep `game …`, true under either name. +The docs (`docs/en`, `docs/zh`), the agent skill (`skills/nsgo-game`) and the READMEs that show the command write it as `nsgo game `. `docs/en/cli.md#install` says it runs through `nsgo` since v0.3.3, that a project's own `nsgo` tool needs v0.3.3 or later as well since an `nsgo` of another version hands a project's commands to the project's, and that `go tool game` runs the same command in a project. `packages/game`, every template's `go.mod.tmpl` (and its copy under `internal/gamecli/_templates`), the examples and the agent-eval fixtures require NSGo v0.3.4 for that reason (#1126), rather than v0.3.3, which skips depth-tested draws into a window's own depth buffer (nsgo-dev/nsgo#2395), so a project made from any template runs `nsgo game` with no extra step. The generated command reference (`internal/gamecli/reference.go`) prints each usage line as `nsgo game …`; the command's own help and errors keep `game …`, true under either name. -What runs the command itself stays `go tool game`: the editor's Run button (`editor/run_game.go`), the workflows and the benchmark baseline's note, as they must work without an `nsgo` on `PATH`. The game module adds no command for `nsgo`: the project templates' `go.mod` already declare the `game` tool that `nsgo game` runs. +What runs the command itself stays `go tool game`: the editor's Run button (`editor/run_game.go`), the workflows and the benchmark baseline's note, as they must work without an `nsgo` on `PATH`. The built-in `nsgo game` dispatch and "no extra command" part of this decision were later superseded by [decoupling `nsgo game` via `cmd/nsgo-game` and `internal/gamecli`](../../implemented/architecture/2026-11-27-nsgo-game-extension-decoupling.md), while `nsgo game` remains the documented form. ## Alternatives considered diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1acc0d8ac..238c3c63c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -84,7 +84,7 @@ jobs: CLOUDSAVE_POSTGRES_DSN: postgres://postgres:accounts-ci@127.0.0.1:5432/postgres?sslmode=disable run: go tool nsgo test ./cloudsave/sqlstore/... - # Lists one matrix entry per template game new offers, from the template directories on disk: starter in template/template and every other template in template//template, which TestTemplatesMatchTemplateModules keeps the same as the registry in packages/game/cmd/game/templates.go. Adding a template therefore needs no edit here. + # Lists one matrix entry per template game new offers, from the template directories on disk: starter in template/template and every other template in template//template, which TestTemplatesMatchTemplateModules keeps the same as the registry in packages/game/internal/gamecli/templates.go. Adding a template therefore needs no edit here. template-list: name: List the templates runs-on: depot-ubuntu-24.04 diff --git a/changelog.d/nsgo-game-extension-binary.md b/changelog.d/nsgo-game-extension-binary.md new file mode 100644 index 000000000..4b0b8c4d1 --- /dev/null +++ b/changelog.d/nsgo-game-extension-binary.md @@ -0,0 +1,7 @@ +### Added + +- `game/cmd/nsgo-game`: add the `nsgo-game` extension binary entrypoint (`go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest`) so `nsgo game` works outside a Go module through NSGo's generic extension mechanism. + +### Changed + +- `game/cmd/game`: move the shared CLI implementation into `game/internal/gamecli` so `cmd/game` and `cmd/nsgo-game` share one entrypoint, and update CLI, template, getting-started, stability and agent skill docs for NSGo's extension-based `nsgo game` dispatch without a built-in command in `nsgo`. diff --git a/docs/en/cli-reference.md b/docs/en/cli-reference.md index bc750a281..9bf004ebb 100644 --- a/docs/en/cli-reference.md +++ b/docs/en/cli-reference.md @@ -1,6 +1,6 @@ # Command Reference - + Every subcommand of `nsgo game`, which `go tool game` runs alike, with its usage line and flags, generated from the commands' definitions so it always matches `game help`. [Command Line](cli.md) shows how to install the command, what each subcommand is for and how to set up shell completion. diff --git a/docs/en/cli.md b/docs/en/cli.md index 30f8ed753..95cbecf47 100644 --- a/docs/en/cli.md +++ b/docs/en/cli.md @@ -4,16 +4,23 @@ ## Install -Run the command as `nsgo game`, a command of NSGo's own `nsgo` since v0.3.3 (nsgo-dev/nsgo#2366). Install `nsgo` once, with Homebrew (`brew install nsgo-dev/tap/nsgo`), with the install script on macOS and Linux (`curl -fsSL https://nsgo.dev/install.sh | sh`) or with Go on any system (`go install github.com/nsgo-dev/nsgo/cmd/nsgo@latest`), as [NSGo's setup](https://nsgo.dev/docs/getting-started/#install-nsgo) describes. In a project, `nsgo game` runs the `game` tool the module's `go.mod` declares: +Run the command as `nsgo game` through NSGo's extension mechanism (since NSGo v0.3.3). Install `nsgo` once, with Homebrew (`brew install nsgo-dev/tap/nsgo`), with the install script on macOS and Linux (`curl -fsSL https://nsgo.dev/install.sh | sh`) or with Go on any system (`go install github.com/nsgo-dev/nsgo/cmd/nsgo@latest`), as [NSGo's setup](https://nsgo.dev/docs/getting-started/#install-nsgo) describes. In a project whose `go.mod` declares the `game` tool, `nsgo game` automatically runs that module's pinned tool (`go tool github.com/nsgo-dev/game/packages/game/cmd/game`): ```sh go get -tool github.com/nsgo-dev/game/packages/game/cmd/game nsgo game help ``` -The `tool` line in `go.mod` pins the command to the module's version of the game layer, so everyone working on the game runs the same one. A project created with [`game new`](#new) has it already. An `nsgo` of another version than the one the project's `go.mod` pins runs the project's own instead, so the project's `nsgo` tool needs v0.3.3 or later too; every template's `go.mod` and the game layer itself require v0.3.4, the first release whose software renderer and surface depth buffer draw 3D scenes right. Outside a project, such as to create one, `nsgo game` runs the game layer's release made for that `nsgo` with `go run`, with nothing else to install. +The `tool` line in `go.mod` pins the command to the module's version of the game layer, so everyone working on the game runs the same one. A project created with [`game new`](#new) has it already. An `nsgo` of another version than the one the project's `go.mod` pins runs the project's own instead, so the project's `nsgo` tool needs v0.3.3 or later too; every template's `go.mod` and the game layer itself require v0.3.4, the first release whose software renderer and surface depth buffer draw 3D scenes right. -`go tool game` runs the same command in a project without an installed `nsgo`, and `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest` does anywhere. +Outside a project, such as before creating one with `nsgo game new`, install the `nsgo-game` extension binary once on `PATH` so `nsgo game` finds it: + +```sh +go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest +nsgo game new mygame +``` + +Or run `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest` directly anywhere with nothing to install. Inside a project, `go tool game` also runs the same command without an installed `nsgo`. ## Commands @@ -193,7 +200,7 @@ nsgo game new -list Writes a project from a template into the directory named, creating it if needed, and prints each file's path. It then runs `go get -tool github.com/nsgo-dev/game/packages/game/cmd/game@` and `go mod tidy` there, which need the Go module proxy, so the project requires that version of the game layer and has the `game` tool beside the `nsgo` tool, and builds and runs with `go tool nsgo dev` without edits. -The game is named after the directory unless `-name` gives a name (letters, digits, spaces, `-` and `_`, starting with a letter), which `game.yaml` and `nsgo.yaml` hold as `name`, with `id` derived from it as `dev.nsgo.`. The module path is the name in lower case with its words joined by `-` unless `-module` gives one. A module path that is a standard-library package's, such as `time` for a game called Time, is refused because the project could not build, so such a game needs `-module`, such as `-module example.com/time`. `-version` is the version of the game layer to require, such as `v0.4.0`, a commit or `latest`; by default it is the version of the command running, so `go run …@v0.4.0 new`, or `nsgo game new` with `NSGO_GAME_VERSION=v0.4.0` outside a project, creates a project on `v0.4.0`, and `latest` when the command was built from a checkout of this repository. `-template` chooses the template, `starter` by default, and an unknown name is refused with the names there are. `-list` prints each template's name, the default marked, beside a line saying what it is, and creates nothing. [Templates](templates.md) lists them with the module `nsgo init -template` takes for each, and describes how a template is laid out and how to add one. +The game is named after the directory unless `-name` gives a name (letters, digits, spaces, `-` and `_`, starting with a letter), which `game.yaml` and `nsgo.yaml` hold as `name`, with `id` derived from it as `dev.nsgo.`. The module path is the name in lower case with its words joined by `-` unless `-module` gives one. A module path that is a standard-library package's, such as `time` for a game called Time, is refused because the project could not build, so such a game needs `-module`, such as `-module example.com/time`. `-version` is the version of the game layer to require, such as `v0.4.0`, a commit or `latest`; by default it is the version of the command running, so `go run …@v0.4.0 new`, or an `nsgo-game` installed at `v0.4.0`, creates a project on `v0.4.0`, and `latest` when the command was built from a checkout of this repository. `-template` chooses the template, `starter` by default, and an unknown name is refused with the names there are. `-list` prints each template's name, the default marked, beside a line saying what it is, and creates nothing. [Templates](templates.md) lists them with the module `nsgo init -template` takes for each, and describes how a template is laid out and how to add one. `new` writes nothing when any file it would write already exists in the directory, and fails with 1. Every template includes `.gitattributes` registering `*.scene.yaml` and `*.scene.yml` with the `nsgo-scene` merge driver, and when the directory already holds a `.git` repository, `new` also configures the local Git driver automatically (otherwise run `go tool game merge -setup` after `git init`). When `go get` or `go mod tidy` fails, such as without a network, the files stay where they are written, and the error names the commands left to run in the directory to finish the project: both `go get -tool …` and `go mod tidy` when `go get` failed, and `go mod tidy` alone when it failed. diff --git a/docs/en/getting-started.md b/docs/en/getting-started.md index c350a558d..f620c6da2 100644 --- a/docs/en/getting-started.md +++ b/docs/en/getting-started.md @@ -21,7 +21,7 @@ cd mygame go tool nsgo dev ``` -`go run github.com/nsgo-dev/game/packages/game/cmd/game@latest new mygame` does the same without `nsgo`. +`nsgo game` outside a project uses the `nsgo-game` extension binary on `PATH` (install once with `go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest`), or `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest new mygame` does the same directly with nothing to install. Inside the created project, `nsgo game` automatically runs the module's pinned `game` tool. The starter includes an animated sprite, tap-to-score input, and tests. Its settings live in `game.yaml`, the [project file](project.md), which `nsgo.yaml` mirrors. `new` names the game after its directory in both files' `name` and `id` and in the module path; `-name` and `-module` choose others, such as `-module example.com/mygame`. [Command Line](cli.md#new) describes every flag, and `-template` starts from another of the [templates](templates.md), which `new -list` lists. Change the identifier to your own before you ship the game: edit the game's name and identifier in `game.yaml`, then run `go run github.com/nsgo-dev/game/packages/game/cmd/gameproject sync` to write them into `nsgo.yaml`. diff --git a/docs/en/stability.md b/docs/en/stability.md index 7af2a5750..774d4a7fb 100644 --- a/docs/en/stability.md +++ b/docs/en/stability.md @@ -87,6 +87,7 @@ Paths are relative to `github.com/nsgo-dev/game/packages`. The table is checked | `game/cmd/gameapi` | Experimental | | | `game/cmd/gameproject` | Experimental | [Project File](project.md) | | `game/cmd/gameschema` | Experimental | [Schemas for YAML files](schemas.md) | +| `game/cmd/nsgo-game` | Experimental | [Command Line](cli.md) | | `game/cmd/sizecheck` | Experimental | [Package Size Budgets](package-size-budgets.md) | | `game/cmd/wasmprobe` | Experimental | [Package Size Budgets](package-size-budgets.md) | | `game/cutscene` | Experimental | [cutscene](cutscene.md) | diff --git a/docs/en/templates.md b/docs/en/templates.md index 5f5bdd3e1..18f50f237 100644 --- a/docs/en/templates.md +++ b/docs/en/templates.md @@ -72,7 +72,7 @@ nsgo game new -list nsgo game new -template starter mygame ``` -Outside a project, `nsgo game` runs the game layer's release made for that `nsgo` ([Command Line](cli.md#install)); `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest new` runs the same without `nsgo`. +Outside a project, install `nsgo-game` once (`go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest`) for `nsgo game` ([Command Line](cli.md#install)), or run `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest new` directly with nothing to install. Without `-template`, `game new` uses `starter`. A name that is not in the list is refused with the names that are. Shell completion for `game` ([Command Line](cli.md#completion)) completes `-template` with the same names. [Command Line](cli.md#new) describes the other flags. @@ -103,7 +103,7 @@ template/ ├─ …_test.go ├─ README.md └─ .gitignore -packages/game/cmd/game/ +packages/game/internal/gamecli/ ├─ templates.go the registry: one entry per template └─ _templates/projects/ ├─ starter/ a copy of template/template @@ -118,8 +118,8 @@ A template is added in one pull request of its own: 1. Create the module: `template//go.mod` declaring `module github.com/nsgo-dev/game/template/` with the `go` line of `template/go.mod`, and the project in `template//template/`. Its name is lower-case letters, digits and `-`, starting with a letter, and not `template`. 2. Add `./template/` to the `use` list of `go.work`. -3. Copy the project into the `game` command, from `packages/game/cmd/game`: `cp -R ../../../../template//template _templates/projects/`. -4. Add one entry to `projectTemplates` in `packages/game/cmd/game/templates.go`: `newProjectTemplate("", templateModuleRoot+"/", "")`. +3. Copy the project into the `game` CLI package, from `packages/game/internal/gamecli`: `cp -R ../../../../template//template _templates/projects/`. +4. Add one entry to `projectTemplates` in `packages/game/internal/gamecli/templates.go`: `newProjectTemplate("", templateModuleRoot+"/", "")`. 5. Add a row for the template to the table above, in `docs/en/templates.md` and `docs/zh/templates.md`, and a fragment under `changelog.d/`. The project in `template//template/` follows these rules, which the tests check where they can: @@ -130,6 +130,6 @@ The project in `template//template/` follows these rules, which the tests - `main.go`, `README.md`, `.gitignore` and tests are there, and `go run ./cmd/game index ../../template` from `packages/game` has nothing left to do. - Every file the template's author writes is text, as for any project in this repository. -The tests of `packages/game/cmd/game` fail when any of these steps is missing: when the copy under `_templates/projects` differs from the module's `template` directory by a byte, when a `template/*/template` directory has no registry entry, when a registry entry has no copy, module or `go.work` entry, and when this page or its Chinese counterpart has no row naming a template and its module. They also create a project from every template, build it against the local game layer and run its tests. +The tests of `packages/game/internal/gamecli` fail when any of these steps is missing: when the copy under `_templates/projects` differs from the module's `template` directory by a byte, when a `template/*/template` directory has no registry entry, when a registry entry has no copy, module or `go.work` entry, and when this page or its Chinese counterpart has no row naming a template and its module. They also create a project from every template, build it against the local game layer and run its tests. CI's `templates` job needs no edit for a new template: it lists `template/template` and every `template/*/template` directory and tests each template the way a developer's project gets it: it copies the template out of the workspace, renders `go.mod` for `example.com/game`, and runs `go tool nsgo test ./...` with `GOWORK=off`, so the project builds against the game layer version `go.mod.tmpl` pins rather than this checkout. A template that needs a package not yet published bumps that pin once the package is on `main`. diff --git a/docs/zh/cli-reference.md b/docs/zh/cli-reference.md index 2dc768871..33d4c0164 100644 --- a/docs/zh/cli-reference.md +++ b/docs/zh/cli-reference.md @@ -1,6 +1,6 @@ # 命令参考 - + `nsgo game`(与 `go tool game` 等价)的每个子命令及其用法行和参数,由命令定义生成,因此始终与 `game help` 的输出一致;说明文字取自命令自身的英文帮助。如何安装命令、各子命令的用途以及如何设置 shell 补全,见[命令行](cli.md)。 diff --git a/docs/zh/cli.md b/docs/zh/cli.md index 90ac71322..ba09f21e1 100644 --- a/docs/zh/cli.md +++ b/docs/zh/cli.md @@ -4,16 +4,23 @@ ## 安装 -以 `nsgo game` 运行这个命令,它是 NSGo 自带的 `nsgo` 从 v0.3.3 起提供的命令(nsgo-dev/nsgo#2366)。`nsgo` 只需安装一次:用 Homebrew(`brew install nsgo-dev/tap/nsgo`),在 macOS 和 Linux 上用安装脚本(`curl -fsSL https://nsgo.dev/install.sh | sh`),或在任何系统上用 Go(`go install github.com/nsgo-dev/nsgo/cmd/nsgo@latest`),见 [NSGo 的安装说明](https://nsgo.dev/zh/docs/getting-started/#安装-nsgo)。在项目中,`nsgo game` 运行模块的 `go.mod` 所声明的 `game` 工具: +通过 NSGo 的扩展机制(自 NSGo v0.3.3 起)以 `nsgo game` 运行这个命令。`nsgo` 只需安装一次:用 Homebrew(`brew install nsgo-dev/tap/nsgo`),在 macOS 和 Linux 上用安装脚本(`curl -fsSL https://nsgo.dev/install.sh | sh`),或在任何系统上用 Go(`go install github.com/nsgo-dev/nsgo/cmd/nsgo@latest`),见 [NSGo 的安装说明](https://nsgo.dev/zh/docs/getting-started/#安装-nsgo)。在 `go.mod` 声明了 `game` 工具的项目中,`nsgo game` 会自动运行该模块固定的工具(`go tool github.com/nsgo-dev/game/packages/game/cmd/game`): ```sh go get -tool github.com/nsgo-dev/game/packages/game/cmd/game nsgo game help ``` -`go.mod` 里的 `tool` 一行把命令固定在模块所用的游戏层版本上,参与这个游戏的每个人运行的都是同一个命令。用 [`game new`](#new) 创建的项目已经包含这一行。版本与项目 `go.mod` 所固定版本不同的 `nsgo` 会改为运行项目自己的 `nsgo`,所以项目的 `nsgo` 工具也需要 v0.3.3 或更新版本;每个模板的 `go.mod` 和游戏层本身都要求 v0.3.4,这是第一个软件渲染器和窗口深度缓冲都能正确绘制 3D 场景的版本。在项目之外,例如创建项目时,`nsgo game` 用 `go run` 运行为这个 `nsgo` 发布的游戏层版本,无需另外安装任何东西。 +`go.mod` 里的 `tool` 一行把命令固定在模块所用的游戏层版本上,参与这个游戏的每个人运行的都是同一个命令。用 [`game new`](#new) 创建的项目已经包含这一行。版本与项目 `go.mod` 所固定版本不同的 `nsgo` 会改为运行项目自己的 `nsgo`,所以项目的 `nsgo` 工具也需要 v0.3.3 或更新版本;每个模板的 `go.mod` 和游戏层本身都要求 v0.3.4,这是第一个软件渲染器和窗口深度缓冲都能正确绘制 3D 场景的版本。 -在项目中,`go tool game` 不经 `nsgo` 运行同一个命令;在任何地方,`go run github.com/nsgo-dev/game/packages/game/cmd/game@latest` 也可以。 +在项目之外(例如先用 `nsgo game new` 创建项目之前),把 `nsgo-game` 扩展二进制安装一次到 `PATH` 上,`nsgo game` 就能自动找到它: + +```sh +go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest +nsgo game new mygame +``` + +也可以在任何地方直接运行 `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest`,无需预先安装。在项目中,`go tool game` 不经 `nsgo` 同样运行这个命令。 ## 命令 @@ -193,7 +200,7 @@ nsgo game new -list 用一个模板生成项目并写入指定目录,目录不存在时会创建,并打印每个文件的路径。随后在该目录运行 `go get -tool github.com/nsgo-dev/game/packages/game/cmd/game@` 和 `go mod tidy`,这两步需要访问 Go 模块代理。这样项目依赖该版本的游戏层,`game` 工具与 `nsgo` 工具并列,无需修改即可用 `go tool nsgo dev` 构建运行。 -游戏名称默认取目录名,`-name` 可以另行指定(字母、数字、空格、`-` 和 `_`,以字母开头)。名称写入 `game.yaml` 和 `nsgo.yaml` 的 `name`,`id` 由它派生为 `dev.nsgo.<去掉空格和标点的小写名称>`。模块路径默认是小写名称、单词之间用 `-` 连接,`-module` 可以另行指定。与标准库包同名的模块路径(例如名为 Time 的游戏得到的 `time`)会被拒绝,因为这样的项目无法构建,此时需要用 `-module` 指定,例如 `-module example.com/time`。`-version` 是要依赖的游戏层版本,例如 `v0.4.0`、某个提交或 `latest`;默认是正在运行的命令自身的版本,所以 `go run …@v0.4.0 new`,或在项目之外设置 `NSGO_GAME_VERSION=v0.4.0` 运行的 `nsgo game new`,创建的项目使用 `v0.4.0`,而从本仓库的检出构建的命令则使用 `latest`。`-template` 选择模板,默认是 `starter`;未知的模板名会被拒绝,并列出现有的模板名。`-list` 打印每个模板的名称(标出默认模板)和一行说明,不创建任何文件。[项目模板](templates.md)列出了所有模板以及 `nsgo init -template` 对应的模块,并说明模板的目录结构和如何新增模板。 +游戏名称默认取目录名,`-name` 可以另行指定(字母、数字、空格、`-` 和 `_`,以字母开头)。名称写入 `game.yaml` 和 `nsgo.yaml` 的 `name`,`id` 由它派生为 `dev.nsgo.<去掉空格和标点的小写名称>`。模块路径默认是小写名称、单词之间用 `-` 连接,`-module` 可以另行指定。与标准库包同名的模块路径(例如名为 Time 的游戏得到的 `time`)会被拒绝,因为这样的项目无法构建,此时需要用 `-module` 指定,例如 `-module example.com/time`。`-version` 是要依赖的游戏层版本,例如 `v0.4.0`、某个提交或 `latest`;默认是正在运行的命令自身的版本,所以 `go run …@v0.4.0 new` 或以 `v0.4.0` 安装的 `nsgo-game` 创建的项目使用 `v0.4.0`,而从本仓库的检出构建的命令则使用 `latest`。`-template` 选择模板,默认是 `starter`;未知的模板名会被拒绝,并列出现有的模板名。`-list` 打印每个模板的名称(标出默认模板)和一行说明,不创建任何文件。[项目模板](templates.md)列出了所有模板以及 `nsgo init -template` 对应的模块,并说明模板的目录结构和如何新增模板。 只要目录中已经存在任何一个将要写入的文件,`new` 就什么也不写,并以 1 退出。每个模板都包含把 `*.scene.yaml` 和 `*.scene.yml` 注册给 `nsgo-scene` 合并驱动的 `.gitattributes`,若目标目录中已存在 `.git` 仓库,`new` 还会自动写入本地 Git 配置(否则在 `git init` 后运行一次 `go tool game merge -setup`)。`go get` 或 `go mod tidy` 失败时(例如没有网络),已写入的文件会保留,错误信息会列出还需在该目录运行的命令以完成项目:`go get` 失败时是 `go get -tool …` 和 `go mod tidy` 两条,`go mod tidy` 失败时只有它一条。 diff --git a/docs/zh/getting-started.md b/docs/zh/getting-started.md index b6a721306..12ef0de37 100644 --- a/docs/zh/getting-started.md +++ b/docs/zh/getting-started.md @@ -21,7 +21,7 @@ cd mygame go tool nsgo dev ``` -`go run github.com/nsgo-dev/game/packages/game/cmd/game@latest new mygame` 不经 `nsgo` 做同样的事。 +在项目之外,`nsgo game` 使用 `PATH` 上的 `nsgo-game` 扩展二进制(用 `go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest` 安装一次),也可以直接运行 `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest new mygame`,无需预先安装。在创建好的项目内,`nsgo game` 会自动运行模块固定的 `game` 工具。 起手模板包含精灵动画、点击得分和测试。它的设置都在[项目文件](project.md) `game.yaml` 中,`nsgo.yaml` 与之保持一致。`new` 用目录名作为这两个文件里的 `name` 和 `id`,以及模块路径;`-name` 和 `-module` 可以另行指定,例如 `-module example.com/mygame`。所有参数见[命令行](cli.md#new);`-template` 可以从其他[项目模板](templates.md)开始,`new -list` 会列出它们。发布游戏之前,把应用标识改成你自己的:在 `game.yaml` 中修改游戏名称和应用标识,然后运行 `go run github.com/nsgo-dev/game/packages/game/cmd/gameproject sync` 把它们写入 `nsgo.yaml`。 diff --git a/docs/zh/stability.md b/docs/zh/stability.md index 8ac5c1e2b..f4ee4a04e 100644 --- a/docs/zh/stability.md +++ b/docs/zh/stability.md @@ -87,6 +87,7 @@ | `game/cmd/gameapi` | 实验性 | | | `game/cmd/gameproject` | 实验性 | [项目文件](project.md) | | `game/cmd/gameschema` | 实验性 | [YAML 文件的 Schema](schemas.md) | +| `game/cmd/nsgo-game` | 实验性 | [命令行](cli.md) | | `game/cmd/sizecheck` | 实验性 | [包体积预算](package-size-budgets.md) | | `game/cmd/wasmprobe` | 实验性 | [包体积预算](package-size-budgets.md) | | `game/cutscene` | 实验性 | [cutscene](cutscene.md) | diff --git a/docs/zh/templates.md b/docs/zh/templates.md index 971febb37..f46b474a4 100644 --- a/docs/zh/templates.md +++ b/docs/zh/templates.md @@ -72,7 +72,7 @@ nsgo game new -list nsgo game new -template starter mygame ``` -在项目之外,`nsgo game` 运行为这个 `nsgo` 发布的游戏层版本(见[命令行](cli.md#安装));`go run github.com/nsgo-dev/game/packages/game/cmd/game@latest new` 不经 `nsgo` 运行同一个命令。 +在项目之外,安装一次 `nsgo-game`(`go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest`)即可使用 `nsgo game`(见[命令行](cli.md#安装));也可以直接运行 `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest new`,无需预先安装。 不加 `-template` 时,`game new` 使用 `starter`。不在列表中的名称会被拒绝,并列出现有的模板名。`game` 的 shell 补全(见[命令行](cli.md#completion))会用同样的名称补全 `-template`。其他参数见[命令行](cli.md#new)。 @@ -103,7 +103,7 @@ template/ ├─ …_test.go ├─ README.md └─ .gitignore -packages/game/cmd/game/ +packages/game/internal/gamecli/ ├─ templates.go 注册表:每个模板一条 └─ _templates/projects/ ├─ starter/ template/template 的副本 @@ -118,8 +118,8 @@ packages/game/cmd/game/ 1. 创建模块:`template//go.mod` 声明 `module github.com/nsgo-dev/game/template/`,`go` 行与 `template/go.mod` 相同,项目放在 `template//template/`。名称只能用小写字母、数字和 `-`,以字母开头,且不能是 `template`。 2. 把 `./template/` 加入 `go.work` 的 `use` 列表。 -3. 在 `packages/game/cmd/game` 中把项目复制进 `game` 命令:`cp -R ../../../../template//template _templates/projects/`。 -4. 在 `packages/game/cmd/game/templates.go` 的 `projectTemplates` 中加一条:`newProjectTemplate("", templateModuleRoot+"/", "<一行英文,说明这是什么游戏>")`。 +3. 在 `packages/game/internal/gamecli` 中把项目复制进 `game` 命令包:`cp -R ../../../../template//template _templates/projects/`。 +4. 在 `packages/game/internal/gamecli/templates.go` 的 `projectTemplates` 中加一条:`newProjectTemplate("", templateModuleRoot+"/", "<一行英文,说明这是什么游戏>")`。 5. 在 `docs/en/templates.md` 和 `docs/zh/templates.md` 上面的表格中为模板各加一行,并在 `changelog.d/` 下加一个片段。 `template//template/` 中的项目遵循以下规则,测试会尽可能检查它们: @@ -130,6 +130,6 @@ packages/game/cmd/game/ - 包含 `main.go`、`README.md`、`.gitignore` 和测试,并且在 `packages/game` 中运行 `go run ./cmd/game index ../../template` 无事可做。 - 模板作者编写的每个文件都是文本,与本仓库中的任何项目一样。 -缺少上述任何一步时,`packages/game/cmd/game` 的测试都会失败:`_templates/projects` 下的副本与模块的 `template` 目录有任何一个字节不同;某个 `template/*/template` 目录没有注册;某条注册没有副本、模块或 `go.work` 条目;本页或其英文版中没有写明模板及其模块的那一行。测试还会用每个模板创建项目,用本地游戏层构建并运行它的测试。 +缺少上述任何一步时,`packages/game/internal/gamecli` 的测试都会失败:`_templates/projects` 下的副本与模块的 `template` 目录有任何一个字节不同;某个 `template/*/template` 目录没有注册;某条注册没有副本、模块或 `go.work` 条目;本页或其英文版中没有写明模板及其模块的那一行。测试还会用每个模板创建项目,用本地游戏层构建并运行它的测试。 新增模板无需修改 CI:`templates` 任务列出 `template/template` 和每个 `template/*/template` 目录,并以开发者拿到项目的方式测试每个模板:把模板复制到工作区之外,为 `example.com/game` 渲染 `go.mod`,并在 `GOWORK=off` 下运行 `go tool nsgo test ./...`,因此项目依赖的是 `go.mod.tmpl` 固定的游戏层版本,而不是当前检出的代码。如果模板需要尚未发布的包,等该包合入 `main` 后再提升这个固定版本。 diff --git a/packages/game/cmd/game/main.go b/packages/game/cmd/game/main.go index 1ba1363a4..5fa531f8c 100644 --- a/packages/game/cmd/game/main.go +++ b/packages/game/cmd/game/main.go @@ -1,197 +1,8 @@ -// Command game is the game layer's command-line tool, run as `nsgo game` or `go tool game` from a module that adds it as a tool. Its subcommands pack sprite atlases (pack), convert audio (audio), generate asset manifests (manifest), encode KTX2 textures (tex), open the scene editor (editor), build release packages for every platform (release), play input recordings headless (replay), run bot playtests headless with replays and YAML reports (playtest), check benchmarks against a stored baseline (bench), create a game project from a template (new), run the game with asset hot reload (dev), check scenes, maps and atlases and the references between them (check), serve the editor's MCP tools to an agent (mcp), build all of a project's assets from game.yaml, rebuilding only what changed (assets), write a new component, system, scene or prefab into a project (generate), move a file and rewrite the references to it (mv), keep the project index of stable file IDs (index), install asset, editor plugin and template packs from a library into a project (library), list every asset's author and license as a credits file (credits), render pixelfx effects to sprite sheets (pixelfx), bake a scene's navigation meshes (navmesh), merge scene YAML files object by object for Git (merge) and write shell completion scripts (completion); `game help` lists them and `game help ` shows one command's flags. +// Command game is the game layer's command-line tool, run as `nsgo game` (via NSGo's extension mechanism) or `go tool game` from a module that adds it as a tool, or directly with `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest`. Its subcommands pack sprite atlases (pack), convert audio (audio), generate asset manifests (manifest), encode KTX2 textures (tex), open the scene editor (editor), build release packages for every platform (release), play input recordings headless (replay), run bot playtests headless with replays and YAML reports (playtest), check benchmarks against a stored baseline (bench), create a game project from a template (new), run the game with asset hot reload (dev), check scenes, maps and atlases and the references between them (check), serve the editor's MCP tools to an agent (mcp), build all of a project's assets from game.yaml, rebuilding only what changed (assets), write a new component, system, scene or prefab into a project (generate), move a file and rewrite the references to it (mv), keep the project index of stable file IDs (index), install asset, editor plugin and template packs from a library into a project (library), list every asset's author and license as a credits file (credits), render pixelfx effects to sprite sheets (pixelfx), bake a scene's navigation meshes (navmesh), merge scene YAML files object by object for Git (merge) and write shell completion scripts (completion); `game help` lists them and `game help ` shows one command's flags. package main -import ( - "errors" - "flag" - "fmt" - "io" - "os" - "text/tabwriter" - - "github.com/nsgo-dev/game/packages/game/editor" - "github.com/nsgo-dev/game/packages/game/editor/editorcmd" - "github.com/nsgo-dev/game/packages/game/tooling/audioconv" -) - -// app is what the subcommands write to, and the parts a test replaces: the audio encoder and how the editor is shown. -type app struct { - // stdin is what the mcp subcommand reads its client's messages from. - stdin io.Reader - stdout, stderr io.Writer - // audio converts audio files for the audio subcommand. - audio *audioconv.Encoder - // launch shows the editor and returns once it closes. - launch func(ed *editor.Editor) - // nsgo runs `go tool nsgo` with args, for the replay and bench subcommands. - nsgo func(args []string, stdout, stderr io.Writer) error - // nsgoEnv runs `go tool nsgo` with extra KEY=VALUE environment entries, for the playtest subcommand. - nsgoEnv func(env []string, args []string, stdout, stderr io.Writer) error - // goRun runs the go command with args in dir, for the editor subcommand to run a project's own editor command. - goRun func(dir string, args []string, stdout, stderr io.Writer) error - // recentProjectsPath overrides the per-user recent projects YAML file path used by `game editor` (tests set it inside t.TempDir()). - recentProjectsPath string - // layoutPath overrides the per-user editor dock layout YAML file path used by `game editor` (tests set it inside t.TempDir()). - layoutPath string -} - -// command is one subcommand of game. -type command struct { - // name is the word after game that runs it. - name string - // args is what follows its flags in its usage line, if anything. - args string - // summary is the one line game help shows for it. - summary string - // define adds the command's flags to fs and returns what runs once they are parsed, which reads the arguments left from fs.Args. - define func(a *app, fs *flag.FlagSet) func() error - // complete is what shell completion offers for a flag's value, keyed by the flag's name, and for the arguments after the flags, keyed by "". The shared -in and -out flags complete file paths without an entry; any other flag, or the arguments, with no entry complete nothing. - complete map[string]completion -} - -// commands are game's subcommands in the order game help lists them, help itself last. -var commands = []*command{packCommand, audioCommand, manifestCommand, texCommand, editorCommand, mcpCommand, releaseCommand, replayCommand, playtestCommand, benchCommand, newCommand, devCommand, checkCommand, assetsCommand, generateCommand, mvCommand, indexCommand, libraryCommand, creditsCommand, pixelfxCommand, navmeshCommand, mergeCommand} - -// helpSummary is the help subcommand's line in the listing. -const helpSummary = "Show the commands, or one command's flags" - -// usageError is a mistake in how a command was called: it exits 2 and shows the command's usage. -type usageError struct{ msg string } - -func (e *usageError) Error() string { return e.msg } - -// usagef returns a usageError with a formatted message. -func usagef(format string, args ...any) error { - return &usageError{msg: fmt.Sprintf(format, args...)} -} +import "github.com/nsgo-dev/game/packages/game/internal/gamecli" func main() { - os.Exit(run(os.Args[1:], &app{ - stdin: os.Stdin, - stdout: os.Stdout, - stderr: os.Stderr, - audio: &audioconv.Encoder{}, - launch: editorcmd.Show, - nsgo: runGoToolNSGo, - nsgoEnv: runGoToolNSGoEnv, - goRun: runGoIn, - })) -} - -// run runs game with args, the arguments after its name, and returns the exit code: 0 on success or help asked for, 1 when a command fails, 2 when it is called wrongly. -func run(args []string, a *app) int { - if len(args) == 0 { - printUsage(a.stderr) - return 2 - } - name, rest := args[0], args[1:] - switch name { - case "help", "-h", "-help", "--help": - return help(rest, a) - } - c := lookup(name) - if c == nil { - fmt.Fprintf(a.stderr, "game: unknown command %q\nRun 'game help' for the commands.\n", name) - return 2 - } - fs := newFlagSet(c, a.stderr) - exec := c.define(a, fs) - if err := fs.Parse(rest); err != nil { - if errors.Is(err, flag.ErrHelp) { - return 0 - } - return 2 - } - if err := exec(); err != nil { - fmt.Fprintf(a.stderr, "game %s: %v\n", c.name, err) - if _, ok := errors.AsType[*usageError](err); ok { - fs.Usage() - return 2 - } - return 1 - } - return 0 -} - -// help runs game help: the listing with no arguments, else the usage of the one command named. -func help(args []string, a *app) int { - switch len(args) { - case 0: - printUsage(a.stdout) - return 0 - case 1: - if args[0] == "help" { - fmt.Fprintf(a.stdout, "usage: game help [command]\n\n%s.\n", helpSummary) - return 0 - } - c := lookup(args[0]) - if c == nil { - fmt.Fprintf(a.stderr, "game help: unknown command %q\nRun 'game help' for the commands.\n", args[0]) - return 2 - } - fs := newFlagSet(c, a.stdout) - c.define(a, fs) - fs.Usage() - return 0 - default: - fmt.Fprintln(a.stderr, "usage: game help [command]") - return 2 - } -} - -// lookup returns the command called name, or nil. -func lookup(name string) *command { - for _, c := range commands { - if c.name == name { - return c - } - } - return nil -} - -// printUsage writes game's usage and the list of its commands to w. -func printUsage(w io.Writer) { - fmt.Fprint(w, "usage: game [flags] [arguments]\n\nCommands:\n") - tw := tabwriter.NewWriter(w, 0, 0, 2, ' ', 0) - for _, c := range commands { - fmt.Fprintf(tw, " %s\t%s\n", c.name, c.summary) - } - fmt.Fprintf(tw, " help\t%s\n", helpSummary) - _ = tw.Flush() - fmt.Fprint(w, "\nRun 'game help ' for a command's flags.\n") -} - -// newFlagSet returns the flag set for c, writing errors and usage to w: every command's usage is its usage line, its summary and its flags. -func newFlagSet(c *command, w io.Writer) *flag.FlagSet { - fs := flag.NewFlagSet("game "+c.name, flag.ContinueOnError) - fs.SetOutput(w) - fs.Usage = func() { - fmt.Fprintf(w, "usage: %s\n\n%s.\n", c.usage(), c.summary) - hasFlags := false - fs.VisitAll(func(*flag.Flag) { hasFlags = true }) - if hasFlags { - fmt.Fprint(w, "\nFlags:\n") - fs.PrintDefaults() - } - } - return fs -} - -// usage returns how c is called, its usage line without the "usage: " in front. -func (c *command) usage() string { - line := "game " + c.name + " [flags]" - if c.args != "" { - line += " " + c.args - } - return line -} - -// inFlag adds the -in flag the commands share for what they read. -func inFlag(fs *flag.FlagSet, value, usage string) *string { - return fs.String("in", value, usage) -} - -// outFlag adds the -out flag the commands share for what they write. -func outFlag(fs *flag.FlagSet, value, usage string) *string { - return fs.String("out", value, usage) + gamecli.Main() } diff --git a/packages/game/cmd/game/main_test.go b/packages/game/cmd/game/main_test.go index cd4d7130c..6c6df3d1c 100644 --- a/packages/game/cmd/game/main_test.go +++ b/packages/game/cmd/game/main_test.go @@ -1,132 +1,26 @@ package main import ( - "bytes" - "io" + "os/exec" "path/filepath" + "runtime" "strings" "testing" - - "github.com/nsgo-dev/game/packages/game/editor" - "github.com/nsgo-dev/game/packages/game/tooling/audioconv" ) -// newTestApp returns an app writing to buffers it also returns, whose editor launch fails the test: tests that open the editor replace it. -func newTestApp(t *testing.T) (*app, *bytes.Buffer, *bytes.Buffer) { - t.Helper() - var stdout, stderr bytes.Buffer - return &app{ - stdout: &stdout, - stderr: &stderr, - audio: &audioconv.Encoder{}, - launch: func(*editor.Editor) { t.Error("editor launched") }, - nsgo: func(args []string, _, _ io.Writer) error { - t.Errorf("go tool nsgo %v ran", args) - return nil - }, - goRun: func(dir string, args []string, _, _ io.Writer) error { - t.Errorf("go %v ran in %s", args, dir) - return nil - }, - recentProjectsPath: filepath.Join(t.TempDir(), "recent-projects.yaml"), - layoutPath: filepath.Join(t.TempDir(), "layout.yaml"), - }, &stdout, &stderr -} - -func TestHelpListsEveryCommand(t *testing.T) { - for _, args := range [][]string{{"help"}, {"-h"}, {"-help"}, {"--help"}} { - a, stdout, stderr := newTestApp(t) - if code := run(args, a); code != 0 { - t.Fatalf("%v exit %d (stderr: %s)", args, code, stderr) - } - out := stdout.String() - for _, c := range commands { - if !strings.Contains(out, "\n "+c.name+" ") || !strings.Contains(out, c.summary) { - t.Errorf("%v does not list %s:\n%s", args, c.name, out) - } - } - if !strings.Contains(out, "\n help ") { - t.Errorf("%v does not list help:\n%s", args, out) - } - if stderr.Len() != 0 { - t.Errorf("%v wrote to stderr: %q", args, stderr) - } +func TestBuildAndHelp(t *testing.T) { + bin := filepath.Join(t.TempDir(), "game") + if runtime.GOOS == "windows" { + bin += ".exe" } -} - -func TestEveryFormerCommandIsASubcommand(t *testing.T) { - want := []string{"pack", "audio", "manifest", "tex", "editor", "mcp", "release", "replay", "playtest", "bench", "new", "dev", "check", "assets", "generate", "mv", "index", "library", "credits", "pixelfx", "navmesh", "merge", "completion"} - if len(commands) != len(want) { - t.Fatalf("%d commands, want %d", len(commands), len(want)) + if out, err := exec.Command("go", "build", "-o", bin, ".").CombinedOutput(); err != nil { + t.Fatalf("go build ./cmd/game: %v\n%s", err, out) } - for i, name := range want { - if commands[i].name != name { - t.Errorf("commands[%d] = %s, want %s", i, commands[i].name, name) - } - if lookup(name) != commands[i] { - t.Errorf("lookup(%q) does not find it", name) - } - } -} - -func TestHelpForEachCommand(t *testing.T) { - for _, c := range commands { - a, stdout, stderr := newTestApp(t) - if code := run([]string{"help", c.name}, a); code != 0 { - t.Fatalf("help %s exit %d (stderr: %s)", c.name, code, stderr) - } - out := stdout.String() - if !strings.HasPrefix(out, "usage: game "+c.name+" [flags]") || !strings.Contains(out, c.summary) { - t.Errorf("help %s:\n%s", c.name, out) - } - - // -h on the command shows the same usage, on stderr as the flag package writes it. - a, _, stderr = newTestApp(t) - if code := run([]string{c.name, "-h"}, a); code != 0 { - t.Fatalf("%s -h exit %d", c.name, code) - } - if stderr.String() != out { - t.Errorf("%s -h = %q, want help's %q", c.name, stderr, out) - } - } - - a, stdout, _ := newTestApp(t) - if code := run([]string{"help", "pack"}, a); code != 0 { - t.Fatal(code) - } - for _, flag := range []string{"-in", "-out", "-padding", "-trim"} { - if !strings.Contains(stdout.String(), " "+flag+" ") && !strings.Contains(stdout.String(), " "+flag+"\n") { - t.Errorf("help pack does not show %s:\n%s", flag, stdout) - } - } - - a, stdout, _ = newTestApp(t) - if code := run([]string{"help", "help"}, a); code != 0 || !strings.HasPrefix(stdout.String(), "usage: game help") { - t.Fatalf("help help exit %d:\n%s", code, stdout) - } -} - -func TestUsageErrors(t *testing.T) { - cases := []struct { - args []string - want string - }{ - {nil, "usage: game "}, - {[]string{"build"}, `game: unknown command "build"`}, - {[]string{"help", "build"}, `game help: unknown command "build"`}, - {[]string{"help", "pack", "audio"}, "usage: game help [command]"}, - {[]string{"pack", "-nope"}, "flag provided but not defined: -nope"}, + out, err := exec.Command(bin, "help").CombinedOutput() + if err != nil { + t.Fatalf("game help: %v\n%s", err, out) } - for _, tc := range cases { - a, stdout, stderr := newTestApp(t) - if code := run(tc.args, a); code != 2 { - t.Errorf("%q exit %d, want 2", tc.args, code) - } - if !strings.Contains(stderr.String(), tc.want) { - t.Errorf("%q stderr = %q, want %q", tc.args, stderr, tc.want) - } - if stdout.Len() != 0 { - t.Errorf("%q wrote to stdout: %q", tc.args, stdout) - } + if !strings.Contains(string(out), "usage: game ") { + t.Errorf("game help output = %q, want usage line", out) } } diff --git a/packages/game/cmd/nsgo-game/main.go b/packages/game/cmd/nsgo-game/main.go new file mode 100644 index 000000000..f41262ea5 --- /dev/null +++ b/packages/game/cmd/nsgo-game/main.go @@ -0,0 +1,8 @@ +// Command nsgo-game installs the `nsgo-game` extension binary on PATH so `nsgo game` works outside a Go module (for example, to run `nsgo game new` before creating a project) via NSGo's extension mechanism. Inside a module whose go.mod declares `tool github.com/nsgo-dev/game/packages/game/cmd/game`, `nsgo game` runs the module's pinned `game` tool instead. +package main + +import "github.com/nsgo-dev/game/packages/game/internal/gamecli" + +func main() { + gamecli.Main() +} diff --git a/packages/game/cmd/nsgo-game/main_test.go b/packages/game/cmd/nsgo-game/main_test.go new file mode 100644 index 000000000..0c3d8c66c --- /dev/null +++ b/packages/game/cmd/nsgo-game/main_test.go @@ -0,0 +1,26 @@ +package main + +import ( + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" +) + +func TestBuildAndHelp(t *testing.T) { + bin := filepath.Join(t.TempDir(), "nsgo-game") + if runtime.GOOS == "windows" { + bin += ".exe" + } + if out, err := exec.Command("go", "build", "-o", bin, ".").CombinedOutput(); err != nil { + t.Fatalf("go build ./cmd/nsgo-game: %v\n%s", err, out) + } + out, err := exec.Command(bin, "help").CombinedOutput() + if err != nil { + t.Fatalf("nsgo-game help: %v\n%s", err, out) + } + if !strings.Contains(string(out), "usage: game ") { + t.Errorf("nsgo-game help output = %q, want usage line", out) + } +} diff --git a/packages/game/conformance_test.go b/packages/game/conformance_test.go index 2885715f7..be1ff0302 100644 --- a/packages/game/conformance_test.go +++ b/packages/game/conformance_test.go @@ -21,7 +21,7 @@ const ( // notFormats are the packages that decode YAML without defining a format of their own, each with the reason, so they need not run formattest.Run. Every other package that decodes YAML must. var notFormats = map[string]string{ - "cmd/game": "reads single settings out of game.yaml and nsgo.yaml, whose formats package project and NSGo define", + "internal/gamecli": "reads single settings out of game.yaml and nsgo.yaml, whose formats package project and NSGo define", "internal/formattest": "the conformance checks themselves, which decode a document to edit it", "internal/releaseplan": "reads single settings out of nsgo.yaml, whose format NSGo defines", "loaderr": "decodes a document only to find a field's line and column for an error", diff --git a/packages/game/cmd/game/_templates/generate/component.go.tmpl b/packages/game/internal/gamecli/_templates/generate/component.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/component.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/component.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/component_test.go.tmpl b/packages/game/internal/gamecli/_templates/generate/component_test.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/component_test.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/component_test.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/components.go.tmpl b/packages/game/internal/gamecli/_templates/generate/components.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/components.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/components.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/editor.go.tmpl b/packages/game/internal/gamecli/_templates/generate/editor.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/editor.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/editor.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/editor_test.go.tmpl b/packages/game/internal/gamecli/_templates/generate/editor_test.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/editor_test.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/editor_test.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/prefab.go.tmpl b/packages/game/internal/gamecli/_templates/generate/prefab.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/prefab.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/prefab.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/prefab_test.go.tmpl b/packages/game/internal/gamecli/_templates/generate/prefab_test.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/prefab_test.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/prefab_test.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/prefabs.go.tmpl b/packages/game/internal/gamecli/_templates/generate/prefabs.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/prefabs.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/prefabs.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/scene.go.tmpl b/packages/game/internal/gamecli/_templates/generate/scene.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/scene.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/scene.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/scene_test.go.tmpl b/packages/game/internal/gamecli/_templates/generate/scene_test.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/scene_test.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/scene_test.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/system.go.tmpl b/packages/game/internal/gamecli/_templates/generate/system.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/system.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/system.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/system_test.go.tmpl b/packages/game/internal/gamecli/_templates/generate/system_test.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/system_test.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/system_test.go.tmpl diff --git a/packages/game/cmd/game/_templates/generate/systems.go.tmpl b/packages/game/internal/gamecli/_templates/generate/systems.go.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/generate/systems.go.tmpl rename to packages/game/internal/gamecli/_templates/generate/systems.go.tmpl diff --git a/packages/game/cmd/game/_templates/projects/action3d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/action3d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/action3d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/action3d/.gitignore b/packages/game/internal/gamecli/_templates/projects/action3d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/action3d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/action3d/README.md b/packages/game/internal/gamecli/_templates/projects/action3d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/README.md rename to packages/game/internal/gamecli/_templates/projects/action3d/README.md diff --git a/packages/game/cmd/game/_templates/projects/action3d/actors.go b/packages/game/internal/gamecli/_templates/projects/action3d/actors.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/actors.go rename to packages/game/internal/gamecli/_templates/projects/action3d/actors.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/data/actors.yaml b/packages/game/internal/gamecli/_templates/projects/action3d/data/actors.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/data/actors.yaml rename to packages/game/internal/gamecli/_templates/projects/action3d/data/actors.yaml diff --git a/packages/game/cmd/game/_templates/projects/action3d/data_test.go b/packages/game/internal/gamecli/_templates/projects/action3d/data_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/data_test.go rename to packages/game/internal/gamecli/_templates/projects/action3d/data_test.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/game.go b/packages/game/internal/gamecli/_templates/projects/action3d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/game.go rename to packages/game/internal/gamecli/_templates/projects/action3d/game.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/game.index.yaml b/packages/game/internal/gamecli/_templates/projects/action3d/game.index.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/game.index.yaml rename to packages/game/internal/gamecli/_templates/projects/action3d/game.index.yaml diff --git a/packages/game/cmd/game/_templates/projects/action3d/game.yaml b/packages/game/internal/gamecli/_templates/projects/action3d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/action3d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/action3d/game_test.go b/packages/game/internal/gamecli/_templates/projects/action3d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/action3d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/action3d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/action3d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/action3d/go.sum b/packages/game/internal/gamecli/_templates/projects/action3d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/go.sum rename to packages/game/internal/gamecli/_templates/projects/action3d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/action3d/level.go b/packages/game/internal/gamecli/_templates/projects/action3d/level.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/level.go rename to packages/game/internal/gamecli/_templates/projects/action3d/level.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/main.go b/packages/game/internal/gamecli/_templates/projects/action3d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/main.go rename to packages/game/internal/gamecli/_templates/projects/action3d/main.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/action3d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/action3d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/action3d/play_test.go b/packages/game/internal/gamecli/_templates/projects/action3d/play_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/play_test.go rename to packages/game/internal/gamecli/_templates/projects/action3d/play_test.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/project.go b/packages/game/internal/gamecli/_templates/projects/action3d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/project.go rename to packages/game/internal/gamecli/_templates/projects/action3d/project.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/project_test.go b/packages/game/internal/gamecli/_templates/projects/action3d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/action3d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/render.go b/packages/game/internal/gamecli/_templates/projects/action3d/render.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/render.go rename to packages/game/internal/gamecli/_templates/projects/action3d/render.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/render_test.go b/packages/game/internal/gamecli/_templates/projects/action3d/render_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/render_test.go rename to packages/game/internal/gamecli/_templates/projects/action3d/render_test.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/rig.go b/packages/game/internal/gamecli/_templates/projects/action3d/rig.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/rig.go rename to packages/game/internal/gamecli/_templates/projects/action3d/rig.go diff --git a/packages/game/cmd/game/_templates/projects/action3d/scenes/keep.scene.yaml b/packages/game/internal/gamecli/_templates/projects/action3d/scenes/keep.scene.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/scenes/keep.scene.yaml rename to packages/game/internal/gamecli/_templates/projects/action3d/scenes/keep.scene.yaml diff --git a/packages/game/cmd/game/_templates/projects/action3d/view.go b/packages/game/internal/gamecli/_templates/projects/action3d/view.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/action3d/view.go rename to packages/game/internal/gamecli/_templates/projects/action3d/view.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/cards2d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/cards2d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/cards2d/.gitignore b/packages/game/internal/gamecli/_templates/projects/cards2d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/cards2d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/cards2d/README.md b/packages/game/internal/gamecli/_templates/projects/cards2d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/README.md rename to packages/game/internal/gamecli/_templates/projects/cards2d/README.md diff --git a/packages/game/cmd/game/_templates/projects/cards2d/board.yaml b/packages/game/internal/gamecli/_templates/projects/cards2d/board.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/board.yaml rename to packages/game/internal/gamecli/_templates/projects/cards2d/board.yaml diff --git a/packages/game/cmd/game/_templates/projects/cards2d/data_test.go b/packages/game/internal/gamecli/_templates/projects/cards2d/data_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/data_test.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/data_test.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/game.go b/packages/game/internal/gamecli/_templates/projects/cards2d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/game.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/game.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/game.yaml b/packages/game/internal/gamecli/_templates/projects/cards2d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/cards2d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/cards2d/game_test.go b/packages/game/internal/gamecli/_templates/projects/cards2d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/cards2d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/cards2d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/cards2d/go.sum b/packages/game/internal/gamecli/_templates/projects/cards2d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/go.sum rename to packages/game/internal/gamecli/_templates/projects/cards2d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/cards2d/hud.go b/packages/game/internal/gamecli/_templates/projects/cards2d/hud.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/hud.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/hud.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/main.go b/packages/game/internal/gamecli/_templates/projects/cards2d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/main.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/main.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/cards2d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/cards2d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/cards2d/playtest.yaml b/packages/game/internal/gamecli/_templates/projects/cards2d/playtest.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/playtest.yaml rename to packages/game/internal/gamecli/_templates/projects/cards2d/playtest.yaml diff --git a/packages/game/cmd/game/_templates/projects/cards2d/project.go b/packages/game/internal/gamecli/_templates/projects/cards2d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/project.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/project.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/project_test.go b/packages/game/internal/gamecli/_templates/projects/cards2d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/render.go b/packages/game/internal/gamecli/_templates/projects/cards2d/render.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/render.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/render.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/rules.go b/packages/game/internal/gamecli/_templates/projects/cards2d/rules.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/rules.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/rules.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/rules.yaml b/packages/game/internal/gamecli/_templates/projects/cards2d/rules.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/rules.yaml rename to packages/game/internal/gamecli/_templates/projects/cards2d/rules.yaml diff --git a/packages/game/cmd/game/_templates/projects/cards2d/save.go b/packages/game/internal/gamecli/_templates/projects/cards2d/save.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/save.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/save.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/save_test.go b/packages/game/internal/gamecli/_templates/projects/cards2d/save_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/save_test.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/save_test.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/table.go b/packages/game/internal/gamecli/_templates/projects/cards2d/table.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/table.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/table.go diff --git a/packages/game/cmd/game/_templates/projects/cards2d/table_test.go b/packages/game/internal/gamecli/_templates/projects/cards2d/table_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/cards2d/table_test.go rename to packages/game/internal/gamecli/_templates/projects/cards2d/table_test.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/fighting2d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/fighting2d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/.gitignore b/packages/game/internal/gamecli/_templates/projects/fighting2d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/fighting2d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/README.md b/packages/game/internal/gamecli/_templates/projects/fighting2d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/README.md rename to packages/game/internal/gamecli/_templates/projects/fighting2d/README.md diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/controls.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/controls.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/controls.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/controls.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/cpu.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/cpu.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/cpu.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/cpu.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/data.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/data.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/data.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/data.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/data/basalt.frames.yaml b/packages/game/internal/gamecli/_templates/projects/fighting2d/data/basalt.frames.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/data/basalt.frames.yaml rename to packages/game/internal/gamecli/_templates/projects/fighting2d/data/basalt.frames.yaml diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/data/basalt.moves.yaml b/packages/game/internal/gamecli/_templates/projects/fighting2d/data/basalt.moves.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/data/basalt.moves.yaml rename to packages/game/internal/gamecli/_templates/projects/fighting2d/data/basalt.moves.yaml diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/data/kestrel.frames.yaml b/packages/game/internal/gamecli/_templates/projects/fighting2d/data/kestrel.frames.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/data/kestrel.frames.yaml rename to packages/game/internal/gamecli/_templates/projects/fighting2d/data/kestrel.frames.yaml diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/data/kestrel.moves.yaml b/packages/game/internal/gamecli/_templates/projects/fighting2d/data/kestrel.moves.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/data/kestrel.moves.yaml rename to packages/game/internal/gamecli/_templates/projects/fighting2d/data/kestrel.moves.yaml diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/data/match.yaml b/packages/game/internal/gamecli/_templates/projects/fighting2d/data/match.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/data/match.yaml rename to packages/game/internal/gamecli/_templates/projects/fighting2d/data/match.yaml diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/data_test.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/data_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/data_test.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/data_test.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/draw.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/draw.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/draw.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/draw.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/game.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/game.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/game.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/game.yaml b/packages/game/internal/gamecli/_templates/projects/fighting2d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/fighting2d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/game_test.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/fighting2d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/fighting2d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/go.sum b/packages/game/internal/gamecli/_templates/projects/fighting2d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/go.sum rename to packages/game/internal/gamecli/_templates/projects/fighting2d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/hud.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/hud.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/hud.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/hud.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/main.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/main.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/main.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/match.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/match.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/match.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/match.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/match_test.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/match_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/match_test.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/match_test.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/fighting2d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/fighting2d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/player.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/player.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/player.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/player.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/project.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/project.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/project.go diff --git a/packages/game/cmd/game/_templates/projects/fighting2d/project_test.go b/packages/game/internal/gamecli/_templates/projects/fighting2d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fighting2d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/fighting2d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/fps3d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/fps3d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/fps3d/.gitignore b/packages/game/internal/gamecli/_templates/projects/fps3d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/fps3d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/fps3d/README.md b/packages/game/internal/gamecli/_templates/projects/fps3d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/README.md rename to packages/game/internal/gamecli/_templates/projects/fps3d/README.md diff --git a/packages/game/cmd/game/_templates/projects/fps3d/arena.go b/packages/game/internal/gamecli/_templates/projects/fps3d/arena.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/arena.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/arena.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/arena.yaml b/packages/game/internal/gamecli/_templates/projects/fps3d/arena.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/arena.yaml rename to packages/game/internal/gamecli/_templates/projects/fps3d/arena.yaml diff --git a/packages/game/cmd/game/_templates/projects/fps3d/arena_test.go b/packages/game/internal/gamecli/_templates/projects/fps3d/arena_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/arena_test.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/arena_test.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/bot_test.go b/packages/game/internal/gamecli/_templates/projects/fps3d/bot_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/bot_test.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/bot_test.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/controls.go b/packages/game/internal/gamecli/_templates/projects/fps3d/controls.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/controls.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/controls.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/enemy.go b/packages/game/internal/gamecli/_templates/projects/fps3d/enemy.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/enemy.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/enemy.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/game.go b/packages/game/internal/gamecli/_templates/projects/fps3d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/game.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/game.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/game.yaml b/packages/game/internal/gamecli/_templates/projects/fps3d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/fps3d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/fps3d/game_test.go b/packages/game/internal/gamecli/_templates/projects/fps3d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/fps3d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/fps3d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/fps3d/go.sum b/packages/game/internal/gamecli/_templates/projects/fps3d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/go.sum rename to packages/game/internal/gamecli/_templates/projects/fps3d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/fps3d/main.go b/packages/game/internal/gamecli/_templates/projects/fps3d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/main.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/main.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/match.go b/packages/game/internal/gamecli/_templates/projects/fps3d/match.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/match.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/match.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/match_test.go b/packages/game/internal/gamecli/_templates/projects/fps3d/match_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/match_test.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/match_test.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/fps3d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/fps3d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/fps3d/project.go b/packages/game/internal/gamecli/_templates/projects/fps3d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/project.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/project.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/project_test.go b/packages/game/internal/gamecli/_templates/projects/fps3d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/render.go b/packages/game/internal/gamecli/_templates/projects/fps3d/render.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/render.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/render.go diff --git a/packages/game/cmd/game/_templates/projects/fps3d/render_test.go b/packages/game/internal/gamecli/_templates/projects/fps3d/render_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/fps3d/render_test.go rename to packages/game/internal/gamecli/_templates/projects/fps3d/render_test.go diff --git a/packages/game/cmd/game/_templates/projects/idle/.gitattributes b/packages/game/internal/gamecli/_templates/projects/idle/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/idle/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/idle/.gitignore b/packages/game/internal/gamecli/_templates/projects/idle/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/.gitignore rename to packages/game/internal/gamecli/_templates/projects/idle/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/idle/README.md b/packages/game/internal/gamecli/_templates/projects/idle/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/README.md rename to packages/game/internal/gamecli/_templates/projects/idle/README.md diff --git a/packages/game/cmd/game/_templates/projects/idle/data.go b/packages/game/internal/gamecli/_templates/projects/idle/data.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/data.go rename to packages/game/internal/gamecli/_templates/projects/idle/data.go diff --git a/packages/game/cmd/game/_templates/projects/idle/data_test.go b/packages/game/internal/gamecli/_templates/projects/idle/data_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/data_test.go rename to packages/game/internal/gamecli/_templates/projects/idle/data_test.go diff --git a/packages/game/cmd/game/_templates/projects/idle/game.go b/packages/game/internal/gamecli/_templates/projects/idle/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/game.go rename to packages/game/internal/gamecli/_templates/projects/idle/game.go diff --git a/packages/game/cmd/game/_templates/projects/idle/game.yaml b/packages/game/internal/gamecli/_templates/projects/idle/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/game.yaml rename to packages/game/internal/gamecli/_templates/projects/idle/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/idle/game_test.go b/packages/game/internal/gamecli/_templates/projects/idle/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/game_test.go rename to packages/game/internal/gamecli/_templates/projects/idle/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/idle/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/idle/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/idle/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/idle/go.sum b/packages/game/internal/gamecli/_templates/projects/idle/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/go.sum rename to packages/game/internal/gamecli/_templates/projects/idle/go.sum diff --git a/packages/game/cmd/game/_templates/projects/idle/hearth.yaml b/packages/game/internal/gamecli/_templates/projects/idle/hearth.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/hearth.yaml rename to packages/game/internal/gamecli/_templates/projects/idle/hearth.yaml diff --git a/packages/game/cmd/game/_templates/projects/idle/main.go b/packages/game/internal/gamecli/_templates/projects/idle/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/main.go rename to packages/game/internal/gamecli/_templates/projects/idle/main.go diff --git a/packages/game/cmd/game/_templates/projects/idle/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/idle/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/idle/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/idle/project.go b/packages/game/internal/gamecli/_templates/projects/idle/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/project.go rename to packages/game/internal/gamecli/_templates/projects/idle/project.go diff --git a/packages/game/cmd/game/_templates/projects/idle/project_test.go b/packages/game/internal/gamecli/_templates/projects/idle/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/project_test.go rename to packages/game/internal/gamecli/_templates/projects/idle/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/idle/save.go b/packages/game/internal/gamecli/_templates/projects/idle/save.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/save.go rename to packages/game/internal/gamecli/_templates/projects/idle/save.go diff --git a/packages/game/cmd/game/_templates/projects/idle/shop.go b/packages/game/internal/gamecli/_templates/projects/idle/shop.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/shop.go rename to packages/game/internal/gamecli/_templates/projects/idle/shop.go diff --git a/packages/game/cmd/game/_templates/projects/idle/sim.go b/packages/game/internal/gamecli/_templates/projects/idle/sim.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/sim.go rename to packages/game/internal/gamecli/_templates/projects/idle/sim.go diff --git a/packages/game/cmd/game/_templates/projects/idle/sim_test.go b/packages/game/internal/gamecli/_templates/projects/idle/sim_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/idle/sim_test.go rename to packages/game/internal/gamecli/_templates/projects/idle/sim_test.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/platformer2d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/platformer2d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/.gitignore b/packages/game/internal/gamecli/_templates/projects/platformer2d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/platformer2d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/README.md b/packages/game/internal/gamecli/_templates/projects/platformer2d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/README.md rename to packages/game/internal/gamecli/_templates/projects/platformer2d/README.md diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/art.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/art.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/art.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/art.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/data.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/data.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/data.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/data.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/data/level.yaml b/packages/game/internal/gamecli/_templates/projects/platformer2d/data/level.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/data/level.yaml rename to packages/game/internal/gamecli/_templates/projects/platformer2d/data/level.yaml diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/data/player.yaml b/packages/game/internal/gamecli/_templates/projects/platformer2d/data/player.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/data/player.yaml rename to packages/game/internal/gamecli/_templates/projects/platformer2d/data/player.yaml diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/data/rooms.yaml b/packages/game/internal/gamecli/_templates/projects/platformer2d/data/rooms.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/data/rooms.yaml rename to packages/game/internal/gamecli/_templates/projects/platformer2d/data/rooms.yaml diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/draw.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/draw.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/draw.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/draw.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/game.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/game.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/game.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/game.yaml b/packages/game/internal/gamecli/_templates/projects/platformer2d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/platformer2d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/game_test.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/platformer2d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/platformer2d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/go.sum b/packages/game/internal/gamecli/_templates/projects/platformer2d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/go.sum rename to packages/game/internal/gamecli/_templates/projects/platformer2d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/level.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/level.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/level.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/level.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/level_test.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/level_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/level_test.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/level_test.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/main.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/main.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/main.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/platformer2d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/platformer2d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/project.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/project.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/project.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/project_test.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/world.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/world.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/world.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/world.go diff --git a/packages/game/cmd/game/_templates/projects/platformer2d/world_test.go b/packages/game/internal/gamecli/_templates/projects/platformer2d/world_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/platformer2d/world_test.go rename to packages/game/internal/gamecli/_templates/projects/platformer2d/world_test.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/puzzle2d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/.gitignore b/packages/game/internal/gamecli/_templates/projects/puzzle2d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/README.md b/packages/game/internal/gamecli/_templates/projects/puzzle2d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/README.md rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/README.md diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/board.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/board.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/board.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/board.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/board_test.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/board_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/board_test.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/board_test.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/draw.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/draw.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/draw.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/draw.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/game.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/game.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/game.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/game.yaml b/packages/game/internal/gamecli/_templates/projects/puzzle2d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/game_test.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/puzzle2d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/go.sum b/packages/game/internal/gamecli/_templates/projects/puzzle2d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/go.sum rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/levels.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/levels.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/levels.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/levels.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/levels.yaml b/packages/game/internal/gamecli/_templates/projects/puzzle2d/levels.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/levels.yaml rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/levels.yaml diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/levels_test.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/levels_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/levels_test.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/levels_test.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/main.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/main.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/main.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/puzzle2d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/playtest.yaml b/packages/game/internal/gamecli/_templates/projects/puzzle2d/playtest.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/playtest.yaml rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/playtest.yaml diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/progress.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/progress.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/progress.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/progress.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/project.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/project.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/project.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/project_test.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/puzzle2d/ui.go b/packages/game/internal/gamecli/_templates/projects/puzzle2d/ui.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/puzzle2d/ui.go rename to packages/game/internal/gamecli/_templates/projects/puzzle2d/ui.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/racing3d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/racing3d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/racing3d/.gitignore b/packages/game/internal/gamecli/_templates/projects/racing3d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/racing3d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/racing3d/CREDITS.md b/packages/game/internal/gamecli/_templates/projects/racing3d/CREDITS.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/CREDITS.md rename to packages/game/internal/gamecli/_templates/projects/racing3d/CREDITS.md diff --git a/packages/game/cmd/game/_templates/projects/racing3d/README.md b/packages/game/internal/gamecli/_templates/projects/racing3d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/README.md rename to packages/game/internal/gamecli/_templates/projects/racing3d/README.md diff --git a/packages/game/cmd/game/_templates/projects/racing3d/course.go b/packages/game/internal/gamecli/_templates/projects/racing3d/course.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/course.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/course.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/data/car.yaml b/packages/game/internal/gamecli/_templates/projects/racing3d/data/car.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/data/car.yaml rename to packages/game/internal/gamecli/_templates/projects/racing3d/data/car.yaml diff --git a/packages/game/cmd/game/_templates/projects/racing3d/data/track.yaml b/packages/game/internal/gamecli/_templates/projects/racing3d/data/track.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/data/track.yaml rename to packages/game/internal/gamecli/_templates/projects/racing3d/data/track.yaml diff --git a/packages/game/cmd/game/_templates/projects/racing3d/driver.go b/packages/game/internal/gamecli/_templates/projects/racing3d/driver.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/driver.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/driver.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/game.go b/packages/game/internal/gamecli/_templates/projects/racing3d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/game.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/game.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/game.yaml b/packages/game/internal/gamecli/_templates/projects/racing3d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/racing3d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/racing3d/game_test.go b/packages/game/internal/gamecli/_templates/projects/racing3d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/racing3d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/racing3d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/racing3d/go.sum b/packages/game/internal/gamecli/_templates/projects/racing3d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/go.sum rename to packages/game/internal/gamecli/_templates/projects/racing3d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/racing3d/main.go b/packages/game/internal/gamecli/_templates/projects/racing3d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/main.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/main.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/meshes.go b/packages/game/internal/gamecli/_templates/projects/racing3d/meshes.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/meshes.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/meshes.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/racing3d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/racing3d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/racing3d/project.go b/packages/game/internal/gamecli/_templates/projects/racing3d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/project.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/project.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/project_test.go b/packages/game/internal/gamecli/_templates/projects/racing3d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/race.go b/packages/game/internal/gamecli/_templates/projects/racing3d/race.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/race.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/race.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/race_test.go b/packages/game/internal/gamecli/_templates/projects/racing3d/race_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/race_test.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/race_test.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/renderer.go b/packages/game/internal/gamecli/_templates/projects/racing3d/renderer.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/renderer.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/renderer.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/scene.go b/packages/game/internal/gamecli/_templates/projects/racing3d/scene.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/scene.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/scene.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/track.go b/packages/game/internal/gamecli/_templates/projects/racing3d/track.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/track.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/track.go diff --git a/packages/game/cmd/game/_templates/projects/racing3d/track_test.go b/packages/game/internal/gamecli/_templates/projects/racing3d/track_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/racing3d/track_test.go rename to packages/game/internal/gamecli/_templates/projects/racing3d/track_test.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/.gitattributes b/packages/game/internal/gamecli/_templates/projects/rhythm/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/rhythm/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/rhythm/.gitignore b/packages/game/internal/gamecli/_templates/projects/rhythm/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/.gitignore rename to packages/game/internal/gamecli/_templates/projects/rhythm/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/rhythm/README.md b/packages/game/internal/gamecli/_templates/projects/rhythm/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/README.md rename to packages/game/internal/gamecli/_templates/projects/rhythm/README.md diff --git a/packages/game/cmd/game/_templates/projects/rhythm/draw.go b/packages/game/internal/gamecli/_templates/projects/rhythm/draw.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/draw.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/draw.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/game.go b/packages/game/internal/gamecli/_templates/projects/rhythm/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/game.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/game.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/game.yaml b/packages/game/internal/gamecli/_templates/projects/rhythm/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/game.yaml rename to packages/game/internal/gamecli/_templates/projects/rhythm/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/rhythm/game_test.go b/packages/game/internal/gamecli/_templates/projects/rhythm/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/game_test.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/rhythm/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/rhythm/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/rhythm/go.sum b/packages/game/internal/gamecli/_templates/projects/rhythm/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/go.sum rename to packages/game/internal/gamecli/_templates/projects/rhythm/go.sum diff --git a/packages/game/cmd/game/_templates/projects/rhythm/main.go b/packages/game/internal/gamecli/_templates/projects/rhythm/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/main.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/main.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/rhythm/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/rhythm/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/rhythm/project.go b/packages/game/internal/gamecli/_templates/projects/rhythm/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/project.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/project.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/project_test.go b/packages/game/internal/gamecli/_templates/projects/rhythm/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/project_test.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/records.go b/packages/game/internal/gamecli/_templates/projects/rhythm/records.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/records.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/records.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/run.go b/packages/game/internal/gamecli/_templates/projects/rhythm/run.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/run.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/run.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/run_test.go b/packages/game/internal/gamecli/_templates/projects/rhythm/run_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/run_test.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/run_test.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/songs.go b/packages/game/internal/gamecli/_templates/projects/rhythm/songs.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/songs.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/songs.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/songs.yaml b/packages/game/internal/gamecli/_templates/projects/rhythm/songs.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/songs.yaml rename to packages/game/internal/gamecli/_templates/projects/rhythm/songs.yaml diff --git a/packages/game/cmd/game/_templates/projects/rhythm/songs/night-drive.beatmap.yaml b/packages/game/internal/gamecli/_templates/projects/rhythm/songs/night-drive.beatmap.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/songs/night-drive.beatmap.yaml rename to packages/game/internal/gamecli/_templates/projects/rhythm/songs/night-drive.beatmap.yaml diff --git a/packages/game/cmd/game/_templates/projects/rhythm/songs_test.go b/packages/game/internal/gamecli/_templates/projects/rhythm/songs_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/songs_test.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/songs_test.go diff --git a/packages/game/cmd/game/_templates/projects/rhythm/ui.go b/packages/game/internal/gamecli/_templates/projects/rhythm/ui.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rhythm/ui.go rename to packages/game/internal/gamecli/_templates/projects/rhythm/ui.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/roguelike2d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/.gitignore b/packages/game/internal/gamecli/_templates/projects/roguelike2d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/README.md b/packages/game/internal/gamecli/_templates/projects/roguelike2d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/README.md rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/README.md diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/actors.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/actors.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/actors.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/actors.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/bot_test.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/bot_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/bot_test.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/bot_test.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/data.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/data.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/data.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/data.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/data/abilities.yaml b/packages/game/internal/gamecli/_templates/projects/roguelike2d/data/abilities.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/data/abilities.yaml rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/data/abilities.yaml diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/data/dungeon.yaml b/packages/game/internal/gamecli/_templates/projects/roguelike2d/data/dungeon.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/data/dungeon.yaml rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/data/dungeon.yaml diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/data/loot.yaml b/packages/game/internal/gamecli/_templates/projects/roguelike2d/data/loot.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/data/loot.yaml rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/data/loot.yaml diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/data/stats.yaml b/packages/game/internal/gamecli/_templates/projects/roguelike2d/data/stats.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/data/stats.yaml rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/data/stats.yaml diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/data_test.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/data_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/data_test.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/data_test.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/draw.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/draw.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/draw.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/draw.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/dungeon.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/dungeon.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/dungeon.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/dungeon.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/floor.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/floor.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/floor.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/floor.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/game.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/game.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/game.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/game.yaml b/packages/game/internal/gamecli/_templates/projects/roguelike2d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/game_test.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/roguelike2d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/go.sum b/packages/game/internal/gamecli/_templates/projects/roguelike2d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/go.sum rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/main.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/main.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/main.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/roguelike2d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/project.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/project.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/project.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/project_test.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/records.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/records.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/records.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/records.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/run.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/run.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/run.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/run.go diff --git a/packages/game/cmd/game/_templates/projects/roguelike2d/run_test.go b/packages/game/internal/gamecli/_templates/projects/roguelike2d/run_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/roguelike2d/run_test.go rename to packages/game/internal/gamecli/_templates/projects/roguelike2d/run_test.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/rpg2d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/rpg2d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/.gitignore b/packages/game/internal/gamecli/_templates/projects/rpg2d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/rpg2d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/README.md b/packages/game/internal/gamecli/_templates/projects/rpg2d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/README.md rename to packages/game/internal/gamecli/_templates/projects/rpg2d/README.md diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/art.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/art.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/art.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/art.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/data.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/data.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/data.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/data.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/data/cast.yaml b/packages/game/internal/gamecli/_templates/projects/rpg2d/data/cast.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/data/cast.yaml rename to packages/game/internal/gamecli/_templates/projects/rpg2d/data/cast.yaml diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/data/dialogue.yarn b/packages/game/internal/gamecli/_templates/projects/rpg2d/data/dialogue.yarn similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/data/dialogue.yarn rename to packages/game/internal/gamecli/_templates/projects/rpg2d/data/dialogue.yarn diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/data/items.yaml b/packages/game/internal/gamecli/_templates/projects/rpg2d/data/items.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/data/items.yaml rename to packages/game/internal/gamecli/_templates/projects/rpg2d/data/items.yaml diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/data/quests.yaml b/packages/game/internal/gamecli/_templates/projects/rpg2d/data/quests.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/data/quests.yaml rename to packages/game/internal/gamecli/_templates/projects/rpg2d/data/quests.yaml diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/data/stats.yaml b/packages/game/internal/gamecli/_templates/projects/rpg2d/data/stats.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/data/stats.yaml rename to packages/game/internal/gamecli/_templates/projects/rpg2d/data/stats.yaml diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/data/world.yaml b/packages/game/internal/gamecli/_templates/projects/rpg2d/data/world.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/data/world.yaml rename to packages/game/internal/gamecli/_templates/projects/rpg2d/data/world.yaml diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/data_test.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/data_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/data_test.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/data_test.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/draw.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/draw.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/draw.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/draw.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/game.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/game.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/game.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/game.yaml b/packages/game/internal/gamecli/_templates/projects/rpg2d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/rpg2d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/rpg2d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/rpg2d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/go.sum b/packages/game/internal/gamecli/_templates/projects/rpg2d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/go.sum rename to packages/game/internal/gamecli/_templates/projects/rpg2d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/input.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/input.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/input.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/input.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/main.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/main.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/main.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/menu.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/menu.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/menu.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/menu.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/rpg2d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/rpg2d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/play_test.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/play_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/play_test.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/play_test.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/playtest.yaml b/packages/game/internal/gamecli/_templates/projects/rpg2d/playtest.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/playtest.yaml rename to packages/game/internal/gamecli/_templates/projects/rpg2d/playtest.yaml diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/project.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/project.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/project.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/project_test.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/rules_test.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/rules_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/rules_test.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/rules_test.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/save.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/save.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/save.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/save.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/ui.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/ui.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/ui.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/ui.go diff --git a/packages/game/cmd/game/_templates/projects/rpg2d/world.go b/packages/game/internal/gamecli/_templates/projects/rpg2d/world.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rpg2d/world.go rename to packages/game/internal/gamecli/_templates/projects/rpg2d/world.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/rts2d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/rts2d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/rts2d/.gitignore b/packages/game/internal/gamecli/_templates/projects/rts2d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/rts2d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/rts2d/README.md b/packages/game/internal/gamecli/_templates/projects/rts2d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/README.md rename to packages/game/internal/gamecli/_templates/projects/rts2d/README.md diff --git a/packages/game/cmd/game/_templates/projects/rts2d/control.go b/packages/game/internal/gamecli/_templates/projects/rts2d/control.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/control.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/control.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/data.go b/packages/game/internal/gamecli/_templates/projects/rts2d/data.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/data.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/data.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/data/formations.yaml b/packages/game/internal/gamecli/_templates/projects/rts2d/data/formations.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/data/formations.yaml rename to packages/game/internal/gamecli/_templates/projects/rts2d/data/formations.yaml diff --git a/packages/game/cmd/game/_templates/projects/rts2d/data/map.yaml b/packages/game/internal/gamecli/_templates/projects/rts2d/data/map.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/data/map.yaml rename to packages/game/internal/gamecli/_templates/projects/rts2d/data/map.yaml diff --git a/packages/game/cmd/game/_templates/projects/rts2d/data/opponent.yaml b/packages/game/internal/gamecli/_templates/projects/rts2d/data/opponent.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/data/opponent.yaml rename to packages/game/internal/gamecli/_templates/projects/rts2d/data/opponent.yaml diff --git a/packages/game/cmd/game/_templates/projects/rts2d/data/rules.yaml b/packages/game/internal/gamecli/_templates/projects/rts2d/data/rules.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/data/rules.yaml rename to packages/game/internal/gamecli/_templates/projects/rts2d/data/rules.yaml diff --git a/packages/game/cmd/game/_templates/projects/rts2d/data_test.go b/packages/game/internal/gamecli/_templates/projects/rts2d/data_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/data_test.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/data_test.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/draw.go b/packages/game/internal/gamecli/_templates/projects/rts2d/draw.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/draw.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/draw.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/game.yaml b/packages/game/internal/gamecli/_templates/projects/rts2d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/rts2d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/rts2d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/rts2d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/rts2d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/rts2d/go.sum b/packages/game/internal/gamecli/_templates/projects/rts2d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/go.sum rename to packages/game/internal/gamecli/_templates/projects/rts2d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/rts2d/input_test.go b/packages/game/internal/gamecli/_templates/projects/rts2d/input_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/input_test.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/input_test.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/main.go b/packages/game/internal/gamecli/_templates/projects/rts2d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/main.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/main.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/rts2d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/rts2d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/rts2d/opponent.go b/packages/game/internal/gamecli/_templates/projects/rts2d/opponent.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/opponent.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/opponent.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/opponent_test.go b/packages/game/internal/gamecli/_templates/projects/rts2d/opponent_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/opponent_test.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/opponent_test.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/orders.go b/packages/game/internal/gamecli/_templates/projects/rts2d/orders.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/orders.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/orders.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/playthrough_test.go b/packages/game/internal/gamecli/_templates/projects/rts2d/playthrough_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/playthrough_test.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/playthrough_test.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/project.go b/packages/game/internal/gamecli/_templates/projects/rts2d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/project.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/project.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/project_test.go b/packages/game/internal/gamecli/_templates/projects/rts2d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/view.go b/packages/game/internal/gamecli/_templates/projects/rts2d/view.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/view.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/view.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/world.go b/packages/game/internal/gamecli/_templates/projects/rts2d/world.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/world.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/world.go diff --git a/packages/game/cmd/game/_templates/projects/rts2d/world_test.go b/packages/game/internal/gamecli/_templates/projects/rts2d/world_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/rts2d/world_test.go rename to packages/game/internal/gamecli/_templates/projects/rts2d/world_test.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/shmup2d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/shmup2d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/.gitignore b/packages/game/internal/gamecli/_templates/projects/shmup2d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/shmup2d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/CREDITS.md b/packages/game/internal/gamecli/_templates/projects/shmup2d/CREDITS.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/CREDITS.md rename to packages/game/internal/gamecli/_templates/projects/shmup2d/CREDITS.md diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/README.md b/packages/game/internal/gamecli/_templates/projects/shmup2d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/README.md rename to packages/game/internal/gamecli/_templates/projects/shmup2d/README.md diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/art.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/art.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/art.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/art.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/audio.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/audio.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/audio.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/audio.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/controls.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/controls.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/controls.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/controls.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/data.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/data.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/data.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/data.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/data/explosion.yaml b/packages/game/internal/gamecli/_templates/projects/shmup2d/data/explosion.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/data/explosion.yaml rename to packages/game/internal/gamecli/_templates/projects/shmup2d/data/explosion.yaml diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/data/patterns.yaml b/packages/game/internal/gamecli/_templates/projects/shmup2d/data/patterns.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/data/patterns.yaml rename to packages/game/internal/gamecli/_templates/projects/shmup2d/data/patterns.yaml diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/data/stage.yaml b/packages/game/internal/gamecli/_templates/projects/shmup2d/data/stage.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/data/stage.yaml rename to packages/game/internal/gamecli/_templates/projects/shmup2d/data/stage.yaml diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/draw.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/draw.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/draw.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/draw.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/game.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/game.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/game.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/game.yaml b/packages/game/internal/gamecli/_templates/projects/shmup2d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/shmup2d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/game_test.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/shmup2d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/shmup2d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/go.sum b/packages/game/internal/gamecli/_templates/projects/shmup2d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/go.sum rename to packages/game/internal/gamecli/_templates/projects/shmup2d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/hud.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/hud.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/hud.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/hud.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/main.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/main.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/main.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/shmup2d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/shmup2d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/pilot_test.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/pilot_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/pilot_test.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/pilot_test.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/playtest.yaml b/packages/game/internal/gamecli/_templates/projects/shmup2d/playtest.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/playtest.yaml rename to packages/game/internal/gamecli/_templates/projects/shmup2d/playtest.yaml diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/project.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/project.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/project.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/project_test.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/stage.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/stage.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/stage.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/stage.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/stage_test.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/stage_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/stage_test.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/stage_test.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/world.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/world.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/world.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/world.go diff --git a/packages/game/cmd/game/_templates/projects/shmup2d/world_test.go b/packages/game/internal/gamecli/_templates/projects/shmup2d/world_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/shmup2d/world_test.go rename to packages/game/internal/gamecli/_templates/projects/shmup2d/world_test.go diff --git a/packages/game/cmd/game/_templates/projects/starter/.gitattributes b/packages/game/internal/gamecli/_templates/projects/starter/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/starter/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/starter/.gitignore b/packages/game/internal/gamecli/_templates/projects/starter/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/.gitignore rename to packages/game/internal/gamecli/_templates/projects/starter/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/starter/README.md b/packages/game/internal/gamecli/_templates/projects/starter/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/README.md rename to packages/game/internal/gamecli/_templates/projects/starter/README.md diff --git a/packages/game/cmd/game/_templates/projects/starter/game.go b/packages/game/internal/gamecli/_templates/projects/starter/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/game.go rename to packages/game/internal/gamecli/_templates/projects/starter/game.go diff --git a/packages/game/cmd/game/_templates/projects/starter/game.yaml b/packages/game/internal/gamecli/_templates/projects/starter/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/game.yaml rename to packages/game/internal/gamecli/_templates/projects/starter/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/starter/game_test.go b/packages/game/internal/gamecli/_templates/projects/starter/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/game_test.go rename to packages/game/internal/gamecli/_templates/projects/starter/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/starter/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/starter/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/starter/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/starter/go.sum b/packages/game/internal/gamecli/_templates/projects/starter/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/go.sum rename to packages/game/internal/gamecli/_templates/projects/starter/go.sum diff --git a/packages/game/cmd/game/_templates/projects/starter/main.go b/packages/game/internal/gamecli/_templates/projects/starter/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/main.go rename to packages/game/internal/gamecli/_templates/projects/starter/main.go diff --git a/packages/game/cmd/game/_templates/projects/starter/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/starter/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/starter/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/starter/project.go b/packages/game/internal/gamecli/_templates/projects/starter/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/project.go rename to packages/game/internal/gamecli/_templates/projects/starter/project.go diff --git a/packages/game/cmd/game/_templates/projects/starter/project_test.go b/packages/game/internal/gamecli/_templates/projects/starter/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/starter/project_test.go rename to packages/game/internal/gamecli/_templates/projects/starter/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/.gitattributes b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/.gitignore b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/.gitignore rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/README.md b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/README.md rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/README.md diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/art.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/art.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/art.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/art.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/data.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/data.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/data.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/data.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/data/level.yaml b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/data/level.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/data/level.yaml rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/data/level.yaml diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/data/projectiles.yaml b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/data/projectiles.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/data/projectiles.yaml rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/data/projectiles.yaml diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/data/towers.yaml b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/data/towers.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/data/towers.yaml rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/data/towers.yaml diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/data_test.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/data_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/data_test.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/data_test.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/game.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/game.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/game.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/game.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/game.index.yaml b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/game.index.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/game.index.yaml rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/game.index.yaml diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/game.yaml b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/game.yaml rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/game_test.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/game_test.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/go.sum b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/go.sum rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/go.sum diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/main.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/main.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/main.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/plan_test.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/plan_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/plan_test.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/plan_test.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/project.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/project.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/project.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/project_test.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/project_test.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/view.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/view.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/view.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/view.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/world.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/world.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/world.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/world.go diff --git a/packages/game/cmd/game/_templates/projects/towerdefense2d/world_test.go b/packages/game/internal/gamecli/_templates/projects/towerdefense2d/world_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/towerdefense2d/world_test.go rename to packages/game/internal/gamecli/_templates/projects/towerdefense2d/world_test.go diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/.gitattributes b/packages/game/internal/gamecli/_templates/projects/visualnovel/.gitattributes similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/.gitattributes rename to packages/game/internal/gamecli/_templates/projects/visualnovel/.gitattributes diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/.gitignore b/packages/game/internal/gamecli/_templates/projects/visualnovel/.gitignore similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/.gitignore rename to packages/game/internal/gamecli/_templates/projects/visualnovel/.gitignore diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/README.md b/packages/game/internal/gamecli/_templates/projects/visualnovel/README.md similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/README.md rename to packages/game/internal/gamecli/_templates/projects/visualnovel/README.md diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/game.yaml b/packages/game/internal/gamecli/_templates/projects/visualnovel/game.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/game.yaml rename to packages/game/internal/gamecli/_templates/projects/visualnovel/game.yaml diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/game_test.go b/packages/game/internal/gamecli/_templates/projects/visualnovel/game_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/game_test.go rename to packages/game/internal/gamecli/_templates/projects/visualnovel/game_test.go diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/go.mod.tmpl b/packages/game/internal/gamecli/_templates/projects/visualnovel/go.mod.tmpl similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/go.mod.tmpl rename to packages/game/internal/gamecli/_templates/projects/visualnovel/go.mod.tmpl diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/go.sum b/packages/game/internal/gamecli/_templates/projects/visualnovel/go.sum similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/go.sum rename to packages/game/internal/gamecli/_templates/projects/visualnovel/go.sum diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/main.go b/packages/game/internal/gamecli/_templates/projects/visualnovel/main.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/main.go rename to packages/game/internal/gamecli/_templates/projects/visualnovel/main.go diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/novel.go b/packages/game/internal/gamecli/_templates/projects/visualnovel/novel.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/novel.go rename to packages/game/internal/gamecli/_templates/projects/visualnovel/novel.go diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/nsgo.yaml b/packages/game/internal/gamecli/_templates/projects/visualnovel/nsgo.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/nsgo.yaml rename to packages/game/internal/gamecli/_templates/projects/visualnovel/nsgo.yaml diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/project.go b/packages/game/internal/gamecli/_templates/projects/visualnovel/project.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/project.go rename to packages/game/internal/gamecli/_templates/projects/visualnovel/project.go diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/project_test.go b/packages/game/internal/gamecli/_templates/projects/visualnovel/project_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/project_test.go rename to packages/game/internal/gamecli/_templates/projects/visualnovel/project_test.go diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/stage.go b/packages/game/internal/gamecli/_templates/projects/visualnovel/stage.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/stage.go rename to packages/game/internal/gamecli/_templates/projects/visualnovel/stage.go diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/story.go b/packages/game/internal/gamecli/_templates/projects/visualnovel/story.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/story.go rename to packages/game/internal/gamecli/_templates/projects/visualnovel/story.go diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/story/cast.yaml b/packages/game/internal/gamecli/_templates/projects/visualnovel/story/cast.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/story/cast.yaml rename to packages/game/internal/gamecli/_templates/projects/visualnovel/story/cast.yaml diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/story/story.yarn b/packages/game/internal/gamecli/_templates/projects/visualnovel/story/story.yarn similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/story/story.yarn rename to packages/game/internal/gamecli/_templates/projects/visualnovel/story/story.yarn diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/story_test.go b/packages/game/internal/gamecli/_templates/projects/visualnovel/story_test.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/story_test.go rename to packages/game/internal/gamecli/_templates/projects/visualnovel/story_test.go diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/strings/en.yaml b/packages/game/internal/gamecli/_templates/projects/visualnovel/strings/en.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/strings/en.yaml rename to packages/game/internal/gamecli/_templates/projects/visualnovel/strings/en.yaml diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/strings/zh-Hans.yaml b/packages/game/internal/gamecli/_templates/projects/visualnovel/strings/zh-Hans.yaml similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/strings/zh-Hans.yaml rename to packages/game/internal/gamecli/_templates/projects/visualnovel/strings/zh-Hans.yaml diff --git a/packages/game/cmd/game/_templates/projects/visualnovel/ui.go b/packages/game/internal/gamecli/_templates/projects/visualnovel/ui.go similarity index 100% rename from packages/game/cmd/game/_templates/projects/visualnovel/ui.go rename to packages/game/internal/gamecli/_templates/projects/visualnovel/ui.go diff --git a/packages/game/cmd/game/assets.go b/packages/game/internal/gamecli/assets.go similarity index 99% rename from packages/game/cmd/game/assets.go rename to packages/game/internal/gamecli/assets.go index eb0ee66de..adbc93a99 100644 --- a/packages/game/cmd/game/assets.go +++ b/packages/game/internal/gamecli/assets.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "context" diff --git a/packages/game/cmd/game/assets_test.go b/packages/game/internal/gamecli/assets_test.go similarity index 99% rename from packages/game/cmd/game/assets_test.go rename to packages/game/internal/gamecli/assets_test.go index 5c16b543d..af0130195 100644 --- a/packages/game/cmd/game/assets_test.go +++ b/packages/game/internal/gamecli/assets_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "image" diff --git a/packages/game/cmd/game/audio.go b/packages/game/internal/gamecli/audio.go similarity index 99% rename from packages/game/cmd/game/audio.go rename to packages/game/internal/gamecli/audio.go index a8a7139c0..fe4fff901 100644 --- a/packages/game/cmd/game/audio.go +++ b/packages/game/internal/gamecli/audio.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "context" diff --git a/packages/game/cmd/game/audio_test.go b/packages/game/internal/gamecli/audio_test.go similarity index 99% rename from packages/game/cmd/game/audio_test.go rename to packages/game/internal/gamecli/audio_test.go index 78d6ed14a..37321db9c 100644 --- a/packages/game/cmd/game/audio_test.go +++ b/packages/game/internal/gamecli/audio_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "context" diff --git a/packages/game/cmd/game/bench.go b/packages/game/internal/gamecli/bench.go similarity index 99% rename from packages/game/cmd/game/bench.go rename to packages/game/internal/gamecli/bench.go index 1043082f7..8b3513013 100644 --- a/packages/game/cmd/game/bench.go +++ b/packages/game/internal/gamecli/bench.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/bench_test.go b/packages/game/internal/gamecli/bench_test.go similarity index 99% rename from packages/game/cmd/game/bench_test.go rename to packages/game/internal/gamecli/bench_test.go index 33c1a2e1f..35cb3d3cc 100644 --- a/packages/game/cmd/game/bench_test.go +++ b/packages/game/internal/gamecli/bench_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/check.go b/packages/game/internal/gamecli/check.go similarity index 99% rename from packages/game/cmd/game/check.go rename to packages/game/internal/gamecli/check.go index d0b38237e..463dad5d1 100644 --- a/packages/game/cmd/game/check.go +++ b/packages/game/internal/gamecli/check.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/check_test.go b/packages/game/internal/gamecli/check_test.go similarity index 99% rename from packages/game/cmd/game/check_test.go rename to packages/game/internal/gamecli/check_test.go index c13115485..3e4a56937 100644 --- a/packages/game/cmd/game/check_test.go +++ b/packages/game/internal/gamecli/check_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "os" diff --git a/packages/game/cmd/game/completion.go b/packages/game/internal/gamecli/completion.go similarity index 99% rename from packages/game/cmd/game/completion.go rename to packages/game/internal/gamecli/completion.go index 189a93900..cbe9b9198 100644 --- a/packages/game/cmd/game/completion.go +++ b/packages/game/internal/gamecli/completion.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "flag" diff --git a/packages/game/cmd/game/completion_test.go b/packages/game/internal/gamecli/completion_test.go similarity index 99% rename from packages/game/cmd/game/completion_test.go rename to packages/game/internal/gamecli/completion_test.go index 7e5333f43..f4137bc2b 100644 --- a/packages/game/cmd/game/completion_test.go +++ b/packages/game/internal/gamecli/completion_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/credits.go b/packages/game/internal/gamecli/credits.go similarity index 99% rename from packages/game/cmd/game/credits.go rename to packages/game/internal/gamecli/credits.go index 4167d0442..a4b15b429 100644 --- a/packages/game/cmd/game/credits.go +++ b/packages/game/internal/gamecli/credits.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "flag" diff --git a/packages/game/cmd/game/credits_test.go b/packages/game/internal/gamecli/credits_test.go similarity index 99% rename from packages/game/cmd/game/credits_test.go rename to packages/game/internal/gamecli/credits_test.go index 448cbb5cf..d08d4982c 100644 --- a/packages/game/cmd/game/credits_test.go +++ b/packages/game/internal/gamecli/credits_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "image/color" diff --git a/packages/game/cmd/game/dev.go b/packages/game/internal/gamecli/dev.go similarity index 99% rename from packages/game/cmd/game/dev.go rename to packages/game/internal/gamecli/dev.go index 631b239eb..4b994ed0a 100644 --- a/packages/game/cmd/game/dev.go +++ b/packages/game/internal/gamecli/dev.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "context" diff --git a/packages/game/cmd/game/dev_test.go b/packages/game/internal/gamecli/dev_test.go similarity index 99% rename from packages/game/cmd/game/dev_test.go rename to packages/game/internal/gamecli/dev_test.go index 6890ba8f3..a5a98c310 100644 --- a/packages/game/cmd/game/dev_test.go +++ b/packages/game/internal/gamecli/dev_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "context" diff --git a/packages/game/cmd/game/editor.go b/packages/game/internal/gamecli/editor.go similarity index 99% rename from packages/game/cmd/game/editor.go rename to packages/game/internal/gamecli/editor.go index 71b160184..68bf2c5cc 100644 --- a/packages/game/cmd/game/editor.go +++ b/packages/game/internal/gamecli/editor.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "context" diff --git a/packages/game/cmd/game/editor_test.go b/packages/game/internal/gamecli/editor_test.go similarity index 99% rename from packages/game/cmd/game/editor_test.go rename to packages/game/internal/gamecli/editor_test.go index dbcfa3411..6b1793ea4 100644 --- a/packages/game/cmd/game/editor_test.go +++ b/packages/game/internal/gamecli/editor_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/generate.go b/packages/game/internal/gamecli/generate.go similarity index 99% rename from packages/game/cmd/game/generate.go rename to packages/game/internal/gamecli/generate.go index 9e62c7f08..a72c4b21d 100644 --- a/packages/game/cmd/game/generate.go +++ b/packages/game/internal/gamecli/generate.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/generate_editor_test.go b/packages/game/internal/gamecli/generate_editor_test.go similarity index 99% rename from packages/game/cmd/game/generate_editor_test.go rename to packages/game/internal/gamecli/generate_editor_test.go index 0efbbd332..ce00590b6 100644 --- a/packages/game/cmd/game/generate_editor_test.go +++ b/packages/game/internal/gamecli/generate_editor_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/generate_test.go b/packages/game/internal/gamecli/generate_test.go similarity index 99% rename from packages/game/cmd/game/generate_test.go rename to packages/game/internal/gamecli/generate_test.go index 13363f804..32b5d0e0e 100644 --- a/packages/game/cmd/game/generate_test.go +++ b/packages/game/internal/gamecli/generate_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/hud_layout_screenshot_test.go b/packages/game/internal/gamecli/hud_layout_screenshot_test.go similarity index 99% rename from packages/game/cmd/game/hud_layout_screenshot_test.go rename to packages/game/internal/gamecli/hud_layout_screenshot_test.go index cfd234545..26f65ddba 100644 --- a/packages/game/cmd/game/hud_layout_screenshot_test.go +++ b/packages/game/internal/gamecli/hud_layout_screenshot_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "os" diff --git a/packages/game/cmd/game/library.go b/packages/game/internal/gamecli/library.go similarity index 99% rename from packages/game/cmd/game/library.go rename to packages/game/internal/gamecli/library.go index dd824e7aa..7708327fc 100644 --- a/packages/game/cmd/game/library.go +++ b/packages/game/internal/gamecli/library.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "context" diff --git a/packages/game/cmd/game/library_test.go b/packages/game/internal/gamecli/library_test.go similarity index 99% rename from packages/game/cmd/game/library_test.go rename to packages/game/internal/gamecli/library_test.go index bb7b3f25f..9eb368d50 100644 --- a/packages/game/cmd/game/library_test.go +++ b/packages/game/internal/gamecli/library_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "os" diff --git a/packages/game/internal/gamecli/main.go b/packages/game/internal/gamecli/main.go new file mode 100644 index 000000000..94bda589d --- /dev/null +++ b/packages/game/internal/gamecli/main.go @@ -0,0 +1,203 @@ +// Package gamecli implements the game layer's command-line tool, shared by cmd/game (for `go tool game`, `go run`, and `nsgo game` inside a module) and cmd/nsgo-game (the `nsgo-game` extension binary on PATH for `nsgo game` outside a module). +package gamecli + +import ( + "errors" + "flag" + "fmt" + "io" + "os" + "text/tabwriter" + + "github.com/nsgo-dev/game/packages/game/editor" + "github.com/nsgo-dev/game/packages/game/editor/editorcmd" + "github.com/nsgo-dev/game/packages/game/tooling/audioconv" +) + +// app is what the subcommands write to, and the parts a test replaces: the audio encoder and how the editor is shown. +type app struct { + // stdin is what the mcp subcommand reads its client's messages from. + stdin io.Reader + stdout, stderr io.Writer + // audio converts audio files for the audio subcommand. + audio *audioconv.Encoder + // launch shows the editor and returns once it closes. + launch func(ed *editor.Editor) + // nsgo runs `go tool nsgo` with args, for the replay and bench subcommands. + nsgo func(args []string, stdout, stderr io.Writer) error + // nsgoEnv runs `go tool nsgo` with extra KEY=VALUE environment entries, for the playtest subcommand. + nsgoEnv func(env []string, args []string, stdout, stderr io.Writer) error + // goRun runs the go command with args in dir, for the editor subcommand to run a project's own editor command. + goRun func(dir string, args []string, stdout, stderr io.Writer) error + // recentProjectsPath overrides the per-user recent projects YAML file path used by `game editor` (tests set it inside t.TempDir()). + recentProjectsPath string + // layoutPath overrides the per-user editor dock layout YAML file path used by `game editor` (tests set it inside t.TempDir()). + layoutPath string +} + +// command is one subcommand of game. +type command struct { + // name is the word after game that runs it. + name string + // args is what follows its flags in its usage line, if anything. + args string + // summary is the one line game help shows for it. + summary string + // define adds the command's flags to fs and returns what runs once they are parsed, which reads the arguments left from fs.Args. + define func(a *app, fs *flag.FlagSet) func() error + // complete is what shell completion offers for a flag's value, keyed by the flag's name, and for the arguments after the flags, keyed by "". The shared -in and -out flags complete file paths without an entry; any other flag, or the arguments, with no entry complete nothing. + complete map[string]completion +} + +// commands are game's subcommands in the order game help lists them, help itself last. +var commands = []*command{packCommand, audioCommand, manifestCommand, texCommand, editorCommand, mcpCommand, releaseCommand, replayCommand, playtestCommand, benchCommand, newCommand, devCommand, checkCommand, assetsCommand, generateCommand, mvCommand, indexCommand, libraryCommand, creditsCommand, pixelfxCommand, navmeshCommand, mergeCommand} + +// helpSummary is the help subcommand's line in the listing. +const helpSummary = "Show the commands, or one command's flags" + +// usageError is a mistake in how a command was called: it exits 2 and shows the command's usage. +type usageError struct{ msg string } + +func (e *usageError) Error() string { return e.msg } + +// usagef returns a usageError with a formatted message. +func usagef(format string, args ...any) error { + return &usageError{msg: fmt.Sprintf(format, args...)} +} + +// Main runs the game CLI with os.Args[1:] and exits with its exit code. +func Main() { + os.Exit(Run(os.Args[1:])) +} + +// Run runs the game CLI with args (the arguments after the command name) using the standard OS streams and returns the exit code: 0 on success or help, 1 when a command fails, 2 on usage errors. +func Run(args []string) int { + return run(args, &app{ + stdin: os.Stdin, + stdout: os.Stdout, + stderr: os.Stderr, + audio: &audioconv.Encoder{}, + launch: editorcmd.Show, + nsgo: runGoToolNSGo, + nsgoEnv: runGoToolNSGoEnv, + goRun: runGoIn, + }) +} + +// run runs game with args, the arguments after its name, and returns the exit code: 0 on success or help asked for, 1 when a command fails, 2 when it is called wrongly. +func run(args []string, a *app) int { + if len(args) == 0 { + printUsage(a.stderr) + return 2 + } + name, rest := args[0], args[1:] + switch name { + case "help", "-h", "-help", "--help": + return help(rest, a) + } + c := lookup(name) + if c == nil { + fmt.Fprintf(a.stderr, "game: unknown command %q\nRun 'game help' for the commands.\n", name) + return 2 + } + fs := newFlagSet(c, a.stderr) + exec := c.define(a, fs) + if err := fs.Parse(rest); err != nil { + if errors.Is(err, flag.ErrHelp) { + return 0 + } + return 2 + } + if err := exec(); err != nil { + fmt.Fprintf(a.stderr, "game %s: %v\n", c.name, err) + if _, ok := errors.AsType[*usageError](err); ok { + fs.Usage() + return 2 + } + return 1 + } + return 0 +} + +// help runs game help: the listing with no arguments, else the usage of the one command named. +func help(args []string, a *app) int { + switch len(args) { + case 0: + printUsage(a.stdout) + return 0 + case 1: + if args[0] == "help" { + fmt.Fprintf(a.stdout, "usage: game help [command]\n\n%s.\n", helpSummary) + return 0 + } + c := lookup(args[0]) + if c == nil { + fmt.Fprintf(a.stderr, "game help: unknown command %q\nRun 'game help' for the commands.\n", args[0]) + return 2 + } + fs := newFlagSet(c, a.stdout) + c.define(a, fs) + fs.Usage() + return 0 + default: + fmt.Fprintln(a.stderr, "usage: game help [command]") + return 2 + } +} + +// lookup returns the command called name, or nil. +func lookup(name string) *command { + for _, c := range commands { + if c.name == name { + return c + } + } + return nil +} + +// printUsage writes game's usage and the list of its commands to w. +func printUsage(w io.Writer) { + fmt.Fprint(w, "usage: game [flags] [arguments]\n\nCommands:\n") + tw := tabwriter.NewWriter(w, 0, 0, 2, ' ', 0) + for _, c := range commands { + fmt.Fprintf(tw, " %s\t%s\n", c.name, c.summary) + } + fmt.Fprintf(tw, " help\t%s\n", helpSummary) + _ = tw.Flush() + fmt.Fprint(w, "\nRun 'game help ' for a command's flags.\n") +} + +// newFlagSet returns the flag set for c, writing errors and usage to w: every command's usage is its usage line, its summary and its flags. +func newFlagSet(c *command, w io.Writer) *flag.FlagSet { + fs := flag.NewFlagSet("game "+c.name, flag.ContinueOnError) + fs.SetOutput(w) + fs.Usage = func() { + fmt.Fprintf(w, "usage: %s\n\n%s.\n", c.usage(), c.summary) + hasFlags := false + fs.VisitAll(func(*flag.Flag) { hasFlags = true }) + if hasFlags { + fmt.Fprint(w, "\nFlags:\n") + fs.PrintDefaults() + } + } + return fs +} + +// usage returns how c is called, its usage line without the "usage: " in front. +func (c *command) usage() string { + line := "game " + c.name + " [flags]" + if c.args != "" { + line += " " + c.args + } + return line +} + +// inFlag adds the -in flag the commands share for what they read. +func inFlag(fs *flag.FlagSet, value, usage string) *string { + return fs.String("in", value, usage) +} + +// outFlag adds the -out flag the commands share for what they write. +func outFlag(fs *flag.FlagSet, value, usage string) *string { + return fs.String("out", value, usage) +} diff --git a/packages/game/internal/gamecli/main_test.go b/packages/game/internal/gamecli/main_test.go new file mode 100644 index 000000000..6c1d0a7af --- /dev/null +++ b/packages/game/internal/gamecli/main_test.go @@ -0,0 +1,132 @@ +package gamecli + +import ( + "bytes" + "io" + "path/filepath" + "strings" + "testing" + + "github.com/nsgo-dev/game/packages/game/editor" + "github.com/nsgo-dev/game/packages/game/tooling/audioconv" +) + +// newTestApp returns an app writing to buffers it also returns, whose editor launch fails the test: tests that open the editor replace it. +func newTestApp(t *testing.T) (*app, *bytes.Buffer, *bytes.Buffer) { + t.Helper() + var stdout, stderr bytes.Buffer + return &app{ + stdout: &stdout, + stderr: &stderr, + audio: &audioconv.Encoder{}, + launch: func(*editor.Editor) { t.Error("editor launched") }, + nsgo: func(args []string, _, _ io.Writer) error { + t.Errorf("go tool nsgo %v ran", args) + return nil + }, + goRun: func(dir string, args []string, _, _ io.Writer) error { + t.Errorf("go %v ran in %s", args, dir) + return nil + }, + recentProjectsPath: filepath.Join(t.TempDir(), "recent-projects.yaml"), + layoutPath: filepath.Join(t.TempDir(), "layout.yaml"), + }, &stdout, &stderr +} + +func TestHelpListsEveryCommand(t *testing.T) { + for _, args := range [][]string{{"help"}, {"-h"}, {"-help"}, {"--help"}} { + a, stdout, stderr := newTestApp(t) + if code := run(args, a); code != 0 { + t.Fatalf("%v exit %d (stderr: %s)", args, code, stderr) + } + out := stdout.String() + for _, c := range commands { + if !strings.Contains(out, "\n "+c.name+" ") || !strings.Contains(out, c.summary) { + t.Errorf("%v does not list %s:\n%s", args, c.name, out) + } + } + if !strings.Contains(out, "\n help ") { + t.Errorf("%v does not list help:\n%s", args, out) + } + if stderr.Len() != 0 { + t.Errorf("%v wrote to stderr: %q", args, stderr) + } + } +} + +func TestEveryFormerCommandIsASubcommand(t *testing.T) { + want := []string{"pack", "audio", "manifest", "tex", "editor", "mcp", "release", "replay", "playtest", "bench", "new", "dev", "check", "assets", "generate", "mv", "index", "library", "credits", "pixelfx", "navmesh", "merge", "completion"} + if len(commands) != len(want) { + t.Fatalf("%d commands, want %d", len(commands), len(want)) + } + for i, name := range want { + if commands[i].name != name { + t.Errorf("commands[%d] = %s, want %s", i, commands[i].name, name) + } + if lookup(name) != commands[i] { + t.Errorf("lookup(%q) does not find it", name) + } + } +} + +func TestHelpForEachCommand(t *testing.T) { + for _, c := range commands { + a, stdout, stderr := newTestApp(t) + if code := run([]string{"help", c.name}, a); code != 0 { + t.Fatalf("help %s exit %d (stderr: %s)", c.name, code, stderr) + } + out := stdout.String() + if !strings.HasPrefix(out, "usage: game "+c.name+" [flags]") || !strings.Contains(out, c.summary) { + t.Errorf("help %s:\n%s", c.name, out) + } + + // -h on the command shows the same usage, on stderr as the flag package writes it. + a, _, stderr = newTestApp(t) + if code := run([]string{c.name, "-h"}, a); code != 0 { + t.Fatalf("%s -h exit %d", c.name, code) + } + if stderr.String() != out { + t.Errorf("%s -h = %q, want help's %q", c.name, stderr, out) + } + } + + a, stdout, _ := newTestApp(t) + if code := run([]string{"help", "pack"}, a); code != 0 { + t.Fatal(code) + } + for _, flag := range []string{"-in", "-out", "-padding", "-trim"} { + if !strings.Contains(stdout.String(), " "+flag+" ") && !strings.Contains(stdout.String(), " "+flag+"\n") { + t.Errorf("help pack does not show %s:\n%s", flag, stdout) + } + } + + a, stdout, _ = newTestApp(t) + if code := run([]string{"help", "help"}, a); code != 0 || !strings.HasPrefix(stdout.String(), "usage: game help") { + t.Fatalf("help help exit %d:\n%s", code, stdout) + } +} + +func TestUsageErrors(t *testing.T) { + cases := []struct { + args []string + want string + }{ + {nil, "usage: game "}, + {[]string{"build"}, `game: unknown command "build"`}, + {[]string{"help", "build"}, `game help: unknown command "build"`}, + {[]string{"help", "pack", "audio"}, "usage: game help [command]"}, + {[]string{"pack", "-nope"}, "flag provided but not defined: -nope"}, + } + for _, tc := range cases { + a, stdout, stderr := newTestApp(t) + if code := run(tc.args, a); code != 2 { + t.Errorf("%q exit %d, want 2", tc.args, code) + } + if !strings.Contains(stderr.String(), tc.want) { + t.Errorf("%q stderr = %q, want %q", tc.args, stderr, tc.want) + } + if stdout.Len() != 0 { + t.Errorf("%q wrote to stdout: %q", tc.args, stdout) + } + } +} diff --git a/packages/game/cmd/game/manifest.go b/packages/game/internal/gamecli/manifest.go similarity index 99% rename from packages/game/cmd/game/manifest.go rename to packages/game/internal/gamecli/manifest.go index c3ad2955c..93100dbf5 100644 --- a/packages/game/cmd/game/manifest.go +++ b/packages/game/internal/gamecli/manifest.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/manifest_test.go b/packages/game/internal/gamecli/manifest_test.go similarity index 99% rename from packages/game/cmd/game/manifest_test.go rename to packages/game/internal/gamecli/manifest_test.go index 5dbe495bb..272e7c4cb 100644 --- a/packages/game/cmd/game/manifest_test.go +++ b/packages/game/internal/gamecli/manifest_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "os" diff --git a/packages/game/cmd/game/mcp.go b/packages/game/internal/gamecli/mcp.go similarity index 99% rename from packages/game/cmd/game/mcp.go rename to packages/game/internal/gamecli/mcp.go index d2f14b6a1..fda2f69e1 100644 --- a/packages/game/cmd/game/mcp.go +++ b/packages/game/internal/gamecli/mcp.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "context" diff --git a/packages/game/cmd/game/mcp_test.go b/packages/game/internal/gamecli/mcp_test.go similarity index 99% rename from packages/game/cmd/game/mcp_test.go rename to packages/game/internal/gamecli/mcp_test.go index 044f80317..0dabdea61 100644 --- a/packages/game/cmd/game/mcp_test.go +++ b/packages/game/internal/gamecli/mcp_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/merge.go b/packages/game/internal/gamecli/merge.go similarity index 99% rename from packages/game/cmd/game/merge.go rename to packages/game/internal/gamecli/merge.go index d6ca3be23..972e88e6e 100644 --- a/packages/game/cmd/game/merge.go +++ b/packages/game/internal/gamecli/merge.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/merge_test.go b/packages/game/internal/gamecli/merge_test.go similarity index 99% rename from packages/game/cmd/game/merge_test.go rename to packages/game/internal/gamecli/merge_test.go index 6dcc57b68..681f0b800 100644 --- a/packages/game/cmd/game/merge_test.go +++ b/packages/game/internal/gamecli/merge_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" @@ -316,7 +316,7 @@ func TestMergeEndToEndWithGit(t *testing.T) { if runtime.GOOS == "windows" { bin += ".exe" } - buildCmd := exec.Command("go", "build", "-o", bin, ".") + buildCmd := exec.Command("go", "build", "-o", bin, "../../cmd/game") if out, err := buildCmd.CombinedOutput(); err != nil { t.Fatalf("go build cmd/game: %v\n%s", err, out) } diff --git a/packages/game/cmd/game/navmesh.go b/packages/game/internal/gamecli/navmesh.go similarity index 99% rename from packages/game/cmd/game/navmesh.go rename to packages/game/internal/gamecli/navmesh.go index 18b2418ab..f7d967bb3 100644 --- a/packages/game/cmd/game/navmesh.go +++ b/packages/game/internal/gamecli/navmesh.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/navmesh_test.go b/packages/game/internal/gamecli/navmesh_test.go similarity index 99% rename from packages/game/cmd/game/navmesh_test.go rename to packages/game/internal/gamecli/navmesh_test.go index f37da6500..87b25dceb 100644 --- a/packages/game/cmd/game/navmesh_test.go +++ b/packages/game/internal/gamecli/navmesh_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/new.go b/packages/game/internal/gamecli/new.go similarity index 99% rename from packages/game/cmd/game/new.go rename to packages/game/internal/gamecli/new.go index 8aa27c42e..ad163f2c7 100644 --- a/packages/game/cmd/game/new.go +++ b/packages/game/internal/gamecli/new.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/new_test.go b/packages/game/internal/gamecli/new_test.go similarity index 99% rename from packages/game/cmd/game/new_test.go rename to packages/game/internal/gamecli/new_test.go index eae44e8c1..695c8e742 100644 --- a/packages/game/cmd/game/new_test.go +++ b/packages/game/internal/gamecli/new_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/nsgorun.go b/packages/game/internal/gamecli/nsgorun.go similarity index 99% rename from packages/game/cmd/game/nsgorun.go rename to packages/game/internal/gamecli/nsgorun.go index d2499ab5e..63306a5ac 100644 --- a/packages/game/cmd/game/nsgorun.go +++ b/packages/game/internal/gamecli/nsgorun.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/pack.go b/packages/game/internal/gamecli/pack.go similarity index 99% rename from packages/game/cmd/game/pack.go rename to packages/game/internal/gamecli/pack.go index 8231c20ea..e7e36e83d 100644 --- a/packages/game/cmd/game/pack.go +++ b/packages/game/internal/gamecli/pack.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "flag" diff --git a/packages/game/cmd/game/pack_test.go b/packages/game/internal/gamecli/pack_test.go similarity index 99% rename from packages/game/cmd/game/pack_test.go rename to packages/game/internal/gamecli/pack_test.go index 1ab3d27e0..372a2166f 100644 --- a/packages/game/cmd/game/pack_test.go +++ b/packages/game/internal/gamecli/pack_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "image" diff --git a/packages/game/cmd/game/pixelfx.go b/packages/game/internal/gamecli/pixelfx.go similarity index 99% rename from packages/game/cmd/game/pixelfx.go rename to packages/game/internal/gamecli/pixelfx.go index f86b9d135..5397671c0 100644 --- a/packages/game/cmd/game/pixelfx.go +++ b/packages/game/internal/gamecli/pixelfx.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "flag" diff --git a/packages/game/cmd/game/pixelfx_test.go b/packages/game/internal/gamecli/pixelfx_test.go similarity index 99% rename from packages/game/cmd/game/pixelfx_test.go rename to packages/game/internal/gamecli/pixelfx_test.go index 8d45152c9..75927a444 100644 --- a/packages/game/cmd/game/pixelfx_test.go +++ b/packages/game/internal/gamecli/pixelfx_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "encoding/json" diff --git a/packages/game/cmd/game/playtest.go b/packages/game/internal/gamecli/playtest.go similarity index 99% rename from packages/game/cmd/game/playtest.go rename to packages/game/internal/gamecli/playtest.go index dede2b282..b3b79d435 100644 --- a/packages/game/cmd/game/playtest.go +++ b/packages/game/internal/gamecli/playtest.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/playtest_test.go b/packages/game/internal/gamecli/playtest_test.go similarity index 99% rename from packages/game/cmd/game/playtest_test.go rename to packages/game/internal/gamecli/playtest_test.go index e8ef1651a..32d44f20e 100644 --- a/packages/game/cmd/game/playtest_test.go +++ b/packages/game/internal/gamecli/playtest_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "io" diff --git a/packages/game/cmd/game/profiler_screenshot_test.go b/packages/game/internal/gamecli/profiler_screenshot_test.go similarity index 99% rename from packages/game/cmd/game/profiler_screenshot_test.go rename to packages/game/internal/gamecli/profiler_screenshot_test.go index 8019c5f35..8b29a079b 100644 --- a/packages/game/cmd/game/profiler_screenshot_test.go +++ b/packages/game/internal/gamecli/profiler_screenshot_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "context" diff --git a/packages/game/cmd/game/reference.go b/packages/game/internal/gamecli/reference.go similarity index 96% rename from packages/game/cmd/game/reference.go rename to packages/game/internal/gamecli/reference.go index da5f5bf2a..98bd82e2f 100644 --- a/packages/game/cmd/game/reference.go +++ b/packages/game/internal/gamecli/reference.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "fmt" @@ -43,7 +43,7 @@ var referenceTexts = []referenceText{ } // referenceHeader follows the title of every generated reference page, telling a reader of the Markdown not to edit it by hand. It comes after the title because the website reads a page's first line as its title. -const referenceHeader = "\n" +const referenceHeader = "\n" // writeReference writes the Markdown command reference for specs in the wording of t. func writeReference(w io.Writer, t referenceText, specs []commandSpec) { diff --git a/packages/game/cmd/game/reference_test.go b/packages/game/internal/gamecli/reference_test.go similarity index 96% rename from packages/game/cmd/game/reference_test.go rename to packages/game/internal/gamecli/reference_test.go index 5fcd6752e..98f40eca1 100644 --- a/packages/game/cmd/game/reference_test.go +++ b/packages/game/internal/gamecli/reference_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "flag" @@ -34,7 +34,7 @@ func TestReference(t *testing.T) { t.Fatalf("%v (run with -update to generate it)", err) } if string(got) != want { - t.Errorf("%s is out of date with the commands' definitions; run go tool nsgo test ./cmd/game -run TestReference -update", path) + t.Errorf("%s is out of date with the commands' definitions; run go tool nsgo test ./internal/gamecli -run TestReference -update", path) } } } diff --git a/packages/game/cmd/game/refs.go b/packages/game/internal/gamecli/refs.go similarity index 99% rename from packages/game/cmd/game/refs.go rename to packages/game/internal/gamecli/refs.go index d91dd3977..f4cb0d4ad 100644 --- a/packages/game/cmd/game/refs.go +++ b/packages/game/internal/gamecli/refs.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/refs_test.go b/packages/game/internal/gamecli/refs_test.go similarity index 99% rename from packages/game/cmd/game/refs_test.go rename to packages/game/internal/gamecli/refs_test.go index 8e8b0c67c..f915275be 100644 --- a/packages/game/cmd/game/refs_test.go +++ b/packages/game/internal/gamecli/refs_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "os" diff --git a/packages/game/cmd/game/release.go b/packages/game/internal/gamecli/release.go similarity index 99% rename from packages/game/cmd/game/release.go rename to packages/game/internal/gamecli/release.go index 8763309cf..773aca637 100644 --- a/packages/game/cmd/game/release.go +++ b/packages/game/internal/gamecli/release.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/release_test.go b/packages/game/internal/gamecli/release_test.go similarity index 99% rename from packages/game/cmd/game/release_test.go rename to packages/game/internal/gamecli/release_test.go index e2ebb977b..8b99fc98f 100644 --- a/packages/game/cmd/game/release_test.go +++ b/packages/game/internal/gamecli/release_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/replay.go b/packages/game/internal/gamecli/replay.go similarity index 99% rename from packages/game/cmd/game/replay.go rename to packages/game/internal/gamecli/replay.go index 69ba04f39..496392732 100644 --- a/packages/game/cmd/game/replay.go +++ b/packages/game/internal/gamecli/replay.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/replay_test.go b/packages/game/internal/gamecli/replay_test.go similarity index 99% rename from packages/game/cmd/game/replay_test.go rename to packages/game/internal/gamecli/replay_test.go index badb0027d..72bdee11e 100644 --- a/packages/game/cmd/game/replay_test.go +++ b/packages/game/internal/gamecli/replay_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/sidecar.go b/packages/game/internal/gamecli/sidecar.go similarity index 98% rename from packages/game/cmd/game/sidecar.go rename to packages/game/internal/gamecli/sidecar.go index 006749437..51ee97f89 100644 --- a/packages/game/cmd/game/sidecar.go +++ b/packages/game/internal/gamecli/sidecar.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "errors" diff --git a/packages/game/cmd/game/sidecar_test.go b/packages/game/internal/gamecli/sidecar_test.go similarity index 99% rename from packages/game/cmd/game/sidecar_test.go rename to packages/game/internal/gamecli/sidecar_test.go index dd627cf50..bcad16ab5 100644 --- a/packages/game/cmd/game/sidecar_test.go +++ b/packages/game/internal/gamecli/sidecar_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "image/png" diff --git a/packages/game/cmd/game/skill_e2e_test.go b/packages/game/internal/gamecli/skill_e2e_test.go similarity index 99% rename from packages/game/cmd/game/skill_e2e_test.go rename to packages/game/internal/gamecli/skill_e2e_test.go index 81f0168a1..cd3410cfe 100644 --- a/packages/game/cmd/game/skill_e2e_test.go +++ b/packages/game/internal/gamecli/skill_e2e_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "encoding/json" diff --git a/packages/game/cmd/game/states_test.go b/packages/game/internal/gamecli/states_test.go similarity index 99% rename from packages/game/cmd/game/states_test.go rename to packages/game/internal/gamecli/states_test.go index e85058a6a..edcba1b6c 100644 --- a/packages/game/cmd/game/states_test.go +++ b/packages/game/internal/gamecli/states_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/templates.go b/packages/game/internal/gamecli/templates.go similarity index 99% rename from packages/game/cmd/game/templates.go rename to packages/game/internal/gamecli/templates.go index 7f4cc09d2..c8066bbaa 100644 --- a/packages/game/cmd/game/templates.go +++ b/packages/game/internal/gamecli/templates.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "embed" diff --git a/packages/game/cmd/game/templates_test.go b/packages/game/internal/gamecli/templates_test.go similarity index 99% rename from packages/game/cmd/game/templates_test.go rename to packages/game/internal/gamecli/templates_test.go index 27c2b24f8..43dbef1c7 100644 --- a/packages/game/cmd/game/templates_test.go +++ b/packages/game/internal/gamecli/templates_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "bytes" diff --git a/packages/game/cmd/game/testdata/editorproject/game.yaml b/packages/game/internal/gamecli/testdata/editorproject/game.yaml similarity index 100% rename from packages/game/cmd/game/testdata/editorproject/game.yaml rename to packages/game/internal/gamecli/testdata/editorproject/game.yaml diff --git a/packages/game/cmd/game/testdata/editorproject/scenes/crate.scene.yaml b/packages/game/internal/gamecli/testdata/editorproject/scenes/crate.scene.yaml similarity index 100% rename from packages/game/cmd/game/testdata/editorproject/scenes/crate.scene.yaml rename to packages/game/internal/gamecli/testdata/editorproject/scenes/crate.scene.yaml diff --git a/packages/game/cmd/game/testdata/editorproject/scenes/main.scene.yaml b/packages/game/internal/gamecli/testdata/editorproject/scenes/main.scene.yaml similarity index 100% rename from packages/game/cmd/game/testdata/editorproject/scenes/main.scene.yaml rename to packages/game/internal/gamecli/testdata/editorproject/scenes/main.scene.yaml diff --git a/packages/game/cmd/game/testdata/editorproject/sprites/actors.json b/packages/game/internal/gamecli/testdata/editorproject/sprites/actors.json similarity index 100% rename from packages/game/cmd/game/testdata/editorproject/sprites/actors.json rename to packages/game/internal/gamecli/testdata/editorproject/sprites/actors.json diff --git a/packages/game/cmd/game/testdata/editorproject/sprites/actors.png b/packages/game/internal/gamecli/testdata/editorproject/sprites/actors.png similarity index 100% rename from packages/game/cmd/game/testdata/editorproject/sprites/actors.png rename to packages/game/internal/gamecli/testdata/editorproject/sprites/actors.png diff --git a/packages/game/cmd/game/tex.go b/packages/game/internal/gamecli/tex.go similarity index 99% rename from packages/game/cmd/game/tex.go rename to packages/game/internal/gamecli/tex.go index f330c1ef0..79d103b37 100644 --- a/packages/game/cmd/game/tex.go +++ b/packages/game/internal/gamecli/tex.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "flag" diff --git a/packages/game/cmd/game/tex_test.go b/packages/game/internal/gamecli/tex_test.go similarity index 99% rename from packages/game/cmd/game/tex_test.go rename to packages/game/internal/gamecli/tex_test.go index 239cdaf87..56468214c 100644 --- a/packages/game/cmd/game/tex_test.go +++ b/packages/game/internal/gamecli/tex_test.go @@ -1,4 +1,4 @@ -package main +package gamecli import ( "image" diff --git a/packages/game/skill_test.go b/packages/game/skill_test.go index 2bb6d3f84..f36be974a 100644 --- a/packages/game/skill_test.go +++ b/packages/game/skill_test.go @@ -77,7 +77,7 @@ func stripFencedCodeBlocks(md string) string { return out.String() } -// TestAgentSkillValid verifies that skills/nsgo-game conforms to the Agent Skills layout (installable via `bunx skills add`), has valid relative links, lists every package under packages/game with the status docs/en/stability.md gives it, and catalogs exactly the tools game/mcp registers. cmd/game's TestAgentSkillDocumentsEveryCommand checks the CLI subcommands. +// TestAgentSkillValid verifies that skills/nsgo-game conforms to the Agent Skills layout (installable via `bunx skills add`), has valid relative links, lists every package under packages/game with the status docs/en/stability.md gives it, and catalogs exactly the tools game/mcp registers. internal/gamecli's TestAgentSkillDocumentsEveryCommand checks the CLI subcommands. func TestAgentSkillValid(t *testing.T) { skillDir := filepath.Join("..", "..", "skills", "nsgo-game") skillPath := filepath.Join(skillDir, "SKILL.md") diff --git a/skills/nsgo-game/SKILL.md b/skills/nsgo-game/SKILL.md index 03a508e6f..2151d1def 100644 --- a/skills/nsgo-game/SKILL.md +++ b/skills/nsgo-game/SKILL.md @@ -31,7 +31,7 @@ Published English docs for agents live at (inde ## Quick-start workflow -1. **Scaffold a project:** `nsgo game` is NSGo's command for the game layer (nsgo-dev/nsgo#2366, NSGo v0.3.3 or later; install it with `brew install nsgo-dev/tap/nsgo`, `curl -fsSL https://nsgo.dev/install.sh | sh` or `go install github.com/nsgo-dev/nsgo/cmd/nsgo@latest`; the game layer and its templates require NSGo v0.3.4): in a module it runs the module's `game` tool, elsewhere `go run` of the matching release. `go tool game` runs the same command in a module. +1. **Scaffold a project:** `nsgo game` runs through NSGo's extension mechanism (NSGo v0.3.3 or later; install `nsgo` with `brew install nsgo-dev/tap/nsgo`, `curl -fsSL https://nsgo.dev/install.sh | sh` or `go install github.com/nsgo-dev/nsgo/cmd/nsgo@latest`; the game layer and its templates require NSGo v0.3.4): inside a module whose `go.mod` declares `tool github.com/nsgo-dev/game/packages/game/cmd/game`, `nsgo game` automatically runs that module's pinned `game` tool (`go tool game` runs the same directly); outside a module, install `nsgo-game` once (`go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest`) for `nsgo game`, or run `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest new my-game` directly with nothing to install. ```sh nsgo game new my-game diff --git a/skills/nsgo-game/references/cli-and-formats.md b/skills/nsgo-game/references/cli-and-formats.md index 232d24a6e..a7feb1d6c 100644 --- a/skills/nsgo-game/references/cli-and-formats.md +++ b/skills/nsgo-game/references/cli-and-formats.md @@ -2,7 +2,7 @@ ## `nsgo game` CLI -Install the tool once per module, then run it as `nsgo game` (nsgo-dev/nsgo#2366) or `go tool game`; outside a module, `nsgo game` runs the matching release with `go run`: +Inside a module whose `go.mod` declares the `game` tool, `nsgo game` automatically runs that module's pinned tool through NSGo's extension mechanism (and `go tool game` runs the same directly); outside a module, install `nsgo-game` once (`go install github.com/nsgo-dev/game/packages/game/cmd/nsgo-game@latest`) for `nsgo game`, or run `go run github.com/nsgo-dev/game/packages/game/cmd/game@latest` directly: ```sh go get -tool github.com/nsgo-dev/game/packages/game/cmd/game@latest diff --git a/skills/nsgo-game/references/packages.md b/skills/nsgo-game/references/packages.md index 89253a7de..f3cc1efc4 100644 --- a/skills/nsgo-game/references/packages.md +++ b/skills/nsgo-game/references/packages.md @@ -165,6 +165,7 @@ Every non-internal package under `github.com/nsgo-dev/game/packages` (shown rela | `game/cmd/gameapi` | Experimental | Generates API reference JSON from package doc comments | | `game/cmd/gameproject` | Experimental | Formats and checks `game.yaml` against `nsgo.yaml` | | `game/cmd/gameschema` | Experimental | Generates and checks published JSON Schemas for YAML formats | +| `game/cmd/nsgo-game` | Experimental | The `nsgo-game` PATH extension binary for running `nsgo game` outside a module | | `game/cmd/sizecheck` | Experimental | Verifies WebAssembly and mobile package size budgets | | `game/cmd/wasmprobe` | Experimental | Probe app used to measure WebAssembly binary size per package | | `game/tooling/apiref` | Experimental | Go doc parser powering `cmd/gameapi` | diff --git a/template/README.md b/template/README.md index 01cbdcb77..5d105510a 100644 --- a/template/README.md +++ b/template/README.md @@ -1,6 +1,6 @@ # NSGo game template module -The `github.com/nsgo-dev/game/template` module ships the starter project, the default template, in its [`template/` directory](template/). Every other template is a module of its own in `template//`, `github.com/nsgo-dev/game/template/`, with its project in `template//template/`. [Templates](../docs/en/templates.md) lists them and describes how to add one. Use the [getting-started guide](../docs/en/getting-started.md) to create a game with `game new`, which embeds a copy of each template, or with `nsgo init -template`. After changing a template, copy it to `packages/game/cmd/game/_templates/projects/`, whose tests fail while the two differ. +The `github.com/nsgo-dev/game/template` module ships the starter project, the default template, in its [`template/` directory](template/). Every other template is a module of its own in `template//`, `github.com/nsgo-dev/game/template/`, with its project in `template//template/`. [Templates](../docs/en/templates.md) lists them and describes how to add one. Use the [getting-started guide](../docs/en/getting-started.md) to create a game with `game new`, which embeds a copy of each template, or with `nsgo init -template`. After changing a template, copy it to `packages/game/internal/gamecli/_templates/projects/`, whose tests fail while the two differ. The repository workspace links every template to the local game library. From the repository root, run its tests and open it on the desktop with: