Skip to content

Commit a3b0f7c

Browse files
authored
🧠 Generate Copilot Agent Instructions for Azure DevOps Migration Tools (#2742)
This PR creates comprehensive GitHub Copilot instructions to enhance code assistance by documenting the application structure and key components of the Azure DevOps Migration Tools. ## 📄 What's Added Created `.github/copilot-instructions.md` with detailed documentation of all executable assemblies and their architecture patterns. ## 🎯 Executable Assemblies Documented ### 1. MigrationTools.ConsoleCore - **Purpose:** Modern .NET 8.0 REST API-based migration tool (cross-platform) - **Assembly:** `devopsmigration` - **Pattern:** `MigrationToolHost.CreateDefaultBuilder()` → `RunConsoleAsync()` - **Focus:** Lightweight, REST-only migrations ### 2. MigrationTools.ConsoleFull - **Purpose:** Full-featured .NET Framework 4.7.2 migration tool (Windows-specific) - **Assembly:** `devopsmigration` - **Pattern:** Dynamic assembly loading → `MigrationToolHost.CreateDefaultBuilder()` → `RunConsoleAsync()` - **Focus:** Complete TFS Object Model + REST API support ### 3. MigrationTools.ConsoleDataGenerator - **Purpose:** Documentation generation utility using reflection - **Pattern:** Standard `Main()` with assembly discovery and type reflection - **Focus:** Auto-generates YAML/Markdown documentation ### 4. MigrationTools.Telemetery - **Purpose:** Azure Functions v4 telemetry collection service - **Pattern:** `HostBuilder().ConfigureFunctionsWebApplication()` → `host.Run()` - **Focus:** Application Insights integration and monitoring ## 🏗️ Additional Context Provided - **MigrationToolHost** common infrastructure patterns - **V1 vs V2 Architecture** guidance (legacy TFS Object Model vs modern REST patterns) - **CLI Commands:** `execute`, `init`, `upgrade`, `builder` - **Configuration Templates:** Basic, Full, WorkItemTracking, Fullv2, WorkItemTrackingv2 - **Copilot-specific notes** for each component to improve code suggestions ## 🎁 Benefits for Copilot The documentation enables GitHub Copilot to: - Understand the dual-runtime architecture (.NET 8.0 vs .NET Framework 4.7.2) - Distinguish between REST API and TFS Object Model patterns - Provide context-aware suggestions based on the specific executable being worked on - Recommend appropriate patterns for v1 (legacy) vs v2 (modern) architectures Fixes #2741. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.
2 parents 718165a + e492673 commit a3b0f7c

File tree

1 file changed

+283
-0
lines changed

1 file changed

+283
-0
lines changed

.github/copilot-instructions.md

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
# Azure DevOps Migration Tools - Copilot Instructions
2+
3+
This document provides GitHub Copilot with information about the Azure DevOps Migration Tools application structure, executables, and key components to enable better code assistance.
4+
5+
## Overview
6+
7+
The Azure DevOps Migration Tools is a comprehensive solution for migrating work items, test cases, and other artifacts between Azure DevOps organizations and Team Foundation Server (TFS) instances. The solution consists of multiple executable assemblies, each serving different purposes and runtime environments.
8+
9+
## Executable Assemblies
10+
11+
### 1. MigrationTools.ConsoleCore
12+
13+
**Path:** `src/MigrationTools.ConsoleCore/Program.cs`
14+
15+
**Purpose:** Modern .NET 8.0 console application for Azure DevOps migrations using REST API clients only. This is the lightweight, cross-platform version of the migration tools.
16+
17+
**Starts With:** `MigrationToolHost.CreateDefaultBuilder(args)` followed by `hostBuilder.RunConsoleAsync()`
18+
19+
**Target Framework:** .NET 8.0
20+
21+
**Assembly Name:** `devopsmigration`
22+
23+
**Dependencies:**
24+
- `MigrationTools.Host` - Common hosting infrastructure
25+
- `MigrationTools.Clients.AzureDevops.Rest` - REST API client for Azure DevOps
26+
- OpenTelemetry packages for monitoring
27+
- Azure Monitor for telemetry export
28+
29+
**Key Features:**
30+
- REST API-based migrations only
31+
- Cross-platform compatibility
32+
- Minimal dependency footprint
33+
- Modern .NET runtime
34+
35+
**Environment Requirements:**
36+
- .NET 8.0 runtime
37+
- Network access to Azure DevOps REST APIs
38+
- Configuration file (typically `configuration-default.json`)
39+
40+
**Copilot Agent Notes:** This is the modern, REST-only version of the migration tool. When suggesting code changes, prefer REST API patterns and modern .NET 8.0 features. This executable doesn't include TFS Object Model capabilities.
41+
42+
---
43+
44+
### 2. MigrationTools.ConsoleFull
45+
46+
**Path:** `src/MigrationTools.ConsoleFull/Program.cs`
47+
48+
**Purpose:** Full-featured .NET Framework 4.7.2 console application that supports both legacy TFS Object Model and modern REST API migrations. This is the most comprehensive version of the migration tools.
49+
50+
**Starts With:** Assembly loading, activity tracking setup, then `MigrationToolHost.CreateDefaultBuilder(args)` followed by `hostBuilder.RunConsoleAsync()`
51+
52+
**Target Framework:** .NET Framework 4.7.2
53+
54+
**Assembly Name:** `devopsmigration`
55+
56+
**Dependencies:**
57+
- `MigrationTools.Host` - Common hosting infrastructure
58+
- `MigrationTools.Clients.TfsObjectModel` - Legacy TFS Object Model client
59+
- `MigrationTools.Clients.AzureDevops.Rest` - REST API client
60+
- `MigrationTools.Clients.FileSystem` - File system operations
61+
- `Microsoft.TeamFoundationServer.ExtendedClient` - TFS integration
62+
- OpenTelemetry packages for monitoring
63+
64+
**Key Features:**
65+
- Full TFS Object Model support
66+
- Dynamic assembly loading for client assemblies
67+
- Comprehensive migration capabilities
68+
- Activity tracking and telemetry
69+
70+
**Special Initialization:**
71+
```csharp
72+
// Dynamically loads client assemblies at startup
73+
string[] clientAssemblies = {
74+
"MigrationTools.Clients.TfsObjectModel.dll",
75+
"MigrationTools.Clients.FileSystem.dll",
76+
"MigrationTools.Clients.AzureDevops.Rest.dll"
77+
};
78+
```
79+
80+
**Environment Requirements:**
81+
- .NET Framework 4.7.2 runtime
82+
- Windows environment (due to TFS Object Model dependencies)
83+
- TFS/Azure DevOps connectivity
84+
- Various configuration files (`configuration-classic.json`, etc.)
85+
86+
**Copilot Agent Notes:** This is the full-featured version supporting both TFS Object Model and REST API patterns. When working with this application, TFS Object Model code requires Windows and specific TFS assemblies, while REST API code is cross-platform.
87+
88+
---
89+
90+
### 3. MigrationTools.ConsoleDataGenerator
91+
92+
**Path:** `src/MigrationTools.ConsoleDataGenerator/Program.cs`
93+
94+
**Purpose:** Development and documentation utility that generates YAML and Markdown files by reflecting over the migration tools' types and options. Used for auto-generating documentation.
95+
96+
**Starts With:** Standard `Main(string[] args)` with assembly loading and reflection
97+
98+
**Target Framework:** .NET 8.0
99+
100+
**Dependencies:**
101+
- All MigrationTools client assemblies for reflection
102+
- `Microsoft.Extensions.Options` for configuration binding
103+
- `YamlDotNet` for YAML serialization
104+
- `Microsoft.Extensions.Configuration` for configuration management
105+
106+
**Key Features:**
107+
- Assembly reflection to discover types
108+
- Automatic YAML data generation
109+
- Markdown documentation generation
110+
- Jekyll-compatible output format
111+
- Configuration type discovery
112+
113+
**Output Locations:**
114+
- YAML data: `../../../../../docs/_data/`
115+
- Markdown documentation: `../../../../../docs/Reference/Generated/`
116+
117+
**Type Discovery:**
118+
Discovers and documents:
119+
- `IProcessorOptions` implementations
120+
- `IToolOptions` implementations
121+
- `IFieldMapOptions` implementations
122+
- `IProcessorEnricherOptions` implementations
123+
- `IEndpointOptions` implementations
124+
- `IEndpointEnricherOptions` implementations
125+
126+
**Environment Requirements:**
127+
- .NET 8.0 runtime
128+
- Write access to documentation folders
129+
- `appsettings.json` configuration file
130+
131+
**Copilot Agent Notes:** This is a development utility for documentation generation. When modifying migration tool types, consider whether documentation regeneration is needed. The tool uses reflection extensively, so be aware of type discovery patterns when adding new options or implementations.
132+
133+
---
134+
135+
### 4. MigrationTools.Telemetery
136+
137+
**Path:** `src/MigrationTools.Telemetery/Program.cs`
138+
139+
**Purpose:** Azure Functions application for collecting and processing telemetry data from migration tool usage. Provides insights and monitoring capabilities.
140+
141+
**Starts With:** `HostBuilder().ConfigureFunctionsWebApplication()` pattern with `host.Run()`
142+
143+
**Target Framework:** .NET 8.0
144+
145+
**Runtime:** Azure Functions v4
146+
147+
**Dependencies:**
148+
- `Microsoft.Azure.Functions.Worker` - Azure Functions runtime
149+
- `Microsoft.Azure.Functions.Worker.Extensions.Http` - HTTP trigger support
150+
- `Microsoft.ApplicationInsights.WorkerService` - Application Insights integration
151+
- `OxyPlot` packages for chart generation
152+
- `System.Drawing.Common` for graphics operations
153+
154+
**Key Features:**
155+
- Azure Functions Worker model
156+
- Application Insights telemetry collection
157+
- HTTP trigger functions
158+
- Chart and visualization generation
159+
- ASP.NET Core integration
160+
161+
**Configuration Files:**
162+
- `host.json` - Azure Functions host configuration
163+
- `local.settings.json` - Local development settings
164+
165+
**Environment Requirements:**
166+
- Azure Functions runtime
167+
- Application Insights instance
168+
- Azure hosting environment or local Azure Functions Core Tools
169+
170+
**Copilot Agent Notes:** This is an Azure Functions application using the isolated worker model. When working with this code, use Azure Functions patterns and Application Insights telemetry practices. Consider scalability and stateless function design patterns.
171+
172+
---
173+
174+
## Common Infrastructure
175+
176+
### MigrationToolHost
177+
178+
**Location:** `src/MigrationTools.Host/MigrationToolHost.cs`
179+
180+
**Purpose:** Provides common hosting infrastructure for console applications, including configuration, logging, dependency injection, and CLI command setup.
181+
182+
**Key Services:**
183+
- Serilog logging with file and console outputs
184+
- Configuration from JSON files, environment variables, and command line
185+
- OpenTelemetry integration for monitoring
186+
- Spectre.Console for CLI interface
187+
- Dependency injection container setup
188+
189+
**CLI Commands:**
190+
- `execute` - Runs migration processors from configuration
191+
- `init` - Creates default configuration files or applies templates
192+
- `upgrade` - Upgrades configuration files to newer versions
193+
- `builder` - Interactive configuration file editor (hidden)
194+
195+
**Configuration Sources:**
196+
1. `appsettings.json` (base directory)
197+
2. Configuration file specified via `--config` parameter
198+
3. Environment variables
199+
4. Command line arguments
200+
201+
**Copilot Agent Notes:** The MigrationToolHost provides the foundation for all console applications. When adding new CLI commands or services, follow the established patterns using Spectre.Console and the dependency injection container. Configuration follows the standard .NET configuration hierarchy.
202+
203+
## Architecture Patterns
204+
205+
### TFS Object Model vs REST API
206+
207+
The migration tools support two primary approaches for connecting to Azure DevOps and TFS:
208+
209+
**TFS Object Model Approach:**
210+
- Based on legacy TFS Object Model patterns
211+
- Requires Windows environment and specific TFS assemblies
212+
- Available primarily in MigrationTools.ConsoleFull
213+
- Provides deep integration with TFS/Azure DevOps
214+
215+
**REST API Approach:**
216+
- Uses modern REST API clients
217+
- Cross-platform compatibility
218+
- Available in both console applications but primary in ConsoleCore
219+
- Configuration-driven endpoint and processor registration
220+
221+
### Configuration Templates
222+
Available templates for `init` command:
223+
- `Basic` - Simple migration setup
224+
- `WorkItemTracking` - Work item migration focus
225+
- `PipelineProcessor` - Pipeline migration setup
226+
- `Reference` - Complete feature set with all options
227+
228+
**Copilot Agent Notes:** When suggesting code modifications, consider whether TFS Object Model or REST API patterns are more appropriate. REST API patterns are preferred for new development and cross-platform scenarios, while TFS Object Model may be necessary for specific legacy TFS compatibility requirements.
229+
230+
## Documentation Synchronization Requirements
231+
232+
### Critical: Keep Documentation in Sync with Code Changes
233+
234+
When modifying any option classes or configuration-related classes, the documentation must be updated to reflect the current code state:
235+
236+
**Classes Requiring Documentation Updates:**
237+
- `IProcessorOptions` implementations (processors configuration)
238+
- `IToolOptions` implementations (tools configuration)
239+
- `IFieldMapOptions` implementations (field mapping configuration)
240+
- `IProcessorEnricherOptions` implementations (processor enrichers configuration)
241+
- `IEndpointOptions` implementations (endpoint configuration)
242+
- `IEndpointEnricherOptions` implementations (endpoint enrichers configuration)
243+
244+
**Required Steps When Editing These Classes:**
245+
246+
1. **Update XML Documentation Comments:** Ensure all public properties have accurate `<summary>` and `<default>` XML documentation comments that reflect current behavior and default values.
247+
248+
2. **Regenerate Documentation:** Run the `MigrationTools.ConsoleDataGenerator` to regenerate YAML data files and Markdown documentation:
249+
```bash
250+
cd src/MigrationTools.ConsoleDataGenerator
251+
dotnet run
252+
```
253+
254+
3. **Verify Configuration Samples:** Check that generated YAML files in `/docs/_data/` contain configuration samples that match the actual class properties:
255+
- Property names must match exactly
256+
- Default values must be current
257+
- All required properties must be present
258+
- Deprecated properties should be removed
259+
260+
4. **Validate Documentation Pages:** Ensure that any code samples in `/docs/Reference/` markdown files reflect the current class structure and property names.
261+
262+
5. **Cross-Reference Class Data:** Verify that the documentation accurately represents what is actually in the code by comparing:
263+
- Property types and names in the class vs. documentation
264+
- Default values in code vs. samples
265+
- Required vs. optional properties
266+
- XML comments vs. generated descriptions
267+
268+
**Documentation Generation Process:**
269+
The `ConsoleDataGenerator` uses reflection to discover types and generates:
270+
- YAML data files in `/docs/_data/` (e.g., `reference.processors.*.yaml`)
271+
- Markdown documentation in `/docs/Reference/Generated/`
272+
- Configuration samples that include all properties with their current default values
273+
274+
**Validation Checklist:**
275+
- [ ] XML documentation comments updated for all modified properties
276+
- [ ] ConsoleDataGenerator executed successfully
277+
- [ ] Generated YAML samples match actual class properties
278+
- [ ] Property types and default values are accurate in documentation
279+
- [ ] No orphaned or outdated property references in samples
280+
- [ ] Markdown documentation reflects current class capabilities
281+
282+
**Why This Matters:**
283+
Users rely on the generated documentation and configuration samples to understand how to configure the migration tools. Outdated documentation leads to configuration errors and user frustration. The reflection-based documentation generation ensures accuracy, but only when the source code contains current and complete XML documentation comments.

0 commit comments

Comments
 (0)