-
Notifications
You must be signed in to change notification settings - Fork 4
fix: Fix build scripts to enhance tree shaking #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughConverts many libs to dual CJS/ESM distributions with conditional exports and esbuild CJS/ESM build targets; reorganizes SDK auth option types/schemas into modular schema/interface/utils; adds a client-side MDX renderer and runtime transpile/execute APIs; applies bundler-friendly lazy imports and externals across UI/uipack and SDK. Changes
Sequence Diagram(s)sequenceDiagram
participant Server as Server (render pipeline)
participant MDX as MdxClientRenderer
participant Browser as Browser (client)
participant CDN as CDN (module URLs)
Note over Server,MDX: Server prepares HTML + client bootstrap script
Server->>MDX: transpile(template) → TranspileResult (hash)
MDX-->>Server: HTML with container + inline ES module (uses CDN URLs)
Note over Browser,CDN: Browser loads and runs client bundle
Browser->>CDN: import mdx, react, react-dom, jsx-runtime (CDN)
CDN-->>Browser: deliver modules
Browser->>Browser: compile/evaluate MDX, create elements, render into container
Browser-->>Server: optional console logs/errors
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
| Status | Scanner | Total (0) | ||||
|---|---|---|---|---|---|---|
| Open Source Security | 0 | 0 | 0 | 0 | See details | |
| ✅ | Code Security | 0 | 0 | 0 | 0 | 0 issues |
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
libs/ui/src/renderers/mdx.renderer.ts (1)
39-42: Align MDX renderer React version with peer dependencies and react.renderer consistency.The
REACT_CDNhardcodes React 18, butreact.renderer.tsuses React 19 via esm.sh, and peer dependencies declare support for both^18.0.0 || ^19.0.0. Consumers using React 19 will load React 18 from this CDN, creating a version mismatch during hydration ingetRuntimeScripts()(lines 216-232) andbuildMdxHydrationScript().Update lines 40-41 to use React 19 ESM:
react: 'https://esm.sh/react@19', reactDom: 'https://esm.sh/react-dom@19/client',This aligns with
react.renderer.tsand honors the documented peer dependency range.
🧹 Nitpick comments (5)
libs/ui/src/renderers/transpiler.ts (1)
81-91: Consider edge case when module.exports is empty.If the transpiled code doesn't export anything,
Object.keys(module.exports)[0]returnsundefined, and the function returns an emptymodule.exportsobject. This may be intentional, but consider whether a more explicit error would help debugging.🔎 Optional: Add explicit handling for empty exports
// Return the default export or first export - return module.exports['default'] || module.exports[Object.keys(module.exports)[0]] || module.exports; + if (module.exports['default']) { + return module.exports['default']; + } + const keys = Object.keys(module.exports); + if (keys.length > 0) { + return module.exports[keys[0]]; + } + // No exports found - return the empty exports object + return module.exports; } catch (error) {libs/ui/src/renderers/mdx.renderer.ts (1)
185-189: Potential prop collision when spreading output properties.Spreading
context.outputat the top level (line 188) could overwrite reserved prop names likeinput,output,structuredContent, orhelpersif the output object contains keys with these names.Suggested safer approach
// Spread output properties at top level for convenience - const spreadProps = { - ...props, - ...(typeof context.output === 'object' && context.output !== null ? context.output : {}), - }; + const outputData = typeof context.output === 'object' && context.output !== null ? context.output : {}; + const reservedKeys = new Set(['input', 'output', 'structuredContent', 'helpers', 'components']); + const safeSpread: Record<string, unknown> = {}; + for (const [key, value] of Object.entries(outputData)) { + if (!reservedKeys.has(key)) { + safeSpread[key] = value; + } + } + const spreadProps = { + ...props, + ...safeSpread, + };libs/uipack/src/registry/render-template.ts (1)
14-16: DuplicateReactComponentTypedefinition exists in codebase.This local
ReactComponentTypedefinition duplicates the one inlibs/uipack/src/renderers/types.ts(line 251). Consider importing from the centralized types file to avoid divergence.Suggested consolidation
-// Type-only definitions for React-like component types (no runtime dependency) -// eslint-disable-next-line @typescript-eslint/no-explicit-any -type ReactComponentType<P = any> = ((props: P) => unknown) & { displayName?: string; name?: string }; +import type { ReactComponentType } from '../renderers/types';Note: The signatures differ slightly (
unknownreturn vsanyreturn), so verify compatibility before consolidating.libs/uipack/src/renderers/index.ts (1)
80-84: Consider adding a deprecation comment for the deprecated utility exports.The
executeTranspiledCodeandtranspileAndExecuteexports are deprecated stubs that throw runtime errors. Adding a brief comment here would help maintainers understand these are intentionally kept for backward compatibility.Suggested documentation
// Utilities export { isReactComponent, isTemplateBuilderFunction, containsJsx, containsMdxSyntax, isPlainHtml, detectTemplateType, hashString, hashCombined, isHash, transpileJsx, isSwcAvailable, + // Deprecated - these throw errors directing to @frontmcp/ui/renderers executeTranspiledCode, transpileAndExecute, } from './utils';libs/uipack/src/renderers/mdx-client.renderer.ts (1)
35-40: Hardcoded CDN versions may require updates.The React 19 and MDX 3 versions are hardcoded. Consider making these configurable via options or extracting to a constants file for easier maintenance when upgrading.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (5)
libs/cli/src/commands/build/adapters/cloudflare.tsis excluded by!**/build/**libs/cli/src/commands/build/adapters/vercel.tsis excluded by!**/build/**libs/cli/src/commands/build/bundler.tsis excluded by!**/build/**libs/cli/src/commands/build/index.tsis excluded by!**/build/**libs/cli/src/commands/build/types.tsis excluded by!**/build/**
📒 Files selected for processing (24)
libs/adapters/package.jsonlibs/adapters/project.jsonlibs/json-schema-to-zod-v3/package.jsonlibs/json-schema-to-zod-v3/project.jsonlibs/mcp-from-openapi/package.jsonlibs/mcp-from-openapi/project.jsonlibs/plugins/package.jsonlibs/plugins/project.jsonlibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/testing/jest-preset.jslibs/testing/package.jsonlibs/testing/project.jsonlibs/ui/src/renderers/index.tslibs/ui/src/renderers/mdx.renderer.tslibs/ui/src/renderers/transpiler.tslibs/uipack/project.jsonlibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/src/dependency/template-processor.tslibs/uipack/src/registry/render-template.tslibs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/renderers/mdx.renderer.d.tslibs/uipack/src/renderers/types.tslibs/uipack/src/renderers/utils/transpiler.ts
💤 Files with no reviewable changes (1)
- libs/uipack/src/renderers/mdx.renderer.d.ts
🧰 Additional context used
📓 Path-based instructions (7)
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/testing/jest-preset.jslibs/uipack/src/dependency/template-processor.tslibs/adapters/project.jsonlibs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/project.jsonlibs/json-schema-to-zod-v3/package.jsonlibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/mcp-from-openapi/package.jsonlibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/plugins/project.jsonlibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/testing/project.jsonlibs/uipack/src/registry/render-template.tslibs/mcp-from-openapi/project.jsonlibs/plugins/package.jsonlibs/json-schema-to-zod-v3/project.jsonlibs/adapters/package.jsonlibs/uipack/src/renderers/types.tslibs/testing/package.jsonlibs/uipack/src/renderers/utils/transpiler.ts
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
libs/uipack/src/dependency/template-processor.tslibs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/uipack/src/registry/render-template.tslibs/uipack/src/renderers/types.tslibs/uipack/src/renderers/utils/transpiler.ts
libs/uipack/src/**/*.ts
📄 CodeRabbit inference engine (libs/uipack/CLAUDE.md)
libs/uipack/src/**/*.ts: Do not add React dependencies to uipack - use @frontmcp/ui package for React components instead
Avoid usinganytype without justification in TypeScript code
Do not expose internal error details in user-facing error messages
Files:
libs/uipack/src/dependency/template-processor.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/registry/render-template.tslibs/uipack/src/renderers/types.tslibs/uipack/src/renderers/utils/transpiler.ts
libs/ui/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (libs/ui/CLAUDE.md)
Do not import React-free utilities from @frontmcp/ui; use @frontmcp/uipack instead
Files:
libs/ui/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/ui/src/renderers/mdx.renderer.ts
libs/*/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
Each library in /libs/* is independent and publishable under @frontmcp/* scope
Files:
libs/json-schema-to-zod-v3/package.jsonlibs/mcp-from-openapi/package.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.json
libs/uipack/src/{components,web-components,renderers,utils}/**/*.ts
📄 CodeRabbit inference engine (libs/uipack/CLAUDE.md)
Always escape user-provided content using escapeHtml() utility to prevent XSS
Files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/renderers/types.tslibs/uipack/src/renderers/utils/transpiler.ts
libs/sdk/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
libs/sdk/src/**/*.ts: MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead ofunknown
Use specific error classes with MCP error codes instead of generic errors
UsegetCapabilities()method for dynamic capability exposure instead of hardcoding capabilities
UsechangeScopeproperty instead ofscopein change events to avoid confusion with Scope class
Validate URIs per RFC 3986 at metadata level using proper validation
Validate hook flows and fail fast on invalid hook configurations with specific error messages
Files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
🧠 Learnings (37)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Ensure SSR support via react-dom/server for React components
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/common/records/**/*.ts : Centralize record types in common/records directory and import from there instead of module-specific files
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Use React 18/19 with TypeScript for all components in frontmcp/ui
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Applied to files:
libs/testing/jest-preset.jslibs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/project.jsonlibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/mcp-from-openapi/package.jsonlibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/mcp-from-openapi/project.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,components,web-components}/**/*.test.ts : Test component behavior across platform configurations (OpenAI, Claude, etc.)
Applied to files:
libs/testing/jest-preset.jslibs/adapters/project.jsonlibs/testing/package.jsonlibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Include SSR tests to verify server-side rendering output for React components
Applied to files:
libs/testing/jest-preset.jslibs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/registry/render-template.tslibs/uipack/src/renderers/types.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to **/*.test.{ts,tsx} : Test all code paths including error cases and constructor validation
Applied to files:
libs/testing/jest-preset.js
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{handlebars,build,layouts,pages}/**/*.ts : Use Handlebars template engine for dynamic template rendering with variable substitution
Applied to files:
libs/uipack/src/dependency/template-processor.tslibs/uipack/project.jsonlibs/ui/src/renderers/transpiler.tslibs/uipack/src/registry/render-template.tslibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Applied to files:
libs/uipack/src/dependency/template-processor.tslibs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/project.jsonlibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/ui/src/renderers/mdx.renderer.tslibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/uipack/src/registry/render-template.tslibs/uipack/src/renderers/types.tslibs/testing/package.jsonlibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Applied to files:
libs/uipack/src/dependency/template-processor.tslibs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/project.jsonlibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/ui/src/renderers/mdx.renderer.tslibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/uipack/src/registry/render-template.tslibs/testing/package.jsonlibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/renderers/**/*.adapter.ts : Implement client-side hydration for interactive widgets using ReactRendererAdapter
Applied to files:
libs/uipack/src/dependency/template-processor.tslibs/ui/src/renderers/index.tslibs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/registry/render-template.tslibs/uipack/src/renderers/types.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Applied to files:
libs/adapters/project.jsonlibs/uipack/project.jsonlibs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/testing/project.jsonlibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
libs/adapters/project.jsonlibs/ui/src/renderers/index.tslibs/uipack/src/renderers/index.tslibs/mcp-from-openapi/package.jsonlibs/testing/project.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.jsonlibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,build,layouts,pages}/**/*.ts : Use platform-aware theming via getPlatform(), OPENAI_PLATFORM, and CLAUDE_PLATFORM constants for network capability detection
Applied to files:
libs/adapters/project.jsonlibs/uipack/project.jsonlibs/ui/src/renderers/mdx.renderer.tslibs/adapters/package.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use `changeScope` property instead of `scope` in change events to avoid confusion with Scope class
Applied to files:
libs/adapters/project.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Use Nx for build system with commands like `nx build sdk`, `nx test`, `nx run-many -t test`
Applied to files:
libs/adapters/project.jsonlibs/plugins/project.jsonlibs/testing/project.jsonlibs/mcp-from-openapi/project.jsonlibs/json-schema-to-zod-v3/project.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/renderers/**/*.test.{ts,tsx} : Include hydration tests to verify client-side hydration behavior
Applied to files:
libs/ui/src/renderers/index.tslibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/types.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Ensure SSR support via react-dom/server for React components
Applied to files:
libs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/registry/render-template.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Applied to files:
libs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/project.jsonlibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/registry/render-template.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Applied to files:
libs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/mcp-from-openapi/package.jsonlibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/uipack/src/registry/render-template.tslibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Use React 18/19 with TypeScript for all components in frontmcp/ui
Applied to files:
libs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/project.jsonlibs/uipack/src/renderers/index.tslibs/ui/src/renderers/transpiler.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/registry/render-template.tslibs/uipack/src/renderers/types.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Zero React dependency constraint - this is the React-free core package
Applied to files:
libs/ui/src/renderers/index.tslibs/uipack/src/bundler/file-cache/component-builder.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Provide TypeScript types for all component props without using 'any' type without justification
Applied to files:
libs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/src/registry/render-template.tslibs/uipack/src/renderers/types.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Avoid using `any` type without justification in TypeScript code
Applied to files:
libs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/src/renderers/types.tslibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Use React Testing Library for component tests with 95%+ coverage across statements, branches, functions, and lines
Applied to files:
libs/uipack/src/bundler/file-cache/component-builder.tslibs/testing/package.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Maintain peer dependencies on React ^18.0.0 || ^19.0.0 and react-dom ^18.0.0 || ^19.0.0
Applied to files:
libs/uipack/src/bundler/file-cache/component-builder.tslibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not expose internal error details in user-facing error messages
Applied to files:
libs/uipack/project.jsonlibs/uipack/src/renderers/index.tslibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{theme,build,layouts,pages,base-template}/**/*.ts : Use theme.cdn configuration instead of hard-coding CDN URLs
Applied to files:
libs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Applied to files:
libs/json-schema-to-zod-v3/package.jsonlibs/mcp-from-openapi/package.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: FrontMCP is a TypeScript-first schema validation framework - all types should align with MCP protocol definitions
Applied to files:
libs/json-schema-to-zod-v3/package.jsonlibs/mcp-from-openapi/package.jsonlibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.{ts,tsx} : Every component must have a Zod schema with `.strict()` mode to reject unknown properties
Applied to files:
libs/json-schema-to-zod-v3/package.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.ts : Validate all component options using validateOptions() helper with the component's Zod schema
Applied to files:
libs/json-schema-to-zod-v3/package.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/hooks/**/*.{ts,tsx} : Use MCP bridge hooks (useMcpBridge, useCallTool, useToolInput, useToolOutput) for tool communication in components
Applied to files:
libs/uipack/src/renderers/index.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead of `unknown`
Applied to files:
libs/mcp-from-openapi/package.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components,renderers,utils}/**/*.ts : Always escape user-provided content using escapeHtml() utility to prevent XSS
Applied to files:
libs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components,renderers}/**/*.test.ts : Test HTML escaping for user-provided content in component tests
Applied to files:
libs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/types.tslibs/uipack/src/renderers/utils/transpiler.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use specific error classes with MCP error codes instead of generic errors
Applied to files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Ensure all builds complete without TypeScript warnings and 100% test pass rate is required
Applied to files:
libs/testing/project.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/*/package.json : Each library in /libs/* is independent and publishable under frontmcp/* scope
Applied to files:
libs/mcp-from-openapi/project.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.json
🧬 Code graph analysis (5)
libs/uipack/src/dependency/template-processor.ts (2)
libs/uipack/src/renderers/index.ts (2)
mdxClientRenderer(62-62)mdxClientRenderer(65-65)libs/uipack/src/renderers/mdx-client.renderer.ts (1)
mdxClientRenderer(236-236)
libs/sdk/src/common/decorators/front-mcp.decorator.ts (2)
libs/sdk/src/index.ts (1)
FrontMcpInstance(4-4)libs/sdk/src/front-mcp/front-mcp.ts (1)
FrontMcpInstance(7-69)
libs/uipack/src/registry/render-template.ts (3)
libs/ui/src/renderers/index.ts (1)
ReactComponentType(35-35)libs/uipack/src/renderers/index.ts (1)
ReactComponentType(46-46)libs/uipack/src/renderers/types.ts (1)
ReactComponentType(252-252)
libs/uipack/src/renderers/types.ts (2)
libs/ui/src/renderers/index.ts (1)
RendererType(24-24)libs/uipack/src/renderers/index.ts (1)
RendererType(35-35)
libs/uipack/src/renderers/utils/transpiler.ts (3)
libs/ui/src/renderers/index.ts (2)
executeTranspiledCode(52-52)transpileAndExecute(52-52)libs/ui/src/renderers/transpiler.ts (2)
executeTranspiledCode(40-92)transpileAndExecute(104-112)libs/uipack/src/renderers/index.ts (2)
executeTranspiledCode(82-82)transpileAndExecute(83-83)
🔇 Additional comments (35)
libs/sdk/src/common/decorators/front-mcp.decorator.ts (2)
84-85: LGTM! String literal import enables better tree-shaking.The change from variable-based to string literal dynamic import allows bundlers to perform static analysis and optimize the bundle. This aligns well with the PR's tree-shaking objectives and maintains consistency with the serverless mode's
require('@frontmcp/sdk')pattern.
88-88: LGTM! Error message consistent with serverless mode.The error message correctly uses the string literal package name and maintains consistency with the identical error message in serverless mode (line 70). The specific error code follows the coding guidelines for MCP error handling.
libs/testing/jest-preset.js (1)
46-50: LGTM!The moduleNameMapper paths are correctly updated to align with the new build output structure where entry points are at
dist/index.jsrather thandist/src/index.js. The comment accurately reflects this change.libs/adapters/project.json (1)
8-75: LGTM!The dual CJS/ESM build configuration is well-structured:
- Proper dependency chain (
^build→build-cjs→build-esm→build)- Consistent externalization of peer dependencies across both formats
- Assets correctly placed only in the CJS build (ESM output shares the same dist folder)
- Declaration generation enabled for both formats with correct root directory
libs/json-schema-to-zod-v3/package.json (1)
31-48: LGTM!The package exports configuration follows best practices:
- Explicit
"type": "commonjs"declaration- Proper conditional exports with
typeslisted beforedefaultfor correct TypeScript resolution"./esm": nullcorrectly prevents consumers from importing the ESM folder directly- Development path enables source-level debugging in dev environments
libs/uipack/project.json (2)
43-51: LGTM!Externalizing React and React-DOM packages aligns with the project guidelines that uipack should not bundle React dependencies. The wildcard patterns (
react/*,react-dom/*) correctly cover subpath imports likereact/jsx-runtime. Based on learnings, consumers should use@frontmcp/uifor React components instead.
90-98: Consistent ESM externalization.The ESM build correctly mirrors the CJS externalization configuration, ensuring consistent behavior across both module formats.
libs/ui/src/renderers/transpiler.ts (2)
12-12: Correct import pattern.The import from
@frontmcp/uipack/renderersfollows the coding guidelines. As per learnings, React-free utilities should be imported from@frontmcp/uipackrather than duplicating them in@frontmcp/ui.
40-45:anytypes are justified for this dynamic execution context.The use of
anyhere is appropriate since the function must handle arbitrary transpiled code and context objects. The eslint-disable comments properly document this deviation from strict TypeScript guidelines.libs/mcp-from-openapi/project.json (1)
8-59: LGTM!The dual CJS/ESM build configuration follows the consistent pattern established across the repository. External dependencies correctly match those declared in
package.json, ensuring they're not bundled and consumers provide their own versions.libs/mcp-from-openapi/package.json (1)
33-50: LGTM!The package exports configuration is consistent with other packages in this PR:
- Proper module type declaration and entry points
- Conditional exports with correct TypeScript resolution order (
typesbeforedefault)- ESM subpath blocked with
nullto prevent incorrect importslibs/json-schema-to-zod-v3/project.json (1)
8-55: LGTM!The dual CJS/ESM build configuration is correctly structured:
zodis properly externalized as it's a peer dependency- Assets include the changelog for npm package consumers
- Build dependency chain ensures sequential execution
libs/ui/src/renderers/mdx.renderer.ts (1)
1-17: Documentation and imports updated correctly.The module documentation clearly indicates this is a server-side renderer requiring React, and correctly points users to
MdxClientRendererfrom@frontmcp/uipackfor React-free clients. Imports are properly consolidated to scoped package paths.libs/adapters/package.json (1)
24-52: Well-structured dual CJS/ESM exports configuration.The exports structure correctly implements:
- Conditional
require/importblocks with proper type declarations- Development condition for direct TypeScript imports during development
"./esm": nullto prevent accidental bare imports from the ESM directoryThis aligns with modern package distribution best practices for tree shaking support.
libs/plugins/package.json (1)
24-63: Consistent dual CJS/ESM exports with subpath exports.The exports configuration mirrors the adapters package pattern and correctly exposes
./cacheand./codecallsubpaths with proper conditional exports. This enables consumers to import only what they need for better tree shaking.libs/uipack/src/bundler/file-cache/component-builder.ts (3)
28-30: Type-only React definition maintains React-free constraint.The
ReactComponentTypealias is type-only and doesn't introduce a runtime React dependency. This is an acceptable pattern for uipack since React is dynamically imported only when SSR is explicitly requested. The eslint-disable comment foranyis justified here as the type represents an external module interface.
452-456: Variable indirection prevents bundler resolution at build time.Using string constants (
reactPkg,reactDomServerPkg) for dynamic imports is a valid technique to prevent bundlers from resolving and bundling React at build time. This supports the tree shaking goals of this PR.
483-484: SSR element creation uses the new type correctly.The cast to
ReactComponentType<unknown>aligns with the type-only definition and maintains type safety without runtime overhead.libs/uipack/src/dependency/template-processor.ts (2)
21-21: Correct migration to MDX client renderer.The import change from
mdxRenderertomdxClientRendereraligns with the broader refactoring to separate server-side and client-side MDX rendering paths. This is consistent with the new exports inlibs/uipack/src/renderers/index.ts.
289-289: MDX rendering calls updated consistently.Both MDX rendering call sites (
processTemplateandprocessMdxTemplate) are updated to usemdxClientRenderer.render(), maintaining consistency throughout the file.Also applies to: 446-446
libs/uipack/src/registry/render-template.ts (2)
248-264: Improved error messages guide users to correct package.The error messages now clearly indicate that React is optional and suggest
@frontmcp/uias the package for React component support. This is helpful for users who encounter the error in a React-free environment.
250-256: Variable indirection pattern correctly applied.Using
reactPkgandreactDomServerPkgstring constants prevents bundlers from statically analyzing and including React in the bundle, supporting the tree shaking objectives.libs/ui/src/renderers/index.ts (1)
1-52: Well-organized public API surface with clear documentation.The barrel file correctly:
- Re-exports types from
@frontmcp/uipack/renderersfor convenience- Exports React-dependent renderers (React, MDX server-side)
- Documents the separation between React-dependent (
@frontmcp/ui) and React-free (@frontmcp/uipack) renderers- Provides clear examples in the module documentation
This follows the coding guidelines for exporting public API through barrel files.
libs/uipack/src/renderers/types.ts (2)
19-22: ExtendedRendererTypewith clear documentation.The new
'mdx-client'variant is well-documented, clearly distinguishing between:
'mdx': Server-side rendering (requires React)'mdx-client': Client-side rendering (CDN-loaded React)This supports the broader MDX rendering refactoring in this PR.
251-252: CentralizedReactComponentTypedefinition.This is the canonical definition that should be imported by other files in uipack (like
render-template.ts) to avoid duplication. Theanyreturn type is justified with an eslint-disable comment and is necessary for React component type compatibility without requiring React types at compile time.libs/uipack/src/renderers/utils/transpiler.ts (2)
159-169: Clean deprecation pattern with proper type usage.Good use of
unknowninstead ofanyfor the_contextparameter, aligning with the coding guidelines. The JSDoc@deprecatedtag will help IDEs surface warnings at import/call sites.The error message provides a clear migration path to
@frontmcp/ui/renderers.
174-184: Consistent deprecation approach.The deprecation stub mirrors
executeTranspiledCodeappropriately. Both functions maintain their signatures for backward compatibility while guiding users to the new location.libs/uipack/src/renderers/index.ts (1)
60-67: Well-structured MDX client renderer exports with compatibility aliases.The dual export pattern (
MdxClientRenderer+ legacyMdxRendereralias) provides a clean migration path. The comment on line 67 clearly directs users to@frontmcp/uifor React-dependent functionality.Based on learnings, the legacy aliases are appropriate during the deprecation transition period.
libs/testing/project.json (1)
8-46: Well-structured CJS build target with appropriate externalizations.The external dependencies list correctly excludes peer dependencies and internal packages from bundling, which is essential for tree-shaking. The
thirdParty: falsesetting ensures only first-party code is bundled.libs/uipack/src/renderers/mdx-client.renderer.ts (3)
158-166: Proper XSS prevention measures in place.Good use of
JSON.stringifyfor script-embedded data (lines 159-160) andescapeHtml()for HTML attributes (lines 163, 166). This aligns with the coding guidelines requiring XSS protection for user-provided content.
200-206: Appropriate error handling without exposing internals.The error handler logs details to console for debugging but displays only a generic message to users. This follows the guideline to not expose internal error details in user-facing messages.
215-230: Good platform capability handling.The renderer correctly detects blocked-network platforms and provides a meaningful warning instead of failing silently. The SSR fallback guidance is helpful.
libs/plugins/project.json (1)
8-70: Consistent dual CJS/ESM build configuration.The build configuration mirrors the pattern established in other packages. External dependencies correctly include optional peer dependencies (ioredis, vectoriadb, @vercel/kv) preventing them from being bundled.
The same ESM
.jsextension consideration applies here as noted in the testing package review.libs/testing/package.json (2)
27-42: Proper dual-format package configuration.The
"type": "commonjs"with separatemain(CJS) andmodule(ESM) fields, plus conditional exports, follows modern Node.js package conventions for dual-format support.
91-91: Good use of null export to prevent direct ESM access.The
"./esm": nullentry prevents consumers from accidentally importing from the internal ESM folder structure directly, encouraging use of the proper conditional exports.
… better clarity and maintainability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (5)
libs/sdk/src/common/types/options/auth/auth.typecheck.ts (1)
56-62: Consider removingPartial<>wrapper to strengthen type checks.The
Partial<>wrapper on schema outputs significantly weakens these type checks.IsAssignable<PublicAccessConfig, Partial<_PublicAccessFromSchema>>will pass even ifPublicAccessConfigis missing required fields from the schema, sincePartial<>makes all fields optional.If the intent is to verify interface compatibility with schema shape, consider removing
Partial<>:// Check PublicAccessConfig is assignable to schema output type _PublicAccessFromSchema = z.output<typeof publicAccessConfigSchema>; -type _PublicAccessCheck = AssertTrue<IsAssignable<PublicAccessConfig, Partial<_PublicAccessFromSchema>>>; +type _PublicAccessCheck = AssertTrue<IsAssignable<PublicAccessConfig, _PublicAccessFromSchema>>; // Check RemoteProviderConfig is assignable to schema output type _RemoteFromSchema = z.output<typeof remoteProviderConfigSchema>; -type _RemoteCheck = AssertTrue<IsAssignable<RemoteProviderConfig, Partial<_RemoteFromSchema>>>; +type _RemoteCheck = AssertTrue<IsAssignable<RemoteProviderConfig, _RemoteFromSchema>>;If
Partial<>is intentional due to optional fields in the interfaces, please add a comment explaining this design decision.libs/sdk/src/common/types/options/auth/public.schema.ts (1)
50-50: Consider consistency:.or()vsz.union().Line 50 uses
jwkSchema.or(z.instanceof(Uint8Array))while other schemas in this PR usez.union([...])for union types (e.g., line 25 in transparent.schema.ts usesz.union([z.string(), z.array(z.string())])).Both approaches are valid in Zod 4, but for consistency across the codebase, consider standardizing on one approach.
libs/sdk/src/common/types/options/auth/auth.utils.ts (1)
70-75: Consider explicit exhaustiveness check.The
allowsPublicAccessfunction handles all three modes but doesn't explicitly ensure exhaustiveness at compile time. If a new auth mode is added in the future, TypeScript won't catch the missing case.Consider adding an explicit exhaustiveness check:
🔎 Suggested enhancement
export function allowsPublicAccess(options: AuthOptions): boolean { if (options.mode === 'public') return true; if (options.mode === 'transparent') return options.allowAnonymous; if (options.mode === 'orchestrated') return options.allowDefaultPublic; - return false; + + // Exhaustiveness check + const _exhaustive: never = options; + return false; }This ensures TypeScript will error if a new mode is added but not handled here.
libs/sdk/src/common/types/options/auth/orchestrated.schema.ts (1)
21-173: Consider extracting shared orchestrated configuration.The
orchestratedLocalSchemaandorchestratedRemoteSchemahave significant duplication (lines 30-91 and 110-173 are nearly identical). While this duplication makes each schema explicit and self-contained (which aids tree shaking), it increases maintenance burden.Consider extracting shared fields into a base schema:
🔎 Suggested refactor
const orchestratedBaseFields = { tokenStorage: tokenStorageConfigSchema.default({ type: 'memory' }), sessionMode: z.enum(['stateful', 'stateless']).default('stateful'), allowDefaultPublic: z.boolean().default(false), anonymousScopes: z.array(z.string()).default(['anonymous']), publicAccess: publicAccessConfigSchema.optional(), consent: consentConfigSchema.optional(), refresh: tokenRefreshConfigSchema.optional(), expectedAudience: z.union([z.string(), z.array(z.string())]).optional(), incrementalAuth: incrementalAuthConfigSchema.optional(), transport: transportConfigSchema.optional(), }; export const orchestratedLocalSchema = z.object({ mode: z.literal('orchestrated'), type: z.literal('local'), local: localSigningConfigSchema.optional(), ...orchestratedBaseFields, }); export const orchestratedRemoteSchema = z.object({ mode: z.literal('orchestrated'), type: z.literal('remote'), remote: remoteProviderConfigSchema, local: localSigningConfigSchema.optional(), ...orchestratedBaseFields, });This maintains tree-shaking benefits while reducing duplication.
libs/sdk/src/common/types/options/auth/index.ts (1)
126-136: Deprecated transport schemas properly marked.The deprecated transport schemas (lines 126-136) are clearly marked with a comment indicating removal in v1.0.0. This is good deprecation practice.
Consider adding
@deprecatedJSDoc tags to the actual schema definitions intransport.deprecated.tsto ensure IDEs show deprecation warnings to consumers.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
libs/sdk/src/auth/instances/instance.local-primary-auth.tslibs/sdk/src/auth/instances/instance.remote-primary-auth.tslibs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.tslibs/sdk/src/common/types/options/auth.options.tslibs/sdk/src/common/types/options/auth/app-auth.schema.tslibs/sdk/src/common/types/options/auth/auth.interfaces.tslibs/sdk/src/common/types/options/auth/auth.schema.tslibs/sdk/src/common/types/options/auth/auth.typecheck.tslibs/sdk/src/common/types/options/auth/auth.utils.tslibs/sdk/src/common/types/options/auth/index.tslibs/sdk/src/common/types/options/auth/orchestrated.schema.tslibs/sdk/src/common/types/options/auth/public.schema.tslibs/sdk/src/common/types/options/auth/shared.schemas.tslibs/sdk/src/common/types/options/auth/transparent.schema.tslibs/sdk/src/common/types/options/auth/transport.deprecated.tslibs/sdk/src/common/types/options/index.tslibs/sdk/src/common/utils/decide-request-intent.utils.tslibs/sdk/src/scope/flows/http.request.flow.ts
💤 Files with no reviewable changes (1)
- libs/sdk/src/common/types/options/auth.options.ts
✅ Files skipped from review due to trivial changes (1)
- libs/sdk/src/scope/flows/http.request.flow.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
libs/sdk/src/auth/instances/instance.remote-primary-auth.tslibs/sdk/src/common/utils/decide-request-intent.utils.tslibs/sdk/src/common/types/options/auth/public.schema.tslibs/sdk/src/common/types/options/auth/app-auth.schema.tslibs/sdk/src/common/types/options/auth/auth.typecheck.tslibs/sdk/src/common/types/options/auth/auth.utils.tslibs/sdk/src/common/types/options/auth/transparent.schema.tslibs/sdk/src/common/types/options/auth/auth.interfaces.tslibs/sdk/src/common/types/options/auth/orchestrated.schema.tslibs/sdk/src/common/types/options/index.tslibs/sdk/src/common/types/options/auth/transport.deprecated.tslibs/sdk/src/auth/instances/instance.local-primary-auth.tslibs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.tslibs/sdk/src/common/types/options/auth/shared.schemas.tslibs/sdk/src/common/types/options/auth/auth.schema.tslibs/sdk/src/common/types/options/auth/index.ts
libs/sdk/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
libs/sdk/src/**/*.ts: MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead ofunknown
Use specific error classes with MCP error codes instead of generic errors
UsegetCapabilities()method for dynamic capability exposure instead of hardcoding capabilities
UsechangeScopeproperty instead ofscopein change events to avoid confusion with Scope class
Validate URIs per RFC 3986 at metadata level using proper validation
Validate hook flows and fail fast on invalid hook configurations with specific error messages
Files:
libs/sdk/src/auth/instances/instance.remote-primary-auth.tslibs/sdk/src/common/utils/decide-request-intent.utils.tslibs/sdk/src/common/types/options/auth/public.schema.tslibs/sdk/src/common/types/options/auth/app-auth.schema.tslibs/sdk/src/common/types/options/auth/auth.typecheck.tslibs/sdk/src/common/types/options/auth/auth.utils.tslibs/sdk/src/common/types/options/auth/transparent.schema.tslibs/sdk/src/common/types/options/auth/auth.interfaces.tslibs/sdk/src/common/types/options/auth/orchestrated.schema.tslibs/sdk/src/common/types/options/index.tslibs/sdk/src/common/types/options/auth/transport.deprecated.tslibs/sdk/src/auth/instances/instance.local-primary-auth.tslibs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.tslibs/sdk/src/common/types/options/auth/shared.schemas.tslibs/sdk/src/common/types/options/auth/auth.schema.tslibs/sdk/src/common/types/options/auth/index.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/sdk/src/auth/instances/instance.remote-primary-auth.tslibs/sdk/src/common/utils/decide-request-intent.utils.tslibs/sdk/src/common/types/options/auth/public.schema.tslibs/sdk/src/common/types/options/auth/app-auth.schema.tslibs/sdk/src/common/types/options/auth/auth.typecheck.tslibs/sdk/src/common/types/options/auth/auth.utils.tslibs/sdk/src/common/types/options/auth/transparent.schema.tslibs/sdk/src/common/types/options/auth/auth.interfaces.tslibs/sdk/src/common/types/options/auth/orchestrated.schema.tslibs/sdk/src/common/types/options/index.tslibs/sdk/src/common/types/options/auth/transport.deprecated.tslibs/sdk/src/auth/instances/instance.local-primary-auth.tslibs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.tslibs/sdk/src/common/types/options/auth/shared.schemas.tslibs/sdk/src/common/types/options/auth/auth.schema.tslibs/sdk/src/common/types/options/auth/index.ts
libs/sdk/src/**/index.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Export public API through barrel files - export users' needed items, no legacy exports with different names
Files:
libs/sdk/src/common/types/options/index.tslibs/sdk/src/common/types/options/auth/index.ts
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.ts : Validate all component options using validateOptions() helper with the component's Zod schema
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{handlebars,build,layouts,pages}/**/*.ts : Use Handlebars template engine for dynamic template rendering with variable substitution
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{theme,build,layouts,pages,base-template}/**/*.ts : Use theme.cdn configuration instead of hard-coding CDN URLs
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Applied to files:
libs/sdk/src/auth/instances/instance.remote-primary-auth.tslibs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: FrontMCP is a TypeScript-first schema validation framework - all types should align with MCP protocol definitions
Applied to files:
libs/sdk/src/auth/instances/instance.remote-primary-auth.tslibs/sdk/src/common/types/options/auth/auth.typecheck.tslibs/sdk/src/common/types/options/auth/auth.interfaces.tslibs/sdk/src/common/types/options/auth/shared.schemas.tslibs/sdk/src/common/types/options/auth/auth.schema.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.ts : Validate all component options using validateOptions() helper with the component's Zod schema
Applied to files:
libs/sdk/src/common/types/options/auth/app-auth.schema.tslibs/sdk/src/common/types/options/auth/auth.typecheck.tslibs/sdk/src/common/types/options/auth/auth.utils.tslibs/sdk/src/common/types/options/auth/shared.schemas.tslibs/sdk/src/common/types/options/auth/auth.schema.tslibs/sdk/src/common/types/options/auth/index.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Validate hook flows and fail fast on invalid hook configurations with specific error messages
Applied to files:
libs/sdk/src/common/types/options/auth/auth.typecheck.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.{ts,tsx} : Every component must have a Zod schema with `.strict()` mode to reject unknown properties
Applied to files:
libs/sdk/src/common/types/options/auth/auth.typecheck.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/common/records/**/*.ts : Centralize record types in common/records directory and import from there instead of module-specific files
Applied to files:
libs/sdk/src/common/types/options/auth/auth.typecheck.tslibs/sdk/src/common/types/options/auth/auth.utils.tslibs/sdk/src/common/types/options/auth/auth.interfaces.tslibs/sdk/src/common/types/options/index.tslibs/sdk/src/common/types/options/auth/transport.deprecated.tslibs/sdk/src/auth/instances/instance.local-primary-auth.tslibs/sdk/src/common/types/options/auth/shared.schemas.tslibs/sdk/src/common/types/options/auth/auth.schema.tslibs/sdk/src/common/types/options/auth/index.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to **/*.ts : Use strict TypeScript mode with no `any` types without strong justification - use `unknown` instead for generic type defaults
Applied to files:
libs/sdk/src/common/types/options/auth/auth.typecheck.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead of `unknown`
Applied to files:
libs/sdk/src/common/types/options/auth/auth.typecheck.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Validate URIs per RFC 3986 at metadata level using proper validation
Applied to files:
libs/sdk/src/common/types/options/auth/auth.typecheck.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
libs/sdk/src/common/types/options/auth/auth.utils.tslibs/sdk/src/common/types/options/index.tslibs/sdk/src/common/types/options/auth/shared.schemas.tslibs/sdk/src/common/types/options/auth/index.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Applied to files:
libs/sdk/src/common/types/options/index.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use `changeScope` property instead of `scope` in change events to avoid confusion with Scope class
Applied to files:
libs/sdk/src/common/types/options/index.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use `getCapabilities()` method for dynamic capability exposure instead of hardcoding capabilities
Applied to files:
libs/sdk/src/common/types/options/index.ts
🧬 Code graph analysis (3)
libs/sdk/src/common/types/options/auth/public.schema.ts (2)
libs/sdk/src/common/types/options/auth/shared.schemas.ts (1)
publicAccessConfigSchema(15-33)libs/sdk/src/common/types/options/auth/transport.deprecated.ts (1)
transportConfigSchema(34-42)
libs/sdk/src/common/types/options/auth/auth.utils.ts (4)
libs/sdk/src/common/types/options/auth/auth.schema.ts (3)
AuthOptionsInput(39-39)AuthOptions(33-33)authOptionsSchema(18-23)libs/sdk/src/common/types/options/auth/public.schema.ts (1)
PublicAuthOptions(65-65)libs/sdk/src/common/types/options/auth/transparent.schema.ts (1)
TransparentAuthOptions(64-64)libs/sdk/src/common/types/options/auth/orchestrated.schema.ts (3)
OrchestratedAuthOptions(203-203)OrchestratedLocalOptions(191-191)OrchestratedRemoteOptions(197-197)
libs/sdk/src/common/types/options/auth/transport.deprecated.ts (2)
libs/sdk/src/auth/session/transport-session.types.ts (1)
redisConfigSchema(335-343)libs/sdk/src/common/types/options/auth/auth.interfaces.ts (2)
TransportConfig(257-265)TransportRecreationConfig(248-252)
⏰ 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). (2)
- GitHub Check: Build Libraries
- GitHub Check: Lint & Format Checks
🔇 Additional comments (14)
libs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.ts (1)
5-5: Verify thatDEFAULT_TRANSPORT_CONFIGis properly defined and typed.The change from a class-level static default to an imported constant aligns with the PR's tree-shaking objective and is correctly implemented.
DEFAULT_TRANSPORT_CONFIGis properly typed asTransportConfigwith expected default values, sourced from the deprecated transport configuration schema.libs/sdk/src/auth/instances/instance.local-primary-auth.ts (1)
12-12: LGTM!Import path correctly updated to use the new centralized auth barrel export (
./auth), aligning with the refactor to consolidate auth options under a unified module. This supports better tree shaking. Based on learnings, this follows the guideline to export public API through barrel files.libs/sdk/src/common/types/options/auth/transport.deprecated.ts (1)
1-69: LGTM! Well-structured backward compatibility layer.The deprecated transport schemas are properly implemented with:
- Clear deprecation markers and removal timeline (v1.0.0)
- Correct refinement logic for Redis requirement when recreation is enabled
- Proper use of
z.lazy()to handle the optional recreation field- Default config derived from schema parsing, ensuring a single source of truth
The schema structure aligns with the
TransportConfigandTransportRecreationConfiginterfaces shown in the relevant code snippets fromauth.interfaces.ts.libs/sdk/src/common/utils/decide-request-intent.utils.ts (1)
3-3: LGTM! Clean interface composition.Extending
TransportConfiginstead of redeclaring individual boolean fields eliminates duplication and ensures theConfiginterface stays synchronized with the centralized transport configuration type. ThetolerateMissingAcceptruntime option is correctly added as the only extension. This improves maintainability and supports the tree-shaking goals of this PR.Also applies to: 54-60
libs/sdk/src/auth/instances/instance.remote-primary-auth.ts (1)
2-2: LGTM!Import path correctly updated to use the centralized auth barrel export, consistent with the changes in
instance.local-primary-auth.ts.libs/sdk/src/common/types/options/index.ts (1)
4-4: LGTM!The barrel export correctly updated to re-export from the new
./authmodule directory instead of the removed./auth.optionsfile. This centralizes auth-related exports and supports better tree shaking. Based on learnings, this follows the guideline to export public API through barrel files.libs/sdk/src/common/types/options/auth/auth.schema.ts (1)
13-44: LGTM! Correct schema composition approach.Using
z.unioninstead ofz.discriminatedUnionis the right choice here since the orchestrated variants share the samemode: 'orchestrated'discriminator and differ by a nestedtypefield. The union correctly combines all four auth mode schemas, and the type exports (AuthOptions,AuthOptionsInput,AuthMode) provide clear, well-documented types for consumers.libs/sdk/src/common/types/options/auth/app-auth.schema.ts (1)
31-45: LGTM! Clean schema extension pattern.The approach of using a plain object schema with
satisfies RawZodShape<StandaloneOption>ensures type alignment between the TypeScript interface and Zod schema shape. Extending each base auth schema with the standalone options using.extend()is a clean pattern that avoids code duplication while providing app-level auth configuration.libs/sdk/src/common/types/options/auth/auth.typecheck.ts (1)
1-107: LGTM! Excellent compile-time validation approach.This type-checking file is a valuable addition that ensures interfaces and Zod schemas stay synchronized. The pattern of using type assertions that fail compilation on mismatch is a robust way to catch schema/interface drift during development. The mode and type literal checks (lines 92-100) are particularly useful for catching discriminator mismatches.
libs/sdk/src/common/types/options/auth/auth.interfaces.ts (1)
1-10: Interface-schema synchronization approach is well-documented.The explicit separation of interfaces (for IDE autocomplete) and schemas (for runtime validation) is a good pattern for tree shaking. The comment correctly warns about keeping them in sync.
Based on the AI summary, there's a
auth.typecheck.tsfile that validates this synchronization at compile time, which is an excellent safeguard against drift.libs/sdk/src/common/types/options/auth/transparent.schema.ts (1)
13-55: LGTM! Transparent auth schema is well-structured.The schema correctly uses Zod 4 features:
.default()for optional fields with sensible defaults.optional()for truly optional fields- Required
remotefield ensures proper configuration- Type-safe literals and unions
libs/sdk/src/common/types/options/auth/shared.schemas.ts (2)
75-144: LGTM! Comprehensive OAuth provider configuration.The
remoteProviderConfigSchemais well-designed with:
- Proper URL validation for all endpoint fields
- Support for standard OAuth/OIDC discovery via JWKS
- DCR (Dynamic Client Registration) support
- Sensible optional overrides for all endpoints
The schema covers both standard OIDC providers and custom implementations well.
206-211: The schema is not duplicated. TheconsentConfigSchemais defined once inshared.schemas.tsand re-exported fromconsent.types.tsfor convenient domain-specific access. This re-export pattern is a standard way to organize module APIs and avoids circular dependencies without creating a maintenance burden.Likely an incorrect or invalid review comment.
libs/sdk/src/common/types/options/auth/index.ts (1)
7-65: Dual type system for interfaces and schemas.This barrel file exports both:
- Explicit interfaces (lines 7-30) - for IDE autocomplete, ending without suffix
- Zod-inferred types (lines 48-65) - runtime types with
ZodorInputsuffixExample:
PublicAccessConfig(interface) vsPublicAccessConfigZod(Zod-inferred type)This dual approach enables:
- Better tree shaking (consumers can import only what they need)
- Flexibility to use interfaces for type annotations or Zod types for runtime validation
- Clear disambiguation when both are needed together
The naming convention is consistent and well thought out. Based on learnings, this aligns with the project's approach to exposing public APIs through barrel files.
libs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
libs/ui/src/renderers/mdx.renderer.ts (1)
106-126: Consider clarifying the transpile method's purpose.The JSDoc states "Transpile MDX to executable JavaScript" but the implementation stores the raw MDX template as
codewithout actual transpilation. The actual compilation happens inrender()viaevaluate(). Consider updating the documentation to reflect this is a caching/hashing step rather than transpilation.Suggested documentation fix
/** - * Transpile MDX to executable JavaScript. + * Prepare MDX template for rendering. + * + * Note: Actual compilation happens during render() via @mdx-js/mdx evaluate(). + * This method primarily handles caching by content hash. */ async transpile(template: MdxTemplate, _options?: TranspileOptions): Promise<TranspileResult> {libs/uipack/src/renderers/mdx-client.renderer.ts (1)
242-257: Consider adding a warning for blocked-network platforms.The
getRuntimeScriptsmethod correctly returns a console warning for blocked-network platforms, but users might not see console output. Consider whether the render method should also detect blocked networks and provide a visible fallback.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
libs/ui/src/renderers/mdx.renderer.tslibs/ui/src/renderers/transpiler.tslibs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- libs/ui/src/renderers/transpiler.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.ts
libs/uipack/src/{components,web-components,renderers,utils}/**/*.ts
📄 CodeRabbit inference engine (libs/uipack/CLAUDE.md)
Always escape user-provided content using escapeHtml() utility to prevent XSS
Files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.ts
libs/uipack/src/**/*.ts
📄 CodeRabbit inference engine (libs/uipack/CLAUDE.md)
libs/uipack/src/**/*.ts: Do not add React dependencies to uipack - use @frontmcp/ui package for React components instead
Avoid usinganytype without justification in TypeScript code
Do not expose internal error details in user-facing error messages
Files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.ts
libs/ui/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (libs/ui/CLAUDE.md)
Do not import React-free utilities from @frontmcp/ui; use @frontmcp/uipack instead
Files:
libs/ui/src/renderers/mdx.renderer.ts
🧠 Learnings (19)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Applied to files:
libs/uipack/src/renderers/index.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
libs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Applied to files:
libs/uipack/src/renderers/index.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Applied to files:
libs/uipack/src/renderers/index.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/renderers/**/*.test.{ts,tsx} : Include hydration tests to verify client-side hydration behavior
Applied to files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Applied to files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/renderers/**/*.adapter.ts : Implement client-side hydration for interactive widgets using ReactRendererAdapter
Applied to files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{theme,build,layouts,pages,base-template}/**/*.ts : Use theme.cdn configuration instead of hard-coding CDN URLs
Applied to files:
libs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Applied to files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Applied to files:
libs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Use React 18/19 with TypeScript for all components in frontmcp/ui
Applied to files:
libs/uipack/src/renderers/index.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Ensure SSR support via react-dom/server for React components
Applied to files:
libs/uipack/src/renderers/index.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Include SSR tests to verify server-side rendering output for React components
Applied to files:
libs/uipack/src/renderers/index.tslibs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/hooks/**/*.{ts,tsx} : Use MCP bridge hooks (useMcpBridge, useCallTool, useToolInput, useToolOutput) for tool communication in components
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components,renderers,utils}/**/*.ts : Always escape user-provided content using escapeHtml() utility to prevent XSS
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components,renderers}/**/*.test.ts : Test HTML escaping for user-provided content in component tests
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,build,layouts,pages}/**/*.ts : Use platform-aware theming via getPlatform(), OPENAI_PLATFORM, and CLAUDE_PLATFORM constants for network capability detection
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Zero React dependency constraint - this is the React-free core package
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
🧬 Code graph analysis (1)
libs/uipack/src/renderers/mdx-client.renderer.ts (2)
libs/uipack/src/renderers/types.ts (6)
RenderOptions(111-118)UIRenderer(160-213)TranspileOptions(101-106)TranspileResult(87-96)ToolUIProps(30-39)RuntimeScripts(123-130)libs/uipack/src/registry/render-template.ts (1)
containsMdxSyntax(27-65)
⏰ 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: Build Libraries
🔇 Additional comments (5)
libs/ui/src/renderers/mdx.renderer.ts (1)
186-199: Good defensive handling of reserved props.The logic correctly prevents output properties from overwriting core props (
input,output,structuredContent,helpers,components) by filtering them out before spreading. The ordering ensures reserved props take precedence.libs/uipack/src/renderers/index.ts (2)
69-82: Well-documented deprecation with clear migration path.The deprecation notice provides actionable guidance distinguishing between server-side (
@frontmcp/ui/renderers) and client-side (@frontmcp/uipack/renderers) use cases. The alias maintains backwards compatibility during the transition period.
52-52: No action needed.componentCacheis properly exported from./cacheon line 289.libs/uipack/src/renderers/mdx-client.renderer.ts (2)
1-10: LGTM - Correct separation of React-free client renderer.This new renderer correctly implements the React-free client-side MDX rendering path. Dependencies are loaded from CDN at runtime rather than bundled, which aligns with the uipack guideline to avoid React dependencies. Based on learnings, uipack should not add React dependencies.
185-193: Good use of escapeHtml for user-provided content.The
loadingMessageandcontainerIdare properly escaped usingescapeHtml()before embedding in HTML, preventing XSS. The MDX template and props useJSON.stringifywhich correctly escapes special characters for JavaScript string context. As per coding guidelines, user-provided content in uipack renderers should always be escaped.
…for improved module handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
libs/ui/package.json (1)
57-61: Remove or replace the non-existent "enclave-vm" dependency.The package
enclave-vm@1.0.3does not exist on the npm registry. Verify whether this should be a different package name, an internal @frontmcp scoped package, or a local dependency. Other verified versions (zod@4.0.0, esbuild@0.27.1, @swc/core@1.5.0) are valid.
♻️ Duplicate comments (2)
libs/testing/package.json (2)
45-55: Previous ESM path issue appears resolved.The
./setupexport now correctly points to./dist/esm/setup.jswith thedist/prefix. Based on learnings, this aligns with the entry point configuration pattern.
59-69: Previous ESM path issue appears resolved.The
./fixturesexport now correctly points to./dist/esm/fixtures/index.jswith thedist/prefix.
🧹 Nitpick comments (1)
libs/sdk/project.json (1)
25-42: Consider extracting duplicated externals list.The
externalarray is duplicated betweenbuild-cjsandbuild-esmtargets. If Nx supports shared options or target defaults, consolidating would reduce maintenance burden.This is a minor DRY concern—the current approach works correctly but requires updating both lists when dependencies change.
Also applies to: 62-79
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
libs/adapters/package.jsonlibs/json-schema-to-zod-v3/package.jsonlibs/mcp-from-openapi/package.jsonlibs/plugins/package.jsonlibs/sdk/package.jsonlibs/sdk/project.jsonlibs/sdk/tsconfig.lib.jsonlibs/testing/package.jsonlibs/ui/package.jsonlibs/uipack/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- libs/plugins/package.json
🧰 Additional context used
📓 Path-based instructions (2)
libs/*/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
Each library in /libs/* is independent and publishable under @frontmcp/* scope
Files:
libs/uipack/package.jsonlibs/mcp-from-openapi/package.jsonlibs/ui/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.jsonlibs/json-schema-to-zod-v3/package.json
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/uipack/package.jsonlibs/mcp-from-openapi/package.jsonlibs/ui/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.jsonlibs/sdk/project.jsonlibs/sdk/tsconfig.lib.jsonlibs/json-schema-to-zod-v3/package.json
🧠 Learnings (24)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Use React 18/19 with TypeScript for all components in frontmcp/ui
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Ensure SSR support via react-dom/server for React components
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Applied to files:
libs/uipack/package.jsonlibs/ui/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.jsonlibs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not expose internal error details in user-facing error messages
Applied to files:
libs/uipack/package.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Applied to files:
libs/uipack/package.jsonlibs/ui/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.jsonlibs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Avoid using `any` type without justification in TypeScript code
Applied to files:
libs/uipack/package.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Zero React dependency constraint - this is the React-free core package
Applied to files:
libs/uipack/package.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Applied to files:
libs/uipack/package.jsonlibs/mcp-from-openapi/package.jsonlibs/ui/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.jsonlibs/sdk/project.jsonlibs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
libs/uipack/package.jsonlibs/mcp-from-openapi/package.jsonlibs/ui/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.jsonlibs/sdk/project.jsonlibs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Applied to files:
libs/uipack/package.jsonlibs/mcp-from-openapi/package.jsonlibs/ui/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.jsonlibs/sdk/project.jsonlibs/json-schema-to-zod-v3/package.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/*/package.json : Each library in /libs/* is independent and publishable under frontmcp/* scope
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: FrontMCP is a TypeScript-first schema validation framework - all types should align with MCP protocol definitions
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.jsonlibs/sdk/tsconfig.lib.jsonlibs/json-schema-to-zod-v3/package.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead of `unknown`
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/testing/package.jsonlibs/adapters/package.jsonlibs/sdk/package.jsonlibs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,build,layouts,pages}/**/*.ts : Use platform-aware theming via getPlatform(), OPENAI_PLATFORM, and CLAUDE_PLATFORM constants for network capability detection
Applied to files:
libs/adapters/package.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use `changeScope` property instead of `scope` in change events to avoid confusion with Scope class
Applied to files:
libs/sdk/package.jsonlibs/sdk/project.jsonlibs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/common/records/**/*.ts : Centralize record types in common/records directory and import from there instead of module-specific files
Applied to files:
libs/sdk/package.jsonlibs/sdk/project.jsonlibs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Applied to files:
libs/sdk/project.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use `getCapabilities()` method for dynamic capability exposure instead of hardcoding capabilities
Applied to files:
libs/sdk/project.jsonlibs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Use Nx for build system with commands like `nx build sdk`, `nx test`, `nx run-many -t test`
Applied to files:
libs/sdk/project.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use specific error classes with MCP error codes instead of generic errors
Applied to files:
libs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Use React 18/19 with TypeScript for all components in frontmcp/ui
Applied to files:
libs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.{ts,tsx} : Every component must have a Zod schema with `.strict()` mode to reject unknown properties
Applied to files:
libs/sdk/tsconfig.lib.jsonlibs/json-schema-to-zod-v3/package.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Provide TypeScript types for all component props without using 'any' type without justification
Applied to files:
libs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.ts : Validate all component options using validateOptions() helper with the component's Zod schema
Applied to files:
libs/json-schema-to-zod-v3/package.json
⏰ 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). (2)
- GitHub Check: Lint & Format Checks
- GitHub Check: Build Libraries
🔇 Additional comments (21)
libs/testing/package.json (3)
27-31: LGTM! Tree shaking configuration looks correct.The
"sideEffects": falseflag combined with explicit"type": "commonjs"and dualmain/moduleentries properly enables bundler tree shaking while maintaining backward compatibility.
36-43: Root export paths are correctly structured.The require/import conditional exports with separate type declarations for CJS (
./dist/index.d.ts) and ESM (./dist/esm/index.d.ts) follow the recommended dual-package pattern.
91-92: Good practice: Explicit null export for./esm.This prevents accidental direct imports from the ESM directory, ensuring consumers use the proper conditional exports.
libs/sdk/tsconfig.lib.json (1)
10-16: Self-referencing path alias for development builds.The
@frontmcp/sdkpath mapping to source (vs. dist for sibling packages) enables internal imports during compilation. This aligns with the"development": "./src/index.ts"entries in package.json exports.libs/sdk/project.json (3)
8-44: CJS build target configuration looks correct.The esbuild configuration properly:
- Externalizes peer dependencies and self-references
- Generates declarations with correct root directory
- Uses platform: node for server-side builds
46-81: ESM build target correctly chains after CJS.The
dependsOn: ["build-cjs"]ensures declarations from CJS are available, and outputting todist/esmmaintains the expected directory structure for dual-package exports.
83-89: Build orchestration is sound.The top-level
buildtarget correctly depends on both format targets and runs the package.json path cleanup script.libs/sdk/package.json (4)
26-30: Tree shaking configuration is correctly applied.The combination of
"type": "commonjs","sideEffects": false, and explicitmodulefield follows best practices for dual CJS/ESM packages with tree shaking support.
33-43: Root export conditional paths are well-structured.The
development,require, andimportconditions properly map to source (for dev tools), CJS, and ESM outputs respectively. Type declarations are correctly paired with each format.
44-54:./mcp-appssub-path export follows the same pattern.Consistent with the root export structure and aligns with the
additionalEntryPointsin project.json. Based on learnings, using entry points from package.json exports for public API access is the correct approach.
55-55: Good: Explicit null export for./esm.Prevents consumers from accidentally importing
@frontmcp/sdk/esmdirectly, enforcing use of proper conditional exports.libs/uipack/package.json (1)
32-32: LGTM. Adding"sideEffects": falsecorrectly enables aggressive tree shaking for this utility library, aligning with the PR's optimization goals. The package contains only pure re-exports with no code execution on import, no global modifications, and no CSS imports—confirming it is safe to mark as side-effect-free.libs/json-schema-to-zod-v3/package.json (4)
38-48: LGTM! Well-structured conditional exports.The exports field correctly implements dual module support following Node.js best practices:
developmentcondition provides source access during developmentrequireblock serves CommonJS consumers with dedicated typesimportblock serves ESM consumers with dedicated types- Proper separation ensures bundlers can tree-shake ESM builds effectively
This structure aligns with the PR objective to enhance tree shaking.
49-49: Good defensive pattern to prevent internal path imports.Setting
"./esm": nullprevents consumers from directly importing from the ESM output directory (e.g.,import ... from 'json-schema-to-zod-v3/esm'), ensuring all imports go through the controlled main export. This maintains a stable public API surface.
35-35:"sideEffects": falseis correctly set for this library.The codebase confirms this package is a pure converter with no module-level side effects. No global state mutations, polyfills, or prototype modifications detected.
31-35: The build configuration correctly supports the new package.json entry points. The Nx esbuild targets output CommonJS todist/index.jsand ESM todist/esm/index.js, with corresponding type definitions atdist/index.d.tsanddist/esm/index.d.ts. Thetsconfig.lib.jsonusesrootDir: "./src"to prevent nested source directories in the output, and both build targets are properly configured with declaration enabled.libs/ui/package.json (1)
30-30: sideEffects: false is correctly configured for this library.The package contains no module-level side effects. Verification confirms:
- No CSS, SCSS, or style imports
- No global state initialization, mutations, or polyfills
- No module-level event listeners (all
addEventListenercalls are inside functions or template strings)- Type augmentations in
web-components/types.tsare compile-time declarations only, not runtime side effectsThe library is safe for aggressive tree-shaking.
libs/adapters/package.json (1)
24-28: Build outputs are missing—verify the build system correctly outputs todist/anddist/esm/directories.The
sideEffects: falsedeclaration is accurate; no side effects were detected in the source code. However, the package.json entry points must have corresponding files on disk, assideEffects: falsesignals to bundlers that only declared exports are safe to keep.The package currently declares these entry points:
./dist/index.js(CJS)./dist/index.d.ts(types)./dist/esm/index.js(ESM)./dist/esm/index.d.ts(ESM types)None of these files exist. The build system must output to both directories with the correct structure matching the conditional exports in
package.json.⛔ Skipped due to learnings
Learnt from: CR Repo: agentfront/frontmcp PR: 0 File: libs/uipack/CLAUDE.md:0-0 Timestamp: 2025-12-22T13:01:16.929Z Learning: Use entry points from package.json exports for public API access instead of direct file importsLearnt from: CR Repo: agentfront/frontmcp PR: 0 File: libs/uipack/CLAUDE.md:0-0 Timestamp: 2025-12-22T13:01:16.929Z Learning: Applies to libs/uipack/src/{adapters,components,web-components}/**/*.test.ts : Test component behavior across platform configurations (OpenAI, Claude, etc.)Learnt from: CR Repo: agentfront/frontmcp PR: 0 File: libs/ui/CLAUDE.md:0-0 Timestamp: 2025-12-22T13:01:03.646Z Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundlerLearnt from: CR Repo: agentfront/frontmcp PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-19T02:04:46.464Z Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different nameslibs/mcp-from-openapi/package.json (3)
51-51: LGTM! Blocks direct ESM path access.The
"./esm": nullentry correctly prevents consumers from bypassing the conditional exports by importing directly frommcp-from-openapi/esm. This ensures all imports go through the exports map where Node.js can properly resolve the appropriate format based on the consumer's module system.
40-50: Verify that dual type declaration files are generated correctly by the build system.The exports structure requires type declarations at two locations:
./dist/index.d.tsfor CommonJS consumers./dist/esm/index.d.tsfor ESM consumersesbuild doesn't support the creation of declaration files (*.d.ts), so the build process must handle type generation separately. The commonly accepted workaround is to run a tsc build before the esbuild build that only outputs the declaration files. Verify that the build configuration includes type declaration generation for both CJS and ESM output formats to ensure the package's type exports are correct.
2-2: The package naming is correct. The unscoped package name "mcp-from-openapi" is published to npm with 2,006 weekly downloads, indicating this is an intentional publishing choice.The data shows 6 out of 9 packages in
/libs/use the@frontmcp/*scope, while 3 packages intentionally remain unscoped (mcp-from-openapi,json-schema-to-zod-v3, andfrontmcp). The learning that "each library should be under @frontmcp/* scope" is overstated—unscoped packages in this monorepo serve specific purposes and are published as standalone tools with independent versioning.No changes required.
…ESM compatibility
There was a problem hiding this 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 (2)
libs/mcp-from-openapi/package.json (1)
2-2: Critical: Package name must use @frontmcp/ scope.Per coding guidelines, each library in
/libs/*must be published under the@frontmcp/*scope. The package name should be"@frontmcp/mcp-from-openapi"instead of"mcp-from-openapi".This is required for consistency with other packages in the monorepo (e.g.,
@frontmcp/sdk,@frontmcp/uipack,@frontmcp/ui).As per coding guidelines, this package should follow the @frontmcp/* scoping convention.
🔎 Proposed fix
- "name": "mcp-from-openapi", + "name": "@frontmcp/mcp-from-openapi",libs/sdk/src/common/decorators/front-mcp.decorator.ts (1)
62-76: Inconsistent lazy loading pattern in serverless mode.The serverless path still uses direct
require('@frontmcp/sdk')instead of leveraging thegetFrontMcpInstance()helper introduced above. This inconsistency means the serverless mode doesn't benefit from the lazy loading pattern designed to avoid circular dependencies.If lazy loading is necessary to prevent circular dependency issues, the same approach should be applied consistently in both serverless and non-serverless modes.
🔎 Proposed fix to use consistent lazy loading
Consider whether
ServerlessInstanceshould also be retrieved viagetFrontMcpInstance(), or if there's a specific reason the serverless path requires a different approach. If they should be the same instance:if (isServerless) { // Serverless mode: bootstrap, prepare (no listen), store handler globally - // Use synchronous require for bundler compatibility (rspack/webpack) - // eslint-disable-next-line @typescript-eslint/no-require-imports - const { - FrontMcpInstance: ServerlessInstance, - setServerlessHandler, - setServerlessHandlerPromise, - setServerlessHandlerError, - }: { - FrontMcpInstance: typeof import('../../front-mcp').FrontMcpInstance; - setServerlessHandler: (handler: unknown) => void; - setServerlessHandlerPromise: (promise: Promise<unknown>) => void; - setServerlessHandlerError: (error: Error) => void; - } = require('@frontmcp/sdk'); + const ServerlessInstance = getFrontMcpInstance(); + // eslint-disable-next-line @typescript-eslint/no-require-imports + const { + setServerlessHandler, + setServerlessHandlerPromise, + setServerlessHandlerError, + } = require('@frontmcp/sdk'); if (!ServerlessInstance) {
♻️ Duplicate comments (1)
libs/adapters/package.json (1)
24-54: Export structure correctly configured for dual CJS/ESM distribution.The nested
require/importblocks with proper type resolutions follow best practices for dual distribution. The"./esm": nullentry correctly prevents direct ESM folder access.However, as flagged in a previous review, ensure the build configuration generates all required outputs for the
./openapiexport (dist/openapi/index.js, dist/openapi/index.d.ts, dist/esm/openapi/index.mjs).
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
libs/adapters/package.jsonlibs/adapters/project.jsonlibs/json-schema-to-zod-v3/package.jsonlibs/json-schema-to-zod-v3/project.jsonlibs/mcp-from-openapi/package.jsonlibs/mcp-from-openapi/project.jsonlibs/plugins/package.jsonlibs/plugins/project.jsonlibs/sdk/package.jsonlibs/sdk/project.jsonlibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/testing/package.jsonlibs/testing/project.jsonlibs/ui/package.jsonlibs/ui/project.jsonlibs/ui/src/web-components/index.tslibs/uipack/package.jsonlibs/uipack/project.json
💤 Files with no reviewable changes (1)
- libs/ui/src/web-components/index.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- libs/ui/package.json
- libs/json-schema-to-zod-v3/package.json
🧰 Additional context used
📓 Path-based instructions (4)
libs/*/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
Each library in /libs/* is independent and publishable under @frontmcp/* scope
Files:
libs/mcp-from-openapi/package.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.jsonlibs/uipack/package.json
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/mcp-from-openapi/package.jsonlibs/plugins/project.jsonlibs/sdk/project.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/adapters/project.jsonlibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/adapters/package.jsonlibs/testing/package.jsonlibs/testing/project.jsonlibs/json-schema-to-zod-v3/project.jsonlibs/uipack/package.jsonlibs/mcp-from-openapi/project.jsonlibs/ui/project.jsonlibs/uipack/project.json
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
libs/sdk/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
libs/sdk/src/**/*.ts: MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead ofunknown
Use specific error classes with MCP error codes instead of generic errors
UsegetCapabilities()method for dynamic capability exposure instead of hardcoding capabilities
UsechangeScopeproperty instead ofscopein change events to avoid confusion with Scope class
Validate URIs per RFC 3986 at metadata level using proper validation
Validate hook flows and fail fast on invalid hook configurations with specific error messages
Files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
🧠 Learnings (29)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Use Nx for build system with commands like `nx build sdk`, `nx test`, `nx run-many -t test`
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.jsonlibs/uipack/package.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/*/package.json : Each library in /libs/* is independent and publishable under frontmcp/* scope
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.jsonlibs/mcp-from-openapi/project.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: FrontMCP is a TypeScript-first schema validation framework - all types should align with MCP protocol definitions
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/adapters/package.jsonlibs/testing/package.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead of `unknown`
Applied to files:
libs/mcp-from-openapi/package.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/adapters/package.jsonlibs/testing/package.jsonlibs/uipack/package.jsonlibs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.jsonlibs/uipack/package.jsonlibs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/plugins/project.jsonlibs/sdk/project.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/adapters/project.jsonlibs/adapters/package.jsonlibs/testing/package.jsonlibs/testing/project.jsonlibs/json-schema-to-zod-v3/project.jsonlibs/uipack/package.jsonlibs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/sdk/src/common/decorators/front-mcp.decorator.tslibs/adapters/package.jsonlibs/testing/package.jsonlibs/uipack/package.jsonlibs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Applied to files:
libs/mcp-from-openapi/package.jsonlibs/sdk/project.jsonlibs/sdk/package.jsonlibs/plugins/package.jsonlibs/adapters/package.jsonlibs/testing/package.jsonlibs/uipack/package.jsonlibs/mcp-from-openapi/project.jsonlibs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Use Nx for build system with commands like `nx build sdk`, `nx test`, `nx run-many -t test`
Applied to files:
libs/plugins/project.jsonlibs/sdk/project.jsonlibs/adapters/project.jsonlibs/testing/project.jsonlibs/json-schema-to-zod-v3/project.jsonlibs/mcp-from-openapi/project.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use `changeScope` property instead of `scope` in change events to avoid confusion with Scope class
Applied to files:
libs/sdk/project.jsonlibs/sdk/package.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/common/records/**/*.ts : Centralize record types in common/records directory and import from there instead of module-specific files
Applied to files:
libs/sdk/project.jsonlibs/sdk/package.jsonlibs/uipack/package.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Applied to files:
libs/adapters/project.jsonlibs/adapters/package.jsonlibs/uipack/package.jsonlibs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,build,layouts,pages}/**/*.ts : Use platform-aware theming via getPlatform(), OPENAI_PLATFORM, and CLAUDE_PLATFORM constants for network capability detection
Applied to files:
libs/adapters/project.jsonlibs/adapters/package.jsonlibs/uipack/package.jsonlibs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,components,web-components}/**/*.test.ts : Test component behavior across platform configurations (OpenAI, Claude, etc.)
Applied to files:
libs/adapters/project.jsonlibs/testing/package.jsonlibs/uipack/package.jsonlibs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Use React Testing Library for component tests with 95%+ coverage across statements, branches, functions, and lines
Applied to files:
libs/testing/package.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not expose internal error details in user-facing error messages
Applied to files:
libs/uipack/package.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Avoid using `any` type without justification in TypeScript code
Applied to files:
libs/uipack/package.jsonlibs/uipack/project.json
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use specific error classes with MCP error codes instead of generic errors
Applied to files:
libs/mcp-from-openapi/project.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Applied to files:
libs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.{ts,tsx} : Every component must have a Zod schema with `.strict()` mode to reject unknown properties
Applied to files:
libs/ui/project.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Include SSR tests to verify server-side rendering output for React components
Applied to files:
libs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{handlebars,build,layouts,pages}/**/*.ts : Use Handlebars template engine for dynamic template rendering with variable substitution
Applied to files:
libs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Use React 18/19 with TypeScript for all components in frontmcp/ui
Applied to files:
libs/ui/project.jsonlibs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{theme,build,layouts,pages,base-template}/**/*.ts : Use theme.cdn configuration instead of hard-coding CDN URLs
Applied to files:
libs/uipack/project.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Maintain peer dependencies on React ^18.0.0 || ^19.0.0 and react-dom ^18.0.0 || ^19.0.0
Applied to files:
libs/uipack/project.json
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Ensure SSR support via react-dom/server for React components
Applied to files:
libs/uipack/project.json
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.ts : Validate all component options using validateOptions() helper with the component's Zod schema
Applied to files:
libs/uipack/project.json
🔇 Additional comments (16)
libs/ui/project.json (1)
48-85: LGTM: Dual CJS/ESM build correctly configured.The ESM build properly uses
.mjsextension and disables duplicate declaration generation. The external dependency list correctly excludes bundling of heavy dependencies likeonnxruntime-*,esbuild, and@huggingface/transformers.libs/uipack/package.json (2)
30-32: LGTM: Tree shaking configuration correctly applied.The
"sideEffects": falsedeclaration enables aggressive tree shaking, and the"module"field correctly points to the ESM build with.mjsextension.
33-57: LGTM: Exports correctly configured for dual CJS/ESM.The exports map properly distinguishes between
require(CJS) andimport(ESM) conditions, with correct paths to.mjsfiles for ESM. The"./esm": nullentry prevents direct imports from the esm directory.libs/testing/project.json (1)
47-83: ESM build correctly configured with .mjs extension.The use of
.mjsextension (line 67) resolves the previous concern about Node.js module resolution. With.mjs, Node automatically treats files as ESM regardless of the parent package.json"type"field, eliminating the need for a separate package.json in dist/esm/.libs/adapters/project.json (1)
8-67: LGTM: Dual-build configuration properly implemented.The esbuild-based build targets correctly separate CJS and ESM outputs. The external dependency list appropriately excludes
@frontmcp/*,@modelcontextprotocol/sdk, and related libraries from bundling.libs/sdk/project.json (1)
45-80: LGTM: ESM build optimized with skipTypeCheck.The
"skipTypeCheck": true(line 58) is a valid optimization since type checking already occurs in the build-cjs target. The comprehensive external list correctly prevents bundling of runtime dependencies likeioredis,jose,express, and Vercel KV.libs/mcp-from-openapi/project.json (1)
8-51: LGTM: Build configuration follows established pattern.The dual-build setup correctly externalizes dependencies like
@apidevtools/json-schema-ref-parser,openapi-types,yaml, andzod. Asset list appropriately includes the CHANGELOG.md for this independently versioned package.libs/uipack/project.json (2)
41-52: LGTM: React correctly externalized for React-free core.The addition of
react,react/*,react-dom, andreact-dom/*to the external list aligns with the architectural principle that uipack is a React-free core package.Based on learnings, uipack should not bundle React dependencies.
87-98: LGTM: ESM build configuration matches CJS externals.The ESM build correctly mirrors the CJS externalization strategy with
.mjsoutput extension and React excluded from the bundle.libs/mcp-from-openapi/package.json (1)
33-51: ESM configuration correctly updated with .mjs extension.The package correctly uses
.mjsextension for ESM output (line 48), which resolves the module resolution concerns from the previous review. With"type": "commonjs"and.mjsfiles, Node.js will correctly interpret the ESM build as ES modules.The exports structure properly separates
requireandimportconditions with matching type declarations.libs/json-schema-to-zod-v3/project.json (1)
8-54: Well-structured dual CJS/ESM build configuration.The new build targets correctly:
- Generate CJS output with declarations in
dist/- Generate ESM output with
.mjsextension indist/esm/- Mark
zodas external to avoid bundling the dependency- Chain
build-esmafterbuild-cjsto reuse declaration fileslibs/plugins/package.json (1)
24-65: Export structure correctly aligns with dual distribution pattern.The
./cacheand./codecallsubpath exports follow the established pattern with properrequire/importblocks. Per coding guidelines, entry points from package.json exports should be used for public API access.libs/plugins/project.json (1)
8-68: Build configuration properly supports all declared exports.The
additionalEntryPointscorrectly includecache/index.tsandcodecall/index.ts, ensuring build outputs match the package.json export declarations. The comprehensiveexternallist prevents bundling of dependencies, which is essential for tree shaking.libs/sdk/package.json (1)
26-56: Export configuration follows dual distribution best practices.The structure correctly provides:
- Shared type definitions between CJS and ESM (avoiding duplicate
.d.tsin ESM)- Proper
.mjsextensions for ESM entry points- The
./mcp-appssubpath aligns with barrel file export patternslibs/testing/package.json (1)
27-93: Export paths now correctly include thedist/prefix.The previous issues with missing
dist/prefixes in ESM export paths have been addressed. All subpath exports (./setup,./fixtures,./matchers,./playwright) now correctly resolve to./dist/esm/*.mjsfor ESM consumers.The shared type definitions under
import.typespointing to./dist/*.d.ts(rather than./dist/esm/*.d.ts) is correct since declarations are generated only in the CJS build and reused.libs/sdk/src/common/decorators/front-mcp.decorator.ts (1)
94-95: Correct usage of lazy loading pattern (pending require() fix).The non-serverless path correctly applies the lazy loading pattern via
getFrontMcpInstance(). However, this usage depends on resolving therequire()vs ESM issue flagged in the earlier comment on lines 7-16.If the lazy loading mechanism is refactored to use dynamic
import()for ESM compatibility, this call site will need to be adjusted to handle the asynchronous nature of ESM imports.
…ed schema for improved clarity and consistency
…serverless mode requirements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (1)
libs/ui/src/renderers/mdx.renderer.ts (1)
40-52: Verify React version compatibility for peer dependency range.While
buildReactCdnUrlsnow accepts both '18' and '19', the CDN URLs are used only for client-side hydration scripts (Line 248). The actual SSR rendering uses the installed React version fromloadReact(). However, the hard-coded default to React 19 CDN could cause hydration mismatches if the installed version is React 18.Based on learnings: The package peer dependencies support both React 18 and 19 (^18.0.0 || ^19.0.0).
Consider detecting the installed React version at runtime and selecting the matching CDN URL:
#!/bin/bash # Search for React version detection logic in the codebase rg -n -C3 'React\.version|react.*version.*detect' --type=ts
🧹 Nitpick comments (1)
libs/ui/src/renderers/mdx.renderer.ts (1)
94-100: Consider usingunknowninstead ofanyfor stricter type safety.The lazy-loaded module types are declared as
anywith an ESLint disable comment. Per strict TypeScript guidelines, consider usingunknownas the generic type default and type-guard these values before use, or explicitly type them as module interfaces.As per coding guidelines: "Use strict TypeScript mode with no
anytypes without strong justification - useunknowninstead for generic type defaults."Suggested type improvement
/** * Lazy-loaded modules. */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - private React: any = null; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - private ReactDOMServer: any = null; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - private jsxRuntime: any = null; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - private mdxEvaluate: ((source: string, options: object) => Promise<{ default: any }>) | null = null; + private React: typeof import('react') | null = null; + private ReactDOMServer: typeof import('react-dom/server') | null = null; + private jsxRuntime: typeof import('react/jsx-runtime') | null = null; + private mdxEvaluate: typeof import('@mdx-js/mdx').evaluate | null = null;
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
libs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.tslibs/sdk/src/common/types/options/auth/orchestrated.schema.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/tsconfig.lib.tsbuildinfo
✅ Files skipped from review due to trivial changes (1)
- libs/uipack/tsconfig.lib.tsbuildinfo
🚧 Files skipped from review as they are similar to previous changes (1)
- libs/sdk/src/common/types/options/auth/orchestrated.schema.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
libs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
libs/sdk/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
libs/sdk/src/**/*.ts: MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead ofunknown
Use specific error classes with MCP error codes instead of generic errors
UsegetCapabilities()method for dynamic capability exposure instead of hardcoding capabilities
UsechangeScopeproperty instead ofscopein change events to avoid confusion with Scope class
Validate URIs per RFC 3986 at metadata level using proper validation
Validate hook flows and fail fast on invalid hook configurations with specific error messages
Files:
libs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
libs/uipack/src/{components,web-components,renderers,utils}/**/*.ts
📄 CodeRabbit inference engine (libs/uipack/CLAUDE.md)
Always escape user-provided content using escapeHtml() utility to prevent XSS
Files:
libs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/renderers/index.ts
libs/uipack/src/**/*.ts
📄 CodeRabbit inference engine (libs/uipack/CLAUDE.md)
libs/uipack/src/**/*.ts: Do not add React dependencies to uipack - use @frontmcp/ui package for React components instead
Avoid usinganytype without justification in TypeScript code
Do not expose internal error details in user-facing error messages
Files:
libs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/renderers/index.ts
libs/ui/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (libs/ui/CLAUDE.md)
Do not import React-free utilities from @frontmcp/ui; use @frontmcp/uipack instead
Files:
libs/ui/src/renderers/mdx.renderer.ts
🧠 Learnings (20)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Use React 18/19 with TypeScript for all components in frontmcp/ui
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,build,layouts,pages}/**/*.ts : Use platform-aware theming via getPlatform(), OPENAI_PLATFORM, and CLAUDE_PLATFORM constants for network capability detection
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/renderers/**/*.adapter.ts : Implement client-side hydration for interactive widgets using ReactRendererAdapter
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/renderers/**/*.test.{ts,tsx} : Include hydration tests to verify client-side hydration behavior
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{theme,build,layouts,pages,base-template}/**/*.ts : Use theme.cdn configuration instead of hard-coding CDN URLs
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.tslibs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Include SSR tests to verify server-side rendering output for React components
Applied to files:
libs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Ensure SSR support via react-dom/server for React components
Applied to files:
libs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Applied to files:
libs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Applied to files:
libs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/**/*.{ts,tsx} : Use React 18/19 with TypeScript for all components in frontmcp/ui
Applied to files:
libs/ui/src/renderers/mdx.renderer.tslibs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Maintain peer dependencies on React ^18.0.0 || ^19.0.0 and react-dom ^18.0.0 || ^19.0.0
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/hooks/**/*.{ts,tsx} : Use MCP bridge hooks (useMcpBridge, useCallTool, useToolInput, useToolOutput) for tool communication in components
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components,renderers,utils}/**/*.ts : Always escape user-provided content using escapeHtml() utility to prevent XSS
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components,renderers}/**/*.test.ts : Test HTML escaping for user-provided content in component tests
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,build,layouts,pages}/**/*.ts : Use platform-aware theming via getPlatform(), OPENAI_PLATFORM, and CLAUDE_PLATFORM constants for network capability detection
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Zero React dependency constraint - this is the React-free core package
Applied to files:
libs/ui/src/renderers/mdx.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Applied to files:
libs/uipack/src/renderers/index.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
libs/uipack/src/renderers/index.ts
🧬 Code graph analysis (1)
libs/ui/src/renderers/mdx.renderer.ts (3)
libs/uipack/src/renderers/index.ts (5)
buildReactCdnUrls(65-65)TranspileOptions(40-40)TranspileResult(39-39)hashString(95-95)transpileCache(52-52)libs/uipack/src/renderers/mdx-client.renderer.ts (1)
buildReactCdnUrls(36-42)libs/uipack/src/renderers/types.ts (2)
TranspileOptions(101-106)TranspileResult(87-96)
⏰ 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). (2)
- GitHub Check: Lint & Format Checks
- GitHub Check: Build Libraries
🔇 Additional comments (7)
libs/sdk/src/common/interfaces/internal/primary-auth-provider.interface.ts (3)
82-82: Documentation clarity improved.The past review concern about the documentation referencing "transport.deprecated.ts" inconsistently has been addressed. The simplified comment accurately describes the behavior without the confusing reference.
84-86: LGTM: Centralized default improves maintainability.The change to use
DEFAULT_TRANSPORT_CONFIGas the centralized source of truth for transport defaults is a sound refactoring that improves maintainability and consistency. The implementation logic is correct and maintains type safety.Assuming the tree shaking concern from Line 5 is verified, this change enhances code organization without altering runtime behavior.
5-5: The barrel import pattern is correct for SDK public API exports per project standards.DEFAULT_TRANSPORT_CONFIGshould be imported from the centralized barrel file ('../../types') as it is part of the public API. If tree-shaking optimization is a PR goal, ensurelibs/sdk/package.jsonincludes"sideEffects": falsein the appropriate export configuration to enable proper dead code elimination for barrel exports, rather than bypassing the barrel with direct imports.Likely an incorrect or invalid review comment.
libs/uipack/src/renderers/index.ts (1)
60-83: LGTM! Excellent deprecation strategy supporting tree shaking.The migration from server-side to client-side MDX rendering with clear deprecation guidance, backward-compatible aliases, and separation of React-free (uipack) vs React-dependent (ui) code directly supports the PR's tree shaking objective. The documentation clearly guides users to the appropriate package based on their rendering needs.
Based on learnings: This aligns with the package separation principle where uipack contains React-free utilities and ui contains React-dependent components.
libs/ui/src/renderers/mdx.renderer.ts (1)
197-210: LGTM! Prop spreading now correctly preserves reserved props.The updated logic filters reserved keys (
input,output,structuredContent,helpers,components) fromcontext.outputbefore spreading, ensuring core props cannot be accidentally overwritten. This provides consistent and predictable behavior.libs/uipack/src/renderers/mdx-client.renderer.ts (2)
192-205: LGTM! Prop spreading now matches server renderer.The reserved props filtering logic is now consistent with the server renderer (
mdx.renderer.tslines 197-210). This preventscontext.outputproperties from overwriting core props likeinput,output,structuredContent,helpers, andcomponents, ensuring predictable behavior across both rendering modes.
36-52: The concern in this review is based on a misunderstanding of how client-side CDN-based rendering works. The code and documentation are already appropriate.Documentation already addresses React 18/19 configuration: Lines 45-47 explicitly document that the default is React 19 and how to use React 18 (
cdn: buildReactCdnUrls('18')). Therender()method correctly supports thecdnoption to override defaults (lines 178-182).Automatic version detection is not feasible: This is client-side code that loads React from esm.sh CDN. Version must be explicit in the URL; there is no way to auto-detect from the browser. Users correctly configure this via the
cdnoption if their application uses React 18.Minor enhancement suggestion: The JSDoc example (lines 105-114) could demonstrate the React 18 configuration to make this feature more discoverable.
Likely an incorrect or invalid review comment.
There was a problem hiding this 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 (1)
libs/sdk/src/common/decorators/front-mcp.decorator.ts (1)
7-19: LGTM! Past issue properly addressed.The lazy loading pattern correctly avoids circular dependencies and dual-package hazards. The explicit error handling on lines 15-17 replaces the previous non-null assertion, following the coding guidelines.
Optional: Add explicit return type annotation
Adding an explicit return type would make the intent clearer:
-function getFrontMcpInstance() { +function getFrontMcpInstance(): typeof import('../../front-mcp').FrontMcpInstance { if (!_FrontMcpInstance) {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
libs/sdk/src/common/decorators/front-mcp.decorator.tslibs/ui/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- libs/ui/package.json
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
libs/sdk/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
libs/sdk/src/**/*.ts: MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead ofunknown
Use specific error classes with MCP error codes instead of generic errors
UsegetCapabilities()method for dynamic capability exposure instead of hardcoding capabilities
UsechangeScopeproperty instead ofscopein change events to avoid confusion with Scope class
Validate URIs per RFC 3986 at metadata level using proper validation
Validate hook flows and fail fast on invalid hook configurations with specific error messages
Files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Applied to files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Applied to files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: FrontMCP is a TypeScript-first schema validation framework - all types should align with MCP protocol definitions
Applied to files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to **/*.ts : Avoid non-null assertions (`!`) - use proper error handling and throw specific errors instead
Applied to files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : Use specific error classes with MCP error codes instead of generic errors
Applied to files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/*.ts : MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead of `unknown`
Applied to files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/react/hooks/**/*.{ts,tsx} : Handle loading and error states in MCP bridge hooks (useMcpBridge, useCallTool, etc.)
Applied to files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Applied to files:
libs/sdk/src/common/decorators/front-mcp.decorator.ts
⏰ 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). (14)
- GitHub Check: E2E Tests (demo-e2e-ui)
- GitHub Check: E2E Tests (demo-e2e-serverless)
- GitHub Check: E2E Tests (demo-e2e-errors)
- GitHub Check: E2E Tests (demo-e2e-multiapp)
- GitHub Check: E2E Tests (demo-e2e-redis)
- GitHub Check: E2E Tests (demo-e2e-cache)
- GitHub Check: E2E Tests (demo-e2e-notifications)
- GitHub Check: E2E Tests (demo-e2e-hooks)
- GitHub Check: E2E Tests (demo-e2e-providers)
- GitHub Check: E2E Tests (demo-e2e-transparent)
- GitHub Check: E2E Tests (demo-e2e-openapi)
- GitHub Check: E2E Tests (demo-e2e-codecall)
- GitHub Check: E2E Tests (demo-e2e-public)
- GitHub Check: Unit Tests
🔇 Additional comments (2)
libs/sdk/src/common/decorators/front-mcp.decorator.ts (2)
65-95: Serverless initialization pattern looks correct.The serverless path appropriately uses direct
require('@frontmcp/sdk')to access multiple exports, with clear documentation (lines 67-68) explaining the difference from the normal path. Error handling properly usesInternalMcpErrorwith specific codes.
96-100: Normal mode path correctly uses lazy loading.The implementation properly calls
getFrontMcpInstance().bootstrap(metadata)with clear documentation explaining the dual-package hazard mitigation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
libs/uipack/src/renderers/mdx-client.renderer.ts (1)
179-182: Consider validating CDN URLs.While the CDN URLs are typically provided by developers, adding basic URL validation would improve robustness and catch configuration errors early.
🔎 Suggested validation
// Merge custom CDN config with defaults const cdn = { ...DEFAULT_CDN, ...options?.cdn, }; + + // Validate CDN URLs are well-formed + const cdnUrls = [cdn.mdx, cdn.jsxRuntime, cdn.react, cdn.reactDom]; + for (const url of cdnUrls) { + try { + new URL(url); + } catch { + throw new Error(`Invalid CDN URL: ${url}`); + } + }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
libs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/utils/escape-html.tslibs/uipack/src/utils/index.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
libs/uipack/src/utils/escape-html.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/utils/index.ts
libs/uipack/src/{components,web-components,renderers,utils}/**/*.ts
📄 CodeRabbit inference engine (libs/uipack/CLAUDE.md)
Always escape user-provided content using escapeHtml() utility to prevent XSS
Files:
libs/uipack/src/utils/escape-html.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/utils/index.ts
libs/uipack/src/**/*.ts
📄 CodeRabbit inference engine (libs/uipack/CLAUDE.md)
libs/uipack/src/**/*.ts: Do not add React dependencies to uipack - use @frontmcp/ui package for React components instead
Avoid usinganytype without justification in TypeScript code
Do not expose internal error details in user-facing error messages
Files:
libs/uipack/src/utils/escape-html.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/utils/index.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/uipack/src/utils/escape-html.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/utils/index.ts
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Configure entry points for frontmcp/ui exports: main, react, react/hooks, renderers, render, universal, and bundler
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Export FrontMCPProvider and UniversalApp from universal app shell for platform-agnostic React configuration
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components}/**/*.ts : Validate all component options using validateOptions() helper with the component's Zod schema
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Use entry points from package.json exports for public API access instead of direct file imports
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{handlebars,build,layouts,pages}/**/*.ts : Use Handlebars template engine for dynamic template rendering with variable substitution
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components,renderers,utils}/**/*.ts : Always escape user-provided content using escapeHtml() utility to prevent XSS
Applied to files:
libs/uipack/src/utils/escape-html.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/utils/index.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{components,web-components,renderers}/**/*.test.ts : Test HTML escaping for user-provided content in component tests
Applied to files:
libs/uipack/src/utils/escape-html.tslibs/uipack/src/renderers/mdx-client.renderer.tslibs/uipack/src/utils/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/renderers/**/*.adapter.ts : Implement client-side hydration for interactive widgets using ReactRendererAdapter
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{adapters,base-template,layouts,pages}/**/*.ts : Use buildCdnScriptsFromTheme() with appropriate inline flag for platform network access constraints
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/{theme,build,layouts,pages,base-template}/**/*.ts : Use theme.cdn configuration instead of hard-coding CDN URLs
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/renderers/**/*.test.{ts,tsx} : Include hydration tests to verify client-side hydration behavior
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : Use SSR component bundler (createBundler, InMemoryBundler) for bundling React components
Applied to files:
libs/uipack/src/renderers/mdx-client.renderer.ts
📚 Learning: 2025-12-19T02:04:46.464Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.464Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
libs/uipack/src/utils/index.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not expose internal error details in user-facing error messages
Applied to files:
libs/uipack/src/utils/index.ts
📚 Learning: 2025-12-22T13:01:03.646Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:03.646Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Do not import React-free utilities from frontmcp/ui; use frontmcp/uipack instead
Applied to files:
libs/uipack/src/utils/index.ts
📚 Learning: 2025-12-22T13:01:16.929Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-22T13:01:16.929Z
Learning: Applies to libs/uipack/src/**/*.ts : Do not add React dependencies to uipack - use frontmcp/ui package for React components instead
Applied to files:
libs/uipack/src/utils/index.ts
🧬 Code graph analysis (2)
libs/uipack/src/utils/escape-html.ts (1)
libs/uipack/src/utils/index.ts (1)
escapeScriptClose(10-10)
libs/uipack/src/renderers/mdx-client.renderer.ts (3)
libs/uipack/src/renderers/types.ts (6)
RenderOptions(111-118)UIRenderer(160-213)TranspileOptions(101-106)TranspileResult(87-96)ToolUIProps(30-39)RuntimeScripts(123-130)libs/uipack/src/registry/render-template.ts (1)
containsMdxSyntax(27-65)libs/uipack/src/utils/escape-html.ts (3)
escapeScriptClose(105-107)escapeJsString(76-86)escapeHtml(27-41)
🔇 Additional comments (1)
libs/uipack/src/utils/index.ts (1)
10-10: LGTM - Proper barrel file export.The export correctly includes the new
escapeScriptClosefunction, maintaining consistency with the existing escape utility exports.Based on learnings, this follows the pattern of exporting public API through barrel files.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.