# Use the interactive CLI

Build a bundle by answering questions about your target, packages, and output, then reuse the saved command.

Source: https://debark.dev/docs/get-started/interactive

---
Interactive mode guides you through a build in your terminal. You can use a target snapshot
or choose a baseline OS without capturing the machine first.

Run it on your online computer after [installing the CLI](/docs/get-started/installation) and
setting up a [build backend](/docs/concepts/backends):

```bash
debark build --interactive
```

## What the CLI asks

The [supported systems page](/docs/get-started/supported-systems#baseline-os-list) lists the
baseline releases, variants, and architecture names shown in the target prompts.

1. **Target:** provide a snapshot path, or choose a baseline’s distribution, release, variant,
   and architecture.
2. **Packages:** enter one package name, version request, .deb URL, or local .deb path per line.
   Submit an empty line when finished.
3. **Output:** choose the bundle folder.
4. **Signing:** use a configured key or enter an existing signing key. This prompt does not
   generate a key.
5. **Extras:** choose whether to include upgrades and a CycloneDX package inventory (SBOM).
6. **Review:** check the choices and confirm before package resolution and downloads start.

For a signed build, create a key once before starting, then pass it to the guided command:

```bash
debark keygen --out operator.key
debark build --interactive --sign operator.key
```

Skip key generation if you already have a key. Keep the private key on the builder and provide
the public key separately to the target. See [Sign a bundle](/docs/trust/signing).

## Supply choices you already know

You can pass a snapshot or baseline, output folder, signing key, and package names on the command
line. The guide skips those corresponding questions.

For example, choose the target in advance and enter packages through prompts:

```bash
debark build --interactive --base ubuntu:24.04/minimal --arch amd64 \
  --out ./bundle --sign operator.key
```

When supplying `--base`, also supply `--arch` if the target differs from the builder.
For a snapshot-based build, use `--snapshot target.tar.zst` instead of `--base` and `--arch`.

## Reuse the package list and command

Packages entered through prompts are saved in `packages.txt` in your current directory.
If that file exists, the CLI chooses an unused name such as `packages-2.txt`.

The list is saved before the final confirmation, so you can keep it even if you cancel there.
Package names supplied on the command line do not create a new list.

After the build attempt, the CLI prints a command using your selected target, package list,
and build options. Save it for the next run or use the list with `--list` in a script.
If you supplied extra options such as a backend, policy, or configuration profile, keep those
with your saved command too.

Always check the build result. Interactive mode uses the same [exit codes](/docs/reference/exit-codes)
as a build with explicit options.

## Save a baseline through prompts

To create a reusable baseline file without building a package bundle yet:

```bash
debark snapshot from-base --interactive
```

This asks for the distribution, release, variant, architecture, and output path. See
[Build with a baseline OS](/docs/get-started/no-target-machine) for when to use the resulting file.

## Terminals and scripts

Interactive mode requires a terminal on standard input. Piped input and CI jobs cannot answer
these prompts. It also cannot be combined with `--json` or `--json-events`.

The CLI only starts these questions when you pass `--interactive`. For unattended builds, use
explicit options and a package list; see [Run Debark from a script](/docs/guides/automation).

<NextSteps
  items={[
    {
      title: 'Build with a baseline OS',
      href: '/docs/get-started/no-target-machine',
      description: 'Choose the release and installed package assumptions.',
    },
    {
      title: 'Install a bundle',
      href: '/docs/operate/installing',
      description: 'Transfer the result, preview it, and install offline.',
    },
    {
      title: 'Run from a script',
      href: '/docs/guides/automation',
      description: 'Repeat the build without prompts.',
    },
  ]}
/>
