@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.js +49 -0
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +49 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -0
- package/dist/index.mjs.map +1 -1
- package/dist/preview/preview-app.tsx +3 -0
- package/package.json +4 -3
- package/templates/default/.mcp.json +5 -1
- package/templates/default/CLAUDE.md +115 -12
package/dist/cli.js
CHANGED
|
@@ -1588,6 +1588,17 @@ async function initCommand(projectName, options = {}) {
|
|
|
1588
1588
|
author,
|
|
1589
1589
|
template
|
|
1590
1590
|
};
|
|
1591
|
+
let figmaApiKey = "";
|
|
1592
|
+
if (!options.yes) {
|
|
1593
|
+
const figmaAnswer = await inquirer__default.default.prompt([
|
|
1594
|
+
{
|
|
1595
|
+
type: "password",
|
|
1596
|
+
name: "figmaApiKey",
|
|
1597
|
+
message: "Figma API Key (optional, for Figma-to-code MCP \u2014 press Enter to skip):"
|
|
1598
|
+
}
|
|
1599
|
+
]);
|
|
1600
|
+
figmaApiKey = figmaAnswer.figmaApiKey || "";
|
|
1601
|
+
}
|
|
1591
1602
|
logger.startSpinner("Creating project structure...");
|
|
1592
1603
|
try {
|
|
1593
1604
|
fs2__default.default.mkdirSync(projectPath, { recursive: true });
|
|
@@ -1599,6 +1610,21 @@ async function initCommand(projectName, options = {}) {
|
|
|
1599
1610
|
description,
|
|
1600
1611
|
author
|
|
1601
1612
|
);
|
|
1613
|
+
const mcpJsonPath = path8__default.default.join(projectPath, ".mcp.json");
|
|
1614
|
+
if (fs2__default.default.existsSync(mcpJsonPath)) {
|
|
1615
|
+
let mcpContent = fs2__default.default.readFileSync(mcpJsonPath, "utf-8");
|
|
1616
|
+
if (figmaApiKey) {
|
|
1617
|
+
mcpContent = mcpContent.replace("__FIGMA_API_KEY__", figmaApiKey);
|
|
1618
|
+
} else {
|
|
1619
|
+
try {
|
|
1620
|
+
const mcpJson = JSON.parse(mcpContent);
|
|
1621
|
+
delete mcpJson.mcpServers.figma;
|
|
1622
|
+
mcpContent = JSON.stringify(mcpJson, null, 2) + "\n";
|
|
1623
|
+
} catch {
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
fs2__default.default.writeFileSync(mcpJsonPath, mcpContent, "utf-8");
|
|
1627
|
+
}
|
|
1602
1628
|
logger.stopSpinner(true, "Project structure created!");
|
|
1603
1629
|
if (options.git) {
|
|
1604
1630
|
logger.startSpinner("Initializing git repository...");
|
|
@@ -3862,6 +3888,29 @@ async function cloneCommand(themeName, options) {
|
|
|
3862
3888
|
].join("\n")
|
|
3863
3889
|
);
|
|
3864
3890
|
}
|
|
3891
|
+
const mcpJsonPath = path8__default.default.join(outputDir, ".mcp.json");
|
|
3892
|
+
if (await fs__default.default.pathExists(mcpJsonPath)) {
|
|
3893
|
+
const { default: inquirerMod } = await import('inquirer');
|
|
3894
|
+
const { figmaApiKey } = await inquirerMod.prompt([
|
|
3895
|
+
{
|
|
3896
|
+
type: "password",
|
|
3897
|
+
name: "figmaApiKey",
|
|
3898
|
+
message: "Figma API Key (optional, for Figma-to-code MCP \u2014 press Enter to skip):"
|
|
3899
|
+
}
|
|
3900
|
+
]);
|
|
3901
|
+
let mcpContent = await fs__default.default.readFile(mcpJsonPath, "utf-8");
|
|
3902
|
+
if (figmaApiKey) {
|
|
3903
|
+
mcpContent = mcpContent.replace("__FIGMA_API_KEY__", figmaApiKey);
|
|
3904
|
+
} else {
|
|
3905
|
+
try {
|
|
3906
|
+
const mcpJson = JSON.parse(mcpContent);
|
|
3907
|
+
delete mcpJson.mcpServers?.figma;
|
|
3908
|
+
mcpContent = JSON.stringify(mcpJson, null, 2) + "\n";
|
|
3909
|
+
} catch {
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
await fs__default.default.writeFile(mcpJsonPath, mcpContent, "utf-8");
|
|
3913
|
+
}
|
|
3865
3914
|
if (options.install !== false) {
|
|
3866
3915
|
const hasPkgJson = await fs__default.default.pathExists(
|
|
3867
3916
|
path8__default.default.join(outputDir, "package.json")
|