chore: add OpenAI-powered prose check pre-commit hook#501
Open
chore: add OpenAI-powered prose check pre-commit hook#501
Conversation
Adds a pre-commit hook that reviews Markdown documentation for grammar and style issues using the OpenAI API. Features: - Configurable model, sensitivity level, and fail/warn mode - Rich terminal UI with spinner and diff-style output - Graceful handling when API key is missing (warns, doesn't block) - External prompt file for easy customization Configuration via .env.local (not committed): - OPENAI_API_KEY (required) - PROSE_CHECK_MODE: warn (default) or fail - PROSE_CHECK_MODEL: gpt-4o-mini (default) - PROSE_CHECK_SENSITIVITY: low, medium (default), or high
- PROSE_CHECK_ENABLED: disable hook entirely (default: true) - PROSE_CHECK_EXCLUDE: comma-separated paths to skip - npm scripts: prose:check (staged files), prose:check:all (all docs) - .env.prose-precommit.example template for contributors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a pre-commit hook that reviews Markdown documentation for grammar and style issues using the OpenAI API.
Features:
scripts/prose-review-instructions.md) for easy customizationConfiguration via
.env.local:Test plan
.env.local→ should warn and allow commit.env.localwith API key → should check staged.md/.mdxfileswarnmode allows commits with issuesfailmode blocks commits with issues