Skip to content

Conversation

@ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Sep 18, 2025

This PR contains updates to the Command Line SDK for version 10.0.0

Summary by CodeRabbit

  • Breaking Changes

    • Removed the Avatars CLI command and its subcommands (examples removed).
  • New Features

    • Geo defaults now accept coordinate arrays for databases and tables with automatic normalization.
    • Pull command now skips deprecated resources by default and reports clearer totals.
    • CLI help updated: databases marked legacy; added commands for tables-db, projects, and project.
  • Bug Fixes

    • Type generation now quotes invalid property names to produce valid TypeScript typings.
  • Documentation

    • Updated examples and help text to reflect the above changes.

@coderabbitai
Copy link

coderabbitai bot commented Sep 18, 2025

Walkthrough

This change removes the avatars CLI command by deleting lib/commands/avatars.js and removing its wiring in index.js, and deletes related avatars docs examples. It updates databases and tables-db command handlers and typedefs to accept coordinate-based xdefault values with runtime normalization (coercing true to []) and updates associated CLI help text and JSDoc. pull.js now calls pullResources with skipDeprecated: true by default and refactors collection/table counting and messages. lib/parser.js updates command descriptions (marks databases as legacy and adds tables-db, projects, project). TypeScript type generation now conditionally quotes non‑identifier property keys in emitted types. Package/version and installer URLs updated to 10.0.0 and changelog/README/client parser version strings adjusted accordingly.

Possibly related PRs

  • Dev #193 — Overlapping changes to codegen and CLI command descriptions (touches lib/type-generation/languages/typescript.js and lib/parser.js), indicating a strong code-level connection.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
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.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "feat: Command Line SDK update for version 10.0.0" is concise and accurately summarizes the primary intent of the changeset — a CLI SDK release/version bump to 10.0.0 and associated CLI updates (reflected in package/client version changes, changelog, install scripts, and CLI behavior). It is specific, developer-focused, and avoids noisy details or file lists while remaining clear enough for someone scanning PR history. It does not need to list every individual change to be an effective PR title.
✨ 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 9.1.0 feat: Command Line SDK update for version 10.0.0 Sep 18, 2025
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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
lib/commands/pull.js (3)

43-49: Filter deprecated resources out of the prompt when skipDeprecated=true

Prevents users from selecting an unavailable option.

-        const answers = await inquirer.prompt(questionsPullResources[0]);
+        // Filter deprecated choices out of the prompt
+        let q = { ...questionsPullResources[0] };
+        if (skipDeprecated && Array.isArray(q.choices)) {
+            const blocked = new Set(['collection', 'collections']);
+            q.choices = q.choices.filter(c => {
+                const v = typeof c === 'string' ? c : (c.value ?? c.name);
+                return !blocked.has(v);
+            });
+        }
+        const answers = await inquirer.prompt(q);
@@
-        if (action !== undefined) {
-            await action({ returnOnZero: true });
-        }
+        if (action !== undefined) {
+            await action({ returnOnZero: true });
+        } else {
+            warn("Selected resource is deprecated or unavailable in this CLI version.");
+        }

367-373: Tables flow prompts the wrong source (uses collections prompt)

Using questionsPullCollection here likely lists Document DBs, not Tables DBs—interactive tables pull will mis-target or fail. Prompt from tablesDBList or a dedicated questionsPullTables.

-        } else {
-            databases = (await inquirer.prompt(questionsPullCollection)).databases;
-        }
+        } else {
+            // Prompt for Tables DBs
+            const dbs = (await paginate(tablesDBList, { parseOutput: false }, 100, 'databases')).databases;
+            const { databases: picked } = await inquirer.prompt([{
+                type: 'checkbox',
+                name: 'databases',
+                message: 'Select Tables databases',
+                choices: dbs.map(db => ({ name: `${db.name} (${db.$id})`, value: db.$id }))
+            }]);
+            databases = picked;
+        }

If you prefer centralized questions, add questionsPullTables in ../questions and use it here.


19-35: Filter interactive choices when deprecating 'collections' (avoid silent no-op)

