Files
integreat/.opencode/skills/clojure-eval/examples.md
Bryce 8a0395dc4a Add Bonanza Produce multi-invoice statement template
- Added multi-invoice template for Bonanza Produce with :multi and :multi-match? flags
- Template uses keywords for statement header to identify multi-invoice format
- Extracts invoice-number, date, customer-identifier (from RETURN line), and total
- Parses 4 invoices from statement PDF 13595522.pdf
- All tests pass (29 assertions, 0 failures, 0 errors)

- Added test: parse-bonanza-produce-statement-13595522
- Updated invoice-template-creator skill: emphasized test-first approach
2026-02-08 07:56:14 -08:00

1.6 KiB

clj-nrepl-eval Examples

Discovery

clj-nrepl-eval --connected-ports

Heredoc for Multiline Code

clj-nrepl-eval -p 7888 <<'EOF'
(defn greet [name]
  (str "Hello, " name "!"))

(greet "Claude")
EOF

Heredoc Simplifies String Escaping

Heredoc avoids shell escaping issues with quotes, backslashes, and special characters:

# With heredoc - no escaping needed
clj-nrepl-eval -p 7888 <<'EOF'
(def regex #"\\d{3}-\\d{4}")
(def message "She said \"Hello!\" and waved")
(def path "C:\\Users\\name\\file.txt")
(println message)
EOF

# Without heredoc - requires complex escaping
clj-nrepl-eval -p 7888 "(def message \"She said \\\"Hello!\\\" and waved\")"

Working with Project Namespaces

# Test a function after requiring
clj-nrepl-eval -p 7888 <<'EOF'
(require '[clojure-mcp-light.delimiter-repair :as dr] :reload)
(dr/delimiter-error? "(defn foo [x]")
EOF

Verify Compilation After Edit

# If this returns nil, the file compiled successfully
clj-nrepl-eval -p 7888 "(require 'clojure-mcp-light.hook :reload)"

Session Management

# Reset session if state becomes corrupted
clj-nrepl-eval -p 7888 --reset-session

Common Workflow Patterns

Load, Test, Iterate

# After editing a file, reload and test in one command
clj-nrepl-eval -p 7888 <<'EOF'
(require '[my.namespace :as ns] :reload)
(ns/my-function test-data)
EOF

Run Tests After Changes

clj-nrepl-eval -p 7888 <<'EOF'
(require '[my.project.core :as core] :reload)
(require '[my.project.core-test :as test] :reload)
(clojure.test/run-tests 'my.project.core-test)
EOF