feat(admin): users and organizations admin verbs#57
Merged
Conversation
Add terminal access to the instance admin endpoints. seamless users covers list (with client-side --limit/--offset paging and --json), delete <id> (with confirmation, via the DELETE /admin/users body userId), credentials <id> (from the GET /admin/users/:id detail response), and prepare-device-replacement <id> for admin-assisted recovery. seamless org covers list, create, get, and update, and seamless org members covers list, add (by --user id or --email, with --roles/--scopes), update, and remove (with confirmation). Every command surfaces a 403 as a clear permission error, and device replacement explains the step-up requirement when the session is not elevated. The network layer lives in core/admin.ts and is unit tested against an injected client; commands/users.ts and commands/org.ts are the front ends. Accepts --profile and honors SEAMLESS_PROFILE. Closes #46
9 tasks
Bccorb
added a commit
that referenced
this pull request
Jul 17, 2026
feat(admin): users and organizations admin verbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eighth issue in the CLI auth epic (#38). Adds terminal access to the instance admin endpoints for user and organization management, built on the authenticated client (#41). All commands require an admin role.
Commands
Users (
/admin/users*):users list [--limit <n>] [--offset <n>] [--json]users delete <id>(confirmation;DELETE /admin/userswith body{ userId })users credentials <id> [--json](fromGET /admin/users/:iddetail)users prepare-device-replacement <id> [--keep-sessions] [--keep-passkeys] [--keep-totp]Organizations (
/admin/organizations*):org list [--json],org create <name> [--slug],org get <id> [--json],org update <id> [--name] [--slug]org members list <orgId> [--json]org members add <orgId> (--user <id> | --email <email>) [--roles a,b] [--scopes a,b]org members update <orgId> <userId> [--roles a,b] [--scopes a,b]org members remove <orgId> <userId>(confirmation)Notes / decisions
DELETE /admin/userstakes the id in the body ({ userId }), not the path. Per-user credentials come from theGET /admin/users/:iddetail response ({ user, sessions, credentials, events }); there is no dedicated per-user credential route (/admin/credential-countis a global count). Create/get/update org return an{ organization }envelope; member add/update return{ membership }. All unwrapped in the core layer.GET /admin/usershas no server-side paging, so--limit/--offsetslice the returned list client-side and the footer reportsshowing X-Y of total.prepare-device-replacementalso requires a step-up session (requireStepUp), which the CLI cannot establish yet. A 401/403 there is surfaced as a clear "requires an elevated step-up admin session, use the dashboard" message rather than a generic error.Structure
src/core/admin.ts: all admin network functions (listUsers,deleteUser,getUserDetail,prepareDeviceReplacement,listOrgs,createOrg,getOrg,updateOrg,listMembers,addMember,updateMember,removeMember),AdminApiError, reusingPermissionError.src/commands/users.ts,src/commands/org.ts, and a small sharedadminShared.ts(error reporter + comma-list parser).Tests / verification
npm run build(tsc strict): passing.npm test(vitest): 81 passing (12 new): users list/delete (body userId)/404, credentials from detail, device-replacement step-up handling, 403 to PermissionError, org list/create/update envelope unwrap, member list/add/update/remove with encoded paths, and org 404.Live end-to-end (admin login, then drive these) fits as a conformance spec under #47, now unblocked by the Node 24 Dockerfile fix (#50).
Acceptance criteria
Closes #46