Skip to content

[codex] Enable docs generation through pre-commit#8

Merged
ewels merged 3 commits into
ewels:mainfrom
adamrtalbot:codex/add-pre-commit-hook
May 20, 2026
Merged

[codex] Enable docs generation through pre-commit#8
ewels merged 3 commits into
ewels:mainfrom
adamrtalbot:codex/add-pre-commit-hook

Conversation

@adamrtalbot
Copy link
Copy Markdown
Contributor

@adamrtalbot adamrtalbot commented May 14, 2026

Warning

Vibe coded slop before I go on holiday #noragrets

Summary

Adds a reusable .pre-commit-hooks.yaml entry so downstream Nextflow pipeline repositories can use this repo directly as a pre-commit hook to regenerate nf-docs output.

What changed

  • Added an nf-docs pre-commit hook manifest that runs nf-docs generate . --format html and disables filename passing.
  • Documented hook usage and argument overrides in the README and running docs.
  • Added tests for the hook manifest defaults and file trigger pattern.
  • Tightened a few dictionary annotations so ty check src/ passes cleanly.

Validation

  • pre-commit validate-manifest .pre-commit-hooks.yaml
  • pre-commit validate-config .pre-commit-config.yaml
  • pre-commit run --files README.md docs/running.md tests/test_pre_commit_hooks.py .pre-commit-hooks.yaml
  • pytest
  • ruff check src/ tests/
  • ruff format --check src/ tests/
  • ty check src/

Notes

The hook default assumes the consuming repository's pipeline lives at . and writes HTML docs to docs/. Repositories with a different layout can override args in their .pre-commit-config.yaml.

adamrtalbot and others added 3 commits May 14, 2026 15:40
Expose nf-docs as a reusable pre-commit hook so downstream Nextflow pipeline repositories can regenerate documentation before commits. The manifest runs the existing CLI against the repository root and leaves command customization to hook args, which keeps the hook small and aligned with the package entry point.

Constraint: pre-commit passes changed filenames by default, but nf-docs operates on a pipeline directory, so the hook disables filename passing.

Rejected: Add a second hook wrapper command | unnecessary API surface when nf-docs generate already supports the needed arguments.

Confidence: high

Scope-risk: narrow

Directive: Keep the hook manifest as a thin wrapper around nf-docs generate unless pre-commit users need behavior the CLI cannot express.

Tested: pre-commit validate-manifest .pre-commit-hooks.yaml

Tested: pre-commit validate-config .pre-commit-config.yaml

Tested: pre-commit run --files README.md docs/running.md tests/test_pre_commit_hooks.py .pre-commit-hooks.yaml

Tested: pytest

Tested: ruff check src/ tests/

Tested: ruff format --check src/ tests/

Tested: ty check src/

Not-tested: End-to-end hook execution inside an external Nextflow pipeline repository
@ewels ewels marked this pull request as ready for review May 20, 2026 10:09
Copy link
Copy Markdown
Owner

@ewels ewels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea!

Tested locally, works well. I updated the docs slightly to prefer Prek over pre-commit, but no other changes.

@ewels ewels merged commit 4280410 into ewels:main May 20, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants