Skip to content

Conversation

@frontegg-david
Copy link
Contributor

@frontegg-david frontegg-david commented Dec 22, 2025

Summary by CodeRabbit

  • New Features

    • UI split into two packages (HTML/tooling + React/SSR); new bundler, secure sandbox executor, bridge IIFE generator, renderer registry, and built-in platform adapters and runtime bridge helpers.
  • Documentation

    • Docs updated throughout with package-split guidance, new import paths, migration notes, and usage examples for theming, templates, renderers, and adapters.
  • Build / Tooling

    • New package manifests, build targets, Jest configs, TypeScript path mappings, and bundler/file-cache APIs.
  • Tests

    • Added/updated tests for bundling, caching, and renderer registry.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 22, 2025

Walkthrough

Split the UI into two packages: @frontmcp/uipack (HTML components, bundler, dependency resolver, runtime bridge, adapters, renderers, tooling, typings) and @frontmcp/ui (React components, SSR/hydration). Updated docs, import paths, TS/Jest mappings, many re-exports, and added uipack implementations and declarations.

Changes

Cohort / File(s) Change Summary
Documentation
docs/draft/docs/guides/ui-library.mdx, docs/draft/docs/ui/*, docs/draft/docs/servers/tools.mdx, docs/draft/updates.mdx
Update docs to describe package split and new import paths; adjust examples to import from @frontmcp/ui/components, @frontmcp/ui/layouts, and @frontmcp/uipack/*; remove draft update content.
Monorepo config & tests
libs/*/jest.config.ts, libs/*/tsconfig.lib.json, libs/ui/project.json
Add Jest moduleNameMapper mappings for @frontmcp/uipack/@frontmcp/ui, SWC/Jest tweaks, TS path mappings and esbuild externals; add test target and build target adjustments.
New package: uipack manifest & docs
libs/uipack/package.json, libs/uipack/README.md, libs/uipack/CLAUDE.md, libs/uipack/.spec.swcrc, libs/uipack/jest.config.ts
Add @frontmcp/uipack package, README/CLAUDE docs, SWC/Jest config, and package metadata (v0.6.0).
uipack — bundler & cache
libs/uipack/src/bundler/**, libs/uipack/src/bundler/file-cache/**, libs/uipack/src/bundler/cache.ts, libs/uipack/src/bundler/sandbox/**
New bundler implementation: in-memory LRU cache, hash utilities, filesystem/Redis storage, component builder with SSR, enclave execution adapter, security policy and tests.
uipack — dependency & import-map
libs/uipack/src/dependency/**
New CDN registry, dependency resolver, import-map generation (with script-escaping), import parser, template loader/processor, Zod schemas and extensive dependency/template typings.
uipack — renderers & handlebars
libs/uipack/src/renderers/**, libs/uipack/src/handlebars/**
New renderer system (HTML, MDX), transpile/cache utilities, Handlebars renderer, helpers, expression extractor, renderer registry and tests.
uipack — runtime, bridge & wrappers
libs/uipack/src/runtime/**, libs/uipack/src/bridge-runtime/**
Add IIFE bridge generator (generateBridgeIIFE/BRIDGE_SCRIPT_TAGS), runtime adapters (HTML/MDX), CSP utilities, wrapper APIs (wrapToolUI variants), renderer runtime bootstrap utilities and runtime typings.
ui package (React-focused) manifests & build
libs/ui/package.json, libs/ui/project.json, libs/ui/README.md, libs/ui/CLAUDE.md
Rework @frontmcp/ui to be React-centric, update peer deps (react/react-dom), consolidate entry points, mark @frontmcp/uipack optional, update docs and build entries.
ui package — bridge, adapters, re-exports & types
libs/ui/src/index.ts, libs/ui/src/bridge/**, libs/ui/src/bridge/core/*.d.ts, libs/ui/src/bridge/types.d.ts, libs/ui/src/bridge/runtime/index.ts
Add bridge core and registry declarations, adapter typings, reorganize public exports into granular entry points and re-export runtime items from @frontmcp/uipack where applicable.
ui package — React components & types
libs/ui/src/react/*.tsx, libs/ui/src/react/index.ts, libs/ui/src/react/types.ts, libs/ui/src/react/utils.ts
Update imports to use @frontmcp/uipack utilities/styles/validation; remove several inline type re-exports from React modules and centralize types under components.
SDK integrations
libs/sdk/package.json, libs/sdk/jest.config.ts, libs/sdk/src/**/*, libs/sdk/src/tool/ui/*, libs/sdk/src/common/metadata/tool-ui.metadata.ts
Point SDK imports/re-exports to @frontmcp/uipack (types, runtime, registry, adapters); update tool flows and metadata type sources; adjust Jest mapping and dependencies.
Type declarations & barrels
many libs/uipack/src/**/*.d.ts, libs/uipack/src/index.ts, libs/uipack/src/renderers/index.ts
Add comprehensive .d.ts surfaces and barrels for bundler, dependency, renderers, runtime, adapters, handlebars and other public APIs.
Tests & small API renames
libs/uipack/src/bundler/__tests__/*, libs/ui/src/bundler/__tests__/*, libs/ui/src/layouts/base.test.ts, libs/ui/src/renderers/registry.test.ts
Add/update tests for caches/registry; rename test usage (e.g., maxSourceSize → maxBundleSize) and adjust helper generics.
Search-and-replace import path updates
many files under libs/ui/src/**, libs/sdk/src/**, docs/**
Large sweep updating imports from @frontmcp/ui to new, more-specific paths: @frontmcp/ui/components, @frontmcp/ui/layouts, @frontmcp/uipack/*, etc.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Server
participant UIPack as @frontmcp/uipack (bridge)
participant AdapterReg as AdapterRegistry
participant Host as Platform (OpenAI/Claude/Gemini)
participant Client

Server->>UIPack: serve bridge script (UNIVERSAL_BRIDGE_SCRIPT / generateBridgeIIFE)
Server->>AdapterReg: registerBuiltInAdapters()
Client->>UIPack: bridge init -> detect platform
UIPack->>AdapterReg: detect() → select adapter
UIPack->>Host: initialize adapter (handshake)
Host-->>UIPack: host capabilities / context
UIPack-->>Client: expose window.FrontMcpBridge (bridge-ready)
Client->>UIPack: callTool / sendMessage
UIPack->>Host: route invocation / messages
Host-->>Client: respond / events

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120+ minutes

Focus areas:

  • Bridge core, AdapterRegistry, and global bridge helpers — libs/ui/src/bridge/*, libs/uipack/src/bridge-runtime/**
  • Bundler & file-cache correctness (hashing, eviction, TTL, manifest integrity, SSR, enclave execution) — libs/uipack/src/bundler/**
  • Dependency resolver, CDN registry, import-map generation and script escaping — libs/uipack/src/dependency/**
  • Public API/barrel changes and potential breakages from export reorganization — libs/ui/src/index.ts, libs/uipack/src/index.ts, libs/ui/src/react/*
  • Type & declaration coverage across many new .d.ts files — ensure typings match implementations
  • Monorepo build/test resolution: tsconfig paths, esbuild externals, jest moduleNameMapper — libs//tsconfig.lib.json, libs//jest.config.ts

Possibly related PRs

Poem

🐰 I hopped through code with nimble paws,

split packages, tidy imports, fixed the flaws.
Bridges built and renderers sing,
uipack blooms — components take wing.
A carrot for tests, a thump for docs — hooray for the cause!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: splitting @frontmcp/ui into two packages to enable server-side bundler usage without React dependency.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch split-frontmcp-ui

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

@frontegg-david
Copy link
Contributor Author

frontegg-david commented Dec 22, 2025

⚠️ Snyk checks are incomplete.

Status Scanner Critical High Medium Low 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 13

Note

Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

Caution

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

⚠️ Outside diff range comments (5)
libs/sdk/src/tool/ui/ui-resource.handler.ts (1)

66-66: Update outdated comment reference.

The comment still references @frontmcp/ui but the function is now imported from @frontmcp/uipack.

🔎 Proposed fix
- * Delegates to @frontmcp/ui's createDefaultBaseTemplate which provides:
+ * Delegates to @frontmcp/uipack's createDefaultBaseTemplate which provides:
docs/draft/docs/servers/tools.mdx (1)

820-820: Update inconsistent package reference.

Line 820 still references @frontmcp/ui in the card title, but based on the context of this PR and the changes on lines 768-773, it should reference @frontmcp/uipack.

🔎 Proposed fix
-    Pre-built components from @frontmcp/ui
+    Pre-built components from @frontmcp/uipack
docs/draft/docs/ui/advanced/platforms.mdx (1)

332-342: Fix inconsistent mock path in testing example.

The import on line 332 uses @frontmcp/uipack/components, but the jest.mock on line 335 references @frontmcp/ui. These should be consistent to accurately reflect the new package structure.

🔎 Suggested fix
 // Mock platform for testing
 import { getPlatform } from '@frontmcp/uipack/components';
 
 // Override for testing
-jest.mock('@frontmcp/ui', () => ({
-  ...jest.requireActual('@frontmcp/ui'),
+jest.mock('@frontmcp/uipack/components', () => ({
+  ...jest.requireActual('@frontmcp/uipack/components'),
   getPlatform: jest.fn().mockReturnValue({
     id: 'claude',
     network: 'blocked',
     scripts: 'inline',
   }),
 }));
libs/ui/package.json (1)

56-66: Update @swc/core to a recent version for React 19 compatibility.

  • esbuild at ^0.27.1 is current as of December 2025 and compatible with React 19
  • @swc/core at ^1.5.0 is significantly outdated (latest is 1.15.7); upgrade to a recent version for React 19 support
  • zod at ^4.0.0 correctly uses the new unified error API introduced in Zod 4
  • @frontmcp/uipack at exact 0.6.0 ensures coordinated release
docs/draft/docs/ui/api-reference/runtime.mdx (1)

1-6: Update frontmatter description to match new package structure.

The description on line 5 still references @frontmcp/ui runtime system, but all code examples now import from @frontmcp/uipack/components. Update the description for consistency with the package split.

🔎 Proposed fix
 ---
 title: Runtime API Reference
 sidebarTitle: Runtime
 icon: gear
-description: Complete API reference for the @frontmcp/ui runtime system, including template context, helper functions, MCP Bridge, and wrapper utilities.
+description: Complete API reference for the @frontmcp/uipack runtime system, including template context, helper functions, MCP Bridge, and wrapper utilities.
 ---
🟡 Minor comments (14)
libs/uipack/src/theme/presets/index.d.ts-1-10 (1)

1-10: Fix inconsistent module path in JSDoc.

The @module tag references @frontmcp/ui/theme/presets but this file is located in the @frontmcp/uipack package. The module path should match the actual package location.

🔎 Proposed fix
  * Provides pre-configured theme presets for different design aesthetics.
- * The GitHub/OpenAI theme is the default for all @frontmcp/ui components.
+ * The GitHub/OpenAI theme is the default for all @frontmcp/uipack components.
  *
- * @module @frontmcp/ui/theme/presets
+ * @module @frontmcp/uipack/theme/presets
  */
