@tsrx/mcp 0.0.0

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/src/schemas.js ADDED
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+
3
+ export const TARGET_SCHEMA = z.enum(['ripple', 'react', 'preact', 'solid', 'vue']);
4
+
5
+ export const target_match_schema = z.object({
6
+ target: z.string(),
7
+ compilerPackage: z.string(),
8
+ signals: z.array(z.string()),
9
+ score: z.number(),
10
+ });
11
+
12
+ export const target_detection_schema = {
13
+ cwd: z.string(),
14
+ packageJsonPath: z.string().nullable(),
15
+ detectedTarget: z.string().nullable(),
16
+ confidence: z.enum(['high', 'ambiguous', 'none']),
17
+ matches: z.array(target_match_schema),
18
+ message: z.string(),
19
+ };
20
+
21
+ export const compile_error_schema = z.object({
22
+ message: z.string(),
23
+ code: z.string().nullable(),
24
+ type: z.string().nullable(),
25
+ fileName: z.string().nullable(),
26
+ pos: z.number().nullable(),
27
+ end: z.number().nullable(),
28
+ raisedAt: z.number().nullable(),
29
+ loc: z.unknown(),
30
+ });
31
+
32
+ export const compile_result_schema = {
33
+ ok: z.boolean(),
34
+ target: z.string().nullable(),
35
+ compilerPackage: z.string().nullable(),
36
+ filename: z.string(),
37
+ cwd: z.string(),
38
+ errors: z.array(compile_error_schema),
39
+ code: z.string().nullable(),
40
+ css: z.string().nullable(),
41
+ };
42
+
43
+ export const format_error_schema = z.object({
44
+ message: z.string(),
45
+ name: z.string().nullable(),
46
+ loc: z.unknown(),
47
+ });
48
+
49
+ export const format_result_schema = {
50
+ ok: z.boolean(),
51
+ filename: z.string(),
52
+ cwd: z.string(),
53
+ message: z.string().nullable(),
54
+ configPath: z.string().nullable(),
55
+ formatted: z.string().nullable(),
56
+ changed: z.boolean(),
57
+ errors: z.array(format_error_schema),
58
+ check: z.boolean().nullable(),
59
+ };
60
+
61
+ export const advice_schema = z.object({
62
+ kind: z.string(),
63
+ severity: z.enum(['error', 'warning', 'info']),
64
+ title: z.string(),
65
+ message: z.string(),
66
+ documentation: z.array(z.string()),
67
+ });
68
+
69
+ export const analysis_result_schema = {
70
+ ok: z.boolean(),
71
+ target: z.string().nullable(),
72
+ compilerPackage: z.string().nullable(),
73
+ filename: z.string(),
74
+ cwd: z.string(),
75
+ errors: z.array(compile_error_schema),
76
+ advice: z.array(advice_schema),
77
+ nextSteps: z.array(z.string()),
78
+ };
79
+
80
+ export const read_result_schema = z.object({
81
+ ok: z.boolean(),
82
+ error: z
83
+ .object({
84
+ message: z.string(),
85
+ code: z.string().nullable(),
86
+ })
87
+ .nullable(),
88
+ });
89
+
90
+ export const validate_file_result_schema = {
91
+ ok: z.boolean(),
92
+ cwd: z.string(),
93
+ filePath: z.string(),
94
+ filename: z.string(),
95
+ message: z.string().nullable(),
96
+ read: read_result_schema,
97
+ format: z.object(format_result_schema).nullable(),
98
+ compile: z.object(compile_result_schema).nullable(),
99
+ analysis: z.object(analysis_result_schema).nullable(),
100
+ };
101
+
102
+ export const package_signal_schema = z.object({
103
+ name: z.string(),
104
+ version: z.string(),
105
+ field: z.string(),
106
+ });
107
+
108
+ export const inspect_project_result_schema = {
109
+ cwd: z.string(),
110
+ root: z.string().nullable(),
111
+ packageJsonPath: z.string().nullable(),
112
+ packageName: z.string().nullable(),
113
+ packageManager: z.string().nullable(),
114
+ target: z.object(target_detection_schema),
115
+ configFiles: z.array(z.string()),
116
+ tsrxPackages: z.array(package_signal_schema),
117
+ targetPackages: z.array(
118
+ z.object({
119
+ target: z.string(),
120
+ compilerPackage: z.string(),
121
+ present: z.boolean(),
122
+ packages: z.array(package_signal_schema),
123
+ }),
124
+ ),
125
+ tooling: z.array(
126
+ z.object({
127
+ name: z.string(),
128
+ present: z.boolean(),
129
+ version: z.string().nullable(),
130
+ field: z.string().nullable(),
131
+ }),
132
+ ),
133
+ scripts: z.record(z.string(), z.string()),
134
+ commands: z.object({
135
+ format: z.string().nullable(),
136
+ formatCheck: z.string().nullable(),
137
+ typecheck: z.string().nullable(),
138
+ test: z.string().nullable(),
139
+ }),
140
+ message: z.string(),
141
+ };