cursor-kit-cli 1.3.0 → 1.4.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.js CHANGED
@@ -136,6 +136,18 @@ function deleteFile(path) {
136
136
  rmSync(path);
137
137
  }
138
138
  }
139
+ function getAgentDir(cwd = process.cwd()) {
140
+ return join(cwd, ".agent");
141
+ }
142
+ function getAgentRulesDir(cwd = process.cwd()) {
143
+ return join(getAgentDir(cwd), "rules");
144
+ }
145
+ function getAgentWorkflowsDir(cwd = process.cwd()) {
146
+ return join(getAgentDir(cwd), "workflows");
147
+ }
148
+ function getAgentSkillsDir(cwd = process.cwd()) {
149
+ return join(getAgentDir(cwd), "skills");
150
+ }
139
151
 
140
152
  // src/utils/templates.ts
141
153
  import { join as join2, dirname as dirname2 } from "path";
@@ -289,6 +301,71 @@ function extractFrontmatter(content) {
289
301
  }
290
302
  return result;
291
303
  }
304
+ function getSemanticDescriptionForRule(filename) {
305
+ const baseName = filename.replace(/\.(md|mdc)$/, "").toLowerCase();
306
+ const semanticMap = {
307
+ "toc": "Table of contents, skill routing, rule selection guide, when to apply rules",
308
+ "git": "Git commit conventions, branching strategy, version control, commit messages",
309
+ "coding-style": "Code formatting, style guidelines, best practices, clean code"
310
+ };
311
+ return semanticMap[baseName] || "";
312
+ }
313
+ function transformRuleForAntiGravity(content, filename = "") {
314
+ const frontmatter = extractFrontmatter(content);
315
+ const body = stripFrontmatter(content);
316
+ const trigger = frontmatter.alwaysApply === true ? "always_on" : "model_decision";
317
+ const existingDesc = frontmatter.description || frontmatter.name || "";
318
+ const semanticDesc = getSemanticDescriptionForRule(filename);
319
+ const description = semanticDesc || existingDesc;
320
+ let newFrontmatter = `---
321
+ trigger: ${trigger}
322
+ `;
323
+ if (description) {
324
+ newFrontmatter += `description: ${description}
325
+ `;
326
+ }
327
+ newFrontmatter += "---\n\n";
328
+ return newFrontmatter + body;
329
+ }
330
+ function transformCommandToWorkflow(content, filename) {
331
+ const frontmatter = extractFrontmatter(content);
332
+ const body = stripFrontmatter(content);
333
+ const description = frontmatter.description || filename.replace(/\.md$/, "").split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
334
+ const newFrontmatter = `---
335
+ description: ${description}
336
+ ---
337
+
338
+ `;
339
+ return newFrontmatter + body;
340
+ }
341
+ function transformSkillForAntiGravity(content) {
342
+ const frontmatter = extractFrontmatter(content);
343
+ const body = stripFrontmatter(content);
344
+ const description = frontmatter.description || frontmatter.name || "";
345
+ let newFrontmatter = `---
346
+ trigger: manual
347
+ `;
348
+ if (description) {
349
+ newFrontmatter += `description: ${description}
350
+ `;
351
+ }
352
+ newFrontmatter += "---\n\n";
353
+ return newFrontmatter + body;
354
+ }
355
+ function copyLocalSkillForAntiGravity(skillName, targetDir) {
356
+ const sourcePath = getLocalSkillDir(skillName);
357
+ if (!sourcePath) return false;
358
+ const destPath = join2(targetDir, skillName);
359
+ ensureDir(destPath);
360
+ copyDir(sourcePath, destPath);
361
+ const skillMdPath = join2(destPath, "SKILL.md");
362
+ if (fileExists(skillMdPath)) {
363
+ const content = readFile(skillMdPath);
364
+ const transformedContent = transformSkillForAntiGravity(content);
365
+ writeFile(skillMdPath, transformedContent);
366
+ }
367
+ return true;
368
+ }
292
369
  function generateCopilotIndex(commands, rules, skills, alwaysApplyRules = []) {
293
370
  let output = "# GitHub Copilot Custom Instructions\n\n";
294
371
  output += "> Generated by cursor-kit-cli\n\n";
@@ -462,6 +539,11 @@ async function promptTargetSelection() {
462
539
  value: "github-copilot",
463
540
  label: "GitHub Copilot",
464
541
  hint: "Generate .github/copilot-instructions.md"
542
+ },
543
+ {
544
+ value: "google-antigravity",
545
+ label: "Google AntiGravity",
546
+ hint: "Generate .agent/ directory with rules and workflows"
465
547
  }
466
548
  ],
