cursor-kit-cli 1.3.0 → 1.4.0

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 CHANGED
@@ -163,6 +163,18 @@ function deleteFile(path) {
163
163
  (0, import_node_fs.rmSync)(path);
164
164
  }
165
165
  }
166
+ function getAgentDir(cwd = process.cwd()) {
167
+ return (0, import_node_path.join)(cwd, ".agent");
168
+ }
169
+ function getAgentRulesDir(cwd = process.cwd()) {
170
+ return (0, import_node_path.join)(getAgentDir(cwd), "rules");
171
+ }
172
+ function getAgentWorkflowsDir(cwd = process.cwd()) {
173
+ return (0, import_node_path.join)(getAgentDir(cwd), "workflows");
174
+ }
175
+ function getAgentSkillsDir(cwd = process.cwd()) {
176
+ return (0, import_node_path.join)(getAgentDir(cwd), "skills");
177
+ }
166
178
 
167
179
  // src/utils/templates.ts
168
180
  var import_node_path2 = require("path");
@@ -316,6 +328,71 @@ function extractFrontmatter(content) {
316
328
  }
317
329
  return result;
318
330
  }
331
+ function getSemanticDescriptionForRule(filename) {
332
+ const baseName = filename.replace(/\.(md|mdc)$/, "").toLowerCase();
333
+ const semanticMap = {
334
+ "toc": "Table of contents, skill routing, rule selection guide, when to apply rules",
335
+ "git": "Git commit conventions, branching strategy, version control, commit messages",
336
+ "coding-style": "Code formatting, style guidelines, best practices, clean code"
337
+ };
338
+ return semanticMap[baseName] || "";
339
+ }
340
+ function transformRuleForAntiGravity(content, filename = "") {
341
+ const frontmatter = extractFrontmatter(content);
342
+ const body = stripFrontmatter(content);
343
+ const trigger = frontmatter.alwaysApply === true ? "always_on" : "model_decision";
344
+ const existingDesc = frontmatter.description || frontmatter.name || "";
345
+ const semanticDesc = getSemanticDescriptionForRule(filename);
346
+ const description = semanticDesc || existingDesc;
347
+ let newFrontmatter = `---
348
+ trigger: ${trigger}
349
+ `;
350
+ if (description) {
351
+ newFrontmatter += `description: ${description}
352
+ `;
353
+ }
354
+ newFrontmatter += "---\n\n";
355
+ return newFrontmatter + body;
356
+ }
357
+ function transformCommandToWorkflow(content, filename) {
358
+ const frontmatter = extractFrontmatter(content);
359
+ const body = stripFrontmatter(content);
360
+ const description = frontmatter.description || filename.replace(/\.md$/, "").split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
361
+ const newFrontmatter = `---
362
+ description: ${description}
363
+ ---
364
+
365
+ `;
366
+ return newFrontmatter + body;
367
+ }
368
+ function transformSkillForAntiGravity(content) {
369
+ const frontmatter = extractFrontmatter(content);
370
+ const body = stripFrontmatter(content);
371
+ const description = frontmatter.description || frontmatter.name || "";
372
+ let newFrontmatter = `---
373
+ trigger: manual
374
+ `;
375
+ if (description) {
376
+ newFrontmatter += `description: ${description}
377
+ `;
378
+ }
379
+ newFrontmatter += "---\n\n";
380
+ return newFrontmatter + body;
381
+ }
382
+ function copyLocalSkillForAntiGravity(skillName, targetDir) {
383
+ const sourcePath = getLocalSkillDir(skillName);
384
+ if (!sourcePath) return false;
385
+ const destPath = (0, import_node_path2.join)(targetDir, skillName);
386
+ ensureDir(destPath);
387
+ copyDir(sourcePath, destPath);
388
+ const skillMdPath = (0, import_node_path2.join)(destPath, "SKILL.md");
389
+ if (fileExists(skillMdPath)) {
390
+ const content = readFile(skillMdPath);
391
+ const transformedContent = transformSkillForAntiGravity(content);
392
+ writeFile(skillMdPath, transformedContent);
393
+ }
394
+ return true;
395
+ }
319
396
  function generateCopilotIndex(commands, rules, skills, alwaysApplyRules = []) {
320
397
  let output = "# GitHub Copilot Custom Instructions\n\n";
321
398
  output += "> Generated by cursor-kit-cli\n\n";
@@ -489,6 +566,11 @@ async function promptTargetSelection() {
489
566
  value: "github-copilot",
490
567
  label: "GitHub Copilot",
491
568
  hint: "Generate .github/copilot-instructions.md"
569
+ },
570
+ {
571
+ value: "google-antigravity",
572
+ label: "Google AntiGravity",
573
+ hint: "Generate .agent/ directory with rules and workflows"
492
574
  }
493
575
  ],
