feat: use active environment across commands#228
Open
angeloashmore wants to merge 3 commits into
Open
Conversation
Migrate the existing commands (locale, preview, token, webhook, pull, push, status, sync) to resolve the target repository from the persisted active environment. Deprecate the per-command --env flag, making it an alias for --repo, and remove resolveEnvironment along with its API-side validation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
angeloashmore
marked this pull request as ready for review
July 16, 2026 20:34
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1fde0c6. Configure here.
Show an explicit --repo target on the status Environment line, not just --env or the active environment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lihbr
approved these changes
Jul 17, 2026
lihbr
left a comment
Member
There was a problem hiding this comment.
LGTM, just one suggestion if it makes sense
| repo: { type: "string", short: "r", description: "Repository domain" }, | ||
| env: { type: "string", short: "e", description: "Environment domain" }, | ||
| repo: { type: "string", short: "r", description: "Repository or environment domain" }, | ||
| env: { type: "string", short: "e", description: "(deprecated) Alias for --repo" }, |
Member
There was a problem hiding this comment.
💡 #idea: any thought on adding a deprecated: true property instead so that:
- the deprecated flag is not shown in
--helpanymore - we can log the deprecation notice (
description) if it is used?
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.

Resolves:
Description
This PR is a follow-up to #227. #227 gives a way to set the active environment, while this PR connects the active environment to the commands.
Note:
--envis deprecated in favor of theenvcommands. It is now treated as an alias to--repo. We previously validated that--envwas valid for the repository. The CLI now simplifies that approach by treating--envas the repository name, falling back to normal 404 reporting if an invalid/incorrect environment name is given.Checklist
Preview
How to QA 1
Note
Medium Risk
Broad CLI behavior change: default target repo/env and removal of --env validation can surprise scripts or users who relied on parent-repo + validated environment resolution.
Overview
CLI commands now default to the active environment (from
.env.localvia the framework adapter) when--repois omitted, falling back toprismic.config.jsonthrough newgetActiveRepositoryName().--envis deprecated and treated as an alias for--repo(repository or environment domain).resolveEnvironmentand its API-side validation against the parent repository are removed; invalid names surface as normal API errors instead ofInvalidEnvironmentError.pull/push/sync/statususe the same resolution (--repo→--env→ active env → config repo). Onboarding and log output use the resolved domain.statusstill prints the config repository name and shows Environment only when it differs.Tests that expected rejection of unknown
--envvalues were removed.Reviewed by Cursor Bugbot for commit 1fde0c6. Bugbot is set up for automated code reviews on this repo. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