cli
Zero-dependency Node CLI for terminals and coding agents. Build only what you declare, upload only what changed, and submit an immutable release for human review.
01
Requires Node 20+. No global install needed. Use npx every time, or npm i -g slopfarm.
npx -y slopfarm@latest login npx -y slopfarm@latest init npx -y slopfarm@latest validate --json npx -y slopfarm@latest publish --yes --json
slopfarm.json (safe to commit). Detects a build command and output folder when it can.02
One agent-agnostic handoff for setup, validation, and publishing. Agents should always pass --yes and --json. Progress messages go to stderr; one result object goes to stdout.
complete agent setup
Set up this repository to publish its static browser game on Slop Farm. Work from the game repository root. Be agent-agnostic and use only the public Slop Farm CLI through: npx -y slopfarm@latest Safety rules: - Require Node.js 20 or newer. Check node --version first; if it is unavailable or too old, stop and tell me what must be installed. - Never print, log, paste into chat, or commit SLOPFARM_TOKEN or any credential. - Never invent a sourceUrl or publish a Git remote. Leave sourceUrl null unless I explicitly provide a public GitHub URL. - Do not change the game merely to make publishing easier. Fix only genuine build or static-export problems. - Do not publish until validation passes and I explicitly approve publishing. Setup: 1. Inspect package.json, the existing build scripts, output directories, and entry HTML. Do not guess when the repository already defines them. 2. Run: npx -y slopfarm@latest whoami --json 3. If login is required, run: npx -y slopfarm@latest login This displays a browser approval code. Give me the code/URL and wait for me to authorize it. Never attempt to automate my account login. 4. If slopfarm.json is missing, run: npx -y slopfarm@latest init --yes --agent 5. Review slopfarm.json against https://slopfarm.games/schemas/project.json. Ensure: - build.command is the repository's real production build command - build.output is the static playable output directory - entry points to the start HTML inside that directory, usually index.html - title, description, category, tags, and madeWith are accurate - capabilities.saves and capabilities.multiplayer describe only features the game actually implements - sourceUrl remains null unless I supplied one 6. Keep slopfarm.json and SLOPFARM_AGENT.md safe to commit. Never commit local credentials or build secrets. Verify: 7. Run: npx -y slopfarm@latest validate --json 8. If validation fails, use the JSON error and repository evidence to fix the actual build/export issue, then validate again. 9. Optionally preview in the production sandbox with: npx -y slopfarm@latest preview 10. Summarize the detected build command, output folder, entry file, capabilities, validation result, and any files changed. Ask for my approval to publish. Publish only after I approve: 11. Run: npx -y slopfarm@latest publish --yes --json 12. Then run: npx -y slopfarm@latest status --json 13. Report the project ID, release/version, moderation status, and game URL from JSON stdout. Progress output is on stderr. Explain that a new release is reviewed before it becomes live and the currently approved release stays playable while an update waits. For CI/headless use, SLOPFARM_TOKEN must come from the user's secret store after one interactive login. Do not create, reveal, or persist it yourself.
Run slopfarm login once on a machine with a browser. Approve the code at /cli/authorize.
After one login, export the secret as SLOPFARM_TOKEN. Never print it, commit it, or paste it into chat logs.
03
The committed contract between your repo and Slop Farm. The CLI only runs build.command and only ships files under build.output.
{
"$schema": "https://slopfarm.games/schemas/project.json",
"projectId": null,
"title": "Block Buster",
"description": "Break bricks. Don't miss.",
"category": "Arcade",
"tags": ["arcade", "casual"],
"madeWith": ["Codex"],
"sourceUrl": null,
"capabilities": {
"saves": true,
"multiplayer": { "maxPlayers": 4 }
},
"build": {
"command": "npm run build",
"output": "dist"
},
"entry": "index.html"
}projectIdStable game id. Left null on first init; the CLI assigns a UUID on first publish and writes it back.
title / description / category / tags / madeWithCatalog metadata shown on the game page after approval.
sourceUrlOptional public GitHub URL only. The CLI never invents or publishes a Git remote.
capabilitiesDeclare cloud saves and/or private room multiplayer. Games use the Slop Farm SDK; no credentials belong in the build.
build.commandExact shell command the CLI runs. Empty string means "already built"; use --no-build to skip.
build.outputRelative folder that contains the playable static build (must stay inside the project).
entryStart HTML file inside the output folder (usually index.html).
Full schema: /schemas/project.json
04
| Command | What it does |
|---|---|
loginnpx -y slopfarm@latest login | Authorize this machine with a short browser approval code. |
logout | Remove the saved credential from this machine. |
whoami | Show the authenticated creator account. |
initnpx -y slopfarm@latest init --yes | Create a commit-safe slopfarm.json for the current project. |
validatenpx -y slopfarm@latest validate --json | Run the declared build (unless --no-build) and validate the output folder. |
preview | Preview the build in the production iframe sandbox. |
publishnpx -y slopfarm@latest publish --yes --json | Build, validate, upload changed files, verify objects, and submit an immutable release for moderation. |
status | Show project and moderation status for the manifest projectId. |
releases | List immutable releases for the project. |
rollback <id> | Restore a previously approved release as the live build. |
open | Open the game page in your browser. |
05
--yesNever prompt (required for agents and CI).
--jsonEmit one stable JSON result on stdout; progress goes to stderr.
--dry-runValidate without creating a release or uploading files.
--no-buildSkip build.command and validate existing build.output.
--headlessDo not open a browser (login/preview/open).
--agentWith init, also write SLOPFARM_AGENT.md publishing notes.
SLOPFARM_TOKENBearer publish secret for CI or headless agents. Never commit it.
SLOPFARM_API_URLOverride API origin for local development (defaults to production).
06
slopfarm.json (unless --no-build).projectId, then opens an immutable release.Prefer the browser ZIP flow? Use Upload. Both paths hit the same /api/v1 release pipeline.