# Install Quark (instructions for coding agents)

You are an AI coding agent asked to install Quark for a user. Follow these steps in order. Stop and report to the user if a step fails, quoting the last 20 lines of output. Do not use `sudo` without asking the user first.

## 1. Check the platform

```sh
uname -s
```

In Windows PowerShell, where `uname` doesn't exist, run `$env:OS` instead. It prints `Windows_NT`.

Note the result. Step 3 has the setup for `Linux`, `Darwin` (macOS), and `Windows_NT`.

## 2. Check Rust

```sh
cargo --version && rustc --version
```

If `cargo` is missing, ask the user before running:

```sh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
```

If it is present, run `rustup update stable`.

## 3. System setup

<!-- os:linux -->
On Linux, check for the fontconfig headers:

```sh
pkg-config --exists fontconfig && echo ok
```

If that prints `ok`, skip to step 4.

Otherwise ask the user whether you may install packages. Use the line for their distro:

```sh
sudo apt install -y pkg-config libfontconfig-dev libxkbcommon-x11-dev libx11-xcb-dev libwayland-dev libvulkan1 mesa-vulkan-drivers
sudo dnf install -y pkgconf-pkg-config fontconfig-devel libxkbcommon-x11-devel libxcb-devel wayland-devel vulkan-loader mesa-vulkan-drivers
sudo pacman -S --noconfirm pkgconf fontconfig libxkbcommon-x11 libxcb wayland vulkan-icd-loader
```

If the user says no, export `RUST_FONTCONFIG_DLOPEN=1` for the build in step 4 and every later run. The link step still needs `libxcb` and `libxkbcommon-x11`; if linking fails with `unable to find library -lxkbcommon-x11`, report that to the user.
<!-- /os -->

<!-- os:macos -->
On macOS, confirm the Xcode tools are installed:

```sh
xcode-select -p
```

If that prints a path, continue to step 4. If it fails, ask the user to install Xcode from the App Store and open it once, then stop.
<!-- /os -->

<!-- os:windows -->
On Windows, confirm the MSVC compiler is installed. In a Developer PowerShell:

```powershell
cl
```

If `cl` isn't found, ask the user to install the Visual Studio Build Tools with the "Desktop development with C++" workload, then stop.
<!-- /os -->

## 4. Build and install

```sh
cargo install --git https://github.com/anxkhn/quark --locked
```

This takes several minutes. Do not interrupt it. Let it run in the background if your tools time out.

## 5. Credentials

Quark needs an existing sign-in or an API key. Check, without printing any file contents:

```sh
test -f ~/.pi/agent/auth.json && echo pi
test -f ~/.local/share/opencode/auth.json && echo opencode
test -n "$COPILOT_GITHUB_TOKEN$OPENAI_API_KEY$OPENROUTER_API_KEY" && echo env
```

If nothing prints, tell the user to sign in once through pi or OpenCode, or set `OPENAI_API_KEY` or `OPENROUTER_API_KEY`. Never ask the user to paste a token into the chat.

## 6. Verify

```sh
quark --version
quark -p --no-session "reply with OK"
```

Success means the second command prints `OK`. Report both outputs to the user, plus the install path from `command -v quark`.

## 7. Tell the user how to start

- `quark` opens the desktop app in the current directory.
- `quark -c` continues the last thread for this directory.
- <kbd>Ctrl</kbd> <kbd>K</kbd> (<kbd>Cmd</kbd> <kbd>K</kbd> on macOS) opens the model, context, and effort picker.
