Skip to content

Prevent wizard inventory output from overwriting non-.drawio diagram paths - #24

Merged
jacobyoby merged 2 commits into
mainfrom
copilot/fix-wizard-overwrite-issue
Sep 8, 2026
Merged

jacobyoby merged 2 commits into
mainfrom
copilot/fix-wizard-overwrite-issue

Conversation

Copilot AI commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

The quick-start wizard derived the inventory path by only replacing a .drawio suffix. When -OutputPath used .xml or no extension, the inventory path collapsed to the diagram path and the JSON write replaced the generated draw.io file.

  • Path derivation

    • Move wizard output-path derivation into a dedicated helper above the dot-source guard.
    • Generate the inventory path from the output filename stem, regardless of extension, so it always becomes a distinct sibling file.
  • Dot-sourced testability

    • Keep the path helper in the dot-sourced portion of examples/New-NetworkDiagram.ps1 so Pester can exercise it without running the live scan.
  • Regression coverage

    • Add focused Pester cases for:
      • -OutputPath ./office.xml
      • -OutputPath ./office
function Get-WizardInventoryPath {
    param([string]$OutputPath)

    $outputDirectory = [System.IO.Path]::GetDirectoryName($OutputPath)
    $outputBaseName = [System.IO.Path]::GetFileNameWithoutExtension($OutputPath)
    $inventoryFileName = "$outputBaseName-inventory.json"

    if ([string]::IsNullOrEmpty($outputDirectory)) {
        return $inventoryFileName
    }

    Join-Path $outputDirectory $inventoryFileName
}

Co-authored-by: jacobyoby <45674026+jacobyoby@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix wizard overwriting diagram with inventory JSON Prevent wizard inventory output from overwriting non-.drawio diagram paths Sep 8, 2026
Copilot AI requested a review from jacobyoby September 8, 2026 08:14
@jacobyoby
jacobyoby marked this pull request as ready for review September 8, 2026 08:15
@jacobyoby
jacobyoby merged commit 20258a6 into main Sep 8, 2026
4 checks passed
@cursor
cursor Bot deleted the copilot/fix-wizard-overwrite-issue 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.

Wizard overwrites the diagram with the inventory JSON when -OutputPath does not end in .drawio

2 participants