Skip to content

remove build from @decocms/bindings, fix ts check oom#1908

Merged
viktormarinho merged 9 commits intomainfrom
fix-ts
Dec 1, 2025
Merged

remove build from @decocms/bindings, fix ts check oom#1908
viktormarinho merged 9 commits intomainfrom
fix-ts

Conversation

@viktormarinho
Copy link
Copy Markdown
Contributor

@viktormarinho viktormarinho commented Dec 1, 2025

What is this contribution about?

Describe your changes and why they're needed.

Screenshots/Demonstration

Add screenshots or a Loom video if your changes affect the UI.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by CodeRabbit

  • Refactor

    • Simplified collection bindings API with streamlined function signatures and consistent tool composition for list, get, create, update, and delete operations.
    • Updated internal dependency imports for compatibility.
  • Chores

    • Updated Zod library dependencies to compatible versions across packages.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 1, 2025

Walkthrough

This PR simplifies the collections API surface by removing per-entity generic type factories and unifying the createCollectionBindings signature to return a plain ToolBinder[]. Additionally, zod imports are migrated from a versioned subpath (zod/v3) to the standard package import across the codebase.

Changes

Cohort / File(s) Summary
Collections API simplification
packages/bindings/src/well-known/collections.ts
Refactored createCollectionBindings signature from highly generic per-entity form to (collectionName: string, entitySchema: z.ZodTypeAny, options?) => ToolBinder[]. Removed exported factory types and signatures (e.g., BaseCollectionEntitySchemaType, CollectionBinding, factory functions). Retained core schemas as exports and introduced generic output types (CollectionListOutput<T>, CollectionGetOutput<T>, etc.).
Zod dependency version updates
apps/mesh/package.json, docs/server/package.json
Updated zod dependency in apps/mesh from ^4.1.13 to ^3.25.76 and in docs/server from ^3.24.3 to ^3.25.76.
Zod import path migration in tools
apps/mesh/src/api/routes/models.ts, apps/mesh/src/api/utils/mcp.ts, apps/mesh/src/core/define-tool.test.ts, apps/mesh/src/core/define-tool.ts, apps/mesh/src/tools/client.ts, apps/mesh/src/tools/connection/*, apps/mesh/src/tools/organization/*
Updated import paths from zod/v3 to zod across 26 files in the tools directory. No functional or control-flow changes; only module resolution adjustments.
Zod import path migration in web components and utilities
apps/mesh/src/web/components/create-organization-dialog.tsx, apps/mesh/src/web/components/index.tsx, apps/mesh/src/web/components/collections/*, apps/mesh/src/web/components/details/connection.tsx, apps/mesh/src/web/components/invite-member-dialog.tsx, apps/mesh/src/web/hooks/collections/use-llm.ts, apps/mesh/src/web/routes/orgs/connections.tsx, apps/mesh/src/web/utils/schema-converter.ts
Updated import paths from zod/v3 to zod across 11 files in web components and utilities. No behavioral changes.
Zod import path migration in bindings core
packages/bindings/src/core/binder.ts, packages/bindings/src/well-known/agent.ts, packages/bindings/src/well-known/language-model.ts, packages/bindings/test/index.test.ts
Updated import paths from zod/v3 to zod across 4 files. No public API changes.
Documentation updates
packages/bindings/README.md
Updated code examples to reflect zod import path changes from zod/v3 to zod.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Rationale: While this PR spans many files, most changes are homogeneous import path swaps (38+ files), which are straightforward and low-risk. The primary complexity is isolated to packages/bindings/src/well-known/collections.ts, which requires careful review of the API surface simplification and type rework. The dependency version changes require verification of compatibility but are routine updates.
  • Areas requiring extra attention:
    • packages/bindings/src/well-known/collections.ts – Verify that the simplified API surface maintains backward compatibility or document breaking changes clearly. Ensure output schema factory functions are correctly inlined.
    • apps/mesh/package.json – Confirm that downgrading zod from ^4.1.13 to ^3.25.76 does not break any runtime behavior or type contracts in the mesh application.
    • apps/mesh/src/tools/connection/list.ts – Minor import reordering; verify no unintended side effects in agent binding resolution.

Possibly related PRs

  • decocms/admin#1902 – Modifies packages/bindings/src/well-known/collections.ts with collection binding API changes and introduces/renames collection output schema helpers and generic collection types alongside this PR.
  • decocms/admin#1903 – Directly related collections.ts refactoring that complements changes to createCollectionBindings signature and exported collection-related type removals.

Suggested reviewers

  • mcandeia
  • pedrofrxncx
  • tlgimenes

Poem

🐰 Hop, hop! The bindings dance anew,
Zod's pathways simplified and true,
From versioned halls to standard ground,
Collections now in ToolBinder bound!
No more generic tangles in sight—
Just cleaner APIs, oh what delight! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the template with empty sections and unchecked boxes. No actual description, rationale, testing details, or breaking change assessment has been provided by the author. Fill in the 'What is this contribution about?' section with detailed change rationale. Address the review checklist items, particularly documenting breaking changes to the public API and confirming tests pass.
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.
Title check ⚠️ Warning The title 'remove build from @decocms/bindings, fix ts check oom' does not reflect the main change, which is simplifying the collections API surface and updating zod imports across the codebase. Revise the title to focus on the primary change: 'Simplify collections bindings API and upgrade zod imports' or similar, as indicated by the PR objectives and the substantial refactoring of the collections module.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-ts

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.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Dec 1, 2025

Deploying decocms-admin-frontend with  Cloudflare Pages  Cloudflare Pages

Latest commit: c45dabd
Status: ✅  Deploy successful!
Preview URL: https://ba20eb2a.admin-decocms-frontend.pages.dev
Branch Preview URL: https://fix-ts.admin-decocms-frontend.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f85ab78 and eee11d4.

📒 Files selected for processing (1)
  • packages/bindings/src/well-known/collections.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react-ts.mdc)

**/*.{ts,tsx}: Write concise, maintainable, and technically accurate TypeScript code with relevant examples
Use functional and declarative programming patterns; avoid classes
Favor iteration and modularization to adhere to DRY principles and avoid code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Organize files systematically: each file should contain only related content, such as exported components, subcomponents, helpers, static content, and types
Favor named exports for functions
Use TypeScript for all code; prefer interfaces over types for their extendability and ability to merge
Avoid enums; use maps instead for better type safety and flexibility
Use functional components with TypeScript interfaces
Use the "function" keyword for pure functions to benefit from hoisting and clarity
Favor using the already-present UI components in packages/ui folder instead of creating custom components
Use useMemo to memoize expensive filtering and sorting operations in React components
Memoize object and array literals in useMemo to maintain stable references across renders
Use useDeferredValue for search operations to prevent blocking user input during expensive computations
Follow established data patterns from MCP (Model Context Protocol) Tools for consistent data fetching and use proper loading states and error handling
Always use UI components from @deco/ui instead of creating custom components that duplicate the design system
Use react-hook-form with Zod validation instead of manual useState for form management
Validate forms on blur (mode: 'onBlur') for better user experience with react-hook-form
Use context (React.createContext) to avoid prop drilling when sharing form state across multiple components
Use design system Form components (Form, FormField, FormItem, FormLabel, FormMessage) with proper error handling
Apply the Single Responsibility Principle: create focused, composable components with single concerns
Create ...

Files:

  • packages/bindings/src/well-known/collections.ts
**/*.{ts,tsx,js,jsx,css}

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Run formatting with bun run fmt before opening pull requests

Keep Tailwind design tokens consistent per plugins/ensure-tailwind-design-system-tokens.ts which will fail builds otherwise

Files:

  • packages/bindings/src/well-known/collections.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Run linting with bun run lint before opening pull requests

**/*.{ts,tsx,js,jsx}: Use PascalCase for component and class names
Use camelCase for hooks and utility function names

Files:

  • packages/bindings/src/well-known/collections.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Keep imports sorted in all code files

Files:

  • packages/bindings/src/well-known/collections.ts
packages/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Enforce kebab-case filenames in shared packages via plugins/enforce-kebab-case-file-names.ts

Files:

  • packages/bindings/src/well-known/collections.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{tools,api,index}*.ts : Organize MCP tools into typed collections (GLOBAL_TOOLS, WORKSPACE_TOOLS, AGENT_TOOLS, EMAIL_TOOLS) by functionality and scope
📚 Learning: 2025-12-01T21:09:54.719Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: docs/.cursor/rules/main.mdc:0-0
Timestamp: 2025-12-01T21:09:54.719Z
Learning: Applies to docs/server/**/*.ts : Use Zod (z.object) for defining inputSchema and outputSchema in tools and workflows

Applied to files:

  • packages/bindings/src/well-known/collections.ts
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{tools,api,index}*.ts : Organize MCP tools into typed collections (GLOBAL_TOOLS, WORKSPACE_TOOLS, AGENT_TOOLS, EMAIL_TOOLS) by functionality and scope

Applied to files:

  • packages/bindings/src/well-known/collections.ts
📚 Learning: 2025-12-01T21:07:33.821Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/api-development.mdc:0-0
Timestamp: 2025-12-01T21:07:33.821Z
Learning: Applies to packages/sdk/src/mcp/*/api.ts : Define separate Zod schemas for input validation (`InputSchema`) and output validation (`OutputSchema`) with clear descriptions

Applied to files:

  • packages/bindings/src/well-known/collections.ts
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{api,tool,tools,server}*.ts : Tool definitions must use Zod schemas for input and output validation with strict typing

Applied to files:

  • packages/bindings/src/well-known/collections.ts
🧬 Code graph analysis (1)
packages/bindings/src/well-known/collections.ts (2)
packages/bindings/src/core/binder.ts (1)
  • ToolBinder (22-49)
apps/mesh/src/core/define-tool.ts (1)
  • ToolBinder (21-30)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
packages/bindings/src/well-known/collections.ts (2)

24-30: Logical expressions cannot be nested.

The conditions field accepts only ComparisonExpressionSchema[], preventing nested logical expressions like AND(OR(a, b), OR(c, d)). Also, the not operator with an array of conditions is unusual—typically NOT applies to a single condition.

If deeper nesting isn't needed, consider documenting this limitation. Otherwise, conditions should reference WhereExpressionSchema recursively using z.lazy().


158-167: LGTM!

The simplified generic output types are clean and provide a clear contract for consumers. Note: CollectionInsertOutput<T> correctly shows item: T (non-nullable), which aligns with the fix suggested above for the CREATE binding schema.

Comment thread packages/bindings/src/well-known/collections.ts
Copy link
Copy Markdown
Contributor

@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: 0

🧹 Nitpick comments (3)
packages/bindings/src/well-known/collections.ts (3)

24-30: Consider recursive WhereExpression for richer boolean logic and clearer not semantics

Right now, logical groups (operator: "and" | "or" | "not") can only contain ComparisonExpressionSchema items and cannot nest other groups, and operator: "not" can wrap an arbitrary-length array, which is semantically a bit odd. If you intend to support expressions like (A AND (B OR C)) or a NOT over a single sub-expression, consider switching conditions to something like z.array(WhereExpressionSchema).min(1) via z.lazy, and optionally constraining not to exactly one condition. If a single flat level of comparisons is sufficient for your use cases, this can stay as-is.


59-65: GET/DELETE input schemas are clear; be aware of ID shape assumptions

Using a simple { id: z.string() } for both CollectionGetInputSchema and CollectionDeleteInputSchema is straightforward and consistent. Just keep in mind this bakes in “single string primary key” semantics—if you later need numeric IDs or composite keys for some collections, you’ll need to either broaden the id type or introduce a more flexible key/where structure for these operations.


91-124: Tighten entitySchema typing for update helpers to avoid unsafe casts

The CRUD helper schemas are generally well-shaped (full data for insert, partial data for update, and entity-returning outputs). The main concern is in createCollectionUpdateInputSchema where you cast entitySchema to z.AnyZodObject just to call .partial():

data: (entitySchema as z.AnyZodObject)
  .partial()
  .describe("Partial entity data to update"),

If someone ever passes a non-object schema (e.g., a union or an effects-wrapped schema) into createCollectionBindings, this will compile but fail at runtime. You can make this safer by tightening the type of entitySchema to z.AnyZodObject end-to-end and dropping the cast, for example:

-export function createCollectionInsertInputSchema(entitySchema: z.ZodTypeAny) {
+export function createCollectionInsertInputSchema(entitySchema: z.AnyZodObject) {
   return z.object({
     data: entitySchema.describe(
       "Data for the new entity (id may be auto-generated)",
     ),
   });
 }

-export function createCollectionUpdateInputSchema(entitySchema: z.ZodTypeAny) {
+export function createCollectionUpdateInputSchema(entitySchema: z.AnyZodObject) {
   return z.object({
     id: z.string().describe("ID of the entity to update"),
-    data: (entitySchema as z.AnyZodObject)
-      .partial()
+    data: entitySchema
+      .partial()
       .describe("Partial entity data to update"),
   });
 }

and similarly updating createCollectionInsertOutputSchema, createCollectionUpdateOutputSchema, createCollectionDeleteOutputSchema, and createCollectionBindings to accept z.AnyZodObject for consistency. That keeps the API focused on object-like entities and catches accidental misuse at compile time.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eee11d4 and 7650ac9.

📒 Files selected for processing (1)
  • packages/bindings/src/well-known/collections.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react-ts.mdc)

**/*.{ts,tsx}: Write concise, maintainable, and technically accurate TypeScript code with relevant examples
Use functional and declarative programming patterns; avoid classes
Favor iteration and modularization to adhere to DRY principles and avoid code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Organize files systematically: each file should contain only related content, such as exported components, subcomponents, helpers, static content, and types
Favor named exports for functions
Use TypeScript for all code; prefer interfaces over types for their extendability and ability to merge
Avoid enums; use maps instead for better type safety and flexibility
Use functional components with TypeScript interfaces
Use the "function" keyword for pure functions to benefit from hoisting and clarity
Favor using the already-present UI components in packages/ui folder instead of creating custom components
Use useMemo to memoize expensive filtering and sorting operations in React components
Memoize object and array literals in useMemo to maintain stable references across renders
Use useDeferredValue for search operations to prevent blocking user input during expensive computations
Follow established data patterns from MCP (Model Context Protocol) Tools for consistent data fetching and use proper loading states and error handling
Always use UI components from @deco/ui instead of creating custom components that duplicate the design system
Use react-hook-form with Zod validation instead of manual useState for form management
Validate forms on blur (mode: 'onBlur') for better user experience with react-hook-form
Use context (React.createContext) to avoid prop drilling when sharing form state across multiple components
Use design system Form components (Form, FormField, FormItem, FormLabel, FormMessage) with proper error handling
Apply the Single Responsibility Principle: create focused, composable components with single concerns
Create ...

Files:

  • packages/bindings/src/well-known/collections.ts
**/*.{ts,tsx,js,jsx,css}

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Run formatting with bun run fmt before opening pull requests

Keep Tailwind design tokens consistent per plugins/ensure-tailwind-design-system-tokens.ts which will fail builds otherwise

Files:

  • packages/bindings/src/well-known/collections.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Run linting with bun run lint before opening pull requests

**/*.{ts,tsx,js,jsx}: Use PascalCase for component and class names
Use camelCase for hooks and utility function names

Files:

  • packages/bindings/src/well-known/collections.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Keep imports sorted in all code files

Files:

  • packages/bindings/src/well-known/collections.ts
packages/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Enforce kebab-case filenames in shared packages via plugins/enforce-kebab-case-file-names.ts

Files:

  • packages/bindings/src/well-known/collections.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: decocms/admin PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-01T21:10:09.298Z
Learning: Include succinct summary, testing notes, and relevant screenshots for UI changes in pull request descriptions
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{tools,api,index}*.ts : Organize MCP tools into typed collections (GLOBAL_TOOLS, WORKSPACE_TOOLS, AGENT_TOOLS, EMAIL_TOOLS) by functionality and scope

Applied to files:

  • packages/bindings/src/well-known/collections.ts
📚 Learning: 2025-12-01T21:07:33.821Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/api-development.mdc:0-0
Timestamp: 2025-12-01T21:07:33.821Z
Learning: Applies to packages/sdk/src/mcp/*/api.ts : Define separate Zod schemas for input validation (`InputSchema`) and output validation (`OutputSchema`) with clear descriptions

Applied to files:

  • packages/bindings/src/well-known/collections.ts
📚 Learning: 2025-12-01T21:08:29.999Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/native-apps-and-views.mdc:0-0
Timestamp: 2025-12-01T21:08:29.999Z
Learning: Applies to packages/sdk/src/mcp/**/*.ts : MCP tools must return objects, not nullable primitives; use object wrappers with outputSchema for return values

Applied to files:

  • packages/bindings/src/well-known/collections.ts
📚 Learning: 2025-12-01T21:09:54.719Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: docs/.cursor/rules/main.mdc:0-0
Timestamp: 2025-12-01T21:09:54.719Z
Learning: Applies to docs/server/**/*.ts : Use Zod (z.object) for defining inputSchema and outputSchema in tools and workflows

Applied to files:

  • packages/bindings/src/well-known/collections.ts
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{api,tool,tools,server}*.ts : Tool definitions must use Zod schemas for input and output validation with strict typing

Applied to files:

  • packages/bindings/src/well-known/collections.ts
🧬 Code graph analysis (1)
packages/bindings/src/well-known/collections.ts (2)
packages/bindings/src/core/binder.ts (1)
  • ToolBinder (22-49)
packages/bindings/src/index.ts (1)
  • ToolBinder (13-13)
🔇 Additional comments (4)
packages/bindings/src/well-known/collections.ts (4)

5-16: BaseCollectionEntitySchema definition looks solid and reusable

Standardizing on id, title, timestamps, and optional created_by/updated_by gives a good cross-collection baseline and should make bindings more consistent. No issues from a schema or typing perspective here.


67-89: List/Get output schemas align well with the object-wrapped tool return pattern

createCollectionListOutputSchema returning { items, totalCount?, hasMore? } and createCollectionGetOutputSchema returning { item: T | null } gives a consistent, object-wrapped result shape while making the not-found case explicit for GET. This matches the MCP tooling guidance that tools should return objects rather than bare primitives, with Zod-backed validation on both input and output. Based on learnings, this is a good standardization point for collection tools.


131-182: Bindings factory is much easier to follow; confirm read-only behavior and external usage

The new createCollectionBindings implementation reads cleanly: LIST/GET tools are always present, and CREATE/UPDATE/DELETE are only added when readOnly is false, with mutation tools marked opt: true. Tool names derived from collectionName.toUpperCase() keep things predictable.

Two things worth double-checking:

  • That readOnly: true collections are indeed expected to expose LIST/GET but no mutations (no need to hide read operations as well).
  • That callers which previously relied on the more heavily-typed, generic binding API are either updated or no longer needed—returning a plain ToolBinder[] is simpler but also less type-directed than before.

If both are intentional, the factory looks good as-is.


184-199: Exported collection IO types match the schemas and provide a clean external surface

The exported aliases (BaseCollectionEntity, WhereExpression, OrderByExpression, the various Collection*Input types, and the generic Collection*Output<T> shapes) line up with the Zod schemas above and should make it straightforward for callers to type tool responses. Using T | null only for CollectionGetOutput while keeping mutation outputs non-nullable is a reasonable distinction between “lookup may not find anything” and “successful mutation returns an entity.”

Copy link
Copy Markdown
Contributor

@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

Caution

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

⚠️ Outside diff range comments (1)
apps/mesh/src/web/utils/schema-converter.ts (1)

1-72: Add length check for empty enum arrays to prevent runtime errors

