feat: Command Line SDK update for version 15.0.0#278
Conversation
WalkthroughBumps SDK and packaging from 14.0.1 to 15.0.0 and updates release URLs and installer metadata. Introduces a breaking redesign: splits Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
* Breaking: Renamed `--specification` to `--build-specification` and added `--runtime-specification`, `--deployment-retention`. * Added `type` filter to `list-invoices` queries. * Added `start-command` option to `sites` creation and update. * Fixed unauthorized error guidance to prompt login.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
lib/commands/services/sites.ts (1)
89-90: Prefer the object-form SDK calls here too.These
create()/update()invocations are still using the positional@appwrite.io/consoleoverloads. The SDK already exposes object-style overloads for both methods and marks the positional forms as deprecated, so this template keeps accumulating fragile argument-order maintenance. (github.com)Also applies to: 200-201
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/commands/services/sites.ts` around lines 89 - 90, Replace the positional create() and update() calls on the Sites client with the SDK's object-form overload to avoid fragile argument ordering: change calls to getSitesClient().create(...) and getSitesClient().update(...) so they pass a single object with keys matching the parameters from the diff (siteId, name, framework, buildRuntime, enabled, logging, timeout, installCommand, buildCommand, startCommand, outputDirectory, adapter, installationId, fallbackFile, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention) and do the same for the other occurrence mentioned (lines ~200-201) so the SDK uses the named-parameter overloads instead of positional args.lib/commands/services/functions.ts (1)
88-89: Prefer the object-form SDK calls here.These
create()/update()invocations are still using the positional@appwrite.io/consoleoverloads. The SDK already exposes object-style overloads for both methods and marks the positional forms as deprecated, so keeping these call sites positional makes every future parameter addition another ordering hazard. (raw.githubusercontent.com)Also applies to: 204-205
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/commands/services/functions.ts` around lines 88 - 89, The create/update calls on getFunctionsClient() are using deprecated positional overloads; change both getFunctionsClient().create(...) and getFunctionsClient().update(...) to use the object-style overload by passing a single object with named properties (e.g., { functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention }) instead of a long positional argument list so future parameter additions won’t break ordering; keep the surrounding parse(...) wrapper and ensure the same set of variables are mapped to the object keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/commands/services/sites.ts`:
- Line 70: Update the help text for the Commander option defined as
.option(`--start-command <start-command>`, ...) to explicitly document how to
reset the value to default by passing an empty string (e.g. --start-command ""),
replacing the ambiguous "Leave empty to use default" wording; apply the same
clarification to the other identical option occurrence in the file (the second
.option(`--start-command <start-command>`, ...) around the later block) so both
usages clearly instruct users to pass an explicit empty string to reset rather
than omitting the option.
---
Nitpick comments:
In `@lib/commands/services/functions.ts`:
- Around line 88-89: The create/update calls on getFunctionsClient() are using
deprecated positional overloads; change both getFunctionsClient().create(...)
and getFunctionsClient().update(...) to use the object-style overload by passing
a single object with named properties (e.g., { functionId, name, runtime,
execute, events, schedule, timeout, enabled, logging, entrypoint, commands,
scopes, installationId, providerRepositoryId, providerBranch,
providerSilentMode, providerRootDirectory, buildSpecification,
runtimeSpecification, deploymentRetention }) instead of a long positional
argument list so future parameter additions won’t break ordering; keep the
surrounding parse(...) wrapper and ensure the same set of variables are mapped
to the object keys.
In `@lib/commands/services/sites.ts`:
- Around line 89-90: Replace the positional create() and update() calls on the
Sites client with the SDK's object-form overload to avoid fragile argument
ordering: change calls to getSitesClient().create(...) and
getSitesClient().update(...) so they pass a single object with keys matching the
parameters from the diff (siteId, name, framework, buildRuntime, enabled,
logging, timeout, installCommand, buildCommand, startCommand, outputDirectory,
adapter, installationId, fallbackFile, providerRepositoryId, providerBranch,
providerSilentMode, providerRootDirectory, buildSpecification,
runtimeSpecification, deploymentRetention) and do the same for the other
occurrence mentioned (lines ~200-201) so the SDK uses the named-parameter
overloads instead of positional args.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a7e2890f-2934-41f1-817c-f00deec18b0b
📒 Files selected for processing (12)
CHANGELOG.mdREADME.mdinstall.ps1install.shlib/client.tslib/commands/services/account.tslib/commands/services/functions.tslib/commands/services/sites.tslib/constants.tslib/sdks.tspackage.jsonscoop/appwrite.config.json
💤 Files with no reviewable changes (1)
- CHANGELOG.md
* Breaking: Replaced `specification` with `buildSpecification` and `runtimeSpecification`; added `deploymentRetention` * Added `startCommand` option for sites * Updated `@appwrite.io/console` to `^5.0.0` * Updated prompts to select `buildSpecification` and `runtimeSpecification` * Fixed unauthorized guests error message to prompt login
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
install.ps1 (1)
1-1:⚠️ Potential issue | 🟡 MinorSave this script as UTF-8 with BOM.
Line 1+ contains Unicode content; current file encoding triggers
PSUseBOMForUnicodeEncodedFileand can cause rendering/parsing inconsistencies on some hosts.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@install.ps1` at line 1, The file contains Unicode on the first line (the comment starting with ## <script src="/dist/scripts/cli-bash.js"></script>) and must be saved using UTF-8 with BOM to satisfy PSUseBOMForUnicodeEncodedFile; update the file encoding to UTF-8 with BOM (e.g., via your editor or an automated save step) so the BOM is present and re-save install.ps1, then verify the BOM is present (or add a CI check) to prevent rendering/parsing issues on hosts that require the BOM.
🧹 Nitpick comments (2)
lib/commands/config.ts (1)
151-151: Add integer and non-negative constraints todeploymentRetentionschema.The field represents a count of days for deployment retention (0 = keep all). Current
z.number().optional()incorrectly accepts fractional values (e.g.,2.5), which are semantically invalid and will fail at the API. Add.int().nonnegative()constraints.♻️ Proposed fix
- deploymentRetention: z.number().optional(), + deploymentRetention: z.number().int().nonnegative().optional(),Also applies to: 169-169
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/commands/config.ts` at line 151, Update the Zod schema entries for deploymentRetention to restrict values to non-negative integers: replace the current z.number().optional() usage for deploymentRetention with z.number().int().nonnegative().optional() so fractional and negative values are rejected; apply this change to both occurrences of the deploymentRetention schema entry (the two places shown in the diff) and keep the existing .optional() semantics (0 means keep all days).lib/questions.ts (1)
462-473: Extract shared specification-to-choice mapping to avoid drift.The same
specifications -> choicesmapping is duplicated in four places. A small helper will reduce maintenance risk and keep behavior consistent.♻️ Suggested refactor
+const mapSpecificationChoices = (specifications: SpecificationChoice[]): Choice[] => + specifications.map((spec) => ({ + name: `${spec.cpus} CPU, ${spec.memory}MB RAM`, + value: spec.slug, + disabled: spec.enabled === false ? "Upgrade to use" : false, + })); // in each prompt: -const choices = specifications.map((spec: SpecificationChoice) => { - return { - name: `${spec.cpus} CPU, ${spec.memory}MB RAM`, - value: spec.slug, - disabled: spec.enabled === false ? "Upgrade to use" : false, - }; -}); -return choices; +return mapSpecificationChoices(specifications);Also applies to: 479-490, 1188-1199, 1205-1216
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/questions.ts` around lines 462 - 473, The mapping from specifications to Inquirer choices is duplicated; extract a small helper (e.g., mapSpecificationToChoice(spec: any): {name: string; value: string; disabled: string|false}) and replace the inline map in the async choices() block (which calls getFunctionsService().listSpecifications()) and the three other duplicated locations (around the other choices blocks at the indicated regions) to call this helper so all places use the same logic for name, value, and disabled fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/questions.ts`:
- Around line 465-470: The four occurrences use spec: any in duplicate mapping
logic; create a single typed utility (e.g., mapSpecToChoice or buildSpecChoice)
that accepts a typed Specification interface (properties: slug: string, cpus:
number, memory: number, enabled?: boolean) and returns the choice object { name,
value, disabled } and replace the inline mappings in questionsCreateFunction
(build/runtime) and questionsCreateSite (build/runtime) with calls to this
utility; ensure the helper is exported or imported where needed and remove all
`any` annotations so the `@typescript-eslint/no-explicit-any` rule is satisfied.
---
Outside diff comments:
In `@install.ps1`:
- Line 1: The file contains Unicode on the first line (the comment starting with
## <script src="/dist/scripts/cli-bash.js"></script>) and must be saved using
UTF-8 with BOM to satisfy PSUseBOMForUnicodeEncodedFile; update the file
encoding to UTF-8 with BOM (e.g., via your editor or an automated save step) so
the BOM is present and re-save install.ps1, then verify the BOM is present (or
add a CI check) to prevent rendering/parsing issues on hosts that require the
BOM.
---
Nitpick comments:
In `@lib/commands/config.ts`:
- Line 151: Update the Zod schema entries for deploymentRetention to restrict
values to non-negative integers: replace the current z.number().optional() usage
for deploymentRetention with z.number().int().nonnegative().optional() so
fractional and negative values are rejected; apply this change to both
occurrences of the deploymentRetention schema entry (the two places shown in the
diff) and keep the existing .optional() semantics (0 means keep all days).
In `@lib/questions.ts`:
- Around line 462-473: The mapping from specifications to Inquirer choices is
duplicated; extract a small helper (e.g., mapSpecificationToChoice(spec: any):
{name: string; value: string; disabled: string|false}) and replace the inline
map in the async choices() block (which calls
getFunctionsService().listSpecifications()) and the three other duplicated
locations (around the other choices blocks at the indicated regions) to call
this helper so all places use the same logic for name, value, and disabled
fields.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d7ed1719-87df-4f8b-8e8d-b2c2d0429cfc
📒 Files selected for processing (12)
CHANGELOG.mdREADME.mdinstall.ps1install.shlib/commands/config.tslib/commands/init.tslib/commands/pull.tslib/commands/push.tslib/constants.tslib/questions.tspackage.jsonscoop/appwrite.config.json
🚧 Files skipped from review as they are similar to previous changes (3)
- lib/constants.ts
- install.sh
- README.md
This PR contains updates to the Command Line SDK for version 15.0.0.
Changes
specificationwithbuildSpecificationandruntimeSpecification; addeddeploymentRetentionstartCommandoption for sites@appwrite.io/consoleto^5.0.0buildSpecificationandruntimeSpecificationSummary by CodeRabbit
Breaking Changes
Bug Fixes
Chores