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

Action catalog

src/core/catalog.ps1 defines 5 modules and 24 actions. It is the only place those definitions live. The TUI, the headless CLI, the documentation, and the automated tests all read from it.

Why a catalog

Without a single definition, it is easy for the menu to offer an action the CLI cannot run, or for documentation to describe an action that no longer exists. The catalog prevents that drift:

flowchart TD
    K["catalog.ps1<br/>5 modules / 24 actions"]
    K --> T["src/menu.ps1<br/>TUI menus and hotkeys"]
    K --> C["src/menu.ps1<br/>CLI --list / --search"]
    K --> D["Documentation<br/>module and action tables"]
    K --> X["tests/suites/02_Catalog<br/>counts, IDs, fields"]
    K --> H["tests/suites/01_SyntaxAndDocs<br/>README/doc count alignment"]
    T --> E["Invoke-WjmAction"]
    C --> E

Data model

Each module is an ordered hashtable with these fields:

FieldTypeMeaning
MenuKeystringTop-level TUI hotkey (1–5)
ModuleIdstringStable machine identifier (scan, manage, clean, backup, settings)
NamestringDisplay name
DescriptionstringOne-line purpose shown in the TUI
OptionalboolReserved for future optional modules; currently $false
ItemsarrayOrdered actions

Each action item has:

FieldTypeMeaning
IdstringStable action identifier, unique across the catalog
MenuKeystringHotkey inside the module (1–6)
LabelstringDisplay label
ActionstringDispatcher key used by Invoke-WjmAction
NeedsInputboolWhether the action prompts for a path or file
MutatesboolWhether the action can change the filesystem

Get-WjmAllActions flattens the catalog and adds ModuleId and ModuleName to each item. Find-WjmAction resolves by ID. Search-WjmCatalog returns module/item pairs.

Modules and actions

1. Scan & Inspect (scan)

Discover, inspect, and classify junctions. All read-only.

KeyAction IDLabelInputMutates
1scan-standardScan Standard LocationsNoNo
2scan-pathScan a Custom DirectoryYesNo
3inspectInspect One JunctionYesNo
4stale-reportStale Junction ReportNoNo
5summaryInventory Summary DashboardNoNo
6verifyVerify Junction HealthNoNo

2. Create & Manage (manage)

Create, retarget, repair, and remove junctions. All mutating.

KeyAction IDLabelInputMutates
1createCreate a New JunctionYesYes
2retargetRetarget an Existing JunctionYesYes
3repairRepair a JunctionYesYes
4removeRemove a JunctionYesYes
5remove-empty-targetDelete an Empty Target DirectoryYesYes

3. Clean & Repair (clean)

Remove stale links and optionally reclaim empty targets. All mutating.

KeyAction IDLabelInputMutates
1clean-staleClean All Stale JunctionsNoYes
2clean-orphanedClean Orphaned (Missing Target)NoYes
3clean-emptyClean Empty-Target JunctionsNoYes
4clean-stale-emptyClean Stale + Empty TargetsNoYes

4. Backup & Export (backup)

Export inventory, back up, and restore links. Only restore mutates.

KeyAction IDLabelInputMutates
1export-jsonExport Inventory to JSONYesNo
2export-csvExport Inventory to CSVYesNo
3backupBack Up Inventory SnapshotNoNo
4import-previewPreview an Inventory FileYesNo
5restoreRestore Junctions from BackupYesYes

5. Settings & Safety (settings)

Inspect the protection policy, scan roots, logs, and version. All read-only.

KeyAction IDLabelInputMutates
1list-protectedShow Protected PathsNoNo
2show-rootsShow Standard Scan RootsNoNo
3open-logsOpen Logs FolderNoNo
4aboutAbout & VersionNoNo

Catalog invariants

These are enforced by 02_Catalog.Tests.ps1:

  1. Exactly 5 modules.
  2. Exactly 24 actions.
  3. Module IDs are stable and unique.
  4. Action IDs are stable and unique across all modules.
  5. Every action has Id, MenuKey, Label, Action, NeedsInput, and Mutates.
  6. Every action is reachable from its module menu key.
  7. Mutates is $true for every operation that can change the filesystem and $false for every read-only action.
  8. README.md, README.txt, and the documentation state the same counts.

The counts also appear literally in the documentation so readers can verify a build at a glance.

Search semantics

Search-WjmCatalog -Query <text> performs a case-insensitive substring match against:

  • the action ID;
  • the action label;
  • the module name;
  • the module ID.

An empty or whitespace query returns every action. --search clean therefore returns the four cleanup actions, and --search backup returns the module and its actions.

Adding or removing an action

Changing the surface is a coordinated change. Do all of these together:

  1. Add or remove the item in Get-WjmCatalog.
  2. Add or remove the matching branch in Invoke-WjmAction in src/menu.ps1.
  3. Add a headless flag and dispatch branch if the action should be scriptable.
  4. Update the module/action tables in this page and the user documentation.
  5. Update the literal counts in README.md and README.txt if the total changes.
  6. Update 02_Catalog.Tests.ps1 and 01_SyntaxAndDocs.Tests.ps1.
  7. Run the full suite.

The catalog is intentionally data-only. Keep behavior in src/menu.ps1 or the core modules, not in the hashtables.

  • Architecture — how the catalog sits between surfaces and core.
  • Core modules — catalog function reference.
  • Testing — how catalog invariants are verified.