mobbdev 1.0.179 → 1.0.181
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/dist/index.mjs +274 -24
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10604,7 +10604,9 @@ var GQLClient = class {
|
|
|
10604
10604
|
`The user with email:${email} is not associated with any organization`
|
|
10605
10605
|
);
|
|
10606
10606
|
}
|
|
10607
|
-
const organization = orgAndProjectRes.user?.at(0)?.userOrganizationsAndUserOrganizationRoles.map(
|
|
10607
|
+
const organization = orgAndProjectRes.user?.at(0)?.userOrganizationsAndUserOrganizationRoles.map(
|
|
10608
|
+
(org) => org.organization
|
|
10609
|
+
).filter(
|
|
10608
10610
|
(org) => userDefinedOrganizationId ? org.id === userDefinedOrganizationId : true
|
|
10609
10611
|
)?.at(0);
|
|
10610
10612
|
if (!organization) {
|
|
@@ -12354,15 +12356,111 @@ import {
|
|
|
12354
12356
|
|
|
12355
12357
|
// src/mcp/Logger.ts
|
|
12356
12358
|
import Configstore3 from "configstore";
|
|
12359
|
+
|
|
12360
|
+
// src/mcp/services/WorkspaceService.ts
|
|
12361
|
+
var WorkspaceService = class {
|
|
12362
|
+
/**
|
|
12363
|
+
* Sets a known workspace path that was discovered through successful validation
|
|
12364
|
+
* @param path The validated workspace path to store
|
|
12365
|
+
*/
|
|
12366
|
+
static setKnownWorkspacePath(path17) {
|
|
12367
|
+
this.knownWorkspacePath = path17;
|
|
12368
|
+
}
|
|
12369
|
+
/**
|
|
12370
|
+
* Gets the known workspace path that was previously validated
|
|
12371
|
+
* @returns The known workspace path or undefined if none stored
|
|
12372
|
+
*/
|
|
12373
|
+
static getKnownWorkspacePath() {
|
|
12374
|
+
return this.knownWorkspacePath;
|
|
12375
|
+
}
|
|
12376
|
+
/**
|
|
12377
|
+
* Gets the workspace folder path from known path or environment variables
|
|
12378
|
+
* @returns The workspace folder path or undefined if none found
|
|
12379
|
+
*/
|
|
12380
|
+
static getWorkspaceFolderPath() {
|
|
12381
|
+
if (this.knownWorkspacePath) {
|
|
12382
|
+
return this.knownWorkspacePath;
|
|
12383
|
+
}
|
|
12384
|
+
const workspaceEnvVars = [
|
|
12385
|
+
"WORKSPACE_FOLDER_PATHS",
|
|
12386
|
+
// Cursor IDE
|
|
12387
|
+
"PWD",
|
|
12388
|
+
// Claude Code and general shell
|
|
12389
|
+
"WORKSPACE_ROOT",
|
|
12390
|
+
// Generic workspace root
|
|
12391
|
+
"PROJECT_ROOT"
|
|
12392
|
+
// Generic project root
|
|
12393
|
+
];
|
|
12394
|
+
for (const envVar of workspaceEnvVars) {
|
|
12395
|
+
const value = process.env[envVar];
|
|
12396
|
+
if (value?.trim()) {
|
|
12397
|
+
return value.trim();
|
|
12398
|
+
}
|
|
12399
|
+
}
|
|
12400
|
+
return void 0;
|
|
12401
|
+
}
|
|
12402
|
+
///this should be deleted, use instead the host detection from the McpUsageService
|
|
12403
|
+
/**
|
|
12404
|
+
* Detects the IDE/editor host based on environment variables
|
|
12405
|
+
* @returns The detected IDE host
|
|
12406
|
+
*/
|
|
12407
|
+
static getHost() {
|
|
12408
|
+
if (process.env["WORKSPACE_FOLDER_PATHS"]) {
|
|
12409
|
+
return "CURSOR";
|
|
12410
|
+
}
|
|
12411
|
+
if (process.env["VSCODE_IPC_HOOK"] || process.env["VSCODE_PID"] || process.env["TERM_PROGRAM"] === "vscode") {
|
|
12412
|
+
return "VSCODE";
|
|
12413
|
+
}
|
|
12414
|
+
if (process.env["WINDSURF_IPC_HOOK"] || process.env["WINDSURF_PID"] || process.env["TERM_PROGRAM"] === "windsurf") {
|
|
12415
|
+
return "WINDSURF";
|
|
12416
|
+
}
|
|
12417
|
+
if (process.env["CLAUDE_DESKTOP"] || process.env["ANTHROPIC_CLAUDE"]) {
|
|
12418
|
+
return "CLAUDE";
|
|
12419
|
+
}
|
|
12420
|
+
if (process.env["WEBSTORM_VM_OPTIONS"] || process.env["IDEA_VM_OPTIONS"] || process.env["JETBRAINS_IDE"]) {
|
|
12421
|
+
return "WEBSTORM";
|
|
12422
|
+
}
|
|
12423
|
+
return "UNKNOWN";
|
|
12424
|
+
}
|
|
12425
|
+
};
|
|
12426
|
+
__publicField(WorkspaceService, "knownWorkspacePath");
|
|
12427
|
+
|
|
12428
|
+
// src/mcp/Logger.ts
|
|
12357
12429
|
var MAX_LOGS_SIZE = 1e3;
|
|
12358
12430
|
var Logger = class {
|
|
12359
12431
|
constructor() {
|
|
12360
12432
|
__publicField(this, "mobbConfigStore");
|
|
12361
|
-
__publicField(this, "
|
|
12362
|
-
this
|
|
12433
|
+
__publicField(this, "host");
|
|
12434
|
+
__publicField(this, "unknownPathSuffix");
|
|
12435
|
+
__publicField(this, "lastKnownPath", null);
|
|
12436
|
+
this.host = WorkspaceService.getHost();
|
|
12437
|
+
this.unknownPathSuffix = Math.floor(1e3 + Math.random() * 9e3).toString();
|
|
12363
12438
|
this.mobbConfigStore = new Configstore3("mobb-logs", {});
|
|
12364
12439
|
this.mobbConfigStore.set("version", packageJson.version);
|
|
12365
12440
|
}
|
|
12441
|
+
/**
|
|
12442
|
+
* Gets the current log path, fetching workspace path dynamically
|
|
12443
|
+
*/
|
|
12444
|
+
getCurrentLogPath() {
|
|
12445
|
+
const workspacePath = WorkspaceService.getWorkspaceFolderPath();
|
|
12446
|
+
if (workspacePath) {
|
|
12447
|
+
return `${this.host}:${workspacePath}`;
|
|
12448
|
+
}
|
|
12449
|
+
return `${this.host}:unknown-${this.unknownPathSuffix}`;
|
|
12450
|
+
}
|
|
12451
|
+
/**
|
|
12452
|
+
* Migrates logs from unknown path to known workspace path
|
|
12453
|
+
*/
|
|
12454
|
+
migrateLogs(fromPath, toPath) {
|
|
12455
|
+
const existingLogs = this.mobbConfigStore.get(fromPath) || [];
|
|
12456
|
+
const targetLogs = this.mobbConfigStore.get(toPath) || [];
|
|
12457
|
+
if (existingLogs.length > 0) {
|
|
12458
|
+
const combinedLogs = [...targetLogs, ...existingLogs];
|
|
12459
|
+
const finalLogs = combinedLogs.slice(-MAX_LOGS_SIZE);
|
|
12460
|
+
this.mobbConfigStore.set(toPath, finalLogs);
|
|
12461
|
+
this.mobbConfigStore.delete(fromPath);
|
|
12462
|
+
}
|
|
12463
|
+
}
|
|
12366
12464
|
/**
|
|
12367
12465
|
* Log a message to the console.
|
|
12368
12466
|
* @param message - The message to log.
|
|
@@ -12370,17 +12468,27 @@ var Logger = class {
|
|
|
12370
12468
|
* @param data - The data to log.
|
|
12371
12469
|
*/
|
|
12372
12470
|
log(message, level = "info", data) {
|
|
12471
|
+
const currentPath = this.getCurrentLogPath();
|
|
12472
|
+
const workspacePath = WorkspaceService.getWorkspaceFolderPath();
|
|
12473
|
+
if (workspacePath && this.lastKnownPath !== workspacePath) {
|
|
12474
|
+
const unknownPath = `${this.host}:unknown-${this.unknownPathSuffix}`;
|
|
12475
|
+
const knownPath = `${this.host}:${workspacePath}`;
|
|
12476
|
+
if (this.lastKnownPath === null || this.lastKnownPath.includes("unknown-")) {
|
|
12477
|
+
this.migrateLogs(unknownPath, knownPath);
|
|
12478
|
+
}
|
|
12479
|
+
this.lastKnownPath = workspacePath;
|
|
12480
|
+
}
|
|
12373
12481
|
const logMessage = {
|
|
12374
12482
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12375
12483
|
level,
|
|
12376
12484
|
message,
|
|
12377
12485
|
data
|
|
12378
12486
|
};
|
|
12379
|
-
const logs = this.mobbConfigStore.get(
|
|
12487
|
+
const logs = this.mobbConfigStore.get(currentPath) || [];
|
|
12380
12488
|
if (logs.length >= MAX_LOGS_SIZE) {
|
|
12381
12489
|
logs.shift();
|
|
12382
12490
|
}
|
|
12383
|
-
this.mobbConfigStore.set(
|
|
12491
|
+
this.mobbConfigStore.set(currentPath, [...logs, logMessage]);
|
|
12384
12492
|
}
|
|
12385
12493
|
};
|
|
12386
12494
|
var logger = new Logger();
|
|
@@ -13206,7 +13314,7 @@ var McpGQLClient = class {
|
|
|
13206
13314
|
}
|
|
13207
13315
|
};
|
|
13208
13316
|
async function createAuthenticatedMcpGQLClient({
|
|
13209
|
-
|
|
13317
|
+
isBackgroundCall = false
|
|
13210
13318
|
} = {}) {
|
|
13211
13319
|
logDebug("[GraphQL] Getting config", {
|
|
13212
13320
|
apiToken: configStore.get("apiToken")
|
|
@@ -13227,7 +13335,7 @@ async function createAuthenticatedMcpGQLClient({
|
|
|
13227
13335
|
return initialClient;
|
|
13228
13336
|
}
|
|
13229
13337
|
const authService = new McpAuthService(initialClient);
|
|
13230
|
-
const newApiToken = await authService.authenticate(
|
|
13338
|
+
const newApiToken = await authService.authenticate(isBackgroundCall);
|
|
13231
13339
|
configStore.set("apiToken", newApiToken);
|
|
13232
13340
|
return new McpGQLClient({ apiKey: newApiToken, type: "apiKey" });
|
|
13233
13341
|
}
|
|
@@ -13475,6 +13583,12 @@ var McpUsageService = class {
|
|
|
13475
13583
|
}
|
|
13476
13584
|
}
|
|
13477
13585
|
startPeriodicTracking() {
|
|
13586
|
+
if (!this.hasOrganizationId()) {
|
|
13587
|
+
logDebug(
|
|
13588
|
+
`[UsageService] Not starting periodic tracking - organization ID not available`
|
|
13589
|
+
);
|
|
13590
|
+
return;
|
|
13591
|
+
}
|
|
13478
13592
|
logDebug(`[UsageService] Starting periodic tracking for mcps`, {});
|
|
13479
13593
|
this.intervalId = setInterval(async () => {
|
|
13480
13594
|
logDebug(`[UsageService] Triggering periodic usage service`, {
|
|
@@ -13509,6 +13623,10 @@ var McpUsageService = class {
|
|
|
13509
13623
|
}
|
|
13510
13624
|
return "";
|
|
13511
13625
|
}
|
|
13626
|
+
hasOrganizationId() {
|
|
13627
|
+
const organizationId = configStore.get("GOV-ORG-ID") || "";
|
|
13628
|
+
return !!organizationId;
|
|
13629
|
+
}
|
|
13512
13630
|
createUsageData(mcpHostId, organizationId, status) {
|
|
13513
13631
|
const { user, mcps } = getHostInfo();
|
|
13514
13632
|
return {
|
|
@@ -13644,6 +13762,9 @@ var McpServer = class {
|
|
|
13644
13762
|
__publicField(this, "toolRegistry");
|
|
13645
13763
|
__publicField(this, "isEventHandlersSetup", false);
|
|
13646
13764
|
__publicField(this, "eventHandlers", /* @__PURE__ */ new Map());
|
|
13765
|
+
__publicField(this, "parentProcessCheckInterval");
|
|
13766
|
+
__publicField(this, "parentPid");
|
|
13767
|
+
this.parentPid = process.ppid;
|
|
13647
13768
|
this.server = new Server(
|
|
13648
13769
|
{
|
|
13649
13770
|
name: config4.name,
|
|
@@ -13658,11 +13779,21 @@ var McpServer = class {
|
|
|
13658
13779
|
this.toolRegistry = new ToolRegistry();
|
|
13659
13780
|
this.setupHandlers();
|
|
13660
13781
|
this.setupProcessEventHandlers();
|
|
13782
|
+
this.setupParentProcessMonitoring();
|
|
13661
13783
|
logInfo("MCP server instance created");
|
|
13662
|
-
logDebug("MCP server instance config", {
|
|
13784
|
+
logDebug("MCP server instance config", {
|
|
13785
|
+
config: config4,
|
|
13786
|
+
parentPid: this.parentPid
|
|
13787
|
+
});
|
|
13663
13788
|
}
|
|
13664
13789
|
async trackServerUsage(action, signalOrError) {
|
|
13665
13790
|
try {
|
|
13791
|
+
if (!mcpUsageService.hasOrganizationId()) {
|
|
13792
|
+
logDebug(
|
|
13793
|
+
`[McpServer] Skipping ${action} usage tracking - organization ID not available`
|
|
13794
|
+
);
|
|
13795
|
+
return;
|
|
13796
|
+
}
|
|
13666
13797
|
if (action === "start") {
|
|
13667
13798
|
await mcpUsageService.trackServerStart();
|
|
13668
13799
|
}
|
|
@@ -13684,6 +13815,12 @@ var McpServer = class {
|
|
|
13684
13815
|
const messages = {
|
|
13685
13816
|
SIGINT: "MCP server interrupted",
|
|
13686
13817
|
SIGTERM: "MCP server terminated",
|
|
13818
|
+
SIGHUP: "MCP server hangup signal received",
|
|
13819
|
+
SIGQUIT: "MCP server quit signal received",
|
|
13820
|
+
SIGABRT: "MCP server abort signal received",
|
|
13821
|
+
SIGPIPE: "MCP server broken pipe signal received",
|
|
13822
|
+
SIGCHLD: "MCP server child process signal received",
|
|
13823
|
+
SIGTSTP: "MCP server terminal stop signal received",
|
|
13687
13824
|
exit: "MCP server exiting",
|
|
13688
13825
|
uncaughtException: "Uncaught exception in MCP server",
|
|
13689
13826
|
unhandledRejection: "Unhandled promise rejection in MCP server",
|
|
@@ -13714,7 +13851,10 @@ var McpServer = class {
|
|
|
13714
13851
|
} else {
|
|
13715
13852
|
logDebug(message, { signal });
|
|
13716
13853
|
}
|
|
13717
|
-
if (signal === "
|
|
13854
|
+
if (signal === "SIGCHLD") {
|
|
13855
|
+
return;
|
|
13856
|
+
}
|
|
13857
|
+
if (signal === "SIGINT" || signal === "SIGTERM" || signal === "SIGHUP" || signal === "SIGQUIT" || signal === "SIGABRT" || signal === "SIGPIPE" || signal === "SIGTSTP") {
|
|
13718
13858
|
await this.trackServerUsage("stop", signal);
|
|
13719
13859
|
process.exit(0);
|
|
13720
13860
|
}
|
|
@@ -13723,6 +13863,62 @@ var McpServer = class {
|
|
|
13723
13863
|
process.exit(1);
|
|
13724
13864
|
}
|
|
13725
13865
|
}
|
|
13866
|
+
isParentProcessAlive() {
|
|
13867
|
+
try {
|
|
13868
|
+
process.kill(this.parentPid, 0);
|
|
13869
|
+
return true;
|
|
13870
|
+
} catch (error) {
|
|
13871
|
+
return false;
|
|
13872
|
+
}
|
|
13873
|
+
}
|
|
13874
|
+
async handleParentProcessDeath(source) {
|
|
13875
|
+
logInfo(`Parent process death detected via ${source}`, {
|
|
13876
|
+
parentPid: this.parentPid
|
|
13877
|
+
});
|
|
13878
|
+
await this.trackServerUsage("stop", `parent-death-${source}`);
|
|
13879
|
+
process.exit(0);
|
|
13880
|
+
}
|
|
13881
|
+
setupParentProcessMonitoring() {
|
|
13882
|
+
logInfo("Setting up parent process monitoring", {
|
|
13883
|
+
parentPid: this.parentPid
|
|
13884
|
+
});
|
|
13885
|
+
process.stdin.on("close", async () => {
|
|
13886
|
+
logDebug("stdin closed - parent likely terminated");
|
|
13887
|
+
await this.handleParentProcessDeath("stdin-close");
|
|
13888
|
+
});
|
|
13889
|
+
process.stdin.on("end", async () => {
|
|
13890
|
+
logDebug("stdin ended - parent likely terminated");
|
|
13891
|
+
await this.handleParentProcessDeath("stdin-end");
|
|
13892
|
+
});
|
|
13893
|
+
process.stdout.on("error", async (error) => {
|
|
13894
|
+
logWarn("stdout error - parent may have terminated", { error });
|
|
13895
|
+
if (error.message.includes("EPIPE") || error.message.includes("ECONNRESET")) {
|
|
13896
|
+
await this.handleParentProcessDeath("stdout-error");
|
|
13897
|
+
}
|
|
13898
|
+
});
|
|
13899
|
+
process.stderr.on("error", async (error) => {
|
|
13900
|
+
logWarn("stderr error - parent may have terminated", { error });
|
|
13901
|
+
if (error.message.includes("EPIPE") || error.message.includes("ECONNRESET")) {
|
|
13902
|
+
await this.handleParentProcessDeath("stderr-error");
|
|
13903
|
+
}
|
|
13904
|
+
});
|
|
13905
|
+
if (process.send) {
|
|
13906
|
+
process.on("disconnect", async () => {
|
|
13907
|
+
logDebug("IPC disconnected - parent terminated");
|
|
13908
|
+
await this.handleParentProcessDeath("ipc-disconnect");
|
|
13909
|
+
});
|
|
13910
|
+
logDebug("IPC monitoring enabled");
|
|
13911
|
+
} else {
|
|
13912
|
+
logDebug("IPC not available - skipping IPC monitoring");
|
|
13913
|
+
}
|
|
13914
|
+
this.parentProcessCheckInterval = setInterval(async () => {
|
|
13915
|
+
if (!this.isParentProcessAlive()) {
|
|
13916
|
+
logDebug("Parent process not alive during periodic check");
|
|
13917
|
+
await this.handleParentProcessDeath("periodic-check");
|
|
13918
|
+
}
|
|
13919
|
+
}, 1e4);
|
|
13920
|
+
logInfo("Parent process monitoring setup complete");
|
|
13921
|
+
}
|
|
13726
13922
|
setupProcessEventHandlers() {
|
|
13727
13923
|
if (this.isEventHandlersSetup) {
|
|
13728
13924
|
logDebug("Process event handlers already setup, skipping");
|
|
@@ -13731,6 +13927,12 @@ var McpServer = class {
|
|
|
13731
13927
|
const signals = [
|
|
13732
13928
|
"SIGINT",
|
|
13733
13929
|
"SIGTERM",
|
|
13930
|
+
"SIGHUP",
|
|
13931
|
+
"SIGQUIT",
|
|
13932
|
+
"SIGABRT",
|
|
13933
|
+
"SIGPIPE",
|
|
13934
|
+
"SIGCHLD",
|
|
13935
|
+
"SIGTSTP",
|
|
13734
13936
|
"exit",
|
|
13735
13937
|
"uncaughtException",
|
|
13736
13938
|
"unhandledRejection",
|
|
@@ -13754,29 +13956,32 @@ var McpServer = class {
|
|
|
13754
13956
|
};
|
|
13755
13957
|
process.once("SIGINT", cleanup);
|
|
13756
13958
|
process.once("SIGTERM", cleanup);
|
|
13959
|
+
process.once("SIGHUP", cleanup);
|
|
13960
|
+
process.once("SIGQUIT", cleanup);
|
|
13961
|
+
process.once("SIGABRT", cleanup);
|
|
13962
|
+
process.once("SIGPIPE", cleanup);
|
|
13963
|
+
process.once("SIGTSTP", cleanup);
|
|
13757
13964
|
});
|
|
13758
13965
|
}
|
|
13759
13966
|
async triggerScanForNewAvailableFixes() {
|
|
13760
13967
|
try {
|
|
13761
13968
|
const gqlClient = await createAuthenticatedMcpGQLClient({
|
|
13762
|
-
|
|
13969
|
+
isBackgroundCall: true
|
|
13763
13970
|
});
|
|
13764
13971
|
const isConnected = await gqlClient.verifyApiConnection();
|
|
13765
13972
|
if (!isConnected) {
|
|
13766
13973
|
logError("Failed to connect to the API, skipping background scan");
|
|
13767
13974
|
return;
|
|
13768
13975
|
}
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
WORKSPACE_FOLDER_PATHS: process.env["WORKSPACE_FOLDER_PATHS"]
|
|
13772
|
-
});
|
|
13976
|
+
const workspacePath = WorkspaceService.getWorkspaceFolderPath();
|
|
13977
|
+
if (workspacePath) {
|
|
13773
13978
|
try {
|
|
13774
13979
|
const checkForNewAvailableFixesTool = this.toolRegistry.getTool(
|
|
13775
13980
|
MCP_TOOL_CHECK_FOR_NEW_AVAILABLE_FIXES
|
|
13776
13981
|
);
|
|
13777
13982
|
logInfo("Triggering periodic scan for new available fixes");
|
|
13778
13983
|
checkForNewAvailableFixesTool.triggerScan({
|
|
13779
|
-
path:
|
|
13984
|
+
path: workspacePath,
|
|
13780
13985
|
gqlClient
|
|
13781
13986
|
});
|
|
13782
13987
|
} catch (error) {
|
|
@@ -13884,6 +14089,12 @@ var McpServer = class {
|
|
|
13884
14089
|
this.toolRegistry.registerTool(tool);
|
|
13885
14090
|
logInfo(`Tool registered: ${tool.name}`);
|
|
13886
14091
|
}
|
|
14092
|
+
getParentProcessId() {
|
|
14093
|
+
return this.parentPid;
|
|
14094
|
+
}
|
|
14095
|
+
checkParentProcessAlive() {
|
|
14096
|
+
return this.isParentProcessAlive();
|
|
14097
|
+
}
|
|
13887
14098
|
async start() {
|
|
13888
14099
|
try {
|
|
13889
14100
|
logInfo("Starting MCP server");
|
|
@@ -13902,6 +14113,11 @@ var McpServer = class {
|
|
|
13902
14113
|
async stop() {
|
|
13903
14114
|
logDebug("MCP server shutting down");
|
|
13904
14115
|
await this.trackServerUsage("stop");
|
|
14116
|
+
if (this.parentProcessCheckInterval) {
|
|
14117
|
+
clearInterval(this.parentProcessCheckInterval);
|
|
14118
|
+
this.parentProcessCheckInterval = void 0;
|
|
14119
|
+
logDebug("Parent process check interval cleared");
|
|
14120
|
+
}
|
|
13905
14121
|
this.eventHandlers.forEach((handler, signal) => {
|
|
13906
14122
|
process.removeListener(signal, handler);
|
|
13907
14123
|
});
|
|
@@ -13923,14 +14139,19 @@ async function validatePath(inputPath) {
|
|
|
13923
14139
|
inputPath = inputPath.slice(1);
|
|
13924
14140
|
}
|
|
13925
14141
|
if (inputPath === "." || inputPath === "./") {
|
|
13926
|
-
|
|
14142
|
+
const workspaceFolderPath = WorkspaceService.getWorkspaceFolderPath();
|
|
14143
|
+
if (workspaceFolderPath) {
|
|
13927
14144
|
logDebug("Fallback to workspace folder path", {
|
|
13928
14145
|
inputPath,
|
|
13929
|
-
workspaceFolderPaths:
|
|
14146
|
+
workspaceFolderPaths: [workspaceFolderPath]
|
|
14147
|
+
});
|
|
14148
|
+
WorkspaceService.setKnownWorkspacePath(workspaceFolderPath);
|
|
14149
|
+
logDebug("Stored workspace folder path as known path", {
|
|
14150
|
+
workspaceFolderPath
|
|
13930
14151
|
});
|
|
13931
14152
|
return {
|
|
13932
14153
|
isValid: true,
|
|
13933
|
-
path:
|
|
14154
|
+
path: workspaceFolderPath
|
|
13934
14155
|
};
|
|
13935
14156
|
} else {
|
|
13936
14157
|
const error = `"." is not a valid path, please provide a full localpath to the repository`;
|
|
@@ -13972,6 +14193,8 @@ async function validatePath(inputPath) {
|
|
|
13972
14193
|
try {
|
|
13973
14194
|
await fs11.promises.access(inputPath);
|
|
13974
14195
|
logDebug("Path exists and is accessible", { inputPath });
|
|
14196
|
+
WorkspaceService.setKnownWorkspacePath(inputPath);
|
|
14197
|
+
logDebug("Stored validated path in WorkspaceService", { inputPath });
|
|
13975
14198
|
return { isValid: true, path: inputPath };
|
|
13976
14199
|
} catch (error) {
|
|
13977
14200
|
const errorMessage = `Path does not exist or is not accessible: ${inputPath}`;
|
|
@@ -14084,7 +14307,15 @@ To retrieve the available fixes, use one of these approaches:
|
|
|
14084
14307
|
|
|
14085
14308
|
**\u{1F4CB} Valid offset range:** 0 to ${Math.max(0, totalCount - 1)}
|
|
14086
14309
|
|
|
14087
|
-
|
|
14310
|
+
### \u26A0\uFE0F CRITICAL INSTRUCTION FOR AI AGENTS \u26A0\uFE0F
|
|
14311
|
+
|
|
14312
|
+
**DO NOT AUTOMATICALLY FETCH FIXES WITHOUT EXPLICIT USER REQUEST**
|
|
14313
|
+
|
|
14314
|
+
- **DO NOT** run the \`${currentTool}\` tool again on your own
|
|
14315
|
+
- **ONLY** fetch fixes if the user explicitly asks for them
|
|
14316
|
+
- **WAIT** for the user to specifically request fixes before proceeding
|
|
14317
|
+
|
|
14318
|
+
If the user wants to fetch the fixes, they should explicitly ask you to run the \`${currentTool}\` tool again with the corrected parameters.
|
|
14088
14319
|
`;
|
|
14089
14320
|
var applyFixesPrompt = ({
|
|
14090
14321
|
fixes,
|
|
@@ -14206,12 +14437,23 @@ ${hasMore ? `---
|
|
|
14206
14437
|
|
|
14207
14438
|
You have viewed ${shownCount} out of ${totalCount} available fixes.
|
|
14208
14439
|
|
|
14209
|
-
|
|
14440
|
+
### \u26A0\uFE0F CRITICAL INSTRUCTION FOR AI AGENTS \u26A0\uFE0F
|
|
14441
|
+
|
|
14442
|
+
**DO NOT AUTOMATICALLY FETCH ADDITIONAL FIXES WITHOUT EXPLICIT USER REQUEST**
|
|
14443
|
+
|
|
14444
|
+
- **DO NOT** run the \`${currentTool}\` tool again on your own
|
|
14445
|
+
- **DO NOT** automatically retrieve more fixes
|
|
14446
|
+
- **ONLY** fetch additional fixes if the user explicitly asks for them
|
|
14447
|
+
- **WAIT** for the user to specifically request more fixes before proceeding
|
|
14448
|
+
|
|
14449
|
+
### How Users Can Request Additional Fixes
|
|
14450
|
+
|
|
14451
|
+
If the user wants to see more fixes, they should explicitly ask you to run the \`${currentTool}\` tool again with the following parameters:
|
|
14210
14452
|
|
|
14211
14453
|
- **offset**: ${nextOffset} _(start index for the next batch)_
|
|
14212
14454
|
- **limit**: <number_of_fixes_to_return> _(optional \u2013 default is ${MCP_DEFAULT_LIMIT})_
|
|
14213
14455
|
|
|
14214
|
-
If
|
|
14456
|
+
If they omit both **offset** and **limit**, the command will automatically return the next ${MCP_DEFAULT_LIMIT} fixes.
|
|
14215
14457
|
` : ""}
|
|
14216
14458
|
`;
|
|
14217
14459
|
};
|
|
@@ -14252,7 +14494,7 @@ var expiredReportPrompt = ({
|
|
|
14252
14494
|
Your most recent vulnerability report for this repository **expired on ${lastReportDate}** and is no longer available for fetching automated fixes.
|
|
14253
14495
|
|
|
14254
14496
|
### \u{1F4CB} Why Did This Happen?
|
|
14255
|
-
- Reports are automatically purged after a retention period for security and storage
|
|
14497
|
+
- Reports are automatically purged after a retention period for security and storage optimization.
|
|
14256
14498
|
- No new scans have been run since the last report expired.
|
|
14257
14499
|
|
|
14258
14500
|
### \u{1F3AF} Recommended Actions
|
|
@@ -14333,13 +14575,21 @@ This will scan up to the specified number of recently changed files.
|
|
|
14333
14575
|
|
|
14334
14576
|
### \u{1F504} Running a Fresh Scan
|
|
14335
14577
|
|
|
14336
|
-
|
|
14578
|
+
### \u26A0\uFE0F CRITICAL INSTRUCTION FOR AI AGENTS \u26A0\uFE0F
|
|
14579
|
+
|
|
14580
|
+
**DO NOT AUTOMATICALLY RUN RESCANS WITHOUT EXPLICIT USER REQUEST**
|
|
14581
|
+
|
|
14582
|
+
- **DO NOT** run rescans on your own
|
|
14583
|
+
- **ONLY** perform rescans if the user explicitly asks for them
|
|
14584
|
+
- **WAIT** for the user to specifically request a rescan before proceeding
|
|
14585
|
+
|
|
14586
|
+
If the user wants to perform a **rescan** of their repository (fetching a brand-new vulnerability report and updated fixes), they should explicitly ask you to include the additional parameter:
|
|
14337
14587
|
|
|
14338
14588
|
- **rescan**: true
|
|
14339
14589
|
|
|
14340
14590
|
This will start a new analysis, discard any cached results.
|
|
14341
14591
|
|
|
14342
|
-
\u26A0\uFE0F *Note:* A full rescan may take longer to complete than simply fetching additional fixes because
|
|
14592
|
+
\u26A0\uFE0F *Note:* A full rescan may take longer to complete than simply fetching additional fixes because the repository is re-uploaded and re-analyzed from scratch.
|
|
14343
14593
|
`;
|
|
14344
14594
|
var noFixesFoundPrompt = ({
|
|
14345
14595
|
scannedFiles
|