|
3 | 3 | ## Build, Lint, and Test |
4 | 4 |
|
5 | 5 | - **Run all tests:** `./run_tests.sh` |
6 | | -- **Minimal tests:** `./run_tests.sh -t minimal` |
7 | | - `nvim --headless -u tests/minimal/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/minimal', {minimal_init = './tests/minimal/init.lua', sequential = true})"` |
8 | | -- **Unit tests:** `./run_tests.sh -t unit` |
9 | | - `nvim --headless -u tests/minimal/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/unit', {minimal_init = './tests/minimal/init.lua'})"` |
10 | | -- **Replay tests:** `./run_tests.sh -t replay` |
11 | | - `nvim --headless -u tests/minimal/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/replay', {minimal_init = './tests/minimal/init.lua'})"` |
12 | 6 | - **Run a single test:** Replace the directory in the above command with the test file path, e.g.: |
13 | | - `nvim --headless -u tests/manual/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/unit/job_spec.lua', {minimal_init = './tests/minimal/init.lua'})"` |
14 | | -- **Manual/Visual tests:** `./tests/manual/run_replay.sh` - Replay captured event data for visual testing |
15 | | -- **Debug rendering in headless mode:** |
16 | | - `nvim --headless -u tests/manual/init_replay.lua "+ReplayHeadless" "+ReplayLoad tests/data/FILE.json" "+ReplayAll 0" "+qa"` |
17 | | - This will replay events and dump the output buffer to stdout, useful for debugging rendering issues without a UI. |
18 | | - You can also run to just a specific message # with (e.g. message # 12): |
19 | | - `nvim --headless -u tests/manual/init_replay.lua "+ReplayHeadless" "+ReplayLoad tests/data/message-removal.json" "+ReplayNext 12" "+qa"` |
20 | | -- **Lint:** No explicit lint command; follow Lua best practices. |
| 7 | + - `./run_tests.sh -t tests/unit/test_example.lua` |
21 | 8 |
|
22 | 9 | ## Code Style Guidelines |
23 | 10 |
|
24 | | -- **Imports:** `local mod = require('mod')` at the top. Group standard, then project imports. |
25 | | -- **Formatting:** 2 spaces per indent. No trailing whitespace. Lines ≤ 100 chars. |
26 | | -- **Types:** Use Lua annotations (`---@class`, `---@field`, etc.) for public APIs/config. |
27 | | -- **Naming:** Modules: `snake_case.lua`; functions/vars: `snake_case`; classes: `CamelCase`. |
28 | | -- **Error Handling:** Use `vim.notify` for user-facing errors. Return early on error. |
29 | | -- **Comments:** Avoid obvious comments that merely restate what the code does. Only add comments when necessary to explain *why* something is done, not *what* is being done. Prefer self-explanatory code. |
30 | | -- **Functions:** Prefer local functions. Use `M.func` for module exports. |
| 11 | +- **Comments:** Avoid obvious comments that merely restate what the code does. Only add comments when necessary to explain _why_ something is done, not _what_ is being done. Prefer self-explanatory code. |
31 | 12 | - **Config:** Centralize in `config.lua`. Use deep merge for user overrides. |
32 | | -- **Tests:** Place in `tests/minimal/`, `tests/unit/`, or `tests/replay/`. Manual/visual tests in `tests/manual/`. |
33 | | - |
34 | | -_Agentic coding agents must follow these conventions strictly for consistency and reliability._ |
35 | | - |
36 | | -## File Reference Detection |
37 | | - |
38 | | -The plugin automatically detects file references in LLM responses and makes them navigable via the reference picker (`<leader>or` or `:Opencode references`). |
39 | | - |
40 | | -### Supported Formats |
41 | | - |
42 | | -The reference picker recognizes these file reference patterns: |
43 | | - |
44 | | -1. **Backtick-wrapped** (recommended by LLMs naturally): |
45 | | - - `` `path/to/file.lua` `` |
46 | | - - `` `path/to/file.lua:42` `` |
47 | | - - `` `path/to/file.lua:42:10` `` (with column) |
48 | | - - `` `path/to/file.lua:42-50` `` (line range) |
49 | | - |
50 | | -2. **file:// URIs** (backward compatibility): |
51 | | - - `file://path/to/file.lua` |
52 | | - - `file://path/to/file.lua:42` |
53 | | - - `file://path/to/file.lua:42-50` |
54 | | - |
55 | | -3. **Plain paths** (natural format): |
56 | | - - `path/to/file.lua` |
57 | | - - `path/to/file.lua:42` |
58 | | - - `./relative/path.lua:42` |
59 | | - - `/absolute/path.lua:42` |
60 | | - |
61 | | -All formats support both relative and absolute paths. Files must exist to be recognized (validation prevents false positives). |
62 | | - |
63 | | -**No system prompt configuration is required** - the parser works with all LLM providers, including those without system prompt support. |
| 13 | +- **Types:** Use Lua annotations (`---@class`, `---@field`, etc.) for public APIs/config. |
0 commit comments