Skip to content

Backport multi-org CLI support to v1 - #822

Merged
roncohen merged 1 commit into
maintenance/cli-v1from
fix/cli-multi-org-v1
Nov 25, 2026
Merged

roncohen merged 1 commit into
maintenance/cli-v1from
fix/cli-multi-org-v1

Conversation

@roncohen

Copy link
Copy Markdown
Contributor

What changed

The stable CLI currently loads apps from one default organization after a personal sign-in. This backports the app-discovery fix so users in multiple organizations can find their apps without moving to CLI v2.

  • reflag apps list shows apps across accessible organizations, with the organization name and ID.
  • reflag init asks users with multiple organizations to pick an organization before picking an app.
  • --org-id and optional orgId in reflag.config.json pin the organization. Invalid or mismatched selections fail rather than falling back.

Existing appId-only configs and app-scoped API keys still work. This keeps the v1 flag API and generated types, including remote config payloads, and does not change MCP connections.

Release and verification

  • Targets maintenance/cli-v1, where the Changesets plan contains only @reflag/cli 1.0.5. The maintenance branch does not publish automatically. Nothing has been published from this PR.
  • All 44 CLI tests passed, along with the CLI build, lint, and formatting checks.
  • Ran the built v1 CLI against a mock API with three organizations. Verified app discovery, defaults and overrides, rejected mismatches, app-scoped API keys, and flag creation and type generation using the existing v1 endpoints and remote config shape.

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: medium

no actionable findings

1 optional refactor suggestion.

let app: App;
try {
app = getApp(appId);
app = await getApp(appId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Refactor suggestion — optional] Use a single error boundary for flag creation

Move const app = await getApp(appId) and the production-environment lookup into the start of the main try, removing the lookup-only try/catch and outer let app. Both catches call handleError(error, "Flags Create"), and spinner?.fail(...) is a no-op before the spinner is created, so one error boundary preserves lookup-failure handling while keeping app local and immutable.

@roncohen
roncohen merged commit ee30ad5 into maintenance/cli-v1 Nov 25, 2026
4 checks passed
@roncohen
roncohen deleted the fix/cli-multi-org-v1 branch November 25, 2026 13:34
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