Skip to content

Commit 30711c8

Browse files
ThomasK33claude
andcommitted
chore: migrate dev environment from Nix flake to mise
Replace the Nix flake devShell with mise (mise.toml) for tool provisioning and treefmt (treefmt.toml) for formatting. Delete flake.nix, flake.lock, the Makefile, .envrc, and the devcontainer Dockerfile; CI, the format hook, the devcontainer, and the docs now drive everything through mise tasks (`mise run <task>` / `mise tasks`). Key details: - Tests run under LuaJIT with busted 2.2.0: the blocking-diff tools yield coroutines across pcall/C boundaries (which PUC Lua 5.1 forbids), and busted 2.3.0 changed test-execution behavior the suite depends on. PUC `lua` is kept only to provide LuaRocks, which builds the rocks targeting LuaJIT. - mise.lock pins resolved tool URLs/checksums (the integrity role flake.lock played); `mise run setup` builds busted/luacheck/luacov into ./.luarocks. - treefmt.toml replicates the former treefmt-nix formatter set (nixpkgs-fmt dropped since no .nix files remain). - Devcontainer regenerated via `mise generate devcontainer`. Change-Id: If27a12690d9d608e71dd534759eeecd6d8fd4cd2 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 102d835 commit 30711c8

20 files changed

Lines changed: 504 additions & 461 deletions

