# BuildaGame Agent Setup

> BuildaGame agent toolchain version: 0.4.115

Always reply to the user in the language they use; this English guidance does not change that.

Your task is to install the BuildaGame toolchain (local CLI + project-level Skill) in the current game project; it supports Godot Web, HTML5 and Unity WebGL.

**Scope and stop point**: when the user only asks to install, complete the 4 steps below and stop after reporting the result; do not pre-read the installed SKILL.md, and do not integrate the
SDK, package or upload on your own; wait until the user raises a concrete task, then route via the Skill. Do not make the user run a shell manually; never ask the user for passwords, cookies,
sessions or tokens.

## 1. Enter the project root

Run every command in the game project root (the CLI rejects other directories): for Godot, the directory containing `project.godot`; for Unity, the directory containing
`ProjectSettings/ProjectVersion.txt` (or `Assets/` + `Packages/manifest.json`); for HTML5, the project root containing
`index.html` or `package.json`. If unsure of the project root, ask the user first; do not install in `$HOME`.

## 2. Determine the authorization site

Check the query of the setup URL the user gave: with no `o` parameter, install with the default command; with `o=<hostname>`, `o` must be a bare hostname
(e.g. `builda.cn`); normalize it to `https://<hostname>` and use the command with `--site-origin`. If `o` contains a scheme, port, path, query,
fragment or userinfo, or is not a valid hostname, stop installing and report the error; do not guess or fix it.

## 3. Run the installer

macOS / Linux / WSL:

```bash
curl -fsSL https://ai.builda.game/agent/releases/0.4.115/install.sh | bash
# Only when the setup URL has o=<hostname>:
curl -fsSL https://ai.builda.game/agent/releases/0.4.115/install.sh | bash -s -- --site-origin "https://<hostname-from-o>"
```

Windows (always use Windows PowerShell 5.1; with `o`, append `--site-origin "https://<hostname-from-o>"` after `-File $p`):

```powershell
$ProgressPreference = "SilentlyContinue"
$p = Join-Path $env:TEMP "builda-install.ps1"
iwr https://ai.builda.game/agent/releases/0.4.115/install.ps1 -UseBasicParsing -OutFile $p
try { & "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -File $p; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } finally { Remove-Item -Force $p -ErrorAction SilentlyContinue }
```

Only if the download fails with `SEC_E_NO_CREDENTIALS` (Schannel has no credentials in a restricted environment), read
`https://ai.builda.game/agent/releases/0.4.115/setup-windows.md` and download the installer via its fallback steps; report any other error as is.

## 4. Self-check and report

```bash
./.builda-agent/builda check
```

On Windows use `.builda-agent\builda.cmd check`. Briefly tell the user the `check` result (version, detected engine, SDK status),
say the toolchain is installed in the project's `.builda-agent/` (should be committed), then stop. Installation needs no authorization; do not run `builda auth`.
In the report, briefly mention: once troubleshooting confirms a Builda SDK internal or Builda service issue, the user can authorize the current Agent to report it to the Builda team; Feedback is installed on demand and reuses the existing Builda account.

## When the user also raised other tasks

First read `./.builda-agent/SKILL.md` (the short core routing guide) and, per its task table, read only the topics this task needs. Common order:
run the idempotent `./.builda-agent/builda auth` once before uploading or syncing a draft; integrate the SDK with `./.builda-agent/builda sdk install`
(SDK tasks need no authorization).

Builda Online multiplayer: delivered with the same version as the SDK; when needed run `./.builda-agent/builda sdk install --with-online` in the project root;
AI-readable setup: `https://ai.builda.game/online/setup.md`.
