fix(login): add --no-interactive flag to suppress agentic prompts#358
Closed
brycelelbach wants to merge 1 commit intobrevdev:mainfrom
Closed
fix(login): add --no-interactive flag to suppress agentic prompts#358brycelelbach wants to merge 1 commit intobrevdev:mainfrom
brycelelbach wants to merge 1 commit intobrevdev:mainfrom
Conversation
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>
There was a problem hiding this comment.
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-interactiveflag to bypass onboarding/tutorial and agent-skill installation prompts. - Skips the analytics opt-in prompt during onboarding when
--no-interactiveis set. - Validates that
--no-interactiverequires--token(disallows browser-based login in this mode).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| _, analyticsAsked := analytics.IsAnalyticsEnabled() | ||
| if !analyticsAsked && analytics.IsAnalyticsFeatureEnabled() { | ||
| if !analyticsAsked && analytics.IsAnalyticsFeatureEnabled() && !noInteractive { |
There was a problem hiding this comment.
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() { |
6 tasks
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
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-interactiveflag tobrev loginthat:hello.CanWeOnboard"Want a quick tour?" prompt inPostRunE.handleOnboarding.agentskill.RunInstallSkillIfWantedprompt after login.--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 ./...andgo vet ./pkg/cmd/login/...pass locally (verified on Go 1.24).brev login --token $TOKEN --no-interactivecompletes without prompting.brev login --no-interactive(without--token) returns the validation error.brev login(no--no-interactive) behavior is unchanged.🤖 Generated with Claude Code