skipDeprecated=true deletes actions.collections, but questionsPullResources still lists "Collections"; selecting it yields action === undefined and the command silently does nothing.

  • Evidence: lib/questions.js contains the "Collections" choice (lines 260–263 and 672–675). lib/commands/pull.js deletes actions.collections (lines ~19–35) then prompts with questionsPullResources[0] and looks up action = actions[answers.resource]; when undefined nothing is executed (lines ~43–46).
  • Fix (choose one): a) Before calling inquirer.prompt, filter questionsPullResources[0].choices to only include values present in Object.keys(actions) (recommended); b) generate the prompt choices dynamically from the actions object; or c) detect action === undefined and show a clear warning + re-prompt.
🧹 Nitpick comments (7)
lib/commands/pull.js (2)

361-362: Copy edit: “tables databases” → “Tables databases” (or “Tables DBs”)

Minor UX polish on success strings.

-        success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tables databases.`);
+        success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} Tables databases.`);
@@
-    success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tables databases.`);
+    success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} Tables databases.`);

Also applies to: 401-401


483-491: Grammar nit and behavior LGTM

Fix minor grammar; keeping skipDeprecated=true for “all” is consistent.

-    .description("Pull all resource.")
+    .description("Pull all resources.")
lib/type-generation/languages/typescript.js (1)

93-95: Quote invalid TS property keys via JSON.stringify to avoid escaping bugs

If a key contains quotes or escape-worthy chars, emitting manual quotes can break the declaration. Let EJS/JSON handle escaping.

Apply this diff:

-    <% if (isValidIdentifier) { %><%- propertyName %><% } else { %>"<%- propertyName %>"<% } %>: <%- getType(attribute, collections) %>;
+    <% if (isValidIdentifier) { %><%- propertyName %><% } else { %><%- JSON.stringify(propertyName) %><% } %>: <%- getType(attribute, collections) %>;
lib/commands/tables-db.js (2)

1188-1188: Tighten JSDoc types for geometric defaults

Use precise shapes to aid consumers and editors.

Apply this diff:

- * @property {any[]} xdefault Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.
+ * @property {number[][]} xdefault Default value when not provided. Two-dimensional array of [longitude, latitude] coordinate pairs, in order. Cannot be set when column is required.

- * @property {any[]} xdefault Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.
+ * @property {number[][]} xdefault Default value when not provided. Two-dimensional array of [longitude, latitude] coordinate pairs, in order. Cannot be set when column is required.

- * @property {any[]} xdefault Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required.
+ * @property {number[]} xdefault Default value when not provided. Array [longitude, latitude]. Cannot be set when column is required.

- * @property {any[]} xdefault Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required.
+ * @property {number[]} xdefault Default value when not provided. Array [longitude, latitude]. Cannot be set when column is required.

- * @property {any[]} xdefault Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required.
+ * @property {number[][][]} xdefault Default value when not provided. Three-dimensional array of rings: [[[lon, lat], …], …]. First ring is exterior; subsequent rings are holes. Each ring must start and end with the same coordinate pair. Cannot be set when column is required.

- * @property {any[]} xdefault Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required.
+ * @property {number[][][]} xdefault Default value when not provided. Three-dimensional array of rings: [[[lon, lat], …], …]. First ring is exterior; subsequent rings are holes. Each ring must start and end with the same coordinate pair. Cannot be set when column is required.

Also applies to: 1232-1232, 1277-1277, 1321-1321, 1366-1366, 1410-1410


2838-2838: Clarify CLI expects JSON for --xdefault

Add an example to reduce user errors; pairs well with runtime parsing.

Apply this diff pattern to each geometry option description:

-    .option(`--xdefault <xdefault>`, `Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.`)
+    .option(`--xdefault <xdefault>`, `Default value (JSON). Example: "[[12.34, 56.78], [23.45, 67.89]]". Cannot be set when column is required.`)

Similarly:

  • point: Example "[12.34, 56.78]"
  • polygon: Example "[[[12.34,56.78],[...],[12.34,56.78]]]" (first ring closed)

Also applies to: 2843-2843, 2848-2848, 2853-2853, 2859-2859, 2864-2864, 2869-2869, 2874-2874, 2880-2880, 2885-2885, 2890-2890, 2895-2895

lib/commands/databases.js (2)

1188-1188: Tighten JSDoc types for geometric defaults

Mirror the tables-db JSDoc improvements for precision.

Apply this diff:

