An open API service indexing awesome lists of open source software.

https://github.com/empathic/hotline

Easy bug reports from distributed applications
https://github.com/empathic/hotline

Last synced: 3 months ago
JSON representation

Easy bug reports from distributed applications

Awesome Lists containing this project

README

          

# hotline

[![crates.io](https://img.shields.io/crates/v/hotln)](https://crates.io/crates/hotln)
[![npm](https://img.shields.io/npm/v/hotln)](https://www.npmjs.com/package/hotln)
[![npm](https://img.shields.io/npm/v/hotln-proxy?label=hotln-proxy)](https://www.npmjs.com/package/hotln-proxy)

A library for filing bug reports to [Linear](https://linear.app) and
[GitHub Issues](https://github.com) from distributed applications. Reports
are sent through a proxy server that holds API credentials.

Available for [Rust](https://crates.io/crates/hotln) and [TypeScript/JavaScript](https://www.npmjs.com/package/hotln).
The proxy server is available as [`hotln-proxy`](https://www.npmjs.com/package/hotln-proxy).

## Usage

### Rust

```rust
hotln::github("https://your-proxy.example.com")
.with_token("secret")
.title("crash on startup")
.text("Something went wrong.")
.file("config.toml", &toml_str)
.create()?;

hotln::linear("https://your-proxy.example.com")
.with_token("secret")
.title("crash on startup")
.text("Details.")
.attachment("crash.log", &log_bytes)
.create()?;
```

### TypeScript

```typescript
import hotln from "hotln";

await hotln.github("https://your-proxy.example.com")
.withToken("secret")
.title("crash on startup")
.text("Something went wrong.")
.file("config.toml", tomlStr)
.create();

await hotln.linear("https://your-proxy.example.com")
.withToken("secret")
.title("crash on startup")
.text("Details.")
.attachment("crash.log", logBytes)
.create();
```

## Builder API

Both backends use a fluent builder. Call `.create()` to send the request and
get back the issue URL (`Result` in Rust, `Promise` in
TypeScript).

| Method | Description |
|--------|-------------|
| `.title(s)` | Set the issue title |
| `.text(s)` | Append a text block to the body |
| `.file(name, content)` | Append a fenced code block to the body |
| `.attachment(name, data)` | **Linear only.** Upload as a real Linear attachment (binary OK) |
| `.with_token(s)` | Set a bearer token for proxy auth |
| `.create()` | Send the request and return the issue URL |

`.text()` and `.file()` blocks are joined in order, separated by blank lines.

## Proxy protocol

The client POSTs JSON to the proxy. Each backend has its own path:

- `POST /linear` — create a Linear issue
- `POST /github` — create a GitHub issue

If `with_token` is set, the client sends an `Authorization: Bearer ` header.

### Linear request

```typescript
interface LinearRequest {
title: string;
description: string;
attachments?: {
filename: string;
contentType: string;
data: string;
encoding?: "text" | "base64";
}[];
}
```

### GitHub request

```typescript
interface GitHubRequest {
title: string;
description: string;
}
```

### Response (both backends)

```typescript
interface Response {
url: string; // URL of the created issue
}
```

## Proxy

A reference proxy implementation lives in `hotln-proxy/`. See
[hotln-proxy/README.md](hotln-proxy/README.md) for setup and configuration.

## CLI

```
hotln github "crash on startup" --proxy-url https://worker.example.com
hotln linear "crash on startup" --proxy-url https://worker.example.com
hotln linear "crash on startup" --proxy-url https://worker.example.com -f config.toml -a crash.log
```

All flags can also be set via environment variables (`HOTLINE_PROXY_URL`,
`HOTLINE_PROXY_TOKEN`).