ferret-scan 1.0.3 → 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/scanner/Scanner.js +10 -7
- package/package.json +1 -1
package/dist/scanner/Scanner.js
CHANGED
|
@@ -172,7 +172,7 @@ function scanFile(file, config) {
|
|
|
172
172
|
* Yield to event loop to allow spinner updates
|
|
173
173
|
*/
|
|
174
174
|
function yieldToEventLoop() {
|
|
175
|
-
return new Promise(resolve =>
|
|
175
|
+
return new Promise(resolve => setTimeout(resolve, 50));
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
178
|
* Main scan function
|
|
@@ -210,14 +210,21 @@ export async function scan(config) {
|
|
|
210
210
|
const totalFiles = discovery.files.length;
|
|
211
211
|
let scannedCount = 0;
|
|
212
212
|
let findingsCount = 0;
|
|
213
|
+
let lastYield = Date.now();
|
|
213
214
|
if (showProgress && totalFiles > 0) {
|
|
214
215
|
spinner = ora(`Scanning files... 0/${totalFiles}`).start();
|
|
215
216
|
}
|
|
216
217
|
for (const file of discovery.files) {
|
|
217
218
|
logger.debug(`Scanning: ${file.relativePath}`);
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
// Update spinner text and yield periodically to let it animate
|
|
220
|
+
if (spinner) {
|
|
220
221
|
spinner.text = `Scanning ${scannedCount + 1}/${totalFiles}: ${file.relativePath.slice(-50)}${findingsCount > 0 ? ` (${findingsCount} findings)` : ''}`;
|
|
222
|
+
// Yield every 100ms to allow spinner animation
|
|
223
|
+
const now = Date.now();
|
|
224
|
+
if (now - lastYield >= 100) {
|
|
225
|
+
await yieldToEventLoop();
|
|
226
|
+
lastYield = Date.now();
|
|
227
|
+
}
|
|
221
228
|
}
|
|
222
229
|
const result = scanFile(file, config);
|
|
223
230
|
if (result.error) {
|
|
@@ -230,10 +237,6 @@ export async function scan(config) {
|
|
|
230
237
|
allFindings.push(...result.findings);
|
|
231
238
|
scannedCount++;
|
|
232
239
|
findingsCount = allFindings.length;
|
|
233
|
-
// Yield to event loop every 100 files to allow spinner to update
|
|
234
|
-
if (showProgress && scannedCount % 100 === 0) {
|
|
235
|
-
await yieldToEventLoop();
|
|
236
|
-
}
|
|
237
240
|
}
|
|
238
241
|
if (spinner) {
|
|
239
242
|
spinner.succeed(`Scanned ${totalFiles} files${findingsCount > 0 ? ` - found ${findingsCount} issues` : ' - no issues found'}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ferret-scan",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Security scanner for AI CLI configurations - detect prompt injections, credential leaks, and malicious patterns in AI agent configs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|