- * @property {any[]} xdefault Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.
+ * @property {number[][]} xdefault Default value when not provided. Two-dimensional array of [longitude, latitude] coordinate pairs, in order. Cannot be set when attribute is required.

- * @property {any[]} xdefault Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.
+ * @property {number[][]} xdefault Default value when not provided. Two-dimensional array of [longitude, latitude] coordinate pairs, in order. Cannot be set when attribute is required.

- * @property {any[]} xdefault Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.
+ * @property {number[]} xdefault Default value when not provided. Array [longitude, latitude]. Cannot be set when attribute is required.

- * @property {any[]} xdefault Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.
+ * @property {number[]} xdefault Default value when not provided. Array [longitude, latitude]. Cannot be set when attribute is required.

- * @property {any[]} xdefault Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.
+ * @property {number[][][]} xdefault Default value when not provided. Three-dimensional array of rings: [[[lon, lat], …], …]. First ring is exterior; subsequent rings are holes. Each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.

- * @property {any[]} xdefault Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.
+ * @property {number[][][]} xdefault Default value when not provided. Three-dimensional array of rings: [[[lon, lat], …], …]. First ring is exterior; subsequent rings are holes. Each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.

Also applies to: 1232-1232, 1277-1277, 1321-1321, 1366-1366, 1410-1410


2860-2860: Clarify CLI expects JSON for --xdefault

Same UX improvement as tables-db commands; add examples to reduce invalid input.

Example diff:

-    .option(`--xdefault <xdefault>`, `Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.`)
+    .option(`--xdefault <xdefault>`, `Default value (JSON). Example: "[12.34, 56.78]". Cannot be set when attribute is required.`)

Also applies to: 2876-2876, 2881-2881, 2891-2891, 2902-2902, 2912-2912

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71e8c88 and ebbe7e9.

📒 Files selected for processing (14)
  • docs/examples/avatars/get-browser.md (0 hunks)
  • docs/examples/avatars/get-credit-card.md (0 hunks)
  • docs/examples/avatars/get-favicon.md (0 hunks)
  • docs/examples/avatars/get-flag.md (0 hunks)
  • docs/examples/avatars/get-image.md (0 hunks)
  • docs/examples/avatars/get-initials.md (0 hunks)
  • docs/examples/avatars/get-qr.md (0 hunks)
  • index.js (0 hunks)
  • lib/commands/avatars.js (0 hunks)
  • lib/commands/databases.js (17 hunks)
  • lib/commands/pull.js (8 hunks)
  • lib/commands/tables-db.js (15 hunks)
  • lib/parser.js (2 hunks)
  • lib/type-generation/languages/typescript.js (1 hunks)
💤 Files with no reviewable changes (9)
  • docs/examples/avatars/get-credit-card.md
  • docs/examples/avatars/get-image.md
  • docs/examples/avatars/get-initials.md
  • docs/examples/avatars/get-flag.md
  • docs/examples/avatars/get-qr.md
  • docs/examples/avatars/get-browser.md
  • docs/examples/avatars/get-favicon.md
  • index.js
  • lib/commands/avatars.js
🧰 Additional context used
🧬 Code graph analysis (3)
lib/commands/pull.js (3)
lib/commands/databases.js (1)
  • databasesList (54-81)
lib/parser.js (5)
  • log (182-184)
  • success (194-196)
  • chalk (1-1)
  • actionRunner (158-166)
  • cliConfig (10-18)
lib/commands/tables-db.js (1)
  • tablesDBList (54-81)
lib/commands/tables-db.js (1)
lib/parser.js (2)
  • parseBool (176-180)
  • actionRunner (158-166)
lib/commands/databases.js (1)
lib/parser.js (2)
  • actionRunner (158-166)
  • parseBool (176-180)
🔇 Additional comments (4)
lib/commands/pull.js (3)

298-300: Collections counters/message rework looks good

Separate totals per databases/collections are accurate; messages align with the new counters.

Also applies to: 307-308, 327-327, 338-338, 347-347


352-354: Tables counters rework is correct

Per-DB and per-table increments are placed correctly.

Also applies to: 381-381, 392-392


479-482: Default pull skips deprecated resources — good

This matches the deprecation strategy; once prompt filtering (above) is in, UX will be consistent.

Please confirm docs/help text note that default pull omits collections.

