cursor-kit-cli 1.3.0-beta.1 → 1.3.0-beta.2
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 +90 -23
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +90 -23
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/templates/manifest.json +3 -3
- package/templates/rules/{coding-style.mdc → coding-style.md} +2 -2
- package/templates/rules/toc.md +28 -0
- package/templates/skills/frontend-design/{SKILL.mdc → SKILL.md} +1 -1
- package/templates/skills/frontend-development/{SKILL.mdc → SKILL.md} +1 -1
- package/templates/skills/research/{SKILL.mdc → SKILL.md} +1 -1
- package/templates/rules/toc.mdc +0 -28
- /package/templates/rules/{git.mdc → git.md} +0 -0
- /package/templates/skills/backend-development/{SKILL.mdc → SKILL.md} +0 -0
- /package/templates/skills/problem-solving/{SKILL.mdc → SKILL.md} +0 -0
- /package/templates/skills/sequential-thinking/{SKILL.mdc → SKILL.md} +0 -0
- /package/templates/skills/ui-styling/{SKILL.mdc → SKILL.md} +0 -0
package/dist/cli.js
CHANGED
|
@@ -174,7 +174,7 @@ function getLocalManifest() {
|
|
|
174
174
|
}
|
|
175
175
|
return {
|
|
176
176
|
commands: dirExists(commandsDir) ? listFiles(commandsDir, ".md") : [],
|
|
177
|
-
rules: dirExists(rulesDir) ? listFiles(rulesDir, ".
|
|
177
|
+
rules: dirExists(rulesDir) ? listFiles(rulesDir, ".md") : [],
|
|
178
178
|
skills: dirExists(skillsDir) ? listDirs(skillsDir) : []
|
|
179
179
|
};
|
|
180
180
|
}
|
|
@@ -184,6 +184,12 @@ function getLocalTemplateContent(type, filename) {
|
|
|
184
184
|
if (fileExists(filePath)) {
|
|
185
185
|
return readFile(filePath);
|
|
186
186
|
}
|
|
187
|
+
if (type === "rules" && filename.endsWith(".md")) {
|
|
188
|
+
const mdcPath = filePath.replace(/\.md$/, ".mdc");
|
|
189
|
+
if (fileExists(mdcPath)) {
|
|
190
|
+
return readFile(mdcPath);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
187
193
|
return null;
|
|
188
194
|
}
|
|
189
195
|
function getLocalSkillDir(skillName) {
|
|
@@ -194,12 +200,29 @@ function getLocalSkillDir(skillName) {
|
|
|
194
200
|
}
|
|
195
201
|
return null;
|
|
196
202
|
}
|
|
197
|
-
function
|
|
203
|
+
function convertMdToMdc(filename) {
|
|
204
|
+
return filename.replace(/\.md$/, ".mdc");
|
|
205
|
+
}
|
|
206
|
+
function transformTocContentForCursor(content) {
|
|
207
|
+
content = content.replace(/\]\(\.\.\/skills\/([^/]+)\/SKILL\.md\)/g, "](../skills/$1/SKILL.mdc)");
|
|
208
|
+
content = content.replace(/\]\(\.\/([^)]+)\.md\)/g, "](./$1.mdc)");
|
|
209
|
+
return content;
|
|
210
|
+
}
|
|
211
|
+
function copyLocalSkill(skillName, targetDir, convertToMdc = false) {
|
|
198
212
|
const sourcePath = getLocalSkillDir(skillName);
|
|
199
213
|
if (!sourcePath) return false;
|
|
200
214
|
const destPath = join2(targetDir, skillName);
|
|
201
215
|
ensureDir(destPath);
|
|
202
216
|
copyDir(sourcePath, destPath);
|
|
217
|
+
if (convertToMdc) {
|
|
218
|
+
const skillMdPath = join2(destPath, "SKILL.md");
|
|
219
|
+
const skillMdcPath = join2(destPath, "SKILL.mdc");
|
|
220
|
+
if (fileExists(skillMdPath)) {
|
|
221
|
+
const content = readFile(skillMdPath);
|
|
222
|
+
writeFile(skillMdcPath, content);
|
|
223
|
+
deleteFile(skillMdPath);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
203
226
|
return true;
|
|
204
227
|
}
|
|
205
228
|
async function fetchTemplateManifest() {
|
|
@@ -345,7 +368,7 @@ async function installCopilotRules(rulesDir, selectedRules) {
|
|
|
345
368
|
for (const [filename, content] of rulesMap) {
|
|
346
369
|
const frontmatter = extractFrontmatter(content);
|
|
347
370
|
const cleanContent = stripFrontmatter(content);
|
|
348
|
-
const mdFilename = filename.replace(/\.mdc$/, ".md");
|
|
371
|
+
const mdFilename = filename.endsWith(".md") ? filename : filename.replace(/\.mdc$/, ".md");
|
|
349
372
|
const filePath = join3(rulesDir, mdFilename);
|
|
350
373
|
writeFile(filePath, cleanContent);
|
|
351
374
|
installed.push(mdFilename);
|
|
@@ -365,7 +388,11 @@ async function installCopilotSkills(skillsDir, selectedSkills) {
|
|
|
365
388
|
const skillTargetDir = join3(skillsDir, skillName);
|
|
366
389
|
const skillMdcPath = join3(skillTargetDir, "SKILL.mdc");
|
|
367
390
|
const skillMdPath = join3(skillTargetDir, "SKILL.md");
|
|
368
|
-
if (fileExists(
|
|
391
|
+
if (fileExists(skillMdPath)) {
|
|
392
|
+
const content = readFile(skillMdPath);
|
|
393
|
+
const cleanContent = stripFrontmatter(content);
|
|
394
|
+
writeFile(skillMdPath, cleanContent);
|
|
395
|
+
} else if (fileExists(skillMdcPath)) {
|
|
369
396
|
const content = readFile(skillMdcPath);
|
|
370
397
|
const cleanContent = stripFrontmatter(content);
|
|
371
398
|
writeFile(skillMdPath, cleanContent);
|
|
@@ -592,16 +619,25 @@ async function handleConflicts(type, conflictingFiles) {
|
|
|
592
619
|
});
|
|
593
620
|
return strategy;
|
|
594
621
|
}
|
|
595
|
-
async function installTemplates(type, targetDir, selectedTemplates, conflictStrategy) {
|
|
622
|
+
async function installTemplates(type, targetDir, selectedTemplates, conflictStrategy, target) {
|
|
596
623
|
const result = { added: [], skipped: [] };
|
|
597
|
-
const
|
|
624
|
+
const expectedFilenames = selectedTemplates.map((filename) => {
|
|
625
|
+
if (target === "cursor" && type === "rules" && filename.endsWith(".md")) {
|
|
626
|
+
return convertMdToMdc(filename);
|
|
627
|
+
}
|
|
628
|
+
return filename;
|
|
629
|
+
});
|
|
630
|
+
const conflictingFiles = getConflictingFiles(targetDir, expectedFilenames);
|
|
598
631
|
let templatesToInstall;
|
|
599
632
|
if (conflictStrategy === "merge") {
|
|
600
633
|
templatesToInstall = selectedTemplates.filter(
|
|
601
|
-
(t) =>
|
|
634
|
+
(t) => {
|
|
635
|
+
const expectedName = target === "cursor" && type === "rules" && t.endsWith(".md") ? convertMdToMdc(t) : t;
|
|
636
|
+
return !conflictingFiles.includes(expectedName);
|
|
637
|
+
}
|
|
602
638
|
);
|
|
603
639
|
result.skipped = conflictingFiles.filter(
|
|
604
|
-
(f) =>
|
|
640
|
+
(f) => expectedFilenames.includes(f)
|
|
605
641
|
);
|
|
606
642
|
} else {
|
|
607
643
|
templatesToInstall = selectedTemplates;
|
|
@@ -612,13 +648,18 @@ async function installTemplates(type, targetDir, selectedTemplates, conflictStra
|
|
|
612
648
|
const templates = await fetchMultipleTemplates(type, templatesToInstall);
|
|
613
649
|
ensureDir(targetDir);
|
|
614
650
|
for (const [filename, content] of templates) {
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
|
|
651
|
+
const outputFilename = target === "cursor" && type === "rules" && filename.endsWith(".md") ? convertMdToMdc(filename) : filename;
|
|
652
|
+
let transformedContent = content;
|
|
653
|
+
if (target === "cursor" && type === "rules" && filename === "toc.md") {
|
|
654
|
+
transformedContent = transformTocContentForCursor(content);
|
|
655
|
+
}
|
|
656
|
+
const filePath = join4(targetDir, outputFilename);
|
|
657
|
+
writeFile(filePath, transformedContent);
|
|
658
|
+
result.added.push(outputFilename);
|
|
618
659
|
}
|
|
619
660
|
return result;
|
|
620
661
|
}
|
|
621
|
-
async function installSkills(targetDir, selectedSkills, conflictStrategy) {
|
|
662
|
+
async function installSkills(targetDir, selectedSkills, conflictStrategy, target) {
|
|
622
663
|
const result = { added: [], skipped: [] };
|
|
623
664
|
const conflictingDirs = getConflictingDirs(targetDir, selectedSkills);
|
|
624
665
|
let skillsToInstall;
|
|
@@ -636,8 +677,9 @@ async function installSkills(targetDir, selectedSkills, conflictStrategy) {
|
|
|
636
677
|
return result;
|
|
637
678
|
}
|
|
638
679
|
ensureDir(targetDir);
|
|
680
|
+
const convertToMdc = target === "cursor";
|
|
639
681
|
for (const skillName of skillsToInstall) {
|
|
640
|
-
const success = copyLocalSkill(skillName, targetDir);
|
|
682
|
+
const success = copyLocalSkill(skillName, targetDir, convertToMdc);
|
|
641
683
|
if (success) {
|
|
642
684
|
result.added.push(skillName);
|
|
643
685
|
}
|
|
@@ -766,7 +808,8 @@ var initCommand = defineCommand({
|
|
|
766
808
|
"commands",
|
|
767
809
|
commandsDir,
|
|
768
810
|
selectedCommands,
|
|
769
|
-
commandStrategy
|
|
811
|
+
commandStrategy,
|
|
812
|
+
target
|
|
770
813
|
);
|
|
771
814
|
s.stop("Commands installed");
|
|
772
815
|
}
|
|
@@ -782,7 +825,10 @@ var initCommand = defineCommand({
|
|
|
782
825
|
}
|
|
783
826
|
selectedRules = selection;
|
|
784
827
|
}
|
|
785
|
-
const
|
|
828
|
+
const expectedRuleFilenames = selectedRules.map((filename) => {
|
|
829
|
+
return target === "cursor" && filename.endsWith(".md") ? convertMdToMdc(filename) : filename;
|
|
830
|
+
});
|
|
831
|
+
const conflictingRules = getConflictingFiles(rulesDir, expectedRuleFilenames);
|
|
786
832
|
let ruleStrategy = "overwrite";
|
|
787
833
|
if (conflictingRules.length > 0 && !args.force) {
|
|
788
834
|
const strategy = await handleConflicts("rules", conflictingRules);
|
|
@@ -797,7 +843,8 @@ var initCommand = defineCommand({
|
|
|
797
843
|
"rules",
|
|
798
844
|
rulesDir,
|
|
799
845
|
selectedRules,
|
|
800
|
-
ruleStrategy
|
|
846
|
+
ruleStrategy,
|
|
847
|
+
target
|
|
801
848
|
);
|
|
802
849
|
s.stop("Rules installed");
|
|
803
850
|
}
|
|
@@ -827,7 +874,8 @@ var initCommand = defineCommand({
|
|
|
827
874
|
results.skills = await installSkills(
|
|
828
875
|
skillsDir,
|
|
829
876
|
selectedSkills,
|
|
830
|
-
skillStrategy
|
|
877
|
+
skillStrategy,
|
|
878
|
+
target
|
|
831
879
|
);
|
|
832
880
|
s.stop("Skills installed");
|
|
833
881
|
}
|
|
@@ -1045,13 +1093,16 @@ var addCommand = defineCommand2({
|
|
|
1045
1093
|
displayPath = targetPath;
|
|
1046
1094
|
} else {
|
|
1047
1095
|
const targetDir = isCommand ? getCommandsDir() : getRulesDir();
|
|
1048
|
-
const extension =
|
|
1096
|
+
const extension = ".md";
|
|
1049
1097
|
targetPath = join5(targetDir, `${slug}${extension}`);
|
|
1050
1098
|
displayPath = targetPath;
|
|
1051
1099
|
}
|
|
1052
|
-
|
|
1100
|
+
const checkPath = isSkill ? targetPath : isCommand ? targetPath : join5(getRulesDir(), `${slug}.mdc`);
|
|
1101
|
+
const exists = isSkill ? dirExists(targetPath) : fileExists(targetPath) || !isCommand && fileExists(checkPath);
|
|
1102
|
+
if (exists) {
|
|
1103
|
+
const displayName = isSkill ? slug : isCommand ? `${slug}.md` : `${slug}.md/.mdc`;
|
|
1053
1104
|
const shouldOverwrite = await p3.confirm({
|
|
1054
|
-
message: `${highlight(
|
|
1105
|
+
message: `${highlight(displayName)} already exists. Overwrite?`,
|
|
1055
1106
|
initialValue: false
|
|
1056
1107
|
});
|
|
1057
1108
|
if (p3.isCancel(shouldOverwrite) || !shouldOverwrite) {
|
|
@@ -1065,21 +1116,37 @@ var addCommand = defineCommand2({
|
|
|
1065
1116
|
if (isSkill) {
|
|
1066
1117
|
ensureDir(targetPath);
|
|
1067
1118
|
ensureDir(join5(targetPath, "references"));
|
|
1068
|
-
|
|
1119
|
+
const skillMdPath = join5(targetPath, "SKILL.md");
|
|
1120
|
+
writeFile(skillMdPath, SKILL_TEMPLATE);
|
|
1069
1121
|
writeFile(join5(targetPath, "references", "example.md"), SKILL_REFERENCE_TEMPLATE);
|
|
1122
|
+
const skillMdcPath = join5(targetPath, "SKILL.mdc");
|
|
1123
|
+
const content = readFile(skillMdPath);
|
|
1124
|
+
writeFile(skillMdcPath, content);
|
|
1125
|
+
deleteFile(skillMdPath);
|
|
1070
1126
|
} else {
|
|
1071
1127
|
const targetDir = isCommand ? getCommandsDir() : getRulesDir();
|
|
1072
1128
|
ensureDir(targetDir);
|
|
1073
1129
|
const template = isCommand ? COMMAND_TEMPLATE : RULE_TEMPLATE;
|
|
1074
|
-
|
|
1130
|
+
if (isCommand) {
|
|
1131
|
+
writeFile(targetPath, template);
|
|
1132
|
+
} else {
|
|
1133
|
+
writeFile(targetPath, template);
|
|
1134
|
+
const mdcPath = join5(targetDir, convertMdToMdc(`${slug}.md`));
|
|
1135
|
+
const content = readFile(targetPath);
|
|
1136
|
+
writeFile(mdcPath, content);
|
|
1137
|
+
deleteFile(targetPath);
|
|
1138
|
+
}
|
|
1075
1139
|
}
|
|
1076
1140
|
s.stop(`${itemType.charAt(0).toUpperCase() + itemType.slice(1)} created`);
|
|
1077
1141
|
console.log();
|
|
1078
1142
|
if (isSkill) {
|
|
1079
1143
|
console.log(pc4.dim(" Directory: ") + highlight(displayPath));
|
|
1080
1144
|
console.log(pc4.dim(" Main file: ") + highlight(join5(displayPath, "SKILL.mdc")));
|
|
1081
|
-
} else {
|
|
1145
|
+
} else if (isCommand) {
|
|
1082
1146
|
console.log(pc4.dim(" File: ") + highlight(displayPath));
|
|
1147
|
+
} else {
|
|
1148
|
+
const mdcPath = join5(getRulesDir(), convertMdToMdc(`${slug}.md`));
|
|
1149
|
+
console.log(pc4.dim(" File: ") + highlight(mdcPath));
|
|
1083
1150
|
}
|
|
1084
1151
|
console.log();
|
|
1085
1152
|
p3.outro(
|