Skip to content

Conversation

@ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Sep 26, 2025

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

Summary by CodeRabbit

  • Bug Fixes
    • Improved Dart model generation to resolve CLI output issues.
    • Fixed row permissions and security synchronization.
    • Resolved errors when pushing columns with relationships.
    • Corrected terminology for TablesDB indexes (attributes → columns).
  • Documentation
    • Updated README examples to 10.0.1.
    • Clarified platform type options in command help.
    • Refined success messages for pulling from tableDBs.
  • Chores
    • Bumped version to 10.0.1 across CLI, installers, and manifests.
    • Updated download URLs and SDK/user-agent headers.
    • Synced error reporting to the new version.

@coderabbitai
Copy link

coderabbitai bot commented Sep 26, 2025

Walkthrough

Patch release to 10.0.1 across repo: version strings updated in package.json, install scripts (PowerShell/Bash), client headers, parser, README, Scoop manifest, and changelog. CLI commands updated: push migrates to tablesDB APIs, adjusts attribute relationship handling (relatedTable fallback), index creation uses columns, tracks changed tables, and updates success messages; pull text adjusted. Config schema keys switched from documentSecurity→rowSecurity and attributes→columns; added KeyIndexesColumns and wired it into table indexing. Projects command help now lists explicit platform types. Type generation updated: Dart template reworked (ordered attributes, import dedup, (de)serialization tweaks); TypeScript uses type-only Models import.

Possibly related PRs

Suggested reviewers

  • loks0n

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title clearly indicates an update to version 10.0.1 of the Command Line SDK but is overly generic and does not highlight the primary fixes and feature additions introduced in this release. Consider making the title more descriptive and concise by specifying the release version, for example “chore: release v10.0.1,” or by calling out key features like tablesDB support and row permissions improvements.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • 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.

@ChiragAgg5k ChiragAgg5k changed the title feat: Command Line SDK update for version 10.0.0 feat: Command Line SDK update for version 10.0.1 Oct 1, 2025
@abnegate abnegate merged commit ac18baf into master Oct 1, 2025
1 check was pending
@ChiragAgg5k ChiragAgg5k deleted the dev branch October 1, 2025 04:39
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: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09587bb and f962455.

