Phase 3: Graphviz coverage & PowerShell integration - #3
Merged
Conversation
Closes the feature gaps identified for Phase 3 of the modernization roadmap, now that the module builds cleanly on PS7 with real CI: - Export-PSGraph: add -PassThru to return rendered graph text (e.g. SVG) directly via the pipeline instead of writing a file, for notebook workflows (Jupyter/.NET Interactive). Ported from upstream PR KevinMarquette#105's intent with a safer explicit-switch design instead of the original's empty-string-DestinationPath sentinel. - New-NodeAttributeSet / New-EdgeAttributeSet: ported from PR KevinMarquette#105, fixing upstream bugs (.ToLower() called on non-string parameter types, a stray malformed array entry that silently dropped -Distortion). - Rank: add -RankType (issue KevinMarquette#101) for min/source/max/sink grouping, not just rank=same. - Row: add -Attributes for row-level HTML attributes (issue KevinMarquette#64, e.g. hiding a row's border), and fix Format-Value's record-port regex to recognize and quote GUID-style port names instead of silently swallowing them (issue KevinMarquette#65). - Install-GraphViz: add -Scope CurrentUser for non-admin installs, with a nuget.org fallback when Chocolatey registration fails (PR KevinMarquette#112). Also fixed $IsOSX (not a real PowerShell variable) to $IsMacOS, and added the -Scope CurrentUser install path to Export-PSGraph's default GraphVizPath search list. - PSGraph.psm1's dev-mode loader was exporting functions only, silently dropping every module alias (including the pre-existing 'digraph'); fixed so NodeAttributes/EdgeAttributes (and digraph) actually resolve after Import-Module, matching the manifest's AliasesToExport. Deliberately left out of this PR (see local_PSGraph/pull-requests/pr-105 and local_PSGraph/checklists/phase3-approved-verb-aliases.md): PR KevinMarquette#105's Cells.ps1/svg.ps1 wrapper and Edge/Node/Record convenience-parameter changes, and approved-verb aliases for the DSL keywords - neither has a concrete ask in the issue tracker backing it yet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014u9G91TefcQ42MAGvWrrqK
Tests/Project.Tests.ps1's unfiltered Invoke-ScriptAnalyzer run (every registered rule, no settings/exclusions) threw a NullReferenceException analyzing PSGraph.psm1 on windows-latest only - the module install step never pinned or explicitly re-imported PSScriptAnalyzer (unlike Pester, which already does both after Phase 2's version-ambiguity fix), so CI could pick up a different/mismatched version than what was verified locally. Pin to 1.25.0 and explicitly import it in the same place Pester already is, mirroring that precedent. Also swapped Export-ModuleMember's `-Alias *` for an explicit list matching the manifest's AliasesToExport - more precise regardless, and removes any dependence on how a given ScriptAnalyzer version resolves a wildcard alias export. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014u9G91TefcQ42MAGvWrrqK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the Phase 3 feature gaps from
plans/modernization-roadmap.mdin thelocal_PSGraphplanning repo, now that the module builds cleanly on PS7 with real CI (Phases 1 and 2, PRs #1/#2).Export-PSGraph -PassThru— returns the rendered graph (e.g. SVG) directly via the pipeline instead of writing a file, for notebook workflows (Jupyter/.NET Interactive). Ported from upstream PR Multiple changes in one PR (sorry) KevinMarquette/PSGraph#105's intent, but with an explicit switch instead of the original's-DestinationPath ''sentinel.New-NodeAttributeSet/New-EdgeAttributeSet— ported from PR Multiple changes in one PR (sorry) KevinMarquette/PSGraph#105, fixing real upstream bugs found while porting:.ToLower()was called on numeric/bool parameter values (throws), and a malformed array entry silently dropped-Distortion.Rank -RankType(issue rank Attributes (namely rankType) KevinMarquette/PSGraph#101) —min/source/max/sink, not justrank=same.Row -Attributes(issue PortTargets in record rows need escaped or normalized KevinMarquette/PSGraph#64) for row-level HTML attributes (e.g. hiding a row's border), plus aFormat-Valuefix (issue Add attribute support to Record Rows KevinMarquette/PSGraph#65) so GUID-style record ports are recognized and quoted instead of silently mangled.Install-GraphViz -Scope CurrentUser(PR Support non-admin graphviz installs, update readme, fallback to nuget graphviz KevinMarquette/PSGraph#112) with a nuget.org fallback when Chocolatey registration fails. Also fixed$IsOSX(not a real PowerShell variable) to$IsMacOS— the macOS/brewinstall path was dead code before this.PSGraph.psm1's dev-mode loader was exporting functions only, silently dropping every module alias (including the pre-existingdigraph); fixed soNodeAttributes/EdgeAttributes(anddigraph) actually resolve afterImport-Module.Deliberately out of scope (per the roadmap's own "don't merge wholesale" note on PR KevinMarquette#105):
Cells.ps1, thesvgall-in-one wrapper/aliases, and PR KevinMarquette#105's unrelatedEdge/Node/Recordconvenience-parameter additions. Also deferred: approved-verb aliases for the DSL keywords — no issue-tracker ask backs specific verb names yet (see decision note in the planning repo).Test plan
Tests/, untagged) passes locally with GraphViz on PATH — 367/367New-NodeAttributeSet.Tests.ps1,New-EdgeAttributeSet.Tests.ps1, extendedRank/Row/Export-PSGraph/Install-GraphViz/Record/PrivateFunctionstests)graph g { edge hello world } | Export-PSGraph -OutputFormat svg -PassThrureturns valid SVG text with zero files written to disk🤖 Generated with Claude Code
https://claude.ai/code/session_014u9G91TefcQ42MAGvWrrqK