CLI リファレンス
pocket-studio は、ターミナルから Pocket Studio のゲームを作り、送り、公開するコマンドです。作業台の準備コマンドでインストールされ(コンピューターの準備)、Bun 1.3 以降で動きます。pocket-studio --help で下の一覧が、pocket-studio --version でバージョンが表示されます。コマンドの出力は英語です。
link、new、create、remix、register とアカウントのコマンドは、どこでも実行できます。ほかのコマンドはプロジェクトの中で実行します。プロジェクトは .pocket-studio.json のあるディレクトリと、その下です。
#コマンド
| コマンド | 内容 |
|---|---|
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 |
#アカウント
#link
pocket-studio link K7QD-9M4X
Linked this machine to https://studio.pocket.nexus as docs-writer
このコンピューターを、コードを作ったアカウントにつなぎます。コードは部屋から受け取ります。作業台のエージェントのカードと、ゲームのカードの リミックス が書き出します。コードは 1 回だけ、15 分間使えます。つないだコンピューターは unlink までつながったままです。
#whoami
つないでいるアカウントを docs-writer at https://studio.pocket.nexus のように表示します。つながっていなければ失敗します。
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 でハンドルを表示し、pocket-studio handle docs-writer で変えます。公開したゲームには、作者としてハンドルが表示されます。
#unlink
このコンピューターから、サーバーとのつながりを消します。
#ゲームを作る
#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)
スターターゲームからプロジェクトを作り、部屋にデバイスのセッションを開き、最初のビルドを作って送ります。ディレクトリは存在しないか空である必要があります。プロジェクトの中で --dir . を付けると、ファイルはそのままで別のデバイスのセッションに移ります。
| オプション | 内容 |
|---|---|
--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
部屋の 新しいゲーム が書き出すコマンドです。ペアリングコードでこのコンピューターをつなぎ、プロジェクトを作り、最初のビルドを送り、その中でコーディングエージェントを起動します。ペアリングコードは 1 回だけ、15 分間使えます。コードを使ったあとでプロジェクトを書けなかったときは、1 日以内に同じコマンドをもう一度実行すると続きから始まります。
| オプション | 内容 |
|---|---|
--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
ゲームのプロジェクトで、コーディングエージェントをもう一度起動します。このディレクトリのプロジェクトか、部屋が ID で示すゲームです。
| オプション | 内容 |
|---|---|
--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.
studio.json、すべての pocket*.json、// @title の行にタイトルを書き、すぐに部屋に伝えます。タイトルは 1〜60 文字、キャッチコピーは 80 文字までで、長すぎるときは何も書かずに断ります。
| オプション | 内容 |
|---|---|
--tagline <text> | One line under the title on the game's card, at most 80 characters |
#dev
Ctrl-C で止めるまで、ファイルを保存するたびにゲームをビルドし、前と違うビルドを送ります。
Watching . for changes. Press Ctrl-C to stop.
#push
セッションのデバイス向けにゲームをビルドして送ります。失敗したビルドは、エラーをファイルと行つきで表示し、何も送りません。studio.json のタイトル、キャッチコピー、カバーの色は、変わっていれば一緒に送られます。No change since build 1 は、ビルドしたゲームが部屋にあるものと同じという意味です。
#shot
pocket-studio shot --do "wait 1; shot title; press CIRCLE; wait 0.5; shot play"
ゲームをビルドし、部屋のデバイスと同じ WebAssembly のコアで、画面なしでコンピューター上で動かします。shot の手順ごとに .pocket/studio/shots/ へ PNG を書き出します。部屋には何も送らず、ネットワークも使いません。画像ごとに、画面上のすべての文字とその枠、そして文字が枠に収まっているかを示す layout: の行を表示します。同じ手順からは、いつも同じ画像ができます。
| オプション | 内容 |
|---|---|
--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
セッションの状態、ビルド番号、最後のメッセージを表示し、ゲームにアドレス、ページ、紹介、パッケージがあればそれも表示します。登録したゲームでは、公開しているものを表示します。
#公開
#publish
Published "Moon Lander". Share: https://studio.pocket.nexus/studio/?app=a8ja3s2exefnv
Address: https://moon.studio.pocket.nexus
ゲームを公開し、共有リンクとアドレスを表示します。アドレスの決まり方は公開と共有にあります。
| オプション | 内容 |
|---|---|
--slug <name> | The game's address: <name>.<studio host>. 3 to 32 lowercase letters, digits and inner hyphens |
#cover
ゲームのケース、カード、Pocket TV の画像を設定します。各辺 64〜2048 ピクセル、2 MiB 以下の PNG です。
| オプション | 内容 |
|---|---|
--remove | Take the cover off instead of setting one |
--app <id> | The game by its id, from any directory. |
#downloads
pocket-studio downloads on でメンバーがゲームのパッケージをダウンロードできるようになり、off で止まります。
Downloads are on for "Moon Lander". It has no package yet.
#listing
listing.json のあるディレクトリから、ゲームページの紹介(動画、画像、説明、共有用の画像)を設定します。決まりはすべて外で作ったゲームにあります。
| オプション | 内容 |
|---|---|
--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.
| オプション | 内容 |
|---|---|
--yes | Delete it; without this the command lists what would go and stops |
#リミックス
#remix
pocket-studio remix a8ja3s2exefnv --agent claude
公開されたゲームのコピーから、自分のゲームを始めます。ゲームは ID、共有リンク、アドレスのどれかで指定します。Pocket Studio のゲームはセッション付きのプロジェクトになり、外で作られたゲームはリポジトリから git でクローンされます。リミックスをご覧ください。
| オプション | 内容 |
|---|---|
--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
Pocket Studio の外で作られたゲームの公開リポジトリを登録し、公開後にリミックスできるようにします。--remove で外します。
| オプション | 内容 |
|---|---|
--remove | Take the repository off |
--app <id> | The game by its id, from any directory |
#外で作ったゲーム
#register
ゲーム自身のツールで作ったゲームを登録し、ディレクトリをそのゲームにつなぎます。外で作ったゲームをご覧ください。
| オプション | 内容 |
|---|---|
--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
静的ファイルのディレクトリを、ゲームのウェブビルドとしてそのアドレスに置きます。Pocket Nexus が確認したゲームのためのものです。
| オプション | 内容 |
|---|---|
--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.
1 台のデバイス向けのインストールパッケージをアップロードします。パッケージをご覧ください。
| オプション | 内容 |
|---|---|
--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. |
#準備
#agent
pocket-studio agent install claude は、Claude Code 自身のプラグインコマンドで Pocket Studio のプラグインを入れます(Codex なら codex)。agent status はエージェントごとにプラグインの場所を表示し、agent remove はプラグインを外します。準備のコマンドが agent install を実行します。
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
PATH で見つかったコーディングエージェントを表示します。
#update
Pocket Studio が今配っているキットをダウンロードし、準備のコマンドと同じようにインストールして、プラグインの入っているエージェントに新しいプラグインを入れます。インストールした pocket-studio は、Pocket Studio とやりとりするコマンドのあと 1 日に 1 回、新しいキットがあるかを確かめ、あれば A newer Pocket Studio is out. Run: pocket-studio update と表示します。
#サーバー
どのコマンドも、指定がなければ https://studio.pocket.nexus とやりとりします。
| オプション | 内容 |
|---|---|
--server <url> | Studio server (default https://studio.pocket.nexus) |
--templates <dir> | Directory of starter templates, for new and create |
#ファイル
| 場所 | 中身 |
|---|---|
~/.config/pocket-studio/config.json | サーバーごとのアカウントのつながり。$XDG_CONFIG_HOME があれば $XDG_CONFIG_HOME/pocket-studio/。 |
~/.config/pocket-studio/projects.json | このコンピューターでの各プロジェクトの場所。continue が使います。 |
~/.cache/pocket-studio/links/ | ペアリングコードの答え。失敗のあとでも create が続けられるよう、1 日保存します。 |
~/.pocket-studio/ | インストールしたキット。コマンド、スターター、プラグイン、PocketJS のコンパイラとそのキャッシュ。 |
.pocket-studio.json | プロジェクトの中。部屋で作ったゲームではセッションとそのトークンで、だれにも渡さず、コミットもしません。登録したゲームではサーバーとゲームの ID で、トークンは含みません。 |
.pocket/studio/out/<device>/ | デバイスごとの最後のビルド。 |
.pocket/studio/shots/ | shot が書き出す画像。 |
#環境変数
| 変数 | 変えるもの |
|---|---|
POCKET_STUDIO_SERVER | --server がないときのサーバー。 |
POCKET_STUDIO_HOME | キットのインストール先。~/.pocket-studio の代わり。 |
POCKET_STUDIO_BIN | 準備のコマンドが pocket-studio を置くディレクトリ。 |
POCKET_STUDIO_TEMPLATES | --templates がないときのスターターゲームのディレクトリ。 |
POCKETJS_FRAMEWORK_ROOT | キットの代わりにビルドに使う PocketJS のチェックアウト。 |
XDG_CONFIG_HOME、XDG_CACHE_HOME | 上の設定とキャッシュのディレクトリの親。 |
BUN_INSTALL | 準備のコマンドが Bun を探す場所と、ないときに入れる場所。 |
#終了コードとエラー
コマンドは、頼まれたことができたら 0、できなかったら 1 で終わり、理由をエラー出力に書きます。--yes のない delete、失敗した shot の手順、エラーのあるビルドは 1 で終わります。
| 表示 | すること |
|---|---|
This machine is not linked to … | 部屋でリンクコードを受け取り、pocket-studio link <CODE> を実行します。 |
A link code is two groups of four characters, such as K7QD-9M4X. | 部屋からコードをもう一度コピーします。 |
This code was already used | コードは 1 回だけ使えます。部屋で新しいコードを受け取ります。 |
This code expired. Get a new one from the room. | コードの有効期限は 15 分です。新しいコードを受け取ります。 |
That does not look like a link code、Code not found | 部屋が書いたコードではありません。部屋からもう一度コピーします。 |
Unknown command … | この pocket-studio が部屋より古いです。pocket-studio update を実行します。 |
… is not installed: there is no claude on PATH. | エージェントをインストールしてから、準備のコマンドをもう一度実行します。 |
pocket-studio runs on Bun, and this is Node. | bun.sh から Bun を入れるか、Bun を入れてくれる準備のコマンドを実行します。 |
Upload a package before publishing | 登録したゲームは、パッケージかウェブビルドがあると公開できます。 |
Pocket Nexus has not verified this project, … | ウェブビルドは確認済みのゲームのためのものです。パッケージとゲームページには確認は要りません。 |