lib/parser.js (1)

209-210: Command descriptions update looks good

Marking databases as legacy and adding tables-db/projects/project is consistent and clear.

Also applies to: 223-224

Comment on lines +1208 to 1211
xdefault = xdefault === true ? [] : xdefault;
if (typeof xdefault !== 'undefined') {
payload['default'] = xdefault;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Parse --xdefault JSON; boolean sentinel is ineffective here as well

Same issue as tables-db: arrives as string; parse before sending to API.

Apply these diffs:

@@ databasesCreateLineAttribute
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [[lon, lat], ...]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ databasesUpdateLineAttribute
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [[lon, lat], ...]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ databasesCreatePointAttribute
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [lon, lat]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ databasesUpdatePointAttribute
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [lon, lat]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ databasesCreatePolygonAttribute
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [[[lon, lat], ...], ...]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ databasesUpdatePolygonAttribute
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [[[lon, lat], ...], ...]'); }
+        }
+        payload['default'] = xdefault;
+    }

Also applies to: 1250-1253, 1297-1300, 1339-1342, 1386-1389, 1428-1431


🏁 Script executed:

#!/bin/bash
# Show all places xdefault is passed unparsed in databases.js
rg -n "xdefault === true|payload\\['default'\\] = xdefault" -C2 lib/commands/databases.js

Length of output: 4327


Parse --xdefault JSON before assigning payload['default'] in lib/commands/databases.js

xdefault often arrives as a string; the boolean sentinel (xdefault === true ? [] : xdefault) is ineffective — JSON.parse string values (try/catch and throw an informative error) before assigning payload['default'].

Ripgrep hits in lib/commands/databases.js — payload assignment lines: 531, 575, 622, 666, 713, 757, 809, 858, 913, 965, 1020, 1072, 1119, 1163, 1210, 1252, 1299, 1341, 1388, 1430, 1537, 1585, 1635, 1679. Sentinel assignments present at 1208, 1250, 1297, 1339, 1386, 1428.

Apply this replacement pattern to all occurrences (tailor the error text to the attribute type, e.g. [lon, lat] for point, [[lon, lat], ...] for line, [[[lon, lat], ...], ...] for polygon):

if (typeof xdefault !== 'undefined') {
if (typeof xdefault === 'string') {
try { xdefault = JSON.parse(xdefault); }
catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [lon, lat] or [[lon, lat], ...] depending on attribute'); }
}
payload['default'] = xdefault;
}

🤖 Prompt for AI Agents
In lib/commands/databases.js around lines 1208–1211 (and apply same change to
the other listed occurrences: 531, 575, 622, 666, 713, 757, 809, 858, 913, 965,
1020, 1072, 1119, 1163, 1210, 1252, 1299, 1341, 1388, 1430, 1537, 1585, 1635,
1679), replace the current sentinel assignment for xdefault with logic that
first checks if xdefault is defined, then if it is a string attempt to
JSON.parse it inside a try/catch and throw a clear Error on failure; after
successful parse (or if not a string) assign payload['default'] = xdefault.
Tailor the thrown error message to the expected attribute shape (e.g. "Invalid
JSON for --xdefault. Expected e.g. [lon, lat]" for point, "Expected e.g. [[lon,
lat], ...]" for line, "Expected e.g. [[[lon, lat], ...], ...]" for polygon).

Comment on lines +1208 to 1211
xdefault = xdefault === true ? [] : xdefault;
if (typeof xdefault !== 'undefined') {
payload['default'] = xdefault;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Parse --xdefault JSON; current code forwards a string and the boolean sentinel is ineffective

Commander provides as a string. The xdefault === true guard never triggers, and the API receives a string, not the required array shape. Parse JSON and validate early.

Apply these diffs:

@@ tablesDBCreateLineColumn
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [[lon, lat], ...]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ tablesDBUpdateLineColumn
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [[lon, lat], ...]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ tablesDBCreatePointColumn
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [lon, lat]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ tablesDBUpdatePointColumn
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [lon, lat]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ tablesDBCreatePolygonColumn
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [[[lon, lat], ...], ...]'); }
+        }
+        payload['default'] = xdefault;
+    }
@@ tablesDBUpdatePolygonColumn
-    xdefault = xdefault === true ? [] : xdefault;
-    if (typeof xdefault !== 'undefined') {
-        payload['default'] = xdefault;
-    }
+    if (typeof xdefault !== 'undefined') {
+        if (typeof xdefault === 'string') {
+            try { xdefault = JSON.parse(xdefault) } catch (e) { throw new Error('Invalid JSON for --xdefault. Expected e.g. [[[lon, lat], ...], ...]'); }
+        }
+        payload['default'] = xdefault;
+    }

