Skip to content

feat: Command Line SDK update for version 22.0.0#323

Merged
ChiragAgg5k merged 3 commits into
masterfrom
dev
Jun 4, 2026
Merged

feat: Command Line SDK update for version 22.0.0#323
ChiragAgg5k merged 3 commits into
masterfrom
dev

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Jun 4, 2026

Copy link
Copy Markdown
Member

This PR contains updates to the Command Line SDK for version 22.0.0.

@ChiragAgg5k ChiragAgg5k changed the title feat: Command Line SDK update for version 22.0.0 feat: SDK update for version 22.0.0 Jun 4, 2026
@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown

Greptile Summary

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)

Reviews (3): Last reviewed commit: "chore: update Command Line SDK to 22.0.0" | Re-trigger Greptile

Comment thread lib/commands/services/organization.ts
Comment thread lib/commands/services/organization.ts Outdated
Comment thread lib/commands/services/organization.ts
Comment thread lib/commands/pull.ts Outdated
Comment thread lib/utils.ts
@ChiragAgg5k ChiragAgg5k changed the title feat: SDK update for version 22.0.0 feat: Command Line SDK update for version 22.0.0 Jun 4, 2026
@ChiragAgg5k ChiragAgg5k changed the title feat: Command Line SDK update for version 22.0.0 feat: SDK update for version 22.0.0 Jun 4, 2026
@ChiragAgg5k ChiragAgg5k changed the title feat: SDK update for version 22.0.0 feat: Command Line SDK update for version 22.0.0 Jun 4, 2026
@ChiragAgg5k ChiragAgg5k merged commit 448f4bc into master Jun 4, 2026
2 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.

2 participants