How lanesket/painy works
Project type and purpose
• Painy is a standalone Python command-line tool for generating Git commit messages by leveraging the OpenAI API.
• It integrates with Git (including notebook diffing via nbdime), applies configurable rules, and optionally adapts to the style of past commits.
File structure
• Top level:
• setup.py, requirements.txt – packaging and dependencies
• README.md, LICENSE, .gitignore
• .github/workflows/python-publish.yml – CI/CD pipeline for publishing to PyPI
• “painy/” package:
• main.py – CLI entrypoint
• chat.py – OpenAI API client adapter
• git.py – Git interaction and diff extraction (including nbdime for .ipynb)
• comment.py & managers.py – core logic for “comment” and “commit” commands, rule application
• settings/ – configuration files (JSON prompts, extension lists, rule definitions)
• enums.py, utils.py – shared types and helper functions
• errors/ – custom exception hierarchy
README for additional insights
• Commands: “painy comment”, “painy commit”, “painy config”, “painy rules”
• Interactive (-i) mode, “--check-all” flag, style-history toggles
• Relies on OpenAI API key and optional model selection via env vars
Detail
• Where exceptions may be thrown (errors/*.py)
• Call out configuration file names (rules.json, prompt_comment_base.txt, etc.)
• Optional branches for interactive mode and history-style prompts