feat(KNO-13755): add schema pull and push commands#824
Conversation
…Data type pull --all now pages through the list endpoint via the page_info.after cursor, so environments with more schemas than a single page (many object collections) are pulled completely (BugBot finding). Also removes the unused SchemaFileData type. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b587e54. Configure here.
|
|
||
| if (itemType !== "object" && collection) { | ||
| this.error("Flag --collection can only be provided for object schemas"); | ||
| } |
There was a problem hiding this comment.
Invalid collection flag unvalidated
Medium Severity
For object schemas, validateCollectionUsage only checks that --collection is present, not that it is a valid collection key. Invalid values such as .. are rejected later inside schemaFilePath via validateSchemaCollection, which throws a raw Error instead of a CLI this.error, so pull/push can crash rather than exit cleanly.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b587e54. Configure here.
| ...schema.content, | ||
| item_type: validateSchemaItemType(schema.content.item_type), | ||
| }, | ||
| })), |
There was a problem hiding this comment.
Push all throws on bad item_type
Medium Severity
readAllSchemaFiles collects JSON parse errors as SourceErrors, but its final pass calls validateSchemaItemType on each file’s item_type without try/catch. A single schema file with a missing or invalid item_type throws and aborts schema push --all instead of reporting a formatted error like other read failures.
Reviewed by Cursor Bugbot for commit b587e54. Configure here.
|
|
||
| if (resp.data.schema) { | ||
| await Schema.writeSchemaFileFromData(schema, resp.data.schema); | ||
| } |
There was a problem hiding this comment.
Push ignores missing upsert schema
Medium Severity
After a successful HTTP response from upsertSchema, pushSchema only refreshes the local file when resp.data.schema is set and otherwise continues. The command still prints success even though the environment may not have been updated and no API validation errors are surfaced, unlike schema pull which errors when resp.data.schema is absent.
Reviewed by Cursor Bugbot for commit b587e54. Configure here.



Description
Adds the
schemacommand topic:knock schema pull [ITEMTYPE]knock schema push [ITEMTYPE]Supported local layout:
schemas/user.jsonschemas/tenant.jsonschemas/objects/<collection>.jsonPull supports single schema pulls and
--allviaGET /v1/schemas. Push supports single schema pushes and--allby discovering local schema files. Schema files include$schemaplus__readonlymetadata foritem_typeanditem_id, and push strips local-only metadata before calling the API.