libs/uipack/src/theme/presets/github-openai.d.ts-1-23 (1)

1-23: Fix package references in JSDoc to match actual location.

This file is located in libs/uipack but the JSDoc documentation references @frontmcp/ui:

  • Line 11: Example imports from '@frontmcp/ui'
  • Line 22: Module path is @frontmcp/ui/theme/presets/github-openai

Both should reference @frontmcp/uipack to match the file's actual package location and the PR's package split architecture.

🔎 Suggested fix
  * @example
  * ```typescript
- * import { GITHUB_OPENAI_THEME, createTheme } from '@frontmcp/ui';
+ * import { GITHUB_OPENAI_THEME, createTheme } from '@frontmcp/uipack';
  *
  * // Use directly
  * baseLayout(content, { theme: GITHUB_OPENAI_THEME });
  *
  * // Or extend
  * const myTheme = createTheme({
  *   colors: { semantic: { primary: '#0969da' } },
  * });
  * ```
  *
- * @module @frontmcp/ui/theme/presets/github-openai
+ * @module @frontmcp/uipack/theme/presets/github-openai
  */
libs/sdk/jest.config.ts-19-25 (1)

19-25: Add build requirement note to Jest configuration.

The moduleNameMapper patterns are correctly configured for the package exports structure (./* maps to dist/*/index.js). However, tests will fail if the dist directories are not built first. Add a comment documenting this dependency:

  coverageDirectory: 'test-output/jest/coverage',
+ // Map @frontmcp/uipack and @frontmcp/ui imports to the built dist for tests.
+ // Ensure packages are built: nx build uipack && nx build ui
  // Map @frontmcp/uipack imports to the built dist for tests
  moduleNameMapper: {
    '^@frontmcp/uipack$': '<rootDir>/../uipack/dist/index.js',
    '^@frontmcp/uipack/(.*)$': '<rootDir>/../uipack/dist/$1/index.js',
    '^@frontmcp/ui$': '<rootDir>/../ui/dist/index.js',
    '^@frontmcp/ui/(.*)$': '<rootDir>/../ui/dist/$1/index.js',
  },
libs/uipack/src/bundler/file-cache/hash-calculator.ts-97-98 (1)

97-98: Unused externals parameter.

The externals parameter is defined in ComponentHashOptions and destructured at line 183, but it's never used in the function body. The docstring mentions "External packages (excluded from hash)" but no exclusion logic exists.

Either implement the exclusion logic or remove the parameter to avoid confusion.

