Skip to content

Conversation

@frontegg-david
Copy link
Contributor

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

Summary by CodeRabbit

  • Build & Tooling
    • Updated module path mappings for improved import resolution across libraries.
    • Restructured package exports for better module compatibility and standardized output paths.
    • Migrated build system from TypeScript compiler to esbuild for improved performance and CommonJS/ESM support.
    • Enabled declaration source maps for better debugging experience.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 13, 2025

Walkthrough

TypeScript path aliases and module exports are reconfigured across the adapter, SDK, and UI libraries. The UI library's package.json transitions from explicit subpath exports to a consolidated wildcard scheme, output paths shift from dist/src/ to dist/, and the build system is updated from TSC to dual esbuild targets for CommonJS and ESModule formats.

Changes

Cohort / File(s) Summary
TypeScript Path Mappings
libs/adapters/tsconfig.lib.json, libs/sdk/tsconfig.lib.json
Added compilerOptions.paths entries to resolve @frontmcp/ui and @frontmcp/sdk module aliases to dist/*.d.ts entry points.
UI Library Export Restructuring
libs/ui/package.json
Added "type": "commonjs"; shifted main/module/types paths from dist/src/ to dist/; consolidated per-subpath exports into generic "./*" wildcard with separate "require" and "import" conditions; added ESM module entry.
UI Build Configuration
libs/ui/project.json
Replaced single build-tsc target with two esbuild-based targets (build-cjs, build-esm); updated build target to depend on both new targets.
UI TypeScript Declaration Maps
libs/ui/tsconfig.lib.json
Enabled declarationMap for source map generation of TypeScript declarations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • libs/ui/package.json: Export structure migration from explicit subpaths to wildcard patterns requires verification that all previously exported modules remain accessible through the new generalized paths.
  • libs/ui/project.json: Build target replacement (TSC → esbuild dual-target) needs validation that both CommonJS and ESModule outputs are correctly configured with identical entry points and asset handling.
  • Path mappings: Verify that updated tsconfig paths correctly resolve to the new dist/ structure across adapter and SDK libraries.

Possibly related PRs

  • PR #10: Introduces strip-dist-from-pkg and fix-pkg build targets that directly manipulate the package.json export paths and dist structure defined in these changes.

Poem

🐰 A build pipeline renewed, so clean and so bright,
From dist/src to dist, we've set the path right—
esbuild now handles both es and cjs,
With aliases pointing and exports that bliss,
The UI library's ready to dance!

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 accurately describes the main changes: adding ESM support to the UI library and updating TypeScript configuration across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-support-for-esm-ui

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

Base automatically changed from remove-unsused-deps to main December 14, 2025 00:18
# Conflicts:
#	docs/draft/docs/adapters/openapi-adapter.mdx
#	libs/adapters/src/openapi/__tests__/fixtures.ts
#	libs/adapters/src/openapi/__tests__/openapi-frontmcp-extension.spec.ts
#	libs/adapters/src/openapi/__tests__/openapi-loading.spec.ts
#	libs/adapters/src/openapi/openapi.adapter.ts
#	libs/adapters/src/openapi/openapi.security.ts
#	libs/adapters/src/openapi/openapi.utils.ts
#	libs/mcp-from-openapi/src/generator.ts
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: 4

📜 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 c09fc81 and 3c2a7e4.

📒 Files selected for processing (6)
  • libs/adapters/src/openapi/__tests__/fixtures.ts (1 hunks)
  • libs/adapters/tsconfig.lib.json (1 hunks)
  • libs/sdk/tsconfig.lib.json (1 hunks)
  • libs/ui/package.json (1 hunks)
  • libs/ui/project.json (1 hunks)
  • libs/ui/tsconfig.lib.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
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/ui/tsconfig.lib.json
  • libs/ui/project.json
  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
  • libs/adapters/src/openapi/__tests__/fixtures.ts
  • libs/ui/package.json
**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.ts: Enable 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 specific error classes with MCP error codes instead of generic errors
Use type parameters with constraints instead of unconstrained generics, and prefer unknown over any for generic type defaults
Follow the preset pattern for hierarchical configurations across the codebase

Files:

  • libs/adapters/src/openapi/__tests__/fixtures.ts
libs/{sdk,adapters,plugins,cli}/src/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

libs/{sdk,adapters,plugins,cli}/src/**/*.ts: Return strictly typed MCP protocol responses (GetPromptResult, ReadResourceResult, etc.) instead of unknown for execute() and read() methods
Validate URIs per RFC 3986 at metadata level using Zod validation with custom refinements
Use getCapabilities() for dynamic capability exposure instead of hardcoding capabilities in adapters
Use changeScope instead of scope for change event properties to avoid confusion with the Scope class
Validate hooks match their entry type and fail fast with InvalidHookFlowError for unsupported flows
Don't mutate rawInput in flows - use state.set() for managing flow state instead

