Contributing
This page describes how to make a change that stays consistent with the project’s structure, safety rules, and test expectations.
Contribution principles
| Principle | What it means in practice |
|---|---|
| Safety first | Never weaken the protected-path policy or add a mutation path that bypasses validation |
| One catalog | Do not hard-code module or action lists outside src/core/catalog.ps1 |
| Native behavior wins | Do not add a filesystem-type gate; attempt the operation and surface the result |
| Dry-run is core-level | Every new mutating function accepts -DryRun and validates before acting |
| Portable | No installer, no hard-coded tool paths, no hidden elevation, no network dependency |
| Local verification | Changes are verified locally with the test runner before they are considered complete |
Prerequisites
- Windows 11
- PowerShell 7.x (
pwsh) available onPATH - 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 Latestand$ErrorActionPreference = 'Stop'at entry points. - Name product functions with the
Wjmnoun 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
-LiteralPathfor 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.ps1andmenu.ps1should 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:
- Catalog — add the module/item entry in
src/core/catalog.ps1. - TUI dispatch — add the branch in
Invoke-WjmActioninsrc/menu.ps1. - CLI dispatch — add the flag parser and
Invoke-WjmCliModebranch if it should be scriptable. - Core — add or reuse a core function. If it mutates, accept
-DryRunand validate first. - Tests — add a case to the relevant suite and update
02_Catalog.Tests.ps1. - Documentation — update this developer guide and the user-facing reference.
- 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
-DryRunand 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
| Area | Question |
|---|---|
| Scope | Does the change do one coherent thing? |
| Safety | Could it mutate a protected path or the wrong filesystem object? |
| Consistency | Did the catalog, CLI, TUI, tests, and docs move together? |
| Portability | Did any hard-coded install path, username, or machine-specific value slip in? |
| Secrets | Is any sensitive value present in a tracked file or log? |
| Verification | Did the full suite pass, and the docs build if pages changed? |
Related documentation
- Architecture — layering and invariants.
- Core modules — function reference.
- Action catalog — how to change the surface.
- Testing — suites, engines, and fixtures.
- Research: junction behavior — platform constraints.