@tostudy-ai/mcp-setup 1.3.0 → 1.4.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/README.md +26 -25
- package/dist/index.d.ts +2 -14
- package/dist/index.js +2983 -613
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
- package/dist/__tests__/e2e-diagnostic-repair-flow.test.d.ts +0 -52
- package/dist/__tests__/e2e-diagnostic-repair-flow.test.d.ts.map +0 -1
- package/dist/__tests__/e2e-diagnostic-repair-flow.test.js +0 -720
- package/dist/__tests__/e2e-diagnostic-repair-flow.test.js.map +0 -1
- package/dist/__tests__/e2e-wizard-flow.test.d.ts +0 -43
- package/dist/__tests__/e2e-wizard-flow.test.d.ts.map +0 -1
- package/dist/__tests__/e2e-wizard-flow.test.js +0 -418
- package/dist/__tests__/e2e-wizard-flow.test.js.map +0 -1
- package/dist/__tests__/ide-handlers.test.d.ts +0 -10
- package/dist/__tests__/ide-handlers.test.d.ts.map +0 -1
- package/dist/__tests__/ide-handlers.test.js +0 -358
- package/dist/__tests__/ide-handlers.test.js.map +0 -1
- package/dist/__tests__/install-command.test.d.ts +0 -10
- package/dist/__tests__/install-command.test.d.ts.map +0 -1
- package/dist/__tests__/install-command.test.js +0 -248
- package/dist/__tests__/install-command.test.js.map +0 -1
- package/dist/callback-page.d.ts +0 -6
- package/dist/callback-page.d.ts.map +0 -1
- package/dist/callback-page.js +0 -96
- package/dist/callback-page.js.map +0 -1
- package/dist/config.d.ts +0 -62
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -167
- package/dist/config.js.map +0 -1
- package/dist/detect.d.ts +0 -42
- package/dist/detect.d.ts.map +0 -1
- package/dist/detect.js +0 -277
- package/dist/detect.js.map +0 -1
- package/dist/diagnose.d.ts +0 -36
- package/dist/diagnose.d.ts.map +0 -1
- package/dist/diagnose.js +0 -502
- package/dist/diagnose.js.map +0 -1
- package/dist/ide-handlers/antigravity.d.ts +0 -16
- package/dist/ide-handlers/antigravity.d.ts.map +0 -1
- package/dist/ide-handlers/antigravity.js +0 -46
- package/dist/ide-handlers/antigravity.js.map +0 -1
- package/dist/ide-handlers/base.d.ts +0 -36
- package/dist/ide-handlers/base.d.ts.map +0 -1
- package/dist/ide-handlers/base.js +0 -66
- package/dist/ide-handlers/base.js.map +0 -1
- package/dist/ide-handlers/claude-code.d.ts +0 -15
- package/dist/ide-handlers/claude-code.d.ts.map +0 -1
- package/dist/ide-handlers/claude-code.js +0 -50
- package/dist/ide-handlers/claude-code.js.map +0 -1
- package/dist/ide-handlers/codex.d.ts +0 -15
- package/dist/ide-handlers/codex.d.ts.map +0 -1
- package/dist/ide-handlers/codex.js +0 -53
- package/dist/ide-handlers/codex.js.map +0 -1
- package/dist/ide-handlers/cursor.d.ts +0 -15
- package/dist/ide-handlers/cursor.d.ts.map +0 -1
- package/dist/ide-handlers/cursor.js +0 -61
- package/dist/ide-handlers/cursor.js.map +0 -1
- package/dist/ide-handlers/desktop.d.ts +0 -16
- package/dist/ide-handlers/desktop.d.ts.map +0 -1
- package/dist/ide-handlers/desktop.js +0 -50
- package/dist/ide-handlers/desktop.js.map +0 -1
- package/dist/ide-handlers/index.d.ts +0 -21
- package/dist/ide-handlers/index.d.ts.map +0 -1
- package/dist/ide-handlers/index.js +0 -55
- package/dist/ide-handlers/index.js.map +0 -1
- package/dist/ide-handlers/manual.d.ts +0 -16
- package/dist/ide-handlers/manual.d.ts.map +0 -1
- package/dist/ide-handlers/manual.js +0 -34
- package/dist/ide-handlers/manual.js.map +0 -1
- package/dist/ide-handlers/opencode.d.ts +0 -15
- package/dist/ide-handlers/opencode.d.ts.map +0 -1
- package/dist/ide-handlers/opencode.js +0 -57
- package/dist/ide-handlers/opencode.js.map +0 -1
- package/dist/ide-handlers/vscode.d.ts +0 -16
- package/dist/ide-handlers/vscode.d.ts.map +0 -1
- package/dist/ide-handlers/vscode.js +0 -62
- package/dist/ide-handlers/vscode.js.map +0 -1
- package/dist/ide-handlers/windsurf.d.ts +0 -16
- package/dist/ide-handlers/windsurf.d.ts.map +0 -1
- package/dist/ide-handlers/windsurf.js +0 -46
- package/dist/ide-handlers/windsurf.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/oauth-server.d.ts +0 -4
- package/dist/oauth-server.d.ts.map +0 -1
- package/dist/oauth-server.js +0 -49
- package/dist/oauth-server.js.map +0 -1
- package/dist/prompts.d.ts +0 -23
- package/dist/prompts.d.ts.map +0 -1
- package/dist/prompts.js +0 -68
- package/dist/prompts.js.map +0 -1
- package/dist/repair.d.ts +0 -50
- package/dist/repair.d.ts.map +0 -1
- package/dist/repair.js +0 -633
- package/dist/repair.js.map +0 -1
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* VS Code IDE Handler
|
|
3
|
-
*
|
|
4
|
-
* Writes to .vscode/mcp.json with { servers: { tostudy: ... } }
|
|
5
|
-
* Note: VS Code uses "servers" (not "mcpServers") in its config format.
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
8
|
-
import { join, dirname } from 'node:path';
|
|
9
|
-
import { homedir, platform } from 'node:os';
|
|
10
|
-
import { buildTostudyServerEntry, verifyHeartbeat } from './base.js';
|
|
11
|
-
export class VSCodeHandler {
|
|
12
|
-
id = 'vscode';
|
|
13
|
-
name = 'VS Code';
|
|
14
|
-
async detect() {
|
|
15
|
-
const home = homedir();
|
|
16
|
-
const os = platform();
|
|
17
|
-
switch (os) {
|
|
18
|
-
case 'darwin':
|
|
19
|
-
return existsSync(join('/Applications', 'Visual Studio Code.app')) ||
|
|
20
|
-
existsSync(join(home, 'Applications', 'Visual Studio Code.app'));
|
|
21
|
-
case 'win32': {
|
|
22
|
-
const programFiles = process.env.ProgramFiles || 'C:\\Program Files';
|
|
23
|
-
const localAppData = process.env.LOCALAPPDATA || join(home, 'AppData', 'Local');
|
|
24
|
-
return existsSync(join(programFiles, 'Microsoft VS Code', 'Code.exe')) ||
|
|
25
|
-
existsSync(join(localAppData, 'Programs', 'Microsoft VS Code', 'Code.exe'));
|
|
26
|
-
}
|
|
27
|
-
case 'linux':
|
|
28
|
-
return existsSync('/usr/bin/code') || existsSync('/usr/local/bin/code');
|
|
29
|
-
default:
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
getConfigPath() {
|
|
34
|
-
// VS Code MCP config is per-workspace: .vscode/mcp.json
|
|
35
|
-
return join(process.cwd(), '.vscode', 'mcp.json');
|
|
36
|
-
}
|
|
37
|
-
async writeConfig(apiKey, mcpUrl) {
|
|
38
|
-
const configPath = this.getConfigPath();
|
|
39
|
-
const configDir = dirname(configPath);
|
|
40
|
-
if (!existsSync(configDir)) {
|
|
41
|
-
mkdirSync(configDir, { recursive: true });
|
|
42
|
-
}
|
|
43
|
-
let config = {};
|
|
44
|
-
if (existsSync(configPath)) {
|
|
45
|
-
try {
|
|
46
|
-
config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
// Start fresh
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// VS Code uses "servers" key
|
|
53
|
-
const servers = config.servers ?? {};
|
|
54
|
-
servers['tostudy'] = buildTostudyServerEntry(apiKey, mcpUrl, this.id);
|
|
55
|
-
config.servers = servers;
|
|
56
|
-
writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
57
|
-
}
|
|
58
|
-
async verify(apiKey, mcpUrl) {
|
|
59
|
-
return verifyHeartbeat(apiKey, mcpUrl);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=vscode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vscode.js","sourceRoot":"","sources":["../../src/ide-handlers/vscode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EA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
* with { mcpServers: { tostudy: ... } }.
|
|
6
|
-
*/
|
|
7
|
-
import { type IDEHandler } from './base.js';
|
|
8
|
-
export declare class WindsurfHandler implements IDEHandler {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
detect(): Promise<boolean>;
|
|
12
|
-
getConfigPath(): string;
|
|
13
|
-
writeConfig(apiKey: string, mcpUrl: string): Promise<void>;
|
|
14
|
-
verify(apiKey: string, mcpUrl: string): Promise<boolean>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=windsurf.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"windsurf.d.ts","sourceRoot":"","sources":["../../src/ide-handlers/windsurf.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,KAAK,UAAU,EAA4C,MAAM,WAAW,CAAC;AAEtF,qBAAa,eAAgB,YAAW,UAAU;IAChD,EAAE,SAAc;IAChB,IAAI,SAAc;IAEZ,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAMhC,aAAa,IAAI,MAAM;IAIjB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB1D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAG/D"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Windsurf IDE Handler
|
|
3
|
-
*
|
|
4
|
-
* Writes to ~/.codeium/windsurf/mcp_config.json
|
|
5
|
-
* with { mcpServers: { tostudy: ... } }.
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
8
|
-
import { join, dirname } from 'node:path';
|
|
9
|
-
import { homedir } from 'node:os';
|
|
10
|
-
import { buildTostudyServerEntry, verifyHeartbeat } from './base.js';
|
|
11
|
-
export class WindsurfHandler {
|
|
12
|
-
id = 'windsurf';
|
|
13
|
-
name = 'Windsurf';
|
|
14
|
-
async detect() {
|
|
15
|
-
const home = homedir();
|
|
16
|
-
return existsSync(join(home, '.codeium', 'windsurf')) ||
|
|
17
|
-
existsSync(join(home, '.codeium', 'windsurf', 'mcp_config.json'));
|
|
18
|
-
}
|
|
19
|
-
getConfigPath() {
|
|
20
|
-
return join(homedir(), '.codeium', 'windsurf', 'mcp_config.json');
|
|
21
|
-
}
|
|
22
|
-
async writeConfig(apiKey, mcpUrl) {
|
|
23
|
-
const configPath = this.getConfigPath();
|
|
24
|
-
const configDir = dirname(configPath);
|
|
25
|
-
if (!existsSync(configDir)) {
|
|
26
|
-
mkdirSync(configDir, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
let config = {};
|
|
29
|
-
if (existsSync(configPath)) {
|
|
30
|
-
try {
|
|
31
|
-
config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// Start fresh if config is corrupted
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const mcpServers = config.mcpServers ?? {};
|
|
38
|
-
mcpServers.tostudy = buildTostudyServerEntry(apiKey, mcpUrl, this.id);
|
|
39
|
-
config.mcpServers = mcpServers;
|
|
40
|
-
writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
41
|
-
}
|
|
42
|
-
async verify(apiKey, mcpUrl) {
|
|
43
|
-
return verifyHeartbeat(apiKey, mcpUrl);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=windsurf.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"windsurf.js","sourceRoot":"","sources":["../../src/ide-handlers/windsurf.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,E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U,CAAC,OAAO,GAAG,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACtE,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;QAE/B,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,MAAc;QACzC,OAAO,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;CACF"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG"}
|
package/dist/oauth-server.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-server.d.ts","sourceRoot":"","sources":["../src/oauth-server.ts"],"names":[],"mappings":"AAUA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAqC3E"}
|
package/dist/oauth-server.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local HTTP server that captures the OAuth callback code.
|
|
3
|
-
*
|
|
4
|
-
* Listens on a given port for the browser redirect from
|
|
5
|
-
* /api/cli/auth/authorize, extracts the code parameter,
|
|
6
|
-
* serves a polished success page, and resolves.
|
|
7
|
-
*/
|
|
8
|
-
import http from "node:http";
|
|
9
|
-
import { getCallbackPageHtml } from "./callback-page.js";
|
|
10
|
-
export function startCallbackServer(port) {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
const server = http.createServer((req, res) => {
|
|
13
|
-
const url = new URL(req.url, `http://localhost:${port}`);
|
|
14
|
-
if (url.pathname === "/callback") {
|
|
15
|
-
const code = url.searchParams.get("code");
|
|
16
|
-
if (code) {
|
|
17
|
-
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
18
|
-
res.end(getCallbackPageHtml());
|
|
19
|
-
server.close();
|
|
20
|
-
resolve({ code });
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
res.writeHead(400, { "Content-Type": "text/plain" });
|
|
24
|
-
res.end("Missing code");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
29
|
-
res.end("Not found");
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
server.listen(port, () => { });
|
|
33
|
-
server.on("error", (err) => {
|
|
34
|
-
if (err.code === "EADDRINUSE") {
|
|
35
|
-
reject(new Error(`Porta ${port} em uso. Tente novamente ou use --api-key.`));
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
reject(err);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
// Timeout after 2 minutes (unref so it doesn't block process exit)
|
|
42
|
-
const timeoutId = setTimeout(() => {
|
|
43
|
-
server.close();
|
|
44
|
-
reject(new Error("Login timeout — nenhuma resposta em 2 minutos."));
|
|
45
|
-
}, 120_000);
|
|
46
|
-
timeoutId.unref();
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=oauth-server.js.map
|
package/dist/oauth-server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-server.js","sourceRoot":"","sources":["../src/oauth-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MA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;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,mEAAmE;QACnE,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAChC,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC;QACtE,CAAC,EAAE,OAAO,CAAC,CAAC;QACZ,SAAS,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/prompts.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive Prompts
|
|
3
|
-
*
|
|
4
|
-
* Simple readline-based prompts for CLI interaction.
|
|
5
|
-
* Uses Node.js built-in readline to minimize dependencies.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Prompt user for text input
|
|
9
|
-
*/
|
|
10
|
-
export declare function prompt(question: string): Promise<string>;
|
|
11
|
-
/**
|
|
12
|
-
* Prompt for API key with validation
|
|
13
|
-
*/
|
|
14
|
-
export declare function promptApiKey(): Promise<string>;
|
|
15
|
-
/**
|
|
16
|
-
* Prompt for yes/no confirmation
|
|
17
|
-
*/
|
|
18
|
-
export declare function confirm(question: string, defaultValue?: boolean): Promise<boolean>;
|
|
19
|
-
/**
|
|
20
|
-
* Prompt for platform URL
|
|
21
|
-
*/
|
|
22
|
-
export declare function promptPlatformUrl(defaultUrl: string): Promise<string>;
|
|
23
|
-
//# sourceMappingURL=prompts.d.ts.map
|
package/dist/prompts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH;;GAEG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxD;AAED;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAgBpD;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAStF;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAO3E"}
|
package/dist/prompts.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive Prompts
|
|
3
|
-
*
|
|
4
|
-
* Simple readline-based prompts for CLI interaction.
|
|
5
|
-
* Uses Node.js built-in readline to minimize dependencies.
|
|
6
|
-
*/
|
|
7
|
-
import * as readline from 'node:readline';
|
|
8
|
-
function println(message = '') {
|
|
9
|
-
process.stdout.write(`${message}\n`);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Create a readline interface for user input
|
|
13
|
-
*/
|
|
14
|
-
function createInterface() {
|
|
15
|
-
return readline.createInterface({
|
|
16
|
-
input: process.stdin,
|
|
17
|
-
output: process.stdout,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Prompt user for text input
|
|
22
|
-
*/
|
|
23
|
-
export function prompt(question) {
|
|
24
|
-
return new Promise((resolve) => {
|
|
25
|
-
const rl = createInterface();
|
|
26
|
-
rl.question(question, (answer) => {
|
|
27
|
-
rl.close();
|
|
28
|
-
resolve(answer.trim());
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Prompt for API key with validation
|
|
34
|
-
*/
|
|
35
|
-
export async function promptApiKey() {
|
|
36
|
-
println();
|
|
37
|
-
println('Cole sua API key (de /student/settings/mcp):');
|
|
38
|
-
const apiKey = await prompt('> ');
|
|
39
|
-
if (!apiKey) {
|
|
40
|
-
throw new Error('API key nao pode ser vazia');
|
|
41
|
-
}
|
|
42
|
-
// Basic validation - key should be at least 32 characters
|
|
43
|
-
if (apiKey.length < 32) {
|
|
44
|
-
throw new Error('API key parece ser muito curta. Verifique e tente novamente.');
|
|
45
|
-
}
|
|
46
|
-
return apiKey;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Prompt for yes/no confirmation
|
|
50
|
-
*/
|
|
51
|
-
export async function confirm(question, defaultValue = false) {
|
|
52
|
-
const defaultStr = defaultValue ? '[S/n]' : '[s/N]';
|
|
53
|
-
const answer = await prompt(`${question} ${defaultStr} `);
|
|
54
|
-
if (!answer) {
|
|
55
|
-
return defaultValue;
|
|
56
|
-
}
|
|
57
|
-
return answer.toLowerCase().startsWith('s') || answer.toLowerCase().startsWith('y');
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Prompt for platform URL
|
|
61
|
-
*/
|
|
62
|
-
export async function promptPlatformUrl(defaultUrl) {
|
|
63
|
-
println();
|
|
64
|
-
println(`URL da plataforma (default: ${defaultUrl}):`);
|
|
65
|
-
const url = await prompt('> ');
|
|
66
|
-
return url || defaultUrl;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=prompts.js.map
|
package/dist/prompts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,SAAS,OAAO,CAAC,OAAO,GAAG,EAAE;IAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,SAAS,eAAe;IACtB,OAAO,QAAQ,CAAC,eAAe,CAAC;QAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM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;AACtF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,UAAkB;IACxD,OAAO,EAAE,CAAC;IACV,OAAO,CAAC,+BAA+B,UAAU,IAAI,CAAC,CAAC;IAEvD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/B,OAAO,GAAG,IAAI,UAAU,CAAC;AAC3B,CAAC"}
|
package/dist/repair.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* MCP Auto-Repair Module
|
|
4
|
-
*
|
|
5
|
-
* Provides automatic repair functions for common MCP configuration issues.
|
|
6
|
-
* Works in conjunction with diagnose.ts to fix detected problems.
|
|
7
|
-
*/
|
|
8
|
-
import { DiagnosticIssue, DiagnosticReport } from "./diagnose.js";
|
|
9
|
-
export interface RepairResult {
|
|
10
|
-
issueId: string;
|
|
11
|
-
success: boolean;
|
|
12
|
-
message: string;
|
|
13
|
-
action?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface RepairReport {
|
|
16
|
-
timestamp: string;
|
|
17
|
-
repairsAttempted: number;
|
|
18
|
-
repairsSucceeded: number;
|
|
19
|
-
repairsFailed: number;
|
|
20
|
-
results: RepairResult[];
|
|
21
|
-
requiresUserInput: string[];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Check if an issue requires user input to repair
|
|
25
|
-
*/
|
|
26
|
-
export declare function issueRequiresUserInput(issueId: string): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Repair a single issue
|
|
29
|
-
*/
|
|
30
|
-
export declare function repairIssue(issue: DiagnosticIssue, apiKey?: string, platformUrl?: string): RepairResult;
|
|
31
|
-
/**
|
|
32
|
-
* Repair all auto-fixable issues from a diagnostic report
|
|
33
|
-
*/
|
|
34
|
-
export declare function repairAllIssues(report: DiagnosticReport, apiKey?: string, platformUrl?: string): RepairReport;
|
|
35
|
-
/**
|
|
36
|
-
* Run diagnostics and repair all issues automatically
|
|
37
|
-
*/
|
|
38
|
-
export declare function diagnoseAndRepair(apiKey?: string, platformUrl?: string): Promise<{
|
|
39
|
-
diagnostic: DiagnosticReport;
|
|
40
|
-
repair: RepairReport;
|
|
41
|
-
}>;
|
|
42
|
-
/**
|
|
43
|
-
* Print repair report to console
|
|
44
|
-
*/
|
|
45
|
-
export declare function printRepairReport(report: RepairReport): void;
|
|
46
|
-
/**
|
|
47
|
-
* Export repair report as JSON
|
|
48
|
-
*/
|
|
49
|
-
export declare function exportRepairReportJson(report: RepairReport): string;
|
|
50
|
-
//# sourceMappingURL=repair.d.ts.map
|
package/dist/repair.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repair.d.ts","sourceRoot":"","sources":["../src/repair.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAcH,OAAO,EAAkB,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAElF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAoeD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,eAAe,EACtB,MAAM,CAAC,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,GACnB,YAAY,CAYd;AAED;;GAEG;AACH,wBAAg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