Files:

  • libs/adapters/src/openapi/__tests__/fixtures.ts
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/*/src/index.ts : Use barrel exports (index.ts) to export all public API surface without legacy exports or aliases
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: 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
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/*/src/common/records/**/*.ts : Centralize record types in common/records and import from there instead of from module-specific files
📚 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/ui/tsconfig.lib.json
  • libs/ui/project.json
  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
  • libs/ui/package.json
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to **/*.ts : Enable strict TypeScript mode with no `any` types without strong justification - use `unknown` instead for generic type defaults

Applied to files:

  • libs/ui/tsconfig.lib.json
  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to **/*.ts : Follow the preset pattern for hierarchical configurations across the codebase

Applied to files:

  • libs/ui/tsconfig.lib.json
  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Use the Nx build system for all build commands (nx build sdk, nx test ast-guard, nx run-many -t test)

Applied to files:

  • libs/ui/project.json
📚 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:

  • libs/ui/project.json
  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
  • libs/adapters/src/openapi/__tests__/fixtures.ts
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/{sdk,adapters,plugins,cli}/src/**/*.ts : Use `changeScope` instead of `scope` for change event properties to avoid confusion with the Scope class

Applied to files:

  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/*/src/index.ts : Use barrel exports (index.ts) to export all public API surface without legacy exports or aliases

Applied to files:

  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
  • libs/ui/package.json
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/{sdk,adapters,plugins,cli}/src/**/*.ts : Use `getCapabilities()` for dynamic capability exposure instead of hardcoding capabilities in adapters

Applied to files:

  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
📚 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/sdk/tsconfig.lib.json
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/*/src/common/records/**/*.ts : Centralize record types in common/records and import from there instead of from module-specific files

Applied to files:

  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
📚 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:

  • libs/sdk/tsconfig.lib.json
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/{sdk,adapters,plugins,cli}/src/**/*.ts : Return strictly typed MCP protocol responses (GetPromptResult, ReadResourceResult, etc.) instead of `unknown` for `execute()` and `read()` methods

Applied to files:

  • libs/adapters/tsconfig.lib.json
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Use FrontMCP's TypeScript-first schema validation framework philosophy - all types should align with MCP protocol definitions

Applied to files:

  • libs/ui/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
libs/ui/tsconfig.lib.json (1)

6-6: LGTM! Declaration maps improve debugging.

Enabling declarationMap: true generates .d.ts.map files that allow IDEs to navigate from type declarations to source files, which is valuable for debugging the reorganized package structure.

libs/ui/package.json (2)

33-62: LGTM! Dual package exports are well-structured.

The restructured exports correctly support both CommonJS and ESM:

  • "type": "commonjs" sets the default module system
  • Top-level fields (main, module, types) provide fallback resolution
  • Conditional exports handle both require and import with proper type declarations
  • Wildcard pattern ("./*") enables deep imports while maintaining format boundaries
  • "./esm": null prevents direct @frontmcp/ui/esm imports, forcing use of the correct entry points

This aligns with the dual build targets (build-cjs and build-esm) in project.json.


