memorix 0.4.0 → 0.4.1

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/index.js CHANGED
@@ -1607,6 +1607,99 @@ var init_antigravity = __esm({
1607
1607
  }
1608
1608
  });
1609
1609
 
1610
+ // src/rules/adapters/copilot.ts
1611
+ import matter6 from "gray-matter";
1612
+ var CopilotAdapter;
1613
+ var init_copilot = __esm({
1614
+ "src/rules/adapters/copilot.ts"() {
1615
+ "use strict";
1616
+ init_esm_shims();
1617
+ init_utils();
1618
+ CopilotAdapter = class {
1619
+ source = "copilot";
1620
+ filePatterns = [
1621
+ ".github/copilot-instructions.md",
1622
+ ".github/instructions/*.instructions.md"
1623
+ ];
1624
+ parse(filePath, content) {
1625
+ if (filePath.includes(".instructions.md") && filePath.includes(".github/instructions")) {
1626
+ return this.parsePathSpecific(filePath, content);
1627
+ }
1628
+ if (filePath.includes("copilot-instructions.md")) {
1629
+ return this.parseRepoWide(filePath, content);
1630
+ }
1631
+ return [];
1632
+ }
1633
+ generate(rules) {
1634
+ if (rules.length === 1 && (!rules[0].paths || rules[0].paths.length === 0)) {
1635
+ return [{
1636
+ filePath: ".github/copilot-instructions.md",
1637
+ content: rules[0].content
1638
+ }];
1639
+ }
1640
+ return rules.map((rule, i) => {
1641
+ const fm = {};
1642
+ if (rule.paths && rule.paths.length > 0) {
1643
+ fm.applyTo = rule.paths.join(",");
1644
+ }
1645
+ if (rule.description) {
1646
+ fm.description = rule.description;
1647
+ }
1648
+ const fileName = rule.id.replace(/^copilot:/, "").replace(/[^a-zA-Z0-9-_]/g, "-") || `instruction-${i}`;
1649
+ const body = Object.keys(fm).length > 0 ? matter6.stringify(rule.content, fm) : rule.content;
1650
+ return {
1651
+ filePath: `.github/instructions/${fileName}.instructions.md`,
1652
+ content: body
1653
+ };
1654
+ });
1655
+ }
1656
+ /**
1657
+ * Parse repository-wide .github/copilot-instructions.md
1658
+ * This is plain Markdown with no frontmatter.
1659
+ */
1660
+ parseRepoWide(filePath, content) {
1661
+ const trimmed = content.trim();
1662
+ if (!trimmed) return [];
1663
+ return [{
1664
+ id: generateRuleId("copilot", filePath),
1665
+ content: trimmed,
1666
+ description: "Repository-wide Copilot instructions",
1667
+ source: "copilot",
1668
+ scope: "project",
1669
+ priority: 3,
1670
+ hash: hashContent(trimmed)
1671
+ }];
1672
+ }
1673
+ /**
1674
+ * Parse path-specific .github/instructions/*.instructions.md
1675
+ * These have YAML frontmatter with `applyTo` glob pattern(s).
1676
+ */
1677
+ parsePathSpecific(filePath, content) {
1678
+ const { data, content: body } = matter6(content);
1679
+ const trimmed = body.trim();
1680
+ if (!trimmed) return [];
1681
+ const applyTo = data.applyTo;
1682
+ const hasApplyTo = !!applyTo;
1683
+ const rule = {
1684
+ id: generateRuleId("copilot", filePath),
1685
+ content: trimmed,
1686
+ source: "copilot",
1687
+ scope: hasApplyTo ? "path-specific" : "project",
1688
+ priority: 5,
1689
+ hash: hashContent(trimmed)
1690
+ };
1691
+ if (hasApplyTo) {
1692
+ rule.paths = applyTo.split(",").map((p3) => p3.trim());
1693
+ }
1694
+ if (data.description) {
1695
+ rule.description = data.description;
1696
+ }
1697
+ return [rule];
1698
+ }
1699
+ };
1700
+ }
1701
+ });
1702
+
1610
1703
  // src/rules/syncer.ts
1611
1704
  var syncer_exports = {};
