Skip to content

Maven repositories - #121

Open
matejcerny wants to merge 1 commit into
VirtusLab:mainfrom
matejcerny:maven-config
Open

Maven repositories#121
matejcerny wants to merge 1 commit into
VirtusLab:mainfrom
matejcerny:maven-config

Conversation

@matejcerny

@matejcerny matejcerny commented Aug 9, 2026

Copy link
Copy Markdown
Contributor
  • add support for configuring extra Maven repositories
  • rewrite SKILL.md to be more concise / token efficient

(I've been using this updated skill for more than a week, so I can confirm it works correctly)

@rochala

rochala commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

LGTM but before I merge I want to run skill creator skill to double check those changes

@rochala

rochala commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Skill creator suggested leaving example block because it tell agent how it can grep it further etc.

Comment thread skills/cellar/SKILL.md Outdated

Run `cellar --version` to verify cellar is on PATH. If not found, the user
needs to install it: https://github.com/VirtusLab/cellar#installation
Look up JVM dependency APIs from the terminal. NEVER download or unpack JARs manually.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skill-creator suggested that leaving a reason will hold better and have better results

Comment thread skills/cellar/SKILL.md Outdated
Prefer cellar **only** for external dependency API lookups (`cellar get-external` vs Metals `inspect`/`get-docs`): cellar requires no project import and works with any published Maven coordinate. For all other tasks — goto definition, find references, rename, diagnostics, compilation — use Metals.
cellar reads APIs, nothing else.
External coordinate → cellar.
Project classpath → Metals `inspect`/`get-docs`/`glob-search`, or cellar's project-aware commands when Metals is unavailable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to be extra careful with metals.

I got some comments / feedback that when they used it with IJ, it tried to install metals or something because of our skill. I'd be very explicit here so something more like:

Project classpath:
Metals MCP server if available > cellar project-aware commands

Compile, references, tests, formatting are not supported by cellar

rochala added a commit that referenced this pull request Aug 23, 2026
`MavenRepository.of` accepts any string verbatim, so a typo like a
missing scheme survived until resolution failed — and it then failed as
`CoordinateNotFound`, pointing at the coordinate with coordinate
suggestions rather than at the repository that was actually wrong.

Reject the URL at parse time instead: empty strings, unparseable URIs,
a missing scheme, schemes other than http/https/file, and http(s) URLs
with no host. The rejection reason carries no source prefix of its own,
so the caller names where the URL came from; that keeps the config-file
source #121 adds able to reuse the same check.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Add `maven.repositories`, extra repository URLs applied to every external
command. CLI `-r` values are appended to the configured list, duplicates
collapse ignoring a trailing slash.

`Config.loadFrom` takes explicit file locations so tests never read the
real user configuration.
@matejcerny matejcerny changed the title Maven repositories + improved SKILL.md Maven repositories Aug 31, 2026
@matejcerny

Copy link
Copy Markdown
Contributor Author

Rebased. I removed the SKILL.md refactoring to unblock it.

Here is the "backup", feel free to cherry-pick it if you want. I use it for almost a month now an it works as expected (tested with Claude Sonnet 5, Opus 5, GPT Luna, Sol and Grok 4.5), no need for examples. One thing I didn't test is IJ compatibility since I don't have any agentic plugin there.

SKILL.md
---
name: cellar
description: >
  Look up the public API of any JVM dependency (Scala 3, Scala 2, Java) from
  the terminal — type signatures, members, docs, and source as Markdown, no
  JAR unpacking needed. Use this skill whenever you need to call an unfamiliar
  library method, explore a package's types, or check a dependency's API.
  Prefer cellar over Metals MCP only for looking up external dependency APIs
  (`cellar get-external` vs Metals `inspect`/`get-docs`) — cellar needs no
  project import and queries any published Maven artifact.
---

# Cellar

Look up JVM dependency APIs from the terminal. NEVER download or unpack JARs manually.
If `cellar` isn't on PATH: https://github.com/VirtusLab/cellar#installation

## Project-aware commands (run from project root)

Queries the current project and its dependencies. Auto-detects Mill, sbt, scala-cli.

```sh
cellar get [--module <name>] <fqn>       # signature, members, docs
cellar list [--module <name>] <package>  # symbols in a package or class
cellar search [--module <name>] <query>  # case-insensitive substring search
```

- Mill/sbt: `--module` required (e.g. `--module core`)
- scala-cli: omit `--module`
- `--no-cache` — re-extract classpath from the build tool

## External (any Maven coordinate)

```sh
cellar get-external <coordinate> <fqn>
cellar list-external <coordinate> <package>
cellar search-external <coordinate> <query>
cellar get-source <coordinate> <fqn>
cellar deps <coordinate>
cellar meta <coordinate>
```

- Coordinates must be explicit: `group:artifact_3:version` (no `::` shorthand)
- sbt plugins: full Scala + sbt suffix, e.g. `org.scala-native:sbt-scala-native_2.12_1.0:latest`
- Full Scala-version artifacts: e.g. `group:artifact_3.3.8:version`
- Version may be `latest`
- `-r <url>` — extra Maven repository (repeatable). Only for a repository that is not already
  listed under `maven.repositories` in `~/.cellar/cellar.conf` or `.cellar/cellar.conf`; those
  apply automatically. Never ask for, inspect, or pass repository credentials.

## Flags for both

- `-l N` — limit `list`/`search` results (default 50) or `get` members
- `--hide-inherited` / `--group-inherited` — control inherited members on `get`
- `--java-home <path>` — override JRE classpath

## Workflow

1. Package/name unknown → `search` / `search-external`
2. Package or enclosing class known, type unknown → `list` / `list-external`
3. Type known → `get` / `get-external`
4. Implementation needed → `get-source`
5. Coordinate/POM only → `meta` or `deps`

## Examples

```sh
cellar get-external org.typelevel:cats-core_3:2.10.0 cats.Monad
cellar get-external --hide-inherited org.typelevel:cats-core_3:2.10.0 cats.Monad
cellar list-external io.circe:circe-core_3:0.14.6 io.circe
cellar search-external org.typelevel:cats-core_3:2.10.0 flatMap
cellar get-source org.typelevel:cats-core_3:2.10.0 cats.Monad
cellar deps org.typelevel:cats-effect_3:3.5.4
cellar get --module lib cats.Monad
```

## Metals vs cellar

cellar reads APIs, nothing else.
External coordinate → cellar.
Project classpath → Metals `inspect`/`get-docs`/`glob-search`, or cellar's project-aware commands when Metals is unavailable.
Compile, references, tests, formatting → Metals.

## Output

stdout is Markdown, stderr is diagnostics. Exit 0 success, 1 error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants