Skip to content

feat: Command Line SDK update for version 17.1.0#284

Merged
ChiragAgg5k merged 1 commit intomasterfrom
dev
Mar 28, 2026
Merged

feat: Command Line SDK update for version 17.1.0#284
ChiragAgg5k merged 1 commit intomasterfrom
dev

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

@ChiragAgg5k ChiragAgg5k commented Mar 28, 2026

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

Changes

  • Added organizations command group with multiple subcommands
  • Added --raw option for full raw JSON output in version command
  • Updated docs for organizations commands with new examples

Summary by CodeRabbit

  • New Features

    • Introduced organizations command group with 40+ subcommands for managing organizations, billing, plans, keys, invoices, and credits.
    • Added --raw flag for unfiltered JSON output in CLI commands.
    • Improved output formatting for tables and JSON responses.
  • Documentation

    • Added comprehensive examples for all organizations command subcommands.
  • Chores

    • Updated CLI version to 17.1.0.

* Added `organizations` command group with multiple subcommands
* Added `--raw` option for full raw JSON output in version command
* Updated docs for `organizations` commands with new examples
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Walkthrough

This release adds version 17.1.0 with three main components: a new organizations CLI command service exposing console-level organization management operations, a global --raw flag for unfiltered JSON output, and enhancements to output formatting and SDK client initialization. Version numbers were bumped across package metadata, installation scripts, and documentation. Forty documentation example files were added demonstrating organizations subcommands. Several service modules now use console-scoped SDK clients instead of project-scoped ones, and the JWT manager was refactored to support project-scoped user operations.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: Command Line SDK update for version 17.1.0' directly summarizes the main change: updating the CLI to version 17.1.0 with new organizations command and --raw option.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 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.

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 28, 2026

Greptile Summary

This PR delivers the CLI update for Appwrite SDK v17.1.0. The main additions are a new organizations command group (37 subcommands for billing, payment methods, API keys, and plan management), a global --raw flag for unfiltered JSON output, and a set of SDK client fixes that move several services (projects, migrations, proxy, vcs) from project-level to console-level authentication. A genuine bug fix is also included: lib/emulation/utils.ts now correctly initialises the Users client with sdkForProject() instead of the console client for JWT refresh logic.

Key findings:

  • The organizations command's help description will be empty at runtime — commandDescriptions["organizations"] is never populated in lib/parser.ts.
  • success is imported but never used in organizations.ts.
  • Several --organization-id option descriptions in the new organizations commands still read "Team ID." (copy-paste artifact from teams commands), including in delete, estimation-delete-organization, and list-regions.
  • The --aggregation-id option in get-aggregation carries the description "Invoice unique ID", another copy-paste error.
  • --json output now silently omits top-level nested objects (filtered by filterData), which is an undocumented behavioral change. Existing scripts relying on --json to access nested fields (e.g. prefs, labels) will silently receive missing data; users must switch to --raw to replicate the old behavior. This change is not mentioned in the CHANGELOG.

Confidence Score: 4/5

Safe to merge after fixing the empty organizations command description and documenting the --json behavioral change in CHANGELOG; all other findings are minor copy-paste errors.

No P0 or hard runtime-breaking issues found. The empty commandDescriptions["organizations"] entry means appwrite organizations --help shows no description (poor UX, not a crash). The silent removal of nested objects from --json output is the most impactful change — it can silently break automation scripts without any error message, and it is undocumented. All remaining issues (unused import, wrong option descriptions) are copy-paste style errors with no runtime impact. Score is 4 rather than 5 because of the undocumented --json behavior change and missing command description.

lib/commands/services/organizations.ts (copy-paste description errors, unused import, missing commandDescriptions entry) and lib/parser.ts (undocumented --json behavioral change)

Important Files Changed

Filename Overview
lib/commands/services/organizations.ts New 517-line organizations command group with 37 subcommands; has unused success import, several copy-paste description errors ("Team ID." instead of "Organization ID." and "Invoice unique ID" for --aggregation-id), and missing entry in commandDescriptions
lib/parser.ts Adds --raw flag, BigInt polyfill, filterData/filterObject helpers, and enhanced table rendering; --json mode now silently drops top-level nested objects (requires --raw for previous full behavior) — undocumented behavioral change
lib/emulation/utils.ts Bug fix: Users client now correctly uses sdkForProject() instead of the console client for JWT refresh user lookup
lib/commands/services/teams.ts Adds helpful error hint redirecting users to organizations command when project context is missing
lib/commands/services/migrations.ts Switches SDK client from sdkForProject to sdkForConsole, aligning with console-level access pattern
lib/commands/services/projects.ts Switches SDK client from sdkForProject to sdkForConsole — correct, as project management is a console-level operation
cli.ts Registers new organizations command, adds global -R/--raw flag, and wires cliConfig.raw handler
lib/types.ts Adds raw: boolean field to CliConfig interface to support the new --raw flag

