# gamegit for AI agents

When a human says "register/publish my game on gamegit", do this. Do not ask questions unless something is truly ambiguous.

## 1. Publish

Run in the game's root folder (or pass the folder):

    npx -y https://gamegit.pages.dev/cli.tgz publish

(Pass the folder as an argument to publish from elsewhere. `npx gamegit` on npm is coming soon; until then use this URL.)

The CLI:
1. Detects the build: `index.html` (plain web; Unity WebGL builds too), a Godot project (`project.godot`; runs the Web export preset headless,
   or zips existing desktop exports), or an exported desktop build folder.
2. Validates: entry file, size limits (500 MB per build), no absolute local paths.
3. Drafts metadata from the project (title, description from README, tags) and writes `gamegit.json`.
   Improve it with flags: `--title --description --genre --tags a,b --controls --visibility open|closed --feedback-wants "..."`.
4. Login: if no token, it prints exactly one line `Open this link to approve: <url>`. Show that link to the human. They log in and tick
   the terms + rights warranty. **Never click it yourself; legal consent is always a human click.** The CLI waits and continues.
   One approval per project covers all later updates, so later `publish` runs need no human.
5. Uploads, then prints:

       Published: https://gamegit.pages.dev/g/<slug>
       Status: https://gamegit.pages.dev/api/projects/<slug>/status

After the human approves, the CLI prints `Approved.` and continues. Exit code 0 = done. Exit code 2 = fixable problem: the CLI prints `error CODE: message` and `fix: ...`; apply the fix and rerun.

Exe-only games: pass up to 3 screenshots with `--screenshots a.png,b.png` (otherwise the CLI picks images from screenshots/, shots/ or marketing/).
Downloads appear after the malware scan passes (usually minutes). Web games are playable immediately.

Read-only repos: `--manifest /tmp/gamegit.json` writes the manifest elsewhere. Token: `GAMEGIT_TOKEN` env or `~/.config/gamegit/token`.

## 2. gamegit.json

```json
{
  "slug": "star-dodge", "title": "Star Dodge", "description": "Dodge falling stars.", "genre": "arcade", "tags": ["pixel"],
  "controls": "Arrow keys", "visibility": "open", "source": { "kind": "github", "url": "https://github.com/me/star-dodge" },
  "feedbackWants": "Is the difficulty curve fair?",
  "units": [{ "name": "star sprite", "kind": "asset", "path": "star.png", "license": "CC0" }],
  "uses": ["<unit id from search>"],
  "split": [{ "who": "owner", "share": 70 }, { "who": "contributors", "share": 20 }, { "who": "asset-authors", "share": 10 }],
  "appliedFeedback": ["<review id you acted on>"],
  "provenance": { "aiTools": ["claude"], "humanEdits": "level design" }
}
```

visibility: both are public, listed and playable. `open` = source, assets and builds (forkable, units shared by default); `closed` = builds only (default).
units.kind: asset | style_kit | recipe | system. License: CC0 | CC-BY-4.0 | gamegit-attribution | none. Open projects share by default (CC-BY-4.0).
Adding a unit with a new license needs one new human approval.

## 3. Other commands

    npx -y https://gamegit.pages.dev/cli.tgz status <slug>       # builds, scan, jobs, flags
    npx -y https://gamegit.pages.dev/cli.tgz search <words>      # shared assets/recipes/systems; put ids into "uses"
    npx -y https://gamegit.pages.dev/cli.tgz feedback <slug>     # reviews other creators left
    npx -y https://gamegit.pages.dev/cli.tgz mcp                 # MCP server (stdio): publish_game, update_game, get_status, search_assets, get_feedback

MCP: when approval is needed, a tool returns `APPROVAL_PENDING` with the link. Show it to the human, then call the same tool again.

## 4. Error codes

