create-catalyst-app-internal 0.1.5 → 0.1.6
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 +40 -34
package/package.json
CHANGED
package/scripts/cli.cjs
CHANGED
|
@@ -43,34 +43,6 @@ const program = new Commander.Command()
|
|
|
43
43
|
return
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
if (process.argv.includes("mcp-setup")) {
|
|
47
|
-
const mcpDir = path.join(process.cwd(), "node_modules/catalyst-core/mcp_v2")
|
|
48
|
-
const setupPath = path.join(mcpDir, "setup.js")
|
|
49
|
-
|
|
50
|
-
if (!fs.existsSync(setupPath)) {
|
|
51
|
-
console.log(cyan("mcp_v2 not found in catalyst-core. Downloading from GitHub..."))
|
|
52
|
-
const catalystCoreDir = path.join(process.cwd(), "node_modules/catalyst-core")
|
|
53
|
-
const tarballUrl = "https://github.com/tata1mg/catalyst-core/archive/refs/heads/main.tar.gz"
|
|
54
|
-
const tarballPath = path.join(catalystCoreDir, "_mcp_v2_tarball.tar.gz")
|
|
55
|
-
execSync(`curl -fsSL "${tarballUrl}" -o "${tarballPath}"`, { stdio: "inherit" })
|
|
56
|
-
fs.mkdirSync(mcpDir, { recursive: true })
|
|
57
|
-
execSync(
|
|
58
|
-
`tar -xzf "${tarballPath}" -C "${mcpDir}" --strip-components=2 "catalyst-core-main/mcp_v2"`,
|
|
59
|
-
{ stdio: "inherit" }
|
|
60
|
-
)
|
|
61
|
-
fs.unlinkSync(tarballPath)
|
|
62
|
-
console.log(cyan("mcp_v2 downloaded successfully."))
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const mcpNodeModules = path.join(mcpDir, "node_modules")
|
|
66
|
-
if (!fs.existsSync(mcpNodeModules)) {
|
|
67
|
-
console.log(cyan("Installing mcp_v2 dependencies..."))
|
|
68
|
-
execSync("npm install", { cwd: mcpDir, stdio: "inherit" })
|
|
69
|
-
}
|
|
70
|
-
execSync(`node ${setupPath}`, { stdio: "inherit" })
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
|
|
74
46
|
console.log(cyan(`Using create-catalyst-app version ${bold(packageJson.version)}`))
|
|
75
47
|
|
|
76
48
|
// Use options provided through commander or prompt the user
|
|
@@ -148,12 +120,7 @@ const program = new Commander.Command()
|
|
|
148
120
|
|
|
149
121
|
if (mcpSupport) {
|
|
150
122
|
const newMcpDir = path.join(process.cwd(), projectName, "node_modules/catalyst-core/mcp_v2")
|
|
151
|
-
|
|
152
|
-
if (!fs.existsSync(newMcpNodeModules)) {
|
|
153
|
-
console.log(cyan("Installing mcp_v2 dependencies..."))
|
|
154
|
-
execSync("npm install", { cwd: newMcpDir, stdio: "inherit" })
|
|
155
|
-
}
|
|
156
|
-
execSync(`node ${path.join(newMcpDir, "setup.js")}`, { stdio: "inherit" })
|
|
123
|
+
runMcpSetup(newMcpDir)
|
|
157
124
|
}
|
|
158
125
|
|
|
159
126
|
execSync(
|
|
@@ -249,8 +216,47 @@ const program = new Commander.Command()
|
|
|
249
216
|
})
|
|
250
217
|
.allowUnknownOption()
|
|
251
218
|
|
|
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
|
+
|
|
252
249
|
program.parse(process.argv)
|
|
253
250
|
|
|
251
|
+
function runMcpSetup(mcpDir) {
|
|
252
|
+
const mcpNodeModules = path.join(mcpDir, "node_modules")
|
|
253
|
+
if (!fs.existsSync(mcpNodeModules)) {
|
|
254
|
+
console.log(cyan("Installing mcp_v2 dependencies..."))
|
|
255
|
+
execSync("npm install", { cwd: mcpDir, stdio: "inherit" })
|
|
256
|
+
}
|
|
257
|
+
execSync(`node ${path.join(mcpDir, "setup.js")}`, { stdio: "inherit" })
|
|
258
|
+
}
|
|
259
|
+
|
|
254
260
|
async function promptStateManagement() {
|
|
255
261
|
const response = await prompts({
|
|
256
262
|
type: "select",
|