stigmergy 1.2.6 → 1.2.10
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/README.md +69 -20
- package/STIGMERGY.md +26 -7
- package/docs/MULTI_USER_WIKI_COLLABORATION_SYSTEM.md +523 -0
- 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/multilingual-hook-demo.js +125 -0
- package/package.json +30 -19
- package/scripts/dependency-analyzer.js +101 -0
- package/scripts/generate-cli-docs.js +64 -0
- package/scripts/postuninstall.js +46 -0
- package/scripts/preuninstall.js +85 -0
- package/scripts/run-layered-tests.js +3 -3
- package/src/adapters/claude/install_claude_integration.js +37 -37
- package/src/adapters/codebuddy/install_codebuddy_integration.js +66 -63
- package/src/adapters/codex/install_codex_integration.js +54 -55
- package/src/adapters/copilot/install_copilot_integration.js +46 -46
- package/src/adapters/gemini/install_gemini_integration.js +68 -68
- package/src/adapters/iflow/install_iflow_integration.js +77 -77
- package/src/adapters/qoder/install_qoder_integration.js +76 -76
- package/src/adapters/qwen/install_qwen_integration.js +23 -23
- package/src/cli/router.js +713 -163
- package/src/commands/skill-bridge.js +39 -0
- package/src/commands/skill-handler.js +150 -0
- package/src/commands/skill.js +127 -0
- package/src/core/cache_cleaner.js +767 -767
- package/src/core/cli_help_analyzer.js +680 -680
- package/src/core/cli_parameter_handler.js +132 -132
- package/src/core/cli_path_detector.js +573 -0
- package/src/core/cli_tools.js +160 -89
- package/src/core/coordination/index.js +16 -16
- package/src/core/coordination/nodejs/AdapterManager.js +130 -102
- package/src/core/coordination/nodejs/CLCommunication.js +132 -132
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +272 -272
- package/src/core/coordination/nodejs/HealthChecker.js +76 -76
- package/src/core/coordination/nodejs/HookDeploymentManager.js +463 -274
- package/src/core/coordination/nodejs/StatisticsCollector.js +71 -71
- package/src/core/coordination/nodejs/index.js +90 -90
- package/src/core/coordination/nodejs/utils/Logger.js +29 -29
- package/src/core/directory_permission_manager.js +568 -0
- package/src/core/enhanced_cli_installer.js +609 -0
- package/src/core/error_handler.js +406 -406
- package/src/core/installer.js +263 -119
- package/src/core/memory_manager.js +83 -83
- package/src/core/multilingual/language-pattern-manager.js +200 -0
- package/src/core/persistent_shell_configurator.js +468 -0
- package/src/core/rest_client.js +160 -160
- package/src/core/skills/StigmergySkillManager.js +357 -0
- package/src/core/skills/__tests__/SkillInstaller.test.js +275 -0
- package/src/core/skills/__tests__/SkillParser.test.js +202 -0
- package/src/core/skills/__tests__/SkillReader.test.js +189 -0
- package/src/core/skills/cli-command-test.js +201 -0
- package/src/core/skills/comprehensive-e2e-test.js +473 -0
- package/src/core/skills/e2e-test.js +267 -0
- package/src/core/skills/embedded-openskills/SkillInstaller.js +438 -0
- package/src/core/skills/embedded-openskills/SkillParser.js +123 -0
- package/src/core/skills/embedded-openskills/SkillReader.js +143 -0
- package/src/core/skills/integration-test.js +248 -0
- package/src/core/skills/package.json +6 -0
- package/src/core/skills/regression-test.js +285 -0
- package/src/core/skills/run-all-tests.js +129 -0
- package/src/core/skills/sync-test.js +210 -0
- package/src/core/skills/test-runner.js +242 -0
- package/src/core/smart_router.js +261 -249
- package/src/core/upgrade_manager.js +48 -20
- package/src/index.js +30 -30
- package/src/test/cli-availability-checker.js +194 -194
- package/src/test/test-environment.js +289 -289
- package/src/utils/helpers.js +18 -35
- package/src/utils.js +921 -921
- package/src/weatherProcessor.js +228 -228
- 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/src/auth.js +0 -173
- package/src/auth_command.js +0 -208
- package/src/calculator.js +0 -313
- package/src/core/enhanced_installer.js +0 -479
- package/src/core/enhanced_uninstaller.js +0 -638
- package/src/data_encryption.js +0 -143
- package/src/data_structures.js +0 -440
- package/src/deploy.js +0 -55
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enhanced Stigmergy Installer
|
|
3
|
-
*
|
|
4
|
-
* Automatic cache cleaning before installation with comprehensive error handling
|
|
5
|
-
* and progress reporting.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
const os = require('os');
|
|
11
|
-
const CacheCleaner = require('./cache_cleaner');
|
|
12
|
-
const StigmergyInstaller = require('./installer');
|
|
13
|
-
|
|
14
|
-
class EnhancedInstaller {
|
|
15
|
-
constructor(options = {}) {
|
|
16
|
-
this.options = {
|
|
17
|
-
cleanBeforeInstall: options.cleanBeforeInstall !== false, // Default true
|
|
18
|
-
cleanNPXCache: options.cleanNPXCache !== false,
|
|
19
|
-
cleanTempFiles: options.cleanTempFiles !== false,
|
|
20
|
-
cleanOldVersions: options.cleanOldVersions !== false,
|
|
21
|
-
dryRun: options.dryRun || false,
|
|
22
|
-
force: options.force || false,
|
|
23
|
-
verbose: options.verbose || false,
|
|
24
|
-
...options,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
this.baseInstaller = new StigmergyInstaller();
|
|
28
|
-
this.cacheCleaner = new CacheCleaner({
|
|
29
|
-
dryRun: this.options.dryRun,
|
|
30
|
-
force: this.options.force,
|
|
31
|
-
verbose: this.options.verbose,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
this.results = {
|
|
35
|
-
cacheCleaning: {},
|
|
36
|
-
installation: {},
|
|
37
|
-
errors: [],
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Perform enhanced installation with automatic cache cleaning
|
|
43
|
-
*/
|
|
44
|
-
async enhancedInstall(options = {}) {
|
|
45
|
-
const config = {
|
|
46
|
-
cleanStigmergy: true,
|
|
47
|
-
cleanNPX: this.options.cleanNPXCache,
|
|
48
|
-
cleanNPM: this.options.cleanOldVersions,
|
|
49
|
-
cleanCLI: false,
|
|
50
|
-
cleanTemp: this.options.cleanTempFiles,
|
|
51
|
-
...options,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
console.log('🚀 Starting Enhanced Stigmergy Installation...\n');
|
|
55
|
-
|
|
56
|
-
if (this.options.dryRun) {
|
|
57
|
-
console.log('🔍 DRY RUN MODE - No actual changes will be made\n');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
// Step 1: Pre-installation cache cleaning
|
|
62
|
-
if (this.options.cleanBeforeInstall) {
|
|
63
|
-
await this.preInstallCacheClean(config);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Step 2: Scan and prepare for installation
|
|
67
|
-
await this.scanAndPrepare();
|
|
68
|
-
|
|
69
|
-
// Step 3: Perform installation
|
|
70
|
-
if (!this.options.dryRun) {
|
|
71
|
-
await this.performInstallation();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Step 4: Post-installation verification
|
|
75
|
-
await this.verifyInstallation();
|
|
76
|
-
|
|
77
|
-
// Step 5: Print summary
|
|
78
|
-
this.printSummary();
|
|
79
|
-
|
|
80
|
-
return this.results;
|
|
81
|
-
} catch (error) {
|
|
82
|
-
console.error('�?Enhanced installation failed:', error.message);
|
|
83
|
-
this.results.errors.push(error.message);
|
|
84
|
-
return this.results;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Pre-installation cache cleaning
|
|
90
|
-
*/
|
|
91
|
-
async preInstallCacheClean(config) {
|
|
92
|
-
console.log('🧹 Pre-installation Cache Cleaning...\n');
|
|
93
|
-
|
|
94
|
-
const startTime = Date.now();
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
// Clean caches before installation
|
|
98
|
-
const cacheResults = await this.cacheCleaner.cleanAllCaches(config);
|
|
99
|
-
|
|
100
|
-
const endTime = Date.now();
|
|
101
|
-
const duration = endTime - startTime;
|
|
102
|
-
|
|
103
|
-
this.results.cacheCleaning = {
|
|
104
|
-
success: true,
|
|
105
|
-
duration,
|
|
106
|
-
filesRemoved: cacheResults.filesRemoved,
|
|
107
|
-
directoriesRemoved: cacheResults.directoriesRemoved,
|
|
108
|
-
bytesFreed: cacheResults.bytesFreed,
|
|
109
|
-
errors: cacheResults.errors.length,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
console.log(`�?Cache cleaning completed in ${duration}ms`);
|
|
113
|
-
console.log(
|
|
114
|
-
`📊 Removed ${cacheResults.filesRemoved} files, freed ${this.formatBytes(cacheResults.bytesFreed)}\n`,
|
|
115
|
-
);
|
|
116
|
-
} catch (error) {
|
|
117
|
-
console.error('�?Cache cleaning failed:', error.message);
|
|
118
|
-
this.results.cacheCleaning = {
|
|
119
|
-
success: false,
|
|
120
|
-
error: error.message,
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
if (!this.options.force) {
|
|
124
|
-
throw new Error(`Cache cleaning failed: ${error.message}`);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
console.log(
|
|
128
|
-
'⚠️ Continuing installation despite cache cleaning errors...\n',
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Scan system and prepare for installation
|
|
135
|
-
*/
|
|
136
|
-
async scanAndPrepare() {
|
|
137
|
-
console.log('🔍 Scanning System for Installation...\n');
|
|
138
|
-
|
|
139
|
-
try {
|
|
140
|
-
// Check system requirements
|
|
141
|
-
await this.checkSystemRequirements();
|
|
142
|
-
|
|
143
|
-
// Scan for existing CLI tools
|
|
144
|
-
const scanResult = await this.baseInstaller.scanCLI();
|
|
145
|
-
|
|
146
|
-
console.log('�?System scan completed');
|
|
147
|
-
console.log(
|
|
148
|
-
`📊 Found ${Object.keys(scanResult.available).length} available CLI tools`,
|
|
149
|
-
);
|
|
150
|
-
console.log(
|
|
151
|
-
`📊 Missing ${Object.keys(scanResult.missing).length} CLI tools\n`,
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
this.results.scan = scanResult;
|
|
155
|
-
} catch (error) {
|
|
156
|
-
console.error('�?System scan failed:', error.message);
|
|
157
|
-
throw error;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Perform the actual installation
|
|
163
|
-
*/
|
|
164
|
-
async performInstallation() {
|
|
165
|
-
console.log('📦 Performing Installation...\n');
|
|
166
|
-
|
|
167
|
-
try {
|
|
168
|
-
// Interactive tool selection would go here
|
|
169
|
-
// For now, we'll use a simple approach
|
|
170
|
-
const missingTools = Object.keys(this.results.scan.missing);
|
|
171
|
-
|
|
172
|
-
if (missingTools.length === 0) {
|
|
173
|
-
console.log('ℹ️ All CLI tools are already installed');
|
|
174
|
-
this.results.installation = {
|
|
175
|
-
success: true,
|
|
176
|
-
installed: [],
|
|
177
|
-
message: 'No tools needed installation',
|
|
178
|
-
};
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
console.log(`📦 Installing ${missingTools.length} CLI tools...`);
|
|
183
|
-
|
|
184
|
-
// Install missing tools
|
|
185
|
-
const installResult = await this.baseInstaller.installTools(
|
|
186
|
-
missingTools,
|
|
187
|
-
this.results.scan.missing,
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
this.results.installation = {
|
|
191
|
-
success: true,
|
|
192
|
-
installed: missingTools,
|
|
193
|
-
result: installResult,
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
console.log('�?Installation completed');
|
|
197
|
-
} catch (error) {
|
|
198
|
-
console.error('�?Installation failed:', error.message);
|
|
199
|
-
this.results.installation = {
|
|
200
|
-
success: false,
|
|
201
|
-
error: error.message,
|
|
202
|
-
};
|
|
203
|
-
throw error;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Post-installation verification
|
|
209
|
-
*/
|
|
210
|
-
async verifyInstallation() {
|
|
211
|
-
console.log('\n�?Post-installation Verification...');
|
|
212
|
-
|
|
213
|
-
try {
|
|
214
|
-
// Verify installation was successful
|
|
215
|
-
const postScan = await this.baseInstaller.scanCLI();
|
|
216
|
-
|
|
217
|
-
const verificationResults = {
|
|
218
|
-
beforeCount: Object.keys(this.results.scan.available).length,
|
|
219
|
-
afterCount: Object.keys(postScan.available).length,
|
|
220
|
-
newlyInstalled: [],
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
// Find newly installed tools
|
|
224
|
-
for (const tool of Object.keys(postScan.available)) {
|
|
225
|
-
if (!this.results.scan.available[tool]) {
|
|
226
|
-
verificationResults.newlyInstalled.push(tool);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
this.results.verification = verificationResults;
|
|
231
|
-
|
|
232
|
-
console.log(`📊 CLI tools before: ${verificationResults.beforeCount}`);
|
|
233
|
-
console.log(`📊 CLI tools after: ${verificationResults.afterCount}`);
|
|
234
|
-
console.log(
|
|
235
|
-
`📊 Newly installed: ${verificationResults.newlyInstalled.length}`,
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
if (verificationResults.newlyInstalled.length > 0) {
|
|
239
|
-
console.log(
|
|
240
|
-
`�?Successfully installed: ${verificationResults.newlyInstalled.join(', ')}`,
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
console.log('�?Installation verification completed\n');
|
|
245
|
-
} catch (error) {
|
|
246
|
-
console.error('�?Verification failed:', error.message);
|
|
247
|
-
this.results.errors.push(`Verification: ${error.message}`);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Check system requirements
|
|
253
|
-
*/
|
|
254
|
-
async checkSystemRequirements() {
|
|
255
|
-
console.log('🔧 Checking System Requirements...');
|
|
256
|
-
|
|
257
|
-
// Check Node.js version
|
|
258
|
-
const nodeVersion = process.version;
|
|
259
|
-
const majorVersion = parseInt(nodeVersion.slice(1).split('.')[0]);
|
|
260
|
-
|
|
261
|
-
if (majorVersion < 14) {
|
|
262
|
-
throw new Error(
|
|
263
|
-
`Node.js version ${nodeVersion} is not supported. Please use Node.js 14 or higher.`,
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
console.log(` �?Node.js: ${nodeVersion}`);
|
|
268
|
-
|
|
269
|
-
// Check npm availability
|
|
270
|
-
try {
|
|
271
|
-
const { spawnSync } = require('child_process');
|
|
272
|
-
const npmResult = spawnSync('npm', ['--version'], {
|
|
273
|
-
encoding: 'utf8',
|
|
274
|
-
shell: true,
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
if (npmResult.status === 0) {
|
|
278
|
-
console.log(` �?npm: ${npmResult.stdout.trim()}`);
|
|
279
|
-
} else {
|
|
280
|
-
throw new Error('npm is not available');
|
|
281
|
-
}
|
|
282
|
-
} catch (error) {
|
|
283
|
-
throw new Error('npm is required but not found');
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Check available disk space (basic check)
|
|
287
|
-
const homeDir = os.homedir();
|
|
288
|
-
try {
|
|
289
|
-
const stats = fs.statSync(homeDir);
|
|
290
|
-
console.log(` �?Home directory accessible: ${homeDir}`);
|
|
291
|
-
} catch (error) {
|
|
292
|
-
throw new Error(`Cannot access home directory: ${homeDir}`);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
console.log('�?System requirements check passed\n');
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Create installation plan without executing
|
|
300
|
-
*/
|
|
301
|
-
async createInstallationPlan() {
|
|
302
|
-
console.log('📋 Creating Installation Plan...\n');
|
|
303
|
-
|
|
304
|
-
const plan = {
|
|
305
|
-
cacheCleaning: {},
|
|
306
|
-
installation: {},
|
|
307
|
-
estimatedTime: 0,
|
|
308
|
-
estimatedSpace: 0,
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
try {
|
|
312
|
-
// Check what would be cleaned
|
|
313
|
-
const stigmergyDir = path.join(os.homedir(), '.stigmergy');
|
|
314
|
-
if (fs.existsSync(stigmergyDir)) {
|
|
315
|
-
const cacheSize = await this.calculateDirectorySize(stigmergyDir);
|
|
316
|
-
plan.cacheCleaning.stigmergyCache = {
|
|
317
|
-
path: stigmergyDir,
|
|
318
|
-
size: cacheSize,
|
|
319
|
-
wouldClean: this.options.cleanBeforeInstall,
|
|
320
|
-
};
|
|
321
|
-
plan.estimatedSpace += cacheSize;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// Scan for missing CLI tools
|
|
325
|
-
const scanResult = await this.baseInstaller.scanCLI();
|
|
326
|
-
const missingTools = Object.keys(scanResult.missing);
|
|
327
|
-
|
|
328
|
-
plan.installation = {
|
|
329
|
-
missingTools: missingTools,
|
|
330
|
-
toolCount: missingTools.length,
|
|
331
|
-
tools: missingTools.map((tool) => ({
|
|
332
|
-
name: scanResult.missing[tool].name,
|
|
333
|
-
installCommand: scanResult.missing[tool].install,
|
|
334
|
-
})),
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
// Estimate time (very rough estimate)
|
|
338
|
-
plan.estimatedTime = missingTools.length * 30000; // 30 seconds per tool
|
|
339
|
-
|
|
340
|
-
console.log('📊 Installation Plan Summary:');
|
|
341
|
-
console.log(
|
|
342
|
-
` 🧹 Cache cleaning: ${this.options.cleanBeforeInstall ? 'Yes' : 'No'}`,
|
|
343
|
-
);
|
|
344
|
-
console.log(` 📦 Tools to install: ${missingTools.length}`);
|
|
345
|
-
console.log(
|
|
346
|
-
` ⏱️ Estimated time: ${Math.ceil(plan.estimatedTime / 1000)} seconds`,
|
|
347
|
-
);
|
|
348
|
-
console.log(
|
|
349
|
-
` 💾 Estimated space: ${this.formatBytes(plan.estimatedSpace)}`,
|
|
350
|
-
);
|
|
351
|
-
|
|
352
|
-
return plan;
|
|
353
|
-
} catch (error) {
|
|
354
|
-
console.error('�?Failed to create installation plan:', error.message);
|
|
355
|
-
throw error;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Quick cache clean only
|
|
361
|
-
*/
|
|
362
|
-
async quickCacheClean() {
|
|
363
|
-
console.log('�?Quick Cache Clean Only...\n');
|
|
364
|
-
|
|
365
|
-
try {
|
|
366
|
-
const results = await this.cacheCleaner.cleanAllCaches({
|
|
367
|
-
cleanStigmergy: false, // Don't clean main config
|
|
368
|
-
cleanNPX: true,
|
|
369
|
-
cleanNPM: false,
|
|
370
|
-
cleanCLI: false,
|
|
371
|
-
cleanTemp: true,
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
console.log('�?Quick cache clean completed');
|
|
375
|
-
console.log(
|
|
376
|
-
`📊 Removed ${results.filesRemoved} files, freed ${this.formatBytes(results.bytesFreed)}`,
|
|
377
|
-
);
|
|
378
|
-
|
|
379
|
-
return results;
|
|
380
|
-
} catch (error) {
|
|
381
|
-
console.error('�?Quick cache clean failed:', error.message);
|
|
382
|
-
throw error;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Helper methods
|
|
388
|
-
*/
|
|
389
|
-
async calculateDirectorySize(dirPath) {
|
|
390
|
-
let totalSize = 0;
|
|
391
|
-
|
|
392
|
-
try {
|
|
393
|
-
const items = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
394
|
-
|
|
395
|
-
for (const item of items) {
|
|
396
|
-
const fullPath = path.join(dirPath, item.name);
|
|
397
|
-
|
|
398
|
-
if (item.isDirectory()) {
|
|
399
|
-
totalSize += await this.calculateDirectorySize(fullPath);
|
|
400
|
-
} else {
|
|
401
|
-
try {
|
|
402
|
-
const stat = fs.statSync(fullPath);
|
|
403
|
-
totalSize += stat.size;
|
|
404
|
-
} catch (error) {
|
|
405
|
-
// Skip files we can't stat
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
} catch (error) {
|
|
410
|
-
// Return 0 for directories we can't read
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
return totalSize;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
formatBytes(bytes) {
|
|
417
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
418
|
-
if (bytes === 0) return '0 Bytes';
|
|
419
|
-
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
420
|
-
return Math.round((bytes / Math.pow(1024, i)) * 100) / 100 + ' ' + sizes[i];
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
printSummary() {
|
|
424
|
-
console.log('\n📊 ENHANCED INSTALLATION SUMMARY:');
|
|
425
|
-
console.log('='.repeat(50));
|
|
426
|
-
|
|
427
|
-
if (this.options.dryRun) {
|
|
428
|
-
console.log('🔍 DRY RUN MODE - No actual changes were made');
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// Cache cleaning summary
|
|
432
|
-
if (this.results.cacheCleaning.success) {
|
|
433
|
-
console.log('🧹 Cache Cleaning: �?);
|
|
434
|
-
console.log(` Duration: ${this.results.cacheCleaning.duration}ms`);
|
|
435
|
-
console.log(
|
|
436
|
-
` Files removed: ${this.results.cacheCleaning.filesRemoved}`,
|
|
437
|
-
);
|
|
438
|
-
console.log(
|
|
439
|
-
` Space freed: ${this.formatBytes(this.results.cacheCleaning.bytesFreed)}`,
|
|
440
|
-
);
|
|
441
|
-
} else if (this.results.cacheCleaning.error) {
|
|
442
|
-
console.log(`🧹 Cache Cleaning: �?${this.results.cacheCleaning.error}`);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// Installation summary
|
|
446
|
-
if (this.results.installation.success) {
|
|
447
|
-
console.log('📦 Installation: �?);
|
|
448
|
-
if (this.results.installation.installed.length > 0) {
|
|
449
|
-
console.log(
|
|
450
|
-
` Installed: ${this.results.installation.installed.join(', ')}`,
|
|
451
|
-
);
|
|
452
|
-
} else {
|
|
453
|
-
console.log(` Message: ${this.results.installation.message}`);
|
|
454
|
-
}
|
|
455
|
-
} else if (this.results.installation.error) {
|
|
456
|
-
console.log(`📦 Installation: �?${this.results.installation.error}`);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// Verification summary
|
|
460
|
-
if (this.results.verification) {
|
|
461
|
-
console.log('�?Verification: �?);
|
|
462
|
-
console.log(
|
|
463
|
-
` Newly installed: ${this.results.verification.newlyInstalled.length} tools`,
|
|
464
|
-
);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// Errors
|
|
468
|
-
if (this.results.errors.length > 0) {
|
|
469
|
-
console.log(`\n�?Errors encountered: ${this.results.errors.length}`);
|
|
470
|
-
this.results.errors.forEach((error) => {
|
|
471
|
-
console.log(` - ${error}`);
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
console.log('\n🎉 Enhanced installation completed!');
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
module.exports = EnhancedInstaller;
|