Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Contributing

This page describes how to make a change that stays consistent with the project’s structure, safety rules, and test expectations.

Contribution principles

PrincipleWhat it means in practice
Safety firstNever weaken the protected-path policy or add a mutation path that bypasses validation
One catalogDo not hard-code module or action lists outside src/core/catalog.ps1
Native behavior winsDo not add a filesystem-type gate; attempt the operation and surface the result
Dry-run is core-levelEvery new mutating function accepts -DryRun and validates before acting
PortableNo installer, no hard-coded tool paths, no hidden elevation, no network dependency
Local verificationChanges are verified locally with the test runner before they are considered complete

Prerequisites

  • Windows 11
  • PowerShell 7.x (pwsh) available on PATH
  • Optional: Pester 5 for the Pester engine, though the bundled native engine is sufficient

No package restore or build step is required. The tool is dot-sourced PowerShell.

Repository layout

JunctionManager.ps1        Root entry point
JunctionManager.bat        PATH-pwsh launcher
src/
  menu.ps1                 CLI dispatcher and interactive TUI
  core/                    Dot-sourced core modules
tests/
  Run-Tests.ps1            Modular test runner
  RunTests.bat             PATH-pwsh test launcher
  helpers/                 Harness and junction fixtures
  suites/                  Auto-discovered *.Tests.ps1 suites
docs/                      mdBook documentation site
book.toml                  mdBook configuration

Coding conventions

  • Target PowerShell 7 with #Requires -Version 7.0.
  • Use Set-StrictMode -Version Latest and $ErrorActionPreference = 'Stop' at entry points.
  • Name product functions with the Wjm noun prefix (Get-WjmJunctionInfo, New-WjmJunction).
  • Return structured objects; leave rendering to src/menu.ps1.
  • Wrap native errors with the action and paths while preserving the original message.
  • Prefer -LiteralPath for filesystem cmdlets.
  • Do not introduce a filesystem-type check. Validate the path, then attempt the operation.
  • Keep modules independent of console rendering. Only ui-helpers.ps1 and menu.ps1 should emit UI.
  • When adding a module, add it to src/core/manifest.ps1; do not repeat the list anywhere else.

Add an action end to end

Use the Action catalog as the contract. A complete change touches these places together:

  1. Catalog — add the module/item entry in src/core/catalog.ps1.
  2. TUI dispatch — add the branch in Invoke-WjmAction in src/menu.ps1.
  3. CLI dispatch — add the flag parser and Invoke-WjmCliMode branch if it should be scriptable.
  4. Core — add or reuse a core function. If it mutates, accept -DryRun and validate first.
  5. Tests — add a case to the relevant suite and update 02_Catalog.Tests.ps1.
  6. Documentation — update this developer guide and the user-facing reference.
  7. Counts — if the total changes, update the literal counts in README.md, README.txt, and the documentation.
flowchart LR
    A[Catalog entry] --> B[TUI handler]
    A --> C[CLI flag and handler]
    B --> D[Core function]
    C --> D
    D --> E[Tests]
    A --> F[Developer docs]
    A --> G[User docs]
    A --> H[Count references]

Removing an action is the reverse: remove the catalog entry, handlers, tests, and documentation, then update the counts.

Safety review checklist

Before considering a change complete, confirm:

  • Protected paths are still refused for create, retarget, remove, delete, and restore.
  • Drive roots and UNC paths are still rejected where required.
  • A link can never be nested inside its own target.
  • Removal detaches the link only and never follows the target.
  • Empty-target deletion still refuses files, junctions, and nested reparse points.
  • Restore still skips protected, existing, and target-missing records.
  • Every new mutation accepts -DryRun and returns a preview before touching disk.
  • Native errors are surfaced, not replaced by a guessed filesystem check.
  • No credential, cookie, webhook, or environment secret is written to a tracked file.

Documentation requirements

Tracked documentation follows the project’s documentation standards:

  • user material under docs/user/;
  • architecture and extension material under docs/developer/;
  • shared platform research under docs/developer/research/.

Each page should be GFM-compliant, use tables and Mermaid diagrams where they help, use ISO dates, and link to real references. Do not include local paths, usernames, or local-only setup. Keep release history in CHANGELOG.md rather than scattering version claims across the docs.

When you add a page, add it to docs/SUMMARY.md so mdBook includes it.

Verification

Run the full suite headlessly:

tests\RunTests.bat --all

Run a targeted suite while iterating:

tests\RunTests.bat --suite catalog
tests\RunTests.bat --suite paths

Run under both engines when Pester 5 is available:

tests\RunTests.bat --all --native
tests\RunTests.bat --all --pester

Validate the documentation site:

mdbook build

The suite itself parses every project .ps1 file, checks the entry points and documentation set, verifies catalog counts, and exercises the filesystem behavior. A change is not complete until the relevant suites pass.

Review checklist

AreaQuestion
ScopeDoes the change do one coherent thing?
SafetyCould it mutate a protected path or the wrong filesystem object?
ConsistencyDid the catalog, CLI, TUI, tests, and docs move together?
PortabilityDid any hard-coded install path, username, or machine-specific value slip in?
SecretsIs any sensitive value present in a tracked file or log?
VerificationDid the full suite pass, and the docs build if pages changed?