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:
| Field | Type | Meaning |
|---|---|---|
MenuKey | string | Top-level TUI hotkey (1–5) |
ModuleId | string | Stable machine identifier (scan, manage, clean, backup, settings) |
Name | string | Display name |
Description | string | One-line purpose shown in the TUI |
Optional | bool | Reserved for future optional modules; currently $false |
Items | array | Ordered actions |
Each action item has:
| Field | Type | Meaning |
|---|---|---|
Id | string | Stable action identifier, unique across the catalog |
MenuKey | string | Hotkey inside the module (1–6) |
Label | string | Display label |
Action | string | Dispatcher key used by Invoke-WjmAction |
NeedsInput | bool | Whether the action prompts for a path or file |
Mutates | bool | Whether 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.
| Key | Action ID | Label | Input | Mutates |
|---|---|---|---|---|
1 | scan-standard | Scan Standard Locations | No | No |
2 | scan-path | Scan a Custom Directory | Yes | No |
3 | inspect | Inspect One Junction | Yes | No |
4 | stale-report | Stale Junction Report | No | No |
5 | summary | Inventory Summary Dashboard | No | No |
6 | verify | Verify Junction Health | No | No |
2. Create & Manage (manage)
Create, retarget, repair, and remove junctions. All mutating.
| Key | Action ID | Label | Input | Mutates |
|---|---|---|---|---|
1 | create | Create a New Junction | Yes | Yes |
2 | retarget | Retarget an Existing Junction | Yes | Yes |
3 | repair | Repair a Junction | Yes | Yes |
4 | remove | Remove a Junction | Yes | Yes |
5 | remove-empty-target | Delete an Empty Target Directory | Yes | Yes |
3. Clean & Repair (clean)
Remove stale links and optionally reclaim empty targets. All mutating.
| Key | Action ID | Label | Input | Mutates |
|---|---|---|---|---|
1 | clean-stale | Clean All Stale Junctions | No | Yes |
2 | clean-orphaned | Clean Orphaned (Missing Target) | No | Yes |
3 | clean-empty | Clean Empty-Target Junctions | No | Yes |
4 | clean-stale-empty | Clean Stale + Empty Targets | No | Yes |
4. Backup & Export (backup)
Export inventory, back up, and restore links. Only restore mutates.
| Key | Action ID | Label | Input | Mutates |
|---|---|---|---|---|
1 | export-json | Export Inventory to JSON | Yes | No |
2 | export-csv | Export Inventory to CSV | Yes | No |
3 | backup | Back Up Inventory Snapshot | No | No |
4 | import-preview | Preview an Inventory File | Yes | No |
5 | restore | Restore Junctions from Backup | Yes | Yes |
5. Settings & Safety (settings)
Inspect the protection policy, scan roots, logs, and version. All read-only.
| Key | Action ID | Label | Input | Mutates |
|---|---|---|---|---|
1 | list-protected | Show Protected Paths | No | No |
2 | show-roots | Show Standard Scan Roots | No | No |
3 | open-logs | Open Logs Folder | No | No |
4 | about | About & Version | No | No |
Catalog invariants
These are enforced by 02_Catalog.Tests.ps1:
- Exactly 5 modules.
- Exactly 24 actions.
- Module IDs are stable and unique.
- Action IDs are stable and unique across all modules.
- Every action has
Id,MenuKey,Label,Action,NeedsInput, andMutates. - Every action is reachable from its module menu key.
Mutatesis$truefor every operation that can change the filesystem and$falsefor every read-only action.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:
- Add or remove the item in
Get-WjmCatalog. - Add or remove the matching branch in
Invoke-WjmActioninsrc/menu.ps1. - Add a headless flag and dispatch branch if the action should be scriptable.
- Update the module/action tables in this page and the user documentation.
- Update the literal counts in
README.mdandREADME.txtif the total changes. - Update
02_Catalog.Tests.ps1and01_SyntaxAndDocs.Tests.ps1. - Run the full suite.
The catalog is intentionally data-only. Keep behavior in src/menu.ps1 or the core modules, not in the hashtables.
Related documentation
- Architecture — how the catalog sits between surfaces and core.
- Core modules — catalog function reference.
- Testing — how catalog invariants are verified.