Add Copilot instructions and code-review agent guidance#2156
Add Copilot instructions and code-review agent guidance#2156
Conversation
There was a problem hiding this comment.
Pull request overview
Adds repository-level guidance for Copilot and a dedicated AL-Go code review agent document to help enforce AL-Go conventions—especially around settings/schema documentation and review focus areas.
Changes:
- Introduces
.github/copilot-instructions.mddescribing AL-Go conventions for PowerShell, workflows, testing, security, and documentation. - Adds
.github/.agents/code-review.agent.mddefining review focus areas and repository knowledge for a code-review agent.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
.github/copilot-instructions.md |
New Copilot guidance covering conventions, security patterns, testing, and documentation requirements. |
.github/.agents/code-review.agent.md |
New code-review agent guidance defining critical/important review checks and key repo references. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.github/copilot-instructions.md
Outdated
| - Use `Write-Host "::Warning::<message>"` for non-blocking warnings. | ||
|
|
||
| ### JSON Processing | ||
| - Always use `ConvertTo-HashTable -recurse` after `ConvertFrom-Json` to ensure case-insensitive access. |
There was a problem hiding this comment.
ConvertTo-HashTable -recurse doesn’t affect case-insensitive access; PowerShell hashtables and property access are already case-insensitive. In this repo, -recurse specifically controls whether nested objects/arrays are converted (see ConvertTo-HashTable in Actions/AL-Go-Helper.ps1). Suggest rewording this bullet to describe the actual benefit (deep conversion for nested settings) to avoid misleading guidance.
| - Always use `ConvertTo-HashTable -recurse` after `ConvertFrom-Json` to ensure case-insensitive access. | |
| - Always use `ConvertTo-HashTable -recurse` after `ConvertFrom-Json` to ensure nested objects and arrays are converted to hashtables for consistent access. |
aholstrup1
left a comment
There was a problem hiding this comment.
Probably something we should've added a while ago. Thanks for adding it! 👍
.github/.agents/code-review.agent.md
Outdated
| ### Important (Should Flag) | ||
| 1. **Missing tests**: New or modified functions should have corresponding Pester tests in `Tests/` | ||
| 2. **Cross-platform issues**: Hardcoded path separators, PS5-only or PS7-only constructs | ||
| 3. **Encoding omissions**: File read/write without explicit `-Encoding UTF8` | ||
| 4. **YAML permissions**: Workflows without minimal permission declarations | ||
| 5. **Missing RELEASENOTES update**: User-facing changes without a release note entry | ||
| 6. **Missing documentation for new settings**: New or changed AL-Go settings must be documented in `Scenarios/settings.md` (including purpose, type, default/required status, and which templates/workflows honor them) and represented in the settings schema (`Actions/.Modules/settings.schema.json`) with matching descriptions and correct metadata (`type`, `enum`, `default`, `required`). | ||
| 7. **Missing documentation for new functions**: New public functions (exported from modules or used as entry points) should include comment-based help (e.g., `.SYNOPSIS`, `.DESCRIPTION`, parameter help) and be described in relevant markdown documentation when they are part of the public surface. | ||
| 8. **Missing documentation for new workflows or user-facing behaviors**: New or significantly changed workflows/templates in `Templates/` must have corresponding scenario documentation (or updates) in `Scenarios/`, and new user-facing commands or actions must be documented in scenarios or `README.md`. |
There was a problem hiding this comment.
Nitpick: Consider if we should separate the different code review rules into separate files like we do internally e.g. a Style.md, Security.md etc. Might make it easier to keep track of the different rules in the long run.
There was a problem hiding this comment.
@copilot please address #2156 (comment)
Also, can you move this file under .github/agents instead?
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ithub/agents/ (#2160) Addresses feedback from #2156 to split the monolithic code-review agent file and relocate it from `.github/.agents/` to `.github/agents/`. ### Changes - **Moved** `.github/.agents/code-review.agent.md` → `.github/agents/code-review.agent.md` - **Split** rules into three focused files: - `Security.md` — Critical rules: error handling header, secret leakage, path traversal, `ConvertTo-HashTable -recurse`, deprecated settings - `Style.md` — Style/quality rules: tests, cross-platform, encoding, YAML permissions, naming conventions - `Documentation.md` — Documentation rules: RELEASENOTES, settings docs, function docs, workflow/scenario docs - Main `code-review.agent.md` now serves as the entry point, referencing the three rule files while retaining the expertise, how-to-review, and repository knowledge sections ### ✅ Checklist - [ ] Add tests (E2E, unit tests) - [ ] Update RELEASENOTES.md - [ ] Update documentation (e.g. for new settings or scenarios) - [ ] Add telemetry <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/AL-Go/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Add repository-level Copilot instructions and tighten the AL-Go code-review agent to enforce documentation for settings, schema, and public functions.