You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pivot: split the 4,948-line module into Public/Private files and small functions #163
PowerShellUniversal.Component.Pivot.psm1 is one file of 4,948 lines with 66 functions and three products in it: the component (New-UDPivotReport), the template stores (lines about 721-1789) and a report engine without a browser (about 2683-4946, Invoke-UDPivotReport, Get-UDPivotSource, HTTP transport, a SQL helper).
The repository's rule (AGENTS.md, "How we build") is one exported function per file in Public/, helpers in Private/, the .psm1 only loading them, C# in .cs files.
To do:
Split the module into Public/ and Private/ files; the build (build/Copy-SharedCode.ps1 already writes Private/) packs them.
Break the long functions into steps: New-UDPivotReport (about 663 lines, 40+ parameters), Get-UDPivotSqlColumnDescription (about 426), Invoke-UDPivotReport (about 333), Invoke-UDPivotTemplateStore (about 230).
Move ReportWriterSource and HttpTransportSource out of here-strings into .cs files, or drop the C# path if a measurement shows it is not needed.
One error helper with error ids instead of about 74 bare throw strings.
Decide whether the report engine becomes its own module.
Not affected: behaviour. The Pester and browser tests must pass unchanged before and after.
The growth guards from #166 now track this module: Pivot.psm1 2,731 code lines in the baseline, New-UDPivotReport 267, Invoke-UDPivotTemplateStore 158, Invoke-UDPivotReport 150 (limits: file 300, function 100). The split must lower them with npm run growth -- --update.
Before the split: #165 (the bundle folder public/ collides with Public/ on macOS and Windows).
The module is split: Public/ (11 commands), Private/ (one helper per file), Private/Settings/ for the $Script: limits and state. The .psm1 only loads them.
The C# moved out of the here-strings into Private/ReportWriter.cs and Private/HttpTransport.cs.
New-UDPivotReport (267 → 95 code lines), Invoke-UDPivotTemplateStore (158 → 51) and Invoke-UDPivotReport (150 → 55) run their steps through helpers. Get-UDPivotSqlColumnDescription was already below the limit (54).
The growth baseline no longer lists the Pivot module.
Activity
docs(agents): judge the product as a whole; small files and functions (…
eizedev commentedon Nov 22, 2026
The growth guards from #166 now track this module:
Pivot.psm12,731 code lines in the baseline,New-UDPivotReport267,Invoke-UDPivotTemplateStore158,Invoke-UDPivotReport150 (limits: file 300, function 100). The split must lower them withnpm run growth -- --update.Before the split: #165 (the bundle folder
public/collides withPublic/on macOS and Windows).build: write the webpack bundle to dist/ instead of public/ (#167)
refactor(pivot): one function per file, and the three long functions …
eizedev commentedon Nov 22, 2026
Done in #171 (merged as 0f29450):
Public/(11 commands),Private/(one helper per file),Private/Settings/for the$Script:limits and state. The.psm1only loads them.Private/ReportWriter.csandPrivate/HttpTransport.cs.New-UDPivotReport(267 → 95 code lines),Invoke-UDPivotTemplateStore(158 → 51) andInvoke-UDPivotReport(150 → 55) run their steps through helpers.Get-UDPivotSqlColumnDescriptionwas already below the limit (54).Moved:
New-UDEChart: echarts: Public/Private files and a shorter New-UDEChart #169Still open here:
throwstrings.