Also applies to: 1250-1253, 1297-1300, 1339-1342, 1386-1389, 1428-1431


🏁 Script executed:

#!/bin/bash
# Show places where xdefault is treated as boolean or sent through unparsed
rg -n "xdefault === true|payload\\['default'\\] = xdefault" -C2 --type=js

Length of output: 15522


Parse --xdefault JSON and validate in all CLI handlers (critical)

Commander supplies option values as strings; the xdefault === true guard only handles flag-without-value. Do not forward raw strings to the API — if typeof xdefault === 'string' JSON.parse(xdefault) and throw a clear error on failure; retain boolean-true => [] behavior.

Files to update: lib/commands/databases.js and lib/commands/tables-db.js — replace every occurrence of the pattern found by your rg run (e.g. around lines 531, 575, 622, 666, 713, 757, 809, 858, 913, 965, 1020, 1072, 1119, 1163, 1208–1211, 1250–1253, 1297–1300, 1339–1342, 1386–1389, 1428–1431, 1537–1538, 1585–1586, 1635–1636, 1679–1680).

🤖 Prompt for AI Agents
In lib/commands/tables-db.js around lines 1208 to 1211, the current logic
forwards raw string option values for --xdefault; update it to: if xdefault ===
true keep the [] behavior; if typeof xdefault === 'string' attempt to
JSON.parse(xdefault) and on parse failure throw a clear, user-facing error (e.g.
"Invalid JSON for --xdefault: <err.message>"); otherwise if parsed successfully
(or non-string non-true value) assign payload['default'] to the parsed value (or
the original non-string value). Apply the same change to
lib/commands/databases.js and replace every occurrence of the pattern identified
by the reviewer (around lines 531, 575, 622, 666, 713, 757, 809, 858, 913, 965,
1020, 1072, 1119, 1163, 1208–1211, 1250–1253, 1297–1300, 1339–1342, 1386–1389,
1428–1431, 1537–1538, 1585–1586, 1635–1636, 1679–1680) so every handler parses
string inputs, throws a clear parse error, and preserves the boolean-true => []
behavior before assigning payload['default'].

* @property {string} databaseId Database ID.
* @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows.
* @property {object[]} rows Array of documents data as JSON objects.
* @property {object[]} rows Array of rows data as JSON objects.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

rows are documented as JSON objects but forwarded as strings; consider parsing each element

Current code passes rows as string array. If the API expects objects, parse inputs for consistency with single-row --data.

Apply this diff:

@@ tablesDBCreateRows
-    rows = rows === true ? [] : rows;
-    if (typeof rows !== 'undefined') {
-        payload['rows'] = rows;
-    }
+    rows = rows === true ? [] : rows;
+    if (typeof rows !== 'undefined') {
+        payload['rows'] = rows.map(r => (typeof r === 'string' ? JSON.parse(r) : r));
+    }
@@ tablesDBUpsertRows
-    rows = rows === true ? [] : rows;
-    if (typeof rows !== 'undefined') {
-        payload['rows'] = rows;
-    }
+    rows = rows === true ? [] : rows;
+    if (typeof rows !== 'undefined') {
+        payload['rows'] = rows.map(r => (typeof r === 'string' ? JSON.parse(r) : r));
+    }

Also applies to: 3056-3056


🏁 Script executed:

#!/bin/bash
# Confirm analogous handling for "documents" elsewhere for parity
rg -n "create-documents|upsert-documents|payload\\['documents'\\]" -C2 --type=js

Length of output: 1849


Parse string rows/documents to JSON before assigning to payload

Rows are documented as object[] but currently forwarded as strings — map string entries to parsed objects when building payload. Apply the same mapping to payload['documents'] in lib/commands/databases.js (around lines 1903 and 1939).

Apply this diff:

