# test-convt-cli

Adopt this skill: https://proskills.md/skills/other/opencoredev-convt-agents-skills-test-convt-cli

Page: https://proskills.md/skills/other/opencoredev-convt-agents-skills-test-convt-cli
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: .agents/skills/test-convt-cli/SKILL.md
size: 8006
upstream: https://github.com/opencoredev/convt/blob/main/.agents/skills/test-convt-cli/SKILL.md

````text
---
name: test-convt-cli
description: Test convt conversions end to end through the `convt` CLI, the engines in convt-engines, routing in convt-core, and the Linux file-manager menus in integrations/linux. Use when changing an engine, a format, the registry, the CLI, or install.py, or when asked to reproduce a conversion bug or prove a conversion works.
---

# Test convt conversions

The CLI is the fastest way to prove engine and routing behavior. The desktop app, the Finder extension and the Linux menus all call the same `convt_engines::default_registry()`, so a CLI result is the ground truth for what a conversion produces.

## Doctor

Run from the repository root before trusting a result. Read only.

```sh
cargo locate-project --workspace --message-format plain   # must be this checkout's Cargo.toml
cargo build -p convt-cli && ./target/debug/convt engines
```

`convt engines` prints each ready engine (`image`, `svg`, `libheif`, `ffmpeg`, `pdfium`, `libreoffice`) and each unavailable one with its reason. A conversion that fails with "no route" usually means an engine is missing here, not a routing bug. Fix the environment first:

- `pdfium` unavailable: `bash scripts/fetch-pdfium.sh` (writes `vendor/pdfium`, gitignored).
- `ffmpeg` or `libreoffice` unavailable: install the package, or point `CONVT_FFMPEG` / `CONVT_SOFFICE` at a binary. See `crates/convt-engines/src/lib.rs` for discovery order.

Always run `./target/debug/convt` from this checkout. A `convt` on `PATH` may be an older install.

## Fixtures

Use synthetic inputs in a fresh temporary directory, never files from a user's home.

```sh
work=$(mktemp -d /tmp/convt-test.XXXXXX)
bash .agents/skills/test-convt-cli/scripts/fixtures.sh "$work/in"
```

This writes `sample.png`, `sample.mp4` (3 s, video and audio), `sample.wav`, `sample.svg`, `sample.txt`, and `sample.pdf` when LibreOffice is present. Add new fixtures to that script rather than committing binaries.

## Drive

Write outputs to a separate directory with `-o` so a same-format or failed run cannot touch the inputs.

```sh
c=./target/debug/convt; mkdir -p "$work/out"
$c targets "$work/in/sample.mp4"                    # what the menus would offer
$c "$work/in/sample.mp4" --to webm -o "$work/out"
$c "$work/in/sample.png" --to avif -o "$work/out"
$c "$work/in/sample.svg" --to jpeg -o "$work/out"
$c "$work/in/sample.pdf" --to png  -o "$work/out"   # one file per page: sample.png, sample-2.png, ...
```

Options, presets and batches:

```sh
$c "$work/in/sample.png" --to jpeg -q 60 --max-size 64 -o "$work/out"
# Transparent areas: white by default for JPEG and PPM, or --background black,
# "#ff8800" or transparent (refused for formats that can't store it).
$c "$work/in/sample.png" --to jpeg --background black -o "$work/out"
$c "$work/in/sample.pdf" --to webp --pages 2- --dpi 72 -o "$work/out"   # named by page: sample-2.webp, ...
$c "$work/in/sample.mp4" --to mp4 --video-height 120 -o "$work/out"
export CONVT_CONFIG_DIR="$work/cfg"                  # never the user's real presets
mkdir -p "$CONVT_CONFIG_DIR/presets"
printf 'to = "jpeg"\nquality = 60\n' > "$CONVT_CONFIG_DIR/presets/thumb.toml"
$c presets && $c "$work/in/sample.png" --preset thumb -o "$work/out"
$c "$work/in" -r --to webp -j 2 --json -o "$work/batch"   # subfolders mirrored under -o
```

