vibecodingmachine-core 2026.2.26-1739 → 2026.3.9-850
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/package.json +1 -1
- package/src/agents/AgentCheckDiscoveryService.js +180 -0
- package/src/agents/AgentCheckService.js +18 -261
- package/src/agents/AgentCheckStatisticsService.js +195 -0
- package/src/agents/EnvironmentConfigurationManager.js +31 -380
- package/src/agents/InstallationType.js +19 -6
- package/src/agents/SimpleAgentCheckService.js +472 -0
- package/src/agents/config-managers/ConfigUtils.js +72 -0
- package/src/agents/config-managers/DefaultConfig.js +58 -0
- package/src/agents/config-managers/EnvVarLoader.js +66 -0
- package/src/agents/config-managers/FileConfigLoader.js +124 -0
- package/src/agents/config-managers/TypeConverters.js +61 -0
- package/src/agents/config-managers/VariableMappings.js +92 -0
- package/src/agents/discovery/AgentDiscoveryService-refactored.js +272 -0
- package/src/agents/discovery/AgentDiscoveryService.js +29 -403
- package/src/agents/discovery/agent-validator.js +262 -0
- package/src/agents/discovery/discovery-results.js +176 -0
- package/src/agents/discovery/discovery-scanner.js +268 -0
- package/src/agents/discovery/discovery-utils.js +161 -0
- package/src/agents/discovery/executable-analyzer.js +290 -0
- package/src/agents/discovery/history-manager.js +310 -0
- package/src/agents/verification/ResultAnalyzer-refactored.js +341 -0
- package/src/agents/verification/ResultAnalyzer.js +30 -431
- package/src/agents/verification/analysis-utils.js +310 -0
- package/src/agents/verification/batch-analyzer.js +440 -0
- package/src/agents/verification/pattern-recognizer.js +369 -0
- package/src/agents/verification/report-generator.js +320 -0
- package/src/agents/verification/test-analyzer.js +290 -0
- package/src/agents/windows/InstallerFactory.js +4 -0
- package/src/agents/windows/VSCodeExtensionInstaller.js +404 -0
- package/src/analysis/analysis-engine.js +314 -0
- package/src/analysis/ast-analyzer.js +342 -0
- package/src/analysis/boundary-detector-refactored.js +378 -0
- package/src/analysis/boundary-detector.js +200 -603
- package/src/analysis/boundary-scanner.js +609 -0
- package/src/analysis/boundary-types.js +118 -0
- package/src/analysis/boundary-utils.js +293 -0
- package/src/analysis/deadline-priority-calculator.js +18 -0
- package/src/analysis/detection-methods.js +347 -0
- package/src/analysis/importance-priority-calculator.js +18 -0
- package/src/analysis/priority/factor-calculators.js +204 -0
- package/src/analysis/priority/factor-helpers.js +71 -0
- package/src/analysis/priority/priority-constants.js +73 -0
- package/src/analysis/priority/priority-factor-calculators.js +301 -0
- package/src/analysis/priority/reasons-generator.js +44 -0
- package/src/analysis/priority-calculator.js +15 -580
- package/src/analysis/strategy-generator.js +16 -66
- package/src/analysis/type-priority-calculator.js +18 -0
- package/src/analysis/urgency-priority-calculator.js +18 -0
- package/src/auto-mode/AutoModeBusinessLogic.js +2 -40
- package/src/commands/disable-requirement.js +60 -0
- package/src/commands/disable-spec.js +60 -0
- package/src/commands/enable-requirement.js +60 -0
- package/src/commands/enable-spec.js +60 -0
- package/src/commands/registry.js +1 -6
- package/src/commands/requirements.js +8 -2
- package/src/ide-integration/applescript-manager.cjs +9 -24
- package/src/ide-integration/cdp-handlers/chat-reader.js +44 -0
- package/src/ide-integration/cdp-handlers/connection-handler.js +88 -0
- package/src/ide-integration/cdp-handlers/continuation-handler.js +314 -0
- package/src/ide-integration/cdp-handlers/message-submitter.js +75 -0
- package/src/ide-integration/cdp-handlers/text-sender.js +138 -0
- package/src/ide-integration/cdp-manager.js +28 -573
- package/src/ide-integration/claude-code-cli-manager.cjs +48 -12
- package/src/ide-integration/ide-openers/claude-opener.js +171 -0
- package/src/ide-integration/ide-openers/cursor-opener.js +53 -0
- package/src/ide-integration/ide-openers/other-ides-opener.js +230 -0
- package/src/ide-integration/ide-openers/vscode-opener.js +147 -0
- package/src/ide-integration/macos-ide-manager.js +20 -582
- package/src/ide-integration/macos-quota-checker.js +164 -0
- package/src/ide-integration/macos-text-sender.js +19 -38
- package/src/ide-integration/provider-manager.cjs +52 -7
- package/src/index.cjs +6 -0
- package/src/index.js +10 -0
- package/src/llm/direct-llm-manager.cjs +501 -0
- package/src/localization/translations/en-part1.js +363 -0
- package/src/localization/translations/en-part2.js +320 -0
- package/src/localization/translations/en.js +4 -687
- package/src/localization/translations/es-part1.js +363 -0
- package/src/localization/translations/es-part2.js +320 -0
- package/src/localization/translations/es.js +4 -688
- package/src/models/file-analysis-collection.js +139 -0
- package/src/models/file-analysis-metrics.js +50 -0
- package/src/models/file-analysis.js +15 -262
- package/src/models/plan-manager.js +410 -0
- package/src/models/refactoring-models.js +380 -0
- package/src/models/refactoring-plan-refactored.js +81 -0
- package/src/models/refactoring-plan.js +2 -663
- package/src/monitoring/alert-system.js +4 -45
- package/src/monitoring/continuous-scan-notifications.js +37 -191
- package/src/monitoring/notification-handlers/base-handler.js +58 -0
- package/src/monitoring/notification-handlers/error-handler.js +36 -0
- package/src/monitoring/notification-handlers/index.js +21 -0
- package/src/monitoring/notification-handlers/new-violation-handler.js +91 -0
- package/src/monitoring/notification-handlers/progress-handler.js +48 -0
- package/src/monitoring/notification-handlers/resolved-violation-handler.js +54 -0
- package/src/monitoring/notification-handlers/threshold-handler.js +36 -0
- package/src/provider-registry.js +8 -0
- package/src/refactoring/boundary/boundary-detector-refactored.js +58 -0
- package/src/refactoring/boundary/boundary-detector.js +26 -596
- package/src/refactoring/boundary/detectors/boundary-analyzers.js +281 -0
- package/src/refactoring/boundary/detectors/boundary-core.js +167 -0
- package/src/refactoring/boundary/detectors/class-detector.js +247 -0
- package/src/refactoring/boundary/detectors/config-detector.js +270 -0
- package/src/refactoring/boundary/detectors/constant-detector.js +269 -0
- package/src/refactoring/boundary/detectors/function-detector.js +248 -0
- package/src/refactoring/boundary/detectors/module-detector.js +249 -0
- package/src/refactoring/boundary/detectors/object-detector.js +247 -0
- package/src/refactoring/boundary/detectors/type-detectors.js +338 -0
- package/src/refactoring/boundary/detectors/utility-detector.js +270 -0
- package/src/refactoring/circular-dependency-resolver-original.js +16 -76
- package/src/refactoring/code-mover-refactored.js +309 -0
- package/src/refactoring/code-mover.js +48 -355
- package/src/refactoring/execution-status.js +18 -0
- package/src/refactoring/execution-strategies.js +172 -0
- package/src/refactoring/file-splitter-core.js +568 -0
- package/src/refactoring/file-splitter-types.js +136 -0
- package/src/refactoring/file-splitter.js +2 -682
- package/src/refactoring/functionality-validator.js +11 -51
- package/src/refactoring/import-manager-refactored.js +385 -0
- package/src/refactoring/import-manager.js +112 -487
- package/src/refactoring/import-models.js +189 -0
- package/src/refactoring/import-parser.js +306 -0
- package/src/refactoring/move-executor.js +431 -0
- package/src/refactoring/move-utils.js +368 -0
- package/src/refactoring/operation-executor.js +76 -0
- package/src/refactoring/plan-creator.js +36 -0
- package/src/refactoring/plan-executor.js +143 -0
- package/src/refactoring/plan-validator.js +68 -0
- package/src/refactoring/refactoring-executor-result.js +70 -0
- package/src/refactoring/refactoring-executor.js +34 -569
- package/src/refactoring/refactoring-operation.js +94 -0
- package/src/refactoring/refactoring-plan.js +69 -0
- package/src/refactoring/refactoring-rollback.js +22 -527
- package/src/refactoring/rollback-handlers/RollbackExecutor.js +107 -0
- package/src/refactoring/rollback-handlers/RollbackManager.js +265 -0
- package/src/refactoring/rollback-handlers/RollbackOperation.js +105 -0
- package/src/refactoring/rollback-handlers/RollbackResult.js +109 -0
- package/src/refactoring/rollback-handlers/RollbackStatistics.js +77 -0
- package/src/refactoring/test-validator.js +32 -448
- package/src/refactoring/validation/baseline-runner.js +71 -0
- package/src/refactoring/validation/report-generator.js +136 -0
- package/src/refactoring/validation/result-comparator.js +92 -0
- package/src/refactoring/validation/test-suite.js +59 -0
- package/src/refactoring/validation/test-validation-result.js +83 -0
- package/src/refactoring/validation/validation-runner.js +95 -0
- package/src/refactoring/validation/validation-status.js +18 -0
- package/src/rui/commands/AgentCommandParser.js +60 -369
- package/src/rui/commands/AgentResponseFormatter.js +7 -47
- package/src/rui/commands/parsers/CommandMapper.js +148 -0
- package/src/rui/commands/parsers/CommandValidator.js +228 -0
- package/src/rui/commands/parsers/ComponentExtractor.js +100 -0
- package/src/rui/commands/parsers/TokenParser.js +69 -0
- package/src/rui/commands/parsers/tokenizer.js +153 -0
- package/src/utils/current-requirement-operations.js +50 -1
- package/src/utils/report-generator.js +18 -514
- package/src/utils/report-generators/analysis-generator.js +115 -0
- package/src/utils/report-generators/base-generator.js +141 -0
- package/src/utils/report-generators/compliance-generator.js +41 -0
- package/src/utils/report-generators/format-handlers.js +185 -0
- package/src/utils/report-generators/refactoring-generator.js +46 -0
- package/src/utils/report-generators/validation-generator.js +63 -0
- package/src/utils/requirement-enable-disable.js +265 -0
- package/src/utils/requirement-helpers/requirement-file-ops.js +69 -1
- package/src/utils/requirement-helpers/requirement-mover.js +88 -1
- package/src/utils/requirement-helpers.js +5 -2
- package/src/utils/smoke-test-cli.js +45 -8
- package/src/utils/specification-enable-disable.js +122 -0
- package/src/utils/specification-helpers.js +30 -4
- package/src/utils/specification-migration.js +5 -5
- package/src/utils/test-comparator.js +118 -0
- package/src/utils/test-config.js +54 -0
- package/src/utils/test-executor.js +133 -0
- package/src/utils/test-parser.js +215 -0
- package/src/utils/test-runner-baseline.js +63 -0
- package/src/utils/test-runner-core.js +98 -0
- package/src/utils/test-runner-report.js +39 -0
- package/src/utils/test-runner-validation.js +71 -0
- package/src/utils/test-runner.js +11 -535
- package/src/validation/comparison-analyzer.js +333 -0
- package/src/validation/compliance-reporter-new.js +282 -0
- package/src/validation/compliance-reporter-refactored.js +344 -0
- package/src/validation/compliance-reporter.js +278 -591
- package/src/validation/compliance-utils.js +278 -0
- package/src/validation/html-generator.js +446 -0
- package/src/validation/metrics/category-calculator.js +137 -0
- package/src/validation/metrics/metrics-helpers.js +155 -0
- package/src/validation/metrics/overview-calculator.js +85 -0
- package/src/validation/metrics/overview-metrics.js +41 -0
- package/src/validation/metrics/quality-calculator.js +166 -0
- package/src/validation/metrics/size-calculator.js +69 -0
- package/src/validation/metrics-calculator.js +27 -551
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
const fs = require('fs').promises;
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const os = require('os');
|
|
11
|
+
const { getDefaultVariableMappings, getVariableDescriptions } = require('./config-managers/VariableMappings');
|
|
12
|
+
const { getTypeConverters, getVariableType } = require('./config-managers/TypeConverters');
|
|
13
|
+
const { getDefaultConfig } = require('./config-managers/DefaultConfig');
|
|
14
|
+
const { setNestedValue, getNestedValue, deepMerge } = require('./config-managers/ConfigUtils');
|
|
15
|
+
const { loadOverrideFile, loadConfigFile, saveConfigFile } = require('./config-managers/FileConfigLoader');
|
|
16
|
+
const { loadEnvironmentVariables, exportToEnvironmentVariables } = require('./config-managers/EnvVarLoader');
|
|
11
17
|
|
|
12
18
|
/**
|
|
13
19
|
* Environment Configuration Manager class
|
|
@@ -24,122 +30,10 @@ class EnvironmentConfigurationManager {
|
|
|
24
30
|
this.overrideFile = options.overrideFile || path.join(os.homedir(), '.vibecodingmachine', 'env.json');
|
|
25
31
|
this.caseSensitive = options.caseSensitive !== false; // Default to case sensitive
|
|
26
32
|
|
|
27
|
-
//
|
|
28
|
-
this.variableMappings =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'MAX_CONCURRENT_INSTALLATIONS': 'installation.maxConcurrent',
|
|
32
|
-
'RETRY_ATTEMPTS': 'installation.retryAttempts',
|
|
33
|
-
'RETRY_DELAY': 'installation.retryDelay',
|
|
34
|
-
'AUTO_ELEVATE': 'installation.autoElevate',
|
|
35
|
-
|
|
36
|
-
// Logging settings
|
|
37
|
-
'LOG_LEVEL': 'logging.level',
|
|
38
|
-
'LOG_FILE': 'logging.file',
|
|
39
|
-
'LOG_FORMAT': 'logging.format',
|
|
40
|
-
'VERBOSE_LOGGING': 'logging.verbose',
|
|
41
|
-
|
|
42
|
-
// Cache settings
|
|
43
|
-
'CACHE_DIR': 'cache.directory',
|
|
44
|
-
'CACHE_SIZE': 'cache.maxSize',
|
|
45
|
-
'CACHE_TTL': 'cache.ttl',
|
|
46
|
-
|
|
47
|
-
// Network settings
|
|
48
|
-
'HTTP_TIMEOUT': 'network.timeout',
|
|
49
|
-
'HTTP_PROXY': 'network.proxy',
|
|
50
|
-
'HTTP_USER_AGENT': 'network.userAgent',
|
|
51
|
-
'RATE_LIMIT_DELAY': 'network.rateLimitDelay',
|
|
52
|
-
|
|
53
|
-
// Security settings
|
|
54
|
-
'SECURITY_STRICT_MODE': 'security.strictMode',
|
|
55
|
-
'SECURITY_MAX_FILE_SIZE': 'security.maxFileSize',
|
|
56
|
-
'SECURITY_ALLOWED_EXTENSIONS': 'security.allowedExtensions',
|
|
57
|
-
|
|
58
|
-
// Performance settings
|
|
59
|
-
'PERFORMANCE_MONITORING': 'performance.monitoring',
|
|
60
|
-
'PERFORMANCE_METRICS_FILE': 'performance.metricsFile',
|
|
61
|
-
'PERFORMANCE_FLUSH_INTERVAL': 'performance.flushInterval',
|
|
62
|
-
|
|
63
|
-
// Agent settings
|
|
64
|
-
'DEFAULT_AGENTS_FILE': 'agents.defaultFile',
|
|
65
|
-
'AGENT_DISCOVERY_ENABLED': 'agents.discoveryEnabled',
|
|
66
|
-
'AGENT_AUTO_UPDATE': 'agents.autoUpdate'
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// Type conversion functions
|
|
70
|
-
this.typeConverters = {
|
|
71
|
-
'boolean': (value) => {
|
|
72
|
-
if (typeof value === 'boolean') return value;
|
|
73
|
-
const str = String(value).toLowerCase();
|
|
74
|
-
return str === 'true' || str === '1' || str === 'yes' || str === 'on';
|
|
75
|
-
},
|
|
76
|
-
'number': (value) => {
|
|
77
|
-
const num = Number(value);
|
|
78
|
-
return isNaN(num) ? 0 : num;
|
|
79
|
-
},
|
|
80
|
-
'string': (value) => String(value),
|
|
81
|
-
'array': (value) => {
|
|
82
|
-
if (Array.isArray(value)) return value;
|
|
83
|
-
const str = String(value);
|
|
84
|
-
try {
|
|
85
|
-
return JSON.parse(str);
|
|
86
|
-
} catch {
|
|
87
|
-
return str.split(',').map(s => s.trim()).filter(s => s);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
'object': (value) => {
|
|
91
|
-
if (typeof value === 'object' && value !== null) return value;
|
|
92
|
-
const str = String(value);
|
|
93
|
-
try {
|
|
94
|
-
return JSON.parse(str);
|
|
95
|
-
} catch {
|
|
96
|
-
return {};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// Default configuration schema
|
|
102
|
-
this.defaultConfig = {
|
|
103
|
-
installation: {
|
|
104
|
-
timeout: 300000,
|
|
105
|
-
maxConcurrent: 2,
|
|
106
|
-
retryAttempts: 3,
|
|
107
|
-
retryDelay: 5000,
|
|
108
|
-
autoElevate: false
|
|
109
|
-
},
|
|
110
|
-
logging: {
|
|
111
|
-
level: 'info',
|
|
112
|
-
file: null,
|
|
113
|
-
format: 'json',
|
|
114
|
-
verbose: false
|
|
115
|
-
},
|
|
116
|
-
cache: {
|
|
117
|
-
directory: './cache',
|
|
118
|
-
maxSize: 100 * 1024 * 1024, // 100MB
|
|
119
|
-
ttl: 3600000 // 1 hour
|
|
120
|
-
},
|
|
121
|
-
network: {
|
|
122
|
-
timeout: 30000,
|
|
123
|
-
proxy: null,
|
|
124
|
-
userAgent: null,
|
|
125
|
-
rateLimitDelay: 1000
|
|
126
|
-
},
|
|
127
|
-
security: {
|
|
128
|
-
strictMode: true,
|
|
129
|
-
maxFileSize: 100 * 1024 * 1024, // 100MB
|
|
130
|
-
allowedExtensions: ['.exe', '.msi', '.zip', '.tar', '.gz']
|
|
131
|
-
},
|
|
132
|
-
performance: {
|
|
133
|
-
monitoring: true,
|
|
134
|
-
metricsFile: null,
|
|
135
|
-
flushInterval: 60000
|
|
136
|
-
},
|
|
137
|
-
agents: {
|
|
138
|
-
defaultFile: './config/agents.json',
|
|
139
|
-
discoveryEnabled: true,
|
|
140
|
-
autoUpdate: false
|
|
141
|
-
}
|
|
142
|
-
};
|
|
33
|
+
// Load configuration modules
|
|
34
|
+
this.variableMappings = getDefaultVariableMappings();
|
|
35
|
+
this.typeConverters = getTypeConverters();
|
|
36
|
+
this.defaultConfig = getDefaultConfig();
|
|
143
37
|
}
|
|
144
38
|
|
|
145
39
|
/**
|
|
@@ -151,17 +45,17 @@ class EnvironmentConfigurationManager {
|
|
|
151
45
|
|
|
152
46
|
try {
|
|
153
47
|
// Load from override file first
|
|
154
|
-
const overrideConfig = await this.
|
|
155
|
-
|
|
48
|
+
const overrideConfig = await loadOverrideFile(this.overrideFile, this.logger);
|
|
49
|
+
deepMerge(config, overrideConfig);
|
|
156
50
|
|
|
157
51
|
// Load from environment variables
|
|
158
|
-
const envConfig = this.
|
|
159
|
-
|
|
52
|
+
const envConfig = loadEnvironmentVariables(this.variableMappings, this.prefix, this.logger);
|
|
53
|
+
deepMerge(config, envConfig);
|
|
160
54
|
|
|
161
55
|
// Load from specified config file
|
|
162
56
|
if (this.configFile) {
|
|
163
|
-
const fileConfig = await
|
|
164
|
-
|
|
57
|
+
const fileConfig = await loadConfigFile(this.configFile, this.logger);
|
|
58
|
+
deepMerge(config, fileConfig);
|
|
165
59
|
}
|
|
166
60
|
|
|
167
61
|
if (this.logger) {
|
|
@@ -183,135 +77,13 @@ class EnvironmentConfigurationManager {
|
|
|
183
77
|
return config;
|
|
184
78
|
}
|
|
185
79
|
|
|
186
|
-
/**
|
|
187
|
-
* Load configuration from override file
|
|
188
|
-
* @returns {Promise<Object>} - Override configuration
|
|
189
|
-
*/
|
|
190
|
-
async loadOverrideFile() {
|
|
191
|
-
try {
|
|
192
|
-
const exists = await fs.access(this.overrideFile).then(() => true).catch(() => false);
|
|
193
|
-
if (!exists) return {};
|
|
194
|
-
|
|
195
|
-
const content = await fs.readFile(this.overrideFile, 'utf8');
|
|
196
|
-
const config = JSON.parse(content);
|
|
197
|
-
|
|
198
|
-
if (this.logger) {
|
|
199
|
-
this.logger.debug('Loaded override file configuration', {
|
|
200
|
-
file: this.overrideFile,
|
|
201
|
-
keys: Object.keys(config)
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return config;
|
|
206
|
-
} catch (error) {
|
|
207
|
-
if (this.logger) {
|
|
208
|
-
this.logger.warn('Failed to load override file', {
|
|
209
|
-
file: this.overrideFile,
|
|
210
|
-
error: error.message
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
return {};
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Load configuration from environment variables
|
|
219
|
-
* @returns {Object} - Environment configuration
|
|
220
|
-
*/
|
|
221
|
-
loadEnvironmentVariables() {
|
|
222
|
-
const config = {};
|
|
223
|
-
|
|
224
|
-
for (const [envVar, configPath] of Object.entries(this.variableMappings)) {
|
|
225
|
-
const fullEnvVar = this.prefix + envVar;
|
|
226
|
-
const value = process.env[fullEnvVar];
|
|
227
|
-
|
|
228
|
-
if (value !== undefined) {
|
|
229
|
-
this.setNestedValue(config, configPath, value);
|
|
230
|
-
|
|
231
|
-
if (this.logger) {
|
|
232
|
-
this.logger.debug('Loaded environment variable', {
|
|
233
|
-
variable: fullEnvVar,
|
|
234
|
-
configPath,
|
|
235
|
-
value
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return config;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Load configuration from file
|
|
246
|
-
* @param {string} filePath - Path to config file
|
|
247
|
-
* @returns {Promise<Object>} - File configuration
|
|
248
|
-
*/
|
|
249
|
-
async loadConfigFile(filePath) {
|
|
250
|
-
try {
|
|
251
|
-
const content = await fs.readFile(filePath, 'utf8');
|
|
252
|
-
const config = JSON.parse(content);
|
|
253
|
-
|
|
254
|
-
if (this.logger) {
|
|
255
|
-
this.logger.debug('Loaded config file', {
|
|
256
|
-
file: filePath,
|
|
257
|
-
keys: Object.keys(config)
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return config;
|
|
262
|
-
} catch (error) {
|
|
263
|
-
if (this.logger) {
|
|
264
|
-
this.logger.warn('Failed to load config file', {
|
|
265
|
-
file: filePath,
|
|
266
|
-
error: error.message
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
return {};
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
80
|
/**
|
|
274
81
|
* Save configuration to override file
|
|
275
82
|
* @param {Object} config - Configuration to save
|
|
276
83
|
* @returns {Promise<Object>} - Save result
|
|
277
84
|
*/
|
|
278
85
|
async saveConfiguration(config) {
|
|
279
|
-
|
|
280
|
-
success: false,
|
|
281
|
-
error: null,
|
|
282
|
-
filePath: this.overrideFile
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
try {
|
|
286
|
-
// Ensure directory exists
|
|
287
|
-
const dir = path.dirname(this.overrideFile);
|
|
288
|
-
await fs.mkdir(dir, { recursive: true });
|
|
289
|
-
|
|
290
|
-
// Save configuration
|
|
291
|
-
const content = JSON.stringify(config, null, 2);
|
|
292
|
-
await fs.writeFile(this.overrideFile, content, 'utf8');
|
|
293
|
-
|
|
294
|
-
result.success = true;
|
|
295
|
-
|
|
296
|
-
if (this.logger) {
|
|
297
|
-
this.logger.info('Configuration saved successfully', {
|
|
298
|
-
file: this.overrideFile,
|
|
299
|
-
keys: Object.keys(config)
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
} catch (error) {
|
|
304
|
-
result.error = error.message;
|
|
305
|
-
|
|
306
|
-
if (this.logger) {
|
|
307
|
-
this.logger.error('Failed to save configuration', {
|
|
308
|
-
file: this.overrideFile,
|
|
309
|
-
error: error.message
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return result;
|
|
86
|
+
return await saveConfigFile(this.overrideFile, config, this.logger);
|
|
315
87
|
}
|
|
316
88
|
|
|
317
89
|
/**
|
|
@@ -331,14 +103,14 @@ class EnvironmentConfigurationManager {
|
|
|
331
103
|
try {
|
|
332
104
|
// Load current configuration
|
|
333
105
|
const config = await this.loadConfiguration();
|
|
334
|
-
result.previousValue =
|
|
106
|
+
result.previousValue = getNestedValue(config, key);
|
|
335
107
|
|
|
336
108
|
// Convert value type
|
|
337
109
|
const convertedValue = this.typeConverters[type] ?
|
|
338
110
|
this.typeConverters[type](value) : value;
|
|
339
111
|
|
|
340
112
|
// Set new value
|
|
341
|
-
|
|
113
|
+
setNestedValue(config, key, convertedValue);
|
|
342
114
|
|
|
343
115
|
// Save configuration
|
|
344
116
|
const saveResult = await this.saveConfiguration(config);
|
|
@@ -378,7 +150,7 @@ class EnvironmentConfigurationManager {
|
|
|
378
150
|
async getConfigurationValue(key, defaultValue = null) {
|
|
379
151
|
try {
|
|
380
152
|
const config = await this.loadConfiguration();
|
|
381
|
-
const value =
|
|
153
|
+
const value = getNestedValue(config, key);
|
|
382
154
|
return value !== undefined ? value : defaultValue;
|
|
383
155
|
} catch (error) {
|
|
384
156
|
if (this.logger) {
|
|
@@ -391,148 +163,29 @@ class EnvironmentConfigurationManager {
|
|
|
391
163
|
}
|
|
392
164
|
}
|
|
393
165
|
|
|
394
|
-
/**
|
|
395
|
-
* Set nested configuration value
|
|
396
|
-
* @param {Object} obj - Target object
|
|
397
|
-
* @param {string} path - Dot-separated path
|
|
398
|
-
* @param {*} value - Value to set
|
|
399
|
-
*/
|
|
400
|
-
setNestedValue(obj, path, value) {
|
|
401
|
-
const keys = path.split('.');
|
|
402
|
-
let current = obj;
|
|
403
|
-
|
|
404
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
405
|
-
const key = keys[i];
|
|
406
|
-
if (!(key in current) || typeof current[key] !== 'object') {
|
|
407
|
-
current[key] = {};
|
|
408
|
-
}
|
|
409
|
-
current = current[key];
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
current[keys[keys.length - 1]] = value;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Get nested configuration value
|
|
417
|
-
* @param {Object} obj - Source object
|
|
418
|
-
* @param {string} path - Dot-separated path
|
|
419
|
-
* @returns {*} - Configuration value
|
|
420
|
-
*/
|
|
421
|
-
getNestedValue(obj, path) {
|
|
422
|
-
const keys = path.split('.');
|
|
423
|
-
let current = obj;
|
|
424
|
-
|
|
425
|
-
for (const key of keys) {
|
|
426
|
-
if (current && typeof current === 'object' && key in current) {
|
|
427
|
-
current = current[key];
|
|
428
|
-
} else {
|
|
429
|
-
return undefined;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
return current;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Merge configuration objects
|
|
438
|
-
* @param {Object} target - Target object
|
|
439
|
-
* @param {Object} source - Source object
|
|
440
|
-
*/
|
|
441
|
-
mergeConfig(target, source) {
|
|
442
|
-
this.deepMerge(target, source);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Deep merge objects
|
|
447
|
-
* @param {Object} target - Target object
|
|
448
|
-
* @param {Object} source - Source object
|
|
449
|
-
*/
|
|
450
|
-
deepMerge(target, source) {
|
|
451
|
-
for (const key in source) {
|
|
452
|
-
if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {
|
|
453
|
-
if (!target[key] || typeof target[key] !== 'object') {
|
|
454
|
-
target[key] = {};
|
|
455
|
-
}
|
|
456
|
-
this.deepMerge(target[key], source[key]);
|
|
457
|
-
} else {
|
|
458
|
-
target[key] = source[key];
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
166
|
/**
|
|
464
167
|
* Get environment variable documentation
|
|
465
168
|
* @returns {Object} - Environment variable documentation
|
|
466
169
|
*/
|
|
467
170
|
getEnvironmentVariableDocumentation() {
|
|
468
171
|
const docs = {};
|
|
172
|
+
const descriptions = getVariableDescriptions();
|
|
469
173
|
|
|
470
174
|
for (const [envVar, configPath] of Object.entries(this.variableMappings)) {
|
|
471
175
|
const fullEnvVar = this.prefix + envVar;
|
|
472
|
-
const defaultValue =
|
|
176
|
+
const defaultValue = getNestedValue(this.defaultConfig, configPath);
|
|
473
177
|
|
|
474
178
|
docs[fullEnvVar] = {
|
|
475
179
|
configPath,
|
|
476
|
-
description:
|
|
180
|
+
description: descriptions[envVar] || 'Configuration variable',
|
|
477
181
|
defaultValue,
|
|
478
|
-
type:
|
|
182
|
+
type: getVariableType(defaultValue)
|
|
479
183
|
};
|
|
480
184
|
}
|
|
481
185
|
|
|
482
186
|
return docs;
|
|
483
187
|
}
|
|
484
188
|
|
|
485
|
-
/**
|
|
486
|
-
* Get variable description
|
|
487
|
-
* @param {string} envVar - Environment variable name
|
|
488
|
-
* @returns {string} - Description
|
|
489
|
-
*/
|
|
490
|
-
getVariableDescription(envVar) {
|
|
491
|
-
const descriptions = {
|
|
492
|
-
'INSTALL_TIMEOUT': 'Installation timeout in milliseconds',
|
|
493
|
-
'MAX_CONCURRENT_INSTALLATIONS': 'Maximum concurrent installations',
|
|
494
|
-
'RETRY_ATTEMPTS': 'Number of retry attempts for failed operations',
|
|
495
|
-
'RETRY_DELAY': 'Delay between retry attempts in milliseconds',
|
|
496
|
-
'AUTO_ELEVATE': 'Automatically request administrator privileges',
|
|
497
|
-
'LOG_LEVEL': 'Logging level (error, warn, info, debug)',
|
|
498
|
-
'LOG_FILE': 'Path to log file',
|
|
499
|
-
'LOG_FORMAT': 'Log format (json, text)',
|
|
500
|
-
'VERBOSE_LOGGING': 'Enable verbose logging',
|
|
501
|
-
'CACHE_DIR': 'Cache directory path',
|
|
502
|
-
'CACHE_SIZE': 'Maximum cache size in bytes',
|
|
503
|
-
'CACHE_TTL': 'Cache time-to-live in milliseconds',
|
|
504
|
-
'HTTP_TIMEOUT': 'HTTP request timeout in milliseconds',
|
|
505
|
-
'HTTP_PROXY': 'HTTP proxy URL',
|
|
506
|
-
'HTTP_USER_AGENT': 'HTTP user agent string',
|
|
507
|
-
'RATE_LIMIT_DELAY': 'Delay for rate limiting in milliseconds',
|
|
508
|
-
'SECURITY_STRICT_MODE': 'Enable strict security mode',
|
|
509
|
-
'SECURITY_MAX_FILE_SIZE': 'Maximum allowed file size in bytes',
|
|
510
|
-
'SECURITY_ALLOWED_EXTENSIONS': 'Comma-separated list of allowed file extensions',
|
|
511
|
-
'PERFORMANCE_MONITORING': 'Enable performance monitoring',
|
|
512
|
-
'PERFORMANCE_METRICS_FILE': 'Path to performance metrics file',
|
|
513
|
-
'PERFORMANCE_FLUSH_INTERVAL': 'Performance metrics flush interval in milliseconds',
|
|
514
|
-
'DEFAULT_AGENTS_FILE': 'Path to default agents configuration file',
|
|
515
|
-
'AGENT_DISCOVERY_ENABLED': 'Enable automatic agent discovery',
|
|
516
|
-
'AGENT_AUTO_UPDATE': 'Enable automatic agent updates'
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
return descriptions[envVar] || 'Configuration variable';
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Get variable type
|
|
524
|
-
* @param {string} configPath - Configuration path
|
|
525
|
-
* @param {*} defaultValue - Default value
|
|
526
|
-
* @returns {string} - Variable type
|
|
527
|
-
*/
|
|
528
|
-
getVariableType(configPath, defaultValue) {
|
|
529
|
-
if (typeof defaultValue === 'boolean') return 'boolean';
|
|
530
|
-
if (typeof defaultValue === 'number') return 'number';
|
|
531
|
-
if (Array.isArray(defaultValue)) return 'array';
|
|
532
|
-
if (typeof defaultValue === 'object' && defaultValue !== null) return 'object';
|
|
533
|
-
return 'string';
|
|
534
|
-
}
|
|
535
|
-
|
|
536
189
|
/**
|
|
537
190
|
* Export configuration to environment file
|
|
538
191
|
* @param {string} filePath - Export file path
|
|
@@ -547,15 +200,13 @@ class EnvironmentConfigurationManager {
|
|
|
547
200
|
|
|
548
201
|
try {
|
|
549
202
|
const config = await this.loadConfiguration();
|
|
550
|
-
const envVars =
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
}
|
|
203
|
+
const envVars = exportToEnvironmentVariables(
|
|
204
|
+
config,
|
|
205
|
+
this.defaultConfig,
|
|
206
|
+
this.variableMappings,
|
|
207
|
+
this.prefix,
|
|
208
|
+
getNestedValue
|
|
209
|
+
);
|
|
559
210
|
|
|
560
211
|
const content = envVars.join('\n');
|
|
561
212
|
await fs.writeFile(filePath, content, 'utf8');
|
|
@@ -32,7 +32,10 @@ const InstallationType = {
|
|
|
32
32
|
POWERSHELL: 'POWERSHELL',
|
|
33
33
|
|
|
34
34
|
// Chocolatey Package Manager (community)
|
|
35
|
-
CHOCOLATEY: 'CHOCOLATEY'
|
|
35
|
+
CHOCOLATEY: 'CHOCOLATEY',
|
|
36
|
+
|
|
37
|
+
// VS Code Extension
|
|
38
|
+
VSCODE_EXTENSION: 'VSCODE_EXTENSION'
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -50,7 +53,7 @@ function isNativeWindows(type) {
|
|
|
50
53
|
* @returns {boolean}
|
|
51
54
|
*/
|
|
52
55
|
function requiresExternalDependency(type) {
|
|
53
|
-
return [InstallationType.NPM, InstallationType.YARN, InstallationType.CHOCOLATEY, InstallationType.HOMEBREW, InstallationType.GO].includes(type);
|
|
56
|
+
return [InstallationType.NPM, InstallationType.YARN, InstallationType.CHOCOLATEY, InstallationType.HOMEBREW, InstallationType.GO, InstallationType.VSCODE_EXTENSION].includes(type);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
/**
|
|
@@ -59,7 +62,7 @@ function requiresExternalDependency(type) {
|
|
|
59
62
|
* @returns {boolean}
|
|
60
63
|
*/
|
|
61
64
|
function supportsAutoUpdate(type) {
|
|
62
|
-
return [InstallationType.WINGET, InstallationType.NPM, InstallationType.YARN, InstallationType.CHOCOLATEY, InstallationType.HOMEBREW].includes(type);
|
|
65
|
+
return [InstallationType.WINGET, InstallationType.NPM, InstallationType.YARN, InstallationType.CHOCOLATEY, InstallationType.HOMEBREW, InstallationType.VSCODE_EXTENSION].includes(type);
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
/**
|
|
@@ -80,6 +83,7 @@ function getTypePriority(type) {
|
|
|
80
83
|
const priorities = {
|
|
81
84
|
[InstallationType.WINGET]: 1, // Native Windows, official support
|
|
82
85
|
[InstallationType.POWERSHELL]: 2, // Vendor-specific official method
|
|
86
|
+
[InstallationType.VSCODE_EXTENSION]: 2, // VS Code extension, official method
|
|
83
87
|
[InstallationType.NPM]: 3, // Cross-platform, widely used
|
|
84
88
|
[InstallationType.YARN]: 3, // Cross-platform, widely used
|
|
85
89
|
[InstallationType.HOMEBREW]: 3, // Cross-platform, widely used
|
|
@@ -104,7 +108,8 @@ function getTypeDescription(type) {
|
|
|
104
108
|
[InstallationType.GO]: 'Go installation (cross-platform)',
|
|
105
109
|
[InstallationType.POWERSHELL]: 'PowerShell script (vendor-specific)',
|
|
106
110
|
[InstallationType.CHOCOLATEY]: 'Chocolatey Package Manager (community)',
|
|
107
|
-
[InstallationType.DIRECT]: 'Direct installation script (curl/wget)'
|
|
111
|
+
[InstallationType.DIRECT]: 'Direct installation script (curl/wget)',
|
|
112
|
+
[InstallationType.VSCODE_EXTENSION]: 'VS Code Extension (cross-platform)'
|
|
108
113
|
};
|
|
109
114
|
|
|
110
115
|
return descriptions[type] || 'Unknown installation type';
|
|
@@ -152,7 +157,8 @@ function isAvailableOnPlatform(type) {
|
|
|
152
157
|
InstallationType.YARN,
|
|
153
158
|
InstallationType.DIRECT,
|
|
154
159
|
InstallationType.HOMEBREW,
|
|
155
|
-
InstallationType.GO
|
|
160
|
+
InstallationType.GO,
|
|
161
|
+
InstallationType.VSCODE_EXTENSION
|
|
156
162
|
];
|
|
157
163
|
return crossPlatformTypes.includes(type);
|
|
158
164
|
}
|
|
@@ -171,7 +177,8 @@ function getSystemRequirements(type) {
|
|
|
171
177
|
[InstallationType.GO]: ['go'],
|
|
172
178
|
[InstallationType.POWERSHELL]: ['windows', 'powershell'],
|
|
173
179
|
[InstallationType.CHOCOLATEY]: ['windows'],
|
|
174
|
-
[InstallationType.DIRECT]: ['curl', 'bash']
|
|
180
|
+
[InstallationType.DIRECT]: ['curl', 'bash'],
|
|
181
|
+
[InstallationType.VSCODE_EXTENSION]: ['vscode']
|
|
175
182
|
};
|
|
176
183
|
|
|
177
184
|
return requirements[type] || [];
|
|
@@ -231,6 +238,12 @@ function getCommandTemplates(type) {
|
|
|
231
238
|
uninstall: 'Remove via vendor-specific method',
|
|
232
239
|
upgrade: 'Re-run installation script',
|
|
233
240
|
info: 'Check vendor documentation'
|
|
241
|
+
},
|
|
242
|
+
[InstallationType.VSCODE_EXTENSION]: {
|
|
243
|
+
install: 'code --install-extension {extensionId}',
|
|
244
|
+
uninstall: 'code --uninstall-extension {extensionId}',
|
|
245
|
+
upgrade: 'code --install-extension {extensionId}',
|
|
246
|
+
info: 'code --list-extensions | grep {extensionId}'
|
|
234
247
|
}
|
|
235
248
|
};
|
|
236
249
|
|