agentinit 1.4.1 → 1.5.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.
Files changed (173) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +209 -0
  3. package/dist/agentinit-1.5.0.tgz +0 -0
  4. package/dist/agents/Agent.d.ts +110 -0
  5. package/dist/agents/Agent.d.ts.map +1 -0
  6. package/dist/agents/Agent.js +174 -0
  7. package/dist/agents/Agent.js.map +1 -0
  8. package/dist/agents/ClaudeAgent.d.ts +50 -0
  9. package/dist/agents/ClaudeAgent.d.ts.map +1 -0
  10. package/dist/agents/ClaudeAgent.js +249 -0
  11. package/dist/agents/ClaudeAgent.js.map +1 -0
  12. package/dist/agents/ClaudeDesktopAgent.d.ts +49 -0
  13. package/dist/agents/ClaudeDesktopAgent.d.ts.map +1 -0
  14. package/dist/agents/ClaudeDesktopAgent.js +143 -0
  15. package/dist/agents/ClaudeDesktopAgent.js.map +1 -0
  16. package/dist/agents/CodexCliAgent.d.ts +48 -0
  17. package/dist/agents/CodexCliAgent.d.ts.map +1 -0
  18. package/dist/agents/CodexCliAgent.js +262 -0
  19. package/dist/agents/CodexCliAgent.js.map +1 -0
  20. package/dist/agents/CursorAgent.d.ts +44 -0
  21. package/dist/agents/CursorAgent.d.ts.map +1 -0
  22. package/dist/agents/CursorAgent.js +231 -0
  23. package/dist/agents/CursorAgent.js.map +1 -0
  24. package/dist/agents/GeminiCliAgent.d.ts +40 -0
  25. package/dist/agents/GeminiCliAgent.d.ts.map +1 -0
  26. package/dist/agents/GeminiCliAgent.js +195 -0
  27. package/dist/agents/GeminiCliAgent.js.map +1 -0
  28. package/dist/cli.d.ts +3 -0
  29. package/dist/cli.d.ts.map +1 -0
  30. package/dist/cli.js +33191 -0
  31. package/dist/cli.js.map +1 -0
  32. package/dist/commands/apply.d.ts +2 -0
  33. package/dist/commands/apply.d.ts.map +1 -0
  34. package/dist/commands/apply.js +468 -0
  35. package/dist/commands/apply.js.map +1 -0
  36. package/dist/commands/config.d.ts +8 -0
  37. package/dist/commands/config.d.ts.map +1 -0
  38. package/dist/commands/config.js +6 -0
  39. package/dist/commands/config.js.map +1 -0
  40. package/dist/commands/detect.d.ts +6 -0
  41. package/dist/commands/detect.d.ts.map +1 -0
  42. package/dist/commands/detect.js +55 -0
  43. package/dist/commands/detect.js.map +1 -0
  44. package/dist/commands/init.d.ts +7 -0
  45. package/dist/commands/init.d.ts.map +1 -0
  46. package/dist/commands/init.js +105 -0
  47. package/dist/commands/init.js.map +1 -0
  48. package/dist/commands/mcp.d.ts +8 -0
  49. package/dist/commands/mcp.d.ts.map +1 -0
  50. package/dist/commands/mcp.js +127 -0
  51. package/dist/commands/mcp.js.map +1 -0
  52. package/dist/commands/subagents.d.ts +9 -0
  53. package/dist/commands/subagents.d.ts.map +1 -0
  54. package/dist/commands/subagents.js +6 -0
  55. package/dist/commands/subagents.js.map +1 -0
  56. package/dist/commands/sync.d.ts +7 -0
  57. package/dist/commands/sync.d.ts.map +1 -0
  58. package/dist/commands/sync.js +49 -0
  59. package/dist/commands/sync.js.map +1 -0
  60. package/dist/commands/verifyMcp.d.ts +2 -0
  61. package/dist/commands/verifyMcp.d.ts.map +1 -0
  62. package/dist/commands/verifyMcp.js +215 -0
  63. package/dist/commands/verifyMcp.js.map +1 -0
  64. package/dist/constants/index.d.ts +3 -0
  65. package/dist/constants/index.d.ts.map +1 -0
  66. package/dist/constants/index.js +3 -0
  67. package/dist/constants/index.js.map +1 -0
  68. package/dist/constants/mcp.d.ts +9 -0
  69. package/dist/constants/mcp.d.ts.map +1 -0
  70. package/dist/constants/mcp.js +28 -0
  71. package/dist/constants/mcp.js.map +1 -0
  72. package/dist/constants/tokens.d.ts +6 -0
  73. package/dist/constants/tokens.d.ts.map +1 -0
  74. package/dist/constants/tokens.js +5 -0
  75. package/dist/constants/tokens.js.map +1 -0
  76. package/dist/core/agentDetector.d.ts +9 -0
  77. package/dist/core/agentDetector.d.ts.map +1 -0
  78. package/dist/core/agentDetector.js +51 -0
  79. package/dist/core/agentDetector.js.map +1 -0
  80. package/dist/core/agentManager.d.ts +55 -0
  81. package/dist/core/agentManager.d.ts.map +1 -0
  82. package/dist/core/agentManager.js +111 -0
  83. package/dist/core/agentManager.js.map +1 -0
  84. package/dist/core/configMerger.d.ts +49 -0
  85. package/dist/core/configMerger.d.ts.map +1 -0
  86. package/dist/core/configMerger.js +180 -0
  87. package/dist/core/configMerger.js.map +1 -0
  88. package/dist/core/mcpClient.d.ts +38 -0
  89. package/dist/core/mcpClient.d.ts.map +1 -0
  90. package/dist/core/mcpClient.js +416 -0
  91. package/dist/core/mcpClient.js.map +1 -0
  92. package/dist/core/mcpFilter.d.ts +44 -0
  93. package/dist/core/mcpFilter.d.ts.map +1 -0
  94. package/dist/core/mcpFilter.js +126 -0
  95. package/dist/core/mcpFilter.js.map +1 -0
  96. package/dist/core/mcpParser.d.ts +25 -0
  97. package/dist/core/mcpParser.d.ts.map +1 -0
  98. package/dist/core/mcpParser.js +297 -0
  99. package/dist/core/mcpParser.js.map +1 -0
  100. package/dist/core/propagator.d.ts +25 -0
  101. package/dist/core/propagator.d.ts.map +1 -0
  102. package/dist/core/propagator.js +154 -0
  103. package/dist/core/propagator.js.map +1 -0
  104. package/dist/core/rulesApplicator.d.ts +29 -0
  105. package/dist/core/rulesApplicator.d.ts.map +1 -0
  106. package/dist/core/rulesApplicator.js +181 -0
  107. package/dist/core/rulesApplicator.js.map +1 -0
  108. package/dist/core/rulesParser.d.ts +41 -0
  109. package/dist/core/rulesParser.d.ts.map +1 -0
  110. package/dist/core/rulesParser.js +260 -0
  111. package/dist/core/rulesParser.js.map +1 -0
  112. package/dist/core/rulesTemplateLoader.d.ts +31 -0
  113. package/dist/core/rulesTemplateLoader.d.ts.map +1 -0
  114. package/dist/core/rulesTemplateLoader.js +75 -0
  115. package/dist/core/rulesTemplateLoader.js.map +1 -0
  116. package/dist/core/stackDetector.d.ts +16 -0
  117. package/dist/core/stackDetector.d.ts.map +1 -0
  118. package/dist/core/stackDetector.js +234 -0
  119. package/dist/core/stackDetector.js.map +1 -0
  120. package/dist/core/templateEngine.d.ts +15 -0
  121. package/dist/core/templateEngine.d.ts.map +1 -0
  122. package/dist/core/templateEngine.js +260 -0
  123. package/dist/core/templateEngine.js.map +1 -0
  124. package/dist/core/tomlGenerator.d.ts +24 -0
  125. package/dist/core/tomlGenerator.d.ts.map +1 -0
  126. package/dist/core/tomlGenerator.js +185 -0
  127. package/dist/core/tomlGenerator.js.map +1 -0
  128. package/dist/index.d.ts +21 -0
  129. package/dist/index.d.ts.map +1 -0
  130. package/dist/index.js +21 -33195
  131. package/dist/index.js.map +1 -0
  132. package/dist/lib/index.d.ts +39 -0
  133. package/dist/lib/index.d.ts.map +1 -0
  134. package/dist/lib/index.js +40 -0
  135. package/dist/lib/index.js.map +1 -0
  136. package/dist/lib/types/index.d.ts +23 -0
  137. package/dist/lib/types/index.d.ts.map +1 -0
  138. package/dist/lib/types/index.js +23 -0
  139. package/dist/lib/types/index.js.map +1 -0
  140. package/dist/lib/utils/index.d.ts +18 -0
  141. package/dist/lib/utils/index.d.ts.map +1 -0
  142. package/dist/lib/utils/index.js +21 -0
  143. package/dist/lib/utils/index.js.map +1 -0
  144. package/dist/lib/verifier/index.d.ts +22 -0
  145. package/dist/lib/verifier/index.d.ts.map +1 -0
  146. package/dist/lib/verifier/index.js +22 -0
  147. package/dist/lib/verifier/index.js.map +1 -0
  148. package/dist/registry/mcpRegistry.d.ts +12 -0
  149. package/dist/registry/mcpRegistry.d.ts.map +1 -0
  150. package/dist/registry/mcpRegistry.js +114 -0
  151. package/dist/registry/mcpRegistry.js.map +1 -0
  152. package/dist/types/index.d.ts +180 -0
  153. package/dist/types/index.d.ts.map +1 -0
  154. package/dist/types/index.js +21 -0
  155. package/dist/types/index.js.map +1 -0
  156. package/dist/types/rules.d.ts +51 -0
  157. package/dist/types/rules.d.ts.map +1 -0
  158. package/dist/types/rules.js +2 -0
  159. package/dist/types/rules.js.map +1 -0
  160. package/dist/utils/fs.d.ts +12 -0
  161. package/dist/utils/fs.d.ts.map +1 -0
  162. package/dist/utils/fs.js +91 -0
  163. package/dist/utils/fs.js.map +1 -0
  164. package/dist/utils/logger.d.ts +14 -0
  165. package/dist/utils/logger.d.ts.map +1 -0
  166. package/dist/utils/logger.js +36 -0
  167. package/dist/utils/logger.js.map +1 -0
  168. package/dist/utils/paths.d.ts +77 -0
  169. package/dist/utils/paths.d.ts.map +1 -0
  170. package/dist/utils/paths.js +140 -0
  171. package/dist/utils/paths.js.map +1 -0
  172. package/package.json +30 -6
  173. package/dist/agentinit-1.4.1.tgz +0 -0
