remove build from @decocms/bindings, fix ts check oom#1908
remove build from @decocms/bindings, fix ts check oom#1908viktormarinho merged 9 commits intomainfrom
Conversation
WalkthroughThis PR simplifies the collections API surface by removing per-entity generic type factories and unifying the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (3 warnings)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
Deploying decocms-admin-frontend with
|
| 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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 inpackages/uifolder 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 fmtbefore opening pull requestsKeep Tailwind design tokens consistent per
plugins/ensure-tailwind-design-system-tokens.tswhich 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 lintbefore 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
conditionsfield accepts onlyComparisonExpressionSchema[], preventing nested logical expressions likeAND(OR(a, b), OR(c, d)). Also, thenotoperator 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,
conditionsshould referenceWhereExpressionSchemarecursively usingz.lazy().
158-167: LGTM!The simplified generic output types are clean and provide a clear contract for consumers. Note:
CollectionInsertOutput<T>correctly showsitem: T(non-nullable), which aligns with the fix suggested above for the CREATE binding schema.
There was a problem hiding this comment.
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 clearernotsemanticsRight now, logical groups (
operator: "and" | "or" | "not") can only containComparisonExpressionSchemaitems and cannot nest other groups, andoperator: "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 aNOTover a single sub-expression, consider switchingconditionsto something likez.array(WhereExpressionSchema).min(1)viaz.lazy, and optionally constrainingnotto 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 assumptionsUsing a simple
{ id: z.string() }for bothCollectionGetInputSchemaandCollectionDeleteInputSchemais 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 theidtype or introduce a more flexible key/where structure for these operations.
91-124: TightenentitySchematyping for update helpers to avoid unsafe castsThe CRUD helper schemas are generally well-shaped (full
datafor insert, partialdatafor update, and entity-returning outputs). The main concern is increateCollectionUpdateInputSchemawhere you castentitySchematoz.AnyZodObjectjust 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 ofentitySchematoz.AnyZodObjectend-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, andcreateCollectionBindingsto acceptz.AnyZodObjectfor 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
📒 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 inpackages/uifolder 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 fmtbefore opening pull requestsKeep Tailwind design tokens consistent per
plugins/ensure-tailwind-design-system-tokens.tswhich 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 lintbefore 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 reusableStandardizing on
id,title, timestamps, and optionalcreated_by/updated_bygives 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
createCollectionListOutputSchemareturning{ items, totalCount?, hasMore? }andcreateCollectionGetOutputSchemareturning{ 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 usageThe new
createCollectionBindingsimplementation reads cleanly: LIST/GET tools are always present, and CREATE/UPDATE/DELETE are only added whenreadOnlyis false, with mutation tools markedopt: true. Tool names derived fromcollectionName.toUpperCase()keep things predictable.Two things worth double-checking:
- That
readOnly: truecollections 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 surfaceThe exported aliases (
BaseCollectionEntity,WhereExpression,OrderByExpression, the variousCollection*Inputtypes, and the genericCollection*Output<T>shapes) line up with the Zod schemas above and should make it straightforward for callers to type tool responses. UsingT | nullonly forCollectionGetOutputwhile keeping mutation outputs non-nullable is a reasonable distinction between “lookup may not find anything” and “successful mutation returns an entity.”
…et, insert, update, and delete operations, improving code organization and reusability.
…r CRUD operations, improving documentation and TypeScript support.
There was a problem hiding this comment.
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 errorsThe 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-ignorecomment bypasses this check. Ifschema.enumis an empty array, the conditionif (schema.enum)still passes (empty arrays are truthy in JavaScript), leading to a runtime error when callingz.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 integrationThe switch to
import * as z from "zod";is correct and keepscreateOrgSchemaworking 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)inuseForm.- Switching
modefrom"onChange"to"onBlur"to match the documented UX guideline.That would remove the need for the manual
safeParseinonSubmitand centralize validation in the form config.Also applies to: 57-79
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockbis 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.tsxapps/mesh/src/web/components/invite-member-dialog.tsxapps/mesh/src/web/index.tsxapps/mesh/src/web/components/create-organization-dialog.tsxapps/mesh/src/web/routes/orgs/connections.tsxapps/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 inpackages/uifolder 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.tsxapps/mesh/src/web/components/invite-member-dialog.tsxapps/mesh/src/core/define-tool.tsapps/mesh/src/tools/connection/test.tsapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/web/index.tsxpackages/bindings/src/core/binder.tsapps/mesh/src/tools/organization/settings-get.tsapps/mesh/src/web/utils/schema-converter.tsapps/mesh/src/web/components/create-organization-dialog.tsxapps/mesh/src/tools/organization/update.tsapps/mesh/src/web/hooks/collections/use-llm.tsapps/mesh/src/web/routes/orgs/connections.tsxpackages/bindings/src/well-known/agent.tspackages/bindings/src/well-known/language-model.tsapps/mesh/src/web/components/collections/types.tsapps/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 fmtbefore opening pull requestsKeep Tailwind design tokens consistent per
plugins/ensure-tailwind-design-system-tokens.tswhich will fail builds otherwise
Files:
apps/mesh/src/web/components/collections/collection-table.tsxapps/mesh/src/web/components/invite-member-dialog.tsxapps/mesh/src/core/define-tool.tsapps/mesh/src/tools/connection/test.tsapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/web/index.tsxpackages/bindings/src/core/binder.tsapps/mesh/src/tools/organization/settings-get.tsapps/mesh/src/web/utils/schema-converter.tsapps/mesh/src/web/components/create-organization-dialog.tsxapps/mesh/src/tools/organization/update.tsapps/mesh/src/web/hooks/collections/use-llm.tsapps/mesh/src/web/routes/orgs/connections.tsxpackages/bindings/src/well-known/agent.tspackages/bindings/src/well-known/language-model.tsapps/mesh/src/web/components/collections/types.tsapps/mesh/src/web/components/collections/collection-card.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)
Run linting with
bun run lintbefore 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.tsxapps/mesh/src/web/components/invite-member-dialog.tsxapps/mesh/src/core/define-tool.tsapps/mesh/src/tools/connection/test.tsapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/web/index.tsxpackages/bindings/src/core/binder.tsapps/mesh/src/tools/organization/settings-get.tsapps/mesh/src/web/utils/schema-converter.tsapps/mesh/src/web/components/create-organization-dialog.tsxapps/mesh/src/tools/organization/update.tsapps/mesh/src/web/hooks/collections/use-llm.tsapps/mesh/src/web/routes/orgs/connections.tsxpackages/bindings/src/well-known/agent.tspackages/bindings/src/well-known/language-model.tsapps/mesh/src/web/components/collections/types.tsapps/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.tsxapps/mesh/src/web/components/invite-member-dialog.tsxapps/mesh/src/core/define-tool.tsapps/mesh/src/tools/connection/test.tsapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/web/index.tsxpackages/bindings/src/core/binder.tsapps/mesh/src/tools/organization/settings-get.tsapps/mesh/src/web/utils/schema-converter.tsapps/mesh/src/web/components/create-organization-dialog.tsxapps/mesh/src/tools/organization/update.tsapps/mesh/src/web/hooks/collections/use-llm.tsapps/mesh/src/web/routes/orgs/connections.tsxpackages/bindings/src/well-known/agent.tspackages/bindings/src/well-known/language-model.tsapps/mesh/src/web/components/collections/types.tsapps/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 callcontext.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 usingassertWorkspaceResourceAccess()
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.tspackages/bindings/src/well-known/agent.tspackages/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 theKEYSobject for cache management and invalidation
UseuseSuspenseQueryfor 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
onMutateandonErrorcallbacks
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.tsxapps/mesh/src/web/components/invite-member-dialog.tsxapps/mesh/src/core/define-tool.tspackages/bindings/README.mdapps/mesh/src/tools/connection/test.tsapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/web/index.tsxpackages/bindings/src/core/binder.tsapps/mesh/src/tools/organization/settings-get.tsapps/mesh/src/web/utils/schema-converter.tsapps/mesh/src/web/components/create-organization-dialog.tsxapps/mesh/src/tools/organization/update.tsapps/mesh/src/web/hooks/collections/use-llm.tsapps/mesh/src/web/routes/orgs/connections.tsxpackages/bindings/src/well-known/agent.tspackages/bindings/src/well-known/language-model.tsapps/mesh/src/web/components/collections/types.tsapps/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.tsxapps/mesh/src/core/define-tool.tspackages/bindings/README.mdapps/mesh/src/tools/connection/test.tsapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/web/index.tsxpackages/bindings/src/core/binder.tsapps/mesh/src/web/utils/schema-converter.tsapps/mesh/src/web/components/create-organization-dialog.tsxapps/mesh/src/tools/organization/update.tsapps/mesh/src/web/hooks/collections/use-llm.tsapps/mesh/src/web/routes/orgs/connections.tsxapps/mesh/src/web/components/collections/types.tsapps/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.tsxapps/mesh/src/web/components/invite-member-dialog.tsxapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/web/index.tsxapps/mesh/src/tools/organization/settings-get.tsapps/mesh/src/web/utils/schema-converter.tsapps/mesh/src/web/components/create-organization-dialog.tsxapps/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.tsxapps/mesh/src/core/define-tool.tspackages/bindings/README.mdapps/mesh/src/tools/connection/test.tsapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/web/index.tsxpackages/bindings/src/core/binder.tsapps/mesh/src/tools/organization/settings-get.tsapps/mesh/src/web/utils/schema-converter.tsapps/mesh/src/web/components/create-organization-dialog.tsxapps/mesh/src/tools/organization/update.tspackages/bindings/src/well-known/agent.tspackages/bindings/src/well-known/language-model.tsapps/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.tsxapps/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.tsxapps/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.tsxapps/mesh/src/web/components/create-organization-dialog.tsxapps/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.tsapps/mesh/src/tools/connection/test.tsapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/web/index.tsxapps/mesh/src/web/utils/schema-converter.tsapps/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.tspackages/bindings/README.mdpackages/bindings/src/core/binder.tsapps/mesh/src/web/utils/schema-converter.tsapps/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.tsapps/mesh/src/tools/organization/settings-update.tspackages/bindings/src/core/binder.tsapps/mesh/src/web/utils/schema-converter.tsapps/mesh/src/web/components/create-organization-dialog.tsxapps/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.tspackages/bindings/README.mdapps/mesh/src/tools/organization/settings-update.tsapps/mesh/src/tools/organization/settings-get.tsapps/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.tspackages/bindings/src/core/binder.tsapps/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.tsxapps/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
zfrom"zod"instead of"zod/v3"keeps the existing schemas intact and aligns with the PR goal of simplifying bindings/imports. Please re-runbun run check/ tests locally and confirm the CI failure isn’t related to module resolution forzodin 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 inpackage.json. Verification confirms:
- No remaining
"zod/v3"imports exist in the codebase- All zod imports in
apps/mesh/srcconsistently 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 inapps/mesh/package.jsonat 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 — LGTMUsing
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‑runbun run checkandbun run testafter 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 — OKSwitching to
import type { z } from "zod";forschema: z.AnyZodObjectkeeps 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 withzodimportUpdating to
import type { z } from "zod";for the optionalschema?: z.AnyZodObjectkeeps 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 unchangedImporting
zfrom"zod"instead of"zod/v3"keeps theemailSchemavalidation 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 — LGTMUsing
import { z } from "zod";keeps allz.ZodTypeandz.inferusages 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 — OKSwitching to
import { z } from "zod";leavesAgentSchema,AGENTS_COLLECTION_BINDING, andAGENTS_BINDINGbehavior unchanged while matching the new bindings/collections zod import convention.packages/bindings/README.md (3)
39-78: Docs: binding example updated to usezodimportThe CHANNEL_BINDING example now imports
zfrom"zod", matching the package’s peer dependency and the rest of the codebase.
245-283: Docs: collection bindings example normalized tozodThe 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 useszodimportThe MCP server Todo implementation sample has been updated to import
zfrom"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-breakingSwitching to
import { z } from "zod";keeps theLLMinferred 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 changeUsing
import * as z from "zod";keeps the existingz.lazy+z.objectsearch-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 mainzodpackageUpdating to
import { z } from "zod";keeps all schemas and theLANGUAGE_MODEL_BINDINGdefinition 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 wiredUsing
import type { z } from "zod";alongsideimport { ZodString } from "zod";keeps both thez.AnyZodObjecttyping and theinstanceof ZodStringruntime 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"; |
There was a problem hiding this comment.
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.insertcall: the object you pass only includes a “create” subset of fields, but the function is typed as accepting a fullConnectionEntity(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.
What is this contribution about?
Screenshots/Demonstration
Review Checklist
Summary by CodeRabbit
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.