@intellectronica/ruler 0.2.3 → 0.2.4

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/README.md CHANGED
@@ -40,7 +40,7 @@ Ruler solves this by providing a **single source of truth** for all your AI agen
40
40
  | GitHub Copilot | `.github/copilot-instructions.md` |
41
41
  | Claude Code | `CLAUDE.md` |
42
42
  | OpenAI Codex CLI | `AGENTS.md` |
43
- | Cursor | `.cursor/rules/ruler_cursor_instructions.md` |
43
+ | Cursor | `.cursor/rules/ruler_cursor_instructions.mdc` |
44
44
  | Windsurf | `.windsurf/rules/ruler_windsurf_instructions.md` |
45
45
  | Cline | `.clinerules` |
46
46
  | Aider | `ruler_aider_instructions.md` and `.aider.conf.yml` |
@@ -288,7 +288,7 @@ node_modules/
288
288
  # START Ruler Generated Files
289
289
  .aider.conf.yml
290
290
  .clinerules
291
- .cursor/rules/ruler_cursor_instructions.md
291
+ .cursor/rules/ruler_cursor_instructions.mdc
292
292
  .github/copilot-instructions.md
293
293
  .windsurf/rules/ruler_windsurf_instructions.md
294
294
  AGENTS.md
@@ -55,5 +55,8 @@ class CopilotAgent {
55
55
  getDefaultOutputPath(projectRoot) {
56
56
  return path.join(projectRoot, '.github', 'copilot-instructions.md');
57
57
  }
58
+ getMcpServerKey() {
59
+ return 'servers';
60
+ }
58
61
  }
59
62
  exports.CopilotAgent = CopilotAgent;
@@ -53,7 +53,7 @@ class CursorAgent {
53
53
  await (0, FileSystemUtils_1.writeGeneratedFile)(output, concatenatedRules);
54
54
  }
55
55
  getDefaultOutputPath(projectRoot) {
56
- return path.join(projectRoot, '.cursor', 'rules', 'ruler_cursor_instructions.md');
56
+ return path.join(projectRoot, '.cursor', 'rules', 'ruler_cursor_instructions.mdc');
57
57
  }
58
58
  }
59
59
  exports.CursorAgent = CursorAgent;
@@ -175,7 +175,7 @@ and apply them to your configured AI coding agents.
175
175
 
176
176
  # [agents.cursor]
177
177
  # enabled = true
178
- # output_path = ".cursor/rules/ruler_cursor_instructions.md"
178
+ # output_path = ".cursor/rules/ruler_cursor_instructions.mdc"
179
179
 
180
180
  # [agents.windsurf]
181
181
  # enabled = true
package/dist/lib.js CHANGED
@@ -222,13 +222,15 @@ async function applyAllAgentConfigs(projectRoot, includedAgents, configPath, cli
222
222
  agentConfig?.mcp?.strategy ??
223
223
  config.mcp?.strategy ??
224
224
  'merge';
225
- (0, constants_1.logVerbose)(`Applying MCP config for ${agent.getName()} with strategy: ${strategy}`, verbose);
225
+ // Determine the correct server key for the agent
226
+ const serverKey = agent.getMcpServerKey?.() ?? 'mcpServers';
227
+ (0, constants_1.logVerbose)(`Applying MCP config for ${agent.getName()} with strategy: ${strategy} and key: ${serverKey}`, verbose);
226
228
  if (dryRun) {
227
229
  (0, constants_1.logVerbose)(`DRY RUN: Would apply MCP config to: ${dest}`, true);
228
230
  }
229
231
  else {
230
232
  const existing = await (0, mcp_1.readNativeMcp)(dest);
231
- const merged = (0, merge_1.mergeMcp)(existing, rulerMcpJson, strategy);
233
+ const merged = (0, merge_1.mergeMcp)(existing, rulerMcpJson, strategy, serverKey);
232
234
  await (0, mcp_1.writeNativeMcp)(dest, merged);
233
235
  }
234
236
  }
package/dist/mcp/merge.js CHANGED
@@ -6,16 +6,26 @@ exports.mergeMcp = mergeMcp;
6
6
  * @param base Existing native MCP config object.
7
7
  * @param incoming Ruler MCP config object.
8
8
  * @param strategy Merge strategy: 'merge' to union servers, 'overwrite' to replace.
9
+ * @param serverKey The key to use for servers in the output (e.g., 'servers' for Copilot, 'mcpServers' for others).
9
10
  * @returns Merged MCP config object.
10
11
  */
11
- function mergeMcp(base, incoming, strategy) {
12
+ function mergeMcp(base, incoming, strategy, serverKey) {
12
13
  if (strategy === 'overwrite') {
13
- return incoming;
14
+ // Ensure the incoming object uses the correct server key.
15
+ const incomingServers = incoming.mcpServers || {};
16
+ return {
17
+ [serverKey]: incomingServers,
18
+ };
14
19
  }
15
- const baseServers = base.mcpServers || {};
20
+ const baseServers = base[serverKey] ||
21
+ base.mcpServers ||
22
+ {}; // Handle legacy key in existing files
16
23
  const incomingServers = incoming.mcpServers || {};
24
+ const mergedServers = { ...baseServers, ...incomingServers };
25
+ const newBase = { ...base };
26
+ delete newBase.mcpServers; // Remove old key if present
17
27
  return {
18
- ...base,
19
- mcpServers: { ...baseServers, ...incomingServers },
28
+ ...newBase,
29
+ [serverKey]: mergedServers,
20
30
  };
21
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intellectronica/ruler",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Ruler — apply the same rules to all coding agents",
5
5
  "main": "dist/lib.js",
6
6
  "scripts": {