@onexapis/cli 1.1.21 → 1.1.24
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/package.json +4 -3
- package/templates/default/.mcp.json +5 -1
- package/templates/default/CLAUDE.md +115 -12
package/dist/index.mjs
CHANGED
|
@@ -1568,6 +1568,17 @@ async function initCommand(projectName, options = {}) {
|
|
|
1568
1568
|
author,
|
|
1569
1569
|
template
|
|
1570
1570
|
};
|
|
1571
|
+
let figmaApiKey = "";
|
|
1572
|
+
if (!options.yes) {
|
|
1573
|
+
const figmaAnswer = await inquirer.prompt([
|
|
1574
|
+
{
|
|
1575
|
+
type: "password",
|
|
1576
|
+
name: "figmaApiKey",
|
|
1577
|
+
message: "Figma API Key (optional, for Figma-to-code MCP \u2014 press Enter to skip):"
|
|
1578
|
+
}
|
|
1579
|
+
]);
|
|
1580
|
+
figmaApiKey = figmaAnswer.figmaApiKey || "";
|
|
1581
|
+
}
|
|
1571
1582
|
logger.startSpinner("Creating project structure...");
|
|
1572
1583
|
try {
|
|
1573
1584
|
fs2.mkdirSync(projectPath, { recursive: true });
|
|
@@ -1579,6 +1590,21 @@ async function initCommand(projectName, options = {}) {
|
|
|
1579
1590
|
description,
|
|
1580
1591
|
author
|
|
1581
1592
|
);
|
|
1593
|
+
const mcpJsonPath = path7.join(projectPath, ".mcp.json");
|
|
1594
|
+
if (fs2.existsSync(mcpJsonPath)) {
|
|
1595
|
+
let mcpContent = fs2.readFileSync(mcpJsonPath, "utf-8");
|
|
1596
|
+
if (figmaApiKey) {
|
|
1597
|
+
mcpContent = mcpContent.replace("__FIGMA_API_KEY__", figmaApiKey);
|
|
1598
|
+
} else {
|
|
1599
|
+
try {
|
|
1600
|
+
const mcpJson = JSON.parse(mcpContent);
|
|
1601
|
+
delete mcpJson.mcpServers.figma;
|
|
1602
|
+
mcpContent = JSON.stringify(mcpJson, null, 2) + "\n";
|
|
1603
|
+
} catch {
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
fs2.writeFileSync(mcpJsonPath, mcpContent, "utf-8");
|
|
1607
|
+
}
|
|
1582
1608
|
logger.stopSpinner(true, "Project structure created!");
|
|
1583
1609
|
if (options.git) {
|
|
1584
1610
|
logger.startSpinner("Initializing git repository...");
|
|
@@ -3338,6 +3364,29 @@ async function cloneCommand(themeName, options) {
|
|
|
3338
3364
|
].join("\n")
|
|
3339
3365
|
);
|
|
3340
3366
|
}
|
|
3367
|
+
const mcpJsonPath = path7.join(outputDir, ".mcp.json");
|
|
3368
|
+
if (await fs.pathExists(mcpJsonPath)) {
|
|
3369
|
+
const { default: inquirerMod } = await import('inquirer');
|
|
3370
|
+
const { figmaApiKey } = await inquirerMod.prompt([
|
|
3371
|
+
{
|
|
3372
|
+
type: "password",
|
|
3373
|
+
name: "figmaApiKey",
|
|
3374
|
+
message: "Figma API Key (optional, for Figma-to-code MCP \u2014 press Enter to skip):"
|
|
3375
|
+
}
|
|
3376
|
+
]);
|
|
3377
|
+
let mcpContent = await fs.readFile(mcpJsonPath, "utf-8");
|
|
3378
|
+
if (figmaApiKey) {
|
|
3379
|
+
mcpContent = mcpContent.replace("__FIGMA_API_KEY__", figmaApiKey);
|
|
3380
|
+
} else {
|
|
3381
|
+
try {
|
|
3382
|
+
const mcpJson = JSON.parse(mcpContent);
|
|
3383
|
+
delete mcpJson.mcpServers?.figma;
|
|
3384
|
+
mcpContent = JSON.stringify(mcpJson, null, 2) + "\n";
|
|
3385
|
+
} catch {
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
await fs.writeFile(mcpJsonPath, mcpContent, "utf-8");
|
|
3389
|
+
}
|
|
3341
3390
|
if (options.install !== false) {
|
|
3342
3391
|
const hasPkgJson = await fs.pathExists(
|
|
3343
3392
|
path7.join(outputDir, "package.json")
|