# sparc

An ESP-IDF development toolkit. Install the toolchain, scaffold a project,
build, flash and monitor, from one binary. It does not reimplement ESP-IDF, it
drives it.

## Install

```sh
curl -fsSL https://sparc.arc1.io/install.sh | sh
```

The script picks the build for your platform, verifies its SHA-256 against the
release manifest, and installs to `/usr/local/bin`, or `~/.local/bin` when that
is not writable. Set `SPARC_INSTALL_DIR` to choose, or `SPARC_VERSION` to pin a
release.

## Quick start

```sh
sparc install
sparc init blinky --target esp32c6
cd blinky
sparc devices
sparc build
sparc flash
sparc monitor
```

Put the port in the project's `.sparc` file once and `flash` and `monitor` need
no arguments.

## Updating

```sh
sparc update
```

sparc checks once a day in the background and verifies the SHA-256 of every
download before it replaces the binary. Set `SPARC_NO_UPDATE_CHECK=1` to turn
the check off.

## API

The same endpoints the CLI and the install script read. No authentication, CORS
open to any origin. Every path answers in JSON, and in flat `key=value` text at
the same path with `.txt` appended.

```
GET /v1/latest?target=<triple>&current=<version>&version=<pin>
GET /v1/latest.txt?target=<triple>
GET /v1/manifest.json
GET /v1/download/<version>/<file>
```

```sh
curl -s "https://sparc.arc1.io/v1/latest.txt?target=aarch64-apple-darwin"
```

```
version=0.1.0
target=aarch64-apple-darwin
file=sparc-0.1.0-aarch64-apple-darwin.tar.gz
sha256=<64 hex characters>
size=1336487
url=https://sparc.arc1.io/v1/download/0.1.0/sparc-0.1.0-aarch64-apple-darwin.tar.gz
```

Builds exist for `aarch64-apple-darwin`, `aarch64-unknown-linux-gnu` and
`x86_64-unknown-linux-gnu`. Anything else, Intel macs included, has to build
from source.

Source: https://github.com/arc1hq/sparc
