Skip to content

feat: Command Line SDK update for version 20.2.0#308

Open
ArnabChatterjee20k wants to merge 1 commit intomasterfrom
clean-no-presences-20260508-1106
Open

feat: Command Line SDK update for version 20.2.0#308
ArnabChatterjee20k wants to merge 1 commit intomasterfrom
clean-no-presences-20260508-1106

Conversation

@ArnabChatterjee20k
Copy link
Copy Markdown
Member

This PR contains updates to the Command Line SDK for version 20.2.0.\n\nThis branch is generated from master to avoid legacy dev-branch history (e.g. removed presences artifacts).

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 8, 2026

Greptile Summary

This PR bumps the CLI SDK from 20.1.0 to 20.2.0, adding the new presences service, bigint attribute/column commands for Databases and TablesDB, pagination for several list endpoints, and a --variable-id requirement on create-variable for functions, sites, and project.

  • New presences service: six commands (list, get, upsert, update-presence, delete, get-usage) wired up following the singleton-client pattern used by all other services.
  • Bigint support: create-big-int-attribute / update-big-int-attribute in Databases and create-big-int-column / update-big-int-column in TablesDB; all three numeric flags use parseInteger, which cannot represent full 64-bit values.
  • Breaking renames and removals: proxy update-rule-verification \u2192 update-rule-status; project get-o-auth-2-provider --provider \u2192 --provider-id; login --switch / --new flags dropped.

Confidence Score: 3/5

The new bigint commands will silently corrupt large boundary values and the --provider rename will break existing scripts at runtime.

Two distinct defects in new code: parseInteger (JS number precision cap) is the wrong parser for a 64-bit integer API field, affecting both Databases and TablesDB bigint commands; and the option rename from --provider to --provider-id is a silent breaking change with no alias or deprecation path. The remaining changes follow existing patterns correctly.

lib/commands/services/databases.ts and lib/commands/services/tables-db.ts (bigint precision); lib/commands/services/project.ts (option rename).

Important Files Changed

Filename Overview
lib/commands/services/presences.ts New service file wiring up the Presences API (list, get, upsert, update-presence, delete, get-usage) following the established singleton-client pattern used by all other services.
lib/commands/services/databases.ts Adds create-big-int-attribute and update-big-int-attribute commands; parseInteger (backed by JS parseInt) is used for bigint min/max/default, silently truncating values above Number.MAX_SAFE_INTEGER.
lib/commands/services/tables-db.ts Adds create-big-int-column and update-big-int-column commands with the same parseInteger precision issue as databases.ts.
lib/commands/services/project.ts Adds pagination to list-o-auth-2-providers and a new get-o-auth-2-provider command; the old --provider flag was silently replaced with --provider-id, breaking existing scripts.
lib/commands/services/proxy.ts Renames update-rule-verification to update-rule-status and removes the --search option from list-rules; both are intentional API changes for 20.2.0.
lib/commands/generic.ts Removes --switch/--new login flags and the isRegionalCloudEndpoint / getCurrentAccount helpers; running login while already authenticated no longer short-circuits.
lib/commands/services/functions.ts Adds --variable-id as a required argument to create-variable, changes --key to optional in update-variable, and adds pagination options to list-variables.
lib/commands/services/sites.ts Mirrors the functions.ts changes: adds --variable-id requirement on create-variable, makes --key optional in update-variable, and adds pagination to list-variables.

Comments Outside Diff (1)

  1. lib/commands/services/project.ts, line 298-309 (link)

    P1 Breaking rename: --provider--provider-id

    The get-o-auth-2-provider subcommand previously accepted --provider <key> and now requires --provider-id <key>. Any existing script or CI job using appwrite project get-o-auth-2-provider --provider github will fail with an "unknown option" error after upgrading to 20.2.0. The renamed option maps to a different camelCase identifier (providerId vs provider) so the old flag cannot be silently ignored — it will break at runtime. If backwards compatibility is needed, adding an alias or a deprecation warning for the old flag would help.

Reviews (1): Last reviewed commit: "feat: Command Line SDK update for versio..." | Re-trigger Greptile

Comment on lines +376 to +397
.requiredOption(`--key <key>`, `Attribute Key.`)
.requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
.option(`--min <min>`, `Minimum value`, parseInteger)
.option(`--max <max>`, `Maximum value`, parseInteger)
.option(`--xdefault <xdefault>`, `Default value. Cannot be set when attribute is required.`, parseInteger)
.option(
`--array [value]`,
`Is attribute an array?`,
(value: string | undefined) =>
value === undefined ? true : parseBool(value),
)
.action(
actionRunner(
async ({ databaseId, collectionId, key, required, min, max, xdefault, array }) =>
parse(await (await getDatabasesClient()).createBigIntAttribute(databaseId, collectionId, key, required, min, max, xdefault, array)),
),
);


const databasesUpdateBigIntAttributeCommand = databases
.command(`update-big-int-attribute`)
.description(`Update a bigint attribute. Changing the \`default\` value will not update already existing documents.
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 parseInteger loses precision for large bigint values

parseInteger calls parseInt(value, 10) which converts to a JavaScript number, capping precision at Number.MAX_SAFE_INTEGER (2^53 − 1 ≈ 9.007 × 10^15). A 64-bit bigint can hold values up to 9.22 × 10^18, so any --min, --max, or --xdefault value larger than the safe integer limit will be silently truncated before being sent to the API. The same issue appears in tablesDBCreateBigIntColumnCommand and tablesDBUpdateBigIntColumnCommand in tables-db.ts.

Comment on lines 367 to +413
);


const tablesDBCreateBigIntColumnCommand = tablesDB
.command(`create-big-int-column`)
.description(`Create a bigint column. Optionally, minimum and maximum values can be provided.
`)
.requiredOption(`--database-id <database-id>`, `Database ID.`)
.requiredOption(`--table-id <table-id>`, `Table ID.`)
.requiredOption(`--key <key>`, `Column Key.`)
.requiredOption(`--required <required>`, `Is column required?`, parseBool)
.option(`--min <min>`, `Minimum value`, parseInteger)
.option(`--max <max>`, `Maximum value`, parseInteger)
.option(`--xdefault <xdefault>`, `Default value. Cannot be set when column is required.`, parseInteger)
.option(
`--array [value]`,
`Is column an array?`,
(value: string | undefined) =>
value === undefined ? true : parseBool(value),
)
.action(
actionRunner(
async ({ databaseId, tableId, key, required, min, max, xdefault, array }) =>
parse(await (await getTablesDBClient()).createBigIntColumn(databaseId, tableId, key, required, min, max, xdefault, array)),
),
);


const tablesDBUpdateBigIntColumnCommand = tablesDB
.command(`update-big-int-column`)
.description(`Update a bigint column. Changing the \`default\` value will not update already existing rows.
`)
.requiredOption(`--database-id <database-id>`, `Database ID.`)
.requiredOption(`--table-id <table-id>`, `Table ID.`)
.requiredOption(`--key <key>`, `Column Key.`)
.requiredOption(`--required <required>`, `Is column required?`, parseBool)
.requiredOption(`--xdefault <xdefault>`, `Default value. Cannot be set when column is required.`, parseInteger)
.option(`--min <min>`, `Minimum value`, parseInteger)
.option(`--max <max>`, `Maximum value`, parseInteger)
.option(`--new-key <new-key>`, `New Column Key.`)
.action(
actionRunner(
async ({ databaseId, tableId, key, required, xdefault, min, max, newKey }) =>
parse(await (await getTablesDBClient()).updateBigIntColumn(databaseId, tableId, key, required, xdefault, min, max, newKey)),
),
);

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 parseInteger precision loss for bigint column values

Same issue as in databases.ts: --min, --max, and --xdefault for create-big-int-column and update-big-int-column use parseInteger (backed by parseInt, a 53-bit safe integer), which silently truncates any value beyond Number.MAX_SAFE_INTEGER. Valid 64-bit bigint boundary values will be corrupted before the API call is made.

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