Skip to content

Fix CLI app discovery across organizations - #821

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

roncohen merged 1 commit into
mainfrom
fix/cli-multi-org

Conversation

@roncohen

Copy link
Copy Markdown
Contributor

What changed

The CLI used to load apps from one default organization after a personal sign-in. If your project used an app in another organization, the CLI couldn't find it, even with the correct appId.

  • reflag apps list now shows apps across accessible organizations, including the organization name and ID for each app.
  • reflag init asks which organization to use when there is more than one, then shows only that organization's apps. An explicit --appId skips both pickers.
  • --org-id overrides the optional orgId in reflag.config.json. An inaccessible organization or an app outside the selected organization produces an error instead of falling back.

Existing configs that only specify appId need no changes, and existing personal sign-ins can be reused. API keys still discover only their own app. This changes CLI app selection, not remote MCP connection scope.

Verification

  • CLI build, lint, formatting check, and all 66 CLI tests passed.
  • Ran the built CLI against a local mock API with three organizations whose apps had identical names. Verified cross-organization listing, app-only config, rejection of a mismatched organization, --org-id precedence, flag creation and type generation in the selected app, and single-app API key discovery.

@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

@roncohen
roncohen added this pull request to the merge queue Nov 25, 2026
@roncohen
roncohen removed this pull request from the merge queue due to a manual request Nov 25, 2026
@roncohen
roncohen added this pull request to the merge queue Nov 25, 2026
roncohen added a commit that referenced this pull request Nov 25, 2026
## What changed

The stable CLI currently loads apps from one default organization after
a personal sign-in. This backports [the app-discovery
fix](#821) 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.
Merged via the queue into main with commit e438bad Nov 25, 2026
9 checks passed
@roncohen
roncohen deleted the fix/cli-multi-org branch November 25, 2026 13:37
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