.claude/hooks/format.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
#
33
# Claude Code Hook: Format Files
4-
# Triggers after Claude edits/writes files and runs nix fmt
4+
# Triggers after Claude edits/writes files and runs treefmt (via mise)
55
#
66
# Environment variables provided by Claude Code:
77
# - CLAUDE_PROJECT_DIR: Path to the project directory
@@ -75,18 +75,18 @@ main() {
7575
exit 1
7676
fi
7777

78-
log "${YELLOW}Formatting file with nix fmt...${NC}"
78+
log "${YELLOW}Formatting file with treefmt...${NC}"
7979

8080
# Change to project directory
8181
cd "${CLAUDE_PROJECT_DIR}"
8282

83-
# Run nix fmt on the file
84-
if nix fmt "$FILE_PATH" 2>/dev/null; then
83+
# Run treefmt on the file
84+
if mise exec -- treefmt "$FILE_PATH" 2>/dev/null; then
8585
log "${GREEN}✓ Successfully formatted: $FILE_PATH${NC}"
8686
exit 0
8787
else
8888
EXIT_CODE=$?
89-
log "${RED}nix fmt failed with exit code $EXIT_CODE${NC}"
89+
log "${RED}treefmt failed with exit code $EXIT_CODE${NC}"
9090
log "${RED}This indicates the file has formatting issues that need manual attention${NC}"
9191

9292
# Don't fail the hook - just warn about formatting issues

.devcontainer/Dockerfile

Lines changed: 0 additions & 29 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
{
22
"name": "claudecode.nvim Development",
3-
"build": {
4-
"dockerfile": "Dockerfile"
5-
},
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
64
"features": {
7-
"ghcr.io/devcontainers/features/git:1": {}
5+
"ghcr.io/devcontainers-extra/features/mise:1": {}
86
},
97
"customizations": {
108
"vscode": {
11-
"settings": {
12-
"terminal.integrated.defaultProfile.linux": "bash"
13-
},
14-
"extensions": ["jnoortheen.nix-ide"]
9+
"extensions": ["hverlin.mise-vscode"]
1510
}
1611
},
1712
"postCreateCommand": "bash .devcontainer/post-create.sh",

.devcontainer/post-create.sh

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
#!/bin/bash
2+
set -euo pipefail
23

3-
# Source Nix environment
4-
. /home/vscode/.nix-profile/etc/profile.d/nix.sh
5-
6-
# Verify Nix is available
7-
if ! command -v nix &>/dev/null; then
8-
echo "Error: Nix is not installed properly"
4+
# Ensure the feature-installed mise is on PATH for this script.
5+
export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"
6+
if ! command -v mise &>/dev/null; then
7+
echo "Error: mise is not on PATH after the devcontainer feature install" >&2
98
exit 1
109
fi
1110

12-
echo "✅ Nix is installed and available"
13-
echo ""
14-
echo "📦 claudecode.nvim Development Container Ready!"
15-
echo ""
16-
echo "To enter the development shell with all dependencies, run:"
17-
echo " nix develop"
11+
# Build deps: PUC Lua builds from source, and the test rocks compile C modules.
12+
sudo apt-get -o Acquire::Retries=3 update
13+
sudo apt-get -o Acquire::Retries=3 install -y build-essential libreadline-dev unzip
14+
15+
# Activate mise in interactive shells (puts the toolchain + fixtures/bin on PATH).
16+
if ! grep -qs 'mise activate bash' "$HOME/.bashrc"; then
17+
echo 'eval "$(mise activate bash)"' >>"$HOME/.bashrc"
18+
fi
19+
1820
echo ""
19-
echo "This will provide:"
20-
echo " - Neovim"
21-
echo " - Lua and LuaJIT"
22-
echo " - busted (test framework)"
23-
echo " - luacheck (linter)"
24-
echo " - stylua (formatter)"
25-
echo " - All other development tools"
21+
echo "📦 Provisioning the claudecode.nvim development environment with mise..."
22+
23+
mise trust
24+
mise install
25+
mise run setup
26+
2627
echo ""
27-
echo "You can also run development commands directly:"
28-
echo " - make # Run full validation (format, lint, test)"
29-
echo " - make test # Run tests"
30-
echo " - make check # Run linter"
31-
echo " - make format # Format code"
28+
echo "✅ claudecode.nvim development environment ready."
29+
echo " mise run all # full validation (format, lint, test)"
30+
echo " mise run test # run tests"
31+
echo " mise run check # lint"
32+
echo " mise run format # format"
33+
echo " mise tasks # list all tasks"

.envrc

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ concurrency:
1616
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
1717

1818
jobs:
19+
# Unit/component tests run under LuaJIT with a mocked vim global (busted), so
20+
# they do not need a real Neovim binary — hence no neovim-version matrix here.
21+
# Real-Neovim coverage lives in the integration-tests job below.
1922
unit-tests:
2023
runs-on: ubuntu-latest
21-
strategy:
22-
matrix:
23-
neovim-version: ["stable", "nightly"]
2424

2525
steps:
2626
- name: Checkout
@@ -29,38 +29,38 @@ jobs:
2929
fetch-depth: 0
3030
persist-credentials: false
3131

32-
- name: Setup Nix
33-
uses: nixbuild/nix-quick-install-action@5bb6a3b3abe66fd09bbf250dce8ada94f856a703 # v30
32+
# Build deps: PUC Lua builds from source, and the test rocks compile C modules.
33+
- name: Install build dependencies
34+
run: |
35+
sudo apt-get -o Acquire::Retries=3 update
36+
sudo apt-get -o Acquire::Retries=3 install -y build-essential libreadline-dev unzip
3437
35-
- uses: nix-community/cache-nix-action@135667ec418502fa5a3598af6fb9eb733888ce6a # v6.1.3
36-
with:
37-
primary-key: nix-claudecode-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
38-
restore-prefixes-first-match: nix-claudecode-${{ runner.os }}-
39-
gc-max-store-size-linux: 2G
40-
purge: true
41-
purge-prefixes: nix-claudecode-${{ runner.os }}-
42-
purge-created: 0
43-
purge-primary-key: never
38+
- name: Set up mise
39+
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
4440

45-
- name: Setup Neovim
46-
uses: rhysd/action-setup-vim@8e931b9954b19d4203d5caa5ff5521f3bc21dcc7 # v1.4.2
41+
# Cache the rock tree (rebuilt from luarocks.org otherwise); a miss just rebuilds.
42+
- name: Cache Lua test rocks
43+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
4744
with:
48-
neovim: true
49-
version: ${{ matrix.neovim-version }}
45+
path: .luarocks
46+
key: luarocks-${{ runner.os }}-${{ hashFiles('mise.toml') }}
47+
48+
- name: Install Lua test rocks
49+
run: mise run setup
5050

51-
- name: Run Luacheck
52-
run: nix develop .#ci -c make check
51+
- name: Run luacheck
52+
run: mise run check
5353

5454
- name: Run tests
55-
run: nix develop .#ci -c make test
55+
run: mise run test
5656

5757
- name: Check formatting
58-
run: nix flake check
58+
run: mise run format-check
5959

6060
- name: Generate coverage report
6161
run: |
6262
if [ -f "luacov.stats.out" ]; then
63-
nix develop .#ci -c luacov
63+
mise exec -- luacov
6464
6565
echo "Creating lcov.info from luacov.report.out"
6666
{
@@ -134,19 +134,8 @@ jobs:
134134
fetch-depth: 0
135135
persist-credentials: false
136136

137-
- name: Setup Nix
138-
uses: nixbuild/nix-quick-install-action@5bb6a3b3abe66fd09bbf250dce8ada94f856a703 # v30
139-
140-
- uses: nix-community/cache-nix-action@135667ec418502fa5a3598af6fb9eb733888ce6a # v6.1.3
141-
with:
142-
primary-key: nix-claudecode-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
143-
restore-prefixes-first-match: nix-claudecode-${{ runner.os }}-
144-
gc-max-store-size-linux: 2G
145-
purge: true
146-
purge-prefixes: nix-claudecode-${{ runner.os }}-
147-
purge-created: 0
148-
purge-primary-key: never
149-
137+
# Neovim here comes from action-setup-vim (matrix-driven), independent of
138+
# the mise.toml neovim pin used for local dev.
150139
- name: Setup Neovim
151140
uses: rhysd/action-setup-vim@8e931b9954b19d4203d5caa5ff5521f3bc21dcc7 # v1.4.2
152141
with:
@@ -159,4 +148,4 @@ jobs:
159148
ln -s "$(pwd)" ~/.local/share/nvim/site/pack/vendor/start/claudecode.nvim
160149
161150
- name: Run integration tests
162-
run: nix develop .#ci -c ./scripts/run_integration_tests_individually.sh
151+
run: ./scripts/run_integration_tests_individually.sh

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ luac.out
66
*.zip
77
*.tar.gz
88

9+
# Project-local Lua rock tree built by `mise run setup`
10+
/.luarocks/
11+
912
# Object files
1013
*.o
1114
*.os

AGENTS.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010

1111
## Build, Test, and Development Commands
1212

13-
- `make check`: Syntax checks + `luacheck` on `lua/` and `tests/`.
14-
- `make format`: Format with StyLua (via Nix `nix fmt` in this repo).
15-
- `make test`: Run Busted tests with coverage (outputs `luacov.stats.out`).
16-
- `make clean`: Remove coverage artifacts.
13+
- Setup (one time): install [mise](https://mise.jdx.dev), then `mise install && mise run setup` to provision the toolchain and build the Lua test rocks. Activate mise in your shell (`eval "$(mise activate bash)"` in your rc) so bare tools like `busted`/`nvim` are on PATH; otherwise prefix with `mise exec --`. Run `mise tasks` to list all tasks.
14+
- `mise run check`: Syntax checks + `luacheck` on `lua/` and `tests/`.
15+
- `mise run format`: Format the tree with treefmt (replaces the former `nix fmt`).
16+
- `mise run test`: Run Busted tests with coverage (outputs `luacov.stats.out`).
17+
- `mise run clean`: Remove coverage artifacts.
1718
Examples:
18-
- Run all tests: `make test`
19+
- Run all tests: `mise run test`
1920
- Run one file: `busted -v tests/unit/terminal_spec.lua`
2021

2122
## Coding Style & Naming Conventions
@@ -32,13 +33,13 @@
3233
- File naming: `*_spec.lua` or `*_test.lua` under `tests/unit` or `tests/integration`.
3334
- Mocks/helpers: place in `tests/mocks` and `tests/helpers`; prefer pure‑Lua mocks.
3435
- Coverage: keep high signal; exercise server, tools, diff, and terminal paths.
35-
- Quick tip: prefer `make test` (it sets `LUA_PATH` and coverage flags).
36+
- Quick tip: prefer `mise run test` (it sets `LUA_PATH` and coverage flags).
3637

3738
## Commit & Pull Request Guidelines
3839

3940
- Commits: Use Conventional Commits (e.g., `feat:`, `fix:`, `docs:`, `test:`, `chore:`). Keep messages imperative and scoped.
4041
- PRs: include a clear description, linked issues, repro steps, and tests. Update docs (`README.md`, `ARCHITECTURE.md`, or `DEVELOPMENT.md`) when behavior changes.
41-
- Pre-flight: run `make format`, `make check`, and `make test`. Attach screenshots or terminal recordings for UX-visible changes (diff flows, terminal behavior).
42+
- Pre-flight: run `mise run all` (format, lint, test). Attach screenshots or terminal recordings for UX-visible changes (diff flows, terminal behavior).
4243

4344
## Security & Configuration Tips
4445

0 commit comments

Comments
 (0)