3 Commits

Author SHA256 Message Date
Alphaeus Mote 96d042b0c6 feat(schedules): target any mix of devices and groups
A trigger now carries lists of devices and groups (JSON columns, like a
role's device scope) or All Devices, instead of one device or one group.
A firing reaches the de-duplicated union; event triggers fire for a device
in any target. Saving needs at least one target, every target must exist,
All Devices stands alone, and a device-scoped role must have every target
in scope (as single targets did).

At fire time a group or device that no longer exists is skipped and noted
in the last result; the rest still run. Deleting a group or removing a
device drops it from schedules' targets, disabling only those left with
none. A schedule saved without a time zone stays UTC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 18:14:46 -05:00
Alphaeus Mote 5da8b648a3 feat(scripts): PowerShell parameters always follow the code
The editor adopts the param() block's parameters when a script opens,
without marking it unsaved, and keeps updating them as the code changes;
the Differs From Code state and the Sync From Code button are gone. Saving
applies the same merge on the server, so the stored parameters of a
PowerShell or Windows PowerShell script always match its code whatever the
client sent, keeping Literal and descriptions the code has no help for (from
the request, else from what was stored). Code that does not parse keeps the
editor's last read; Bash is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 21:22:34 -05:00
Alphaeus Mote 1ef7d348d8 feat(scripts): read PowerShell param() blocks and check values on every start
The server reads a PowerShell script's param() block with PowerShell's own
parser (System.Management.Automation, parse only) through
POST /api/scripts/parameters/parse (scripts.view) and merges it into the
editor's parameters: the code owns name, type, required, default and
ValidateSet; Expansion and hand-written descriptions without help are kept;
parameters gone from the code are dropped. Only constant primitive defaults
and lists of them are imported; computed ones stay in the code. `using
assembly` is masked before parsing, since the parser would load it.

Manual runs, trigger saves and every firing share one check: a required
parameter needs a value or a default, and given values must fit. Schedules
store only the values set on them, so untouched ones follow the script's
defaults; a firing that no longer fits records why and does not run. Empty
values count as not given on the server and the agent alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:46:00 -05:00