create-catalyst-app-internal 0.1.9 → 0.1.11
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 +1 -1
- package/scripts/cli.cjs +7 -59
- package/templates/common/server/document.js +1 -1
- package/templates/mcp-root/mcp/mcp.js +55 -0
- package/templates/none-js/client/index.js +1 -1
- package/templates/none-js/package.json +1 -1
- package/templates/none-ts/client/index.js +1 -1
- package/templates/none-ts/package.json +1 -1
- package/templates/redux-js/client/index.js +1 -1
- package/templates/redux-js/package.json +1 -1
- package/templates/redux-ts/client/index.js +1 -1
- package/templates/redux-ts/package.json +1 -1
- package/templates/rtk-js/client/index.js +1 -1
- package/templates/rtk-js/package.json +1 -1
- package/templates/rtk-ts/client/index.js +1 -1
- package/templates/rtk-ts/package.json +1 -1
package/package.json
CHANGED
package/scripts/cli.cjs
CHANGED
|
@@ -93,8 +93,11 @@ const program = new Commander.Command()
|
|
|
93
93
|
const commonCodeDirectory = "package/templates/common"
|
|
94
94
|
const selectedTemplateCode = `package/templates/${repositorySuffixes[stateManagement]}-${repositorySuffixes[language]}`
|
|
95
95
|
const tailwindCodeDirectory = "package/templates/tailwind"
|
|
96
|
+
const mcpCodeDirectory = "package/templates/mcp-root"
|
|
97
|
+
|
|
96
98
|
const subDirectoriesToExtract = [commonCodeDirectory, selectedTemplateCode]
|
|
97
99
|
if (tailWindSupport) subDirectoriesToExtract.push(tailwindCodeDirectory)
|
|
100
|
+
if (mcpSupport) subDirectoriesToExtract.push(mcpCodeDirectory)
|
|
98
101
|
|
|
99
102
|
const extractionDestination = `/${projectName}/`
|
|
100
103
|
let tempDir
|
|
@@ -119,8 +122,7 @@ const program = new Commander.Command()
|
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
if (mcpSupport) {
|
|
122
|
-
|
|
123
|
-
runMcpSetup(newMcpDir, path.join(process.cwd(), projectName))
|
|
125
|
+
execSync(`cd ${projectName} && npm i @modelcontextprotocol/sdk`, { stdio: "inherit" })
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
execSync(
|
|
@@ -201,6 +203,9 @@ const program = new Commander.Command()
|
|
|
201
203
|
if (entry.path.startsWith(tailwindCodeDirectory)) {
|
|
202
204
|
entry.path = entry.path.replace(tailwindCodeDirectory, extractionDestination)
|
|
203
205
|
}
|
|
206
|
+
if (entry.path.startsWith(mcpCodeDirectory)) {
|
|
207
|
+
entry.path = entry.path.replace(mcpCodeDirectory, extractionDestination)
|
|
208
|
+
}
|
|
204
209
|
},
|
|
205
210
|
})
|
|
206
211
|
} catch (e) {
|
|
@@ -216,65 +221,8 @@ const program = new Commander.Command()
|
|
|
216
221
|
})
|
|
217
222
|
.allowUnknownOption()
|
|
218
223
|
|
|
219
|
-
program
|
|
220
|
-
.command("mcp-setup")
|
|
221
|
-
.description("Set up MCP server in an existing catalyst project")
|
|
222
|
-
.action(() => {
|
|
223
|
-
try {
|
|
224
|
-
const mcpDir = path.join(process.cwd(), "node_modules/catalyst-core/mcp_v2")
|
|
225
|
-
const setupPath = path.join(mcpDir, "setup.js")
|
|
226
|
-
|
|
227
|
-
if (!fs.existsSync(setupPath)) {
|
|
228
|
-
console.log(cyan("mcp_v2 not found in catalyst-core. Downloading from GitHub..."))
|
|
229
|
-
const catalystCoreDir = path.join(process.cwd(), "node_modules/catalyst-core")
|
|
230
|
-
const tarballUrl = "https://github.com/tata1mg/catalyst-core/archive/refs/heads/main.tar.gz"
|
|
231
|
-
const tarballPath = path.join(catalystCoreDir, "_mcp_v2_tarball.tar.gz")
|
|
232
|
-
execSync(`curl -fsSL "${tarballUrl}" -o "${tarballPath}"`, { stdio: "inherit" })
|
|
233
|
-
fs.mkdirSync(mcpDir, { recursive: true })
|
|
234
|
-
execSync(
|
|
235
|
-
`tar -xzf "${tarballPath}" -C "${mcpDir}" --strip-components=2 "catalyst-core-main/mcp_v2"`,
|
|
236
|
-
{ stdio: "inherit" }
|
|
237
|
-
)
|
|
238
|
-
fs.unlinkSync(tarballPath)
|
|
239
|
-
console.log(cyan("mcp_v2 downloaded successfully."))
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
runMcpSetup(mcpDir)
|
|
243
|
-
} catch (error) {
|
|
244
|
-
console.error(red("An error occurred:"), error.message)
|
|
245
|
-
process.exit(1)
|
|
246
|
-
}
|
|
247
|
-
})
|
|
248
|
-
|
|
249
224
|
program.parse(process.argv)
|
|
250
225
|
|
|
251
|
-
function runMcpSetup(mcpDir, cwd = process.cwd()) {
|
|
252
|
-
const pkgPath = path.join(mcpDir, "package.json")
|
|
253
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"))
|
|
254
|
-
pkg.dependencies["better-sqlite3"] = "^12.8.0"
|
|
255
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2))
|
|
256
|
-
|
|
257
|
-
const mcpNodeModules = path.join(mcpDir, "node_modules")
|
|
258
|
-
let needsInstall = !fs.existsSync(mcpNodeModules)
|
|
259
|
-
|
|
260
|
-
if (!needsInstall) {
|
|
261
|
-
try {
|
|
262
|
-
execSync(`node -e "require('better-sqlite3')"`, { cwd: mcpDir, stdio: "pipe" })
|
|
263
|
-
} catch {
|
|
264
|
-
console.log(cyan("Detected incompatible better-sqlite3 build. Reinstalling..."))
|
|
265
|
-
fs.rmSync(mcpNodeModules, { recursive: true, force: true })
|
|
266
|
-
needsInstall = true
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (needsInstall) {
|
|
271
|
-
console.log(cyan("Installing mcp_v2 dependencies..."))
|
|
272
|
-
execSync("npm install", { cwd: mcpDir, stdio: "inherit" })
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
execSync(`node ${path.join(mcpDir, "setup.js")}`, { cwd, stdio: "inherit" })
|
|
276
|
-
}
|
|
277
|
-
|
|
278
226
|
async function promptStateManagement() {
|
|
279
227
|
const response = await prompts({
|
|
280
228
|
type: "select",
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const { McpServer } = require("@modelcontextprotocol/sdk/server/mcp.js")
|
|
2
|
+
const { StdioServerTransport } = require("@modelcontextprotocol/sdk/server/stdio.js")
|
|
3
|
+
|
|
4
|
+
const fetchContextFromGitHub = async () => {
|
|
5
|
+
const url = "https://raw.githubusercontent.com/tata1mg/catalyst-core-internal/main/context.md"
|
|
6
|
+
const response = await fetch(url)
|
|
7
|
+
|
|
8
|
+
if (!response.ok) {
|
|
9
|
+
throw new Error(`HTTP ${response.status}: Failed to fetch context from GitHub`)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return await response.text()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const server = new McpServer({
|
|
16
|
+
name: "catalyst",
|
|
17
|
+
version: "1.0.0",
|
|
18
|
+
capabilities: {
|
|
19
|
+
tools: {},
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
server.tool("get_context", "Complete context of catalyst framework", {}, async () => {
|
|
24
|
+
try {
|
|
25
|
+
const context = await fetchContextFromGitHub()
|
|
26
|
+
return {
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: "text",
|
|
30
|
+
text: context,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
}
|
|
34
|
+
} catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: "text",
|
|
39
|
+
text: `Error fetching context: ${error.message}`,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const init = async () => {
|
|
47
|
+
try {
|
|
48
|
+
const transport = new StdioServerTransport()
|
|
49
|
+
await server.connect(transport)
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error("Error starting MCP server:", error)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
init()
|
|
@@ -3,7 +3,7 @@ import "./styles"
|
|
|
3
3
|
import { hydrateRoot } from "react-dom/client"
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { RouterProvider } from "@tata1mg/router"
|
|
6
|
-
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
6
|
+
import clientRouter from "catalyst-core-internal/router/ClientRouter"
|
|
7
7
|
|
|
8
8
|
window.addEventListener("load", () => {
|
|
9
9
|
loadableReady(() => {
|
|
@@ -3,7 +3,7 @@ import "./styles"
|
|
|
3
3
|
import { hydrateRoot } from "react-dom/client"
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { RouterProvider } from "@tata1mg/router"
|
|
6
|
-
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
6
|
+
import clientRouter from "catalyst-core-internal/router/ClientRouter"
|
|
7
7
|
|
|
8
8
|
window.addEventListener("load", () => {
|
|
9
9
|
loadableReady(() => {
|
|
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
|
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { Provider } from "react-redux"
|
|
6
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
|
+
import clientRouter from "catalyst-core-internal/router/ClientRouter"
|
|
8
8
|
import configureStore from "@store"
|
|
9
9
|
|
|
10
10
|
window.addEventListener("load", () => {
|
|
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
|
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { Provider } from "react-redux"
|
|
6
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
|
+
import clientRouter from "catalyst-core-internal/router/ClientRouter"
|
|
8
8
|
import configureStore from "@store"
|
|
9
9
|
|
|
10
10
|
window.addEventListener("load", () => {
|
|
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
|
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { Provider } from "react-redux"
|
|
6
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
|
+
import clientRouter from "catalyst-core-internal/router/ClientRouter"
|
|
8
8
|
import configureStore from "@store"
|
|
9
9
|
|
|
10
10
|
window.addEventListener("load", () => {
|
|
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
|
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { Provider } from "react-redux"
|
|
6
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
|
+
import clientRouter from "catalyst-core-internal/router/ClientRouter"
|
|
8
8
|
import configureStore from "@store"
|
|
9
9
|
|
|
10
10
|
window.addEventListener("load", () => {
|