494
576
  initialValue: "cursor"
@@ -583,6 +665,146 @@ async function handleCopilotInstallation(cwd, manifest, args, shouldInitCommands
583
665
  process.exit(1);
584
666
  }
585
667
  }
668
+ async function handleAntiGravityInstallation(cwd, manifest, args, shouldInitCommands, shouldInitRules, shouldInitSkills) {
669
+ const s = p2.spinner();
670
+ const agentDir = getAgentDir(cwd);
671
+ const rulesDir = getAgentRulesDir(cwd);
672
+ const workflowsDir = getAgentWorkflowsDir(cwd);
673
+ const skillsDir = getAgentSkillsDir(cwd);
674
+ const existingRules = getConflictingFiles(rulesDir, manifest.rules);
675
+ const existingWorkflows = getConflictingFiles(workflowsDir, manifest.commands);
676
+ const existingSkills = getConflictingDirs(skillsDir, manifest.skills);
677
+ if ((existingRules.length > 0 || existingWorkflows.length > 0 || existingSkills.length > 0) && !args.force) {
678
+ console.log();
679
+ console.log(import_picocolors3.default.yellow("\u26A0 Existing files found:"));
680
+ for (const file of [...existingRules, ...existingWorkflows, ...existingSkills]) {
681
+ console.log(import_picocolors3.default.dim(` \u2514\u2500 ${file}`));
682
+ }
683
+ console.log();
684
+ const proceed = await p2.confirm({
685
+ message: "Overwrite existing files?",
686
+ initialValue: false
687
+ });
688
+ if (p2.isCancel(proceed) || !proceed) {
689
+ p2.cancel("Operation cancelled");
690
+ process.exit(0);
691
+ }
692
+ }
693
+ let selectedCommands = [];
694
+ let selectedRules = [];
695
+ let selectedSkills = [];
696
+ if (shouldInitCommands) {
697
+ if (args.all) {
698
+ selectedCommands = manifest.commands;
699
+ } else {
700
+ const selection = await selectTemplates("commands", manifest.commands);
701
+ if (p2.isCancel(selection)) {
702
+ p2.cancel("Operation cancelled");
703
+ process.exit(0);
704
+ }
705
+ selectedCommands = selection;
706
+ }
707
+ }
708
+ if (shouldInitRules) {
709
+ if (args.all) {
710
+ selectedRules = manifest.rules;
711
+ } else {
712
+ const selection = await selectTemplates("rules", manifest.rules);
713
+ if (p2.isCancel(selection)) {
714
+ p2.cancel("Operation cancelled");
715
+ process.exit(0);
716
+ }
717
+ selectedRules = selection;
718
+ }
719
+ }
720
+ if (shouldInitSkills) {
721
+ if (args.all) {
722
+ selectedSkills = manifest.skills;
723
+ } else {
724
+ const selection = await selectTemplates("skills", manifest.skills);
725
+ if (p2.isCancel(selection)) {
726
+ p2.cancel("Operation cancelled");
727
+ process.exit(0);
728
+ }
729
+ selectedSkills = selection;
730
+ }
731
+ }
732
+ if (selectedCommands.length === 0 && selectedRules.length === 0 && selectedSkills.length === 0) {
733
+ p2.cancel("No templates selected");
734
+ process.exit(0);
735
+ }
736
+ const results = {
737
+ workflows: [],
738
+ rules: [],
739
+ skills: []
740
+ };
741
+ try {
742
+ ensureDir(agentDir);
743
+ ensureDir(rulesDir);
744
+ ensureDir(workflowsDir);
745
+ ensureDir(skillsDir);
746
+ if (selectedCommands.length > 0) {
747
+ s.start("Installing workflows...");
748
+ const templates = await fetchMultipleTemplates("commands", selectedCommands);
749
+ for (const [filename, content] of templates) {
750
+ const transformedContent = transformCommandToWorkflow(content, filename);
751
+ const filePath = (0, import_node_path4.join)(workflowsDir, filename);
752
+ writeFile(filePath, transformedContent);
753
+ results.workflows.push(filename);
754
+ }
755
+ s.stop("Workflows installed");
756
+ }
757
+ if (selectedRules.length > 0) {
758
+ s.start("Installing rules...");
759
+ const templates = await fetchMultipleTemplates("rules", selectedRules);
760
+ for (const [filename, content] of templates) {
761
+ const transformedContent = transformRuleForAntiGravity(content, filename);
762
+ const filePath = (0, import_node_path4.join)(rulesDir, filename);
763
+ writeFile(filePath, transformedContent);
764
+ results.rules.push(filename);
765
+ }
766
+ s.stop("Rules installed");
767
+ }
768
+ if (selectedSkills.length > 0) {
769
+ s.start("Installing skills...");
770
+ for (const skillName of selectedSkills) {
771
+ const success = copyLocalSkillForAntiGravity(skillName, skillsDir);
772
+ if (success) {
773
+ results.skills.push(skillName);
774
+ }
775
+ }
776
+ s.stop("Skills installed");
777
+ }
778
+ printDivider();
779
+ console.log();
780
+ if (results.workflows.length > 0) {
781
+ printSuccess(`Workflows: ${highlight(results.workflows.length.toString())} added`);
782
+ for (const wf of results.workflows) {
783
+ console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.green("+")} ${wf}`));
784
+ }
785
+ }
786
+ if (results.rules.length > 0) {
787
+ printSuccess(`Rules: ${highlight(results.rules.length.toString())} added`);
788
+ for (const rule of results.rules) {
789
+ console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.green("+")} ${rule}`));
790
+ }
791
+ }
792
+ if (results.skills.length > 0) {
793
+ printSuccess(`Skills: ${highlight(results.skills.length.toString())} added`);
794
+ for (const skill of results.skills) {
795
+ console.log(import_picocolors3.default.dim(` \u2514\u2500 ${import_picocolors3.default.green("+")} ${skill}`));
796
+ }
797
+ }
798
+ console.log();
799
+ p2.outro(import_picocolors3.default.green("\u2728 Google AntiGravity configuration created successfully!"));
800
+ } catch (error) {
801
+ s.stop("Failed");
802
+ p2.cancel(
803
+ `Error: ${error instanceof Error ? error.message : "Unknown error"}`
804
+ );
805
+ process.exit(1);
806
+ }
807
+ }
586
808
  async function selectTemplates(type, availableTemplates) {
587
809
  const labelFn = type === "skills" ? getSkillLabel : getTemplateLabel;
588
810
  const selectionMode = await p2.select({
@@ -752,7 +974,7 @@ var initCommand = (0, import_citty.defineCommand)({
752
974
  target: {
753
975
  type: "string",
754
976
  alias: "t",
755
- description: "Target AI IDE: 'cursor' or 'github-copilot'",
977
+ description: "Target AI IDE: 'cursor', 'github-copilot', or 'google-antigravity'",
756
978
  default: void 0
757
979
  }
758
980
  },
@@ -768,7 +990,7 @@ var initCommand = (0, import_citty.defineCommand)({
768
990
  const shouldInitSkills = initAll || args.skills;
769
991
  p2.intro(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" cursor-kit init ")));
770
992
  let target;
771
- if (args.target === "github-copilot" || args.target === "cursor") {
993
+ if (args.target === "github-copilot" || args.target === "cursor" || args.target === "google-antigravity") {
772
994
  target = args.target;
773
995
  } else {
774
996
  const selection = await promptTargetSelection();
@@ -802,6 +1024,17 @@ var initCommand = (0, import_citty.defineCommand)({
802
1024
  );
803
1025
  return;
804
1026
  }
1027
+ if (target === "google-antigravity") {
1028
+ await handleAntiGravityInstallation(
1029
+ cwd,
1030
+ manifest,
1031
+ args,
1032
+ shouldInitCommands,
1033
+ shouldInitRules,
1034
+ shouldInitSkills
1035
+ );
1036
+ return;
1037
+ }
805
1038
  const results = {};
806
1039
  try {
807
1040
  ensureDir(cursorDir);