create-bodhi-js 0.8.0 → 0.10.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.
Files changed (2) hide show
  1. package/dist/index.js +42 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25,18 +25,23 @@ var TEMPLATE_FILES = [
25
25
  "playwright.config.ts",
26
26
  "CONTRIBUTING.md",
27
27
  "src/App.tsx",
28
+ "src/components/Header.tsx",
28
29
  ".github/SECURITY.md",
29
30
  ".github/ISSUE_TEMPLATE/config.yml",
30
31
  ".github/workflows/ci.yml",
31
32
  ".github/workflows/deploy-pages.yml"
32
33
  ];
33
34
  async function processTemplates(targetDir, vars) {
35
+ const mcpServers = vars.mcpServers ?? [];
36
+ const mcpBuilderCalls = mcpServers.map((url) => `
37
+ .addMcpServer('${url}')`).join("");
38
+ const templateVars = { ...vars, mcpBuilderCalls };
34
39
  for (const file of TEMPLATE_FILES) {
35
40
  const filePath = path.join(targetDir, file);
36
41
  try {
37
42
  const content = await fs.readFile(filePath, "utf-8");
38
43
  const template = Handlebars.compile(content);
39
- const rendered = template(vars);
44
+ const rendered = template(templateVars);
40
45
  await fs.writeFile(filePath, rendered, "utf-8");
41
46
  } catch (error) {
42
47
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
@@ -65,7 +70,8 @@ async function scaffold(options) {
65
70
  install,
66
71
  git,
67
72
  devClientId,
68
- prodClientId
73
+ prodClientId,
74
+ mcpServers
69
75
  } = options;
70
76
  const targetDir = path2.resolve(process.cwd(), projectName);
71
77
  try {
@@ -111,7 +117,8 @@ async function scaffold(options) {
111
117
  basePath,
112
118
  pathSegmentsToKeep,
113
119
  devClientId,
114
- prodClientId
120
+ prodClientId,
121
+ mcpServers
115
122
  });
116
123
  if (!githubPages) {
117
124
  const filesToDelete = [
@@ -200,6 +207,7 @@ Or use a local path: /path/to/template`
200
207
  }
201
208
 
202
209
  // src/cli.ts
210
+ var POPULAR_MCP_SERVERS = ["https://mcp.exa.ai/mcp", "https://mcp.deepwiki.com/mcp"];
203
211
  async function create(projectName, options) {
204
212
  if (options.ci) {
205
213
  process.env.CI = "true";
@@ -275,6 +283,34 @@ async function create(projectName, options) {
275
283
  } else {
276
284
  githubOrg = "YOUR_ORG";
277
285
  }
286
+ let mcpServers = [];
287
+ if (options.mcpServers) {
288
+ mcpServers = options.mcpServers.split(",").map((s) => s.trim()).filter(Boolean);
289
+ } else if (!options.ci) {
290
+ const presetResult = await p.multiselect({
291
+ message: "Select MCP servers to request access to:",
292
+ options: POPULAR_MCP_SERVERS.map((url) => ({ value: url, label: url })),
293
+ required: false
294
+ });
295
+ if (p.isCancel(presetResult)) {
296
+ p.cancel("Operation cancelled");
297
+ process.exit(0);
298
+ }
299
+ mcpServers = presetResult;
300
+ const customResult = await p.text({
301
+ message: "Additional MCP server URLs (comma-separated, blank to skip):",
302
+ placeholder: "https://mcp.example.com/mcp",
303
+ defaultValue: ""
304
+ });
305
+ if (p.isCancel(customResult)) {
306
+ p.cancel("Operation cancelled");
307
+ process.exit(0);
308
+ }
309
+ if (customResult) {
310
+ const customUrls = customResult.split(",").map((s) => s.trim()).filter(Boolean);
311
+ mcpServers = [...mcpServers, ...customUrls];
312
+ }
313
+ }
278
314
  const spinner2 = p.spinner();
279
315
  spinner2.start("Scaffolding project...");
280
316
  try {
@@ -288,7 +324,8 @@ async function create(projectName, options) {
288
324
  install: options.install,
289
325
  git: options.git,
290
326
  devClientId: options.devClientId,
291
- prodClientId: options.prodClientId
327
+ prodClientId: options.prodClientId,
328
+ mcpServers
292
329
  });
293
330
  spinner2.stop("Project scaffolded successfully!");
294
331
  p.note(
@@ -305,7 +342,7 @@ async function create(projectName, options) {
305
342
 
306
343
  // src/index.ts
307
344
  var program = new Command();
308
- program.name("create-bodhi-js").description("Scaffold Bodhi-powered applications").version("0.1.0").argument("[project-name]", "Name of the project").option("-t, --template <name>", "Template name or local path", "react").option("--no-install", "Skip dependency installation").option("--no-git", "Skip git initialization").option("--github-pages", "Enable GitHub Pages deployment setup").option("--no-github-pages", "Disable GitHub Pages deployment setup").option("--github-org <org>", "GitHub repository owner (user/org)").option("--dev-client-id <id>", "Development client ID (for .env.local and CI)").option("--prod-client-id <id>", "Production client ID (for GitHub Pages deploy)").option("--ci", "Run in CI mode (disable animations)").action(async (projectName, options) => {
345
+ program.name("create-bodhi-js").description("Scaffold Bodhi-powered applications").version("0.1.0").argument("[project-name]", "Name of the project").option("-t, --template <name>", "Template name or local path", "react").option("--no-install", "Skip dependency installation").option("--no-git", "Skip git initialization").option("--github-pages", "Enable GitHub Pages deployment setup").option("--no-github-pages", "Disable GitHub Pages deployment setup").option("--github-org <org>", "GitHub repository owner (user/org)").option("--dev-client-id <id>", "Development client ID (for .env.local and CI)").option("--prod-client-id <id>", "Production client ID (for GitHub Pages deploy)").option("--mcp-servers <urls>", "Comma-separated MCP server URLs to request access to").option("--ci", "Run in CI mode (disable animations)").action(async (projectName, options) => {
309
346
  await create(projectName, options);
310
347
  });
311
348
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bodhi-js",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Scaffold Bodhi-powered applications with React, TypeScript, Vite, and more",
5
5
  "type": "module",
6
6
  "bin": {