avana-cli 2.11.1 → 2.12.0

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.
Files changed (39) hide show
  1. package/README.md +47 -3
  2. package/dist/cli.js +30 -8
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/scan.d.ts +0 -2
  5. package/dist/commands/scan.d.ts.map +1 -1
  6. package/dist/commands/scan.js +48 -60
  7. package/dist/commands/scan.js.map +1 -1
  8. package/dist/commands/troubleshoot.d.ts +9 -0
  9. package/dist/commands/troubleshoot.d.ts.map +1 -0
  10. package/dist/commands/troubleshoot.js +362 -0
  11. package/dist/commands/troubleshoot.js.map +1 -0
  12. package/dist/utils/chardet-error-handler.d.ts +25 -0
  13. package/dist/utils/chardet-error-handler.d.ts.map +1 -0
  14. package/dist/utils/chardet-error-handler.js +163 -0
  15. package/dist/utils/chardet-error-handler.js.map +1 -0
  16. package/dist/utils/dependency-checker.d.ts +37 -0
  17. package/dist/utils/dependency-checker.d.ts.map +1 -0
  18. package/dist/utils/dependency-checker.js +226 -0
  19. package/dist/utils/dependency-checker.js.map +1 -0
  20. package/dist/utils/file-stream-scanner.d.ts.map +1 -1
  21. package/dist/utils/file-stream-scanner.js +3 -1
  22. package/dist/utils/file-stream-scanner.js.map +1 -1
  23. package/dist/utils/file-type-detector.d.ts +7 -2
  24. package/dist/utils/file-type-detector.d.ts.map +1 -1
  25. package/dist/utils/file-type-detector.js +92 -8
  26. package/dist/utils/file-type-detector.js.map +1 -1
  27. package/dist/utils/ignore-pattern-manager.d.ts.map +1 -1
  28. package/dist/utils/ignore-pattern-manager.js +4 -2
  29. package/dist/utils/ignore-pattern-manager.js.map +1 -1
  30. package/dist/utils/json-output-formatter.d.ts.map +1 -1
  31. package/dist/utils/json-output-formatter.js +14 -6
  32. package/dist/utils/json-output-formatter.js.map +1 -1
  33. package/dist/utils/parallel-scanner.d.ts.map +1 -1
  34. package/dist/utils/parallel-scanner.js +6 -2
  35. package/dist/utils/parallel-scanner.js.map +1 -1
  36. package/dist/utils/progress-reporter.d.ts.map +1 -1
  37. package/dist/utils/progress-reporter.js +3 -34
  38. package/dist/utils/progress-reporter.js.map +1 -1
  39. package/package.json +17 -7
