feat(cli,management): close area-move and template-folder CLI parity gaps

Two verified-absent parity gaps between the service layer and the CLI /
ManagementActor command surface, both left as follow-ups by the 2026-05-11
design plans.

(1) area move. AreaService.MoveAreaAsync had existed since the deployment
topology page shipped but was reachable only from the Blazor UI. Adds
MoveAreaCommand(AreaId, NewParentAreaId?) to Commons, a ManagementActor
dispatch arm delegating straight to AreaService.MoveAreaAsync (not-found /
self-parent / descendant-cycle / cross-site / name-collision all surface as
the standard curated ManagementCommandException failure response; the service
writes its own "Move" audit row), and the CLI verb `site area move --id
[--parent-id]`. Omitting --parent-id moves the area to the site root, matching
the command's nullable NewParentAreaId. The command carries the SAME any-of
[Designer, Deployer] gate as CreateArea/UpdateArea/DeleteArea (arch-review C6):
re-parenting is the same structural authoring act, exposed on the same two
surfaces. Placed under the existing `site area` group rather than a new
top-level `area` group, alongside its create/update/delete siblings.

(2) template folder verbs. The five folder management commands have been
handled by ManagementActor since the folder-hierarchy plan, but the promised
CLI surface was never written. Adds `template folder
list|create|rename|move|reorder|delete` mapping 1:1 onto ListTemplateFolders /
CreateTemplateFolder / RenameTemplateFolder / MoveTemplateFolder /
ReorderTemplateFolder / DeleteTemplateFolder. --parent-id is omitted to target
the tree root; --direction takes the lowercase literals up/down, validated at
parse time by AcceptOnlyFromAmong (same case-sensitive contract as the audit
--channel/--kind/--status options).

Follow-on updates: the frozen authorization matrix gains its MoveArea entry
(reflection-driven, so a missing entry would have failed CI); CommandTreeTests
pins both new verb sets plus the omit-parent-id-means-root parse behaviour and
registry round-trips; ManagementActorTests covers the MoveArea role gate and
the delegate-to-service success/root/cycle/not-found paths; the CLI README and
Component-ManagementService.md document the new surface (the latter also gained
the previously-undocumented ReorderTemplateFolder); both plan docs' follow-up
lines are marked done.
This commit is contained in:
Joseph Doherty
2026-08-01 11:14:48 -04:00
parent e0851e3e17
commit 88638d774a
11 changed files with 482 additions and 6 deletions
+93
View File
@@ -431,6 +431,84 @@ scadabridge --url <url> template resync-members --id <int>
|--------|----------|-------------|
| `--id` | yes | Template ID (its derived subtree is included) |
#### `template folder list`
List all template folders. Folders are a Central UI organizational device only — they
have no effect on template resolution or flattening.
```sh
scadabridge --url <url> template folder list
```
Takes no options beyond the global ones.
#### `template folder create`
Create a template folder. Omit `--parent-id` to create it at the tree root. Sibling
names must be unique (case-insensitive).
```sh
scadabridge --url <url> template folder create --name <string> [--parent-id <int>]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--name` | yes | Folder name |
| `--parent-id` | no | Parent folder ID; omit to create at the tree root |
#### `template folder rename`
Rename a template folder. Enforces sibling-name uniqueness.
```sh
scadabridge --url <url> template folder rename --id <int> --name <string>
```
| Option | Required | Description |
|--------|----------|-------------|
| `--id` | yes | Folder ID |
| `--name` | yes | New folder name |
#### `template folder move`
Move a template folder under a new parent folder. Omit `--parent-id` to move it to the
tree root. Rejects cycles (a folder cannot move under one of its own descendants).
```sh
scadabridge --url <url> template folder move --id <int> [--parent-id <int>]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--id` | yes | Folder ID to move |
| `--parent-id` | no | New parent folder ID; omit to move to the tree root |
#### `template folder reorder`
Swap a folder's `SortOrder` with an adjacent sibling. `up` swaps with the previous
sibling, `down` with the next; reordering past either end is a no-op.
```sh
scadabridge --url <url> template folder reorder --id <int> --direction <up|down>
```
| Option | Required | Description |
|--------|----------|-------------|
| `--id` | yes | Folder ID |
| `--direction` | yes | `up` or `down` (lowercase literals only) |
#### `template folder delete`
Delete a template folder. Blocked if the folder still contains any subfolders or templates.
```sh
scadabridge --url <url> template folder delete --id <int>
```
| Option | Required | Description |
|--------|----------|-------------|
| `--id` | yes | Folder ID |
---
### `instance` — Manage instances
@@ -831,6 +909,21 @@ scadabridge --url <url> site area update --id <int> --name <string>
| `--id` | yes | Area ID |
| `--name` | yes | Area name |
#### `site area move`
Re-parent an area within its own site. Omit `--parent-id` to move the area to the
site root. Rejected for: self-parent, moving under one of the area's own descendants
(cycle), a parent in a different site, and a sibling name collision at the target level.
```sh
scadabridge --url <url> site area move --id <int> [--parent-id <int>]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--id` | yes | Area ID to move |
| `--parent-id` | no | New parent area ID; omit to move to the site root |
#### `site area delete`
Delete an area. Fails if any instances are assigned to it.