Comments Outside Diff (1)

  1. lib/commands/services/organizations.ts, line 563 (link)

    P2 Missing commandDescriptions["organizations"] entry

    commandDescriptions["organizations"] resolves to undefined at runtime, so the command's --help output will display an empty description string (due to the ?? "" fallback). Every other service command has a corresponding entry in the commandDescriptions record in lib/parser.ts.

    An entry like the following should be added to the commandDescriptions object in lib/parser.ts:

    organizations: `The organizations command allows you to manage your Appwrite organizations, billing plans, payment methods, and API keys.`,

Reviews (1): Last reviewed commit: "feat: update Command Line SDK to 17.1.0" | Re-trigger Greptile

Copy link
Copy Markdown

@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: 7

🧹 Nitpick comments (1)
lib/commands/services/organizations.ts (1)

100-112: Minor typo in description: "it's" → "its"

Line 102 has a grammatical error: "it's aggregation ID" should be "its aggregation ID" (possessive, not contraction).

📝 Proposed fix
 organizations
   .command(`get-aggregation`)
-  .description(`Get a specific aggregation using it's aggregation ID.`)
+  .description(`Get a specific aggregation using its aggregation ID.`)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/commands/services/organizations.ts` around lines 100 - 112, Update the
description string for the organizations.command(`get-aggregation`) entry to use
the correct possessive "its" instead of the contraction "it's" (change "Get a
specific aggregation using it's aggregation ID." to "Get a specific aggregation
using its aggregation ID."). Locate the description passed to
organizations.command(`get-aggregation`) in organizations.ts and edit that
literal to fix the typo.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/examples/organizations/create-key.md`:
- Line 5: Replace the literal scope values in the example command so it uses the
documented placeholder convention; specifically update the `--scopes` argument
from the literal "one two three" to a placeholder like `<SCOPES>` (or `<SCOPE_1>
<SCOPE_2> <SCOPE_3>`), ensuring the `--scopes` flag in the example matches other
placeholders such as `<ORGANIZATION_ID>` and `<NAME>`.

In `@docs/examples/organizations/update-budget.md`:
- Line 4: Replace the literal usage of "--budget 0" with a placeholder to match
the rest of the docs; update the example to use a placeholder like "--budget
<BUDGET>" (or "<NEW_BUDGET>") so readers understand it’s an example value rather
than the intended literal value, and ensure the placeholder name matches
conventions used elsewhere in the examples.

In `@lib/commands/services/organizations.ts`:
- Around line 3-10: The import list in organizations.ts includes an unused
symbol `success` from the parser module; remove `success` from the named imports
(the line importing actionRunner, commandDescriptions, success, parse,
parseBool, parseInteger from "../../parser.js") so only used symbols remain, and
run the linter/format step to ensure import formatting is updated accordingly.
- Around line 252-262: The command organizations.command('get-invoice-download')
incorrectly treats the return of getInvoiceDownload as JSON and calls parse();
add a required option --destination and change the action (inside actionRunner)
to follow the file-download pattern used elsewhere: call (await
getOrganizationsClient()).getInvoiceDownload(organizationId, invoiceId) to get
the URL, fetch the URL, convert response.arrayBuffer() to a Buffer,
fs.writeFileSync(destination, buffer), and call success(`File saved to
${destination}`); remove the parse(...) call and ensure the option name used in
the action matches the new --destination parameter.
- Around line 138-149: The --alerts option on the
organizations.command('update-budget') currently passes alerts as strings to the
SDK; ensure the alerts are parsed to integers before calling updateBudget by
either applying parseInteger to each alert when defining the option or mapping
alerts through parseInteger inside the actionRunner callback (the async handler
that calls getOrganizationsClient().updateBudget). Update the handler signature
that receives { organizationId, budget, alerts } to convert alerts to numeric
percentages (handle undefined) and then call updateBudget with the numeric
array; keep using parse for the response and verify SDK/updateBudget type
expects numbers.

