Repository navigation
Description
Problem
nemar admin notify currently only supports broadcast groups (--to all|admins|members). There is no way to send a transactional email to a single user.
This came up while following up with a user who hit a sandbox bug (#377): the only options were to broadcast to everyone (overkill) or skip the CLI and send mail outside the audit trail.
Proposal
Add a --user <username> option to nemar admin notify that sends to exactly one user, mutually exclusive with --to.
nemar admin notify --user AlexWoods1 \
--subject "Your sandbox issue is fixed in v0.8.3" \
--body-file ./alex-followup.mdBackend
POST /admin/notify schema (in backend/src/routes/admin.ts:4989) currently accepts to: enum(all, admins, members). Extend to accept user: string as an alternative; reject if both are provided.
getBroadcastRecipients in backend/src/services/broadcast.ts would gain a single-user lookup path that returns [{user_id, email, ...}] for the given username (404 if not found, 400 if not approved/has no email).
The downstream sendBroadcast already iterates over a recipient list, so per-user is just recipients.length === 1 and the audit log row records group: \user:${username}`instead ofall|admins|members`.
CLI
src/commands/admin/notify.ts (or wherever the command lives) currently passes to to the API. Add --user option, validate exclusivity with --to, surface 404 if user not found.
Audit
The existing audit_log row should record the target username so admin history shows who got pinged. Reuse the same notify action; differentiate via the details JSON (e.g. { recipient: \"user:Alex\" } vs { recipient: \"group:members\" }).
Acceptance
-
nemar admin notify --user <username> --subject ... --body ...sends to exactly that user. -
--userand--toare mutually exclusive (CLI rejects with usage error). - Unknown username returns 404.
- User without email or unapproved returns 400 with explanation.
-
--dry-runworks for--userand shows the single recipient. - Audit log distinguishes per-user vs broadcast in the details JSON.
Out of scope
- A future
--users <a,b,c>for ad-hoc small lists. Defer until there's a real ask.
Related
- sandbox: surface real errors and add --verbose; migrate off fragile registerurl path #377 - sandbox: surface real errors and add --verbose (the case that surfaced this gap)
Activity
neuromechanist commentedon May 14, 2026
Merged via PR #461 (admin notify --user).