@shakecodeslikecray/whiterose 1.0.4 → 1.0.5
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/cli/index.js +35 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +30 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2116,11 +2116,25 @@ var CoreScanner = class {
|
|
|
2116
2116
|
executor;
|
|
2117
2117
|
config;
|
|
2118
2118
|
progress;
|
|
2119
|
+
passErrors = [];
|
|
2119
2120
|
constructor(executor, config = {}, progress = {}) {
|
|
2120
2121
|
this.executor = executor;
|
|
2121
2122
|
this.config = { ...DEFAULT_SCANNER_CONFIG, ...config };
|
|
2122
2123
|
this.progress = progress;
|
|
2123
2124
|
}
|
|
2125
|
+
/**
|
|
2126
|
+
* Get errors that occurred during the last scan.
|
|
2127
|
+
* Returns an array of pass names and their error messages.
|
|
2128
|
+
*/
|
|
2129
|
+
getPassErrors() {
|
|
2130
|
+
return this.passErrors;
|
|
2131
|
+
}
|
|
2132
|
+
/**
|
|
2133
|
+
* Check if any passes failed during the last scan.
|
|
2134
|
+
*/
|
|
2135
|
+
hasPassErrors() {
|
|
2136
|
+
return this.passErrors.length > 0;
|
|
2137
|
+
}
|
|
2124
2138
|
/**
|
|
2125
2139
|
* Run a thorough 19-pass scan with findings flowing through pipeline:
|
|
2126
2140
|
*
|
|
@@ -2134,6 +2148,7 @@ var CoreScanner = class {
|
|
|
2134
2148
|
async scan(context) {
|
|
2135
2149
|
const cwd = process.cwd();
|
|
2136
2150
|
const startTime = Date.now();
|
|
2151
|
+
this.passErrors = [];
|
|
2137
2152
|
const pipeline = getFullAnalysisPipeline();
|
|
2138
2153
|
const unitPasses = pipeline[0].passes;
|
|
2139
2154
|
const integrationPasses = pipeline[1].passes;
|
|
@@ -2214,8 +2229,10 @@ var CoreScanner = class {
|
|
|
2214
2229
|
this.report(` \u2713 ${pass.name}: ${bugs.length} bugs`);
|
|
2215
2230
|
return bugs;
|
|
2216
2231
|
} catch (error) {
|
|
2217
|
-
|
|
2218
|
-
this.
|
|
2232
|
+
const errorMsg = error.message || String(error);
|
|
2233
|
+
this.progress.onPassError?.(pass.name, errorMsg);
|
|
2234
|
+
this.report(` \u2717 ${pass.name}: ${errorMsg}`);
|
|
2235
|
+
this.passErrors.push({ passName: pass.name, error: errorMsg });
|
|
2219
2236
|
return [];
|
|
2220
2237
|
}
|
|
2221
2238
|
});
|
|
@@ -3089,7 +3106,7 @@ function extractIntentFromDocs(docs) {
|
|
|
3089
3106
|
}
|
|
3090
3107
|
}
|
|
3091
3108
|
if (docs.readme) {
|
|
3092
|
-
const featuresMatch = docs.readme.match(/##\s*Features?\s*\n([\s\S]*?)(?=\n##|\n
|
|
3109
|
+
const featuresMatch = docs.readme.match(/##\s*Features?\s*\n([\s\S]*?)(?=\n##|\n---|$)/i);
|
|
3093
3110
|
if (featuresMatch) {
|
|
3094
3111
|
const featureLines = featuresMatch[1].split("\n").filter((line) => line.trim().startsWith("-") || line.trim().startsWith("*")).map((line) => line.replace(/^[-*]\s*/, "").trim()).filter((line) => line.length > 0);
|
|
3095
3112
|
intent.features.push(...featureLines.slice(0, 20));
|
|
@@ -6484,19 +6501,21 @@ async function runAgenticFix(bug, config, projectDir, onProgress) {
|
|
|
6484
6501
|
for (const block of event.message.content) {
|
|
6485
6502
|
if (block.type === "tool_use") {
|
|
6486
6503
|
const toolName = block.name || "tool";
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6504
|
+
const friendlyNames = {
|
|
6505
|
+
"Read": "Reading file",
|
|
6506
|
+
"Edit": "Editing file",
|
|
6507
|
+
"Write": "Writing file",
|
|
6508
|
+
"Bash": "Running command",
|
|
6509
|
+
"Glob": "Searching files",
|
|
6510
|
+
"Grep": "Searching content",
|
|
6511
|
+
"Task": "Running task"
|
|
6512
|
+
};
|
|
6513
|
+
const displayName = friendlyNames[toolName] || `Using ${toolName}`;
|
|
6514
|
+
onProgress(`${displayName}...`);
|
|
6493
6515
|
}
|
|
6494
6516
|
}
|
|
6495
6517
|
}
|
|
6496
6518
|
} catch {
|
|
6497
|
-
if (trimmed.length > 3 && trimmed.length < 100) {
|
|
6498
|
-
onProgress(trimmed);
|
|
6499
|
-
}
|
|
6500
6519
|
}
|
|
6501
6520
|
}
|
|
6502
6521
|
}
|
|
@@ -6935,10 +6954,12 @@ async function loadBugFromGitHub(issueUrl, cwd) {
|
|
|
6935
6954
|
} else if (labels.some((l) => l.includes("leak") || l.includes("memory"))) {
|
|
6936
6955
|
category = "resource-leak";
|
|
6937
6956
|
}
|
|
6957
|
+
const sanitizedTitle = sanitizeSarifText(String(issue.title || ""), "github.title");
|
|
6958
|
+
const sanitizedBody = sanitizeSarifText(String(issue.body || ""), "github.body");
|
|
6938
6959
|
return {
|
|
6939
6960
|
id: `GH-${issueNumber}`,
|
|
6940
|
-
title:
|
|
6941
|
-
description:
|
|
6961
|
+
title: sanitizedTitle,
|
|
6962
|
+
description: sanitizedBody || sanitizedTitle,
|
|
6942
6963
|
file: fileMatch?.[1] || "",
|
|
6943
6964
|
line: parseInt(lineMatch?.[1] || "1", 10),
|
|
6944
6965
|
kind: "bug",
|