Skip to content

Template-extractor #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 30, 2025
Merged

Template-extractor #50

merged 5 commits into from
Apr 30, 2025

Conversation

akshay-online
Copy link
Collaborator

This pull request introduces several changes to enhance the functionality of the ADOGenerator project. The updates include the addition of new interfaces and methods for project analysis and template management, improved logging and error handling, and enhancements to the user interface for project and organization selection. Below is a summary of the most important changes grouped by theme:

New Features and Interfaces:

  • Added IExtractorService interface with methods for project configuration, team and iteration counts, and artifact generation (src/ADOGenerator/IServices/IExtractorService.cs).
  • Extended ITemplateService with methods for project analysis, template existence checks, and artifact generation (src/ADOGenerator/IServices/ITemplateService.cs).
  • Introduced ExtractorAnalysis class to encapsulate analysis results, including team counts, iteration counts, and error messages (src/ADOGenerator/Models/ExtractorAnalysis.cs).

Enhancements to Template and Project Services:

  • Implemented TemplateService with methods for analyzing projects, checking template existence, and generating artifacts. Added logging for analysis results (src/ADOGenerator/Services/TemplateService.cs).
  • Updated ProjectService to include methods for retrieving and selecting projects, with added support for paginated and wrapped text in the console output (src/ADOGenerator/Services/ProjectService.cs).

Logging and Error Handling Improvements:

  • Added a new WarningId method in ServiceExtensions for logging warnings and updated AddMessage to display warnings in yellow (src/ADOGenerator/ServiceExtensions.cs). [1] [2]

User Interface Enhancements:

  • Improved the organization selection UI with a tabular format, proper alignment, and wrapping for long text (src/ADOGenerator/Services/AuthService.cs).
  • Enhanced project selection UI to display project names and IDs in a formatted table with wrapping for long text (src/ADOGenerator/Services/ProjectService.cs).

Code Simplification and Refactoring:

  • Replaced ReadFromJsonAsync with JsonConvert.DeserializeObject for deserializing work item details, improving compatibility (src/API/Extractor/GetWorkItemsCount.cs).
  • Removed unused Configuration.cs file from the project (src/ADOGenerator/ADOGenerator.csproj).

Priya-Solanki and others added 5 commits April 2, 2025 00:52
- Added `UpgradeLog.htm` to `.gitignore`.
- Updated `ADOGenerator.csproj` to include `ExtractedTemplate` folder and ensure files are copied to output.
- Modified `ITemplateService` to change `StartEnvironmentSetupProcess` to `GenerateTemplateArtifacts`, returning a tuple.
- Improved user interaction in `Program.cs` with JSON handling and better project creation logic.
- Refactored `ExtractorService` for improved path handling and directory creation.
- Enhanced `TemplateService` structure and error handling for project analysis and artifact generation.
- Overall improvements to functionality, maintainability, and user experience.
- Updated `ADOGenerator.csproj` to ensure `appsettings.json` is always copied to the output directory.
- Modified `IExtractorService` to remove several methods and add `extractedFolderName` parameter for improved file handling.
- Enhanced `GenerateTemplateArtifacts` in `ITemplateService` to return the location of the generated template.
- Restructured `Program.cs` for better user interaction and added color-coded console messages.
- Introduced new helper methods for file management and template updates.
- Updated `ExtractorService` and export methods to utilize the new folder structure.
- Improved error handling and user feedback in `TemplateService`.
- Overall, these changes streamline the generation and export of Azure DevOps templates and artifacts.
Refactored `IExtractorService` and `ITemplateService` to return `bool` for success/failure, added methods to check template existence. Improved user prompts and error handling in `Program.cs`, including better message formatting and clarity. Enhanced logging capabilities in `ServiceExtensions.cs`. Updated project selection output in `ProjectService.cs` for improved readability. Overall, these changes focus on enhancing user experience and error management throughout the application.
- Updated `.gitignore` to include `UpgradeLog.htm`.
- Removed `Models\Configuration.cs` from `ADOGenerator.csproj`.
- Introduced `IExtractorService` interface with methods for project configurations and exporting queries.
- Added `GetProjects` and `SelectProject` methods in `IProjectService` for project retrieval and selection.
- Enhanced `ITemplateService` with methods for project analysis and template existence checks.
- Created `ExtractorAnalysis` class to hold analysis results.
- Refactored `Program.cs` for improved user interaction and project management.
- Added logging and error handling methods in `ServiceExtensions.cs`.
- Improved organization selection prompts in `AuthService.cs`.
- Expanded `ExtractorService` with methods for handling project configurations and exporting various entities.
- Introduced a method in `Init.cs` to extract href links.
- Updated `ProjectService.cs` to retrieve project details based on account information.
- Refactored `TemplateService.cs` to include configuration and artifact generation methods.
- Changed `GetWorkItemsCount.cs` to use `JsonConvert` for work item fetching.
@akshay-online akshay-online marked this pull request as ready for review April 29, 2025 10:59
@akshay-online akshay-online requested a review from Copilot April 29, 2025 10:59
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the ADOGenerator project by introducing new service interfaces for template and project analysis, improving logging/warning messages, and upgrading the user interface for project and organization selection. Key changes include new methods in ITemplateService and IExtractorService, improved error and warning logging via ServiceExtensions, and refactored project selection UI with enhanced text wrapping and alignment.

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/API/Extractor/GetWorkItemsCount.cs Replaces ReadFromJsonAsync with JsonConvert for work item deserialization.
src/ADOGenerator/Services/TemplateService.cs Adds project analysis, template existence checking, and artifact generation with logging improvements.
src/ADOGenerator/Services/ProjectService.cs Introduces enhanced project retrieval and a formatted selection UI.
src/ADOGenerator/Services/AuthService.cs Improves organization selection UI with color and wrapping.
src/ADOGenerator/ServiceExtensions.cs Adds a WarningId extension and adjusts message color based on warning status.
src/ADOGenerator/Models/ExtractorAnalysis.cs Introduces a data model to encapsulate analysis results.
Interface files under IServices Define new service artifacts required for template and project analysis.
Files not reviewed (1)
  • src/ADOGenerator/ADOGenerator.csproj: Language not supported
Comments suppressed due to low confidence (1)

src/ADOGenerator/Services/TemplateService.cs:87

  • The method name 'GenerateTemplateArifacts' appears to be misspelled. Consider renaming it to 'GenerateTemplateArtifacts' for clarity and consistency.
string[] createdTemplate = extractorService.GenerateTemplateArifacts(model);

Projects projects = new Projects(config);
ProjectProperties.Properties load = projects.GetProjectProperties();
model.ProcessTemplate = load.value[4].value;
ExtractorService es = new ExtractorService(_config);
Copy link
Preview

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a redundant instantiation of ExtractorService here while the class already holds an instance via the 'extractorService' field. Consider reusing the existing instance to reduce unnecessary object creation.

Suggested change
ExtractorService es = new ExtractorService(_config);

Copilot uses AI. Check for mistakes.

@akshay-online
Copy link
Collaborator Author

Closes #37 #43 #47 #48

@gloridelmorales gloridelmorales self-requested a review April 30, 2025 13:39
@gloridelmorales gloridelmorales merged commit 85b1f0c into main Apr 30, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants