imcp 0.1.7 → 0.1.8-dev
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/cli/commands/install.js +1 -106
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/list.js +1 -90
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/pull.js +1 -16
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/serve.js +1 -33
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/uninstall.js +1 -46
- package/dist/cli/commands/uninstall.js.map +1 -0
- package/dist/cli/index.js +1 -65
- package/dist/cli/index.js.map +1 -0
- package/dist/core/installers/clients/BaseClientInstaller.js +1 -282
- package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstaller.js +1 -163
- package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstallerFactory.js +1 -36
- package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
- package/dist/core/installers/clients/ClineInstaller.js +1 -30
- package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
- package/dist/core/installers/clients/ExtensionInstaller.js +1 -151
- package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
- package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -68
- package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
- package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -28
- package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
- package/dist/core/installers/index.js +1 -8
- package/dist/core/installers/index.js.map +1 -0
- package/dist/core/installers/requirements/BaseInstaller.js +1 -56
- package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
- package/dist/core/installers/requirements/CommandInstaller.js +1 -213
- package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
- package/dist/core/installers/requirements/GeneralInstaller.js +1 -126
- package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
- package/dist/core/installers/requirements/InstallerFactory.js +1 -99
- package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
- package/dist/core/installers/requirements/NpmInstaller.js +1 -235
- package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
- package/dist/core/installers/requirements/NugetInstaller.js +1 -188
- package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
- package/dist/core/installers/requirements/PipInstaller.js +1 -192
- package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
- package/dist/core/installers/requirements/RequirementInstaller.js +1 -2
- package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
- package/dist/core/loaders/ConfigurationLoader.js +1 -256
- package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
- package/dist/core/loaders/ConfigurationProvider.js +1 -383
- package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
- package/dist/core/loaders/InstallOperationManager.js +1 -310
- package/dist/core/loaders/InstallOperationManager.js.map +1 -0
- package/dist/core/loaders/ServerSchemaLoader.js +1 -108
- package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
- package/dist/core/loaders/ServerSchemaProvider.js +1 -89
- package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
- package/dist/core/loaders/SystemSettingsManager.js +1 -256
- package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
- package/dist/core/metadatas/constants.js +1 -100
- package/dist/core/metadatas/constants.js.map +1 -0
- package/dist/core/metadatas/recordingConstants.js +1 -46
- package/dist/core/metadatas/recordingConstants.js.map +1 -0
- package/dist/core/metadatas/types.js +1 -15
- package/dist/core/metadatas/types.js.map +1 -0
- package/dist/core/onboard/FeedOnboardService.js +1 -422
- package/dist/core/onboard/FeedOnboardService.js.map +1 -0
- package/dist/core/onboard/OnboardProcessor.js +1 -333
- package/dist/core/onboard/OnboardProcessor.js.map +1 -0
- package/dist/core/onboard/OnboardStatus.js +1 -9
- package/dist/core/onboard/OnboardStatus.js.map +1 -0
- package/dist/core/onboard/OnboardStatusManager.js +1 -360
- package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
- package/dist/core/validators/FeedValidator.js +1 -133
- package/dist/core/validators/FeedValidator.js.map +1 -0
- package/dist/core/validators/IServerValidator.js +1 -1
- package/dist/core/validators/IServerValidator.js.map +1 -0
- package/dist/core/validators/SSEServerValidator.js +1 -38
- package/dist/core/validators/SSEServerValidator.js.map +1 -0
- package/dist/core/validators/ServerValidatorFactory.js +1 -44
- package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
- package/dist/core/validators/StdioServerValidator.js +1 -281
- package/dist/core/validators/StdioServerValidator.js.map +1 -0
- package/dist/index.js +1 -18
- package/dist/index.js.map +1 -0
- package/dist/services/InstallationService.js +1 -81
- package/dist/services/InstallationService.js.map +1 -0
- package/dist/services/MCPManager.js +1 -197
- package/dist/services/MCPManager.js.map +1 -0
- package/dist/services/RequirementService.js +1 -548
- package/dist/services/RequirementService.js.map +1 -0
- package/dist/services/ServerService.js +1 -127
- package/dist/services/ServerService.js.map +1 -0
- package/dist/services/TelemetryService.js +1 -53
- package/dist/services/TelemetryService.js.map +1 -0
- package/dist/utils/UpdateCheckTracker.js +1 -79
- package/dist/utils/UpdateCheckTracker.js.map +1 -0
- package/dist/utils/adoUtils.js +1 -254
- package/dist/utils/adoUtils.js.map +1 -0
- package/dist/utils/clientUtils.js +1 -65
- package/dist/utils/clientUtils.js.map +1 -0
- package/dist/utils/feedUtils.js +1 -28
- package/dist/utils/feedUtils.js.map +1 -0
- package/dist/utils/githubAuth.js +1 -177
- package/dist/utils/githubAuth.js.map +1 -0
- package/dist/utils/githubUtils.js +1 -125
- package/dist/utils/githubUtils.js.map +1 -0
- package/dist/utils/logger.js +1 -176
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/macroExpressionUtils.js +1 -93
- package/dist/utils/macroExpressionUtils.js.map +1 -0
- package/dist/utils/osUtils.js +1 -664
- package/dist/utils/osUtils.js.map +1 -0
- package/dist/utils/versionUtils.js +1 -101
- package/dist/utils/versionUtils.js.map +1 -0
- package/dist/web/contract/serverContract.js +1 -1
- package/dist/web/contract/serverContract.js.map +1 -0
- package/dist/web/public/js/api.js +2 -132
- package/dist/web/public/js/api.js.map +1 -0
- package/dist/web/public/js/detailsWidget.js +2 -264
- package/dist/web/public/js/detailsWidget.js.map +1 -0
- package/dist/web/public/js/flights/flights.js +2 -127
- package/dist/web/public/js/flights/flights.js.map +1 -0
- package/dist/web/public/js/modal/index.js +2 -52
- package/dist/web/public/js/modal/index.js.map +1 -0
- package/dist/web/public/js/modal/installModal.js +2 -162
- package/dist/web/public/js/modal/installModal.js.map +1 -0
- package/dist/web/public/js/modal/installation.js +2 -266
- package/dist/web/public/js/modal/installation.js.map +1 -0
- package/dist/web/public/js/modal/loadingModal.js +2 -182
- package/dist/web/public/js/modal/loadingModal.js.map +1 -0
- package/dist/web/public/js/modal/modalSetup.js +2 -595
- package/dist/web/public/js/modal/modalSetup.js.map +1 -0
- package/dist/web/public/js/modal/modalUtils.js +2 -37
- package/dist/web/public/js/modal/modalUtils.js.map +1 -0
- package/dist/web/public/js/modal/versionUtils.js +2 -20
- package/dist/web/public/js/modal/versionUtils.js.map +1 -0
- package/dist/web/public/js/modal.js +2 -42
- package/dist/web/public/js/modal.js.map +1 -0
- package/dist/web/public/js/notifications.js +2 -137
- package/dist/web/public/js/notifications.js.map +1 -0
- package/dist/web/public/js/onboard/formProcessor.js +2 -1037
- package/dist/web/public/js/onboard/formProcessor.js.map +1 -0
- package/dist/web/public/js/onboard/index.js +2 -374
- package/dist/web/public/js/onboard/index.js.map +1 -0
- package/dist/web/public/js/onboard/publishHandler.js +2 -172
- package/dist/web/public/js/onboard/publishHandler.js.map +1 -0
- package/dist/web/public/js/onboard/state.js +2 -76
- package/dist/web/public/js/onboard/state.js.map +1 -0
- package/dist/web/public/js/onboard/templates.js +2 -342
- package/dist/web/public/js/onboard/templates.js.map +1 -0
- package/dist/web/public/js/onboard/uiHandlers.js +2 -1076
- package/dist/web/public/js/onboard/uiHandlers.js.map +1 -0
- package/dist/web/public/js/onboard/validationHandlers.js +2 -493
- package/dist/web/public/js/onboard/validationHandlers.js.map +1 -0
- package/dist/web/public/js/serverCategoryDetails.js +2 -364
- package/dist/web/public/js/serverCategoryDetails.js.map +1 -0
- package/dist/web/public/js/serverCategoryList.js +2 -241
- package/dist/web/public/js/serverCategoryList.js.map +1 -0
- package/dist/web/public/js/settings.js +2 -314
- package/dist/web/public/js/settings.js.map +1 -0
- package/dist/web/server.js +1 -404
- package/dist/web/server.js.map +1 -0
- package/package.json +8 -2
- package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
- package/.github/acl/access.yml +0 -20
- package/.github/compliance/inventory.yml +0 -5
- package/.github/policies/jit.yml +0 -19
- package/.github/workflows/build.yml +0 -28
- package/.roo/rules-code/rules.md +0 -88
- package/dist/cli/commands/start.d.ts +0 -2
- package/dist/cli/commands/start.js +0 -32
- package/dist/cli/commands/sync.d.ts +0 -2
- package/dist/cli/commands/sync.js +0 -17
- package/dist/core/ConfigurationLoader.d.ts +0 -32
- package/dist/core/ConfigurationLoader.js +0 -236
- package/dist/core/ConfigurationProvider.d.ts +0 -35
- package/dist/core/ConfigurationProvider.js +0 -375
- package/dist/core/InstallationService.d.ts +0 -50
- package/dist/core/InstallationService.js +0 -350
- package/dist/core/MCPManager.d.ts +0 -28
- package/dist/core/MCPManager.js +0 -188
- package/dist/core/RequirementService.d.ts +0 -40
- package/dist/core/RequirementService.js +0 -110
- package/dist/core/ServerSchemaLoader.d.ts +0 -11
- package/dist/core/ServerSchemaLoader.js +0 -43
- package/dist/core/ServerSchemaProvider.d.ts +0 -17
- package/dist/core/ServerSchemaProvider.js +0 -120
- package/dist/core/constants.d.ts +0 -47
- package/dist/core/constants.js +0 -94
- package/dist/core/installers/BaseInstaller.d.ts +0 -74
- package/dist/core/installers/BaseInstaller.js +0 -253
- package/dist/core/installers/ClientInstaller.d.ts +0 -23
- package/dist/core/installers/ClientInstaller.js +0 -564
- package/dist/core/installers/CommandInstaller.d.ts +0 -37
- package/dist/core/installers/CommandInstaller.js +0 -173
- package/dist/core/installers/GeneralInstaller.d.ts +0 -33
- package/dist/core/installers/GeneralInstaller.js +0 -85
- package/dist/core/installers/InstallerFactory.d.ts +0 -54
- package/dist/core/installers/InstallerFactory.js +0 -97
- package/dist/core/installers/NpmInstaller.d.ts +0 -26
- package/dist/core/installers/NpmInstaller.js +0 -127
- package/dist/core/installers/PipInstaller.d.ts +0 -28
- package/dist/core/installers/PipInstaller.js +0 -127
- package/dist/core/installers/RequirementInstaller.d.ts +0 -33
- package/dist/core/installers/RequirementInstaller.js +0 -3
- package/dist/core/types.d.ts +0 -166
- package/dist/core/types.js +0 -16
- package/dist/services/InstallRequestValidator.d.ts +0 -21
- package/dist/services/InstallRequestValidator.js +0 -99
- package/dist/web/public/js/modal/installHandler.js +0 -227
- package/dist/web/public/js/modal/loadingUI.js +0 -74
- package/dist/web/public/js/modal/messageQueue.js +0 -112
- package/dist/web/public/js/modal/modalUI.js +0 -214
- package/dist/web/public/js/modal/version.js +0 -20
- package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +0 -370
- package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
- package/docs/Telemetry.md +0 -136
- package/memory-bank/activeContext.md +0 -26
- package/memory-bank/decisionLog.md +0 -91
- package/memory-bank/productContext.md +0 -41
- package/memory-bank/progress.md +0 -35
- package/memory-bank/systemPatterns.md +0 -10
- package/src/cli/commands/install.ts +0 -139
- package/src/cli/commands/list.ts +0 -113
- package/src/cli/commands/pull.ts +0 -16
- package/src/cli/commands/serve.ts +0 -39
- package/src/cli/commands/uninstall.ts +0 -64
- package/src/cli/index.ts +0 -82
- package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
- package/src/core/installers/clients/ClientInstaller.ts +0 -222
- package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
- package/src/core/installers/clients/ClineInstaller.ts +0 -35
- package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
- package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
- package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
- package/src/core/installers/index.ts +0 -11
- package/src/core/installers/requirements/BaseInstaller.ts +0 -85
- package/src/core/installers/requirements/CommandInstaller.ts +0 -231
- package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
- package/src/core/installers/requirements/InstallerFactory.ts +0 -114
- package/src/core/installers/requirements/NpmInstaller.ts +0 -271
- package/src/core/installers/requirements/NugetInstaller.ts +0 -203
- package/src/core/installers/requirements/PipInstaller.ts +0 -207
- package/src/core/installers/requirements/RequirementInstaller.ts +0 -42
- package/src/core/loaders/ConfigurationLoader.ts +0 -298
- package/src/core/loaders/ConfigurationProvider.ts +0 -462
- package/src/core/loaders/InstallOperationManager.ts +0 -367
- package/src/core/loaders/ServerSchemaLoader.ts +0 -117
- package/src/core/loaders/ServerSchemaProvider.ts +0 -99
- package/src/core/loaders/SystemSettingsManager.ts +0 -278
- package/src/core/metadatas/constants.ts +0 -122
- package/src/core/metadatas/recordingConstants.ts +0 -65
- package/src/core/metadatas/types.ts +0 -202
- package/src/core/onboard/FeedOnboardService.ts +0 -501
- package/src/core/onboard/OnboardProcessor.ts +0 -356
- package/src/core/onboard/OnboardStatus.ts +0 -60
- package/src/core/onboard/OnboardStatusManager.ts +0 -416
- package/src/core/validators/FeedValidator.ts +0 -135
- package/src/core/validators/IServerValidator.ts +0 -21
- package/src/core/validators/SSEServerValidator.ts +0 -43
- package/src/core/validators/ServerValidatorFactory.ts +0 -51
- package/src/core/validators/StdioServerValidator.ts +0 -313
- package/src/index.ts +0 -44
- package/src/services/InstallationService.ts +0 -102
- package/src/services/MCPManager.ts +0 -249
- package/src/services/RequirementService.ts +0 -627
- package/src/services/ServerService.ts +0 -161
- package/src/services/TelemetryService.ts +0 -59
- package/src/utils/UpdateCheckTracker.ts +0 -86
- package/src/utils/adoUtils.ts +0 -293
- package/src/utils/clientUtils.ts +0 -72
- package/src/utils/feedUtils.ts +0 -31
- package/src/utils/githubAuth.ts +0 -212
- package/src/utils/githubUtils.ts +0 -164
- package/src/utils/logger.ts +0 -195
- package/src/utils/macroExpressionUtils.ts +0 -104
- package/src/utils/osUtils.ts +0 -700
- package/src/utils/versionUtils.ts +0 -114
- package/src/web/contract/serverContract.ts +0 -74
- package/src/web/public/css/detailsWidget.css +0 -235
- package/src/web/public/css/modal.css +0 -757
- package/src/web/public/css/notifications.css +0 -101
- package/src/web/public/css/onboard.css +0 -107
- package/src/web/public/css/serverCategoryList.css +0 -120
- package/src/web/public/css/serverDetails.css +0 -139
- package/src/web/public/index.html +0 -359
- package/src/web/public/js/api.js +0 -132
- package/src/web/public/js/detailsWidget.js +0 -264
- package/src/web/public/js/flights/flights.js +0 -127
- package/src/web/public/js/modal/index.js +0 -52
- package/src/web/public/js/modal/installModal.js +0 -162
- package/src/web/public/js/modal/installation.js +0 -266
- package/src/web/public/js/modal/loadingModal.js +0 -182
- package/src/web/public/js/modal/modalSetup.js +0 -595
- package/src/web/public/js/modal/modalUtils.js +0 -37
- package/src/web/public/js/modal/versionUtils.js +0 -20
- package/src/web/public/js/modal.js +0 -42
- package/src/web/public/js/notifications.js +0 -137
- package/src/web/public/js/onboard/formProcessor.js +0 -1037
- package/src/web/public/js/onboard/index.js +0 -374
- package/src/web/public/js/onboard/publishHandler.js +0 -172
- package/src/web/public/js/onboard/state.js +0 -76
- package/src/web/public/js/onboard/templates.js +0 -342
- package/src/web/public/js/onboard/uiHandlers.js +0 -1076
- package/src/web/public/js/onboard/validationHandlers.js +0 -493
- package/src/web/public/js/serverCategoryDetails.js +0 -364
- package/src/web/public/js/serverCategoryList.js +0 -241
- package/src/web/public/js/settings.js +0 -314
- package/src/web/public/modal.html +0 -84
- package/src/web/public/onboard.html +0 -296
- package/src/web/public/settings.html +0 -135
- package/src/web/public/styles.css +0 -277
- package/src/web/server.ts +0 -478
- package/tsconfig.json +0 -18
- package/wiki/Installation.md +0 -3
- package/wiki/Publish.md +0 -3
|
@@ -1,501 +0,0 @@
|
|
|
1
|
-
import { FeedConfiguration, McpConfig } from '../metadatas/types.js';
|
|
2
|
-
import { configProvider } from '../loaders/ConfigurationProvider.js';
|
|
3
|
-
import { ServerSchemaProvider } from '../loaders/ServerSchemaProvider.js';
|
|
4
|
-
import { feedValidator } from '../validators/FeedValidator.js';
|
|
5
|
-
import { Logger, EventType, EventStatus } from '../../utils/logger.js';
|
|
6
|
-
import { OnboardingProcessStatus, OperationStatus, OperationType, ValidationOperationResult } from './OnboardStatus.js';
|
|
7
|
-
import { onboardStatusManager } from './OnboardStatusManager.js';
|
|
8
|
-
import { onboardProcessor } from './OnboardProcessor.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Service for handling feed onboarding operations
|
|
12
|
-
*/
|
|
13
|
-
export class FeedOnboardService {
|
|
14
|
-
// tempDir and repoDir will be generated per onboarding process
|
|
15
|
-
|
|
16
|
-
constructor() {
|
|
17
|
-
// No shared tempDir or repoDir at instance level
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Creates an operation ID that combines feed name and operation type.
|
|
22
|
-
* @param feedName The name of the feed.
|
|
23
|
-
* @param operationType The type of operation.
|
|
24
|
-
* @returns Combined operation ID string.
|
|
25
|
-
*/
|
|
26
|
-
private createOperationId(feedName: string, operationType: OperationType): string {
|
|
27
|
-
return `${feedName}_${operationType}`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Onboard a new feed configuration. This method performs validation and initiates the onboarding process.
|
|
32
|
-
* @param config Feed configuration to onboard
|
|
33
|
-
* @param forExistingCategory Whether this onboarding is for an existing category
|
|
34
|
-
* @returns Promise resolving to operation status with optional feed configuration
|
|
35
|
-
*/
|
|
36
|
-
public async onboardFeed(config: FeedConfiguration, forExistingCategory?: boolean): Promise<OperationStatus & { feedConfiguration?: FeedConfiguration }> {
|
|
37
|
-
// Perform static validation first
|
|
38
|
-
const serverList = await this.validateStaticConfig(config, forExistingCategory);
|
|
39
|
-
|
|
40
|
-
// Check for an existing, succeeded VALIDATION_ONLY operation with an identical configuration.
|
|
41
|
-
const existingSucceededValidation = await onboardStatusManager.findSucceededOperation(config.name, 'VALIDATION_ONLY', config);
|
|
42
|
-
|
|
43
|
-
if (!existingSucceededValidation) {
|
|
44
|
-
// If no matching successful validation is found, instruct user to validate first.
|
|
45
|
-
Logger.log(`Feed ${config.name} has not been successfully validated with the current configuration. Publishing requires prior successful validation.`);
|
|
46
|
-
// Return a specific status/message indicating validation is required.
|
|
47
|
-
// This is not a FAILED state for an operation, but a prerequisite not met.
|
|
48
|
-
// We'll use a custom message and potentially a specific status if we define one for "PREREQUISITE_FAILED" or similar.
|
|
49
|
-
// For now, let's return a FAILED status for the attempted FULL_ONBOARDING initiation.
|
|
50
|
-
// A more robust solution might involve a different return type or error code.
|
|
51
|
-
const onboardingId = this.createOperationId(config.name, 'FULL_ONBOARDING'); // Hypothetical ID
|
|
52
|
-
const errorMessage = `No prior successful validation found for feed: ${config.name}. Please validate the configuration before publishing.`;
|
|
53
|
-
|
|
54
|
-
// Track failed event
|
|
55
|
-
Logger.trackEvent(EventType.FEED_ONBOARD, {
|
|
56
|
-
status: EventStatus.FAILED,
|
|
57
|
-
feedName: config.name,
|
|
58
|
-
errorMessage,
|
|
59
|
-
onboardingId: onboardingId,
|
|
60
|
-
feedConfiguration: config
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
onboardingId: onboardingId,
|
|
65
|
-
status: OnboardingProcessStatus.FAILED, // Or a new status like 'VALIDATION_REQUIRED'
|
|
66
|
-
message: errorMessage,
|
|
67
|
-
lastQueried: new Date().toISOString(),
|
|
68
|
-
feedConfiguration: config
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
Logger.log(`Found existing successful validation for feed: ${config.name}. Proceeding with full onboarding.`);
|
|
73
|
-
// If validation exists and matches, proceed to initiate FULL_ONBOARDING.
|
|
74
|
-
// _initiateOperation will handle checks for existing non-completed or successfully completed FULL_ONBOARDING operations.
|
|
75
|
-
const operationStatus = await this._initiateOperation(config, 'FULL_ONBOARDING', serverList, forExistingCategory);
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
...operationStatus,
|
|
79
|
-
feedConfiguration: config
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Validate a feed configuration without performing full onboarding.
|
|
85
|
-
* This method performs static validation and initiates the validation process.
|
|
86
|
-
* @param config Feed configuration to validate
|
|
87
|
-
* @param forExistingCategory Whether this validation is for an existing category
|
|
88
|
-
* @returns Promise resolving to operation status with optional feed configuration
|
|
89
|
-
*/
|
|
90
|
-
public async validateFeed(config: FeedConfiguration, forExistingCategory?: boolean): Promise<OperationStatus & { feedConfiguration?: FeedConfiguration }> {
|
|
91
|
-
// Perform static validation first
|
|
92
|
-
const serverList = await this.validateStaticConfig(config, forExistingCategory);
|
|
93
|
-
|
|
94
|
-
const operationStatus = await this._initiateOperation(config, 'VALIDATION_ONLY', serverList, forExistingCategory);
|
|
95
|
-
|
|
96
|
-
return { ...operationStatus, feedConfiguration: config };
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Initiates either a full onboarding or a validation-only operation.
|
|
101
|
-
* It checks for existing non-completed operations for the same feed and operation type.
|
|
102
|
-
* If an existing operation is found, its status is returned. Otherwise, a new operation is created and started.
|
|
103
|
-
* @param config The feed configuration.
|
|
104
|
-
* @param operationType The type of operation to initiate (FULL_ONBOARDING or VALIDATION_ONLY).
|
|
105
|
-
* @param serverList The list of server names to process.
|
|
106
|
-
* @returns A promise that resolves to the operation status.
|
|
107
|
-
*/
|
|
108
|
-
private async _initiateOperation(config: FeedConfiguration, operationType: OperationType, serverList: string[], forExistingCategory?: boolean): Promise<OperationStatus & { feedConfiguration?: FeedConfiguration }> {
|
|
109
|
-
// Check for successful operations with matching configuration
|
|
110
|
-
const succeededOperation = await onboardStatusManager.findSucceededOperation(config.name, operationType, config);
|
|
111
|
-
if (succeededOperation) {
|
|
112
|
-
Logger.log(`[${succeededOperation.onboardingId}] Found existing successful ${operationType} operation for feed: ${config.name} with matching configuration.`);
|
|
113
|
-
const operationStatus: OperationStatus & { feedConfiguration?: FeedConfiguration } = {
|
|
114
|
-
onboardingId: succeededOperation.onboardingId,
|
|
115
|
-
status: succeededOperation.status,
|
|
116
|
-
message: `A successful ${operationType} already exists for this feed with identical configuration.`,
|
|
117
|
-
lastQueried: new Date().toISOString(),
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
if (config) {
|
|
121
|
-
operationStatus.feedConfiguration = config;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return operationStatus;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// If no existing or matching operations found, create a new one
|
|
128
|
-
const onboardingId = this.createOperationId(config.name, operationType);
|
|
129
|
-
const initialStatus = await onboardStatusManager.createInitialStatus(config.name, operationType);
|
|
130
|
-
|
|
131
|
-
// Use config.name as categoryName for saveFeedConfiguration
|
|
132
|
-
await onboardStatusManager.saveFeedConfiguration(config.name, operationType, config);
|
|
133
|
-
|
|
134
|
-
if (operationType === 'FULL_ONBOARDING') {
|
|
135
|
-
// For FULL_ONBOARDING, we assume all servers defined in the config are to be processed for PR creation.
|
|
136
|
-
// The serverList from validateStaticConfig primarily influences validation.
|
|
137
|
-
// If specific servers need to be excluded from the PR, this logic might need adjustment.
|
|
138
|
-
this.processFullOnboarding(onboardingId, config, operationType, serverList).catch(async (error) => {
|
|
139
|
-
Logger.error(`[${onboardingId}] Full feed onboarding process failed:`, error);
|
|
140
|
-
await onboardStatusManager.recordStep(
|
|
141
|
-
config.name,
|
|
142
|
-
operationType,
|
|
143
|
-
'Failed during full onboarding process',
|
|
144
|
-
undefined, // serverName
|
|
145
|
-
OnboardingProcessStatus.FAILED,
|
|
146
|
-
error instanceof Error ? error.message : String(error)
|
|
147
|
-
);
|
|
148
|
-
});
|
|
149
|
-
} else if (operationType === 'VALIDATION_ONLY') {
|
|
150
|
-
this.processValidationOnly(onboardingId, config, operationType, serverList).catch(async (error) => {
|
|
151
|
-
Logger.error(`[${onboardingId}] Feed validation process failed:`, error);
|
|
152
|
-
await onboardStatusManager.recordStep(
|
|
153
|
-
config.name,
|
|
154
|
-
operationType,
|
|
155
|
-
'Failed during validation process',
|
|
156
|
-
undefined, // serverName
|
|
157
|
-
OnboardingProcessStatus.FAILED,
|
|
158
|
-
error instanceof Error ? error.message : String(error)
|
|
159
|
-
// TODO: Consider how to best store/pass 'validationStatus' if it's still needed at this specific failure point
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return {
|
|
165
|
-
onboardingId,
|
|
166
|
-
status: OnboardingProcessStatus.PENDING,
|
|
167
|
-
message: `New ${operationType} process started with ID: ${onboardingId}.`,
|
|
168
|
-
lastQueried: new Date().toISOString(),
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Performs static validation of the feed configuration.
|
|
174
|
-
* @param config The feed configuration to validate.
|
|
175
|
-
* @param forExistingCategory Whether this is for an existing category.
|
|
176
|
-
* @returns A promise that resolves to a list of server names to be processed.
|
|
177
|
-
* @throws Error if validation fails.
|
|
178
|
-
*/
|
|
179
|
-
private async validateStaticConfig(config: FeedConfiguration, forExistingCategory?: boolean): Promise<string[]> {
|
|
180
|
-
// --- Start of moved and enhanced static validation ---
|
|
181
|
-
if (!config || typeof config !== 'object') { // Check if config itself is a valid object
|
|
182
|
-
throw new Error('Invalid configuration: Input must be a valid object.');
|
|
183
|
-
}
|
|
184
|
-
if (typeof config.name !== 'string' || !config.name.trim()) {
|
|
185
|
-
throw new Error('Invalid configuration: "name" must be a non-empty string.');
|
|
186
|
-
}
|
|
187
|
-
if (!Array.isArray(config.requirements)) {
|
|
188
|
-
throw new Error('Invalid configuration: "requirements" must be an array.');
|
|
189
|
-
}
|
|
190
|
-
if (!Array.isArray(config.mcpServers)) {
|
|
191
|
-
throw new Error('Invalid configuration: "mcpServers" must be an array.');
|
|
192
|
-
}
|
|
193
|
-
// --- End of moved static validation ---
|
|
194
|
-
|
|
195
|
-
const existingConfig = await configProvider.getFeedConfiguration(config.name);
|
|
196
|
-
// Note: operationType validation is handled at the MCP server level
|
|
197
|
-
|
|
198
|
-
let serverListToProcess: string[];
|
|
199
|
-
|
|
200
|
-
if (forExistingCategory) {
|
|
201
|
-
if (!existingConfig) {
|
|
202
|
-
throw new Error(`Cannot update non-existent category: ${config.name}. Please ensure the category name is correct or create it as a new category.`);
|
|
203
|
-
}
|
|
204
|
-
// For existing categories, mcpServers list must be present in the payload.
|
|
205
|
-
if (!config.mcpServers || config.mcpServers.length === 0) {
|
|
206
|
-
throw new Error('For an existing category, "mcpServers" must be provided and non-empty in the payload.');
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const existingServerNames = new Set(existingConfig.mcpServers.map((s: McpConfig) => s.name));
|
|
210
|
-
// Servers to process are those that are new OR existing ones marked as adhoc in the payload.
|
|
211
|
-
const serversToProcessInPayload = config.mcpServers.filter(payloadServer => {
|
|
212
|
-
const isNew = !existingServerNames.has(payloadServer.name);
|
|
213
|
-
const isAdhocInPayload = payloadServer.systemTags?.adhoc === 'true';
|
|
214
|
-
return isNew || (existingServerNames.has(payloadServer.name) && isAdhocInPayload);
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
if (serversToProcessInPayload.length === 0) {
|
|
218
|
-
// If no new or editable (adhoc) servers are found in the payload for an existing category, it's an error.
|
|
219
|
-
throw new Error(`No new or adhoc (editable) servers provided for the existing category "${config.name}". Ensure the "mcpServers" list in your payload contains at least one server not already in this category or an existing server marked with adhoc:true.`);
|
|
220
|
-
}
|
|
221
|
-
serverListToProcess = serversToProcessInPayload.map(s => s.name);
|
|
222
|
-
} else { // For new categories
|
|
223
|
-
if (existingConfig) {
|
|
224
|
-
// If it's not for an existing category, but the category name already exists, this is an error.
|
|
225
|
-
// Adhoc tags on servers are not relevant here as we are creating a new category.
|
|
226
|
-
throw new Error(`Category "${config.name}" already exists. To modify an existing category, please set 'forExistingCategory' to true.`);
|
|
227
|
-
}
|
|
228
|
-
// For new categories, mcpServers list must be present and non-empty.
|
|
229
|
-
if (!config.mcpServers || config.mcpServers.length === 0) {
|
|
230
|
-
throw new Error('Server configuration ("mcpServers") must be provided and non-empty for new categories.');
|
|
231
|
-
}
|
|
232
|
-
// For new categories, all servers in the payload are considered.
|
|
233
|
-
serverListToProcess = config.mcpServers.map(s => s.name);
|
|
234
|
-
}
|
|
235
|
-
// Remove systemTags from individual servers
|
|
236
|
-
if (config.mcpServers && Array.isArray(config.mcpServers)) {
|
|
237
|
-
config.mcpServers.forEach(server => {
|
|
238
|
-
if (server.systemTags) {
|
|
239
|
-
delete server.systemTags;
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Remove systemTags and PullRequest from the main config object
|
|
245
|
-
if (config.systemTags) {
|
|
246
|
-
delete config.systemTags;
|
|
247
|
-
}
|
|
248
|
-
if (config.PullRequest) {
|
|
249
|
-
delete config.PullRequest;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return serverListToProcess;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Validates the feed configuration.
|
|
257
|
-
* Updates the onboarding status to VALIDATING, then to VALIDATED or FAILED based on the validation result.
|
|
258
|
-
* @param onboardingId The ID of the onboarding process.
|
|
259
|
-
* @param config The feed configuration to validate.
|
|
260
|
-
* @param operationType The type of operation this validation is for.
|
|
261
|
-
* @param serverList The list of server names to validate.
|
|
262
|
-
* @throws Error if validation fails, to be caught by the calling process.
|
|
263
|
-
*/
|
|
264
|
-
private async _validateFeedConfiguration(onboardingId: string, config: FeedConfiguration, operationType: OperationType, serverList: string[]): Promise<void> {
|
|
265
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'Validating feed configuration', undefined, OnboardingProcessStatus.VALIDATING);
|
|
266
|
-
let overallValidationStatus: ValidationOperationResult['validationStatus'] = { isValid: true, serverResults: [] };
|
|
267
|
-
try {
|
|
268
|
-
await feedValidator.validate(config, config.name, operationType);
|
|
269
|
-
|
|
270
|
-
// Then, validate each MCP server specified in the serverList
|
|
271
|
-
for (const serverConfig of config.mcpServers) {
|
|
272
|
-
if (!serverList.includes(serverConfig.name)) {
|
|
273
|
-
Logger.log(`[${onboardingId}] Skipping validation for server ${serverConfig.name} as it's not in the specified list for this operation.`);
|
|
274
|
-
// Optionally, record a skipped status or add to serverResults as skipped
|
|
275
|
-
overallValidationStatus.serverResults?.push({ serverName: serverConfig.name, isValid: true, message: "Skipped (existed)" });
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
try {
|
|
279
|
-
await feedValidator.validateServer(serverConfig, config, config.name, operationType);
|
|
280
|
-
overallValidationStatus.serverResults?.push({ serverName: serverConfig.name, isValid: true });
|
|
281
|
-
await onboardStatusManager.recordStep(config.name, operationType, `Validated server: ${serverConfig.name}`, serverConfig.name, OnboardingProcessStatus.VALIDATING);
|
|
282
|
-
await onboardStatusManager.updateStatus(config.name, operationType, { validationStatus: overallValidationStatus });
|
|
283
|
-
} catch (serverValidationError: any) {
|
|
284
|
-
overallValidationStatus.isValid = false;
|
|
285
|
-
overallValidationStatus.serverResults?.push({
|
|
286
|
-
serverName: serverConfig.name,
|
|
287
|
-
isValid: false,
|
|
288
|
-
message: serverValidationError.message || String(serverValidationError)
|
|
289
|
-
});
|
|
290
|
-
await onboardStatusManager.recordStep(
|
|
291
|
-
config.name,
|
|
292
|
-
operationType,
|
|
293
|
-
`Validation failed for server: ${serverConfig.name}`,
|
|
294
|
-
serverConfig.name,
|
|
295
|
-
OnboardingProcessStatus.FAILED,
|
|
296
|
-
`Server ${serverConfig.name}: ${serverValidationError.message || String(serverValidationError)}`
|
|
297
|
-
);
|
|
298
|
-
await onboardStatusManager.updateStatus(config.name, operationType, { validationStatus: overallValidationStatus });
|
|
299
|
-
throw serverValidationError; // Propagate the error to fail the whole validation
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// If all *processed* servers validated successfully
|
|
304
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'All servers in feed configuration validated successfully', undefined, OnboardingProcessStatus.VALIDATED);
|
|
305
|
-
await onboardStatusManager.updateStatus(config.name, operationType, { validationStatus: overallValidationStatus });
|
|
306
|
-
} catch (error) {
|
|
307
|
-
const validationError = error as any; // Assuming error might have validation details
|
|
308
|
-
await onboardStatusManager.recordStep(
|
|
309
|
-
config.name,
|
|
310
|
-
operationType,
|
|
311
|
-
'Feed configuration validation failed',
|
|
312
|
-
undefined,
|
|
313
|
-
OnboardingProcessStatus.FAILED,
|
|
314
|
-
validationError.message || String(error)
|
|
315
|
-
);
|
|
316
|
-
await onboardStatusManager.updateStatus(config.name, operationType, {
|
|
317
|
-
validationStatus: {
|
|
318
|
-
isValid: false,
|
|
319
|
-
message: validationError.message || String(error),
|
|
320
|
-
serverResults: overallValidationStatus.serverResults // Ensure this is up-to-date
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
throw error; // Re-throw to be caught by the calling process
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Processes a validation-only operation for a feed configuration.
|
|
329
|
-
* It validates the configuration and updates the status to SUCCEEDED if validation is successful.
|
|
330
|
-
* If validation fails, the error is handled by _validateFeedConfiguration and the calling _initiateOperation method.
|
|
331
|
-
* @param onboardingId The ID of the onboarding process.
|
|
332
|
-
* @param config The feed configuration.
|
|
333
|
-
* @param operationType The type of operation (should be 'VALIDATION_ONLY').
|
|
334
|
-
* @param serverList The list of server names to validate.
|
|
335
|
-
*/
|
|
336
|
-
private async processValidationOnly(onboardingId: string, config: FeedConfiguration, operationType: OperationType, serverList: string[]): Promise<void> {
|
|
337
|
-
try {
|
|
338
|
-
// Pass operationType and serverList to _validateFeedConfiguration
|
|
339
|
-
await this._validateFeedConfiguration(onboardingId, config, operationType, serverList);
|
|
340
|
-
// Use config.name and operationType for getStatus
|
|
341
|
-
const finalStatus = await onboardStatusManager.getStatus(config.name, operationType);
|
|
342
|
-
const result: ValidationOperationResult = {
|
|
343
|
-
validationStatus: finalStatus?.validationStatus || { isValid: true, serverResults: [] },
|
|
344
|
-
feedConfiguration: config
|
|
345
|
-
};
|
|
346
|
-
// Use config.name and operationType for recordStep and updateStatus
|
|
347
|
-
await onboardStatusManager.recordStep(
|
|
348
|
-
config.name,
|
|
349
|
-
operationType,
|
|
350
|
-
'Feed configuration validated successfully',
|
|
351
|
-
undefined, // serverName
|
|
352
|
-
OnboardingProcessStatus.SUCCEEDED
|
|
353
|
-
);
|
|
354
|
-
await onboardStatusManager.updateStatus(config.name, operationType, {
|
|
355
|
-
errorMessage: undefined, // Clear any previous error
|
|
356
|
-
prInfo: undefined, // Clear PR info for validation-only
|
|
357
|
-
result: result, // Set the result
|
|
358
|
-
validationStatus: result.validationStatus // Ensure validationStatus is also updated on success
|
|
359
|
-
});
|
|
360
|
-
Logger.log(`[${onboardingId}] Successfully validated feed: ${config.name}`);
|
|
361
|
-
|
|
362
|
-
// Track successful validation
|
|
363
|
-
Logger.trackEvent(EventType.FEED_VALIDATE, {
|
|
364
|
-
status: EventStatus.SUCCESS,
|
|
365
|
-
feedName: config.name,
|
|
366
|
-
operationType: 'VALIDATION_ONLY',
|
|
367
|
-
onboardingId: onboardingId,
|
|
368
|
-
feedConfiguration: config
|
|
369
|
-
});
|
|
370
|
-
} catch (error) {
|
|
371
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
372
|
-
// Error is already logged and status updated by _validateFeedConfiguration or its callers
|
|
373
|
-
Logger.error(`[${onboardingId}] Feed validation process failed for ${config.name} (already handled):`, error);
|
|
374
|
-
|
|
375
|
-
// Track validation failure
|
|
376
|
-
Logger.trackEvent(EventType.FEED_VALIDATE, {
|
|
377
|
-
status: EventStatus.FAILED,
|
|
378
|
-
feedName: config.name,
|
|
379
|
-
operationType: 'VALIDATION_ONLY',
|
|
380
|
-
errorMessage: errorMessage,
|
|
381
|
-
onboardingId: onboardingId,
|
|
382
|
-
feedConfiguration: config
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Processes the full onboarding for a feed configuration.
|
|
390
|
-
* This includes validation, forking/cloning the repository, saving the config, and creating a pull request.
|
|
391
|
-
* Manages status updates throughout the process and handles cleanup of temporary directories.
|
|
392
|
-
* @param onboardingId The ID of the onboarding process.
|
|
393
|
-
* @param config The feed configuration.
|
|
394
|
-
* @param operationType The type of operation (should be 'FULL_ONBOARDING').
|
|
395
|
-
* @throws Error if any step of the full onboarding process fails.
|
|
396
|
-
*/
|
|
397
|
-
private async processFullOnboarding(onboardingId: string, config: FeedConfiguration, operationType: OperationType, serverList: string[]): Promise<void> {
|
|
398
|
-
const { tempDir, repoDir } = onboardProcessor.createDirectories(onboardingId);
|
|
399
|
-
try {
|
|
400
|
-
// Validation is now a prerequisite and assumed to be done if this process is initiated.
|
|
401
|
-
// The status should be PENDING or a similar initial state from _initiateOperation.
|
|
402
|
-
// We directly proceed to PR creation steps.
|
|
403
|
-
// The first step recorded here will likely move status from PENDING to PR_CREATING.
|
|
404
|
-
|
|
405
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'Starting PR creation process (validation confirmed)', undefined, OnboardingProcessStatus.PR_CREATING);
|
|
406
|
-
|
|
407
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'Forking repository', undefined, OnboardingProcessStatus.PR_CREATING);
|
|
408
|
-
await onboardProcessor.forkRepo(onboardingId, repoDir);
|
|
409
|
-
|
|
410
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'Cloning repository', undefined, OnboardingProcessStatus.PR_CREATING);
|
|
411
|
-
await onboardProcessor.cloneRepo(onboardingId, tempDir, repoDir);
|
|
412
|
-
|
|
413
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'Setting up branch', undefined, OnboardingProcessStatus.PR_CREATING);
|
|
414
|
-
const branchName = await onboardProcessor.setupBranch(onboardingId, config, repoDir);
|
|
415
|
-
|
|
416
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'Saving feed configuration to repository', undefined, OnboardingProcessStatus.PR_CREATING);
|
|
417
|
-
const { feedFilePath, categorySchemasPath } = await onboardProcessor.saveFeedConfigToRepo(onboardingId, config, repoDir, serverList);
|
|
418
|
-
|
|
419
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'Creating pull request', undefined, OnboardingProcessStatus.PR_CREATING);
|
|
420
|
-
const prInfo = await onboardProcessor.createPullRequest(onboardingId, config, repoDir, branchName);
|
|
421
|
-
|
|
422
|
-
// Step 3: Finalize with SUCCEEDED status for PR creation
|
|
423
|
-
await onboardStatusManager.recordStep(config.name, operationType, prInfo.prExists ? 'Successfully updated to existing pull request' : 'Successfully created pull request', undefined, OnboardingProcessStatus.SUCCEEDED);
|
|
424
|
-
await onboardStatusManager.updateStatus(config.name, operationType, {
|
|
425
|
-
errorMessage: undefined, // Clear any previous errors
|
|
426
|
-
prInfo: prInfo,
|
|
427
|
-
result: prInfo.url // Store PR URL as the result
|
|
428
|
-
});
|
|
429
|
-
Logger.log(`[${onboardingId}] Successfully created/updated PR for feed: ${config.name}. PR URL: ${prInfo.url}`);
|
|
430
|
-
|
|
431
|
-
// After successful PR, re-initialize providers
|
|
432
|
-
try {
|
|
433
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'Reloading server schemas', undefined, OnboardingProcessStatus.SUCCEEDED);
|
|
434
|
-
Logger.log(`[${onboardingId}] Initializing ServerSchemaProvider with new schemas at ${categorySchemasPath}`);
|
|
435
|
-
await ServerSchemaProvider.getInstance().initialize(categorySchemasPath);
|
|
436
|
-
Logger.log(`[${onboardingId}] ServerSchemaProvider re-initialized.`);
|
|
437
|
-
|
|
438
|
-
await onboardStatusManager.recordStep(config.name, operationType, 'Reloading configurations', undefined, OnboardingProcessStatus.SUCCEEDED);
|
|
439
|
-
Logger.log(`[${onboardingId}] Initializing ConfigurationProvider with new feed file at ${feedFilePath}`);
|
|
440
|
-
await configProvider.initialize(feedFilePath, { prLink: prInfo.url, adhocServers: serverList }); // configProvider is already an instance
|
|
441
|
-
Logger.log(`[${onboardingId}] ConfigurationProvider re-initialized.`);
|
|
442
|
-
|
|
443
|
-
Logger.log(`[${onboardingId}] Successfully completed full onboarding for feed: ${config.name}`);
|
|
444
|
-
|
|
445
|
-
// Track successful onboarding
|
|
446
|
-
Logger.trackEvent(EventType.FEED_ONBOARD, {
|
|
447
|
-
status: EventStatus.SUCCESS,
|
|
448
|
-
feedName: config.name,
|
|
449
|
-
onboardingId: onboardingId,
|
|
450
|
-
prUrl: prInfo.url,
|
|
451
|
-
feedConfiguration: config
|
|
452
|
-
});
|
|
453
|
-
} catch (reinitError) {
|
|
454
|
-
Logger.warn(`[${onboardingId}] Failed to re-initialize providers after PR creation for feed ${config.name}:`);
|
|
455
|
-
Logger.warn(`Skipping re-initialization of providers due to error: ${reinitError}`,);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
} catch (error) {
|
|
459
|
-
Logger.error(`[${onboardingId}] Full feed onboarding process failed:`, error);
|
|
460
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
461
|
-
|
|
462
|
-
// Track onboarding failure
|
|
463
|
-
Logger.trackEvent(EventType.FEED_ONBOARD, {
|
|
464
|
-
status: EventStatus.FAILED,
|
|
465
|
-
feedName: config.name,
|
|
466
|
-
onboardingId: onboardingId,
|
|
467
|
-
errorMessage,
|
|
468
|
-
feedConfiguration: config
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
// Check if status is already FAILED (e.g., by _validateFeedConfiguration)
|
|
472
|
-
// to avoid overwriting a more specific error message or step from validation.
|
|
473
|
-
const currentStatus = await onboardStatusManager.getStatus(config.name, operationType);
|
|
474
|
-
if (currentStatus?.status !== OnboardingProcessStatus.FAILED) {
|
|
475
|
-
let stepName = 'Failed during full onboarding process';
|
|
476
|
-
if (error instanceof Error && 'step' in error && typeof error.step === 'string') {
|
|
477
|
-
stepName = `Failed at step: ${error.step}`;
|
|
478
|
-
} else if (currentStatus?.steps && currentStatus.steps.length > 0) {
|
|
479
|
-
// If not already failed by validation, use the last known good step before this error
|
|
480
|
-
stepName = `Failed after step: ${currentStatus.steps[currentStatus.steps.length - 1].stepName}`;
|
|
481
|
-
}
|
|
482
|
-
await onboardStatusManager.recordStep(
|
|
483
|
-
config.name,
|
|
484
|
-
operationType,
|
|
485
|
-
stepName,
|
|
486
|
-
undefined, // serverName
|
|
487
|
-
OnboardingProcessStatus.FAILED,
|
|
488
|
-
errorMessage
|
|
489
|
-
);
|
|
490
|
-
} else {
|
|
491
|
-
// If already FAILED, the error and step were likely recorded by _validateFeedConfiguration.
|
|
492
|
-
// Log the current error context if it's different or provides more info.
|
|
493
|
-
Logger.log(`[${onboardingId}] Process was already marked as FAILED. Additional context - Current error: ${errorMessage}. Initial error from status: ${currentStatus.errorMessage}`);
|
|
494
|
-
}
|
|
495
|
-
throw error; // Re-throw to ensure the promise from processFullOnboarding is rejected.
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// Export singleton instance
|
|
501
|
-
export const feedOnboardService = new FeedOnboardService();
|