📒 Files selected for processing (14)
  • CHANGELOG.md (1 hunks)
  • README.md (2 hunks)
  • install.ps1 (1 hunks)
  • install.sh (1 hunks)
  • lib/client.js (1 hunks)
  • lib/commands/projects.js (2 hunks)
  • lib/commands/pull.js (2 hunks)
  • lib/commands/push.js (11 hunks)
  • lib/config.js (3 hunks)
  • lib/parser.js (1 hunks)
  • lib/type-generation/languages/dart.js (1 hunks)
  • lib/type-generation/languages/typescript.js (1 hunks)
  • package.json (1 hunks)
  • scoop/appwrite.config.json (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
lib/commands/pull.js (1)
lib/parser.js (2)
  • success (194-196)
  • chalk (1-1)
lib/type-generation/languages/dart.js (1)
lib/type-generation/attribute.js (1)
  • AttributeType (1-12)
lib/commands/push.js (2)
lib/commands/tables-db.js (4)
  • tablesDBUpdate (205-229)
  • tablesDBCreate (95-122)
  • tablesDBGetTable (364-385)
  • tablesDBUpdateTable (402-433)
lib/config.js (1)
  • KeysTable (12-12)
🔇 Additional comments (10)
scoop/appwrite.config.json (1)

3-3: LGTM! Version bump is consistent.

The version and download URLs have been correctly updated to 10.0.1 across all architecture variants.

Also applies to: 9-9, 18-18

package.json (1)

5-5: LGTM! Package version updated correctly.

The version bump to 10.0.1 is consistent with the patch release described in the CHANGELOG.

install.ps1 (1)

16-17: LGTM! Download URLs updated correctly.

Both x64 and arm64 Windows binary URLs have been updated to reference the 10.0.1 release.

install.sh (1)

100-100: LGTM! Version constant updated correctly.

The GITHUB_LATEST_VERSION has been updated to 10.0.1, which will be used to construct the download URL for all platforms.

CHANGELOG.md (1)

3-9: LGTM! Changelog appropriately documents patch fixes.

The 10.0.1 changelog section correctly documents the bug fixes included in this patch release, following the existing format and conventions.

lib/commands/pull.js (1)

361-361: LGTM! Terminology updated for consistency.

The success messages now use "tableDBs" instead of "tables databases", aligning with the tablesDB terminology used throughout the codebase.

Also applies to: 401-401

README.md (1)

32-32: LGTM! Documentation updated to reflect version 10.0.1.

The version verification examples correctly show the new 10.0.1 version output.

Also applies to: 63-63

lib/type-generation/languages/typescript.js (1)

72-72: LGTM! Improved TypeScript import syntax.

The change from import { type Models } to import type { Models } is the preferred TypeScript syntax for type-only imports. This makes the intent more explicit and ensures proper tree-shaking.

lib/commands/projects.js (1)

1237-1237: Nice to see the platform type list spelled out.

Explicit values in both the typedef and CLI help make it much easier for users to discover the supported platform targets.

Also applies to: 2357-2357

lib/config.js (1)

12-13: Schema whitelist keeps pace with the table DB rename.

The new rowSecurity / columns keys and dedicated index whitelist keep local config sanitization aligned with the API.

Also applies to: 65-66, 72-72, 408-409

Comment on lines +19 to +20
'x-sdk-version': '10.0.1',
'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`,
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Avoid hardcoding the version strings.

The version is hardcoded in the SDK headers. This creates maintenance burden and risks version drift. Consider importing the version from package.json for consistency.

Apply this approach:

+const { version } = require('../package.json');
+
 class Client {
   CHUNK_SIZE = 5*1024*1024; // 5MB
 
   constructor() {
     this.endpoint = 'https://cloud.appwrite.io/v1';
     this.headers = {
       'content-type': '',
       'x-sdk-name': 'Command Line',
       'x-sdk-platform': 'console',
       'x-sdk-language': 'cli',
-      'x-sdk-version': '10.0.1',
-      'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`,
+      'x-sdk-version': version,
+      'user-agent' : `AppwriteCLI/${version} (${os.type()} ${os.version()}; ${os.arch()})`,
       'X-Appwrite-Response-Format' : '1.8.0',
     };
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'x-sdk-version': '10.0.1',
'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`,
// lib/client.js
const os = require('os');
const { version } = require('../package.json');
class Client {
CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
constructor() {
this.endpoint = 'https://cloud.appwrite.io/v1';
this.headers = {
'content-type': '',
'x-sdk-name': 'Command Line',
'x-sdk-platform': 'console',
'x-sdk-language': 'cli',
- 'x-sdk-version': '10.0.1',
'x-sdk-version': version,
'user-agent': `AppwriteCLI/${version} (${os.type()} ${os.version()}; ${os.arch()})`,
'X-Appwrite-Response-Format': '1.8.0',
};
}
// ... rest of the class
}
🤖 Prompt for AI Agents
In lib/client.js around lines 19 to 20, the SDK and User-Agent version strings
are hardcoded which can drift; import the package version (e.g.,
require('../package.json').version or appropriate path) at top of the file and
replace the literal '10.0.1' occurrences with that imported variable so both
'x-sdk-version' and the User-Agent interpolate the package version dynamically.

Comment on lines +1781 to 1793
if (remoteTable.name !== table.name) changes.push('name');
if (remoteTable.rowSecurity !== table.rowSecurity) changes.push('rowSecurity');
if (JSON.stringify(remoteTable['$permissions']) !== JSON.stringify(table['$permissions'])) changes.push('permissions');

if (changes.length > 0) {
await tablesDBUpdateTable({
databaseId: table['databaseId'],
tableId: table['$id'],
name: table.name,
parseOutput: false
parseOutput: false,
rowSecurity: table.rowSecurity,
permissions: table['$permissions']
})
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

Don't drop table enabled updates

We no longer propagate the table enabled flag when pushing. Any change to enabled in appwrite.config.json now silently does nothing, and newly created tables always come up with the API default instead of the configured state. Please wire the flag back into the change detection and into the create/update payloads so pushes keep tables enabled/disabled as intended.

Apply this diff to restore the missing behavior:

             const changes = [];
             if (remoteTable.name !== table.name) changes.push('name');
             if (remoteTable.rowSecurity !== table.rowSecurity) changes.push('rowSecurity');
+            if (remoteTable.enabled !== table.enabled) changes.push('enabled');
             if (JSON.stringify(remoteTable['$permissions']) !== JSON.stringify(table['$permissions'])) changes.push('permissions');

             if (changes.length > 0) {
                 await tablesDBUpdateTable({
                     databaseId: table['databaseId'],
                     tableId: table['$id'],
                     name: table.name,
                     parseOutput: false,
                     rowSecurity: table.rowSecurity,
-                    permissions: table['$permissions']
+                    permissions: table['$permissions'],
+                    enabled: table.enabled
                 })
@@
                 await tablesDBCreateTable({
                     databaseId: table['databaseId'],
                     tableId: table['$id'],
                     name: table.name,
                     rowSecurity: table.rowSecurity,
-                    permissions: table['$permissions'],
+                    permissions: table['$permissions'],
+                    enabled: table.enabled,
                     parseOutput: false
                 })

Also applies to: 1805-1811

🤖 Prompt for AI Agents
In lib/commands/push.js around lines 1781-1793 (and similarly 1805-1811), the
table 'enabled' flag is not being compared or sent to the API; add a comparison
that pushes 'enabled' into the changes array when remoteTable.enabled !==
table.enabled, and include enabled: table.enabled in the payload passed to
tablesDBUpdateTable (and the equivalent create call around 1805-1811) so both
update and create requests carry the configured enabled state.

}

const version = '10.0.0';
const version = '10.0.1';
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Avoid hardcoding the version string.

The version is hardcoded here but package.json is already imported at the top of the file (line 4). Hardcoding creates a maintenance burden and risks version drift between this file and package.json.

Apply this diff to use the version from package.json:

+const { description, version } = require('../package.json');
-const { description } = require('../package.json');

Then update line 125:

-            const version = '10.0.1';
+            // version is now imported from package.json above
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const version = '10.0.1';
// lib/parser.js
// (near line 4)
const { description, version } = require('../package.json');
// …
// (around line 125)
// version is now imported from package.json above
🤖 Prompt for AI Agents
In lib/parser.js around line 125, the version is hardcoded as '10.0.1' which can
drift from package.json (already imported at line 4); replace the hardcoded
assignment with a reference to the imported package.json version (e.g., use the
imported package object’s version property) so the file reads the version from
package.json instead of a literal string.

Comment on lines 133 to 134
map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%>
<%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%>
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

Compilation breaks: firstOrNull is undefined in generated Dart.

Iterable doesn’t expose firstOrNull in the standard Dart SDK, so generated models fail to compile unless consumers add their own extension/import. Please stick with firstWhere (with the null guard you already have) so optional enums still deserialize correctly.

- map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null
+ map['<%= attribute.key %>'] != null
+     ? <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])
+     : null
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%>
<%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%>
// before (optional enum branch)
map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%>
<%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%>
// after applying the diff
map['<%= attribute.key %>'] != null
? <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])
: null<% } else { -%>
<%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%>
🤖 Prompt for AI Agents
In lib/type-generation/languages/dart.js around lines 133-134, replace the
non-existent Iterable.firstOrNull usage with firstWhere(..., orElse: () => null)
so the generated Dart uses the standard SDK API (e.g. map['key'] != null ?
EnumType.values.where((e) => e.name == map['key']).firstWhere((e) => true,
orElse: () => null) : null — implement it properly to return the found element
or null); update the template to use firstWhere with an orElse that returns null
so optional enum deserialization compiles without extra extensions or imports.

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