Skip to content

Conversation

@abnegate
Copy link
Member

@abnegate abnegate commented Nov 3, 2025

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

Summary by CodeRabbit

  • New Features

    • Added a total parameter across list endpoints to skip row counting in tables for improved performance. When set to false, the total count will not be calculated, reducing query overhead.
  • Version

    • Updated to version 11.1.0 with corresponding installation script updates.

@coderabbitai
Copy link

coderabbitai bot commented Nov 3, 2025

Walkthrough

This pull request bumps the CLI version from 11.0.0 to 11.1.0 and introduces a new total parameter across list-related API endpoints. The total parameter allows clients to skip row counting in table operations for improved performance. Version references are updated in configuration files, installation scripts, and SDK manifests. The total parameter is consistently added to request parameter typedefs, function signatures, request payloads, and CLI command options across account, database, function, messaging, migration, project, proxy, site, storage, table, team, token, user, and VCS command modules.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20-25 minutes

  • Wide but homogeneous scope: 22 files affected, but the majority contain repetitive, mechanical changes following the same pattern (parameter addition, payload inclusion, CLI option wiring).
  • Consistency verification required: Spot-check representative command files (e.g., lib/commands/databases.js, lib/commands/messaging.js, lib/commands/users.js) to ensure the total parameter is consistently applied to function signatures, typedefs, payload construction, and CLI options across all endpoints.
  • Key areas requiring attention:
    • Verify all list-related functions across command modules include the total parameter in the correct position within the destructured parameter object.
    • Confirm CLI option parsers are consistent (defaulting to true when undefined via parseBool).
    • Ensure payload construction correctly checks typeof total !== 'undefined' before assignment.
    • Validate version bumps across all installation scripts, manifests, and SDK files (lib/client.js, package.json, scoop config).
    • Check that CLI options descriptions and parsing behavior are consistent across messaging.js (which has the most functions modified).

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: Command Line SDK update for version 11.1.0" is partially related to the changeset. While it accurately reflects the version bump to 11.1.0 that appears across multiple files (package.json, CHANGELOG.md, install scripts, client.js, and parser.js), it does not highlight the primary feature addition in this release. The main substantive change throughout the codebase is the introduction of a total parameter across numerous list endpoints in modules like account.js, databases.js, functions.js, messaging.js, and others—enabling clients to skip row counting for performance optimization. The title refers to a real aspect of the changes (the version number) but is somewhat overly broad, using the generic term "update" without specifying what the actual feature improvement is.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

CHANGELOG.md Outdated
## 11.1.0

* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance
* Add `Operator` class for atomic modification of rows via update, bulk update, upsert, and bulk upsert operations
Copy link
Member

Choose a reason for hiding this comment

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

looks like cli only has changes for total, i dont see operator class added. lets remove this changelog if its intentional

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
lib/commands/projects.js (1)

2118-2120: Minor UX: document default and broaden boolean parsing (optional).

  • Consider updating option help to say “Default: true”.
  • Optionally accept case-insensitive true/false and 1/0 in parseBool for CLI ergonomics.

Example change in parser.js (outside this file):

-const parseBool = (value) => {
-    if (value === 'true') return true;
-    if (value === 'false') return false;
-    throw new commander.InvalidArgumentError('Not a boolean.');
-}
+const parseBool = (value) => {
+  const v = String(value).trim().toLowerCase();
+  if (v === 'true' || v === '1' || v === 'yes') return true;
+  if (v === 'false' || v === '0' || v === 'no') return false;
+  throw new commander.InvalidArgumentError('Not a boolean (expected true/false, 1/0, yes/no).');
+}

Also applies to: 2316-2319, 2368-2371, 2519-2522

lib/commands/sites.js (1)

1363-1366: Optional: clarify default in help and improve parseBool.

  • Append “Default: true” in option descriptions.
  • Consider enhancing parseBool to accept 1/0, yes/no, case-insensitive, as shown in projects comment.

Also applies to: 1475-1478, 1554-1556

lib/commands/account.js (1)

1776-1777: Optional: CLI help default + tolerant boolean parsing.

Same suggestions as other files: mention “Default: true” and consider broadening parseBool.

Also applies to: 1794-1795

lib/commands/teams.js (1)

562-565: Optional: CLI help default + tolerant boolean parsing.

Mirror the minor UX improvements suggested in projects/sites.

Also applies to: 599-601, 608-610

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44c7c7d and 4cd3264.

