# CLI reference

`elide --help` lists everyday commands; `elide --help-all` adds the Advanced group and every flag.
`elide help <command>` prints that command's section of this page.

## Run and develop

### `run`

Run a file, a named script, or the project entrypoint. Resolution order: [Project setup](/docs/projects#add-a-script).

```bash
elide run app.ts -- --port 3000
```

| Flag | Effect |
| --- | --- |
| `-s, --snippet CODE` | Run inline code instead of a file. |
| `-l, --language LANG` | Snippet language: `js` (default), `ts`, `python`, `java`, or `kotlin`. |
| `--contexts=<N\|auto>` | Application contexts to prespawn; `auto` sizes from physical cores. Default `1`. |
| `--surface MODE` | In a project, inside Tern: how the run draws, `inline` (default), `screen` or `auto`. |

Java and Kotlin snippets are whole programs with a `main`; arguments after `--` reach it:

```bash
elide run -l java -s 'void main() { System.out.println("hello from java " + (6 * 7)); }'
elide run -l kotlin -s 'fun main(args: Array<String>) = println(args.joinToString())' -- a b
```

```text
hello from java 42
a, b
```

A Java snippet without a class or `main` fails with `Could not find a top-level class/record/enum or a main in the
Java snippet.`; a Kotlin snippet without `main` fails with ``Could not find a `main` function in the Kotlin
snippet; declare `fun main() { ... }`.``

Pkl and PCF files render directly to stdout, without an Elide project:

```bash
elide --format=json config.pkl > config.json
elide run --format yaml config.pcf > config.yaml
elide config.pkl
```

Supported formats are `json`, `yaml`, and `pcf`. Without `--format`, the module's output
configuration applies (PCF by default). Imports resolve relative to the input file. Evaluation
errors go to stderr and exit nonzero; unsupported formats exit with status 2. `--quiet` preserves
the rendered output. TOML output is not supported. See [Render Pkl configuration](/docs/pkl-configuration)
for format selection, shared defaults, and CI examples.

Markdown files render as terminal documents. See [Markdown in the terminal](/docs/terminal-markdown)
for runbooks, paging, and text exports:

```bash
elide README.md
elide --no-color notes.markdown
```

Headings, lists, quotes, tables, task lists, links, and syntax-highlighted fenced code use terminal
layout. Paragraphs wrap at word boundaries to fit terminal width. Redirected output is plain unless color is explicitly forced. `--format` applies only to
Pkl and PCF files. Document rendering rejects `--sandbox` and `--limit`.

Debugger, profiler, and coverage flags: [Diagnostics flags](#diagnostics-flags).

In a [Tern](https://docs.stencil.so/tern/) terminal, `elide run` in a project draws the run as a view:
its state, the build's tasks and compile errors when the run builds first, the program's last 300 output
lines, and Stop. The program runs on a terminal of its own (`TERM=dumb`): it reads what you type, sees a
TTY of the pane's size, and `Ctrl+C` interrupts it. The view is inline by default and stays in scrollback
when the run ends; `--surface=screen`, or `ELIDE_TERN_SURFACE=screen` in the environment, opens the full
Run page instead, with Run again (`r`). `--help`, `--progress`, `--project`, redirected output, and a
directory with no `elide.pkl` above it keep the plain run. Each run keeps its output in
`.dev/reports/run/tern/<run>/output.log`, and only the newest 10 runs are kept. `elide run` exits with
the program's status, and `130` when stopped or interrupted. Outside Tern, `--surface` is accepted and
ignored.

In a project declaring `android`, `elide run [app]` builds, installs and launches its one application (or
the one named), then prints its log until interrupted or the app exits. Each form runs a build target,
which `elide build --inspect` lists:

| Command | Target |
| --- | --- |
| `elide run [app] [--device=<serial>]` | `android-run-<app>`: the device named, else the one attached, else the project's emulator, booted if needed |
| `elide run [app] --emulator` | `android-run-emulator-<app>` |
| `elide run [app] --debugger[=<port>]` | `android-debug-<app>`: launched suspended, JDWP forwarded to the port (any free one when bare) |
| `elide run [app] --watch` | the above, rebuilt, reinstalled and relaunched when a source changes; the change ends the running session (its log, its debug forward) first |

More than one attached device is an error naming them. `--debugger` prints
`Listening for transport dt_socket at address: <port>`, the line a JVM prints. On a terminal, an SDK
missing components it has no license acceptance for is offered for install first. See
[Run and debug](/docs/toolchain/android/run).

A booted emulator shows its window only on a terminal with a display and outside CI; elsewhere it runs
headless (`--window`/`--no-window` decide explicitly). An emulator without hardware acceleration fails
before booting, naming the fix (on Linux, membership of the `kvm` group). Elide starts the `adb` server
with `ADB_EMU=0` unless `ADB_EMU` is set, and fails within 30 seconds if it does not start: on hosts that
drop connections to closed loopback ports (WSL2 with mirrored networking) a scanning server takes over
half an hour, and one already stuck is cleared with `adb kill-server`. See
[Headless hosts, CI and WSL](/docs/toolchain/android/run#headless-hosts-ci-and-wsl).

### `serve` (alias `start`)

Serve a directory as static files, or a script that exports a fetch handler ([Development Server](/docs/dev-server)).

```bash
elide serve ./public
elide serve server.ts -- --verbose
```

| Flag | Effect |
| --- | --- |
| `--host HOST` | Bind host. Default `127.0.0.1`. |
| `--port PORT` | Bind port. Default `8080`. |
| `--contexts=<N\|auto>` | Application contexts to prespawn, as for `run`. |
| `--no-tui` | Plain log output instead of the dashboard. |
| `--surface MODE` | How the server draws inside Tern: `inline` (the default), `screen`, `auto`, or `off` for plain log output (as `--no-tui`). |
| `-- SCRIPT_ARGS` | Arguments for the served script. |

### `dev`

Like `serve`, with the same flags, on port `3000`. For a directory, HTML pages reload in the browser when files
change; a script is not reloaded. `--no-watch` turns off watching and reload.

### `install`

Install project dependencies.

| Flag | Effect |
| --- | --- |
| `--ecosystems LIST` | Ecosystems to install, e.g. `maven,npm`. Default `maven`. |
| `--workspace` | Install every ecosystem the project declares. |
| `--with CLASSIFIER` | Download `sources`, `docs` (alias `javadoc`), or `indexes`. Repeat to select several. |
| `--slim` | Download classes only (the default when no `--with` option is given). |
| `--fresh` | Download all dependencies, refreshing artifacts in the global cache. |
| `--direct` | Copy artifacts into the project instead of linking them. |
| `--accept-android-licenses` | Accept the Android SDK licenses for the components this install downloads. |
| `--update` | Re-resolve the Android SDK components recorded in the lockfile. |
| `--surface MODE` | How the install draws inside Tern: `inline` (the default), `screen` or `auto`. |

An IDE can run `elide install --with indexes` after a classes-only install. For each release JAR
whose Pkgst repository advertises a Rote index, Elide installs the sibling `-rote-index.jar` in
the project Maven repository. Source and documentation requests also work with standard Maven repositories.

In a project declaring `android`, `elide install` also installs the Android SDK components the project
needs (the platform and build-tools a build runs, plus every component the lockfile recorded) into
the SDK `android.sdk` names, else `ANDROID_HOME`, `ANDROID_SDK_ROOT`, the platform's default
location, or the SDK Elide manages under `~/.elide/toolchains/android`. Nothing is installed under an
unaccepted license: on a terminal the install asks once; elsewhere pass `--accept-android-licenses`
or set `ELIDE_ANDROID_ACCEPT_LICENSES=1`. `android.sdk = "system"` never downloads anything. An
Android project runs this install even when it declares no Maven package. See [Android SDK](/docs/toolchain/android/sdk).

In a [Tern](https://docs.stencil.so/tern/) terminal, `elide install` in a project draws the install
inline: a row per ecosystem with its packages, how many came from the cache and how many were
downloaded, a bar per artifact download while it runs, problems as cards, and the resolved Maven
graph as a folded tree from the packages the project asks for. An install with nothing to download
still shows the graph. `--surface=screen`, or `ELIDE_TERN_SURFACE=screen`, opens the full Install
page instead, with Reinstall. Each finished run writes `.dev/reports/install/tern/<run>/install.json`
(outcome, package and download counts, and one entry per ecosystem); only the newest 10 runs are
kept. `--help`, `--progress`, `--project`, redirected output, and a directory with no `elide.pkl`
above it keep the plain install, and the hosted install cannot answer the Android SDK license
question: pass `--accept-android-licenses`. Outside Tern, `--surface` is accepted and ignored.

### `repl`

Start the interactive REPL. A bare `elide` in a terminal does the same.

### `python`

Run Python like `python`; tokens after the script go to the program. Install it with [`setup`](#setup) first.

```bash
elide python script.py --flag-for-the-script
```

| Flag | Effect |
| --- | --- |
| `-c CMD` | Run a program passed as a string. |
| `-s` | Leave the user site directory off `sys.path`. |

Interpreter flags (`-B`, `-W`, `-m`, …): [Python options](#python-options).

### `uv`

Manage packages in the active project's automatic Python environment. Requires the Python component.

```bash
elide uv install attrs
elide uv compile requirements.in --generate-hashes --output-file requirements.txt
elide uv sync requirements.txt
elide uv list
```

Package operations: `install`, `sync`, `compile`, `check`, `list`, `freeze`, and `show`, with an optional
`pip` prefix. `elide uv tool run` executes tools in bounded, isolated environments; `tool list`,
`tool uninstall KEY`, and `tool prune --all` manage that cache. Elide selects its own interpreter. Runtime downloads,
self-update, and upstream project/runtime management commands are unavailable. See
[Packages and virtual environments](/docs/python-packages).

## Build and test

### `build`

Build what `elide.pkl` declares. Bare tokens name tasks (`deps`, `compile`, `test`, `clean`; leading `:` optional).
Arguments after `--` go to the subprocess.

```bash
elide build deps compile
```

| Flag | Effect |
| --- | --- |
| `-i, --inspect` | List the project's tasks. |
| `--workers=<N>` | Run at most N tasks at once. |
| `--no-cache` | Disable the build cache for this run. |
| `--offline` | Do not fetch remote resources. |
| `-f, --flag NAME[=VALUE]` | Set a manifest build flag ([Build Flags](/docs/toolchain/build-flags)). |
| `--surface MODE` | How the build draws inside Tern: `inline` (the default), `screen` or `auto`. |
| `--release` | Android: build each application that leaves `release` unset as a release, shrunk with R8 when it has ProGuard rules and leaves `minify` unset. |

In a [Tern](https://docs.stencil.so/tern/) terminal, `elide build` in a project draws the build
inline, in the pane's output: its state, error and warning counts, task progress, and each javac
and kotlinc diagnostic as a card with the source excerpt, notes and an Open button for the location.
Cards are grouped by file. Below them, a task table lists each task with its project, outcome (a
skipped task shows the engine's reason, such as `Up to date`), a bar placing it on the build's
timeline, and its time; a folded Output section holds the build's last 300 output lines. When the
build ends the block stays in scrollback. `--surface=screen`, or
`ELIDE_TERN_SURFACE=screen` in the environment, opens the full Build page instead, with Rebuild; the
flag wins over the variable. Each run writes its diagnostics to
`.dev/reports/build/tern/<run>/diagnostics.json`, at most 500 of them with exact counts, and
`finished_ms`, the run's end in Unix milliseconds. Then `.dev/reports/build/tern/latest` is
rewritten to hold the newest run's directory name, and only the newest 10 runs are kept.
`elide build --inspect` draws the task list: each project's tasks, a task with options folding them beneath it, and a
play button that builds the task. `--help`, `--progress`, `--project`, redirected output, and a directory with no
`elide.pkl` above it keep the plain build. Outside Tern, `--surface` is accepted and ignored. See
[Build diagnostics in Tern](/docs/tern-build).

In an Android project, an application that leaves `release` unset is a debuggable debug build;
`elide build --release` makes it a release, publishes R8's `mapping.txt` beside each shrunk archive,
and records in the lockfile which `d8` or R8 dexed it. A release declaring no `signing` is published
unsigned, with a warning. See
[Release builds](https://github.com/elide-dev/elide/blob/main/docs/android.md#release-builds).

### `test`

Run tests, or only those under the given paths. JVM tests come from a test source set: `src/test/java` or
`src/test/kotlin` by convention, or one declared in `elide.pkl` (see [Source sets](/docs/toolchain/source-sets)).

| Flag | Effect |
| --- | --- |
| `-t, --test-name-pattern REGEX` | Run tests whose name matches. |
| `--where CEL` | JS: run tests for which a [CEL](/docs/api-cel) expression over `name`, `parents` and `file` is true. |
| `--select SELECTOR` | JVM: run what a selector names: `class:`, `method:`, or `package:`. Repeatable. |
| `--include-tag EXPR` | JVM: run tests matching any include. Repeatable. |
| `--exclude-tag EXPR` | JVM: skip tests matching any exclude. Repeatable. |
| `--bail[=N]` | Stop after N failures. Default `1`. |
| `--test-timeout MS` | Per-test timeout. `--timeout` limits the whole run. |
| `--only` | Run only tests marked `.only`. |
| `--concurrency N` | Tests at once (JS files, JVM classes). Default `1`. |
| `--reporter NAME` | `console`, `junit`, or `tap`. |
| `--reporter-outfile DIR` | Reporter output directory. |
| `--surface MODE` | In Tern: `inline` (default), `screen`, or `auto` (inline). |
| `--device[=<serial>\|<name>\|all]` | Android: run instrumented tests on a device instead of host tests. |
| `--tests CLASS[#METHOD]` | Android: instrumented tests to run with `--device`. Repeatable. |

In an Android project, `elide test` runs host tests under Robolectric. `elide test --device` runs
instrumented tests through the `android-test-<app>` targets: with no value on the attached device or the
project's emulator, with a serial on that device, with a name from `android.devices` on that device
(`android-test-<app>-on-<name>`), and with `all` on every declared device (`android-test-<app>-on-all`). See
[Android tests](/docs/toolchain/android/testing).

In a [Tern](https://docs.stencil.so/tern/) terminal, `elide test` shows its results natively
instead of printing them and exits nonzero when the last run failed, and `130` when a run is
cancelled (`x`) or interrupted (Ctrl+C) before it finishes. By default the results draw
inline, in the pane's output: the run's status, its numbers and the results table, with the selected
test's failure beneath it; when the run ends the block stays in scrollback. `--surface=screen`, or
`ELIDE_TERN_SURFACE=screen` in the environment, opens the full Tests page instead, with failures,
output and coverage views; the flag wins over the variable. A variable naming no mode prints one
warning on stderr, with the value and the accepted modes, and the run uses `auto`. A Tern without
inline surfaces gets the page. `--reporter`, globs, and redirected output keep the plain run. Outside Tern, and on any run
that keeps the plain output, `--surface` is accepted and ignored, so a launcher can always pass it.
Test files and failure locations inside a
project link as `elide://source` URLs, which the Tern plugin opens at the line in its editor.
In the project workspace, **Debug this test** (`d`) on a selected JavaScript or TypeScript test
launches the project debugger in test mode with a breakpoint at the failure line.
Debugging tests: [Debugging](/docs/debugging). All Tern views: [Terminal surfaces](/docs/tern-terminal).

### `format` (alias `fmt`)

Format Java and Kotlin sources. Paths and formatter flags follow `--`: `elide format -- src`.

| Flag | Effect |
| --- | --- |
| `--list-files` | Print each file that fails the check or is changed. |
| `--list-diffs[=N]` | Print a diff per file in check mode; with `N`, only when N or fewer fail. |
| `--install` | Run `elide install` first, so `--jfmt` resolves imports against the project's dependencies. |

`--dry-run` (after `--`) checks without writing; it exits `1` if a file would change.

### `project`

| Command | Purpose |
| --- | --- |
| `elide project info` | Show resolved project metadata; for an Android project, the SDK root and its source, its components at the revisions the lockfile recorded (flagging any installed at another revision), the pinned tools, what dexed each application, what is missing, and attached devices and emulators. |
| `elide project advice` | Show project advice for coding agents. |
| `elide project export` | Print the project as JSON, a `pom.xml`, or an IntelliJ model. |

### `publish`

```
elide publish [PROJECT...] [--to <name>] [--skip-existing] [--dry-run] [--sign | --no-sign] [--no-wait]
              [--allow-http-repositories] [--offline]
```

Builds the project's JARs and installs them with a POM into the local Maven repository (`~/.m2/repository` unless
`publishing.maven.localRepository` says otherwise). From a workspace root it publishes every project. From a member it
publishes that member and every workspace project its POM depends on, so the coordinates it names are installed too.
Every project is built, staged and signed before any is published, so a failure there publishes nothing; a failed
upload can still leave the projects uploaded before it in place. Configure it in the manifest's
[`publishing`](/docs/elide-pkl-reference#publishing) block.

Naming workspace projects publishes exactly those, for example only the ones that changed since the last release:
`elide publish core util --to central`. A workspace project they depend on but that isn't named must already be in the
target, at the version its manifest declares, or nothing is published. Projects you leave out keep their `publishing`
configuration, so a later run can publish them again.

| Flag | Effect |
| --- | --- |
| `--to <name>` | Publish to the repository of that name in `publishing.maven.repositories` instead of the local one. |
| `--skip-existing` | Leave out every project whose version is already in the target, and say which. A snapshot version is always published. Useful to rerun a release that failed halfway. |
| `--dry-run` | Stage (and sign) the POM and JARs under `.dev/staging/publish/maven` and list them, without publishing. With Maven Central, also writes and lists the bundle, and needs no Portal token, but still signs, so it needs a usable signing key. With named projects or `--skip-existing`, it still looks versions up in the target, so it lists what a real run would publish; for Central that needs the token. |
| `--sign`, `--no-sign` | Sign the files with `gpg`, or don't. Remote publishes sign by default when `signing` is set. |
| `--no-wait` | For Maven Central, return once the deployment is uploaded instead of waiting for validation. |
| `--allow-http-repositories` | Allow a plain `http://` repository other than localhost. |
| `--offline` | Build without fetching remote resources. |

A version is in the target when its POM is in the local repository, when the remote repository serves its POM, or when
the Central Portal reports it published. A Central deployment that was validated but not released doesn't count.
A lookup that fails for any other reason, such as refused credentials, stops the run instead of counting as missing.

## Project export formats

`elide project export --format=<json|pom|intellij>` prints to stdout. Default `json`.

| Format | Output |
| --- | --- |
| `json` | The evaluated manifest. Type discriminators use `@type` and Pkl type names. |
| `pom` | Coordinates, dependencies by scope, repositories, compiler levels, source and resource roots. |
| `intellij` | One module per source set, with content roots, dependencies, SDK level and Kotlin facet. |

### pom

| POM element | Value |
| --- | --- |
| `<artifactId>` | The project name. |
| `<groupId>` | The workspace root's name, or the project name outside a workspace. |
| `<version>` | The manifest's version, or `0.0.0`. |
| `<modules>` | A workspace root's members. |
| `<parent>` | A member's workspace root. |

| Manifest | Maven scope |
| --- | --- |
| `packages`, `modules` | `compile` |
| `compileOnly`, `devPackages`, `processors` | `provided` |
| `runtimeOnly` | `runtime` |
| `testPackages` | `test` |

Sibling projects become coordinate dependencies and local JARs `system`-scoped. `exclusions` and `kotlinPlugins`
are omitted. Extra source roots use `build-helper-maven-plugin`.

### intellij

Modules are named `<project>.<sourceSet>`. Paths are relative to `root`, the workspace or project root. Libraries
resolve from `localRepository` (default `.dev/dependencies/m2`), so run `elide install` first. The
[IntelliJ IDEA plugin](/docs/intellij) imports this model.

## JVM toolchain

Elide bundles JDK 25 and Kotlin. Elide's flags go before `--`; tool arguments follow it.

### `java`

Run JVM programs, like `java`.

```bash
elide java -- -jar app.jar
```

### `javac`

Compile Java, like `javac`. See [Java Compiler](/docs/toolchain/jvm/javac).

| Flag | Effect |
| --- | --- |
| `--jar JAR` | Pack a JAR at this path after compiling. |
| `--manifest MANIFEST` | Manifest for the `--jar` output. |
| `--max-errors N` | Show at most N distinct errors; `0` shows all. |
| `--report-used-deps PATH` | Write the classpath entries the compiler read, supertypes included (Bazel strict-deps). |
| `--jdeps PATH` | Write a Bazel `.jdeps` proto with each entry's kind and the classes used from it, with SHA-256 hashes. |
| `--target-label LABEL` | Target label recorded in the `--jdeps` proto. |
| `--unused-inputs PATH` | Write classpath entries the compile neither used nor searched (Bazel `unused_inputs_list`). |
| `--persistent_worker` | Run as a Bazel persistent worker. |
| `--classpath-cache` | Reuse classpath state across worker compilations. Worker only. |
| `--capabilities` | Print compiler capabilities as JSON. |
| `--abi-only` | Emit only an ABI (header) JAR to `--emit-abi`, `--jar` or `-d`. |
| `--emit-abi PATH` | Also emit an ABI (header) JAR next to the full compile. |
| `--bindings NAME` | Select a named `java.bindings` group from the project; repeat to combine groups. |
| `--jextract GLOB` | Generate and compile Java FFM bindings for matching C headers; repeat for more headers. |
| `--jextract-package NAME` / `--jextract-class NAME` | Package and header-class name for ad hoc bindings. |
| `--jextract-include-dir DIR` | Header include directory for ad hoc bindings; repeatable. |
| `--jextract-define NAME[=VALUE]` | Preprocessor definition for ad hoc bindings; repeatable. |
| `--jextract-library NAME` | Native library for ad hoc bindings; repeatable. |
| `--emit-bindings DIR` | Also export generated Java sources to this directory for IDEs or other tools. |

Header generation runs in memory before javac attribution. The native library is a separate runtime dependency.
See [C header bindings](/docs/toolchain/jvm/javac#c-header-bindings) for named groups, source-set selection,
generation-only builds, and a complete example.

### `kotlinc`

Compile Kotlin, like `kotlinc`. See [Kotlin Compiler](/docs/toolchain/jvm/kotlinc).

| Flag | Effect |
| --- | --- |
| `--incremental` | Compile incrementally; state goes in `.dev/artifacts/kotlinc/incremental/`. |
| `--incremental-cache-dir DIR` | Incremental state directory. |
| `--plugins LIST` | Built-in plugins: `metro`, `serialization`, `atomicfu`, `power-assert`, `compose`, `parcelize`. |
| `--metro` / `--no-metro` | Force the Metro DI plugin on or off. |
| `--compose` / `--no-compose` | Force the opt-in Compose compiler plugin on or off; requires a Compose runtime dependency when enabled. |
| `--parcelize` / `--no-parcelize` | Force the Parcelize plugin on or off; its runtime joins the classpath when enabled. |
| `--tests` | Enable test plugins (power-assert). |
| `--abi-only` | Emit only an ABI (header) JAR to `-d`; `--emit-abi PATH` after `--` adds one to a full compile. |
| `--kapt-sources PATH` | Run annotation processors over the sources instead of compiling; see [Kotlin Compiler](/docs/toolchain/jvm/kotlinc). |
| `--ksp-output DIR` | Run KSP2 symbol processors over the sources instead of compiling (`--ksp-sources`/`--ksp-classes` write jars); see [Kotlin Compiler](/docs/toolchain/jvm/kotlinc). |
| `--max-errors N` | Show at most N distinct errors; `0` shows all. |
| `--report-used-deps PATH` | Write the classpath entries the compiler read, supertypes included (Bazel strict-deps). |
| `--jdeps PATH` | Write a Bazel `.jdeps` proto with each entry's kind and the classes used from it, with SHA-256 hashes. |
| `--target-label LABEL` | Target label recorded in the `--jdeps` proto. |
| `--unused-inputs PATH` | Write classpath entries the compile neither used nor searched (Bazel `unused_inputs_list`). |
| `--persistent_worker` | Run as a Bazel persistent worker. |

### `jar`

Build JARs, like `jar`. See [JAR Assembly](/docs/toolchain/jvm/jar).

## Native toolchain

### `cc`

Elide's packaged clang. Every argument after `--` goes to the clang driver unchanged; linking uses the packaged
LLD and your system's C library:

```bash
elide cc -- hello.c -o hello
elide cc -- -O2 -Iinclude -c answer.c -o answer.o
elide cc -- --help
```

See [C compiler and linker](/docs/toolchain/native/cc) for headers, libraries and distribution support.

### `jextract`

Generate Java FFM sources from C headers with the embedded OpenJDK generator. Generator arguments follow `--`:

```bash
elide jextract -- --output generated --target-package example.ffi --header-class-name NativeApi native/api.h
```

Common generator options are `--output`, `--target-package`, `--header-class-name`, `-I`, `-D`, and `-l`.
`elide jextract -- --help` lists the bundled generator's options. Compile the generated Java and provide the native
library and native-access permission at runtime. For generation and compilation in one invocation, use
[`javac --jextract`](/docs/toolchain/jvm/javac#c-header-bindings).

See [C header bindings with jextract](/docs/toolchain/native/jextract) for a complete shared-library example, symbol
selection, library lookup, and FFM memory lifetimes.

## Setup and tooling

`elide agent` commands are for coding agents and other non-interactive callers; see
[Elide for AI Agents](/docs/agents).

| Command | Flags | Effect |
| --- | --- | --- |
| `elide agent help [TOPIC]` | `-l, --lang LANG` | Print the agent guide, or a documentation topic, as Markdown. |
| `elide agent diagnostics` | `--json` | Print the version, platform, crash-report directory and terminal state. |
| `elide agent bug` | `--kind bug\|perf\|expectation\|feature`, `--json` | Print an issue URL and report body; `--json` prints an `elide.report/1` skeleton. Submits nothing. |
| `elide agent perf -- COMMAND` | `--runs N` (`10`), `--warmup N` (`3`), `--baseline COMMAND`, `--against VERSION`, `--json` | Time a command locally, optionally against another runtime or an installed Elide version. |

```bash
elide agent perf --runs 5 --warmup 1 -- elide run hi.mjs
```

```text
elide run hi.mjs (5 runs, 1 warmup)
  wall 83.4 ms ± 20.1  min 57.7  max 107.0
  cpu  user 15.8 ms  sys 33.1 ms
  rss  max 66.8 MiB
For servers, measure with wrk or oha and paste the results
```

The command after `--` is a full command line, including `elide`. Report fields and flags in detail:
[Report a problem](/docs/agentic-reporting#elide-agent-perf).

### `init`

Create a project from a template. With no flags, opens an editor.

Templates: `android` (Kotlin and Compose app), `java`, `ktjvm`, `web-demo`, `web-simple`, `workspace` (Kotlin library
plus app).

| Flag | Effect |
| --- | --- |
| `--templates` | List template IDs. |
| `-t, --template TEMPLATE` | Select a template. |
| `--parameters` | List template parameters. |
| `--json` | Print `--templates` or `--parameters` as JSON. |
| `-i, --plain` | Ask plain questions instead of opening the editor. |
| `-d, --skip-defaults` | Skip parameters with defaults. Needs `--plain`. |
| `-s, --skip-run` | Do not run Elide after generating. |
| `--overwrite` | Replace existing files. |

### `adopt`

Migrate the project in the current directory to Elide with an AI coding harness
([Adopt an Existing Project](/docs/toolchain/usage/adopt)). With no flags, it asks for each choice. Exits `0` when the harness
succeeds, `1` when it fails or cannot start, `130` on Ctrl+C.

| Flag | Effect |
| --- | --- |
| `--build STRATEGY` | `elide` (create an Elide build) or `existing` (keep Maven/Gradle). |
| `--harness HARNESS` | `codex`, `claude`, or `omp`. |
| `--approval MODE` | `auto-approve`, `manual-approve`, or `yolo` (bypasses protections). |
| `--log` | Stream harness output as well as logging it. |
| `--prompt-append FILE` | Append guidance to the prompt. Repeatable. |
| `--non-interactive` | Batch mode. Needs all three choices; not `manual-approve`. |

### `help`

Read this documentation offline. A command name prints its section, a slug or title prints the page, and
`options` lists every flag.

<img src="/assets/demos/help.gif" alt="elide help — the complete manual, available offline" width="1591" height="1056" loading="lazy" decoding="async" class="rounded-lg border border-border my-6 w-full" />

| Flag | Effect |
| --- | --- |
| `--format FORMAT` | `auto` (default), `interactive`, or `markdown`. |
| `-w, --width WIDTH` | Maximum width. Default `110`. |
| `-l, --lang LANG` | Display language: `en`, `fr`, `de`, `ru`, `es` or `uk`. Defaults to the [CLI language](/docs/localization#choose-a-language). |
| `--languages` | List display languages. |
| `--no-animation` | Hide the snow animation; Tab toggles it. |

In a [Tern](https://docs.stencil.so/tern/) pane, `elide help` opens the docs as a native page instead of the
terminal reader. The navigation sits beside the page, grouped by part of the docs with the part you are reading open;
a trail above the page leads to its group, and the head row holds a search field. Under 80 columns the page stacks:
the search field, the page, then the navigation. `elide help TOPIC` opens at that topic, and an unknown topic lists the
closest ones.

| Key | Action |
| --- | --- |
| `/` | Search titles, slugs and command names; at most 50 topics are listed, with a count of the rest. |
| `↑` `↓`, `Enter` | While searching: pick a topic, open it. |
| `Esc` | Close the search when it is open; with nothing open, quit. |
| `j` `k`, `space` | Scroll the page by a line or a screen. |
| `[` `]` | Previous and next page in navigation order. |
| `b` `f` | Back and forward through the pages you opened. |
| `q` | Quit. |

Pages a page links to are listed under it and open in place. The link text in the page carries an
`elide://help?topic=` link, which opens only through the Tern plugin. A Tern that lacks one of the page's elements
gets a plainer form of it, such as plain text lines for the page. Outside Tern, and with `--format markdown` or
redirected output, nothing changes. See [Terminal surfaces](/docs/tern-terminal#elide-help-in-tern).

### `info`

Show binary, platform, language, and network transport details. `--cargo-lockfile` prints the embedded lockfile.

### `studio`

Download and launch Elide Studio for Linux amd64 or macOS arm64:

```bash
elide studio
elide studio --studio-version 0.2.0 --install
```

| Flag | Effect |
| --- | --- |
| `--studio-version VERSION` | Select an exact Studio version, without a `v` prefix. Default: the platform's stable channel. |
| `--install` | Install without launching the desktop UI. |

Studio is installed under Elide's managed user root in `studio/VERSION/PLATFORM`. The root is
`ELIDE_HOME`, then `XDG_DATA_HOME/elide`, then `~/.local/share/elide`. Downloads are checked against
the published size and SHA-256 before installation; matching installations are reused. Each invocation
checks the distribution manifest, so network access is required even when Studio is installed.

The launcher passes its canonical Elide executable path in `ELIDE_BIN`. Studio must consume this
variable to select that runtime. Project-path arguments are not supported. Linux requires a
graphical session, WebKitGTK 4.1, and Studio's desktop system dependencies.

### `discord`

Print the community invite link, https://elide.dev/discord, then open it in the Discord desktop app
when one is installed, or in the default browser. Under WSL it opens on the Windows side. `--print`
prints the link only. Nothing is opened when stdout is not a terminal, `CI` is set, or no display is
available; the command exits 0 either way.

### `upgrade`

Update Elide.

| Flag | Effect |
| --- | --- |
| `--check` | Report without applying. |
| `--force` | Update even when current. |
| `--channel CHANNEL` | `release` or `nightly`. Default: this build's channel. |

### `setup`

Install an optional component: `elide setup python`.

| Flag | Effect |
| --- | --- |
| `--channel CHANNEL` | `release` or `nightly`. Default: this build's channel. |
| `--force` | Re-apply an installed component. |

`setup` installs the component for the running version and never upgrades or downgrades Elide. `elide upgrade` keeps installed components.
`setup` refuses package manager installs (Homebrew, apt, RPM, MSI, nix, snap); use the install script:

```bash
curl -sSL --tlsv1.2 elide.sh | bash -s -- --with-python
```

### `use`

Pin a version in `.elideversion` and download it: `elide use 1.6.0`.

| Flag | Effect |
| --- | --- |
| `--channel CHANNEL` | `release` or `nightly`. |
| `--no-install` | Write the pin without downloading. |

Versions are releases (`1.6.0`, `v1.6.0`) or nightly datestamps (`20260921`). `--ignore-version` runs this
binary anyway.

### `lsp`

Start a Language Server Protocol server over stdio. Serves Java; see [Other editors](/docs/connect-ide).

### `mcp`

Start a Model Context Protocol server. See [Project MCP server](/docs/mcp).

| Flag | Effect |
| --- | --- |
| `--mode MODE` | `stdio` (default) or `http` (legacy HTTP+SSE). |
| `--host HOST` | HTTP bind host. Default `localhost`. |
| `--port PORT` | HTTP bind port. Default `8125`. |

## Advanced

Listed by `elide --help-all`.

### `tern`

Host a native [Tern](https://docs.stencil.so/tern/) surface that needs the Tern plugin's broker.
The plugin launches these; they exit `2` outside Tern. `elide test`, `elide serve` and
`elide repl` negotiate their own surfaces and need no `tern` command. See [Tern plugin](/docs/tern).

| Surface | Arguments |
| --- | --- |
| `tern repl` | `BROKER SDK STATE [LANGUAGE]`: the embedded SDK notebook REPL. |
| `tern project` | `BROKER STATE RUNTIME ROOT [SUBJECT]`: a shared project test session view. |
| `tern debug` | `BROKER STATE RUNTIME ROOT [SOURCE]`: a shared project debugger view. Without `SOURCE`, choose the target from a searchable picker (`/`) of the project's tests, entry points and sources. `Esc` dismisses the status message, then backs out of an opened value, and quits only when nothing is open. |

### `classpath`

Print a resolved classpath for `[<sourceSet>:]<usage>`, e.g. `test:runtime`. Usages: `toolchain`, `processor`,
`compile`, `modules`, `runtime`, `provided`. Default `main:compile`; an unknown usage exits `2`.

| Flag | Effect |
| --- | --- |
| `--offline` | Do not fetch remote resources. |

### `index`

Index the project's resolved Maven dependencies and query that index. Actions: `build`, `status` (default),
`get <address>`, `references <address>`, `used-by <name>`, `resolve <name>`. An address is `maven:group:artifact:version`,
optionally followed by `/symbol` and `#member`; a member is `name(paramType,...)` for methods and
constructors (`<init>`) and the bare name for fields. `build` writes the layers named by `--layers`
(default `l0,l1`; `l2` adds member signatures, `l3` adds outbound references) beside any already built.
`get`, `references` and `resolve` exit `1` for an unknown artifact, symbol, member or name, and `2` when
a layer they need has not been built; run `elide index build --layers=...`.

`build` also compiles main Java and Kotlin sources and refreshes their local reference index.
`references local:<project>/<type>` reads a local class's outbound references; `used-by <type>[#member]` prints
matching package-relative local source files. Queries do not refresh those compiled references.
See [Dependency code index](/docs/toolchain/jvm/code-index) for examples and experimental scope.

| Flag | Effect |
| --- | --- |
| `--layers=<l0,l1,l2,l3>` | Layers `build` writes; `l0` is always included. |
| `--offline` | Do not fetch remote resources. |

### `javadoc`

Generate Javadoc, like `javadoc`. Arguments follow `--`.

| Flag | Effect |
| --- | --- |
| `--theme THEME` | `default` or `elide`. |

### `javaformat`

Format Java with google-java-format, or with the Netflix jfmt dialect given `--jfmt`. Arguments follow `--`. Takes `format`'s `--list-files` and `--list-diffs`. See
[Formatting](/docs/toolchain/jvm/formatting).

### `javap`

Disassemble JVM bytecode, like `javap`. Arguments follow `--`.

### `jdeps`

Analyze JVM class dependencies, like `jdeps`. Arguments follow `--`.

### `ktfmt`

Format Kotlin with ktfmt. Arguments follow `--`. Takes `format`'s `--list-files` and `--list-diffs`.

### `native-image`

Build a JVM program into a native executable. Arguments follow `--`. See [Native Image](/docs/toolchain/jvm/native-image).

### `rewrite`

Run OpenRewrite recipes on the project's main Java sources (experimental in 1.6.0). Recipes come from the bundled
libraries and `dependencies.maven.devPackages`; dependency types come from the code index.
`elide rewrite --list` prints available recipes; `elide rewrite <name>…` applies them in order.
The default workflow compiles main sources and filters candidate files when recipe preconditions support it.
See [OpenRewrite](/docs/toolchain/jvm/rewrite) for setup, examples, and compatibility limits.
Exit `1` for an unknown recipe, `2` for a usage error.

| Flag | Effect |
| --- | --- |
| `--dry-run` | Print diffs without applying source changes; build state can still be written. |
| `--list` | List available recipes without compiling main sources. |
| `--no-prefilter` | Skip main-source compilation and parse every main Java source. |
| `--offline` | Do not fetch remote resources. |

### `web`

Web tooling: `elide web build app.ts page.md --out dist` builds files without a manifest. See
[Web Toolchain](/docs/toolchain/web).

| Flag | Effect |
| --- | --- |
| `-o, --out DIR` | Output directory. |

## Global options

Accepted before or after the command name, before any `--`.

### Common flags

| Option | Effect |
| --- | --- |
| `-p, --project PATH` | Project directory. |
| `-f, --flag NAME[=VALUE]` | Set a manifest build flag. |
| `-q, --quiet` | Hide progress. Warnings, errors, and program output still print. |
| `-v, --verbose` / `--debug` | More logging. |
| `--color` / `--no-color` | Force color on or off. |
| `--timeout DURATION` | Time limit, e.g. `30s`, `5m`; `0` disables it. Kills child processes and exits `124`. |
| `--max-mem SIZE` | Heap limit, e.g. `512m`, `8g`. One-shot runs default to `4g`. |
| `--limit NAME=COUNT` | Resource limit: `workers` or `fds`. Repeatable. |
| `--interop` | Share one context across languages ([Languages](/docs/languages)). |
| `-V, --version` | Print the version. |

### Configuration files

Application commands load `.env` then `.env.local` from the invocation directory. `--project` selects
the project directory, including enclosing Elide projects. Existing environment variables win,
including empty values. `.properties` and `.properties.local` supply Java system properties; explicit
VM/engine assignments win. Properties use Java syntax, including escapes and continuations.

| Option | Effect |
| --- | --- |
| `--env-file PATH` | Use explicit dotenv files instead of automatic discovery; repeat to layer files. |
| `--properties-file PATH` | Use explicit Java properties files instead of automatic discovery; repeat to layer files. |
| `--no-env` | Disable dotenv loading. |
| `--no-properties` | Disable properties file loading. |

The standalone Java `run` path can read an automatic `.properties` file despite
`--no-properties`. See the [documented isolation limitation](/docs/environment#choose-files-explicitly).

Explicit paths are relative to the invocation directory; later files win. A file flag and its disable
switch cannot be combined. Missing automatic files are silent; malformed or explicitly missing files fail.

Both formats accept dotenvx `encrypted:` values. Supply private keys through `DOTENV_PRIVATE_KEY*` or
`.env.keys` beside the selected files. Key files are read only when decryption is needed and are never
exported as application variables. The dotenvx CLI's file authoring format is dotenv; Java properties
files use unquoted ciphertext as property values. Shell substitutions are not executed.

Use `${NAME}` for dotenv interpolation. Properties and decrypted payloads are not interpolated. File
loading does not grant additional manifest environment access or sandbox capabilities. In JVM mode,
file variables reach guest environment APIs and child processes; the already-running JVM's own
`System.getenv()` remains its launch environment.

Automatic discovery applies to application and project execution commands, not every standalone tool. Explicit file
flags also select a context for tool commands. See [Environment and properties](/docs/environment) for the exact command
scope, project-directory layering, per-file interpolation, encrypted-value authoring, key lookup order, and examples.

### Sandbox flags

Programs run unconfined until you pass a sandbox flag. See [Sandbox](/docs/sandbox).

| Option | Effect |
| --- | --- |
| `--sandbox[=PROFILE]` | Profile: `trusted`. Bare `--sandbox` confines filesystem access and denies subprocesses. |
| `--allow-read[=PATHS]` | Grant reads; bare grants all. |
| `--allow-write[=PATHS]` | Grant writes; bare grants all. |
| `--allow-net[=HOSTS]` | Permit network; bare permits all. |
| `--deny-net=HOSTS` | Deny hosts; overrides `--allow-net`. |
| `--allow-run[=CMDS]` | Permit subprocesses; bare permits all. A filesystem sandbox denies them without it. |
| `--deny-run=CMDS` | Deny commands; overrides `--allow-run`. |
| `--allow-env[=NAMES]` | Variables Python guests and the manifest may read; bare allows all. |
| `--fs-audit` | Log each filesystem access decision. |
| `--allow-threads` | Permit guest threads. Denied by default. |
| `--allow-native` / `--no-native` | Permit or deny guest native access. |

### Diagnostics flags

| Option | Effect |
| --- | --- |
| `--debugger[=MODE\|ADDRESS]` | Attach a debugger: `auto`, `cdp`, `dap`, or a JDWP address (`5005`, `host:5005`). See [Debugging](/docs/debugging). |
| `--debugger-host HOST` | Debugger bind host. Default `127.0.0.1`. |
| `--debugger-port PORT` | Debugger port. Default `4711` (DAP) or `1337` (CDP). |
| `--profiler[=PROFILER]` | `cputracing`, `cpusampling`, or `memtracing`. |
| `--coverage[=auto]` | Collect coverage. |
| `--insights INSIGHTS` | Inject [Insight](/docs/api-insight) scripts. |
| `--error-format FORMAT` | Uncaught errors: `auto` (default), `pretty`, or `plain`. |
| `--abort-on-uncaught-exception` | Abort with `SIGABRT` on an uncaught exception. |
| `--redirect-warnings FILE` | Write warnings to FILE instead of stderr. |

### Version flags

| Option | Effect |
| --- | --- |
| `--use-version VERSION` | Run another installed Elide version. |
| `--ignore-version` | Ignore `.elideversion` and `--use-version`. |

### Advanced flags

| Option | Effect |
| --- | --- |
| `--transport TRANSPORT` | Network transport ([Network transport](#network-transport)). |
| `--locale LOCALE` | CLI language, e.g. `fr`. See [Languages and offline docs](/docs/localization). |
| `--progress=MODE` | Build progress: `auto` (default), `plain`, or `json`. Also `ELIDE_PROGRESS`. See [Progress output](#progress-output). |
| `-X, -D, --vm KEY=VALUE` | Set a VM property; `-Dkey=value` also works. |
| `--safe-close` | Shut down fully even for one-shot runs. |
| `--pkgst` / `--no-pkgst` | Enable or disable Pkgst routing for embedded package resolvers, overriding `ELIDE_PKGST`. Maven uses its separate setting; see [Repositories](/docs/toolchain/dependencies#repositories). |
| `--otel-endpoint=URL` | Send OpenTelemetry data to this OTLP endpoint. |
| `--otel-provider=PROVIDER` | Send OpenTelemetry data to a provider: `otlp`, `sentry`, `datadog`, `posthog`, `honeycomb`, `grafana`. |
| `--otel-protocol=PROTOCOL` | OTLP protocol: `grpc`, `http/protobuf`, `http/json`. |
| `--otel-shutdown=MODE` | How the final export leaves at exit: `sidecar`, `inline`, `drop`. |
| `--no-otel` | Turn OpenTelemetry export off. |
| `--help-instruments` | List [instrument](#instruments) flags. |

### Python options

CPython flags; put them before the script.

| Option | Effect |
| --- | --- |
| `-I` | Isolated mode. |
| `-B` | Do not write bytecode files. |
| `-E` | Ignore `PYTHON*` environment variables. |
| `-S` | Do not `import site` on startup. |
| `-u` | Unbuffered stdout and stderr. |
| `-P` | Do not prepend an unsafe path to `sys.path`. |
| `-O` | Optimize. Repeatable. |
| `-b` | Warn on bytes/str comparisons. Repeatable. |
| `-x` | Accepted; no effect. |
| `-W ARG` | Warning control. Repeatable. |
| `-m MODULE` | Run a module as `__main__`. |

## Network transport

| `--transport=` | Effect |
| --- | --- |
| `auto` | Default: `v2` on Linux and macOS, `nio` elsewhere. |
| `v2` | Elide's native transport. |
| `epoll`, `kqueue`, `io_uring` | `v2` with that driver. Fails on other platforms. |
| `nio` | Portable transport. |

## Instruments

| Option | Effect |
| --- | --- |
| `--jfr FILE` | Record a JFR file, saved on exit. |
| `--jfr-settings SETTINGS` | `default`, `profile` (default), or a `.jfc` file. |
| `--jitdump DIR` | Write JIT metadata for Linux `perf`. |
| `--heap-dump FILE` | Dump the heap on exit. |
| `--heap-dump-on-oom FILE` | Dump the heap on out-of-memory, then exit `3`. |
| `--vmstat` | Make the process visible to `jps`, `jstat`, and `jcmd`. |

## Exit codes

| Code | Meaning |
| --- | --- |
| `0` | Success, help, or version output. |
| `1` | The command or program failed. |
| `2` | Invalid usage, unknown run target, or a removed command. |
| `3` | Out of memory; `--heap-dump-on-oom` wrote a heap dump. |
| `124` | `--timeout` expired. |
| other | Set by the program or tool. |

Once a timeout starts terminating the process tree, its `124` status takes precedence over child
exit codes produced during cleanup (for example, `137` after `SIGKILL`).

## Output streams

- Program output, test reports, and machine-readable output go to stdout.
- Progress and diagnostics go to stderr.
- Color is off when the stream is not a terminal. `--color`, `FORCE_COLOR`, or `CLICOLOR_FORCE` force
  it on; `--no-color` or `NO_COLOR` turn it off.
- `--quiet` hides progress only.
- `--progress=json` records go to stderr with the rest of the progress; stdout stays the command's product.

## Progress output

`--progress=MODE`, or `ELIDE_PROGRESS=MODE`, picks how builds report progress on stderr.

| Mode | Output |
| --- | --- |
| `auto` | A live display on a terminal. Otherwise, one line per finished task and the verdict. |
| `plain` | A `>` line when each task starts and a line when it finishes, terminal or not. No cursor control. |
| `json` | One JSON object per line for every build event, for editors and other programs. |

Every `json` record has a `type` and a `time` in epoch milliseconds. Other fields:

| `type` | Fields |
| --- | --- |
| `build-started` | `plannedTasks`; `workspace` and `projects` in a workspace |
| `build-configured` | `totalTasks`: tasks the build will run |
| `build-progress` | `completedTasks`, `message` |
| `task-started` | `task`, `project`, `message`, `total` |
| `task-progress` | `task`, `project`, `progress`, `total`, `message` |
| `task-finished` | `task`, `project`, `outcome` (`success`, `failure`, `skipped`), `reason`, `durationMs`, `message` |
| `step-started` | `task`, `project`, `step`, `message`, `total` |
| `step-progress` | `task`, `project`, `step`, `progress`, `message`, `detail` |
| `step-finished` | `task`, `project`, `step` |
| `message` | `level` (`output`, `hint`, `warning`, `error`), `text`, `task`; for a compiler diagnostic, `file` (absolute), `line`, `column` |
| `dependency` | `elide install` only: `ecosystem` (`maven`), `task`, `project`, `id` (`group:artifact`), `version`, `direct`, `requires` (at most 64 ids), `requiresMore` |
| `dependencies` | `elide install` only: `ecosystem` (`maven`, `npm`), `task`, `project`; for Maven `resolved`, `direct`, `transitive`, `overrides`, `exclusions`, `upToDate`; for npm `phase` (`resolving`, `fetching`, `linking`, `done`), `resolved`, `total`, `reused`, `downloaded`, `downloadedBytes`, `estimatedBytes` |
| `build-finished` | `outcome` (`success`, `failure`), `exitCode` on failure, `durationMs`, `message` |

Fields without a value are left out. Progress records arrive at most every 100 ms per task or step. A
program's own stderr is passed through unchanged, so read records as the lines that parse as JSON objects.
A `task-finished` record's `durationMs` covers the whole task, its up-to-date check included, so a skipped task
reports the time it took to find it had nothing to do. A `task-finished` record without a `message` belongs to a
task that prints no completion line of its own; label it with its `task`.
`elide install` reports a Maven graph as one `dependency` record per resolved package, then its `dependencies`
totals. Its npm and PyPI legs report as the tasks `npm-install` and `pypi-install`.
`--quiet` keeps only `message` records for warnings and errors.

### Package CDN session default

`ELIDE_PKGST=1` enables Pkgst routing by default for embedded package resolvers.
`true`, `yes`, and `on` also enable it, ignoring case and surrounding whitespace.
Unset, empty, or other values leave routing disabled unless `--pkgst` is passed.
Explicit `--pkgst` and `--no-pkgst` flags take precedence; if both are supplied,
the last flag wins. A launcher can set this environment variable for a session
without changing project files or package-cache locations.

Maven's `--use-pkgst` setting is independent of this environment default.
