From 9d842cdfc9793da4990bda4bbd0b62a06809eb89 Mon Sep 17 00:00:00 2001 From: Jakub Zika Date: Thu, 10 Sep 2026 18:28:34 +0200 Subject: [PATCH] Make the brepl skill self-contained with verified CLI guidance Replace repeated examples with a compact command reference and practical safeguards for shell quoting, input precedence, server selection, raw nREPL responses, and bracket repair. Keep installation and optional hook setup in brepl's own documentation so the skill-only plugin can be published independently. --- plugins/brepl/README.md | 47 ++----- plugins/brepl/skills/brepl/SKILL.md | 202 +++++++++------------------- 2 files changed, 80 insertions(+), 169 deletions(-) diff --git a/plugins/brepl/README.md b/plugins/brepl/README.md index 201cb75..6de50ba 100644 --- a/plugins/brepl/README.md +++ b/plugins/brepl/README.md @@ -1,45 +1,24 @@ # brepl -A skill that teaches ECA the correct heredoc pattern for evaluating Clojure code via [brepl](https://github.com/licht1stein/brepl), a REPL client. +A skill for evaluating Clojure code with [brepl](https://github.com/licht1stein/brepl). +This plugin provides instructions only. It does not install the brepl executable, +configure hooks, or automatically evaluate edits. ## Requirements -> ⚠️ **You must have `brepl` installed and available on your PATH.** -> -> Install it from [github.com/licht1stein/brepl](https://github.com/licht1stein/brepl) before using this plugin. -> -> You also need a running nREPL server (e.g., started via `lein repl`, `clj -M:nrepl`, or your build tool of choice). +Install `brepl` separately and make it available on ECA's `PATH`. +Evaluation requires a running nREPL server. Manual bracket repair does not. -## What it provides - -- **`brepl` skill** — Must be loaded before any brepl usage. Teaches the heredoc pattern that eliminates shell quoting issues when evaluating Clojure expressions. - -## Why this skill matters - -Shell quoting with Clojure is error-prone: Clojure uses both single and double quotes, nested quotes require escaping, and reader macros can confuse the shell. The heredoc pattern (`<<'EOF'`) eliminates all these issues by passing code literally to brepl. +See the [brepl repository](https://github.com/licht1stein/brepl) for installation +instructions and optional hook setup. ## Usage -The skill is automatically loaded when needed. You can also request it explicitly: - -``` -Load the brepl skill and evaluate my test -``` - -### Quick example - -```bash -brepl <<'EOF' -(require '[clojure.string :as str]) -(str/join ", " ["hello" "world"]) -EOF -``` - -## Features covered by the skill +ECA normally loads the `brepl` skill automatically when needed. You can also +ask ECA to load it explicitly. The skill covers command options, safe quoting, +server selection, file loading, raw nREPL messages, error handling, and manual +bracket repair. Its usage instructions are self-contained. -- **Heredoc pattern** for reliable multi-line evaluation -- **File loading** via `brepl -f` -- **Bracket fixing** via `brepl balance` -- **Common patterns** — namespace reloading, doc lookup, error inspection, test running +Updating this plugin does not change existing hook configuration. -Credits: Based on the [brepl](https://github.com/licht1stein/brepl) project by @licht1stein. +Credits: Based on [brepl](https://github.com/licht1stein/brepl) by @licht1stein. diff --git a/plugins/brepl/skills/brepl/SKILL.md b/plugins/brepl/skills/brepl/SKILL.md index 0d40b80..375b8f4 100644 --- a/plugins/brepl/skills/brepl/SKILL.md +++ b/plugins/brepl/skills/brepl/SKILL.md @@ -1,51 +1,31 @@ --- name: brepl -description: "MANDATORY - Load this skill BEFORE using brepl in any way. Teaches the heredoc pattern for reliable Clojure code evaluation." +description: "Evaluate Clojure code and use the REPL via brepl. Load this skill before using brepl." --- -# brepl - Evaluating Clojure Code +## Requirements -## CRITICAL: Load This Skill First +Use an installed `brepl` binary on `PATH`. Evaluation requires a running nREPL +server; manual bracket repair does not. -**You MUST load this skill before using brepl.** Do NOT attempt to use brepl without loading this skill first, or you will use incorrect syntax. +## Command Reference -## Overview +- `brepl -e EXPR` or `brepl EXPR`: evaluate one expression argument. +- `brepl` with stdin: evaluate code from a pipe or heredoc. +- `brepl -f FILE`: load and execute a file. +- `brepl -m MESSAGE`: send a raw nREPL message in EDN format. +- `-p PORT`, `-h HOST`: select the nREPL server. `-h` is not help. +- `--verbose`: show raw protocol messages instead of normal result output. +- `--help` or `-?`: show help. `--version`: show the installed version. +- `brepl balance FILE [--dry-run]`: repair brackets, or preview the repair. -brepl is a REPL client for evaluating Clojure expressions. This skill teaches the heredoc pattern for reliable code evaluation. +## Evaluating Code -**Always load this skill before using brepl. Always use the heredoc pattern for all Clojure code evaluation.** - -## The Heredoc Pattern - Default Approach - -**Always use heredoc for brepl evaluation.** This eliminates quoting issues, works for all cases, and provides a consistent, reliable pattern. - -### Syntax (Stdin - Recommended) - -```bash -brepl <<'EOF' -(your clojure code here) -EOF -``` - -This is the simplest heredoc syntax - stdin feeds directly to brepl. - -### Alternative Syntax (Positional Argument) - -For simple one-liners, you can use positional arguments: - -```bash -brepl '(+ 1 2 3)' -``` - -Heredoc is preferred for anything with quotes or multiple lines. - -**Note**: The `-e` flag is optional - brepl automatically treats stdin and positional arguments as code to evaluate. - -**Important**: Use `<<'EOF'` (with quotes) not `<