|
| 1 | +# Prompt Files |
| 2 | + |
| 3 | +APIOps provides [prompt files](https://code.visualstudio.com/docs/copilot/copilot-customization#_reusable-prompt-files-experimental) that guide GitHub Copilot through common APIOps configuration tasks. These are reusable `.prompt.md` files that give Copilot the context it needs to help you configure extraction filters, environment overrides, and CI/CD identity setup. |
| 4 | + |
| 5 | +## What are prompt files? |
| 6 | + |
| 7 | +Prompt files are markdown files with a `.prompt.md` extension that provide instructions and context to GitHub Copilot. When you open a prompt file in VS Code and invoke Copilot, it uses the file's content as context to guide you through a task interactively. |
| 8 | + |
| 9 | +## Available prompt files |
| 10 | + |
| 11 | +| File | Description | |
| 12 | +|------|-------------| |
| 13 | +| `apiops-configure-filter.prompt.md` | Guides Copilot through creating a `configuration.extractor.yaml` filter file to control which API Management resources are extracted. See also: [Filtering resources guide](./filtering-resources.md) | |
| 14 | +| `apiops-configure-overrides.prompt.md` | Guides Copilot through creating environment override files (`configuration.<env>.yaml`) for promoting APIs across environments. See also: [Environment overrides guide](./environment-overrides.md) | |
| 15 | +| `apiops-setup-workflow-identity-github-actions.prompt.md` | Walks through setting up Azure identity (app registration, federated credentials, RBAC) for GitHub Actions CI/CD pipelines. | |
| 16 | +| `apiops-setup-workflow-identity-azure-devops.prompt.md` | Walks through setting up Azure identity (app registration, federated credentials, RBAC) for Azure DevOps CI/CD pipelines. | |
| 17 | + |
| 18 | +## Getting prompt files |
| 19 | + |
| 20 | +### Via `apiops init` (recommended) |
| 21 | + |
| 22 | +The easiest way to get prompt files is to run [`apiops init`](../commands/init.md), which scaffolds your repository with prompt files already in place at `.github/prompts/`. |
| 23 | + |
| 24 | +### Download individually |
| 25 | + |
| 26 | +If you already have an APIOps repository and want to add prompt files without re-running init, you can download them directly from this repository. |
| 27 | + |
| 28 | +#### Bash |
| 29 | + |
| 30 | +```bash |
| 31 | +# Resolve repo root so this works from any subdirectory |
| 32 | +repo_root="$(git rev-parse --show-toplevel)" |
| 33 | + |
| 34 | +# Create the prompts directory |
| 35 | +mkdir -p "${repo_root}/.github/prompts" |
| 36 | + |
| 37 | +# Available prompt files — remove any you don't need |
| 38 | +files=( |
| 39 | + "apiops-configure-filter.prompt.md" |
| 40 | + "apiops-configure-overrides.prompt.md" |
| 41 | + # Remove the identity setup prompt that doesn't apply to your CI provider: |
| 42 | + "apiops-setup-workflow-identity-github-actions.prompt.md" |
| 43 | + "apiops-setup-workflow-identity-azure-devops.prompt.md" |
| 44 | +) |
| 45 | + |
| 46 | +base_url="https://raw.githubusercontent.com/Azure/apiops-cli/main/src/templates/copilot" |
| 47 | + |
| 48 | +for file in "${files[@]}"; do |
| 49 | + curl -sL "${base_url}/${file}" -o "${repo_root}/.github/prompts/${file}" |
| 50 | + echo "Downloaded ${file}" |
| 51 | +done |
| 52 | +``` |
| 53 | + |
| 54 | +#### PowerShell |
| 55 | + |
| 56 | +```powershell |
| 57 | +# Resolve repo root so this works from any subdirectory |
| 58 | +$repoRoot = git rev-parse --show-toplevel |
| 59 | +
|
| 60 | +# Create the prompts directory |
| 61 | +New-Item -ItemType Directory -Path "$repoRoot/.github/prompts" -Force | Out-Null |
| 62 | +
|
| 63 | +# Available prompt files — remove any you don't need |
| 64 | +$files = @( |
| 65 | + "apiops-configure-filter.prompt.md" |
| 66 | + "apiops-configure-overrides.prompt.md" |
| 67 | + # Remove the identity setup prompt that doesn't apply to your CI provider: |
| 68 | + "apiops-setup-workflow-identity-github-actions.prompt.md" |
| 69 | + "apiops-setup-workflow-identity-azure-devops.prompt.md" |
| 70 | +) |
| 71 | +
|
| 72 | +$baseUrl = "https://raw.githubusercontent.com/Azure/apiops-cli/main/src/templates/copilot" |
| 73 | +
|
| 74 | +foreach ($file in $files) { |
| 75 | + Invoke-WebRequest -Uri "$baseUrl/$file" -OutFile "$repoRoot/.github/prompts/$file" |
| 76 | + Write-Host "Downloaded $file" |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +## Further reading |
| 81 | + |
| 82 | +- [VS Code: Reusable prompt files](https://code.visualstudio.com/docs/copilot/copilot-customization#_reusable-prompt-files-experimental) |
| 83 | +- [GitHub Copilot in the CLI](https://docs.github.com/en/copilot/github-copilot-in-the-cli/using-github-copilot-in-the-cli) |
0 commit comments