TW-5729: improve nylas init (app choice + Agent Account domain); TW-5722: nylas rpc token#116
Merged
Merged
Conversation
…t Account domain registration Step 2 (Application): when exactly one application exists, prompt to use it or create a new one instead of silently auto-selecting. Shared createNewApp helper backs both the zero-app and create-new paths; the "No applications found" line now only prints in the genuine zero-app case. Step 5 (Agent Account Domain): new optional step that registers a free <subdomain>.nylas.email domain for Agent Accounts. Gated on a dashboard session (skipped on the --api-key path with a `nylas dashboard login` hint), validates the subdomain locally, picks the region from the active app, and treats incomplete/mismatched API responses as failure. Prompt errors are surfaced rather than silently swallowed. On success the completion summary prints a ready-to-run `nylas agent account create user@<domain>`. Adds exported dashboard.CreateDomainService (delegating to a shared newDomainService), an AgentDomain field on SetupStatus, test seams for the prompts and domain service, and unit tests covering the success path, all rejection paths, the region prompt, and both completion-summary branches. Docs and command help updated.
Add a `nylas rpc token` subcommand that prints (or copies) the JSON-RPC WebSocket session token, resolving it the same way the server does (NYLAS_WS_TOKEN, else keyring, generating one if absent). Supports --json and --copy. Change the default RPC bind address from 127.0.0.1:7368 to 127.0.0.1:7369 and update docs accordingly. Add RPC client examples under docs/commands/rpc-examples/. Un-ignore internal/cli/rpc/token.go in .gitignore (the broad *token* rule was swallowing the legitimate source file), matching the existing !internal/cli/auth/token.go exception.
…method call' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…method call' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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
This branch carries two independent changes.
TW-5729 —
nylas initimprovementscreateNewApphelper backs both the zero-app and create-new paths; the "No applications found" line now only prints in the genuine zero-app case.<subdomain>.nylas.emaildomain for Agent Accounts. Gated on a dashboard session (skipped on the--api-keypath with anylas dashboard loginhint), validates the subdomain locally, picks the region from the active app, and treats incomplete/mismatched API responses as failure. Prompt errors are surfaced rather than silently swallowed. On success the completion summary prints a ready-to-runnylas agent account create user@<domain>.dashboard.CreateDomainService(delegating to a sharednewDomainService), anAgentDomainfield onSetupStatus, and test seams for the prompts + domain service.TW-5722 —
nylas rpc tokennylas rpc tokensubcommand that prints (or--copy/--json) the JSON-RPC WebSocket session token, resolving it the same way the server does (NYLAS_WS_TOKEN→ keyring, generating one if absent).127.0.0.1:7368→127.0.0.1:7369; docs updated; client examples added underdocs/commands/rpc-examples/.internal/cli/rpc/token.goin.gitignore(the broad*token*rule was swallowing the legit source file), matching the existing!internal/cli/auth/token.goexception.Testing
go build ./...,go vet,golangci-lint— clean for changed packagesgo test -race ./internal/cli/setup/... ./internal/cli/rpc/...— passRelated docs