@@ -0,0 +1,362 @@
1
+ "use strict";
2
+ /**
3
+ * Avana CLI - Troubleshoot Command
4
+ * Provides comprehensive troubleshooting information and diagnostics
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.troubleshootCommand = troubleshootCommand;
41
+ const fs = __importStar(require("fs"));
42
+ const path = __importStar(require("path"));
43
+ const os = __importStar(require("os"));
44
+ const child_process_1 = require("child_process");
45
+ const chardet_error_handler_1 = require("../utils/chardet-error-handler");
46
+ const dependency_checker_1 = require("../utils/dependency-checker");
47
+ const exit_codes_1 = require("../utils/exit-codes");
48
+ /**
49
+ * Colors for console output
50
+ */
51
+ const colors = {
52
+ red: '\x1b[31m',
53
+ yellow: '\x1b[33m',
54
+ blue: '\x1b[34m',
55
+ green: '\x1b[32m',
56
+ cyan: '\x1b[36m',
57
+ reset: '\x1b[0m',
58
+ bold: '\x1b[1m'
59
+ };
60
+ /**
61
+ * Get system information
62
+ */
63
+ function getSystemInfo() {
64
+ const nodeVersion = process.version;
65
+ const platform = os.platform();
66
+ const arch = os.arch();
67
+ const osRelease = os.release();
68
+ const totalMemory = Math.round(os.totalmem() / 1024 / 1024 / 1024);
69
+ return {
70
+ nodeVersion,
71
+ platform,
72
+ arch,
73
+ osRelease,
74
+ totalMemory
75
+ };
76
+ }
77
+ /**
78
+ * Get npm information
79
+ */
80
+ function getNpmInfo() {
81
+ try {
82
+ const npmVersion = (0, child_process_1.execSync)('npm --version', { encoding: 'utf-8' }).trim();
83
+ const npmPrefix = (0, child_process_1.execSync)('npm config get prefix', { encoding: 'utf-8' }).trim();
84
+ return {
85
+ version: npmVersion,
86
+ prefix: npmPrefix,
87
+ available: true
88
+ };
89
+ }
90
+ catch (error) {
91
+ return {
92
+ version: 'Unknown',
93
+ prefix: 'Unknown',
94
+ available: false,
95
+ error: error instanceof Error ? error.message : 'Unknown error'
96
+ };
97
+ }
98
+ }
99
+ /**
100
+ * Check Avana installation
101
+ */
102
+ function checkAvanaInstallation() {
103
+ try {
104
+ // Check if we can find package.json
105
+ const packageJsonPath = path.join(process.cwd(), 'package.json');
106
+ let packageInfo = null;
107
+ if (fs.existsSync(packageJsonPath)) {
108
+ try {
109
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
110
+ packageInfo = {
111
+ name: packageJson.name,
112
+ version: packageJson.version,
113
+ isAvana: packageJson.name === 'avana-cli'
114
+ };
115
+ }
116
+ catch (parseError) {
117
+ packageInfo = { error: 'Could not parse package.json' };
118
+ }
119
+ }
120
+ // Check global installation
121
+ let globalInstallation = null;
122
+ try {
123
+ const globalList = (0, child_process_1.execSync)('npm list -g avana-cli --depth=0', {
124
+ encoding: 'utf-8',
125
+ stdio: 'pipe'
126
+ });
127
+ globalInstallation = { installed: true, info: globalList.trim() };
128
+ }
129
+ catch (error) {
130
+ globalInstallation = { installed: false };
131
+ }
132
+ return {
133
+ packageInfo,
134
+ globalInstallation
135
+ };
136
+ }
137
+ catch (error) {
138
+ return {
139
+ error: error instanceof Error ? error.message : 'Unknown error'
140
+ };
141
+ }
142
+ }
143
+ /**
144
+ * Check file permissions
145
+ */
146
+ function checkFilePermissions() {
147
+ const testPaths = [
148
+ process.cwd(),
149
+ os.tmpdir(),
150
+ path.join(os.homedir(), '.npm')
151
+ ];
152
+ const results = testPaths.map(testPath => {
153
+ try {
154
+ // Test read access
155
+ fs.accessSync(testPath, fs.constants.R_OK);
156
+ // Test write access
157
+ fs.accessSync(testPath, fs.constants.W_OK);
158
+ return {
159
+ path: testPath,
160
+ readable: true,
161
+ writable: true,
162
+ error: null
163
+ };
164
+ }
165
+ catch (error) {
166
+ return {
167
+ path: testPath,
168
+ readable: false,
169
+ writable: false,
170
+ error: error instanceof Error ? error.message : 'Unknown error'
171
+ };
172
+ }
173
+ });
174
+ return results;
175
+ }
176
+ /**
177
+ * Display system diagnostics
178
+ */
179
+ function displaySystemDiagnostics() {
180
+ console.log(`${colors.cyan}${colors.bold}🖥️ System Information${colors.reset}`);
181
+ console.log();
182
+ const systemInfo = getSystemInfo();
183
+ console.log(`${colors.blue}Operating System:${colors.reset} ${systemInfo.platform} ${systemInfo.arch} (${systemInfo.osRelease})`);
184
+ console.log(`${colors.blue}Node.js Version:${colors.reset} ${systemInfo.nodeVersion}`);
185
+ console.log(`${colors.blue}Total Memory:${colors.reset} ${systemInfo.totalMemory} GB`);
186
+ // Check Node.js version compatibility
187
+ const majorVersion = parseInt(systemInfo.nodeVersion.split('.')[0].substring(1));
188
+ if (majorVersion < 18) {
189
+ console.log(`${colors.red}⚠️ Node.js version ${systemInfo.nodeVersion} is below minimum required (18+)${colors.reset}`);
190
+ console.log(`${colors.yellow} Update Node.js: https://nodejs.org/${colors.reset}`);
191
+ }
192
+ else {
193
+ console.log(`${colors.green}✅ Node.js version is compatible${colors.reset}`);
194
+ }
195
+ console.log();
196
+ }
197
+ /**
198
+ * Display npm diagnostics
199
+ */
200
+ function displayNpmDiagnostics() {
201
+ console.log(`${colors.cyan}${colors.bold}📦 npm Information${colors.reset}`);
202
+ console.log();
203
+ const npmInfo = getNpmInfo();
204
+ if (npmInfo.available) {
205
+ console.log(`${colors.blue}npm Version:${colors.reset} ${npmInfo.version}`);
206
+ console.log(`${colors.blue}npm Prefix:${colors.reset} ${npmInfo.prefix}`);
207
+ console.log(`${colors.green}✅ npm is available${colors.reset}`);
208
+ }
209
+ else {
210
+ console.log(`${colors.red}❌ npm is not available${colors.reset}`);
211
+ if (npmInfo.error) {
212
+ console.log(`${colors.yellow}Error: ${npmInfo.error}${colors.reset}`);
213
+ }
214
+ console.log(`${colors.yellow}Install npm: https://www.npmjs.com/get-npm${colors.reset}`);
215
+ }
216
+ console.log();
217
+ }
218
+ /**
219
+ * Display Avana installation diagnostics
220
+ */
221
+ function displayAvanaDiagnostics() {
222
+ console.log(`${colors.cyan}${colors.bold}🔒 Avana Installation${colors.reset}`);
223
+ console.log();
224
+ const installation = checkAvanaInstallation();
225
+ if (installation.packageInfo) {
226
+ if (installation.packageInfo.isAvana) {
227
+ console.log(`${colors.green}✅ Running from Avana source directory${colors.reset}`);
228
+ console.log(`${colors.blue}Version:${colors.reset} ${installation.packageInfo.version}`);
229
+ }
230
+ else if (installation.packageInfo.name) {
231
+ console.log(`${colors.yellow}ℹ️ Running from ${installation.packageInfo.name} directory${colors.reset}`);
232
+ }
233
+ }
234
+ if (installation.globalInstallation) {
235
+ if (installation.globalInstallation.installed) {
236
+ console.log(`${colors.green}✅ Avana is installed globally${colors.reset}`);
237
+ }
238
+ else {
239
+ console.log(`${colors.yellow}ℹ️ Avana is not installed globally${colors.reset}`);
240
+ console.log(`${colors.blue}Install globally: npm install -g avana-cli${colors.reset}`);
241
+ }
242
+ }
243
+ console.log();
244
+ }
245
+ /**
246
+ * Display dependency diagnostics
247
+ */
248
+ function displayDependencyDiagnostics() {
249
+ console.log(`${colors.cyan}${colors.bold}📚 Dependencies${colors.reset}`);
250
+ console.log();
251
+ const allAvailable = (0, dependency_checker_1.areAllDependenciesAvailable)();
252
+ const missing = (0, dependency_checker_1.getMissingDependencies)();
253
+ if (allAvailable) {
254
+ console.log(`${colors.green}✅ All required dependencies are available${colors.reset}`);
255
+ }
256
+ else {
257
+ console.log(`${colors.red}❌ Missing dependencies: ${missing.join(', ')}${colors.reset}`);
258
+ console.log(`${colors.blue}Install missing: npm install ${missing.join(' ')}${colors.reset}`);
259
+ }
260
+ console.log();
261
+ // Specific chardet diagnostics
262
+ (0, chardet_error_handler_1.displayChardetStatus)();
263
+ }
264
+ /**
265
+ * Display file permission diagnostics
266
+ */
267
+ function displayPermissionDiagnostics() {
268
+ console.log(`${colors.cyan}${colors.bold}🔐 File Permissions${colors.reset}`);
269
+ console.log();
270
+ const permissions = checkFilePermissions();
271
+ for (const perm of permissions) {
272
+ if (perm.readable && perm.writable) {
273
+ console.log(`${colors.green}✅ ${perm.path}: Read/Write OK${colors.reset}`);
274
+ }
275
+ else {
276
+ console.log(`${colors.red}❌ ${perm.path}: Permission issues${colors.reset}`);
277
+ if (perm.error) {
278
+ console.log(`${colors.yellow} Error: ${perm.error}${colors.reset}`);
279
+ }
280
+ }
281
+ }
282
+ console.log();
283
+ }
284
+ /**
285
+ * Display common troubleshooting steps
286
+ */
287
+ function displayTroubleshootingSteps() {
288
+ console.log(`${colors.cyan}${colors.bold}🔧 Common Troubleshooting Steps${colors.reset}`);
289
+ console.log();
290
+ console.log(`${colors.blue}${colors.bold}1. Reinstall Avana CLI:${colors.reset}`);
291
+ console.log(` npm uninstall -g avana-cli`);
292
+ console.log(` npm install -g avana-cli`);
293
+ console.log();
294
+ console.log(`${colors.blue}${colors.bold}2. Clear npm cache:${colors.reset}`);
295
+ console.log(` npm cache clean --force`);
296
+ console.log();
297
+ console.log(`${colors.blue}${colors.bold}3. Rebuild native dependencies:${colors.reset}`);
298
+ console.log(` npm rebuild`);
299
+ console.log();
300
+ console.log(`${colors.blue}${colors.bold}4. Update npm to latest version:${colors.reset}`);
301
+ console.log(` npm install -g npm@latest`);
302
+ console.log();
303
+ console.log(`${colors.blue}${colors.bold}5. Check for conflicting installations:${colors.reset}`);
304
+ console.log(` npm list -g avana-cli`);
305
+ console.log(` which avana # On Unix-like systems`);
306
+ console.log(` where avana # On Windows`);
307
+ console.log();
308
+ console.log(`${colors.blue}${colors.bold}6. Verify PATH environment variable:${colors.reset}`);
309
+ console.log(` echo $PATH # On Unix-like systems`);
310
+ console.log(` echo %PATH% # On Windows`);
311
+ console.log();
312
+ }
313
+ /**
314
+ * Display support information
315
+ */
316
+ function displaySupportInfo() {
317
+ console.log(`${colors.cyan}${colors.bold}📞 Getting Help${colors.reset}`);
318
+ console.log();
319
+ console.log(`${colors.blue}${colors.bold}Documentation:${colors.reset}`);
320
+ console.log(` https://github.com/innookeke/avana-cli#readme`);
321
+ console.log();
322
+ console.log(`${colors.blue}${colors.bold}Report Issues:${colors.reset}`);
323
+ console.log(` https://github.com/innookeke/avana-cli/issues`);
324
+ console.log();
325
+ console.log(`${colors.blue}${colors.bold}When reporting issues, please include:${colors.reset}`);
326
+ console.log(` • Your operating system and version`);
327
+ console.log(` • Node.js version (node --version)`);
328
+ console.log(` • npm version (npm --version)`);
329
+ console.log(` • Complete error message`);
330
+ console.log(` • Steps to reproduce the issue`);
331
+ console.log();
332
+ console.log(`${colors.blue}${colors.bold}Quick Test Command:${colors.reset}`);
333
+ console.log(` avana --help`);
334
+ console.log();
335
+ }
336
+ /**
337
+ * Main troubleshoot command
338
+ */
339
+ async function troubleshootCommand() {
340
+ console.log(`${colors.bold}${colors.cyan}🔍 Avana CLI Troubleshooting${colors.reset}`);
341
+ console.log();
342
+ try {
343
+ displaySystemDiagnostics();
344
+ displayNpmDiagnostics();
345
+ displayAvanaDiagnostics();
346
+ displayDependencyDiagnostics();
347
+ displayPermissionDiagnostics();
348
+ displayTroubleshootingSteps();
349
+ displaySupportInfo();
350
+ console.log(`${colors.green}${colors.bold}✅ Troubleshooting diagnostics complete${colors.reset}`);
351
+ console.log();
352
+ process.exit(exit_codes_1.ExitCode.SUCCESS);
353
+ }
354
+ catch (error) {
355
+ console.error(`${colors.red}❌ Error running troubleshooting diagnostics:${colors.reset}`);
356
+ if (error instanceof Error) {
357
+ console.error(error.message);
358
+ }
359
+ process.exit(exit_codes_1.ExitCode.UNEXPECTED_ERROR);
360
+ }
361
+ }
362
+ //# sourceMappingURL=troubleshoot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"troubleshoot.js","sourceRoot":"","sources":["../../src/commands/troubleshoot.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkVH,kDAwBC;AAxWD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,iDAAyC;AACzC,0EAAmG;AACnG,oEAAkG;AAClG,oDAA+C;AAE/C;;GAEG;AACH,MAAM,MAAM,GAAG;IACb,GAAG,EAAE,UAAU;IACf,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;CAChB,CAAC;AAEF;;GAEG;AACH,SAAS,aAAa;IACpB,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IACpC,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACvB,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;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Chardet Error Handler
3
+ * Specific error handling and troubleshooting for chardet module issues
4
+ */
5
+ /**
6
+ * Display specific chardet error message
7
+ */
8
+ export declare function displayChardetError(error: Error, context?: string): void;
9
+ /**
10
+ * Handle chardet loading error with graceful fallback
11
+ */
12
+ export declare function handleChardetLoadingError(error: Error): void;
13
+ /**
14
+ * Test chardet functionality
15
+ */
16
+ export declare function testChardetFunctionality(): boolean;
17
+ /**
18
+ * Display chardet status information
19
+ */
20
+ export declare function displayChardetStatus(): void;
21
+ /**
22
+ * Validate chardet installation and provide guidance
23
+ */
24
+ export declare function validateChardetInstallation(): boolean;
25
+ //# sourceMappingURL=chardet-error-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chardet-error-handler.d.ts","sourceRoot":"","sources":["../../src/utils/chardet-error-handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CA0DxE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAW5D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAYlD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAkC3C;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAgBrD"}
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ /**
3
+ * Chardet Error Handler
4
+ * Specific error handling and troubleshooting for chardet module issues
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.displayChardetError = displayChardetError;
8
+ exports.handleChardetLoadingError = handleChardetLoadingError;
9
+ exports.testChardetFunctionality = testChardetFunctionality;
10
+ exports.displayChardetStatus = displayChardetStatus;
11
+ exports.validateChardetInstallation = validateChardetInstallation;
12
+ /**
13
+ * Colors for console output
14
+ */
15
+ const colors = {
16
+ red: '\x1b[31m',
17
+ yellow: '\x1b[33m',
18
+ blue: '\x1b[34m',
19
+ green: '\x1b[32m',
20
+ reset: '\x1b[0m',
21
+ bold: '\x1b[1m'
22
+ };
23
+ /**
24
+ * Display specific chardet error message
25
+ */
26
+ function displayChardetError(error, context) {
27
+ console.error(`${colors.red}${colors.bold}❌ Character Encoding Detection Error${colors.reset}`);
28
+ console.error();
29
+ console.error(`${colors.red}The chardet module failed to load or execute properly.${colors.reset}`);
30
+ if (context) {
31
+ console.error(`${colors.yellow}Context:${colors.reset} ${context}`);
32
+ }
33
+ console.error(`${colors.yellow}Error details:${colors.reset} ${error.message}`);
34
+ console.error();
35
+ console.error(`${colors.blue}${colors.bold}🔧 Quick Fixes:${colors.reset}`);
36
+ console.error();
37
+ console.error(`${colors.blue}1. Reinstall chardet module:${colors.reset}`);
38
+ console.error(` npm uninstall chardet`);
39
+ console.error(` npm install chardet`);
40
+ console.error();
41
+ console.error(`${colors.blue}2. Clear npm cache and reinstall:${colors.reset}`);
42
+ console.error(` npm cache clean --force`);
43
+ console.error(` npm install chardet`);
44
+ console.error();
45
+ console.error(`${colors.blue}3. Try a different chardet version:${colors.reset}`);
46
+ console.error(` npm install chardet@2.1.1`);
47
+ console.error();
48
+ console.error(`${colors.blue}4. Verify Node.js compatibility:${colors.reset}`);
49
+ console.error(` node --version # Should be 18.0.0 or higher`);
50
+ console.error();
51
+ console.error(`${colors.yellow}${colors.bold}💡 About chardet:${colors.reset}`);
52
+ console.error(`${colors.yellow}chardet is used for automatic character encoding detection.${colors.reset}`);
53
+ console.error(`${colors.yellow}It helps Avana correctly read files with different text encodings.${colors.reset}`);
54
+ console.error();
55
+ console.error(`${colors.yellow}${colors.bold}🔍 Troubleshooting Steps:${colors.reset}`);
56
+ console.error();
57
+ console.error(`${colors.yellow}1. Check if chardet is installed:${colors.reset}`);
58
+ console.error(` npm list chardet`);
59
+ console.error();
60
+ console.error(`${colors.yellow}2. Test chardet directly:${colors.reset}`);
61
+ console.error(` node -e "console.log(require('chardet'))"`);
62
+ console.error();
63
+ console.error(`${colors.yellow}3. Check for native dependencies:${colors.reset}`);
64
+ console.error(` npm rebuild`);
65
+ console.error();
66
+ console.error(`${colors.yellow}4. If using Windows, ensure build tools are available:${colors.reset}`);
67
+ console.error(` npm install -g windows-build-tools`);
68
+ console.error();
69
+ console.error(`${colors.green}${colors.bold}✅ Workaround:${colors.reset}`);
70
+ console.error(`${colors.green}Avana can continue without chardet using fallback encoding detection.${colors.reset}`);
71
+ console.error(`${colors.green}Set DEBUG=1 to see encoding detection warnings.${colors.reset}`);
72
+ console.error();
73
+ console.error(`${colors.blue}${colors.bold}📞 Still need help?${colors.reset}`);
74
+ console.error(`${colors.blue}Report this issue: https://github.com/innookeke/avana-cli/issues${colors.reset}`);
75
+ console.error(`${colors.blue}Include your Node.js version and operating system.${colors.reset}`);
76
+ console.error();
77
+ }
78
+ /**
79
+ * Handle chardet loading error with graceful fallback
80
+ */
81
+ function handleChardetLoadingError(error) {
82
+ console.warn(`${colors.yellow}⚠️ Warning: chardet module could not be loaded${colors.reset}`);
83
+ console.warn(`${colors.yellow}Falling back to basic encoding detection.${colors.reset}`);
84
+ if (process.env.DEBUG) {
85
+ console.warn(`${colors.yellow}Error details: ${error.message}${colors.reset}`);
86
+ console.warn();
87
+ console.warn(`${colors.blue}To fix this issue:${colors.reset}`);
88
+ console.warn(`${colors.blue}Run: npm install chardet${colors.reset}`);
89
+ console.warn();
90
+ }
91
+ }
92
+ /**
93
+ * Test chardet functionality
94
+ */
95
+ function testChardetFunctionality() {
96
+ try {
97
+ const chardet = require('chardet');
98
+ // Test with a simple buffer
99
+ const testBuffer = Buffer.from('Hello, world!', 'utf8');
100
+ const result = chardet.detect(testBuffer);
101
+ return typeof result === 'string' && result.length > 0;
102
+ }
103
+ catch (error) {
104
+ return false;
105
+ }
106
+ }
107
+ /**
108
+ * Display chardet status information
109
+ */
110
+ function displayChardetStatus() {
111
+ console.log(`${colors.blue}${colors.bold}📊 Chardet Module Status${colors.reset}`);
112
+ console.log();
113
+ try {
114
+ const chardet = require('chardet');
115
+ console.log(`${colors.green}✅ chardet module: Available${colors.reset}`);
116
+ // Test functionality
117
+ const isWorking = testChardetFunctionality();
118
+ if (isWorking) {
119
+ console.log(`${colors.green}✅ chardet functionality: Working${colors.reset}`);
120
+ }
121
+ else {
122
+ console.log(`${colors.yellow}⚠️ chardet functionality: Limited${colors.reset}`);
123
+ }
124
+ // Show version if available
125
+ try {
126
+ const packageJson = require('chardet/package.json');
127
+ console.log(`${colors.blue}ℹ️ chardet version: ${packageJson.version}${colors.reset}`);
128
+ }
129
+ catch (versionError) {
130
+ console.log(`${colors.yellow}ℹ️ chardet version: Unknown${colors.reset}`);
131
+ }
132
+ }
133
+ catch (error) {
134
+ console.log(`${colors.red}❌ chardet module: Not available${colors.reset}`);
135
+ console.log(`${colors.yellow} Fallback encoding detection will be used${colors.reset}`);
136
+ if (error instanceof Error) {
137
+ console.log(`${colors.yellow} Error: ${error.message}${colors.reset}`);
138
+ }
139
+ }
140
+ console.log();
141
+ }
142
+ /**
143
+ * Validate chardet installation and provide guidance
144
+ */
145
+ function validateChardetInstallation() {
146
+ try {
147
+ require('chardet');
148
+ if (testChardetFunctionality()) {
149
+ return true;
150
+ }
151
+ else {
152
+ console.warn(`${colors.yellow}⚠️ chardet is installed but not functioning correctly${colors.reset}`);
153
+ console.warn(`${colors.yellow}Consider reinstalling: npm install chardet${colors.reset}`);
154
+ return false;
155
+ }
156
+ }
157
+ catch (error) {
158
+ console.warn(`${colors.yellow}⚠️ chardet is not installed or not accessible${colors.reset}`);
159
+ console.warn(`${colors.green}Install with: npm install chardet${colors.reset}`);
160
+ return false;
161
+ }
162
+ }
163
+ //# sourceMappingURL=chardet-error-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chardet-error-handler.js","sourceRoot":"","sources":["../../src/utils/chardet-error-handler.ts"],"names":[],"mappings":";AA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G,CAAC,GAAG,MAAM,CAAC,GAAG,kCAAkC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3E,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,8CAA8C,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAE1F,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,aAAa,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,2BAA2B;IACzC,IAAI,CAAC;QACH,OAAO,CAAC,SAAS,CAAC,CAAC;QAEnB,IAAI,wBAAwB,EAAE,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,yDAAyD,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YACtG,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,6CAA6C,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YAC1F,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,iDAAiD,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9F,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,oCAAoC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAChF,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Dependency Checker
3
+ * Validates that all required dependencies are available and provides helpful error messages
4
+ */
5
+ /**
6
+ * Get missing dependencies
7
+ */
8
+ export declare function getMissingDependencies(): string[];
9
+ /**
10
+ * Check if all dependencies are available
11
+ */
12
+ export declare function areAllDependenciesAvailable(): boolean;
13
+ /**
14
+ * Display detailed error message for missing dependencies
15
+ */
16
+ export declare function displayDependencyError(missingDeps?: string[]): void;
17
+ /**
18
+ * Validate dependencies and exit if any are missing
19
+ */
20
+ export declare function validateDependenciesOrExit(): void;
21
+ /**
22
+ * Safe require with error handling
23
+ */
24
+ export declare function safeRequire<T = any>(moduleName: string): T | null;
25
+ /**
26
+ * Safe require with detailed error message
27
+ */
28
+ export declare function safeRequireWithError<T = any>(moduleName: string, context?: string): T;
29
+ /**
30
+ * Check specific dependency with context
31
+ */
32
+ export declare function checkDependency(moduleName: string, context: string): boolean;
33
+ /**
34
+ * Display general troubleshooting information
35
+ */
36
+ export declare function displayTroubleshootingInfo(): void;
37
+ //# sourceMappingURL=dependency-checker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-checker.d.ts","sourceRoot":"","sources":["../../src/utils/dependency-checker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2DH;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAIjD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CA0CnE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAOjD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAMjE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAoCrF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAmB5E;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAyBjD"}