50-60: Verify that wildcard exports don't expose internal implementation details.

The "./*" wildcard (lines 50-60) allows consumers to import any subpath (e.g., @frontmcp/ui/adapters, @frontmcp/ui/runtime). Ensure that only public API modules with barrel exports (index.ts) are intended for external consumption.

Run the following to list all modules exposed by the wildcard:

#!/bin/bash
# List all index.ts files that will be publicly accessible
fd -e ts '^index\.ts$' libs/ui/src -x echo 'Public export: @frontmcp/ui/{/.}'

Review the output to confirm all exposed paths are intentional public API surfaces. Based on learnings, barrel exports should expose only the public API without legacy exports or aliases.

libs/ui/project.json (1)

8-91: The dependsOn: ["build-cjs"] on build-esm (line 52) ensures sequential execution and prevents any declaration generation conflicts. Both targets use the same declarationRootDir but write to different outputPath directories, and with the dependency in place, there are no parallel build conflicts to verify.

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

🧹 Nitpick comments (1)
libs/ui/project.json (1)

45-47: Consider removing redundant esbuildOptions.

The outExtension: { ".js": ".js" } is esbuild's default behavior and can be safely removed for clarity.

-        "esbuildOptions": {
-          "outExtension": { ".js": ".js" }
-        }
📜 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 3c2a7e4 and 90c29ca.

📒 Files selected for processing (3)
  • libs/adapters/tsconfig.lib.json (1 hunks)
  • libs/sdk/tsconfig.lib.json (1 hunks)
  • libs/ui/project.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • libs/sdk/tsconfig.lib.json
  • libs/adapters/tsconfig.lib.json
🧰 Additional context used
📓 Path-based instructions (1)
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/ui/project.json
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/*/src/index.ts : Use barrel exports (index.ts) to export all public API surface without legacy exports or aliases
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-01T00:33:33.644Z
Learning: Applies to libs/{sdk,adapters,plugins,cli}/src/**/*.ts : Use `changeScope` instead of `scope` for change event properties to avoid confusion with the Scope class
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/{sdk,adapters,plugins,cli}/src/**/*.ts : Use `getCapabilities()` for dynamic capability exposure instead of hardcoding capabilities in adapters
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/*/src/common/records/**/*.ts : Centralize record types in common/records and import from there instead of from module-specific files
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
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to **/*.ts : Follow the preset pattern for hierarchical configurations across the codebase
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
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Applies to libs/*/src/index.ts : Use barrel exports (index.ts) to export all public API surface without legacy exports or aliases

Applied to files:

  • libs/ui/project.json
📚 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/ui/project.json
📚 Learning: 2025-12-01T00:33:33.644Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T00:33:33.644Z
Learning: Use the Nx build system for all build commands (nx build sdk, nx test ast-guard, nx run-many -t test)

Applied to files:

  • libs/ui/project.json
📚 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:

  • libs/ui/project.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
libs/ui/project.json (2)

50-89: The build configuration is correct—declaration handling is safe despite parallel builds.

Both build-cjs and build-esm run in parallel (via the build target's dependsOn), but declarations output to completely separate directories: libs/ui/dist/ (CJS) and libs/ui/dist/esm/ (ESM). With esbuild's declaration generation per output path, there is no file collision risk. The declarationRootDir merely sets the source root for path mapping within declarations, not the output location. The configuration is sound.


91-96: Script correctly handles dual output paths in both CJS and ESM formats.

The strip-dist-from-pkg.js script properly processes both output directories. The stripDist function removes the ./dist/ prefix from all paths: ./dist/index.js becomes ./index.js (for CJS in dist/), and ./dist/esm/index.js becomes ./esm/index.js (valid relative path from dist/ pointing to the dist/esm/ subdirectory). The recursive walk function correctly handles nested export conditions, removes development conditions as required for published packages, and preserves the dual export structure where require paths resolve to CJS outputs and import paths resolve to ESM outputs.

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