Skip to content

CLI commands

This page is a quick reference for jugg CLI commands and options. It does not explain when to use the CLI. See Jugg CLI for its scope and usage recommendations, and CLI guide for step-by-step instructions.

Command syntax

bash
jugg [--console=plain|rich|json] [--project-dir <path>] [--if-compiling wait|interrupt] <subcommand> [options]
jugg help <subcommand>

Global options

OptionDescription
--console=plainPlain-text output without a spinner. This is the default when the Python script is run directly.
--console=richSpinner output for interactive terminals. This is the default for the shell wrapper.
--console=jsonOutputs MCP structuredContent JSON for scripts and Agents.
--project-dir <path>Specifies the MCP projectDir directly and skips automatic matching against the current directory.
--if-compiling waitWaits for an existing compilation to finish before triggering a compile-related command. This is the default.
--if-compiling interruptTriggers a new task without waiting for the old task and uses the server-side interruption semantics.

Camel-case global options such as --projectDir and --ifCompiling are normalized to kebab-case.

Public subcommands

SubcommandPurpose
versionDisplays the CLI version and plugin version.
compileRuns Jugg compilation without deployment.
deployCompiles and deploys.
gradle-buildForces a Gradle build, followed by the installation and launch flow.
clean-reinstallClears app data and reinstalls the APK.
restartRestarts the target app.
instrumentRuns tests from an androidTest source file anchor.
statusShows device, fallback, uncompiled file, and androidTest baseline status.
layout-dumpExports the UI hierarchy as HTML.
view-locateFinds an element by text, resource id, or content-desc.
view-inspectReads read-only View properties through reflection, including getters, Kotlin properties, and public fields.
tapPerforms a tap, long-press, or swipe.
devicesLists connected devices.
activity-stackShows the Activity stack.
ssh-infoRequests remote SSH troubleshooting information.
wait-logsWaits for an app log marker, crash, or timeout.

Compilation and deployment

bash
jugg compile
jugg deploy --always-restart-app false
jugg gradle-build
jugg clean-reinstall
jugg restart
CommandCommon optionsDescription
compileNoneCompiles without deployment.
deploy`--always-restart-app <truefalse>`
gradle-buildNoneForces a Gradle build and outputs a log summary if it fails.
clean-reinstallNoneRecovers from inconsistencies between local history and the installed state on the device.
restartNoneRestarts the app only.

IMPORTANT

To determine the final state of deploy or gradle-build, check both isCompileSuccess and isDeploySuccess. A successful compilation does not mean that deployment succeeded.

Android Test

bash
jugg instrument --source-path app/src/androidTest/java/example/FooTest.kt
jugg instrument --source-path app/src/androidTest/java/example/FooTest.kt --class example.FooTest --method testLogin
OptionDescription
--source-path / --sourcePathRequired. Used to resolve the module and Test APK.
--classTest class. May be omitted for a file that contains a single class.
--methodTest method. The class must already be uniquely identified.
--runnerInstrumentation runner override.
--extrasSemicolon-separated k=v;k2=v2 arguments.

Legacy entry points and aliases such as --package, --testsRegex, --regex, --clazz, --instrumentationRunner, and -e are not supported.

Status and devices

bash
jugg status --refresh-changes true
jugg devices
jugg activity-stack
CommandCommon optionsDescription
status`--refresh-changes <truefalse>`
devicesNoneReturns the device list and marks the selected device.
activity-stackNoneReturns the top Activity and Activity stack.

UI tools

bash
jugg layout-dump --include-gone --all-windows
jugg view-locate --resource-id login_button
jugg view-inspect --text 登录 getText() isEnabled()
jugg view-inspect --resource-id bubble_container layoutParams.leftMargin getLayoutParams().getMarginStart()
jugg tap --resource-id login_button
jugg tap --x-percent 50 --y-percent 80
jugg tap --action swipe --x 500 --y 1600 --end-x 500 --end-y 300 --duration 300
CommandCommon options
layout-dump--root-layout, --include-gone, --all-windows
view-locate--text, --resource-id, --content-desc
view-inspect--text, --resource-id, --content-desc, --class-name, read-only expressions
tap--action, coordinate options, percentage options, element selector, --duration

The tap mode priority is coordinate > percent > element. swipe supports only coordinate or percentage mode, not element mode.

Logs and remote troubleshooting

bash
jugg wait-logs --marker "LoginSuccess" --tags Activity,Repository --timeout-ms 30000
jugg ssh-info --reason "Need to inspect remote Gradle build output"
CommandOptionsDescription
wait-logs--marker, --tags, --timeout-msWaits for a log marker, crash, or timeout.
ssh-info--reasonRemote troubleshooting entry point that requires explicit user consent.