📒 Files selected for processing (22)
  • CHANGELOG.md (1 hunks)
  • README.md (2 hunks)
  • install.ps1 (1 hunks)
  • install.sh (1 hunks)
  • lib/client.js (1 hunks)
  • lib/commands/account.js (6 hunks)
  • lib/commands/databases.js (18 hunks)
  • lib/commands/functions.js (15 hunks)
  • lib/commands/messaging.js (28 hunks)
  • lib/commands/migrations.js (4 hunks)
  • lib/commands/projects.js (13 hunks)
  • lib/commands/proxy.js (4 hunks)
  • lib/commands/sites.js (11 hunks)
  • lib/commands/storage.js (8 hunks)
  • lib/commands/tables-db.js (18 hunks)
  • lib/commands/teams.js (11 hunks)
  • lib/commands/tokens.js (3 hunks)
  • lib/commands/users.js (21 hunks)
  • lib/commands/vcs.js (4 hunks)
  • lib/parser.js (1 hunks)
  • package.json (1 hunks)
  • scoop/appwrite.config.json (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (15)
lib/commands/tokens.js (2)
lib/sdks.js (1)
  • sdkForProject (24-55)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/proxy.js (1)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/teams.js (2)
lib/sdks.js (1)
  • sdkForProject (24-55)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/migrations.js (1)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/account.js (2)
lib/sdks.js (1)
  • sdkForProject (24-55)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/vcs.js (1)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/users.js (2)
lib/sdks.js (1)
  • sdkForProject (24-55)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/databases.js (2)
lib/commands/push.js (2)
  • databasesListAttributes (112-117)
  • databasesListIndexes (145-150)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/functions.js (2)
lib/sdks.js (1)
  • sdkForProject (24-55)
lib/parser.js (1)
  • parseBool (176-180)
lib/client.js (2)
lib/parser.js (1)
  • os (6-6)
lib/config.js (1)
  • os (1-1)
lib/commands/storage.js (1)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/tables-db.js (2)
lib/sdks.js (1)
  • sdkForProject (24-55)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/messaging.js (2)
lib/sdks.js (1)
  • sdkForProject (24-55)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/projects.js (2)
lib/sdks.js (1)
  • sdkForConsole (4-22)
lib/parser.js (1)
  • parseBool (176-180)
lib/commands/sites.js (2)
lib/sdks.js (1)
  • sdkForProject (24-55)
lib/parser.js (1)
  • parseBool (176-180)
🔇 Additional comments (29)
install.sh (1)

100-100: LGTM! Version bump is consistent with the release.

The version update to 11.1.0 correctly targets the new release for the CLI download URL.

lib/parser.js (1)

125-125: LGTM! Version string updated for error reporting.

The CLI version in error reports now correctly reflects 11.1.0.

scoop/appwrite.config.json (1)

3-18: LGTM! Scoop manifest updated consistently.

The version and download URLs are correctly updated to 11.1.0 for both x64 and ARM64 architectures.

lib/commands/tokens.js (2)

47-66: LGTM! Total parameter correctly implemented.

The total parameter is properly added to the typedef, function signature, and payload construction. The conditional check ensures it's only included in the payload when defined.


222-222: LGTM! CLI option correctly wired.

The --total flag is properly configured with a parser that defaults to true when provided without a value, and uses parseBool for explicit values. This gives users flexibility:

  • Omit flag: server default behavior
  • --total: calculate total (true)
  • --total true: calculate total (true)
  • --total false: skip calculation (false)
lib/commands/migrations.js (2)

46-68: LGTM! Consistent implementation of total parameter.

The typedef, function signature, and payload handling for the total parameter follow the established pattern from other modules in this PR.


692-692: LGTM! CLI option matches the pattern.

The --total flag implementation is consistent with other list commands in this update.

lib/commands/proxy.js (2)

46-68: LGTM! Total parameter properly integrated.

The implementation follows the consistent pattern established across all list endpoints in this PR.


340-340: LGTM! CLI option correctly configured.

The --total flag is properly wired with the standard parser logic.

lib/commands/vcs.js (2)

296-318: LGTM! Total parameter implementation is consistent.

The typedef, function signature, and payload construction follow the established pattern for the total parameter.


452-452: LGTM! CLI option properly configured.

The --total flag implementation matches the pattern used across other list commands.

lib/commands/storage.js (4)

46-68: LGTM! Total parameter added to listBuckets.

The typedef, function signature, and payload handling for the total parameter in storageListBuckets are correctly implemented.


293-315: LGTM! Total parameter added to listFiles.

The total parameter implementation for storageListFiles follows the same consistent pattern as storageListBuckets.


826-826: LGTM! CLI option for list-buckets.

The --total flag is properly configured for the list-buckets command.


879-879: LGTM! CLI option for list-files.

The --total flag is properly configured for the list-files command.

lib/commands/projects.js (2)

46-46: LGTM: consistent total wiring for projects listings.

Typedefs, params, payload, and CLI options look correct and aligned with parseBool behavior (default true when no value supplied).

Also applies to: 55-69, 977-986, 991-994, 1212-1213, 1221-1229, 1864-1865, 1873-1881, 2118-2120, 2316-2319, 2368-2371, 2519-2522


756-792: Dev-keys endpoint is undocumented and doesn't support total parameter.

Appwrite does not document a REST API endpoint to list/manage dev keys, so there is no documented "total" query/response parameter for a dev-keys list. The projectsListDevKeys function and command should not expose a --total option since the backend doesn't support it.

Likely an incorrect or invalid review comment.

lib/commands/sites.js (1)

46-47: LGTM: total flag added consistently across sites list endpoints and CLI.

Payload only includes total when defined; CLI default true is correct.

Also applies to: 55-69, 568-569, 577-591, 1052-1053, 1061-1072, 1363-1366, 1475-1478, 1554-1556

lib/commands/account.js (1)

188-189: LGTM: total support for account listings is correct.

Threads through typedefs, params, payload, and CLI with sensible default.

Also applies to: 197-208, 283-284, 292-303, 1776-1777, 1794-1795

lib/commands/teams.js (1)

46-47: LGTM: total flag integrated across teams listings and CLI.

Implementation is consistent with other modules.

Also applies to: 55-69, 229-230, 238-249, 267-268, 276-289, 562-565, 599-601, 608-610

lib/commands/tables-db.js (1)

43-85: LGTM! Consistent implementation of the total parameter across all list operations.

The addition of the total parameter to the list-related functions (tablesDBList, tablesDBListTables, tablesDBListColumns, tablesDBListIndexes, tablesDBListRows) is well-implemented:

  • Typedefs correctly updated with the total property and appropriate documentation
  • Function signatures consistently extended to accept the total parameter
  • Conditional payload construction ensures total is only sent when explicitly provided
  • CLI options properly configured with boolean parsing that defaults to true when --total is specified without a value

The pattern is uniform across all affected functions and follows existing codebase conventions.

Also applies to: 470-513, 679-719, 2023-2063, 2220-2264, 2847-2853, 2932-2940, 2979-2987, 3303-3311, 3350-3359

lib/commands/functions.js (1)

43-85: LGTM! Clean implementation of the total parameter for function-related list operations.

The changes to functionsList, functionsListTemplates, functionsListDeployments, and functionsListExecutions follow the same solid pattern as in tables-db.js:

  • Typedef documentation clearly describes the parameter behavior
  • Function signatures properly extended
  • Payload construction uses defensive checking with typeof total !== 'undefined'
  • CLI options configured consistently with appropriate boolean parsing

The implementation is uniform across both files and maintains consistency with the existing codebase architecture.

Also applies to: 251-301, 570-613, 1055-1094, 1422-1429, 1465-1474, 1533-1541, 1613-1620

lib/commands/databases.js (4)

43-68: LGTM! Well-implemented total parameter for databasesList.

The implementation follows a clean pattern:

  • Typedef documents the boolean parameter clearly
  • Function signature properly includes the new parameter
  • Conditional payload construction correctly distinguishes undefined from false
  • CLI option properly parses boolean values

The typeof total !== 'undefined' check ensures backward compatibility—existing callers that don't pass this parameter will continue to work with the server's default behavior.

Also applies to: 2864-2870


470-496: Excellent consistency across all database list endpoints.

The total parameter has been consistently implemented across:

  • databasesListCollections (lines 470-496)
  • databasesListAttributes (lines 679-702)
  • databasesListDocuments (lines 2019-2046)
  • databasesListIndexes (lines 2571-2594)

Each implementation follows the identical pattern for typedefs, function signatures, payload construction, and CLI wiring. This uniformity makes the codebase easier to maintain and reduces the likelihood of bugs.

Also applies to: 679-702, 2019-2046, 2571-2594


2868-2868: CLI option parsing looks correct.

The boolean parsing pattern (value) => value === undefined ? true : parseBool(value) provides intuitive behavior:

  • --totaltrue (explicit opt-in)
  • --total truetrue
  • --total falsefalse (performance optimization)
  • No flag → undefined (server default, backward compatible)

This gives users explicit control while maintaining backward compatibility for existing scripts.

Also applies to: 2955-2955, 3002-3002, 3326-3326, 3459-3459


66-68: The script output confirms backward compatibility is properly maintained. All existing function calls in the codebase (databasesList, databasesListAttributes, databasesListIndexes) are called without the total parameter:

  • lib/questions.js (line 592): databasesList()
  • lib/commands/pull.js (line 301): databasesList()
  • lib/commands/push.js (lines 112, 145): databasesListAttributes() and databasesListIndexes()

The conditional check at lines 66-68 (and the other locations mentioned) correctly excludes total from the payload when undefined, allowing these existing callers to continue working unchanged.

However, verification of the server-side default behavior—whether it correctly calculates totals when the parameter is absent—cannot be confirmed from the client-side codebase alone. This requires checking server-side implementation or API documentation.

lib/commands/users.js (3)

43-68: LGTM! Consistent total parameter implementation.

The total parameter implementation in usersList and usersListIdentities follows the same solid pattern as the databases module:

  • Clear typedef documentation
  • Proper function signature updates
  • Correct conditional payload construction with typeof check
  • Backward compatible design

The consistency across modules ensures predictable behavior for users of the CLI.

Also applies to: 226-251


759-781: Excellent cross-module consistency.

The total parameter has been uniformly implemented across all user list endpoints:

  • usersListLogs (lines 759-781)
  • usersListMemberships (lines 796-822)
  • usersListSessions (lines 1185-1203)
  • usersListTargets (lines 1347-1369)

This matches the pattern used in databases.js and other modules mentioned in the AI summary (account.js, functions.js, etc.), creating a cohesive API experience across the entire CLI.

Also applies to: 796-822, 1185-1203, 1347-1369


1643-1650: CLI options properly implemented across all user commands.

All six user list commands have been updated with the --total option using consistent boolean parsing. The pattern provides intuitive behavior:

  • Omitting the flag maintains backward compatibility
  • Including --total enables explicit control over total count calculation
  • --total false provides performance optimization for large result sets

Also applies to: 1680-1686, 1789-1795, 1797-1804, 1878-1884, 1912-1918

Comment on lines 44 to 47
* @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan
* @property {string} search Search term to filter your list results. Max length: 256 chars.
* @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
* @property {boolean} overrideForCli
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Docs: confirm “total” as a filterable attribute for teams.

The queries doc lists name, total, billingPlan. If “total” isn’t an actual data field filter, remove it to avoid confusion with the boolean flag.


🏁 Script executed:

#!/bin/bash
# Inspect teams list docs/comments across repo for "name, total, billingPlan"
rg -nC2 -P "teams.*queries.*name.*total.*billingPlan" lib || true

Length of output: 0



---

🏁 Script executed:

```shell
#!/bin/bash
# Inspect the actual file around lines 44-47
cat -n lib/commands/teams.js | sed -n '35,60p'

Length of output: 1332


🏁 Script executed:

#!/bin/bash
# Search for team query documentation or filter definitions more broadly
rg -n "name.*billingPlan\|billingPlan.*name" lib/commands/teams.js -A2 -B2

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Look for any "total" mentions in teams.js to understand its role
rg -n "total" lib/commands/teams.js -C3

Length of output: 5849


🏁 Script executed:

#!/bin/bash
# Search for type definitions or JSDoc patterns for listTeams query parameters
rg -n "listTeams\|@property.*queries" lib/commands/teams.js -C3

Length of output: 0


Remove "total" from filterable query attributes—it's a response control, not a data field.

The total parameter is a boolean that controls whether the total count is calculated (line 46), not a filterable attribute for queries. It should not appear in the "You may filter on the following attributes" documentation.

  • Line 44: Remove total from: name, total, billingPlanname, billingPlan
  • Line 560: Remove total from the CLI option description to match

Other list endpoints (e.g., teamsListMemberships, teamsListLogs) correctly exclude total from their filterable attributes lists.

🤖 Prompt for AI Agents
In lib/commands/teams.js around lines 44 to 47 (and also update the CLI option
at line 560), remove "total" from the list of filterable query attributes
because it's a response control, not a data field; change the documentation text
so the attributes read "name, billingPlan" instead of "name, total, billingPlan"
and update the CLI option description at line 560 to no longer mention "total."

@abnegate abnegate merged commit 9961632 into master Nov 3, 2025
1 check 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.

3 participants