cursor-kit-cli 1.4.0-beta → 1.5.0-beta
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/README.md +69 -27
- package/dist/cli.cjs +335 -129
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +334 -128
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1203,10 +1203,95 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
1203
1203
|
});
|
|
1204
1204
|
|
|
1205
1205
|
// src/commands/add.ts
|
|
1206
|
-
var
|
|
1206
|
+
var p4 = __toESM(require("@clack/prompts"), 1);
|
|
1207
1207
|
var import_citty2 = require("citty");
|
|
1208
1208
|
var import_node_path5 = require("path");
|
|
1209
1209
|
var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
1210
|
+
|
|
1211
|
+
// src/utils/target.ts
|
|
1212
|
+
var p3 = __toESM(require("@clack/prompts"), 1);
|
|
1213
|
+
var TARGET_CONFIGS = {
|
|
1214
|
+
cursor: {
|
|
1215
|
+
label: "Cursor",
|
|
1216
|
+
hint: ".cursor/ directory",
|
|
1217
|
+
commandsLabel: "commands",
|
|
1218
|
+
rulesLabel: "rules",
|
|
1219
|
+
rulesExtension: ".mdc",
|
|
1220
|
+
commandsExtension: ".md"
|
|
1221
|
+
},
|
|
1222
|
+
"github-copilot": {
|
|
1223
|
+
label: "GitHub Copilot",
|
|
1224
|
+
hint: ".github/copilot-instructions/ directory",
|
|
1225
|
+
commandsLabel: "commands",
|
|
1226
|
+
rulesLabel: "rules",
|
|
1227
|
+
rulesExtension: ".md",
|
|
1228
|
+
commandsExtension: ".md"
|
|
1229
|
+
},
|
|
1230
|
+
"google-antigravity": {
|
|
1231
|
+
label: "Google AntiGravity",
|
|
1232
|
+
hint: ".agent/ directory",
|
|
1233
|
+
commandsLabel: "workflows",
|
|
1234
|
+
rulesLabel: "rules",
|
|
1235
|
+
rulesExtension: ".md",
|
|
1236
|
+
commandsExtension: ".md"
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
async function promptTargetSelection2() {
|
|
1240
|
+
return await p3.select({
|
|
1241
|
+
message: "Which AI IDE are you targeting?",
|
|
1242
|
+
options: [
|
|
1243
|
+
{
|
|
1244
|
+
value: "cursor",
|
|
1245
|
+
label: "Cursor",
|
|
1246
|
+
hint: "Work with .cursor/ directory"
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
value: "github-copilot",
|
|
1250
|
+
label: "GitHub Copilot",
|
|
1251
|
+
hint: "Work with .github/copilot-instructions/"
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
value: "google-antigravity",
|
|
1255
|
+
label: "Google AntiGravity",
|
|
1256
|
+
hint: "Work with .agent/ directory"
|
|
1257
|
+
}
|
|
1258
|
+
],
|
|
1259
|
+
initialValue: "cursor"
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
function isValidTarget(value) {
|
|
1263
|
+
return value === "cursor" || value === "github-copilot" || value === "google-antigravity";
|
|
1264
|
+
}
|
|
1265
|
+
function getTargetDirectories(target, cwd = process.cwd()) {
|
|
1266
|
+
switch (target) {
|
|
1267
|
+
case "cursor":
|
|
1268
|
+
return {
|
|
1269
|
+
rootDir: getCursorDir(cwd),
|
|
1270
|
+
commandsDir: getCommandsDir(cwd),
|
|
1271
|
+
rulesDir: getRulesDir(cwd),
|
|
1272
|
+
skillsDir: getSkillsDir(cwd)
|
|
1273
|
+
};
|
|
1274
|
+
case "github-copilot":
|
|
1275
|
+
return {
|
|
1276
|
+
rootDir: getCopilotInstructionsDir(cwd),
|
|
1277
|
+
commandsDir: getCopilotCommandsDir(cwd),
|
|
1278
|
+
rulesDir: getCopilotRulesDir(cwd),
|
|
1279
|
+
skillsDir: getCopilotSkillsDir(cwd)
|
|
1280
|
+
};
|
|
1281
|
+
case "google-antigravity":
|
|
1282
|
+
return {
|
|
1283
|
+
rootDir: getAgentDir(cwd),
|
|
1284
|
+
commandsDir: getAgentWorkflowsDir(cwd),
|
|
1285
|
+
rulesDir: getAgentRulesDir(cwd),
|
|
1286
|
+
skillsDir: getAgentSkillsDir(cwd)
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
function getTargetConfig(target) {
|
|
1291
|
+
return TARGET_CONFIGS[target];
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
// src/commands/add.ts
|
|
1210
1295
|
var COMMAND_TEMPLATE = `You are a helpful assistant. Describe what this command does.
|
|
1211
1296
|
|
|
1212
1297
|
## Instructions
|
|
@@ -1289,22 +1374,39 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
1289
1374
|
type: "string",
|
|
1290
1375
|
alias: "n",
|
|
1291
1376
|
description: "Name of the command, rule, or skill"
|
|
1377
|
+
},
|
|
1378
|
+
target: {
|
|
1379
|
+
type: "string",
|
|
1380
|
+
description: "Target IDE: 'cursor', 'github-copilot', or 'google-antigravity'"
|
|
1292
1381
|
}
|
|
1293
1382
|
},
|
|
1294
1383
|
async run({ args }) {
|
|
1295
|
-
|
|
1384
|
+
p4.intro(import_picocolors4.default.bgCyan(import_picocolors4.default.black(" cursor-kit add ")));
|
|
1385
|
+
let target;
|
|
1386
|
+
if (isValidTarget(args.target)) {
|
|
1387
|
+
target = args.target;
|
|
1388
|
+
} else {
|
|
1389
|
+
const selection = await promptTargetSelection2();
|
|
1390
|
+
if (p4.isCancel(selection)) {
|
|
1391
|
+
p4.cancel("Operation cancelled");
|
|
1392
|
+
process.exit(0);
|
|
1393
|
+
}
|
|
1394
|
+
target = selection;
|
|
1395
|
+
}
|
|
1396
|
+
const targetConfig = getTargetConfig(target);
|
|
1397
|
+
const directories = getTargetDirectories(target);
|
|
1296
1398
|
let itemType;
|
|
1297
1399
|
let itemName;
|
|
1298
1400
|
if (args.type && ["command", "rule", "skill"].includes(args.type)) {
|
|
1299
1401
|
itemType = args.type;
|
|
1300
1402
|
} else {
|
|
1301
|
-
const typeResult = await
|
|
1403
|
+
const typeResult = await p4.select({
|
|
1302
1404
|
message: "What do you want to add?",
|
|
1303
1405
|
options: [
|
|
1304
1406
|
{
|
|
1305
1407
|
value: "command",
|
|
1306
|
-
label: "Command",
|
|
1307
|
-
hint: "A reusable prompt template"
|
|
1408
|
+
label: target === "google-antigravity" ? "Workflow" : "Command",
|
|
1409
|
+
hint: target === "google-antigravity" ? "A workflow template" : "A reusable prompt template"
|
|
1308
1410
|
},
|
|
1309
1411
|
{
|
|
1310
1412
|
value: "rule",
|
|
@@ -1318,17 +1420,18 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
1318
1420
|
}
|
|
1319
1421
|
]
|
|
1320
1422
|
});
|
|
1321
|
-
if (
|
|
1322
|
-
|
|
1423
|
+
if (p4.isCancel(typeResult)) {
|
|
1424
|
+
p4.cancel("Operation cancelled");
|
|
1323
1425
|
process.exit(0);
|
|
1324
1426
|
}
|
|
1325
1427
|
itemType = typeResult;
|
|
1326
1428
|
}
|
|
1429
|
+
const itemLabel = itemType === "command" ? targetConfig.commandsLabel : itemType;
|
|
1327
1430
|
if (args.name) {
|
|
1328
1431
|
itemName = args.name;
|
|
1329
1432
|
} else {
|
|
1330
|
-
const nameResult = await
|
|
1331
|
-
message: `Enter ${
|
|
1433
|
+
const nameResult = await p4.text({
|
|
1434
|
+
message: `Enter ${itemLabel} name:`,
|
|
1332
1435
|
placeholder: itemType === "command" ? "my-command" : itemType === "rule" ? "my-rule" : "my-skill",
|
|
1333
1436
|
validate: (value) => {
|
|
1334
1437
|
if (!value.trim()) return "Name is required";
|
|
@@ -1336,8 +1439,8 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
1336
1439
|
return void 0;
|
|
1337
1440
|
}
|
|
1338
1441
|
});
|
|
1339
|
-
if (
|
|
1340
|
-
|
|
1442
|
+
if (p4.isCancel(nameResult)) {
|
|
1443
|
+
p4.cancel("Operation cancelled");
|
|
1341
1444
|
process.exit(0);
|
|
1342
1445
|
}
|
|
1343
1446
|
itemName = nameResult;
|
|
@@ -1345,33 +1448,38 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
1345
1448
|
const slug = generateSlug(itemName);
|
|
1346
1449
|
const isCommand = itemType === "command";
|
|
1347
1450
|
const isSkill = itemType === "skill";
|
|
1451
|
+
const isRule = itemType === "rule";
|
|
1348
1452
|
let targetPath;
|
|
1349
1453
|
let displayPath;
|
|
1350
1454
|
if (isSkill) {
|
|
1351
|
-
|
|
1352
|
-
targetPath = (0, import_node_path5.join)(skillsDir, slug);
|
|
1455
|
+
targetPath = (0, import_node_path5.join)(directories.skillsDir, slug);
|
|
1353
1456
|
displayPath = targetPath;
|
|
1354
1457
|
} else {
|
|
1355
|
-
const targetDir = isCommand ?
|
|
1458
|
+
const targetDir = isCommand ? directories.commandsDir : directories.rulesDir;
|
|
1356
1459
|
const extension = ".md";
|
|
1357
1460
|
targetPath = (0, import_node_path5.join)(targetDir, `${slug}${extension}`);
|
|
1358
1461
|
displayPath = targetPath;
|
|
1359
1462
|
}
|
|
1360
|
-
const
|
|
1463
|
+
const getExpectedExtension = () => {
|
|
1464
|
+
if (isSkill) return "";
|
|
1465
|
+
if (isCommand) return targetConfig.commandsExtension;
|
|
1466
|
+
return targetConfig.rulesExtension;
|
|
1467
|
+
};
|
|
1468
|
+
const checkPath = isSkill ? targetPath : isCommand ? targetPath : (0, import_node_path5.join)(directories.rulesDir, `${slug}${getExpectedExtension()}`);
|
|
1361
1469
|
const exists = isSkill ? dirExists(targetPath) : fileExists(targetPath) || !isCommand && fileExists(checkPath);
|
|
1362
1470
|
if (exists) {
|
|
1363
|
-
const displayName = isSkill ? slug : isCommand ? `${slug}.md` : `${slug}
|
|
1364
|
-
const shouldOverwrite = await
|
|
1471
|
+
const displayName = isSkill ? slug : isCommand ? `${slug}.md` : `${slug}${getExpectedExtension()}`;
|
|
1472
|
+
const shouldOverwrite = await p4.confirm({
|
|
1365
1473
|
message: `${highlight(displayName)} already exists. Overwrite?`,
|
|
1366
1474
|
initialValue: false
|
|
1367
1475
|
});
|
|
1368
|
-
if (
|
|
1369
|
-
|
|
1476
|
+
if (p4.isCancel(shouldOverwrite) || !shouldOverwrite) {
|
|
1477
|
+
p4.cancel("Operation cancelled");
|
|
1370
1478
|
process.exit(0);
|
|
1371
1479
|
}
|
|
1372
1480
|
}
|
|
1373
|
-
const s =
|
|
1374
|
-
s.start(`Creating ${
|
|
1481
|
+
const s = p4.spinner();
|
|
1482
|
+
s.start(`Creating ${itemLabel}...`);
|
|
1375
1483
|
try {
|
|
1376
1484
|
if (isSkill) {
|
|
1377
1485
|
ensureDir(targetPath);
|
|
@@ -1379,42 +1487,48 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
1379
1487
|
const skillMdPath = (0, import_node_path5.join)(targetPath, "SKILL.md");
|
|
1380
1488
|
writeFile(skillMdPath, SKILL_TEMPLATE);
|
|
1381
1489
|
writeFile((0, import_node_path5.join)(targetPath, "references", "example.md"), SKILL_REFERENCE_TEMPLATE);
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1490
|
+
if (target === "cursor") {
|
|
1491
|
+
const skillMdcPath = (0, import_node_path5.join)(targetPath, "SKILL.mdc");
|
|
1492
|
+
const content = readFile(skillMdPath);
|
|
1493
|
+
writeFile(skillMdcPath, content);
|
|
1494
|
+
deleteFile(skillMdPath);
|
|
1495
|
+
}
|
|
1386
1496
|
} else {
|
|
1387
|
-
const targetDir = isCommand ?
|
|
1497
|
+
const targetDir = isCommand ? directories.commandsDir : directories.rulesDir;
|
|
1388
1498
|
ensureDir(targetDir);
|
|
1389
1499
|
const template = isCommand ? COMMAND_TEMPLATE : RULE_TEMPLATE;
|
|
1390
1500
|
if (isCommand) {
|
|
1391
1501
|
writeFile(targetPath, template);
|
|
1392
|
-
} else {
|
|
1502
|
+
} else if (isRule) {
|
|
1393
1503
|
writeFile(targetPath, template);
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1504
|
+
if (target === "cursor") {
|
|
1505
|
+
const mdcPath = (0, import_node_path5.join)(targetDir, convertMdToMdc(`${slug}.md`));
|
|
1506
|
+
const content = readFile(targetPath);
|
|
1507
|
+
writeFile(mdcPath, content);
|
|
1508
|
+
deleteFile(targetPath);
|
|
1509
|
+
}
|
|
1398
1510
|
}
|
|
1399
1511
|
}
|
|
1400
|
-
s.stop(`${
|
|
1512
|
+
s.stop(`${itemLabel.charAt(0).toUpperCase() + itemLabel.slice(1)} created`);
|
|
1401
1513
|
console.log();
|
|
1514
|
+
console.log(import_picocolors4.default.dim(" Target: ") + highlight(targetConfig.label));
|
|
1402
1515
|
if (isSkill) {
|
|
1403
1516
|
console.log(import_picocolors4.default.dim(" Directory: ") + highlight(displayPath));
|
|
1404
|
-
|
|
1517
|
+
const skillFileName = target === "cursor" ? "SKILL.mdc" : "SKILL.md";
|
|
1518
|
+
console.log(import_picocolors4.default.dim(" Main file: ") + highlight((0, import_node_path5.join)(displayPath, skillFileName)));
|
|
1405
1519
|
} else if (isCommand) {
|
|
1406
1520
|
console.log(import_picocolors4.default.dim(" File: ") + highlight(displayPath));
|
|
1407
1521
|
} else {
|
|
1408
|
-
const
|
|
1409
|
-
console.log(import_picocolors4.default.dim(" File: ") + highlight(
|
|
1522
|
+
const finalPath = target === "cursor" ? (0, import_node_path5.join)(directories.rulesDir, convertMdToMdc(`${slug}.md`)) : targetPath;
|
|
1523
|
+
console.log(import_picocolors4.default.dim(" File: ") + highlight(finalPath));
|
|
1410
1524
|
}
|
|
1411
1525
|
console.log();
|
|
1412
|
-
|
|
1413
|
-
import_picocolors4.default.green(`\u2728 ${
|
|
1526
|
+
p4.outro(
|
|
1527
|
+
import_picocolors4.default.green(`\u2728 ${itemLabel.charAt(0).toUpperCase() + itemLabel.slice(1)} created! Edit the file to customize it.`)
|
|
1414
1528
|
);
|
|
1415
1529
|
} catch (error) {
|
|
1416
1530
|
s.stop("Failed");
|
|
1417
|
-
|
|
1531
|
+
p4.cancel(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1418
1532
|
process.exit(1);
|
|
1419
1533
|
}
|
|
1420
1534
|
}
|
|
@@ -1422,9 +1536,57 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
1422
1536
|
|
|
1423
1537
|
// src/commands/pull.ts
|
|
1424
1538
|
var import_citty3 = require("citty");
|
|
1425
|
-
var
|
|
1539
|
+
var p5 = __toESM(require("@clack/prompts"), 1);
|
|
1426
1540
|
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
1427
1541
|
var import_giget = require("giget");
|
|
1542
|
+
var import_node_path6 = require("path");
|
|
1543
|
+
async function convertPulledFilesForTarget(target, directories) {
|
|
1544
|
+
const { commandsDir, rulesDir, skillsDir } = directories;
|
|
1545
|
+
if (target === "cursor") {
|
|
1546
|
+
const ruleFiles = listFiles(rulesDir, ".md");
|
|
1547
|
+
for (const file of ruleFiles) {
|
|
1548
|
+
const sourcePath = (0, import_node_path6.join)(rulesDir, file);
|
|
1549
|
+
const content = readFile(sourcePath);
|
|
1550
|
+
const mdcFilename = convertMdToMdc(file);
|
|
1551
|
+
const destPath = (0, import_node_path6.join)(rulesDir, mdcFilename);
|
|
1552
|
+
let transformedContent = content;
|
|
1553
|
+
if (file === "toc.md") {
|
|
1554
|
+
transformedContent = transformTocContentForCursor(content);
|
|
1555
|
+
}
|
|
1556
|
+
writeFile(destPath, transformedContent);
|
|
1557
|
+
const { rmSync: rmSync2 } = await import("fs");
|
|
1558
|
+
rmSync2(sourcePath);
|
|
1559
|
+
}
|
|
1560
|
+
const skillDirs = listDirs(skillsDir);
|
|
1561
|
+
for (const skillDir of skillDirs) {
|
|
1562
|
+
const skillPath = (0, import_node_path6.join)(skillsDir, skillDir);
|
|
1563
|
+
const skillMdPath = (0, import_node_path6.join)(skillPath, "SKILL.md");
|
|
1564
|
+
const skillMdcPath = (0, import_node_path6.join)(skillPath, "SKILL.mdc");
|
|
1565
|
+
const { existsSync: existsSync3 } = await import("fs");
|
|
1566
|
+
if (existsSync3(skillMdPath)) {
|
|
1567
|
+
const content = readFile(skillMdPath);
|
|
1568
|
+
writeFile(skillMdcPath, content);
|
|
1569
|
+
const { rmSync: rmSync2 } = await import("fs");
|
|
1570
|
+
rmSync2(skillMdPath);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
} else if (target === "google-antigravity") {
|
|
1574
|
+
const ruleFiles = listFiles(rulesDir, ".md");
|
|
1575
|
+
for (const file of ruleFiles) {
|
|
1576
|
+
const sourcePath = (0, import_node_path6.join)(rulesDir, file);
|
|
1577
|
+
const content = readFile(sourcePath);
|
|
1578
|
+
const transformedContent = transformRuleForAntiGravity(content, file);
|
|
1579
|
+
writeFile(sourcePath, transformedContent);
|
|
1580
|
+
}
|
|
1581
|
+
const commandFiles = listFiles(commandsDir, ".md");
|
|
1582
|
+
for (const file of commandFiles) {
|
|
1583
|
+
const sourcePath = (0, import_node_path6.join)(commandsDir, file);
|
|
1584
|
+
const content = readFile(sourcePath);
|
|
1585
|
+
const transformedContent = transformCommandToWorkflow(content, file);
|
|
1586
|
+
writeFile(sourcePath, transformedContent);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1428
1590
|
var pullCommand = (0, import_citty3.defineCommand)({
|
|
1429
1591
|
meta: {
|
|
1430
1592
|
name: "pull",
|
|
@@ -1454,6 +1616,11 @@ var pullCommand = (0, import_citty3.defineCommand)({
|
|
|
1454
1616
|
alias: "f",
|
|
1455
1617
|
description: "Force overwrite without confirmation",
|
|
1456
1618
|
default: false
|
|
1619
|
+
},
|
|
1620
|
+
target: {
|
|
1621
|
+
type: "string",
|
|
1622
|
+
alias: "t",
|
|
1623
|
+
description: "Target IDE: 'cursor', 'github-copilot', or 'google-antigravity'"
|
|
1457
1624
|
}
|
|
1458
1625
|
},
|
|
1459
1626
|
async run({ args }) {
|
|
@@ -1461,53 +1628,67 @@ var pullCommand = (0, import_citty3.defineCommand)({
|
|
|
1461
1628
|
const shouldPullCommands = pullAll || args.commands;
|
|
1462
1629
|
const shouldPullRules = pullAll || args.rules;
|
|
1463
1630
|
const shouldPullSkills = pullAll || args.skills;
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1631
|
+
p5.intro(import_picocolors5.default.bgCyan(import_picocolors5.default.black(" cursor-kit pull ")));
|
|
1632
|
+
let target;
|
|
1633
|
+
if (isValidTarget(args.target)) {
|
|
1634
|
+
target = args.target;
|
|
1635
|
+
} else {
|
|
1636
|
+
const selection = await promptTargetSelection2();
|
|
1637
|
+
if (p5.isCancel(selection)) {
|
|
1638
|
+
p5.cancel("Operation cancelled");
|
|
1639
|
+
process.exit(0);
|
|
1640
|
+
}
|
|
1641
|
+
target = selection;
|
|
1642
|
+
}
|
|
1643
|
+
const targetConfig = getTargetConfig(target);
|
|
1644
|
+
const directories = getTargetDirectories(target);
|
|
1645
|
+
const { rootDir, commandsDir, rulesDir, skillsDir } = directories;
|
|
1646
|
+
const rulesExtension = target === "cursor" ? ".mdc" : ".md";
|
|
1468
1647
|
const existingCommands = listFiles(commandsDir, ".md");
|
|
1469
|
-
const existingRules = listFiles(rulesDir,
|
|
1648
|
+
const existingRules = listFiles(rulesDir, rulesExtension);
|
|
1470
1649
|
const existingSkills = listDirs(skillsDir);
|
|
1471
1650
|
const hasExisting = existingCommands.length > 0 || existingRules.length > 0 || existingSkills.length > 0;
|
|
1651
|
+
console.log(import_picocolors5.default.dim(` Target: ${highlight(targetConfig.label)}`));
|
|
1652
|
+
console.log();
|
|
1472
1653
|
if (hasExisting && !args.force) {
|
|
1473
1654
|
printInfo("Current status:");
|
|
1474
1655
|
if (existingCommands.length > 0) {
|
|
1475
|
-
console.log(import_picocolors5.default.dim(`
|
|
1656
|
+
console.log(import_picocolors5.default.dim(` ${targetConfig.commandsLabel}: ${existingCommands.length} files`));
|
|
1476
1657
|
}
|
|
1477
1658
|
if (existingRules.length > 0) {
|
|
1478
|
-
console.log(import_picocolors5.default.dim(`
|
|
1659
|
+
console.log(import_picocolors5.default.dim(` ${targetConfig.rulesLabel}: ${existingRules.length} files`));
|
|
1479
1660
|
}
|
|
1480
1661
|
if (existingSkills.length > 0) {
|
|
1481
1662
|
console.log(import_picocolors5.default.dim(` Skills: ${existingSkills.length} directories`));
|
|
1482
1663
|
}
|
|
1483
1664
|
console.log();
|
|
1484
|
-
const shouldContinue = await
|
|
1665
|
+
const shouldContinue = await p5.confirm({
|
|
1485
1666
|
message: "This will merge with existing files. Continue?",
|
|
1486
1667
|
initialValue: true
|
|
1487
1668
|
});
|
|
1488
|
-
if (
|
|
1489
|
-
|
|
1669
|
+
if (p5.isCancel(shouldContinue) || !shouldContinue) {
|
|
1670
|
+
p5.cancel("Operation cancelled");
|
|
1490
1671
|
process.exit(0);
|
|
1491
1672
|
}
|
|
1492
1673
|
}
|
|
1493
|
-
const s =
|
|
1674
|
+
const s = p5.spinner();
|
|
1494
1675
|
try {
|
|
1495
|
-
ensureDir(
|
|
1676
|
+
ensureDir(rootDir);
|
|
1496
1677
|
if (shouldPullCommands) {
|
|
1497
|
-
s.start(
|
|
1678
|
+
s.start(`Pulling ${targetConfig.commandsLabel}...`);
|
|
1498
1679
|
await (0, import_giget.downloadTemplate)(`${REPO_URL}/templates/commands#${REPO_REF}`, {
|
|
1499
1680
|
dir: commandsDir,
|
|
1500
1681
|
force: true
|
|
1501
1682
|
});
|
|
1502
|
-
s.stop(
|
|
1683
|
+
s.stop(`${targetConfig.commandsLabel.charAt(0).toUpperCase() + targetConfig.commandsLabel.slice(1)} updated`);
|
|
1503
1684
|
}
|
|
1504
1685
|
if (shouldPullRules) {
|
|
1505
|
-
s.start(
|
|
1686
|
+
s.start(`Pulling ${targetConfig.rulesLabel}...`);
|
|
1506
1687
|
await (0, import_giget.downloadTemplate)(`${REPO_URL}/templates/rules#${REPO_REF}`, {
|
|
1507
1688
|
dir: rulesDir,
|
|
1508
1689
|
force: true
|
|
1509
1690
|
});
|
|
1510
|
-
s.stop(
|
|
1691
|
+
s.stop(`${targetConfig.rulesLabel.charAt(0).toUpperCase() + targetConfig.rulesLabel.slice(1)} updated`);
|
|
1511
1692
|
}
|
|
1512
1693
|
if (shouldPullSkills) {
|
|
1513
1694
|
s.start("Pulling skills...");
|
|
@@ -1517,21 +1698,27 @@ var pullCommand = (0, import_citty3.defineCommand)({
|
|
|
1517
1698
|
});
|
|
1518
1699
|
s.stop("Skills updated");
|
|
1519
1700
|
}
|
|
1701
|
+
if (target !== "github-copilot") {
|
|
1702
|
+
s.start("Converting files for target...");
|
|
1703
|
+
await convertPulledFilesForTarget(target, directories);
|
|
1704
|
+
s.stop("Files converted");
|
|
1705
|
+
}
|
|
1520
1706
|
printDivider();
|
|
1521
1707
|
console.log();
|
|
1708
|
+
const newRulesExtension = target === "cursor" ? ".mdc" : ".md";
|
|
1522
1709
|
const newCommands = listFiles(commandsDir, ".md");
|
|
1523
|
-
const newRules = listFiles(rulesDir,
|
|
1710
|
+
const newRules = listFiles(rulesDir, newRulesExtension);
|
|
1524
1711
|
const newSkills = listDirs(skillsDir);
|
|
1525
1712
|
if (shouldPullCommands) {
|
|
1526
1713
|
const added = newCommands.length - existingCommands.length;
|
|
1527
1714
|
printSuccess(
|
|
1528
|
-
|
|
1715
|
+
`${targetConfig.commandsLabel.charAt(0).toUpperCase() + targetConfig.commandsLabel.slice(1)}: ${highlight(newCommands.length.toString())} total` + (added > 0 ? import_picocolors5.default.green(` (+${added} new)`) : "")
|
|
1529
1716
|
);
|
|
1530
1717
|
}
|
|
1531
1718
|
if (shouldPullRules) {
|
|
1532
1719
|
const added = newRules.length - existingRules.length;
|
|
1533
1720
|
printSuccess(
|
|
1534
|
-
|
|
1721
|
+
`${targetConfig.rulesLabel.charAt(0).toUpperCase() + targetConfig.rulesLabel.slice(1)}: ${highlight(newRules.length.toString())} total` + (added > 0 ? import_picocolors5.default.green(` (+${added} new)`) : "")
|
|
1535
1722
|
);
|
|
1536
1723
|
}
|
|
1537
1724
|
if (shouldPullSkills) {
|
|
@@ -1541,19 +1728,19 @@ var pullCommand = (0, import_citty3.defineCommand)({
|
|
|
1541
1728
|
);
|
|
1542
1729
|
}
|
|
1543
1730
|
console.log();
|
|
1544
|
-
|
|
1731
|
+
p5.outro(import_picocolors5.default.green(`\u2728 Successfully pulled latest updates for ${targetConfig.label}!`));
|
|
1545
1732
|
} catch (error) {
|
|
1546
1733
|
s.stop("Failed");
|
|
1547
|
-
|
|
1734
|
+
p5.cancel(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1548
1735
|
process.exit(1);
|
|
1549
1736
|
}
|
|
1550
1737
|
}
|
|
1551
1738
|
});
|
|
1552
1739
|
|
|
1553
1740
|
// src/commands/list.ts
|
|
1554
|
-
var
|
|
1741
|
+
var p6 = __toESM(require("@clack/prompts"), 1);
|
|
1555
1742
|
var import_citty4 = require("citty");
|
|
1556
|
-
var
|
|
1743
|
+
var import_node_path7 = require("path");
|
|
1557
1744
|
var import_picocolors6 = __toESM(require("picocolors"), 1);
|
|
1558
1745
|
function extractDescription(content, isCommand) {
|
|
1559
1746
|
if (isCommand) {
|
|
@@ -1572,7 +1759,7 @@ function extractDescription(content, isCommand) {
|
|
|
1572
1759
|
function getItems(dir, extension, isCommand) {
|
|
1573
1760
|
const files = listFiles(dir, extension);
|
|
1574
1761
|
return files.map((file) => {
|
|
1575
|
-
const filePath = (0,
|
|
1762
|
+
const filePath = (0, import_node_path7.join)(dir, file);
|
|
1576
1763
|
const content = fileExists(filePath) ? readFile(filePath) : "";
|
|
1577
1764
|
return {
|
|
1578
1765
|
name: file.replace(extension, ""),
|
|
@@ -1584,9 +1771,9 @@ function getItems(dir, extension, isCommand) {
|
|
|
1584
1771
|
function getSkills(dir) {
|
|
1585
1772
|
const skillDirs = listDirs(dir);
|
|
1586
1773
|
return skillDirs.map((skillName) => {
|
|
1587
|
-
const skillPath = (0,
|
|
1588
|
-
const skillFile = (0,
|
|
1589
|
-
const altSkillFile = (0,
|
|
1774
|
+
const skillPath = (0, import_node_path7.join)(dir, skillName);
|
|
1775
|
+
const skillFile = (0, import_node_path7.join)(skillPath, "SKILL.mdc");
|
|
1776
|
+
const altSkillFile = (0, import_node_path7.join)(skillPath, "SKILL.md");
|
|
1590
1777
|
let description;
|
|
1591
1778
|
if (fileExists(skillFile)) {
|
|
1592
1779
|
const content = readFile(skillFile);
|
|
@@ -1638,7 +1825,7 @@ var listCommand = (0, import_citty4.defineCommand)({
|
|
|
1638
1825
|
const shouldListCommands = listAll || args.commands;
|
|
1639
1826
|
const shouldListRules = listAll || args.rules;
|
|
1640
1827
|
const shouldListSkills = listAll || args.skills;
|
|
1641
|
-
|
|
1828
|
+
p6.intro(import_picocolors6.default.bgCyan(import_picocolors6.default.black(" cursor-kit list ")));
|
|
1642
1829
|
const commandsDir = getCommandsDir();
|
|
1643
1830
|
const rulesDir = getRulesDir();
|
|
1644
1831
|
const skillsDir = getSkillsDir();
|
|
@@ -1652,7 +1839,7 @@ var listCommand = (0, import_citty4.defineCommand)({
|
|
|
1652
1839
|
import_picocolors6.default.dim(" Run ") + highlight("cursor-kit init") + import_picocolors6.default.dim(" to get started.")
|
|
1653
1840
|
);
|
|
1654
1841
|
console.log();
|
|
1655
|
-
|
|
1842
|
+
p6.outro(import_picocolors6.default.dim("Nothing to show"));
|
|
1656
1843
|
return;
|
|
1657
1844
|
}
|
|
1658
1845
|
printDivider();
|
|
@@ -1707,15 +1894,15 @@ var listCommand = (0, import_citty4.defineCommand)({
|
|
|
1707
1894
|
console.log();
|
|
1708
1895
|
printDivider();
|
|
1709
1896
|
const total = commands.length + rules.length + skills.length;
|
|
1710
|
-
|
|
1897
|
+
p6.outro(import_picocolors6.default.dim(`Total: ${total} item${total !== 1 ? "s" : ""}`));
|
|
1711
1898
|
}
|
|
1712
1899
|
});
|
|
1713
1900
|
|
|
1714
1901
|
// src/commands/remove.ts
|
|
1715
1902
|
var import_citty5 = require("citty");
|
|
1716
|
-
var
|
|
1903
|
+
var p7 = __toESM(require("@clack/prompts"), 1);
|
|
1717
1904
|
var import_picocolors7 = __toESM(require("picocolors"), 1);
|
|
1718
|
-
var
|
|
1905
|
+
var import_node_path8 = require("path");
|
|
1719
1906
|
var removeCommand = (0, import_citty5.defineCommand)({
|
|
1720
1907
|
meta: {
|
|
1721
1908
|
name: "remove",
|
|
@@ -1737,21 +1924,39 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1737
1924
|
alias: "f",
|
|
1738
1925
|
description: "Skip confirmation",
|
|
1739
1926
|
default: false
|
|
1927
|
+
},
|
|
1928
|
+
target: {
|
|
1929
|
+
type: "string",
|
|
1930
|
+
description: "Target IDE: 'cursor', 'github-copilot', or 'google-antigravity'"
|
|
1740
1931
|
}
|
|
1741
1932
|
},
|
|
1742
1933
|
async run({ args }) {
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1934
|
+
p7.intro(import_picocolors7.default.bgCyan(import_picocolors7.default.black(" cursor-kit remove ")));
|
|
1935
|
+
let target;
|
|
1936
|
+
if (isValidTarget(args.target)) {
|
|
1937
|
+
target = args.target;
|
|
1938
|
+
} else {
|
|
1939
|
+
const selection = await promptTargetSelection2();
|
|
1940
|
+
if (p7.isCancel(selection)) {
|
|
1941
|
+
p7.cancel("Operation cancelled");
|
|
1942
|
+
process.exit(0);
|
|
1943
|
+
}
|
|
1944
|
+
target = selection;
|
|
1945
|
+
}
|
|
1946
|
+
const targetConfig = getTargetConfig(target);
|
|
1947
|
+
const directories = getTargetDirectories(target);
|
|
1948
|
+
const { commandsDir, rulesDir, skillsDir } = directories;
|
|
1949
|
+
const rulesExtension = targetConfig.rulesExtension;
|
|
1747
1950
|
const commands = listFiles(commandsDir, ".md").map((f) => f.replace(".md", ""));
|
|
1748
|
-
const rules = listFiles(rulesDir,
|
|
1951
|
+
const rules = listFiles(rulesDir, rulesExtension).map((f) => f.replace(rulesExtension, ""));
|
|
1749
1952
|
const skills = listDirs(skillsDir);
|
|
1953
|
+
console.log(import_picocolors7.default.dim(` Target: ${highlight(targetConfig.label)}`));
|
|
1954
|
+
console.log();
|
|
1750
1955
|
if (commands.length === 0 && rules.length === 0 && skills.length === 0) {
|
|
1751
1956
|
console.log();
|
|
1752
|
-
console.log(import_picocolors7.default.yellow(
|
|
1957
|
+
console.log(import_picocolors7.default.yellow(` No ${targetConfig.commandsLabel}, ${targetConfig.rulesLabel}, or skills to remove.`));
|
|
1753
1958
|
console.log();
|
|
1754
|
-
|
|
1959
|
+
p7.outro(import_picocolors7.default.dim("Nothing to do"));
|
|
1755
1960
|
return;
|
|
1756
1961
|
}
|
|
1757
1962
|
let itemType;
|
|
@@ -1763,7 +1968,7 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1763
1968
|
if (commands.length > 0) {
|
|
1764
1969
|
typeOptions.push({
|
|
1765
1970
|
value: "command",
|
|
1766
|
-
label: "Command",
|
|
1971
|
+
label: target === "google-antigravity" ? "Workflow" : "Command",
|
|
1767
1972
|
hint: `${commands.length} available`
|
|
1768
1973
|
});
|
|
1769
1974
|
}
|
|
@@ -1781,12 +1986,12 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1781
1986
|
hint: `${skills.length} available`
|
|
1782
1987
|
});
|
|
1783
1988
|
}
|
|
1784
|
-
const typeResult = await
|
|
1989
|
+
const typeResult = await p7.select({
|
|
1785
1990
|
message: "What do you want to remove?",
|
|
1786
1991
|
options: typeOptions
|
|
1787
1992
|
});
|
|
1788
|
-
if (
|
|
1789
|
-
|
|
1993
|
+
if (p7.isCancel(typeResult)) {
|
|
1994
|
+
p7.cancel("Operation cancelled");
|
|
1790
1995
|
process.exit(0);
|
|
1791
1996
|
}
|
|
1792
1997
|
itemType = typeResult;
|
|
@@ -1796,9 +2001,10 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1796
2001
|
const isSkill = itemType === "skill";
|
|
1797
2002
|
const items = isCommand ? commands : isRule ? rules : skills;
|
|
1798
2003
|
const dir = isCommand ? commandsDir : isRule ? rulesDir : skillsDir;
|
|
1799
|
-
const extension = isCommand ? ".md" : isRule ?
|
|
2004
|
+
const extension = isCommand ? ".md" : isRule ? rulesExtension : "";
|
|
2005
|
+
const itemLabel = isCommand ? targetConfig.commandsLabel : itemType;
|
|
1800
2006
|
if (items.length === 0) {
|
|
1801
|
-
|
|
2007
|
+
p7.cancel(`No ${itemLabel}s found`);
|
|
1802
2008
|
process.exit(0);
|
|
1803
2009
|
}
|
|
1804
2010
|
if (args.name && items.includes(args.name)) {
|
|
@@ -1808,30 +2014,30 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1808
2014
|
value: item,
|
|
1809
2015
|
label: item
|
|
1810
2016
|
}));
|
|
1811
|
-
const nameResult = await
|
|
1812
|
-
message: `Select ${
|
|
2017
|
+
const nameResult = await p7.select({
|
|
2018
|
+
message: `Select ${itemLabel} to remove:`,
|
|
1813
2019
|
options: itemOptions
|
|
1814
2020
|
});
|
|
1815
|
-
if (
|
|
1816
|
-
|
|
2021
|
+
if (p7.isCancel(nameResult)) {
|
|
2022
|
+
p7.cancel("Operation cancelled");
|
|
1817
2023
|
process.exit(0);
|
|
1818
2024
|
}
|
|
1819
2025
|
itemName = nameResult;
|
|
1820
2026
|
}
|
|
1821
|
-
const targetPath = isSkill ? (0,
|
|
2027
|
+
const targetPath = isSkill ? (0, import_node_path8.join)(dir, itemName) : (0, import_node_path8.join)(dir, `${itemName}${extension}`);
|
|
1822
2028
|
const exists = isSkill ? dirExists(targetPath) : fileExists(targetPath);
|
|
1823
2029
|
if (!exists) {
|
|
1824
|
-
|
|
2030
|
+
p7.cancel(`${itemLabel} '${itemName}' not found`);
|
|
1825
2031
|
process.exit(1);
|
|
1826
2032
|
}
|
|
1827
2033
|
if (!args.force) {
|
|
1828
2034
|
const displayName = isSkill ? itemName : itemName + extension;
|
|
1829
|
-
const shouldDelete = await
|
|
2035
|
+
const shouldDelete = await p7.confirm({
|
|
1830
2036
|
message: `Are you sure you want to delete ${highlight(displayName)}?${isSkill ? " (This will remove the entire skill directory)" : ""}`,
|
|
1831
2037
|
initialValue: false
|
|
1832
2038
|
});
|
|
1833
|
-
if (
|
|
1834
|
-
|
|
2039
|
+
if (p7.isCancel(shouldDelete) || !shouldDelete) {
|
|
2040
|
+
p7.cancel("Operation cancelled");
|
|
1835
2041
|
process.exit(0);
|
|
1836
2042
|
}
|
|
1837
2043
|
}
|
|
@@ -1839,11 +2045,11 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1839
2045
|
removeFile(targetPath);
|
|
1840
2046
|
const displayName = isSkill ? itemName : itemName + extension;
|
|
1841
2047
|
console.log();
|
|
1842
|
-
printSuccess(`Removed ${highlight(displayName)}`);
|
|
2048
|
+
printSuccess(`Removed ${highlight(displayName)} from ${targetConfig.label}`);
|
|
1843
2049
|
console.log();
|
|
1844
|
-
|
|
2050
|
+
p7.outro(import_picocolors7.default.green("\u2728 Done!"));
|
|
1845
2051
|
} catch (error) {
|
|
1846
|
-
|
|
2052
|
+
p7.cancel(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1847
2053
|
process.exit(1);
|
|
1848
2054
|
}
|
|
1849
2055
|
}
|
|
@@ -1851,17 +2057,17 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1851
2057
|
|
|
1852
2058
|
// src/commands/instance.ts
|
|
1853
2059
|
var import_citty6 = require("citty");
|
|
1854
|
-
var
|
|
2060
|
+
var p8 = __toESM(require("@clack/prompts"), 1);
|
|
1855
2061
|
var import_picocolors8 = __toESM(require("picocolors"), 1);
|
|
1856
2062
|
var import_node_child_process = require("child_process");
|
|
1857
|
-
var
|
|
2063
|
+
var import_node_path9 = require("path");
|
|
1858
2064
|
var import_node_url2 = require("url");
|
|
1859
2065
|
var import_node_fs2 = require("fs");
|
|
1860
2066
|
function getBinPath() {
|
|
1861
|
-
const currentDir = (0,
|
|
2067
|
+
const currentDir = (0, import_node_path9.dirname)((0, import_node_url2.fileURLToPath)(importMetaUrl));
|
|
1862
2068
|
const possiblePaths = [
|
|
1863
|
-
(0,
|
|
1864
|
-
(0,
|
|
2069
|
+
(0, import_node_path9.join)(currentDir, "..", "..", "bin"),
|
|
2070
|
+
(0, import_node_path9.join)(currentDir, "..", "bin")
|
|
1865
2071
|
];
|
|
1866
2072
|
for (const binPath of possiblePaths) {
|
|
1867
2073
|
if ((0, import_node_fs2.existsSync)(binPath)) {
|
|
@@ -1877,13 +2083,13 @@ function ensureExecutable(scriptPath) {
|
|
|
1877
2083
|
}
|
|
1878
2084
|
}
|
|
1879
2085
|
function getExistingInstances() {
|
|
1880
|
-
const userAppsDir = (0,
|
|
2086
|
+
const userAppsDir = (0, import_node_path9.join)(process.env.HOME ?? "", "Applications");
|
|
1881
2087
|
if (!(0, import_node_fs2.existsSync)(userAppsDir)) return [];
|
|
1882
2088
|
try {
|
|
1883
2089
|
const apps = (0, import_node_fs2.readdirSync)(userAppsDir);
|
|
1884
2090
|
return apps.filter((app) => app.startsWith("Cursor") && app.endsWith(".app") && app !== "Cursor.app").map((app) => ({
|
|
1885
2091
|
name: app.replace(".app", ""),
|
|
1886
|
-
path: (0,
|
|
2092
|
+
path: (0, import_node_path9.join)(userAppsDir, app)
|
|
1887
2093
|
}));
|
|
1888
2094
|
} catch {
|
|
1889
2095
|
return [];
|
|
@@ -1927,13 +2133,13 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1927
2133
|
}
|
|
1928
2134
|
},
|
|
1929
2135
|
async run({ args }) {
|
|
1930
|
-
|
|
2136
|
+
p8.intro(import_picocolors8.default.bgCyan(import_picocolors8.default.black(" cursor-kit instance ")));
|
|
1931
2137
|
if (process.platform !== "darwin") {
|
|
1932
2138
|
console.log();
|
|
1933
2139
|
printWarning("This command only works on macOS.");
|
|
1934
2140
|
console.log(import_picocolors8.default.dim(" Cursor instance management requires macOS-specific features."));
|
|
1935
2141
|
console.log();
|
|
1936
|
-
|
|
2142
|
+
p8.outro(import_picocolors8.default.dim("Exiting"));
|
|
1937
2143
|
process.exit(1);
|
|
1938
2144
|
}
|
|
1939
2145
|
if (args.list) {
|
|
@@ -1953,15 +2159,15 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1953
2159
|
}
|
|
1954
2160
|
console.log();
|
|
1955
2161
|
printDivider();
|
|
1956
|
-
|
|
2162
|
+
p8.outro(import_picocolors8.default.dim(`Total: ${instances.length} instance${instances.length !== 1 ? "s" : ""}`));
|
|
1957
2163
|
return;
|
|
1958
2164
|
}
|
|
1959
|
-
const s =
|
|
2165
|
+
const s = p8.spinner();
|
|
1960
2166
|
s.start("Checking prerequisites...");
|
|
1961
2167
|
const binPath = getBinPath();
|
|
1962
|
-
const createScript = (0,
|
|
1963
|
-
const removeScript = (0,
|
|
1964
|
-
const reinstallScript = (0,
|
|
2168
|
+
const createScript = (0, import_node_path9.join)(binPath, "cursor-new-instance");
|
|
2169
|
+
const removeScript = (0, import_node_path9.join)(binPath, "cursor-remove-instance");
|
|
2170
|
+
const reinstallScript = (0, import_node_path9.join)(binPath, "cursor-reinstall-instance.sh");
|
|
1965
2171
|
const scriptsExist = (0, import_node_fs2.existsSync)(createScript) && (0, import_node_fs2.existsSync)(removeScript) && (0, import_node_fs2.existsSync)(reinstallScript);
|
|
1966
2172
|
if (!scriptsExist) {
|
|
1967
2173
|
s.stop("Prerequisites check failed");
|
|
@@ -1969,7 +2175,7 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1969
2175
|
printWarning("Required scripts not found.");
|
|
1970
2176
|
console.log(import_picocolors8.default.dim(` Expected at: ${binPath}`));
|
|
1971
2177
|
console.log();
|
|
1972
|
-
|
|
2178
|
+
p8.outro(import_picocolors8.default.red("Installation may be corrupted"));
|
|
1973
2179
|
process.exit(1);
|
|
1974
2180
|
}
|
|
1975
2181
|
const originalCursor = "/Applications/Cursor.app";
|
|
@@ -1979,7 +2185,7 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1979
2185
|
printWarning("Cursor.app not found in /Applications");
|
|
1980
2186
|
console.log(import_picocolors8.default.dim(" Please install Cursor IDE first."));
|
|
1981
2187
|
console.log();
|
|
1982
|
-
|
|
2188
|
+
p8.outro(import_picocolors8.default.red("Cursor IDE required"));
|
|
1983
2189
|
process.exit(1);
|
|
1984
2190
|
}
|
|
1985
2191
|
s.stop("Prerequisites verified");
|
|
@@ -1989,7 +2195,7 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1989
2195
|
if (args.action && ["create", "remove", "reinstall"].includes(args.action)) {
|
|
1990
2196
|
action = args.action;
|
|
1991
2197
|
} else {
|
|
1992
|
-
const actionResult = await
|
|
2198
|
+
const actionResult = await p8.select({
|
|
1993
2199
|
message: "What would you like to do?",
|
|
1994
2200
|
options: [
|
|
1995
2201
|
{
|
|
@@ -2009,8 +2215,8 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
2009
2215
|
}
|
|
2010
2216
|
]
|
|
2011
2217
|
});
|
|
2012
|
-
if (
|
|
2013
|
-
|
|
2218
|
+
if (p8.isCancel(actionResult)) {
|
|
2219
|
+
p8.cancel("Operation cancelled");
|
|
2014
2220
|
process.exit(0);
|
|
2015
2221
|
}
|
|
2016
2222
|
action = actionResult;
|
|
@@ -2019,7 +2225,7 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
2019
2225
|
instanceName = args.name;
|
|
2020
2226
|
} else if ((action === "remove" || action === "reinstall") && existingInstances.length > 0) {
|
|
2021
2227
|
const actionLabel2 = action === "remove" ? "remove" : "reinstall";
|
|
2022
|
-
const instanceResult = await
|
|
2228
|
+
const instanceResult = await p8.select({
|
|
2023
2229
|
message: `Select instance to ${actionLabel2}:`,
|
|
2024
2230
|
options: existingInstances.map((inst) => ({
|
|
2025
2231
|
value: inst.name,
|
|
@@ -2027,8 +2233,8 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
2027
2233
|
hint: inst.path
|
|
2028
2234
|
}))
|
|
2029
2235
|
});
|
|
2030
|
-
if (
|
|
2031
|
-
|
|
2236
|
+
if (p8.isCancel(instanceResult)) {
|
|
2237
|
+
p8.cancel("Operation cancelled");
|
|
2032
2238
|
process.exit(0);
|
|
2033
2239
|
}
|
|
2034
2240
|
instanceName = instanceResult;
|
|
@@ -2036,10 +2242,10 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
2036
2242
|
console.log();
|
|
2037
2243
|
printInfo(`No custom Cursor instances found to ${action}.`);
|
|
2038
2244
|
console.log();
|
|
2039
|
-
|
|
2245
|
+
p8.outro(import_picocolors8.default.dim("Nothing to do"));
|
|
2040
2246
|
return;
|
|
2041
2247
|
} else {
|
|
2042
|
-
const nameResult = await
|
|
2248
|
+
const nameResult = await p8.text({
|
|
2043
2249
|
message: "Enter a name for the new instance:",
|
|
2044
2250
|
placeholder: "Cursor Enterprise",
|
|
2045
2251
|
validate: (value) => {
|
|
@@ -2052,8 +2258,8 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
2052
2258
|
return void 0;
|
|
2053
2259
|
}
|
|
2054
2260
|
});
|
|
2055
|
-
if (
|
|
2056
|
-
|
|
2261
|
+
if (p8.isCancel(nameResult)) {
|
|
2262
|
+
p8.cancel("Operation cancelled");
|
|
2057
2263
|
process.exit(0);
|
|
2058
2264
|
}
|
|
2059
2265
|
instanceName = nameResult;
|
|
@@ -2071,22 +2277,22 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
2071
2277
|
console.log(` ${import_picocolors8.default.dim("Bundle ID:")} ${import_picocolors8.default.dim("com.cursor.")}${highlight(slug)}`);
|
|
2072
2278
|
console.log(` ${import_picocolors8.default.dim("Location:")} ${import_picocolors8.default.dim("~/Applications/")}${highlight(instanceName + ".app")}`);
|
|
2073
2279
|
if (action === "reinstall") {
|
|
2074
|
-
const dataDir = (0,
|
|
2280
|
+
const dataDir = (0, import_node_path9.join)(process.env.HOME ?? "", "Library", "Application Support", instanceName.replace(/ /g, ""));
|
|
2075
2281
|
console.log(` ${import_picocolors8.default.dim("Data:")} ${import_picocolors8.default.green("\u2713")} ${import_picocolors8.default.dim("Preserved at")} ${import_picocolors8.default.dim(dataDir)}`);
|
|
2076
2282
|
}
|
|
2077
2283
|
} else {
|
|
2078
|
-
const targetPath = (0,
|
|
2284
|
+
const targetPath = (0, import_node_path9.join)(process.env.HOME ?? "", "Applications", `${instanceName}.app`);
|
|
2079
2285
|
console.log(` ${import_picocolors8.default.dim("Path:")} ${import_picocolors8.default.dim(targetPath)}`);
|
|
2080
2286
|
}
|
|
2081
2287
|
console.log();
|
|
2082
2288
|
printDivider();
|
|
2083
2289
|
console.log();
|
|
2084
|
-
const shouldContinue = await
|
|
2290
|
+
const shouldContinue = await p8.confirm({
|
|
2085
2291
|
message: action === "create" ? "Create this Cursor instance?" : action === "reinstall" ? "Reinstall this instance? (User data will be preserved)" : "Remove this Cursor instance? This cannot be undone.",
|
|
2086
2292
|
initialValue: action !== "remove"
|
|
2087
2293
|
});
|
|
2088
|
-
if (
|
|
2089
|
-
|
|
2294
|
+
if (p8.isCancel(shouldContinue) || !shouldContinue) {
|
|
2295
|
+
p8.cancel("Operation cancelled");
|
|
2090
2296
|
process.exit(0);
|
|
2091
2297
|
}
|
|
2092
2298
|
console.log();
|
|
@@ -2117,11 +2323,11 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
2117
2323
|
printSuccess(`Instance ${highlight(instanceName)} removed successfully!`);
|
|
2118
2324
|
}
|
|
2119
2325
|
console.log();
|
|
2120
|
-
|
|
2326
|
+
p8.outro(import_picocolors8.default.green("\u2728 Done!"));
|
|
2121
2327
|
} else {
|
|
2122
2328
|
printWarning(`Operation completed with exit code ${exitCode}`);
|
|
2123
2329
|
console.log();
|
|
2124
|
-
|
|
2330
|
+
p8.outro(import_picocolors8.default.yellow("Check the output above for details"));
|
|
2125
2331
|
process.exit(exitCode);
|
|
2126
2332
|
}
|
|
2127
2333
|
}
|