@tanstack/cta-cli 0.15.7 → 0.15.8
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/dist/mcp.js +17 -72
- package/package.json +3 -3
- package/src/mcp.ts +29 -93
package/dist/mcp.js
CHANGED
|
@@ -1,83 +1,24 @@
|
|
|
1
|
+
// do same for listTanStackReactAddOns and listTanStackSolidAddOns
|
|
2
|
+
// remove the react and solid variants
|
|
1
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
4
|
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
3
5
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
6
|
import express from 'express';
|
|
5
7
|
import { z } from 'zod';
|
|
6
|
-
import { createApp, createDefaultEnvironment, finalizeAddOns,
|
|
8
|
+
import { createApp, createDefaultEnvironment, finalizeAddOns, getFrameworkByName, getFrameworks, } from '@tanstack/cta-engine';
|
|
7
9
|
function createServer({ appName, forcedAddOns = [], }) {
|
|
8
10
|
const server = new McpServer({
|
|
9
11
|
name: `${appName} Application Builder`,
|
|
10
12
|
version: '1.0.0',
|
|
11
13
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
type: 'text',
|
|
18
|
-
text: JSON.stringify(framework
|
|
19
|
-
.getAddOns()
|
|
20
|
-
.filter((addOn) => addOn.modes.includes('file-router'))
|
|
21
|
-
.map((addOn) => ({
|
|
22
|
-
id: addOn.id,
|
|
23
|
-
description: addOn.description,
|
|
24
|
-
}))),
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
server.tool('createTanStackReactApplication', 'Create a new TanStack React application', {
|
|
30
|
-
projectName: z
|
|
14
|
+
const frameworks = getFrameworks();
|
|
15
|
+
const frameworkNames = frameworks.map((framework) => framework.name);
|
|
16
|
+
server.tool('listTanStackAddOns', 'List the available add-ons for creating TanStack applications', {
|
|
17
|
+
framework: z
|
|
31
18
|
.string()
|
|
32
|
-
.describe(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
targetDir: z
|
|
36
|
-
.string()
|
|
37
|
-
.describe('The directory to create the application in. Use the absolute path of the directory you want the application to be created in'),
|
|
38
|
-
}, async ({ projectName, addOns, cwd, targetDir }) => {
|
|
39
|
-
const framework = getFrameworkById('react-cra');
|
|
40
|
-
try {
|
|
41
|
-
process.chdir(cwd);
|
|
42
|
-
try {
|
|
43
|
-
const chosenAddOns = await finalizeAddOns(framework, 'file-router', Array.from(new Set([
|
|
44
|
-
...addOns,
|
|
45
|
-
...forcedAddOns,
|
|
46
|
-
])));
|
|
47
|
-
await createApp(createDefaultEnvironment(), {
|
|
48
|
-
projectName: projectName.replace(/^\//, './'),
|
|
49
|
-
targetDir,
|
|
50
|
-
framework,
|
|
51
|
-
typescript: true,
|
|
52
|
-
tailwind: true,
|
|
53
|
-
packageManager: 'pnpm',
|
|
54
|
-
mode: 'file-router',
|
|
55
|
-
chosenAddOns,
|
|
56
|
-
git: true,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
console.error(error);
|
|
61
|
-
return {
|
|
62
|
-
content: [
|
|
63
|
-
{ type: 'text', text: `Error creating application: ${error}` },
|
|
64
|
-
],
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
content: [{ type: 'text', text: 'Application created successfully' }],
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
return {
|
|
73
|
-
content: [
|
|
74
|
-
{ type: 'text', text: `Error creating application: ${error}` },
|
|
75
|
-
],
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
server.tool('listTanStackSolidAddOns', 'List the available add-ons for creating TanStack Solid applications', {}, () => {
|
|
80
|
-
const framework = getFrameworkById('solid');
|
|
19
|
+
.describe(`The framework to use. Available frameworks: ${frameworkNames.join(', ')}`),
|
|
20
|
+
}, ({ framework: frameworkName }) => {
|
|
21
|
+
const framework = getFrameworkByName(frameworkName);
|
|
81
22
|
return {
|
|
82
23
|
content: [
|
|
83
24
|
{
|
|
@@ -93,7 +34,10 @@ function createServer({ appName, forcedAddOns = [], }) {
|
|
|
93
34
|
],
|
|
94
35
|
};
|
|
95
36
|
});
|
|
96
|
-
server.tool('
|
|
37
|
+
server.tool('createTanStackApplication', 'Create a new TanStack application', {
|
|
38
|
+
framework: z
|
|
39
|
+
.string()
|
|
40
|
+
.describe(`The framework to use. Available frameworks: ${frameworkNames.join(', ')}`),
|
|
97
41
|
projectName: z
|
|
98
42
|
.string()
|
|
99
43
|
.describe('The package.json module name of the application (will also be the directory name)'),
|
|
@@ -102,8 +46,8 @@ function createServer({ appName, forcedAddOns = [], }) {
|
|
|
102
46
|
targetDir: z
|
|
103
47
|
.string()
|
|
104
48
|
.describe('The directory to create the application in. Use the absolute path of the directory you want the application to be created in'),
|
|
105
|
-
}, async ({ projectName, addOns, cwd, targetDir }) => {
|
|
106
|
-
const framework =
|
|
49
|
+
}, async ({ framework: frameworkName, projectName, addOns, cwd, targetDir, }) => {
|
|
50
|
+
const framework = getFrameworkByName(frameworkName);
|
|
107
51
|
try {
|
|
108
52
|
process.chdir(cwd);
|
|
109
53
|
try {
|
|
@@ -124,6 +68,7 @@ function createServer({ appName, forcedAddOns = [], }) {
|
|
|
124
68
|
});
|
|
125
69
|
}
|
|
126
70
|
catch (error) {
|
|
71
|
+
console.error(error);
|
|
127
72
|
return {
|
|
128
73
|
content: [
|
|
129
74
|
{ type: 'text', text: `Error creating application: ${error}` },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/cta-cli",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.8",
|
|
4
4
|
"description": "Tanstack Application Builder CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"commander": "^13.1.0",
|
|
30
30
|
"express": "^4.21.2",
|
|
31
31
|
"zod": "^3.24.2",
|
|
32
|
-
"@tanstack/cta-
|
|
33
|
-
"@tanstack/cta-
|
|
32
|
+
"@tanstack/cta-engine": "0.15.7",
|
|
33
|
+
"@tanstack/cta-ui": "0.15.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@tanstack/config": "^0.16.2",
|
package/src/mcp.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// do same for listTanStackReactAddOns and listTanStackSolidAddOns
|
|
2
|
+
// remove the react and solid variants
|
|
3
|
+
|
|
1
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
5
|
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'
|
|
3
6
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
@@ -8,7 +11,8 @@ import {
|
|
|
8
11
|
createApp,
|
|
9
12
|
createDefaultEnvironment,
|
|
10
13
|
finalizeAddOns,
|
|
11
|
-
|
|
14
|
+
getFrameworkByName,
|
|
15
|
+
getFrameworks,
|
|
12
16
|
} from '@tanstack/cta-engine'
|
|
13
17
|
|
|
14
18
|
function createServer({
|
|
@@ -24,101 +28,21 @@ function createServer({
|
|
|
24
28
|
version: '1.0.0',
|
|
25
29
|
})
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
'List the available add-ons for creating TanStack React applications',
|
|
30
|
-
{},
|
|
31
|
-
() => {
|
|
32
|
-
const framework = getFrameworkById('react-cra')!
|
|
33
|
-
return {
|
|
34
|
-
content: [
|
|
35
|
-
{
|
|
36
|
-
type: 'text',
|
|
37
|
-
text: JSON.stringify(
|
|
38
|
-
framework
|
|
39
|
-
.getAddOns()
|
|
40
|
-
.filter((addOn) => addOn.modes.includes('file-router'))
|
|
41
|
-
.map((addOn) => ({
|
|
42
|
-
id: addOn.id,
|
|
43
|
-
description: addOn.description,
|
|
44
|
-
})),
|
|
45
|
-
),
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
)
|
|
31
|
+
const frameworks = getFrameworks()
|
|
32
|
+
const frameworkNames = frameworks.map((framework) => framework.name)
|
|
51
33
|
|
|
52
34
|
server.tool(
|
|
53
|
-
'
|
|
54
|
-
'
|
|
35
|
+
'listTanStackAddOns',
|
|
36
|
+
'List the available add-ons for creating TanStack applications',
|
|
55
37
|
{
|
|
56
|
-
|
|
57
|
-
.string()
|
|
58
|
-
.describe(
|
|
59
|
-
'The package.json module name of the application (will also be the directory name)',
|
|
60
|
-
),
|
|
61
|
-
cwd: z.string().describe('The directory to create the application in'),
|
|
62
|
-
addOns: z.array(z.string()).describe('The IDs of the add-ons to install'),
|
|
63
|
-
targetDir: z
|
|
38
|
+
framework: z
|
|
64
39
|
.string()
|
|
65
40
|
.describe(
|
|
66
|
-
|
|
41
|
+
`The framework to use. Available frameworks: ${frameworkNames.join(', ')}`,
|
|
67
42
|
),
|
|
68
43
|
},
|
|
69
|
-
|
|
70
|
-
const framework =
|
|
71
|
-
try {
|
|
72
|
-
process.chdir(cwd)
|
|
73
|
-
try {
|
|
74
|
-
const chosenAddOns = await finalizeAddOns(
|
|
75
|
-
framework,
|
|
76
|
-
'file-router',
|
|
77
|
-
Array.from(
|
|
78
|
-
new Set([
|
|
79
|
-
...(addOns as unknown as Array<string>),
|
|
80
|
-
...forcedAddOns,
|
|
81
|
-
]),
|
|
82
|
-
),
|
|
83
|
-
)
|
|
84
|
-
await createApp(createDefaultEnvironment(), {
|
|
85
|
-
projectName: projectName.replace(/^\//, './'),
|
|
86
|
-
targetDir,
|
|
87
|
-
framework,
|
|
88
|
-
typescript: true,
|
|
89
|
-
tailwind: true,
|
|
90
|
-
packageManager: 'pnpm',
|
|
91
|
-
mode: 'file-router',
|
|
92
|
-
chosenAddOns,
|
|
93
|
-
git: true,
|
|
94
|
-
})
|
|
95
|
-
} catch (error) {
|
|
96
|
-
console.error(error)
|
|
97
|
-
return {
|
|
98
|
-
content: [
|
|
99
|
-
{ type: 'text', text: `Error creating application: ${error}` },
|
|
100
|
-
],
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
content: [{ type: 'text', text: 'Application created successfully' }],
|
|
105
|
-
}
|
|
106
|
-
} catch (error) {
|
|
107
|
-
return {
|
|
108
|
-
content: [
|
|
109
|
-
{ type: 'text', text: `Error creating application: ${error}` },
|
|
110
|
-
],
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
server.tool(
|
|
117
|
-
'listTanStackSolidAddOns',
|
|
118
|
-
'List the available add-ons for creating TanStack Solid applications',
|
|
119
|
-
{},
|
|
120
|
-
() => {
|
|
121
|
-
const framework = getFrameworkById('solid')!
|
|
44
|
+
({ framework: frameworkName }) => {
|
|
45
|
+
const framework = getFrameworkByName(frameworkName)!
|
|
122
46
|
return {
|
|
123
47
|
content: [
|
|
124
48
|
{
|
|
@@ -139,9 +63,14 @@ function createServer({
|
|
|
139
63
|
)
|
|
140
64
|
|
|
141
65
|
server.tool(
|
|
142
|
-
'
|
|
143
|
-
'Create a new TanStack
|
|
66
|
+
'createTanStackApplication',
|
|
67
|
+
'Create a new TanStack application',
|
|
144
68
|
{
|
|
69
|
+
framework: z
|
|
70
|
+
.string()
|
|
71
|
+
.describe(
|
|
72
|
+
`The framework to use. Available frameworks: ${frameworkNames.join(', ')}`,
|
|
73
|
+
),
|
|
145
74
|
projectName: z
|
|
146
75
|
.string()
|
|
147
76
|
.describe(
|
|
@@ -155,8 +84,14 @@ function createServer({
|
|
|
155
84
|
'The directory to create the application in. Use the absolute path of the directory you want the application to be created in',
|
|
156
85
|
),
|
|
157
86
|
},
|
|
158
|
-
async ({
|
|
159
|
-
|
|
87
|
+
async ({
|
|
88
|
+
framework: frameworkName,
|
|
89
|
+
projectName,
|
|
90
|
+
addOns,
|
|
91
|
+
cwd,
|
|
92
|
+
targetDir,
|
|
93
|
+
}) => {
|
|
94
|
+
const framework = getFrameworkByName(frameworkName)!
|
|
160
95
|
try {
|
|
161
96
|
process.chdir(cwd)
|
|
162
97
|
try {
|
|
@@ -182,6 +117,7 @@ function createServer({
|
|
|
182
117
|
git: true,
|
|
183
118
|
})
|
|
184
119
|
} catch (error) {
|
|
120
|
+
console.error(error)
|
|
185
121
|
return {
|
|
186
122
|
content: [
|
|
187
123
|
{ type: 'text', text: `Error creating application: ${error}` },
|