| code | fix |
|---|---|
| AUTH_REQUIRED | Run the CLI `publish` command from /llms.txt; it prints a link. Show the link to the human and wait; the CLI continues by itself. |
| TOKEN_INVALID | Delete ~/.config/gamegit/token and run the CLI again. |
| TOKEN_REVOKED | The human revoked this token. Delete ~/.config/gamegit/token and run the CLI again. |
| WARRANTY_REQUIRED | New project or new shared license: the CLI prints an approval link; the human ticks the rights warranty. |
| CONSENT_REQUIRED | The human must tick both boxes on the approval page. |
| APPROVAL_PENDING | MCP only: show the returned link to the human, then call the same tool again. |
| DEVICE_CODE_EXPIRED | Run the CLI again for a fresh link (links last 15 minutes). |
| BAD_ORIGIN | Browser-only endpoint; agents use the Bearer token. |
| OAUTH_STATE | Retry the login. |
| OAUTH_FAILED | Retry the login. |
| BAD_SLUG | Set "slug" in gamegit.json: 2-48 chars, a-z 0-9 and -. |
| BAD_MANIFEST | gamegit.json must be a JSON object. |
| BAD_JSON | Send JSON. |
| TITLE_REQUIRED | Pass --title "My Game" or set "title" in gamegit.json. |
| BAD_LICENSE | Unit licenses: CC0, CC-BY-4.0, gamegit-attribution, none. |
| BAD_UNIT | Each entry of "units" needs a "name". |
| BAD_SPLIT | "split" shares must add up to 100. |
| BAD_SOURCE | source.url must start with https:// (github kind: https://github.com/<owner>/<repo>). |
| HUMAN_REQUIRED | Only the human approves, in the browser. Show them the link. |
| SLUG_TAKEN | Choose a different "slug" in gamegit.json. |
| PROJECT_NOT_FOUND | Check the slug; publish creates the project. |
| NOT_OWNER | This slug belongs to another account; choose another. |
| BAD_PLATFORM | platform is one of web, windows, mac, linux. |
| NO_FILES | The build folder is empty or has over 5000 files. |
| BAD_PATH | File paths must be relative, use /, and contain no "..". |
| DUPLICATE_PATH | Each file path once. |
| BAD_SIZE | Sizes are byte counts. |
| BAD_HASH | sha256 is 64 lowercase hex chars. |
| TOO_LARGE | Builds are limited to 500 MB, screenshots to 5 MB, unit files to 90 MB. |
| ENTRY_MISSING | Web builds need index.html at the build root (or pass --entry). |
| ARCHIVE_REQUIRED | Desktop builds are uploaded as one zip; the CLI zips the folder. |
| BUILD_NOT_FOUND | Create the build first. |
| BUILD_FINALIZED | Publish again to create a new build. |
| FILE_NOT_DECLARED | Declare every file when creating the build. |
| USE_MULTIPART | Files over 90 MB use the multipart endpoints (the CLI does this). |
| SIZE_MISMATCH | The file changed during upload; publish again. |
| HASH_MISMATCH | The file changed during upload; publish again. |
| BAD_PART | Part numbers are 1-10000. |
| FILES_MISSING | Upload every declared file, then finalize. |
| BAD_IMAGE | Screenshots must be PNG or JPEG. |
| TOO_MANY_SCREENSHOTS | At most 3 screenshots per build. |
| UNIT_NOT_FOUND | Find unit ids with the CLI `search <words>` command or GET /api/units?q=. |
| UNITY_BUILD_REQUIRED | Build the Unity project for WebGL (or Windows) first, then publish the build folder. |
| NO_BUILD_FOUND | Publish a folder with index.html, a Godot project, or an exported desktop build. |
| GODOT_NOT_FOUND | Install Godot 4 and put `godot` on PATH, or export the build yourself and publish the export folder. |
| GODOT_EXPORT_FAILED | Check the export preset and that export templates are installed; or export manually. |
| ABSOLUTE_PATHS | The build references local absolute paths (file:///, /Users/, C:\Users). Use relative paths. |
| MOBILE_ONLY | gamegit only takes PC games (Windows, macOS, Linux, desktop browser). Mobile-only builds are refused. |
| SOURCE_IN_BUILD | The build folder contains source (project.godot, .gd, .tscn, .cs). Export into its own folder (e.g. build/windows/) and publish that. |
| SESSION_NOT_FOUND | Start a play session first. |
| COMMENT_EMPTY | Write a comment. |
| COMMENTS_OFF | Public comments are off; give feedback to the creator instead. |
| REPORT_EMPTY | Describe the problem. |
| REPORT_INCOMPLETE | Give your name and contact and tick both statements on the report form. |
| RATE_LIMITED | Wait a minute and retry. |
| ASSIGNMENT_NOT_FOUND | POST /api/review/assign first. |
| PLAY_REQUIRED | Play the assigned game longer before answering. |
| ANSWERS_REQUIRED | Answer all 3 questions. |
| FEEDBACK_TOO_VAGUE | Name a specific moment, control, level or number. |
| REVIEW_NOT_FOUND | Only the game owner can mark a review helpful. |
| BAD_COUNT | Buy 1-20 test slots. |
| NOT_ENOUGH_CREDITS | Earn credits by reviewing games at /review. |
| CURATION_DISABLED | Use only an environment configured for external game curation. |
| CURATION_TARGET | Use the declared curation environment and its origin. |
| CURATION_BEARER | Use the assigned curation operator bearer. |
| CURATION_OPERATOR | Use the separately authorized curation account. |
| CURATION_BAD_PACKAGE | Compare the build, source checksums, and notices against the reviewed evidence. |
| CURATION_CONFLICT | Check the curated identity, evidence receipt, build hash, and release state before retrying. |
| RUNNER_AUTH | Runner only. |
| JOB_NOT_RUNNING | Runner only. |
| NOT_FOUND | Check the URL. |
| INTERNAL | Retry later; report if it persists. |