The switch to import { z } from "zod"; is consistent with the rest of the repo. However, the enum handling has a defensive gap: while Zod's typings require at least one enum value (readonly [string, ...string[]]), the @ts-ignore comment bypasses this check. If schema.enum is an empty array, the condition if (schema.enum) still passes (empty arrays are truthy in JavaScript), leading to a runtime error when calling z.enum([]).

Add a length check to ensure the array is non-empty:

   if (schema.type === "string") {
     let stringSchema = z.string();
@@
-    if (schema.enum) {
+    if (schema.enum && schema.enum.length > 0) {
       // @ts-ignore - enum implementation matches string expectation
       return z.enum(schema.enum as [string, ...string[]]);
     }
🧹 Nitpick comments (1)
apps/mesh/src/web/components/create-organization-dialog.tsx (1)

25-40: Zod import is fine; consider tightening react-hook-form + Zod integration

The switch to import * as z from "zod"; is correct and keeps createOrgSchema working as before.

As a follow-up (not blocking this PR), you might want to align with the repo’s react-hook-form + Zod pattern by:

  • Using zodResolver(createOrgSchema) in useForm.
  • Switching mode from "onChange" to "onBlur" to match the documented UX guideline.

That would remove the need for the manual safeParse in onSubmit and centralize validation in the form config.

Also applies to: 57-79

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7650ac9 and 9b9e6c3.

⛔ Files ignored due to path filters (1)
  • bun.lockb is excluded by !**/bun.lockb
📒 Files selected for processing (38)
  • apps/mesh/package.json (1 hunks)
  • apps/mesh/src/api/routes/models.ts (1 hunks)
  • apps/mesh/src/api/utils/mcp.ts (1 hunks)
  • apps/mesh/src/core/define-tool.test.ts (1 hunks)
  • apps/mesh/src/core/define-tool.ts (1 hunks)
  • apps/mesh/src/tools/client.ts (1 hunks)
  • apps/mesh/src/tools/connection/create.ts (1 hunks)
  • apps/mesh/src/tools/connection/list.ts (1 hunks)
  • apps/mesh/src/tools/connection/schema.ts (1 hunks)
  • apps/mesh/src/tools/connection/test.ts (1 hunks)
  • apps/mesh/src/tools/connection/update.ts (1 hunks)
  • apps/mesh/src/tools/organization/create.ts (1 hunks)
  • apps/mesh/src/tools/organization/delete.ts (1 hunks)
  • apps/mesh/src/tools/organization/get.ts (1 hunks)
  • apps/mesh/src/tools/organization/list.ts (1 hunks)
  • apps/mesh/src/tools/organization/member-add.ts (1 hunks)
  • apps/mesh/src/tools/organization/member-list.ts (1 hunks)
  • apps/mesh/src/tools/organization/member-remove.ts (1 hunks)
  • apps/mesh/src/tools/organization/member-update-role.ts (1 hunks)
  • apps/mesh/src/tools/organization/settings-get.ts (1 hunks)
  • apps/mesh/src/tools/organization/settings-update.ts (1 hunks)
  • apps/mesh/src/tools/organization/update.ts (1 hunks)
  • apps/mesh/src/web/components/collections/collection-card.tsx (1 hunks)
  • apps/mesh/src/web/components/collections/collection-table.tsx (1 hunks)
  • apps/mesh/src/web/components/collections/types.ts (1 hunks)
  • apps/mesh/src/web/components/create-organization-dialog.tsx (1 hunks)
  • apps/mesh/src/web/components/details/connection.tsx (1 hunks)
  • apps/mesh/src/web/components/invite-member-dialog.tsx (1 hunks)
  • apps/mesh/src/web/hooks/collections/use-llm.ts (1 hunks)
  • apps/mesh/src/web/index.tsx (1 hunks)
  • apps/mesh/src/web/routes/orgs/connections.tsx (1 hunks)
  • apps/mesh/src/web/utils/schema-converter.ts (1 hunks)
  • docs/server/package.json (1 hunks)
  • packages/bindings/README.md (3 hunks)
  • packages/bindings/src/core/binder.ts (1 hunks)
  • packages/bindings/src/well-known/agent.ts (1 hunks)
  • packages/bindings/src/well-known/language-model.ts (1 hunks)
  • packages/bindings/test/index.test.ts (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • apps/mesh/src/web/components/details/connection.tsx
  • packages/bindings/test/index.test.ts
  • apps/mesh/src/api/utils/mcp.ts
🚧 Files skipped from review as they are similar to previous changes (17)
  • apps/mesh/src/tools/client.ts
  • apps/mesh/src/tools/organization/list.ts
  • apps/mesh/src/tools/connection/create.ts
  • apps/mesh/src/tools/organization/member-remove.ts
  • apps/mesh/src/tools/connection/schema.ts
  • apps/mesh/src/tools/organization/member-add.ts
  • apps/mesh/src/tools/organization/create.ts
  • docs/server/package.json
  • apps/mesh/src/tools/organization/delete.ts
  • apps/mesh/src/core/define-tool.test.ts
  • apps/mesh/package.json
  • apps/mesh/src/api/routes/models.ts
  • apps/mesh/src/tools/connection/update.ts
  • apps/mesh/src/tools/organization/member-update-role.ts
  • apps/mesh/src/tools/connection/list.ts
  • apps/mesh/src/tools/organization/member-list.ts
  • apps/mesh/src/tools/organization/get.ts
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

Handle loading and error states appropriately when using React Query hooks in components

Files:

  • apps/mesh/src/web/components/collections/collection-table.tsx
  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/web/index.tsx
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/web/routes/orgs/connections.tsx
  • apps/mesh/src/web/components/collections/collection-card.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react-ts.mdc)

**/*.{ts,tsx}: Write concise, maintainable, and technically accurate TypeScript code with relevant examples
Use functional and declarative programming patterns; avoid classes
Favor iteration and modularization to adhere to DRY principles and avoid code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Organize files systematically: each file should contain only related content, such as exported components, subcomponents, helpers, static content, and types
Favor named exports for functions
Use TypeScript for all code; prefer interfaces over types for their extendability and ability to merge
Avoid enums; use maps instead for better type safety and flexibility
Use functional components with TypeScript interfaces
Use the "function" keyword for pure functions to benefit from hoisting and clarity
Favor using the already-present UI components in packages/ui folder instead of creating custom components
Use useMemo to memoize expensive filtering and sorting operations in React components
Memoize object and array literals in useMemo to maintain stable references across renders
Use useDeferredValue for search operations to prevent blocking user input during expensive computations
Follow established data patterns from MCP (Model Context Protocol) Tools for consistent data fetching and use proper loading states and error handling
Always use UI components from @deco/ui instead of creating custom components that duplicate the design system
Use react-hook-form with Zod validation instead of manual useState for form management
Validate forms on blur (mode: 'onBlur') for better user experience with react-hook-form
Use context (React.createContext) to avoid prop drilling when sharing form state across multiple components
Use design system Form components (Form, FormField, FormItem, FormLabel, FormMessage) with proper error handling
Apply the Single Responsibility Principle: create focused, composable components with single concerns
Create ...

Files:

  • apps/mesh/src/web/components/collections/collection-table.tsx
  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/core/define-tool.ts
  • apps/mesh/src/tools/connection/test.ts
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/web/index.tsx
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/tools/organization/settings-get.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/tools/organization/update.ts
  • apps/mesh/src/web/hooks/collections/use-llm.ts
  • apps/mesh/src/web/routes/orgs/connections.tsx
  • packages/bindings/src/well-known/agent.ts
  • packages/bindings/src/well-known/language-model.ts
  • apps/mesh/src/web/components/collections/types.ts
  • apps/mesh/src/web/components/collections/collection-card.tsx
**/*.{ts,tsx,js,jsx,css}

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Run formatting with bun run fmt before opening pull requests

Keep Tailwind design tokens consistent per plugins/ensure-tailwind-design-system-tokens.ts which will fail builds otherwise

Files:

  • apps/mesh/src/web/components/collections/collection-table.tsx
  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/core/define-tool.ts
  • apps/mesh/src/tools/connection/test.ts
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/web/index.tsx
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/tools/organization/settings-get.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/tools/organization/update.ts
  • apps/mesh/src/web/hooks/collections/use-llm.ts
  • apps/mesh/src/web/routes/orgs/connections.tsx
  • packages/bindings/src/well-known/agent.ts
  • packages/bindings/src/well-known/language-model.ts
  • apps/mesh/src/web/components/collections/types.ts
  • apps/mesh/src/web/components/collections/collection-card.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Run linting with bun run lint before opening pull requests

**/*.{ts,tsx,js,jsx}: Use PascalCase for component and class names
Use camelCase for hooks and utility function names

Files:

  • apps/mesh/src/web/components/collections/collection-table.tsx
  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/core/define-tool.ts
  • apps/mesh/src/tools/connection/test.ts
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/web/index.tsx
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/tools/organization/settings-get.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/tools/organization/update.ts
  • apps/mesh/src/web/hooks/collections/use-llm.ts
  • apps/mesh/src/web/routes/orgs/connections.tsx
  • packages/bindings/src/well-known/agent.ts
  • packages/bindings/src/well-known/language-model.ts
  • apps/mesh/src/web/components/collections/types.ts
  • apps/mesh/src/web/components/collections/collection-card.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Keep imports sorted in all code files

Files:

  • apps/mesh/src/web/components/collections/collection-table.tsx
  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/core/define-tool.ts
  • apps/mesh/src/tools/connection/test.ts
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/web/index.tsx
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/tools/organization/settings-get.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/tools/organization/update.ts
  • apps/mesh/src/web/hooks/collections/use-llm.ts
  • apps/mesh/src/web/routes/orgs/connections.tsx
  • packages/bindings/src/well-known/agent.ts
  • packages/bindings/src/well-known/language-model.ts
  • apps/mesh/src/web/components/collections/types.ts
  • apps/mesh/src/web/components/collections/collection-card.tsx
**/*{api,tool,tools,server}*.ts

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

Tool definitions must use Zod schemas for input and output validation with strict typing

Files:

  • apps/mesh/src/core/define-tool.ts
**/*{api,tool,tools,handler}*.ts

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

**/*{api,tool,tools,handler}*.ts: Always call context.resourceAccess.grant() after authorization checks are successful in MCP tool handlers
MCP tools must return objects, not nullable primitives, as required by the Model Context Protocol
Perform authorization checks before executing business logic in MCP tool handlers using assertWorkspaceResourceAccess()

Files:

  • apps/mesh/src/core/define-tool.ts
**/*{api,tool,tools}*.ts

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

Use descriptive tool names following the pattern {RESOURCE}_{ACTION} (e.g., AGENTS_CREATE, THREADS_LIST)

Files:

  • apps/mesh/src/core/define-tool.ts
**/*{api,tool,auth,handler}*.ts

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

Use slug-based authorization for team resource access instead of numeric IDs

Files:

  • apps/mesh/src/core/define-tool.ts
**/*{server,mcp,tool}*.ts

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

MCP servers must validate all tool inputs against Zod schemas before execution

Files:

  • apps/mesh/src/core/define-tool.ts
packages/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Enforce kebab-case filenames in shared packages via plugins/enforce-kebab-case-file-names.ts

Files:

  • packages/bindings/src/core/binder.ts
  • packages/bindings/src/well-known/agent.ts
  • packages/bindings/src/well-known/language-model.ts
**/*{hook,query,use}*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

**/*{hook,query,use}*.{ts,tsx}: Use consistent React Query key patterns from the KEYS object for cache management and invalidation
Use useSuspenseQuery for critical data that must be loaded before rendering components
Cache frequently accessed data with appropriate TTL using React Query configuration
Use parallel queries in React where appropriate to improve data fetching performance

Files:

  • apps/mesh/src/web/hooks/collections/use-llm.ts
**/*{hook,mutation,use}*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

Implement optimistic updates in React Query mutations with proper rollback on error using onMutate and onError callbacks

Files:

  • apps/mesh/src/web/hooks/collections/use-llm.ts
🧠 Learnings (25)
📚 Learning: 2025-12-01T21:09:54.719Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: docs/.cursor/rules/main.mdc:0-0
Timestamp: 2025-12-01T21:09:54.719Z
Learning: Applies to docs/server/**/*.ts : Use Zod (z.object) for defining inputSchema and outputSchema in tools and workflows

Applied to files:

  • apps/mesh/src/web/components/collections/collection-table.tsx
  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/core/define-tool.ts
  • packages/bindings/README.md
  • apps/mesh/src/tools/connection/test.ts
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/web/index.tsx
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/tools/organization/settings-get.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/tools/organization/update.ts
  • apps/mesh/src/web/hooks/collections/use-llm.ts
  • apps/mesh/src/web/routes/orgs/connections.tsx
  • packages/bindings/src/well-known/agent.ts
  • packages/bindings/src/well-known/language-model.ts
  • apps/mesh/src/web/components/collections/types.ts
  • apps/mesh/src/web/components/collections/collection-card.tsx
📚 Learning: 2025-12-01T21:08:08.813Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/deconfig.mdc:0-0
Timestamp: 2025-12-01T21:08:08.813Z
Learning: Applies to packages/sdk/src/mcp/deconfig/**/*.ts : Ensure full TypeScript type safety with interfaces for all data structures, generated RPC types for tool integration, and Zod schema validation where needed

Applied to files:

  • apps/mesh/src/web/components/collections/collection-table.tsx
  • apps/mesh/src/core/define-tool.ts
  • packages/bindings/README.md
  • apps/mesh/src/tools/connection/test.ts
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/web/index.tsx
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/tools/organization/update.ts
  • apps/mesh/src/web/hooks/collections/use-llm.ts
  • apps/mesh/src/web/routes/orgs/connections.tsx
  • apps/mesh/src/web/components/collections/types.ts
  • apps/mesh/src/web/components/collections/collection-card.tsx
📚 Learning: 2025-12-01T21:08:50.051Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/react-ts.mdc:0-0
Timestamp: 2025-12-01T21:08:50.051Z
Learning: Applies to **/*.{ts,tsx} : Use react-hook-form with Zod validation instead of manual useState for form management

Applied to files:

  • apps/mesh/src/web/components/collections/collection-table.tsx
  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/web/index.tsx
  • apps/mesh/src/tools/organization/settings-get.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/web/routes/orgs/connections.tsx
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{api,tool,tools,server}*.ts : Tool definitions must use Zod schemas for input and output validation with strict typing

Applied to files:

  • apps/mesh/src/web/components/collections/collection-table.tsx
  • apps/mesh/src/core/define-tool.ts
  • packages/bindings/README.md
  • apps/mesh/src/tools/connection/test.ts
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/web/index.tsx
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/tools/organization/settings-get.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/tools/organization/update.ts
  • packages/bindings/src/well-known/agent.ts
  • packages/bindings/src/well-known/language-model.ts
  • apps/mesh/src/web/components/collections/types.ts
📚 Learning: 2025-12-01T21:08:29.999Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/native-apps-and-views.mdc:0-0
Timestamp: 2025-12-01T21:08:29.999Z
Learning: Applies to packages/sdk/src/hooks/*.ts : Create React Query hooks using `useQuery` for data fetching and `useMutation` for updates, with proper cache invalidation on success

Applied to files:

  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/web/components/create-organization-dialog.tsx
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{hook,query,use}*.{ts,tsx} : Cache frequently accessed data with appropriate TTL using React Query configuration

Applied to files:

  • apps/mesh/src/web/components/invite-member-dialog.tsx
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*.{tsx,jsx} : Handle loading and error states appropriately when using React Query hooks in components

Applied to files:

  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/web/components/create-organization-dialog.tsx
📚 Learning: 2025-12-01T21:08:50.051Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/react-ts.mdc:0-0
Timestamp: 2025-12-01T21:08:50.051Z
Learning: Applies to **/*.{ts,tsx} : Use useMemo to memoize expensive filtering and sorting operations in React components

Applied to files:

  • apps/mesh/src/web/components/invite-member-dialog.tsx
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{hook,query,use}*.{ts,tsx} : Use parallel queries in React where appropriate to improve data fetching performance

Applied to files:

  • apps/mesh/src/web/components/invite-member-dialog.tsx
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{hook,query,use}*.{ts,tsx} : Use `useSuspenseQuery` for critical data that must be loaded before rendering components

Applied to files:

  • apps/mesh/src/web/components/invite-member-dialog.tsx
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{hook,mutation,use}*.{ts,tsx} : Implement optimistic updates in React Query mutations with proper rollback on error using `onMutate` and `onError` callbacks

Applied to files:

  • apps/mesh/src/web/components/invite-member-dialog.tsx
📚 Learning: 2025-12-01T21:08:50.051Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/react-ts.mdc:0-0
Timestamp: 2025-12-01T21:08:50.051Z
Learning: Applies to **/*.{ts,tsx} : Use context (React.createContext) to avoid prop drilling when sharing form state across multiple components

Applied to files:

  • apps/mesh/src/web/components/invite-member-dialog.tsx
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/web/routes/orgs/connections.tsx
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{hook,query,use}*.{ts,tsx} : Use consistent React Query key patterns from the `KEYS` object for cache management and invalidation

Applied to files:

  • apps/mesh/src/web/components/invite-member-dialog.tsx
📚 Learning: 2025-12-01T21:07:33.821Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/api-development.mdc:0-0
Timestamp: 2025-12-01T21:07:33.821Z
Learning: Applies to packages/sdk/src/mcp/index.ts : Export all API tools in `packages/sdk/src/mcp/index.ts` by adding import statements and registering tools in the WORKSPACE_TOOLS array

Applied to files:

  • apps/mesh/src/core/define-tool.ts
  • apps/mesh/src/tools/connection/test.ts
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/web/index.tsx
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/tools/organization/update.ts
📚 Learning: 2025-12-01T21:07:33.821Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/api-development.mdc:0-0
Timestamp: 2025-12-01T21:07:33.821Z
Learning: Applies to packages/sdk/src/mcp/*/api.ts : Define separate Zod schemas for input validation (`InputSchema`) and output validation (`OutputSchema`) with clear descriptions

Applied to files:

  • apps/mesh/src/core/define-tool.ts
  • packages/bindings/README.md
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/collections/types.ts
📚 Learning: 2025-12-01T21:07:33.821Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/api-development.mdc:0-0
Timestamp: 2025-12-01T21:07:33.821Z
Learning: Applies to packages/sdk/src/mcp/*/api.ts : Create MCP API module at `packages/sdk/src/mcp/{feature}/api.ts` with basic file structure including Zod schemas, TypeScript types, mappers, and tool group creation

Applied to files:

  • apps/mesh/src/core/define-tool.ts
  • apps/mesh/src/tools/organization/settings-update.ts
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/web/utils/schema-converter.ts
  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/tools/organization/update.ts
📚 Learning: 2025-12-01T21:09:54.719Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: docs/.cursor/rules/main.mdc:0-0
Timestamp: 2025-12-01T21:09:54.719Z
Learning: Applies to docs/server/**/*.ts : Define tools as functions that create tool instances with id, description, inputSchema, outputSchema, and execute method in server/main.ts

Applied to files:

  • apps/mesh/src/core/define-tool.ts
  • packages/bindings/README.md
  • apps/mesh/src/tools/organization/settings-update.ts
  • apps/mesh/src/tools/organization/settings-get.ts
  • apps/mesh/src/tools/organization/update.ts
📚 Learning: 2025-12-01T21:08:29.999Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/native-apps-and-views.mdc:0-0
Timestamp: 2025-12-01T21:08:29.999Z
Learning: Applies to packages/sdk/src/mcp/index.ts : Register MCP tools in PROJECT_TOOLS or ORG_TOOLS collections in `packages/sdk/src/mcp/index.ts` with appropriate scoping

Applied to files:

  • packages/bindings/README.md
📚 Learning: 2025-12-01T21:07:47.300Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/data-flow.mdc:0-0
Timestamp: 2025-12-01T21:07:47.300Z
Learning: Applies to **/*{server,mcp,tool}*.ts : MCP servers must validate all tool inputs against Zod schemas before execution

Applied to files:

  • apps/mesh/src/tools/organization/settings-update.ts
  • packages/bindings/src/core/binder.ts
  • apps/mesh/src/tools/organization/settings-get.ts
📚 Learning: 2025-12-01T21:09:05.323Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/structure.mdc:0-0
Timestamp: 2025-12-01T21:09:05.323Z
Learning: Applies to apps/web/src/**/*.{ts,tsx} : Use React 19 for UI development in the decocms admin shell and marketplace

Applied to files:

  • apps/mesh/src/web/index.tsx
📚 Learning: 2025-12-01T21:08:29.999Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/native-apps-and-views.mdc:0-0
Timestamp: 2025-12-01T21:08:29.999Z
Learning: Applies to packages/sdk/src/mcp/**/*.ts : MCP tools must return objects, not nullable primitives; use object wrappers with outputSchema for return values

Applied to files:

  • packages/bindings/src/core/binder.ts
📚 Learning: 2025-12-01T21:08:08.813Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/deconfig.mdc:0-0
Timestamp: 2025-12-01T21:08:08.813Z
Learning: Applies to packages/sdk/src/mcp/deconfig/**/*.ts : Diff operations must support cross-namespace diffing, return only differences (add/modify/delete), and work with path prefixes for scoped operations

Applied to files:

  • apps/mesh/src/web/utils/schema-converter.ts
📚 Learning: 2025-12-01T21:08:50.051Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/react-ts.mdc:0-0
Timestamp: 2025-12-01T21:08:50.051Z
Learning: Applies to **/*.{ts,tsx} : Use design system Form components (Form, FormField, FormItem, FormLabel, FormMessage) with proper error handling

Applied to files:

  • apps/mesh/src/web/components/create-organization-dialog.tsx
  • apps/mesh/src/web/routes/orgs/connections.tsx
📚 Learning: 2025-12-01T21:08:29.999Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/native-apps-and-views.mdc:0-0
Timestamp: 2025-12-01T21:08:29.999Z
Learning: Applies to apps/web/src/main.tsx : Add route for native app view to main.tsx with appropriate path pattern (org-level or project-level)

Applied to files:

  • apps/mesh/src/web/routes/orgs/connections.tsx
📚 Learning: 2025-12-01T21:08:50.051Z
Learnt from: CR
Repo: decocms/admin PR: 0
File: .cursor/rules/react-ts.mdc:0-0
Timestamp: 2025-12-01T21:08:50.051Z
Learning: Applies to **/*.{ts,tsx} : Validate forms on blur (mode: 'onBlur') for better user experience with react-hook-form

Applied to files:

  • apps/mesh/src/web/routes/orgs/connections.tsx
🪛 GitHub Actions: Tests
apps/mesh/src/web/components/collections/collection-table.tsx

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/web/components/invite-member-dialog.tsx

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/core/define-tool.ts

[error] 1-1: Process completed with exit code 2.

packages/bindings/README.md

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/tools/connection/test.ts

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/tools/organization/settings-update.ts

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/web/index.tsx

[error] 1-1: Process completed with exit code 2.

packages/bindings/src/core/binder.ts

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/tools/organization/settings-get.ts

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/web/utils/schema-converter.ts

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/web/components/create-organization-dialog.tsx

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/tools/organization/update.ts

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/web/hooks/collections/use-llm.ts

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/web/routes/orgs/connections.tsx

[error] 231-231: Argument of type '{ id: ${string}-${string}-${string}-${string}-${string}; title: string; description: string | null; connection_type: "HTTP" | "SSE" | "Websocket"; connection_url: string; connection_token: string | null; created_at: string; updated_at: string; status: "inactive"; organization_id: string; }' is not assignable to parameter of type '{ status: "active" | "inactive" | "error"; description: string | null; id: string; title: string; created_at: string; updated_at: string; created_by: string; organization_id: string; icon: string | null; ... 10 more ...; updated_by?: string | undefined; } | { ...; }[]'.


[error] 231-231: Type '{ id: ${string}-${string}-${string}-${string}-${string}; title: string; description: string | null; connection_type: "HTTP" | "SSE" | "Websocket"; connection_url: string; connection_token: string | null; created_at: string; updated_at: string; status: "inactive"; organization_id: string; }' is missing the following properties from type '{ status: "active" | "inactive" | "error"; description: string | null; id: string; title: string; created_at: string; updated_at: string; created_by: string; organization_id: string; icon: string | null; ... 10 more ...; updated_by?: string | undefined; }': created_by, icon, app_name, app_id, and 5 more.


[error] 1-1: Process completed with exit code 2.

packages/bindings/src/well-known/agent.ts

[error] 1-1: Process completed with exit code 2.

packages/bindings/src/well-known/language-model.ts

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/web/components/collections/types.ts

[error] 1-1: Process completed with exit code 2.

apps/mesh/src/web/components/collections/collection-card.tsx

[error] 1-1: Process completed with exit code 2.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (17)
apps/mesh/src/tools/organization/settings-update.ts (1)

1-1: Zod import path standardization looks good, just re-run checks.

Importing z from "zod" instead of "zod/v3" keeps the existing schemas intact and aligns with the PR goal of simplifying bindings/imports. Please re-run bun run check / tests locally and confirm the CI failure isn’t related to module resolution for zod in the mesh/tools environment.

Based on learnings, this continues to follow the guideline of using Zod schemas for tool input/output.

apps/mesh/src/tools/organization/update.ts (1)

7-7: Import migration to "zod" is complete and consistent.

The change from "zod/v3" to "zod" is correct and aligns with the project-wide zod import migration. Verification confirms no remaining "zod/v3" imports exist in the codebase, ensuring consistency across all files.

apps/mesh/src/tools/connection/test.ts (1)

7-7: Import path is correct and migration is complete.

The import change from "zod/v3" to "zod" is correct and properly aligned with the zod v3.25.76 version in package.json. Verification confirms:

  • No remaining "zod/v3" imports exist in the codebase
  • All zod imports in apps/mesh/src consistently use the "zod" path
  • The tool definition structure at this file follows the established pattern with proper Zod schema usage
apps/mesh/src/tools/organization/settings-get.ts (1)

1-1: The zod import has been correctly updated and requires no further action.

The import path modernization from "zod/v3" to "zod" has already been completed. The file shows the correct import statement, zod is properly configured in apps/mesh/package.json at version ^3.25.76, and all other tool files in the codebase follow the same pattern. No test failures related to this change exist.

packages/bindings/src/core/binder.ts (1)

8-8: Zod type import normalized to top-level package — LGTM

Using import type { ZodType } from "zod"; keeps this file type-only with no runtime impact and aligns with the repo‑wide zod import migration. Please re‑run bun run check and bun run test after the dependency bump to ensure there are no type resolution regressions around these schemas.

apps/mesh/src/web/components/collections/collection-table.tsx (1)

5-26: Collection table schema type import updated — OK

Switching to import type { z } from "zod"; for schema: z.AnyZodObject keeps this purely type‑level and in line with the zod migration, with no changes to the table rendering behavior.

apps/mesh/src/web/components/collections/types.ts (1)

1-6: CollectionsListProps schema typing aligned with zod import

Updating to import type { z } from "zod"; for the optional schema?: z.AnyZodObject keeps this interface API identical while matching the new zod import convention.

apps/mesh/src/web/components/invite-member-dialog.tsx (1)

1-37: Invite dialog Zod import path normalized — behavior unchanged

Importing z from "zod" instead of "zod/v3" keeps the emailSchema validation semantics the same while aligning with the rest of the app’s zod usage. Please re‑run typecheck/tests to confirm there are no bundler or resolution surprises after this path change.

apps/mesh/src/core/define-tool.ts (1)

13-58: defineTool Zod import consolidated — LGTM

Using import { z } from "zod"; keeps all z.ZodType and z.infer usages intact while aligning this core tooling module with the standardized zod import; the tool definition and execution semantics remain unchanged.

packages/bindings/src/well-known/agent.ts (1)

11-60: Agent binding now imports Zod from normalized path — OK

Switching to import { z } from "zod"; leaves AgentSchema, AGENTS_COLLECTION_BINDING, and AGENTS_BINDING behavior unchanged while matching the new bindings/collections zod import convention.

packages/bindings/README.md (3)

39-78: Docs: binding example updated to use zod import

The CHANNEL_BINDING example now imports z from "zod", matching the package’s peer dependency and the rest of the codebase.


245-283: Docs: collection bindings example normalized to zod

The Todo collection bindings example correctly shows import { z } from "zod";, keeping the documentation aligned with the actual API usage.


495-566: Docs: MCP implementation example now uses zod import

The MCP server Todo implementation sample has been updated to import z from "zod", consistent with the rest of the documentation and code.

apps/mesh/src/web/hooks/collections/use-llm.ts (1)

8-19: Zod import path update looks correct and non-breaking

Switching to import { z } from "zod"; keeps the LLM inferred type and hook behavior intact; no further changes needed here.

apps/mesh/src/web/index.tsx (1)

14-38: Route search validation still correct after zod import change

Using import * as z from "zod"; keeps the existing z.lazy + z.object search-schema validation intact; behavior is unchanged and consistent with the rest of the PR.

packages/bindings/src/well-known/language-model.ts (1)

13-19: Schema module now correctly imports from the main zod package

Updating to import { z } from "zod"; keeps all schemas and the LANGUAGE_MODEL_BINDING definition intact with no observable behavior change.

apps/mesh/src/web/components/collections/collection-card.tsx (1)

11-18: Zod type/value imports from the main package are correctly wired

Using import type { z } from "zod"; alongside import { ZodString } from "zod"; keeps both the z.AnyZodObject typing and the instanceof ZodString runtime guard working as before. No changes needed here.

Also applies to: 28-36

import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { z } from "zod/v3";
import { z } from "zod";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix collection.insert type mismatch causing the pipeline failure

  • The zod import (import { z } from "zod";) is fine and consistent with the rest of the repo.
  • The blocking issue is the collection.insert call: the object you pass only includes a “create” subset of fields, but the function is typed as accepting a full ConnectionEntity (or array). This is exactly what the GitHub Actions error is reporting.

To restore type compatibility in this UI layer without overhauling the collection typings, you can follow the comment and cast through unknown to ConnectionEntity:

-      } else {
-        // Create new connection - cast through unknown because the insert API
-        // accepts ConnectionCreateInput but the collection is typed as ConnectionEntity
-        const tx = collection.insert({
-          id: crypto.randomUUID(),
-          title: data.title,
-          description: data.description || null,
-          connection_type: data.connection_type,
-          connection_url: data.connection_url,
-          connection_token: data.connection_token || null,
-          created_at: new Date().toISOString(),
-          updated_at: new Date().toISOString(),
-          status: "inactive",
-          organization_id: org,
-        });
-        await tx.isPersisted.promise;
-      }
+      } else {
+        // Create new connection - the insert API expects a ConnectionEntity-shaped
+        // value, but some fields are server-populated. Cast through unknown to
+        // satisfy the type while sending only the client-known fields.
+        const tx = collection.insert(
+          {
+            id: crypto.randomUUID(),
+            title: data.title,
+            description: data.description || null,
+            connection_type: data.connection_type,
+            connection_url: data.connection_url,
+            connection_token: data.connection_token || null,
+            created_at: new Date().toISOString(),
+            updated_at: new Date().toISOString(),
+            status: "inactive",
+            organization_id: org,
+          } as unknown as ConnectionEntity,
+        );
+        await tx.isPersisted.promise;
+      }

