lua/claudecode/: Core plugin modules (init.lua,config.lua,diff.lua,terminal/,server/,tools/,logger.lua, etc.).plugin/: Lightweight loader that guards startup and optional auto-setup.tests/: Busted test suite (unit/,integration/,helpers/,mocks/).fixtures/: Minimal Neovim configs for manual and integration testing.scripts/: Development helpers;dev-config.luaaids local testing.
- Setup (one time): install mise, then
mise install && mise run setupto provision the toolchain and build the Lua test rocks. Activate mise in your shell (eval "$(mise activate bash)"in your rc) so bare tools likebusted/nvimare on PATH; otherwise prefix withmise exec --. Runmise tasksto list all tasks. mise run check: Syntax checks +luacheckonlua/andtests/.mise run format: Format the tree with treefmt (replaces the formernix fmt).mise run test: Run Busted tests with coverage (outputsluacov.stats.out).mise run clean: Remove coverage artifacts. Examples:- Run all tests:
mise run test - Run one file:
busted -v tests/unit/terminal_spec.lua
- Lua: 2‑space indent, 120‑column width, double quotes preferred.
- Formatting: StyLua configured in
.stylua.toml(require-sort enabled). - Linting:
luacheckwith settings in.luacheckrc(usesluajit+bustedstd). - Modules/files: lower_snake_case; return a module table
Mwith documented functions (EmmyLua annotations encouraged). - Avoid one-letter names; prefer explicit, testable functions.
- Frameworks: Busted + Luassert; Plenary used where Neovim APIs are needed.
- File naming:
*_spec.luaor*_test.luaundertests/unitortests/integration. - Mocks/helpers: place in
tests/mocksandtests/helpers; prefer pure‑Lua mocks. - Coverage: keep high signal; exercise server, tools, diff, and terminal paths.
- Quick tip: prefer
mise run test(it setsLUA_PATHand coverage flags).
- Commits: Use Conventional Commits (e.g.,
feat:,fix:,docs:,test:,chore:). Keep messages imperative and scoped. - PRs: include a clear description, linked issues, repro steps, and tests. Update docs (
README.md,ARCHITECTURE.md, orDEVELOPMENT.md) when behavior changes. - Pre-flight: run
mise run all(format, lint, test). Attach screenshots or terminal recordings for UX-visible changes (diff flows, terminal behavior).
- Do not commit secrets or local paths; prefer environment variables. The plugin honors
CLAUDE_CONFIG_DIRfor lock files. - Local CLI paths (e.g.,
opts.terminal_cmd) should be configured in user config, not hardcoded in repo files.