From f7d234f61f77a82cd651ec3453470345e7db179c Mon Sep 17 00:00:00 2001 From: Tomer Figenblat Date: Fri, 24 Jul 2026 11:17:28 -0400 Subject: [PATCH] feat: add codespell for markdown spell checking Add codespell as a spell checker for catching typos in skill files, flow files, and documentation. Includes pre-commit hook, Makefile target (validate-spelling), and CI workflow. Signed-off-by: Tomer Figenblat --- .codespell-ignore.txt | 3 +++ .codespellrc | 3 +++ .github/workflows/spell-check.yml | 16 ++++++++++++++++ .pre-commit-config.yaml | 6 ++++++ Makefile | 8 +++++++- pyproject.toml | 1 + uv.lock | 15 ++++++++++++++- 7 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 .codespell-ignore.txt create mode 100644 .codespellrc create mode 100644 .github/workflows/spell-check.yml diff --git a/.codespell-ignore.txt b/.codespell-ignore.txt new file mode 100644 index 0000000..e36b029 --- /dev/null +++ b/.codespell-ignore.txt @@ -0,0 +1,3 @@ +cna +pre-select +te diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..307addc --- /dev/null +++ b/.codespellrc @@ -0,0 +1,3 @@ +[codespell] +skip = .git,*.json,*.svg,*.png,.validate,dist,eval,.codespellrc +ignore-words = .codespell-ignore.txt diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml new file mode 100644 index 0000000..cccd9b0 --- /dev/null +++ b/.github/workflows/spell-check.yml @@ -0,0 +1,16 @@ +name: Spell Check + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + push: + branches: [main] + +jobs: + codespell: + if: github.event.pull_request.draft == false || github.event_name == 'push' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + + - uses: codespell-project/actions-codespell@406322ec52dd7b488e48c1c4b82e2a8b3a1bf630 # v2.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 960e06d..c550765 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,6 +8,12 @@ repos: # Uses gitleaks on PATH (install: brew install gitleaks, or run scripts/install-hooks.sh) - id: gitleaks-system + - repo: https://github.com/codespell-project/codespell + rev: v2.4.3 + hooks: + - id: codespell + args: [--config, .codespellrc] + - repo: local hooks: - id: make-validate diff --git a/Makefile b/Makefile index 6e23ed7..7c5f3f2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help install validate validate-structure validate-collection-schema validate-collection-compliance validate-skill-design validate-skill-design-changed validate-mcp-tools package clean check-uv +.PHONY: help install validate validate-structure validate-collection-schema validate-collection-compliance validate-skill-design validate-skill-design-changed validate-mcp-tools validate-spelling package clean check-uv help: @echo "agentic-plugins" @@ -12,6 +12,7 @@ help: @echo " validate-skill-design - Validate all skills (use PACK=rh-sre for a specific pack)" @echo " validate-skill-design-changed - Validate only changed skills (staged + unstaged, for local dev)" @echo " validate-mcp-tools - Validate allowed-tools against live MCP servers (requires podman)" + @echo " validate-spelling - Run codespell spell check on all files" @echo " package - Package skills into ZIPs (output: dist/)" @echo " clean - Remove generated files" @echo "" @@ -98,6 +99,11 @@ validate-mcp-tools: check-uv @uv run python scripts/validate_mcp_tools.py $(if $(PACK),$(PACK)) @echo "MCP tool validation complete!" +validate-spelling: check-uv + @echo "Running spell check with codespell..." + @uv run codespell + @echo "Spell check passed!" + package: check-uv @uv run python scripts/package_skills.py diff --git a/pyproject.toml b/pyproject.toml index d895bfa..5bcaafa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,5 +11,6 @@ dependencies = [ [dependency-groups] dev = [ + "codespell>=2.3.0", "pre-commit>=4.0.0", ] diff --git a/uv.lock b/uv.lock index 58bdb36..4472137 100644 --- a/uv.lock +++ b/uv.lock @@ -14,6 +14,7 @@ dependencies = [ [package.dev-dependencies] dev = [ + { name = "codespell" }, { name = "pre-commit" }, ] @@ -25,7 +26,10 @@ requires-dist = [ ] [package.metadata.requires-dev] -dev = [{ name = "pre-commit", specifier = ">=4.0.0" }] +dev = [ + { name = "codespell", specifier = ">=2.3.0" }, + { name = "pre-commit", specifier = ">=4.0.0" }, +] [[package]] name = "attrs" @@ -45,6 +49,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/db/3c/33bac158f8ab7f89b2e59426d5fe2e4f63f7ed25df84c036890172b412b5/cfgv-3.5.0-py2.py3-none-any.whl", hash = "sha256:a8dc6b26ad22ff227d2634a65cb388215ce6cc96bbcc5cfde7641ae87e8dacc0", size = 7445, upload-time = "2025-11-19T20:55:50.744Z" }, ] +[[package]] +name = "codespell" +version = "2.4.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/80/19/45e941380f69c042b43423513d201e6592346f992394347f5e7174c31407/codespell-2.4.3.tar.gz", hash = "sha256:cbe085e331227b37bb86ef8bddd08dc768c704ee9a07ca869852c093fa2793e2", size = 352773, upload-time = "2026-07-15T11:51:54.159Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/8b/bf/bdb951d34eb169140b546f44be9ec4525d1acefb9eb5572071f5492b19fc/codespell-2.4.3-py3-none-any.whl", hash = "sha256:af2505b335e8573dbd2d384d1c4ef498f4006f4ba2d6fceca01e55b91f52628a", size = 340736, upload-time = "2026-07-15T11:51:52.925Z" }, +] + [[package]] name = "distlib" version = "0.4.3"