This should clear the TypeScript error mentioned in the pipeline while keeping runtime behavior the same. If you plan to introduce a dedicated ConnectionCreateInput type in the bindings, that would be the longer-term, more strongly typed solution.

Also applies to: 206-245

🤖 Prompt for AI Agents
In apps/mesh/src/web/routes/orgs/connections.tsx around line 63 (and similarly
lines 206-245), the call to collection.insert is passing an object with only the
"create" subset of fields, but the function is typed to accept a full
ConnectionEntity (or array), causing a TypeScript type error in CI; fix it by
casting the create-object to unknown and then to ConnectionEntity before calling
collection.insert (e.g. (createObj as unknown as ConnectionEntity)) so the UI
layer compiles without changing runtime behavior; consider introducing a
dedicated ConnectionCreateInput type in the bindings later for stronger typing.

…up configuration. The package version is bumped to 1.0.0, and the npm publish command is simplified by setting the working directory directly.
@viktormarinho viktormarinho changed the title simplify bindings collections package remove build from @decocms/bindings, fix ts check oom Dec 1, 2025
@viktormarinho viktormarinho merged commit b4fbb00 into main Dec 1, 2025
2 of 3 checks passed
@viktormarinho viktormarinho deleted the fix-ts branch December 1, 2025 22:43
This was referenced Dec 2, 2025
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