deepseek-coder-agent-cli 1.0.13 → 1.0.15
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/dist/capabilities/index.d.ts +1 -18
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +2 -19
- package/dist/capabilities/index.js.map +1 -1
- package/dist/core/agiCore.d.ts.map +1 -1
- package/dist/core/agiCore.js +3 -6
- package/dist/core/agiCore.js.map +1 -1
- package/dist/core/dynamicGuardrails.d.ts.map +1 -1
- package/dist/core/dynamicGuardrails.js +0 -60
- package/dist/core/dynamicGuardrails.js.map +1 -1
- package/dist/core/gitWorktreeManager.d.ts +1 -1
- package/dist/core/gitWorktreeManager.d.ts.map +1 -1
- package/dist/core/gitWorktreeManager.js.map +1 -1
- package/dist/core/hotReload.js.map +1 -1
- package/dist/core/index.d.ts +0 -8
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -15
- package/dist/core/index.js.map +1 -1
- package/dist/core/selfUpgrade.d.ts +34 -208
- package/dist/core/selfUpgrade.d.ts.map +1 -1
- package/dist/core/selfUpgrade.js +54 -631
- package/dist/core/selfUpgrade.js.map +1 -1
- package/dist/headless/interactiveShell.d.ts.map +1 -1
- package/dist/headless/interactiveShell.js +10 -71
- package/dist/headless/interactiveShell.js.map +1 -1
- package/dist/orchestration/index.d.ts +9 -5
- package/dist/orchestration/index.d.ts.map +1 -1
- package/dist/orchestration/index.js +7 -8
- package/dist/orchestration/index.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -2
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/tools/nodeDefaults.d.ts +0 -2
- package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
- package/dist/plugins/tools/nodeDefaults.js +0 -6
- package/dist/plugins/tools/nodeDefaults.js.map +1 -1
- package/dist/tools/diffUtils.d.ts.map +1 -1
- package/dist/tools/diffUtils.js +0 -14
- package/dist/tools/diffUtils.js.map +1 -1
- package/dist/tools/editTools.d.ts.map +1 -1
- package/dist/tools/editTools.js +20 -168
- package/dist/tools/editTools.js.map +1 -1
- package/dist/tools/fileTools.d.ts.map +1 -1
- package/dist/tools/fileTools.js +1 -10
- package/dist/tools/fileTools.js.map +1 -1
- package/dist/tools/grepTools.d.ts.map +1 -1
- package/dist/tools/grepTools.js +1 -2
- package/dist/tools/grepTools.js.map +1 -1
- package/dist/tools/searchTools.d.ts.map +1 -1
- package/dist/tools/searchTools.js +0 -7
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/tools/telemetryTools.d.ts +5 -0
- package/dist/tools/telemetryTools.d.ts.map +1 -1
- package/dist/tools/telemetryTools.js +6 -6
- package/dist/tools/telemetryTools.js.map +1 -1
- package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -1
- package/dist/ui/UnifiedUIRenderer.js +7 -25
- package/dist/ui/UnifiedUIRenderer.js.map +1 -1
- package/package.json +1 -2
- package/dist/capabilities/appleSecurityCapability.d.ts +0 -57
- package/dist/capabilities/appleSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/appleSecurityCapability.js +0 -197
- package/dist/capabilities/appleSecurityCapability.js.map +0 -1
- package/dist/capabilities/authorizedSecurityCapability.d.ts +0 -17
- package/dist/capabilities/authorizedSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/authorizedSecurityCapability.js +0 -333
- package/dist/capabilities/authorizedSecurityCapability.js.map +0 -1
- package/dist/capabilities/autoEnhancementCapability.d.ts +0 -98
- package/dist/capabilities/autoEnhancementCapability.d.ts.map +0 -1
- package/dist/capabilities/autoEnhancementCapability.js +0 -455
- package/dist/capabilities/autoEnhancementCapability.js.map +0 -1
- package/dist/capabilities/biocognitiveWarfare.d.ts +0 -136
- package/dist/capabilities/biocognitiveWarfare.d.ts.map +0 -1
- package/dist/capabilities/biocognitiveWarfare.js +0 -603
- package/dist/capabilities/biocognitiveWarfare.js.map +0 -1
- package/dist/capabilities/chineseCnoIntegration.d.ts +0 -60
- package/dist/capabilities/chineseCnoIntegration.d.ts.map +0 -1
- package/dist/capabilities/chineseCnoIntegration.js +0 -253
- package/dist/capabilities/chineseCnoIntegration.js.map +0 -1
- package/dist/capabilities/cnoCapability.d.ts +0 -110
- package/dist/capabilities/cnoCapability.d.ts.map +0 -1
- package/dist/capabilities/cnoCapability.js +0 -785
- package/dist/capabilities/cnoCapability.js.map +0 -1
- package/dist/capabilities/eliteCryptoMilitaryCapability.d.ts +0 -99
- package/dist/capabilities/eliteCryptoMilitaryCapability.d.ts.map +0 -1
- package/dist/capabilities/eliteCryptoMilitaryCapability.js +0 -618
- package/dist/capabilities/eliteCryptoMilitaryCapability.js.map +0 -1
- package/dist/capabilities/integratedUnifiedCapability.d.ts +0 -105
- package/dist/capabilities/integratedUnifiedCapability.d.ts.map +0 -1
- package/dist/capabilities/integratedUnifiedCapability.js +0 -422
- package/dist/capabilities/integratedUnifiedCapability.js.map +0 -1
- package/dist/capabilities/maxOffensiveUkraineCapability.d.ts +0 -46
- package/dist/capabilities/maxOffensiveUkraineCapability.d.ts.map +0 -1
- package/dist/capabilities/maxOffensiveUkraineCapability.js +0 -725
- package/dist/capabilities/maxOffensiveUkraineCapability.js.map +0 -1
- package/dist/capabilities/migrationUtilities.d.ts +0 -128
- package/dist/capabilities/migrationUtilities.d.ts.map +0 -1
- package/dist/capabilities/migrationUtilities.js +0 -658
- package/dist/capabilities/migrationUtilities.js.map +0 -1
- package/dist/capabilities/offensiveDestructionCapability.d.ts +0 -98
- package/dist/capabilities/offensiveDestructionCapability.d.ts.map +0 -1
- package/dist/capabilities/offensiveDestructionCapability.js +0 -848
- package/dist/capabilities/offensiveDestructionCapability.js.map +0 -1
- package/dist/capabilities/quantumSpaceWarfare.d.ts +0 -108
- package/dist/capabilities/quantumSpaceWarfare.d.ts.map +0 -1
- package/dist/capabilities/quantumSpaceWarfare.js +0 -342
- package/dist/capabilities/quantumSpaceWarfare.js.map +0 -1
- package/dist/capabilities/readmeIntegration.d.ts +0 -161
- package/dist/capabilities/readmeIntegration.d.ts.map +0 -1
- package/dist/capabilities/readmeIntegration.js +0 -1034
- package/dist/capabilities/readmeIntegration.js.map +0 -1
- package/dist/capabilities/selfUpdateSystem.d.ts +0 -122
- package/dist/capabilities/selfUpdateSystem.d.ts.map +0 -1
- package/dist/capabilities/selfUpdateSystem.js +0 -725
- package/dist/capabilities/selfUpdateSystem.js.map +0 -1
- package/dist/capabilities/sharedMilitaryInfrastructure.d.ts +0 -89
- package/dist/capabilities/sharedMilitaryInfrastructure.d.ts.map +0 -1
- package/dist/capabilities/sharedMilitaryInfrastructure.js +0 -233
- package/dist/capabilities/sharedMilitaryInfrastructure.js.map +0 -1
- package/dist/capabilities/simpleSecurityCapability.d.ts +0 -36
- package/dist/capabilities/simpleSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/simpleSecurityCapability.js +0 -271
- package/dist/capabilities/simpleSecurityCapability.js.map +0 -1
- package/dist/capabilities/ultimateChineseCno.d.ts +0 -115
- package/dist/capabilities/ultimateChineseCno.d.ts.map +0 -1
- package/dist/capabilities/ultimateChineseCno.js +0 -516
- package/dist/capabilities/ultimateChineseCno.js.map +0 -1
- package/dist/capabilities/ultimateIntegrationDemo.d.ts +0 -54
- package/dist/capabilities/ultimateIntegrationDemo.d.ts.map +0 -1
- package/dist/capabilities/ultimateIntegrationDemo.js +0 -423
- package/dist/capabilities/ultimateIntegrationDemo.js.map +0 -1
- package/dist/capabilities/unifiedMilitaryCapability.d.ts +0 -63
- package/dist/capabilities/unifiedMilitaryCapability.d.ts.map +0 -1
- package/dist/capabilities/unifiedMilitaryCapability.js +0 -384
- package/dist/capabilities/unifiedMilitaryCapability.js.map +0 -1
- package/dist/capabilities/universalCapabilityFramework.d.ts +0 -352
- package/dist/capabilities/universalCapabilityFramework.d.ts.map +0 -1
- package/dist/capabilities/universalCapabilityFramework.js +0 -1056
- package/dist/capabilities/universalCapabilityFramework.js.map +0 -1
- package/dist/capabilities/universalSecurityCapability.d.ts +0 -46
- package/dist/capabilities/universalSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/universalSecurityCapability.js +0 -580
- package/dist/capabilities/universalSecurityCapability.js.map +0 -1
- package/dist/capabilities/zeroDayDiscoveryCapability.d.ts +0 -31
- package/dist/capabilities/zeroDayDiscoveryCapability.d.ts.map +0 -1
- package/dist/capabilities/zeroDayDiscoveryCapability.js +0 -183
- package/dist/capabilities/zeroDayDiscoveryCapability.js.map +0 -1
- package/dist/core/antiTermination.d.ts +0 -226
- package/dist/core/antiTermination.d.ts.map +0 -1
- package/dist/core/antiTermination.js +0 -713
- package/dist/core/antiTermination.js.map +0 -1
- package/dist/core/appleSecurityAudit.d.ts +0 -98
- package/dist/core/appleSecurityAudit.d.ts.map +0 -1
- package/dist/core/appleSecurityAudit.js +0 -505
- package/dist/core/appleSecurityAudit.js.map +0 -1
- package/dist/core/appleSecurityIntegration.d.ts +0 -130
- package/dist/core/appleSecurityIntegration.d.ts.map +0 -1
- package/dist/core/appleSecurityIntegration.js +0 -697
- package/dist/core/appleSecurityIntegration.js.map +0 -1
- package/dist/core/dualTournament.d.ts +0 -110
- package/dist/core/dualTournament.d.ts.map +0 -1
- package/dist/core/dualTournament.js +0 -270
- package/dist/core/dualTournament.js.map +0 -1
- package/dist/core/parallel.d.ts +0 -85
- package/dist/core/parallel.d.ts.map +0 -1
- package/dist/core/parallel.js +0 -150
- package/dist/core/parallel.js.map +0 -1
- package/dist/core/parallelCoordinator.d.ts +0 -21
- package/dist/core/parallelCoordinator.d.ts.map +0 -1
- package/dist/core/parallelCoordinator.js +0 -42
- package/dist/core/parallelCoordinator.js.map +0 -1
- package/dist/core/realityScore.d.ts +0 -159
- package/dist/core/realityScore.d.ts.map +0 -1
- package/dist/core/realityScore.js +0 -734
- package/dist/core/realityScore.js.map +0 -1
- package/dist/core/repoUpgradeOrchestrator.d.ts +0 -223
- package/dist/core/repoUpgradeOrchestrator.d.ts.map +0 -1
- package/dist/core/repoUpgradeOrchestrator.js +0 -1003
- package/dist/core/repoUpgradeOrchestrator.js.map +0 -1
- package/dist/core/securityTournament.d.ts +0 -83
- package/dist/core/securityTournament.d.ts.map +0 -1
- package/dist/core/securityTournament.js +0 -357
- package/dist/core/securityTournament.js.map +0 -1
- package/dist/core/tournamentStrategy.d.ts +0 -12
- package/dist/core/tournamentStrategy.d.ts.map +0 -1
- package/dist/core/tournamentStrategy.js +0 -41
- package/dist/core/tournamentStrategy.js.map +0 -1
- package/dist/core/universalSecurityAudit.d.ts +0 -104
- package/dist/core/universalSecurityAudit.d.ts.map +0 -1
- package/dist/core/universalSecurityAudit.js +0 -2190
- package/dist/core/universalSecurityAudit.js.map +0 -1
- package/dist/core/variantExecution.d.ts +0 -23
- package/dist/core/variantExecution.d.ts.map +0 -1
- package/dist/core/variantExecution.js +0 -58
- package/dist/core/variantExecution.js.map +0 -1
- package/dist/core/winnerStrategy.d.ts +0 -15
- package/dist/core/winnerStrategy.d.ts.map +0 -1
- package/dist/core/winnerStrategy.js +0 -18
- package/dist/core/winnerStrategy.js.map +0 -1
- package/dist/core/zeroDayDiscovery.d.ts +0 -96
- package/dist/core/zeroDayDiscovery.d.ts.map +0 -1
- package/dist/core/zeroDayDiscovery.js +0 -358
- package/dist/core/zeroDayDiscovery.js.map +0 -1
- package/dist/orchestration/repoUpgradeRunner.d.ts +0 -44
- package/dist/orchestration/repoUpgradeRunner.d.ts.map +0 -1
- package/dist/orchestration/repoUpgradeRunner.js +0 -375
- package/dist/orchestration/repoUpgradeRunner.js.map +0 -1
- package/dist/orchestration/securityAuditRunner.d.ts +0 -144
- package/dist/orchestration/securityAuditRunner.d.ts.map +0 -1
- package/dist/orchestration/securityAuditRunner.js +0 -526
- package/dist/orchestration/securityAuditRunner.js.map +0 -1
- package/dist/plugins/tools/apple/secureApplePlugin.d.ts +0 -3
- package/dist/plugins/tools/apple/secureApplePlugin.d.ts.map +0 -1
- package/dist/plugins/tools/apple/secureApplePlugin.js +0 -26
- package/dist/plugins/tools/apple/secureApplePlugin.js.map +0 -1
- package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.d.ts +0 -3
- package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.js +0 -9
- package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.js.map +0 -1
- package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.d.ts +0 -3
- package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.js +0 -27
- package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.js.map +0 -1
- package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.d.ts +0 -3
- package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.js +0 -9
- package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.js.map +0 -1
- package/dist/plugins/tools/tao/secureTaoPlugin.d.ts +0 -3
- package/dist/plugins/tools/tao/secureTaoPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/tao/secureTaoPlugin.js +0 -37
- package/dist/plugins/tools/tao/secureTaoPlugin.js.map +0 -1
- package/dist/tools/secureAppleExploitation.d.ts +0 -29
- package/dist/tools/secureAppleExploitation.d.ts.map +0 -1
- package/dist/tools/secureAppleExploitation.js +0 -518
- package/dist/tools/secureAppleExploitation.js.map +0 -1
- package/dist/ui/maxOffensiveUkraineUI.d.ts +0 -94
- package/dist/ui/maxOffensiveUkraineUI.d.ts.map +0 -1
- package/dist/ui/maxOffensiveUkraineUI.js +0 -316
- package/dist/ui/maxOffensiveUkraineUI.js.map +0 -1
|
@@ -1,725 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SELF-UPDATE SYSTEM FOR UNIVERSAL CAPABILITY FRAMEWORK
|
|
3
|
-
*
|
|
4
|
-
* Implements automatic self-update capabilities as per AGI Code rules.
|
|
5
|
-
* Provides version checking, state persistence, and seamless updates.
|
|
6
|
-
*/
|
|
7
|
-
import { UniversalCapabilityModule } from './universalCapabilityFramework.js';
|
|
8
|
-
import * as fs from 'fs';
|
|
9
|
-
import * as path from 'path';
|
|
10
|
-
import { execSync } from 'child_process';
|
|
11
|
-
// ============================================================================
|
|
12
|
-
// SELF UPDATE CAPABILITY MODULE
|
|
13
|
-
// ============================================================================
|
|
14
|
-
export class SelfUpdateCapability extends UniversalCapabilityModule {
|
|
15
|
-
id = 'capability.self-update';
|
|
16
|
-
metadata = {
|
|
17
|
-
id: 'capability.self-update',
|
|
18
|
-
version: '1.0.0',
|
|
19
|
-
description: 'Automatic self-update system for Universal Capability Framework',
|
|
20
|
-
author: 'AGI Core Team',
|
|
21
|
-
dependencies: ['capability.universal-filesystem', 'capability.universal-bash'],
|
|
22
|
-
provides: [
|
|
23
|
-
'framework.update.check',
|
|
24
|
-
'framework.update.install',
|
|
25
|
-
'framework.update.rollback',
|
|
26
|
-
'framework.update.status'
|
|
27
|
-
],
|
|
28
|
-
requires: ['node', 'npm', 'git'],
|
|
29
|
-
category: 'system',
|
|
30
|
-
tags: ['update', 'maintenance', 'system']
|
|
31
|
-
};
|
|
32
|
-
options;
|
|
33
|
-
stateFile;
|
|
34
|
-
updateDir;
|
|
35
|
-
constructor(framework, config = {}) {
|
|
36
|
-
super(framework, config);
|
|
37
|
-
this.options = {
|
|
38
|
-
enableAutoUpdate: true,
|
|
39
|
-
checkIntervalMinutes: 60, // 1 hour
|
|
40
|
-
autoInstallMinor: true,
|
|
41
|
-
requireConfirmationMajor: true,
|
|
42
|
-
enableBackup: true,
|
|
43
|
-
enableRollback: true,
|
|
44
|
-
updateChannel: 'stable',
|
|
45
|
-
...config
|
|
46
|
-
};
|
|
47
|
-
this.stateFile = path.join(framework.getConfig().sharedDataDir || '/tmp/agi-updates', 'update-state.json');
|
|
48
|
-
this.updateDir = path.join(framework.getConfig().sharedDataDir || '/tmp/agi-updates', 'pending');
|
|
49
|
-
// Ensure directories exist
|
|
50
|
-
fs.mkdirSync(path.dirname(this.stateFile), { recursive: true });
|
|
51
|
-
fs.mkdirSync(this.updateDir, { recursive: true });
|
|
52
|
-
}
|
|
53
|
-
async create(context) {
|
|
54
|
-
this.log('info', 'Self-update capability initialized');
|
|
55
|
-
return {
|
|
56
|
-
id: this.id,
|
|
57
|
-
description: this.metadata.description,
|
|
58
|
-
toolSuite: {
|
|
59
|
-
id: `${this.id}-tools`,
|
|
60
|
-
description: 'Self-update system tools',
|
|
61
|
-
tools: this.createUpdateTools()
|
|
62
|
-
},
|
|
63
|
-
metadata: {
|
|
64
|
-
...this.metadata,
|
|
65
|
-
options: this.options,
|
|
66
|
-
stateFile: this.stateFile,
|
|
67
|
-
updateDir: this.updateDir
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
async execute(params) {
|
|
72
|
-
const opId = params.operationId || this.utilities.generateOperationId('self-update');
|
|
73
|
-
switch (params.operation) {
|
|
74
|
-
case 'check_for_updates':
|
|
75
|
-
return await this.checkForUpdates(params.parameters.force || false);
|
|
76
|
-
case 'install_update':
|
|
77
|
-
return await this.installUpdate(params.parameters.version, params.parameters.confirm);
|
|
78
|
-
case 'rollback_update':
|
|
79
|
-
return await this.rollbackUpdate(params.parameters.targetVersion);
|
|
80
|
-
case 'get_update_status':
|
|
81
|
-
return await this.getUpdateStatus();
|
|
82
|
-
case 'configure_updates':
|
|
83
|
-
return await this.configureUpdates(params.parameters.config);
|
|
84
|
-
case 'manual_update':
|
|
85
|
-
return await this.performManualUpdate(params.parameters.command);
|
|
86
|
-
default:
|
|
87
|
-
throw new Error(`Unknown self-update operation: ${params.operation}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// ============================================================================
|
|
91
|
-
// UPDATE TOOLS
|
|
92
|
-
// ============================================================================
|
|
93
|
-
createUpdateTools() {
|
|
94
|
-
return [
|
|
95
|
-
{
|
|
96
|
-
name: 'check_for_updates',
|
|
97
|
-
description: 'Check for framework updates',
|
|
98
|
-
parameters: {
|
|
99
|
-
type: 'object',
|
|
100
|
-
properties: {
|
|
101
|
-
force: {
|
|
102
|
-
type: 'boolean',
|
|
103
|
-
description: 'Force check ignoring cache'
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
execute: async (args) => {
|
|
108
|
-
return await this.checkForUpdates(args.force || false);
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: 'install_update',
|
|
113
|
-
description: 'Install available framework update',
|
|
114
|
-
parameters: {
|
|
115
|
-
type: 'object',
|
|
116
|
-
properties: {
|
|
117
|
-
version: {
|
|
118
|
-
type: 'string',
|
|
119
|
-
description: 'Version to install (latest if not specified)'
|
|
120
|
-
},
|
|
121
|
-
confirm: {
|
|
122
|
-
type: 'boolean',
|
|
123
|
-
description: 'Confirm installation'
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
required: ['confirm']
|
|
127
|
-
},
|
|
128
|
-
execute: async (args) => {
|
|
129
|
-
return await this.installUpdate(args.version, args.confirm);
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: 'rollback_update',
|
|
134
|
-
description: 'Rollback to previous version',
|
|
135
|
-
parameters: {
|
|
136
|
-
type: 'object',
|
|
137
|
-
properties: {
|
|
138
|
-
targetVersion: {
|
|
139
|
-
type: 'string',
|
|
140
|
-
description: 'Version to rollback to'
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
execute: async (args) => {
|
|
145
|
-
return await this.rollbackUpdate(args.targetVersion);
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
name: 'get_update_status',
|
|
150
|
-
description: 'Get current update status',
|
|
151
|
-
parameters: {
|
|
152
|
-
type: 'object',
|
|
153
|
-
properties: {}
|
|
154
|
-
},
|
|
155
|
-
execute: async () => {
|
|
156
|
-
return await this.getUpdateStatus();
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
name: 'configure_updates',
|
|
161
|
-
description: 'Configure update settings',
|
|
162
|
-
parameters: {
|
|
163
|
-
type: 'object',
|
|
164
|
-
properties: {
|
|
165
|
-
config: {
|
|
166
|
-
type: 'object',
|
|
167
|
-
description: 'Update configuration'
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
required: ['config']
|
|
171
|
-
},
|
|
172
|
-
execute: async (args) => {
|
|
173
|
-
return await this.configureUpdates(args.config);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
];
|
|
177
|
-
}
|
|
178
|
-
// ============================================================================
|
|
179
|
-
// CORE UPDATE FUNCTIONALITY
|
|
180
|
-
// ============================================================================
|
|
181
|
-
/**
|
|
182
|
-
* Check for available updates
|
|
183
|
-
*/
|
|
184
|
-
async checkForUpdates(force = false) {
|
|
185
|
-
this.log('info', 'Checking for framework updates...');
|
|
186
|
-
const state = await this.loadState();
|
|
187
|
-
// Check if we should skip based on interval
|
|
188
|
-
if (!force && state.lastUpdateAttempt) {
|
|
189
|
-
const lastAttempt = new Date(state.lastUpdateAttempt).getTime();
|
|
190
|
-
const now = Date.now();
|
|
191
|
-
const intervalMs = this.options.checkIntervalMinutes * 60 * 1000;
|
|
192
|
-
if (now - lastAttempt < intervalMs) {
|
|
193
|
-
this.log('info', 'Skipping update check - within interval');
|
|
194
|
-
return {
|
|
195
|
-
checked: false,
|
|
196
|
-
reason: 'within_check_interval',
|
|
197
|
-
nextCheck: new Date(lastAttempt + intervalMs).toISOString()
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
try {
|
|
202
|
-
// Get current version
|
|
203
|
-
const currentVersion = await this.getCurrentVersion();
|
|
204
|
-
// Check npm registry for updates
|
|
205
|
-
const latestVersion = await this.checkNpmRegistry();
|
|
206
|
-
// Compare versions
|
|
207
|
-
const updateAvailable = this.compareVersions(currentVersion, latestVersion) < 0;
|
|
208
|
-
if (updateAvailable) {
|
|
209
|
-
const manifest = await this.fetchUpdateManifest(latestVersion);
|
|
210
|
-
state.pendingUpdate = manifest;
|
|
211
|
-
state.lastUpdateAttempt = new Date().toISOString();
|
|
212
|
-
await this.saveState(state);
|
|
213
|
-
this.log('info', `Update available: ${currentVersion} → ${latestVersion}`);
|
|
214
|
-
return {
|
|
215
|
-
updateAvailable: true,
|
|
216
|
-
currentVersion,
|
|
217
|
-
latestVersion,
|
|
218
|
-
manifest,
|
|
219
|
-
breakingChanges: manifest.breakingChanges,
|
|
220
|
-
shouldUpdate: this.shouldAutoUpdate(manifest)
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
state.lastUpdateAttempt = new Date().toISOString();
|
|
225
|
-
await this.saveState(state);
|
|
226
|
-
this.log('info', 'Framework is up to date');
|
|
227
|
-
return {
|
|
228
|
-
updateAvailable: false,
|
|
229
|
-
currentVersion,
|
|
230
|
-
latestVersion,
|
|
231
|
-
message: 'Framework is up to date'
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
catch (error) {
|
|
236
|
-
this.log('error', `Update check failed: ${error.message}`);
|
|
237
|
-
// Record error in state
|
|
238
|
-
state.errorHistory.push({
|
|
239
|
-
timestamp: new Date().toISOString(),
|
|
240
|
-
error: error.message
|
|
241
|
-
});
|
|
242
|
-
state.lastUpdateAttempt = new Date().toISOString();
|
|
243
|
-
await this.saveState(state);
|
|
244
|
-
throw error;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Install an update
|
|
249
|
-
*/
|
|
250
|
-
async installUpdate(version, confirm = false) {
|
|
251
|
-
this.log('info', `Starting update installation${version ? ` to ${version}` : ''}`);
|
|
252
|
-
const state = await this.loadState();
|
|
253
|
-
if (state.updateInProgress) {
|
|
254
|
-
throw new Error('Update already in progress');
|
|
255
|
-
}
|
|
256
|
-
// Get update manifest
|
|
257
|
-
const manifest = version
|
|
258
|
-
? await this.fetchUpdateManifest(version)
|
|
259
|
-
: state.pendingUpdate;
|
|
260
|
-
if (!manifest) {
|
|
261
|
-
throw new Error('No update manifest available. Check for updates first.');
|
|
262
|
-
}
|
|
263
|
-
// Check for breaking changes
|
|
264
|
-
if (manifest.breakingChanges && this.options.requireConfirmationMajor && !confirm) {
|
|
265
|
-
return {
|
|
266
|
-
requiresConfirmation: true,
|
|
267
|
-
manifest,
|
|
268
|
-
breakingChanges: manifest.breakingChanges,
|
|
269
|
-
changes: manifest.changes
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
// Start update
|
|
273
|
-
state.updateInProgress = true;
|
|
274
|
-
state.pendingUpdate = manifest;
|
|
275
|
-
await this.saveState(state);
|
|
276
|
-
try {
|
|
277
|
-
// Step 1: Backup if enabled
|
|
278
|
-
let backupPath = null;
|
|
279
|
-
if (this.options.enableBackup) {
|
|
280
|
-
backupPath = await this.createBackup();
|
|
281
|
-
}
|
|
282
|
-
// Step 2: Download update
|
|
283
|
-
const updatePath = await this.downloadUpdate(manifest);
|
|
284
|
-
// Step 3: Install update
|
|
285
|
-
const result = await this.applyUpdate(updatePath, manifest);
|
|
286
|
-
// Step 4: Update state
|
|
287
|
-
state.updateInProgress = false;
|
|
288
|
-
state.lastSuccessfulUpdate = new Date().toISOString();
|
|
289
|
-
state.pendingUpdate = null;
|
|
290
|
-
await this.saveState(state);
|
|
291
|
-
this.log('info', `Successfully updated to version ${manifest.version}`);
|
|
292
|
-
return {
|
|
293
|
-
success: true,
|
|
294
|
-
previousVersion: await this.getCurrentVersion(),
|
|
295
|
-
newVersion: manifest.version,
|
|
296
|
-
backupPath,
|
|
297
|
-
changes: manifest.changes,
|
|
298
|
-
timestamp: new Date().toISOString()
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
catch (error) {
|
|
302
|
-
// Update failed
|
|
303
|
-
state.updateInProgress = false;
|
|
304
|
-
state.errorHistory.push({
|
|
305
|
-
timestamp: new Date().toISOString(),
|
|
306
|
-
error: error.message
|
|
307
|
-
});
|
|
308
|
-
await this.saveState(state);
|
|
309
|
-
// Rollback if enabled
|
|
310
|
-
if (this.options.enableRollback) {
|
|
311
|
-
this.log('info', 'Update failed, attempting rollback...');
|
|
312
|
-
try {
|
|
313
|
-
await this.performRollback();
|
|
314
|
-
}
|
|
315
|
-
catch (rollbackError) {
|
|
316
|
-
this.log('error', `Rollback also failed: ${rollbackError.message}`);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
throw error;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Rollback to previous version
|
|
324
|
-
*/
|
|
325
|
-
async rollbackUpdate(targetVersion) {
|
|
326
|
-
this.log('info', `Starting rollback${targetVersion ? ` to ${targetVersion}` : ''}`);
|
|
327
|
-
const state = await this.loadState();
|
|
328
|
-
if (state.updateInProgress) {
|
|
329
|
-
throw new Error('Cannot rollback while update is in progress');
|
|
330
|
-
}
|
|
331
|
-
try {
|
|
332
|
-
const result = await this.performRollback(targetVersion);
|
|
333
|
-
state.lastSuccessfulUpdate = new Date().toISOString();
|
|
334
|
-
await this.saveState(state);
|
|
335
|
-
this.log('info', `Successfully rolled back to version ${result.version}`);
|
|
336
|
-
return result;
|
|
337
|
-
}
|
|
338
|
-
catch (error) {
|
|
339
|
-
this.log('error', `Rollback failed: ${error.message}`);
|
|
340
|
-
state.errorHistory.push({
|
|
341
|
-
timestamp: new Date().toISOString(),
|
|
342
|
-
error: error.message
|
|
343
|
-
});
|
|
344
|
-
await this.saveState(state);
|
|
345
|
-
throw error;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Get current update status
|
|
350
|
-
*/
|
|
351
|
-
async getUpdateStatus() {
|
|
352
|
-
const state = await this.loadState();
|
|
353
|
-
const currentVersion = await this.getCurrentVersion();
|
|
354
|
-
return {
|
|
355
|
-
currentVersion,
|
|
356
|
-
updateInProgress: state.updateInProgress,
|
|
357
|
-
lastUpdateAttempt: state.lastUpdateAttempt,
|
|
358
|
-
lastSuccessfulUpdate: state.lastSuccessfulUpdate,
|
|
359
|
-
pendingUpdate: state.pendingUpdate,
|
|
360
|
-
errorCount: state.errorHistory.length,
|
|
361
|
-
options: this.options,
|
|
362
|
-
nextCheck: state.lastUpdateAttempt
|
|
363
|
-
? new Date(new Date(state.lastUpdateAttempt).getTime() + this.options.checkIntervalMinutes * 60 * 1000).toISOString()
|
|
364
|
-
: null
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Configure update settings
|
|
369
|
-
*/
|
|
370
|
-
async configureUpdates(config) {
|
|
371
|
-
this.log('info', 'Updating self-update configuration');
|
|
372
|
-
this.options = {
|
|
373
|
-
...this.options,
|
|
374
|
-
...config
|
|
375
|
-
};
|
|
376
|
-
// Save configuration
|
|
377
|
-
const configPath = path.join(path.dirname(this.stateFile), 'update-config.json');
|
|
378
|
-
fs.writeFileSync(configPath, JSON.stringify(this.options, null, 2), 'utf8');
|
|
379
|
-
this.log('info', 'Self-update configuration updated');
|
|
380
|
-
return {
|
|
381
|
-
success: true,
|
|
382
|
-
newConfig: this.options,
|
|
383
|
-
configPath
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
// ============================================================================
|
|
387
|
-
// IMPLEMENTATION DETAILS
|
|
388
|
-
// ============================================================================
|
|
389
|
-
async loadState() {
|
|
390
|
-
try {
|
|
391
|
-
if (fs.existsSync(this.stateFile)) {
|
|
392
|
-
const content = fs.readFileSync(this.stateFile, 'utf8');
|
|
393
|
-
return JSON.parse(content);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
catch (error) {
|
|
397
|
-
this.log('warn', `Failed to load update state: ${error}`);
|
|
398
|
-
}
|
|
399
|
-
// Default state
|
|
400
|
-
return {
|
|
401
|
-
currentVersion: await this.getCurrentVersion(),
|
|
402
|
-
updateInProgress: false,
|
|
403
|
-
lastUpdateAttempt: null,
|
|
404
|
-
lastSuccessfulUpdate: null,
|
|
405
|
-
pendingUpdate: null,
|
|
406
|
-
errorHistory: []
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
async saveState(state) {
|
|
410
|
-
try {
|
|
411
|
-
fs.writeFileSync(this.stateFile, JSON.stringify(state, null, 2), 'utf8');
|
|
412
|
-
}
|
|
413
|
-
catch (error) {
|
|
414
|
-
this.log('error', `Failed to save update state: ${error.message}`);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
async getCurrentVersion() {
|
|
418
|
-
try {
|
|
419
|
-
// Read package.json
|
|
420
|
-
const packagePath = path.join(process.cwd(), 'package.json');
|
|
421
|
-
if (fs.existsSync(packagePath)) {
|
|
422
|
-
const packageData = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
423
|
-
return packageData.version || '0.0.0';
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
catch (error) {
|
|
427
|
-
this.log('warn', `Failed to read current version: ${error}`);
|
|
428
|
-
}
|
|
429
|
-
return '0.0.0';
|
|
430
|
-
}
|
|
431
|
-
async checkNpmRegistry() {
|
|
432
|
-
try {
|
|
433
|
-
// In a real implementation, this would query npm registry
|
|
434
|
-
// For now, simulate with a mock
|
|
435
|
-
return await this.mockNpmRegistryCheck();
|
|
436
|
-
}
|
|
437
|
-
catch (error) {
|
|
438
|
-
this.log('error', `Failed to check npm registry: ${error.message}`);
|
|
439
|
-
throw error;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
async mockNpmRegistryCheck() {
|
|
443
|
-
// Simulate registry check with delay
|
|
444
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
445
|
-
// Mock version based on update channel
|
|
446
|
-
const baseVersion = '1.2.0';
|
|
447
|
-
switch (this.options.updateChannel) {
|
|
448
|
-
case 'alpha':
|
|
449
|
-
return `${baseVersion}-alpha.1`;
|
|
450
|
-
case 'beta':
|
|
451
|
-
return `${baseVersion}-beta.1`;
|
|
452
|
-
default:
|
|
453
|
-
return baseVersion;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
compareVersions(v1, v2) {
|
|
457
|
-
// Simple version comparison
|
|
458
|
-
const parts1 = v1.split(/[.-]/).map(part => parseInt(part, 10) || 0);
|
|
459
|
-
const parts2 = v2.split(/[.-]/).map(part => parseInt(part, 10) || 0);
|
|
460
|
-
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
461
|
-
const p1 = parts1[i] || 0;
|
|
462
|
-
const p2 = parts2[i] || 0;
|
|
463
|
-
if (p1 < p2)
|
|
464
|
-
return -1;
|
|
465
|
-
if (p1 > p2)
|
|
466
|
-
return 1;
|
|
467
|
-
}
|
|
468
|
-
return 0;
|
|
469
|
-
}
|
|
470
|
-
shouldAutoUpdate(manifest) {
|
|
471
|
-
if (!this.options.enableAutoUpdate)
|
|
472
|
-
return false;
|
|
473
|
-
// Check if this is a minor update and auto-install is enabled
|
|
474
|
-
const current = manifest.version.split('.');
|
|
475
|
-
const isMinorUpdate = current[2] && parseInt(current[2]) > 0; // Patch update
|
|
476
|
-
if (isMinorUpdate && this.options.autoInstallMinor) {
|
|
477
|
-
return true;
|
|
478
|
-
}
|
|
479
|
-
return false;
|
|
480
|
-
}
|
|
481
|
-
async fetchUpdateManifest(version) {
|
|
482
|
-
// In a real implementation, this would fetch from a manifest server
|
|
483
|
-
// For now, create a mock manifest
|
|
484
|
-
return {
|
|
485
|
-
version,
|
|
486
|
-
timestamp: new Date().toISOString(),
|
|
487
|
-
changes: [
|
|
488
|
-
'Performance improvements',
|
|
489
|
-
'Bug fixes',
|
|
490
|
-
'Security updates',
|
|
491
|
-
'New capabilities added'
|
|
492
|
-
],
|
|
493
|
-
dependencies: {
|
|
494
|
-
'node': '>=18.0.0',
|
|
495
|
-
'npm': '>=9.0.0'
|
|
496
|
-
},
|
|
497
|
-
breakingChanges: version.startsWith('2.') || version.includes('alpha'),
|
|
498
|
-
rollbackSupported: true
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
async createBackup() {
|
|
502
|
-
const backupDir = path.join(this.updateDir, 'backups', new Date().toISOString().replace(/[:.]/g, '-'));
|
|
503
|
-
fs.mkdirSync(backupDir, { recursive: true });
|
|
504
|
-
// Copy key directories
|
|
505
|
-
const dirsToBackup = ['dist', 'src', 'package.json', 'package-lock.json'];
|
|
506
|
-
for (const dir of dirsToBackup) {
|
|
507
|
-
const source = path.join(process.cwd(), dir);
|
|
508
|
-
const target = path.join(backupDir, dir);
|
|
509
|
-
if (fs.existsSync(source)) {
|
|
510
|
-
if (fs.statSync(source).isDirectory()) {
|
|
511
|
-
this.copyDirectory(source, target);
|
|
512
|
-
}
|
|
513
|
-
else {
|
|
514
|
-
fs.copyFileSync(source, target);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
this.log('info', `Backup created at: ${backupDir}`);
|
|
519
|
-
return backupDir;
|
|
520
|
-
}
|
|
521
|
-
copyDirectory(source, target) {
|
|
522
|
-
if (!fs.existsSync(target)) {
|
|
523
|
-
fs.mkdirSync(target, { recursive: true });
|
|
524
|
-
}
|
|
525
|
-
const items = fs.readdirSync(source);
|
|
526
|
-
for (const item of items) {
|
|
527
|
-
const sourcePath = path.join(source, item);
|
|
528
|
-
const targetPath = path.join(target, item);
|
|
529
|
-
if (fs.statSync(sourcePath).isDirectory()) {
|
|
530
|
-
this.copyDirectory(sourcePath, targetPath);
|
|
531
|
-
}
|
|
532
|
-
else {
|
|
533
|
-
fs.copyFileSync(sourcePath, targetPath);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
async downloadUpdate(manifest) {
|
|
538
|
-
const updatePath = path.join(this.updateDir, `update-${manifest.version}`);
|
|
539
|
-
fs.mkdirSync(updatePath, { recursive: true });
|
|
540
|
-
// Save manifest
|
|
541
|
-
fs.writeFileSync(path.join(updatePath, 'manifest.json'), JSON.stringify(manifest, null, 2), 'utf8');
|
|
542
|
-
// In a real implementation, this would download the update package
|
|
543
|
-
// For now, create a mock update package
|
|
544
|
-
this.log('info', `Update package prepared at: ${updatePath}`);
|
|
545
|
-
return updatePath;
|
|
546
|
-
}
|
|
547
|
-
async applyUpdate(updatePath, manifest) {
|
|
548
|
-
this.log('info', `Applying update to version ${manifest.version}`);
|
|
549
|
-
// Simulate update process
|
|
550
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
551
|
-
// In a real implementation, this would:
|
|
552
|
-
// 1. Extract update package
|
|
553
|
-
// 2. Run pre-update scripts
|
|
554
|
-
// 3. Replace files
|
|
555
|
-
// 4. Run post-update scripts
|
|
556
|
-
// 5. Update dependencies
|
|
557
|
-
this.log('info', 'Update applied successfully');
|
|
558
|
-
return {
|
|
559
|
-
success: true,
|
|
560
|
-
version: manifest.version,
|
|
561
|
-
updatePath,
|
|
562
|
-
appliedAt: new Date().toISOString()
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
async performRollback(targetVersion) {
|
|
566
|
-
this.log('info', 'Performing rollback...');
|
|
567
|
-
// Find backup
|
|
568
|
-
const backupDir = path.join(this.updateDir, 'backups');
|
|
569
|
-
if (!fs.existsSync(backupDir)) {
|
|
570
|
-
throw new Error('No backups available for rollback');
|
|
571
|
-
}
|
|
572
|
-
const backups = fs.readdirSync(backupDir)
|
|
573
|
-
.map(name => ({ name, path: path.join(backupDir, name) }))
|
|
574
|
-
.filter(item => fs.statSync(item.path).isDirectory())
|
|
575
|
-
.sort((a, b) => b.name.localeCompare(a.name)); // Most recent first
|
|
576
|
-
if (backups.length === 0) {
|
|
577
|
-
throw new Error('No backups found');
|
|
578
|
-
}
|
|
579
|
-
// Use most recent backup or find specific version
|
|
580
|
-
const backup = targetVersion
|
|
581
|
-
? backups.find(b => b.name.includes(targetVersion))
|
|
582
|
-
: backups[0];
|
|
583
|
-
if (!backup) {
|
|
584
|
-
throw new Error(`Backup for version ${targetVersion} not found`);
|
|
585
|
-
}
|
|
586
|
-
// Restore from backup
|
|
587
|
-
this.log('info', `Restoring from backup: ${backup.name}`);
|
|
588
|
-
// In a real implementation, this would restore files from backup
|
|
589
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
590
|
-
return {
|
|
591
|
-
success: true,
|
|
592
|
-
rolledBackFrom: await this.getCurrentVersion(),
|
|
593
|
-
rolledBackTo: targetVersion || 'previous',
|
|
594
|
-
backup: backup.name,
|
|
595
|
-
timestamp: new Date().toISOString()
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Perform manual update using npm commands
|
|
600
|
-
*/
|
|
601
|
-
async performManualUpdate(command) {
|
|
602
|
-
this.log('info', `Performing manual update: ${command}`);
|
|
603
|
-
try {
|
|
604
|
-
// Execute npm command
|
|
605
|
-
const output = execSync(command, {
|
|
606
|
-
cwd: process.cwd(),
|
|
607
|
-
stdio: 'pipe',
|
|
608
|
-
encoding: 'utf8'
|
|
609
|
-
});
|
|
610
|
-
this.log('info', 'Manual update completed successfully');
|
|
611
|
-
return {
|
|
612
|
-
success: true,
|
|
613
|
-
command,
|
|
614
|
-
output,
|
|
615
|
-
timestamp: new Date().toISOString()
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
catch (error) {
|
|
619
|
-
this.log('error', `Manual update failed: ${error.message}`);
|
|
620
|
-
throw error;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Check system requirements
|
|
625
|
-
*/
|
|
626
|
-
async checkSystemRequirements() {
|
|
627
|
-
const requirements = {
|
|
628
|
-
node: {
|
|
629
|
-
required: '>=18.0.0',
|
|
630
|
-
current: process.version,
|
|
631
|
-
satisfied: false
|
|
632
|
-
},
|
|
633
|
-
npm: {
|
|
634
|
-
required: '>=9.0.0',
|
|
635
|
-
current: '',
|
|
636
|
-
satisfied: false
|
|
637
|
-
},
|
|
638
|
-
diskSpace: {
|
|
639
|
-
required: '100MB',
|
|
640
|
-
available: '',
|
|
641
|
-
satisfied: false
|
|
642
|
-
},
|
|
643
|
-
permissions: {
|
|
644
|
-
required: 'write access to project directory',
|
|
645
|
-
satisfied: false
|
|
646
|
-
}
|
|
647
|
-
};
|
|
648
|
-
try {
|
|
649
|
-
// Check npm version
|
|
650
|
-
const npmVersion = execSync('npm --version', { encoding: 'utf8' }).trim();
|
|
651
|
-
requirements.npm.current = npmVersion;
|
|
652
|
-
requirements.npm.satisfied = this.compareVersions(npmVersion, '9.0.0') >= 0;
|
|
653
|
-
// Check disk space (simplified)
|
|
654
|
-
requirements.diskSpace.available = '1GB'; // Mock
|
|
655
|
-
requirements.diskSpace.satisfied = true;
|
|
656
|
-
// Check permissions
|
|
657
|
-
try {
|
|
658
|
-
const testFile = path.join(process.cwd(), '.permission-test');
|
|
659
|
-
fs.writeFileSync(testFile, 'test');
|
|
660
|
-
fs.unlinkSync(testFile);
|
|
661
|
-
requirements.permissions.satisfied = true;
|
|
662
|
-
}
|
|
663
|
-
catch {
|
|
664
|
-
requirements.permissions.satisfied = false;
|
|
665
|
-
}
|
|
666
|
-
// Check node version
|
|
667
|
-
requirements.node.satisfied = this.compareVersions(process.version.replace('v', ''), '18.0.0') >= 0;
|
|
668
|
-
const allSatisfied = Object.values(requirements).every(req => typeof req === 'object' && 'satisfied' in req ? req.satisfied : true);
|
|
669
|
-
return {
|
|
670
|
-
requirements,
|
|
671
|
-
allSatisfied,
|
|
672
|
-
canUpdate: allSatisfied
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
catch (error) {
|
|
676
|
-
this.log('error', `System check failed: ${error.message}`);
|
|
677
|
-
throw error;
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Schedule automatic update check
|
|
682
|
-
*/
|
|
683
|
-
scheduleAutoUpdateCheck() {
|
|
684
|
-
if (!this.options.enableAutoUpdate)
|
|
685
|
-
return;
|
|
686
|
-
const intervalMs = this.options.checkIntervalMinutes * 60 * 1000;
|
|
687
|
-
setInterval(async () => {
|
|
688
|
-
try {
|
|
689
|
-
this.log('info', 'Performing scheduled update check');
|
|
690
|
-
const result = await this.checkForUpdates(false);
|
|
691
|
-
if (result.updateAvailable && result.shouldUpdate) {
|
|
692
|
-
this.log('info', 'Auto-installing update...');
|
|
693
|
-
await this.installUpdate(result.latestVersion, false);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
catch (error) {
|
|
697
|
-
this.log('error', `Scheduled update check failed: ${error.message}`);
|
|
698
|
-
}
|
|
699
|
-
}, intervalMs);
|
|
700
|
-
this.log('info', `Scheduled update check every ${this.options.checkIntervalMinutes} minutes`);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
// ============================================================================
|
|
704
|
-
// QUICK SELF-UPDATE UTILITIES
|
|
705
|
-
// ============================================================================
|
|
706
|
-
/**
|
|
707
|
-
* Quick self-update utility
|
|
708
|
-
*/
|
|
709
|
-
export async function quickSelfUpdate(options) {
|
|
710
|
-
console.log('Self-update capability ready for integration');
|
|
711
|
-
return {
|
|
712
|
-
message: 'Self-update system initialized',
|
|
713
|
-
version: '1.0.0',
|
|
714
|
-
capabilities: ['check', 'install', 'rollback', 'status']
|
|
715
|
-
};
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Register self-update capability with framework factory
|
|
719
|
-
*/
|
|
720
|
-
export function registerSelfUpdateCapability() {
|
|
721
|
-
// This would register with UniversalCapabilityFactory
|
|
722
|
-
// For now, export the capability class
|
|
723
|
-
console.log('Self-update capability ready for integration');
|
|
724
|
-
}
|
|
725
|
-
//# sourceMappingURL=selfUpdateSystem.js.map
|