create-catalyst-app-internal 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/cli.cjs +30 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-catalyst-app-internal",
3
3
  "bin": "scripts/cli.cjs",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "description": "cli package to scaffold Catalyst application",
6
6
  "dependencies": {
7
7
  "commander": "^8.2.0",
package/scripts/cli.cjs CHANGED
@@ -44,7 +44,29 @@ const program = new Commander.Command()
44
44
  }
45
45
 
46
46
  if (process.argv.includes("mcp-setup")) {
47
- const setupPath = path.join(process.cwd(), "node_modules/catalyst-core/mcp_v2/setup.js")
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
+ }
48
70
  execSync(`node ${setupPath}`, { stdio: "inherit" })
49
71
  return
50
72
  }
@@ -125,7 +147,13 @@ const program = new Commander.Command()
125
147
  }
126
148
 
127
149
  if (mcpSupport) {
128
- execSync(` cd ${projectName} && node node_modules/catalyst-core/mcp_v2/setup.js`, { stdio: "inherit" })
150
+ const newMcpDir = path.join(process.cwd(), projectName, "node_modules/catalyst-core/mcp_v2")
151
+ const newMcpNodeModules = path.join(newMcpDir, "node_modules")
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" })
129
157
  }
130
158
 
131
159
  execSync(