Skip to content

feat: Command Line SDK update for version 20.0.0#305

Merged
ChiragAgg5k merged 4 commits intomasterfrom
dev
May 5, 2026
Merged

feat: Command Line SDK update for version 20.0.0#305
ChiragAgg5k merged 4 commits intomasterfrom
dev

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

@ChiragAgg5k ChiragAgg5k commented May 5, 2026

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

@ChiragAgg5k ChiragAgg5k changed the title feat: Command Line SDK update for version 20.0.0 feat: SDK update for version 20.0.0 May 5, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 5, 2026

Greptile Summary

  • Bumps the CLI SDK to version 20.0.0, migrating project-scoped operations (auth methods, mock phones, OAuth2, keys, delete) from the projects console-level service to the new per-project Project service, and switches ephemeral JWT creation to createEphemeralKey.
  • Introduces includes support in appwrite.config.json so functions and sites arrays can live in separate JSON files; all path resolution in pull, push, run, and docker emulation is updated to respect these user-defined directories.
  • Replaces the single-call updateMockNumbers API with a per-entry CRUD sync loop using listMockPhones/createMockPhone/updateMockPhone/deleteMockPhone; the response property access (response.mockNumbers) may not match the SDK's actual field name and warrants verification.

Confidence Score: 4/5

Safe to merge after verifying the listMockPhones response property name; all other changes are well-structured.

One P1 concern: response.mockNumbers in the mock-phone sync loop may be the wrong property name for the listMockPhones response (Appwrite list models conventionally expose the resource array under the plural of the resource type, i.e. phones). If incorrect, spreading undefined throws a TypeError and the entire settings-push path fails. Everything else — includes support, path resolution, JWT migration, parseJsonObject hardening — looks correct.

lib/commands/push.ts — the response.mockNumbers access in the mock-phone pagination loop needs verification against the actual @appwrite.io/console@12.0.0 SDK types.

Important Files Changed

Filename Overview
lib/commands/push.ts Migrates mock-number sync from a single bulk updateMockNumbers call to per-entry CRUD. Contains a likely P1 bug: response.mockNumbers should probably be response.phones per Appwrite's list-model convention.
lib/config.ts Adds includes support for externalising resource arrays into separate JSON files; introduces path traversal guards (assertValidIncludePath, assertIncludePathInsideProject) and new exported helpers for pull/push path resolution.
lib/commands/pull.ts Adds resourceDirectories option and wraps pullResources body in try/finally to guarantee config-directory restoration; routes per-resource pull to the correct include-file directory.
lib/commands/schema.ts Uses a WeakMap to track resolved config paths per config object, and threads resource-directory hints through pull/push operations. Delegates file I/O to new helpers in config.ts.
lib/emulation/utils.ts Switches JWT generation from Projects.createJWT to Project.createEphemeralKey; response field renamed from .jwt to .secret to match the new API.
lib/parser.ts Adds parseJsonObject helper that validates a CLI flag value is a JSON object before passing it to the SDK, replacing raw JSON.parse calls that could silently pass arrays or primitives.
lib/commands/services/project.ts Large expansion adding new project-scoped commands (delete, auth-method, mock-phones, keys, labels, OAuth2 providers, etc.) moved from the console-level projects service.
lib/commands/services/projects.ts Removes commands now provided by the project-scoped service (delete, updateMockNumbers, updateAuthStatus, createJWT, updateOAuth2) and fixes JSON.parseparseJsonObject for --data.
lib/emulation/docker.ts Replaces manual path.join(localConfig.getDirname(), func.path, ...) with localConfig.resolveResourcePath("functions", func.path) throughout to support include-file-based directory layout.
lib/utils.ts Maps authMockNumbers from the project model into { phone, otp } shape expected by the local settings schema.

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

Comment thread lib/commands/pull.ts
@ChiragAgg5k ChiragAgg5k changed the title feat: SDK update for version 20.0.0 feat: Command Line SDK update for version 20.0.0 May 5, 2026
Comment thread lib/config.ts Outdated
Comment thread lib/commands/config.ts
.min(1, "Include path cannot be empty")
.refine((value) => !value.includes("\0"), {
message: "Include path cannot contain null bytes",
})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need multiple .refine() calls here? Since all these checks operate on the same value, this feels like a good candidate for a single superRefine.

Comment thread lib/commands/push.ts
Comment on lines +1060 to +1068
const response = await projectService.listMockPhones({
queries: [Query.limit(limit), Query.offset(offset)],
});

remoteMockNumbers.push(...response.mockNumbers);
total = response.total;
offset += response.mockNumbers.length;

if (response.mockNumbers.length === 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Likely wrong property name on listMockPhones response

The code accesses response.mockNumbers, but Appwrite's convention for list-response models is to name the array field after the plural of the resource type. Since the resource is MockPhone, the response model (MockPhoneList) almost certainly exposes a phones field, not mockNumbers. If the property name is wrong, response.mockNumbers is undefined, and spreading it on line 1064 immediately throws TypeError: undefined is not iterable, making the entire settings-push path fail for any project that has mock phone numbers configured. Can you confirm the exact property name on the listMockPhones response object? Based on Appwrite's SDK naming convention (e.g. FunctionList.functions, BucketList.buckets) this should be phones, not mockNumbers.

@ChiragAgg5k ChiragAgg5k merged commit 8623504 into master May 5, 2026
2 checks passed
@ChiragAgg5k ChiragAgg5k deleted the dev branch May 5, 2026 05:13
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