vibecodingmachine-core 2026.2.20-438 → 2026.2.26-1739
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 +240 -0
- package/package.json +10 -2
- package/src/agents/Agent.js +300 -0
- package/src/agents/AgentAdditionService.js +311 -0
- package/src/agents/AgentCheckService.js +690 -0
- package/src/agents/AgentInstallationService.js +140 -0
- package/src/agents/AgentSetupService.js +467 -0
- package/src/agents/AgentStatus.js +183 -0
- package/src/agents/AgentVerificationService.js +634 -0
- package/src/agents/ConfigurationSchemaValidator.js +543 -0
- package/src/agents/EnvironmentConfigurationManager.js +602 -0
- package/src/agents/InstallationErrorHandler.js +372 -0
- package/src/agents/InstallationLog.js +363 -0
- package/src/agents/InstallationMethod.js +510 -0
- package/src/agents/InstallationOrchestrator.js +352 -0
- package/src/agents/InstallationProgressReporter.js +372 -0
- package/src/agents/InstallationRetryManager.js +322 -0
- package/src/agents/InstallationType.js +254 -0
- package/src/agents/OperationTypes.js +310 -0
- package/src/agents/PerformanceMetricsCollector.js +493 -0
- package/src/agents/SecurityValidationService.js +534 -0
- package/src/agents/VerificationTest.js +354 -0
- package/src/agents/VerificationType.js +226 -0
- package/src/agents/WindowsPermissionHandler.js +518 -0
- package/src/agents/config/AgentConfigManager.js +393 -0
- package/src/agents/config/AgentDefaultsRegistry.js +373 -0
- package/src/agents/config/ConfigValidator.js +281 -0
- package/src/agents/discovery/AgentDiscoveryService.js +707 -0
- package/src/agents/logging/AgentLogger.js +511 -0
- package/src/agents/status/AgentStatusManager.js +481 -0
- package/src/agents/storage/FileManager.js +454 -0
- package/src/agents/verification/AgentCommunicationTester.js +474 -0
- package/src/agents/verification/BaseVerifier.js +430 -0
- package/src/agents/verification/CommandVerifier.js +480 -0
- package/src/agents/verification/FileOperationVerifier.js +453 -0
- package/src/agents/verification/ResultAnalyzer.js +707 -0
- package/src/agents/verification/TestRequirementManager.js +495 -0
- package/src/agents/verification/VerificationRunner.js +433 -0
- package/src/agents/windows/BaseWindowsInstaller.js +441 -0
- package/src/agents/windows/ChocolateyInstaller.js +509 -0
- package/src/agents/windows/DirectInstaller.js +443 -0
- package/src/agents/windows/InstallerFactory.js +391 -0
- package/src/agents/windows/NpmInstaller.js +505 -0
- package/src/agents/windows/PowerShellInstaller.js +458 -0
- package/src/agents/windows/WinGetInstaller.js +390 -0
- package/src/analysis/analysis-reporter.js +132 -0
- package/src/analysis/boundary-detector.js +712 -0
- package/src/analysis/categorizer.js +340 -0
- package/src/analysis/codebase-scanner.js +384 -0
- package/src/analysis/line-counter.js +513 -0
- package/src/analysis/priority-calculator.js +679 -0
- package/src/analysis/report/analysis-report.js +250 -0
- package/src/analysis/report/package-analyzer.js +278 -0
- package/src/analysis/report/recommendation-generator.js +382 -0
- package/src/analysis/report/statistics-generator.js +515 -0
- package/src/analysis/reports/analysis-report-model.js +101 -0
- package/src/analysis/reports/recommendation-generator.js +283 -0
- package/src/analysis/reports/report-generators.js +191 -0
- package/src/analysis/reports/statistics-calculator.js +231 -0
- package/src/analysis/reports/trend-analyzer.js +219 -0
- package/src/analysis/strategy-generator.js +814 -0
- package/src/auto-mode/AutoModeBusinessLogic.js +836 -0
- package/src/config/refactoring-config.js +307 -0
- package/src/health-tracking/json-storage.js +38 -2
- package/src/ide-integration/applescript-manager-core.js +233 -0
- package/src/ide-integration/applescript-manager.cjs +357 -28
- package/src/ide-integration/applescript-manager.js +89 -3599
- package/src/ide-integration/cdp-manager.js +306 -0
- package/src/ide-integration/claude-code-cli-manager.cjs +1 -1
- package/src/ide-integration/continuation-handler.js +337 -0
- package/src/ide-integration/ide-status-checker.js +292 -0
- package/src/ide-integration/macos-ide-manager.js +627 -0
- package/src/ide-integration/macos-text-sender.js +528 -0
- package/src/ide-integration/response-reader.js +548 -0
- package/src/ide-integration/windows-automation-manager.js +121 -0
- package/src/ide-integration/windows-ide-manager.js +373 -0
- package/src/index.cjs +25 -3
- package/src/index.js +15 -1
- package/src/llm/direct-llm-manager.cjs +90 -2
- package/src/models/compliance-report.js +538 -0
- package/src/models/file-analysis.js +681 -0
- package/src/models/refactoring-plan.js +770 -0
- package/src/monitoring/alert-system.js +834 -0
- package/src/monitoring/compliance-progress-tracker.js +437 -0
- package/src/monitoring/continuous-scan-notifications.js +661 -0
- package/src/monitoring/continuous-scanner.js +279 -0
- package/src/monitoring/file-monitor/file-analyzer.js +262 -0
- package/src/monitoring/file-monitor/file-monitor.js +237 -0
- package/src/monitoring/file-monitor/watcher.js +194 -0
- package/src/monitoring/file-monitor.js +17 -0
- package/src/monitoring/notification-manager.js +437 -0
- package/src/monitoring/scanner-core.js +368 -0
- package/src/monitoring/scanner-events.js +214 -0
- package/src/monitoring/violation-notification-system.js +515 -0
- package/src/refactoring/boundaries/cohesion-analyzer.js +316 -0
- package/src/refactoring/boundaries/extraction-result.js +285 -0
- package/src/refactoring/boundaries/extraction-strategies.js +392 -0
- package/src/refactoring/boundaries/module-boundary.js +209 -0
- package/src/refactoring/boundary/boundary-detector.js +741 -0
- package/src/refactoring/boundary/boundary-types.js +405 -0
- package/src/refactoring/boundary/extraction-strategies.js +554 -0
- package/src/refactoring/boundary-extraction-result.js +77 -0
- package/src/refactoring/boundary-extraction-strategies.js +330 -0
- package/src/refactoring/boundary-extractor.js +384 -0
- package/src/refactoring/boundary-types.js +46 -0
- package/src/refactoring/circular/circular-dependency.js +88 -0
- package/src/refactoring/circular/cycle-detection.js +147 -0
- package/src/refactoring/circular/dependency-node.js +82 -0
- package/src/refactoring/circular/dependency-result.js +107 -0
- package/src/refactoring/circular/dependency-types.js +58 -0
- package/src/refactoring/circular/graph-builder.js +213 -0
- package/src/refactoring/circular/resolution-strategy.js +72 -0
- package/src/refactoring/circular/strategy-generator.js +229 -0
- package/src/refactoring/circular-dependency-resolver-original.js +809 -0
- package/src/refactoring/circular-dependency-resolver.js +200 -0
- package/src/refactoring/code-mover.js +761 -0
- package/src/refactoring/file-splitter.js +696 -0
- package/src/refactoring/functionality-validator.js +816 -0
- package/src/refactoring/import-manager.js +774 -0
- package/src/refactoring/module-boundary.js +107 -0
- package/src/refactoring/refactoring-executor.js +672 -0
- package/src/refactoring/refactoring-rollback.js +614 -0
- package/src/refactoring/test-validator.js +631 -0
- package/src/requirement-management/default-requirement-manager.js +321 -0
- package/src/requirement-management/requirement-file-parser.js +159 -0
- package/src/requirement-management/requirement-sequencer.js +221 -0
- package/src/rui/commands/AgentCommandParser.js +600 -0
- package/src/rui/commands/AgentCommands.js +487 -0
- package/src/rui/commands/AgentResponseFormatter.js +832 -0
- package/src/scripts/verify-full-compliance.js +269 -0
- package/src/sync/sync-engine-core.js +1 -0
- package/src/sync/sync-engine-remote-handlers.js +135 -0
- package/src/task-generation/automated-task-generator.js +351 -0
- package/src/task-generation/prioritizer.js +287 -0
- package/src/task-generation/task-list-updater.js +215 -0
- package/src/task-generation/task-management-integration.js +480 -0
- package/src/task-generation/task-manager-integration.js +270 -0
- package/src/task-generation/violation-task-generator.js +474 -0
- package/src/task-management/continuous-scan-integration.js +342 -0
- package/src/timeout-management/index.js +12 -3
- package/src/timeout-management/response-time-tracker.js +167 -0
- package/src/timeout-management/timeout-calculator.js +159 -0
- package/src/timeout-management/timeout-config-manager.js +172 -0
- package/src/utils/ast-analyzer.js +417 -0
- package/src/utils/current-requirement-manager.js +276 -0
- package/src/utils/current-requirement-operations.js +472 -0
- package/src/utils/dependency-mapper.js +456 -0
- package/src/utils/download-with-progress.js +4 -2
- package/src/utils/electron-update-checker.js +4 -1
- package/src/utils/file-size-analyzer.js +272 -0
- package/src/utils/import-updater.js +280 -0
- package/src/utils/refactoring-tools.js +512 -0
- package/src/utils/report-generator.js +569 -0
- package/src/utils/reports/report-analysis.js +218 -0
- package/src/utils/reports/report-types.js +55 -0
- package/src/utils/reports/summary-generators.js +102 -0
- package/src/utils/requirement-file-management.js +157 -0
- package/src/utils/requirement-helpers/requirement-file-ops.js +392 -0
- package/src/utils/requirement-helpers/requirement-mover.js +414 -0
- package/src/utils/requirement-helpers/requirement-parser.js +326 -0
- package/src/utils/requirement-helpers/requirement-status.js +320 -0
- package/src/utils/requirement-helpers-new.js +55 -0
- package/src/utils/requirement-helpers-refactored.js +367 -0
- package/src/utils/requirement-helpers.js +291 -1191
- package/src/utils/requirement-movement-operations.js +450 -0
- package/src/utils/requirement-movement.js +312 -0
- package/src/utils/requirement-parsing-helpers.js +56 -0
- package/src/utils/requirement-statistics.js +200 -0
- package/src/utils/requirement-text-utils.js +58 -0
- package/src/utils/rollback/rollback-handlers.js +125 -0
- package/src/utils/rollback/rollback-operation.js +63 -0
- package/src/utils/rollback/rollback-recorder.js +166 -0
- package/src/utils/rollback/rollback-state-manager.js +175 -0
- package/src/utils/rollback/rollback-types.js +33 -0
- package/src/utils/rollback/rollback-utils.js +110 -0
- package/src/utils/rollback-manager-original.js +569 -0
- package/src/utils/rollback-manager.js +202 -0
- package/src/utils/smoke-test-cli.js +362 -0
- package/src/utils/smoke-test-gui.js +351 -0
- package/src/utils/smoke-test-orchestrator.js +321 -0
- package/src/utils/smoke-test-runner.js +60 -0
- package/src/utils/smoke-test-web.js +347 -0
- package/src/utils/specification-helpers.js +39 -13
- package/src/utils/specification-migration.js +97 -0
- package/src/utils/test-runner.js +579 -0
- package/src/utils/validation-framework.js +518 -0
- package/src/validation/compliance-analyzer.js +197 -0
- package/src/validation/compliance-report-generator.js +343 -0
- package/src/validation/compliance-reporter.js +711 -0
- package/src/validation/compliance-rules.js +127 -0
- package/src/validation/constitution-validator-new.js +196 -0
- package/src/validation/constitution-validator.js +17 -0
- package/src/validation/file-validators.js +170 -0
- package/src/validation/line-limit/file-analyzer.js +201 -0
- package/src/validation/line-limit/line-limit-validator.js +208 -0
- package/src/validation/line-limit/validation-result.js +144 -0
- package/src/validation/line-limit-core.js +225 -0
- package/src/validation/line-limit-reporter.js +134 -0
- package/src/validation/line-limit-result.js +125 -0
- package/src/validation/line-limit-validator.js +41 -0
- package/src/validation/metrics-calculator.js +660 -0
- package/src/sync/sync-engine-backup.js +0 -559
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installation Log Class
|
|
3
|
+
*
|
|
4
|
+
* Represents a log entry for installation/verification operations.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { OperationType, OperationStatus } = require('./OperationTypes');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Installation log class for tracking agent operations
|
|
12
|
+
*/
|
|
13
|
+
class InstallationLog {
|
|
14
|
+
/**
|
|
15
|
+
* Create a new InstallationLog instance
|
|
16
|
+
* @param {Object} config - Log configuration
|
|
17
|
+
* @param {string} config.id - Unique log identifier
|
|
18
|
+
* @param {string} config.agentId - Agent identifier
|
|
19
|
+
* @param {string} config.operation - Operation type
|
|
20
|
+
* @param {Date} config.timestamp - When the operation occurred
|
|
21
|
+
* @param {string} config.status - Operation status
|
|
22
|
+
* @param {string} config.message - Detailed log message
|
|
23
|
+
* @param {number} config.duration - Operation duration in milliseconds
|
|
24
|
+
* @param {string} config.errorDetails - Error information if failed
|
|
25
|
+
*/
|
|
26
|
+
constructor(config = {}) {
|
|
27
|
+
this.id = config.id || this.generateId();
|
|
28
|
+
this.agentId = config.agentId || '';
|
|
29
|
+
this.operation = config.operation || '';
|
|
30
|
+
this.timestamp = config.timestamp || new Date();
|
|
31
|
+
this.status = config.status || '';
|
|
32
|
+
this.message = config.message || '';
|
|
33
|
+
this.duration = config.duration || 0;
|
|
34
|
+
this.errorDetails = config.errorDetails || '';
|
|
35
|
+
|
|
36
|
+
this.validate();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Validate log configuration
|
|
41
|
+
* @throws {Error} If configuration is invalid
|
|
42
|
+
*/
|
|
43
|
+
validate() {
|
|
44
|
+
if (!this.id || typeof this.id !== 'string') {
|
|
45
|
+
throw new Error('Installation log must have a valid non-empty string id');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!this.agentId || typeof this.agentId !== 'string') {
|
|
49
|
+
throw new Error('Installation log must have a valid non-empty string agentId');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!this.operation || typeof this.operation !== 'string') {
|
|
53
|
+
throw new Error('Installation log must have a valid non-empty string operation');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!Object.values(OperationType).includes(this.operation)) {
|
|
57
|
+
throw new Error(`Invalid operation type: ${this.operation}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!(this.timestamp instanceof Date) || isNaN(this.timestamp)) {
|
|
61
|
+
throw new Error('Timestamp must be a valid Date object');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!this.status || typeof this.status !== 'string') {
|
|
65
|
+
throw new Error('Installation log must have a valid non-empty string status');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!Object.values(OperationStatus).includes(this.status)) {
|
|
69
|
+
throw new Error(`Invalid operation status: ${this.status}`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!this.message || typeof this.message !== 'string') {
|
|
73
|
+
throw new Error('Installation log must have a valid non-empty string message');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (typeof this.duration !== 'number' || this.duration < 0) {
|
|
77
|
+
throw new Error('Duration must be a non-negative number');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Error details required if status is FAILED
|
|
81
|
+
if (this.status === OperationStatus.FAILED && !this.errorDetails) {
|
|
82
|
+
throw new Error('Error details are required when status is FAILED');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Generate unique log ID
|
|
88
|
+
* @returns {string} - Unique identifier
|
|
89
|
+
*/
|
|
90
|
+
generateId() {
|
|
91
|
+
const timestamp = Date.now();
|
|
92
|
+
const random = Math.random().toString(36).substr(2, 9);
|
|
93
|
+
return `log-${timestamp}-${random}`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Update log status and message
|
|
98
|
+
* @param {string} newStatus - New operation status
|
|
99
|
+
* @param {string} message - Updated message
|
|
100
|
+
* @param {string} errorDetails - Error details if failed
|
|
101
|
+
* @param {number} additionalDuration - Additional duration to add
|
|
102
|
+
*/
|
|
103
|
+
update(newStatus, message = '', errorDetails = '', additionalDuration = 0) {
|
|
104
|
+
const oldStatus = this.status;
|
|
105
|
+
this.status = newStatus;
|
|
106
|
+
this.message = message || this.message;
|
|
107
|
+
this.errorDetails = errorDetails || this.errorDetails;
|
|
108
|
+
this.duration += additionalDuration;
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
oldStatus,
|
|
112
|
+
newStatus,
|
|
113
|
+
timestamp: new Date()
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Mark log as completed successfully
|
|
119
|
+
* @param {string} message - Completion message
|
|
120
|
+
* @param {number} finalDuration - Final duration if different
|
|
121
|
+
*/
|
|
122
|
+
complete(message = '', finalDuration = null) {
|
|
123
|
+
if (finalDuration !== null) {
|
|
124
|
+
this.duration = finalDuration;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return this.update(OperationStatus.COMPLETED, message);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Mark log as failed
|
|
132
|
+
* @param {string} error - Error message
|
|
133
|
+
* @param {string} errorDetails - Detailed error information
|
|
134
|
+
* @param {number} finalDuration - Final duration if different
|
|
135
|
+
*/
|
|
136
|
+
fail(error, errorDetails = '', finalDuration = null) {
|
|
137
|
+
if (finalDuration !== null) {
|
|
138
|
+
this.duration = finalDuration;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return this.update(OperationStatus.FAILED, error, errorDetails);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Mark log as timed out
|
|
146
|
+
* @param {number} timeoutDuration - Duration when timeout occurred
|
|
147
|
+
*/
|
|
148
|
+
timeout(timeoutDuration = null) {
|
|
149
|
+
if (timeoutDuration !== null) {
|
|
150
|
+
this.duration = timeoutDuration;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return this.update(OperationStatus.TIMEOUT, 'Operation timed out');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Check if log represents a successful operation
|
|
158
|
+
* @returns {boolean}
|
|
159
|
+
*/
|
|
160
|
+
isSuccessful() {
|
|
161
|
+
return this.status === OperationStatus.COMPLETED;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Check if log represents a failed operation
|
|
166
|
+
* @returns {boolean}
|
|
167
|
+
*/
|
|
168
|
+
isFailed() {
|
|
169
|
+
return this.status === OperationStatus.FAILED;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Check if log represents a timed out operation
|
|
174
|
+
* @returns {boolean}
|
|
175
|
+
*/
|
|
176
|
+
isTimedOut() {
|
|
177
|
+
return this.status === OperationStatus.TIMEOUT;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Check if log represents an ongoing operation
|
|
182
|
+
* @returns {boolean}
|
|
183
|
+
*/
|
|
184
|
+
isOngoing() {
|
|
185
|
+
return this.status === OperationStatus.STARTED;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Get human-readable status description
|
|
190
|
+
* @returns {string}
|
|
191
|
+
*/
|
|
192
|
+
getStatusDescription() {
|
|
193
|
+
const descriptions = {
|
|
194
|
+
[OperationStatus.STARTED]: 'Started',
|
|
195
|
+
[OperationStatus.COMPLETED]: 'Completed',
|
|
196
|
+
[OperationStatus.FAILED]: 'Failed',
|
|
197
|
+
[OperationStatus.TIMEOUT]: 'Timed out',
|
|
198
|
+
[OperationStatus.CANCELLED]: 'Cancelled'
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
return descriptions[this.status] || 'Unknown';
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Get formatted duration string
|
|
206
|
+
* @returns {string} - Formatted duration (e.g., "2.5s", "1m 30s")
|
|
207
|
+
*/
|
|
208
|
+
getFormattedDuration() {
|
|
209
|
+
const duration = this.duration;
|
|
210
|
+
|
|
211
|
+
if (duration < 1000) {
|
|
212
|
+
return `${duration}ms`;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (duration < 60000) {
|
|
216
|
+
return `${(duration / 1000).toFixed(1)}s`;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const minutes = Math.floor(duration / 60000);
|
|
220
|
+
const seconds = ((duration % 60000) / 1000).toFixed(0);
|
|
221
|
+
return `${minutes}m ${seconds}s`;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Get formatted timestamp
|
|
226
|
+
* @returns {string} - ISO timestamp
|
|
227
|
+
*/
|
|
228
|
+
getFormattedTimestamp() {
|
|
229
|
+
return this.timestamp.toISOString();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Check if log entry is recent (within last hour)
|
|
234
|
+
* @returns {boolean}
|
|
235
|
+
*/
|
|
236
|
+
isRecent() {
|
|
237
|
+
const oneHour = 60 * 60 * 1000;
|
|
238
|
+
return (Date.now() - this.timestamp.getTime()) < oneHour;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Create a summary of the log entry
|
|
243
|
+
* @returns {Object} - Log summary
|
|
244
|
+
*/
|
|
245
|
+
getSummary() {
|
|
246
|
+
return {
|
|
247
|
+
id: this.id,
|
|
248
|
+
agentId: this.agentId,
|
|
249
|
+
operation: this.operation,
|
|
250
|
+
status: this.status,
|
|
251
|
+
statusDescription: this.getStatusDescription(),
|
|
252
|
+
duration: this.duration,
|
|
253
|
+
formattedDuration: this.getFormattedDuration(),
|
|
254
|
+
timestamp: this.getFormattedTimestamp(),
|
|
255
|
+
message: this.message,
|
|
256
|
+
hasError: this.isFailed(),
|
|
257
|
+
isRecent: this.isRecent()
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Convert installation log to plain object
|
|
263
|
+
* @returns {Object}
|
|
264
|
+
*/
|
|
265
|
+
toJSON() {
|
|
266
|
+
return {
|
|
267
|
+
id: this.id,
|
|
268
|
+
agentId: this.agentId,
|
|
269
|
+
operation: this.operation,
|
|
270
|
+
timestamp: this.timestamp.toISOString(),
|
|
271
|
+
status: this.status,
|
|
272
|
+
message: this.message,
|
|
273
|
+
duration: this.duration,
|
|
274
|
+
errorDetails: this.errorDetails
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Create installation log from plain object
|
|
280
|
+
* @param {Object} data - Plain object data
|
|
281
|
+
* @returns {InstallationLog}
|
|
282
|
+
*/
|
|
283
|
+
static fromJSON(data) {
|
|
284
|
+
return new InstallationLog({
|
|
285
|
+
...data,
|
|
286
|
+
timestamp: data.timestamp ? new Date(data.timestamp) : new Date()
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Create a new log entry for operation start
|
|
292
|
+
* @param {string} agentId - Agent identifier
|
|
293
|
+
* @param {string} operation - Operation type
|
|
294
|
+
* @param {string} message - Start message
|
|
295
|
+
* @returns {InstallationLog}
|
|
296
|
+
*/
|
|
297
|
+
static createStart(agentId, operation, message = '') {
|
|
298
|
+
return new InstallationLog({
|
|
299
|
+
agentId,
|
|
300
|
+
operation,
|
|
301
|
+
status: OperationStatus.STARTED,
|
|
302
|
+
message: message || `Starting ${operation} for ${agentId}`,
|
|
303
|
+
duration: 0
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Create a new log entry for successful completion
|
|
309
|
+
* @param {string} agentId - Agent identifier
|
|
310
|
+
* @param {string} operation - Operation type
|
|
311
|
+
* @param {string} message - Success message
|
|
312
|
+
* @param {number} duration - Operation duration
|
|
313
|
+
* @returns {InstallationLog}
|
|
314
|
+
*/
|
|
315
|
+
static createSuccess(agentId, operation, message = '', duration = 0) {
|
|
316
|
+
return new InstallationLog({
|
|
317
|
+
agentId,
|
|
318
|
+
operation,
|
|
319
|
+
status: OperationStatus.COMPLETED,
|
|
320
|
+
message: message || `Successfully completed ${operation} for ${agentId}`,
|
|
321
|
+
duration
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Create a new log entry for failed operation
|
|
327
|
+
* @param {string} agentId - Agent identifier
|
|
328
|
+
* @param {string} operation - Operation type
|
|
329
|
+
* @param {string} error - Error message
|
|
330
|
+
* @param {string} errorDetails - Detailed error information
|
|
331
|
+
* @param {number} duration - Operation duration
|
|
332
|
+
* @returns {InstallationLog}
|
|
333
|
+
*/
|
|
334
|
+
static createFailure(agentId, operation, error, errorDetails = '', duration = 0) {
|
|
335
|
+
return new InstallationLog({
|
|
336
|
+
agentId,
|
|
337
|
+
operation,
|
|
338
|
+
status: OperationStatus.FAILED,
|
|
339
|
+
message: error || `Failed ${operation} for ${agentId}`,
|
|
340
|
+
errorDetails,
|
|
341
|
+
duration
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Create a new log entry for timeout
|
|
347
|
+
* @param {string} agentId - Agent identifier
|
|
348
|
+
* @param {string} operation - Operation type
|
|
349
|
+
* @param {number} duration - Duration when timeout occurred
|
|
350
|
+
* @returns {InstallationLog}
|
|
351
|
+
*/
|
|
352
|
+
static createTimeout(agentId, operation, duration = 0) {
|
|
353
|
+
return new InstallationLog({
|
|
354
|
+
agentId,
|
|
355
|
+
operation,
|
|
356
|
+
status: OperationStatus.TIMEOUT,
|
|
357
|
+
message: `${operation} for ${agentId} timed out`,
|
|
358
|
+
duration
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
module.exports = InstallationLog;
|