feat(typegen): add @decocms/typegen package#2501
Merged
viktormarinho merged 25 commits intomainfrom Feb 26, 2026
Merged
Conversation
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
There was a problem hiding this comment.
2 issues found across 11 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/typegen/src/runtime.ts">
<violation number="1" location="packages/typegen/src/runtime.ts:11">
P2: This factory creates an active client connection that cannot be closed by the consumer, leading to potential resource leaks if `createMeshClient` is called repeatedly or used in a hot-reload environment.
Consider exposing a `close` or `dispose` method on the returned proxy, or documenting that this function should only be used as a singleton.</violation>
<violation number="2" location="packages/typegen/src/runtime.ts:14">
P1: 1. **Race Condition**: `getClient` checks `mcpClient` synchronously but awaits the connection. Concurrent calls will bypass the check, creating multiple `Client` instances and connections (orphan connections). Use a shared Promise to ensure a singleton connection.
2. **URL Construction Bug**: `new URL("/mcp/...", baseUrl)` ignores the path component of `baseUrl` (if any) because the first argument starts with `/`. This breaks usage with proxy URLs (e.g., `https://example.com/api`).
3. **Injection Risk**: `opts.mcpId` is not encoded, which breaks the URL if it contains special characters.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Contributor
Release OptionsShould a new version be published when this PR is merged? React with an emoji to vote on the release type:
Current version: Deployment
|
… runtime; fix cn lint error
…t SDK mock from leaking into CI test suite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/typegenpackage with a dual-purpose design: a CLI bin (bunx @decocms/typegen) and a runtime factory (createMeshClient)client.tswith a fully typedToolsinterfacecreateMeshClient<T>()returns a lazy-connecting Proxy typed to the generated interface — one import, zero boilerplateTest Plan
bun test packages/typegen/— 10/10 tests pass (runtime + codegen)bun run --cwd=packages/typegen check— TypeScript cleanbun run --cwd=packages/typegen build—dist/built withindex.js,cli.js,.d.tsfilesbun run fmt— Biome formatting appliedSummary by cubic
Adds a new @decocms/typegen package to generate a typed TypeScript client for Mesh Virtual MCPs. Updates the Connect UI, stabilizes the runtime (race fix, safe URLs, close()), adds CI auto‑publish, and improves test isolation.
New Features
Bug Fixes
Written for commit d2e1369. Summary will update on new commits.