-
Notifications
You must be signed in to change notification settings - Fork 0
refactoring to the Generate-ProductivityReport.ps1 script
#3
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
Conversation
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>
feat: Collapsible Workspace Guidance + docs sync + validator JSON guidance generation
Enhance license header script and update README
Resolved merge conflicts and integrated changes in Generate-ProductivityReport.ps1, improving interactive prompts, report generation, and output formatting. Added a new, more detailed New-RowObject implementation to Recursive-Directory-Analysis.ps1, supporting enhanced CSV export with Excel hyperlink formulas and reordered columns for better usability.
Resolved merge conflicts and integrated changes in Generate-ProductivityReport.ps1, improving interactive prompts, report generation, and output formatting. Added a new, more detailed New-RowObject implementation to Recursive-Directory-Analysis.ps1, supporting enhanced CSV export with Excel hyperlink formulas and reordered columns for better usability.
Merge pull request #3 from KCoderVA/main
There was a problem hiding this 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 pull request introduces significant improvements and refactoring to the Generate-ProductivityReport.ps1 script, focusing on enhancing the HTML report output, improving user interaction, and updating the summary and configuration display. The changes include a redesigned report layout with a new activity trend chart, more flexible user prompts, and improved KPI presentation.
- Redesigned HTML report output with new CSS layout, responsive components, and a canvas-based activity trend chart with dynamic period grouping
- Enhanced user interaction prompts to accept both numeric and named choices for better usability
- Improved configuration summary display and updated intro text for better clarity
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| copilot-instructions/tasks.json | Removed trailing space from command line arguments |
| copilot-instructions/Validate-WorkspaceSetup.ps1 | Updated condition to trigger guidance generator for both errors and warnings |
| copilot-instructions/Recursive-Directory-Analysis.ps1 | Added commented-out duplicate function definition |
| copilot-instructions/Generate-ProductivityReport.ps1 | Major refactoring with new HTML layout, enhanced user prompts, improved chart functionality, and git merge conflict markers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| <# | ||
| --------------------------------------------------------------------- | ||
| function New-RowObject { | ||
| param( | ||
| [string]$ItemType, | ||
| [System.IO.FileSystemInfo]$Item, | ||
| [Nullable[int64]]$SizeBytes, | ||
| [string]$Author, | ||
| [Nullable[int]]$Lines, | ||
| [Nullable[int64]]$Chars) | ||
| $ext = if (-not $Item.PSIsContainer) { ($Item.Extension.ToLowerInvariant()); } else { $null } | ||
| $attrs = Get-ItemAttributesBooleans -Item $Item | ||
| $created = try { $Item.CreationTime.ToString("yyyy-MM-ddTHH:mm:ss.fffK") } catch { '' } | ||
| $modified = try { $Item.LastWriteTime.ToString("yyyy-MM-ddTHH:mm:ss.fffK") } catch { '' } | ||
| $name = try { $Item.Name } catch { [System.IO.Path]::GetFileName($Item.FullName) } | ||
| $full = try { $Item.FullName } catch { $null } | ||
| $extVal = if ($ext) { $ext } else { '' } | ||
| $sizeVal = if ($null -ne $SizeBytes) { [string]$SizeBytes } else { '' } | ||
| $linesVal = if ($null -ne $Lines) { [string]$Lines } else { '' } | ||
| $charsVal = if ($null -ne $Chars) { [string]$Chars } else { '' } | ||
| # Build Excel HYPERLINK formula for the FullPath column | ||
| # Requirement: clicking opens the containing folder/location, not the item itself. | ||
| $fullForLink = if ($full) { $full } else { '' } | ||
| $containingFolder = try { | ||
| if ($Item.PSIsContainer) { | ||
| if ($Item.Parent) { $Item.Parent.FullName } else { $Item.FullName } | ||
| } else { | ||
| $Item.DirectoryName | ||
| } | ||
| } catch { $fullForLink } | ||
| if ([string]::IsNullOrWhiteSpace($containingFolder)) { $containingFolder = $fullForLink } | ||
| # Escape double quotes for CSV/formula safety (Excel uses doubled quotes inside formulas) | ||
| $dispText = $fullForLink -replace '"','""' | ||
| $targetPath = $containingFolder -replace '"','""' | ||
| $fullHyperlink = if ([string]::IsNullOrEmpty($fullForLink)) { '' } else { [string]::Format('=HYPERLINK("{0}","{1}")', $targetPath, $dispText) } | ||
| # Reordered columns: | ||
| # Far left: CreatedTime, LastModifiedTime, Author, IsReparsePoint, IsHidden, IsReadOnly, IsSystem, IsArchive | ||
| # Then FullPath (as hyperlink), Name, and remaining columns | ||
| $obj = [ordered]@{ | ||
| CreatedTime = $created | ||
| LastModifiedTime = $modified | ||
| Author = $Author | ||
| IsReparsePoint = [string](Test-ReparsePoint -Item $Item) | ||
| IsHidden = [string]$($attrs.IsHidden) | ||
| IsReadOnly = [string]$($attrs.IsReadOnly) | ||
| IsSystem = [string]$($attrs.IsSystem) | ||
| IsArchive = [string]$($attrs.IsArchive) | ||
| FullPath = $fullHyperlink | ||
| Name = $name | ||
| ItemType = $ItemType | ||
| Extension = $extVal | ||
| SizeBytes = $sizeVal | ||
| LinesOfText = $linesVal | ||
| CharacterCount = $charsVal | ||
| } | ||
| return [PSCustomObject]$obj | ||
| } | ||
| ---------------------------------------------------------------------- | ||
| #> |
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a large block of commented-out code that appears to be a duplicate of the existing New-RowObject function. This duplicated code should be removed to improve maintainability and avoid confusion.
Copilot uses AI. Check for mistakes.
| <<<<<<< Updated upstream | ||
| <<<<<<< Updated upstream | ||
| # Conditional console writer (suppressed when -Quiet) | ||
| function Write-Info { | ||
| param([string]$Text, [ConsoleColor]$Color = [ConsoleColor]::Gray) | ||
| if (-not $Quiet) { Write-Host $Text -ForegroundColor $Color } | ||
| } | ||
|
|
||
| ======= | ||
| >>>>>>> Stashed changes | ||
| ======= | ||
| >>>>>>> Stashed changes |
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git merge conflict markers are present in the code. These need to be resolved before merging.
| <<<<<<< Updated upstream | |
| <<<<<<< Updated upstream | |
| # Conditional console writer (suppressed when -Quiet) | |
| function Write-Info { | |
| param([string]$Text, [ConsoleColor]$Color = [ConsoleColor]::Gray) | |
| if (-not $Quiet) { Write-Host $Text -ForegroundColor $Color } | |
| } | |
| ======= | |
| >>>>>>> Stashed changes | |
| ======= | |
| >>>>>>> Stashed changes | |
| # Conditional console writer (suppressed when -Quiet) | |
| function Write-Info { | |
| param([string]$Text, [ConsoleColor]$Color = [ConsoleColor]::Gray) | |
| if (-not $Quiet) { Write-Host $Text -ForegroundColor $Color } | |
| } |
Copilot uses AI. Check for mistakes.
| <<<<<<< Updated upstream | ||
| <<<<<<< Updated upstream | ||
| Write-Host "" | ||
| Write-Host "What this tool does:" -ForegroundColor Cyan | ||
| Write-Host " Creates a decision-ready snapshot of development activity in this workspace for a selected period." -ForegroundColor Gray |
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git merge conflict markers are present in the code. These need to be resolved before merging.
Copilot uses AI. Check for mistakes.
| ======= | ||
| ======= | ||
| >>>>>>> Stashed changes | ||
| Write-Host ""; Write-Host "About this tool" -ForegroundColor Cyan | ||
| Write-Host "Purpose: Generate a concise productivity snapshot for a chosen time period." -ForegroundColor Gray | ||
| Write-Host "Scope: Analyzes Git activity in this workspace and parses productivity logs (if present)." -ForegroundColor Gray | ||
| Write-Host "Intended use: Management/status reporting and personal tracking—not precise timekeeping." -ForegroundColor Gray | ||
| Write-Host "Expected results: A report file (Markdown/HTML/JSON/CSV) with commit counts, code deltas, and an effort estimate." -ForegroundColor Gray | ||
| Write-Host "Notes: The report is a snapshot of the selected period (Daily/Weekly/Monthly/All time/Custom)." -ForegroundColor Gray | ||
| Write-Host " Use Custom for exact start/end dates. Opening the report is optional and can be automated." -ForegroundColor Gray | ||
| <<<<<<< Updated upstream | ||
| >>>>>>> Stashed changes | ||
| ======= | ||
| >>>>>>> Stashed changes |
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git merge conflict markers are present in the code. These need to be resolved before merging.
Copilot uses AI. Check for mistakes.
| Write-Progress -Id $progressId -Activity "Productivity Report" -Status "Analyzing workspace activity..." -PercentComplete 35 | ||
|
|
||
| # Select output format (interactive if not provided) | ||
| if (-not $PSBoundParameters.ContainsKey('OutputFormat')) { | ||
| $OutputFormat = Get-OutputFormatInteractive | ||
| } | ||
| Write-Host "Output Format: $OutputFormat" -ForegroundColor Yellow | ||
|
|
||
| Show-ConfigSummary -ReportType $ReportType -StartDate $StartDate -EndDate $EndDate -OutputFormat $OutputFormat -OpenAfterGeneration:$OpenAfterGeneration -IncludeDetailed:$IncludeDetailed | ||
|
|
||
| Write-Progress -Id $progressId -Activity "Productivity Report" -Status "Analyzing workspace activity..." -PercentComplete 35 | ||
|
|
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is duplicated code block that selects output format, shows configuration summary, and writes progress. This duplication should be removed to avoid redundant execution.
| Write-Progress -Id $progressId -Activity "Productivity Report" -Status "Analyzing workspace activity..." -PercentComplete 35 | |
| # Select output format (interactive if not provided) | |
| if (-not $PSBoundParameters.ContainsKey('OutputFormat')) { | |
| $OutputFormat = Get-OutputFormatInteractive | |
| } | |
| Write-Host "Output Format: $OutputFormat" -ForegroundColor Yellow | |
| Show-ConfigSummary -ReportType $ReportType -StartDate $StartDate -EndDate $EndDate -OutputFormat $OutputFormat -OpenAfterGeneration:$OpenAfterGeneration -IncludeDetailed:$IncludeDetailed | |
| Write-Progress -Id $progressId -Activity "Productivity Report" -Status "Analyzing workspace activity..." -PercentComplete 35 |
Copilot uses AI. Check for mistakes.
This pull request introduces significant improvements and refactoring to the
Generate-ProductivityReport.ps1script, focusing on enhancing the HTML report output, improving user interaction, and updating the summary and configuration display. The changes include a redesigned report layout with a new activity trend chart, more flexible user prompts, and improved KPI presentation. Some code was also cleaned up and reorganized for clarity.Report Output & Layout Enhancements
.container,.chart-card, and improved KPI cards. Added a canvas-based activity trend chart (commits per period) with dynamic resizing and period grouping (daily/weekly/monthly) for visualizing commit activity. (copilot-instructions/Generate-ProductivityReport.ps1, [1] [2] [3] [4] [5]copilot-instructions/Generate-ProductivityReport.ps1, copilot-instructions/Generate-ProductivityReport.ps1R1471-R1552)User Interaction Improvements
copilot-instructions/Generate-ProductivityReport.ps1, [1] [2]copilot-instructions/Generate-ProductivityReport.ps1, [1] [2]Configuration & Summary Display
copilot-instructions/Generate-ProductivityReport.ps1, [1] [2]Code Cleanup
copilot-instructions/Generate-ProductivityReport.ps1, copilot-instructions/Generate-ProductivityReport.ps1L1)Overall, these changes make the productivity report more informative, visually engaging, and user-friendly.