Skip to content

Conversation

@scooterthedev
Copy link

Env vars should now use --prod to delete prod instead of deleting by default and --preview to delete previews

…deleting by default and --preview to delete previews
Copilot AI review requested due to automatic review settings December 18, 2025 11:54
Copy link

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

This PR implements explicit deployment type targeting for environment variable commands by adding a --prod flag alongside the existing --preview flag. The goal is to require users to explicitly specify whether they're operating on production or preview deployments, particularly for the env rm command to prevent accidental deletions.

Key changes:

  • Added --prod flag to explicitly target production deployments
  • Added validation to prevent using both --prod and --preview simultaneously
  • Required explicit flag specification for env rm command

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
cmd/root.go Declares the new prodFlag boolean variable
cmd/env.go Adds --prod flag registration and validation logic across env subcommands (add, rm, pull, push)
TODO Marks the TODO item as DONE

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

if prodFlag && previewFlag {
ui.Error("Cannot use both --prod and --preview")
return fmt.Errorf("conflicting flags")
}
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The runEnvPull function doesn't check if neither --prod nor --preview is specified, unlike runEnvRm. This creates inconsistent behavior - runEnvPull will default to production when no flag is specified, while runEnvRm requires an explicit flag. For consistency and to prevent accidental production operations, runEnvPull should also require an explicit flag specification.

Suggested change
}
}
if !prodFlag && !previewFlag {
ui.Error("Please specify either --prod or --preview")
return fmt.Errorf("no environment specified")
}

Copilot uses AI. Check for mistakes.
if prodFlag && previewFlag {
ui.Error("Cannot use both --prod and --preview")
return fmt.Errorf("conflicting flags")
}
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The runEnvPush function doesn't check if neither --prod nor --preview is specified, unlike runEnvRm. This creates inconsistent behavior - runEnvPush will default to production when no flag is specified, while runEnvRm requires an explicit flag. For consistency and to prevent accidental production operations, runEnvPush should also require an explicit flag specification.

Suggested change
}
}
if !prodFlag && !previewFlag {
ui.Error("You must specify either --prod or --preview")
return fmt.Errorf("missing required environment flag")
}

Copilot uses AI. Check for mistakes.
scooterthedev and others added 2 commits December 18, 2025 07:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

1 participant