Repository navigation
Add prototype for CLI signup command - #131
shakeelrao wants to merge 15 commits into
Conversation
Copy the GetOrCreateCLIOnboardingState RPC from saas-proto (#1455, CAS-297) into proto/onboardingservice/v1, trimmed to the fields the CLI uses. Omitted fields are reserved, so the wire format matches the server. saas-proto remains the source of truth. Generate Go code with buf (`make proto`); protoc-gen-go and protoc-gen-go-grpc are pinned as go tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Log in to Auth0 with the onboarding audience, call GetOrCreateCLIOnboardingState, and poll until onboarding completes. The sign-up token stays in memory; the user runs `temporal cloud login` afterwards. - --login-method google|microsoft|password, or an arrow-key picker in an interactive terminal. Without a TTY, Auth0 shows its own picker. - Login prompts now go to stderr so -o json output stays clean. - --disable-pop-up now prints the URL without opening a browser. - The command is hidden from help until the prod handler ships. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| docs: | ||
| keywords: | ||
| - signup | ||
| - onboarding | ||
| description-header: Sign up | ||
| tags: | ||
| - login |
There was a problem hiding this comment.
I suspect this would end up getting published upon merge. Can we either keep this on a development branch or make sure it won't make it into the docs until it's actually usable by others?
There was a problem hiding this comment.
agreed. i can probably merge all the code outside of the command now (in separate PRs) and leave the command implementation out of main until we're ready to ship.
| const ( | ||
| keyCtrlC = '\x03' | ||
| keyCtrlD = '\x04' | ||
| keyEsc = '\x1b' | ||
| ) |
There was a problem hiding this comment.
Are these and all the other terminal control codes the same on Windows?
There was a problem hiding this comment.
i plan to add the picker in a dedicated PR (if we decide to keep it), so we can harden the code then. will add to the TODO list so i don't forget :3
|
|
||
| func isTerminal(stream any) bool { | ||
| f, ok := stream.(fdFile) | ||
| return ok && term.IsTerminal(int(f.Fd())) |
There was a problem hiding this comment.
Elsewhere in the generated commands.gen.go, we use istatty.IsTerminal. Can we do the same here?
There was a problem hiding this comment.
we need x/term for raw mode anyway, so using it for the TTY check too keeps the check and the raw-mode setup on the same implementation. isatty is only in generated code, and it wouldn't change behaviour, so i'm inclined to re-use x/term instead of bringing in a new import for a functionally equivalent call. wdyt?
| func (b bearerTokenCredentials) GetRequestMetadata(context.Context, ...string) (map[string]string, error) { | ||
| token, err := b.tokenSource.Token() | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get access token: %w", err) |
There was a problem hiding this comment.
Errors that come through here can end up being pretty opaque to the end user. Are there any known error cases we should make friendlier like we do in the cloud client?
There was a problem hiding this comment.
yes, when the server implementation is finalized, i think we can wrap known error modes as friendly errors.
Prototype:
temporal cloud signupDraft for prototype review. The command is hidden from
--help.What it does
OnboardingService.GetOrCreateCLIOnboardingStateand polls until onboarding completes. The polling slows down the same way the website's does.temporal cloud loginafterwards.--login-method google|microsoft|passwordpicks the provider. Without it, the command shows an arrow-key picker in a terminal; otherwise (no TTY or-o json) Auth0 shows its own picker.Changes to existing behaviour
Loginprompts now go to stderr, so-o jsonoutput stays parseable.--disable-pop-upnow really skips opening the browser and only prints the URL.Known gaps
FailedPreconditionreasons (waiting on server support).signupmultiple times for email + password: the first run ends at email verification, a later one at MFA enrollment, and only then does onboarding start.cloud login, no token storage on disk, and no cross-process refresh lock.