emusoi

Automation

mia commands are the interface for scripts, mia-ui and plugins. Read commands that support structured output take --json; mia api always emits JSON.

Discover the interface

mia api capabilities

The answer names the API version, available queries and feature markers introduced by newer builds:

{
  "version": 1,
  "queries": ["capabilities", "worktrees", "machines"],
  "features": ["direct-http", "project-config", "doctor"]
}

The actual answer includes every query and feature, not this shortened list. Check capabilities before using a feature. Existing response shapes are not wrapped in a version envelope.

JSON commands

commandreturns
mia api <query>worktrees, machines, here, repositories, environments, stacks and base
mia config show --jsoneffective global, project and local configuration
mia doctor --jsonevery check and an overall ok; failures still exit non-zero
mia gateway status --jsonrunning, address, pac, ca, trust, differentBuild, routes
mia env host [worktree] --jsonworktree, machine, and remote staging when present
mia dev --jsonwhether main is lent, and its worktree, path, stashed
mia env sync <worktree> status --jsonsync session, problems and conflict count
mia env sync <worktree> conflicts --jsonthe same session with conflictPaths
mia env sync <worktree> preview --jsonignore rules and secret paths excluded or allowed
mia gc --merged --jsonclean merged worktrees offered for removal, without removing them
mia stack sync --jsonfetched base, current layer, dropped landed layers and rebase count

mia dev <worktree> --json reports the new lent state; mia dev off --json reports {"lent": false}. --follow cannot be combined with --json.

Examples of placement and gateway state:

{"worktree":"monduli","machine":"build","staging":"/home/me/.mia/shop/monduli"}
{"running":true,"address":"127.0.0.1:7842","pac":"http://127.0.0.1:7842/proxy.pac","ca":"/home/me/.config/mia/gateway/ca.pem","routes":["monduli.mia"]}

Exit status

A command that runs another command preserves its exit status where possible, including mia run, mia env run, mia env exec and interactive shells. Mia itself uses 1 for failure, 3 for a missing worktree or query and 64 for usage errors.

Plugin name collisions

A verb declared by two enabled plugins is refused until all but one are disabled. A verb that shadows a core command is also reported by mia plugin ls and mia doctor.

Edit this page

    ↑↓ choose ⏎ open esc close