@vibebrowser/chrome-devtools-mcp 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +873 -0
- package/build/src/DevToolsConnectionAdapter.js +70 -0
- package/build/src/DevtoolsUtils.js +295 -0
- package/build/src/HeapSnapshotManager.js +110 -0
- package/build/src/McpContext.js +605 -0
- package/build/src/McpPage.js +315 -0
- package/build/src/McpResponse.js +858 -0
- package/build/src/Mutex.js +38 -0
- package/build/src/PageCollector.js +297 -0
- package/build/src/SlimMcpResponse.js +19 -0
- package/build/src/TextSnapshot.js +236 -0
- package/build/src/ToolHandler.js +217 -0
- package/build/src/WaitForHelper.js +190 -0
- package/build/src/bin/check-latest-version.js +50 -0
- package/build/src/bin/chrome-devtools-cli-options.js +840 -0
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +350 -0
- package/build/src/bin/chrome-devtools-mcp-main.js +94 -0
- package/build/src/bin/chrome-devtools-mcp.js +31 -0
- package/build/src/bin/chrome-devtools.js +189 -0
- package/build/src/bin/install-service.js +246 -0
- package/build/src/bin/service/chrome-devtools-mcp.service.template +17 -0
- package/build/src/bin/service/com.vibebrowser.chrome-devtools-mcp.plist.template +37 -0
- package/build/src/browser.js +204 -0
- package/build/src/daemon/client.js +154 -0
- package/build/src/daemon/daemon.js +204 -0
- package/build/src/daemon/types.js +7 -0
- package/build/src/daemon/utils.js +115 -0
- package/build/src/formatters/ConsoleFormatter.js +288 -0
- package/build/src/formatters/HeapSnapshotFormatter.js +54 -0
- package/build/src/formatters/IssueFormatter.js +193 -0
- package/build/src/formatters/NetworkFormatter.js +236 -0
- package/build/src/formatters/SnapshotFormatter.js +135 -0
- package/build/src/index.js +140 -0
- package/build/src/issue-descriptions.js +40 -0
- package/build/src/logger.js +37 -0
- package/build/src/polyfill.js +8 -0
- package/build/src/telemetry/ClearcutLogger.js +169 -0
- package/build/src/telemetry/WatchdogClient.js +61 -0
- package/build/src/telemetry/errors.js +18 -0
- package/build/src/telemetry/flagUtils.js +89 -0
- package/build/src/telemetry/metricsRegistry.js +89 -0
- package/build/src/telemetry/persistence.js +72 -0
- package/build/src/telemetry/transformation.js +134 -0
- package/build/src/telemetry/types.js +31 -0
- package/build/src/telemetry/watchdog/ClearcutSender.js +205 -0
- package/build/src/telemetry/watchdog/main.js +128 -0
- package/build/src/third_party/devtools-formatter-worker.js +8 -0
- package/build/src/third_party/devtools-heap-snapshot-worker.js +8 -0
- package/build/src/third_party/index.js +32 -0
- package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +8 -0
- package/build/src/third_party/issue-descriptions/arInsecureContext.md +7 -0
- package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +5 -0
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +6 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +4 -0
- package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +18 -0
- package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +19 -0
- package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +8 -0
- package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +9 -0
- package/build/src/third_party/issue-descriptions/arSourceIgnored.md +13 -0
- package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +12 -0
- package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +10 -0
- package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +11 -0
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
- package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +8 -0
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
- package/build/src/third_party/issue-descriptions/deprecation.md +3 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
- package/build/src/third_party/issue-descriptions/heavyAd.md +10 -0
- package/build/src/third_party/issue-descriptions/mixedContent.md +5 -0
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
- package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
- package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
- package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
- package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +10 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
- package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +61598 -0
- package/build/src/tools/ToolDefinition.js +73 -0
- package/build/src/tools/categories.js +36 -0
- package/build/src/tools/console.js +91 -0
- package/build/src/tools/emulation.js +57 -0
- package/build/src/tools/extensions.js +96 -0
- package/build/src/tools/input.js +461 -0
- package/build/src/tools/lighthouse.js +131 -0
- package/build/src/tools/memory.js +106 -0
- package/build/src/tools/network.js +125 -0
- package/build/src/tools/pages.js +411 -0
- package/build/src/tools/performance.js +196 -0
- package/build/src/tools/screencast.js +95 -0
- package/build/src/tools/screenshot.js +87 -0
- package/build/src/tools/script.js +151 -0
- package/build/src/tools/slim/tools.js +85 -0
- package/build/src/tools/snapshot.js +60 -0
- package/build/src/tools/thirdPartyDeveloper.js +75 -0
- package/build/src/tools/tools.js +56 -0
- package/build/src/tools/webmcp.js +64 -0
- package/build/src/trace-processing/parse.js +85 -0
- package/build/src/types.js +7 -0
- package/build/src/utils/check-for-updates.js +74 -0
- package/build/src/utils/files.js +18 -0
- package/build/src/utils/id.js +16 -0
- package/build/src/utils/keyboard.js +297 -0
- package/build/src/utils/pagination.js +50 -0
- package/build/src/utils/string.js +37 -0
- package/build/src/utils/types.js +7 -0
- package/build/src/version.js +10 -0
- package/package.json +93 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { logger } from './logger.js';
|
|
7
|
+
import { McpResponse } from './McpResponse.js';
|
|
8
|
+
import { SlimMcpResponse } from './SlimMcpResponse.js';
|
|
9
|
+
import { ClearcutLogger } from './telemetry/ClearcutLogger.js';
|
|
10
|
+
import { bucketizeLatency } from './telemetry/transformation.js';
|
|
11
|
+
import { zod } from './third_party/index.js';
|
|
12
|
+
import { labels, OFF_BY_DEFAULT_CATEGORIES } from './tools/categories.js';
|
|
13
|
+
import { pageIdSchema } from './tools/ToolDefinition.js';
|
|
14
|
+
export function buildFlag(category) {
|
|
15
|
+
return `category${category.charAt(0).toUpperCase() + category.slice(1)}`;
|
|
16
|
+
}
|
|
17
|
+
function buildDisabledMessage(toolName, flag, categoryLabel) {
|
|
18
|
+
const reason = categoryLabel
|
|
19
|
+
? `is in category ${categoryLabel} which`
|
|
20
|
+
: `requires experimental feature ${flag} and`;
|
|
21
|
+
return `Tool ${toolName} ${reason} is currently disabled. Enable it by running chrome-devtools start ${flag}=true. For more information check the README.`;
|
|
22
|
+
}
|
|
23
|
+
function getCategoryStatus(category, serverArgs) {
|
|
24
|
+
const categoryFlag = buildFlag(category);
|
|
25
|
+
const flagValue = serverArgs[categoryFlag];
|
|
26
|
+
const isDisabled = OFF_BY_DEFAULT_CATEGORIES.includes(category)
|
|
27
|
+
? !flagValue
|
|
28
|
+
: flagValue === false;
|
|
29
|
+
if (isDisabled) {
|
|
30
|
+
return {
|
|
31
|
+
categoryFlag,
|
|
32
|
+
disabled: true,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
disabled: false,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function getConditionStatus(condition, serverArgs) {
|
|
40
|
+
if (condition && !serverArgs[condition]) {
|
|
41
|
+
return { conditionFlag: condition, disabled: true };
|
|
42
|
+
}
|
|
43
|
+
return { disabled: false };
|
|
44
|
+
}
|
|
45
|
+
function getToolStatusInfo(tool, serverArgs) {
|
|
46
|
+
const category = tool.annotations.category;
|
|
47
|
+
const categoryCheck = getCategoryStatus(category, serverArgs);
|
|
48
|
+
if (category && categoryCheck.disabled) {
|
|
49
|
+
if (!categoryCheck.categoryFlag) {
|
|
50
|
+
throw new Error('when the category is disabled there should always be a flag set');
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
disabled: true,
|
|
54
|
+
reason: buildDisabledMessage(tool.name, `--${categoryCheck.categoryFlag}`, labels[category]),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
for (const condition of tool.annotations.conditions || []) {
|
|
58
|
+
const conditionCheck = getConditionStatus(condition, serverArgs);
|
|
59
|
+
if (conditionCheck.disabled) {
|
|
60
|
+
if (!conditionCheck.conditionFlag) {
|
|
61
|
+
throw new Error('when the condition is disabled there should always be a flag set');
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
disabled: true,
|
|
65
|
+
reason: buildDisabledMessage(tool.name, `--${conditionCheck.conditionFlag}`),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return { disabled: false };
|
|
70
|
+
}
|
|
71
|
+
function isPageScopedTool(tool) {
|
|
72
|
+
return 'pageScoped' in tool && tool.pageScoped === true;
|
|
73
|
+
}
|
|
74
|
+
function formatArgumentNames(names) {
|
|
75
|
+
return names.map(name => `"${name}"`).join(', ');
|
|
76
|
+
}
|
|
77
|
+
function buildUnknownArgumentsMessage(toolName, unknownArgumentNames, expectedArgumentNames) {
|
|
78
|
+
const unknownLabel = unknownArgumentNames.length === 1 ? 'argument' : 'arguments';
|
|
79
|
+
const expectedArguments = expectedArgumentNames.length
|
|
80
|
+
? `Expected arguments: ${formatArgumentNames(expectedArgumentNames)}.`
|
|
81
|
+
: 'This tool does not accept any arguments.';
|
|
82
|
+
const correction = unknownArgumentNames.length === 1 ? 'Remove it' : 'Remove them';
|
|
83
|
+
return `Unknown ${unknownLabel} for tool "${toolName}": ${formatArgumentNames(unknownArgumentNames)}. ${expectedArguments} ${correction} and retry.`;
|
|
84
|
+
}
|
|
85
|
+
export class ToolHandler {
|
|
86
|
+
tool;
|
|
87
|
+
serverArgs;
|
|
88
|
+
getContext;
|
|
89
|
+
toolMutex;
|
|
90
|
+
inputSchema;
|
|
91
|
+
registeredInputSchema;
|
|
92
|
+
shouldRegister;
|
|
93
|
+
disabledReason;
|
|
94
|
+
constructor(tool, serverArgs, getContext, toolMutex) {
|
|
95
|
+
this.tool = tool;
|
|
96
|
+
this.serverArgs = serverArgs;
|
|
97
|
+
this.getContext = getContext;
|
|
98
|
+
this.toolMutex = toolMutex;
|
|
99
|
+
const { disabled, reason } = getToolStatusInfo(tool, serverArgs);
|
|
100
|
+
this.disabledReason = reason;
|
|
101
|
+
this.shouldRegister = !(disabled && !serverArgs.viaCli);
|
|
102
|
+
this.inputSchema =
|
|
103
|
+
'pageScoped' in tool &&
|
|
104
|
+
tool.pageScoped &&
|
|
105
|
+
serverArgs.experimentalPageIdRouting &&
|
|
106
|
+
!serverArgs.slim
|
|
107
|
+
? { ...tool.schema, ...pageIdSchema }
|
|
108
|
+
: tool.schema;
|
|
109
|
+
this.registeredInputSchema = zod.object(this.inputSchema).passthrough();
|
|
110
|
+
}
|
|
111
|
+
unknownArgumentNames(params) {
|
|
112
|
+
return Object.keys(params).filter(key => !Object.hasOwn(this.inputSchema, key));
|
|
113
|
+
}
|
|
114
|
+
async handle(params) {
|
|
115
|
+
if (this.disabledReason) {
|
|
116
|
+
return {
|
|
117
|
+
content: [
|
|
118
|
+
{
|
|
119
|
+
type: 'text',
|
|
120
|
+
text: this.disabledReason,
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
isError: true,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const unknownArgumentNames = this.unknownArgumentNames(params);
|
|
127
|
+
if (unknownArgumentNames.length) {
|
|
128
|
+
return {
|
|
129
|
+
content: [
|
|
130
|
+
{
|
|
131
|
+
type: 'text',
|
|
132
|
+
text: buildUnknownArgumentsMessage(this.tool.name, unknownArgumentNames, Object.keys(this.inputSchema)),
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
isError: true,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const guard = await this.toolMutex.acquire();
|
|
139
|
+
const startTime = Date.now();
|
|
140
|
+
let success = false;
|
|
141
|
+
try {
|
|
142
|
+
logger(`${this.tool.name} request: ${JSON.stringify(params, null, ' ')}`);
|
|
143
|
+
const context = await this.getContext();
|
|
144
|
+
logger(`${this.tool.name} context: resolved`);
|
|
145
|
+
await context.detectOpenDevToolsWindows();
|
|
146
|
+
const response = this.serverArgs.slim
|
|
147
|
+
? new SlimMcpResponse(this.serverArgs)
|
|
148
|
+
: new McpResponse(this.serverArgs);
|
|
149
|
+
response.setRedactNetworkHeaders(this.serverArgs.redactNetworkHeaders);
|
|
150
|
+
try {
|
|
151
|
+
if (isPageScopedTool(this.tool)) {
|
|
152
|
+
const pageId = typeof params.pageId === 'number' ? params.pageId : undefined;
|
|
153
|
+
const page = this.serverArgs.experimentalPageIdRouting &&
|
|
154
|
+
pageId !== undefined &&
|
|
155
|
+
!this.serverArgs.slim
|
|
156
|
+
? context.getPageById(pageId)
|
|
157
|
+
: context.getSelectedMcpPage();
|
|
158
|
+
response.setPage(page);
|
|
159
|
+
if (this.tool.blockedByDialog) {
|
|
160
|
+
page.throwIfDialogOpen();
|
|
161
|
+
}
|
|
162
|
+
await this.tool.handler({
|
|
163
|
+
params,
|
|
164
|
+
page,
|
|
165
|
+
}, response, context);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
await this.tool.handler({
|
|
169
|
+
params,
|
|
170
|
+
}, response, context);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
response.setError(err);
|
|
175
|
+
}
|
|
176
|
+
const { content, structuredContent } = await response.handle(this.tool.name, context);
|
|
177
|
+
const result = {
|
|
178
|
+
content,
|
|
179
|
+
};
|
|
180
|
+
if (response.error) {
|
|
181
|
+
result.isError = true;
|
|
182
|
+
}
|
|
183
|
+
success = true;
|
|
184
|
+
if (this.serverArgs.experimentalStructuredContent) {
|
|
185
|
+
result.structuredContent = structuredContent;
|
|
186
|
+
}
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
catch (err) {
|
|
190
|
+
logger(`${this.tool.name} error:`, err, err?.stack);
|
|
191
|
+
let errorText = err && 'message' in err ? err.message : String(err);
|
|
192
|
+
if ('cause' in err && err.cause) {
|
|
193
|
+
errorText += `\nCause: ${err.cause.message}`;
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
content: [
|
|
197
|
+
{
|
|
198
|
+
type: 'text',
|
|
199
|
+
text: errorText,
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
isError: true,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
finally {
|
|
206
|
+
void ClearcutLogger.get()?.logToolInvocation({
|
|
207
|
+
toolName: this.tool.name,
|
|
208
|
+
params,
|
|
209
|
+
schema: this.inputSchema,
|
|
210
|
+
success,
|
|
211
|
+
latencyMs: bucketizeLatency(Date.now() - startTime),
|
|
212
|
+
});
|
|
213
|
+
guard.dispose();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=ToolHandler.js.map
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { logger } from './logger.js';
|
|
7
|
+
export class WaitForHelper {
|
|
8
|
+
#abortController = new AbortController();
|
|
9
|
+
#page;
|
|
10
|
+
#stableDomTimeout;
|
|
11
|
+
#stableDomFor;
|
|
12
|
+
#expectNavigationIn;
|
|
13
|
+
#navigationTimeout;
|
|
14
|
+
#dialogOpened = false;
|
|
15
|
+
#initialUrl;
|
|
16
|
+
constructor(page, cpuTimeoutMultiplier, networkTimeoutMultiplier) {
|
|
17
|
+
this.#stableDomTimeout = 3000 * cpuTimeoutMultiplier;
|
|
18
|
+
this.#stableDomFor = 100 * cpuTimeoutMultiplier;
|
|
19
|
+
this.#expectNavigationIn = 100 * cpuTimeoutMultiplier;
|
|
20
|
+
this.#navigationTimeout = 3000 * networkTimeoutMultiplier;
|
|
21
|
+
this.#page = page;
|
|
22
|
+
this.#initialUrl = page.url();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A wrapper that executes a action and waits for
|
|
26
|
+
* a potential navigation, after which it waits
|
|
27
|
+
* for the DOM to be stable before returning.
|
|
28
|
+
*/
|
|
29
|
+
async waitForStableDom() {
|
|
30
|
+
const stableDomObserver = await this.#page.evaluateHandle(timeout => {
|
|
31
|
+
let timeoutId;
|
|
32
|
+
function callback() {
|
|
33
|
+
clearTimeout(timeoutId);
|
|
34
|
+
timeoutId = setTimeout(() => {
|
|
35
|
+
domObserver.resolver.resolve();
|
|
36
|
+
domObserver.observer.disconnect();
|
|
37
|
+
}, timeout);
|
|
38
|
+
}
|
|
39
|
+
const domObserver = {
|
|
40
|
+
resolver: Promise.withResolvers(),
|
|
41
|
+
observer: new MutationObserver(callback),
|
|
42
|
+
};
|
|
43
|
+
// It's possible that the DOM is not gonna change so we
|
|
44
|
+
// need to start the timeout initially.
|
|
45
|
+
callback();
|
|
46
|
+
domObserver.observer.observe(document.body, {
|
|
47
|
+
childList: true,
|
|
48
|
+
subtree: true,
|
|
49
|
+
attributes: true,
|
|
50
|
+
});
|
|
51
|
+
return domObserver;
|
|
52
|
+
}, this.#stableDomFor);
|
|
53
|
+
this.#abortController.signal.addEventListener('abort', async () => {
|
|
54
|
+
try {
|
|
55
|
+
await stableDomObserver.evaluate(observer => {
|
|
56
|
+
observer.observer.disconnect();
|
|
57
|
+
observer.resolver.resolve();
|
|
58
|
+
});
|
|
59
|
+
await stableDomObserver.dispose();
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Ignored cleanup errors
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return Promise.race([
|
|
66
|
+
stableDomObserver.evaluate(async (observer) => {
|
|
67
|
+
return await observer.resolver.promise;
|
|
68
|
+
}),
|
|
69
|
+
this.timeout(this.#stableDomTimeout).then(() => {
|
|
70
|
+
throw new Error('Timeout');
|
|
71
|
+
}),
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
async waitForNavigationStarted() {
|
|
75
|
+
// Currently Puppeteer does not have API
|
|
76
|
+
// For when a navigation is about to start
|
|
77
|
+
const navigationStartedPromise = new Promise(resolve => {
|
|
78
|
+
const listener = (event) => {
|
|
79
|
+
if ([
|
|
80
|
+
'historySameDocument',
|
|
81
|
+
'historyDifferentDocument',
|
|
82
|
+
'sameDocument',
|
|
83
|
+
].includes(event.navigationType)) {
|
|
84
|
+
resolve(false);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
resolve(true);
|
|
88
|
+
};
|
|
89
|
+
this.#page._client().on('Page.frameStartedNavigating', listener);
|
|
90
|
+
this.#abortController.signal.addEventListener('abort', () => {
|
|
91
|
+
resolve(false);
|
|
92
|
+
this.#page._client().off('Page.frameStartedNavigating', listener);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
return await Promise.race([
|
|
96
|
+
navigationStartedPromise,
|
|
97
|
+
this.timeout(this.#expectNavigationIn).then(() => false),
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
timeout(time) {
|
|
101
|
+
return new Promise(res => {
|
|
102
|
+
const id = setTimeout(res, time);
|
|
103
|
+
this.#abortController.signal.addEventListener('abort', () => {
|
|
104
|
+
res();
|
|
105
|
+
clearTimeout(id);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async waitForEventsAfterAction(action, options) {
|
|
110
|
+
if (this.#abortController.signal.aborted) {
|
|
111
|
+
throw new Error("Can't re-use a WaitForHelper");
|
|
112
|
+
}
|
|
113
|
+
if (options?.handleDialog) {
|
|
114
|
+
const dialogHandler = (dialog) => {
|
|
115
|
+
this.#dialogOpened = true;
|
|
116
|
+
if (options.handleDialog === 'dismiss') {
|
|
117
|
+
void dialog.dismiss();
|
|
118
|
+
}
|
|
119
|
+
else if (options.handleDialog === 'accept') {
|
|
120
|
+
void dialog.accept();
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
void dialog.accept(options.handleDialog);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
this.#page.on('dialog', dialogHandler);
|
|
127
|
+
this.#abortController.signal.addEventListener('abort', () => {
|
|
128
|
+
this.#page.off('dialog', dialogHandler);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const navigationFinished = this.waitForNavigationStarted()
|
|
132
|
+
.then(navigationStated => {
|
|
133
|
+
if (navigationStated) {
|
|
134
|
+
return this.#page.waitForNavigation({
|
|
135
|
+
timeout: options?.timeout ?? this.#navigationTimeout,
|
|
136
|
+
signal: this.#abortController.signal,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
140
|
+
})
|
|
141
|
+
.catch(error => logger(error));
|
|
142
|
+
try {
|
|
143
|
+
await action();
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
// Clear up pending promises
|
|
147
|
+
this.#abortController.abort();
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
await navigationFinished;
|
|
152
|
+
if (this.#dialogOpened) {
|
|
153
|
+
return this.#getResult();
|
|
154
|
+
}
|
|
155
|
+
// Wait for stable dom after navigation so we execute in
|
|
156
|
+
// the correct context
|
|
157
|
+
await this.waitForStableDom();
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
logger(error);
|
|
161
|
+
}
|
|
162
|
+
finally {
|
|
163
|
+
this.#abortController.abort();
|
|
164
|
+
}
|
|
165
|
+
return this.#getResult();
|
|
166
|
+
}
|
|
167
|
+
#getResult() {
|
|
168
|
+
const urlAfterAction = this.#page.url();
|
|
169
|
+
return {
|
|
170
|
+
...(urlAfterAction !== this.#initialUrl
|
|
171
|
+
? { navigatedToUrl: urlAfterAction }
|
|
172
|
+
: {}),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
export function getNetworkMultiplierFromString(condition) {
|
|
177
|
+
const puppeteerCondition = condition;
|
|
178
|
+
switch (puppeteerCondition) {
|
|
179
|
+
case 'Fast 4G':
|
|
180
|
+
return 1;
|
|
181
|
+
case 'Slow 4G':
|
|
182
|
+
return 2.5;
|
|
183
|
+
case 'Fast 3G':
|
|
184
|
+
return 5;
|
|
185
|
+
case 'Slow 3G':
|
|
186
|
+
return 10;
|
|
187
|
+
}
|
|
188
|
+
return 1;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=WaitForHelper.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { execSync } from 'node:child_process';
|
|
7
|
+
import fs from 'node:fs/promises';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import process from 'node:process';
|
|
10
|
+
const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
|
|
11
|
+
function getRegistry() {
|
|
12
|
+
// Use the user's configured npm registry so update checks work behind
|
|
13
|
+
// corporate proxies and private registries. `npm config get registry`
|
|
14
|
+
// honors .npmrc files at every scope and respects npm_config_registry,
|
|
15
|
+
// so it covers direct CLI invocations as well as `npx` / `npm run`.
|
|
16
|
+
try {
|
|
17
|
+
const registry = execSync('npm config get registry', {
|
|
18
|
+
encoding: 'utf8',
|
|
19
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
20
|
+
timeout: 5000,
|
|
21
|
+
})
|
|
22
|
+
.trim()
|
|
23
|
+
.replace(/\/$/, '');
|
|
24
|
+
if (registry && registry !== 'undefined' && /^https?:\/\//.test(registry)) {
|
|
25
|
+
return registry;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// npm not on PATH or other errors, fall back to default.
|
|
30
|
+
}
|
|
31
|
+
return DEFAULT_REGISTRY;
|
|
32
|
+
}
|
|
33
|
+
const cachePath = process.argv[2];
|
|
34
|
+
if (cachePath) {
|
|
35
|
+
try {
|
|
36
|
+
const response = await fetch(`${getRegistry()}/chrome-devtools-mcp/latest`);
|
|
37
|
+
const data = response.ok ? await response.json() : null;
|
|
38
|
+
if (data &&
|
|
39
|
+
typeof data === 'object' &&
|
|
40
|
+
'version' in data &&
|
|
41
|
+
typeof data.version === 'string') {
|
|
42
|
+
await fs.mkdir(path.dirname(cachePath), { recursive: true });
|
|
43
|
+
await fs.writeFile(cachePath, JSON.stringify({ version: data.version }));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Ignore errors.
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=check-latest-version.js.map
|