diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 9ff3b98b8..e9fd39bf8 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -91,5 +91,35 @@ All tracking files use markdown format with frontmatter and follow patterns from * Scripts follow instructions provided by the codebase for convention and standards. * Scripts used by the codebase have an `npm run` script for ease of use. -PowerShell scripts follow PSScriptAnalyzer rules from `PSScriptAnalyzer.psd1` and include proper comment-based help. Validation runs via `npm run psscriptanalyzer` with results output to `logs/`. +PowerShell scripts follow PSScriptAnalyzer rules from `PSScriptAnalyzer.psd1` and include proper comment-based help. Validation runs via `npm run lint:ps` with results output to `logs/`. + + +## Coding Agent Environment + +Copilot Coding Agent uses a cloud-based GitHub Actions environment, separate from the local devcontainer. The `.github/workflows/copilot-setup-steps.yml` workflow pre-installs tools to match devcontainer capabilities. + +### Pre-installed Tools + +* Node.js 20 with npm dependencies from `package.json` +* Python 3.11 +* PowerShell 7 with Pester 5.7.1 and PowerShell-Yaml modules +* shellcheck for bash script validation (pre-installed on ubuntu-latest) + +### Using npm Scripts + +Agents should use npm scripts for all validation: + +* `npm run lint:md` - Markdown linting +* `npm run lint:ps` - PowerShell analysis +* `npm run lint:yaml` - YAML validation +* `npm run lint:frontmatter` - Frontmatter validation +* `npm run lint:all` - Run all linters +* `npm run test:ps` - PowerShell tests + +### Environment Synchronization + +The `copilot-setup-steps.yml` mirrors tools from `.devcontainer/scripts/on-create.sh` and `.devcontainer/scripts/post-create.sh`. When adding tools to the devcontainer, update the setup workflow to maintain parity. + + +🤖 Crafted with precision by ✨Copilot following brilliant human instruction, then carefully refined by our team of discerning human reviewers. diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 000000000..300d811ae --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,65 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: MIT +# +# copilot-setup-steps.yml +# Pre-install tools and dependencies for GitHub Copilot Coding Agent +# Reference: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment + +name: "Copilot Setup Steps" + +# Auto-run on push/PR to validate the setup workflow +on: + workflow_dispatch: + push: + paths: + - .github/workflows/copilot-setup-steps.yml + pull_request: + paths: + - .github/workflows/copilot-setup-steps.yml + +jobs: + # Job MUST be named 'copilot-setup-steps' to be recognized by Copilot + copilot-setup-steps: + runs-on: ubuntu-latest + + # Minimal permissions; Copilot receives its own token for operations + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2 + with: + persist-credentials: false + + - name: Set up Node.js + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 + with: + node-version: "20" + cache: "npm" + + - name: Install JavaScript dependencies + run: npm ci + + - name: Set up Python + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + with: + python-version: "3.11" + + - name: Install PowerShell modules + shell: pwsh + run: | + Install-Module -Name PowerShell-Yaml -Force -Scope CurrentUser + Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser + + - name: Verify tool availability + run: | + echo "=== Tool Versions ===" + node --version + npm --version + python3 --version + pwsh --version + shellcheck --version + echo "" + echo "=== npm Scripts Available ===" + npm run --list