@intellectronica/ruler 0.3.12 → 0.3.14
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 +1 -4
- package/dist/agents/CrushAgent.js +37 -3
- package/dist/agents/CursorAgent.js +11 -50
- package/dist/core/apply-engine.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Ruler solves this by providing a **single source of truth** for all your AI agen
|
|
|
61
61
|
| Claude Code | `CLAUDE.md` | `.mcp.json` |
|
|
62
62
|
| OpenAI Codex CLI | `AGENTS.md` | `.codex/config.toml` |
|
|
63
63
|
| Jules | `AGENTS.md` | - |
|
|
64
|
-
| Cursor |
|
|
64
|
+
| Cursor | `AGENTS.md` | `.cursor/mcp.json` |
|
|
65
65
|
| Windsurf | `AGENTS.md` | `.windsurf/mcp_config.json` |
|
|
66
66
|
| Cline | `.clinerules` | - |
|
|
67
67
|
| Crush | `CRUSH.md` | `.crush.json` |
|
|
@@ -712,11 +712,8 @@ node_modules/
|
|
|
712
712
|
# START Ruler Generated Files
|
|
713
713
|
.aider.conf.yml
|
|
714
714
|
.clinerules
|
|
715
|
-
.cursor/rules/ruler_cursor_instructions.mdc
|
|
716
|
-
.windsurf/rules/ruler_windsurf_instructions.md
|
|
717
715
|
AGENTS.md
|
|
718
716
|
CLAUDE.md
|
|
719
|
-
AGENTS.md
|
|
720
717
|
# END Ruler Generated Files
|
|
721
718
|
|
|
722
719
|
dist/
|
|
@@ -49,6 +49,37 @@ class CrushAgent {
|
|
|
49
49
|
mcp: path.join(projectRoot, '.crush.json'),
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Transform MCP server types for Crush compatibility.
|
|
54
|
+
* Crush expects "http" for HTTP servers and "sse" for SSE servers, not "remote".
|
|
55
|
+
*/
|
|
56
|
+
transformMcpServersForCrush(mcpServers) {
|
|
57
|
+
const transformedServers = {};
|
|
58
|
+
for (const [name, serverDef] of Object.entries(mcpServers)) {
|
|
59
|
+
if (serverDef && typeof serverDef === 'object') {
|
|
60
|
+
const server = serverDef;
|
|
61
|
+
const transformedServer = { ...server };
|
|
62
|
+
// Transform type: "remote" to appropriate Crush types
|
|
63
|
+
if (server.type === 'remote' &&
|
|
64
|
+
server.url &&
|
|
65
|
+
typeof server.url === 'string') {
|
|
66
|
+
const url = server.url;
|
|
67
|
+
// Check if URL suggests SSE (contains /sse path segment)
|
|
68
|
+
if (/\/sse(\/|$)/i.test(url)) {
|
|
69
|
+
transformedServer.type = 'sse';
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
transformedServer.type = 'http';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
transformedServers[name] = transformedServer;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
transformedServers[name] = serverDef;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return transformedServers;
|
|
82
|
+
}
|
|
52
83
|
async applyRulerConfig(concatenatedRules, projectRoot, rulerMcpJson, agentConfig) {
|
|
53
84
|
const outputPaths = this.getDefaultOutputPath(projectRoot);
|
|
54
85
|
const instructionsPath = agentConfig?.outputPathInstructions ?? outputPaths['instructions'];
|
|
@@ -59,24 +90,27 @@ class CrushAgent {
|
|
|
59
90
|
try {
|
|
60
91
|
const existingMcpConfig = JSON.parse(await fs.readFile(mcpPath, 'utf-8'));
|
|
61
92
|
if (existingMcpConfig && typeof existingMcpConfig === 'object') {
|
|
93
|
+
const transformedServers = this.transformMcpServersForCrush((rulerMcpJson?.mcpServers ?? {}));
|
|
62
94
|
finalMcpConfig = {
|
|
63
95
|
...existingMcpConfig,
|
|
64
96
|
mcp: {
|
|
65
97
|
...(existingMcpConfig.mcp || {}),
|
|
66
|
-
...
|
|
98
|
+
...transformedServers,
|
|
67
99
|
},
|
|
68
100
|
};
|
|
69
101
|
}
|
|
70
102
|
else if (rulerMcpJson) {
|
|
103
|
+
const transformedServers = this.transformMcpServersForCrush((rulerMcpJson?.mcpServers ?? {}));
|
|
71
104
|
finalMcpConfig = {
|
|
72
|
-
mcp:
|
|
105
|
+
mcp: transformedServers,
|
|
73
106
|
};
|
|
74
107
|
}
|
|
75
108
|
}
|
|
76
109
|
catch {
|
|
77
110
|
if (rulerMcpJson) {
|
|
111
|
+
const transformedServers = this.transformMcpServersForCrush((rulerMcpJson?.mcpServers ?? {}));
|
|
78
112
|
finalMcpConfig = {
|
|
79
|
-
mcp:
|
|
113
|
+
mcp: transformedServers,
|
|
80
114
|
};
|
|
81
115
|
}
|
|
82
116
|
}
|
|
@@ -1,46 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.CursorAgent = void 0;
|
|
37
|
-
const
|
|
38
|
-
const AbstractAgent_1 = require("./AbstractAgent");
|
|
39
|
-
const FileSystemUtils_1 = require("../core/FileSystemUtils");
|
|
4
|
+
const AgentsMdAgent_1 = require("./AgentsMdAgent");
|
|
40
5
|
/**
|
|
41
6
|
* Cursor agent adapter.
|
|
7
|
+
* Leverages the standardized AGENTS.md approach supported natively by Cursor.
|
|
8
|
+
* See: https://docs.cursor.com/en/cli/using
|
|
42
9
|
*/
|
|
43
|
-
class CursorAgent extends
|
|
10
|
+
class CursorAgent extends AgentsMdAgent_1.AgentsMdAgent {
|
|
44
11
|
getIdentifier() {
|
|
45
12
|
return 'cursor';
|
|
46
13
|
}
|
|
@@ -48,20 +15,14 @@ class CursorAgent extends AbstractAgent_1.AbstractAgent {
|
|
|
48
15
|
return 'Cursor';
|
|
49
16
|
}
|
|
50
17
|
async applyRulerConfig(concatenatedRules, projectRoot, _rulerMcpJson, agentConfig, backup = true) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const content = `${frontMatter}${concatenatedRules.trimStart()}`;
|
|
57
|
-
await (0, FileSystemUtils_1.ensureDirExists)(path.dirname(absolutePath));
|
|
58
|
-
if (backup) {
|
|
59
|
-
await (0, FileSystemUtils_1.backupFile)(absolutePath);
|
|
60
|
-
}
|
|
61
|
-
await (0, FileSystemUtils_1.writeGeneratedFile)(absolutePath, content);
|
|
18
|
+
// Write AGENTS.md via base class
|
|
19
|
+
// Cursor natively reads AGENTS.md from the project root
|
|
20
|
+
await super.applyRulerConfig(concatenatedRules, projectRoot, null, {
|
|
21
|
+
outputPath: agentConfig?.outputPath,
|
|
22
|
+
}, backup);
|
|
62
23
|
}
|
|
63
|
-
|
|
64
|
-
return
|
|
24
|
+
getMcpServerKey() {
|
|
25
|
+
return 'mcpServers';
|
|
65
26
|
}
|
|
66
27
|
supportsMcpStdio() {
|
|
67
28
|
return true;
|
|
@@ -442,7 +442,8 @@ async function applyMcpConfiguration(agent, filteredMcpJson, dest, agentConfig,
|
|
|
442
442
|
// Agents that handle MCP configuration internally should not have external MCP handling
|
|
443
443
|
if (agent.getIdentifier() === 'zed' ||
|
|
444
444
|
agent.getIdentifier() === 'gemini-cli' ||
|
|
445
|
-
agent.getIdentifier() === 'amazon-q-cli'
|
|
445
|
+
agent.getIdentifier() === 'amazon-q-cli' ||
|
|
446
|
+
agent.getIdentifier() === 'crush') {
|
|
446
447
|
(0, constants_1.logVerbose)(`Skipping external MCP config for ${agent.getName()} - handled internally by agent`, verbose);
|
|
447
448
|
return;
|
|
448
449
|
}
|