Skip to content

TW-5729: improve nylas init (app choice + Agent Account domain); TW-5722: nylas rpc token#116

Merged
qasim-nylas merged 4 commits into
mainfrom
feature/TW-5729-init-app-choice-agent-domain
Jun 27, 2026
Merged

TW-5729: improve nylas init (app choice + Agent Account domain); TW-5722: nylas rpc token#116
qasim-nylas merged 4 commits into
mainfrom
feature/TW-5729-init-app-choice-agent-domain

Conversation

@qasim-nylas

Copy link
Copy Markdown
Collaborator

Summary

This branch carries two independent changes.

TW-5729 — nylas init improvements

  • Step 2 (Application): when exactly one application exists, the wizard now prompts "Use this application?" (use it / create a new one) instead of silently auto-selecting. A 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): optionally 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, and test seams for the prompts + domain service.

TW-5722 — nylas rpc token

  • New nylas rpc token subcommand 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).
  • Default RPC bind address bumped 127.0.0.1:7368127.0.0.1:7369; docs updated; client examples added under docs/commands/rpc-examples/.
  • Un-ignores internal/cli/rpc/token.go in .gitignore (the broad *token* rule was swallowing the legit source file), matching the existing !internal/cli/auth/token.go exception.

Testing

  • go build ./..., go vet, golangci-lint — clean for changed packages
  • go test -race ./internal/cli/setup/... ./internal/cli/rpc/... — pass
  • New unit tests: subdomain regex, auth-gate skip, both completion-summary branches, domain-registration success + all rejection paths (decline/invalid/error/region-mismatch/missing-ID/address-mismatch), region prompt (error + success); RPC token resolution.

Related docs

…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.
@qasim-nylas qasim-nylas requested a review from AaronDDM June 27, 2026 02:10
AaronDDM
AaronDDM previously approved these changes Jun 27, 2026

@AaronDDM AaronDDM left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment thread docs/commands/rpc-examples/list-sweep.js Fixed
Comment thread docs/commands/rpc-examples/read-thread.js Fixed
…method call'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
AaronDDM
AaronDDM previously approved these changes Jun 27, 2026

@AaronDDM AaronDDM left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

…method call'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

@AaronDDM AaronDDM left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@qasim-nylas qasim-nylas merged commit 6fe6c49 into main Jun 27, 2026
7 checks passed
@qasim-nylas qasim-nylas deleted the feature/TW-5729-init-app-choice-agent-domain branch June 27, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants