Skip to content

fix(pre-commit): use stylua prebuilt-binary hook variant#203

Merged
laurigates merged 1 commit into
mainfrom
fix/issue-200
May 11, 2026
Merged

fix(pre-commit): use stylua prebuilt-binary hook variant#203
laurigates merged 1 commit into
mainfrom
fix/issue-200

Conversation

@laurigates
Copy link
Copy Markdown
Owner

Summary

  • Switch the stylua pre-commit hook from id: stylua (language: rust, builds from source via cargo install) to id: stylua-github (downloads a prebuilt release binary from the upstream repo).
  • Unblocks commits on minimal Linux hosts without a system C linker, while leaving macOS and standard CI runners unaffected.

Why

The default upstream hook tries to cargo install stylua on first use. That requires cc, which isn't present on minimal Linux hosts where apt is disabled (notably TrueNAS appliances). Result: every commit fails on those hosts — even commits that don't touch any Lua files — because pre-commit installs hook envs eagerly. Workaround in use until now was SKIP=stylua git commit … per commit (see #199).

The upstream repo ships three variants at v2.1.0:

id language works without cc?
stylua rust ❌ (current)
stylua-system system ✅, but needs stylua on $PATH
stylua-github python ✅, downloads release binary

stylua-github keeps the workflow uniform across machines without requiring a per-host stylua install, matching the preference in #200.

Test plan

  • On TrueNAS host (no cc): pre-commit clean && pre-commit run --all-filesStyLua (Github) ... Passed
  • Conventional-commit hook passes against the commit message
  • CI smoke (ubuntu-latest) passes on PR

Fixes #200

🤖 Generated with Claude Code

The default `stylua` hook (language: rust) installs stylua via
`cargo install`, which requires a working C linker (`cc`). On
minimal Linux hosts without a system toolchain (notably TrueNAS
appliances where apt is disabled), env install fails with
"linker `cc` not found" and blocks every commit — even commits
that don't touch Lua — because pre-commit installs hook envs
eagerly on first use.

Switch to `stylua-github`, the upstream-provided variant that
downloads a prebuilt release binary instead of building from
source. macOS and standard Linux runners are unaffected.

Verified on a TrueNAS host without `cc`: `pre-commit clean &&
pre-commit run --all-files` now passes end-to-end.

Fixes #200

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@laurigates laurigates added the enhancement New feature or request label May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Broken Links Detected

Summary

Status Count
🔍 Total 128
✅ Successful 122
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 5
❓ Unknown 0
🚫 Errors 1

Errors per input

Errors in exact_dot_claude/docs/prds/daily-catchup.PRD.md


Please fix the broken links before merging.

@laurigates laurigates merged commit ea76815 into main May 11, 2026
7 of 8 checks passed
@laurigates laurigates deleted the fix/issue-200 branch May 11, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace stylua pre-commit hook with prebuilt-binary install

1 participant