Baton

v0.2.10
io.github.kanumuri9593/baton Checked 5 hours ago Published 1 month ago

Run, hot-reload and screenshot Flutter, web, React Native and native iOS/Android apps.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

diagnose

Search bounded log and network evidence across projects. Defaults to errors only and 20 findings. Findings are grouped by session; repeats of the same error are counted once (×N), and a stack is collapsed to its first app frames. Pass a trace ID and errorsOnly=false to follow a request across Node services. Use exact session IDs to limit scope.

ParameterTypeDescription
errorsOnlyboolean
limitinteger
querystring
rootstring
sessionsarray
sincenumber

run_workflow

Launch up to eight project targets in dependency order and wait for each to become ready, in one call. Stops launching dependents on failure. Returns compact session IDs, URLs and errors; retains sessions for debugging. Use browser/device tools next to validate the actual flow. Paths must be absolute.

ParameterTypeDescription
name *string
steps *array

inspect_project

Read fresh launch sources, configuration problems, nested projects and guidance file paths. Does not run commands or expose environment values. Use before choosing an environment, checkout and device; review screenshot evidence rather than treating capture as visual approval.

ParameterTypeDescription
cwdstring

list_targets

List everything runnable in a project: launch.json configs, package.json dev scripts, Flutter entrypoints.

ParameterTypeDescription
cwdstringProject directory. Defaults to the daemon working directory.

list_sessions

List running sessions with their status, capabilities, URLs and device.

list_checkouts

List git checkouts this project can run from: This checkout, linked worktrees, local branches, remotes.

ParameterTypeDescription
cwdstringProject directory. Defaults to the daemon working directory.

run_target

Start a target by name. Returns the new session id to use with the other tools. Optional branch or checkout runs from a git worktree without moving the current folder.

ParameterTypeDescription
target *stringTarget name or an unambiguous substring of it.
branchstringGit branch or remote ref to run from a Baton-owned copy. Mutually exclusive with checkout.
checkoutstringPath to an existing worktree to attach. Mutually exclusive with branch.
cwdstring
deviceIdstringForce a specific device or simulator.

hot_reload

Hot reload a session, keeping app state. Flutter only. Returns code 0 on success; a non-zero code carries the compile error.

ParameterTypeDescription
allbooleanReload every running session.
reasonstring
sessionstringSession id. Omit with all=true.

hot_restart

Hot restart a session, dropping app state. For web dev servers and plain processes this reboots the process.

ParameterTypeDescription
allboolean
reasonstring
sessionstring

stop_session

Stop one session, or every running session with all=true.

ParameterTypeDescription
allboolean
sessionstring

forget_session

Remove stopped sessions from the list. Running sessions must be stopped first. Use all=true to clear every stopped session.

ParameterTypeDescription
allboolean
sessionstring

read_logs

Read recent output from a session, newest last. Use filter to grep for an error: it searches all retained output and returns the last `tail` matching lines. Works for a currently running session id, and for a past run (its own session id, or the runId from list_run_history) even after it has stopped or the daemon has restarted.

ParameterTypeDescription
session *stringA live session id, or a past run's session id / runId.
filterstringCase-insensitive regular expression.
tailnumberHow many lines (default 200); with a filter, how many matching lines.

list_run_history

List past and current runs persisted on disk -- survives daemon restarts. Each line is runId, name, status (live / exit N / ?), how long ago it started, and its log size. Pass a runId to read_logs to see its output.

ParameterTypeDescription
cwdstringProject directory; limits the list to that project.
limitnumberMaximum runs to return (default 50).

list_network_requests

List HTTP requests the app has made, newest last. One line each: id, method, status (… while in flight), duration in ms, response bytes, URI. Flutter debug/profile sessions only, while the app is running. Captures dart:io HttpClient traffic (package:http and dio with its default adapter) — NOT cupertino_http/cronet_http native clients, WebSockets or raw sockets. Traffic those make is invisible here, not absent.

ParameterTypeDescription
session *stringSession id from list_sessions.
filterstringCase-insensitive regular expression over "METHOD uri".
tailnumberHow many requests (default 200).

get_network_request

One captured request in full: headers, timeline events, and optionally the bodies. Fetched from the running app, so it works only while the session is alive. Flutter debug/profile sessions only, while the app is running. Captures dart:io HttpClient traffic (package:http and dio with its default adapter) — NOT cupertino_http/cronet_http native clients, WebSockets or raw sockets. Traffic those make is invisible here, not absent.

ParameterTypeDescription
id *stringRequest id from list_network_requests (the short number works too).
session *string
includeBodiesbooleanInclude request and response bodies (capped at 256 KB).

clear_network_requests

Forget every captured request for a session, in the daemon and in the app itself. Useful before reproducing one specific call.

ParameterTypeDescription
session *string

read_launch_config

Read a project's launch.json exactly as written -- comments, formatting and all -- plus the configurations it defines and any pre-flight problems with them. Returns file: null when the project has none; a file that does not parse still returns its text, with the parse errors.

ParameterTypeDescription
cwdstringProject directory. Defaults to the daemon's current project.

write_launch_config

