@dynamicu/chromedebug-mcp 2.3.0 → 2.4.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.
- package/README.md +50 -0
- package/chrome-extension/activation-manager.html +208 -0
- package/chrome-extension/activation-manager.js +187 -0
- package/chrome-extension/background.js +5 -5
- package/chrome-extension/firebase-client.js +135 -1
- package/chrome-extension/popup.js +68 -2
- package/dist/chromedebug-extension-free.zip +0 -0
- package/package.json +1 -1
- package/scripts/postinstall.js +13 -4
- package/scripts/webpack.config.free.cjs +3 -0
- package/scripts/webpack.config.pro.cjs +3 -0
- package/src/chrome-controller.js +107 -106
- package/src/config-loader.js +18 -17
- package/src/database.js +81 -80
- package/src/index.js +35 -24
- package/src/middleware/auth.js +30 -29
- package/src/port-discovery.js +7 -6
- package/src/services/failover-manager.js +19 -18
- package/src/services/project-manager.js +16 -15
- package/src/utils/logger.js +63 -0
package/src/config-loader.js
CHANGED
|
@@ -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
|
-
|
|
84
|
+
logger.debug(`[ConfigLoader] Using project-local config: ${projectConfigPath}`);
|
|
84
85
|
return;
|
|
85
86
|
} catch (error) {
|
|
86
|
-
|
|
87
|
+
logger.warn('[ConfigLoader] Project structure not ready, using global config:', error.message);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
} catch (error) {
|
|
90
|
-
|
|
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
|
-
|
|
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
|
-
|
|
107
|
+
logger.debug(`Configuration loaded from: ${this.configPath}`);
|
|
107
108
|
} else {
|
|
108
|
-
|
|
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
|
-
|
|
120
|
-
|
|
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
|
-
|
|
157
|
+
|
|
158
|
+
logger.debug(`[ConfigLoader] Copied global config to project: ${this.configPath}`);
|
|
158
159
|
} catch (error) {
|
|
159
|
-
|
|
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
|
-
|
|
174
|
+
logger.debug(`Default configuration file created at: ${this.configPath}`);
|
|
174
175
|
} catch (error) {
|
|
175
|
-
|
|
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
|
-
|
|
270
|
+
logger.debug('Configuration updated successfully');
|
|
270
271
|
return true;
|
|
271
272
|
} catch (error) {
|
|
272
|
-
|
|
273
|
+
logger.error(`Error updating configuration: ${error.message}`);
|
|
273
274
|
return false;
|
|
274
275
|
}
|
|
275
276
|
}
|