1612
1705
  __export(syncer_exports, {
@@ -1624,6 +1717,7 @@ var init_syncer = __esm({
1624
1717
  init_codex();
1625
1718
  init_windsurf();
1626
1719
  init_antigravity();
1720
+ init_copilot();
1627
1721
  RulesSyncer = class {
1628
1722
  projectRoot;
1629
1723
  adapters;
@@ -1635,7 +1729,8 @@ var init_syncer = __esm({
1635
1729
  new ClaudeCodeAdapter(),
1636
1730
  new CodexAdapter(),
1637
1731
  new WindsurfAdapter(),
1638
- new AntigravityAdapter()
1732
+ new AntigravityAdapter(),
1733
+ new CopilotAdapter()
1639
1734
  ];
1640
1735
  for (const a of all) {
1641
1736
  this.adapters.set(a.source, a);
@@ -2101,7 +2196,7 @@ import { homedir as homedir5 } from "os";
2101
2196
  import { join as join5 } from "path";
2102
2197
  import { existsSync as existsSync2, readFileSync } from "fs";
2103
2198
  var CopilotMCPAdapter;
2104
- var init_copilot = __esm({
2199
+ var init_copilot2 = __esm({
2105
2200
  "src/workspace/mcp-adapters/copilot.ts"() {
2106
2201
  "use strict";
2107
2202
  init_esm_shims();
@@ -2245,7 +2340,7 @@ var init_antigravity2 = __esm({
2245
2340
  });
2246
2341
 
2247
2342
  // src/workspace/workflow-sync.ts
2248
- import matter6 from "gray-matter";
2343
+ import matter7 from "gray-matter";
2249
2344
  var WorkflowSyncer;
2250
2345
  var init_workflow_sync = __esm({
2251
2346
  "src/workspace/workflow-sync.ts"() {
@@ -2260,7 +2355,7 @@ var init_workflow_sync = __esm({
2260
2355
  let description = "";
2261
2356
  let content = raw;
2262
2357
  try {
2263
- const parsed = matter6(raw);
2358
+ const parsed = matter7(raw);
2264
2359
  description = parsed.data?.description ?? "";
2265
2360
  content = parsed.content.trim();
2266
2361
  } catch {
@@ -2282,7 +2377,7 @@ var init_workflow_sync = __esm({
2282
2377
  if (wf.description) {
2283
2378
  fm.description = wf.description;
2284
2379
  }
2285
- const content = matter6.stringify(wf.content, fm);
2380
+ const content = matter7.stringify(wf.content, fm);
2286
2381
  return {
2287
2382
  filePath: `.agents/skills/${safeName}/SKILL.md`,
2288
2383
  content
@@ -2299,7 +2394,7 @@ var init_workflow_sync = __esm({
2299
2394
  }
2300
2395
  fm.globs = "";
2301
2396
  fm.alwaysApply = "false";
2302
- const content = matter6.stringify(wf.content, fm);
2397
+ const content = matter7.stringify(wf.content, fm);
2303
2398
  return {
2304
2399
  filePath: `.cursor/rules/${safeName}.mdc`,
2305
2400
  content
@@ -2498,7 +2593,7 @@ var init_engine2 = __esm({
2498
2593
  init_cursor2();
2499
2594
  init_codex2();
2500
2595
  init_claude_code2();
2501
- init_copilot();
2596
+ init_copilot2();
2502
2597
  init_antigravity2();
2503
2598
  init_workflow_sync();
2504
2599
  init_syncer();
@@ -2622,7 +2717,7 @@ var init_engine2 = __esm({
2622
2717
  cursor: [".cursor/skills", ".cursor/skills-cursor"],
2623
2718
  windsurf: [".windsurf/skills"],
2624
2719
  "claude-code": [".claude/skills"],
2625
- copilot: [],
2720
+ copilot: [".github/skills", ".copilot/skills"],
2626
2721
  antigravity: [".agent/skills", ".gemini/skills", ".gemini/antigravity/skills"]
2627
2722
  };
2628
2723
  /** Get the target skills directory for an agent (null if agent has no skills support) */
@@ -2809,7 +2904,7 @@ var init_engine2 = __esm({
2809
2904
  "claude-code": "claude-code",
2810
2905
  codex: "codex",
2811
2906
  windsurf: "windsurf",
2812
- copilot: "windsurf",
2907
+ copilot: "copilot",
2813
2908
  antigravity: "antigravity"
2814
2909
  };
2815
2910
  return map[target] ?? null;
@@ -3747,12 +3842,12 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
3747
3842
  };
3748
3843
  }
3749
3844
  );
3750
- const RULE_SOURCES = ["cursor", "claude-code", "codex", "windsurf", "antigravity"];
3845
+ const RULE_SOURCES = ["cursor", "claude-code", "codex", "windsurf", "antigravity", "copilot"];
3751
3846
  server.registerTool(
3752
3847
  "memorix_rules_sync",
3753
3848
  {
3754
3849
  title: "Rules Sync",
3755
- description: "Scan project for agent rule files (Cursor, Claude Code, Codex, Windsurf, Antigravity), deduplicate, detect conflicts, and optionally generate rules for a target agent format. Without target: returns sync status report. With target: generates converted rule files.",
3850
+ description: "Scan project for agent rule files (Cursor, Claude Code, Codex, Windsurf, Antigravity, Copilot), deduplicate, detect conflicts, and optionally generate rules for a target agent format. Without target: returns sync status report. With target: generates converted rule files.",
3756
3851
  inputSchema: {
3757
3852
  action: z.enum(["status", "generate"]).describe('Action: "status" for report, "generate" to produce target files'),
3758
3853
  target: z.enum(RULE_SOURCES).optional().describe("Target agent format for generation (required when action=generate)")