From b354a0469d528f21ea11bf01185e3416d46b79b5 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 21 Feb 2026 17:35:04 -0600 Subject: [PATCH] Add missing auth commands to CLI - auth register - POST /api/auth/register - auth forgot-password - POST /api/auth/forgot-password - auth reset-password - POST /api/auth/reset-password - auth account - PATCH /api/auth/account - auth users - GET /api/auth/users CLI now has 100% coverage of all API endpoints --- scripts/README.md | 8 +++++- scripts/gantt.sh | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/scripts/README.md b/scripts/README.md index eddacd4..c535157 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -145,7 +145,13 @@ Displays text files in terminal, saves binary files to `/tmp/`. | Attach file | ✅ | ✅ | ✅ | | List projects | ✅ | ✅ | ❌ | | List sprints | ✅ | ✅ | ❌ | -| Auth login/logout | ✅ | ✅ | ❌ | +| Auth login | ✅ | ✅ | ❌ | +| Auth logout | ✅ | ✅ | ❌ | +| Auth register | ✅ | ✅ | ❌ | +| Auth forgot-password | ✅ | ✅ | ❌ | +| Auth reset-password | ✅ | ✅ | ❌ | +| Auth account update | ✅ | ✅ | ❌ | +| Auth list users | ✅ | ✅ | ❌ | | View attachments | ✅ | ❌ | ✅ | ### Auditing Coverage diff --git a/scripts/gantt.sh b/scripts/gantt.sh index ae9492c..45731a8 100755 --- a/scripts/gantt.sh +++ b/scripts/gantt.sh @@ -335,6 +335,69 @@ cmd_auth_session() { api_call GET "/auth/session" } +cmd_auth_register() { + local email="$1" + local password="$2" + local name="${3:-}" + + if [ -z "$email" ] || [ -z "$password" ]; then + log_error "Usage: auth register [name]" + exit 1 + fi + + log_info "Registering user..." + local data + data=$(jq -n --arg email "$email" --arg password "$password" --arg name "$name" \ + '{email: $email, password: $password, name: (if $name == "" then null else $name end)}') + api_call POST "/auth/register" "$data" +} + +cmd_auth_forgot_password() { + local email="$1" + + if [ -z "$email" ]; then + log_error "Usage: auth forgot-password " + exit 1 + fi + + log_info "Requesting password reset..." + api_call POST "/auth/forgot-password" "{\"email\": \"$email\"}" +} + +cmd_auth_reset_password() { + local token="$1" + local password="$2" + + if [ -z "$token" ] || [ -z "$password" ]; then + log_error "Usage: auth reset-password " + exit 1 + fi + + log_info "Resetting password..." + api_call POST "/auth/reset-password" "{\"token\": \"$token\", \"password\": \"$password\"}" +} + +cmd_auth_account() { + local field="$1" + local value="$2" + + if [ -z "$field" ] || [ -z "$value" ]; then + log_error "Usage: auth account " + echo "Fields: name, email" + exit 1 + fi + + log_info "Updating account $field..." + local data + data=$(jq -n --arg field "$field" --arg value "$value" '{($field): $value}') + api_call PATCH "/auth/account" "$data" +} + +cmd_auth_users() { + log_info "Fetching users..." + api_call GET "/auth/users" +} + #=================== # DEBUG OPERATIONS #=================== @@ -379,6 +442,11 @@ AUTH COMMANDS: auth login Log in auth logout Log out auth session Check current session + auth register Register new account + auth forgot-password Request password reset + auth reset-password Reset password with token + auth account Update account (name, email) + auth users List all users OTHER COMMANDS: debug Call debug endpoint @@ -455,6 +523,11 @@ main() { login) cmd_auth_login "$@" ;; logout) cmd_auth_logout "$@" ;; session|whoami) cmd_auth_session "$@" ;; + register|signup) cmd_auth_register "$@" ;; + forgot-password|forgot) cmd_auth_forgot_password "$@" ;; + reset-password|reset) cmd_auth_reset_password "$@" ;; + account|profile) cmd_auth_account "$@" ;; + users|list-users) cmd_auth_users "$@" ;; *) log_error "Unknown auth command: $subcmd"; show_help; exit 1 ;; esac ;;