@@ tablesDBCreateRows
-    rows = rows === true ? [] : rows;
-    if (typeof rows !== 'undefined') {
-        payload['rows'] = rows;
-    }
+    rows = rows === true ? [] : rows;
+    if (typeof rows !== 'undefined') {
+        payload['rows'] = rows.map(r => (typeof r === 'string' ? JSON.parse(r) : r));
+    }
@@ tablesDBUpsertRows
-    rows = rows === true ? [] : rows;
-    if (typeof rows !== 'undefined') {
-        payload['rows'] = rows;
-    }
+    rows = rows === true ? [] : rows;
+    if (typeof rows !== 'undefined') {
+        payload['rows'] = rows.map(r => (typeof r === 'string' ? JSON.parse(r) : r));
+    }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In lib/commands/tables-db.js around line 2084 the rows are documented as
object[] but are currently forwarded as strings; parse any string entries to
JSON before assigning to payload (map each row: if typeof row === 'string' parse
with JSON.parse, otherwise keep as-is) and assign the resulting objects to
payload.rows; apply the same string-to-JSON mapping to payload['documents'] in
lib/commands/databases.js around lines 1903 and 1939 so that both payload.rows
and payload['documents'] contain actual objects rather than raw JSON strings.

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 (2)
scoop/appwrite.config.json (1)

27-29: Consider adding autoupdate block for Scoop.

Optional but helps future bumps.

   "checkver": {
-      "github": "https://github.com/appwrite/sdk-for-cli"
-  }
+    "github": "https://github.com/appwrite/sdk-for-cli"
+  },
+  "autoupdate": {
+    "architecture": {
+      "64bit": {
+        "url": "https://github.com/appwrite/sdk-for-cli/releases/download/$version/appwrite-cli-win-x64.exe"
+      },
+      "arm64": {
+        "url": "https://github.com/appwrite/sdk-for-cli/releases/download/$version/appwrite-cli-win-arm64.exe"
+      }
+    }
+  }
package.json (1)

5-5: Add engines field to package.json (Node >=18).
Confirmed pkg scripts target node18 — declare engines to match packaged binaries.

  "license": "BSD-3-Clause",
+  "engines": {
+    "node": ">=18"
+  },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ebbe7e9 and 78419ed.

📒 Files selected for processing (8)
  • CHANGELOG.md (1 hunks)
  • README.md (2 hunks)
  • install.ps1 (1 hunks)
  • install.sh (1 hunks)
  • lib/client.js (1 hunks)
  • lib/parser.js (3 hunks)
  • package.json (1 hunks)
  • scoop/appwrite.config.json (2 hunks)
✅ Files skipped from review due to trivial changes (3)
  • install.sh
  • lib/client.js
  • install.ps1
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/parser.js
🔇 Additional comments (3)
scoop/appwrite.config.json (2)

3-3: Version bumped to 10.0.0 — OK.


9-15: Add per-arch SHA256 hashes to Scoop manifest — release assets return 404

Tried to download v10.0.0 Windows x64 and arm64 executables to compute SHA256; both URLs returned HTTP 404. Update the manifest to point to valid release assets or provide the binaries, then add per-arch "hash": "sha256:" entries.

File: scoop/appwrite.config.json — 64bit and arm64 sections (lines 9–15 and 18–25)

     "64bit": {
-      "url": "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.0/appwrite-cli-win-x64.exe",
+      "url": "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.0/appwrite-cli-win-x64.exe",
+      "hash": "sha256:PUT_ACTUAL_SHA256_HERE",
       "bin": [
         [
           "appwrite-cli-win-x64.exe",
           "appwrite"
         ]
       ]
     },
     "arm64": {
-      "url": "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.0/appwrite-cli-win-arm64.exe",
+      "url": "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.0/appwrite-cli-win-arm64.exe",
+      "hash": "sha256:PUT_ACTUAL_SHA256_HERE",
       "bin": [
         [
           "appwrite-cli-win-arm64.exe",
           "appwrite"
         ]
       ]
     }
README.md (1)

31-33: Version bump to 10.0.0 — cross-repo verification complete

No 9.x references found; installer URLs, package.json, user-agent/x-sdk headers, lib/parser, README and scoop config are all updated to 10.0.0 (package.json, install.sh, install.ps1, scoop/appwrite.config.json, lib/client.js, lib/parser.js, README.md).

