Skip to content

Commit b826eb5

Browse files
committed
Add Claude.md
1 parent 8d5ccdb commit b826eb5

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

CLAUDE.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Neil is a CLI tool for managing `deps.edn`-based Clojure projects. It runs on Babashka and handles dependency management, project scaffolding, versioning, licensing, and alias management. Written in Clojure (`.clj`/`.cljc`), it is distributed as a single concatenated Babashka script.
8+
9+
## Common Commands
10+
11+
```bash
12+
bb run dev # Start file watcher for auto-rebuilding the neil script
13+
bb run gen-script # Build the standalone neil script from source modules
14+
bb run lint # Run clj-kondo linter
15+
bb run test:bb # Run Babashka integration tests (rebuilds script first)
16+
bb run test:clj # Run Clojure unit tests
17+
bb run test:emacs # Run Emacs integration tests
18+
bb run ci # Run all: lint + test:bb + test:clj + test:emacs
19+
```
20+
21+
Run specific Babashka test namespaces:
22+
```bash
23+
bb run test:bb :nses '[tests]'
24+
bb run test:bb :nses '[babashka.neil.version-test]'
25+
```
26+
27+
Run specific Clojure tests:
28+
```bash
29+
clojure -M:test --namespace babashka.neil.dep-add-test
30+
```
31+
32+
Set `BABASHKA_FAIL_FAST=true` to stop Babashka tests on first failure.
33+
34+
## Architecture
35+
36+
### Script Generation
37+
38+
Neil is developed as modular source files but distributed as a single executable Babashka script (`./neil`). The build process (`dev/babashka/neil/gen_script.clj`) concatenates the `prelude` file (which injects dependencies via `babashka.deps/add-deps`) with all source modules in a specific order into the `neil` file. **After changing source files, run `bb run gen-script` (or use `bb run dev` for auto-rebuild) before running Babashka tests.**
39+
40+
### Source Modules (src/babashka/neil/)
41+
42+
- `neil.clj` — Main CLI entry point. Uses `babashka.cli/dispatch` for command routing. Contains most business logic for dep operations (add, search, upgrade, versions) and license management.
43+
- `curl.clj` — HTTP client wrapper with GitHub API auth (`NEIL_GITHUB_TOKEN`/`NEIL_GITHUB_USER`)
44+
- `git.clj` — Git operations (tags, SHAs, repo URL construction)
45+
- `new.clj` — Project scaffolding via deps-new
46+
- `version.clj` — Semantic versioning (set, bump major/minor/patch, tag)
47+
- `project.clj` — Project metadata from deps.edn
48+
- `rewrite.clj` — EDN formatting utilities
49+
- `test.cljc` — Test runner alias integration
50+
- `utils.clj` — Lazy-loading via `req-resolve` (workaround for Babashka pmap issues)
51+
- `meta.clj` — Generated version metadata (do not edit; regenerated by gen-script)
52+
53+
### EDN Manipulation
54+
55+
Neil uses `rewrite-edn` (built on `rewrite-clj`) to modify `deps.edn` files while preserving user formatting and whitespace. This is critical for version control friendliness.
56+
57+
### Testing
58+
59+
Two separate test suites:
60+
- **Babashka tests** (`tests.clj` + `test/babashka/neil/version_test.clj` + `test/babashka/neil/dep_upgrade_test.clj`): Integration tests that invoke the compiled `./neil` script. These require `bb run gen-script` first (handled automatically by `bb run test:bb`).
61+
- **Clojure tests** (`test/babashka/neil/`): Unit tests for individual modules, run via cognitect test-runner.
62+
63+
### Version Management
64+
65+
The project version lives in `deps.edn` at `:aliases :neil :project :version`. Use `bb run bump-version` to increment the patch version. The version is baked into the generated script via `meta.clj`.
66+
67+
### Dependencies with `:neil/pinned`
68+
69+
Dependencies in `deps.edn` can be marked with `:neil/pinned true` to skip them during `neil dep upgrade`.

0 commit comments

Comments
 (0)