`--json` prints one event per line on stdout (`started`, `progress`, `done`, `failed` with a `kind`, then `summary`). Folder files that can't reach the target, or already are it, are skipped quietly; files named directly report their errors. Exit codes: 0 all done, 1 any failure, 130 cancelled.

To test cancellation, start a conversion of a long video in the background, `kill -INT` that PID (never `pkill`), and check that it exits 130, that its FFmpeg child is gone (`ps -o pid= --ppid <pid>` before the kill), and that the output directory holds no `.convt-*` staging folder or partial file.

HEIC and AVIF decode through the patched libheif (`libheif.so.1`, or `CONVT_LIBHEIF_DIR`). Unpatched system libraries are unavailable because they cannot disable implicit plugin loading. For full host verification, select the built bundle with absolute `CONVT_LIBHEIF_DIR` and `CONVT_LIBHEIF_PLUGIN_DIR`, and prepend its `lib` directory to `LD_LIBRARY_PATH`. Set `CONVT_FFMPEG` and `CONVT_FFPROBE` to the bundle tools so the independent AVIF validator has container support. The Python fixture helper separately needs a trusted absolute `LIBHEIF_PLUGIN_PATH`; the engine ignores that variable. The matrix generates its own HEIC with alpha. It first tries a libheif HEVC encoder, then uses FFmpeg's libx265 to encode the color and alpha items in a small HEIF container. It generates AVIF with libheif's AV1 encoder, independently of convt's AVIF encoder. When no HEIC encoder is available, `CONVT_TEST_HEIC=/path/to/sample.heic` opts into a local sample, copied into the temporary fixture directory and compared against separately decoded source pixels. No real sample belongs in the repository.

Pick the paths your change touches. For a routing change, also check that `targets` does not offer something it should not. A still image must never list a video or audio format through a multi-hop route; `crates/convt-core/src/registry.rs` has tests for this.

## Licensing

Builds from source skip the license check, so `convert` works without a key. To try the trial and activation flow, make a development key pair and opt in at run time. Always set `CONVT_LICENSE_STORE=file`: without it a key goes to the user's real Secret Service keyring.

```sh
cargo run -p convt-license --example dev-keys -- keygen       # writes .convt-dev/ (gitignored)
key=$(cargo run -q -p convt-license --example dev-keys -- issue you@example.com 2027-10-02)
export CONVT_CONFIG_DIR="$work/cfg" CONVT_DATA_DIR="$work/data" CONVT_LICENSE_STORE=file
export CONVT_LICENSE_ENFORCE=1 CONVT_LICENSE_PUBKEY=$(cat .convt-dev/license.pub)
$c license                                          # Free trial: 7 days, starting with ...
$c "$work/in/sample.png" --to jpeg -o "$work/out"   # starts the trial: $work/data/trial
echo 2026-01-01 > "$work/data/trial"; $c "$work/in/sample.png" --to jpeg -o "$work/out"   # trial ended, exit 1
echo "$key" | $c license activate && $c license     # key in $work/cfg/license.key, mode 0600
$c license remove
```

`formats`, `targets`, `engines` and `presets` never need a license; only conversions do. A key issued with an `updates_until` before today's build date shows the "newer than your license covers" message. Delete `.convt-dev` when done unless you need the key again, and never commit it.

The Secret Service path has one ignored test. Run it only on a private bus with its own runtime and data directories, so it can't reach the user's keyring:

```sh
T=$(mktemp -d); mkdir -m 700 "$T/run"; mkdir "$T/data"
env -u DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR="$T/run" XDG_DATA_HOME="$T/data" dbus-run-session -- sh -c \
  'echo -n test | gnome-keyring-daemon --unlock --components=secrets >/dev/null; cargo test -p convt-license --features client -- --ignored secret_service'
rm -rf "$T"
```