@@ -0,0 +1,262 @@
1
+ import * as TOML from '@iarna/toml';
2
+ import { Agent } from './Agent.js';
3
+ import { readFileIfExists, writeFile, ensureDirectoryExists } from '../utils/fs.js';
4
+ /**
5
+ * OpenAI Codex CLI agent implementation
6
+ * Supports only stdio MCP servers - transforms remote servers to stdio via mcp-remote proxy
7
+ * Native config: .codex/config.toml
8
+ */
9
+ export class CodexCliAgent extends Agent {
10
+ constructor() {
11
+ const definition = {
12
+ id: 'codex',
13
+ name: 'OpenAI Codex CLI',
14
+ capabilities: {
15
+ mcp: {
16
+ stdio: true,
17
+ http: false, // Supported via transformation
18
+ sse: false // Supported via transformation
19
+ },
20
+ rules: true,
21
+ hooks: false,
22
+ commands: false,
23
+ subagents: false,
24
+ statusline: false
25
+ },
26
+ configFiles: [
27
+ {
28
+ path: '.codex/config.toml',
29
+ purpose: 'mcp',
30
+ format: 'toml',
31
+ type: 'file',
32
+ optional: true,
33
+ description: 'OpenAI Codex CLI MCP server configuration'
34
+ }
35
+ ],
36
+ nativeConfigPath: '.codex/config.toml',
37
+ globalConfigPath: '~/.codex/config.toml'
38
+ };
39
+ super(definition);
40
+ }
41
+ /**
42
+ * Apply MCP configuration to Codex CLI's native TOML format
43
+ */
44
+ async applyMCPConfig(projectPath, servers) {
45
+ const tomlConfigPath = this.getNativeMcpPath(projectPath);
46
+ // Ensure the directory exists
47
+ await ensureDirectoryExists(tomlConfigPath);
48
+ // Read existing configuration
49
+ const existingContent = await readFileIfExists(tomlConfigPath);
50
+ let existingConfig = { mcp_servers: {} };
51
+ if (existingContent) {
52
+ try {
53
+ existingConfig = TOML.parse(existingContent);
54
+ if (!existingConfig.mcp_servers) {
55
+ existingConfig.mcp_servers = {};
56
+ }
57
+ }
58
+ catch (error) {
59
+ console.warn('Warning: Existing .codex/config.toml is invalid, creating new configuration');
60
+ existingConfig = { mcp_servers: {} };
61
+ }
62
+ }
63
+ // Transform servers to stdio format and add to config
64
+ const transformedServers = this.transformMCPServers(servers);
65
+ for (const server of transformedServers) {
66
+ const codexServer = {};
67
+ // All servers should be stdio at this point after transformation
68
+ if (server.command) {
69
+ codexServer.command = server.command;
70
+ }
71
+ if (server.args && server.args.length > 0) {
72
+ codexServer.args = server.args;
73
+ }
74
+ if (server.env && Object.keys(server.env).length > 0) {
75
+ codexServer.env = server.env;
76
+ }
77
+ existingConfig.mcp_servers[server.name] = codexServer;
78
+ }
79
+ // Write the updated configuration using TOML formatting
80
+ const formattedToml = this.formatTOML(TOML.stringify(existingConfig));
81
+ await writeFile(tomlConfigPath, formattedToml);
82
+ }
83
+ /**
84
+ * Codex only supports stdio, so filter out others (they'll be transformed)
85
+ */
86
+ filterMCPServers(servers) {
87
+ // Don't filter here - let transformMCPServers handle the conversion
88
+ return servers;
89
+ }
90
+ /**
91
+ * Transform remote (HTTP/SSE) servers to stdio using mcp-remote proxy
92
+ */
93
+ transformMCPServers(servers) {
94
+ return servers.map(server => {
95
+ // Keep stdio servers as-is
96
+ if (server.type === 'stdio') {
97
+ return server;
98
+ }
99
+ // Transform remote servers to use mcp-remote proxy
100
+ const transformedServer = {
101
+ name: server.name,
102
+ type: 'stdio',
103
+ command: 'npx',
104
+ args: ['-y', 'mcp-remote@latest'],
105
+ env: server.env || {}
106
+ };
107
+ // Add the URL as an argument to mcp-remote
108
+ if (server.url) {
109
+ transformedServer.args.push(server.url);
110
+ }
111
+ // Add any headers as environment variables
112
+ if (server.headers) {
113
+ for (const [key, value] of Object.entries(server.headers)) {
114
+ transformedServer.env[`MCP_HEADER_${key.toUpperCase().replace(/-/g, '_')}`] = value;
115
+ }
116
+ }
117
+ return transformedServer;
118
+ });
119
+ }
120
+ /**
121
+ * Format TOML output for Codex CLI with proper structure and comments
122
+ */
123
+ formatTOML(tomlString) {
124
+ const lines = tomlString.split('\n');
125
+ const formattedLines = [];
126
+ // Add header comment
127
+ formattedLines.push('# Codex CLI MCP Configuration');
128
+ formattedLines.push('# Generated automatically by agentinit');
129
+ formattedLines.push('# Remote MCPs are automatically converted to stdio via mcp-remote proxy');
130
+ formattedLines.push('');
131
+ let inServerBlock = false;
132
+ for (const line of lines) {
133
+ const trimmedLine = line.trim();
134
+ if (trimmedLine.startsWith('[mcp_servers.')) {
135
+ if (inServerBlock) {
136
+ formattedLines.push(''); // Add blank line between servers
137
+ }
138
+ inServerBlock = true;
139
+ formattedLines.push(trimmedLine);
140
+ }
141
+ else if (trimmedLine) {
142
+ formattedLines.push(trimmedLine);
143
+ }
144
+ }
145
+ return formattedLines.join('\n') + '\n';
146
+ }
147
+ /**
148
+ * Apply rules configuration to Codex CLI's TOML format
149
+ */
150
+ async applyRulesConfig(configPath, rules, existingContent) {
151
+ let config = {};
152
+ // Parse existing TOML if present
153
+ if (existingContent.trim()) {
154
+ try {
155
+ config = TOML.parse(existingContent);
156
+ }
157
+ catch (error) {
158
+ // If parsing fails, start with empty config
159
+ config = {};
160
+ }
161
+ }
162
+ // Add or update rules section
163
+ if (!config.rules) {
164
+ config.rules = {};
165
+ }
166
+ // Convert rule sections to TOML structure
167
+ for (const section of rules.sections) {
168
+ config.rules[section.templateId] = {
169
+ name: section.templateName,
170
+ rules: section.rules
171
+ };
172
+ }
173
+ return this.formatTOMLRules(TOML.stringify(config));
174
+ }
175
+ /**
176
+ * Extract existing rule texts from TOML content
177
+ */
178
+ extractExistingRules(content) {
179
+ try {
180
+ const config = TOML.parse(content);
181
+ const rules = [];
182
+ if (config.rules) {
183
+ for (const [key, value] of Object.entries(config.rules)) {
184
+ if (value.rules && Array.isArray(value.rules)) {
185
+ rules.push(...value.rules);
186
+ }
187
+ }
188
+ }
189
+ return rules;
190
+ }
191
+ catch (error) {
192
+ return [];
193
+ }
194
+ }
195
+ /**
196
+ * Extract existing rule sections from TOML content
197
+ */
198
+ extractExistingSections(content) {
199
+ try {
200
+ const config = TOML.parse(content);
201
+ const sections = [];
202
+ if (config.rules) {
203
+ for (const [key, value] of Object.entries(config.rules)) {
204
+ if (value.name && value.rules && Array.isArray(value.rules)) {
205
+ sections.push({
206
+ templateId: key,
207
+ templateName: value.name,
208
+ rules: value.rules
209
+ });
210
+ }
211
+ }
212
+ }
213
+ return sections;
214
+ }
215
+ catch (error) {
216
+ return [];
217
+ }
218
+ }
219
+ /**
220
+ * Generate rules content in TOML format
221
+ */
222
+ generateRulesContent(sections) {
223
+ if (!sections || sections.length === 0) {
224
+ return '';
225
+ }
226
+ const config = { rules: {} };
227
+ for (const section of sections) {
228
+ config.rules[section.templateId] = {
229
+ name: section.templateName,
230
+ rules: section.rules
231
+ };
232
+ }
233
+ return this.formatTOMLRules(TOML.stringify(config));
234
+ }
235
+ /**
236
+ * Format TOML output for rules with proper structure and comments
237
+ */
238
+ formatTOMLRules(tomlString) {
239
+ const lines = tomlString.split('\n');
240
+ const formattedLines = [];
241
+ // Add header comment
242
+ formattedLines.push('# Codex CLI Configuration with Rules');
243
+ formattedLines.push('# Generated automatically by agentinit');
244
+ formattedLines.push('');
245
+ let inRulesSection = false;
246
+ for (const line of lines) {
247
+ const trimmedLine = line.trim();
248
+ if (trimmedLine.startsWith('[rules.')) {
249
+ if (inRulesSection) {
250
+ formattedLines.push(''); // Add blank line between rule sections
251
+ }
252
+ inRulesSection = true;
253
+ formattedLines.push(trimmedLine);
254
+ }
255
+ else if (trimmedLine) {
256
+ formattedLines.push(trimmedLine);
257
+ }
258
+ }
259
+ return formattedLines.join('\n') + '\n';
260
+ }
261
+ }
262
+ //# sourceMappingURL=CodexCliAgent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodexCliAgent.js","sourceRoot":"","sources":["../../src/agents/CodexCliAgent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAIpF;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC;QACE,MAAM,UAAU,GAAoB;YAClC,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,kBAAkB;YACxB,YAAY,EAAE;gBACZ,GAAG,EAAE;oBACH,KAAK,EAAE,IAAI;oBACX,IAAI,EAAE,KAAK,EAAE,+BAA+B;oBAC5C,GAAG,EAAE,KAAK,CAAG,+BAA+B;iBAC7C;gBACD,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,KAAK;gBACZ,QAAQ,EAAE,KAAK;gBACf,SAAS,EAAE,KAAK;gBAChB,UAAU,EAAE,KAAK;aAClB;YACD,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,oBAAoB;oBAC1B,OAAO,EAAE,KAAK;oBACd,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,2CAA2C;iBACzD;aACF;YACD,gBAAgB,EAAE,oBAAoB;YACtC,gBAAgB,EAAE,sBAAsB;SACzC,CAAC;QAEF,KAAK,CAAC,UAAU,CAAC,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,WAAmB,EAAE,OAA0B;QAClE,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAE1D,8BAA8B;QAC9B,MAAM,qBAAqB,CAAC,cAAc,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C;IAED;;OAEG;IACK,eAAe,CAAC,UAAkB;QACxC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,cAAc,GAAa,EAAE,CAAC;QAEpC,qBAAqB;QACrB,cAAc,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAC5D,cAAc,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QAC9D,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAExB,IAAI,cAAc,GAAG,KAAK,CAAC;QAE3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAEhC,IAAI,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBACtC,IAAI,cAAc,EAAE,CAAC;oBACnB,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,uCAAuC;gBAClE,CAAC;gBACD,cAAc,GAAG,IAAI,CAAC;gBACtB,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACnC,CAAC;iBAAM,IAAI,WAAW,EAAE,CAAC;gBACvB,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QAED,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1C,CAAC;CACF"}
@@ -0,0 +1,44 @@
1
+ import { Agent } from './Agent.js';
2
+ import type { MCPServerConfig } from '../types/index.js';
3
+ import type { AppliedRules, RuleSection } from '../types/rules.js';
4
+ /**
5
+ * Cursor IDE agent implementation
6
+ * Supports full MCP capabilities including stdio, HTTP, and SSE servers
7
+ * Native config: .cursor/mcp.json
8
+ */
9
+ export declare class CursorAgent extends Agent {
10
+ constructor();
11
+ /**
12
+ * Apply MCP configuration to Cursor's native .cursor/mcp.json format
13
+ */
14
+ applyMCPConfig(projectPath: string, servers: MCPServerConfig[]): Promise<void>;
15
+ /**
16
+ * Cursor supports all MCP server types, so no filtering needed
17
+ */
18
+ filterMCPServers(servers: MCPServerConfig[]): MCPServerConfig[];
19
+ /**
20
+ * Cursor doesn't need any transformations
21
+ */
22
+ transformMCPServers(servers: MCPServerConfig[]): MCPServerConfig[];
23
+ /**
24
+ * Apply rules configuration to Cursor's .cursorrules format
25
+ */
26
+ applyRulesConfig(configPath: string, rules: AppliedRules, existingContent: string): Promise<string>;
27
+ /**
28
+ * Extract existing rule texts from .cursorrules content (ignoring headers and comments)
29
+ */
30
+ extractExistingRules(content: string): string[];
31
+ /**
32
+ * Extract existing rule sections from .cursorrules content using # headers
33
+ */
34
+ extractExistingSections(content: string): RuleSection[];
35
+ /**
36
+ * Generate rules content in Cursor's .cursorrules format
37
+ */
38
+ generateRulesContent(sections: RuleSection[]): string;
39
+ /**
40
+ * Extract all rule texts from file content (ignoring headers and comments)
41
+ */
42
+ private extractAllRuleTexts;
43
+ }
44
+ //# sourceMappingURL=CursorAgent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CursorAgent.d.ts","sourceRoot":"","sources":["../../src/agents/CursorAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,eAAe,EAAqC,MAAM,mBAAmB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,KAAK;;IA2DpC;;OAEG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA2DpF;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE;IAI/D;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE;IAIlE;;OAEG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,CAAC;IA+BlB;;OAEG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAI/C;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE;IAkCvD;;OAEG;IACH,oBAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM;IAiBrD;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAc5B"}
@@ -0,0 +1,231 @@
1
+ import { Agent } from './Agent.js';
2
+ import { readFileIfExists, writeFile, ensureDirectoryExists } from '../utils/fs.js';
3
+ /**
4
+ * Cursor IDE agent implementation
5
+ * Supports full MCP capabilities including stdio, HTTP, and SSE servers
6
+ * Native config: .cursor/mcp.json
7
+ */
8
+ export class CursorAgent extends Agent {
9
+ constructor() {
10
+ const definition = {
11
+ id: 'cursor',
12
+ name: 'Cursor IDE',
13
+ url: 'https://docs.cursor.com/context/model-context-protocol',
14
+ capabilities: {
15
+ mcp: {
16
+ stdio: true,
17
+ http: true,
18
+ sse: true
19
+ },
20
+ rules: true,
21
+ hooks: false,
22
+ commands: false,
23
+ subagents: false,
24
+ statusline: false
25
+ },
26
+ configFiles: [
27
+ {
28
+ path: '.cursor/rules',
29
+ purpose: 'rules',
30
+ format: 'markdown',
31
+ type: 'folder',
32
+ optional: true,
33
+ description: 'AI behavior rules directory with MDC files'
34
+ },
35
+ {
36
+ path: 'AGENTS.md',
37
+ purpose: 'rules',
38
+ format: 'markdown',
39
+ type: 'file',
40
+ optional: true,
41
+ description: 'Simple agent instructions in markdown format'
42
+ },
43
+ {
44
+ path: '.cursor/settings.json',
45
+ purpose: 'settings',
46
+ format: 'json',
47
+ type: 'file',
48
+ optional: true,
49
+ description: 'Cursor IDE preferences and settings'
50
+ },
51
+ {
52
+ path: '.cursor/mcp.json',
53
+ purpose: 'mcp',
54
+ format: 'json',
55
+ type: 'file',
56
+ optional: true,
57
+ description: 'Model Context Protocol server configurations'
58
+ }
59
+ ],
60
+ nativeConfigPath: '.cursor/mcp.json',
61
+ globalConfigPath: '~/.cursor/mcp.json'
62
+ };
63
+ super(definition);
64
+ }
65
+ /**
66
+ * Apply MCP configuration to Cursor's native .cursor/mcp.json format
67
+ */
68
+ async applyMCPConfig(projectPath, servers) {
69
+ const mcpConfigPath = this.getNativeMcpPath(projectPath);
70
+ // Ensure the directory exists
71
+ await ensureDirectoryExists(mcpConfigPath);
72
+ // Read existing configuration
73
+ const existingContent = await readFileIfExists(mcpConfigPath);
74
+ let existingConfig = { mcpServers: {} };
75
+ if (existingContent) {
76
+ try {
77
+ existingConfig = JSON.parse(existingContent);
78
+ if (!existingConfig.mcpServers) {
79
+ existingConfig.mcpServers = {};
80
+ }
81
+ }
82
+ catch (error) {
83
+ console.warn('Warning: Existing .cursor/mcp.json is invalid, creating new configuration');
84
+ existingConfig = { mcpServers: {} };
85
+ }
86
+ }
87
+ // Convert our MCP server configs to Cursor's format
88
+ for (const server of servers) {
89
+ const cursorServer = {};
90
+ switch (server.type) {
91
+ case 'stdio':
92
+ if (server.command) {
93
+ cursorServer.command = server.command;
94
+ }
95
+ if (server.args && server.args.length > 0) {
96
+ cursorServer.args = server.args;
97
+ }
98
+ if (server.env && Object.keys(server.env).length > 0) {
99
+ cursorServer.env = server.env;
100
+ }
101
+ break;
102
+ case 'http':
103
+ case 'sse':
104
+ if (server.url) {
105
+ cursorServer.url = server.url;
106
+ }
107
+ if (server.headers && Object.keys(server.headers).length > 0) {
108
+ cursorServer.headers = server.headers;
109
+ }
110
+ break;
111
+ }
112
+ // Add or update the server in the config
113
+ existingConfig.mcpServers[server.name] = cursorServer;
114
+ }
115
+ // Write the updated configuration
116
+ const configJson = JSON.stringify(existingConfig, null, 2);
117
+ await writeFile(mcpConfigPath, configJson);
118
+ }
119
+ /**
120
+ * Cursor supports all MCP server types, so no filtering needed
121
+ */
122
+ filterMCPServers(servers) {
123
+ return servers; // Cursor supports everything
124
+ }
125
+ /**
126
+ * Cursor doesn't need any transformations
127
+ */
128
+ transformMCPServers(servers) {
129
+ return servers; // No transformations needed
130
+ }
131
+ /**
132
+ * Apply rules configuration to Cursor's .cursorrules format
133
+ */
134
+ async applyRulesConfig(configPath, rules, existingContent) {
135
+ // Extract all existing rule texts (ignore section headers)
136
+ const existingRules = this.extractAllRuleTexts(existingContent);
137
+ // Filter new sections to only include rules that don't already exist
138
+ const filteredSections = rules.sections.map(section => ({
139
+ ...section,
140
+ rules: section.rules.filter(rule => !existingRules.includes(rule))
141
+ })).filter(section => section.rules.length > 0); // Remove empty sections
142
+ if (filteredSections.length === 0) {
143
+ // No new rules to add
144
+ return existingContent;
145
+ }
146
+ // Append new sections to existing content
147
+ let content = existingContent;
148
+ if (content && !content.endsWith('\n')) {
149
+ content += '\n';
150
+ }
151
+ if (content) {
152
+ content += '\n';
153
+ }
154
+ // Add only the new sections with unique rules
155
+ const sectionsContent = this.generateRulesContent(filteredSections);
156
+ content += sectionsContent;
157
+ return content.trim() + '\n';
158
+ }
159
+ /**
160
+ * Extract existing rule texts from .cursorrules content (ignoring headers and comments)
161
+ */
162
+ extractExistingRules(content) {
163
+ return this.extractAllRuleTexts(content);
164
+ }
165
+ /**
166
+ * Extract existing rule sections from .cursorrules content using # headers
167
+ */
168
+ extractExistingSections(content) {
169
+ const lines = content.split('\n');
170
+ const sections = [];
171
+ let currentSection = null;
172
+ for (const line of lines) {
173
+ const trimmed = line.trim();
174
+ // Check if it's a section header
175
+ if (trimmed.startsWith('#') && trimmed.includes(' ')) {
176
+ // Start new section
177
+ if (currentSection) {
178
+ sections.push(currentSection);
179
+ }
180
+ const sectionName = trimmed.replace(/^#\s*/, '');
181
+ currentSection = {
182
+ templateId: sectionName.toLowerCase().replace(/\s+/g, '_'),
183
+ templateName: sectionName,
184
+ rules: []
185
+ };
186
+ }
187
+ else if (currentSection && trimmed && !trimmed.startsWith('#')) {
188
+ // Add rule to current section
189
+ currentSection.rules.push(trimmed);
190
+ }
191
+ }
192
+ // Add the last section
193
+ if (currentSection) {
194
+ sections.push(currentSection);
195
+ }
196
+ return sections;
197
+ }
198
+ /**
199
+ * Generate rules content in Cursor's .cursorrules format
200
+ */
201
+ generateRulesContent(sections) {
202
+ let content = '';
203
+ if (sections && sections.length > 0) {
204
+ // Group rules by sections
205
+ for (const ruleSection of sections) {
206
+ content += `# ${ruleSection.templateName}\n`;
207
+ for (const rule of ruleSection.rules) {
208
+ content += `${rule}\n`;
209
+ }
210
+ content += '\n';
211
+ }
212
+ }
213
+ return content;
214
+ }
215
+ /**
216
+ * Extract all rule texts from file content (ignoring headers and comments)
217
+ */
218
+ extractAllRuleTexts(content) {
219
+ const rules = [];
220
+ const lines = content.split('\n');
221
+ for (const line of lines) {
222
+ const trimmed = line.trim();
223
+ // Skip empty lines, headers (starting with #), and other comments
224
+ if (trimmed && !trimmed.startsWith('#') && !trimmed.startsWith('//')) {
225
+ rules.push(trimmed);
226
+ }
227
+ }
228
+ return rules;
229
+ }
230
+ }
231
+ //# sourceMappingURL=CursorAgent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CursorAgent.js","sourceRoot":"","sources":["../../src/agents/CursorAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAIpF;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC;QACE,MAAM,UAAU,GAAoB;YAClC,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,wDAAwD;YAC7D,YAAY,EAAE;gBACZ,GAAG,EAAE;oBACH,KAAK,EAAE,IAAI;oBACX,IAAI,EAAE,IAAI;oBACV,GAAG,EAAE,IAAI;iBACV;gBAC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C,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,40 @@
1
+ import { Agent } from './Agent.js';
2
+ import type { MCPServerConfig } from '../types/index.js';
3
+ import type { AppliedRules, RuleSection } from '../types/rules.js';
4
+ /**
5
+ * Google Gemini CLI agent implementation
6
+ * Supports stdio, HTTP, and SSE MCP servers
7
+ * Native config: .gemini/settings.json (general settings file, not just MCP)
8
+ */
9
+ export declare class GeminiCliAgent extends Agent {
10
+ constructor();
11
+ /**
12
+ * Apply MCP configuration to Gemini CLI's native JSON settings format
13
+ */
14
+ applyMCPConfig(projectPath: string, servers: MCPServerConfig[]): Promise<void>;
15
+ /**
16
+ * Gemini supports all MCP server types, so no filtering needed
17
+ */
18
+ filterMCPServers(servers: MCPServerConfig[]): MCPServerConfig[];
19
+ /**
20
+ * Gemini doesn't need any transformations
21
+ */
22
+ transformMCPServers(servers: MCPServerConfig[]): MCPServerConfig[];
23
+ /**
24
+ * Apply rules configuration to Gemini CLI's JSON format
25
+ */
26
+ applyRulesConfig(configPath: string, rules: AppliedRules, existingContent: string): Promise<string>;
27
+ /**
28
+ * Extract existing rule texts from JSON content
29
+ */
30
+ extractExistingRules(content: string): string[];
31
+ /**
32
+ * Extract existing rule sections from JSON content
33
+ */
34
+ extractExistingSections(content: string): RuleSection[];
35
+ /**
36
+ * Generate rules content in JSON format
37
+ */
38
+ generateRulesContent(sections: RuleSection[]): string;
39
+ }
40
+ //# sourceMappingURL=GeminiCliAgent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeminiCliAgent.d.ts","sourceRoot":"","sources":["../../src/agents/GeminiCliAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;;IAkCvC;;OAEG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA2DpF;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE;IAI/D;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE;IAIlE;;OAEG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,CAAC;IA6BlB;;OAEG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAmB/C;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE;IAuBvD;;OAEG;IACH,oBAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM;CAgBtD"}