/
/
/
# What does this implement/fix? Committing from a git worktree failed on every lint hook. The hooks shell out to `uv run`, and in a worktree there is no virtualenv, so uv quietly builds a fresh one holding only the base dependencies — the linters live in the `test` extra, which uv never syncs — and then dies with ``Failed to spawn: `ruff` ``. The only way around it was exporting the main checkout's `.venv/bin` onto `PATH` by hand before every commit. The hooks now go through `scripts/run-in-env.sh`, which points uv at the main checkout's environment when it detects a worktree. In a normal checkout it changes nothing — it execs plain `uv run` exactly as before. **Related issue (if applicable):** - n/a ## Types of changes - [ ] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [ ] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [x] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` Changes: - `scripts/run-in-env.sh` now resolves the main checkout via `git rev-parse --git-common-dir` and sets `UV_PROJECT_ENVIRONMENT` / `UV_NO_SYNC` when it runs from a worktree, then execs `uv run`. Syncing is off in that case so uv cannot resolve the shared environment against the worktree. (The script was dead code — nothing referenced it, and its old `--show-toplevel` lookup had the same worktree blind spot.) - Every hook entry in `.pre-commit-config.yaml` calls `scripts/run-in-env.sh` instead of `uv run` directly. - Side benefit: worktrees no longer collect a half-built `.venv` as a leftover of each failed commit. - Refreshed the now-stale `uv run codespell` quote in `.github/pr-review/standards.md`. CI is unaffected — it installs with `uv pip install --system`, so no worktree is involved and the wrapper takes the plain `uv run` path. ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.