467
549
  initialValue: "cursor"
@@ -556,6 +638,146 @@ async function handleCopilotInstallation(cwd, manifest, args, shouldInitCommands
556
638
  process.exit(1);
557
639
  }
558
640
  }
641
+ async function handleAntiGravityInstallation(cwd, manifest, args, shouldInitCommands, shouldInitRules, shouldInitSkills) {
642
+ const s = p2.spinner();
643
+ const agentDir = getAgentDir(cwd);
644
+ const rulesDir = getAgentRulesDir(cwd);
645
+ const workflowsDir = getAgentWorkflowsDir(cwd);
646
+ const skillsDir = getAgentSkillsDir(cwd);
647
+ const existingRules = getConflictingFiles(rulesDir, manifest.rules);
648
+ const existingWorkflows = getConflictingFiles(workflowsDir, manifest.commands);
649
+ const existingSkills = getConflictingDirs(skillsDir, manifest.skills);
650
+ if ((existingRules.length > 0 || existingWorkflows.length > 0 || existingSkills.length > 0) && !args.force) {
651
+ console.log();
652
+ console.log(pc3.yellow("\u26A0 Existing files found:"));
653
+ for (const file of [...existingRules, ...existingWorkflows, ...existingSkills]) {
654
+ console.log(pc3.dim(` \u2514\u2500 ${file}`));
655
+ }
656
+ console.log();
657
+ const proceed = await p2.confirm({
658
+ message: "Overwrite existing files?",
659
+ initialValue: false
660
+ });
661
+ if (p2.isCancel(proceed) || !proceed) {
662
+ p2.cancel("Operation cancelled");
663
+ process.exit(0);
664
+ }
665
+ }
666
+ let selectedCommands = [];
667
+ let selectedRules = [];
668
+ let selectedSkills = [];
669
+ if (shouldInitCommands) {
670
+ if (args.all) {
671
+ selectedCommands = manifest.commands;
672
+ } else {
673
+ const selection = await selectTemplates("commands", manifest.commands);
674
+ if (p2.isCancel(selection)) {
675
+ p2.cancel("Operation cancelled");
676
+ process.exit(0);
677
+ }
678
+ selectedCommands = selection;
679
+ }
680
+ }
681
+ if (shouldInitRules) {
682
+ if (args.all) {
683
+ selectedRules = manifest.rules;
684
+ } else {
685
+ const selection = await selectTemplates("rules", manifest.rules);
686
+ if (p2.isCancel(selection)) {
687
+ p2.cancel("Operation cancelled");
688
+ process.exit(0);
689
+ }
690
+ selectedRules = selection;
691
+ }
692
+ }
693
+ if (shouldInitSkills) {
694
+ if (args.all) {
695
+ selectedSkills = manifest.skills;
696
+ } else {
697
+ const selection = await selectTemplates("skills", manifest.skills);
698
+ if (p2.isCancel(selection)) {
699
+ p2.cancel("Operation cancelled");
700
+ process.exit(0);
701
+ }
702
+ selectedSkills = selection;
703
+ }
704
+ }
705
+ if (selectedCommands.length === 0 && selectedRules.length === 0 && selectedSkills.length === 0) {
706
+ p2.cancel("No templates selected");
707
+ process.exit(0);
708
+ }
709
+ const results = {
710
+ workflows: [],
711
+ rules: [],
712
+ skills: []
713
+ };
714
+ try {
715
+ ensureDir(agentDir);
716
+ ensureDir(rulesDir);
717
+ ensureDir(workflowsDir);
718
+ ensureDir(skillsDir);
719
+ if (selectedCommands.length > 0) {
720
+ s.start("Installing workflows...");
721
+ const templates = await fetchMultipleTemplates("commands", selectedCommands);
722
+ for (const [filename, content] of templates) {
723
+ const transformedContent = transformCommandToWorkflow(content, filename);
724
+ const filePath = join4(workflowsDir, filename);
725
+ writeFile(filePath, transformedContent);
726
+ results.workflows.push(filename);
727
+ }
728
+ s.stop("Workflows installed");
729
+ }
730
+ if (selectedRules.length > 0) {
731
+ s.start("Installing rules...");
732
+ const templates = await fetchMultipleTemplates("rules", selectedRules);
733
+ for (const [filename, content] of templates) {
734
+ const transformedContent = transformRuleForAntiGravity(content, filename);
735
+ const filePath = join4(rulesDir, filename);
736
+ writeFile(filePath, transformedContent);
737
+ results.rules.push(filename);
738
+ }
739
+ s.stop("Rules installed");
740
+ }
741
+ if (selectedSkills.length > 0) {
742
+ s.start("Installing skills...");
743
+ for (const skillName of selectedSkills) {
744
+ const success = copyLocalSkillForAntiGravity(skillName, skillsDir);
745
+ if (success) {
746
+ results.skills.push(skillName);
747
+ }
748
+ }
749
+ s.stop("Skills installed");
750
+ }
751
+ printDivider();
752
+ console.log();
753
+ if (results.workflows.length > 0) {
754
+ printSuccess(`Workflows: ${highlight(results.workflows.length.toString())} added`);
755
+ for (const wf of results.workflows) {
756
+ console.log(pc3.dim(` \u2514\u2500 ${pc3.green("+")} ${wf}`));
757
+ }
758
+ }
759
+ if (results.rules.length > 0) {
760
+ printSuccess(`Rules: ${highlight(results.rules.length.toString())} added`);
761
+ for (const rule of results.rules) {
762
+ console.log(pc3.dim(` \u2514\u2500 ${pc3.green("+")} ${rule}`));
763
+ }
764
+ }
765
+ if (results.skills.length > 0) {
766
+ printSuccess(`Skills: ${highlight(results.skills.length.toString())} added`);
767
+ for (const skill of results.skills) {
768
+ console.log(pc3.dim(` \u2514\u2500 ${pc3.green("+")} ${skill}`));
769
+ }
770
+ }
771
+ console.log();
772
+ p2.outro(pc3.green("\u2728 Google AntiGravity configuration created successfully!"));
773
+ } catch (error) {
774
+ s.stop("Failed");
775
+ p2.cancel(
776
+ `Error: ${error instanceof Error ? error.message : "Unknown error"}`
777
+ );
778
+ process.exit(1);
779
+ }
780
+ }
559
781
  async function selectTemplates(type, availableTemplates) {
560
782
  const labelFn = type === "skills" ? getSkillLabel : getTemplateLabel;
561
783
  const selectionMode = await p2.select({
@@ -725,7 +947,7 @@ var initCommand = defineCommand({
725
947
  target: {
726
948
  type: "string",
727
949
  alias: "t",
728
- description: "Target AI IDE: 'cursor' or 'github-copilot'",
950
+ description: "Target AI IDE: 'cursor', 'github-copilot', or 'google-antigravity'",
729
951
  default: void 0
730
952
  }
731
953
  },
@@ -741,7 +963,7 @@ var initCommand = defineCommand({
741
963
  const shouldInitSkills = initAll || args.skills;
742
964
  p2.intro(pc3.bgCyan(pc3.black(" cursor-kit init ")));
743
965
  let target;
744
- if (args.target === "github-copilot" || args.target === "cursor") {
966
+ if (args.target === "github-copilot" || args.target === "cursor" || args.target === "google-antigravity") {
745
967
  target = args.target;
746
968
  } else {
747
969
  const selection = await promptTargetSelection();
@@ -775,6 +997,17 @@ var initCommand = defineCommand({
775
997
  );
776
998
  return;
777
999
  }
1000
+ if (target === "google-antigravity") {
1001
+ await handleAntiGravityInstallation(
1002
+ cwd,
1003
+ manifest,
1004
+ args,
1005
+ shouldInitCommands,
1006
+ shouldInitRules,
1007
+ shouldInitSkills
1008
+ );
1009
+ return;
1010
+ }
778
1011
  const results = {};
779
1012
  try {
780
1013
  ensureDir(cursorDir);