Skip to content

Commit 591df1f

Browse files
committed
format + lint
2 parents 05a95f6 + 1489c70 commit 591df1f

File tree

11 files changed

+96
-14
lines changed

11 files changed

+96
-14
lines changed

.devcontainer/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM mcr.microsoft.com/devcontainers/base:ubuntu
2+
3+
# Install Nix
4+
RUN apt-get update && apt-get install -y \
5+
curl \
6+
xz-utils \
7+
sudo \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
# Create vscode user if it doesn't exist
11+
RUN if ! id -u vscode > /dev/null 2>&1; then \
12+
useradd -m -s /bin/bash vscode && \
13+
echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers; \
14+
fi
15+
16+
# Switch to vscode user for Nix installation
17+
USER vscode
18+
WORKDIR /home/vscode
19+
20+
# Install Nix in single-user mode
21+
RUN curl -L https://nixos.org/nix/install | sh -s -- --no-daemon
22+
23+
# Add Nix to PATH and configure for the shell
24+
RUN echo '. /home/vscode/.nix-profile/etc/profile.d/nix.sh' >> /home/vscode/.bashrc && \
25+
mkdir -p /home/vscode/.config/nix && \
26+
echo 'experimental-features = nix-command flakes' >> /home/vscode/.config/nix/nix.conf
27+
28+
# Keep container running
29+
CMD ["sleep", "infinity"]

.devcontainer/devcontainer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "claudecode.nvim Development",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"features": {
7+
"ghcr.io/devcontainers/features/git:1": {}
8+
},
9+
"customizations": {
10+
"vscode": {
11+
"settings": {
12+
"terminal.integrated.defaultProfile.linux": "bash"
13+
},
14+
"extensions": ["jnoortheen.nix-ide"]
15+
}
16+
},
17+
"postCreateCommand": "bash .devcontainer/post-create.sh",
18+
"remoteUser": "vscode"
19+
}

.devcontainer/post-create.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
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"
9+
exit 1
10+
fi
11+
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"
18+
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"
26+
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"

CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,13 @@ When updating the version number for a new release, you must update **ALL** of t
362362
```
363363

364364
2. **`scripts/claude_interactive.sh`** - Multiple client version references:
365+
365366
- Line ~52: `"version": "0.2.0"` (handshake)
366367
- Line ~223: `"version": "0.2.0"` (initialize)
367368
- Line ~309: `"version": "0.2.0"` (reconnect)
368369

369370
3. **`scripts/lib_claude.sh`** - ClaudeCodeNvim version:
371+
370372
- Line ~120: `"version": "0.2.0"` (init message)
371373

372374
4. **`CHANGELOG.md`** - Add new release section with:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ For deep technical details, see [ARCHITECTURE.md](./ARCHITECTURE.md).
260260
provider = "auto", -- "auto", "snacks", "native", "external", or custom provider table
261261
auto_close = true,
262262
snacks_win_opts = {}, -- Opts to pass to `Snacks.terminal.open()` - see Floating Window section below
263-
263+
264264
-- Provider-specific options
265265
provider_opts = {
266266
external_terminal_cmd = nil, -- Command template for external terminal provider (e.g., "alacritty -e %s")

lua/claudecode/config.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ M.defaults = {
2626
keep_terminal_focus = false, -- If true, moves focus back to terminal after diff opens
2727
},
2828
models = {
29-
{ name = "Claude Opus 4 (Latest)", value = "opus" },
29+
{ name = "Claude Opus 4.1 (Latest)", value = "opus" },
3030
{ name = "Claude Sonnet 4 (Latest)", value = "sonnet" },
31+
{ name = "Claude Haiku 3.5 (Latest)", value = "haiku" },
3132
},
3233
terminal = nil, -- Will be lazy-loaded to avoid circular dependency
3334
}

lua/claudecode/diff.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ local logger = require("claudecode.logger")
66

77
-- Global state management for active diffs
88

9-
local active_diffs = {}
10-
local autocmd_group
9+
---@type ClaudeCodeConfig
1110
local config
1211

12+
---@type number
13+
local autocmd_group
1314
---Get or create the autocmd group
1415
local function get_autocmd_group()
1516
if not autocmd_group then
@@ -112,7 +113,7 @@ local function is_buffer_dirty(file_path)
112113
end
113114

114115
---Setup the diff module
115-
---@param user_config table? The configuration passed from init.lua
116+
---@param user_config ClaudeCodeConfig? The configuration passed from init.lua
116117
function M.setup(user_config)
117118
-- Store the configuration for later use
118119
config = user_config or {}
@@ -336,6 +337,9 @@ function M._open_native_diff(old_file_path, new_file_path, new_file_contents, ta
336337
}
337338
end
338339

340+
---@type table<string, table>
341+
local active_diffs = {}
342+
339343
---Register diff state for tracking
340344
---@param tab_name string Unique identifier for the diff
341345
---@param diff_data table Diff state data
@@ -638,7 +642,7 @@ function M._create_diff_view_from_window(target_window, old_file_path, new_buffe
638642
if terminal_win then
639643
vim.api.nvim_set_current_win(terminal_win)
640644
end
641-
end, 0)
645+
end)
642646
end
643647

644648
-- Return window information for later storage

lua/claudecode/server/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ M.state = {
2525
}
2626

2727
---Initialize the WebSocket server
28-
---@param config table Configuration options
28+
---@param config ClaudeCodeConfig Configuration options
2929
---@param auth_token string|nil The authentication token for validating connections
3030
---@return boolean success Whether server started successfully
3131
---@return number|string port_or_error Port number or error message

lua/claudecode/server/tcp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function M.find_available_port(min_port, max_port)
4949
end
5050

5151
---Create and start a TCP server
52-
---@param config table Server configuration
52+
---@param config ClaudeCodeConfig Server configuration
5353
---@param callbacks table Callback functions
5454
---@param auth_token string|nil Authentication token for validating connections
5555
---@return TCPServer|nil server The server object, or nil on error

lua/claudecode/terminal.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ function M.setup(user_term_config, p_terminal_cmd, p_env)
321321
for k, v in pairs(user_term_config) do
322322
if k == "terminal_cmd" then
323323
-- terminal_cmd is handled above, skip
324+
break
324325
elseif k == "provider_opts" then
325326
-- Handle nested provider options
326327
if type(v) == "table" then

0 commit comments

Comments
 (0)