You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR updates the CLI SDK to v22.0.0, migrating org-scoped operations from the Organizations (plural, explicit ID) service to the new Organization (singular, header-based) service, adding organizationId to local project config, introducing applyConfigFilters to resolve and inject the X-Appwrite-Organization header, and enriching settings with security policy and mock-phone data pulled via separate API calls.
New organization command group replaces the key/project sub-commands in organizations, but the standalone commands (list-keys, create-key, list-projects, etc.) never call applyConfigFilters and never set X-Appwrite-Organization on their console client, leaving every org-scoped request without organization context.
Settings pull/push now correctly fetches policies and mock-phone numbers separately and persists the full security block; init and pull both persist organizationId to appwrite.json for future commands.
setProject legacy overload in config.ts still calls createSettingsObject(project) without policies, which would silently drop security settings — this path is currently unreachable but is misleading dead code.
Confidence Score: 3/5
The standalone organization command group is broken for multi-org users — all key and project operations will execute without the required organization context.
The applyConfigFilters machinery that correctly resolves and sets X-Appwrite-Organization is wired into push and pull, but the new organization CLI command group bypasses it entirely. For any user in more than one organization, every appwrite organization list-keys / create-key / list-projects / create-project / delete-project call will hit the API without identifying which organization to operate on.
lib/commands/services/organization.ts needs applyConfigFilters (or equivalent org-header injection) before constructing the Organization SDK instance.
Important Files Changed
Filename
Overview
lib/commands/services/organization.ts
New organization command group replacing the per-org organizations key/project sub-commands; sdkForConsole() is used correctly for auth but the X-Appwrite-Organization header is never set, so all org-scoped operations lack the required organization context
lib/commands/services/presences.ts
New presences service command group using sdkForProject; standard generated pattern, no issues found
lib/commands/pull.ts
Migrates settings pull from Projects to Organization service; introduces applyConfigFilters for org header resolution and enriches settings with policy/mock-phone data; standalone pullSettings correctly persists full settings
lib/commands/push.ts
Migrates settings push to Organization service with applyConfigFilters for org resolution; renames ServiceId/ProtocolId/AuthMethod enums; standalone pushSettings resolves org ID in the pre-check block and carries it forward correctly
lib/config-filters.ts
New filter pipeline that sets X-Appwrite-Organization on the console client, resolving org ID from config or by fetching project details as a backwards-compatible fallback; logic is sound
lib/config.ts
Adds organizationId to project config, new setOrganizationId helper, and delegates cloud hostname detection to isCloudHostname; the legacy setProject(id, name, project) overload at line 1189 still calls createSettingsObject without policies, silently dropping security settings if ever invoked
lib/utils.ts
Rewrites createSettingsObject to use Map-based lookups from services/authMethods arrays and adds security policy support; isCloudHostname now uses an allowlist of region codes
lib/sdks.ts
Refactored sdkForConsole signature from positional args to an options object and adds optional organizationId header injection; clean, no issues
lib/commands/init.ts
Migrates project creation/linking to Organization service, removes extractSelectionId in favour of direct ID values from prompts, and persists organizationId to local config after init; changes look correct
lib/questions.ts
Updates organization/project selection to use direct IDs instead of display labels and switches project listing to getOrganizationService with org-scoped client; paginate sdk passthrough pattern is correct
lib/services.ts
Adds getOrganizationService factory using sdkForConsole as default; existing getOrganizationsService remains with sdkForProject default (used only by the organizations command group directly)
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
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.
This PR contains updates to the Command Line SDK for version 22.0.0.