# CLI The `elements` command-line interface. One binary, a handful of subcommands, consistent conventions across all of them. ## Discovering Commands Every command has its own help screen. Run the command with `-h` or `--help`: ```bash Terminal elements --help # top-level commands and global options elements create --help # create's subcommands, arguments, options elements build --help # build's flags elements db --help # db's subcommands ``` Help output is short and self-contained. Read the whole thing. Don't pipe through `head`, `tail`, or `less`: truncating the output hides subcommands and options you'll need. If the screen is taller than your terminal, scroll. The output is not paginated. ## Top-Level Commands Grouped by purpose: **Project lifecycle** - `elements create` (`c`): scaffold a new app, package, page, template, migration, job, email, test, or config files. `-scaffold` creates the app from a published Elements app instead of the built-in templates, for example `-scaffold=elementscode/scaffold-ecommerce`; see `elements man start/layout`. A new app starts as a git repository when git is installed and the app is not inside another repository; `-no-git` skips it. Once the first install has written `package.lock`, the project server commits everything create made as `elements create `, with your git `user.name` and `user.email`, so the first diff shows only your own changes. It does this only while the repository has no commits, and skips it when no identity is set. Has subcommands; see `elements create --help`. - `elements start`: start and run your program, the same way in development and production. It exits when the program exits, with the program's exit code. The user runs it, not an agent; see `elements man build`. In development it opens the app in the user's browser once per process, or in the editor's own browser from a VS Code terminal with the Elements extension. `ELEMENTS_NO_BROWSER=1` skips it. - `elements kill`: stop the project: the app, its jobs, the project server, and any `elements start` attached to it, which exits. `-destroy` also drops the project's app and test databases and their backups, for a project folder you are about to delete. The folder itself is left alone. **Build, test, run** - `elements build` (`b`): query the current build state. `-json` for structured output. Full topic: `elements man build`. - `elements test` (`t`): query test results. `-json` for structured output. Full topic: `elements man tests`. - `elements run` (`r`): run a one-off program once. Useful for scripts. It exits with the program's exit code, or 1 when the build has errors and nothing ran. - `elements logs`: what the app logged, read from `.elements/logs`, every service merged in time order. `-service app` keeps one service, `-f` follows, `-since 10m` and `-until