The Keychain on macOS and Credential Manager on Windows have no test path here; report them as unverified.

## Evidence

A zero exit code and a `-> path` line are not enough. Inspect the output:

```sh
ffprobe -v error -show_entries stream=codec_name,width,height:format=duration -of compact "$work/out/sample.webm"
file "$work/out/"*
```

Check codec, dimensions, duration, and page count against what the change should produce. For images, open the file with the Read tool to look at it. Report which engines were unavailable, because those routes were not exercised.

## Linux file-manager menus

Format entries run `convt-app open --to <format> -- <files>`, so the app shows progress and errors. Every supported Linux menu also has “More options…” which runs `convt-app open -- <files>` to open Quick convert without choosing a target. `install.py` reads `convt formats 
````

## File: README.md
upstream: https://github.com/opencoredev/convt/blob/main/README.md

````text
<p align="center">
  <a href="https://github.com/opencoredev/convt/stargazers"><img alt="GitHub stars" src="https://shieldcn.dev/github/opencoredev/convt/stars.svg?variant=branded&mode=dark" /></a>
  <a href="https://x.com/leodev"><img alt="Follow @leodev on X" src="https://shieldcn.dev/x/follow/leodev.svg?variant=branded&mode=dark" /></a>
</p>

# convt

Local file conversion for your own machine. Right-click a file, pick a format, and convt writes the result next to the original. Images, video, audio, PDFs and documents stay on disk: nothing is uploaded.

- 49 formats, routed through native engines (FFmpeg, PDFium, LibreOffice, image, resvg)
- A desktop app built with [GPUI](https://www.gpui.rs), with a Finder menu on macOS and file manager menus on Linux. The Windows Explorer menu is built (`crates/convt-shell`) but not yet in the release installer
- The `convt` CLI, shipped in the same install
- A [Raycast extension](https://www.raycast.com/0xdhrv/convt) for macOS and Windows, by Dhruv Suthar
- Multi-hop routes of at most three steps when no engine can convert directly
- Document support for Word, Excel and PowerPoint: a one-time download that setup offers, or that you can add later in Settings
- A paid cloud API and TypeScript SDK for converting files on convt's servers
- Accounts, checkout and downloads on [convt.app](https://convt.app)

## Install

macOS (Apple silicon) with Homebrew:

```bash
brew tap opencoredev/convt https://github.com/opencoredev/convt
brew install --cask convt
```

That installs the signed app and puts the `convt` CLI on your `PATH`. Download the app from [convt.app/download](https://convt.app/download) for a disk image, Windows MSI, or Linux packages. There is no Linux Homebrew formula yet; use the `.deb`, `.rpm` or AppImage. Packaged builds start a 7-day trial on the first conversion.

To build from source:

```bash
bun run setup
cargo run -p convt-cli -- photo.png --to webp
```

`bun run setup` installs system packages (asks for sudo on Linux and macOS), the Rust toolchain, Bun dependencies and PDFium. On Windows run `scripts/setup-windows.ps1` in PowerShell. Ordinary source builds are unrestricted.

## Usage

```bash
convt clip.mov --to mp4
convt photos/ --to webp -r
convt lease.pdf --to png --pages 1-3
```

From a checkout, prefix those with `cargo run -p convt-cli --`. Output lands next to each input unless you pass `--out-dir`.

## Raycast

[convt for Raycast](https://www.raycast.com/0xdhrv/convt), built by Dhruv Suthar ([0xdhrv](https://github.com/0xdhrv)), converts the files selected in Finder, or files and folders you pick in Raycast on Windows and macOS, and Raycast AI can call it too. It runs the `convt` CLI you already installed and finds it in the app bundle, the Windows install folder, Homebrew or `PATH`. Install it from the Raycast Store.

The extension's source lives in [raycast/extensions](https://github.com/raycast/extensions/tree/main/extensions/convt), with a working copy in [`integrations/raycast`](integrations/raycast) that tracks new CLI options. `crates/convt-cli/tests/raycast_contract.rs` pins the output it parses (`convt formats --json`, `convt targets`, `convt presets` and the `--json` events), so a change that would break the extension fails `cargo test`.

## Engines

convt registers whatever can run on this machine and picks a route:

- **FFmpeg** for video and audio (MP4, MOV, WebM, MKV, AVI, MP3, WAV, FLAC, AAC, M4A, OGG, Opus)
- **LibreOffice** for Word, Excel, PowerPoint and their open formats, and for saving any of them as PDF
- **PDFium** to render PDF pages to PNG or JPEG
- **image** and **resvg** for photos and SVG (JPEG, PNG, WebP, AVIF, GIF, TIFF, BMP, ICO, TGA, PPM, QOI, OpenEXR)
- **libheif**, or `sips` on macOS, for HEIC

Office files use LibreOffice. Released builds on macOS, Linux and Windows download a pinned document pack from their GitHub release: the app offers it during setup, and `convt pack install documents` does the same from the CLI, verifying the checksum compiled into that build. Source builds use a LibreOffice on `PATH`, or an explicit `--source` and `--sha256`. The engines never start that download themselves.

## CLI

```bash
convt engines              # backends available here
convt targets photo.heic   # formats this file can reach
convt targets photo.heic --menu
convt formats
convt presets
convt pack status documents
convt --skill              # SKILL.md for AI coding agents (also: convt skill)
```

`convt --help` lists quality, size, pages, DPI, video and job flags. See [AGENTS.md](AGENTS.md) for the rest of the commands in this repo.

## Cloud API

The cloud API converts files on convt's servers for a paid plan. You upload a file, start a job, and download the result. [`@convt/sdk`](packages/sdk) wraps those calls in TypeScript but is not on npm yet; see the [API docs](https://convt.app/docs) for keys, the host to call and the full reference. The API is `crates/convt-server`, and conversions run in sandboxed `crates/convt-worker` processes using the same engines as the app.

## Documentation

- **[convt.app](https://convt.app)**: product site, pricing and sign-in
- **[Download](https://convt.app/download)**: desktop builds and matching source archives
- **[Formats](https://convt.app/formats)**: every format and the targets it can reach
- **[Raycast extension](https://www.raycast.com/0xdhrv/convt)**: convert selected files from Raycast on macOS and Windows
- **[API docs](https://convt.app/docs)**: the cloud API, the SDK and the API reference
- **[AGENTS.md](AGENTS.md)**: repo layout, conventions, and how to check, test and build

## License

convt is open source under the [GNU AGPL v3](LICENSE). The signed desktop builds, convt Cloud and the API are paid. "convt" and the convt logo are trademarks and are not covered by the code license.

## Sponsors

Want your logo here? **[Become a sponsor →](https://github.com/sponsors/opencoredev)**

<p align="center">
  <a href="https://github.com/sponsors/opencoredev">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/sponsors/opencoredev.svg?special=resend,instatushq,primitivedotdev,lettermint&title=false&mode=dark&preset=surface" />
      <source media="(prefers-color-scheme: light)" srcset="https://shieldcn.dev/sponsors/opencoredev.svg?special=resend,instatushq,primitivedotdev,lettermint&title=false&mode=light&preset=surface" />
      <img alt="Sponsors" src="https://shieldcn.dev/sponsors/opencoredev.svg?special=resend,instatushq,primitivedotdev,lettermint&title=false&mode=dark&preset=surface" width="820" />
    </picture>
  </a>
</p>

## Star History

<p align="center">
  <a href="https://github.com/opencoredev/convt/stargazers"><img alt="Star history" src="https://shieldcn.dev/chart/github/stars/opencoredev/convt.svg?mode=dark" /></a>
</p>

<p align="center"><sub><a href="./LICENSE">AGPL-3.0</a> · Built by <a href="https://x.com/leodev">@leodev</a></sub></p>
````
