Skip to content

fix(login): add --no-interactive flag to suppress agentic prompts#358

Closed
brycelelbach wants to merge 1 commit intobrevdev:mainfrom
brycelelbach:fix/brev-login-no-interactive
Closed

fix(login): add --no-interactive flag to suppress agentic prompts#358
brycelelbach wants to merge 1 commit intobrevdev:mainfrom
brycelelbach:fix/brev-login-no-interactive

Conversation

@brycelelbach
Copy link
Copy Markdown

Summary

brev login --token ${TOKEN} launches interactive prompts (tutorial, analytics opt-in, agent-skill install) that are unsuitable for agentic or scripted usage.

This PR adds a --no-interactive flag to brev login that:

  • Skips the hello.CanWeOnboard "Want a quick tour?" prompt in PostRunE.
  • Skips the analytics opt-in prompt in handleOnboarding.
  • Skips the agentskill.RunInstallSkillIfWanted prompt after login.
  • Requires --token (returns a validation error otherwise), since browser-based login is inherently interactive.

Follow-up (not in this PR)

The copy/paste snippet at https://brev.nvidia.com/settings/cli should default to including --no-interactive, so agents picking up the snippet get non-interactive behavior by default.

Test plan

  • go build ./... and go vet ./pkg/cmd/login/... pass locally (verified on Go 1.24).
  • brev login --token $TOKEN --no-interactive completes without prompting.
  • brev login --no-interactive (without --token) returns the validation error.
  • Existing brev login (no --no-interactive) behavior is unchanged.

🤖 Generated with Claude Code

brev login --token ${TOKEN} launched interactive prompts (tutorial,
analytics opt-in, agent-skill install) unsuitable for agentic or
scripted usage. Add a --no-interactive flag that skips all such
prompts and requires --token (since browser-based login is inherently
interactive).

Callers in agentic contexts (e.g. the copy/paste snippet on
https://brev.nvidia.com/settings/cli) should pass --no-interactive;
the website snippet should default to including it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 18, 2026 06:58
@brycelelbach brycelelbach requested a review from a team as a code owner April 18, 2026 06:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a --no-interactive mode to brev login to support scripted/agentic usage by suppressing post-login prompts and enforcing token-based auth when interactivity is disabled.

Changes:

  • Introduces --no-interactive flag to bypass onboarding/tutorial and agent-skill installation prompts.
  • Skips the analytics opt-in prompt during onboarding when --no-interactive is set.
  • Validates that --no-interactive requires --token (disallows browser-based login in this mode).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cmd/login/login.go

_, analyticsAsked := analytics.IsAnalyticsEnabled()
if !analyticsAsked && analytics.IsAnalyticsFeatureEnabled() {
if !analyticsAsked && analytics.IsAnalyticsFeatureEnabled() && !noInteractive {
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

The noInteractive guard is last in the && chain, so when !analyticsAsked is true this still calls analytics.IsAnalyticsFeatureEnabled() even in --no-interactive mode. That function performs a PostHog feature-flag network call, which defeats the goal of fast/non-agentic-safe execution. Reorder the condition (or early-return) so noInteractive short-circuits before any network call.

Suggested change
if !analyticsAsked && analytics.IsAnalyticsFeatureEnabled() && !noInteractive {
if !analyticsAsked && !noInteractive && analytics.IsAnalyticsFeatureEnabled() {

Copilot uses AI. Check for mistakes.
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.

2 participants