diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 3be73a02a55b..771dd3d070fc 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -8,7 +8,131 @@ - Do not comment on code style, formatting or linting issues. - Flag comments that over-explain straightforward code, narrate the obvious, or read like AI commentary (multi-sentence justifications for a single line). - A Pull Request with a dependency version bump should only contain changes required for the version bump. If the PR includes other changes, request that they are removed from the PR. -- Check that the PR description is complete and filled in according to the template at `.github/PULL_REQUEST_TEMPLATE.md`. Every section and checklist item from the template must be present, except the `## Breaking change` section which is optional. Nothing from the template should be missing. Even unchecked checkboxes or empty sections must be present. This is an hard requirement. +- Check that the PR description is complete and filled in according to the PR template included below. Every section and checklist item from the template must be present, except the `## Breaking change` section which is optional. Nothing from the template should be missing. Even unchecked checkboxes or empty sections must be present. This is an hard requirement. + +## Pull Request template + +The PR description must follow this template (from `.github/PULL_REQUEST_TEMPLATE.md`): + +```markdown + +## Breaking change + + + +## Proposed change + + + +## Type of change + + +- [ ] Dependency upgrade +- [ ] Bugfix (non-breaking change which fixes an issue) +- [ ] New integration (thank you!) +- [ ] New feature (which adds functionality to an existing integration) +- [ ] Deprecation (breaking change to happen in the future) +- [ ] Breaking change (fix/feature causing existing functionality to break) +- [ ] Code quality improvements to existing code or addition of tests + +## Additional information + + +- This PR fixes or closes issue: fixes # +- This PR is related to issue: +- Link to documentation pull request: +- Link to developer documentation pull request: +- Link to frontend pull request: + +## Checklist + + +- [ ] I understand the code I am submitting and can explain how it works. +- [ ] The code change is tested and works locally. +- [ ] Local tests pass. **Your PR cannot be merged unless tests pass** +- [ ] There is no commented out code in this PR. +- [ ] I have followed the [development checklist][dev-checklist] +- [ ] I have followed the [perfect PR recommendations][perfect-pr] +- [ ] The code has been formatted using Ruff (`ruff format homeassistant tests`) +- [ ] Tests have been added to verify that the new code works. +- [ ] Any generated code has been carefully reviewed for correctness and compliance with project standards. + +If user exposed functionality or configuration variables are added/changed: + +- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository] + +If the code communicates with devices, web services, or third-party tools: + +- [ ] The [manifest file][manifest-docs] has all fields filled out correctly. + Updated and included derived files by running: `python3 -m script.hassfest`. +- [ ] New or updated dependencies have been added to `requirements_all.txt`. + Updated by running `python3 -m script.gen_requirements_all`. +- [ ] For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description. + + + +To help with the load of incoming pull requests: + +- [ ] I have reviewed two other [open pull requests][prs] in this repository. + +[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure + + +[dev-checklist]: https://developers.home-assistant.io/docs/development_checklist/ +[manifest-docs]: https://developers.home-assistant.io/docs/creating_integration_manifest/ +[quality-scale]: https://developers.home-assistant.io/docs/integration_quality_scale_index/ +[docs-repository]: https://github.com/home-assistant/home-assistant.io +[perfect-pr]: https://developers.home-assistant.io/docs/review-process/#creating-the-perfect-pr +``` # GitHub Copilot & Claude Code Instructions diff --git a/script/gen_copilot_instructions.py b/script/gen_copilot_instructions.py index d1e91cb3f993..ae25f35779a6 100755 --- a/script/gen_copilot_instructions.py +++ b/script/gen_copilot_instructions.py @@ -17,6 +17,7 @@ INTEGRATION_SKILL_FILE = Path(".claude/skills/ha-integration-knowledge/SKILL.md" INTEGRATION_PATH_SPECIFIC_OUTPUT_FILE = Path( ".github/instructions/integrations.instructions.md" ) +PR_TEMPLATE_FILE = Path(".github/PULL_REQUEST_TEMPLATE.md") COPILOT_SPECIFIC_INSTRUCTIONS = """ # Copilot code review instructions @@ -25,7 +26,15 @@ COPILOT_SPECIFIC_INSTRUCTIONS = """ - Do not comment on code style, formatting or linting issues. - Flag comments that over-explain straightforward code, narrate the obvious, or read like AI commentary (multi-sentence justifications for a single line). - A Pull Request with a dependency version bump should only contain changes required for the version bump. If the PR includes other changes, request that they are removed from the PR. -- Check that the PR description is complete and filled in according to the template at `.github/PULL_REQUEST_TEMPLATE.md`. Every section and checklist item from the template must be present, except the `## Breaking change` section which is optional. Nothing from the template should be missing. Even unchecked checkboxes or empty sections must be present. This is an hard requirement. +- Check that the PR description is complete and filled in according to the PR template included below. Every section and checklist item from the template must be present, except the `## Breaking change` section which is optional. Nothing from the template should be missing. Even unchecked checkboxes or empty sections must be present. This is an hard requirement. + +## Pull Request template + +The PR description must follow this template (from `.github/PULL_REQUEST_TEMPLATE.md`): + +```markdown +{pr_template} +``` """ INTEGRATION_PATH_SPECIFIC_INSTRUCTIONS = """--- @@ -70,7 +79,15 @@ def generate_output() -> str: print(f"Error: {AGENTS_FILE} not found") sys.exit(1) - output_parts: list[str] = [GENERATED_MESSAGE, COPILOT_SPECIFIC_INSTRUCTIONS] + if not PR_TEMPLATE_FILE.exists(): + print(f"Error: {PR_TEMPLATE_FILE} not found") + sys.exit(1) + + copilot_instructions = COPILOT_SPECIFIC_INSTRUCTIONS.replace( + "{pr_template}", PR_TEMPLATE_FILE.read_text().strip() + ) + + output_parts: list[str] = [GENERATED_MESSAGE, copilot_instructions] # Add AGENTS.md content agents_content = AGENTS_FILE.read_text()