Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Enable pre-commit on Windows CI (#164)

Maximilian Roos1c6e885c20d1
diff --git a/.config/wt.toml b/.config/wt.toml
index d891f0d48..05549b597 100644
--- a/.config/wt.toml
+++ b/.config/wt.toml
@@ -35,8 +35,8 @@ sync = 'if [ "{{ target }}" = "main" ]; then git pull && git push; fi'
# Note: This must come AFTER post-merge because [pre-merge] starts
# a TOML table section, and everything after it would be inside that section
[pre-merge]
-# Skip if pre-commit not installed (Windows CI) - lint job handles this on Ubuntu
-pre-commit = "if which pre-commit > /dev/null 2>&1; then pre-commit run --all-files; fi"
+# Skip lychee on Windows (MSYSTEM is set in Git Bash/MSYS2 environments)
+pre-commit = "if [ -n \"$MSYSTEM\" ]; then SKIP=lychee-system pre-commit run --all-files; else pre-commit run --all-files; fi"
insta = "RUSTFLAGS='-D warnings' NEXTEST_STATUS_LEVEL=fail NEXTEST_SUCCESS_OUTPUT=never cargo insta test --dnd --check --features shell-integration-tests"
doctest = "RUSTDOCFLAGS='-Dwarnings' cargo test --doc"
doc = "RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps"
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index f5313e534..b62d9cae4 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -68,15 +68,18 @@ jobs:
echo "Using Git Bash for Windows tests"
shell: pwsh
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
+
- name: Install pre-commit
+ run: uv tool install pre-commit
+
+ # lychee-system hook requires lychee binary; skip on Windows via SKIP env var in wt.toml
+ - name: Install lychee
if: runner.os != 'Windows'
- run: |
- if command -v uv &> /dev/null; then
- uv tool install pre-commit
- else
- pip install pre-commit
- fi
- shell: bash
+ uses: baptiste0928/cargo-install@v3
+ with:
+ crate: lychee
# On Linux/macOS: Install from crates.io (pre-merge hooks run against published version)
# On Windows: Build from source (published version may not have Git Bash detection fixes)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 12926851b..09d0fc042 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -30,9 +30,8 @@ repos:
rev: lychee-v0.22.0
hooks:
# PR mode - check links using .config/lychee.toml exclusions
- # TODO: Consider re-adding `--include=^https://(github\.com/max-sixty/worktrunk|worktrunk\.dev)`
- # once /hook/ page is deployed (currently excluded in lychee.toml to allow landing page merge)
- - id: lychee
+ # Uses lychee-system (requires `cargo install lychee`) to avoid /bin/bash dependency on Windows
+ - id: lychee-system
name: lychee (PR mode)
types: [markdown]
args:
@@ -42,7 +41,7 @@ repos:
- -q
# Comprehensive mode - check all links with full config
# Run manually: pre-commit run --hook-stage manual lychee-all --all-files
- - id: lychee
+ - id: lychee-system
name: lychee-all (comprehensive)
types: [markdown]
stages: [manual]
@@ -75,6 +74,6 @@ repos:
ci:
# pre-commit.ci doesn't have Rust toolchain, so skip Rust-specific hooks.
- # Network access also isn't supported, so skip lychee.
- skip: [fmt, clippy, lychee, cargo-lock]
+ # Network access also isn't supported, so skip lychee-system.
+ skip: [fmt, clippy, lychee-system, cargo-lock]
autoupdate_commit_msg: "chore: pre-commit autoupdate"