Skip to content

Commit d94bb52

Browse files
committed
chore: merge upstream changes (mise, CSPRNG auth, diff fixes)
Key upstream changes integrated: - Replace Nix flake dev env with mise (mise.toml, treefmt.toml) - CSPRNG-based auth token generation with restricted lock-file perms - Auto-close orphaned diffs on client disconnect (issue coder#248) - Fallback split when Claude terminal is the only window (issue coder#231) - Terminal paste fragmentation fix for Neovim <0.12.2 - Snacks explorer layout exclusion from editor window detection - Close connection on malformed WebSocket frames (issue coder#258) - ClaudeCodeCloseAllDiffs command; modernized model picker Conflict resolutions preserve our fork's additions: live-cursor config, unified.nvim diff provider, multi-tab singleton architecture, and tab-scoped diff/window operations.
2 parents 61046e2 + 8ec3212 commit d94bb52

77 files changed

Lines changed: 3909 additions & 594 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.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/claude.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release Notes
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release-notes:
13+
name: release-notes
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Validate release inputs
17+
env:
18+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
RELEASE_TAG: ${{ github.event.release.tag_name }}
21+
run: |
22+
set -euo pipefail
23+
24+
: "${ANTHROPIC_API_KEY:?ANTHROPIC_API_KEY secret is required}"
25+
: "${GITHUB_TOKEN:?GITHUB_TOKEN is required}"
26+
: "${RELEASE_TAG:?release tag is required}"
27+
28+
case "$RELEASE_TAG" in
29+
v*) ;;
30+
*)
31+
echo "release tag must start with 'v': $RELEASE_TAG" >&2
32+
exit 1
33+
;;
34+
esac
35+
36+
- name: Checkout
37+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
38+
with:
39+
fetch-depth: 0
40+
fetch-tags: true
41+
persist-credentials: false
42+
43+
# install_args installs only communique (pinned in mise.toml), not the
44+
# full dev toolchain. cache: false avoids zizmor's cache-poisoning finding
45+
# on this publish workflow (caching saves little on a release-only job).
46+
- name: Set up mise
47+
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
48+
with:
49+
install_args: communique
50+
cache: false
51+
52+
- name: Resolve previous release ref
53+
env:
54+
RELEASE_TAG: ${{ github.event.release.tag_name }}
55+
run: |
56+
set -euo pipefail
57+
58+
release_commit="$(git rev-parse --verify "${RELEASE_TAG}^{commit}")"
59+
: "${release_commit:?release commit is required}"
60+
61+
if previous_ref="$(git describe --tags --abbrev=0 --match 'v[0-9]*.[0-9]*.[0-9]*' --exclude '*-*' "${release_commit}^" 2>/dev/null)"; then
62+
echo "Previous release tag: $previous_ref"
63+
else
64+
previous_ref="$(git rev-list --max-parents=0 "$release_commit" | head -n 1)"
65+
: "${previous_ref:?previous release ref is required}"
66+
echo "No previous release tag found; using root commit: $previous_ref"
67+
fi
68+
69+
echo "PREVIOUS_RELEASE_REF=$previous_ref" >> "$GITHUB_ENV"
70+
71+
- name: Generate GitHub release notes
72+
env:
73+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
RELEASE_TAG: ${{ github.event.release.tag_name }}
76+
run: |
77+
set -euo pipefail
78+
79+
: "${PREVIOUS_RELEASE_REF:?previous release ref is required}"
80+
81+
communique generate "$RELEASE_TAG" "$PREVIOUS_RELEASE_REF" \
82+
--github-release --repo "${{ github.repository }}"

.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

0 commit comments

Comments
 (0)