@onexapis/cli 1.1.22 → 1.1.25

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/cli.mjs CHANGED
@@ -1546,6 +1546,17 @@ async function initCommand(projectName, options = {}) {
1546
1546
  author,
1547
1547
  template
1548
1548
  };
1549
+ let figmaApiKey = "";
1550
+ if (!options.yes) {
1551
+ const figmaAnswer = await inquirer.prompt([
1552
+ {
1553
+ type: "password",
1554
+ name: "figmaApiKey",
1555
+ message: "Figma API Key (optional, for Figma-to-code MCP \u2014 press Enter to skip):"
1556
+ }
1557
+ ]);
1558
+ figmaApiKey = figmaAnswer.figmaApiKey || "";
1559
+ }
1549
1560
  logger.startSpinner("Creating project structure...");
1550
1561
  try {
1551
1562
  fs2.mkdirSync(projectPath, { recursive: true });
@@ -1557,6 +1568,21 @@ async function initCommand(projectName, options = {}) {
1557
1568
  description,
1558
1569
  author
1559
1570
  );
1571
+ const mcpJsonPath = path8.join(projectPath, ".mcp.json");
1572
+ if (fs2.existsSync(mcpJsonPath)) {
1573
+ let mcpContent = fs2.readFileSync(mcpJsonPath, "utf-8");
1574
+ if (figmaApiKey) {
1575
+ mcpContent = mcpContent.replace("__FIGMA_API_KEY__", figmaApiKey);
1576
+ } else {
1577
+ try {
1578
+ const mcpJson = JSON.parse(mcpContent);
1579
+ delete mcpJson.mcpServers.figma;
1580
+ mcpContent = JSON.stringify(mcpJson, null, 2) + "\n";
1581
+ } catch {
1582
+ }
1583
+ }
1584
+ fs2.writeFileSync(mcpJsonPath, mcpContent, "utf-8");
1585
+ }
1560
1586
  logger.stopSpinner(true, "Project structure created!");
1561
1587
  if (options.git) {
1562
1588
  logger.startSpinner("Initializing git repository...");
@@ -3820,6 +3846,29 @@ async function cloneCommand(themeName, options) {
3820
3846
  ].join("\n")
3821
3847
  );
3822
3848
  }
3849
+ const mcpJsonPath = path8.join(outputDir, ".mcp.json");
3850
+ if (await fs.pathExists(mcpJsonPath)) {
3851
+ const { default: inquirerMod } = await import('inquirer');
3852
+ const { figmaApiKey } = await inquirerMod.prompt([
3853
+ {
3854
+ type: "password",
3855
+ name: "figmaApiKey",
3856
+ message: "Figma API Key (optional, for Figma-to-code MCP \u2014 press Enter to skip):"
3857
+ }
3858
+ ]);
3859
+ let mcpContent = await fs.readFile(mcpJsonPath, "utf-8");
3860
+ if (figmaApiKey) {
3861
+ mcpContent = mcpContent.replace("__FIGMA_API_KEY__", figmaApiKey);
3862
+ } else {
3863
+ try {
3864
+ const mcpJson = JSON.parse(mcpContent);
3865
+ delete mcpJson.mcpServers?.figma;
3866
+ mcpContent = JSON.stringify(mcpJson, null, 2) + "\n";
3867
+ } catch {
3868
+ }
3869
+ }
3870
+ await fs.writeFile(mcpJsonPath, mcpContent, "utf-8");
3871
+ }
3823
3872
  if (options.install !== false) {
3824
3873
  const hasPkgJson = await fs.pathExists(
3825
3874
  path8.join(outputDir, "package.json")