CLI reference
pocket-studio makes, sends and publishes Pocket Studio games from a terminal. The setup command on the workbench installs it (Set up your computer); it runs on Bun 1.3 or newer. pocket-studio --help prints the list below, and pocket-studio --version its version.
Run link, new, create, remix, register and the account commands anywhere. Run the others inside a project: the directory that holds .pocket-studio.json, or one below it.
#Commands
| Command | What it does |
|---|---|
pocket-studio link <CODE> | Link this machine to your Studio account with the link code from the room |
pocket-studio new | Create a game project and its session, build it, send it to the room |
pocket-studio create <CODE> | Link the pairing code from the room, create the project, start the agent |
pocket-studio continue [id] | Start the agent in a game's project again: this directory's, or the game the room names |
pocket-studio title "<Title>" | Name the game, here and on the shelf, with --tagline "<one line>" for its card |
pocket-studio dev | Rebuild and send the game to the room on every change |
pocket-studio push | Build once and send the game to the room |
pocket-studio shot | Run the game with no screen and write PNGs of it, with --do "<steps>" |
pocket-studio publish | Publish the game, its share link and its own address |
pocket-studio register | Register a game built outside Pocket Studio, with --title |
pocket-studio remix <game> | Start a game of your own from a copy of another: its id, share link or address |
pocket-studio repository <url> | Name the public repository of a game built outside Pocket Studio, so it can be remixed, or --remove |
pocket-studio site <dir> | Deploy a directory as the web build of a game Pocket Nexus verified |
pocket-studio package <file> | Upload an installation package with --target psp|vita|3ds|ipod-touch|android |
pocket-studio downloads on|off | Let members download the game's packages, or stop it |
pocket-studio cover <png> | Set the picture on the game's case, its card and Pocket TV, or take it off with --remove |
pocket-studio listing <dir> | Set what the game's page shows from a directory with listing.json, or take it off with --remove |
pocket-studio status | Print the session phase, or what a registered game has published |
pocket-studio delete | Delete the game from the Studio for good, with --yes |
pocket-studio whoami | Print the account this machine is linked to |
pocket-studio handle [name] | Print the account's handle, or choose another |
pocket-studio unlink | Forget the account link |
pocket-studio agent install <claude|codex> | Install the Pocket Studio plugin into a coding agent |
pocket-studio agent status | Say where the plugin is installed |
pocket-studio agent remove <claude|codex> | Remove the plugin from a coding agent |
pocket-studio agents | List the coding agents found on PATH |
pocket-studio update | Bring this pocket-studio and its plugins up to the one the Studio serves now |
#Your account
#link
pocket-studio link K7QD-9M4X
Linked this machine to https://studio.pocket.nexus as docs-writer
Links this computer to the account that made the code. The code comes from the room: the agent card on the workbench and Remix on a game's card write one. It works once and for 15 minutes. A computer stays linked until unlink.
#whoami
Prints the linked account, docs-writer at https://studio.pocket.nexus, or fails when there is none:
This machine is not linked to https://studio.pocket.nexus.
Get a link code from the room (click the Claude or Codex figure), then run: pocket-studio link <CODE>
#handle
pocket-studio handle prints your handle; pocket-studio handle docs-writer chooses another. Your published games say By and the handle.
#unlink
Forgets the link to the server on this computer.
#Making a game
#new
pocket-studio new --device psp --title "Moon Lander" --agent claude
Started "Moon Lander" for PSP as docs-writer
Created ./moon-lander from the snack-snake starter
Build 1 is on the PSP (.pocket/studio/out/psp/moon-lander.js, 514 KiB)
Creates a project from a starter game, opens a session for the device in your room, and compiles and sends the first build. The directory must be absent or empty. Inside a project, --dir . gives the game a session on another device and keeps its files.
| Option | What it does |
|---|---|
--device <id> | psp, vita, 3ds, ipod-touch, android. With --remix, the remixed game's first device when left out |
--remix <game> | Start from a copy of another game: its id, its share link or its address |
--title <title> | The game's title (default Untitled Game) |
--dir <path> | Project directory (default ./<game-title>) |
--agent <name> | The agent doing the work: claude or codex |
--server <url> | Studio server (default https://studio.pocket.nexus) |
--templates <dir> | Directory of starter templates, for new and create |
#create
pocket-studio create PINE-QWJ6
Runs the command the room writes under New game: links this computer with the pairing code, creates the project, sends the first build and starts a coding agent in it. A pairing code works once and for 15 minutes. If the project could not be written after the code was used, the same command run again within a day picks the link up.
| Option | What it does |
|---|---|
--dir <path> | Project directory (default ./<game-title>, with a number after it when that is taken) |
--agent <name> | claude, codex or none (default: the first one found) |
--no-launch | Create and build the project without starting an agent |
--server <url> | Studio server (default https://studio.pocket.nexus) |
--templates <dir> | Directory of starter templates, for new and create |
#continue
Starts the coding agent again in a game's project: the one in this directory, or the game the room names by its id.
| Option | What it does |
|---|---|
--agent <name> | claude, codex or none (default: the one that worked on the game last, then the first one found) |
#title
pocket-studio title "Moon Lander" --tagline "Land on three pads before the fuel runs out."
The game is "Moon Lander" in the room.
Its card says: Land on three pads before the fuel runs out.
Its title screen is drawn by the project: change the title there too.
Writes the title into studio.json, every pocket*.json and the // @title line, and tells the room at once. A title is 1 to 60 characters and a tagline at most 80; a longer one is refused and nothing is written.
| Option | What it does |
|---|---|
--tagline <text> | One line under the title on the game's card, at most 80 characters |
#dev
Rebuilds the game on every change you save and sends each build that differs from the last, until you press Ctrl-C.
Watching . for changes. Press Ctrl-C to stop.
#push
Compiles the game for the session's device and sends the build. A build that fails prints its errors with file and line and sends nothing. The title, tagline and cover colours of studio.json go with it when they changed. No change since build 1 means the compiled game is the one the room has.
#shot
pocket-studio shot --do "wait 1; shot title; press CIRCLE; wait 0.5; shot play"
Builds the game and runs it on this computer with no screen, on the WebAssembly core the room's device runs, and writes a PNG for each shot step into .pocket/studio/shots/. It sends nothing to the room and needs no network. Under each picture it prints every text on screen with its box, and a layout: line that says whether each text fits its box. The same steps give the same pictures every time.
| Option | What it does |
|---|---|
--device <id> | Look at another device's screen; the session stays on its own |
--no-build | Run the last build as it is |
Steps, separated by `;`:
wait <time> let the game run
press <BUTTON> down for 1 frame, then up for 1 frame
hold <BUTTON> <time> down that long, then up for 1 frame
down <BUTTON> press it and keep it down through the steps that follow, a shot among them
up <BUTTON> let go of a button that `down` holds
until "<text>" [time] run frame by frame until a text on screen contains it; the run fails when the time passes first (default 10 seconds of game time)
tap <x> <y> [time] touch the screen at a point, in the touch screen's logical pixels (default 1 frame)
swipe <x0> <y0> <x1> <y1> [time] drag a finger from one point to another (default 0.2, at least 2 frames)
shot [name] write a PNG and print what is on screen
Time: seconds (`0.5`) or whole frames with an f (`30f`). Every device runs 60 frames a second. Seconds times 60 is rounded to the nearest frame, a half up, and is at least 1 frame: `wait 0.7167` is 43 frames.
Buttons: SELECT, START, UP, RIGHT, DOWN, LEFT, L, R, TRIANGLE, CIRCLE, CROSS, SQUARE. On the 3DS, A, B, X and Y too.
Several buttons: `press`, `hold`, `down` and `up` take buttons joined with +, as in `press L+R`. `down` adds to what is held, so `down LEFT; down CROSS` holds both.
Frames: the game sees a button go down on the first frame it is held after a frame it was up, so `press` takes 2 frames and `hold CROSS 90f` takes 91. `down` and `up` take 1 frame each, the frame the game sees the change on: `press X` is `down X; up X`.
`until` reads the texts a shot lists, with upper and lower case as written. Put the text in quotes when it has a space: `until 'GAME OVER' 20`.
Pictures: .pocket/studio/shots/<name>.png for the session's device, .pocket/studio/shots/<device>/<name>.png for another one under --device. A run replaces the pictures of the directory it writes and of no other.
#status
"Moon Lander" on PSP
phase: published
build: 1
message: Published
address: https://moon.studio.pocket.nexus
page: https://studio.pocket.nexus/games/moon
listing: none
Prints the session's phase, its build and its last message, then the game's address, page, listing and packages when it has them. For a registered game it prints what the game has published.
#Publishing
#publish
Published "Moon Lander". Share: https://studio.pocket.nexus/studio/?app=a8ja3s2exefnv
Address: https://moon.studio.pocket.nexus
Makes the game public and prints its share link and address. Publishing and sharing says how an address is chosen.
| Option | What it does |
|---|---|
--slug <name> | The game's address: <name>.<studio host>. 3 to 32 lowercase letters, digits and inner hyphens |
#cover
Sets the picture on the game's case, its card and Pocket TV: a PNG of 64 to 2048 pixels on each side, at most 2 MiB.
| Option | What it does |
|---|---|
--remove | Take the cover off instead of setting one |
--app <id> | The game by its id, from any directory. |
#downloads
pocket-studio downloads on lets members download the game's packages, and off stops it.
Downloads are on for "Moon Lander". It has no package yet.
#listing
Sets what the game's page shows from a directory with listing.json: clips, pictures, a description and a share picture. Games built elsewhere has every rule.
| Option | What it does |
|---|---|
--remove | Take the listing off instead of setting one |
--app <id> | The game by its id, from any directory. |
#delete
"Moon Lander" would be deleted from https://studio.pocket.nexus for good:
address: https://moon.studio.pocket.nexus
builds: psp
Nothing was deleted. Run it again with --yes to delete it.
| Option | What it does |
|---|---|
--yes | Delete it; without this the command lists what would go and stops |
#Remixing
#remix
pocket-studio remix a8ja3s2exefnv --agent claude
Starts a game of your own from a copy of a published game, named by its id, its share link or its address. A game made in Pocket Studio becomes a project with a session; a game built elsewhere is cloned from its repository with git. See Remix.
| Option | What it does |
|---|---|
--dir <path> | Project directory (default ./<game-title>-remix) |
--device <id> | For a Pocket app: the device the remix starts on (default the game's first) |
--agent <name> | For a Pocket app: the agent doing the work, claude or codex |
#repository
Names the public repository of a game built outside Pocket Studio, so it can be remixed once it is published; --remove takes it off.
| Option | What it does |
|---|---|
--remove | Take the repository off |
--app <id> | The game by its id, from any directory |
#Games built elsewhere
#register
Registers a game built with its own tools, and links the directory to it. See Games built elsewhere.
| Option | What it does |
|---|---|
--title <title> | The game's title |
--tagline <text> | One line under the title |
--colors <a,b> | The two cover colours, #rrggbb each |
--cover <png> | The cover picture, as pocket-studio cover sets it |
--repository <url> | The public repository of its source, so others can remix it once it is published |
--dir <path> | The project directory to link (default .) |
--server <url> | Studio server (default https://studio.pocket.nexus) |
--templates <dir> | Directory of starter templates, for new and create |
#site
Deploys a directory of static files as the game's web build, at its address. For games Pocket Nexus verified.
| Option | What it does |
|---|---|
--entry <file> | The file the address serves at / (default index.html) |
#package
Uploaded moon.3dsx (4 KB), version 0.1.0 for 3ds.
Members can download it from the game's page.
Uploads an installation package for one device. See Packages.
| Option | What it does |
|---|---|
--target <id> | psp, vita, 3ds, ipod-touch, android |
--version <text> | The package's version, such as 0.1.0 |
--app <id> | The game by its id, from any directory. |
#Setup
#agent
pocket-studio agent install claude installs the Pocket Studio plugin into Claude Code with its own plugin commands (codex for Codex); agent status says where each agent has it; agent remove takes it out. The setup command runs agent install for you.
claude pocket-studio@pocket-nexus 0.1.0, enabled, from ~/.pocket-studio/plugins/pocket-studio
codex no plugin. Run: pocket-studio agent install codex
#agents
Lists the coding agents found on PATH.
#update
Downloads the kit the Studio serves now and installs it as the setup command does, then gives each agent that has the plugin the new one. Once a day, after a command that talks to the Studio, an installed pocket-studio checks whether a newer kit is out and says A newer Pocket Studio is out. Run: pocket-studio update.
#The server
Every command talks to https://studio.pocket.nexus unless told otherwise:
| Option | What it does |
|---|---|
--server <url> | Studio server (default https://studio.pocket.nexus) |
--templates <dir> | Directory of starter templates, for new and create |
#Files
| Path | Holds |
|---|---|
~/.config/pocket-studio/config.json | The account link for each server. $XDG_CONFIG_HOME/pocket-studio/ when that is set. |
~/.config/pocket-studio/projects.json | Where each of your projects is on this computer, for continue. |
~/.cache/pocket-studio/links/ | A pairing code's answer, kept for a day so create can finish after a failure. |
~/.pocket-studio/ | The installed kit: the command, the starters, the plugin, the PocketJS compiler and its caches. |
.pocket-studio.json | In a project. For a game made in the room: the session and its token, which you never share or commit. For a registered game: the server and the game's id, with no token. |
.pocket/studio/out/<device>/ | The last build for each device. |
.pocket/studio/shots/ | The pictures shot writes. |
#Environment
| Variable | What it changes |
|---|---|
POCKET_STUDIO_SERVER | The server, when no --server is given. |
POCKET_STUDIO_HOME | Where the kit is installed, in place of ~/.pocket-studio. |
POCKET_STUDIO_BIN | The directory the setup puts the pocket-studio command in. |
POCKET_STUDIO_TEMPLATES | The directory of starter games, when no --templates is given. |
POCKETJS_FRAMEWORK_ROOT | A PocketJS checkout to compile with, in place of the kit's. |
XDG_CONFIG_HOME, XDG_CACHE_HOME | The parents of the config and cache directories above. |
BUN_INSTALL | Where the setup command looks for Bun, and installs it when it is missing. |
#Exit codes and errors
A command ends with 0 when it did what it was asked and 1 when it did not, with the reason on the error output. delete without --yes, a shot step that fails and a build with errors end with 1.
| It says | What to do |
|---|---|
This machine is not linked to … | Get a link code from the room and run pocket-studio link <CODE>. |
A link code is two groups of four characters, such as K7QD-9M4X. | Copy the code again from the room. |
This code was already used | A code works once. Get a new one from the room. |
This code expired. Get a new one from the room. | A code works for 15 minutes. Get a new one. |
That does not look like a link code, Code not found | The code is not one the room wrote. Copy it again from the room. |
Unknown command … | This pocket-studio is older than the room. Run pocket-studio update. |
… is not installed: there is no claude on PATH. | Install the agent, then run the setup command again. |
pocket-studio runs on Bun, and this is Node. | Install Bun from bun.sh, or run the setup command, which does. |
Upload a package before publishing | A registered game is published once it has a package or a web build. |
Pocket Nexus has not verified this project, … | A web build is for verified games. Its packages and its page need no verification. |