@dynamicu/chromedebug-mcp 2.3.0 → 2.3.1

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.
@@ -3,6 +3,7 @@ import fs from 'fs';
3
3
  import path from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { ProjectManager } from './services/project-manager.js';
6
+ import logger from './utils/logger.js';
6
7
 
7
8
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
9
 
@@ -80,19 +81,19 @@ class ConfigLoader {
80
81
  }
81
82
 
82
83
  this.configPath = projectConfigPath;
83
- console.log(`[ConfigLoader] Using project-local config: ${projectConfigPath}`);
84
+ logger.debug(`[ConfigLoader] Using project-local config: ${projectConfigPath}`);
84
85
  return;
85
86
  } catch (error) {
86
- console.warn('[ConfigLoader] Project structure not ready, using global config:', error.message);
87
+ logger.warn('[ConfigLoader] Project structure not ready, using global config:', error.message);
87
88
  }
88
89
  }
89
90
  } catch (error) {
90
- console.warn('[ConfigLoader] Failed project detection, using global config:', error.message);
91
+ logger.warn('[ConfigLoader] Failed project detection, using global config:', error.message);
91
92
  }
92
93
 
93
94
  // Fallback to global config
94
95
  this.configPath = path.join(__dirname, '../config/chromedebug-config.json');
95
- console.log(`[ConfigLoader] Using global config: ${this.configPath}`);
96
+ logger.debug(`[ConfigLoader] Using global config: ${this.configPath}`);
96
97
  }
97
98
 
98
99
  // Load configuration from file
@@ -103,11 +104,11 @@ class ConfigLoader {
103
104
  if (fs.existsSync(this.configPath)) {
104
105
  const configData = fs.readFileSync(this.configPath, 'utf8');
105
106
  this.config = { ...DEFAULT_CONFIG, ...JSON.parse(configData) };
106
- console.log(`Configuration loaded from: ${this.configPath}`);
107
+ logger.debug(`Configuration loaded from: ${this.configPath}`);
107
108
  } else {
108
- console.log('No configuration file found, using defaults');
109
+ logger.debug('No configuration file found, using defaults');
109
110
  this.config = DEFAULT_CONFIG;
110
-
111
+
111
112
  // If we're in project mode and global config exists, copy it first
112
113
  if (this.isProjectLocalConfig() && this.hasGlobalConfig()) {
113
114
  this.copyGlobalConfigToProject();
@@ -116,8 +117,8 @@ class ConfigLoader {
116
117
  }
117
118
  }
118
119
  } catch (error) {
119
- console.warn(`Error loading configuration: ${error.message}`);
120
- console.log('Using default configuration');
120
+ logger.warn(`Error loading configuration: ${error.message}`);
121
+ logger.debug('Using default configuration');
121
122
  this.config = DEFAULT_CONFIG;
122
123
  }
123
124
 
@@ -153,10 +154,10 @@ class ConfigLoader {
153
154
  // Merge with defaults and write to project config
154
155
  this.config = { ...DEFAULT_CONFIG, ...globalConfig };
155
156
  fs.writeFileSync(this.configPath, JSON.stringify(this.config, null, 2));
156
-
157
- console.log(`[ConfigLoader] Copied global config to project: ${this.configPath}`);
157
+
158
+ logger.debug(`[ConfigLoader] Copied global config to project: ${this.configPath}`);
158
159
  } catch (error) {
159
- console.warn(`[ConfigLoader] Failed to copy global config: ${error.message}`);
160
+ logger.warn(`[ConfigLoader] Failed to copy global config: ${error.message}`);
160
161
  this.createDefaultConfigFile();
161
162
  }
162
163
  }
@@ -168,11 +169,11 @@ class ConfigLoader {
168
169
  if (!fs.existsSync(configDir)) {
169
170
  fs.mkdirSync(configDir, { recursive: true });
170
171
  }
171
-
172
+
172
173
  fs.writeFileSync(this.configPath, JSON.stringify(DEFAULT_CONFIG, null, 2));
173
- console.log(`Default configuration file created at: ${this.configPath}`);
174
+ logger.debug(`Default configuration file created at: ${this.configPath}`);
174
175
  } catch (error) {
175
- console.warn(`Could not create default configuration file: ${error.message}`);
176
+ logger.warn(`Could not create default configuration file: ${error.message}`);
176
177
  }
177
178
  }
178
179
 
@@ -266,10 +267,10 @@ class ConfigLoader {
266
267
  try {
267
268
  fs.writeFileSync(this.configPath, JSON.stringify(newConfig, null, 2));
268
269
  this.config = newConfig;
269
- console.log('Configuration updated successfully');
270
+ logger.debug('Configuration updated successfully');
270
271
  return true;
271
272
  } catch (error) {
272
- console.error(`Error updating configuration: ${error.message}`);
273
+ logger.error(`Error updating configuration: ${error.message}`);
273
274
  return false;
274
275
  }
275
276
  }