-
Notifications
You must be signed in to change notification settings - Fork 40
feat: Command Line SDK update for version 10.0.0 #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis 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 Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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 |
There was a problem hiding this 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=truePrevents 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 LGTMFix 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 bugsIf 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 defaultsUse 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 --xdefaultAdd 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 defaultsMirror 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 --xdefaultSame 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
📒 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 goodSeparate 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 correctPer-DB and per-table increments are placed correctly.
Also applies to: 381-381, 392-392
479-482: Default pull skips deprecated resources — goodThis 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 goodMarking databases as legacy and adding tables-db/projects/project is consistent and clear.
Also applies to: 223-224
| xdefault = xdefault === true ? [] : xdefault; | ||
| if (typeof xdefault !== 'undefined') { | ||
| payload['default'] = xdefault; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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.jsLength 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).
| xdefault = xdefault === true ? [] : xdefault; | ||
| if (typeof xdefault !== 'undefined') { | ||
| payload['default'] = xdefault; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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=jsLength 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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=jsLength 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.
There was a problem hiding this 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
📒 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 404Tried 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 completeNo 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).
| ## 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 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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"
fiLength 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.
| ## 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.
This PR contains updates to the Command Line SDK for version 10.0.0
Summary by CodeRabbit
Breaking Changes
New Features
Bug Fixes
Documentation