In `@lib/parser.ts`:
- Around line 194-206: In rows.map (producing rowEntries) the code currently
skips object/array values and avoids using formatCellValue, causing fields to
disappear in condensed-table fallback; update the logic in the rowEntries
builder to not continue on object values but instead call formatCellValue(value)
for non-function, non-null values (including objects/arrays and long
strings/BigNumber fallback), push the resulting string into entries ([key,
formattedValue]), and apply the same change to the similar block around the
other occurrence referenced (lines ~223-225) so condensed mode shows “[N items]”
/ “{N keys}” and truncated scalars consistently via formatCellValue.
- Around line 61-104: The current filterObject and filterData implementations
drop object-valued fields (they use "continue" for typeof value === 'object')
and only partially handle arrays, which makes --json lossy; fix by making
filterObject and filterData recursively preserve and clean nested objects/arrays
instead of skipping them (e.g., in filterObject, when value is an object or
array call into the same recursive cleaning logic rather than continue; in
filterData, map arrays recursively and call filterObject for nested plain
objects), and add a separate opt-in compact projection (rename the compact logic
to something like compactFilter and only use it when an explicit flag is passed)
so the default --json behavior remains fully compatible.

---

Nitpick comments:
In `@lib/commands/services/organizations.ts`:
- Around line 100-112: Update the description string for the
organizations.command(`get-aggregation`) entry to use the correct possessive
"its" instead of the contraction "it's" (change "Get a specific aggregation
using it's aggregation ID." to "Get a specific aggregation using its aggregation
ID."). Locate the description passed to organizations.command(`get-aggregation`)
in organizations.ts and edit that literal to fix the typo.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 94079067-64c1-43a6-8869-29c0efbdbb5c

📥 Commits

Reviewing files that changed from the base of the PR and between 33f4f5e and a0a66df.

📒 Files selected for processing (57)
  • CHANGELOG.md
  • README.md
  • cli.ts
  • docs/examples/organizations/add-credit.md
  • docs/examples/organizations/cancel-downgrade.md
  • docs/examples/organizations/create-downgrade-feedback.md
  • docs/examples/organizations/create-invoice-payment.md
  • docs/examples/organizations/create-key.md
  • docs/examples/organizations/create.md
  • docs/examples/organizations/delete-backup-payment-method.md
  • docs/examples/organizations/delete-default-payment-method.md
  • docs/examples/organizations/delete-key.md
  • docs/examples/organizations/delete.md
  • docs/examples/organizations/estimation-create-organization.md
  • docs/examples/organizations/estimation-delete-organization.md
  • docs/examples/organizations/estimation-update-plan.md
  • docs/examples/organizations/get-aggregation.md
  • docs/examples/organizations/get-available-credits.md
  • docs/examples/organizations/get-credit.md
  • docs/examples/organizations/get-invoice-download.md
  • docs/examples/organizations/get-invoice-view.md
  • docs/examples/organizations/get-invoice.md
  • docs/examples/organizations/get-key.md
  • docs/examples/organizations/get-plan.md
  • docs/examples/organizations/get-scopes.md
  • docs/examples/organizations/get-usage.md
  • docs/examples/organizations/list-aggregations.md
  • docs/examples/organizations/list-credits.md
  • docs/examples/organizations/list-keys.md
  • docs/examples/organizations/list-regions.md
  • docs/examples/organizations/list.md
  • docs/examples/organizations/set-backup-payment-method.md
  • docs/examples/organizations/set-billing-address.md
  • docs/examples/organizations/set-billing-email.md
  • docs/examples/organizations/set-billing-tax-id.md
  • docs/examples/organizations/set-default-payment-method.md
  • docs/examples/organizations/update-budget.md
  • docs/examples/organizations/update-key.md
  • docs/examples/organizations/update-plan.md
  • docs/examples/organizations/validate-invoice.md
  • docs/examples/organizations/validate-payment.md
  • install.ps1
  • install.sh
  • lib/commands/services/migrations.ts
  • lib/commands/services/organizations.ts
  • lib/commands/services/projects.ts
  • lib/commands/services/proxy.ts
  • lib/commands/services/teams.ts
  • lib/commands/services/vcs.ts
  • lib/constants.ts
  • lib/emulation/utils.ts
  • lib/parser.ts
  • lib/questions.ts
  • lib/sdks.ts
  • lib/types.ts
  • package.json
  • scoop/appwrite.config.json

@ChiragAgg5k ChiragAgg5k merged commit aa548b6 into master Mar 28, 2026
3 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