From 7a96cc42ef8598136f7b69ff4424ba39a15bc513 Mon Sep 17 00:00:00 2001 From: geobelsky Date: Thu, 9 Apr 2026 10:23:56 +0000 Subject: [PATCH] feat: profile prompts after login + X-Axme-Client header - After successful axme login, prompt for name and company (optional, Enter to skip) - Best-effort POST to /v1/portal/personal/profile - Add X-Axme-Client: axme-cli/{version} header on all requests via applyAuthHeaders() --- cmd/axme/email_login.go | 28 ++++++++++++++++++++++++++++ cmd/axme/main.go | 1 + 2 files changed, 29 insertions(+) diff --git a/cmd/axme/email_login.go b/cmd/axme/email_login.go index 6fc0eb0..244ea90 100644 --- a/cmd/axme/email_login.go +++ b/cmd/axme/email_login.go @@ -271,6 +271,34 @@ func (rt *runtime) runEmailLogin(ctx context.Context, ctxName string) error { return err } + // Optional profile collection (name + company) — best-effort, never blocks login. + if !rt.outputJSON && c.resolvedActorToken() != "" { + fmt.Fprintln(os.Stderr) + fmt.Fprintln(os.Stderr, " Quick profile (press Enter to skip):") + fmt.Fprintln(os.Stderr) + + fmt.Fprint(os.Stderr, " Your name: ") + nameReader := bufio.NewReader(os.Stdin) + nameLine, _ := nameReader.ReadString('\n') + displayName := strings.TrimSpace(nameLine) + + fmt.Fprint(os.Stderr, " Company: ") + companyReader := bufio.NewReader(os.Stdin) + companyLine, _ := companyReader.ReadString('\n') + company := strings.TrimSpace(companyLine) + + if displayName != "" || company != "" { + profilePayload := map[string]any{} + if displayName != "" { + profilePayload["display_name"] = displayName + } + if company != "" { + profilePayload["company"] = company + } + _, _, _, _ = rt.request(ctx, c, "POST", "/v1/portal/personal/profile", nil, profilePayload, true) + } + } + summary := rt.deviceLoginSummary(ctx, c, ctxName, hydrated) if rt.outputJSON { return rt.printJSON(summary) diff --git a/cmd/axme/main.go b/cmd/axme/main.go index fb7c4d4..386eee8 100644 --- a/cmd/axme/main.go +++ b/cmd/axme/main.go @@ -4240,6 +4240,7 @@ func (rt *runtime) hydrateContextFromServer(ctx context.Context, c *clientConfig } func (rt *runtime) applyAuthHeaders(req *http.Request, c *clientConfig) { + req.Header.Set("X-Axme-Client", "axme-cli/"+version) if c.APIKey != "" { req.Header.Set("x-api-key", c.APIKey) }