Skip to content

Fix capitalize-comments hook entry point, add AGENTS.md - #30

Merged
glenn-jocher merged 1 commit into
mainfrom
standardize-agents-md
Aug 2, 2026
Merged

Fix capitalize-comments hook entry point, add AGENTS.md#30
glenn-jocher merged 1 commit into
mainfrom
standardize-agents-md

Conversation

@glenn-jocher

@glenn-jocher glenn-jocher commented Aug 2, 2026

Copy link
Copy Markdown
Member

The capitalize-comments hook did not run for any consumer. Reproduced against a scratch repository before and after the fix.

Before:

Capitalize standalone inline comments....................................Failed
- hook id: capitalize-comments
- exit code: 1
Executable `capitalize_comments.py` not found

After:

Capitalize standalone inline comments....................................Failed
- hook id: capitalize-comments
- files were modified by this hook

(the second result is the expected outcome for a formatting hook that rewrote a file — the comments were correctly capitalized)

Cause: language: python resolves entry as a command on PATH inside the environment pre-commit builds, but pyproject.toml declared no [project.scripts], so nothing named capitalize_comments.py was ever installed.

Changes:

  • capitalize_comments.py: move the __main__ body into a main() entry point and hoist the sys import.
  • pyproject.toml: declare the capitalize-comments console script.
  • .pre-commit-hooks.yaml: point entry at that console script. The hook id is unchanged, so existing .pre-commit-config.yaml files keep working untouched.
  • README.md: the "Adding New Hooks" instructions and example still described the filename-as-entry pattern that does not work — updated to the console-script pattern.
  • Add AGENTS.md with the standard Ultralytics Core Principles and PR Workflow, plus repo-specific Commands, Architecture, and Conventions. CLAUDE.md is a symlink to it.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

🔧 Fixes the capitalize-comments pre-commit hook entry point and improves repository guidance for contributors and AI coding agents.

📊 Key Changes

  • ✅ Registers capitalize-comments as a console script in pyproject.toml.
  • 🔄 Updates .pre-commit-hooks.yaml to invoke the console command instead of the Python filename.
  • 🐍 Refactors capitalize_comments.py to expose a reusable main() function.
  • 📚 Adds AGENTS.md with repository architecture, contribution workflow, validation steps, and coding principles.
  • 🔗 Adds CLAUDE.md as a symlink to AGENTS.md.
  • ✍️ Updates the README with the correct hook registration and console-script configuration process.

🎯 Purpose & Impact

  • 🚀 Makes the hook compatible with language: python pre-commit environments, preventing runtime “executable not found” failures.
  • 🧩 Establishes a clear, reusable pattern for adding future hooks.
  • 🤖 Helps human contributors and AI coding agents work consistently within the repository’s conventions.
  • 📖 Improves documentation accuracy without changing the comment-capitalization behavior itself.

@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working documentation Improvements or additions to documentation fixed Bug has been resolved labels Aug 2, 2026
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @glenn-jocher, thank you for submitting a ultralytics/pre-commit 🚀 PR! To ensure a seamless integration of your work, please review the following checklist:

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/pre-commit main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. This is an automated message, and an engineer will assist with any questions. Thank you for contributing to Ultralytics! 🚀

@UltralyticsAssistant UltralyticsAssistant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Clean PR. The console-script entry point, hook configuration, and main() refactor are consistent, and the accompanying documentation accurately describes the required packaging flow.

@glenn-jocher
glenn-jocher merged commit 518ddb9 into main Aug 2, 2026
5 checks passed
@glenn-jocher
glenn-jocher deleted the standardize-agents-md branch August 2, 2026 18:09
@UltralyticsAssistant

Copy link
Copy Markdown
Member

🎉 Thank you and congratulations on the successful merge, @glenn-jocher!

“The secret of getting ahead is getting started.” — Mark Twain

This PR turns that spirit into practical improvements: a reliable capitalize-comments hook, clearer contributor guidance, and reusable conventions for future hooks and AI coding agents. Your careful work strengthens the repository’s foundation and makes it easier for everyone to contribute with confidence. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation fixed Bug has been resolved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants