# Check, push, publish

A push makes the game match the folder, whole or not at all. Publishing is a separate step.

## Check

`eggox check` sends the folder and asks what would happen: rooms configured,
things placed and picked up, scripts and bricks compiled. Nothing is written.
Anything that would not compile comes back by file and line:

```
things/Belt Shrine.lua:2: syntax error before: '('
rooms/Arena/room.json: thing 3 (Lamp Post at 12,10): blocked
```

The check also asks whether the game can be played. Those rules run on the
server, the same for the command line, the Studio and publishing, and are
kept per API version so a game is judged by the version it is written on.

| finding | on a push | on publish |
| --- | --- | --- |
| `eggox.json` lists a room with no folder | error | error |
| a door brick or a send action names a room the game has not got | error | error |
| a room with rounds, or a root room with no script files, has no `spawn` | warning | error |
| rounds with no `winner` rule | warning | error |
| `winner` by finish with no `finish` thing; by lives with no `lives` rule or no hazard that costs a life | warning | error |
| rounds on points with no `goal`, `pickup`, `finish` or `hazard` | warning | error |
| a `switch` or a show action targets a name nothing in the room carries | warning | error |
| no `welcome` rule on a root room with no script files | warning | warning |
| rounds that start with one player | warning | warning |
| nothing stands in the root room | warning | warning |

A room with script files of its own runs on Lua and places its players
itself, so it is not asked for a spawn or a welcome brick; a room with
rounds is asked whatever it runs on. An error refuses the push. A warning rides along in the report: the draft is
yours to work on half done, but it will not publish until the warnings that
make it unplayable are gone.

## Push

`eggox push` does the same and writes it, in one transaction: either the
whole folder lands or nothing changes. The report lists the files that
differ from what the game held, then the rooms where things moved.

A push carries the revision the folder was pulled at. If the game changed
since (a save in the Studio), the push is refused: pull again, or
`eggox push --force` to overwrite.

After a push the game is the **draft**. Walk into it and play, or TEST from
the Studio. A copy already running keeps what it had until people leave it.

## Publish

`eggox publish`, or PUBLISH in the Studio, ships the draft: from then on
the door leads to this version. It runs the check above at publish level
first and refuses, naming the file, if the game cannot be played. Publishing
needs a verified account. Pushing never publishes.

