https://github.com/virtuslab/cellar
CLI tool for coding agents and developers to query the public API of any Maven JVM dependency — get symbol signatures, list packages, search by name, and inspect dependency trees. Powered by Coursier and tasty-query.
https://github.com/virtuslab/cellar
Last synced: 3 months ago
JSON representation
CLI tool for coding agents and developers to query the public API of any Maven JVM dependency — get symbol signatures, list packages, search by name, and inspect dependency trees. Powered by Coursier and tasty-query.
- Host: GitHub
- URL: https://github.com/virtuslab/cellar
- Owner: VirtusLab
- License: mpl-2.0
- Created: 2026-02-22T20:48:36.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-04-07T20:05:31.000Z (3 months ago)
- Last Synced: 2026-04-07T22:15:46.471Z (3 months ago)
- Language: Scala
- Size: 422 KB
- Stars: 31
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Cellar
Look up the public API of any JVM dependency from the terminal.
---
When a coding agent needs to call an unfamiliar library method, its options are bad: parse HTML docs (expensive, unreliable), find source on GitHub (requires knowing the URL), or hallucinate the API.
Cellar gives agents — and humans — a single shell command that returns exactly the type signatures, members, and docs needed to write correct code. Output is plain Markdown on stdout, ready to be injected into an LLM prompt with zero post-processing.
## Supported artifacts
| Format | Support |
|---|---|
| Scala 3 (TASTy) | Full — signatures, flags, companions, sealed hierarchies, givens, extensions, docstrings |
| Scala 2 (pickles) | Best-effort — type information may be incomplete |
| Java (.class) | Good — signatures, members |
## Installation
### Nix
Run without installing:
```sh
nix run github:VirtusLab/cellar -- get-external org.typelevel:cats-core_3:2.10.0 cats.Monad
```
Install into your profile:
```sh
nix profile install github:VirtusLab/cellar
```
A Nix overlay is also available at `github:VirtusLab/cellar#overlays.default`.
### Manual
Download the native binary for your platform from https://github.com/VirtusLab/cellar/releases/latest, then extract and install:
```sh
tar xz -f cellar-*.tar.gz
sudo mv cellar /usr/local/bin/
```
To verify checksums and signatures, see [RELEASING.md](RELEASING.md).
## Quick start
```sh
# Look up a trait from cats
cellar get-external org.typelevel:cats-core_3:2.10.0 cats.Monad
# List top-level symbols in a package
cellar list-external org.typelevel:cats-core_3:2.10.0 cats
# Search for a method name
cellar search-external org.typelevel:cats-core_3:2.10.0 flatMap
# View source code
cellar get-source org.typelevel:cats-core_3:2.10.0 cats.Monad
# Dependency tree
cellar deps org.typelevel:cats-effect_3:3.5.4
```
## Commands
Cellar has two modes: **project-aware** commands that work against your current project's classpath, and **external** commands that query arbitrary Maven coordinates.
### Project-aware commands
Run from your project root. Cellar auto-detects the build tool (Mill, sbt, or scala-cli), extracts the classpath, and queries your project's code and all its dependencies.
```sh
cellar get [--module ]
cellar list [--module ]
cellar search [--module ]
```
- **Mill / sbt**: `--module` is required (e.g. `--module lib`, `--module core`)
- **scala-cli**: `--module` is not supported — omit it
The classpath is cached after the first run. Use `--no-cache` to force re-extraction.
### External commands
Query any published Maven artifact by explicit coordinate:
```sh
cellar get-external
cellar list-external
cellar search-external
cellar get-source
cellar deps
```
### Command reference
| Command | Description |
|---|---|
| `get` | Symbol info from the current project (signature, flags, members, docs) |
| `get-external` | Symbol info from a Maven coordinate |
| `get-source` | Source code from a published `-sources.jar` |
| `list` | List public symbols in a package/class from the current project |
| `list-external` | List public symbols from a Maven coordinate |
| `search` | Case-insensitive substring search in the current project |
| `search-external` | Case-insensitive substring search from a Maven coordinate |
| `deps` | Print the transitive dependency tree |
### Maven coordinates
Coordinates use the format `group:artifact:version`. The `::` shorthand is **not** supported — use the full artifact name.
```
org.typelevel:cats-core_3:2.10.0 # Scala 3
org.typelevel:cats-core_2.13:2.10.0 # Scala 2
org.apache.commons:commons-lang3:3.14.0 # Java
```
Use `latest` as the version to automatically resolve the most recent release:
```sh
cellar get-external org.typelevel:cats-core_3:latest cats.Monad
```
### Options
| Flag | Applies to | Description |
|---|---|---|
| `--module `, `-m` | project commands | Build module name (required for Mill/sbt) |
| `--no-cache` | project commands | Skip classpath cache, re-extract from build tool |
| `--java-home ` | all | Use a specific JDK for JRE classpath |
| `-r`, `--repository ` | external commands | Extra Maven repository URL (repeatable) |
| `-l`, `--limit ` | `list`, `search` | Max results (default: 50) |
## Configuration
Cellar loads configuration from HOCON files and environment variables. Files are loaded in order, with later values overriding earlier ones:
1. Built-in defaults
2. `~/.cellar/cellar.conf` (user-level, optional)
3. `.cellar/cellar.conf` (project-level, optional)
Use `--config ` / `-c ` to load a specific file instead.
### Default config
```hocon
mill {
# Binary to invoke when extracting Mill classpaths
binary = "./mill" # env: CELLAR_MILL_BINARY
}
sbt {
# Binary to invoke when extracting sbt classpaths (e.g. "sbt", "sbtn")
binary = "sbt" # env: CELLAR_SBT_BINARY
# Extra arguments passed to sbt, space-separated (e.g. "--client")
extra-args = "" # env: CELLAR_SBT_EXTRA_ARGS
}
```
### Examples
Use `sbtn` instead of `sbt`:
```hocon
sbt { binary = "sbtn" }
```
Use sbt in `--client` mode:
```hocon
sbt { extra-args = "--client" }
```
Use a custom Mill wrapper:
```hocon
mill { binary = "./millw" }
```
Or via environment: `CELLAR_SBT_BINARY=sbtn cellar get --module core cats.Monad`
## Output conventions
- **stdout** — Markdown content (signatures, docs, source)
- **stderr** — diagnostics (warnings, truncation notices)
- **Exit 0** — success
- **Exit 1** — error
## Example output
cellar get-external org.typelevel:cats-core_3:2.10.0 cats.Monad
## cats.Monad
```scala
trait Monad[F] extends FlatMap[F] with Applicative[F]
```
Monad.
Allows composition of dependent effectful functions.
**Flags:** abstract
**Origin:** cats.Monad
**Members:**
```scala
def flatMap[A, B](fa: F[A])(f: Function1[A, F[B]]): F[B]
def pure[A](x: A): F[A]
def flatten[A](ffa: F[F[A]]): F[A]
def iterateWhile[A](f: F[A])(p: Function1[A, Boolean]): F[A]
...
```
cellar list-external org.typelevel:cats-core_3:2.10.0 cats --limit 5
object Eval$
trait ComposedContravariantCovariant[F, G] extends Contravariant[TypeLambda]
object Later$
object Show$
trait EvalSemigroup[A] extends Semigroup[Eval[A]]
Note: results truncated at 5. Use --limit to increase.
cellar search-external org.typelevel:cats-core_3:2.10.0 flatMap --limit 3
cats.FlatMap — object FlatMap$
cats.FlatMap — trait FlatMap[F] extends Apply[F] with FlatMapArityFunctions[F]
cats.FlatMap$ — object FlatMap$
Note: results truncated at 3. Use --limit to increase.
## Using cellar with Claude Code
### As a plugin (recommended)
Install cellar as a Claude Code plugin for auto-updates:
```sh
/plugin marketplace add virtuslab/cellar
/plugin install cellar@cellar
```
Claude will automatically have access to the `/cellar:cellar` skill and know when to use it.
### Manual setup
Alternatively, add the following to your project's `CLAUDE.md`:
````markdown
## Cellar
When you need the API of a JVM dependency, use cellar. Always prefer cellar over hallucinating API signatures.
### Project-aware commands (run from project root)
For querying the current project's code and dependencies (auto-detects build tool):
cellar get [--module ] # single symbol
cellar list [--module ] # explore a package
cellar search [--module ] # find by name
- Mill/sbt projects: `--module` is required (e.g. `--module lib`, `--module core`)
- scala-cli projects: `--module` is not supported (omit it)
- `--no-cache`: skip classpath cache, re-extract from build tool
- `--java-home`: override JRE classpath
### External commands (query arbitrary Maven coordinates)
For querying any published artifact by explicit coordinate:
cellar get-external # single symbol
cellar list-external # explore a package
cellar search-external # find by name
cellar get-source # source code
cellar deps # dependency tree
Coordinates must be explicit: `group:artifact_3:version` (use `latest` for newest version).
### Workflow
1. **Don't know the package?** → `cellar search ` or `cellar search-external `
2. **Know the package, not the type?** → `cellar list ` or `cellar list-external `
3. **Know the type?** → `cellar get ` or `cellar get-external `
4. **Need the source?** → `cellar get-source `
````
## Building from source
Requires JDK 17+ and [Mill](https://mill-build.org/).
```sh
# Fat JAR
./mill cli.assembly
java -jar out/cli/assembly.dest/out.jar get-external org.typelevel:cats-core_3:2.10.0 cats.Monad
# Native image (GraalVM)
./mill cli.nativeImage
# Wrapper script (for development)
./scripts/cellar get-external org.typelevel:cats-core_3:2.10.0 cats.Monad
```
### Running tests
```sh
# Publish test fixtures to local Maven first
./mill publishFixtures
# Run tests
./mill lib.test
```
### Installing a local build with Nix
```sh
./mill cli.nativeImage && nix profile install --impure .#dev
```
## Tech stack
Scala 3, Cats Effect, fs2, [tasty-query](https://github.com/scalacenter/tasty-query), [Coursier](https://get-coursier.io/), [decline](https://ben.kirw.in/decline/), Mill.
## License
[MPL-2.0](LICENSE)