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.js
CHANGED
|
@@ -1176,10 +1176,95 @@ var initCommand = defineCommand({
|
|
|
1176
1176
|
});
|
|
1177
1177
|
|
|
1178
1178
|
// src/commands/add.ts
|
|
1179
|
-
import * as
|
|
1179
|
+
import * as p4 from "@clack/prompts";
|
|
1180
1180
|
import { defineCommand as defineCommand2 } from "citty";
|
|
1181
1181
|
import { join as join5 } from "path";
|
|
1182
1182
|
import pc4 from "picocolors";
|
|
1183
|
+
|
|
1184
|
+
// src/utils/target.ts
|
|
1185
|
+
import * as p3 from "@clack/prompts";
|
|
1186
|
+
var TARGET_CONFIGS = {
|
|
1187
|
+
cursor: {
|
|
1188
|
+
label: "Cursor",
|
|
1189
|
+
hint: ".cursor/ directory",
|
|
1190
|
+
commandsLabel: "commands",
|
|
1191
|
+
rulesLabel: "rules",
|
|
1192
|
+
rulesExtension: ".mdc",
|
|
1193
|
+
commandsExtension: ".md"
|
|
1194
|
+
},
|
|
1195
|
+
"github-copilot": {
|
|
1196
|
+
label: "GitHub Copilot",
|
|
1197
|
+
hint: ".github/copilot-instructions/ directory",
|
|
1198
|
+
commandsLabel: "commands",
|
|
1199
|
+
rulesLabel: "rules",
|
|
1200
|
+
rulesExtension: ".md",
|
|
1201
|
+
commandsExtension: ".md"
|
|
1202
|
+
},
|
|
1203
|
+
"google-antigravity": {
|
|
1204
|
+
label: "Google AntiGravity",
|
|
1205
|
+
hint: ".agent/ directory",
|
|
1206
|
+
commandsLabel: "workflows",
|
|
1207
|
+
rulesLabel: "rules",
|
|
1208
|
+
rulesExtension: ".md",
|
|
1209
|
+
commandsExtension: ".md"
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
async function promptTargetSelection2() {
|
|
1213
|
+
return await p3.select({
|
|
1214
|
+
message: "Which AI IDE are you targeting?",
|
|
1215
|
+
options: [
|
|
1216
|
+
{
|
|
1217
|
+
value: "cursor",
|
|
1218
|
+
label: "Cursor",
|
|
1219
|
+
hint: "Work with .cursor/ directory"
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
value: "github-copilot",
|
|
1223
|
+
label: "GitHub Copilot",
|
|
1224
|
+
hint: "Work with .github/copilot-instructions/"
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
value: "google-antigravity",
|
|
1228
|
+
label: "Google AntiGravity",
|
|
1229
|
+
hint: "Work with .agent/ directory"
|
|
1230
|
+
}
|
|
1231
|
+
],
|
|
1232
|
+
initialValue: "cursor"
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
function isValidTarget(value) {
|
|
1236
|
+
return value === "cursor" || value === "github-copilot" || value === "google-antigravity";
|
|
1237
|
+
}
|
|
1238
|
+
function getTargetDirectories(target, cwd = process.cwd()) {
|
|
1239
|
+
switch (target) {
|
|
1240
|
+
case "cursor":
|
|
1241
|
+
return {
|
|
1242
|
+
rootDir: getCursorDir(cwd),
|
|
1243
|
+
commandsDir: getCommandsDir(cwd),
|
|
1244
|
+
rulesDir: getRulesDir(cwd),
|
|
1245
|
+
skillsDir: getSkillsDir(cwd)
|
|
1246
|
+
};
|
|
1247
|
+
case "github-copilot":
|
|
1248
|
+
return {
|
|
1249
|
+
rootDir: getCopilotInstructionsDir(cwd),
|
|
1250
|
+
commandsDir: getCopilotCommandsDir(cwd),
|
|
1251
|
+
rulesDir: getCopilotRulesDir(cwd),
|
|
1252
|
+
skillsDir: getCopilotSkillsDir(cwd)
|
|
1253
|
+
};
|
|
1254
|
+
case "google-antigravity":
|
|
1255
|
+
return {
|
|
1256
|
+
rootDir: getAgentDir(cwd),
|
|
1257
|
+
commandsDir: getAgentWorkflowsDir(cwd),
|
|
1258
|
+
rulesDir: getAgentRulesDir(cwd),
|
|
1259
|
+
skillsDir: getAgentSkillsDir(cwd)
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
function getTargetConfig(target) {
|
|
1264
|
+
return TARGET_CONFIGS[target];
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
// src/commands/add.ts
|
|
1183
1268
|
var COMMAND_TEMPLATE = `You are a helpful assistant. Describe what this command does.
|
|
1184
1269
|
|
|
1185
1270
|
## Instructions
|
|
@@ -1262,22 +1347,39 @@ var addCommand = defineCommand2({
|
|
|
1262
1347
|
type: "string",
|
|
1263
1348
|
alias: "n",
|
|
1264
1349
|
description: "Name of the command, rule, or skill"
|
|
1350
|
+
},
|
|
1351
|
+
target: {
|
|
1352
|
+
type: "string",
|
|
1353
|
+
description: "Target IDE: 'cursor', 'github-copilot', or 'google-antigravity'"
|
|
1265
1354
|
}
|
|
1266
1355
|
},
|
|
1267
1356
|
async run({ args }) {
|
|
1268
|
-
|
|
1357
|
+
p4.intro(pc4.bgCyan(pc4.black(" cursor-kit add ")));
|
|
1358
|
+
let target;
|
|
1359
|
+
if (isValidTarget(args.target)) {
|
|
1360
|
+
target = args.target;
|
|
1361
|
+
} else {
|
|
1362
|
+
const selection = await promptTargetSelection2();
|
|
1363
|
+
if (p4.isCancel(selection)) {
|
|
1364
|
+
p4.cancel("Operation cancelled");
|
|
1365
|
+
process.exit(0);
|
|
1366
|
+
}
|
|
1367
|
+
target = selection;
|
|
1368
|
+
}
|
|
1369
|
+
const targetConfig = getTargetConfig(target);
|
|
1370
|
+
const directories = getTargetDirectories(target);
|
|
1269
1371
|
let itemType;
|
|
1270
1372
|
let itemName;
|
|
1271
1373
|
if (args.type && ["command", "rule", "skill"].includes(args.type)) {
|
|
1272
1374
|
itemType = args.type;
|
|
1273
1375
|
} else {
|
|
1274
|
-
const typeResult = await
|
|
1376
|
+
const typeResult = await p4.select({
|
|
1275
1377
|
message: "What do you want to add?",
|
|
1276
1378
|
options: [
|
|
1277
1379
|
{
|
|
1278
1380
|
value: "command",
|
|
1279
|
-
label: "Command",
|
|
1280
|
-
hint: "A reusable prompt template"
|
|
1381
|
+
label: target === "google-antigravity" ? "Workflow" : "Command",
|
|
1382
|
+
hint: target === "google-antigravity" ? "A workflow template" : "A reusable prompt template"
|
|
1281
1383
|
},
|
|
1282
1384
|
{
|
|
1283
1385
|
value: "rule",
|
|
@@ -1291,17 +1393,18 @@ var addCommand = defineCommand2({
|
|
|
1291
1393
|
}
|
|
1292
1394
|
]
|
|
1293
1395
|
});
|
|
1294
|
-
if (
|
|
1295
|
-
|
|
1396
|
+
if (p4.isCancel(typeResult)) {
|
|
1397
|
+
p4.cancel("Operation cancelled");
|
|
1296
1398
|
process.exit(0);
|
|
1297
1399
|
}
|
|
1298
1400
|
itemType = typeResult;
|
|
1299
1401
|
}
|
|
1402
|
+
const itemLabel = itemType === "command" ? targetConfig.commandsLabel : itemType;
|
|
1300
1403
|
if (args.name) {
|
|
1301
1404
|
itemName = args.name;
|
|
1302
1405
|
} else {
|
|
1303
|
-
const nameResult = await
|
|
1304
|
-
message: `Enter ${
|
|
1406
|
+
const nameResult = await p4.text({
|
|
1407
|
+
message: `Enter ${itemLabel} name:`,
|
|
1305
1408
|
placeholder: itemType === "command" ? "my-command" : itemType === "rule" ? "my-rule" : "my-skill",
|
|
1306
1409
|
validate: (value) => {
|
|
1307
1410
|
if (!value.trim()) return "Name is required";
|
|
@@ -1309,8 +1412,8 @@ var addCommand = defineCommand2({
|
|
|
1309
1412
|
return void 0;
|
|
1310
1413
|
}
|
|
1311
1414
|
});
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1415
|
+
if (p4.isCancel(nameResult)) {
|
|
1416
|
+
p4.cancel("Operation cancelled");
|
|
1314
1417
|
process.exit(0);
|
|
1315
1418
|
}
|
|
1316
1419
|
itemName = nameResult;
|
|
@@ -1318,33 +1421,38 @@ var addCommand = defineCommand2({
|
|
|
1318
1421
|
const slug = generateSlug(itemName);
|
|
1319
1422
|
const isCommand = itemType === "command";
|
|
1320
1423
|
const isSkill = itemType === "skill";
|
|
1424
|
+
const isRule = itemType === "rule";
|
|
1321
1425
|
let targetPath;
|
|
1322
1426
|
let displayPath;
|
|
1323
1427
|
if (isSkill) {
|
|
1324
|
-
|
|
1325
|
-
targetPath = join5(skillsDir, slug);
|
|
1428
|
+
targetPath = join5(directories.skillsDir, slug);
|
|
1326
1429
|
displayPath = targetPath;
|
|
1327
1430
|
} else {
|
|
1328
|
-
const targetDir = isCommand ?
|
|
1431
|
+
const targetDir = isCommand ? directories.commandsDir : directories.rulesDir;
|
|
1329
1432
|
const extension = ".md";
|
|
1330
1433
|
targetPath = join5(targetDir, `${slug}${extension}`);
|
|
1331
1434
|
displayPath = targetPath;
|
|
1332
1435
|
}
|
|
1333
|
-
const
|
|
1436
|
+
const getExpectedExtension = () => {
|
|
1437
|
+
if (isSkill) return "";
|
|
1438
|
+
if (isCommand) return targetConfig.commandsExtension;
|
|
1439
|
+
return targetConfig.rulesExtension;
|
|
1440
|
+
};
|
|
1441
|
+
const checkPath = isSkill ? targetPath : isCommand ? targetPath : join5(directories.rulesDir, `${slug}${getExpectedExtension()}`);
|
|
1334
1442
|
const exists = isSkill ? dirExists(targetPath) : fileExists(targetPath) || !isCommand && fileExists(checkPath);
|
|
1335
1443
|
if (exists) {
|
|
1336
|
-
const displayName = isSkill ? slug : isCommand ? `${slug}.md` : `${slug}
|
|
1337
|
-
const shouldOverwrite = await
|
|
1444
|
+
const displayName = isSkill ? slug : isCommand ? `${slug}.md` : `${slug}${getExpectedExtension()}`;
|
|
1445
|
+
const shouldOverwrite = await p4.confirm({
|
|
1338
1446
|
message: `${highlight(displayName)} already exists. Overwrite?`,
|
|
1339
1447
|
initialValue: false
|
|
1340
1448
|
});
|
|
1341
|
-
if (
|
|
1342
|
-
|
|
1449
|
+
if (p4.isCancel(shouldOverwrite) || !shouldOverwrite) {
|
|
1450
|
+
p4.cancel("Operation cancelled");
|
|
1343
1451
|
process.exit(0);
|
|
1344
1452
|
}
|
|
1345
1453
|
}
|
|
1346
|
-
const s =
|
|
1347
|
-
s.start(`Creating ${
|
|
1454
|
+
const s = p4.spinner();
|
|
1455
|
+
s.start(`Creating ${itemLabel}...`);
|
|
1348
1456
|
try {
|
|
1349
1457
|
if (isSkill) {
|
|
1350
1458
|
ensureDir(targetPath);
|
|
@@ -1352,42 +1460,48 @@ var addCommand = defineCommand2({
|
|
|
1352
1460
|
const skillMdPath = join5(targetPath, "SKILL.md");
|
|
1353
1461
|
writeFile(skillMdPath, SKILL_TEMPLATE);
|
|
1354
1462
|
writeFile(join5(targetPath, "references", "example.md"), SKILL_REFERENCE_TEMPLATE);
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1463
|
+
if (target === "cursor") {
|
|
1464
|
+
const skillMdcPath = join5(targetPath, "SKILL.mdc");
|
|
1465
|
+
const content = readFile(skillMdPath);
|
|
1466
|
+
writeFile(skillMdcPath, content);
|
|
1467
|
+
deleteFile(skillMdPath);
|
|
1468
|
+
}
|
|
1359
1469
|
} else {
|
|
1360
|
-
const targetDir = isCommand ?
|
|
1470
|
+
const targetDir = isCommand ? directories.commandsDir : directories.rulesDir;
|
|
1361
1471
|
ensureDir(targetDir);
|
|
1362
1472
|
const template = isCommand ? COMMAND_TEMPLATE : RULE_TEMPLATE;
|
|
1363
1473
|
if (isCommand) {
|
|
1364
1474
|
writeFile(targetPath, template);
|
|
1365
|
-
} else {
|
|
1475
|
+
} else if (isRule) {
|
|
1366
1476
|
writeFile(targetPath, template);
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1477
|
+
if (target === "cursor") {
|
|
1478
|
+
const mdcPath = join5(targetDir, convertMdToMdc(`${slug}.md`));
|
|
1479
|
+
const content = readFile(targetPath);
|
|
1480
|
+
writeFile(mdcPath, content);
|
|
1481
|
+
deleteFile(targetPath);
|
|
1482
|
+
}
|
|
1371
1483
|
}
|
|
1372
1484
|
}
|
|
1373
|
-
s.stop(`${
|
|
1485
|
+
s.stop(`${itemLabel.charAt(0).toUpperCase() + itemLabel.slice(1)} created`);
|
|
1374
1486
|
console.log();
|
|
1487
|
+
console.log(pc4.dim(" Target: ") + highlight(targetConfig.label));
|
|
1375
1488
|
if (isSkill) {
|
|
1376
1489
|
console.log(pc4.dim(" Directory: ") + highlight(displayPath));
|
|
1377
|
-
|
|
1490
|
+
const skillFileName = target === "cursor" ? "SKILL.mdc" : "SKILL.md";
|
|
1491
|
+
console.log(pc4.dim(" Main file: ") + highlight(join5(displayPath, skillFileName)));
|
|
1378
1492
|
} else if (isCommand) {
|
|
1379
1493
|
console.log(pc4.dim(" File: ") + highlight(displayPath));
|
|
1380
1494
|
} else {
|
|
1381
|
-
const
|
|
1382
|
-
console.log(pc4.dim(" File: ") + highlight(
|
|
1495
|
+
const finalPath = target === "cursor" ? join5(directories.rulesDir, convertMdToMdc(`${slug}.md`)) : targetPath;
|
|
1496
|
+
console.log(pc4.dim(" File: ") + highlight(finalPath));
|
|
1383
1497
|
}
|
|
1384
1498
|
console.log();
|
|
1385
|
-
|
|
1386
|
-
pc4.green(`\u2728 ${
|
|
1499
|
+
p4.outro(
|
|
1500
|
+
pc4.green(`\u2728 ${itemLabel.charAt(0).toUpperCase() + itemLabel.slice(1)} created! Edit the file to customize it.`)
|
|
1387
1501
|
);
|
|
1388
1502
|
} catch (error) {
|
|
1389
1503
|
s.stop("Failed");
|
|
1390
|
-
|
|
1504
|
+
p4.cancel(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1391
1505
|
process.exit(1);
|
|
1392
1506
|
}
|
|
1393
1507
|
}
|
|
@@ -1395,9 +1509,57 @@ var addCommand = defineCommand2({
|
|
|
1395
1509
|
|
|
1396
1510
|
// src/commands/pull.ts
|
|
1397
1511
|
import { defineCommand as defineCommand3 } from "citty";
|
|
1398
|
-
import * as
|
|
1512
|
+
import * as p5 from "@clack/prompts";
|
|
1399
1513
|
import pc5 from "picocolors";
|
|
1400
1514
|
import { downloadTemplate } from "giget";
|
|
1515
|
+
import { join as join6 } from "path";
|
|
1516
|
+
async function convertPulledFilesForTarget(target, directories) {
|
|
1517
|
+
const { commandsDir, rulesDir, skillsDir } = directories;
|
|
1518
|
+
if (target === "cursor") {
|
|
1519
|
+
const ruleFiles = listFiles(rulesDir, ".md");
|
|
1520
|
+
for (const file of ruleFiles) {
|
|
1521
|
+
const sourcePath = join6(rulesDir, file);
|
|
1522
|
+
const content = readFile(sourcePath);
|
|
1523
|
+
const mdcFilename = convertMdToMdc(file);
|
|
1524
|
+
const destPath = join6(rulesDir, mdcFilename);
|
|
1525
|
+
let transformedContent = content;
|
|
1526
|
+
if (file === "toc.md") {
|
|
1527
|
+
transformedContent = transformTocContentForCursor(content);
|
|
1528
|
+
}
|
|
1529
|
+
writeFile(destPath, transformedContent);
|
|
1530
|
+
const { rmSync: rmSync2 } = await import("fs");
|
|
1531
|
+
rmSync2(sourcePath);
|
|
1532
|
+
}
|
|
1533
|
+
const skillDirs = listDirs(skillsDir);
|
|
1534
|
+
for (const skillDir of skillDirs) {
|
|
1535
|
+
const skillPath = join6(skillsDir, skillDir);
|
|
1536
|
+
const skillMdPath = join6(skillPath, "SKILL.md");
|
|
1537
|
+
const skillMdcPath = join6(skillPath, "SKILL.mdc");
|
|
1538
|
+
const { existsSync: existsSync3 } = await import("fs");
|
|
1539
|
+
if (existsSync3(skillMdPath)) {
|
|
1540
|
+
const content = readFile(skillMdPath);
|
|
1541
|
+
writeFile(skillMdcPath, content);
|
|
1542
|
+
const { rmSync: rmSync2 } = await import("fs");
|
|
1543
|
+
rmSync2(skillMdPath);
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
} else if (target === "google-antigravity") {
|
|
1547
|
+
const ruleFiles = listFiles(rulesDir, ".md");
|
|
1548
|
+
for (const file of ruleFiles) {
|
|
1549
|
+
const sourcePath = join6(rulesDir, file);
|
|
1550
|
+
const content = readFile(sourcePath);
|
|
1551
|
+
const transformedContent = transformRuleForAntiGravity(content, file);
|
|
1552
|
+
writeFile(sourcePath, transformedContent);
|
|
1553
|
+
}
|
|
1554
|
+
const commandFiles = listFiles(commandsDir, ".md");
|
|
1555
|
+
for (const file of commandFiles) {
|
|
1556
|
+
const sourcePath = join6(commandsDir, file);
|
|
1557
|
+
const content = readFile(sourcePath);
|
|
1558
|
+
const transformedContent = transformCommandToWorkflow(content, file);
|
|
1559
|
+
writeFile(sourcePath, transformedContent);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1401
1563
|
var pullCommand = defineCommand3({
|
|
1402
1564
|
meta: {
|
|
1403
1565
|
name: "pull",
|
|
@@ -1427,6 +1589,11 @@ var pullCommand = defineCommand3({
|
|
|
1427
1589
|
alias: "f",
|
|
1428
1590
|
description: "Force overwrite without confirmation",
|
|
1429
1591
|
default: false
|
|
1592
|
+
},
|
|
1593
|
+
target: {
|
|
1594
|
+
type: "string",
|
|
1595
|
+
alias: "t",
|
|
1596
|
+
description: "Target IDE: 'cursor', 'github-copilot', or 'google-antigravity'"
|
|
1430
1597
|
}
|
|
1431
1598
|
},
|
|
1432
1599
|
async run({ args }) {
|
|
@@ -1434,53 +1601,67 @@ var pullCommand = defineCommand3({
|
|
|
1434
1601
|
const shouldPullCommands = pullAll || args.commands;
|
|
1435
1602
|
const shouldPullRules = pullAll || args.rules;
|
|
1436
1603
|
const shouldPullSkills = pullAll || args.skills;
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1604
|
+
p5.intro(pc5.bgCyan(pc5.black(" cursor-kit pull ")));
|
|
1605
|
+
let target;
|
|
1606
|
+
if (isValidTarget(args.target)) {
|
|
1607
|
+
target = args.target;
|
|
1608
|
+
} else {
|
|
1609
|
+
const selection = await promptTargetSelection2();
|
|
1610
|
+
if (p5.isCancel(selection)) {
|
|
1611
|
+
p5.cancel("Operation cancelled");
|
|
1612
|
+
process.exit(0);
|
|
1613
|
+
}
|
|
1614
|
+
target = selection;
|
|
1615
|
+
}
|
|
1616
|
+
const targetConfig = getTargetConfig(target);
|
|
1617
|
+
const directories = getTargetDirectories(target);
|
|
1618
|
+
const { rootDir, commandsDir, rulesDir, skillsDir } = directories;
|
|
1619
|
+
const rulesExtension = target === "cursor" ? ".mdc" : ".md";
|
|
1441
1620
|
const existingCommands = listFiles(commandsDir, ".md");
|
|
1442
|
-
const existingRules = listFiles(rulesDir,
|
|
1621
|
+
const existingRules = listFiles(rulesDir, rulesExtension);
|
|
1443
1622
|
const existingSkills = listDirs(skillsDir);
|
|
1444
1623
|
const hasExisting = existingCommands.length > 0 || existingRules.length > 0 || existingSkills.length > 0;
|
|
1624
|
+
console.log(pc5.dim(` Target: ${highlight(targetConfig.label)}`));
|
|
1625
|
+
console.log();
|
|
1445
1626
|
if (hasExisting && !args.force) {
|
|
1446
1627
|
printInfo("Current status:");
|
|
1447
1628
|
if (existingCommands.length > 0) {
|
|
1448
|
-
console.log(pc5.dim(`
|
|
1629
|
+
console.log(pc5.dim(` ${targetConfig.commandsLabel}: ${existingCommands.length} files`));
|
|
1449
1630
|
}
|
|
1450
1631
|
if (existingRules.length > 0) {
|
|
1451
|
-
console.log(pc5.dim(`
|
|
1632
|
+
console.log(pc5.dim(` ${targetConfig.rulesLabel}: ${existingRules.length} files`));
|
|
1452
1633
|
}
|
|
1453
1634
|
if (existingSkills.length > 0) {
|
|
1454
1635
|
console.log(pc5.dim(` Skills: ${existingSkills.length} directories`));
|
|
1455
1636
|
}
|
|
1456
1637
|
console.log();
|
|
1457
|
-
const shouldContinue = await
|
|
1638
|
+
const shouldContinue = await p5.confirm({
|
|
1458
1639
|
message: "This will merge with existing files. Continue?",
|
|
1459
1640
|
initialValue: true
|
|
1460
1641
|
});
|
|
1461
|
-
if (
|
|
1462
|
-
|
|
1642
|
+
if (p5.isCancel(shouldContinue) || !shouldContinue) {
|
|
1643
|
+
p5.cancel("Operation cancelled");
|
|
1463
1644
|
process.exit(0);
|
|
1464
1645
|
}
|
|
1465
1646
|
}
|
|
1466
|
-
const s =
|
|
1647
|
+
const s = p5.spinner();
|
|
1467
1648
|
try {
|
|
1468
|
-
ensureDir(
|
|
1649
|
+
ensureDir(rootDir);
|
|
1469
1650
|
if (shouldPullCommands) {
|
|
1470
|
-
s.start(
|
|
1651
|
+
s.start(`Pulling ${targetConfig.commandsLabel}...`);
|
|
1471
1652
|
await downloadTemplate(`${REPO_URL}/templates/commands#${REPO_REF}`, {
|
|
1472
1653
|
dir: commandsDir,
|
|
1473
1654
|
force: true
|
|
1474
1655
|
});
|
|
1475
|
-
s.stop(
|
|
1656
|
+
s.stop(`${targetConfig.commandsLabel.charAt(0).toUpperCase() + targetConfig.commandsLabel.slice(1)} updated`);
|
|
1476
1657
|
}
|
|
1477
1658
|
if (shouldPullRules) {
|
|
1478
|
-
s.start(
|
|
1659
|
+
s.start(`Pulling ${targetConfig.rulesLabel}...`);
|
|
1479
1660
|
await downloadTemplate(`${REPO_URL}/templates/rules#${REPO_REF}`, {
|
|
1480
1661
|
dir: rulesDir,
|
|
1481
1662
|
force: true
|
|
1482
1663
|
});
|
|
1483
|
-
s.stop(
|
|
1664
|
+
s.stop(`${targetConfig.rulesLabel.charAt(0).toUpperCase() + targetConfig.rulesLabel.slice(1)} updated`);
|
|
1484
1665
|
}
|
|
1485
1666
|
if (shouldPullSkills) {
|
|
1486
1667
|
s.start("Pulling skills...");
|
|
@@ -1490,21 +1671,27 @@ var pullCommand = defineCommand3({
|
|
|
1490
1671
|
});
|
|
1491
1672
|
s.stop("Skills updated");
|
|
1492
1673
|
}
|
|
1674
|
+
if (target !== "github-copilot") {
|
|
1675
|
+
s.start("Converting files for target...");
|
|
1676
|
+
await convertPulledFilesForTarget(target, directories);
|
|
1677
|
+
s.stop("Files converted");
|
|
1678
|
+
}
|
|
1493
1679
|
printDivider();
|
|
1494
1680
|
console.log();
|
|
1681
|
+
const newRulesExtension = target === "cursor" ? ".mdc" : ".md";
|
|
1495
1682
|
const newCommands = listFiles(commandsDir, ".md");
|
|
1496
|
-
const newRules = listFiles(rulesDir,
|
|
1683
|
+
const newRules = listFiles(rulesDir, newRulesExtension);
|
|
1497
1684
|
const newSkills = listDirs(skillsDir);
|
|
1498
1685
|
if (shouldPullCommands) {
|
|
1499
1686
|
const added = newCommands.length - existingCommands.length;
|
|
1500
1687
|
printSuccess(
|
|
1501
|
-
|
|
1688
|
+
`${targetConfig.commandsLabel.charAt(0).toUpperCase() + targetConfig.commandsLabel.slice(1)}: ${highlight(newCommands.length.toString())} total` + (added > 0 ? pc5.green(` (+${added} new)`) : "")
|
|
1502
1689
|
);
|
|
1503
1690
|
}
|
|
1504
1691
|
if (shouldPullRules) {
|
|
1505
1692
|
const added = newRules.length - existingRules.length;
|
|
1506
1693
|
printSuccess(
|
|
1507
|
-
|
|
1694
|
+
`${targetConfig.rulesLabel.charAt(0).toUpperCase() + targetConfig.rulesLabel.slice(1)}: ${highlight(newRules.length.toString())} total` + (added > 0 ? pc5.green(` (+${added} new)`) : "")
|
|
1508
1695
|
);
|
|
1509
1696
|
}
|
|
1510
1697
|
if (shouldPullSkills) {
|
|
@@ -1514,19 +1701,19 @@ var pullCommand = defineCommand3({
|
|
|
1514
1701
|
);
|
|
1515
1702
|
}
|
|
1516
1703
|
console.log();
|
|
1517
|
-
|
|
1704
|
+
p5.outro(pc5.green(`\u2728 Successfully pulled latest updates for ${targetConfig.label}!`));
|
|
1518
1705
|
} catch (error) {
|
|
1519
1706
|
s.stop("Failed");
|
|
1520
|
-
|
|
1707
|
+
p5.cancel(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1521
1708
|
process.exit(1);
|
|
1522
1709
|
}
|
|
1523
1710
|
}
|
|
1524
1711
|
});
|
|
1525
1712
|
|
|
1526
1713
|
// src/commands/list.ts
|
|
1527
|
-
import * as
|
|
1714
|
+
import * as p6 from "@clack/prompts";
|
|
1528
1715
|
import { defineCommand as defineCommand4 } from "citty";
|
|
1529
|
-
import { join as
|
|
1716
|
+
import { join as join7 } from "path";
|
|
1530
1717
|
import pc6 from "picocolors";
|
|
1531
1718
|
function extractDescription(content, isCommand) {
|
|
1532
1719
|
if (isCommand) {
|
|
@@ -1545,7 +1732,7 @@ function extractDescription(content, isCommand) {
|
|
|
1545
1732
|
function getItems(dir, extension, isCommand) {
|
|
1546
1733
|
const files = listFiles(dir, extension);
|
|
1547
1734
|
return files.map((file) => {
|
|
1548
|
-
const filePath =
|
|
1735
|
+
const filePath = join7(dir, file);
|
|
1549
1736
|
const content = fileExists(filePath) ? readFile(filePath) : "";
|
|
1550
1737
|
return {
|
|
1551
1738
|
name: file.replace(extension, ""),
|
|
@@ -1557,9 +1744,9 @@ function getItems(dir, extension, isCommand) {
|
|
|
1557
1744
|
function getSkills(dir) {
|
|
1558
1745
|
const skillDirs = listDirs(dir);
|
|
1559
1746
|
return skillDirs.map((skillName) => {
|
|
1560
|
-
const skillPath =
|
|
1561
|
-
const skillFile =
|
|
1562
|
-
const altSkillFile =
|
|
1747
|
+
const skillPath = join7(dir, skillName);
|
|
1748
|
+
const skillFile = join7(skillPath, "SKILL.mdc");
|
|
1749
|
+
const altSkillFile = join7(skillPath, "SKILL.md");
|
|
1563
1750
|
let description;
|
|
1564
1751
|
if (fileExists(skillFile)) {
|
|
1565
1752
|
const content = readFile(skillFile);
|
|
@@ -1611,7 +1798,7 @@ var listCommand = defineCommand4({
|
|
|
1611
1798
|
const shouldListCommands = listAll || args.commands;
|
|
1612
1799
|
const shouldListRules = listAll || args.rules;
|
|
1613
1800
|
const shouldListSkills = listAll || args.skills;
|
|
1614
|
-
|
|
1801
|
+
p6.intro(pc6.bgCyan(pc6.black(" cursor-kit list ")));
|
|
1615
1802
|
const commandsDir = getCommandsDir();
|
|
1616
1803
|
const rulesDir = getRulesDir();
|
|
1617
1804
|
const skillsDir = getSkillsDir();
|
|
@@ -1625,7 +1812,7 @@ var listCommand = defineCommand4({
|
|
|
1625
1812
|
pc6.dim(" Run ") + highlight("cursor-kit init") + pc6.dim(" to get started.")
|
|
1626
1813
|
);
|
|
1627
1814
|
console.log();
|
|
1628
|
-
|
|
1815
|
+
p6.outro(pc6.dim("Nothing to show"));
|
|
1629
1816
|
return;
|
|
1630
1817
|
}
|
|
1631
1818
|
printDivider();
|
|
@@ -1680,15 +1867,15 @@ var listCommand = defineCommand4({
|
|
|
1680
1867
|
console.log();
|
|
1681
1868
|
printDivider();
|
|
1682
1869
|
const total = commands.length + rules.length + skills.length;
|
|
1683
|
-
|
|
1870
|
+
p6.outro(pc6.dim(`Total: ${total} item${total !== 1 ? "s" : ""}`));
|
|
1684
1871
|
}
|
|
1685
1872
|
});
|
|
1686
1873
|
|
|
1687
1874
|
// src/commands/remove.ts
|
|
1688
1875
|
import { defineCommand as defineCommand5 } from "citty";
|
|
1689
|
-
import * as
|
|
1876
|
+
import * as p7 from "@clack/prompts";
|
|
1690
1877
|
import pc7 from "picocolors";
|
|
1691
|
-
import { join as
|
|
1878
|
+
import { join as join8 } from "path";
|
|
1692
1879
|
var removeCommand = defineCommand5({
|
|
1693
1880
|
meta: {
|
|
1694
1881
|
name: "remove",
|
|
@@ -1710,21 +1897,39 @@ var removeCommand = defineCommand5({
|
|
|
1710
1897
|
alias: "f",
|
|
1711
1898
|
description: "Skip confirmation",
|
|
1712
1899
|
default: false
|
|
1900
|
+
},
|
|
1901
|
+
target: {
|
|
1902
|
+
type: "string",
|
|
1903
|
+
description: "Target IDE: 'cursor', 'github-copilot', or 'google-antigravity'"
|
|
1713
1904
|
}
|
|
1714
1905
|
},
|
|
1715
1906
|
async run({ args }) {
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1907
|
+
p7.intro(pc7.bgCyan(pc7.black(" cursor-kit remove ")));
|
|
1908
|
+
let target;
|
|
1909
|
+
if (isValidTarget(args.target)) {
|
|
1910
|
+
target = args.target;
|
|
1911
|
+
} else {
|
|
1912
|
+
const selection = await promptTargetSelection2();
|
|
1913
|
+
if (p7.isCancel(selection)) {
|
|
1914
|
+
p7.cancel("Operation cancelled");
|
|
1915
|
+
process.exit(0);
|
|
1916
|
+
}
|
|
1917
|
+
target = selection;
|
|
1918
|
+
}
|
|
1919
|
+
const targetConfig = getTargetConfig(target);
|
|
1920
|
+
const directories = getTargetDirectories(target);
|
|
1921
|
+
const { commandsDir, rulesDir, skillsDir } = directories;
|
|
1922
|
+
const rulesExtension = targetConfig.rulesExtension;
|
|
1720
1923
|
const commands = listFiles(commandsDir, ".md").map((f) => f.replace(".md", ""));
|
|
1721
|
-
const rules = listFiles(rulesDir,
|
|
1924
|
+
const rules = listFiles(rulesDir, rulesExtension).map((f) => f.replace(rulesExtension, ""));
|
|
1722
1925
|
const skills = listDirs(skillsDir);
|
|
1926
|
+
console.log(pc7.dim(` Target: ${highlight(targetConfig.label)}`));
|
|
1927
|
+
console.log();
|
|
1723
1928
|
if (commands.length === 0 && rules.length === 0 && skills.length === 0) {
|
|
1724
1929
|
console.log();
|
|
1725
|
-
console.log(pc7.yellow(
|
|
1930
|
+
console.log(pc7.yellow(` No ${targetConfig.commandsLabel}, ${targetConfig.rulesLabel}, or skills to remove.`));
|
|
1726
1931
|
console.log();
|
|
1727
|
-
|
|
1932
|
+
p7.outro(pc7.dim("Nothing to do"));
|
|
1728
1933
|
return;
|
|
1729
1934
|
}
|
|
1730
1935
|
let itemType;
|
|
@@ -1736,7 +1941,7 @@ var removeCommand = defineCommand5({
|
|
|
1736
1941
|
if (commands.length > 0) {
|
|
1737
1942
|
typeOptions.push({
|
|
1738
1943
|
value: "command",
|
|
1739
|
-
label: "Command",
|
|
1944
|
+
label: target === "google-antigravity" ? "Workflow" : "Command",
|
|
1740
1945
|
hint: `${commands.length} available`
|
|
1741
1946
|
});
|
|
1742
1947
|
}
|
|
@@ -1754,12 +1959,12 @@ var removeCommand = defineCommand5({
|
|
|
1754
1959
|
hint: `${skills.length} available`
|
|
1755
1960
|
});
|
|
1756
1961
|
}
|
|
1757
|
-
const typeResult = await
|
|
1962
|
+
const typeResult = await p7.select({
|
|
1758
1963
|
message: "What do you want to remove?",
|
|
1759
1964
|
options: typeOptions
|
|
1760
1965
|
});
|
|
1761
|
-
if (
|
|
1762
|
-
|
|
1966
|
+
if (p7.isCancel(typeResult)) {
|
|
1967
|
+
p7.cancel("Operation cancelled");
|
|
1763
1968
|
process.exit(0);
|
|
1764
1969
|
}
|
|
1765
1970
|
itemType = typeResult;
|
|
@@ -1769,9 +1974,10 @@ var removeCommand = defineCommand5({
|
|
|
1769
1974
|
const isSkill = itemType === "skill";
|
|
1770
1975
|
const items = isCommand ? commands : isRule ? rules : skills;
|
|
1771
1976
|
const dir = isCommand ? commandsDir : isRule ? rulesDir : skillsDir;
|
|
1772
|
-
const extension = isCommand ? ".md" : isRule ?
|
|
1977
|
+
const extension = isCommand ? ".md" : isRule ? rulesExtension : "";
|
|
1978
|
+
const itemLabel = isCommand ? targetConfig.commandsLabel : itemType;
|
|
1773
1979
|
if (items.length === 0) {
|
|
1774
|
-
|
|
1980
|
+
p7.cancel(`No ${itemLabel}s found`);
|
|
1775
1981
|
process.exit(0);
|
|
1776
1982
|
}
|
|
1777
1983
|
if (args.name && items.includes(args.name)) {
|
|
@@ -1781,30 +1987,30 @@ var removeCommand = defineCommand5({
|
|
|
1781
1987
|
value: item,
|
|
1782
1988
|
label: item
|
|
1783
1989
|
}));
|
|
1784
|
-
const nameResult = await
|
|
1785
|
-
message: `Select ${
|
|
1990
|
+
const nameResult = await p7.select({
|
|
1991
|
+
message: `Select ${itemLabel} to remove:`,
|
|
1786
1992
|
options: itemOptions
|
|
1787
1993
|
});
|
|
1788
|
-
if (
|
|
1789
|
-
|
|
1994
|
+
if (p7.isCancel(nameResult)) {
|
|
1995
|
+
p7.cancel("Operation cancelled");
|
|
1790
1996
|
process.exit(0);
|
|
1791
1997
|
}
|
|
1792
1998
|
itemName = nameResult;
|
|
1793
1999
|
}
|
|
1794
|
-
const targetPath = isSkill ?
|
|
2000
|
+
const targetPath = isSkill ? join8(dir, itemName) : join8(dir, `${itemName}${extension}`);
|
|
1795
2001
|
const exists = isSkill ? dirExists(targetPath) : fileExists(targetPath);
|
|
1796
2002
|
if (!exists) {
|
|
1797
|
-
|
|
2003
|
+
p7.cancel(`${itemLabel} '${itemName}' not found`);
|
|
1798
2004
|
process.exit(1);
|
|
1799
2005
|
}
|
|
1800
2006
|
if (!args.force) {
|
|
1801
2007
|
const displayName = isSkill ? itemName : itemName + extension;
|
|
1802
|
-
const shouldDelete = await
|
|
2008
|
+
const shouldDelete = await p7.confirm({
|
|
1803
2009
|
message: `Are you sure you want to delete ${highlight(displayName)}?${isSkill ? " (This will remove the entire skill directory)" : ""}`,
|
|
1804
2010
|
initialValue: false
|
|
1805
2011
|
});
|
|
1806
|
-
if (
|
|
1807
|
-
|
|
2012
|
+
if (p7.isCancel(shouldDelete) || !shouldDelete) {
|
|
2013
|
+
p7.cancel("Operation cancelled");
|
|
1808
2014
|
process.exit(0);
|
|
1809
2015
|
}
|
|
1810
2016
|
}
|
|
@@ -1812,11 +2018,11 @@ var removeCommand = defineCommand5({
|
|
|
1812
2018
|
removeFile(targetPath);
|
|
1813
2019
|
const displayName = isSkill ? itemName : itemName + extension;
|
|
1814
2020
|
console.log();
|
|
1815
|
-
printSuccess(`Removed ${highlight(displayName)}`);
|
|
2021
|
+
printSuccess(`Removed ${highlight(displayName)} from ${targetConfig.label}`);
|
|
1816
2022
|
console.log();
|
|
1817
|
-
|
|
2023
|
+
p7.outro(pc7.green("\u2728 Done!"));
|
|
1818
2024
|
} catch (error) {
|
|
1819
|
-
|
|
2025
|
+
p7.cancel(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1820
2026
|
process.exit(1);
|
|
1821
2027
|
}
|
|
1822
2028
|
}
|
|
@@ -1824,17 +2030,17 @@ var removeCommand = defineCommand5({
|
|
|
1824
2030
|
|
|
1825
2031
|
// src/commands/instance.ts
|
|
1826
2032
|
import { defineCommand as defineCommand6 } from "citty";
|
|
1827
|
-
import * as
|
|
2033
|
+
import * as p8 from "@clack/prompts";
|
|
1828
2034
|
import pc8 from "picocolors";
|
|
1829
2035
|
import { spawn } from "child_process";
|
|
1830
|
-
import { join as
|
|
2036
|
+
import { join as join9, dirname as dirname3 } from "path";
|
|
1831
2037
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1832
2038
|
import { existsSync as existsSync2, chmodSync, readdirSync as readdirSync2 } from "fs";
|
|
1833
2039
|
function getBinPath() {
|
|
1834
2040
|
const currentDir = dirname3(fileURLToPath2(import.meta.url));
|
|
1835
2041
|
const possiblePaths = [
|
|
1836
|
-
|
|
1837
|
-
|
|
2042
|
+
join9(currentDir, "..", "..", "bin"),
|
|
2043
|
+
join9(currentDir, "..", "bin")
|
|
1838
2044
|
];
|
|
1839
2045
|
for (const binPath of possiblePaths) {
|
|
1840
2046
|
if (existsSync2(binPath)) {
|
|
@@ -1850,13 +2056,13 @@ function ensureExecutable(scriptPath) {
|
|
|
1850
2056
|
}
|
|
1851
2057
|
}
|
|
1852
2058
|
function getExistingInstances() {
|
|
1853
|
-
const userAppsDir =
|
|
2059
|
+
const userAppsDir = join9(process.env.HOME ?? "", "Applications");
|
|
1854
2060
|
if (!existsSync2(userAppsDir)) return [];
|
|
1855
2061
|
try {
|
|
1856
2062
|
const apps = readdirSync2(userAppsDir);
|
|
1857
2063
|
return apps.filter((app) => app.startsWith("Cursor") && app.endsWith(".app") && app !== "Cursor.app").map((app) => ({
|
|
1858
2064
|
name: app.replace(".app", ""),
|
|
1859
|
-
path:
|
|
2065
|
+
path: join9(userAppsDir, app)
|
|
1860
2066
|
}));
|
|
1861
2067
|
} catch {
|
|
1862
2068
|
return [];
|
|
@@ -1900,13 +2106,13 @@ var instanceCommand = defineCommand6({
|
|
|
1900
2106
|
}
|
|
1901
2107
|
},
|
|
1902
2108
|
async run({ args }) {
|
|
1903
|
-
|
|
2109
|
+
p8.intro(pc8.bgCyan(pc8.black(" cursor-kit instance ")));
|
|
1904
2110
|
if (process.platform !== "darwin") {
|
|
1905
2111
|
console.log();
|
|
1906
2112
|
printWarning("This command only works on macOS.");
|
|
1907
2113
|
console.log(pc8.dim(" Cursor instance management requires macOS-specific features."));
|
|
1908
2114
|
console.log();
|
|
1909
|
-
|
|
2115
|
+
p8.outro(pc8.dim("Exiting"));
|
|
1910
2116
|
process.exit(1);
|
|
1911
2117
|
}
|
|
1912
2118
|
if (args.list) {
|
|
@@ -1926,15 +2132,15 @@ var instanceCommand = defineCommand6({
|
|
|
1926
2132
|
}
|
|
1927
2133
|
console.log();
|
|
1928
2134
|
printDivider();
|
|
1929
|
-
|
|
2135
|
+
p8.outro(pc8.dim(`Total: ${instances.length} instance${instances.length !== 1 ? "s" : ""}`));
|
|
1930
2136
|
return;
|
|
1931
2137
|
}
|
|
1932
|
-
const s =
|
|
2138
|
+
const s = p8.spinner();
|
|
1933
2139
|
s.start("Checking prerequisites...");
|
|
1934
2140
|
const binPath = getBinPath();
|
|
1935
|
-
const createScript =
|
|
1936
|
-
const removeScript =
|
|
1937
|
-
const reinstallScript =
|
|
2141
|
+
const createScript = join9(binPath, "cursor-new-instance");
|
|
2142
|
+
const removeScript = join9(binPath, "cursor-remove-instance");
|
|
2143
|
+
const reinstallScript = join9(binPath, "cursor-reinstall-instance.sh");
|
|
1938
2144
|
const scriptsExist = existsSync2(createScript) && existsSync2(removeScript) && existsSync2(reinstallScript);
|
|
1939
2145
|
if (!scriptsExist) {
|
|
1940
2146
|
s.stop("Prerequisites check failed");
|
|
@@ -1942,7 +2148,7 @@ var instanceCommand = defineCommand6({
|
|
|
1942
2148
|
printWarning("Required scripts not found.");
|
|
1943
2149
|
console.log(pc8.dim(` Expected at: ${binPath}`));
|
|
1944
2150
|
console.log();
|
|
1945
|
-
|
|
2151
|
+
p8.outro(pc8.red("Installation may be corrupted"));
|
|
1946
2152
|
process.exit(1);
|
|
1947
2153
|
}
|
|
1948
2154
|
const originalCursor = "/Applications/Cursor.app";
|
|
@@ -1952,7 +2158,7 @@ var instanceCommand = defineCommand6({
|
|
|
1952
2158
|
printWarning("Cursor.app not found in /Applications");
|
|
1953
2159
|
console.log(pc8.dim(" Please install Cursor IDE first."));
|
|
1954
2160
|
console.log();
|
|
1955
|
-
|
|
2161
|
+
p8.outro(pc8.red("Cursor IDE required"));
|
|
1956
2162
|
process.exit(1);
|
|
1957
2163
|
}
|
|
1958
2164
|
s.stop("Prerequisites verified");
|
|
@@ -1962,7 +2168,7 @@ var instanceCommand = defineCommand6({
|
|
|
1962
2168
|
if (args.action && ["create", "remove", "reinstall"].includes(args.action)) {
|
|
1963
2169
|
action = args.action;
|
|
1964
2170
|
} else {
|
|
1965
|
-
const actionResult = await
|
|
2171
|
+
const actionResult = await p8.select({
|
|
1966
2172
|
message: "What would you like to do?",
|
|
1967
2173
|
options: [
|
|
1968
2174
|
{
|
|
@@ -1982,8 +2188,8 @@ var instanceCommand = defineCommand6({
|
|
|
1982
2188
|
}
|
|
1983
2189
|
]
|
|
1984
2190
|
});
|
|
1985
|
-
if (
|
|
1986
|
-
|
|
2191
|
+
if (p8.isCancel(actionResult)) {
|
|
2192
|
+
p8.cancel("Operation cancelled");
|
|
1987
2193
|
process.exit(0);
|
|
1988
2194
|
}
|
|
1989
2195
|
action = actionResult;
|
|
@@ -1992,7 +2198,7 @@ var instanceCommand = defineCommand6({
|
|
|
1992
2198
|
instanceName = args.name;
|
|
1993
2199
|
} else if ((action === "remove" || action === "reinstall") && existingInstances.length > 0) {
|
|
1994
2200
|
const actionLabel2 = action === "remove" ? "remove" : "reinstall";
|
|
1995
|
-
const instanceResult = await
|
|
2201
|
+
const instanceResult = await p8.select({
|
|
1996
2202
|
message: `Select instance to ${actionLabel2}:`,
|
|
1997
2203
|
options: existingInstances.map((inst) => ({
|
|
1998
2204
|
value: inst.name,
|
|
@@ -2000,8 +2206,8 @@ var instanceCommand = defineCommand6({
|
|
|
2000
2206
|
hint: inst.path
|
|
2001
2207
|
}))
|
|
2002
2208
|
});
|
|
2003
|
-
if (
|
|
2004
|
-
|
|
2209
|
+
if (p8.isCancel(instanceResult)) {
|
|
2210
|
+
p8.cancel("Operation cancelled");
|
|
2005
2211
|
process.exit(0);
|
|
2006
2212
|
}
|
|
2007
2213
|
instanceName = instanceResult;
|
|
@@ -2009,10 +2215,10 @@ var instanceCommand = defineCommand6({
|
|
|
2009
2215
|
console.log();
|
|
2010
2216
|
printInfo(`No custom Cursor instances found to ${action}.`);
|
|
2011
2217
|
console.log();
|
|
2012
|
-
|
|
2218
|
+
p8.outro(pc8.dim("Nothing to do"));
|
|
2013
2219
|
return;
|
|
2014
2220
|
} else {
|
|
2015
|
-
const nameResult = await
|
|
2221
|
+
const nameResult = await p8.text({
|
|
2016
2222
|
message: "Enter a name for the new instance:",
|
|
2017
2223
|
placeholder: "Cursor Enterprise",
|
|
2018
2224
|
validate: (value) => {
|
|
@@ -2025,8 +2231,8 @@ var instanceCommand = defineCommand6({
|
|
|
2025
2231
|
return void 0;
|
|
2026
2232
|
}
|
|
2027
2233
|
});
|
|
2028
|
-
if (
|
|
2029
|
-
|
|
2234
|
+
if (p8.isCancel(nameResult)) {
|
|
2235
|
+
p8.cancel("Operation cancelled");
|
|
2030
2236
|
process.exit(0);
|
|
2031
2237
|
}
|
|
2032
2238
|
instanceName = nameResult;
|
|
@@ -2044,22 +2250,22 @@ var instanceCommand = defineCommand6({
|
|
|
2044
2250
|
console.log(` ${pc8.dim("Bundle ID:")} ${pc8.dim("com.cursor.")}${highlight(slug)}`);
|
|
2045
2251
|
console.log(` ${pc8.dim("Location:")} ${pc8.dim("~/Applications/")}${highlight(instanceName + ".app")}`);
|
|
2046
2252
|
if (action === "reinstall") {
|
|
2047
|
-
const dataDir =
|
|
2253
|
+
const dataDir = join9(process.env.HOME ?? "", "Library", "Application Support", instanceName.replace(/ /g, ""));
|
|
2048
2254
|
console.log(` ${pc8.dim("Data:")} ${pc8.green("\u2713")} ${pc8.dim("Preserved at")} ${pc8.dim(dataDir)}`);
|
|
2049
2255
|
}
|
|
2050
2256
|
} else {
|
|
2051
|
-
const targetPath =
|
|
2257
|
+
const targetPath = join9(process.env.HOME ?? "", "Applications", `${instanceName}.app`);
|
|
2052
2258
|
console.log(` ${pc8.dim("Path:")} ${pc8.dim(targetPath)}`);
|
|
2053
2259
|
}
|
|
2054
2260
|
console.log();
|
|
2055
2261
|
printDivider();
|
|
2056
2262
|
console.log();
|
|
2057
|
-
const shouldContinue = await
|
|
2263
|
+
const shouldContinue = await p8.confirm({
|
|
2058
2264
|
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.",
|
|
2059
2265
|
initialValue: action !== "remove"
|
|
2060
2266
|
});
|
|
2061
|
-
if (
|
|
2062
|
-
|
|
2267
|
+
if (p8.isCancel(shouldContinue) || !shouldContinue) {
|
|
2268
|
+
p8.cancel("Operation cancelled");
|
|
2063
2269
|
process.exit(0);
|
|
2064
2270
|
}
|
|
2065
2271
|
console.log();
|
|
@@ -2090,11 +2296,11 @@ var instanceCommand = defineCommand6({
|
|
|
2090
2296
|
printSuccess(`Instance ${highlight(instanceName)} removed successfully!`);
|
|
2091
2297
|
}
|
|
2092
2298
|
console.log();
|
|
2093
|
-
|
|
2299
|
+
p8.outro(pc8.green("\u2728 Done!"));
|
|
2094
2300
|
} else {
|
|
2095
2301
|
printWarning(`Operation completed with exit code ${exitCode}`);
|
|
2096
2302
|
console.log();
|
|
2097
|
-
|
|
2303
|
+
p8.outro(pc8.yellow("Check the output above for details"));
|
|
2098
2304
|
process.exit(exitCode);
|
|
2099
2305
|
}
|
|
2100
2306
|
}
|