ai-jue-adapter-cursor 1.0.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/index.js +66 -0
- package/package.json +38 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generate = generate;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const ai_jue_core_1 = require("ai-jue-core");
|
|
9
|
+
async function generate(config, outputDir) {
|
|
10
|
+
// 1. Generate .cursorrules
|
|
11
|
+
let cursorRulesContent = '';
|
|
12
|
+
// Inject AGENTS.md content first (Global Context)
|
|
13
|
+
if (config.prompts?.agents?.content) {
|
|
14
|
+
cursorRulesContent += `# Global Context & Agents\n\n${config.prompts.agents.content}\n\n`;
|
|
15
|
+
}
|
|
16
|
+
// Add Prompts
|
|
17
|
+
if (config.prompts) {
|
|
18
|
+
for (const [key, value] of Object.entries(config.prompts)) {
|
|
19
|
+
if (key === 'agents')
|
|
20
|
+
continue;
|
|
21
|
+
const content = value.content || value;
|
|
22
|
+
cursorRulesContent += `## Prompt: ${key}\n\n${content}\n\n`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Add Skills as natural language descriptions
|
|
26
|
+
if (config.skills) {
|
|
27
|
+
cursorRulesContent += `## Skills\n\nYou have access to the following skills:\n\n`;
|
|
28
|
+
for (const [key, value] of Object.entries(config.skills)) {
|
|
29
|
+
const skill = value;
|
|
30
|
+
cursorRulesContent += `### ${key}\n${skill.content || skill.prompt || ''}\n\n`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Add Commands as trigger rules
|
|
34
|
+
if (config.commands) {
|
|
35
|
+
cursorRulesContent += `## Commands\n\nFollow these rules when the user uses specific triggers:\n\n`;
|
|
36
|
+
for (const [key, value] of Object.entries(config.commands)) {
|
|
37
|
+
const cmd = value;
|
|
38
|
+
const triggers = cmd.triggers ? cmd.triggers.join(', ') : `/${key}`;
|
|
39
|
+
cursorRulesContent += `### ${key}\n**Triggers:** ${triggers}\n\n**Action:** ${cmd.prompt}\n\n`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Add Hooks suggestions
|
|
43
|
+
if (config.hooks) {
|
|
44
|
+
cursorRulesContent += `## Workflow Hooks\n\nPlease follow these workflow rules:\n\n`;
|
|
45
|
+
for (const [key, value] of Object.entries(config.hooks)) {
|
|
46
|
+
const hookValue = value;
|
|
47
|
+
const script = typeof hookValue === 'string' ? hookValue : hookValue.script;
|
|
48
|
+
if (key === 'pre-commit') {
|
|
49
|
+
cursorRulesContent += `- **Pre-commit**: Before committing changes, please ensure you run: \`${script}\`\n`;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
cursorRulesContent += `- **${key}**: \`${script}\`\n`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (cursorRulesContent.trim()) {
|
|
57
|
+
(0, ai_jue_core_1.generateMarkdownFile)(path_1.default.join(outputDir, '.cursorrules'), cursorRulesContent);
|
|
58
|
+
}
|
|
59
|
+
// 2. Generate .cursor/mcp.json
|
|
60
|
+
if (config.mcp && config.mcp.servers) {
|
|
61
|
+
const mcpConfig = {
|
|
62
|
+
mcpServers: config.mcp.servers
|
|
63
|
+
};
|
|
64
|
+
(0, ai_jue_core_1.generateJsonFile)(path_1.default.join(outputDir, '.cursor', 'mcp.json'), mcpConfig);
|
|
65
|
+
}
|
|
66
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-jue-adapter-cursor",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "AI-Jue adapter for Cursor",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"ai-jue",
|
|
11
|
+
"adapter",
|
|
12
|
+
"cursor"
|
|
13
|
+
],
|
|
14
|
+
"author": "AI-Jue Team <contact@ai-jue.dev>",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"ai-jue-core": "*",
|
|
18
|
+
"@types/node": "^20.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.0.0"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/ai-jue/ai-jue.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/ai-jue/ai-jue/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/ai-jue/ai-jue#readme",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"types": "dist/index.d.ts"
|
|
38
|
+
}
|