@telepat/snoopy 0.1.13 → 0.1.15
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 +70 -215
- package/README.zh-CN.md +137 -0
- package/dist/src/agent/install.d.ts +18 -0
- package/dist/src/agent/install.js +488 -0
- package/dist/src/cli/commands/feedback.d.ts +18 -0
- package/dist/src/cli/commands/feedback.js +276 -0
- package/dist/src/cli/commands/prompt.d.ts +6 -0
- package/dist/src/cli/commands/prompt.js +92 -0
- package/dist/src/cli/commands/promptEditor.d.ts +1 -0
- package/dist/src/cli/commands/promptEditor.js +17 -0
- package/dist/src/cli/flows/jobAddFlow.js +1 -1
- package/dist/src/cli/index.js +86 -1
- package/dist/src/mcp/helpers.d.ts +46 -0
- package/dist/src/mcp/helpers.js +506 -0
- package/dist/src/mcp/server.d.ts +1 -0
- package/dist/src/mcp/server.js +299 -0
- package/dist/src/mcp/tools.d.ts +90 -0
- package/dist/src/mcp/tools.js +106 -0
- package/dist/src/services/db/migrations/002_feedback_fields.d.ts +7 -0
- package/dist/src/services/db/migrations/002_feedback_fields.js +22 -0
- package/dist/src/services/db/migrations/index.js +2 -1
- package/dist/src/services/db/repositories/jobsRepo.d.ts +2 -0
- package/dist/src/services/db/repositories/jobsRepo.js +15 -0
- package/dist/src/services/db/repositories/scanItemsRepo.d.ts +17 -0
- package/dist/src/services/db/repositories/scanItemsRepo.js +197 -2
- package/dist/src/services/feedback/consolidationService.d.ts +28 -0
- package/dist/src/services/feedback/consolidationService.js +124 -0
- package/dist/src/services/openrouter/client.d.ts +23 -0
- package/dist/src/services/openrouter/client.js +67 -0
- package/dist/src/types/settings.d.ts +1 -1
- package/dist/src/types/settings.js +1 -1
- package/dist/src/ui/components/MultilinePrompt.d.ts +10 -0
- package/dist/src/ui/components/MultilinePrompt.js +87 -0
- package/dist/src/ui/components/multilinePromptModel.d.ts +25 -0
- package/dist/src/ui/components/multilinePromptModel.js +76 -0
- package/package.json +4 -1
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join, dirname } from 'node:path';
|
|
4
|
+
const SNOOPY_MARKER = 'snoopy';
|
|
5
|
+
const SUPPORTED_RUNTIMES = [
|
|
6
|
+
'claude',
|
|
7
|
+
'claude-desktop',
|
|
8
|
+
'chatgpt',
|
|
9
|
+
'gemini',
|
|
10
|
+
'codex',
|
|
11
|
+
'cursor',
|
|
12
|
+
'vscode',
|
|
13
|
+
'opencode',
|
|
14
|
+
'generic-mcp',
|
|
15
|
+
];
|
|
16
|
+
function ensureDir(dir) {
|
|
17
|
+
if (!existsSync(dir)) {
|
|
18
|
+
mkdirSync(dir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function readJsonFile(path) {
|
|
22
|
+
if (!existsSync(path)) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const raw = JSON.parse(readFileSync(path, 'utf8'));
|
|
27
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
return raw;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function writeJsonFile(path, data) {
|
|
37
|
+
ensureDir(dirname(path));
|
|
38
|
+
writeFileSync(path, JSON.stringify(data, null, 2) + '\n');
|
|
39
|
+
}
|
|
40
|
+
function readTomlFile(path) {
|
|
41
|
+
if (!existsSync(path)) {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
return readFileSync(path, 'utf8');
|
|
45
|
+
}
|
|
46
|
+
function writeTomlFile(path, content) {
|
|
47
|
+
ensureDir(dirname(path));
|
|
48
|
+
writeFileSync(path, content);
|
|
49
|
+
}
|
|
50
|
+
// --- Claude Code ---
|
|
51
|
+
function installClaude() {
|
|
52
|
+
const settingsPath = join(homedir(), '.claude', 'settings.json');
|
|
53
|
+
const settings = readJsonFile(settingsPath);
|
|
54
|
+
const mcpServers = settings.mcpServers ?? {};
|
|
55
|
+
mcpServers[SNOOPY_MARKER] = { command: 'snoopy', args: ['mcp'] };
|
|
56
|
+
settings.mcpServers = mcpServers;
|
|
57
|
+
writeJsonFile(settingsPath, settings);
|
|
58
|
+
return {
|
|
59
|
+
runtime: 'claude',
|
|
60
|
+
installed: true,
|
|
61
|
+
configPath: settingsPath,
|
|
62
|
+
message: `Registered Snoopy MCP server in ${settingsPath}`,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function uninstallClaude() {
|
|
66
|
+
const settingsPath = join(homedir(), '.claude', 'settings.json');
|
|
67
|
+
const settings = readJsonFile(settingsPath);
|
|
68
|
+
const mcpServers = settings.mcpServers ?? {};
|
|
69
|
+
delete mcpServers[SNOOPY_MARKER];
|
|
70
|
+
settings.mcpServers = mcpServers;
|
|
71
|
+
writeJsonFile(settingsPath, settings);
|
|
72
|
+
return {
|
|
73
|
+
runtime: 'claude',
|
|
74
|
+
installed: false,
|
|
75
|
+
configPath: settingsPath,
|
|
76
|
+
message: `Removed Snoopy MCP server from ${settingsPath}`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function isClaudeInstalled() {
|
|
80
|
+
const settingsPath = join(homedir(), '.claude', 'settings.json');
|
|
81
|
+
const settings = readJsonFile(settingsPath);
|
|
82
|
+
const mcpServers = settings.mcpServers ?? {};
|
|
83
|
+
return SNOOPY_MARKER in mcpServers;
|
|
84
|
+
}
|
|
85
|
+
// --- Claude Desktop ---
|
|
86
|
+
function getClaudeDesktopConfigPath() {
|
|
87
|
+
if (process.platform === 'darwin') {
|
|
88
|
+
return join(homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
89
|
+
}
|
|
90
|
+
if (process.platform === 'win32') {
|
|
91
|
+
return join(process.env.APPDATA ?? join(homedir(), 'AppData', 'Roaming'), 'Claude', 'claude_desktop_config.json');
|
|
92
|
+
}
|
|
93
|
+
return join(homedir(), '.config', 'Claude', 'claude_desktop_config.json');
|
|
94
|
+
}
|
|
95
|
+
function installClaudeDesktop() {
|
|
96
|
+
const configPath = getClaudeDesktopConfigPath();
|
|
97
|
+
const config = readJsonFile(configPath);
|
|
98
|
+
const mcpServers = config.mcpServers ?? {};
|
|
99
|
+
mcpServers[SNOOPY_MARKER] = { command: 'snoopy', args: ['mcp'] };
|
|
100
|
+
config.mcpServers = mcpServers;
|
|
101
|
+
writeJsonFile(configPath, config);
|
|
102
|
+
return {
|
|
103
|
+
runtime: 'claude-desktop',
|
|
104
|
+
installed: true,
|
|
105
|
+
configPath,
|
|
106
|
+
message: `Registered Snoopy MCP server in ${configPath}`,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function uninstallClaudeDesktop() {
|
|
110
|
+
const configPath = getClaudeDesktopConfigPath();
|
|
111
|
+
const config = readJsonFile(configPath);
|
|
112
|
+
const mcpServers = config.mcpServers ?? {};
|
|
113
|
+
delete mcpServers[SNOOPY_MARKER];
|
|
114
|
+
config.mcpServers = mcpServers;
|
|
115
|
+
writeJsonFile(configPath, config);
|
|
116
|
+
return {
|
|
117
|
+
runtime: 'claude-desktop',
|
|
118
|
+
installed: false,
|
|
119
|
+
configPath,
|
|
120
|
+
message: `Removed Snoopy MCP server from ${configPath}`,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function isClaudeDesktopInstalled() {
|
|
124
|
+
const configPath = getClaudeDesktopConfigPath();
|
|
125
|
+
const config = readJsonFile(configPath);
|
|
126
|
+
const mcpServers = config.mcpServers ?? {};
|
|
127
|
+
return SNOOPY_MARKER in mcpServers;
|
|
128
|
+
}
|
|
129
|
+
// --- ChatGPT Desktop ---
|
|
130
|
+
function installChatGpt() {
|
|
131
|
+
console.log('[snoopy] ChatGPT Desktop uses remote MCP servers via Developer Mode.');
|
|
132
|
+
console.log('[snoopy] To register Snoopy with ChatGPT:');
|
|
133
|
+
console.log(' 1. Open ChatGPT Desktop > Settings > Apps > Advanced settings');
|
|
134
|
+
console.log(' 2. Enable Developer mode');
|
|
135
|
+
console.log(' 3. Create a new MCP app pointing to Snoopy (requires a remote MCP proxy)');
|
|
136
|
+
console.log('[snoopy] Note: ChatGPT Desktop requires a remote HTTP MCP endpoint, not local stdio.');
|
|
137
|
+
console.log('[snoopy] For local usage, consider using a stdio-to-HTTP proxy.');
|
|
138
|
+
return {
|
|
139
|
+
runtime: 'chatgpt',
|
|
140
|
+
installed: false,
|
|
141
|
+
configPath: 'manual-setup',
|
|
142
|
+
message: 'ChatGPT Desktop requires manual MCP app setup via Developer Mode. See printed instructions.',
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function uninstallChatGpt() {
|
|
146
|
+
return {
|
|
147
|
+
runtime: 'chatgpt',
|
|
148
|
+
installed: false,
|
|
149
|
+
configPath: 'manual-setup',
|
|
150
|
+
message: 'ChatGPT Desktop MCP apps are managed in the ChatGPT Desktop UI.',
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function isChatGptInstalled() {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
// --- Gemini ---
|
|
157
|
+
function getGeminiSettingsPath() {
|
|
158
|
+
if (process.platform === 'win32') {
|
|
159
|
+
return join(process.env.APPDATA ?? join(homedir(), 'AppData', 'Roaming'), 'Gemini', 'settings.json');
|
|
160
|
+
}
|
|
161
|
+
return join(homedir(), '.gemini', 'settings.json');
|
|
162
|
+
}
|
|
163
|
+
function installGemini() {
|
|
164
|
+
const settingsPath = getGeminiSettingsPath();
|
|
165
|
+
const settings = readJsonFile(settingsPath);
|
|
166
|
+
const mcpServers = settings.mcpServers ?? {};
|
|
167
|
+
mcpServers[SNOOPY_MARKER] = { command: 'snoopy', args: ['mcp'] };
|
|
168
|
+
settings.mcpServers = mcpServers;
|
|
169
|
+
writeJsonFile(settingsPath, settings);
|
|
170
|
+
return {
|
|
171
|
+
runtime: 'gemini',
|
|
172
|
+
installed: true,
|
|
173
|
+
configPath: settingsPath,
|
|
174
|
+
message: `Registered Snoopy MCP server in ${settingsPath}`,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function uninstallGemini() {
|
|
178
|
+
const settingsPath = getGeminiSettingsPath();
|
|
179
|
+
const settings = readJsonFile(settingsPath);
|
|
180
|
+
const mcpServers = settings.mcpServers ?? {};
|
|
181
|
+
delete mcpServers[SNOOPY_MARKER];
|
|
182
|
+
settings.mcpServers = mcpServers;
|
|
183
|
+
writeJsonFile(settingsPath, settings);
|
|
184
|
+
return {
|
|
185
|
+
runtime: 'gemini',
|
|
186
|
+
installed: false,
|
|
187
|
+
configPath: settingsPath,
|
|
188
|
+
message: `Removed Snoopy MCP server from ${settingsPath}`,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function isGeminiInstalled() {
|
|
192
|
+
const settingsPath = getGeminiSettingsPath();
|
|
193
|
+
const settings = readJsonFile(settingsPath);
|
|
194
|
+
const mcpServers = settings.mcpServers ?? {};
|
|
195
|
+
return SNOOPY_MARKER in mcpServers;
|
|
196
|
+
}
|
|
197
|
+
// --- Codex ---
|
|
198
|
+
function getCodexConfigPath() {
|
|
199
|
+
if (process.platform === 'win32') {
|
|
200
|
+
return join(process.env.APPDATA ?? join(homedir(), 'AppData', 'Roaming'), 'codex', 'config.toml');
|
|
201
|
+
}
|
|
202
|
+
return join(homedir(), '.codex', 'config.toml');
|
|
203
|
+
}
|
|
204
|
+
function installCodex() {
|
|
205
|
+
const configPath = getCodexConfigPath();
|
|
206
|
+
let content = readTomlFile(configPath);
|
|
207
|
+
const marker = `[mcp_servers.${SNOOPY_MARKER}]`;
|
|
208
|
+
if (content.includes(marker)) {
|
|
209
|
+
return {
|
|
210
|
+
runtime: 'codex',
|
|
211
|
+
installed: true,
|
|
212
|
+
configPath,
|
|
213
|
+
message: `Snoopy MCP server already registered in ${configPath}`,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const section = `\n${marker}\ncommand = "snoopy"\nargs = ["mcp"]\nenabled = true\ntool_timeout_sec = 120\n`;
|
|
217
|
+
content += section;
|
|
218
|
+
writeTomlFile(configPath, content);
|
|
219
|
+
return {
|
|
220
|
+
runtime: 'codex',
|
|
221
|
+
installed: true,
|
|
222
|
+
configPath,
|
|
223
|
+
message: `Registered Snoopy MCP server in ${configPath}`,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function uninstallCodex() {
|
|
227
|
+
const configPath = getCodexConfigPath();
|
|
228
|
+
let content = readTomlFile(configPath);
|
|
229
|
+
const marker = `[mcp_servers.${SNOOPY_MARKER}]`;
|
|
230
|
+
const markerIndex = content.indexOf(marker);
|
|
231
|
+
if (markerIndex === -1) {
|
|
232
|
+
return {
|
|
233
|
+
runtime: 'codex',
|
|
234
|
+
installed: false,
|
|
235
|
+
configPath,
|
|
236
|
+
message: `Snoopy MCP server not found in ${configPath}`,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const afterMarker = content.slice(markerIndex + marker.length);
|
|
240
|
+
const nextSectionMatch = afterMarker.match(/\n\[/);
|
|
241
|
+
const endIndex = nextSectionMatch
|
|
242
|
+
? markerIndex + marker.length + nextSectionMatch.index + 1
|
|
243
|
+
: content.length;
|
|
244
|
+
content = content.slice(0, markerIndex) + content.slice(endIndex);
|
|
245
|
+
writeTomlFile(configPath, content.trimEnd() + '\n');
|
|
246
|
+
return {
|
|
247
|
+
runtime: 'codex',
|
|
248
|
+
installed: false,
|
|
249
|
+
configPath,
|
|
250
|
+
message: `Removed Snoopy MCP server from ${configPath}`,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function isCodexInstalled() {
|
|
254
|
+
const configPath = getCodexConfigPath();
|
|
255
|
+
const content = readTomlFile(configPath);
|
|
256
|
+
return content.includes(`[mcp_servers.${SNOOPY_MARKER}]`);
|
|
257
|
+
}
|
|
258
|
+
// --- Cursor ---
|
|
259
|
+
function getCursorMcpPath() {
|
|
260
|
+
return join(homedir(), '.cursor', 'mcp.json');
|
|
261
|
+
}
|
|
262
|
+
function installCursor() {
|
|
263
|
+
const configPath = getCursorMcpPath();
|
|
264
|
+
const config = readJsonFile(configPath);
|
|
265
|
+
const mcpServers = config.mcpServers ?? {};
|
|
266
|
+
mcpServers[SNOOPY_MARKER] = { command: 'snoopy', args: ['mcp'] };
|
|
267
|
+
config.mcpServers = mcpServers;
|
|
268
|
+
writeJsonFile(configPath, config);
|
|
269
|
+
return {
|
|
270
|
+
runtime: 'cursor',
|
|
271
|
+
installed: true,
|
|
272
|
+
configPath,
|
|
273
|
+
message: `Registered Snoopy MCP server in ${configPath}`,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function uninstallCursor() {
|
|
277
|
+
const configPath = getCursorMcpPath();
|
|
278
|
+
const config = readJsonFile(configPath);
|
|
279
|
+
const mcpServers = config.mcpServers ?? {};
|
|
280
|
+
delete mcpServers[SNOOPY_MARKER];
|
|
281
|
+
config.mcpServers = mcpServers;
|
|
282
|
+
writeJsonFile(configPath, config);
|
|
283
|
+
return {
|
|
284
|
+
runtime: 'cursor',
|
|
285
|
+
installed: false,
|
|
286
|
+
configPath,
|
|
287
|
+
message: `Removed Snoopy MCP server from ${configPath}`,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function isCursorInstalled() {
|
|
291
|
+
const configPath = getCursorMcpPath();
|
|
292
|
+
const config = readJsonFile(configPath);
|
|
293
|
+
const mcpServers = config.mcpServers ?? {};
|
|
294
|
+
return SNOOPY_MARKER in mcpServers;
|
|
295
|
+
}
|
|
296
|
+
// --- VS Code ---
|
|
297
|
+
function getVSCodeMcpPath() {
|
|
298
|
+
return join(process.cwd(), '.vscode', 'mcp.json');
|
|
299
|
+
}
|
|
300
|
+
function installVSCode() {
|
|
301
|
+
const configPath = getVSCodeMcpPath();
|
|
302
|
+
const config = readJsonFile(configPath);
|
|
303
|
+
const servers = config.servers ?? {};
|
|
304
|
+
servers[SNOOPY_MARKER] = {
|
|
305
|
+
type: 'stdio',
|
|
306
|
+
command: 'snoopy',
|
|
307
|
+
args: ['mcp'],
|
|
308
|
+
};
|
|
309
|
+
config.servers = servers;
|
|
310
|
+
writeJsonFile(configPath, config);
|
|
311
|
+
return {
|
|
312
|
+
runtime: 'vscode',
|
|
313
|
+
installed: true,
|
|
314
|
+
configPath,
|
|
315
|
+
message: `Registered Snoopy MCP server in ${configPath}`,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function uninstallVSCode() {
|
|
319
|
+
const configPath = getVSCodeMcpPath();
|
|
320
|
+
const config = readJsonFile(configPath);
|
|
321
|
+
const servers = config.servers ?? {};
|
|
322
|
+
delete servers[SNOOPY_MARKER];
|
|
323
|
+
config.servers = servers;
|
|
324
|
+
writeJsonFile(configPath, config);
|
|
325
|
+
return {
|
|
326
|
+
runtime: 'vscode',
|
|
327
|
+
installed: false,
|
|
328
|
+
configPath,
|
|
329
|
+
message: `Removed Snoopy MCP server from ${configPath}`,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
function isVSCodeInstalled() {
|
|
333
|
+
const configPath = getVSCodeMcpPath();
|
|
334
|
+
const config = readJsonFile(configPath);
|
|
335
|
+
const servers = config.servers ?? {};
|
|
336
|
+
return SNOOPY_MARKER in servers;
|
|
337
|
+
}
|
|
338
|
+
// --- OpenCode ---
|
|
339
|
+
function getOpenCodeConfigPath() {
|
|
340
|
+
return join(process.cwd(), 'opencode.json');
|
|
341
|
+
}
|
|
342
|
+
function installOpenCode() {
|
|
343
|
+
const configPath = getOpenCodeConfigPath();
|
|
344
|
+
const config = readJsonFile(configPath);
|
|
345
|
+
const mcp = config.mcp ?? {};
|
|
346
|
+
mcp[SNOOPY_MARKER] = {
|
|
347
|
+
type: 'local',
|
|
348
|
+
command: ['snoopy', 'mcp'],
|
|
349
|
+
enabled: true,
|
|
350
|
+
};
|
|
351
|
+
config.mcp = mcp;
|
|
352
|
+
writeJsonFile(configPath, config);
|
|
353
|
+
return {
|
|
354
|
+
runtime: 'opencode',
|
|
355
|
+
installed: true,
|
|
356
|
+
configPath,
|
|
357
|
+
message: `Registered Snoopy MCP server in ${configPath}`,
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function uninstallOpenCode() {
|
|
361
|
+
const configPath = getOpenCodeConfigPath();
|
|
362
|
+
const config = readJsonFile(configPath);
|
|
363
|
+
const mcp = config.mcp ?? {};
|
|
364
|
+
delete mcp[SNOOPY_MARKER];
|
|
365
|
+
config.mcp = mcp;
|
|
366
|
+
writeJsonFile(configPath, config);
|
|
367
|
+
return {
|
|
368
|
+
runtime: 'opencode',
|
|
369
|
+
installed: false,
|
|
370
|
+
configPath,
|
|
371
|
+
message: `Removed Snoopy MCP server from ${configPath}`,
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function isOpenCodeInstalled() {
|
|
375
|
+
const configPath = getOpenCodeConfigPath();
|
|
376
|
+
const config = readJsonFile(configPath);
|
|
377
|
+
const mcp = config.mcp ?? {};
|
|
378
|
+
return SNOOPY_MARKER in mcp;
|
|
379
|
+
}
|
|
380
|
+
// --- Generic MCP ---
|
|
381
|
+
function installGenericMcp() {
|
|
382
|
+
const config = {
|
|
383
|
+
mcpServers: {
|
|
384
|
+
snoopy: {
|
|
385
|
+
command: 'snoopy',
|
|
386
|
+
args: ['mcp'],
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
console.log('[snoopy] Generic MCP server configuration:');
|
|
391
|
+
console.log('');
|
|
392
|
+
console.log('JSON format:');
|
|
393
|
+
console.log(JSON.stringify(config, null, 2));
|
|
394
|
+
console.log('');
|
|
395
|
+
console.log('Add this to your agent framework\'s MCP server configuration.');
|
|
396
|
+
return {
|
|
397
|
+
runtime: 'generic-mcp',
|
|
398
|
+
installed: false,
|
|
399
|
+
configPath: 'manual',
|
|
400
|
+
message: 'Printed generic MCP config to stdout. Add to your agent framework manually.',
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
function uninstallGenericMcp() {
|
|
404
|
+
return {
|
|
405
|
+
runtime: 'generic-mcp',
|
|
406
|
+
installed: false,
|
|
407
|
+
configPath: 'manual',
|
|
408
|
+
message: 'Remove the snoopy MCP server entry from your agent framework config manually.',
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function isGenericMcpInstalled() {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
const RUNTIME_HANDLERS = {
|
|
415
|
+
'claude': { install: installClaude, uninstall: uninstallClaude, isInstalled: isClaudeInstalled },
|
|
416
|
+
'claude-desktop': { install: installClaudeDesktop, uninstall: uninstallClaudeDesktop, isInstalled: isClaudeDesktopInstalled },
|
|
417
|
+
'chatgpt': { install: installChatGpt, uninstall: uninstallChatGpt, isInstalled: isChatGptInstalled },
|
|
418
|
+
'gemini': { install: installGemini, uninstall: uninstallGemini, isInstalled: isGeminiInstalled },
|
|
419
|
+
'codex': { install: installCodex, uninstall: uninstallCodex, isInstalled: isCodexInstalled },
|
|
420
|
+
'cursor': { install: installCursor, uninstall: uninstallCursor, isInstalled: isCursorInstalled },
|
|
421
|
+
'vscode': { install: installVSCode, uninstall: uninstallVSCode, isInstalled: isVSCodeInstalled },
|
|
422
|
+
'opencode': { install: installOpenCode, uninstall: uninstallOpenCode, isInstalled: isOpenCodeInstalled },
|
|
423
|
+
'generic-mcp': { install: installGenericMcp, uninstall: uninstallGenericMcp, isInstalled: isGenericMcpInstalled },
|
|
424
|
+
};
|
|
425
|
+
function validateRuntime(runtime) {
|
|
426
|
+
if (!SUPPORTED_RUNTIMES.includes(runtime)) {
|
|
427
|
+
throw new Error(`Unsupported runtime "${runtime}". Supported: ${SUPPORTED_RUNTIMES.join(', ')}`);
|
|
428
|
+
}
|
|
429
|
+
return runtime;
|
|
430
|
+
}
|
|
431
|
+
export async function agentInstall(runtime) {
|
|
432
|
+
const rt = validateRuntime(runtime);
|
|
433
|
+
const result = RUNTIME_HANDLERS[rt].install();
|
|
434
|
+
console.log(`[snoopy] ${result.message}`);
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
export async function agentUninstall(runtime) {
|
|
438
|
+
const rt = validateRuntime(runtime);
|
|
439
|
+
const result = RUNTIME_HANDLERS[rt].uninstall();
|
|
440
|
+
console.log(`[snoopy] ${result.message}`);
|
|
441
|
+
return result;
|
|
442
|
+
}
|
|
443
|
+
export async function agentStatus() {
|
|
444
|
+
const runtimes = SUPPORTED_RUNTIMES.map((rt) => {
|
|
445
|
+
let configPath = '';
|
|
446
|
+
try {
|
|
447
|
+
switch (rt) {
|
|
448
|
+
case 'claude':
|
|
449
|
+
configPath = join(homedir(), '.claude', 'settings.json');
|
|
450
|
+
break;
|
|
451
|
+
case 'claude-desktop':
|
|
452
|
+
configPath = getClaudeDesktopConfigPath();
|
|
453
|
+
break;
|
|
454
|
+
case 'chatgpt':
|
|
455
|
+
configPath = 'manual-setup';
|
|
456
|
+
break;
|
|
457
|
+
case 'gemini':
|
|
458
|
+
configPath = getGeminiSettingsPath();
|
|
459
|
+
break;
|
|
460
|
+
case 'codex':
|
|
461
|
+
configPath = getCodexConfigPath();
|
|
462
|
+
break;
|
|
463
|
+
case 'cursor':
|
|
464
|
+
configPath = getCursorMcpPath();
|
|
465
|
+
break;
|
|
466
|
+
case 'vscode':
|
|
467
|
+
configPath = getVSCodeMcpPath();
|
|
468
|
+
break;
|
|
469
|
+
case 'opencode':
|
|
470
|
+
configPath = getOpenCodeConfigPath();
|
|
471
|
+
break;
|
|
472
|
+
case 'generic-mcp':
|
|
473
|
+
configPath = 'manual';
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
catch {
|
|
478
|
+
configPath = 'unknown';
|
|
479
|
+
}
|
|
480
|
+
return {
|
|
481
|
+
runtime: rt,
|
|
482
|
+
installed: RUNTIME_HANDLERS[rt].isInstalled(),
|
|
483
|
+
configPath,
|
|
484
|
+
};
|
|
485
|
+
});
|
|
486
|
+
return { runtimes };
|
|
487
|
+
}
|
|
488
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface FeedbackSubmitOptions {
|
|
2
|
+
valid?: boolean;
|
|
3
|
+
invalid?: boolean;
|
|
4
|
+
reason?: string;
|
|
5
|
+
json?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface FeedbackReviewOptions {
|
|
8
|
+
json?: boolean;
|
|
9
|
+
limit?: number;
|
|
10
|
+
}
|
|
11
|
+
interface FeedbackConsolidateOptions {
|
|
12
|
+
limit?: number;
|
|
13
|
+
json?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function feedbackSubmit(resultId: string, options?: FeedbackSubmitOptions): Promise<void>;
|
|
16
|
+
export declare function feedbackReview(jobRef?: string, options?: FeedbackReviewOptions): Promise<void>;
|
|
17
|
+
export declare function feedbackConsolidate(jobRef?: string, options?: FeedbackConsolidateOptions): Promise<void>;
|
|
18
|
+
export {};
|