Remove workarounds for copilot skills (#182353)

This commit is contained in:
Abílio Costa
2026-09-16 07:10:09 +02:00
committed by GitHub
parent 5fd990135b
commit 4e2e79a4ad
4 changed files with 4 additions and 104 deletions
+2 -52
View File
@@ -1,8 +1,5 @@
#!/usr/bin/env python3
"""Generate .github/copilot-instructions.md from AGENTS.md and skills.
Necessary until copilot can handle skills.
"""
"""Generate .github/copilot-instructions.md from AGENTS.md and the PR template."""
from pathlib import Path
import sys
@@ -13,10 +10,6 @@ GENERATED_MESSAGE = (
AGENTS_FILE = Path("AGENTS.md")
OUTPUT_FILE = Path(".github/copilot-instructions.md")
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 = """
@@ -24,6 +17,7 @@ COPILOT_SPECIFIC_INSTRUCTIONS = """
- Start review comments with a short, one-sentence summary of the suggested fix.
- Do not comment on code style, formatting or linting issues.
- When reviewing changes under `homeassistant/components/` or `tests/components/`, use the `ha-integration-knowledge` skill as the primary reference.
- 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 PR template included below. Every section and checklist item from the template must be present, except the `## Breaking change` section which is optional. No content from the template should be missing, except for HTML comments and Markdown link reference definitions (lines of the form `[name]: url`), which do not render and cannot be verified from the description. Even unchecked checkboxes or empty sections must be present. This is a hard requirement.
@@ -37,41 +31,6 @@ The PR description must follow this template (from `.github/PULL_REQUEST_TEMPLAT
```
"""
INTEGRATION_PATH_SPECIFIC_INSTRUCTIONS = """---
applyTo: "homeassistant/components/**, tests/components/**"
excludeAgent: "cloud-agent"
---
"""
def _strip_frontmatter(text: str) -> str:
"""Strip YAML frontmatter from the start of a markdown document."""
if not text.startswith("---\n"):
return text
end = text.find("\n---\n", 4)
if end == -1:
return text
return text[end + len("\n---\n") :].lstrip("\n")
def generate_integration_path_specific_instructions() -> str:
"""Generate instructions for integration paths."""
if not INTEGRATION_SKILL_FILE.exists():
print(f"Error: {INTEGRATION_SKILL_FILE} not found")
sys.exit(1)
skill_content = _strip_frontmatter(INTEGRATION_SKILL_FILE.read_text())
return (
INTEGRATION_PATH_SPECIFIC_INSTRUCTIONS
+ "\n"
+ GENERATED_MESSAGE
+ "\n"
+ skill_content
)
def generate_output() -> str:
"""Generate the copilot-instructions.md content."""
@@ -119,22 +78,13 @@ def main(validate: bool = False) -> int:
return 1
main_content = generate_output()
integration_path_specific_content = (
generate_integration_path_specific_instructions()
)
if validate:
check_file(OUTPUT_FILE, main_content)
check_file(
INTEGRATION_PATH_SPECIFIC_OUTPUT_FILE, integration_path_specific_content
)
return 0
OUTPUT_FILE.write_text(main_content)
print(f"Generated {OUTPUT_FILE}")
INTEGRATION_PATH_SPECIFIC_OUTPUT_FILE.write_text(integration_path_specific_content)
print(f"Generated {INTEGRATION_PATH_SPECIFIC_OUTPUT_FILE}")
return 0