|
1 | | -AGENT GUIDE (for coding agents) |
| 1 | +ECA Agent Guide (AGENTS.md) |
2 | 2 |
|
3 | | -Build/Run |
4 | | -- Prereqs: Clojure CLI (tools.deps) and Babashka (bb.edn). |
5 | | -- Local dev binary (nREPL-enabled): bb debug-cli (produces ./eca[.bat]). |
6 | | -- Production-like embedded JVM binary: bb prod-cli; Fat JAR: bb prod-jar; Native (GraalVM): set GRAALVM_HOME, then bb native-cli. |
7 | | - |
8 | | -Test |
9 | | -- Unit tests (Kaocha): bb test (equivalent to clojure -M:test). |
10 | | -- Run a single test ns: clojure -M:test --focus eca.shared-test (regex allowed, e.g. --focus "eca.features.*"). |
11 | | -- Run a single test var: clojure -M:test --focus "eca.shared-test/some-test". |
12 | | -- Integration tests (require ./eca binary): bb prod-cli && bb integration-test but only run if user requests it. |
13 | | - |
14 | | -Lint/Format |
15 | | -- Lint with clojure-lsp (config in .lsp/): `clojure-lsp diagnostics`. |
16 | | -- Use clojure-lsp formatting style, follow idiomatic Clojure style (2-space indent, align let bindings, wrap at ~100 cols). |
17 | | - |
18 | | -Code Style |
19 | | -- Namespace preamble: (set! *warn-on-reflection* true); prefer require with :as aliases (e.g., [clojure.string :as string], [eca.features.commands :as f.commands]); use :refer only for a few, explicit symbols. |
20 | | -- Naming: kebab-case for vars/fns, namespaces as eca.<area>[.<subarea>]; predicates end with ? (e.g., clear-history-after-finished?). |
21 | | -- Data: use plain maps with clear keys; prefer assoc-some (eca.shared) to avoid nil assigns; thread with -> / ->> for pipelines. |
22 | | -- Errors/logging: throw ex-info with a data map; log via eca.logger/{debug,info,warn,error}; avoid println to stdout (stderr logging is handled). |
23 | | -- APIs: favor pure functions; side effects live in features/tools or adapters; keep tool I/O and messaging through eca.messenger/f.tools. |
24 | | -- Unit tests should have a single `deftest` for function to be tested with multiple `testing`s for each tested case. |
25 | | -- Unit tests that use file paths and uris should rely on `h/file-path` and `h/file-uri` to avoid windows issues with slashes. |
26 | | - |
27 | | -Secrets Management |
28 | | -- `src/eca/secrets.clj` - Main secrets manager for credential file operations: |
29 | | - - File discovery and priority order (`:netrcFile <FILE>` config → .netrc → _netrc) |
30 | | - - Cross-platform path construction using io/file (handles / vs \ separators automatically) |
31 | | - - keyRc format parsing: [login@]machine[:port] (named after Unix "rc" config file tradition) |
32 | | - - Credential matching logic (exact login match when specified, first match otherwise) |
33 | | - - Permission validation (Unix: warns if not 0600; Windows: skipped) |
34 | | -- Authentication flow: config `key` → credential files `keyRc` → env var `keyEnv` → OAuth |
35 | | - |
36 | | -Notes |
37 | | -- CI runs: bb test and bb integration-test. Ensure these pass locally before PRs. |
| 3 | +- Build (requires Clojure CLI + Babashka): |
| 4 | + - All-in-one debug CLI (JVM, with nREPL): bb debug-cli |
| 5 | + - Production CLI (JVM): bb prod-cli | Production JAR: bb prod-jar |
| 6 | + - Native image (requires GRAALVM_HOME): bb native-cli |
| 7 | +- Test (Kaocha via :test alias): |
| 8 | + - Run all unit tests: bb test (equivalent: clojure -M:test) |
| 9 | + - Run a single namespace: clojure -M:test --focus eca.main-test |
| 10 | + - Run a single test var: clojure -M:test --focus eca.main-test/parse-opts-test |
| 11 | + - Integration tests (needs ./eca or eca.exe present): bb integration-test |
| 12 | +- Lint/format: |
| 13 | + - Lint: clj-kondo --lint src test dev integration-test |
| 14 | + - Formatting is not enforced; follow idiomatic Clojure (use cljfmt if desired). |
| 15 | +- Namespace and imports: |
| 16 | + - One file per `ns`; set! *warn-on-reflection* true. |
| 17 | + - Group requires: stdlib, third‑party, then eca.*; sort within groups. |
| 18 | + - Prefer :as aliases; avoid :refer except in tests (clojure.test only what you use). |
| 19 | +- Naming/types: |
| 20 | + - kebab-case for fns/vars, snake/camel only for external data keys; namespaces `eca.<area>[.<subarea>]`. |
| 21 | + - Prefer immutable maps/vectors/sets; use namespaced keywords for domain data. |
| 22 | + - Add type hints only to silence reflection where needed. |
| 23 | +- Errors/logging: |
| 24 | + - Use ex-info with data for exceptional paths; return {:result-code ...} maps from CLI flows. |
| 25 | + - Never println for app logs; use eca.logger (levels: error/warn/info/debug). |
| 26 | +- Tests: |
| 27 | + - Use clojure.test + matcher-combinators; keep tests deterministic; place helpers under test/eca/test_helper.clj. |
0 commit comments