Skip to content

fix: resolve env list from active branch#65

Merged
luanvdw merged 2 commits into
mainfrom
feat/env-list-branch-targeting
Jun 3, 2026
Merged

fix: resolve env list from active branch#65
luanvdw merged 2 commits into
mainfrom
feat/env-list-branch-targeting

Conversation

@luanvdw
Copy link
Copy Markdown
Member

@luanvdw luanvdw commented Jun 3, 2026

Overview

This changes project env list so an unscoped read reflects the caller's current workstream instead of silently showing production. It keeps writes explicit, but makes read output clear about which env map was resolved and why.

Changes

  • packages/cli/src/lib/git/local-branch.ts extracts local Git branch detection from app deploy and is reused by packages/cli/src/controllers/app.ts and packages/cli/src/controllers/app-env.ts.
  • runEnvList now has a list-only target resolver. Explicit --role and --branch paths stay unchanged; no flags with a local Git branch resolve the matching Platform Branch role; missing Platform Branches show preview template metadata; no Git branch shows a production/preview project-level overview.
  • packages/cli/src/types/app-env.ts and packages/cli/src/presenters/app-env.ts add resolved target metadata so human and JSON output can explain the inferred branch, branch role, env map, and missing-branch state.
  • Env-var listing now uses one shared collector for pagination and filtering. The overview path excludes Branch overrides by keeping only project-level production and preview rows.
  • Docs, help examples, and env-list tests were updated to cover preview, production, missing Branch, no-Git overview, and explicit-scope behavior.

Why

A default production read is too easy to misinterpret when the user is checked out on a feature branch. Resolving from local Git matches the Branch model users already carry in their head, while the no-Git overview avoids pretending there is a single safe target. The implementation uses Branch role as the platform truth and does not couple it to isDefault; production-branch mutation remains out of scope.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Warning

Review limit reached

@luanvdw, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 24 minutes and 1 second. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 444173df-eaa1-4480-aad1-fb88533b0a6c

📥 Commits

Reviewing files that changed from the base of the PR and between 8930881 and 95334b0.

📒 Files selected for processing (10)
  • docs/product/command-spec.md
  • packages/cli/README.md
  • packages/cli/src/controllers/app-env.ts
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/lib/git/local-branch.ts
  • packages/cli/src/presenters/app-env.ts
  • packages/cli/src/shell/command-meta.ts
  • packages/cli/src/types/app-env.ts
  • packages/cli/tests/app-env-presenter.test.ts
  • packages/cli/tests/app-env.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/env-list-branch-targeting
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/env-list-branch-targeting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@luanvdw luanvdw marked this pull request as ready for review June 3, 2026 05:54
@luanvdw
Copy link
Copy Markdown
Member Author

luanvdw commented Jun 3, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@luanvdw luanvdw merged commit db48a36 into main Jun 3, 2026
5 checks passed
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