Conversation
WalkthroughThis PR introduces a new metadata CLI command that retrieves and displays backend metadata from an API endpoint. The command supports both JSON and human-readable output formats. A shared schema dependency is added to support the metadata structure. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/commands/metadata.ts (1)
17-18: Consider validating the API response against the schema.The response is cast directly to
AppMetadataSchemawithout runtime validation. If the API returns malformed data, subsequent property accesses could fail with unclear errors.Since
@insforge/shared-schemaslikely provides Zod schemas (given the naming convention), you could use.parse()for runtime validation to provide clearer error messages when the API response doesn't match expectations.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/metadata.ts` around lines 17 - 18, The code currently casts the fetch result to AppMetadataSchema without runtime validation; update the flow in the metadata fetch (where ossFetch('/api/metadata') and res.json() are used) to validate the parsed JSON against the Zod schema exported as AppMetadataSchema by calling its .parse() (or .safeParse() then handle errors) instead of a direct cast, and surface a clear error/log when validation fails so downstream property access is safe and errors are informative.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/commands/metadata.ts`:
- Around line 17-18: The code currently casts the fetch result to
AppMetadataSchema without runtime validation; update the flow in the metadata
fetch (where ossFetch('/api/metadata') and res.json() are used) to validate the
parsed JSON against the Zod schema exported as AppMetadataSchema by calling its
.parse() (or .safeParse() then handle errors) instead of a direct cast, and
surface a clear error/log when validation fails so downstream property access is
safe and errors are informative.
ℹ️ Review info
Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4bc2144d-5920-41f7-bdd5-b38991235277
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
package.jsonsrc/commands/metadata.tssrc/index.ts
Summary by CodeRabbit
Release Notes
New Features
metadataCLI command that retrieves and displays comprehensive backend metadata, including authentication configuration, database details, storage information, functions, available AI models, realtime channels, and system version.Chores