cursor-kit-cli 1.2.1-beta → 1.3.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/dist/cli.cjs +508 -178
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +507 -177
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -72,9 +72,9 @@ function highlight(text3) {
|
|
|
72
72
|
|
|
73
73
|
// src/commands/init.ts
|
|
74
74
|
var import_citty = require("citty");
|
|
75
|
-
var
|
|
76
|
-
var
|
|
77
|
-
var
|
|
75
|
+
var p2 = __toESM(require("@clack/prompts"), 1);
|
|
76
|
+
var import_picocolors3 = __toESM(require("picocolors"), 1);
|
|
77
|
+
var import_node_path4 = require("path");
|
|
78
78
|
|
|
79
79
|
// src/utils/fs.ts
|
|
80
80
|
var import_node_fs = require("fs");
|
|
@@ -140,6 +140,29 @@ function getConflictingDirs(dir, dirs) {
|
|
|
140
140
|
if (!dirExists(dir)) return [];
|
|
141
141
|
return dirs.filter((d) => dirExists((0, import_node_path.join)(dir, d)));
|
|
142
142
|
}
|
|
143
|
+
function getGitHubDir(cwd = process.cwd()) {
|
|
144
|
+
return (0, import_node_path.join)(cwd, ".github");
|
|
145
|
+
}
|
|
146
|
+
function getCopilotInstructionsPath(cwd = process.cwd()) {
|
|
147
|
+
return (0, import_node_path.join)(getGitHubDir(cwd), "copilot-instructions.md");
|
|
148
|
+
}
|
|
149
|
+
function getCopilotInstructionsDir(cwd = process.cwd()) {
|
|
150
|
+
return (0, import_node_path.join)(getGitHubDir(cwd), "copilot-instructions");
|
|
151
|
+
}
|
|
152
|
+
function getCopilotCommandsDir(cwd = process.cwd()) {
|
|
153
|
+
return (0, import_node_path.join)(getCopilotInstructionsDir(cwd), "commands");
|
|
154
|
+
}
|
|
155
|
+
function getCopilotRulesDir(cwd = process.cwd()) {
|
|
156
|
+
return (0, import_node_path.join)(getCopilotInstructionsDir(cwd), "rules");
|
|
157
|
+
}
|
|
158
|
+
function getCopilotSkillsDir(cwd = process.cwd()) {
|
|
159
|
+
return (0, import_node_path.join)(getCopilotInstructionsDir(cwd), "skills");
|
|
160
|
+
}
|
|
161
|
+
function deleteFile(path) {
|
|
162
|
+
if (fileExists(path)) {
|
|
163
|
+
(0, import_node_fs.rmSync)(path);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
143
166
|
|
|
144
167
|
// src/utils/templates.ts
|
|
145
168
|
var import_node_path2 = require("path");
|
|
@@ -252,11 +275,290 @@ function getTemplateLabel(filename) {
|
|
|
252
275
|
function getSkillLabel(skillName) {
|
|
253
276
|
return skillName.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
254
277
|
}
|
|
278
|
+
function stripFrontmatter(content) {
|
|
279
|
+
const frontmatterRegex = /^---\n[\s\S]*?\n---\n/;
|
|
280
|
+
return content.replace(frontmatterRegex, "").trim();
|
|
281
|
+
}
|
|
282
|
+
function extractFrontmatter(content) {
|
|
283
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n/);
|
|
284
|
+
if (!frontmatterMatch) return {};
|
|
285
|
+
const frontmatter = frontmatterMatch[1];
|
|
286
|
+
const result = {};
|
|
287
|
+
for (const line of frontmatter.split("\n")) {
|
|
288
|
+
const match = line.match(/^(\w+):\s*(.+)$/);
|
|
289
|
+
if (match) {
|
|
290
|
+
const [, key, value] = match;
|
|
291
|
+
result[key] = value === "true" ? true : value === "false" ? false : value;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
296
|
+
function generateCopilotIndex(commands, rules, skills, alwaysApplyRules = []) {
|
|
297
|
+
let output = "# GitHub Copilot Custom Instructions\n\n";
|
|
298
|
+
output += "> Generated by cursor-kit-cli\n\n";
|
|
299
|
+
output += "This file provides instructions for GitHub Copilot. ";
|
|
300
|
+
output += "When working on tasks, read the relevant files from the `copilot-instructions/` directory as needed.\n\n";
|
|
301
|
+
if (alwaysApplyRules.length > 0) {
|
|
302
|
+
output += "## Rules Applied Automatically\n\n";
|
|
303
|
+
output += "The following rules are always applied. Read these files for context:\n\n";
|
|
304
|
+
for (const rule of alwaysApplyRules) {
|
|
305
|
+
const ruleName = rule.replace(/\.md$/, "");
|
|
306
|
+
output += `- **${ruleName}**: Read \`.github/copilot-instructions/rules/${rule}\` for guidelines
|
|
307
|
+
`;
|
|
308
|
+
}
|
|
309
|
+
output += "\n";
|
|
310
|
+
}
|
|
311
|
+
if (commands.length > 0) {
|
|
312
|
+
output += "## Commands\n\n";
|
|
313
|
+
output += "When the user requests a command, read the corresponding file:\n\n";
|
|
314
|
+
for (const cmd of commands) {
|
|
315
|
+
const cmdName = cmd.replace(/\.md$/, "");
|
|
316
|
+
output += `- **${cmdName}**: Read \`.github/copilot-instructions/commands/${cmd}\` when user requests "${cmdName}"
|
|
317
|
+
`;
|
|
318
|
+
}
|
|
319
|
+
output += "\n";
|
|
320
|
+
}
|
|
321
|
+
if (rules.length > 0) {
|
|
322
|
+
output += "## Rules\n\n";
|
|
323
|
+
output += "Apply these rules when relevant to the task. Read the files as needed:\n\n";
|
|
324
|
+
for (const rule of rules) {
|
|
325
|
+
const ruleName = rule.replace(/\.md$/, "");
|
|
326
|
+
output += `- **${ruleName}**: Read \`.github/copilot-instructions/rules/${rule}\` for ${ruleName} guidelines
|
|
327
|
+
`;
|
|
328
|
+
}
|
|
329
|
+
output += "\n";
|
|
330
|
+
}
|
|
331
|
+
if (skills.length > 0) {
|
|
332
|
+
output += "## Skills\n\n";
|
|
333
|
+
output += "These are comprehensive guides for specialized domains. Read the relevant skill when working in that domain:\n\n";
|
|
334
|
+
for (const skill of skills) {
|
|
335
|
+
output += `- **${skill}**: Read \`.github/copilot-instructions/skills/${skill}/SKILL.md\` when working on ${skill} tasks
|
|
336
|
+
`;
|
|
337
|
+
}
|
|
338
|
+
output += "\n";
|
|
339
|
+
}
|
|
340
|
+
output += "## Usage Guidelines\n\n";
|
|
341
|
+
output += "- **Don't read all files at once** - Only read files relevant to the current task\n";
|
|
342
|
+
output += "- **Commands**: Read command files when the user explicitly requests that command\n";
|
|
343
|
+
output += "- **Rules**: Reference rules when they apply to the current coding task\n";
|
|
344
|
+
output += "- **Skills**: Read skill files when working in that domain (e.g., frontend-development for React components)\n";
|
|
345
|
+
output += "- **Always Apply Rules**: These are automatically considered, but you can reference them for specific guidance\n\n";
|
|
346
|
+
return output;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// src/utils/copilot.ts
|
|
350
|
+
var import_node_path3 = require("path");
|
|
351
|
+
var p = __toESM(require("@clack/prompts"), 1);
|
|
352
|
+
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
353
|
+
async function installCopilotCommands(commandsDir, selectedCommands) {
|
|
354
|
+
if (selectedCommands.length === 0) return [];
|
|
355
|
+
ensureDir(commandsDir);
|
|
356
|
+
const commandsMap = await fetchMultipleTemplates("commands", selectedCommands);
|
|
357
|
+
const installed = [];
|
|
358
|
+
for (const [filename, content] of commandsMap) {
|
|
359
|
+
const cleanContent = stripFrontmatter(content);
|
|
360
|
+
const filePath = (0, import_node_path3.join)(commandsDir, filename);
|
|
361
|
+
writeFile(filePath, cleanContent);
|
|
362
|
+
installed.push(filename);
|
|
363
|
+
}
|
|
364
|
+
return installed;
|
|
365
|
+
}
|
|
366
|
+
async function installCopilotRules(rulesDir, selectedRules) {
|
|
367
|
+
if (selectedRules.length === 0) return { installed: [], alwaysApply: [] };
|
|
368
|
+
ensureDir(rulesDir);
|
|
369
|
+
const rulesMap = await fetchMultipleTemplates("rules", selectedRules);
|
|
370
|
+
const installed = [];
|
|
371
|
+
const alwaysApply = [];
|
|
372
|
+
for (const [filename, content] of rulesMap) {
|
|
373
|
+
const frontmatter = extractFrontmatter(content);
|
|
374
|
+
const cleanContent = stripFrontmatter(content);
|
|
375
|
+
const mdFilename = filename.replace(/\.mdc$/, ".md");
|
|
376
|
+
const filePath = (0, import_node_path3.join)(rulesDir, mdFilename);
|
|
377
|
+
writeFile(filePath, cleanContent);
|
|
378
|
+
installed.push(mdFilename);
|
|
379
|
+
if (frontmatter.alwaysApply) {
|
|
380
|
+
alwaysApply.push(mdFilename);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return { installed, alwaysApply };
|
|
384
|
+
}
|
|
385
|
+
async function installCopilotSkills(skillsDir, selectedSkills) {
|
|
386
|
+
if (selectedSkills.length === 0) return [];
|
|
387
|
+
ensureDir(skillsDir);
|
|
388
|
+
const installed = [];
|
|
389
|
+
for (const skillName of selectedSkills) {
|
|
390
|
+
const success = copyLocalSkill(skillName, skillsDir);
|
|
391
|
+
if (!success) continue;
|
|
392
|
+
const skillTargetDir = (0, import_node_path3.join)(skillsDir, skillName);
|
|
393
|
+
const skillMdcPath = (0, import_node_path3.join)(skillTargetDir, "SKILL.mdc");
|
|
394
|
+
const skillMdPath = (0, import_node_path3.join)(skillTargetDir, "SKILL.md");
|
|
395
|
+
if (fileExists(skillMdcPath)) {
|
|
396
|
+
const content = readFile(skillMdcPath);
|
|
397
|
+
const cleanContent = stripFrontmatter(content);
|
|
398
|
+
writeFile(skillMdPath, cleanContent);
|
|
399
|
+
deleteFile(skillMdcPath);
|
|
400
|
+
}
|
|
401
|
+
installed.push(skillName);
|
|
402
|
+
}
|
|
403
|
+
return installed;
|
|
404
|
+
}
|
|
405
|
+
async function checkCopilotConflicts(cwd, force) {
|
|
406
|
+
const copilotDir = getCopilotInstructionsDir(cwd);
|
|
407
|
+
const copilotIndexPath = getCopilotInstructionsPath(cwd);
|
|
408
|
+
const hasExistingDir = dirExists(copilotDir);
|
|
409
|
+
const hasExistingIndex = fileExists(copilotIndexPath);
|
|
410
|
+
if ((hasExistingDir || hasExistingIndex) && !force) {
|
|
411
|
+
const overwrite = await p.confirm({
|
|
412
|
+
message: "GitHub Copilot instructions already exist. Overwrite?",
|
|
413
|
+
initialValue: false
|
|
414
|
+
});
|
|
415
|
+
if (p.isCancel(overwrite) || !overwrite) {
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return true;
|
|
420
|
+
}
|
|
421
|
+
async function installCopilotInstructions(cwd, selectedCommands, selectedRules, selectedSkills) {
|
|
422
|
+
const commandsDir = getCopilotCommandsDir(cwd);
|
|
423
|
+
const rulesDir = getCopilotRulesDir(cwd);
|
|
424
|
+
const skillsDir = getCopilotSkillsDir(cwd);
|
|
425
|
+
const copilotIndexPath = getCopilotInstructionsPath(cwd);
|
|
426
|
+
const [installedCommands, rulesResult, installedSkills] = await Promise.all([
|
|
427
|
+
installCopilotCommands(commandsDir, selectedCommands),
|
|
428
|
+
installCopilotRules(rulesDir, selectedRules),
|
|
429
|
+
installCopilotSkills(skillsDir, selectedSkills)
|
|
430
|
+
]);
|
|
431
|
+
const installedRules = rulesResult.installed;
|
|
432
|
+
const alwaysApplyRules = rulesResult.alwaysApply;
|
|
433
|
+
const indexContent = generateCopilotIndex(
|
|
434
|
+
installedCommands,
|
|
435
|
+
installedRules,
|
|
436
|
+
installedSkills,
|
|
437
|
+
alwaysApplyRules
|
|
438
|
+
);
|
|
439
|
+
writeFile(copilotIndexPath, indexContent);
|
|
440
|
+
printSuccess(`GitHub Copilot instructions generated`);
|
|
441
|
+
console.log(import_picocolors2.default.dim(` \u2514\u2500 ${copilotIndexPath}`));
|
|
442
|
+
console.log(import_picocolors2.default.dim(` \u2514\u2500 ${getCopilotInstructionsDir(cwd)}/`));
|
|
443
|
+
return {
|
|
444
|
+
commands: installedCommands,
|
|
445
|
+
rules: installedRules.map((r) => r.replace(/\.md$/, "")),
|
|
446
|
+
skills: installedSkills,
|
|
447
|
+
alwaysApplyRules
|
|
448
|
+
};
|
|
449
|
+
}
|
|
255
450
|
|
|
256
451
|
// src/commands/init.ts
|
|
452
|
+
async function promptTargetSelection() {
|
|
453
|
+
return await p2.select({
|
|
454
|
+
message: "Which AI IDE are you using?",
|
|
455
|
+
options: [
|
|
456
|
+
{
|
|
457
|
+
value: "cursor",
|
|
458
|
+
label: "Cursor",
|
|
459
|
+
hint: "Generate .cursor/ directory structure"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
value: "github-copilot",
|
|
463
|
+
label: "GitHub Copilot",
|
|
464
|
+
hint: "Generate .github/copilot-instructions.md"
|
|
465
|
+
}
|
|
466
|
+
],
|
|
467
|
+
initialValue: "cursor"
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
async function handleCopilotInstallation(cwd, manifest, args, shouldInitCommands, shouldInitRules, shouldInitSkills) {
|
|
471
|
+
const s = p2.spinner();
|
|
472
|
+
const canProceed = await checkCopilotConflicts(cwd, args.force ?? false);
|
|
473
|
+
if (!canProceed) {
|
|
474
|
+
p2.cancel("Operation cancelled");
|
|
475
|
+
process.exit(0);
|
|
476
|
+
}
|
|
477
|
+
let selectedCommands = [];
|
|
478
|
+
let selectedRules = [];
|
|
479
|
+
let selectedSkills = [];
|
|
480
|
+
if (shouldInitCommands) {
|
|
481
|
+
if (args.all) {
|
|
482
|
+
selectedCommands = manifest.commands;
|
|
483
|
+
} else {
|
|
484
|
+
const selection = await selectTemplates("commands", manifest.commands);
|
|
485
|
+
if (p2.isCancel(selection)) {
|
|
486
|
+
p2.cancel("Operation cancelled");
|
|
487
|
+
process.exit(0);
|
|
488
|
+
}
|
|
489
|
+
selectedCommands = selection;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
if (shouldInitRules) {
|
|
493
|
+
if (args.all) {
|
|
494
|
+
selectedRules = manifest.rules;
|
|
495
|
+
} else {
|
|
496
|
+
const selection = await selectTemplates("rules", manifest.rules);
|
|
497
|
+
if (p2.isCancel(selection)) {
|
|
498
|
+
p2.cancel("Operation cancelled");
|
|
499
|
+
process.exit(0);
|
|
500
|
+
}
|
|
501
|
+
selectedRules = selection;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (shouldInitSkills) {
|
|
505
|
+
if (args.all) {
|
|
506
|
+
selectedSkills = manifest.skills;
|
|
507
|
+
} else {
|
|
508
|
+
const selection = await selectTemplates("skills", manifest.skills);
|
|
509
|
+
if (p2.isCancel(selection)) {
|
|
510
|
+
p2.cancel("Operation cancelled");
|
|
511
|
+
process.exit(0);
|
|
512
|
+
}
|
|
513
|
+
selectedSkills = selection;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (selectedCommands.length === 0 && selectedRules.length === 0 && selectedSkills.length === 0) {
|
|
517
|
+
p2.cancel("No templates selected");
|
|
518
|
+
process.exit(0);
|
|
519
|
+
}
|
|
520
|
+
try {
|
|
521
|
+
s.start("Installing GitHub Copilot instructions...");
|
|
522
|
+
const result = await installCopilotInstructions(
|
|
523
|
+
cwd,
|
|
524
|
+
selectedCommands,
|
|
525
|
+
selectedRules,
|
|
526
|
+
selectedSkills
|
|
527
|
+
);
|
|
528
|
+
s.stop("GitHub Copilot instructions installed");
|
|
529
|
+
printDivider();
|
|
530
|
+
console.log();
|
|
531
|
+
if (result.commands.length > 0) {
|
|
532
|
+
printSuccess(`Commands: ${highlight(result.commands.length.toString())} added`);
|
|
533
|
+
for (const cmd of result.commands) {
|
|
534
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.green("+")} ${cmd}`));
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (result.rules.length > 0) {
|
|
538
|
+
printSuccess(`Rules: ${highlight(result.rules.length.toString())} added`);
|
|
539
|
+
for (const rule of result.rules) {
|
|
540
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.green("+")} ${rule}`));
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
if (result.skills.length > 0) {
|
|
544
|
+
printSuccess(`Skills: ${highlight(result.skills.length.toString())} added`);
|
|
545
|
+
for (const skill of result.skills) {
|
|
546
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.green("+")} ${skill}`));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
console.log();
|
|
550
|
+
p2.outro(import_picocolors3.default.green("\u2728 GitHub Copilot instructions created successfully!"));
|
|
551
|
+
} catch (error) {
|
|
552
|
+
s.stop("Failed");
|
|
553
|
+
p2.cancel(
|
|
554
|
+
`Error: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
555
|
+
);
|
|
556
|
+
process.exit(1);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
257
559
|
async function selectTemplates(type, availableTemplates) {
|
|
258
560
|
const labelFn = type === "skills" ? getSkillLabel : getTemplateLabel;
|
|
259
|
-
const selectionMode = await
|
|
561
|
+
const selectionMode = await p2.select({
|
|
260
562
|
message: `How would you like to add ${type}?`,
|
|
261
563
|
options: [
|
|
262
564
|
{
|
|
@@ -271,11 +573,11 @@ async function selectTemplates(type, availableTemplates) {
|
|
|
271
573
|
}
|
|
272
574
|
]
|
|
273
575
|
});
|
|
274
|
-
if (
|
|
576
|
+
if (p2.isCancel(selectionMode)) return selectionMode;
|
|
275
577
|
if (selectionMode === "all") {
|
|
276
578
|
return availableTemplates;
|
|
277
579
|
}
|
|
278
|
-
const selectedTemplates = await
|
|
580
|
+
const selectedTemplates = await p2.multiselect({
|
|
279
581
|
message: `Select ${type} to add:`,
|
|
280
582
|
options: availableTemplates.map((template) => ({
|
|
281
583
|
value: template,
|
|
@@ -289,13 +591,13 @@ async function selectTemplates(type, availableTemplates) {
|
|
|
289
591
|
async function handleConflicts(type, conflictingFiles) {
|
|
290
592
|
console.log();
|
|
291
593
|
console.log(
|
|
292
|
-
|
|
594
|
+
import_picocolors3.default.yellow(`\u26A0 ${conflictingFiles.length} existing ${type} found:`)
|
|
293
595
|
);
|
|
294
596
|
for (const file of conflictingFiles) {
|
|
295
|
-
console.log(
|
|
597
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${file}`));
|
|
296
598
|
}
|
|
297
599
|
console.log();
|
|
298
|
-
const strategy = await
|
|
600
|
+
const strategy = await p2.select({
|
|
299
601
|
message: "How would you like to handle conflicts?",
|
|
300
602
|
options: [
|
|
301
603
|
{
|
|
@@ -337,7 +639,7 @@ async function installTemplates(type, targetDir, selectedTemplates, conflictStra
|
|
|
337
639
|
const templates = await fetchMultipleTemplates(type, templatesToInstall);
|
|
338
640
|
ensureDir(targetDir);
|
|
339
641
|
for (const [filename, content] of templates) {
|
|
340
|
-
const filePath = (0,
|
|
642
|
+
const filePath = (0, import_node_path4.join)(targetDir, filename);
|
|
341
643
|
writeFile(filePath, content);
|
|
342
644
|
result.added.push(filename);
|
|
343
645
|
}
|
|
@@ -404,6 +706,12 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
404
706
|
alias: "a",
|
|
405
707
|
description: "Install all templates without selection prompts",
|
|
406
708
|
default: false
|
|
709
|
+
},
|
|
710
|
+
target: {
|
|
711
|
+
type: "string",
|
|
712
|
+
alias: "t",
|
|
713
|
+
description: "Target AI IDE: 'cursor' or 'github-copilot'",
|
|
714
|
+
default: void 0
|
|
407
715
|
}
|
|
408
716
|
},
|
|
409
717
|
async run({ args }) {
|
|
@@ -416,8 +724,19 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
416
724
|
const shouldInitCommands = initAll || args.commands;
|
|
417
725
|
const shouldInitRules = initAll || args.rules;
|
|
418
726
|
const shouldInitSkills = initAll || args.skills;
|
|
419
|
-
|
|
420
|
-
|
|
727
|
+
p2.intro(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" cursor-kit init ")));
|
|
728
|
+
let target;
|
|
729
|
+
if (args.target === "github-copilot" || args.target === "cursor") {
|
|
730
|
+
target = args.target;
|
|
731
|
+
} else {
|
|
732
|
+
const selection = await promptTargetSelection();
|
|
733
|
+
if (p2.isCancel(selection)) {
|
|
734
|
+
p2.cancel("Operation cancelled");
|
|
735
|
+
process.exit(0);
|
|
736
|
+
}
|
|
737
|
+
target = selection;
|
|
738
|
+
}
|
|
739
|
+
const s = p2.spinner();
|
|
421
740
|
let manifest;
|
|
422
741
|
try {
|
|
423
742
|
s.start("Fetching template manifest...");
|
|
@@ -425,11 +744,22 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
425
744
|
s.stop("Template manifest loaded");
|
|
426
745
|
} catch (error) {
|
|
427
746
|
s.stop("Failed to fetch manifest");
|
|
428
|
-
|
|
747
|
+
p2.cancel(
|
|
429
748
|
`Error: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
430
749
|
);
|
|
431
750
|
process.exit(1);
|
|
432
751
|
}
|
|
752
|
+
if (target === "github-copilot") {
|
|
753
|
+
await handleCopilotInstallation(
|
|
754
|
+
cwd,
|
|
755
|
+
manifest,
|
|
756
|
+
args,
|
|
757
|
+
shouldInitCommands,
|
|
758
|
+
shouldInitRules,
|
|
759
|
+
shouldInitSkills
|
|
760
|
+
);
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
433
763
|
const results = {};
|
|
434
764
|
try {
|
|
435
765
|
ensureDir(cursorDir);
|
|
@@ -439,8 +769,8 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
439
769
|
selectedCommands = manifest.commands;
|
|
440
770
|
} else {
|
|
441
771
|
const selection = await selectTemplates("commands", manifest.commands);
|
|
442
|
-
if (
|
|
443
|
-
|
|
772
|
+
if (p2.isCancel(selection)) {
|
|
773
|
+
p2.cancel("Operation cancelled");
|
|
444
774
|
process.exit(0);
|
|
445
775
|
}
|
|
446
776
|
selectedCommands = selection;
|
|
@@ -452,8 +782,8 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
452
782
|
let commandStrategy = "overwrite";
|
|
453
783
|
if (conflictingCommands.length > 0 && !args.force) {
|
|
454
784
|
const strategy = await handleConflicts("commands", conflictingCommands);
|
|
455
|
-
if (
|
|
456
|
-
|
|
785
|
+
if (p2.isCancel(strategy) || strategy === "cancel") {
|
|
786
|
+
p2.cancel("Operation cancelled");
|
|
457
787
|
process.exit(0);
|
|
458
788
|
}
|
|
459
789
|
commandStrategy = strategy;
|
|
@@ -473,8 +803,8 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
473
803
|
selectedRules = manifest.rules;
|
|
474
804
|
} else {
|
|
475
805
|
const selection = await selectTemplates("rules", manifest.rules);
|
|
476
|
-
if (
|
|
477
|
-
|
|
806
|
+
if (p2.isCancel(selection)) {
|
|
807
|
+
p2.cancel("Operation cancelled");
|
|
478
808
|
process.exit(0);
|
|
479
809
|
}
|
|
480
810
|
selectedRules = selection;
|
|
@@ -483,8 +813,8 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
483
813
|
let ruleStrategy = "overwrite";
|
|
484
814
|
if (conflictingRules.length > 0 && !args.force) {
|
|
485
815
|
const strategy = await handleConflicts("rules", conflictingRules);
|
|
486
|
-
if (
|
|
487
|
-
|
|
816
|
+
if (p2.isCancel(strategy) || strategy === "cancel") {
|
|
817
|
+
p2.cancel("Operation cancelled");
|
|
488
818
|
process.exit(0);
|
|
489
819
|
}
|
|
490
820
|
ruleStrategy = strategy;
|
|
@@ -504,8 +834,8 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
504
834
|
selectedSkills = manifest.skills;
|
|
505
835
|
} else {
|
|
506
836
|
const selection = await selectTemplates("skills", manifest.skills);
|
|
507
|
-
if (
|
|
508
|
-
|
|
837
|
+
if (p2.isCancel(selection)) {
|
|
838
|
+
p2.cancel("Operation cancelled");
|
|
509
839
|
process.exit(0);
|
|
510
840
|
}
|
|
511
841
|
selectedSkills = selection;
|
|
@@ -514,8 +844,8 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
514
844
|
let skillStrategy = "overwrite";
|
|
515
845
|
if (conflictingSkills.length > 0 && !args.force) {
|
|
516
846
|
const strategy = await handleConflicts("skills", conflictingSkills);
|
|
517
|
-
if (
|
|
518
|
-
|
|
847
|
+
if (p2.isCancel(strategy) || strategy === "cancel") {
|
|
848
|
+
p2.cancel("Operation cancelled");
|
|
519
849
|
process.exit(0);
|
|
520
850
|
}
|
|
521
851
|
skillStrategy = strategy;
|
|
@@ -534,13 +864,13 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
534
864
|
const { added, skipped } = results.commands;
|
|
535
865
|
if (added.length > 0 || skipped.length > 0) {
|
|
536
866
|
printSuccess(
|
|
537
|
-
`Commands: ${highlight(added.length.toString())} added${skipped.length > 0 ? `, ${
|
|
867
|
+
`Commands: ${highlight(added.length.toString())} added${skipped.length > 0 ? `, ${import_picocolors3.default.yellow(skipped.length.toString())} skipped` : ""}`
|
|
538
868
|
);
|
|
539
869
|
for (const f of added) {
|
|
540
|
-
console.log(
|
|
870
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.green("+")} ${f}`));
|
|
541
871
|
}
|
|
542
872
|
for (const f of skipped) {
|
|
543
|
-
console.log(
|
|
873
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.yellow("\u25CB")} ${f} (kept existing)`));
|
|
544
874
|
}
|
|
545
875
|
}
|
|
546
876
|
}
|
|
@@ -548,13 +878,13 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
548
878
|
const { added, skipped } = results.rules;
|
|
549
879
|
if (added.length > 0 || skipped.length > 0) {
|
|
550
880
|
printSuccess(
|
|
551
|
-
`Rules: ${highlight(added.length.toString())} added${skipped.length > 0 ? `, ${
|
|
881
|
+
`Rules: ${highlight(added.length.toString())} added${skipped.length > 0 ? `, ${import_picocolors3.default.yellow(skipped.length.toString())} skipped` : ""}`
|
|
552
882
|
);
|
|
553
883
|
for (const f of added) {
|
|
554
|
-
console.log(
|
|
884
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.green("+")} ${f}`));
|
|
555
885
|
}
|
|
556
886
|
for (const f of skipped) {
|
|
557
|
-
console.log(
|
|
887
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.yellow("\u25CB")} ${f} (kept existing)`));
|
|
558
888
|
}
|
|
559
889
|
}
|
|
560
890
|
}
|
|
@@ -562,13 +892,13 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
562
892
|
const { added, skipped } = results.skills;
|
|
563
893
|
if (added.length > 0 || skipped.length > 0) {
|
|
564
894
|
printSuccess(
|
|
565
|
-
`Skills: ${highlight(added.length.toString())} added${skipped.length > 0 ? `, ${
|
|
895
|
+
`Skills: ${highlight(added.length.toString())} added${skipped.length > 0 ? `, ${import_picocolors3.default.yellow(skipped.length.toString())} skipped` : ""}`
|
|
566
896
|
);
|
|
567
897
|
for (const f of added) {
|
|
568
|
-
console.log(
|
|
898
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.green("+")} ${f}`));
|
|
569
899
|
}
|
|
570
900
|
for (const f of skipped) {
|
|
571
|
-
console.log(
|
|
901
|
+
console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.yellow("\u25CB")} ${f} (kept existing)`));
|
|
572
902
|
}
|
|
573
903
|
}
|
|
574
904
|
}
|
|
@@ -576,14 +906,14 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
576
906
|
const totalSkipped = (results.commands?.skipped.length ?? 0) + (results.rules?.skipped.length ?? 0) + (results.skills?.skipped.length ?? 0);
|
|
577
907
|
if (totalAdded === 0 && totalSkipped > 0) {
|
|
578
908
|
console.log();
|
|
579
|
-
|
|
909
|
+
p2.outro(import_picocolors3.default.yellow("No new templates added (all selected files already exist)"));
|
|
580
910
|
} else {
|
|
581
911
|
console.log();
|
|
582
|
-
|
|
912
|
+
p2.outro(import_picocolors3.default.green("\u2728 Cursor Kit initialized successfully!"));
|
|
583
913
|
}
|
|
584
914
|
} catch (error) {
|
|
585
915
|
s.stop("Failed");
|
|
586
|
-
|
|
916
|
+
p2.cancel(
|
|
587
917
|
`Error: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
588
918
|
);
|
|
589
919
|
process.exit(1);
|
|
@@ -592,10 +922,10 @@ var initCommand = (0, import_citty.defineCommand)({
|
|
|
592
922
|
});
|
|
593
923
|
|
|
594
924
|
// src/commands/add.ts
|
|
595
|
-
var
|
|
925
|
+
var p3 = __toESM(require("@clack/prompts"), 1);
|
|
596
926
|
var import_citty2 = require("citty");
|
|
597
|
-
var
|
|
598
|
-
var
|
|
927
|
+
var import_node_path5 = require("path");
|
|
928
|
+
var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
599
929
|
var COMMAND_TEMPLATE = `You are a helpful assistant. Describe what this command does.
|
|
600
930
|
|
|
601
931
|
## Instructions
|
|
@@ -681,13 +1011,13 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
681
1011
|
}
|
|
682
1012
|
},
|
|
683
1013
|
async run({ args }) {
|
|
684
|
-
|
|
1014
|
+
p3.intro(import_picocolors4.default.bgCyan(import_picocolors4.default.black(" cursor-kit add ")));
|
|
685
1015
|
let itemType;
|
|
686
1016
|
let itemName;
|
|
687
1017
|
if (args.type && ["command", "rule", "skill"].includes(args.type)) {
|
|
688
1018
|
itemType = args.type;
|
|
689
1019
|
} else {
|
|
690
|
-
const typeResult = await
|
|
1020
|
+
const typeResult = await p3.select({
|
|
691
1021
|
message: "What do you want to add?",
|
|
692
1022
|
options: [
|
|
693
1023
|
{
|
|
@@ -707,8 +1037,8 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
707
1037
|
}
|
|
708
1038
|
]
|
|
709
1039
|
});
|
|
710
|
-
if (
|
|
711
|
-
|
|
1040
|
+
if (p3.isCancel(typeResult)) {
|
|
1041
|
+
p3.cancel("Operation cancelled");
|
|
712
1042
|
process.exit(0);
|
|
713
1043
|
}
|
|
714
1044
|
itemType = typeResult;
|
|
@@ -716,7 +1046,7 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
716
1046
|
if (args.name) {
|
|
717
1047
|
itemName = args.name;
|
|
718
1048
|
} else {
|
|
719
|
-
const nameResult = await
|
|
1049
|
+
const nameResult = await p3.text({
|
|
720
1050
|
message: `Enter ${itemType} name:`,
|
|
721
1051
|
placeholder: itemType === "command" ? "my-command" : itemType === "rule" ? "my-rule" : "my-skill",
|
|
722
1052
|
validate: (value) => {
|
|
@@ -725,8 +1055,8 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
725
1055
|
return void 0;
|
|
726
1056
|
}
|
|
727
1057
|
});
|
|
728
|
-
if (
|
|
729
|
-
|
|
1058
|
+
if (p3.isCancel(nameResult)) {
|
|
1059
|
+
p3.cancel("Operation cancelled");
|
|
730
1060
|
process.exit(0);
|
|
731
1061
|
}
|
|
732
1062
|
itemName = nameResult;
|
|
@@ -738,32 +1068,32 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
738
1068
|
let displayPath;
|
|
739
1069
|
if (isSkill) {
|
|
740
1070
|
const skillsDir = getSkillsDir();
|
|
741
|
-
targetPath = (0,
|
|
1071
|
+
targetPath = (0, import_node_path5.join)(skillsDir, slug);
|
|
742
1072
|
displayPath = targetPath;
|
|
743
1073
|
} else {
|
|
744
1074
|
const targetDir = isCommand ? getCommandsDir() : getRulesDir();
|
|
745
1075
|
const extension = isCommand ? ".md" : ".mdc";
|
|
746
|
-
targetPath = (0,
|
|
1076
|
+
targetPath = (0, import_node_path5.join)(targetDir, `${slug}${extension}`);
|
|
747
1077
|
displayPath = targetPath;
|
|
748
1078
|
}
|
|
749
1079
|
if (isSkill ? dirExists(targetPath) : fileExists(targetPath)) {
|
|
750
|
-
const shouldOverwrite = await
|
|
1080
|
+
const shouldOverwrite = await p3.confirm({
|
|
751
1081
|
message: `${highlight(isSkill ? slug : slug + (isCommand ? ".md" : ".mdc"))} already exists. Overwrite?`,
|
|
752
1082
|
initialValue: false
|
|
753
1083
|
});
|
|
754
|
-
if (
|
|
755
|
-
|
|
1084
|
+
if (p3.isCancel(shouldOverwrite) || !shouldOverwrite) {
|
|
1085
|
+
p3.cancel("Operation cancelled");
|
|
756
1086
|
process.exit(0);
|
|
757
1087
|
}
|
|
758
1088
|
}
|
|
759
|
-
const s =
|
|
1089
|
+
const s = p3.spinner();
|
|
760
1090
|
s.start(`Creating ${itemType}...`);
|
|
761
1091
|
try {
|
|
762
1092
|
if (isSkill) {
|
|
763
1093
|
ensureDir(targetPath);
|
|
764
|
-
ensureDir((0,
|
|
765
|
-
writeFile((0,
|
|
766
|
-
writeFile((0,
|
|
1094
|
+
ensureDir((0, import_node_path5.join)(targetPath, "references"));
|
|
1095
|
+
writeFile((0, import_node_path5.join)(targetPath, "SKILL.mdc"), SKILL_TEMPLATE);
|
|
1096
|
+
writeFile((0, import_node_path5.join)(targetPath, "references", "example.md"), SKILL_REFERENCE_TEMPLATE);
|
|
767
1097
|
} else {
|
|
768
1098
|
const targetDir = isCommand ? getCommandsDir() : getRulesDir();
|
|
769
1099
|
ensureDir(targetDir);
|
|
@@ -773,18 +1103,18 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
773
1103
|
s.stop(`${itemType.charAt(0).toUpperCase() + itemType.slice(1)} created`);
|
|
774
1104
|
console.log();
|
|
775
1105
|
if (isSkill) {
|
|
776
|
-
console.log(
|
|
777
|
-
console.log(
|
|
1106
|
+
console.log(import_picocolors4.default.dim(" Directory: ") + highlight(displayPath));
|
|
1107
|
+
console.log(import_picocolors4.default.dim(" Main file: ") + highlight((0, import_node_path5.join)(displayPath, "SKILL.mdc")));
|
|
778
1108
|
} else {
|
|
779
|
-
console.log(
|
|
1109
|
+
console.log(import_picocolors4.default.dim(" File: ") + highlight(displayPath));
|
|
780
1110
|
}
|
|
781
1111
|
console.log();
|
|
782
|
-
|
|
783
|
-
|
|
1112
|
+
p3.outro(
|
|
1113
|
+
import_picocolors4.default.green(`\u2728 ${itemType.charAt(0).toUpperCase() + itemType.slice(1)} created! Edit the file to customize it.`)
|
|
784
1114
|
);
|
|
785
1115
|
} catch (error) {
|
|
786
1116
|
s.stop("Failed");
|
|
787
|
-
|
|
1117
|
+
p3.cancel(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
788
1118
|
process.exit(1);
|
|
789
1119
|
}
|
|
790
1120
|
}
|
|
@@ -792,8 +1122,8 @@ var addCommand = (0, import_citty2.defineCommand)({
|
|
|
792
1122
|
|
|
793
1123
|
// src/commands/pull.ts
|
|
794
1124
|
var import_citty3 = require("citty");
|
|
795
|
-
var
|
|
796
|
-
var
|
|
1125
|
+
var p4 = __toESM(require("@clack/prompts"), 1);
|
|
1126
|
+
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
797
1127
|
var import_giget = require("giget");
|
|
798
1128
|
var pullCommand = (0, import_citty3.defineCommand)({
|
|
799
1129
|
meta: {
|
|
@@ -831,7 +1161,7 @@ var pullCommand = (0, import_citty3.defineCommand)({
|
|
|
831
1161
|
const shouldPullCommands = pullAll || args.commands;
|
|
832
1162
|
const shouldPullRules = pullAll || args.rules;
|
|
833
1163
|
const shouldPullSkills = pullAll || args.skills;
|
|
834
|
-
|
|
1164
|
+
p4.intro(import_picocolors5.default.bgCyan(import_picocolors5.default.black(" cursor-kit pull ")));
|
|
835
1165
|
const commandsDir = getCommandsDir();
|
|
836
1166
|
const rulesDir = getRulesDir();
|
|
837
1167
|
const skillsDir = getSkillsDir();
|
|
@@ -842,25 +1172,25 @@ var pullCommand = (0, import_citty3.defineCommand)({
|
|
|
842
1172
|
if (hasExisting && !args.force) {
|
|
843
1173
|
printInfo("Current status:");
|
|
844
1174
|
if (existingCommands.length > 0) {
|
|
845
|
-
console.log(
|
|
1175
|
+
console.log(import_picocolors5.default.dim(` Commands: ${existingCommands.length} files`));
|
|
846
1176
|
}
|
|
847
1177
|
if (existingRules.length > 0) {
|
|
848
|
-
console.log(
|
|
1178
|
+
console.log(import_picocolors5.default.dim(` Rules: ${existingRules.length} files`));
|
|
849
1179
|
}
|
|
850
1180
|
if (existingSkills.length > 0) {
|
|
851
|
-
console.log(
|
|
1181
|
+
console.log(import_picocolors5.default.dim(` Skills: ${existingSkills.length} directories`));
|
|
852
1182
|
}
|
|
853
1183
|
console.log();
|
|
854
|
-
const shouldContinue = await
|
|
1184
|
+
const shouldContinue = await p4.confirm({
|
|
855
1185
|
message: "This will merge with existing files. Continue?",
|
|
856
1186
|
initialValue: true
|
|
857
1187
|
});
|
|
858
|
-
if (
|
|
859
|
-
|
|
1188
|
+
if (p4.isCancel(shouldContinue) || !shouldContinue) {
|
|
1189
|
+
p4.cancel("Operation cancelled");
|
|
860
1190
|
process.exit(0);
|
|
861
1191
|
}
|
|
862
1192
|
}
|
|
863
|
-
const s =
|
|
1193
|
+
const s = p4.spinner();
|
|
864
1194
|
try {
|
|
865
1195
|
ensureDir(getCursorDir());
|
|
866
1196
|
if (shouldPullCommands) {
|
|
@@ -895,36 +1225,36 @@ var pullCommand = (0, import_citty3.defineCommand)({
|
|
|
895
1225
|
if (shouldPullCommands) {
|
|
896
1226
|
const added = newCommands.length - existingCommands.length;
|
|
897
1227
|
printSuccess(
|
|
898
|
-
`Commands: ${highlight(newCommands.length.toString())} total` + (added > 0 ?
|
|
1228
|
+
`Commands: ${highlight(newCommands.length.toString())} total` + (added > 0 ? import_picocolors5.default.green(` (+${added} new)`) : "")
|
|
899
1229
|
);
|
|
900
1230
|
}
|
|
901
1231
|
if (shouldPullRules) {
|
|
902
1232
|
const added = newRules.length - existingRules.length;
|
|
903
1233
|
printSuccess(
|
|
904
|
-
`Rules: ${highlight(newRules.length.toString())} total` + (added > 0 ?
|
|
1234
|
+
`Rules: ${highlight(newRules.length.toString())} total` + (added > 0 ? import_picocolors5.default.green(` (+${added} new)`) : "")
|
|
905
1235
|
);
|
|
906
1236
|
}
|
|
907
1237
|
if (shouldPullSkills) {
|
|
908
1238
|
const added = newSkills.length - existingSkills.length;
|
|
909
1239
|
printSuccess(
|
|
910
|
-
`Skills: ${highlight(newSkills.length.toString())} total` + (added > 0 ?
|
|
1240
|
+
`Skills: ${highlight(newSkills.length.toString())} total` + (added > 0 ? import_picocolors5.default.green(` (+${added} new)`) : "")
|
|
911
1241
|
);
|
|
912
1242
|
}
|
|
913
1243
|
console.log();
|
|
914
|
-
|
|
1244
|
+
p4.outro(import_picocolors5.default.green("\u2728 Successfully pulled latest updates!"));
|
|
915
1245
|
} catch (error) {
|
|
916
1246
|
s.stop("Failed");
|
|
917
|
-
|
|
1247
|
+
p4.cancel(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
918
1248
|
process.exit(1);
|
|
919
1249
|
}
|
|
920
1250
|
}
|
|
921
1251
|
});
|
|
922
1252
|
|
|
923
1253
|
// src/commands/list.ts
|
|
924
|
-
var
|
|
1254
|
+
var p5 = __toESM(require("@clack/prompts"), 1);
|
|
925
1255
|
var import_citty4 = require("citty");
|
|
926
|
-
var
|
|
927
|
-
var
|
|
1256
|
+
var import_node_path6 = require("path");
|
|
1257
|
+
var import_picocolors6 = __toESM(require("picocolors"), 1);
|
|
928
1258
|
function extractDescription(content, isCommand) {
|
|
929
1259
|
if (isCommand) {
|
|
930
1260
|
const firstLine = content.trim().split("\n")[0];
|
|
@@ -942,7 +1272,7 @@ function extractDescription(content, isCommand) {
|
|
|
942
1272
|
function getItems(dir, extension, isCommand) {
|
|
943
1273
|
const files = listFiles(dir, extension);
|
|
944
1274
|
return files.map((file) => {
|
|
945
|
-
const filePath = (0,
|
|
1275
|
+
const filePath = (0, import_node_path6.join)(dir, file);
|
|
946
1276
|
const content = fileExists(filePath) ? readFile(filePath) : "";
|
|
947
1277
|
return {
|
|
948
1278
|
name: file.replace(extension, ""),
|
|
@@ -954,9 +1284,9 @@ function getItems(dir, extension, isCommand) {
|
|
|
954
1284
|
function getSkills(dir) {
|
|
955
1285
|
const skillDirs = listDirs(dir);
|
|
956
1286
|
return skillDirs.map((skillName) => {
|
|
957
|
-
const skillPath = (0,
|
|
958
|
-
const skillFile = (0,
|
|
959
|
-
const altSkillFile = (0,
|
|
1287
|
+
const skillPath = (0, import_node_path6.join)(dir, skillName);
|
|
1288
|
+
const skillFile = (0, import_node_path6.join)(skillPath, "SKILL.mdc");
|
|
1289
|
+
const altSkillFile = (0, import_node_path6.join)(skillPath, "SKILL.md");
|
|
960
1290
|
let description;
|
|
961
1291
|
if (fileExists(skillFile)) {
|
|
962
1292
|
const content = readFile(skillFile);
|
|
@@ -1008,7 +1338,7 @@ var listCommand = (0, import_citty4.defineCommand)({
|
|
|
1008
1338
|
const shouldListCommands = listAll || args.commands;
|
|
1009
1339
|
const shouldListRules = listAll || args.rules;
|
|
1010
1340
|
const shouldListSkills = listAll || args.skills;
|
|
1011
|
-
|
|
1341
|
+
p5.intro(import_picocolors6.default.bgCyan(import_picocolors6.default.black(" cursor-kit list ")));
|
|
1012
1342
|
const commandsDir = getCommandsDir();
|
|
1013
1343
|
const rulesDir = getRulesDir();
|
|
1014
1344
|
const skillsDir = getSkillsDir();
|
|
@@ -1017,75 +1347,75 @@ var listCommand = (0, import_citty4.defineCommand)({
|
|
|
1017
1347
|
const skills = shouldListSkills ? getSkills(skillsDir) : [];
|
|
1018
1348
|
if (commands.length === 0 && rules.length === 0 && skills.length === 0) {
|
|
1019
1349
|
console.log();
|
|
1020
|
-
console.log(
|
|
1350
|
+
console.log(import_picocolors6.default.yellow(" No commands, rules, or skills found."));
|
|
1021
1351
|
console.log(
|
|
1022
|
-
|
|
1352
|
+
import_picocolors6.default.dim(" Run ") + highlight("cursor-kit init") + import_picocolors6.default.dim(" to get started.")
|
|
1023
1353
|
);
|
|
1024
1354
|
console.log();
|
|
1025
|
-
|
|
1355
|
+
p5.outro(import_picocolors6.default.dim("Nothing to show"));
|
|
1026
1356
|
return;
|
|
1027
1357
|
}
|
|
1028
1358
|
printDivider();
|
|
1029
1359
|
if (shouldListCommands && commands.length > 0) {
|
|
1030
1360
|
console.log();
|
|
1031
1361
|
console.log(
|
|
1032
|
-
|
|
1362
|
+
import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u{1F4DC} Commands")) + import_picocolors6.default.dim(` (${commands.length})`)
|
|
1033
1363
|
);
|
|
1034
1364
|
console.log();
|
|
1035
1365
|
commands.forEach((cmd) => {
|
|
1036
|
-
console.log(` ${
|
|
1366
|
+
console.log(` ${import_picocolors6.default.green("\u25CF")} ${highlight(cmd.name)}`);
|
|
1037
1367
|
if (cmd.description) {
|
|
1038
|
-
console.log(
|
|
1368
|
+
console.log(import_picocolors6.default.dim(` ${cmd.description}`));
|
|
1039
1369
|
}
|
|
1040
1370
|
if (args.verbose) {
|
|
1041
|
-
console.log(
|
|
1371
|
+
console.log(import_picocolors6.default.dim(` ${cmd.path}`));
|
|
1042
1372
|
}
|
|
1043
1373
|
});
|
|
1044
1374
|
}
|
|
1045
1375
|
if (shouldListRules && rules.length > 0) {
|
|
1046
1376
|
console.log();
|
|
1047
1377
|
console.log(
|
|
1048
|
-
|
|
1378
|
+
import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u{1F4CB} Rules")) + import_picocolors6.default.dim(` (${rules.length})`)
|
|
1049
1379
|
);
|
|
1050
1380
|
console.log();
|
|
1051
1381
|
rules.forEach((rule) => {
|
|
1052
|
-
console.log(` ${
|
|
1382
|
+
console.log(` ${import_picocolors6.default.green("\u25CF")} ${highlight(rule.name)}`);
|
|
1053
1383
|
if (rule.description) {
|
|
1054
|
-
console.log(
|
|
1384
|
+
console.log(import_picocolors6.default.dim(` ${rule.description}`));
|
|
1055
1385
|
}
|
|
1056
1386
|
if (args.verbose) {
|
|
1057
|
-
console.log(
|
|
1387
|
+
console.log(import_picocolors6.default.dim(` ${rule.path}`));
|
|
1058
1388
|
}
|
|
1059
1389
|
});
|
|
1060
1390
|
}
|
|
1061
1391
|
if (shouldListSkills && skills.length > 0) {
|
|
1062
1392
|
console.log();
|
|
1063
1393
|
console.log(
|
|
1064
|
-
|
|
1394
|
+
import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u{1F3AF} Skills")) + import_picocolors6.default.dim(` (${skills.length})`)
|
|
1065
1395
|
);
|
|
1066
1396
|
console.log();
|
|
1067
1397
|
skills.forEach((skill) => {
|
|
1068
|
-
console.log(` ${
|
|
1398
|
+
console.log(` ${import_picocolors6.default.green("\u25CF")} ${highlight(skill.name)}`);
|
|
1069
1399
|
if (skill.description) {
|
|
1070
|
-
console.log(
|
|
1400
|
+
console.log(import_picocolors6.default.dim(` ${skill.description}`));
|
|
1071
1401
|
}
|
|
1072
1402
|
if (args.verbose) {
|
|
1073
|
-
console.log(
|
|
1403
|
+
console.log(import_picocolors6.default.dim(` ${skill.path}`));
|
|
1074
1404
|
}
|
|
1075
1405
|
});
|
|
1076
1406
|
}
|
|
1077
1407
|
console.log();
|
|
1078
1408
|
printDivider();
|
|
1079
1409
|
const total = commands.length + rules.length + skills.length;
|
|
1080
|
-
|
|
1410
|
+
p5.outro(import_picocolors6.default.dim(`Total: ${total} item${total !== 1 ? "s" : ""}`));
|
|
1081
1411
|
}
|
|
1082
1412
|
});
|
|
1083
1413
|
|
|
1084
1414
|
// src/commands/remove.ts
|
|
1085
1415
|
var import_citty5 = require("citty");
|
|
1086
|
-
var
|
|
1087
|
-
var
|
|
1088
|
-
var
|
|
1416
|
+
var p6 = __toESM(require("@clack/prompts"), 1);
|
|
1417
|
+
var import_picocolors7 = __toESM(require("picocolors"), 1);
|
|
1418
|
+
var import_node_path7 = require("path");
|
|
1089
1419
|
var removeCommand = (0, import_citty5.defineCommand)({
|
|
1090
1420
|
meta: {
|
|
1091
1421
|
name: "remove",
|
|
@@ -1110,7 +1440,7 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1110
1440
|
}
|
|
1111
1441
|
},
|
|
1112
1442
|
async run({ args }) {
|
|
1113
|
-
|
|
1443
|
+
p6.intro(import_picocolors7.default.bgCyan(import_picocolors7.default.black(" cursor-kit remove ")));
|
|
1114
1444
|
const commandsDir = getCommandsDir();
|
|
1115
1445
|
const rulesDir = getRulesDir();
|
|
1116
1446
|
const skillsDir = getSkillsDir();
|
|
@@ -1119,9 +1449,9 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1119
1449
|
const skills = listDirs(skillsDir);
|
|
1120
1450
|
if (commands.length === 0 && rules.length === 0 && skills.length === 0) {
|
|
1121
1451
|
console.log();
|
|
1122
|
-
console.log(
|
|
1452
|
+
console.log(import_picocolors7.default.yellow(" No commands, rules, or skills to remove."));
|
|
1123
1453
|
console.log();
|
|
1124
|
-
|
|
1454
|
+
p6.outro(import_picocolors7.default.dim("Nothing to do"));
|
|
1125
1455
|
return;
|
|
1126
1456
|
}
|
|
1127
1457
|
let itemType;
|
|
@@ -1151,12 +1481,12 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1151
1481
|
hint: `${skills.length} available`
|
|
1152
1482
|
});
|
|
1153
1483
|
}
|
|
1154
|
-
const typeResult = await
|
|
1484
|
+
const typeResult = await p6.select({
|
|
1155
1485
|
message: "What do you want to remove?",
|
|
1156
1486
|
options: typeOptions
|
|
1157
1487
|
});
|
|
1158
|
-
if (
|
|
1159
|
-
|
|
1488
|
+
if (p6.isCancel(typeResult)) {
|
|
1489
|
+
p6.cancel("Operation cancelled");
|
|
1160
1490
|
process.exit(0);
|
|
1161
1491
|
}
|
|
1162
1492
|
itemType = typeResult;
|
|
@@ -1168,7 +1498,7 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1168
1498
|
const dir = isCommand ? commandsDir : isRule ? rulesDir : skillsDir;
|
|
1169
1499
|
const extension = isCommand ? ".md" : isRule ? ".mdc" : "";
|
|
1170
1500
|
if (items.length === 0) {
|
|
1171
|
-
|
|
1501
|
+
p6.cancel(`No ${itemType}s found`);
|
|
1172
1502
|
process.exit(0);
|
|
1173
1503
|
}
|
|
1174
1504
|
if (args.name && items.includes(args.name)) {
|
|
@@ -1178,30 +1508,30 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1178
1508
|
value: item,
|
|
1179
1509
|
label: item
|
|
1180
1510
|
}));
|
|
1181
|
-
const nameResult = await
|
|
1511
|
+
const nameResult = await p6.select({
|
|
1182
1512
|
message: `Select ${itemType} to remove:`,
|
|
1183
1513
|
options: itemOptions
|
|
1184
1514
|
});
|
|
1185
|
-
if (
|
|
1186
|
-
|
|
1515
|
+
if (p6.isCancel(nameResult)) {
|
|
1516
|
+
p6.cancel("Operation cancelled");
|
|
1187
1517
|
process.exit(0);
|
|
1188
1518
|
}
|
|
1189
1519
|
itemName = nameResult;
|
|
1190
1520
|
}
|
|
1191
|
-
const targetPath = isSkill ? (0,
|
|
1521
|
+
const targetPath = isSkill ? (0, import_node_path7.join)(dir, itemName) : (0, import_node_path7.join)(dir, `${itemName}${extension}`);
|
|
1192
1522
|
const exists = isSkill ? dirExists(targetPath) : fileExists(targetPath);
|
|
1193
1523
|
if (!exists) {
|
|
1194
|
-
|
|
1524
|
+
p6.cancel(`${itemType} '${itemName}' not found`);
|
|
1195
1525
|
process.exit(1);
|
|
1196
1526
|
}
|
|
1197
1527
|
if (!args.force) {
|
|
1198
1528
|
const displayName = isSkill ? itemName : itemName + extension;
|
|
1199
|
-
const shouldDelete = await
|
|
1529
|
+
const shouldDelete = await p6.confirm({
|
|
1200
1530
|
message: `Are you sure you want to delete ${highlight(displayName)}?${isSkill ? " (This will remove the entire skill directory)" : ""}`,
|
|
1201
1531
|
initialValue: false
|
|
1202
1532
|
});
|
|
1203
|
-
if (
|
|
1204
|
-
|
|
1533
|
+
if (p6.isCancel(shouldDelete) || !shouldDelete) {
|
|
1534
|
+
p6.cancel("Operation cancelled");
|
|
1205
1535
|
process.exit(0);
|
|
1206
1536
|
}
|
|
1207
1537
|
}
|
|
@@ -1211,9 +1541,9 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1211
1541
|
console.log();
|
|
1212
1542
|
printSuccess(`Removed ${highlight(displayName)}`);
|
|
1213
1543
|
console.log();
|
|
1214
|
-
|
|
1544
|
+
p6.outro(import_picocolors7.default.green("\u2728 Done!"));
|
|
1215
1545
|
} catch (error) {
|
|
1216
|
-
|
|
1546
|
+
p6.cancel(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1217
1547
|
process.exit(1);
|
|
1218
1548
|
}
|
|
1219
1549
|
}
|
|
@@ -1221,17 +1551,17 @@ var removeCommand = (0, import_citty5.defineCommand)({
|
|
|
1221
1551
|
|
|
1222
1552
|
// src/commands/instance.ts
|
|
1223
1553
|
var import_citty6 = require("citty");
|
|
1224
|
-
var
|
|
1225
|
-
var
|
|
1554
|
+
var p7 = __toESM(require("@clack/prompts"), 1);
|
|
1555
|
+
var import_picocolors8 = __toESM(require("picocolors"), 1);
|
|
1226
1556
|
var import_node_child_process = require("child_process");
|
|
1227
|
-
var
|
|
1557
|
+
var import_node_path8 = require("path");
|
|
1228
1558
|
var import_node_url2 = require("url");
|
|
1229
1559
|
var import_node_fs2 = require("fs");
|
|
1230
1560
|
function getBinPath() {
|
|
1231
|
-
const currentDir = (0,
|
|
1561
|
+
const currentDir = (0, import_node_path8.dirname)((0, import_node_url2.fileURLToPath)(importMetaUrl));
|
|
1232
1562
|
const possiblePaths = [
|
|
1233
|
-
(0,
|
|
1234
|
-
(0,
|
|
1563
|
+
(0, import_node_path8.join)(currentDir, "..", "..", "bin"),
|
|
1564
|
+
(0, import_node_path8.join)(currentDir, "..", "bin")
|
|
1235
1565
|
];
|
|
1236
1566
|
for (const binPath of possiblePaths) {
|
|
1237
1567
|
if ((0, import_node_fs2.existsSync)(binPath)) {
|
|
@@ -1247,13 +1577,13 @@ function ensureExecutable(scriptPath) {
|
|
|
1247
1577
|
}
|
|
1248
1578
|
}
|
|
1249
1579
|
function getExistingInstances() {
|
|
1250
|
-
const userAppsDir = (0,
|
|
1580
|
+
const userAppsDir = (0, import_node_path8.join)(process.env.HOME ?? "", "Applications");
|
|
1251
1581
|
if (!(0, import_node_fs2.existsSync)(userAppsDir)) return [];
|
|
1252
1582
|
try {
|
|
1253
1583
|
const apps = (0, import_node_fs2.readdirSync)(userAppsDir);
|
|
1254
1584
|
return apps.filter((app) => app.startsWith("Cursor") && app.endsWith(".app") && app !== "Cursor.app").map((app) => ({
|
|
1255
1585
|
name: app.replace(".app", ""),
|
|
1256
|
-
path: (0,
|
|
1586
|
+
path: (0, import_node_path8.join)(userAppsDir, app)
|
|
1257
1587
|
}));
|
|
1258
1588
|
} catch {
|
|
1259
1589
|
return [];
|
|
@@ -1297,13 +1627,13 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1297
1627
|
}
|
|
1298
1628
|
},
|
|
1299
1629
|
async run({ args }) {
|
|
1300
|
-
|
|
1630
|
+
p7.intro(import_picocolors8.default.bgCyan(import_picocolors8.default.black(" cursor-kit instance ")));
|
|
1301
1631
|
if (process.platform !== "darwin") {
|
|
1302
1632
|
console.log();
|
|
1303
1633
|
printWarning("This command only works on macOS.");
|
|
1304
|
-
console.log(
|
|
1634
|
+
console.log(import_picocolors8.default.dim(" Cursor instance management requires macOS-specific features."));
|
|
1305
1635
|
console.log();
|
|
1306
|
-
|
|
1636
|
+
p7.outro(import_picocolors8.default.dim("Exiting"));
|
|
1307
1637
|
process.exit(1);
|
|
1308
1638
|
}
|
|
1309
1639
|
if (args.list) {
|
|
@@ -1312,34 +1642,34 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1312
1642
|
console.log();
|
|
1313
1643
|
if (instances.length === 0) {
|
|
1314
1644
|
printInfo("No custom Cursor instances found.");
|
|
1315
|
-
console.log(
|
|
1645
|
+
console.log(import_picocolors8.default.dim(" Run ") + highlight("cursor-kit instance") + import_picocolors8.default.dim(" to create one."));
|
|
1316
1646
|
} else {
|
|
1317
|
-
console.log(
|
|
1647
|
+
console.log(import_picocolors8.default.bold(import_picocolors8.default.cyan(" \u{1F5A5} Cursor Instances")) + import_picocolors8.default.dim(` (${instances.length})`));
|
|
1318
1648
|
console.log();
|
|
1319
1649
|
for (const instance of instances) {
|
|
1320
|
-
console.log(` ${
|
|
1321
|
-
console.log(
|
|
1650
|
+
console.log(` ${import_picocolors8.default.green("\u25CF")} ${highlight(instance.name)}`);
|
|
1651
|
+
console.log(import_picocolors8.default.dim(` \u2514\u2500 ${instance.path}`));
|
|
1322
1652
|
}
|
|
1323
1653
|
}
|
|
1324
1654
|
console.log();
|
|
1325
1655
|
printDivider();
|
|
1326
|
-
|
|
1656
|
+
p7.outro(import_picocolors8.default.dim(`Total: ${instances.length} instance${instances.length !== 1 ? "s" : ""}`));
|
|
1327
1657
|
return;
|
|
1328
1658
|
}
|
|
1329
|
-
const s =
|
|
1659
|
+
const s = p7.spinner();
|
|
1330
1660
|
s.start("Checking prerequisites...");
|
|
1331
1661
|
const binPath = getBinPath();
|
|
1332
|
-
const createScript = (0,
|
|
1333
|
-
const removeScript = (0,
|
|
1334
|
-
const reinstallScript = (0,
|
|
1662
|
+
const createScript = (0, import_node_path8.join)(binPath, "cursor-new-instance");
|
|
1663
|
+
const removeScript = (0, import_node_path8.join)(binPath, "cursor-remove-instance");
|
|
1664
|
+
const reinstallScript = (0, import_node_path8.join)(binPath, "cursor-reinstall-instance.sh");
|
|
1335
1665
|
const scriptsExist = (0, import_node_fs2.existsSync)(createScript) && (0, import_node_fs2.existsSync)(removeScript) && (0, import_node_fs2.existsSync)(reinstallScript);
|
|
1336
1666
|
if (!scriptsExist) {
|
|
1337
1667
|
s.stop("Prerequisites check failed");
|
|
1338
1668
|
console.log();
|
|
1339
1669
|
printWarning("Required scripts not found.");
|
|
1340
|
-
console.log(
|
|
1670
|
+
console.log(import_picocolors8.default.dim(` Expected at: ${binPath}`));
|
|
1341
1671
|
console.log();
|
|
1342
|
-
|
|
1672
|
+
p7.outro(import_picocolors8.default.red("Installation may be corrupted"));
|
|
1343
1673
|
process.exit(1);
|
|
1344
1674
|
}
|
|
1345
1675
|
const originalCursor = "/Applications/Cursor.app";
|
|
@@ -1347,9 +1677,9 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1347
1677
|
s.stop("Prerequisites check failed");
|
|
1348
1678
|
console.log();
|
|
1349
1679
|
printWarning("Cursor.app not found in /Applications");
|
|
1350
|
-
console.log(
|
|
1680
|
+
console.log(import_picocolors8.default.dim(" Please install Cursor IDE first."));
|
|
1351
1681
|
console.log();
|
|
1352
|
-
|
|
1682
|
+
p7.outro(import_picocolors8.default.red("Cursor IDE required"));
|
|
1353
1683
|
process.exit(1);
|
|
1354
1684
|
}
|
|
1355
1685
|
s.stop("Prerequisites verified");
|
|
@@ -1359,7 +1689,7 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1359
1689
|
if (args.action && ["create", "remove", "reinstall"].includes(args.action)) {
|
|
1360
1690
|
action = args.action;
|
|
1361
1691
|
} else {
|
|
1362
|
-
const actionResult = await
|
|
1692
|
+
const actionResult = await p7.select({
|
|
1363
1693
|
message: "What would you like to do?",
|
|
1364
1694
|
options: [
|
|
1365
1695
|
{
|
|
@@ -1379,8 +1709,8 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1379
1709
|
}
|
|
1380
1710
|
]
|
|
1381
1711
|
});
|
|
1382
|
-
if (
|
|
1383
|
-
|
|
1712
|
+
if (p7.isCancel(actionResult)) {
|
|
1713
|
+
p7.cancel("Operation cancelled");
|
|
1384
1714
|
process.exit(0);
|
|
1385
1715
|
}
|
|
1386
1716
|
action = actionResult;
|
|
@@ -1389,7 +1719,7 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1389
1719
|
instanceName = args.name;
|
|
1390
1720
|
} else if ((action === "remove" || action === "reinstall") && existingInstances.length > 0) {
|
|
1391
1721
|
const actionLabel2 = action === "remove" ? "remove" : "reinstall";
|
|
1392
|
-
const instanceResult = await
|
|
1722
|
+
const instanceResult = await p7.select({
|
|
1393
1723
|
message: `Select instance to ${actionLabel2}:`,
|
|
1394
1724
|
options: existingInstances.map((inst) => ({
|
|
1395
1725
|
value: inst.name,
|
|
@@ -1397,8 +1727,8 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1397
1727
|
hint: inst.path
|
|
1398
1728
|
}))
|
|
1399
1729
|
});
|
|
1400
|
-
if (
|
|
1401
|
-
|
|
1730
|
+
if (p7.isCancel(instanceResult)) {
|
|
1731
|
+
p7.cancel("Operation cancelled");
|
|
1402
1732
|
process.exit(0);
|
|
1403
1733
|
}
|
|
1404
1734
|
instanceName = instanceResult;
|
|
@@ -1406,10 +1736,10 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1406
1736
|
console.log();
|
|
1407
1737
|
printInfo(`No custom Cursor instances found to ${action}.`);
|
|
1408
1738
|
console.log();
|
|
1409
|
-
|
|
1739
|
+
p7.outro(import_picocolors8.default.dim("Nothing to do"));
|
|
1410
1740
|
return;
|
|
1411
1741
|
} else {
|
|
1412
|
-
const nameResult = await
|
|
1742
|
+
const nameResult = await p7.text({
|
|
1413
1743
|
message: "Enter a name for the new instance:",
|
|
1414
1744
|
placeholder: "Cursor Enterprise",
|
|
1415
1745
|
validate: (value) => {
|
|
@@ -1422,41 +1752,41 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1422
1752
|
return void 0;
|
|
1423
1753
|
}
|
|
1424
1754
|
});
|
|
1425
|
-
if (
|
|
1426
|
-
|
|
1755
|
+
if (p7.isCancel(nameResult)) {
|
|
1756
|
+
p7.cancel("Operation cancelled");
|
|
1427
1757
|
process.exit(0);
|
|
1428
1758
|
}
|
|
1429
1759
|
instanceName = nameResult;
|
|
1430
1760
|
}
|
|
1431
1761
|
printDivider();
|
|
1432
1762
|
console.log();
|
|
1433
|
-
console.log(
|
|
1763
|
+
console.log(import_picocolors8.default.bold(import_picocolors8.default.cyan(" \u{1F4CB} Summary")));
|
|
1434
1764
|
console.log();
|
|
1435
|
-
const actionColor = action === "create" ?
|
|
1765
|
+
const actionColor = action === "create" ? import_picocolors8.default.green : action === "reinstall" ? import_picocolors8.default.blue : import_picocolors8.default.yellow;
|
|
1436
1766
|
const actionLabel = action === "create" ? "Create" : action === "reinstall" ? "Reinstall" : "Remove";
|
|
1437
|
-
console.log(` ${
|
|
1438
|
-
console.log(` ${
|
|
1767
|
+
console.log(` ${import_picocolors8.default.dim("Action:")} ${actionColor(actionLabel)}`);
|
|
1768
|
+
console.log(` ${import_picocolors8.default.dim("Instance:")} ${highlight(instanceName)}`);
|
|
1439
1769
|
if (action === "create" || action === "reinstall") {
|
|
1440
1770
|
const slug = instanceName.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
1441
|
-
console.log(` ${
|
|
1442
|
-
console.log(` ${
|
|
1771
|
+
console.log(` ${import_picocolors8.default.dim("Bundle ID:")} ${import_picocolors8.default.dim("com.cursor.")}${highlight(slug)}`);
|
|
1772
|
+
console.log(` ${import_picocolors8.default.dim("Location:")} ${import_picocolors8.default.dim("~/Applications/")}${highlight(instanceName + ".app")}`);
|
|
1443
1773
|
if (action === "reinstall") {
|
|
1444
|
-
const dataDir = (0,
|
|
1445
|
-
console.log(` ${
|
|
1774
|
+
const dataDir = (0, import_node_path8.join)(process.env.HOME ?? "", "Library", "Application Support", instanceName.replace(/ /g, ""));
|
|
1775
|
+
console.log(` ${import_picocolors8.default.dim("Data:")} ${import_picocolors8.default.green("\u2713")} ${import_picocolors8.default.dim("Preserved at")} ${import_picocolors8.default.dim(dataDir)}`);
|
|
1446
1776
|
}
|
|
1447
1777
|
} else {
|
|
1448
|
-
const targetPath = (0,
|
|
1449
|
-
console.log(` ${
|
|
1778
|
+
const targetPath = (0, import_node_path8.join)(process.env.HOME ?? "", "Applications", `${instanceName}.app`);
|
|
1779
|
+
console.log(` ${import_picocolors8.default.dim("Path:")} ${import_picocolors8.default.dim(targetPath)}`);
|
|
1450
1780
|
}
|
|
1451
1781
|
console.log();
|
|
1452
1782
|
printDivider();
|
|
1453
1783
|
console.log();
|
|
1454
|
-
const shouldContinue = await
|
|
1784
|
+
const shouldContinue = await p7.confirm({
|
|
1455
1785
|
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.",
|
|
1456
1786
|
initialValue: action !== "remove"
|
|
1457
1787
|
});
|
|
1458
|
-
if (
|
|
1459
|
-
|
|
1788
|
+
if (p7.isCancel(shouldContinue) || !shouldContinue) {
|
|
1789
|
+
p7.cancel("Operation cancelled");
|
|
1460
1790
|
process.exit(0);
|
|
1461
1791
|
}
|
|
1462
1792
|
console.log();
|
|
@@ -1472,26 +1802,26 @@ var instanceCommand = (0, import_citty6.defineCommand)({
|
|
|
1472
1802
|
if (action === "create") {
|
|
1473
1803
|
printSuccess(`Instance ${highlight(instanceName)} created successfully!`);
|
|
1474
1804
|
console.log();
|
|
1475
|
-
console.log(
|
|
1476
|
-
console.log(
|
|
1477
|
-
console.log(
|
|
1478
|
-
console.log(
|
|
1805
|
+
console.log(import_picocolors8.default.dim(" Next steps:"));
|
|
1806
|
+
console.log(import_picocolors8.default.dim(" \u2022 The new instance should launch automatically"));
|
|
1807
|
+
console.log(import_picocolors8.default.dim(" \u2022 Sign in with a different Cursor account"));
|
|
1808
|
+
console.log(import_picocolors8.default.dim(" \u2022 Find it in ~/Applications/"));
|
|
1479
1809
|
} else if (action === "reinstall") {
|
|
1480
1810
|
printSuccess(`Instance ${highlight(instanceName)} reinstalled successfully!`);
|
|
1481
1811
|
console.log();
|
|
1482
|
-
console.log(
|
|
1483
|
-
console.log(
|
|
1484
|
-
console.log(
|
|
1485
|
-
console.log(
|
|
1812
|
+
console.log(import_picocolors8.default.dim(" The instance has been:"));
|
|
1813
|
+
console.log(import_picocolors8.default.dim(" \u2022 Refreshed with the latest Cursor version"));
|
|
1814
|
+
console.log(import_picocolors8.default.dim(" \u2022 Relaunched with your preserved data"));
|
|
1815
|
+
console.log(import_picocolors8.default.dim(" \u2022 Ready to use with your existing account"));
|
|
1486
1816
|
} else {
|
|
1487
1817
|
printSuccess(`Instance ${highlight(instanceName)} removed successfully!`);
|
|
1488
1818
|
}
|
|
1489
1819
|
console.log();
|
|
1490
|
-
|
|
1820
|
+
p7.outro(import_picocolors8.default.green("\u2728 Done!"));
|
|
1491
1821
|
} else {
|
|
1492
1822
|
printWarning(`Operation completed with exit code ${exitCode}`);
|
|
1493
1823
|
console.log();
|
|
1494
|
-
|
|
1824
|
+
p7.outro(import_picocolors8.default.yellow("Check the output above for details"));
|
|
1495
1825
|
process.exit(exitCode);
|
|
1496
1826
|
}
|
|
1497
1827
|
}
|