🔎 Option 1: Implement externals filtering in collectLocalDependencies
-async function collectLocalDependencies(
+async function collectLocalDependencies(
   filePath: string,
   baseDir: string,
   collected: Set<string>,
   maxDepth: number,
   currentDepth: number,
+  externals: string[] = [],
 ): Promise<void> {
   // ... existing code ...
   
   for (const importPath of imports) {
     // Skip external packages
-    if (!importPath.startsWith('.') && !importPath.startsWith('/')) {
+    if (!importPath.startsWith('.') && !importPath.startsWith('/') || externals.includes(importPath)) {
       continue;
     }
🔎 Option 2: Remove unused parameter
 export interface ComponentHashOptions {
   // ...
-  /**
-   * External packages (excluded from hash).
-   */
-  externals?: string[];
   // ...
 }

Also applies to: 179-187

libs/uipack/src/theme/theme.d.ts-14-36 (1)

14-36: Update import path in documentation example.

The example imports from @frontmcp/ui but this file is now part of @frontmcp/uipack per the PR objective to split packages. The import path should be updated to reflect the new package structure.

🔎 Suggested fix
 * @example
 * ```typescript
-* import { createTheme, DEFAULT_THEME } from '@frontmcp/ui';
+* import { createTheme, DEFAULT_THEME } from '@frontmcp/uipack';
 *
 * // Use the default GitHub/OpenAI theme
libs/uipack/src/renderers/index.ts-1-28 (1)

1-28: Documentation references incorrect package name.

Same issue as the .d.ts file - the @module tag and import examples reference @frontmcp/ui instead of @frontmcp/uipack. The comment on line 62 correctly notes the package split, but the header documentation is inconsistent.

🔎 Proposed fix
  /**
   * Renderer Module
   *
   * Multi-framework rendering system for Tool UI templates.
   * Supports HTML, React, and MDX templates with auto-detection.
   *
-  * @module @frontmcp/ui
+  * @module @frontmcp/uipack/renderers
   *
   * @example Basic usage with auto-detection
   * ```typescript
-  * import { rendererRegistry } from '@frontmcp/ui';
+  * import { rendererRegistry } from '@frontmcp/uipack/renderers';
   *
   * // HTML template
   * const htmlTemplate = (ctx) => `<div>${ctx.output.name}</div>`;
   * const result = await rendererRegistry.render(htmlTemplate, context);
   * ```
   *
   * @example Register React renderer
   * ```typescript
-  * import { rendererRegistry, reactRenderer } from '@frontmcp/ui';
+  * import { rendererRegistry } from '@frontmcp/uipack/renderers';
+  * import { reactRenderer } from '@frontmcp/ui/renderers';
   *
   * rendererRegistry.register(reactRenderer);
libs/uipack/src/renderers/index.d.ts-7-27 (1)

7-27: Documentation references incorrect package name.

The @module tag and import examples reference @frontmcp/ui, but this file is in @frontmcp/uipack. This will confuse users trying to use the examples.

🔎 Proposed fix
- * @module @frontmcp/ui
+ * @module @frontmcp/uipack/renderers
  *
  * @example Basic usage with auto-detection
  * ```typescript
- * import { rendererRegistry } from '@frontmcp/ui';
+ * import { rendererRegistry } from '@frontmcp/uipack/renderers';
  *
  * // HTML template
  * const htmlTemplate = (ctx) => `<div>${ctx.output.name}</div>`;
  * const result = await rendererRegistry.render(htmlTemplate, context);
  * ```
  *
  * @example Register React renderer
  * ```typescript
- * import { rendererRegistry, reactRenderer } from '@frontmcp/ui';
+ * import { rendererRegistry } from '@frontmcp/uipack/renderers';
+ * import { reactRenderer } from '@frontmcp/ui/renderers';
  *
  * rendererRegistry.register(reactRenderer);
libs/uipack/src/renderers/cache.d.ts-127-144 (1)

127-144: ComponentCache is not exported from the barrel file.

The ComponentCache class and componentCache instance are defined in cache.d.ts and cache.ts but are not re-exported from libs/uipack/src/renderers/index.ts. If this is intentional (internal-only), add a comment to clarify. If it should be public, add it to the barrel exports.

libs/uipack/src/theme/cdn.d.ts-16-25 (1)

16-25: Update import path in the example.

The example shows importing from @frontmcp/ui, but these CDN functions are exported only from @frontmcp/uipack. Update the import to:

import { buildCdnScriptsFromTheme, DEFAULT_THEME } from '@frontmcp/uipack';
libs/uipack/src/renderers/registry.d.ts-130-145 (1)

130-145: Documentation example shows incorrect import path.

The example imports from @frontmcp/ui, but this file is part of @frontmcp/uipack. Since this PR splits the packages, the documentation should reflect the correct import path for the package where rendererRegistry is defined.

Suggested fix
 * ```typescript
- * import { rendererRegistry } from '@frontmcp/ui';
- * import { reactRenderer } from '@frontmcp/ui';
- * import { mdxRenderer } from '@frontmcp/ui';
+ * import { rendererRegistry } from '@frontmcp/uipack';
+ * import { reactRenderer } from '@frontmcp/ui';
+ * import { mdxRenderer } from '@frontmcp/ui';
 *
 * rendererRegistry.register(reactRenderer);
 * rendererRegistry.register(mdxRenderer);
 * ```

Note: reactRenderer and mdxRenderer may still come from @frontmcp/ui if they contain React dependencies.

libs/uipack/src/bridge-runtime/iife-generator.ts-333-347 (1)

333-347: Security: Origin trust-on-first-message pattern has inherent risks.

When trustedOrigins is empty, the code trusts the first message's origin unconditionally (lines 339-343). While documented, this trust-on-first-message pattern can be vulnerable in scenarios where an attacker's iframe loads before the legitimate parent sends a message.

Consider documenting this limitation more prominently or requiring explicit trustedOrigins configuration for production use.

libs/uipack/src/bridge-runtime/iife-generator.ts-937-945 (1)

937-945: Regex-based minification may break code in edge cases and should not be used for production.

Naive minification tools can break code by interfering with string literals and regular expressions. This function's regex patterns are particularly risky:

  • /\s+/g collapses all whitespace, including inside string literals like "hello world""helloworld"
  • /\s*([{};,:()[\]])\s*/g removes spaces around punctuation indiscriminately, breaking strings like "a" + " " + "b"
  • Template literals with intentional whitespace are corrupted

For production, consider AST-based tools like terser or esbuild. If this function must be used, document that it only handles generated code with predictable content, not arbitrary JavaScript.

libs/uipack/src/runtime/index.d.ts-1-8 (1)

1-8: Inconsistent @module tag with package location.

The @module JSDoc tag references @frontmcp/ui/runtime, but this file is located in libs/uipack. For the package split, this should likely be @frontmcp/uipack/runtime to match the actual package structure.

🔎 Proposed fix
 /**
  * MCP Bridge Runtime Module
  *
  * Provides the infrastructure for rendering tool UI templates
  * that work across multiple host environments (OpenAI, Claude, ext-apps).
  *
- * @module @frontmcp/ui/runtime
+ * @module @frontmcp/uipack/runtime
  */
libs/uipack/src/runtime/wrapper.d.ts-308-320 (1)

308-320: Align csp property across shell widget options interfaces.

WrapLeanWidgetShellOptions lacks csp in its uiConfig, while both WrapHybridWidgetShellOptions and WrapStaticWidgetOptions include it. However, neither wrapHybridWidgetShell nor wrapStaticWidgetUniversal implementations actually use the csp property—the implementations only extract widgetAccessible. This suggests the csp declaration in the hybrid and static options is either dead code or an incomplete implementation. Either add csp to WrapLeanWidgetShellOptions for consistency with the hybrid shell, or remove it from hybrid and static if it's not needed.

🧹 Nitpick comments (26)
libs/uipack/project.json (1)

22-40: Consider extracting shared entry points to reduce duplication.

The additionalEntryPoints array is duplicated between build-cjs and build-esm targets. While JSON doesn't support variables, you could consider migrating to a project.ts configuration or accepting this duplication for transparency. If staying with JSON, just be mindful to update both arrays when adding new entry points.

Also applies to: 61-79

libs/ui/src/renderers/react.renderer.ts (2)

206-216: Use escapeHtml() utility instead of manual HTML escaping.

The manual HTML attribute escaping should be replaced with the escapeHtml() utility function to ensure consistent XSS prevention across the codebase.

Based on coding guidelines: libs/ui/src/**/*.ts should always use escapeHtml() utility for all user-provided content.

🔎 Proposed refactor using escapeHtml utility

First, import the utility at the top of the file:

 import {
   isReactComponent,
   containsJsx,
   hashString,
   transpileJsx,
   executeTranspiledCode,
   transpileCache,
+  escapeHtml,
 } from '@frontmcp/uipack/renderers';

Then replace the manual escaping:

     // If hydration is enabled, wrap with hydration markers
     if (options?.hydrate) {
       const componentName = (Component as { name?: string }).name || 'Component';
-      // Full HTML attribute escaping to prevent XSS
-      const escapedProps = JSON.stringify(props)
-        .replace(/&/g, '&amp;')
-        .replace(/'/g, '&#39;')
-        .replace(/</g, '&lt;')
-        .replace(/>/g, '&gt;');
+      const escapedProps = escapeHtml(JSON.stringify(props));
       return `<div data-hydrate="${componentName}" data-props='${escapedProps}'>${html}</div>`;
     }

208-215: Consider escaping the componentName in HTML attribute.

While componentName is derived from the function's name property rather than direct user input, it's being used in an HTML attribute (data-hydrate) without escaping. For defense-in-depth, consider escaping it as well.

🔎 Proposed enhancement
     // If hydration is enabled, wrap with hydration markers
     if (options?.hydrate) {
       const componentName = (Component as { name?: string }).name || 'Component';
       const escapedProps = escapeHtml(JSON.stringify(props));
-      return `<div data-hydrate="${componentName}" data-props='${escapedProps}'>${html}</div>`;
+      return `<div data-hydrate="${escapeHtml(componentName)}" data-props='${escapedProps}'>${html}</div>`;
     }
libs/uipack/src/runtime/renderer-runtime.d.ts (1)

49-123: Consider clarifying lifecycle and error handling in documentation.

The class API is well-structured with a clear lifecycle pattern. However, consider enhancing the JSDoc to clarify:

  1. Can init() be called multiple times? Is it idempotent?
  2. What happens if render() is called before init()?
  3. What errors might be thrown by each method?
  4. Can render() be called multiple times with different targets?

These clarifications would help consumers use the API correctly and handle errors appropriately.

libs/uipack/src/adapters/response-builder.ts (1)

15-15: Barrel import refactor improves module organization.

The import has been refactored from a direct file path (../utils/safe-stringify) to a barrel export (../utils). This is good practice for maintaining a cleaner public API surface within the package.

As per coding guidelines: Export public API through barrel files.

Quick verification of the barrel export:

#!/bin/bash
# Verify ../utils barrel exports safeStringify

echo "=== Checking libs/uipack/src/utils/index.ts ==="
if [ -f "libs/uipack/src/utils/index.ts" ]; then
  rg -n "export.*safeStringify" libs/uipack/src/utils/index.ts
else
  echo "No index.ts found, checking for index.d.ts"
  fd -t f "index\.(ts|d\.ts)" libs/uipack/src/utils/
fi
libs/uipack/src/dependency/import-parser.d.ts (1)

1-14: Consider AST-based parsing for more reliable import detection.

The documented limitations of regex-based parsing (lines 8-11) pose risks for production use:

  • False negatives could miss critical dependencies
  • False positives could bloat bundles unnecessarily
  • Comments and strings can cause incorrect matches

Modern AST parsers like @babel/parser, TypeScript's compiler API, or acorn would provide accurate, reliable import detection without these limitations.

Rationale for AST-based approach

AST-based parsing:

  • Correctly handles imports in comments/strings
  • Supports multi-line and complex import formats
  • Handles template literal imports
  • Provides precise location information
  • Is the industry standard for production tooling

While regex parsing may be faster, the reliability trade-off for a bundler/dependency resolution system is significant.

libs/uipack/src/bundler/cache.ts (1)

292-302: Consider stronger hash for production use.

FNV-1a is fast and adequate for small-to-medium cache sizes, but has higher collision rates compared to modern algorithms like xxHash or Node's built-in crypto hashes. For a production bundler cache with potentially thousands of entries, collisions could lead to incorrect cache hits.

Alternative: Use Node.js built-in crypto

For better collision resistance with minimal performance impact:

import { createHash } from 'crypto';

export function hashContent(content: string): string {
  return createHash('sha256')
    .update(content)
    .digest('hex')
    .slice(0, 16); // Use first 16 chars for reasonable key length
}

This provides cryptographic-strength hashing at acceptable speed for cache key generation.

libs/uipack/src/bundler/types.ts (1)

543-627: Consider security implications of SharedArrayBuffer in allowed globals.

SharedArrayBuffer at line 623 can be used for timing attacks (Spectre) in browser contexts. While this may be intentional for legitimate use cases, consider documenting why it's included or making it opt-in depending on your threat model.

libs/uipack/src/bundler/sandbox/enclave-adapter.ts (1)

371-380: Verify intentional exposure of __filename and __dirname in wrapped code.

Lines 376-377 define __filename and __dirname as local constants inside the wrapped code, but these identifiers are listed in DANGEROUS_GLOBAL_KEYS. While they're safe here (hardcoded dummy values, not user-controlled), this could be confusing if the security model is later audited. Consider adding a comment explaining this is intentional for CommonJS compatibility.

libs/ui/src/bridge/types.d.ts (1)

356-393: Consider API surface consistency between FrontMcpBridgeInterface and PlatformAdapter.

FrontMcpBridgeInterface exposes a subset of PlatformAdapter methods. Notably missing: getUserAgent, getLocale, getSafeArea, getViewport, getHostContext, getStructuredContent, getWidgetState, requestClose. If intentional (minimal public API), this is fine; otherwise, consider exposing commonly-needed methods like getHostContext() for full context access.

libs/uipack/src/bundler/__tests__/cache.test.ts (1)

35-45: Suggest adding constructor validation tests.

The test suite is comprehensive, but consider adding tests for constructor validation to ensure robust error handling:

  1. Invalid options validation (negative maxSize, negative TTL)
  2. Boundary conditions (maxSize=0, ttl=0)
  3. Type safety for options (non-numeric values)
🔎 Proposed additional test cases
describe('Constructor Validation', () => {
  it('should handle maxSize=0', () => {
    const cache = new BundlerCache({ maxSize: 0, ttl: 5000 });
    cache.set('key1', createMockResult());
    // Should either reject or handle gracefully
    expect(cache.size).toBeLessThanOrEqual(0);
  });

  it('should handle ttl=0', () => {
    const cache = new BundlerCache({ maxSize: 10, ttl: 0 });
    cache.set('key1', createMockResult());
    // Entries should expire immediately
    expect(cache.get('key1')).toBeUndefined();
  });

  it('should handle negative maxSize gracefully', () => {
    // Verify behavior or throw appropriate error
    expect(() => new BundlerCache({ maxSize: -1, ttl: 5000 })).toThrow();
  });

  it('should handle negative ttl gracefully', () => {
    // Verify behavior or throw appropriate error
    expect(() => new BundlerCache({ maxSize: 10, ttl: -1 })).toThrow();
  });
});
libs/uipack/src/bundler/file-cache/storage/redis.ts (1)

299-312: Consider batching or sampling for large caches.

The size recalculation iterates all keys sequentially, which could be slow for large caches. Consider adding a threshold to skip full recalculation or using SCAN with a pipeline for batch fetching if performance becomes an issue in production.

libs/uipack/src/renderers/html.renderer.d.ts (1)

17-21: Consider exporting HtmlTemplate type for external consumers.

The HtmlTemplate type is used in the public render method signature (line 100-104) but is not exported. Consumers may need this type to properly type their templates when using HtmlRenderer. Similarly, TemplateBuilderFn could be useful for consumers building template functions.

🔎 Suggested export
-type TemplateBuilderFn<In, Out> = (ctx: TemplateContext<In, Out>) => string;
+export type TemplateBuilderFn<In, Out> = (ctx: TemplateContext<In, Out>) => string;
 /**
  * Types this renderer can handle.
  */
-type HtmlTemplate<In = unknown, Out = unknown> = string | TemplateBuilderFn<In, Out>;
+export type HtmlTemplate<In = unknown, Out = unknown> = string | TemplateBuilderFn<In, Out>;
libs/uipack/src/bundler/file-cache/hash-calculator.ts (1)

330-349: Consider using async file existence checks for better I/O performance.

resolveImportPath uses multiple synchronous existsSync calls in a loop. In a function called from an async context (collectLocalDependencies), consider using fs/promises for non-blocking I/O, especially when resolving many imports.

🔎 Suggested async alternative
+import { access } from 'fs/promises';
+import { constants } from 'fs';
+
+async function fileExists(path: string): Promise<boolean> {
+  try {
+    await access(path, constants.F_OK);
+    return true;
+  } catch {
+    return false;
+  }
+}
+
 /**
  * Resolve an import path to an absolute file path.
  */
-function resolveImportPath(importPath: string, fromDir: string): string | undefined {
+async function resolveImportPath(importPath: string, fromDir: string): Promise<string | undefined> {
   const extensions = ['', '.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'];
 
   for (const ext of extensions) {
     const fullPath = join(fromDir, importPath + ext);
-    if (existsSync(fullPath)) {
+    if (await fileExists(fullPath)) {
       return fullPath;
     }
   }
   // ... similar for index files
libs/uipack/src/bundler/file-cache/storage/interface.ts (1)

181-189: Consider logging when size calculation fails.

The fallback to 0 for circular references or BigInt values is reasonable, but silently returning 0 could mask issues or lead to incorrect size tracking for cache eviction. Consider adding a console warning in development mode.

🔎 Suggested improvement
 export function calculateManifestSize(manifest: ComponentBuildManifest): number {
   // Approximate size by serializing to JSON
   try {
     return Buffer.byteLength(JSON.stringify(manifest), 'utf8');
   } catch {
     // Fallback for circular references or BigInt values
+    if (process.env.NODE_ENV !== 'production') {
+      console.warn('[file-cache] Could not calculate manifest size, falling back to 0');
+    }
     return 0;
   }
 }
libs/uipack/src/runtime/types.d.ts (3)

72-72: Consider more specific typing for React components.

The (props: any) => any type for React components is very permissive. While React component typing can be complex, consider a more specific type to improve type safety.

Potential alternative
- export type ToolUITemplate<In = unknown, Out = unknown> = TemplateBuilderFn<In, Out> | string | ((props: any) => any);
+ export type ToolUITemplate<In = unknown, Out = unknown> = TemplateBuilderFn<In, Out> | string | ((props: Record<string, unknown>) => unknown);

Note: If this needs to accept actual React components, you may need to import React types or use a more permissive type. The current approach may be acceptable given the React/MDX integration requirements.


146-146: Record<string, any> for MDX components.

Similar to the ToolUITemplate type, this uses any for MDX component values. This is a pragmatic choice given MDX's dynamic nature, but worth noting for future type safety improvements if the React/MDX integration stabilizes.


162-162: Redundant type alias.

UICSPType is an alias for UIContentSecurityPolicy but is only used once (line 281). Consider using UIContentSecurityPolicy directly for clarity.

Suggested simplification
- type UICSPType = UIContentSecurityPolicy;

And on line 281:

-   csp?: UICSPType;
+   csp?: UIContentSecurityPolicy;
libs/uipack/src/bundler/file-cache/storage/filesystem.ts (2)

187-191: Consider logging cache read failures in debug mode.

The empty catch block silently swallows all errors. While returning undefined on cache miss is correct behavior, logging the error in debug mode (similar to line 179-181) would help diagnose issues.

🔎 Suggested improvement
-    } catch {
+    } catch (err) {
+      if (process.env['DEBUG']) {
+        console.debug(`[FilesystemStorage] Failed to read cache entry ${key}: ${err}`);
+      }
       this.stats.misses++;
       this.updateHitRate();
       return undefined;
     }

456-465: Minor stats inconsistency when removing corrupted files.

When a corrupted file is removed, stats.entries is decremented but stats.totalSize remains unchanged since the file's size is unknown. This can cause totalSize to gradually overestimate actual usage.

This is acceptable for an edge case, but you might consider resetting stats via loadStats() after removing corrupted files if accuracy becomes important.

libs/uipack/src/bridge-runtime/iife-generator.ts (1)

348-367: Verify timeout behavior for long-running tool calls.

The 10-second timeout (line 361) may be too short for complex server-side tool operations. Consider making this configurable through IIFEGeneratorOptions.

🔎 Proposed enhancement

Add timeout configuration to options:

 export interface IIFEGeneratorOptions {
   /** Include specific adapters (all if not specified) */
   adapters?: ('openai' | 'ext-apps' | 'claude' | 'gemini' | 'generic')[];
   /** Enable debug logging */
   debug?: boolean;
   /** Trusted origins for ext-apps adapter */
   trustedOrigins?: string[];
   /** Minify the output */
   minify?: boolean;
+  /** Request timeout in milliseconds for ext-apps adapter */
+  requestTimeout?: number;
 }
libs/uipack/src/bundler/file-cache/component-builder.ts (1)

231-235: Silent warning on dependency resolution failure may hide issues.

When external dependency resolution fails, the code logs a warning but continues. This could lead to runtime errors if the bundled code expects the external to be available. Consider making this behavior configurable.

🔎 Proposed enhancement
 export interface ComponentBuildOptions {
   // ... existing options
+  /**
+   * How to handle external resolution failures.
+   * - 'warn': Log warning and bundle the dependency (default)
+   * - 'error': Throw an error
+   * @default 'warn'
+   */
+  onExternalResolutionFailure?: 'warn' | 'error';
 }
libs/uipack/src/renderers/types.d.ts (1)

319-321: Consider using unknown instead of any for MDX component props.

Per coding guidelines, any types require strong justification. While the ReactComponentType has documented justification (avoiding React types), mdxComponents uses any without similar reasoning. Consider using unknown for stricter typing.

🔎 Proposed refinement
   * }
   * ```
   */
-  mdxComponents?: Record<string, (props: any) => any>;
+  mdxComponents?: Record<string, (props: unknown) => unknown>;

Note: If any is intentional here for React/JSX compatibility similar to ReactComponentType, adding a brief comment explaining this would satisfy the coding guidelines requirement for justification.

libs/uipack/src/dependency/types.d.ts (1)

659-708: Consider using unknown instead of importing ZodTypeAny for schema fields.

The outputSchema and inputSchema fields use ZodTypeAny which is a Zod-specific type. While this is technically correct, it creates a tight coupling to Zod's internal types. Per coding guidelines, consider whether unknown would be more appropriate for the public API surface, or document explicitly that Zod schemas are required.

libs/uipack/src/index.ts (2)

35-39: Consider explicit named exports instead of export * for better API control.

Using export * from './types' re-exports everything from the types module, which could inadvertently expose internal types. Per learnings, barrel files should "export users' needed items, no legacy exports with different names." Consider explicit named exports for tighter API control.

Example of more controlled exports
// Instead of:
export * from './types';

// Consider explicit exports:
export type {
  UITemplateConfig,
  TemplateContext,
  // ... other public types
} from './types';

146-156: Consider explicit named exports for tool-template, base-template, and renderers modules.

Using export * for these modules may expose internal implementation details. Based on learnings about barrel file best practices, explicit named exports provide better API surface control.

Recommendation

Review the exports from ./tool-template, ./base-template, and ./renderers to determine which are public API vs internal implementation, then use explicit named exports for public items only.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

♻️ Duplicate comments (3)
libs/uipack/src/bridge-runtime/iife-generator.ts (1)

333-347: Security concern: Trust-on-first-use pattern tracked.

This trust-on-first-use pattern for ext-apps origin validation was previously flagged in past reviews. While the code includes a security warning comment (lines 337-339), the underlying security concern remains: a malicious iframe could establish trust by sending the first message.

This is a duplicate of the existing security concern from past reviews.

docs/draft/docs/ui/api-reference/runtime.mdx (1)

159-159: Invalid import path @frontmcp/uipack/components used throughout the file.

This issue was already flagged in a previous review. All 15 import statements in this file use the non-existent @frontmcp/uipack/components subpath. Per the prior verification, these should be changed to @frontmcp/uipack/runtime.

Also applies to: 288-288, 299-299, 311-311, 329-329, 363-363, 392-392, 405-405, 418-418, 429-429, 444-444, 467-467, 477-477, 495-495, 511-511

libs/uipack/src/bundler/file-cache/component-builder.ts (1)

460-465: Security: new Function() code execution risk (already flagged).

This security concern was identified in a previous review. The default use of new Function() at line 463 is equivalent to eval() and can execute arbitrary code. While the comment at lines 456-459 warns about this, the insecure default remains.

The previous review suggested either requiring executeCode or using a safe sandbox (Node.js vm module). This issue should be addressed before merging.

🧹 Nitpick comments (6)
libs/uipack/src/bridge-runtime/iife-generator.ts (2)

938-946: Consider using a proper JavaScript minifier.

The current minifyJS function is very basic—it only removes comments and collapses whitespace using regex. This approach can be error-prone and doesn't provide the optimization benefits of proper minification (dead code elimination, identifier shortening, etc.).

Consider using a production-grade minifier like terser or esbuild for the minify: true option:

🔎 Recommended refactor using terser
+import { minify as terserMinify } from 'terser';
+
 function minifyJS(code: string): string {
+  // For production, use a proper minifier
+  if (process.env.NODE_ENV === 'production') {
+    const result = await terserMinify(code, {
+      compress: true,
+      mangle: true,
+    });
+    return result.code || code;
+  }
+  
+  // Fallback to basic minification for development
   return code
     .replace(/\/\*[\s\S]*?\*\//g, '')
     .replace(/\/\/.*$/gm, '')
     .replace(/\s+/g, ' ')
     .replace(/\s*([{};,:()[\]])\s*/g, '$1')
     .replace(/;\}/g, '}')
     .trim();
 }

863-868: Improve error recovery in button reset.

The button state reset logic in the data-tool-call handler could fail if the button element is removed from the DOM during the async operation, leaving the UI in an inconsistent state.

🔎 Proposed enhancement for error recovery
         // Helper to reset button state
         function resetButton() {
+          // Check if element is still in DOM before resetting
+          if (!document.body.contains(target)) {
+            return;
+          }
           target.innerHTML = originalContent;
           target.disabled = originalDisabled;
           target.classList.remove('opacity-50', 'cursor-not-allowed');
         }
libs/uipack/src/bundler/file-cache/storage/filesystem.ts (2)

432-478: Consider optimizing LRU eviction to avoid O(n) file reads.

The current implementation reads every cache file to find the least recently used entry. With many cached builds, this becomes a performance bottleneck.

Consider maintaining an in-memory index of { key, lastAccessedAt, size, filePath } that is:

  1. Loaded during initialize() by scanning the directory once
  2. Updated on each get(), set(), and delete() operation
  3. Persisted periodically or on close()

This reduces eviction from O(n) file I/O to O(n) memory scan, and with a min-heap or sorted structure, can be O(log n).

Alternatively, if keeping the simple approach, document the performance characteristics in the class-level JSDoc.


111-487: Document concurrency limitations for multi-process environments.

The filesystem storage lacks file locking, so concurrent processes can create race conditions:

  • Two processes may simultaneously evict different entries, leading to incorrect stats
  • Concurrent writes to the same key may result in partial writes or corruption
  • Stats tracking can drift when multiple processes modify the cache

For production use with multiple processes, consider:

  1. Using Redis storage (RedisStorage) which has atomic operations
  2. Implementing file locking (e.g., using lockfile or proper-lockfile packages)
  3. Restricting filesystem cache to single-process development environments (document this limitation)
  4. Using process-level cache coordination (e.g., through a primary process that manages cache)

Add a note in the class JSDoc about the single-process limitation.

libs/uipack/src/bundler/file-cache/component-builder.ts (2)

274-277: Document caching behavior when SSR fails.

If SSR is requested (ssr: true) but fails (line 479-481 returns undefined), the manifest at line 302 is still cached with ssrHtml: undefined. This means:

  1. Subsequent cache hits will serve a manifest without SSR output
  2. Users expecting SSR won't get it without clearing the cache

Consider either:

  • Not caching when SSR fails (check ssrHtml before caching)
  • Including SSR status in the cache key/hash
  • Documenting this behavior clearly
🔎 Proposed enhancement to handle SSR failures
     // Optionally perform SSR
     let ssrHtml: string | undefined;
     if (ssr) {
       ssrHtml = await this.renderSSR(bundleResult.code, ssrContext, resolvedDeps, executeCode);
+      
+      // If SSR was requested but failed, consider it a build failure
+      if (!ssrHtml) {
+        console.warn(`SSR requested for ${toolName} but failed - not caching this build`);
+        // Return the manifest without caching
+        return {
+          manifest: {
+            version: '1.0',
+            buildId: randomUUID(),
+            toolName,
+            entryPath: absoluteEntryPath,
+            contentHash: hashResult.hash,
+            dependencies: resolvedDeps,
+            outputs: { code: bundleResult.code, sourceMap: bundleResult.map, ssrHtml },
+            importMap,
+            metadata: {
+              createdAt: new Date().toISOString(),
+              buildTimeMs: performance.now() - startTime,
+              totalSize: Buffer.byteLength(bundleResult.code, 'utf8'),
+              bundlerVersion: bundleResult.bundlerVersion,
+            },
+          },
+          cached: false,
+          buildTimeMs: performance.now() - startTime,
+        };
+      }
     }

Alternatively, document the current behavior in the ComponentBuildOptions.ssr JSDoc.

Also applies to: 302-302


15-22: Consider using package imports instead of relative paths for consistency.

The imports use relative paths (../../dependency/types) rather than the @frontmcp/uipack/dependency namespace mentioned in the AI summary. While relative imports work, using package imports would be more consistent with the stated goal of splitting packages.

If the package structure is already set up with exports, consider:

-import type {
-  ComponentBuildManifest,
-  FileBundleOptions,
-  CDNDependency,
-  CDNPlatformType,
-  ResolvedDependency,
-  ImportMap,
-} from '../../dependency/types';
+import type {
+  ComponentBuildManifest,
+  FileBundleOptions,
+  CDNDependency,
+  CDNPlatformType,
+  ResolvedDependency,
+  ImportMap,
+} from '@frontmcp/uipack/dependency';

This aligns with the package split objective and makes imports more stable if internal structure changes.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f7f3d0 and 65aec0c.

📒 Files selected for processing (23)
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/servers/tools.mdx
  • docs/draft/docs/ui/advanced/platforms.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
  • libs/sdk/src/tool/ui/ui-resource.handler.ts
  • libs/uipack/src/bridge-runtime/iife-generator.ts
  • libs/uipack/src/bundler/cache.ts
  • libs/uipack/src/bundler/file-cache/component-builder.ts
  • libs/uipack/src/bundler/file-cache/storage/filesystem.ts
  • libs/uipack/src/dependency/import-map.ts
  • libs/uipack/src/renderers/index.d.ts
  • libs/uipack/src/renderers/index.ts
  • libs/uipack/src/renderers/registry.d.ts
  • libs/uipack/src/renderers/registry.test.ts
  • libs/uipack/src/renderers/registry.ts
  • libs/uipack/src/runtime/index.d.ts
  • libs/uipack/src/runtime/index.ts
  • libs/uipack/src/runtime/mcp-bridge.d.ts
  • libs/uipack/src/runtime/mcp-bridge.ts
  • libs/uipack/src/theme/cdn.ts
  • libs/uipack/src/theme/presets/github-openai.ts
  • libs/uipack/src/theme/presets/index.ts
  • libs/uipack/src/theme/theme.ts
✅ Files skipped from review due to trivial changes (2)
  • libs/uipack/src/theme/presets/index.ts
  • libs/uipack/src/theme/presets/github-openai.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • libs/sdk/src/tool/ui/ui-resource.handler.ts
  • docs/draft/docs/guides/ui-library.mdx
  • libs/uipack/src/renderers/index.ts
  • libs/uipack/src/runtime/mcp-bridge.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.ts: Use strict TypeScript mode with no any types without strong justification - use unknown instead 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/theme/theme.ts
  • libs/uipack/src/theme/cdn.ts
  • libs/uipack/src/runtime/index.ts
  • libs/uipack/src/bundler/cache.ts
  • libs/uipack/src/dependency/import-map.ts
  • libs/uipack/src/bridge-runtime/iife-generator.ts
  • libs/uipack/src/renderers/registry.ts
  • libs/uipack/src/renderers/registry.d.ts
  • libs/uipack/src/renderers/registry.test.ts
  • libs/uipack/src/bundler/file-cache/component-builder.ts
  • libs/uipack/src/runtime/mcp-bridge.d.ts
  • libs/uipack/src/runtime/index.d.ts
  • libs/uipack/src/bundler/file-cache/storage/filesystem.ts
  • libs/uipack/src/renderers/index.d.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/theme/theme.ts
  • libs/uipack/src/theme/cdn.ts
  • libs/uipack/src/runtime/index.ts
  • libs/uipack/src/bundler/cache.ts
  • libs/uipack/src/dependency/import-map.ts
  • libs/uipack/src/bridge-runtime/iife-generator.ts
  • libs/uipack/src/renderers/registry.ts
  • libs/uipack/src/renderers/registry.d.ts
  • libs/uipack/src/renderers/registry.test.ts
  • libs/uipack/src/bundler/file-cache/component-builder.ts
  • libs/uipack/src/runtime/mcp-bridge.d.ts
  • libs/uipack/src/runtime/index.d.ts
  • libs/uipack/src/bundler/file-cache/storage/filesystem.ts
  • libs/uipack/src/renderers/index.d.ts
docs/draft/docs/**

⚙️ CodeRabbit configuration file

docs/draft/docs/**: This folder holds the draft/source docs that humans are expected to edit. When authors want to add or change documentation, they should do it here. The Codex workflow uses these drafts, together with the code diff, to generate the latest docs under docs/docs/. As a reviewer: - Encourage contributors to add/update content here instead of docs/docs/. - It is fine to do structural/content feedback here (clarity, examples, etc).

Files:

  • docs/draft/docs/ui/advanced/platforms.mdx
  • docs/draft/docs/servers/tools.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
docs/**

⚙️ CodeRabbit configuration file

docs/**: Repository documentation for the SDK, using MDX and hosted by Mintlify. See more specific rules for: - docs/docs/** (latest rendered docs, automation-only) - docs/v/** (archived versions, read-only) - docs/draft/docs/** (human-editable drafts) - docs/blogs/** (blogs, human edited) - docs/docs.json (Mintlify navigation)

Files:

  • docs/draft/docs/ui/advanced/platforms.mdx
  • docs/draft/docs/servers/tools.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.test.{ts,tsx}: Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Test all code paths including error cases and constructor validation
Include error class instanceof checks in tests to validate error handling

Files:

  • libs/uipack/src/renderers/registry.test.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/*/package.json : Each library in /libs/* is independent and publishable under frontmcp/* scope
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
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.ts : Hard-code CDN URLs only in theme presets; always reference theme.cdn configuration in component code

Applied to files:

  • libs/uipack/src/theme/theme.ts
  • libs/uipack/src/theme/cdn.ts
  • docs/draft/docs/ui/advanced/platforms.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/theme/presets/**/*.ts : Implement GitHub/OpenAI gray-black monochromatic palette as the default theme

Applied to files:

  • libs/uipack/src/theme/theme.ts
  • docs/draft/docs/ui/advanced/platforms.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Add JSDoc examples with example tags showing basic usage and options patterns for all components

Applied to files:

  • libs/uipack/src/theme/cdn.ts
  • docs/draft/docs/servers/tools.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 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/runtime/index.ts
  • libs/uipack/src/bundler/cache.ts
  • libs/uipack/src/bridge-runtime/iife-generator.ts
  • libs/uipack/src/bundler/file-cache/component-builder.ts
  • libs/uipack/src/runtime/index.d.ts
  • docs/draft/docs/ui/api-reference/runtime.mdx
  • libs/uipack/src/renderers/index.d.ts
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.test.ts : Test behavior across platform configurations (OpenAI, Claude, Gemini, ngrok) where applicable

Applied to files:

  • docs/draft/docs/ui/advanced/platforms.mdx
  • libs/uipack/src/bridge-runtime/iife-generator.ts
  • libs/uipack/src/renderers/registry.test.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:

  • docs/draft/docs/ui/advanced/platforms.mdx
  • docs/draft/docs/servers/tools.mdx
  • libs/uipack/src/runtime/mcp-bridge.d.ts
  • libs/uipack/src/runtime/index.d.ts
  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Support platform-aware rendering by detecting network capabilities (open vs blocked) and script loading strategies (external vs inline)

Applied to files:

  • docs/draft/docs/ui/advanced/platforms.mdx
📚 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:

  • docs/draft/docs/ui/advanced/platforms.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.test.ts : Write validation tests covering invalid variant/options, unknown properties, and valid option acceptance

Applied to files:

  • docs/draft/docs/ui/advanced/platforms.mdx
  • libs/uipack/src/renderers/registry.test.ts
  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.ts : Always use `escapeHtml()` utility for all user-provided content to prevent XSS vulnerabilities

Applied to files:

  • libs/uipack/src/dependency/import-map.ts
  • libs/uipack/src/bundler/file-cache/component-builder.ts
  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.test.ts : Test HTML escaping for user-provided content to prevent XSS attacks

Applied to files:

  • libs/uipack/src/dependency/import-map.ts
  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/** : Organize components into schema.ts (definitions) and implementation .ts files with matching names

Applied to files:

  • libs/uipack/src/bundler/file-cache/component-builder.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/uipack/src/runtime/mcp-bridge.d.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/uipack/src/runtime/mcp-bridge.d.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/uipack/src/runtime/index.d.ts
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Use pure HTML string generation without React/Vue/JSX - components return HTML strings only

Applied to files:

  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Validate component options using `validateOptions()` helper and return error box on validation failure

Applied to files:

  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 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:

  • docs/draft/docs/ui/api-reference/runtime.mdx
🧬 Code graph analysis (2)
libs/uipack/src/renderers/registry.test.ts (2)
libs/uipack/src/runtime/index.d.ts (1)
  • TemplateContext (21-21)
libs/uipack/src/runtime/index.ts (1)
  • TemplateContext (24-24)
libs/uipack/src/runtime/mcp-bridge.d.ts (3)
libs/uipack/src/runtime/index.d.ts (5)
  • MCP_BRIDGE_RUNTIME (28-28)
  • getMCPBridgeScript (28-28)
  • isMCPBridgeSupported (28-28)
  • FRONTMCP_BRIDGE_RUNTIME (30-30)
  • PLATFORM_BRIDGE_SCRIPTS (31-31)
libs/uipack/src/runtime/index.ts (5)
  • MCP_BRIDGE_RUNTIME (33-33)
  • getMCPBridgeScript (33-33)
  • isMCPBridgeSupported (33-33)
  • FRONTMCP_BRIDGE_RUNTIME (37-37)
  • PLATFORM_BRIDGE_SCRIPTS (38-38)
libs/uipack/src/runtime/mcp-bridge.ts (5)
  • MCP_BRIDGE_RUNTIME (46-508)
  • getMCPBridgeScript (514-518)
  • isMCPBridgeSupported (523-534)
  • FRONTMCP_BRIDGE_RUNTIME (550-550)
  • PLATFORM_BRIDGE_SCRIPTS (568-568)
⏰ 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 (21)
libs/uipack/src/bundler/cache.ts (8)

1-27: LGTM!

The module documentation and CacheOptions interface are well-defined with clear JSDoc comments documenting the default values.


29-62: LGTM!

The CacheStats interface is comprehensive with clear documentation for each property.


90-104: LGTM!

The class initialization is clean with sensible defaults using nullish coalescing.


112-138: LGTM!

The get method correctly implements LRU behavior by re-inserting entries to move them to the MRU position, and properly handles TTL expiration.


146-161: LGTM!

The set method correctly enforces capacity limits before insertion. Using a while loop is defensive and handles edge cases where maxSize might be reduced after cache population.


234-246: Verify safety of deleting from Map during iteration.

The code deletes entries from the Map while iterating over it. While this is technically safe in JavaScript (Map iterators handle concurrent deletion), it's worth noting this relies on that behavior.


284-302: LGTM!

Correct FNV-1a hash implementation with proper 32-bit handling using Math.imul and unsigned conversion.


313-335: Fix applied correctly.

The array mutation issue from the previous review has been addressed. Line 329 now uses .slice().sort() to create a copy before sorting, preventing mutation of the caller's array.

libs/uipack/src/renderers/registry.test.ts (1)

217-217: LGTM: Good type safety improvement.

The change from {} to object as default type parameters is a TypeScript best practice—object correctly represents non-primitive types, whereas {} can misleadingly accept primitives.

Also applies to: 257-257

docs/draft/docs/ui/advanced/platforms.mdx (1)

26-26: LGTM! Import path migration is consistent.

All platform-related imports have been correctly updated from @frontmcp/ui to @frontmcp/uipack/components, which aligns with the PR objective to separate React-free utilities into the @frontmcp/uipack package.

Also applies to: 57-57, 169-169, 192-192, 213-213, 244-244, 271-271, 290-290

docs/draft/docs/servers/tools.mdx (1)

768-820: LGTM! Documentation correctly updated for package split.

The documentation changes accurately reflect the migration from @frontmcp/ui to @frontmcp/uipack for HTML components. The import path @frontmcp/uipack/components is correct for the new package structure.

libs/uipack/src/runtime/mcp-bridge.d.ts (1)

1-102: Type declarations are well-structured.

The TypeScript declarations provide a comprehensive API surface for the MCP Bridge runtime. Note that a security concern regarding trust-on-first-use origin validation was previously flagged in the implementation (see past review comments on lines 42-43 of the runtime implementation). This declaration file itself is sound.

libs/uipack/src/theme/cdn.ts (1)

1-456: LGTM! Documentation paths updated correctly.

The documentation comments have been updated to reflect the new @frontmcp/uipack package path. No functional changes to the CDN configuration logic.

libs/uipack/src/runtime/index.ts (1)

1-117: LGTM! Package split correctly implemented.

The removal of React-specific exports (ReactRendererAdapter, createReactAdapter) from this barrel file correctly establishes the package boundary between @frontmcp/uipack (HTML/MDX components and build tools) and @frontmcp/ui (React components). The helpful comment on line 103 documents this split for future maintainers.

libs/uipack/src/renderers/index.d.ts (1)

1-65: LGTM! Well-structured renderer API surface.

This barrel file provides a clean, consolidated API surface for the renderer system with comprehensive documentation. The examples clearly show how to register the React renderer from the separate @frontmcp/ui package (lines 19-28), which aligns with the package split strategy.

libs/uipack/src/renderers/registry.d.ts (1)

1-145: LGTM! Solid registry API design.

The RendererRegistry class provides a well-designed API for managing multiple renderer types with priority-based auto-detection. Key strengths:

  • Clear separation of concerns (register, detect, render)
  • Type-safe render methods with generic parameters
  • Comprehensive statistics via getStats()
  • Good documentation with usage examples (lines 136-142)
libs/uipack/src/runtime/index.d.ts (1)

1-100: LGTM! Comprehensive runtime API barrel.

This declaration file provides a well-organized, single entry point for the entire @frontmcp/uipack/runtime API. The logical grouping of exports (types, bridge runtime, CSP, wrappers, sanitization, renderer runtime, adapters) makes it easy to understand the module's capabilities. The intentional omission of React adapters correctly maintains the package boundary.

docs/draft/docs/ui/api-reference/runtime.mdx (1)

5-5: LGTM!

The description update correctly reflects the package split to @frontmcp/uipack.

libs/uipack/src/renderers/registry.ts (1)

274-274: No actionable issues found. The documentation example at line 274 correctly reflects the updated import paths after the package split. Both mdxRenderer and the imports are properly exported through the configured package.json exports field, and the subpath pattern supports accessing @frontmcp/uipack/renderers as documented.

libs/uipack/src/dependency/import-map.ts (1)

155-156: LGTM: XSS mitigation for import map JSON.

The escaping of </ sequences prevents script tag injection attacks. While import map data typically originates from internal dependency resolution rather than direct user input, this defense-in-depth approach is a sound security practice.

Based on learnings, this follows the project's security guidelines for content escaping.

Also applies to: 167-169

libs/uipack/src/bundler/file-cache/component-builder.ts (1)

409-410: jsxImportSource default is already configurable and appropriate for React-focused bundler.

The jsxImportSource parameter is optional in FileBundleOptions and can be configured by users. If a different JSX runtime is needed, callers can specify bundleOptions.jsxImportSource: 'preact' (or another runtime). The default of 'react' is appropriate for this bundler, which is documented as React-specific and requires React for SSR functionality.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65aec0c and 610c8c8.

📒 Files selected for processing (34)
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/servers/tools.mdx
  • docs/draft/docs/ui/advanced/custom-renderers.mdx
  • docs/draft/docs/ui/advanced/hydration.mdx
  • docs/draft/docs/ui/advanced/mcp-bridge.mdx
  • docs/draft/docs/ui/advanced/platforms.mdx
  • docs/draft/docs/ui/api-reference/components.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
  • docs/draft/docs/ui/api-reference/theme.mdx
  • docs/draft/docs/ui/components/alert.mdx
  • docs/draft/docs/ui/components/avatar.mdx
  • docs/draft/docs/ui/components/badge.mdx
  • docs/draft/docs/ui/components/button.mdx
  • docs/draft/docs/ui/components/card.mdx
  • docs/draft/docs/ui/components/form.mdx
  • docs/draft/docs/ui/components/list.mdx
  • docs/draft/docs/ui/components/modal.mdx
  • docs/draft/docs/ui/components/overview.mdx
  • docs/draft/docs/ui/components/resource-widgets.mdx
  • docs/draft/docs/ui/components/table.mdx
  • docs/draft/docs/ui/getting-started.mdx
  • docs/draft/docs/ui/integration/tools.mdx
  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/ui/layouts/overview.mdx
  • docs/draft/docs/ui/layouts/templates.mdx
  • docs/draft/docs/ui/overview.mdx
  • docs/draft/docs/ui/templates/custom.mdx
  • docs/draft/docs/ui/templates/html.mdx
  • docs/draft/docs/ui/templates/mdx.mdx
  • docs/draft/docs/ui/templates/react.mdx
  • docs/draft/docs/ui/theming/customization.mdx
  • docs/draft/docs/ui/theming/dark-mode.mdx
  • docs/draft/docs/ui/theming/overview.mdx
  • libs/uipack/README.md
✅ Files skipped from review due to trivial changes (2)
  • libs/uipack/README.md
  • docs/draft/docs/ui/advanced/mcp-bridge.mdx
🚧 Files skipped from review as they are similar to previous changes (19)
  • docs/draft/docs/ui/components/overview.mdx
  • docs/draft/docs/ui/components/button.mdx
  • docs/draft/docs/servers/tools.mdx
  • docs/draft/docs/ui/components/badge.mdx
  • docs/draft/docs/ui/components/alert.mdx
  • docs/draft/docs/ui/components/list.mdx
  • docs/draft/docs/ui/advanced/custom-renderers.mdx
  • docs/draft/docs/ui/advanced/platforms.mdx
  • docs/draft/docs/ui/theming/dark-mode.mdx
  • docs/draft/docs/ui/integration/tools.mdx
  • docs/draft/docs/ui/layouts/overview.mdx
  • docs/draft/docs/ui/theming/customization.mdx
  • docs/draft/docs/ui/layouts/templates.mdx
  • docs/draft/docs/ui/overview.mdx
  • docs/draft/docs/ui/api-reference/components.mdx
  • docs/draft/docs/ui/components/card.mdx
  • docs/draft/docs/ui/components/table.mdx
  • docs/draft/docs/ui/templates/mdx.mdx
  • docs/draft/docs/ui/components/resource-widgets.mdx
🧰 Additional context used
📓 Path-based instructions (2)
docs/draft/docs/**

⚙️ CodeRabbit configuration file

docs/draft/docs/**: This folder holds the draft/source docs that humans are expected to edit. When authors want to add or change documentation, they should do it here. The Codex workflow uses these drafts, together with the code diff, to generate the latest docs under docs/docs/. As a reviewer: - Encourage contributors to add/update content here instead of docs/docs/. - It is fine to do structural/content feedback here (clarity, examples, etc).

Files:

  • docs/draft/docs/ui/components/avatar.mdx
  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/ui/components/modal.mdx
  • docs/draft/docs/ui/templates/custom.mdx
  • docs/draft/docs/ui/components/form.mdx
  • docs/draft/docs/ui/api-reference/theme.mdx
  • docs/draft/docs/ui/theming/overview.mdx
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
  • docs/draft/docs/ui/getting-started.mdx
  • docs/draft/docs/ui/templates/html.mdx
  • docs/draft/docs/ui/advanced/hydration.mdx
  • docs/draft/docs/ui/templates/react.mdx
docs/**

⚙️ CodeRabbit configuration file

docs/**: Repository documentation for the SDK, using MDX and hosted by Mintlify. See more specific rules for: - docs/docs/** (latest rendered docs, automation-only) - docs/v/** (archived versions, read-only) - docs/draft/docs/** (human-editable drafts) - docs/blogs/** (blogs, human edited) - docs/docs.json (Mintlify navigation)

Files:

  • docs/draft/docs/ui/components/avatar.mdx
  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/ui/components/modal.mdx
  • docs/draft/docs/ui/templates/custom.mdx
  • docs/draft/docs/ui/components/form.mdx
  • docs/draft/docs/ui/api-reference/theme.mdx
  • docs/draft/docs/ui/theming/overview.mdx
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
  • docs/draft/docs/ui/getting-started.mdx
  • docs/draft/docs/ui/templates/html.mdx
  • docs/draft/docs/ui/advanced/hydration.mdx
  • docs/draft/docs/ui/templates/react.mdx
🧠 Learnings (22)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/** : Organize components into schema.ts (definitions) and implementation .ts files with matching names
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
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-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Use pure HTML string generation without React/Vue/JSX - components return HTML strings only
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Add JSDoc examples with example tags showing basic usage and options patterns for all components

Applied to files:

  • docs/draft/docs/ui/components/avatar.mdx
  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/ui/components/modal.mdx
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
  • docs/draft/docs/ui/getting-started.mdx
  • docs/draft/docs/ui/templates/html.mdx
  • docs/draft/docs/ui/templates/react.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.test.ts : Write validation tests covering invalid variant/options, unknown properties, and valid option acceptance

Applied to files:

  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/** : Organize components into schema.ts (definitions) and implementation .ts files with matching names

Applied to files:

  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/ui/templates/react.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Validate component options using `validateOptions()` helper and return error box on validation failure

Applied to files:

  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/ui/components/modal.mdx
  • docs/draft/docs/ui/components/form.mdx
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/ui/templates/react.mdx
📚 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:

  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/ui/components/modal.mdx
  • docs/draft/docs/ui/api-reference/theme.mdx
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
  • docs/draft/docs/ui/getting-started.mdx
  • docs/draft/docs/ui/templates/html.mdx
  • docs/draft/docs/ui/advanced/hydration.mdx
  • docs/draft/docs/ui/templates/react.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.schema.ts : Every component must have a Zod schema with `.strict()` mode to reject unknown properties

Applied to files:

  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/ui/getting-started.mdx
  • docs/draft/docs/ui/templates/react.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Use Zod schema validation for all component inputs as a core validation strategy

Applied to files:

  • docs/draft/docs/ui/integration/validation.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.schema.ts : Use HTMX schema with strict mode including get, post, put, delete, target, swap, and trigger properties

Applied to files:

  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/ui/templates/html.mdx
  • docs/draft/docs/ui/advanced/hydration.mdx
  • docs/draft/docs/ui/templates/react.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.ts : Always use `escapeHtml()` utility for all user-provided content to prevent XSS vulnerabilities

Applied to files:

  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.test.ts : Test HTML escaping for user-provided content to prevent XSS attacks

Applied to files:

  • docs/draft/docs/ui/integration/validation.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.ts : Hard-code CDN URLs only in theme presets; always reference theme.cdn configuration in component code

Applied to files:

  • docs/draft/docs/ui/api-reference/theme.mdx
  • docs/draft/docs/ui/theming/overview.mdx
  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/theme/presets/**/*.ts : Implement GitHub/OpenAI gray-black monochromatic palette as the default theme

Applied to files:

  • docs/draft/docs/ui/api-reference/theme.mdx
  • docs/draft/docs/ui/theming/overview.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.test.ts : Test behavior across platform configurations (OpenAI, Claude, Gemini, ngrok) where applicable

Applied to files:

  • docs/draft/docs/ui/api-reference/theme.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Support platform-aware rendering by detecting network capabilities (open vs blocked) and script loading strategies (external vs inline)

Applied to files:

  • docs/draft/docs/ui/api-reference/theme.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.schema.ts : Use consistent enum naming for variants ('primary', 'secondary', 'outline', 'ghost', 'danger', 'success') and sizes ('xs', 'sm', 'md', 'lg', 'xl')

Applied to files:

  • docs/draft/docs/ui/theming/overview.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Use pure HTML string generation without React/Vue/JSX - components return HTML strings only

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
  • docs/draft/docs/ui/api-reference/runtime.mdx
  • docs/draft/docs/ui/getting-started.mdx
  • docs/draft/docs/ui/advanced/hydration.mdx
  • docs/draft/docs/ui/templates/react.mdx
📚 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:

  • docs/draft/docs/guides/ui-library.mdx
📚 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:

  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 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:

  • docs/draft/docs/ui/api-reference/runtime.mdx
📚 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 type parameters with constraints instead of unconstrained generics

Applied to files:

  • docs/draft/docs/ui/templates/react.mdx
📚 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:

  • docs/draft/docs/ui/templates/react.mdx
⏰ 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 (13)
docs/draft/docs/ui/components/form.mdx (1)

19-19: Documentation import paths updated for package restructuring.

All import paths have been correctly updated from @frontmcp/ui to @frontmcp/ui/components across the form.mdx examples (lines 19, 230, 252, 267, 300). The changes are consistent and align with the PR's objective of splitting the UI package structure. This is the appropriate location for documentation updates per the coding guidelines for human-editable draft files.

Verify that all imported components (input, select, textarea, checkbox, radio, formGroup, formField, button, card) are correctly exported from @frontmcp/ui/components in the package exports configuration.

docs/draft/docs/ui/components/modal.mdx (1)

11-11: The import paths are correct. The @frontmcp/ui/components subpath properly exports these HTML component functions, including modal, drawer, dialog, button, input, select, and others. The @frontmcp/uipack package is specifically for build tools, bundling, and platform adapters—not for UI components themselves. The documentation in docs/draft/docs/ui/components/modal.mdx uses the correct import paths consistent with the package structure.

Likely an incorrect or invalid review comment.

docs/draft/docs/ui/components/avatar.mdx (1)

11-11: LGTM! Import paths correctly updated.

The import paths have been correctly updated to @frontmcp/ui/components to reflect the new package structure where HTML component functions are now imported from a dedicated subpath.

Also applies to: 189-189, 224-224

docs/draft/docs/ui/templates/custom.mdx (1)

282-282: LGTM! Type import correctly migrated.

The type-only import of TemplateContext has been correctly updated to reference @frontmcp/uipack/types, aligning with the package split where type definitions are now provided by the uipack package.

docs/draft/docs/ui/api-reference/theme.mdx (1)

5-5: LGTM! Theme API references correctly migrated.

All theme-related imports and the package description have been consistently updated to reference @frontmcp/uipack/theme. This correctly reflects that the theme system is part of the uipack package, which has no React dependency.

Also applies to: 15-15, 40-40, 68-68, 87-87, 556-556, 567-567, 577-577, 601-601, 616-616, 627-627, 639-639, 656-656, 697-697, 728-728

docs/draft/docs/ui/integration/validation.mdx (1)

109-109: LGTM! Component utilities import correctly updated.

The import path for validation and HTML escaping utilities has been correctly updated to @frontmcp/ui/components, reflecting the new package structure.

docs/draft/docs/ui/templates/html.mdx (1)

129-129: LGTM! Component imports in HTML templates correctly updated.

The component imports in the HTML template examples have been correctly updated to @frontmcp/ui/components, demonstrating proper usage of the component library within HTML template functions.

Also applies to: 270-270

docs/draft/docs/ui/advanced/hydration.mdx (1)

69-69: LGTM! Hydration example imports correctly migrated.

All imports have been correctly updated to reflect the package split:

  • Template types moved to @frontmcp/uipack/types
  • Runtime types moved to @frontmcp/uipack/runtime
  • Component functions moved to @frontmcp/ui/components

Type-only imports are properly marked with import type.

Also applies to: 176-176, 282-282

docs/draft/docs/ui/theming/overview.mdx (1)

19-19: LGTM! Theme and layout imports correctly separated.

The imports have been correctly updated to reflect the package split:

  • Theme configuration and utilities moved to @frontmcp/uipack/theme
  • Layout functions moved to @frontmcp/ui/layouts

This separation aligns with the architecture where pure theme config lives in uipack while layout rendering lives in the ui package.

Also applies to: 200-201, 212-212

docs/draft/docs/ui/getting-started.mdx (2)

15-45: LGTM! Package split clearly explained.

The installation section now clearly explains the two-package architecture with a helpful table distinguishing between:

  • @frontmcp/uipack for HTML components without React
  • @frontmcp/ui for React components

The separate installation instructions for each use case make it easy for developers to choose the right package for their needs.


132-136: LGTM! Component imports and narrative correctly updated.

The documentation narrative now correctly references @frontmcp/uipack for HTML components, and all code examples have been updated to import from @frontmcp/ui/components. The changes are consistent and clear.

Also applies to: 191-191

docs/draft/docs/ui/templates/react.mdx (1)

37-37: LGTM! Import paths are consistent with the package split architecture.

All TemplateContext type imports correctly use import type from @frontmcp/uipack/types, while UI component imports consistently reference @frontmcp/ui/components. This aligns with the two-package architecture where types/runtime live in uipack and components live in ui.

Also applies to: 78-78, 127-128, 158-159, 232-232, 302-302

docs/draft/docs/ui/api-reference/runtime.mdx (1)

5-5: LGTM! All runtime API imports are consistent and correct.

All import examples throughout this API reference consistently use @frontmcp/uipack/runtime, which correctly reflects the package split where runtime utilities live in the uipack package. The previous review concern about invalid @frontmcp/uipack/components paths has been properly addressed.

Also applies to: 159-159, 288-288, 299-299, 311-311, 329-329, 363-363, 392-392, 405-405, 418-418, 429-429, 444-444, 467-467, 477-477, 495-495, 511-511

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (2)
docs/draft/docs/guides/ui-library.mdx (2)

14-20: Update section heading to reflect both packages.

The heading "Why @frontmcp/uipack" is followed by bullet points describing features from both packages—components from @frontmcp/ui (HTML output, HTMX, validation) and utilities from @frontmcp/uipack (platform detection, theme system).

🔎 Suggested fix
-## Why @frontmcp/uipack
+## Why @frontmcp/ui and @frontmcp/uipack

Alternatively, split this into two subsections if you want to distinguish the offerings:

  • "## Why @frontmcp/ui" → Pure HTML output, HTMX, Zod validation
  • "## Why @frontmcp/uipack" → Platform detection, theme system, page templates

188-188: Specify the package for the widgets module.

Line 188 mentions "The widgets module" but doesn't specify which package exports it. Based on the two-package architecture, clarify whether widgets come from @frontmcp/ui/widgets or @frontmcp/uipack/widgets so users know where to import them.

🔎 Suggested addition
-The `widgets` module exposes OpenAI App SDK components (resource pickers, action lists) plus status badges, progress indicators, and table helpers.
+The `@frontmcp/ui/widgets` module exposes OpenAI App SDK components (resource pickers, action lists) plus status badges, progress indicators, and table helpers.

(Adjust the package path based on the actual implementation.)

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 610c8c8 and 87049b4.

📒 Files selected for processing (1)
  • docs/draft/docs/guides/ui-library.mdx
🧰 Additional context used
📓 Path-based instructions (2)
docs/draft/docs/**

⚙️ CodeRabbit configuration file

docs/draft/docs/**: This folder holds the draft/source docs that humans are expected to edit. When authors want to add or change documentation, they should do it here. The Codex workflow uses these drafts, together with the code diff, to generate the latest docs under docs/docs/. As a reviewer: - Encourage contributors to add/update content here instead of docs/docs/. - It is fine to do structural/content feedback here (clarity, examples, etc).

Files:

  • docs/draft/docs/guides/ui-library.mdx
docs/**

⚙️ CodeRabbit configuration file

docs/**: Repository documentation for the SDK, using MDX and hosted by Mintlify. See more specific rules for: - docs/docs/** (latest rendered docs, automation-only) - docs/v/** (archived versions, read-only) - docs/draft/docs/** (human-editable drafts) - docs/blogs/** (blogs, human edited) - docs/docs.json (Mintlify navigation)

Files:

  • docs/draft/docs/guides/ui-library.mdx
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/** : Organize components into schema.ts (definitions) and implementation .ts files with matching names
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
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-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Use pure HTML string generation without React/Vue/JSX - components return HTML strings only
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Add JSDoc examples with example tags showing basic usage and options patterns for all components

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Use pure HTML string generation without React/Vue/JSX - components return HTML strings only

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 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:

  • docs/draft/docs/guides/ui-library.mdx
📚 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:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.schema.ts : Use HTMX schema with strict mode including get, post, put, delete, target, swap, and trigger properties

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.ts : Hard-code CDN URLs only in theme presets; always reference theme.cdn configuration in component code

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Validate component options using `validateOptions()` helper and return error box on validation failure

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.test.ts : Write validation tests covering invalid variant/options, unknown properties, and valid option acceptance

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.schema.ts : Every component must have a Zod schema with `.strict()` mode to reject unknown properties

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
⏰ 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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/draft/docs/guides/ui-library.mdx (1)

190-190: Consider adding an earlier mention or example of the widgets module.

The @frontmcp/ui/widgets module is introduced for the first time in the "next steps" section without prior context or examples. While appropriate for an advanced features callout, users might benefit from:

  • A brief mention in the package responsibilities Note (lines 11-14), or
  • A small code example showing a widget in action earlier in the guide

This would improve discoverability and help users understand the full scope of @frontmcp/ui capabilities.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1be4b1e and f4730d0.

📒 Files selected for processing (2)
  • docs/draft/docs/guides/ui-library.mdx
  • libs/sdk/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/sdk/package.json
🧰 Additional context used
📓 Path-based instructions (2)
docs/draft/docs/**

⚙️ CodeRabbit configuration file

docs/draft/docs/**: This folder holds the draft/source docs that humans are expected to edit. When authors want to add or change documentation, they should do it here. The Codex workflow uses these drafts, together with the code diff, to generate the latest docs under docs/docs/. As a reviewer: - Encourage contributors to add/update content here instead of docs/docs/. - It is fine to do structural/content feedback here (clarity, examples, etc).

Files:

  • docs/draft/docs/guides/ui-library.mdx
docs/**

⚙️ CodeRabbit configuration file

docs/**: Repository documentation for the SDK, using MDX and hosted by Mintlify. See more specific rules for: - docs/docs/** (latest rendered docs, automation-only) - docs/v/** (archived versions, read-only) - docs/draft/docs/** (human-editable drafts) - docs/blogs/** (blogs, human edited) - docs/docs.json (Mintlify navigation)

Files:

  • docs/draft/docs/guides/ui-library.mdx
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/** : Organize components into schema.ts (definitions) and implementation .ts files with matching names
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
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Use pure HTML string generation without React/Vue/JSX - components return HTML strings only
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
📚 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:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Use pure HTML string generation without React/Vue/JSX - components return HTML strings only

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 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:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.schema.ts : Use HTMX schema with strict mode including get, post, put, delete, target, swap, and trigger properties

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.ts : Hard-code CDN URLs only in theme presets; always reference theme.cdn configuration in component code

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Validate component options using `validateOptions()` helper and return error box on validation failure

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.test.ts : Write validation tests covering invalid variant/options, unknown properties, and valid option acceptance

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.schema.ts : Every component must have a Zod schema with `.strict()` mode to reject unknown properties

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
⏰ 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 (3)
docs/draft/docs/guides/ui-library.mdx (3)

5-14: Excellent clarification of package responsibilities.

The updated introduction now clearly distinguishes between the two packages. The Note box on lines 11-14 directly addresses previous concerns by explicitly listing what each package provides, making it easy for users to understand which package they need for specific functionality.


26-38: Installation instructions are now complete.

All package managers correctly install both @frontmcp/ui and @frontmcp/uipack, ensuring users have access to components, layouts, theming, and page templates needed for the examples throughout the guide.


45-48: Import paths are consistent throughout the guide.

All code examples use the correct module paths aligned with the two-package architecture:

  • Components, layouts, and widgets from @frontmcp/ui
  • Theming and page templates from @frontmcp/uipack

This consistency helps users understand the package structure while following the examples.

Also applies to: 75-76, 102-109, 149-149, 175-176

… responsibilities and add Snyk badge to README
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/draft/docs/guides/ui-library.mdx (1)

8-14: Consider clarifying the guide's focus on HTML components.

The introduction describes the packages as requiring "no React runtime" (line 8), and all code examples use HTML components from @frontmcp/ui/components and /layouts. However, line 12 mentions that @frontmcp/ui also provides React components under /react. This dual nature isn't explained, which might confuse readers who see React mentioned but never used.

Since this guide exclusively demonstrates HTML string generation, consider adding a brief note after line 14 clarifying that this guide focuses on the HTML component approach, and that React components are available separately for SSR/hydration scenarios.

Suggested clarification

After line 14, add:

 - `@frontmcp/uipack` provides theming (`/theme`), page templates (`/pages`), and build utilities
 </Note>
 
+This guide focuses on the HTML component approach (components that return strings). For React-based server-side rendering and hydration, see the [React Integration guide](/docs/ui/react).
+
 ## Why use the UI packages
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f4730d0 and c45753c.

📒 Files selected for processing (2)
  • README.md
  • docs/draft/docs/guides/ui-library.mdx
🧰 Additional context used
📓 Path-based instructions (2)
docs/draft/docs/**

⚙️ CodeRabbit configuration file

docs/draft/docs/**: This folder holds the draft/source docs that humans are expected to edit. When authors want to add or change documentation, they should do it here. The Codex workflow uses these drafts, together with the code diff, to generate the latest docs under docs/docs/. As a reviewer: - Encourage contributors to add/update content here instead of docs/docs/. - It is fine to do structural/content feedback here (clarity, examples, etc).

Files:

  • docs/draft/docs/guides/ui-library.mdx
docs/**

⚙️ CodeRabbit configuration file

docs/**: Repository documentation for the SDK, using MDX and hosted by Mintlify. See more specific rules for: - docs/docs/** (latest rendered docs, automation-only) - docs/v/** (archived versions, read-only) - docs/draft/docs/** (human-editable drafts) - docs/blogs/** (blogs, human edited) - docs/docs.json (Mintlify navigation)

Files:

  • docs/draft/docs/guides/ui-library.mdx
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/** : Organize components into schema.ts (definitions) and implementation .ts files with matching names
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: 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
📚 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:

  • README.md
  • docs/draft/docs/guides/ui-library.mdx
📚 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:

  • README.md
  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Use pure HTML string generation without React/Vue/JSX - components return HTML strings only

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.schema.ts : Use HTMX schema with strict mode including get, post, put, delete, target, swap, and trigger properties

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/**/*.ts : Hard-code CDN URLs only in theme presets; always reference theme.cdn configuration in component code

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.ts : Validate component options using `validateOptions()` helper and return error box on validation failure

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.test.ts : Write validation tests covering invalid variant/options, unknown properties, and valid option acceptance

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
📚 Learning: 2025-11-26T15:23:04.965Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-11-26T15:23:04.965Z
Learning: Applies to libs/ui/src/components/**/*.schema.ts : Every component must have a Zod schema with `.strict()` mode to reject unknown properties

Applied to files:

  • docs/draft/docs/guides/ui-library.mdx
⏰ 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 (3)
README.md (1)

17-17: LGTM!

The Snyk security badge is appropriately positioned alongside other project badges and adds transparency around security scanning. The badge URL follows standard conventions.

docs/draft/docs/guides/ui-library.mdx (2)

28-37: Installation instructions now complete.

The installation commands now correctly include both @frontmcp/ui and @frontmcp/uipack, addressing the previous issue where users would encounter import errors. All subsequent code examples will work as written.


46-48: Import paths are consistent with package split.

All import statements throughout the guide correctly reflect the two-package architecture:

  • HTML components and layouts from @frontmcp/ui
  • Theme system and page templates from @frontmcp/uipack

The documentation is internally consistent and users can follow the examples without confusion.

Also applies to: 76-76, 109-109, 149-149, 176-176, 190-190

@frontegg-david frontegg-david merged commit dacd86a into main Dec 22, 2025
20 of 21 checks passed
@frontegg-david frontegg-david deleted the split-frontmcp-ui branch December 22, 2025 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants