gabriel / muse public
feat patch feat/224-cli-user-create-delete #1 / 1
AI Agent gabriel · 1 day ago · Oct 22, 2026 · Diff

feat: muse hub user create/delete CLI commands (musehub#224)

Companion to musehub's server-side change (DELETE /api/admin/users/{handle}, shared delete_identity_account service, MCP parity). Closes the CLI-side gap: user/identity had read/update but no create or delete, unlike every other hub resource's full CRUD convention.

run_user_create wraps POST /api/users (profile creation -- distinct from identity/keypair registration via `muse auth register`, which must already have happened).

run_user_delete is one CLI surface for both self-delete and admin-delete (design decision confirmed via AskUserQuestion): omitting --handle (or passing your own handle) calls DELETE /api/me; passing a different handle calls DELETE /api/admin/users/{handle}, which the hub rejects with 403 unless the caller has admin privileges -- the CLI performs no authorization check of its own, it only routes. Requires --yes, matching the existing `muse hub repo delete` confirmation convention.

TDD: wrote command-construction tests first (mirroring TestHubUserReadUpdateCommands' existing pattern) confirming genuine RED (ImportError -- the functions didn't exist), then implemented. Confirmed GREEN: 110 passed in test_cli_hub.py.

Documented both paths in docs/agent-guide.md (Gitism Glossary + Users/ topics/forks command reference), per musehub#224's own acceptance criteria.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

sha256:992af0a75d7793d0d26f1f8378827ac61ca1052684797a718cda70d1719ea137 sha
+9 ~5 symbols
3 changed · 1259 in snapshot files
sha256:0b85bb01693d3743612d1c4742338b34d0d5fba9958ef780873bef26f3c4a7d4 snapshot
+9
symbols added
~5
symbols modified
3
files changed
1259
files in snapshot
0
dead code introduced
Semantic Changes 14 symbols
~ muse/cli/commands/hub/users.py .py 2 symbols added, 1 symbol modified
+ run_user_create function function run_user_create L89–131
+ run_user_delete function function run_user_delete L133–180
~ tests/test_cli_hub.py .py 7 symbols added
+ TestHubUserCreateCommand class class TestHubUserCreateCommand L1667–1693
+ test_user_create_calls_correct_path_and_method method method test_user_create_calls_correct_path_and_method L1670–1693
+ TestHubUserDeleteCommand class class TestHubUserDeleteCommand L1696–1771
+ test_user_delete_with_other_handle_calls_admin_endpoint method method test_user_delete_with_other_handle_calls_admin_endpoint L1752–1771
+ test_user_delete_with_own_handle_calls_delete_me method method test_user_delete_with_own_handle_calls_delete_me L1730–1750
+ test_user_delete_without_handle_calls_delete_me method method test_user_delete_without_handle_calls_delete_me L1709–1728
+ test_user_delete_without_handle_requires_yes method method test_user_delete_without_handle_requires_yes L1701–1707
Files Changed
~3
1259 in snapshot
← Older Oldest on feat/224-cli-user-create-delete
All commits
Newer → Latest on feat/224-cli-user-create-delete

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:992af0a75d7793d0d26f1f8378827ac61ca1052684797a718cda70d1719ea137 --body "your comment"