Comment on lines +3 to +11
## 10.0.0

* **Breaking:** Removed Avatars CLI command and all related subcommands; corresponding examples deleted
* **Feat:** Geo defaults now accept coordinate arrays for Databases and Tables DB, with automatic normalization
* **Feat:** Pull command skips deprecated resources by default and shows clearer totals/messages
* **Feat:** Updated CLI descriptions: Databases marked legacy; added tables-db, projects, and project
* Fix TypeScript type generation now quotes invalid property names to produce valid typings
* Update documentation: Removed Avatars CLI examples and updated help text to reflect new geo defaults and terminology

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Polish 10.0.0 entry: add date and fix label consistency.

Align “Fix” line with other bolded labels and include release date for traceability.

-## 10.0.0
+## 10.0.0 — 2025-09-18
@@
-* Fix TypeScript type generation now quotes invalid property names to produce valid typings
+* **Fix:** TypeScript type generation now quotes invalid property names to produce valid typings

🏁 Script executed:

#!/bin/bash
# Ensure avatars CLI removal is fully reflected across code/help
rg -nP '\bavatars?\b' -g '!**/CHANGELOG.md'

Length of output: 148


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== CHANGELOG.md head (first 120 lines) ==="
if [[ -f CHANGELOG.md ]]; then
  sed -n '1,120p' CHANGELOG.md || true
else
  echo "CHANGELOG.md not found"
fi

echo
echo "=== Search for 'avatar' or 'avatars' (case-insensitive) across repo ==="
rg -n --hidden -uu -S -i '\bavatar(s)?\b' || echo "no matches"

echo
echo "=== Confirm '## 10.0.0' header exists in CHANGELOG.md ==="
if [[ -f CHANGELOG.md ]]; then
  rg -n --hidden -uu -S '##\s*10\.0\.0' CHANGELOG.md || echo "10.0.0 header not found"
fi

Length of output: 6972


Polish 10.0.0: add release date, bold the Fix label, and resolve Avatars removal mismatch.

  • Add release date and align label (apply diff below).
-## 10.0.0
+## 10.0.0 — 2025-09-18
@@
-* Fix TypeScript type generation now quotes invalid property names to produce valid typings
+* **Fix:** TypeScript type generation now quotes invalid property names to produce valid typings
  • Changelog claims "Removed Avatars CLI" but code still references avatars — remove or confirm and update CHANGELOG: lib/parser.js:207, lib/config.js:602.
📝 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
## 10.0.0
* **Breaking:** Removed Avatars CLI command and all related subcommands; corresponding examples deleted
* **Feat:** Geo defaults now accept coordinate arrays for Databases and Tables DB, with automatic normalization
* **Feat:** Pull command skips deprecated resources by default and shows clearer totals/messages
* **Feat:** Updated CLI descriptions: Databases marked legacy; added tables-db, projects, and project
* Fix TypeScript type generation now quotes invalid property names to produce valid typings
* Update documentation: Removed Avatars CLI examples and updated help text to reflect new geo defaults and terminology
## 10.0.0 — 2025-09-18
* **Breaking:** Removed Avatars CLI command and all related subcommands; corresponding examples deleted
* **Feat:** Geo defaults now accept coordinate arrays for Databases and Tables DB, with automatic normalization
* **Feat:** Pull command skips deprecated resources by default and shows clearer totals/messages
* **Feat:** Updated CLI descriptions: Databases marked legacy; added tables-db, projects, and project
* **Fix:** TypeScript type generation now quotes invalid property names to produce valid typings
* Update documentation: Removed Avatars CLI examples and updated help text to reflect new geo defaults and terminology
🤖 Prompt for AI Agents
In CHANGELOG.md around lines 3 to 11, add the 10.0.0 release date after the
heading and change the "Fix" label to bold "**Fix:**"; also resolve the Avatars
removal mismatch by either removing or confirming avatar references in the code:
inspect lib/parser.js at line ~207 and lib/config.js at line ~602 and if avatars
were removed, delete or refactor those references so the changelog claim is
accurate, otherwise update the CHANGELOG entry to reflect that avatars remain
and explain the actual change.

@loks0n loks0n merged commit 09587bb into master Sep 22, 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.

4 participants