-
Notifications
You must be signed in to change notification settings - Fork 0
Add ERT tests, CI workflow, and shared command helpers #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dc4923f
130562d
eaf9365
23f2be8
fd7443d
60ce218
a05c6f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master, develop ] | ||
| pull_request: | ||
| branches: [ main, master, develop ] | ||
| workflow_dispatch: # Allow manual triggering from GitHub UI | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Emacs | ||
| uses: purcell/setup-emacs@master | ||
| with: | ||
| version: 29.1 | ||
| - name: Lint and compile | ||
| uses: leotaku/elisp-check@v1.4.0 | ||
| with: | ||
| check: melpa | ||
| file: cursor-agent.el | ||
| - name: Run tests | ||
| uses: leotaku/elisp-check@v1.4.0 | ||
| with: | ||
| check: ert | ||
| file: cursor-agent-test.el | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -228,7 +228,7 @@ If you want to track the package via Git and get updates: | |||||
|
|
||||||
| 2. **Run `doom sync`** to install | ||||||
|
|
||||||
| 3. **Add configuration to `~/.config/doom/config.el`:** | ||||||
| 3. **Add configuration to `~/.config/doom/config.el`** — use `after! cursor-agent` only for `setq` and keybindings. **Do not** `unload-feature` or `load` the package in `after!`; that causes recursive load errors (see [Known issues](#known-issues)): | ||||||
| ```elisp | ||||||
| (after! cursor-agent | ||||||
| (setq cursor-agent-default-model "gpt-5") | ||||||
|
|
@@ -252,13 +252,16 @@ If you're developing or want to keep it in a separate directory: | |||||
| 1. **Add to `~/.config/doom/packages.el`:** | ||||||
| ```elisp | ||||||
| (package! cursor-agent | ||||||
| :recipe (:local-repo "~/workspaces/personal/cursor-agent.el" | ||||||
| :files ("cursor-agent.el"))) | ||||||
| :recipe (:local-repo "/path/to/cursor-agent.el" ; or "~/workspaces/personal/cursor-agent.el" | ||||||
| :files ("cursor-agent.el") | ||||||
| :build (:not compile))) ; optional: faster iteration when not byte-compiling | ||||||
| ``` | ||||||
|
|
||||||
| 2. **Run `doom sync`** | ||||||
|
|
||||||
| 3. **Configure in `~/.config/doom/config.el`** as shown in Method 2 | ||||||
| 3. **Configure in `~/.config/doom/config.el`** as in Method 2. **Do not** `unload-feature` or `load` cursor-agent in `after!` — it causes recursive load errors. | ||||||
|
|
||||||
| With `:local-repo`, Doom/Straight may only autoload a few commands at startup. Run `M-x cursor-agent-install` (or any autoloaded command) once to load the full file; after that, all commands are available. See [Known issues](#known-issues). | ||||||
|
|
||||||
| ### Doom Emacs Keybindings | ||||||
|
|
||||||
|
|
@@ -286,10 +289,20 @@ The recommended keybinding layout for Doom Emacs: | |||||
| ### Doom Emacs Tips | ||||||
|
|
||||||
| - **No `doom sync` needed** for Method 1 (local file) - just restart Emacs | ||||||
| - **Use `after!` macro** for package configuration when using `package!` | ||||||
| - **Use `after!` macro** for package configuration when using `package!` — only for `setq` and keybindings, **not** for `unload-feature` or `load` of cursor-agent (causes recursive load) | ||||||
| - **Use `map!` macro** for keybindings (Doom's DSL) | ||||||
| - **vterm module**: If you have Doom's `:term vterm` module enabled, vterm will be available automatically | ||||||
|
|
||||||
| ## Known issues | ||||||
|
|
||||||
| ### Doom Emacs / Straight: commands unavailable until first use | ||||||
|
|
||||||
| With Doom and Straight (`package!` with `:local-repo` or `:host github`), only a subset of commands may appear in `M-x` at startup. **Run `M-x cursor-agent-install`** (or any other autoloaded command) **once** to load the full package; after that, all commands are available. This comes from how Doom/Straight generate and apply autoloads; the package itself has `;;;###autoload` on all commands. | ||||||
|
|
||||||
| ### Doom Emacs: do not unload/reload in config | ||||||
|
|
||||||
| **Do not** use `unload-feature` and `load` (or `load-file`) of `cursor-agent.el` inside an `after! cursor-agent` block. That causes a **recursive load** between the Straight build path and your source path (e.g. workspace or `:local-repo`). Use `after! cursor-agent` only for configuration (`setq`, keybindings). The package is already loaded by Doom/Straight. | ||||||
|
|
||||||
| ## Compatibility | ||||||
|
|
||||||
| This package is **designed and tested primarily for vanilla Emacs**. It uses only standard Emacs features and has no distribution-specific dependencies. | ||||||
|
|
@@ -341,6 +354,24 @@ The package will automatically fall back to `shell-mode`. For better experience, | |||||
| M-x package-install RET vterm RET | ||||||
| ``` | ||||||
|
|
||||||
| ## Testing | ||||||
|
|
||||||
| Tests are included in `cursor-agent-test.el` using ERT (Emacs Lisp Regression Testing). Run tests locally: | ||||||
|
|
||||||
| ```elisp | ||||||
| M-x load-file RET cursor-agent-test.el RET | ||||||
| M-x ert RET cursor-agent-test-.* RET | ||||||
| ``` | ||||||
|
|
||||||
| Or from the command line: | ||||||
|
|
||||||
| ```bash | ||||||
| emacs --batch -l ert -l cursor-agent.el -l cursor-agent-test.el \ | ||||||
| --eval "(ert-run-tests-batch-and-exit 'cursor-agent-test-.* t)" | ||||||
|
||||||
| --eval "(ert-run-tests-batch-and-exit 'cursor-agent-test-.* t)" | |
| --eval "(ert-run-tests-batch-and-exit \"cursor-agent-test-\")" |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,261 @@ | ||||||||||||||||||||
| ;;; cursor-agent-test.el --- Unit tests for cursor-agent.el | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
Comment on lines
+1
to
+2
|
||||||||||||||||||||
| ;;; cursor-agent-test.el --- Unit tests for cursor-agent.el | |
| ;;; cursor-agent-test.el --- Unit tests for cursor-agent.el -*- lexical-binding: t; -*- | |
| ;; Author: cursor-agent maintainers | |
| ;; Maintainer: cursor-agent maintainers | |
| ;; Version: 0.1 | |
| ;; Package-Requires: ((emacs "24.3")) | |
| ;; Keywords: tools, lisp | |
| ;; URL: https://example.com/cursor-agent |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test selector pattern "cursor-agent-test-" matches test names that start with this prefix, but the selector should be a regexp pattern. While this will work for substring matching, using a proper regexp like "^cursor-agent-test-" would be more explicit and matches the pattern used in the README documentation where "cursor-agent-test-.*" is shown.
| (ert-run-tests "cursor-agent-test-" t)) | |
| (ert-run-tests "^cursor-agent-test-" t)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow uses purcell/setup-emacs@master which references an unstable moving target. For better reproducibility and stability, it's recommended to pin to a specific version tag or commit SHA instead of using @master. This prevents unexpected breaks when the upstream action changes.