mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-23 05:41:10 -05:00
Prettier backfill
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
class Client {
|
||||
constructor() {
|
||||
this.request = jest.fn()
|
||||
}
|
||||
constructor() {
|
||||
this.request = jest.fn()
|
||||
}
|
||||
|
||||
connect() {
|
||||
return Promise.resolve()
|
||||
}
|
||||
connect() {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
close() {
|
||||
return Promise.resolve()
|
||||
}
|
||||
close() {
|
||||
return Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
Client
|
||||
}
|
||||
Client,
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
class StdioClientTransport {
|
||||
constructor() {
|
||||
this.start = jest.fn().mockResolvedValue(undefined)
|
||||
this.close = jest.fn().mockResolvedValue(undefined)
|
||||
this.stderr = {
|
||||
on: jest.fn()
|
||||
}
|
||||
}
|
||||
constructor() {
|
||||
this.start = jest.fn().mockResolvedValue(undefined)
|
||||
this.close = jest.fn().mockResolvedValue(undefined)
|
||||
this.stderr = {
|
||||
on: jest.fn(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class StdioServerParameters {
|
||||
constructor() {
|
||||
this.command = ''
|
||||
this.args = []
|
||||
this.env = {}
|
||||
}
|
||||
constructor() {
|
||||
this.command = ""
|
||||
this.args = []
|
||||
this.env = {}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
StdioClientTransport,
|
||||
StdioServerParameters
|
||||
}
|
||||
StdioClientTransport,
|
||||
StdioServerParameters,
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
const { Client } = require('./client/index.js')
|
||||
const { StdioClientTransport, StdioServerParameters } = require('./client/stdio.js')
|
||||
const { Client } = require("./client/index.js")
|
||||
const { StdioClientTransport, StdioServerParameters } = require("./client/stdio.js")
|
||||
const {
|
||||
CallToolResultSchema,
|
||||
ListToolsResultSchema,
|
||||
ListResourcesResultSchema,
|
||||
ListResourceTemplatesResultSchema,
|
||||
ReadResourceResultSchema,
|
||||
ErrorCode,
|
||||
McpError
|
||||
} = require('./types.js')
|
||||
CallToolResultSchema,
|
||||
ListToolsResultSchema,
|
||||
ListResourcesResultSchema,
|
||||
ListResourceTemplatesResultSchema,
|
||||
ReadResourceResultSchema,
|
||||
ErrorCode,
|
||||
McpError,
|
||||
} = require("./types.js")
|
||||
|
||||
module.exports = {
|
||||
Client,
|
||||
StdioClientTransport,
|
||||
StdioServerParameters,
|
||||
CallToolResultSchema,
|
||||
ListToolsResultSchema,
|
||||
ListResourcesResultSchema,
|
||||
ListResourceTemplatesResultSchema,
|
||||
ReadResourceResultSchema,
|
||||
ErrorCode,
|
||||
McpError
|
||||
}
|
||||
Client,
|
||||
StdioClientTransport,
|
||||
StdioServerParameters,
|
||||
CallToolResultSchema,
|
||||
ListToolsResultSchema,
|
||||
ListResourcesResultSchema,
|
||||
ListResourceTemplatesResultSchema,
|
||||
ReadResourceResultSchema,
|
||||
ErrorCode,
|
||||
McpError,
|
||||
}
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
const CallToolResultSchema = {
|
||||
parse: jest.fn().mockReturnValue({})
|
||||
parse: jest.fn().mockReturnValue({}),
|
||||
}
|
||||
|
||||
const ListToolsResultSchema = {
|
||||
parse: jest.fn().mockReturnValue({
|
||||
tools: []
|
||||
})
|
||||
parse: jest.fn().mockReturnValue({
|
||||
tools: [],
|
||||
}),
|
||||
}
|
||||
|
||||
const ListResourcesResultSchema = {
|
||||
parse: jest.fn().mockReturnValue({
|
||||
resources: []
|
||||
})
|
||||
parse: jest.fn().mockReturnValue({
|
||||
resources: [],
|
||||
}),
|
||||
}
|
||||
|
||||
const ListResourceTemplatesResultSchema = {
|
||||
parse: jest.fn().mockReturnValue({
|
||||
resourceTemplates: []
|
||||
})
|
||||
parse: jest.fn().mockReturnValue({
|
||||
resourceTemplates: [],
|
||||
}),
|
||||
}
|
||||
|
||||
const ReadResourceResultSchema = {
|
||||
parse: jest.fn().mockReturnValue({
|
||||
contents: []
|
||||
})
|
||||
parse: jest.fn().mockReturnValue({
|
||||
contents: [],
|
||||
}),
|
||||
}
|
||||
|
||||
const ErrorCode = {
|
||||
InvalidRequest: 'InvalidRequest',
|
||||
MethodNotFound: 'MethodNotFound',
|
||||
InvalidParams: 'InvalidParams',
|
||||
InternalError: 'InternalError'
|
||||
InvalidRequest: "InvalidRequest",
|
||||
MethodNotFound: "MethodNotFound",
|
||||
InvalidParams: "InvalidParams",
|
||||
InternalError: "InternalError",
|
||||
}
|
||||
|
||||
class McpError extends Error {
|
||||
constructor(code, message) {
|
||||
super(message)
|
||||
this.code = code
|
||||
}
|
||||
constructor(code, message) {
|
||||
super(message)
|
||||
this.code = code
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
CallToolResultSchema,
|
||||
ListToolsResultSchema,
|
||||
ListResourcesResultSchema,
|
||||
ListResourceTemplatesResultSchema,
|
||||
ReadResourceResultSchema,
|
||||
ErrorCode,
|
||||
McpError
|
||||
}
|
||||
CallToolResultSchema,
|
||||
ListToolsResultSchema,
|
||||
ListResourcesResultSchema,
|
||||
ListResourceTemplatesResultSchema,
|
||||
ReadResourceResultSchema,
|
||||
ErrorCode,
|
||||
McpError,
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
export class McpHub {
|
||||
connections = []
|
||||
isConnecting = false
|
||||
connections = []
|
||||
isConnecting = false
|
||||
|
||||
constructor() {
|
||||
this.toggleToolAlwaysAllow = jest.fn()
|
||||
this.callTool = jest.fn()
|
||||
}
|
||||
constructor() {
|
||||
this.toggleToolAlwaysAllow = jest.fn()
|
||||
this.callTool = jest.fn()
|
||||
}
|
||||
|
||||
async toggleToolAlwaysAllow(serverName: string, toolName: string, shouldAllow: boolean): Promise<void> {
|
||||
return Promise.resolve()
|
||||
}
|
||||
async toggleToolAlwaysAllow(serverName: string, toolName: string, shouldAllow: boolean): Promise<void> {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
async callTool(serverName: string, toolName: string, toolArguments?: Record<string, unknown>): Promise<any> {
|
||||
return Promise.resolve({ result: 'success' })
|
||||
}
|
||||
}
|
||||
async callTool(serverName: string, toolName: string, toolArguments?: Record<string, unknown>): Promise<any> {
|
||||
return Promise.resolve({ result: "success" })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Mock default shell based on platform
|
||||
const os = require('os');
|
||||
const os = require("os")
|
||||
|
||||
let defaultShell;
|
||||
if (os.platform() === 'win32') {
|
||||
defaultShell = 'cmd.exe';
|
||||
let defaultShell
|
||||
if (os.platform() === "win32") {
|
||||
defaultShell = "cmd.exe"
|
||||
} else {
|
||||
defaultShell = '/bin/bash';
|
||||
defaultShell = "/bin/bash"
|
||||
}
|
||||
|
||||
module.exports = defaultShell;
|
||||
module.exports.default = defaultShell;
|
||||
module.exports = defaultShell
|
||||
module.exports.default = defaultShell
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function delay(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
module.exports = delay;
|
||||
module.exports.default = delay;
|
||||
module.exports = delay
|
||||
module.exports.default = delay
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
function globby(patterns, options) {
|
||||
return Promise.resolve([]);
|
||||
return Promise.resolve([])
|
||||
}
|
||||
|
||||
globby.sync = function(patterns, options) {
|
||||
return [];
|
||||
};
|
||||
globby.sync = function (patterns, options) {
|
||||
return []
|
||||
}
|
||||
|
||||
module.exports = globby;
|
||||
module.exports.default = globby;
|
||||
module.exports = globby
|
||||
module.exports.default = globby
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function osName() {
|
||||
return 'macOS';
|
||||
return "macOS"
|
||||
}
|
||||
|
||||
module.exports = osName;
|
||||
module.exports.default = osName;
|
||||
module.exports = osName
|
||||
module.exports.default = osName
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
function pWaitFor(condition, options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const interval = setInterval(() => {
|
||||
if (condition()) {
|
||||
clearInterval(interval);
|
||||
resolve();
|
||||
}
|
||||
}, options.interval || 20);
|
||||
return new Promise((resolve, reject) => {
|
||||
const interval = setInterval(() => {
|
||||
if (condition()) {
|
||||
clearInterval(interval)
|
||||
resolve()
|
||||
}
|
||||
}, options.interval || 20)
|
||||
|
||||
if (options.timeout) {
|
||||
setTimeout(() => {
|
||||
clearInterval(interval);
|
||||
reject(new Error('Timed out'));
|
||||
}, options.timeout);
|
||||
}
|
||||
});
|
||||
if (options.timeout) {
|
||||
setTimeout(() => {
|
||||
clearInterval(interval)
|
||||
reject(new Error("Timed out"))
|
||||
}, options.timeout)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = pWaitFor;
|
||||
module.exports.default = pWaitFor;
|
||||
module.exports = pWaitFor
|
||||
module.exports.default = pWaitFor
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
function serializeError(error) {
|
||||
if (error instanceof Error) {
|
||||
return {
|
||||
name: error.name,
|
||||
message: error.message,
|
||||
stack: error.stack
|
||||
};
|
||||
}
|
||||
return error;
|
||||
if (error instanceof Error) {
|
||||
return {
|
||||
name: error.name,
|
||||
message: error.message,
|
||||
stack: error.stack,
|
||||
}
|
||||
}
|
||||
return error
|
||||
}
|
||||
|
||||
function deserializeError(errorData) {
|
||||
if (errorData && typeof errorData === 'object') {
|
||||
const error = new Error(errorData.message);
|
||||
error.name = errorData.name;
|
||||
error.stack = errorData.stack;
|
||||
return error;
|
||||
}
|
||||
return errorData;
|
||||
if (errorData && typeof errorData === "object") {
|
||||
const error = new Error(errorData.message)
|
||||
error.name = errorData.name
|
||||
error.stack = errorData.stack
|
||||
return error
|
||||
}
|
||||
return errorData
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
serializeError,
|
||||
deserializeError
|
||||
};
|
||||
serializeError,
|
||||
deserializeError,
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function stripAnsi(string) {
|
||||
// Simple mock that just returns the input string
|
||||
return string;
|
||||
// Simple mock that just returns the input string
|
||||
return string
|
||||
}
|
||||
|
||||
module.exports = stripAnsi;
|
||||
module.exports.default = stripAnsi;
|
||||
module.exports = stripAnsi
|
||||
module.exports.default = stripAnsi
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
const vscode = {
|
||||
window: {
|
||||
showInformationMessage: jest.fn(),
|
||||
showErrorMessage: jest.fn(),
|
||||
createTextEditorDecorationType: jest.fn().mockReturnValue({
|
||||
dispose: jest.fn()
|
||||
})
|
||||
},
|
||||
workspace: {
|
||||
onDidSaveTextDocument: jest.fn()
|
||||
},
|
||||
Disposable: class {
|
||||
dispose() {}
|
||||
},
|
||||
Uri: {
|
||||
file: (path) => ({
|
||||
fsPath: path,
|
||||
scheme: 'file',
|
||||
authority: '',
|
||||
path: path,
|
||||
query: '',
|
||||
fragment: '',
|
||||
with: jest.fn(),
|
||||
toJSON: jest.fn()
|
||||
})
|
||||
},
|
||||
EventEmitter: class {
|
||||
constructor() {
|
||||
this.event = jest.fn();
|
||||
this.fire = jest.fn();
|
||||
}
|
||||
},
|
||||
ConfigurationTarget: {
|
||||
Global: 1,
|
||||
Workspace: 2,
|
||||
WorkspaceFolder: 3
|
||||
},
|
||||
Position: class {
|
||||
constructor(line, character) {
|
||||
this.line = line;
|
||||
this.character = character;
|
||||
}
|
||||
},
|
||||
Range: class {
|
||||
constructor(startLine, startCharacter, endLine, endCharacter) {
|
||||
this.start = new vscode.Position(startLine, startCharacter);
|
||||
this.end = new vscode.Position(endLine, endCharacter);
|
||||
}
|
||||
},
|
||||
ThemeColor: class {
|
||||
constructor(id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
};
|
||||
window: {
|
||||
showInformationMessage: jest.fn(),
|
||||
showErrorMessage: jest.fn(),
|
||||
createTextEditorDecorationType: jest.fn().mockReturnValue({
|
||||
dispose: jest.fn(),
|
||||
}),
|
||||
},
|
||||
workspace: {
|
||||
onDidSaveTextDocument: jest.fn(),
|
||||
},
|
||||
Disposable: class {
|
||||
dispose() {}
|
||||
},
|
||||
Uri: {
|
||||
file: (path) => ({
|
||||
fsPath: path,
|
||||
scheme: "file",
|
||||
authority: "",
|
||||
path: path,
|
||||
query: "",
|
||||
fragment: "",
|
||||
with: jest.fn(),
|
||||
toJSON: jest.fn(),
|
||||
}),
|
||||
},
|
||||
EventEmitter: class {
|
||||
constructor() {
|
||||
this.event = jest.fn()
|
||||
this.fire = jest.fn()
|
||||
}
|
||||
},
|
||||
ConfigurationTarget: {
|
||||
Global: 1,
|
||||
Workspace: 2,
|
||||
WorkspaceFolder: 3,
|
||||
},
|
||||
Position: class {
|
||||
constructor(line, character) {
|
||||
this.line = line
|
||||
this.character = character
|
||||
}
|
||||
},
|
||||
Range: class {
|
||||
constructor(startLine, startCharacter, endLine, endCharacter) {
|
||||
this.start = new vscode.Position(startLine, startCharacter)
|
||||
this.end = new vscode.Position(endLine, endCharacter)
|
||||
}
|
||||
},
|
||||
ThemeColor: class {
|
||||
constructor(id) {
|
||||
this.id = id
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = vscode;
|
||||
module.exports = vscode
|
||||
|
||||
Reference in New Issue
Block a user