|
| 1 | +# GitHub Copilot Instructions for Agent365-python |
| 2 | + |
| 3 | +## Code Review Rules |
| 4 | + |
| 5 | +### Rule 1: Check for "Kairo" Keyword |
| 6 | +- **Description**: Scan code for any occurrence of the keyword "Kairo" |
| 7 | +- **Action**: If "Kairo" is found in any code file: |
| 8 | + - Flag it for review |
| 9 | + - Suggest removal or replacement with appropriate terminology |
| 10 | + - Check if it's a legacy reference that needs to be updated |
| 11 | +- **Files to check**: All `.py` files in the repository |
| 12 | + |
| 13 | +### Rule 2: Verify Copyright Headers |
| 14 | +- **Description**: Ensure all Python files have proper Microsoft copyright headers |
| 15 | +- **Action**: If a `.py` file is missing a copyright header: |
| 16 | + - Add the Microsoft copyright header at the top of the file |
| 17 | + - The header should be placed before any imports or code |
| 18 | + - Maintain proper formatting and spacing |
| 19 | + |
| 20 | +#### Required Copyright Header Format |
| 21 | +```python |
| 22 | +# Copyright (c) Microsoft Corporation. |
| 23 | +# Licensed under the MIT License. |
| 24 | +``` |
| 25 | + |
| 26 | +### Implementation Guidelines |
| 27 | + |
| 28 | +#### When Reviewing Code: |
| 29 | +1. **Kairo Check**: |
| 30 | + - Search for case-insensitive matches of "Kairo" |
| 31 | + - Review context to determine if it's: |
| 32 | + - A variable name |
| 33 | + - A comment reference |
| 34 | + - An import statement |
| 35 | + - A string literal |
| 36 | + - Suggest appropriate alternatives based on the context |
| 37 | + |
| 38 | +2. **Header Check**: |
| 39 | + - Verify the first non-empty, non-shebang lines of Python files |
| 40 | + - If missing, prepend the copyright header |
| 41 | + - Ensure there's a blank line after the header before other content |
| 42 | + - Do not add headers to: |
| 43 | + - `__init__.py` files that are intentionally empty |
| 44 | + - Generated files (if marked as such) |
| 45 | + |
| 46 | +#### Example of Proper File Structure: |
| 47 | +```python |
| 48 | +# Copyright (c) Microsoft Corporation. |
| 49 | +# Licensed under the MIT License. |
| 50 | + |
| 51 | +"""Module docstring goes here.""" |
| 52 | + |
| 53 | +import os |
| 54 | +import sys |
| 55 | + |
| 56 | +# Rest of the code... |
| 57 | +``` |
| 58 | + |
| 59 | +### Auto-fix Behavior |
| 60 | +When Copilot detects violations: |
| 61 | +- **Kairo keyword**: Suggest inline replacement or flag for manual review |
| 62 | +- **Missing header**: Automatically suggest adding the copyright header |
| 63 | + |
| 64 | +### Exclusions |
| 65 | +- Test files in `tests/` directory may have relaxed header requirements (but headers are still recommended) |
| 66 | +- Third-party code or vendored dependencies should not be modified |
| 67 | +- Configuration files (`.toml`, `.json`, `.yaml`, `.md`) do not require Python copyright headers |
0 commit comments