agentinit 1.4.1 → 1.6.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/CHANGELOG.md +19 -0
- package/README.md +209 -0
- package/dist/agentinit-1.6.0.tgz +0 -0
- package/dist/agents/Agent.d.ts +110 -0
- package/dist/agents/Agent.d.ts.map +1 -0
- package/dist/agents/Agent.js +174 -0
- package/dist/agents/Agent.js.map +1 -0
- package/dist/agents/ClaudeAgent.d.ts +50 -0
- package/dist/agents/ClaudeAgent.d.ts.map +1 -0
- package/dist/agents/ClaudeAgent.js +249 -0
- package/dist/agents/ClaudeAgent.js.map +1 -0
- package/dist/agents/ClaudeDesktopAgent.d.ts +49 -0
- package/dist/agents/ClaudeDesktopAgent.d.ts.map +1 -0
- package/dist/agents/ClaudeDesktopAgent.js +143 -0
- package/dist/agents/ClaudeDesktopAgent.js.map +1 -0
- package/dist/agents/CodexCliAgent.d.ts +48 -0
- package/dist/agents/CodexCliAgent.d.ts.map +1 -0
- package/dist/agents/CodexCliAgent.js +262 -0
- package/dist/agents/CodexCliAgent.js.map +1 -0
- package/dist/agents/CursorAgent.d.ts +44 -0
- package/dist/agents/CursorAgent.d.ts.map +1 -0
- package/dist/agents/CursorAgent.js +231 -0
- package/dist/agents/CursorAgent.js.map +1 -0
- package/dist/agents/DroidAgent.d.ts +52 -0
- package/dist/agents/DroidAgent.d.ts.map +1 -0
- package/dist/agents/DroidAgent.js +228 -0
- package/dist/agents/DroidAgent.js.map +1 -0
- package/dist/agents/GeminiCliAgent.d.ts +40 -0
- package/dist/agents/GeminiCliAgent.d.ts.map +1 -0
- package/dist/agents/GeminiCliAgent.js +195 -0
- package/dist/agents/GeminiCliAgent.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +33365 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/apply.d.ts +2 -0
- package/dist/commands/apply.d.ts.map +1 -0
- package/dist/commands/apply.js +468 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +6 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/detect.d.ts +6 -0
- package/dist/commands/detect.d.ts.map +1 -0
- package/dist/commands/detect.js +55 -0
- package/dist/commands/detect.js.map +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +105 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +8 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +127 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/subagents.d.ts +9 -0
- package/dist/commands/subagents.d.ts.map +1 -0
- package/dist/commands/subagents.js +6 -0
- package/dist/commands/subagents.js.map +1 -0
- package/dist/commands/sync.d.ts +7 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +49 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/verifyMcp.d.ts +2 -0
- package/dist/commands/verifyMcp.d.ts.map +1 -0
- package/dist/commands/verifyMcp.js +215 -0
- package/dist/commands/verifyMcp.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/mcp.d.ts +9 -0
- package/dist/constants/mcp.d.ts.map +1 -0
- package/dist/constants/mcp.js +28 -0
- package/dist/constants/mcp.js.map +1 -0
- package/dist/constants/tokens.d.ts +6 -0
- package/dist/constants/tokens.d.ts.map +1 -0
- package/dist/constants/tokens.js +5 -0
- package/dist/constants/tokens.js.map +1 -0
- package/dist/core/agentDetector.d.ts +9 -0
- package/dist/core/agentDetector.d.ts.map +1 -0
- package/dist/core/agentDetector.js +51 -0
- package/dist/core/agentDetector.js.map +1 -0
- package/dist/core/agentManager.d.ts +55 -0
- package/dist/core/agentManager.d.ts.map +1 -0
- package/dist/core/agentManager.js +113 -0
- package/dist/core/agentManager.js.map +1 -0
- package/dist/core/configMerger.d.ts +49 -0
- package/dist/core/configMerger.d.ts.map +1 -0
- package/dist/core/configMerger.js +180 -0
- package/dist/core/configMerger.js.map +1 -0
- package/dist/core/mcpClient.d.ts +38 -0
- package/dist/core/mcpClient.d.ts.map +1 -0
- package/dist/core/mcpClient.js +416 -0
- package/dist/core/mcpClient.js.map +1 -0
- package/dist/core/mcpFilter.d.ts +44 -0
- package/dist/core/mcpFilter.d.ts.map +1 -0
- package/dist/core/mcpFilter.js +126 -0
- package/dist/core/mcpFilter.js.map +1 -0
- package/dist/core/mcpParser.d.ts +25 -0
- package/dist/core/mcpParser.d.ts.map +1 -0
- package/dist/core/mcpParser.js +297 -0
- package/dist/core/mcpParser.js.map +1 -0
- package/dist/core/propagator.d.ts +25 -0
- package/dist/core/propagator.d.ts.map +1 -0
- package/dist/core/propagator.js +154 -0
- package/dist/core/propagator.js.map +1 -0
- package/dist/core/rulesApplicator.d.ts +29 -0
- package/dist/core/rulesApplicator.d.ts.map +1 -0
- package/dist/core/rulesApplicator.js +181 -0
- package/dist/core/rulesApplicator.js.map +1 -0
- package/dist/core/rulesParser.d.ts +41 -0
- package/dist/core/rulesParser.d.ts.map +1 -0
- package/dist/core/rulesParser.js +260 -0
- package/dist/core/rulesParser.js.map +1 -0
- package/dist/core/rulesTemplateLoader.d.ts +31 -0
- package/dist/core/rulesTemplateLoader.d.ts.map +1 -0
- package/dist/core/rulesTemplateLoader.js +75 -0
- package/dist/core/rulesTemplateLoader.js.map +1 -0
- package/dist/core/stackDetector.d.ts +16 -0
- package/dist/core/stackDetector.d.ts.map +1 -0
- package/dist/core/stackDetector.js +234 -0
- package/dist/core/stackDetector.js.map +1 -0
- package/dist/core/templateEngine.d.ts +15 -0
- package/dist/core/templateEngine.d.ts.map +1 -0
- package/dist/core/templateEngine.js +260 -0
- package/dist/core/templateEngine.js.map +1 -0
- package/dist/core/tomlGenerator.d.ts +24 -0
- package/dist/core/tomlGenerator.d.ts.map +1 -0
- package/dist/core/tomlGenerator.js +185 -0
- package/dist/core/tomlGenerator.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -33195
- package/dist/index.js.map +1 -0
- package/dist/lib/index.d.ts +39 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +40 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/types/index.d.ts +23 -0
- package/dist/lib/types/index.d.ts.map +1 -0
- package/dist/lib/types/index.js +23 -0
- package/dist/lib/types/index.js.map +1 -0
- package/dist/lib/utils/index.d.ts +18 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +21 -0
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/verifier/index.d.ts +22 -0
- package/dist/lib/verifier/index.d.ts.map +1 -0
- package/dist/lib/verifier/index.js +22 -0
- package/dist/lib/verifier/index.js.map +1 -0
- package/dist/registry/mcpRegistry.d.ts +12 -0
- package/dist/registry/mcpRegistry.d.ts.map +1 -0
- package/dist/registry/mcpRegistry.js +114 -0
- package/dist/registry/mcpRegistry.js.map +1 -0
- package/dist/types/index.d.ts +180 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +21 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/rules.d.ts +51 -0
- package/dist/types/rules.d.ts.map +1 -0
- package/dist/types/rules.js +2 -0
- package/dist/types/rules.js.map +1 -0
- package/dist/utils/fs.d.ts +12 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +91 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +36 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/paths.d.ts +77 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +140 -0
- package/dist/utils/paths.js.map +1 -0
- package/package.json +30 -6
- package/dist/agentinit-1.4.1.tgz +0 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { Agent } from './Agent.js';
|
|
2
|
+
import { readFileIfExists, writeFile, ensureDirectoryExists } from '../utils/fs.js';
|
|
3
|
+
/**
|
|
4
|
+
* Claude Code agent implementation
|
|
5
|
+
* Supports full MCP capabilities including stdio, HTTP, and SSE servers
|
|
6
|
+
* Native config: .mcp.json
|
|
7
|
+
* Global config: ~/.claude.json
|
|
8
|
+
*
|
|
9
|
+
* Note: Claude Code uses a unique MCP configuration format:
|
|
10
|
+
* - stdio servers: { command, args?, env? }
|
|
11
|
+
* - http servers: { type: "http", url, headers? }
|
|
12
|
+
* - sse servers: { type: "sse", url, headers? }
|
|
13
|
+
*/
|
|
14
|
+
export class ClaudeAgent extends Agent {
|
|
15
|
+
constructor() {
|
|
16
|
+
const definition = {
|
|
17
|
+
id: 'claude',
|
|
18
|
+
name: 'Claude Code',
|
|
19
|
+
url: 'https://docs.anthropic.com/claude/docs/claude-code',
|
|
20
|
+
capabilities: {
|
|
21
|
+
mcp: {
|
|
22
|
+
stdio: true,
|
|
23
|
+
http: true,
|
|
24
|
+
sse: true
|
|
25
|
+
},
|
|
26
|
+
rules: true,
|
|
27
|
+
hooks: true,
|
|
28
|
+
commands: true,
|
|
29
|
+
subagents: true,
|
|
30
|
+
statusline: true
|
|
31
|
+
},
|
|
32
|
+
configFiles: [
|
|
33
|
+
{
|
|
34
|
+
path: 'CLAUDE.md',
|
|
35
|
+
purpose: 'rules',
|
|
36
|
+
format: 'markdown',
|
|
37
|
+
type: 'file',
|
|
38
|
+
optional: true,
|
|
39
|
+
description: 'Claude-specific configuration and rules'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
path: '.claude/config.md',
|
|
43
|
+
purpose: 'rules',
|
|
44
|
+
format: 'markdown',
|
|
45
|
+
type: 'file',
|
|
46
|
+
optional: true,
|
|
47
|
+
description: 'Alternative Claude configuration file'
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
nativeConfigPath: '.mcp.json',
|
|
51
|
+
globalConfigPath: '~/.claude.json'
|
|
52
|
+
};
|
|
53
|
+
super(definition);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Apply MCP configuration to Claude's native .mcp.json format
|
|
57
|
+
*/
|
|
58
|
+
async applyMCPConfig(projectPath, servers) {
|
|
59
|
+
const mcpConfigPath = this.getNativeMcpPath(projectPath);
|
|
60
|
+
// Ensure the directory exists
|
|
61
|
+
await ensureDirectoryExists(mcpConfigPath);
|
|
62
|
+
// Read existing configuration
|
|
63
|
+
const existingContent = await readFileIfExists(mcpConfigPath);
|
|
64
|
+
let existingConfig = { mcpServers: {} };
|
|
65
|
+
if (existingContent) {
|
|
66
|
+
try {
|
|
67
|
+
existingConfig = JSON.parse(existingContent);
|
|
68
|
+
if (!existingConfig.mcpServers) {
|
|
69
|
+
existingConfig.mcpServers = {};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
console.warn('Warning: Existing .mcp.json is invalid, creating new configuration');
|
|
74
|
+
existingConfig = { mcpServers: {} };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Convert our MCP server configs to Claude's format
|
|
78
|
+
for (const server of servers) {
|
|
79
|
+
const claudeServer = {};
|
|
80
|
+
switch (server.type) {
|
|
81
|
+
case 'stdio':
|
|
82
|
+
if (server.command) {
|
|
83
|
+
claudeServer.command = server.command;
|
|
84
|
+
}
|
|
85
|
+
if (server.args && server.args.length > 0) {
|
|
86
|
+
claudeServer.args = server.args;
|
|
87
|
+
}
|
|
88
|
+
if (server.env && Object.keys(server.env).length > 0) {
|
|
89
|
+
claudeServer.env = server.env;
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case 'http':
|
|
93
|
+
claudeServer.type = 'http';
|
|
94
|
+
if (server.url) {
|
|
95
|
+
claudeServer.url = server.url;
|
|
96
|
+
}
|
|
97
|
+
if (server.headers && Object.keys(server.headers).length > 0) {
|
|
98
|
+
claudeServer.headers = server.headers;
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
case 'sse':
|
|
102
|
+
claudeServer.type = 'sse';
|
|
103
|
+
if (server.url) {
|
|
104
|
+
claudeServer.url = server.url;
|
|
105
|
+
}
|
|
106
|
+
if (server.headers && Object.keys(server.headers).length > 0) {
|
|
107
|
+
claudeServer.headers = server.headers;
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
// Add or update the server in the config
|
|
112
|
+
existingConfig.mcpServers[server.name] = claudeServer;
|
|
113
|
+
}
|
|
114
|
+
// Write the updated configuration
|
|
115
|
+
const configJson = JSON.stringify(existingConfig, null, 2);
|
|
116
|
+
await writeFile(mcpConfigPath, configJson);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Claude supports all MCP server types, so no filtering needed
|
|
120
|
+
*/
|
|
121
|
+
filterMCPServers(servers) {
|
|
122
|
+
return servers; // Claude supports everything
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Claude doesn't need any transformations
|
|
126
|
+
*/
|
|
127
|
+
transformMCPServers(servers) {
|
|
128
|
+
return servers; // No transformations needed
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Apply rules configuration to Claude's CLAUDE.md format
|
|
132
|
+
*/
|
|
133
|
+
async applyRulesConfig(configPath, rules, existingContent) {
|
|
134
|
+
const rulesSection = this.generateRulesContent(rules.sections);
|
|
135
|
+
let content = existingContent;
|
|
136
|
+
// For markdown, we'll append rules directly
|
|
137
|
+
if (content && !content.endsWith('\n')) {
|
|
138
|
+
content += '\n';
|
|
139
|
+
}
|
|
140
|
+
if (content) {
|
|
141
|
+
content += '\n';
|
|
142
|
+
}
|
|
143
|
+
content += rulesSection;
|
|
144
|
+
return content.trim() + '\n';
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Extract existing rule texts from CLAUDE.md content
|
|
148
|
+
*/
|
|
149
|
+
extractExistingRules(content) {
|
|
150
|
+
// Extract rules from markdown format - look for lines starting with "- "
|
|
151
|
+
const ruleLines = content.split('\n').filter(line => line.trim().startsWith('- '));
|
|
152
|
+
return ruleLines.map(line => line.replace(/^- /, '').trim()).filter(rule => rule.length > 0);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Extract existing rule sections from CLAUDE.md content using ## headers
|
|
156
|
+
*/
|
|
157
|
+
extractExistingSections(content) {
|
|
158
|
+
const lines = content.split('\n');
|
|
159
|
+
const sections = [];
|
|
160
|
+
let currentSection = null;
|
|
161
|
+
for (const line of lines) {
|
|
162
|
+
const trimmed = line.trim();
|
|
163
|
+
// Check if it's a section header
|
|
164
|
+
if (trimmed.startsWith('## ') && trimmed.includes(' ')) {
|
|
165
|
+
// Start new section
|
|
166
|
+
if (currentSection) {
|
|
167
|
+
sections.push(currentSection);
|
|
168
|
+
}
|
|
169
|
+
const sectionName = trimmed.replace(/^##\s*/, '');
|
|
170
|
+
currentSection = {
|
|
171
|
+
templateId: sectionName.toLowerCase().replace(/\s+/g, '_'),
|
|
172
|
+
templateName: sectionName,
|
|
173
|
+
rules: []
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
else if (currentSection && trimmed.startsWith('- ')) {
|
|
177
|
+
// Add rule to current section
|
|
178
|
+
const rule = trimmed.replace(/^- /, '');
|
|
179
|
+
currentSection.rules.push(rule);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// Add the last section
|
|
183
|
+
if (currentSection) {
|
|
184
|
+
sections.push(currentSection);
|
|
185
|
+
}
|
|
186
|
+
return sections;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Generate rules content in Claude's CLAUDE.md markdown format
|
|
190
|
+
*/
|
|
191
|
+
generateRulesContent(sections) {
|
|
192
|
+
let content = '';
|
|
193
|
+
if (sections && sections.length > 0) {
|
|
194
|
+
// Group rules by sections
|
|
195
|
+
for (const ruleSection of sections) {
|
|
196
|
+
content += `## ${ruleSection.templateName}\n\n`;
|
|
197
|
+
for (const rule of ruleSection.rules) {
|
|
198
|
+
content += `- ${rule}\n`;
|
|
199
|
+
}
|
|
200
|
+
content += '\n';
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return content;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Get existing MCP servers from Claude's .mcp.json configuration
|
|
207
|
+
*/
|
|
208
|
+
async getMCPServers(projectPath) {
|
|
209
|
+
const mcpConfigPath = this.getNativeMcpPath(projectPath);
|
|
210
|
+
const configContent = await readFileIfExists(mcpConfigPath);
|
|
211
|
+
if (!configContent) {
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
const config = JSON.parse(configContent);
|
|
216
|
+
const servers = [];
|
|
217
|
+
if (config.mcpServers) {
|
|
218
|
+
for (const [name, serverConfig] of Object.entries(config.mcpServers)) {
|
|
219
|
+
const server = {
|
|
220
|
+
name,
|
|
221
|
+
type: (serverConfig.type || (serverConfig.command ? 'stdio' : serverConfig.type)),
|
|
222
|
+
};
|
|
223
|
+
if (serverConfig.command) {
|
|
224
|
+
server.command = serverConfig.command;
|
|
225
|
+
}
|
|
226
|
+
if (serverConfig.args) {
|
|
227
|
+
server.args = serverConfig.args;
|
|
228
|
+
}
|
|
229
|
+
if (serverConfig.env) {
|
|
230
|
+
server.env = serverConfig.env;
|
|
231
|
+
}
|
|
232
|
+
if (serverConfig.url) {
|
|
233
|
+
server.url = serverConfig.url;
|
|
234
|
+
}
|
|
235
|
+
if (serverConfig.headers) {
|
|
236
|
+
server.headers = serverConfig.headers;
|
|
237
|
+
}
|
|
238
|
+
servers.push(server);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return servers;
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
// Invalid JSON or missing mcpServers property
|
|
245
|
+
return [];
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=ClaudeAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClaudeAgent.js","sourceRoot":"","sources":["../../src/agents/ClaudeAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAIpF;;;;;;;;;;GAUG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC;QACE,MAAM,UAAU,GAAoB;YAClC,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE,aAAa;YACnB,GAAG,EAAE,oDAAoD;YACzD,YAAY,EAAE;gBACZ,GAAG,EAAE;oBACH,KAAK,EAAE,IAAI;oBACX,IAAI,EAAE,IAAI;oBACV,GAAG,EAAE,IAAI;iBACV;gBACD,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;gBACX,QAAQ,EAAE,IAAI;gBACd,SAAS,EAAE,IAAI;gBACf,UAAU,EAAE,IAAI;aACjB;YACD,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,OAAO;oBAChB,MAAM,EAAE,UAAU;oBAClB,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,yCAAyC;iBACvD;gBACD;oBACE,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,OAAO;oBAChB,MAAM,EAAE,UAAU;oBAClB,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,uCAAuC;iBACrD;aACF;YACD,gBAAgB,EAAE,WAAW;YAC7B,gBAAgB,EAAE,gBAAgB;SACnC,CAAC;QAEF,KAAK,CAAC,UAAU,CAAC,CAAC;IACpB,CAAC;I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,MAAM,CAAC,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC;oBAChC,CAAC;oBACD,IAAI,YAAY,CAAC,GAAG,EAAE,CAAC;wBACrB,MAAM,CAAC,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC;oBAChC,CAAC;oBACD,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;wBACzB,MAAM,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;oBACxC,CAAC;oBAED,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,8CAA8C;YAC9C,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
* Claude Desktop app agent implementation
|
|
6
|
+
* Supports full MCP capabilities including stdio, HTTP, and SSE servers
|
|
7
|
+
* Native config: platform-specific claude_desktop_config.json
|
|
8
|
+
*/
|
|
9
|
+
export declare class ClaudeDesktopAgent extends Agent {
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Claude Desktop doesn't support project-level detection since it's a desktop app
|
|
13
|
+
*/
|
|
14
|
+
detectPresence(): Promise<null>;
|
|
15
|
+
/**
|
|
16
|
+
* Claude Desktop is not used for project-level configurations
|
|
17
|
+
* This method should not be called
|
|
18
|
+
*/
|
|
19
|
+
applyMCPConfig(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Apply MCP configuration to Claude Desktop's global config format
|
|
22
|
+
*/
|
|
23
|
+
applyGlobalMCPConfig(servers: MCPServerConfig[]): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Claude Desktop supports all MCP server types, so no filtering needed
|
|
26
|
+
*/
|
|
27
|
+
filterMCPServers(servers: MCPServerConfig[]): MCPServerConfig[];
|
|
28
|
+
/**
|
|
29
|
+
* Claude Desktop doesn't need any transformations
|
|
30
|
+
*/
|
|
31
|
+
transformMCPServers(servers: MCPServerConfig[]): MCPServerConfig[];
|
|
32
|
+
/**
|
|
33
|
+
* Claude Desktop doesn't support rules configuration
|
|
34
|
+
*/
|
|
35
|
+
applyRulesConfig(configPath: string, rules: AppliedRules, existingContent: string): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Claude Desktop doesn't support rules extraction
|
|
38
|
+
*/
|
|
39
|
+
extractExistingRules(content: string): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Claude Desktop doesn't support rules sections
|
|
42
|
+
*/
|
|
43
|
+
extractExistingSections(content: string): RuleSection[];
|
|
44
|
+
/**
|
|
45
|
+
* Claude Desktop doesn't generate rules content
|
|
46
|
+
*/
|
|
47
|
+
generateRulesContent(sections: RuleSection[]): string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=ClaudeDesktopAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClaudeDesktopAgent.d.ts","sourceRoot":"","sources":["../../src/agents/ClaudeDesktopAgent.ts"],"names":[],"mappings":"AAAA,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,kBAAmB,SAAQ,KAAK;;IA8B3C;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;OAEG;IACG,oBAAoB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA+DrE;;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;IAIlB;;OAEG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAI/C;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE;IAIvD;;OAEG;IACH,oBAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM;CAGtD"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Agent } from './Agent.js';
|
|
2
|
+
import { readFileIfExists, writeFile, ensureDirectoryExists } from '../utils/fs.js';
|
|
3
|
+
/**
|
|
4
|
+
* Claude Desktop app agent implementation
|
|
5
|
+
* Supports full MCP capabilities including stdio, HTTP, and SSE servers
|
|
6
|
+
* Native config: platform-specific claude_desktop_config.json
|
|
7
|
+
*/
|
|
8
|
+
export class ClaudeDesktopAgent extends Agent {
|
|
9
|
+
constructor() {
|
|
10
|
+
const definition = {
|
|
11
|
+
id: 'claude-desktop',
|
|
12
|
+
name: 'Claude Desktop',
|
|
13
|
+
url: 'https://claude.ai/download',
|
|
14
|
+
capabilities: {
|
|
15
|
+
mcp: {
|
|
16
|
+
stdio: true,
|
|
17
|
+
http: true,
|
|
18
|
+
sse: true
|
|
19
|
+
},
|
|
20
|
+
rules: false, // No .rules files support
|
|
21
|
+
hooks: false, // No hook system
|
|
22
|
+
commands: false, // No custom commands
|
|
23
|
+
subagents: false, // No subagent support
|
|
24
|
+
statusline: false // No statusline customization
|
|
25
|
+
},
|
|
26
|
+
configFiles: [], // Claude Desktop doesn't have project-specific detection files
|
|
27
|
+
nativeConfigPath: 'claude_desktop_config.json', // Not used for project-level
|
|
28
|
+
globalConfigPaths: {
|
|
29
|
+
windows: '%APPDATA%/Claude/claude_desktop_config.json',
|
|
30
|
+
darwin: '~/Library/Application Support/Claude/claude_desktop_config.json',
|
|
31
|
+
linux: '~/.config/Claude/claude_desktop_config.json'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
super(definition);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Claude Desktop doesn't support project-level detection since it's a desktop app
|
|
38
|
+
*/
|
|
39
|
+
async detectPresence() {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Claude Desktop is not used for project-level configurations
|
|
44
|
+
* This method should not be called
|
|
45
|
+
*/
|
|
46
|
+
async applyMCPConfig() {
|
|
47
|
+
throw new Error('Claude Desktop only supports global configuration. Use --global flag.');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Apply MCP configuration to Claude Desktop's global config format
|
|
51
|
+
*/
|
|
52
|
+
async applyGlobalMCPConfig(servers) {
|
|
53
|
+
const globalPath = this.getGlobalMcpPath();
|
|
54
|
+
if (!globalPath) {
|
|
55
|
+
throw new Error(`Claude Desktop global configuration path could not be determined for this platform`);
|
|
56
|
+
}
|
|
57
|
+
// Ensure the directory exists
|
|
58
|
+
await ensureDirectoryExists(globalPath);
|
|
59
|
+
// Read existing configuration
|
|
60
|
+
const existingContent = await readFileIfExists(globalPath);
|
|
61
|
+
let existingConfig = { mcpServers: {} };
|
|
62
|
+
if (existingContent) {
|
|
63
|
+
try {
|
|
64
|
+
existingConfig = JSON.parse(existingContent);
|
|
65
|
+
if (!existingConfig.mcpServers) {
|
|
66
|
+
existingConfig.mcpServers = {};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.warn('Warning: Existing claude_desktop_config.json is invalid, creating new configuration');
|
|
71
|
+
existingConfig = { mcpServers: {} };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Convert our MCP server configs to Claude Desktop's format
|
|
75
|
+
for (const server of servers) {
|
|
76
|
+
const claudeDesktopServer = {};
|
|
77
|
+
switch (server.type) {
|
|
78
|
+
case 'stdio':
|
|
79
|
+
if (server.command) {
|
|
80
|
+
claudeDesktopServer.command = server.command;
|
|
81
|
+
}
|
|
82
|
+
if (server.args && server.args.length > 0) {
|
|
83
|
+
claudeDesktopServer.args = server.args;
|
|
84
|
+
}
|
|
85
|
+
if (server.env && Object.keys(server.env).length > 0) {
|
|
86
|
+
claudeDesktopServer.env = server.env;
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case 'http':
|
|
90
|
+
case 'sse':
|
|
91
|
+
if (server.url) {
|
|
92
|
+
claudeDesktopServer.url = server.url;
|
|
93
|
+
}
|
|
94
|
+
if (server.headers && Object.keys(server.headers).length > 0) {
|
|
95
|
+
claudeDesktopServer.headers = server.headers;
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
// Add or update the server in the config
|
|
100
|
+
existingConfig.mcpServers[server.name] = claudeDesktopServer;
|
|
101
|
+
}
|
|
102
|
+
// Write the updated configuration
|
|
103
|
+
const configJson = JSON.stringify(existingConfig, null, 2);
|
|
104
|
+
await writeFile(globalPath, configJson);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Claude Desktop supports all MCP server types, so no filtering needed
|
|
108
|
+
*/
|
|
109
|
+
filterMCPServers(servers) {
|
|
110
|
+
return servers; // Claude Desktop supports everything
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Claude Desktop doesn't need any transformations
|
|
114
|
+
*/
|
|
115
|
+
transformMCPServers(servers) {
|
|
116
|
+
return servers; // No transformations needed
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Claude Desktop doesn't support rules configuration
|
|
120
|
+
*/
|
|
121
|
+
async applyRulesConfig(configPath, rules, existingContent) {
|
|
122
|
+
throw new Error('Claude Desktop does not support rules configuration. Rules should be applied to a project-level agent like Claude Code.');
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Claude Desktop doesn't support rules extraction
|
|
126
|
+
*/
|
|
127
|
+
extractExistingRules(content) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Claude Desktop doesn't support rules sections
|
|
132
|
+
*/
|
|
133
|
+
extractExistingSections(content) {
|
|
134
|
+
return [];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Claude Desktop doesn't generate rules content
|
|
138
|
+
*/
|
|
139
|
+
generateRulesContent(sections) {
|
|
140
|
+
return '';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=ClaudeDesktopAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClaudeDesktopAgent.js","sourceRoot":"","sources":["../../src/agents/ClaudeDesktopAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAIpF;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C;QACE,MAAM,UAAU,GAAoB;YAClC,EAAE,EAAE,gBAAgB;YACpB,IAAI,EAAE,gBAAgB;YACtB,GAAG,EAAE,4BAA4B;YACjC,YAAY,EAAE;gBACZ,GAAG,EAAE;oBACH,KAAK,EAAE,IAAI;oBACX,IAAI,EAAE,IAAI;oBACV,GAAG,EAAE,IAAI;iBACV;gBACD,KAAK,EAAE,KAAK,EAAK,0BAA0B;gBAC3C,KAAK,EAAE,KAAK,EAAK,iBAAiB;gBAClC,QAAQ,EAAE,KAAK,EAAE,qBAAqB;gBACtC,SAAS,EAAE,KAAK,EAAC,sBAAsB;gBACvC,UAAU,EA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AC;QAC3D,MAAM,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,gBAAgB,CAAC,OAA0B;QACzC,OAAO,OAAO,CAAC,CAAC,qCAAqC;IACvD,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,OAA0B;QAC5C,OAAO,OAAO,CAAC,CAAC,4BAA4B;IAC9C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CACpB,UAAkB,EAClB,KAAmB,EACnB,eAAuB;QAEvB,MAAM,IAAI,KAAK,CAAC,yHAAyH,CAAC,CAAC;IAC7I,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,OAAe;QAClC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;OAEG;IACH,uBAAuB,CAAC,OAAe;QACrC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,QAAuB;QAC1C,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
* 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 declare class CodexCliAgent extends Agent {
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Apply MCP configuration to Codex CLI's native TOML format
|
|
13
|
+
*/
|
|
14
|
+
applyMCPConfig(projectPath: string, servers: MCPServerConfig[]): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Codex only supports stdio, so filter out others (they'll be transformed)
|
|
17
|
+
*/
|
|
18
|
+
filterMCPServers(servers: MCPServerConfig[]): MCPServerConfig[];
|
|
19
|
+
/**
|
|
20
|
+
* Transform remote (HTTP/SSE) servers to stdio using mcp-remote proxy
|
|
21
|
+
*/
|
|
22
|
+
transformMCPServers(servers: MCPServerConfig[]): MCPServerConfig[];
|
|
23
|
+
/**
|
|
24
|
+
* Format TOML output for Codex CLI with proper structure and comments
|
|
25
|
+
*/
|
|
26
|
+
private formatTOML;
|
|
27
|
+
/**
|
|
28
|
+
* Apply rules configuration to Codex CLI's TOML format
|
|
29
|
+
*/
|
|
30
|
+
applyRulesConfig(configPath: string, rules: AppliedRules, existingContent: string): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Extract existing rule texts from TOML content
|
|
33
|
+
*/
|
|
34
|
+
extractExistingRules(content: string): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Extract existing rule sections from TOML content
|
|
37
|
+
*/
|
|
38
|
+
extractExistingSections(content: string): RuleSection[];
|
|
39
|
+
/**
|
|
40
|
+
* Generate rules content in TOML format
|
|
41
|
+
*/
|
|
42
|
+
generateRulesContent(sections: RuleSection[]): string;
|
|
43
|
+
/**
|
|
44
|
+
* Format TOML output for rules with proper structure and comments
|
|
45
|
+
*/
|
|
46
|
+
private formatTOMLRules;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=CodexCliAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodexCliAgent.d.ts","sourceRoot":"","sources":["../../src/agents/CodexCliAgent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,eAAe,EAAkC,MAAM,mBAAmB,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,KAAK;;IAkCtC;;OAEG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA+CpF;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE;IAK/D;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE;IAgClE;;OAEG;IACH,OAAO,CAAC,UAAU;IA6BlB;;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;IAiBrD;;OAEG;IACH,OAAO,CAAC,eAAe;CA2BxB"}
|