@tsrx/mcp 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -3
- package/src/analyze.js +1 -1
- package/src/compile.js +6 -8
- package/src/schemas.js +1 -1
- package/src/server.js +30 -3
- package/src/target.js +5 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "MCP server for TSRX documentation and project context",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.4",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -38,12 +38,13 @@
|
|
|
38
38
|
"prettier": "^3.9.6",
|
|
39
39
|
"zod": "^4.3.6",
|
|
40
40
|
"@tsrx/core": "0.2.2",
|
|
41
|
-
"@tsrx/prettier-plugin": "0.4.
|
|
41
|
+
"@tsrx/prettier-plugin": "0.4.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^24.3.0",
|
|
45
45
|
"typescript": "^5.9.3",
|
|
46
|
-
"vitest": "^4.1.6"
|
|
46
|
+
"vitest": "^4.1.6",
|
|
47
|
+
"@tsrx/hono": "0.1.1"
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"generate:docs": "node scripts/generate-docs-index.js"
|
package/src/analyze.js
CHANGED
|
@@ -49,7 +49,7 @@ function create_advice(input) {
|
|
|
49
49
|
severity: 'error',
|
|
50
50
|
title: 'Select a TSRX runtime target',
|
|
51
51
|
message:
|
|
52
|
-
'The compiler could not infer a runtime target. Call detect-target with a project cwd, or pass target as ripple, react, preact, solid, or
|
|
52
|
+
'The compiler could not infer a runtime target. Call detect-target with a project cwd, or pass target as ripple, react, preact, solid, vue, or hono.',
|
|
53
53
|
documentation: ['tsrx://docs/target-integration.md'],
|
|
54
54
|
});
|
|
55
55
|
}
|
package/src/compile.js
CHANGED
|
@@ -173,15 +173,13 @@ export async function compile_tsrx(input) {
|
|
|
173
173
|
if (!candidate) {
|
|
174
174
|
throw new Error(`Missing compiler candidate for target "${target}".`);
|
|
175
175
|
}
|
|
176
|
+
const compiler_package =
|
|
177
|
+
target === 'hono' && input.mode === 'client' ? '@tsrx/hono/dom' : candidate.compilerPackage;
|
|
176
178
|
|
|
177
179
|
try {
|
|
178
|
-
const compiler = await import_compiler(
|
|
179
|
-
candidate.compilerPackage,
|
|
180
|
-
cwd,
|
|
181
|
-
detection.packageJsonPath,
|
|
182
|
-
);
|
|
180
|
+
const compiler = await import_compiler(compiler_package, cwd, detection.packageJsonPath);
|
|
183
181
|
if (typeof compiler.compile !== 'function') {
|
|
184
|
-
throw new Error(`${
|
|
182
|
+
throw new Error(`${compiler_package} does not export a compile() function.`);
|
|
185
183
|
}
|
|
186
184
|
|
|
187
185
|
const result = compiler.compile(input.code, filename, {
|
|
@@ -196,7 +194,7 @@ export async function compile_tsrx(input) {
|
|
|
196
194
|
return {
|
|
197
195
|
ok: errors.length === 0,
|
|
198
196
|
target,
|
|
199
|
-
compilerPackage:
|
|
197
|
+
compilerPackage: compiler_package,
|
|
200
198
|
filename,
|
|
201
199
|
cwd,
|
|
202
200
|
errors,
|
|
@@ -207,7 +205,7 @@ export async function compile_tsrx(input) {
|
|
|
207
205
|
return {
|
|
208
206
|
ok: false,
|
|
209
207
|
target,
|
|
210
|
-
compilerPackage:
|
|
208
|
+
compilerPackage: compiler_package,
|
|
211
209
|
filename,
|
|
212
210
|
cwd,
|
|
213
211
|
errors: [normalize_error(error, filename)],
|
package/src/schemas.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
export const TARGET_SCHEMA = z.enum(['ripple', 'react', 'preact', 'solid', 'vue']);
|
|
3
|
+
export const TARGET_SCHEMA = z.enum(['ripple', 'react', 'preact', 'solid', 'vue', 'hono']);
|
|
4
4
|
|
|
5
5
|
export const target_match_schema = z.object({
|
|
6
6
|
target: z.string(),
|
package/src/server.js
CHANGED
|
@@ -86,6 +86,33 @@ The Vue target layer should own:
|
|
|
86
86
|
- interop with Vue libraries and composition APIs
|
|
87
87
|
|
|
88
88
|
Before giving Vue-specific advice, use \`detect-target\` or an explicit target signal and validate generated .tsrx code with \`compile-tsrx\`.`,
|
|
89
|
+
hono: `# TSRX Hono Target
|
|
90
|
+
|
|
91
|
+
The core TSRX MCP server owns target-neutral language syntax and compiler validation. Hono-specific guidance should live in the Hono target layer.
|
|
92
|
+
|
|
93
|
+
The Hono target layer should own:
|
|
94
|
+
- Hono JSX server and DOM package setup
|
|
95
|
+
- Hono Vite and Bun plugin setup
|
|
96
|
+
- server versus DOM runtime selection
|
|
97
|
+
- Hono JSX runtime imports and helper APIs
|
|
98
|
+
- Hono server output works with \`c.html()\`, \`c.render()\`, \`jsxRenderer\`, and
|
|
99
|
+
\`useRequestContext()\`; streaming uses Hono's \`hono/jsx/streaming\` APIs
|
|
100
|
+
- Hono's \`StreamingContext\`, \`hono/css\`/\`Style\`, custom JSX elements, and
|
|
101
|
+
intrinsic-element type augmentation remain application-level Hono APIs
|
|
102
|
+
- Hono DOM's synchronous component rule: use Hono's \`use(promise)\` with \`<Suspense>\` instead of Promise-returning components. The static validator catches explicit \`async\` components that can be resolved from a same-module component position; it does not infer Promise results across types or modules.
|
|
103
|
+
- Hono ErrorBoundary's \`fallbackRender\` contract, which does not provide a reset callback
|
|
104
|
+
|
|
105
|
+
Use \`hono/jsx\` for server output and \`hono/jsx/dom\` for browser output. The
|
|
106
|
+
documented Hono pattern may import hooks from \`hono/jsx\` while selecting
|
|
107
|
+
\`hono/jsx/dom\` as the JSX runtime. Do not claim identical server and DOM hook
|
|
108
|
+
or async semantics. Keep server and DOM compilation at the build boundary. For
|
|
109
|
+
Vite, one config can map \`mode === 'client'\` to \`tsrxHono({ mode: 'dom' })\`
|
|
110
|
+
and the default build to \`tsrxHono({ mode: 'server' })\`; run them as separate
|
|
111
|
+
builds (for example, \`vite build --mode client && vite build\`). For Bun, run
|
|
112
|
+
separate \`Bun.build()\` calls with \`mode: 'dom'\` and \`mode: 'server'\`.
|
|
113
|
+
Do not use include/exclude filters to mix the two runtimes within one build.
|
|
114
|
+
Before giving Hono-specific advice, use \`detect-target\` or an explicit target
|
|
115
|
+
signal and validate generated .tsrx code with \`compile-tsrx\`.`,
|
|
89
116
|
ripple: `# TSRX Ripple Target
|
|
90
117
|
|
|
91
118
|
The core TSRX MCP server owns target-neutral language syntax and compiler validation. Ripple-specific guidance should live in a Ripple target layer.
|
|
@@ -290,7 +317,7 @@ function text_resource(uri, text) {
|
|
|
290
317
|
function create_tsrx_task_prompt(options) {
|
|
291
318
|
const project_context_step = options.remote
|
|
292
319
|
? '2. This hosted MCP endpoint cannot inspect a local project filesystem. Use an explicit `target` argument when compiling or analyzing code, or ask the user which target runtime they use.'
|
|
293
|
-
: '2. If project context exists, call `inspect-project` for package/tooling context or `detect-target` when only the runtime target is needed before assuming React, Preact, Solid, Vue, or
|
|
320
|
+
: '2. If project context exists, call `inspect-project` for package/tooling context or `detect-target` when only the runtime target is needed before assuming React, Preact, Solid, Vue, Ripple, or Hono semantics.';
|
|
294
321
|
const file_validation_step = options.remote
|
|
295
322
|
? '6. For existing files, ask the user to paste source or use a local stdio MCP client; hosted MCP cannot read local file paths.'
|
|
296
323
|
: '6. When working with an existing file, call `validate-tsrx-file` for one-shot format, compile, and advice feedback.';
|
|
@@ -441,7 +468,7 @@ export function createTSRXMcpServer(options = {}) {
|
|
|
441
468
|
'Guide an agent through target-aware TSRX work: detect target, fetch docs, compile, and defer runtime-specific details to target layers.',
|
|
442
469
|
argsSchema: {
|
|
443
470
|
task: z.string().optional(),
|
|
444
|
-
target: z.enum(['ripple', 'react', 'preact', 'solid', 'vue']).optional(),
|
|
471
|
+
target: z.enum(['ripple', 'react', 'preact', 'solid', 'vue', 'hono']).optional(),
|
|
445
472
|
},
|
|
446
473
|
},
|
|
447
474
|
async ({ task, target }) => {
|
|
@@ -473,7 +500,7 @@ export function createTSRXMcpServer(options = {}) {
|
|
|
473
500
|
{
|
|
474
501
|
title: 'Detect TSRX Runtime Target',
|
|
475
502
|
description:
|
|
476
|
-
'Inspects package.json and common bundler config files to infer whether a project uses TSRX with Ripple, React, Preact, Solid, or
|
|
503
|
+
'Inspects package.json and common bundler config files to infer whether a project uses TSRX with Ripple, React, Preact, Solid, Vue, or Hono.',
|
|
477
504
|
inputSchema: {
|
|
478
505
|
cwd: z.string().optional(),
|
|
479
506
|
},
|
package/src/target.js
CHANGED
|
@@ -38,6 +38,11 @@ export const TARGET_CANDIDATES = [
|
|
|
38
38
|
compilerPackage: '@tsrx/vue',
|
|
39
39
|
signals: ['@tsrx/vue', '@tsrx/vite-plugin-vue', '@tsrx/rspack-plugin-vue'],
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
target: 'hono',
|
|
43
|
+
compilerPackage: '@tsrx/hono',
|
|
44
|
+
signals: ['@tsrx/hono', '@tsrx/vite-plugin-hono', '@tsrx/bun-plugin-hono'],
|
|
45
|
+
},
|
|
41
46
|
];
|
|
42
47
|
|
|
43
48
|
export const CONFIG_FILES = [
|