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

https://github.com/juxt/glance

Command output summariser with filters, built for LLMs
https://github.com/juxt/glance

Last synced: 3 months ago
JSON representation

Command output summariser with filters, built for LLMs

Awesome Lists containing this project

README

          

# glance — LLM-optimized output summarizer

[![PyPI](https://img.shields.io/pypi/v/glancecli?label=pypi)](https://pypi.org/project/glancecli/)
[![Go tests](https://github.com/juxt/glance/actions/workflows/test.yml/badge.svg)](https://github.com/juxt/glance/actions/workflows/test.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

LLMs read every token of command output with equal attention, unlike humans who skim head/tail and scan for patterns. `glance` gives LLMs a human-like "skim" — pipe output in, get a token-efficient summary with head/tail + regex-matched lines, plus an ID to drill deeper.

## Install

```sh
# Install permanently (puts `glance` on PATH)
uv tool install glancecli

# One-shot without installing
uvx --from glancecli glance

# Or with Go
go install github.com/juxt/glance@latest
```

Claude Code plugin:
```
/plugin marketplace add juxt/glance
/plugin install glance
```

## What it does

```
$ seq 500 | glance -n 3
1: 1
2: 2
3: 3
498: 498
499: 499
500: 500
--- glance id=20260219-143022-a3f8b1c0 | 500 lines | showing 6 | sections: 1-3, 498-500 ---
```

```
$ (seq 100; echo "ERROR db connection refused"; seq 200) | glance -n 3 -p errors
1: 1
2: 2
3: 3
101: ERROR db connection refused
299: 198
300: 199
301: 200
--- glance id=20260219-143025-b7c2e4f1 | 301 lines | showing 7 | sections: 1-3, 101, 299-301 ---
```

The stored capture can be drilled into:
```
$ glance show 20260219-143025-b7c2e4f1 -a 101 2
99: 99
100: 100
101: ERROR db connection refused
102: 1
103: 2
--- glance show 20260219-143025-b7c2e4f1 | 301 lines | showing 5 | sections: 99-103 ---
```

## Design decisions

- **Single static binary** — compiled Go, no runtime dependencies. Cross-compiled for Linux, macOS, and Windows (amd64 + arm64).
- **OR semantics** — all matchers (filters + presets) OR together. Head/tail always shown. This is the most useful behavior for scanning output: "show me the start, end, and anything interesting".
- **Persistent storage** — captures stored in `$XDG_CACHE_HOME/glance/captures/` with timestamp + hex IDs (e.g. `20260219-143022-a3f8b1c0`). Full ID required for `glance show` — use `glance list` to find IDs.
- **No metadata files** — line count and age derived from the stored file itself (`wc -l`, `stat`).
- **Built-in + user presets** — three hardcoded presets (errors, warnings, status) cover common patterns. User presets stored in `~/.config/glance/presets.csv` as CSV. Use `(?i)` prefix for case-insensitive matching.

## Usage

See `glance help` for complete documentation. Key commands:

| Command | Description |
|---------|-------------|
| `cmd \| glance` | Head 10 + tail 10 |
| `cmd \| glance -n 5` | Head 5 + tail 5 |
| `cmd \| glance -f 'regex'` | + regex filter matches |
| `cmd \| glance -p errors` | + preset filter |
| `glance show ` | Full stored output |
| `glance show -l 50-80` | Line range |
| `glance show -f 'regex'` | Filter stored output |
| `glance show -p errors` | Filter with preset |
| `glance show -a N C` | Context around line N |
| `glance list` | List stored captures |
| `glance clean` | Purge captures |
| `glance presets list` | Show all presets |
| `glance presets add [desc]` | Add user preset |
| `glance presets remove ` | Remove user preset |

Preset names must be alphanumeric (plus hyphens and underscores). Use `(?i)` prefix in regex for case-insensitive matching:

```sh
glance presets add deploys '(?i)deploy|release|rollout' 'Deployment events'
```

## Testing

```
go test ./...
```

## Files

- `main.go` — entry point and CLI
- `*_test.go` — integration and unit tests
- `.github/workflows/publish.yml` — PyPI release workflow
- `README.md` — this file