OVERWRITE a project's launch.json with the text given. The whole file is replaced, so read it with read_launch_config first and send the full text back, or comments and configurations you did not mean to touch are lost. Invalid JSONC is refused before anything is written. Returns the path written and any pre-flight issues in the result.

ParameterTypeDescription
text *stringThe complete file contents. JSONC: comments and trailing commas are allowed.
cwdstringProject directory. Defaults to the daemon's current project.
filestringWhich convention to create for a project that has neither. A project that already has a launch.json is written back to that same file.

list_devices

List connected devices, simulators and emulators available to Flutter. Use boot_device to start one that is not running.

ParameterTypeDescription
cwdstring

set_debug_flag

Toggle a framework debug flag on a running Flutter session, e.g. ext.flutter.debugPaint with {enabled: true} or ext.flutter.timeDilation with {timeDilation: 5}. Values are sent as the strings Flutter expects.

ParameterTypeDescription
method *stringService extension name, e.g. ext.flutter.debugPaint
session *string
paramsobject

screenshot

Capture the screen of a running session so the visual result of a change can be checked. iOS simulators and Android devices capture the device screen. Web sessions (Vite, Next.js, Flutter web...) load their URL in a headless Chrome, Edge or Brave at the viewport given, and also report the page's console errors and failed requests; they capture at 1x unless scale=2. A capture proves an image was written, not that the UI is right: look at it.

ParameterTypeDescription
session *string
outstringWhere to save the PNG. Defaults to a path under the daemon's state directory.
scaleWeb sessions only: device pixels per CSS pixel. 1 (default) keeps the image small; 2 for fine detail, at about 4x the image tokens.
viewportstringWeb sessions only: phone (390x844), tablet (820x1180), desktop (1280x800, the default) or WIDTHxHEIGHT.

check_change

After editing code: apply the change and return the evidence in one call, instead of hot_reload + wait_for + read_logs + list_network_requests + screenshot. action=auto hot reloads Flutter, leaves web and React Native to HMR / Fast Refresh, and restarts everything else. Answers ok/not ok with only what is new since the call began: reload result, error lines (for web, including the browser console), failed requests, and a screenshot. Prefer this as the default step after every edit.

ParameterTypeDescription
session *string
actionstringDefault auto.
scaleWeb sessions only: device pixels per CSS pixel. 1 (default) keeps the image small; 2 for fine detail, at about 4x the image tokens.
screenshotbooleanDefault true. false returns text only; a web page is still loaded headlessly so its console errors count.
settleMsnumberWait after the action before collecting evidence (default 1500).
viewportstringWeb sessions only: phone (390x844), tablet (820x1180), desktop (1280x800, the default) or WIDTHxHEIGHT.

boot_device

Boot an iOS simulator or Android emulator by name (e.g. "iPhone 17 Pro", "Pixel_8") or id, and wait until it is up. Returns the device id to pass to run_target as deviceId. Call with no name to list what can be booted.

ParameterTypeDescription
cwdstring
namestringDevice name, an unambiguous part of it, or its id.

wait_for

Block until a session reaches a state. Use after run_target or hot_restart instead of polling read_logs.

ParameterTypeDescription
session *string
timeoutMsnumberDefault 60000, capped at 900000 (15 minutes, enough for a first native build).
until

session_summary

Cheap structured overview -- call this before deciding what to do next.

ParameterTypeDescription
session *string

run_proof

Run proof verification and return a zip with screenshots, network call counts, response times and logs.

ParameterTypeDescription
target *stringTarget name or unambiguous substring.
allowstringComma-separated regexes allowed in noErrors check.
appearancestringComma-separated: light,dark
branchstringBranch to verify in an isolated worktree.
checkoutstringExisting worktree to verify.
checksstringComma-separated checks: running,noErrors,noFailedRequests,screenshot
cwdstring
devicesstringComma-separated device names, e.g. "iPhone SE,iPhone 16 Pro Max".
keepbooleanLeave sessions running after the proof.
localestringComma-separated locale codes
outstringBundle output directory.
routestringDeep link or URL to open on each device before capture.
settleMsnumberMilliseconds to wait after navigation before screenshot (default 2000).
textScalestringComma-separated scales, e.g. 1.0,1.5
timeoutMsnumberPer-cell running timeout (default 120000).

list_proofs

List past proof bundles, newest first.

ParameterTypeDescription
limitnumberMaximum entries (default 20).

show_dashboard Show Baton

Show a live Baton control panel in the chat: every running app with its simulator or URL, status, CPU and memory; per-app Reload, Restart, Pause/Resume, Bring to front, Logs, Screenshot and Stop; quick actions for all apps; and New run (pick a project, target and device, or boot a simulator). Use when the user asks to see or show Baton, their runs or simulators.

dashboard_action Baton card action

Used by the Baton card: refresh; catalog (projects and devices for New run); run a project target on a device; boot a device; logs, reload, restart, pause, resume, front, screenshot, stop or dismiss (forget a finished run) one session; or reload/restart/pause/resume/front/stop all. Returns the card state.

ParameterTypeDescription
action *string
devicestring
rootstring
sessionstring
targetstring