Skip to content

Feat/metadata#9

Merged
jwfing merged 2 commits intomainfrom
feat/metadata
Mar 4, 2026
Merged

Feat/metadata#9
jwfing merged 2 commits intomainfrom
feat/metadata

Conversation

@jwfing
Copy link
Contributor

@jwfing jwfing commented Mar 4, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new metadata CLI command that retrieves and displays comprehensive backend metadata, including authentication configuration, database details, storage information, functions, available AI models, realtime channels, and system version.
    • Supports both JSON format for programmatic access and human-readable format for easy viewing.
  • Chores

    • Added new dependency: shared schemas package.

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

Walkthrough

This 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

Cohort / File(s) Summary
Dependencies
package.json
Added @insforge/shared-schemas v^1.1.43 dependency to support metadata schema definitions.
New Metadata Command
src/commands/metadata.ts
New command implementation that fetches backend metadata from /api/metadata endpoint with authentication. Exports registerMetadataCommand(). Supports JSON output (raw schema) and human-readable output (formatted sections for Auth, Database, Storage, Functions, AI Models, Realtime, Version). Includes conditional rendering for lists and formatSize() utility for gigabyte conversion.
CLI Integration
src/index.ts
Registered the new metadata command with the program by importing and invoking registerMetadataCommand().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hop, hop! A command springs to life,
Metadata gleams without strife,
In JSON or prose, we see the way,
What secrets the backend holds to say! 🌟

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Feat/metadata' is vague and follows a branch naming convention rather than describing the actual change. It doesn't convey what the metadata feature does or why it matters. Use a more descriptive title like 'Add metadata command to display backend configuration' that clearly explains the primary change and its purpose.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/metadata

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

🧹 Nitpick comments (1)
src/commands/metadata.ts (1)

17-18: Consider validating the API response against the schema.

The response is cast directly to AppMetadataSchema without runtime validation. If the API returns malformed data, subsequent property accesses could fail with unclear errors.

Since @insforge/shared-schemas likely 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

📥 Commits

Reviewing files that changed from the base of the PR and between b4c44da and cc414c2.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • package.json
  • src/commands/metadata.ts
  • src/index.ts

@jwfing jwfing merged commit 890737a into main Mar 4, 2026
2 checks 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.

1 participant