stigmergy 1.2.0 โ 1.2.8
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/LICENSE +18 -18
- package/README.md +31 -211
- package/STIGMERGY.md +70 -61
- package/docs/MULTI_USER_WIKI_COLLABORATION_SYSTEM.md +523 -0
- package/docs/PROJECT_CONSTITUTION.md +433 -433
- package/docs/PROJECT_STRUCTURE_CURRENT.md +80 -80
- package/docs/PROMPT_BASED_SKILLS_SYSTEM_DESIGN.md +458 -0
- package/docs/SKILL_IMPLEMENTATION_CONSTRAINTS_AND_ALIGNMENT.md +423 -0
- package/docs/TECHNICAL_FEASIBILITY_ANALYSIS.md +308 -0
- package/examples/calculator-example.js +72 -72
- package/examples/cline_usage_examples.md +364 -364
- package/examples/encryption-example.js +67 -67
- package/examples/json-parser-example.js +120 -120
- package/examples/json-validation-example.js +64 -64
- package/examples/multilingual-hook-demo.js +125 -0
- package/examples/rest-client-example.js +52 -52
- package/examples/rest_client_example.js +54 -54
- package/package.json +38 -20
- package/scripts/build.js +74 -74
- package/scripts/dependency-analyzer.js +101 -0
- package/scripts/generate-cli-docs.js +64 -0
- package/scripts/post-deployment-config.js +296 -296
- package/scripts/postuninstall.js +46 -0
- package/scripts/preinstall-check.js +173 -173
- package/scripts/preuninstall.js +75 -0
- package/scripts/publish.js +58 -268
- package/scripts/run-layered-tests.js +247 -0
- package/scripts/safe-install.js +139 -139
- package/scripts/simple-publish.js +57 -59
- package/src/adapters/claude/install_claude_integration.js +292 -0
- package/src/adapters/codebuddy/install_codebuddy_integration.js +349 -0
- package/src/adapters/codex/install_codex_integration.js +395 -0
- package/src/adapters/copilot/install_copilot_integration.js +716 -0
- package/src/adapters/gemini/install_gemini_integration.js +304 -0
- package/src/adapters/iflow/install_iflow_integration.js +304 -0
- package/src/adapters/qoder/install_qoder_integration.js +1090 -0
- package/src/adapters/qwen/install_qwen_integration.js +285 -0
- package/src/cli/router.js +562 -39
- package/src/core/cache_cleaner.js +82 -59
- package/src/core/cli_help_analyzer.js +297 -291
- package/src/core/cli_parameter_handler.js +5 -0
- package/src/core/cli_tools.js +6 -6
- package/src/core/coordination/index.js +2 -2
- package/src/core/coordination/nodejs/AdapterManager.js +30 -17
- package/src/core/coordination/nodejs/CLCommunication.js +28 -20
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +72 -36
- package/src/core/coordination/nodejs/HealthChecker.js +13 -14
- package/src/core/coordination/nodejs/HookDeploymentManager.js +325 -63
- package/src/core/coordination/nodejs/StatisticsCollector.js +6 -6
- package/src/core/coordination/nodejs/index.js +29 -11
- package/src/core/coordination/nodejs/utils/Logger.js +1 -1
- package/src/core/enhanced_installer.js +92 -69
- package/src/core/enhanced_uninstaller.js +73 -53
- package/src/core/installer.js +815 -294
- package/src/core/multilingual/language-pattern-manager.js +172 -0
- package/src/core/smart_router.js +141 -26
- package/src/core/upgrade_manager.js +91 -46
- package/src/data_structures.js +1 -1
- package/src/deploy.js +2 -2
- package/src/index.js +3 -3
- package/src/test/cli-availability-checker.js +194 -0
- package/src/test/test-environment.js +289 -0
- package/src/utils/helpers.js +2 -2
- package/src/utils.js +7 -1
- package/test/multilingual/hook-deployment.test.js +91 -0
- package/test/multilingual/language-pattern-manager.test.js +140 -0
- package/test/multilingual/system-test.js +85 -0
- package/test/cache-cleaner-implemented.test.js +0 -328
- package/test/cache-cleaner.test.js +0 -390
- package/test/calculator.test.js +0 -215
- package/test/collision-test.js +0 -26
- package/test/comprehensive-enhanced-features.test.js +0 -252
- package/test/comprehensive-execution-test.js +0 -428
- package/test/conflict-prevention-test.js +0 -95
- package/test/cross-cli-detection-test.js +0 -33
- package/test/csv-processing-test.js +0 -36
- package/test/deploy-hooks-test.js +0 -250
- package/test/e2e/claude-cli-test.js +0 -128
- package/test/e2e/collaboration-test.js +0 -75
- package/test/e2e/comprehensive-test.js +0 -431
- package/test/e2e/error-handling-test.js +0 -90
- package/test/e2e/individual-tool-test.js +0 -143
- package/test/e2e/other-cli-test.js +0 -130
- package/test/e2e/qoder-cli-test.js +0 -128
- package/test/e2e/run-e2e-tests.js +0 -73
- package/test/e2e/test-data.js +0 -88
- package/test/e2e/test-utils.js +0 -222
- package/test/encryption-simple-test.js +0 -110
- package/test/encryption.test.js +0 -129
- package/test/enhanced-main-alignment.test.js +0 -298
- package/test/enhanced-uninstaller-implemented.test.js +0 -271
- package/test/enhanced-uninstaller.test.js +0 -284
- package/test/error-handling-test.js +0 -341
- package/test/fibonacci.test.js +0 -178
- package/test/final-deploy-test.js +0 -221
- package/test/final-install-test.js +0 -226
- package/test/hash-table-demo.js +0 -33
- package/test/hash-table-test.js +0 -26
- package/test/hash_table_test.js +0 -114
- package/test/hook-system-integration-test.js +0 -307
- package/test/iflow-integration-test.js +0 -292
- package/test/improved-install-test.js +0 -362
- package/test/install-command-test.js +0 -370
- package/test/json-parser-test.js +0 -161
- package/test/json-validation-test.js +0 -164
- package/test/natural-language-skills-test.js +0 -320
- package/test/nl-integration-test.js +0 -179
- package/test/parameter-parsing-test.js +0 -143
- package/test/plugin-deployment-test.js +0 -316
- package/test/postinstall-test.js +0 -269
- package/test/python-plugins-test.js +0 -259
- package/test/real-test.js +0 -435
- package/test/remaining-adapters-test.js +0 -256
- package/test/rest-client-test.js +0 -56
- package/test/rest_client.test.js +0 -85
- package/test/safe-installation-cleaner.test.js +0 -343
- package/test/simple-iflow-hook-test.js +0 -137
- package/test/stigmergy-upgrade-test.js +0 -243
- package/test/system-compatibility-test.js +0 -467
- package/test/tdd-deploy-fix-test.js +0 -324
- package/test/tdd-fixes-test.js +0 -211
- package/test/third-party-skills-test.js +0 -321
- package/test/tool-selection-integration-test.js +0 -158
- package/test/unit/calculator-full.test.js +0 -191
- package/test/unit/calculator-simple.test.js +0 -96
- package/test/unit/calculator.test.js +0 -97
- package/test/unit/cli-scanner.test.js +0 -291
- package/test/unit/cli_parameter_handler.test.js +0 -116
- package/test/unit/cross-cli-executor.test.js +0 -399
- package/test/weather-processor.test.js +0 -104
|
@@ -19,7 +19,7 @@ class CacheCleaner {
|
|
|
19
19
|
preserveRecent: options.preserveRecent || 24 * 60 * 60 * 1000, // 24 hours
|
|
20
20
|
batchSize: options.batchSize || 50,
|
|
21
21
|
parallel: options.parallel || true,
|
|
22
|
-
...options
|
|
22
|
+
...options,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
this.homeDir = os.homedir();
|
|
@@ -28,7 +28,7 @@ class CacheCleaner {
|
|
|
28
28
|
directoriesRemoved: 0,
|
|
29
29
|
bytesFreed: 0,
|
|
30
30
|
errors: [],
|
|
31
|
-
skipped: []
|
|
31
|
+
skipped: [],
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -42,7 +42,7 @@ class CacheCleaner {
|
|
|
42
42
|
cleanNPM: true,
|
|
43
43
|
cleanCLI: true,
|
|
44
44
|
cleanTemp: true,
|
|
45
|
-
...options
|
|
45
|
+
...options,
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
console.log('๐งน Starting Comprehensive Cache Cleaning...\n');
|
|
@@ -81,9 +81,8 @@ class CacheCleaner {
|
|
|
81
81
|
this.printSummary();
|
|
82
82
|
|
|
83
83
|
return this.results;
|
|
84
|
-
|
|
85
84
|
} catch (error) {
|
|
86
|
-
console.error('
|
|
85
|
+
console.error('๏ฟฝ?Cache cleaning failed:', error.message);
|
|
87
86
|
this.results.errors.push(error.message);
|
|
88
87
|
return this.results;
|
|
89
88
|
}
|
|
@@ -113,7 +112,7 @@ class CacheCleaner {
|
|
|
113
112
|
path.join(stigmergyDir, 'cache'),
|
|
114
113
|
path.join(stigmergyDir, 'logs'),
|
|
115
114
|
path.join(stigmergyDir, 'temp'),
|
|
116
|
-
path.join(stigmergyDir, '.tmp')
|
|
115
|
+
path.join(stigmergyDir, '.tmp'),
|
|
117
116
|
];
|
|
118
117
|
|
|
119
118
|
for (const cachePath of cachePaths) {
|
|
@@ -122,7 +121,7 @@ class CacheCleaner {
|
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
|
|
125
|
-
console.log('
|
|
124
|
+
console.log('๏ฟฝ?Stigmergy cache cleaning completed');
|
|
126
125
|
}
|
|
127
126
|
|
|
128
127
|
/**
|
|
@@ -147,7 +146,7 @@ class CacheCleaner {
|
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
const removed = await this.batchRemoveFiles(recentFiles);
|
|
150
|
-
console.log(`
|
|
149
|
+
console.log(` ๏ฟฝ?Removed ${removed} files from ${type} directory`);
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
/**
|
|
@@ -185,7 +184,7 @@ class CacheCleaner {
|
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
186
|
|
|
188
|
-
console.log(`
|
|
187
|
+
console.log(` ๏ฟฝ?Removed ${removed} NPX cache entries`);
|
|
189
188
|
if (failed.length > 0) {
|
|
190
189
|
console.log(` โ ๏ธ Failed to remove ${failed.length} entries`);
|
|
191
190
|
}
|
|
@@ -207,18 +206,17 @@ class CacheCleaner {
|
|
|
207
206
|
const result = spawnSync('npm', ['cache', 'clean', '--force'], {
|
|
208
207
|
encoding: 'utf8',
|
|
209
208
|
shell: true,
|
|
210
|
-
stdio: this.options.verbose ? 'inherit' : 'pipe'
|
|
209
|
+
stdio: this.options.verbose ? 'inherit' : 'pipe',
|
|
211
210
|
});
|
|
212
211
|
|
|
213
212
|
if (result.status === 0) {
|
|
214
|
-
console.log('
|
|
213
|
+
console.log(' ๏ฟฝ?NPM cache cleaned successfully');
|
|
215
214
|
} else {
|
|
216
215
|
console.log(' โ ๏ธ NPM cache clean failed, trying manual cleanup');
|
|
217
216
|
await this.manualNPMCacheClean();
|
|
218
217
|
}
|
|
219
|
-
|
|
220
218
|
} catch (error) {
|
|
221
|
-
console.error(`
|
|
219
|
+
console.error(` ๏ฟฝ?Failed to clean NPM cache: ${error.message}`);
|
|
222
220
|
this.results.errors.push(`NPM cache: ${error.message}`);
|
|
223
221
|
}
|
|
224
222
|
}
|
|
@@ -229,7 +227,7 @@ class CacheCleaner {
|
|
|
229
227
|
async manualNPMCacheClean() {
|
|
230
228
|
const npmCacheDirs = [
|
|
231
229
|
path.join(this.homeDir, '.npm', '_cacache'),
|
|
232
|
-
path.join(this.homeDir, 'AppData', 'Local', 'npm-cache', '_cacache')
|
|
230
|
+
path.join(this.homeDir, 'AppData', 'Local', 'npm-cache', '_cacache'),
|
|
233
231
|
];
|
|
234
232
|
|
|
235
233
|
for (const cacheDir of npmCacheDirs) {
|
|
@@ -247,8 +245,15 @@ class CacheCleaner {
|
|
|
247
245
|
console.log('โ๏ธ Cleaning CLI configurations...');
|
|
248
246
|
|
|
249
247
|
const supportedCLIs = [
|
|
250
|
-
'claude',
|
|
251
|
-
'
|
|
248
|
+
'claude',
|
|
249
|
+
'gemini',
|
|
250
|
+
'qwen',
|
|
251
|
+
'iflow',
|
|
252
|
+
'qodercli',
|
|
253
|
+
'codebuddy',
|
|
254
|
+
'codex',
|
|
255
|
+
'copilot',
|
|
256
|
+
'qwencode',
|
|
252
257
|
];
|
|
253
258
|
|
|
254
259
|
let totalCleaned = 0;
|
|
@@ -277,12 +282,12 @@ class CacheCleaner {
|
|
|
277
282
|
totalCleaned += removed;
|
|
278
283
|
|
|
279
284
|
if (removed > 0) {
|
|
280
|
-
console.log(`
|
|
285
|
+
console.log(` ๏ฟฝ?Cleaned ${removed} files from ${cli}`);
|
|
281
286
|
}
|
|
282
287
|
}
|
|
283
288
|
|
|
284
289
|
if (totalCleaned > 0) {
|
|
285
|
-
console.log(`
|
|
290
|
+
console.log(` ๏ฟฝ?Cleaned ${totalCleaned} CLI configuration files`);
|
|
286
291
|
}
|
|
287
292
|
}
|
|
288
293
|
|
|
@@ -290,12 +295,12 @@ class CacheCleaner {
|
|
|
290
295
|
* Clean temporary files
|
|
291
296
|
*/
|
|
292
297
|
async cleanTemporaryFiles() {
|
|
293
|
-
console.log('
|
|
298
|
+
console.log('๐๏ฟฝ? Cleaning temporary files...');
|
|
294
299
|
|
|
295
300
|
const tempDirs = [
|
|
296
301
|
os.tmpdir(),
|
|
297
302
|
path.join(this.homeDir, 'AppData', 'Local', 'Temp'),
|
|
298
|
-
path.join(this.homeDir, 'AppData', 'Local', 'npm-cache', '_tmp')
|
|
303
|
+
path.join(this.homeDir, 'AppData', 'Local', 'npm-cache', '_tmp'),
|
|
299
304
|
];
|
|
300
305
|
|
|
301
306
|
let totalRemoved = 0;
|
|
@@ -311,7 +316,9 @@ class CacheCleaner {
|
|
|
311
316
|
continue;
|
|
312
317
|
}
|
|
313
318
|
|
|
314
|
-
console.log(
|
|
319
|
+
console.log(
|
|
320
|
+
` ๐ ${path.basename(tempDir)}: ${tempFiles.length} temporary files`,
|
|
321
|
+
);
|
|
315
322
|
|
|
316
323
|
if (this.options.dryRun) {
|
|
317
324
|
this.logFiles(tempFiles.slice(0, 5), ' ๐ ');
|
|
@@ -325,12 +332,14 @@ class CacheCleaner {
|
|
|
325
332
|
totalRemoved += removed;
|
|
326
333
|
|
|
327
334
|
if (removed > 0) {
|
|
328
|
-
console.log(
|
|
335
|
+
console.log(
|
|
336
|
+
` ๏ฟฝ?Removed ${removed} files from ${path.basename(tempDir)}`,
|
|
337
|
+
);
|
|
329
338
|
}
|
|
330
339
|
}
|
|
331
340
|
|
|
332
341
|
if (totalRemoved > 0) {
|
|
333
|
-
console.log(`
|
|
342
|
+
console.log(` ๏ฟฝ?Removed ${totalRemoved} temporary files`);
|
|
334
343
|
}
|
|
335
344
|
}
|
|
336
345
|
|
|
@@ -341,7 +350,7 @@ class CacheCleaner {
|
|
|
341
350
|
const {
|
|
342
351
|
preservePatterns = [],
|
|
343
352
|
removePatterns = [],
|
|
344
|
-
preserveRecent = this.options.preserveRecent
|
|
353
|
+
preserveRecent = this.options.preserveRecent,
|
|
345
354
|
} = options;
|
|
346
355
|
|
|
347
356
|
console.log(`๐ฏ Selective cleaning: ${targetDirectory}`);
|
|
@@ -356,13 +365,13 @@ class CacheCleaner {
|
|
|
356
365
|
|
|
357
366
|
for (const file of allFiles) {
|
|
358
367
|
// Check preserve patterns
|
|
359
|
-
const shouldPreserve =
|
|
360
|
-
this.matchPattern(file, pattern)
|
|
361
|
-
|
|
368
|
+
const shouldPreserve =
|
|
369
|
+
preservePatterns.some((pattern) => this.matchPattern(file, pattern)) ||
|
|
370
|
+
this.isRecentFile(file, preserveRecent);
|
|
362
371
|
|
|
363
372
|
// Check remove patterns
|
|
364
|
-
const shouldRemove = removePatterns.some(pattern =>
|
|
365
|
-
this.matchPattern(file, pattern)
|
|
373
|
+
const shouldRemove = removePatterns.some((pattern) =>
|
|
374
|
+
this.matchPattern(file, pattern),
|
|
366
375
|
);
|
|
367
376
|
|
|
368
377
|
if (shouldRemove && !shouldPreserve) {
|
|
@@ -378,7 +387,7 @@ class CacheCleaner {
|
|
|
378
387
|
}
|
|
379
388
|
|
|
380
389
|
const removed = await this.batchRemoveFiles(filesToRemove);
|
|
381
|
-
console.log(`
|
|
390
|
+
console.log(` ๏ฟฝ?Selectively removed ${removed} files`);
|
|
382
391
|
}
|
|
383
392
|
|
|
384
393
|
/**
|
|
@@ -388,18 +397,22 @@ class CacheCleaner {
|
|
|
388
397
|
const {
|
|
389
398
|
batchSize = this.options.batchSize,
|
|
390
399
|
parallel = this.options.parallel,
|
|
391
|
-
maxConcurrency = 4
|
|
400
|
+
maxConcurrency = 4,
|
|
392
401
|
} = options;
|
|
393
402
|
|
|
394
|
-
console.log(
|
|
403
|
+
console.log(`๏ฟฝ?Performance cleaning: ${targetDirectory}`);
|
|
395
404
|
|
|
396
405
|
const files = await this.scanDirectory(targetDirectory);
|
|
397
406
|
const recentFiles = this.filterRecentFiles(files);
|
|
398
407
|
|
|
399
|
-
console.log(
|
|
408
|
+
console.log(
|
|
409
|
+
` ๐ Processing ${recentFiles.length} files in batches of ${batchSize}`,
|
|
410
|
+
);
|
|
400
411
|
|
|
401
412
|
if (this.options.dryRun) {
|
|
402
|
-
console.log(
|
|
413
|
+
console.log(
|
|
414
|
+
` ๐ Would process in ${Math.ceil(recentFiles.length / batchSize)} batches`,
|
|
415
|
+
);
|
|
403
416
|
return;
|
|
404
417
|
}
|
|
405
418
|
|
|
@@ -415,7 +428,7 @@ class CacheCleaner {
|
|
|
415
428
|
}
|
|
416
429
|
}
|
|
417
430
|
|
|
418
|
-
console.log(`
|
|
431
|
+
console.log(` ๏ฟฝ?Performance cleaned ${removed} files`);
|
|
419
432
|
return removed;
|
|
420
433
|
}
|
|
421
434
|
|
|
@@ -533,7 +546,9 @@ class CacheCleaner {
|
|
|
533
546
|
}
|
|
534
547
|
|
|
535
548
|
filterRecentFiles(files) {
|
|
536
|
-
return files.filter(
|
|
549
|
+
return files.filter(
|
|
550
|
+
(file) => !this.isRecentFile(file, this.options.preserveRecent),
|
|
551
|
+
);
|
|
537
552
|
}
|
|
538
553
|
|
|
539
554
|
isRecentFile(filePath, maxAge) {
|
|
@@ -556,7 +571,7 @@ class CacheCleaner {
|
|
|
556
571
|
const fullPath = path.join(dirPath, file.name);
|
|
557
572
|
|
|
558
573
|
if (file.isDirectory()) {
|
|
559
|
-
stigmergyFiles.push(...await this.findStigmergyFiles(fullPath));
|
|
574
|
+
stigmergyFiles.push(...(await this.findStigmergyFiles(fullPath)));
|
|
560
575
|
} else if (this.isStigmergyFile(file.name)) {
|
|
561
576
|
stigmergyFiles.push(fullPath);
|
|
562
577
|
}
|
|
@@ -576,12 +591,12 @@ class CacheCleaner {
|
|
|
576
591
|
'integration',
|
|
577
592
|
'cache',
|
|
578
593
|
'.tmp',
|
|
579
|
-
'temp'
|
|
594
|
+
'temp',
|
|
580
595
|
];
|
|
581
596
|
|
|
582
597
|
const lowerFileName = fileName.toLowerCase();
|
|
583
|
-
return stigmergyPatterns.some(pattern =>
|
|
584
|
-
lowerFileName.includes(pattern.toLowerCase())
|
|
598
|
+
return stigmergyPatterns.some((pattern) =>
|
|
599
|
+
lowerFileName.includes(pattern.toLowerCase()),
|
|
585
600
|
);
|
|
586
601
|
}
|
|
587
602
|
|
|
@@ -590,7 +605,7 @@ class CacheCleaner {
|
|
|
590
605
|
const possibleNPXBases = [
|
|
591
606
|
path.join(this.homeDir, 'AppData', 'Local', 'npm-cache', '_npx'),
|
|
592
607
|
path.join(this.homeDir, '.npm', '_npx'),
|
|
593
|
-
path.join(os.tmpdir(), 'npm-cache', '_npx')
|
|
608
|
+
path.join(os.tmpdir(), 'npm-cache', '_npx'),
|
|
594
609
|
];
|
|
595
610
|
|
|
596
611
|
for (const npxCacheBase of possibleNPXBases) {
|
|
@@ -603,7 +618,11 @@ class CacheCleaner {
|
|
|
603
618
|
|
|
604
619
|
for (const entry of entries) {
|
|
605
620
|
const entryPath = path.join(npxCacheBase, entry);
|
|
606
|
-
const stigmergyPath = path.join(
|
|
621
|
+
const stigmergyPath = path.join(
|
|
622
|
+
entryPath,
|
|
623
|
+
'node_modules',
|
|
624
|
+
'stigmergy',
|
|
625
|
+
);
|
|
607
626
|
|
|
608
627
|
if (fs.existsSync(stigmergyPath)) {
|
|
609
628
|
cacheDirs.push(entryPath);
|
|
@@ -624,9 +643,11 @@ class CacheCleaner {
|
|
|
624
643
|
const files = fs.readdirSync(tempDir, { withFileTypes: true });
|
|
625
644
|
|
|
626
645
|
for (const file of files) {
|
|
627
|
-
if (
|
|
628
|
-
|
|
629
|
-
|
|
646
|
+
if (
|
|
647
|
+
this.isStigmergyFile(file.name) ||
|
|
648
|
+
file.name.startsWith('stigmergy-') ||
|
|
649
|
+
file.name.includes('stigmergy')
|
|
650
|
+
) {
|
|
630
651
|
const fullPath = path.join(tempDir, file.name);
|
|
631
652
|
tempFiles.push(fullPath);
|
|
632
653
|
}
|
|
@@ -647,9 +668,11 @@ class CacheCleaner {
|
|
|
647
668
|
const files = await this.scanDirectory(dirPath);
|
|
648
669
|
const removed = await this.batchRemoveFiles(files);
|
|
649
670
|
|
|
650
|
-
console.log(
|
|
671
|
+
console.log(
|
|
672
|
+
` ๐งน Cleaned ${removed} files from ${path.basename(dirPath)}`,
|
|
673
|
+
);
|
|
651
674
|
} catch (error) {
|
|
652
|
-
console.error(`
|
|
675
|
+
console.error(` ๏ฟฝ?Failed to clean ${dirPath}: ${error.message}`);
|
|
653
676
|
this.results.errors.push(`Clean error ${dirPath}: ${error.message}`);
|
|
654
677
|
}
|
|
655
678
|
}
|
|
@@ -658,9 +681,7 @@ class CacheCleaner {
|
|
|
658
681
|
const fileName = path.basename(filePath);
|
|
659
682
|
|
|
660
683
|
// Simple glob pattern matching
|
|
661
|
-
const regexPattern = pattern
|
|
662
|
-
.replace(/\*/g, '.*')
|
|
663
|
-
.replace(/\?/g, '.');
|
|
684
|
+
const regexPattern = pattern.replace(/\*/g, '.*').replace(/\?/g, '.');
|
|
664
685
|
|
|
665
686
|
const regex = new RegExp(regexPattern, 'i');
|
|
666
687
|
return regex.test(fileName);
|
|
@@ -696,11 +717,11 @@ class CacheCleaner {
|
|
|
696
717
|
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
697
718
|
if (bytes === 0) return '0 Bytes';
|
|
698
719
|
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
699
|
-
return Math.round(bytes / Math.pow(1024, i) * 100) / 100 + ' ' + sizes[i];
|
|
720
|
+
return Math.round((bytes / Math.pow(1024, i)) * 100) / 100 + ' ' + sizes[i];
|
|
700
721
|
}
|
|
701
722
|
|
|
702
723
|
logFiles(files, prefix = '') {
|
|
703
|
-
files.slice(0, 10).forEach(file => {
|
|
724
|
+
files.slice(0, 10).forEach((file) => {
|
|
704
725
|
console.log(`${prefix}${path.basename(file)}`);
|
|
705
726
|
});
|
|
706
727
|
|
|
@@ -711,34 +732,36 @@ class CacheCleaner {
|
|
|
711
732
|
|
|
712
733
|
printSummary() {
|
|
713
734
|
console.log('\n๐ CACHE CLEANING SUMMARY:');
|
|
714
|
-
console.log('='
|
|
735
|
+
console.log('='.repeat(50));
|
|
715
736
|
|
|
716
737
|
if (this.options.dryRun) {
|
|
717
738
|
console.log('๐ DRY RUN MODE - No files were actually deleted');
|
|
718
739
|
} else {
|
|
719
740
|
console.log(`๐ Directories removed: ${this.results.directoriesRemoved}`);
|
|
720
741
|
console.log(`๐ Files removed: ${this.results.filesRemoved}`);
|
|
721
|
-
console.log(
|
|
742
|
+
console.log(
|
|
743
|
+
`๐พ Space freed: ${this.formatBytes(this.results.bytesFreed)}`,
|
|
744
|
+
);
|
|
722
745
|
}
|
|
723
746
|
|
|
724
747
|
if (this.results.skipped.length > 0) {
|
|
725
748
|
console.log(`โญ๏ธ Items skipped: ${this.results.skipped.length}`);
|
|
726
749
|
if (this.options.verbose) {
|
|
727
|
-
this.results.skipped.forEach(item => {
|
|
750
|
+
this.results.skipped.forEach((item) => {
|
|
728
751
|
console.log(` ${item}`);
|
|
729
752
|
});
|
|
730
753
|
}
|
|
731
754
|
}
|
|
732
755
|
|
|
733
756
|
if (this.results.errors.length > 0) {
|
|
734
|
-
console.log(
|
|
735
|
-
this.results.errors.forEach(error => {
|
|
757
|
+
console.log(`๏ฟฝ?Errors: ${this.results.errors.length}`);
|
|
758
|
+
this.results.errors.forEach((error) => {
|
|
736
759
|
console.log(` ${error}`);
|
|
737
760
|
});
|
|
738
761
|
}
|
|
739
762
|
|
|
740
|
-
console.log('\n
|
|
763
|
+
console.log('\n๏ฟฝ?Cache cleaning completed!');
|
|
741
764
|
}
|
|
742
765
|
}
|
|
743
766
|
|
|
744
|
-
module.exports = CacheCleaner;
|
|
767
|
+
module.exports = CacheCleaner;
|