@archpilotlabs/archpilot 0.2.2 → 0.2.3
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/archpilot-cli.js +516 -105
- package/dist/cli/src/archpilot-cli.js +5523 -0
- package/dist/cli/src/archpilot-cli.js.map +1 -0
- package/dist/core/src/adr/adrLoader.js +97 -0
- package/dist/core/src/adr/adrLoader.js.map +1 -0
- package/dist/core/src/adr/adrParser.js +77 -0
- package/dist/core/src/adr/adrParser.js.map +1 -0
- package/dist/core/src/adr/adrTemplate.js +45 -0
- package/dist/core/src/adr/adrTemplate.js.map +1 -0
- package/dist/core/src/adr/adrTypes.js +3 -0
- package/dist/core/src/adr/adrTypes.js.map +1 -0
- package/dist/core/src/adr/adrValidation.js +160 -0
- package/dist/core/src/adr/adrValidation.js.map +1 -0
- package/dist/core/src/adr/index.js +9 -0
- package/dist/core/src/adr/index.js.map +1 -0
- package/dist/core/src/adrManagement.js +174 -0
- package/dist/core/src/adrManagement.js.map +1 -0
- package/dist/core/src/adrRequirementStatus.js +62 -0
- package/dist/core/src/adrRequirementStatus.js.map +1 -0
- package/dist/core/src/adrScaffoldGeneration.js +325 -0
- package/dist/core/src/adrScaffoldGeneration.js.map +1 -0
- package/dist/core/src/apiDesignAnalysis.js +869 -0
- package/dist/core/src/apiDesignAnalysis.js.map +1 -0
- package/dist/core/src/applicationLayeringAnalysis.js +920 -0
- package/dist/core/src/applicationLayeringAnalysis.js.map +1 -0
- package/dist/core/src/applyRulePack.js +117 -0
- package/dist/core/src/applyRulePack.js.map +1 -0
- package/dist/core/src/architectureBaseline.js +271 -0
- package/dist/core/src/architectureBaseline.js.map +1 -0
- package/dist/core/src/architectureComponentDiscoveryDefaults.js +139 -0
- package/dist/core/src/architectureComponentDiscoveryDefaults.js.map +1 -0
- package/dist/core/src/architectureDependencyContext.js +316 -0
- package/dist/core/src/architectureDependencyContext.js.map +1 -0
- package/dist/core/src/architectureDriftDetection.js +96 -0
- package/dist/core/src/architectureDriftDetection.js.map +1 -0
- package/dist/core/src/architectureDriftTimeline.js +221 -0
- package/dist/core/src/architectureDriftTimeline.js.map +1 -0
- package/dist/core/src/architectureGovernanceBaseline.js +469 -0
- package/dist/core/src/architectureGovernanceBaseline.js.map +1 -0
- package/dist/core/src/architectureHealthHistory.js +208 -0
- package/dist/core/src/architectureHealthHistory.js.map +1 -0
- package/dist/core/src/architectureHealthScore.js +657 -0
- package/dist/core/src/architectureHealthScore.js.map +1 -0
- package/dist/core/src/architectureInit.js +826 -0
- package/dist/core/src/architectureInit.js.map +1 -0
- package/dist/core/src/architectureMap.js +727 -0
- package/dist/core/src/architectureMap.js.map +1 -0
- package/dist/core/src/architectureMigrationPreview.js +467 -0
- package/dist/core/src/architectureMigrationPreview.js.map +1 -0
- package/dist/core/src/architectureModelRefresh.js +209 -0
- package/dist/core/src/architectureModelRefresh.js.map +1 -0
- package/dist/core/src/architectureReportWorkflow.js +139 -0
- package/dist/core/src/architectureReportWorkflow.js.map +1 -0
- package/dist/core/src/architectureValidation.js +3879 -0
- package/dist/core/src/architectureValidation.js.map +1 -0
- package/dist/core/src/architectureWorkspaceModel.js +166 -0
- package/dist/core/src/architectureWorkspaceModel.js.map +1 -0
- package/dist/core/src/authorizationTenantAnalysis.js +652 -0
- package/dist/core/src/authorizationTenantAnalysis.js.map +1 -0
- package/dist/core/src/bootstrapArchitectureConfig.js +150 -0
- package/dist/core/src/bootstrapArchitectureConfig.js.map +1 -0
- package/dist/core/src/changeRisk/changeRiskAssessment.js +251 -0
- package/dist/core/src/changeRisk/changeRiskAssessment.js.map +1 -0
- package/dist/core/src/changeRisk/changeRiskTypes.js +3 -0
- package/dist/core/src/changeRisk/changeRiskTypes.js.map +1 -0
- package/dist/core/src/changeRisk/index.js +6 -0
- package/dist/core/src/changeRisk/index.js.map +1 -0
- package/dist/core/src/ci/githubInlineAnnotations.js +245 -0
- package/dist/core/src/ci/githubInlineAnnotations.js.map +1 -0
- package/dist/core/src/ci/githubPrCommentAdapter.js +232 -0
- package/dist/core/src/ci/githubPrCommentAdapter.js.map +1 -0
- package/dist/core/src/ciWorkflowTemplates.js +1042 -0
- package/dist/core/src/ciWorkflowTemplates.js.map +1 -0
- package/dist/core/src/compliance/complianceExportBuilder.js +122 -0
- package/dist/core/src/compliance/complianceExportBuilder.js.map +1 -0
- package/dist/core/src/compliance/complianceExportTypes.js +3 -0
- package/dist/core/src/compliance/complianceExportTypes.js.map +1 -0
- package/dist/core/src/compliance/complianceExportWriter.js +48 -0
- package/dist/core/src/compliance/complianceExportWriter.js.map +1 -0
- package/dist/core/src/compliance/complianceRulePackResolver.js +62 -0
- package/dist/core/src/compliance/complianceRulePackResolver.js.map +1 -0
- package/dist/core/src/config/index.js +17 -0
- package/dist/core/src/config/index.js.map +1 -0
- package/dist/core/src/config/projectConfig.js +224 -0
- package/dist/core/src/config/projectConfig.js.map +1 -0
- package/dist/core/src/config/projectIdentity.js +160 -0
- package/dist/core/src/config/projectIdentity.js.map +1 -0
- package/dist/core/src/dataQueryRiskDetection.js +1203 -0
- package/dist/core/src/dataQueryRiskDetection.js.map +1 -0
- package/dist/core/src/dependencyValidation.js +2557 -0
- package/dist/core/src/dependencyValidation.js.map +1 -0
- package/dist/core/src/discoverAdrs.js +15 -0
- package/dist/core/src/discoverAdrs.js.map +1 -0
- package/dist/core/src/drift/driftComparator.js +49 -0
- package/dist/core/src/drift/driftComparator.js.map +1 -0
- package/dist/core/src/drift/driftSnapshotLoader.js +136 -0
- package/dist/core/src/drift/driftSnapshotLoader.js.map +1 -0
- package/dist/core/src/drift/driftSnapshotTypes.js +3 -0
- package/dist/core/src/drift/driftSnapshotTypes.js.map +1 -0
- package/dist/core/src/drift/driftSnapshotWriter.js +48 -0
- package/dist/core/src/drift/driftSnapshotWriter.js.map +1 -0
- package/dist/core/src/drift/index.js +6 -0
- package/dist/core/src/drift/index.js.map +1 -0
- package/dist/core/src/eventArchitectureAnalysis.js +925 -0
- package/dist/core/src/eventArchitectureAnalysis.js.map +1 -0
- package/dist/core/src/findingTargetResolution.js +117 -0
- package/dist/core/src/findingTargetResolution.js.map +1 -0
- package/dist/core/src/generateArchitectureDiagrams.js +57 -0
- package/dist/core/src/generateArchitectureDiagrams.js.map +1 -0
- package/dist/core/src/generateImpactAnalysis.js +366 -0
- package/dist/core/src/generateImpactAnalysis.js.map +1 -0
- package/dist/core/src/generateOnboardingDocs.js +262 -0
- package/dist/core/src/generateOnboardingDocs.js.map +1 -0
- package/dist/core/src/governance/cloudConnection.js +203 -0
- package/dist/core/src/governance/cloudConnection.js.map +1 -0
- package/dist/core/src/governance/governanceContracts.js +129 -0
- package/dist/core/src/governance/governanceContracts.js.map +1 -0
- package/dist/core/src/governance/governanceGitMetadata.js +78 -0
- package/dist/core/src/governance/governanceGitMetadata.js.map +1 -0
- package/dist/core/src/governance/governanceUploadClient.js +119 -0
- package/dist/core/src/governance/governanceUploadClient.js.map +1 -0
- package/dist/core/src/governance/governanceUploadLimitErrorFormatting.js +155 -0
- package/dist/core/src/governance/governanceUploadLimitErrorFormatting.js.map +1 -0
- package/dist/core/src/governance/governanceUploadPayload.js +439 -0
- package/dist/core/src/governance/governanceUploadPayload.js.map +1 -0
- package/dist/core/src/governance/runGovernanceUpload.js +103 -0
- package/dist/core/src/governance/runGovernanceUpload.js.map +1 -0
- package/dist/core/src/impactAnalysisEngine.js +376 -0
- package/dist/core/src/impactAnalysisEngine.js.map +1 -0
- package/dist/core/src/initializationState.js +99 -0
- package/dist/core/src/initializationState.js.map +1 -0
- package/dist/core/src/managedArtifacts.js +151 -0
- package/dist/core/src/managedArtifacts.js.map +1 -0
- package/dist/core/src/moduleContractValidation.js +266 -0
- package/dist/core/src/moduleContractValidation.js.map +1 -0
- package/dist/core/src/moduleContractsGenerator.js +337 -0
- package/dist/core/src/moduleContractsGenerator.js.map +1 -0
- package/dist/core/src/moduleDiscovery.js +416 -0
- package/dist/core/src/moduleDiscovery.js.map +1 -0
- package/dist/core/src/moduleScope.js +426 -0
- package/dist/core/src/moduleScope.js.map +1 -0
- package/dist/core/src/onboardingGuidance.js +74 -0
- package/dist/core/src/onboardingGuidance.js.map +1 -0
- package/dist/core/src/operationalLogging.js +7 -0
- package/dist/core/src/operationalLogging.js.map +1 -0
- package/dist/core/src/packageVersion.js +52 -0
- package/dist/core/src/packageVersion.js.map +1 -0
- package/dist/core/src/policy/effectivePolicyResolver.js +91 -0
- package/dist/core/src/policy/effectivePolicyResolver.js.map +1 -0
- package/dist/core/src/policy/exceptionLoader.js +285 -0
- package/dist/core/src/policy/exceptionLoader.js.map +1 -0
- package/dist/core/src/policy/remotePolicyLoader.js +227 -0
- package/dist/core/src/policy/remotePolicyLoader.js.map +1 -0
- package/dist/core/src/policy/remotePolicyTypes.js +3 -0
- package/dist/core/src/policy/remotePolicyTypes.js.map +1 -0
- package/dist/core/src/policy/riskPolicyConfig.js +206 -0
- package/dist/core/src/policy/riskPolicyConfig.js.map +1 -0
- package/dist/core/src/policy/riskPolicyEnforcement.js +203 -0
- package/dist/core/src/policy/riskPolicyEnforcement.js.map +1 -0
- package/dist/core/src/policy/riskPolicyExitCode.js +16 -0
- package/dist/core/src/policy/riskPolicyExitCode.js.map +1 -0
- package/dist/core/src/policy/riskPolicyInitializer.js +90 -0
- package/dist/core/src/policy/riskPolicyInitializer.js.map +1 -0
- package/dist/core/src/quickFix/quickFixEngine.js +132 -0
- package/dist/core/src/quickFix/quickFixEngine.js.map +1 -0
- package/dist/core/src/quickFix/quickFixMessaging.js +15 -0
- package/dist/core/src/quickFix/quickFixMessaging.js.map +1 -0
- package/dist/core/src/quickFix/quickFixProviders.js +87 -0
- package/dist/core/src/quickFix/quickFixProviders.js.map +1 -0
- package/dist/core/src/quickFix/quickFixTypes.js +3 -0
- package/dist/core/src/quickFix/quickFixTypes.js.map +1 -0
- package/dist/core/src/remediation/fileHelpers.js +86 -0
- package/dist/core/src/remediation/fileHelpers.js.map +1 -0
- package/dist/core/src/remediation/fixRegistry.js +645 -0
- package/dist/core/src/remediation/fixRegistry.js.map +1 -0
- package/dist/core/src/remediation/index.js +8 -0
- package/dist/core/src/remediation/index.js.map +1 -0
- package/dist/core/src/remediation/remediationEngine.js +207 -0
- package/dist/core/src/remediation/remediationEngine.js.map +1 -0
- package/dist/core/src/reporting/adrReporter.js +59 -0
- package/dist/core/src/reporting/adrReporter.js.map +1 -0
- package/dist/core/src/reporting/architectureBaselineReporter.js +64 -0
- package/dist/core/src/reporting/architectureBaselineReporter.js.map +1 -0
- package/dist/core/src/reporting/architectureDiagramReporter.js +148 -0
- package/dist/core/src/reporting/architectureDiagramReporter.js.map +1 -0
- package/dist/core/src/reporting/architectureDriftTimelineReporter.js +44 -0
- package/dist/core/src/reporting/architectureDriftTimelineReporter.js.map +1 -0
- package/dist/core/src/reporting/architectureHealthHistoryReporter.js +51 -0
- package/dist/core/src/reporting/architectureHealthHistoryReporter.js.map +1 -0
- package/dist/core/src/reporting/architectureMapReporter.js +228 -0
- package/dist/core/src/reporting/architectureMapReporter.js.map +1 -0
- package/dist/core/src/reporting/architecturePrCommentReporter.js +324 -0
- package/dist/core/src/reporting/architecturePrCommentReporter.js.map +1 -0
- package/dist/core/src/reporting/architecturePrReviewReporter.js +389 -0
- package/dist/core/src/reporting/architecturePrReviewReporter.js.map +1 -0
- package/dist/core/src/reporting/architectureReportArtifacts.js +166 -0
- package/dist/core/src/reporting/architectureReportArtifacts.js.map +1 -0
- package/dist/core/src/reporting/architectureReviewReportGenerator.js +382 -0
- package/dist/core/src/reporting/architectureReviewReportGenerator.js.map +1 -0
- package/dist/core/src/reporting/architectureReviewReporter.js +1633 -0
- package/dist/core/src/reporting/architectureReviewReporter.js.map +1 -0
- package/dist/core/src/reporting/architectureRiskAssessment.js +101 -0
- package/dist/core/src/reporting/architectureRiskAssessment.js.map +1 -0
- package/dist/core/src/reporting/architectureScoreBadge.js +177 -0
- package/dist/core/src/reporting/architectureScoreBadge.js.map +1 -0
- package/dist/core/src/reporting/architectureSupplementalReporters.js +124 -0
- package/dist/core/src/reporting/architectureSupplementalReporters.js.map +1 -0
- package/dist/core/src/reporting/changeRiskAssessment.js +6 -0
- package/dist/core/src/reporting/changeRiskAssessment.js.map +1 -0
- package/dist/core/src/reporting/changeRiskTypes.js +3 -0
- package/dist/core/src/reporting/changeRiskTypes.js.map +1 -0
- package/dist/core/src/reporting/impactAnalysisReporter.js +111 -0
- package/dist/core/src/reporting/impactAnalysisReporter.js.map +1 -0
- package/dist/core/src/reporting/onboardingDocsReporter.js +113 -0
- package/dist/core/src/reporting/onboardingDocsReporter.js.map +1 -0
- package/dist/core/src/reporting/rulePackReporter.js +61 -0
- package/dist/core/src/reporting/rulePackReporter.js.map +1 -0
- package/dist/core/src/reporting/safetyControlsDetection.js +343 -0
- package/dist/core/src/reporting/safetyControlsDetection.js.map +1 -0
- package/dist/core/src/resolveRuleAdrs.js +31 -0
- package/dist/core/src/resolveRuleAdrs.js.map +1 -0
- package/dist/core/src/reviewGenerationWorkflow.js +220 -0
- package/dist/core/src/reviewGenerationWorkflow.js.map +1 -0
- package/dist/core/src/rulePacks/index.js +17 -0
- package/dist/core/src/rulePacks/index.js.map +1 -0
- package/dist/core/src/rulePacks/layeredMonolithRulePack.js +45 -0
- package/dist/core/src/rulePacks/layeredMonolithRulePack.js.map +1 -0
- package/dist/core/src/rulePacks/modularMonolithRulePack.js +41 -0
- package/dist/core/src/rulePacks/modularMonolithRulePack.js.map +1 -0
- package/dist/core/src/rulePacks/types.js +3 -0
- package/dist/core/src/rulePacks/types.js.map +1 -0
- package/dist/core/src/setupNextSteps.js +939 -0
- package/dist/core/src/setupNextSteps.js.map +1 -0
- package/dist/core/src/setupRefresh.js +152 -0
- package/dist/core/src/setupRefresh.js.map +1 -0
- package/dist/core/src/smartInit/apiDbHintDetection.js +836 -0
- package/dist/core/src/smartInit/apiDbHintDetection.js.map +1 -0
- package/dist/core/src/smartInit/architectureProposalBuilder.js +1215 -0
- package/dist/core/src/smartInit/architectureProposalBuilder.js.map +1 -0
- package/dist/core/src/smartInit/architectureStyleDetection.js +472 -0
- package/dist/core/src/smartInit/architectureStyleDetection.js.map +1 -0
- package/dist/core/src/smartInit/archpilotIgnore.js +139 -0
- package/dist/core/src/smartInit/archpilotIgnore.js.map +1 -0
- package/dist/core/src/smartInit/componentDetection.js +1084 -0
- package/dist/core/src/smartInit/componentDetection.js.map +1 -0
- package/dist/core/src/smartInit/implementationProfileResolution.js +53 -0
- package/dist/core/src/smartInit/implementationProfileResolution.js.map +1 -0
- package/dist/core/src/smartInit/index.js +31 -0
- package/dist/core/src/smartInit/index.js.map +1 -0
- package/dist/core/src/smartInit/moduleDetection.js +982 -0
- package/dist/core/src/smartInit/moduleDetection.js.map +1 -0
- package/dist/core/src/smartInit/projectKindDetection.js +437 -0
- package/dist/core/src/smartInit/projectKindDetection.js.map +1 -0
- package/dist/core/src/smartInit/repoTopologyDetection.js +470 -0
- package/dist/core/src/smartInit/repoTopologyDetection.js.map +1 -0
- package/dist/core/src/smartInit/runContext.js +112 -0
- package/dist/core/src/smartInit/runContext.js.map +1 -0
- package/dist/core/src/smartInit/smartInitEngine.js +94 -0
- package/dist/core/src/smartInit/smartInitEngine.js.map +1 -0
- package/dist/core/src/smartInit/stackDetection.js +503 -0
- package/dist/core/src/smartInit/stackDetection.js.map +1 -0
- package/dist/core/src/smartInit/toolingHintDetection.js +345 -0
- package/dist/core/src/smartInit/toolingHintDetection.js.map +1 -0
- package/dist/core/src/sourceScopeClassification.js +83 -0
- package/dist/core/src/sourceScopeClassification.js.map +1 -0
- package/dist/core/src/stackAdapters.js +2475 -0
- package/dist/core/src/stackAdapters.js.map +1 -0
- package/dist/core/src/stackMetadata.js +157 -0
- package/dist/core/src/stackMetadata.js.map +1 -0
- package/dist/core/src/suppressions/index.js +3 -0
- package/dist/core/src/suppressions/index.js.map +1 -0
- package/dist/core/src/suppressions/suppressionReporter.js +38 -0
- package/dist/core/src/suppressions/suppressionReporter.js.map +1 -0
- package/dist/core/src/suppressions/suppressionTypes.js +3 -0
- package/dist/core/src/suppressions/suppressionTypes.js.map +1 -0
- package/dist/core/src/suppressions/suppressionValidator.js +119 -0
- package/dist/core/src/suppressions/suppressionValidator.js.map +1 -0
- package/dist/core/src/transactionDomainAnalysis.js +1416 -0
- package/dist/core/src/transactionDomainAnalysis.js.map +1 -0
- package/dist/core/src/validation/changedFilesResolver.js +165 -0
- package/dist/core/src/validation/changedFilesResolver.js.map +1 -0
- package/dist/core/src/validationProfiling.js +33 -0
- package/dist/core/src/validationProfiling.js.map +1 -0
- package/dist/core/src/validationRuleExplanations.js +69 -0
- package/dist/core/src/validationRuleExplanations.js.map +1 -0
- package/dist/core/src/validationSourceInventory.js +200 -0
- package/dist/core/src/validationSourceInventory.js.map +1 -0
- package/dist/core/src/validationSuppressions.js +231 -0
- package/dist/core/src/validationSuppressions.js.map +1 -0
- package/dist/core/src/validationTypeScriptAstCache.js +82 -0
- package/dist/core/src/validationTypeScriptAstCache.js.map +1 -0
- package/dist/core/src/validationWorkflow.js +222 -0
- package/dist/core/src/validationWorkflow.js.map +1 -0
- package/dist/core/src/workspaceRoot.js +68 -0
- package/dist/core/src/workspaceRoot.js.map +1 -0
- package/package.json +1 -1
package/dist/archpilot-cli.js
CHANGED
|
@@ -215175,9 +215175,9 @@ function pathHasFileExtension(value) {
|
|
|
215175
215175
|
function isRelativeImport(importSpecifier) {
|
|
215176
215176
|
return importSpecifier === "." || importSpecifier === ".." || importSpecifier.startsWith("./") || importSpecifier.startsWith("../");
|
|
215177
215177
|
}
|
|
215178
|
-
function
|
|
215179
|
-
const child =
|
|
215180
|
-
const parent =
|
|
215178
|
+
function isNormalizedPathInsideOrEqual(normalizedChildPath, normalizedParentPath) {
|
|
215179
|
+
const child = normalizedChildPath.toLowerCase();
|
|
215180
|
+
const parent = normalizedParentPath.toLowerCase();
|
|
215181
215181
|
return child === parent || child.startsWith(`${parent}/`);
|
|
215182
215182
|
}
|
|
215183
215183
|
function toEndpoint(candidate) {
|
|
@@ -215196,38 +215196,43 @@ function compareCandidates(left, right) {
|
|
|
215196
215196
|
}
|
|
215197
215197
|
return left.component.id.localeCompare(right.component.id);
|
|
215198
215198
|
}
|
|
215199
|
-
function
|
|
215200
|
-
const normalizedModulePath = normalizePath2(modulePath);
|
|
215199
|
+
function normalizedModulePathMatchScore(normalizedInputPath, normalizedModulePath) {
|
|
215201
215200
|
if (pathHasFileExtension(normalizedModulePath)) {
|
|
215202
|
-
return
|
|
215201
|
+
return isNormalizedPathInsideOrEqual(normalizedInputPath, normalizedModulePath) || isNormalizedPathInsideOrEqual(normalizedModulePath, normalizedInputPath) ? normalizedModulePath.length + 1e3 : void 0;
|
|
215203
215202
|
}
|
|
215204
|
-
return
|
|
215203
|
+
return isNormalizedPathInsideOrEqual(normalizedInputPath, normalizedModulePath) ? normalizedModulePath.length + 1e3 : void 0;
|
|
215204
|
+
}
|
|
215205
|
+
function modulePathMatchScore(inputPath, modulePath) {
|
|
215206
|
+
return normalizedModulePathMatchScore(normalizePath2(inputPath), normalizePath2(modulePath));
|
|
215205
215207
|
}
|
|
215206
215208
|
function findComponentForPath(components, inputPath) {
|
|
215207
215209
|
const normalizedInputPath = normalizePath2(inputPath);
|
|
215208
215210
|
const candidates = [];
|
|
215209
215211
|
for (const component of components) {
|
|
215210
|
-
for (const
|
|
215211
|
-
if (!moduleReference.
|
|
215212
|
+
for (const moduleReference of component.modules) {
|
|
215213
|
+
if (!moduleReference.normalizedPath) {
|
|
215212
215214
|
continue;
|
|
215213
215215
|
}
|
|
215214
|
-
const score =
|
|
215216
|
+
const score = normalizedModulePathMatchScore(
|
|
215217
|
+
normalizedInputPath,
|
|
215218
|
+
moduleReference.normalizedPath
|
|
215219
|
+
);
|
|
215215
215220
|
if (score !== void 0) {
|
|
215216
215221
|
candidates.push({
|
|
215217
|
-
component,
|
|
215218
|
-
moduleId,
|
|
215222
|
+
component: component.component,
|
|
215223
|
+
moduleId: moduleReference.moduleId,
|
|
215219
215224
|
path: moduleReference.path,
|
|
215220
215225
|
ownership: "module-path",
|
|
215221
215226
|
score
|
|
215222
215227
|
});
|
|
215223
215228
|
}
|
|
215224
215229
|
}
|
|
215225
|
-
if (component.
|
|
215230
|
+
if (component.normalizedPath && isNormalizedPathInsideOrEqual(normalizedInputPath, component.normalizedPath)) {
|
|
215226
215231
|
candidates.push({
|
|
215227
|
-
component,
|
|
215228
|
-
path: component.path,
|
|
215232
|
+
component: component.component,
|
|
215233
|
+
path: component.component.path,
|
|
215229
215234
|
ownership: "component-path",
|
|
215230
|
-
score:
|
|
215235
|
+
score: component.normalizedPath.length
|
|
215231
215236
|
});
|
|
215232
215237
|
}
|
|
215233
215238
|
}
|
|
@@ -215238,19 +215243,20 @@ function findComponentForModuleSpecifier(components, importSpecifier) {
|
|
|
215238
215243
|
const normalizedSegments = normalizedImport.split("/").filter((segment) => segment.length > 0);
|
|
215239
215244
|
const candidates = [];
|
|
215240
215245
|
for (const component of components) {
|
|
215241
|
-
for (const
|
|
215246
|
+
for (const moduleReference of component.modules) {
|
|
215247
|
+
const moduleId = moduleReference.moduleId;
|
|
215242
215248
|
if (normalizedImport === moduleId || normalizedImport.startsWith(`${moduleId}/`)) {
|
|
215243
215249
|
candidates.push({
|
|
215244
|
-
component,
|
|
215250
|
+
component: component.component,
|
|
215245
215251
|
moduleId,
|
|
215246
215252
|
...moduleReference.path ? { path: moduleReference.path } : {},
|
|
215247
215253
|
ownership: moduleReference.path ? "module-path" : "component-path",
|
|
215248
215254
|
score: moduleId.length + 500
|
|
215249
215255
|
});
|
|
215250
215256
|
}
|
|
215251
|
-
if (component.id === VIRTUAL_WORKSPACE_COMPONENT_ID && normalizedSegments.includes(moduleId)) {
|
|
215257
|
+
if (component.component.id === VIRTUAL_WORKSPACE_COMPONENT_ID && normalizedSegments.includes(moduleId)) {
|
|
215252
215258
|
candidates.push({
|
|
215253
|
-
component,
|
|
215259
|
+
component: component.component,
|
|
215254
215260
|
moduleId,
|
|
215255
215261
|
...moduleReference.path ? { path: moduleReference.path } : {},
|
|
215256
215262
|
ownership: "virtual-workspace",
|
|
@@ -215258,20 +215264,20 @@ function findComponentForModuleSpecifier(components, importSpecifier) {
|
|
|
215258
215264
|
});
|
|
215259
215265
|
}
|
|
215260
215266
|
}
|
|
215261
|
-
if (component.
|
|
215267
|
+
if (component.normalizedPath && isNormalizedPathInsideOrEqual(normalizedImport, component.normalizedPath)) {
|
|
215262
215268
|
candidates.push({
|
|
215263
|
-
component,
|
|
215264
|
-
path: component.path,
|
|
215269
|
+
component: component.component,
|
|
215270
|
+
path: component.component.path,
|
|
215265
215271
|
ownership: "component-path",
|
|
215266
|
-
score:
|
|
215272
|
+
score: component.normalizedPath.length
|
|
215267
215273
|
});
|
|
215268
215274
|
}
|
|
215269
|
-
if (normalizedImport === component.id || normalizedImport.startsWith(`${component.id}/`)) {
|
|
215275
|
+
if (normalizedImport === component.component.id || normalizedImport.startsWith(`${component.component.id}/`)) {
|
|
215270
215276
|
candidates.push({
|
|
215271
|
-
component,
|
|
215272
|
-
...component.path ? { path: component.path } : {},
|
|
215273
|
-
ownership: component.path ? "component-path" : "virtual-workspace",
|
|
215274
|
-
score: component.id.length
|
|
215277
|
+
component: component.component,
|
|
215278
|
+
...component.component.path ? { path: component.component.path } : {},
|
|
215279
|
+
ownership: component.component.path ? "component-path" : "virtual-workspace",
|
|
215280
|
+
score: component.component.id.length
|
|
215275
215281
|
});
|
|
215276
215282
|
}
|
|
215277
215283
|
}
|
|
@@ -215315,12 +215321,12 @@ function resolveSourceCandidate(contract, components, sourceFile) {
|
|
|
215315
215321
|
return directMatch;
|
|
215316
215322
|
}
|
|
215317
215323
|
const virtualComponent = components.find(
|
|
215318
|
-
(component) => component.id === VIRTUAL_WORKSPACE_COMPONENT_ID
|
|
215319
|
-
);
|
|
215324
|
+
(component) => component.component.id === VIRTUAL_WORKSPACE_COMPONENT_ID
|
|
215325
|
+
)?.component;
|
|
215320
215326
|
if (virtualComponent) {
|
|
215321
215327
|
return resolveLegacyVirtualSource(contract, sourceFile, virtualComponent);
|
|
215322
215328
|
}
|
|
215323
|
-
const fallback = [...components].sort((left, right) => left.id.localeCompare(right.id))[0];
|
|
215329
|
+
const fallback = [...components].map((component) => component.component).sort((left, right) => left.id.localeCompare(right.id))[0];
|
|
215324
215330
|
if (fallback) {
|
|
215325
215331
|
return {
|
|
215326
215332
|
component: fallback,
|
|
@@ -215331,7 +215337,7 @@ function resolveSourceCandidate(contract, components, sourceFile) {
|
|
|
215331
215337
|
}
|
|
215332
215338
|
throw new Error("Architecture dependency context requires at least one normalized component.");
|
|
215333
215339
|
}
|
|
215334
|
-
function resolveTargetCandidate(components, sourceFile, importSpecifier) {
|
|
215340
|
+
function resolveTargetCandidate(contract, components, sourceFile, importSpecifier) {
|
|
215335
215341
|
if (isRelativeImport(importSpecifier)) {
|
|
215336
215342
|
const resolvedTargetPath = resolveRelativeImportPath(sourceFile, importSpecifier);
|
|
215337
215343
|
return {
|
|
@@ -215340,7 +215346,8 @@ function resolveTargetCandidate(components, sourceFile, importSpecifier) {
|
|
|
215340
215346
|
};
|
|
215341
215347
|
}
|
|
215342
215348
|
const normalizedImport = normalizeImportPath(importSpecifier);
|
|
215343
|
-
|
|
215349
|
+
const normalizedModulesRoot = normalizePath2(resolveModulesRootFromContract(contract));
|
|
215350
|
+
if (normalizedModulesRoot.length > 0 && normalizedImport.startsWith(`${normalizedModulesRoot}/`) || normalizedImport.startsWith("src/") || normalizedImport.startsWith("app/") || normalizedImport.startsWith("apps/") || normalizedImport.startsWith("services/") || normalizedImport.startsWith("packages/") || normalizedImport.startsWith("libs/") || normalizedImport.startsWith("libraries/") || normalizedImport.startsWith("workers/")) {
|
|
215344
215351
|
return {
|
|
215345
215352
|
candidate: findComponentForPath(components, normalizedImport),
|
|
215346
215353
|
resolvedTargetPath: normalizedImport
|
|
@@ -215352,20 +215359,28 @@ function resolveTargetCandidate(components, sourceFile, importSpecifier) {
|
|
|
215352
215359
|
}
|
|
215353
215360
|
return {};
|
|
215354
215361
|
}
|
|
215355
|
-
function
|
|
215356
|
-
|
|
215357
|
-
|
|
215362
|
+
function prepareComponentReferences(components) {
|
|
215363
|
+
return components.map((component) => ({
|
|
215364
|
+
component,
|
|
215365
|
+
...component.path ? { normalizedPath: normalizePath2(component.path) } : {},
|
|
215366
|
+
modules: Object.entries(component.modules).map(([moduleId, moduleReference]) => ({
|
|
215367
|
+
moduleId,
|
|
215368
|
+
...moduleReference.path ? {
|
|
215369
|
+
path: moduleReference.path,
|
|
215370
|
+
normalizedPath: normalizePath2(moduleReference.path)
|
|
215371
|
+
} : {}
|
|
215372
|
+
}))
|
|
215373
|
+
}));
|
|
215374
|
+
}
|
|
215375
|
+
function resolveDependencyContextWithPreparedComponents(contract, components, input2) {
|
|
215376
|
+
const sourceCandidate = resolveSourceCandidate(contract, components, input2.sourceFile);
|
|
215358
215377
|
const { candidate: resolvedTargetCandidate, resolvedTargetPath } = resolveTargetCandidate(
|
|
215359
|
-
|
|
215378
|
+
contract,
|
|
215379
|
+
components,
|
|
215360
215380
|
input2.sourceFile,
|
|
215361
215381
|
input2.importSpecifier
|
|
215362
215382
|
);
|
|
215363
|
-
const targetCandidate = resolvedTargetCandidate ?? (resolvedTargetPath ?
|
|
215364
|
-
...sourceCandidate,
|
|
215365
|
-
path: resolvedTargetPath,
|
|
215366
|
-
ownership: sourceCandidate.ownership,
|
|
215367
|
-
score: 0
|
|
215368
|
-
} : void 0);
|
|
215383
|
+
const targetCandidate = resolvedTargetCandidate ?? (resolvedTargetPath ? resolveSourceCandidate(contract, components, resolvedTargetPath) : void 0);
|
|
215369
215384
|
if (!targetCandidate) {
|
|
215370
215385
|
return {
|
|
215371
215386
|
dependencyType: "external",
|
|
@@ -215386,6 +215401,19 @@ function resolveDependencyContext(contract, input2) {
|
|
|
215386
215401
|
isExternal: false
|
|
215387
215402
|
};
|
|
215388
215403
|
}
|
|
215404
|
+
function createArchitectureDependencyContextResolver(contract) {
|
|
215405
|
+
const model = normalizeArchitectureWorkspaceModel(contract);
|
|
215406
|
+
const components = prepareComponentReferences(model.components);
|
|
215407
|
+
return {
|
|
215408
|
+
contract,
|
|
215409
|
+
model,
|
|
215410
|
+
resolve: (input2) => resolveDependencyContextWithPreparedComponents(
|
|
215411
|
+
contract,
|
|
215412
|
+
components,
|
|
215413
|
+
input2
|
|
215414
|
+
)
|
|
215415
|
+
};
|
|
215416
|
+
}
|
|
215389
215417
|
var path6;
|
|
215390
215418
|
var init_architectureDependencyContext = __esm({
|
|
215391
215419
|
"../core/src/architectureDependencyContext.ts"() {
|
|
@@ -215474,7 +215502,7 @@ function toSafeContractModuleFileStem(moduleName) {
|
|
|
215474
215502
|
function normalizeAbsolutePath(filePath) {
|
|
215475
215503
|
return normalizePath4(path7.resolve(filePath)).toLowerCase();
|
|
215476
215504
|
}
|
|
215477
|
-
function
|
|
215505
|
+
function isPathInsideOrEqual(childPath, parentPath) {
|
|
215478
215506
|
const child = normalizeAbsolutePath(childPath);
|
|
215479
215507
|
const parent = normalizeAbsolutePath(parentPath);
|
|
215480
215508
|
return child === parent || child.startsWith(`${parent}/`);
|
|
@@ -215555,6 +215583,9 @@ function buildChildModulesByParent(hierarchyEdges) {
|
|
|
215555
215583
|
])
|
|
215556
215584
|
);
|
|
215557
215585
|
}
|
|
215586
|
+
function isIsolatedContractlessHierarchyModule(input2) {
|
|
215587
|
+
return !input2.hasContract && input2.parentModule !== void 0 && input2.declaredDependencies.length === 0 && input2.actualDependencies.length === 0 && input2.inboundDeclaredFrom.length === 0 && input2.inboundActualFrom.length === 0 && input2.unusedDeclaredDependencies.length === 0 && input2.undeclaredActualDependencies.length === 0;
|
|
215588
|
+
}
|
|
215558
215589
|
function getScriptKind(filePath) {
|
|
215559
215590
|
const extension = path7.extname(filePath).toLowerCase();
|
|
215560
215591
|
switch (extension) {
|
|
@@ -215712,7 +215743,7 @@ async function buildTsConfigPathAliasMap(workspaceRoot, moduleRoots) {
|
|
|
215712
215743
|
const isWildcard = /\/\*$/u.test(aliasPattern) && /\/\*$/u.test(targetPattern);
|
|
215713
215744
|
const normalizedTarget = normalizePath4(targetPattern).replace(/\/\*$/u, "");
|
|
215714
215745
|
const absoluteTarget = path7.join(workspaceRoot, ...normalizedTarget.split("/"));
|
|
215715
|
-
const moduleEntry = [...moduleRoots.entries()].filter(([, moduleRoot2]) =>
|
|
215746
|
+
const moduleEntry = [...moduleRoots.entries()].filter(([, moduleRoot2]) => isPathInsideOrEqual(absoluteTarget, moduleRoot2)).sort((left, right) => right[1].length - left[1].length || left[0].localeCompare(right[0]))[0];
|
|
215716
215747
|
if (!moduleEntry) {
|
|
215717
215748
|
continue;
|
|
215718
215749
|
}
|
|
@@ -215947,7 +215978,7 @@ async function collectSourceFiles(directoryPath, adapter, scanRootPath = directo
|
|
|
215947
215978
|
const fullPath = path7.join(directoryPath, entry.name);
|
|
215948
215979
|
if (entry.isDirectory()) {
|
|
215949
215980
|
if (excludedDirectoryRoots.some(
|
|
215950
|
-
(excludedRoot) =>
|
|
215981
|
+
(excludedRoot) => isPathInsideOrEqual(fullPath, excludedRoot)
|
|
215951
215982
|
)) {
|
|
215952
215983
|
continue;
|
|
215953
215984
|
}
|
|
@@ -216172,7 +216203,7 @@ async function buildJavaImportIndex(workspaceRoot, moduleRoots, adapter) {
|
|
|
216172
216203
|
for (const [moduleId, moduleRoot] of [...moduleRoots.entries()].sort(
|
|
216173
216204
|
([left], [right]) => left.localeCompare(right)
|
|
216174
216205
|
)) {
|
|
216175
|
-
const childModuleRoots = [...moduleRoots.entries()].filter(([childModuleName, childModuleRoot]) => childModuleName !== moduleId &&
|
|
216206
|
+
const childModuleRoots = [...moduleRoots.entries()].filter(([childModuleName, childModuleRoot]) => childModuleName !== moduleId && isPathInsideOrEqual(childModuleRoot, moduleRoot)).map(([, childModuleRoot]) => childModuleRoot);
|
|
216176
216207
|
const sourceFiles = await collectSourceFiles(moduleRoot, adapter, moduleRoot, childModuleRoots);
|
|
216177
216208
|
for (const sourceFilePath of sourceFiles) {
|
|
216178
216209
|
const relativePath = normalizePath4(path7.relative(workspaceRoot, sourceFilePath));
|
|
@@ -216780,7 +216811,7 @@ async function resolveCrossModuleImport(workspaceRoot, modulesRootRelativePath,
|
|
|
216780
216811
|
if (!resolvedPath) {
|
|
216781
216812
|
return void 0;
|
|
216782
216813
|
}
|
|
216783
|
-
const targetModuleEntry = packageAliasTargetModule && packageAliasTargetModuleRoot ? [packageAliasTargetModule, packageAliasTargetModuleRoot] : [...moduleRoots.entries()].filter(([, moduleRoot]) =>
|
|
216814
|
+
const targetModuleEntry = packageAliasTargetModule && packageAliasTargetModuleRoot ? [packageAliasTargetModule, packageAliasTargetModuleRoot] : [...moduleRoots.entries()].filter(([, moduleRoot]) => isPathInsideOrEqual(resolvedPath, moduleRoot)).sort((left, right) => right[1].length - left[1].length || left[0].localeCompare(right[0]))[0];
|
|
216784
216815
|
if (!targetModuleEntry) {
|
|
216785
216816
|
const standaloneTargetModule = explicitStandaloneModuleByPath.get(
|
|
216786
216817
|
normalizePath4(path7.relative(workspaceRoot, resolvedPath))
|
|
@@ -216826,7 +216857,7 @@ async function collectCrossModuleImports(workspaceRoot, modulesRootRelativePath,
|
|
|
216826
216857
|
for (const [moduleName, moduleRoot] of [...moduleRoots.entries()].sort(
|
|
216827
216858
|
([left], [right]) => left.localeCompare(right)
|
|
216828
216859
|
)) {
|
|
216829
|
-
const childModuleRoots = [...moduleRoots.entries()].filter(([childModuleName, childModuleRoot]) => childModuleName !== moduleName &&
|
|
216860
|
+
const childModuleRoots = [...moduleRoots.entries()].filter(([childModuleName, childModuleRoot]) => childModuleName !== moduleName && isPathInsideOrEqual(childModuleRoot, moduleRoot)).map(([, childModuleRoot]) => childModuleRoot);
|
|
216830
216861
|
const sourceFiles = await collectSourceFiles(
|
|
216831
216862
|
moduleRoot,
|
|
216832
216863
|
adapter,
|
|
@@ -216962,15 +216993,15 @@ function toDependencyContextMetadata(context) {
|
|
|
216962
216993
|
isExternal: context.isExternal
|
|
216963
216994
|
};
|
|
216964
216995
|
}
|
|
216965
|
-
function resolveImportDependencyContextMetadata(architectureContract, dependencyImport) {
|
|
216966
|
-
const directContext =
|
|
216996
|
+
function resolveImportDependencyContextMetadata(architectureContract, dependencyImport, resolver = createArchitectureDependencyContextResolver(architectureContract)) {
|
|
216997
|
+
const directContext = resolver.resolve({
|
|
216967
216998
|
sourceFile: dependencyImport.sourceFileRelativePath,
|
|
216968
216999
|
importSpecifier: dependencyImport.importSpecifier
|
|
216969
217000
|
});
|
|
216970
217001
|
if (!directContext.isExternal) {
|
|
216971
217002
|
return toDependencyContextMetadata(directContext);
|
|
216972
217003
|
}
|
|
216973
|
-
const moduleTargetContext =
|
|
217004
|
+
const moduleTargetContext = resolver.resolve({
|
|
216974
217005
|
sourceFile: dependencyImport.sourceFileRelativePath,
|
|
216975
217006
|
importSpecifier: dependencyImport.targetModule
|
|
216976
217007
|
});
|
|
@@ -216981,7 +217012,7 @@ function resolveImportDependencyContextMetadata(architectureContract, dependency
|
|
|
216981
217012
|
resolvedTargetPath: dependencyImport.resolvedTargetRelativePath
|
|
216982
217013
|
});
|
|
216983
217014
|
}
|
|
216984
|
-
const resolvedPathContext =
|
|
217015
|
+
const resolvedPathContext = resolver.resolve({
|
|
216985
217016
|
sourceFile: dependencyImport.sourceFileRelativePath,
|
|
216986
217017
|
importSpecifier: dependencyImport.resolvedTargetRelativePath
|
|
216987
217018
|
});
|
|
@@ -217019,11 +217050,15 @@ function validateComponentDependencyPolicies(architectureContract, imports) {
|
|
|
217019
217050
|
if (!architectureContract || policies.size === 0) {
|
|
217020
217051
|
return [];
|
|
217021
217052
|
}
|
|
217053
|
+
const dependencyContextResolver = createArchitectureDependencyContextResolver(
|
|
217054
|
+
architectureContract
|
|
217055
|
+
);
|
|
217022
217056
|
const findings = [];
|
|
217023
217057
|
for (const dependencyImport of imports) {
|
|
217024
217058
|
const dependencyMetadata = resolveImportDependencyContextMetadata(
|
|
217025
217059
|
architectureContract,
|
|
217026
|
-
dependencyImport
|
|
217060
|
+
dependencyImport,
|
|
217061
|
+
dependencyContextResolver
|
|
217027
217062
|
);
|
|
217028
217063
|
if (dependencyMetadata.dependencyType !== "cross-component" || dependencyMetadata.isExternal || !dependencyMetadata.sourceComponentId || !dependencyMetadata.targetComponentId) {
|
|
217029
217064
|
continue;
|
|
@@ -217059,7 +217094,7 @@ function validateComponentDependencyPolicies(architectureContract, imports) {
|
|
|
217059
217094
|
}
|
|
217060
217095
|
return findings;
|
|
217061
217096
|
}
|
|
217062
|
-
function isModuleScopedDependencyImport(architectureContract, dependencyImport) {
|
|
217097
|
+
function isModuleScopedDependencyImport(architectureContract, dependencyImport, resolver) {
|
|
217063
217098
|
if (dependencyImport.sourceModule === dependencyImport.targetModule || isParentChildModuleRelationship(
|
|
217064
217099
|
dependencyImport.sourceModule,
|
|
217065
217100
|
dependencyImport.targetModule
|
|
@@ -217071,7 +217106,8 @@ function isModuleScopedDependencyImport(architectureContract, dependencyImport)
|
|
|
217071
217106
|
}
|
|
217072
217107
|
const dependencyMetadata = resolveImportDependencyContextMetadata(
|
|
217073
217108
|
architectureContract,
|
|
217074
|
-
dependencyImport
|
|
217109
|
+
dependencyImport,
|
|
217110
|
+
resolver
|
|
217075
217111
|
);
|
|
217076
217112
|
return !dependencyMetadata.isExternal;
|
|
217077
217113
|
}
|
|
@@ -217421,34 +217457,42 @@ async function buildDependencyGraphSummary(workspaceRoot, architectureContract,
|
|
|
217421
217457
|
const inboundDeclared = buildInboundDependencyMap(declaredBySource, moduleIds);
|
|
217422
217458
|
const inboundActual = buildInboundDependencyMap(actualBySource, moduleIds);
|
|
217423
217459
|
const hierarchyEdges = buildModuleHierarchyEdges(moduleIds);
|
|
217424
|
-
const childModulesByParent = buildChildModulesByParent(hierarchyEdges);
|
|
217425
217460
|
const parentModuleByChild = new Map(
|
|
217426
217461
|
hierarchyEdges.map((edge) => [edge.childModule, edge.parentModule])
|
|
217427
217462
|
);
|
|
217463
|
+
const moduleSummaries = moduleIds.map((moduleId) => {
|
|
217464
|
+
const declaredDependencies = sortUnique2(declaredBySource.get(moduleId) ?? []);
|
|
217465
|
+
const actualDependencies = sortUnique2(actualBySource.get(moduleId) ?? []);
|
|
217466
|
+
const unusedDeclaredDependencies = declaredDependencies.filter(
|
|
217467
|
+
(declaredDependency) => !actualDependencies.includes(declaredDependency)
|
|
217468
|
+
);
|
|
217469
|
+
const undeclaredActualDependencies = actualDependencies.filter(
|
|
217470
|
+
(actualDependency) => !declaredDependencies.includes(actualDependency)
|
|
217471
|
+
);
|
|
217472
|
+
return {
|
|
217473
|
+
module: moduleId,
|
|
217474
|
+
hasContract: hasContractByModule.get(moduleId) ?? false,
|
|
217475
|
+
...parentModuleByChild.has(moduleId) ? { parentModule: parentModuleByChild.get(moduleId) } : {},
|
|
217476
|
+
childModules: [],
|
|
217477
|
+
declaredDependencies,
|
|
217478
|
+
actualDependencies,
|
|
217479
|
+
inboundDeclaredFrom: inboundDeclared.get(moduleId) ?? [],
|
|
217480
|
+
inboundActualFrom: inboundActual.get(moduleId) ?? [],
|
|
217481
|
+
unusedDeclaredDependencies,
|
|
217482
|
+
undeclaredActualDependencies
|
|
217483
|
+
};
|
|
217484
|
+
}).filter((moduleSummary) => !isIsolatedContractlessHierarchyModule(moduleSummary));
|
|
217485
|
+
const retainedModuleIds = new Set(moduleSummaries.map((moduleSummary) => moduleSummary.module));
|
|
217486
|
+
const retainedHierarchyEdges = hierarchyEdges.filter(
|
|
217487
|
+
(edge) => retainedModuleIds.has(edge.parentModule) && retainedModuleIds.has(edge.childModule)
|
|
217488
|
+
);
|
|
217489
|
+
const childModulesByParent = buildChildModulesByParent(retainedHierarchyEdges);
|
|
217428
217490
|
return {
|
|
217429
|
-
modules:
|
|
217430
|
-
|
|
217431
|
-
|
|
217432
|
-
|
|
217433
|
-
|
|
217434
|
-
);
|
|
217435
|
-
const undeclaredActualDependencies = actualDependencies.filter(
|
|
217436
|
-
(actualDependency) => !declaredDependencies.includes(actualDependency)
|
|
217437
|
-
);
|
|
217438
|
-
return {
|
|
217439
|
-
module: moduleId,
|
|
217440
|
-
hasContract: hasContractByModule.get(moduleId) ?? false,
|
|
217441
|
-
...parentModuleByChild.has(moduleId) ? { parentModule: parentModuleByChild.get(moduleId) } : {},
|
|
217442
|
-
childModules: childModulesByParent.get(moduleId) ?? [],
|
|
217443
|
-
declaredDependencies,
|
|
217444
|
-
actualDependencies,
|
|
217445
|
-
inboundDeclaredFrom: inboundDeclared.get(moduleId) ?? [],
|
|
217446
|
-
inboundActualFrom: inboundActual.get(moduleId) ?? [],
|
|
217447
|
-
unusedDeclaredDependencies,
|
|
217448
|
-
undeclaredActualDependencies
|
|
217449
|
-
};
|
|
217450
|
-
}),
|
|
217451
|
-
hierarchyEdges
|
|
217491
|
+
modules: moduleSummaries.map((moduleSummary) => ({
|
|
217492
|
+
...moduleSummary,
|
|
217493
|
+
childModules: childModulesByParent.get(moduleSummary.module) ?? []
|
|
217494
|
+
})),
|
|
217495
|
+
hierarchyEdges: retainedHierarchyEdges
|
|
217452
217496
|
};
|
|
217453
217497
|
}
|
|
217454
217498
|
async function validateDependencyContractBoundaries(workspaceRoot, architectureContract, options) {
|
|
@@ -217478,9 +217522,16 @@ async function validateDependencyContractBoundaries(workspaceRoot, architectureC
|
|
|
217478
217522
|
workspacePackageAliases,
|
|
217479
217523
|
adapter
|
|
217480
217524
|
);
|
|
217525
|
+
const dependencyContextResolver = createArchitectureDependencyContextResolver(
|
|
217526
|
+
architectureContract
|
|
217527
|
+
);
|
|
217481
217528
|
const peerImports = filterPeerModuleImports(imports);
|
|
217482
217529
|
const moduleScopedPeerImports = peerImports.filter(
|
|
217483
|
-
(dependencyImport) => isModuleScopedDependencyImport(
|
|
217530
|
+
(dependencyImport) => isModuleScopedDependencyImport(
|
|
217531
|
+
architectureContract,
|
|
217532
|
+
dependencyImport,
|
|
217533
|
+
dependencyContextResolver
|
|
217534
|
+
)
|
|
217484
217535
|
);
|
|
217485
217536
|
const findings = [];
|
|
217486
217537
|
const moduleContractCache = /* @__PURE__ */ new Map();
|
|
@@ -217490,7 +217541,8 @@ async function validateDependencyContractBoundaries(workspaceRoot, architectureC
|
|
|
217490
217541
|
for (const dependencyImport of moduleScopedPeerImports) {
|
|
217491
217542
|
const dependencyMetadata = resolveImportDependencyContextMetadata(
|
|
217492
217543
|
architectureContract,
|
|
217493
|
-
dependencyImport
|
|
217544
|
+
dependencyImport,
|
|
217545
|
+
dependencyContextResolver
|
|
217494
217546
|
);
|
|
217495
217547
|
if (dependencyMetadata.isExternal) {
|
|
217496
217548
|
continue;
|
|
@@ -217622,7 +217674,8 @@ async function validateDependencyContractBoundaries(workspaceRoot, architectureC
|
|
|
217622
217674
|
for (const dependencyImport of moduleScopedPeerImports) {
|
|
217623
217675
|
const dependencyMetadata = resolveImportDependencyContextMetadata(
|
|
217624
217676
|
architectureContract,
|
|
217625
|
-
dependencyImport
|
|
217677
|
+
dependencyImport,
|
|
217678
|
+
dependencyContextResolver
|
|
217626
217679
|
);
|
|
217627
217680
|
if (dependencyMetadata.isExternal) {
|
|
217628
217681
|
continue;
|
|
@@ -217881,9 +217934,14 @@ async function validateDependencyBoundaries(workspaceRoot, options) {
|
|
|
217881
217934
|
workspacePackageAliases,
|
|
217882
217935
|
adapter
|
|
217883
217936
|
);
|
|
217937
|
+
const dependencyContextResolver = parsedArchitectureContract ? createArchitectureDependencyContextResolver(parsedArchitectureContract) : void 0;
|
|
217884
217938
|
const peerImports = filterPeerModuleImports(imports);
|
|
217885
217939
|
const moduleScopedPeerImports = peerImports.filter(
|
|
217886
|
-
(dependencyImport) => isModuleScopedDependencyImport(
|
|
217940
|
+
(dependencyImport) => isModuleScopedDependencyImport(
|
|
217941
|
+
parsedArchitectureContract,
|
|
217942
|
+
dependencyImport,
|
|
217943
|
+
dependencyContextResolver
|
|
217944
|
+
)
|
|
217887
217945
|
);
|
|
217888
217946
|
const findings = [];
|
|
217889
217947
|
const moduleContractCache = /* @__PURE__ */ new Map();
|
|
@@ -217942,7 +218000,8 @@ async function validateDependencyBoundaries(workspaceRoot, options) {
|
|
|
217942
218000
|
if (parsedArchitectureContract) {
|
|
217943
218001
|
const dependencyMetadata = resolveImportDependencyContextMetadata(
|
|
217944
218002
|
parsedArchitectureContract,
|
|
217945
|
-
dependencyImport
|
|
218003
|
+
dependencyImport,
|
|
218004
|
+
dependencyContextResolver
|
|
217946
218005
|
);
|
|
217947
218006
|
if (dependencyMetadata.isExternal) {
|
|
217948
218007
|
return false;
|
|
@@ -217966,7 +218025,11 @@ async function validateDependencyBoundaries(workspaceRoot, options) {
|
|
|
217966
218025
|
});
|
|
217967
218026
|
} else {
|
|
217968
218027
|
for (const violation of violations) {
|
|
217969
|
-
const dependencyMetadata = parsedArchitectureContract ? resolveImportDependencyContextMetadata(
|
|
218028
|
+
const dependencyMetadata = parsedArchitectureContract ? resolveImportDependencyContextMetadata(
|
|
218029
|
+
parsedArchitectureContract,
|
|
218030
|
+
violation,
|
|
218031
|
+
dependencyContextResolver
|
|
218032
|
+
) : void 0;
|
|
217970
218033
|
const allowedDependencies = dependencyRules.modules[violation.sourceModule]?.allowedDependencies ?? [];
|
|
217971
218034
|
const allowedDescription = allowedDependencies.length === 0 ? "may not depend on any other modules" : `may only depend on: ${allowedDependencies.join(", ")}`;
|
|
217972
218035
|
findings.push({
|
|
@@ -218008,7 +218071,8 @@ async function validateDependencyBoundaries(workspaceRoot, options) {
|
|
|
218008
218071
|
if (parsedArchitectureContract) {
|
|
218009
218072
|
const dependencyMetadata = resolveImportDependencyContextMetadata(
|
|
218010
218073
|
parsedArchitectureContract,
|
|
218011
|
-
dependencyImport
|
|
218074
|
+
dependencyImport,
|
|
218075
|
+
dependencyContextResolver
|
|
218012
218076
|
);
|
|
218013
218077
|
if (dependencyMetadata.isExternal) {
|
|
218014
218078
|
continue;
|
|
@@ -218057,7 +218121,11 @@ async function validateDependencyBoundaries(workspaceRoot, options) {
|
|
|
218057
218121
|
});
|
|
218058
218122
|
} else {
|
|
218059
218123
|
for (const violation of violations) {
|
|
218060
|
-
const dependencyMetadata = parsedArchitectureContract ? resolveImportDependencyContextMetadata(
|
|
218124
|
+
const dependencyMetadata = parsedArchitectureContract ? resolveImportDependencyContextMetadata(
|
|
218125
|
+
parsedArchitectureContract,
|
|
218126
|
+
violation,
|
|
218127
|
+
dependencyContextResolver
|
|
218128
|
+
) : void 0;
|
|
218061
218129
|
const publicImportGuidance = await describeModulePublicImportGuidance(
|
|
218062
218130
|
workspaceRoot,
|
|
218063
218131
|
violation.targetModule,
|
|
@@ -221079,7 +221147,7 @@ async function generateMissingModuleContracts(workspaceRoot) {
|
|
|
221079
221147
|
});
|
|
221080
221148
|
createdContracts.push(contractPath);
|
|
221081
221149
|
}
|
|
221082
|
-
if (isRegistryEntryDifferent({
|
|
221150
|
+
if (moduleEntry.discoverySource === "architecture.json" && isRegistryEntryDifferent({
|
|
221083
221151
|
contract,
|
|
221084
221152
|
moduleName: moduleEntry.moduleName,
|
|
221085
221153
|
sourcePath,
|
|
@@ -226727,17 +226795,40 @@ function getModulePathForName(contract, moduleName) {
|
|
|
226727
226795
|
const reference = contract.modules?.[moduleName];
|
|
226728
226796
|
return normalizePath11(reference?.path ?? `${modulesRoot}/${moduleName}`);
|
|
226729
226797
|
}
|
|
226730
|
-
function
|
|
226798
|
+
function getComponentEntries2(contract) {
|
|
226799
|
+
const components = contract.components;
|
|
226800
|
+
if (!components) {
|
|
226801
|
+
return [];
|
|
226802
|
+
}
|
|
226803
|
+
return Array.isArray(components) ? components.map((component, index) => [
|
|
226804
|
+
typeof component.id === "string" && component.id.trim().length > 0 ? component.id.trim() : `component-${index}`,
|
|
226805
|
+
component
|
|
226806
|
+
]) : Object.entries(components);
|
|
226807
|
+
}
|
|
226808
|
+
function getComponentPathForFile(contract, relativePath) {
|
|
226731
226809
|
const normalized = normalizePath11(relativePath).toLowerCase();
|
|
226732
|
-
|
|
226810
|
+
const candidates = getComponentEntries2(contract).map(([, component]) => component.path).filter(
|
|
226811
|
+
(componentPath) => typeof componentPath === "string" && componentPath.trim().length > 0
|
|
226812
|
+
).map((componentPath) => normalizePath11(componentPath)).filter((componentPath) => {
|
|
226813
|
+
const normalizedComponentPath = componentPath.toLowerCase();
|
|
226814
|
+
return normalized === normalizedComponentPath || normalized.startsWith(`${normalizedComponentPath}/`);
|
|
226815
|
+
}).sort((left, right) => right.length - left.length || left.localeCompare(right));
|
|
226816
|
+
return candidates[0];
|
|
226817
|
+
}
|
|
226818
|
+
function getOwnershipPathForFile(contract, relativePath, moduleName) {
|
|
226819
|
+
return getModulePathForName(contract, moduleName) ?? getComponentPathForFile(contract, relativePath);
|
|
226820
|
+
}
|
|
226821
|
+
function getPathSegmentsInsideModule(relativePath, ownershipPath) {
|
|
226822
|
+
const normalized = normalizePath11(relativePath).toLowerCase();
|
|
226823
|
+
if (!ownershipPath) {
|
|
226733
226824
|
return normalized.split("/");
|
|
226734
226825
|
}
|
|
226735
|
-
const
|
|
226736
|
-
if (normalized ===
|
|
226826
|
+
const normalizedOwnershipPath = normalizePath11(ownershipPath).toLowerCase();
|
|
226827
|
+
if (normalized === normalizedOwnershipPath) {
|
|
226737
226828
|
return [];
|
|
226738
226829
|
}
|
|
226739
|
-
if (normalized.startsWith(`${
|
|
226740
|
-
return normalized.slice(
|
|
226830
|
+
if (normalized.startsWith(`${normalizedOwnershipPath}/`)) {
|
|
226831
|
+
return normalized.slice(normalizedOwnershipPath.length + 1).split("/");
|
|
226741
226832
|
}
|
|
226742
226833
|
return normalized.split("/");
|
|
226743
226834
|
}
|
|
@@ -226873,7 +226964,10 @@ function createFinding(input2) {
|
|
|
226873
226964
|
function hasRepositoryLayer(files, contract) {
|
|
226874
226965
|
return files.some((file) => {
|
|
226875
226966
|
const moduleName = inferModuleForPath2(contract, file.relativePath);
|
|
226876
|
-
return classifySourceFile(
|
|
226967
|
+
return classifySourceFile(
|
|
226968
|
+
file,
|
|
226969
|
+
getOwnershipPathForFile(contract, file.relativePath, moduleName)
|
|
226970
|
+
).isRepository;
|
|
226877
226971
|
});
|
|
226878
226972
|
}
|
|
226879
226973
|
function hasServiceLayer(files) {
|
|
@@ -227195,7 +227289,7 @@ async function detectApplicationLayeringFindings(input2) {
|
|
|
227195
227289
|
const moduleName = inferModuleForPath2(input2.contract, file.relativePath);
|
|
227196
227290
|
const classification = classifySourceFile(
|
|
227197
227291
|
file,
|
|
227198
|
-
|
|
227292
|
+
getOwnershipPathForFile(input2.contract, file.relativePath, moduleName),
|
|
227199
227293
|
input2.astCache
|
|
227200
227294
|
);
|
|
227201
227295
|
const candidates = [
|
|
@@ -245446,7 +245540,15 @@ function readMavenMetadata(workspaceRoot, componentPath) {
|
|
|
245446
245540
|
artifactId: readFirstXmlTag(normalizedPom, "artifactId"),
|
|
245447
245541
|
name: readFirstXmlTag(normalizedPom, "name"),
|
|
245448
245542
|
hasPom: true,
|
|
245543
|
+
hasModules: /<modules\b/iu.test(normalizedPom),
|
|
245449
245544
|
hasDependencyManagement: /<dependencyManagement\b/iu.test(normalizedPom),
|
|
245545
|
+
hasSpringBootPlugin: /\bspring-boot-maven-plugin\b/iu.test(normalizedPom),
|
|
245546
|
+
hasSpringBootRepackageGoal: /<goal>\s*repackage\s*<\/goal>/iu.test(normalizedPom),
|
|
245547
|
+
configuredMainClass: readFirstXmlTag(normalizedPom, "mainClass") ?? readFirstXmlTag(normalizedPom, "start-class"),
|
|
245548
|
+
hasSpringBootStarterDependency: dependencyBlocks.some((block) => /<artifactId>\s*spring-boot-starter(?:-[^<]+)?\s*<\/artifactId>/iu.test(block)),
|
|
245549
|
+
hasSpringBootAutoconfigureDependency: dependencyBlocks.some((block) => /<artifactId>\s*spring-boot-autoconfigure\s*<\/artifactId>/iu.test(block)),
|
|
245550
|
+
hasSpringBootAutoconfigureProcessor: /spring-boot-autoconfigure-processor|spring-boot-configuration-processor/iu.test(normalizedPom),
|
|
245551
|
+
hasDocumentationTooling: /asciidoctor-maven-plugin|maven-site-plugin|doxia|antora|javadoc|<goal>\s*site\s*<\/goal>/iu.test(normalizedPom),
|
|
245450
245552
|
testScopedDependencyCount: dependencyBlocks.filter((block) => /<scope>\s*test\s*<\/scope>/iu.test(block)).length,
|
|
245451
245553
|
totalDependencyCount: dependencyBlocks.length,
|
|
245452
245554
|
hasMavenPluginConfiguration: packaging === "maven-plugin" || /maven-plugin-plugin|<goalPrefix>|<mojo/iu.test(normalizedPom),
|
|
@@ -245563,6 +245665,291 @@ function hasRunnableFrontendComponentEvidence(workspaceRoot, componentPath) {
|
|
|
245563
245665
|
function isUnderJvmResourceRoot4(componentPath) {
|
|
245564
245666
|
return /(^|\/)src\/main\/resources(?:\/|$)/u.test(normalizePath25(componentPath).toLowerCase());
|
|
245565
245667
|
}
|
|
245668
|
+
function hasFileUnderRoot(root, pattern) {
|
|
245669
|
+
if (!pathExists19(root)) {
|
|
245670
|
+
return false;
|
|
245671
|
+
}
|
|
245672
|
+
const entries = fs58.readdirSync(root, { recursive: true, withFileTypes: true });
|
|
245673
|
+
return entries.some((entry) => entry.isFile() && pattern.test(entry.name));
|
|
245674
|
+
}
|
|
245675
|
+
var javaMainMethodPattern = /\bpublic\s+static\s+void\s+main\s*\(\s*String\s*(?:(?:\[\s*\]\s*)|\.\.\.\s*)[A-Za-z_$][\w$]*\s*(?:\[\s*\])?\s*\)/u;
|
|
245676
|
+
function stripJavaLikeCommentsAndStrings(value) {
|
|
245677
|
+
let result = "";
|
|
245678
|
+
let index = 0;
|
|
245679
|
+
let state = "code";
|
|
245680
|
+
while (index < value.length) {
|
|
245681
|
+
const current = value[index] ?? "";
|
|
245682
|
+
const next = value[index + 1] ?? "";
|
|
245683
|
+
const nextTwo = value.slice(index, index + 3);
|
|
245684
|
+
if (state === "code") {
|
|
245685
|
+
if (current === "/" && next === "/") {
|
|
245686
|
+
result += " ";
|
|
245687
|
+
index += 2;
|
|
245688
|
+
state = "line-comment";
|
|
245689
|
+
continue;
|
|
245690
|
+
}
|
|
245691
|
+
if (current === "/" && next === "*") {
|
|
245692
|
+
result += " ";
|
|
245693
|
+
index += 2;
|
|
245694
|
+
state = "block-comment";
|
|
245695
|
+
continue;
|
|
245696
|
+
}
|
|
245697
|
+
if (nextTwo === '"""') {
|
|
245698
|
+
result += " ";
|
|
245699
|
+
index += 3;
|
|
245700
|
+
state = "text-block";
|
|
245701
|
+
continue;
|
|
245702
|
+
}
|
|
245703
|
+
if (current === '"') {
|
|
245704
|
+
result += " ";
|
|
245705
|
+
index += 1;
|
|
245706
|
+
state = "string";
|
|
245707
|
+
continue;
|
|
245708
|
+
}
|
|
245709
|
+
if (current === "'") {
|
|
245710
|
+
result += " ";
|
|
245711
|
+
index += 1;
|
|
245712
|
+
state = "char";
|
|
245713
|
+
continue;
|
|
245714
|
+
}
|
|
245715
|
+
result += current;
|
|
245716
|
+
index += 1;
|
|
245717
|
+
continue;
|
|
245718
|
+
}
|
|
245719
|
+
if (state === "line-comment") {
|
|
245720
|
+
result += current === "\n" || current === "\r" ? current : " ";
|
|
245721
|
+
index += 1;
|
|
245722
|
+
if (current === "\n") {
|
|
245723
|
+
state = "code";
|
|
245724
|
+
}
|
|
245725
|
+
continue;
|
|
245726
|
+
}
|
|
245727
|
+
if (state === "block-comment") {
|
|
245728
|
+
if (current === "*" && next === "/") {
|
|
245729
|
+
result += " ";
|
|
245730
|
+
index += 2;
|
|
245731
|
+
state = "code";
|
|
245732
|
+
continue;
|
|
245733
|
+
}
|
|
245734
|
+
result += current === "\n" || current === "\r" ? current : " ";
|
|
245735
|
+
index += 1;
|
|
245736
|
+
continue;
|
|
245737
|
+
}
|
|
245738
|
+
if (state === "text-block") {
|
|
245739
|
+
if (nextTwo === '"""') {
|
|
245740
|
+
result += " ";
|
|
245741
|
+
index += 3;
|
|
245742
|
+
state = "code";
|
|
245743
|
+
continue;
|
|
245744
|
+
}
|
|
245745
|
+
result += current === "\n" || current === "\r" ? current : " ";
|
|
245746
|
+
index += 1;
|
|
245747
|
+
continue;
|
|
245748
|
+
}
|
|
245749
|
+
if (state === "string") {
|
|
245750
|
+
if (current === "\\") {
|
|
245751
|
+
result += " ";
|
|
245752
|
+
index += next ? 2 : 1;
|
|
245753
|
+
if (next) {
|
|
245754
|
+
result += " ";
|
|
245755
|
+
}
|
|
245756
|
+
continue;
|
|
245757
|
+
}
|
|
245758
|
+
result += current === "\n" || current === "\r" ? current : " ";
|
|
245759
|
+
index += 1;
|
|
245760
|
+
if (current === '"') {
|
|
245761
|
+
state = "code";
|
|
245762
|
+
}
|
|
245763
|
+
continue;
|
|
245764
|
+
}
|
|
245765
|
+
if (current === "\\") {
|
|
245766
|
+
result += " ";
|
|
245767
|
+
index += next ? 2 : 1;
|
|
245768
|
+
if (next) {
|
|
245769
|
+
result += " ";
|
|
245770
|
+
}
|
|
245771
|
+
continue;
|
|
245772
|
+
}
|
|
245773
|
+
result += current === "\n" || current === "\r" ? current : " ";
|
|
245774
|
+
index += 1;
|
|
245775
|
+
if (current === "'") {
|
|
245776
|
+
state = "code";
|
|
245777
|
+
}
|
|
245778
|
+
}
|
|
245779
|
+
return result;
|
|
245780
|
+
}
|
|
245781
|
+
function readMavenProductionSourceFiles(workspaceRoot, componentPath) {
|
|
245782
|
+
const absoluteRoot = absoluteComponentRoot(workspaceRoot, componentPath);
|
|
245783
|
+
const mainRoots = [
|
|
245784
|
+
path64.join(absoluteRoot, "src", "main", "java"),
|
|
245785
|
+
path64.join(absoluteRoot, "src", "main", "kotlin"),
|
|
245786
|
+
path64.join(absoluteRoot, "src", "main", "scala")
|
|
245787
|
+
];
|
|
245788
|
+
const files = [];
|
|
245789
|
+
for (const sourceRoot of mainRoots) {
|
|
245790
|
+
if (!pathExists19(sourceRoot)) {
|
|
245791
|
+
continue;
|
|
245792
|
+
}
|
|
245793
|
+
const entries = fs58.readdirSync(sourceRoot, { recursive: true, withFileTypes: true });
|
|
245794
|
+
for (const entry of entries) {
|
|
245795
|
+
if (!entry.isFile() || !/\.(?:java|kt|scala)$/iu.test(entry.name)) {
|
|
245796
|
+
continue;
|
|
245797
|
+
}
|
|
245798
|
+
const contents = readTextFileSafe(path64.join(entry.parentPath, entry.name));
|
|
245799
|
+
if (contents) {
|
|
245800
|
+
files.push({ fileName: entry.name, contents });
|
|
245801
|
+
}
|
|
245802
|
+
}
|
|
245803
|
+
}
|
|
245804
|
+
return files;
|
|
245805
|
+
}
|
|
245806
|
+
function findMatchingBrace6(value, openBraceIndex) {
|
|
245807
|
+
let depth = 0;
|
|
245808
|
+
for (let index = openBraceIndex; index < value.length; index += 1) {
|
|
245809
|
+
const current = value[index];
|
|
245810
|
+
if (current === "{") {
|
|
245811
|
+
depth += 1;
|
|
245812
|
+
} else if (current === "}") {
|
|
245813
|
+
depth -= 1;
|
|
245814
|
+
if (depth === 0) {
|
|
245815
|
+
return index;
|
|
245816
|
+
}
|
|
245817
|
+
}
|
|
245818
|
+
}
|
|
245819
|
+
return -1;
|
|
245820
|
+
}
|
|
245821
|
+
function getDeclaredPackageName(value) {
|
|
245822
|
+
return value.match(/\bpackage\s+([a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*)\s*;/u)?.[1];
|
|
245823
|
+
}
|
|
245824
|
+
function classNameMatchesConfiguredMainClass(className, packageName, configuredMainClass) {
|
|
245825
|
+
const normalized = configuredMainClass.trim();
|
|
245826
|
+
if (normalized.length === 0) {
|
|
245827
|
+
return false;
|
|
245828
|
+
}
|
|
245829
|
+
return normalized === className || (packageName ? normalized === `${packageName}.${className}` : false);
|
|
245830
|
+
}
|
|
245831
|
+
function normalizeAnnotationName(value) {
|
|
245832
|
+
return value.slice(value.lastIndexOf(".") + 1);
|
|
245833
|
+
}
|
|
245834
|
+
function hasAnnotation(annotations, annotationNames) {
|
|
245835
|
+
return annotations.some((annotation) => annotationNames.has(normalizeAnnotationName(annotation)));
|
|
245836
|
+
}
|
|
245837
|
+
function extractAnnotations(annotationBlock) {
|
|
245838
|
+
return [...annotationBlock.matchAll(/@\s*([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)/gu)].map((match) => match[1]).filter((annotation) => Boolean(annotation));
|
|
245839
|
+
}
|
|
245840
|
+
function extractConcreteClassDeclarations(contents) {
|
|
245841
|
+
const sanitized = stripJavaLikeCommentsAndStrings(contents);
|
|
245842
|
+
const packageName = getDeclaredPackageName(sanitized);
|
|
245843
|
+
const classPattern = /((?:@\s*[\w.]+(?:\s*\([^)]*\))?\s*)*)(?:public\s+|protected\s+|private\s+|abstract\s+|final\s+|sealed\s+|non-sealed\s+|static\s+)*class\s+([A-Za-z_$][\w$]*)[^{]*\{/gu;
|
|
245844
|
+
const declarations = [];
|
|
245845
|
+
for (const match of sanitized.matchAll(classPattern)) {
|
|
245846
|
+
const annotationBlock = match[1] ?? "";
|
|
245847
|
+
const className = match[2] ?? "";
|
|
245848
|
+
const openBraceIndex = (match.index ?? 0) + match[0].length - 1;
|
|
245849
|
+
const closeBraceIndex = findMatchingBrace6(sanitized, openBraceIndex);
|
|
245850
|
+
if (closeBraceIndex < 0) {
|
|
245851
|
+
continue;
|
|
245852
|
+
}
|
|
245853
|
+
declarations.push({
|
|
245854
|
+
className,
|
|
245855
|
+
...packageName ? { packageName } : {},
|
|
245856
|
+
annotations: extractAnnotations(annotationBlock),
|
|
245857
|
+
body: sanitized.slice(openBraceIndex + 1, closeBraceIndex)
|
|
245858
|
+
});
|
|
245859
|
+
}
|
|
245860
|
+
return declarations;
|
|
245861
|
+
}
|
|
245862
|
+
function extractApplicationAnnotationNames(sourceFiles) {
|
|
245863
|
+
const applicationAnnotations = /* @__PURE__ */ new Set(["SpringBootApplication"]);
|
|
245864
|
+
let changed = true;
|
|
245865
|
+
while (changed) {
|
|
245866
|
+
changed = false;
|
|
245867
|
+
for (const sourceFile of sourceFiles) {
|
|
245868
|
+
const sanitized = stripJavaLikeCommentsAndStrings(sourceFile.contents);
|
|
245869
|
+
const annotationPattern = /((?:@\s*[\w.]+(?:\s*\([^)]*\))?\s*)*)public\s+@interface\s+([A-Za-z_$][\w$]*)\b/gu;
|
|
245870
|
+
for (const match of sanitized.matchAll(annotationPattern)) {
|
|
245871
|
+
const annotations = extractAnnotations(match[1] ?? "");
|
|
245872
|
+
const annotationName = match[2];
|
|
245873
|
+
if (annotationName && !applicationAnnotations.has(annotationName) && hasAnnotation(annotations, applicationAnnotations)) {
|
|
245874
|
+
applicationAnnotations.add(annotationName);
|
|
245875
|
+
changed = true;
|
|
245876
|
+
}
|
|
245877
|
+
}
|
|
245878
|
+
}
|
|
245879
|
+
}
|
|
245880
|
+
return applicationAnnotations;
|
|
245881
|
+
}
|
|
245882
|
+
function hasSpringApplicationRunForClass(body, className) {
|
|
245883
|
+
return new RegExp(`\\bSpringApplication\\.run\\s*\\(\\s*${className}\\.class\\b`, "u").test(body);
|
|
245884
|
+
}
|
|
245885
|
+
function hasIndirectSpringApplicationRunForClass(body, className) {
|
|
245886
|
+
const helperCalls = [...body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(\s*([A-Za-z_$][\w$]*)\.class\s*,/gu)].filter((match) => match[2] === className).map((match) => match[1]).filter((methodName) => Boolean(methodName));
|
|
245887
|
+
return helperCalls.some(
|
|
245888
|
+
(methodName) => new RegExp(`\\b${methodName}\\s*\\([^)]*\\)\\s*\\{[\\s\\S]*?\\bSpringApplication\\.run\\s*\\(`, "u").test(body)
|
|
245889
|
+
);
|
|
245890
|
+
}
|
|
245891
|
+
function hasConcreteSpringBootApplicationBootstrap(sourceFiles) {
|
|
245892
|
+
const applicationAnnotations = extractApplicationAnnotationNames(sourceFiles);
|
|
245893
|
+
const declarations = sourceFiles.flatMap((sourceFile) => extractConcreteClassDeclarations(sourceFile.contents));
|
|
245894
|
+
const applicationClassNames = new Set(
|
|
245895
|
+
declarations.filter((declaration) => hasAnnotation(declaration.annotations, applicationAnnotations)).map((declaration) => declaration.className)
|
|
245896
|
+
);
|
|
245897
|
+
if (applicationClassNames.size === 0) {
|
|
245898
|
+
return false;
|
|
245899
|
+
}
|
|
245900
|
+
const hasLauncherForApplicationClass = (declaration) => javaMainMethodPattern.test(declaration.body) && [...applicationClassNames].some(
|
|
245901
|
+
(applicationClassName) => hasSpringApplicationRunForClass(declaration.body, applicationClassName) || applicationClassName === declaration.className && hasIndirectSpringApplicationRunForClass(declaration.body, applicationClassName)
|
|
245902
|
+
);
|
|
245903
|
+
if (declarations.some(hasLauncherForApplicationClass)) {
|
|
245904
|
+
return true;
|
|
245905
|
+
}
|
|
245906
|
+
for (const sourceFile of sourceFiles) {
|
|
245907
|
+
for (const declaration of extractConcreteClassDeclarations(sourceFile.contents)) {
|
|
245908
|
+
if (!hasAnnotation(declaration.annotations, applicationAnnotations)) {
|
|
245909
|
+
continue;
|
|
245910
|
+
}
|
|
245911
|
+
if (javaMainMethodPattern.test(declaration.body) && (hasSpringApplicationRunForClass(declaration.body, declaration.className) || hasIndirectSpringApplicationRunForClass(declaration.body, declaration.className))) {
|
|
245912
|
+
return true;
|
|
245913
|
+
}
|
|
245914
|
+
}
|
|
245915
|
+
}
|
|
245916
|
+
return false;
|
|
245917
|
+
}
|
|
245918
|
+
function hasConfiguredMainClassEntrypoint(contents, configuredMainClass) {
|
|
245919
|
+
for (const declaration of extractConcreteClassDeclarations(contents)) {
|
|
245920
|
+
if (!classNameMatchesConfiguredMainClass(declaration.className, declaration.packageName, configuredMainClass)) {
|
|
245921
|
+
continue;
|
|
245922
|
+
}
|
|
245923
|
+
if (javaMainMethodPattern.test(declaration.body)) {
|
|
245924
|
+
return true;
|
|
245925
|
+
}
|
|
245926
|
+
}
|
|
245927
|
+
return false;
|
|
245928
|
+
}
|
|
245929
|
+
function hasMavenMainEntrypoint(workspaceRoot, componentPath) {
|
|
245930
|
+
return hasConcreteSpringBootApplicationBootstrap(readMavenProductionSourceFiles(workspaceRoot, componentPath));
|
|
245931
|
+
}
|
|
245932
|
+
function hasMavenConfiguredMainClassEntrypoint(workspaceRoot, componentPath, configuredMainClass) {
|
|
245933
|
+
if (!configuredMainClass) {
|
|
245934
|
+
return false;
|
|
245935
|
+
}
|
|
245936
|
+
return readMavenProductionSourceFiles(workspaceRoot, componentPath).some((sourceFile) => hasConfiguredMainClassEntrypoint(sourceFile.contents, configuredMainClass));
|
|
245937
|
+
}
|
|
245938
|
+
function hasMavenAutoConfigurationMetadata(workspaceRoot, componentPath) {
|
|
245939
|
+
const absoluteRoot = absoluteComponentRoot(workspaceRoot, componentPath);
|
|
245940
|
+
return [
|
|
245941
|
+
path64.join(absoluteRoot, "src", "main", "resources", "META-INF", "spring.factories"),
|
|
245942
|
+
path64.join(absoluteRoot, "src", "main", "resources", "META-INF", "spring", "org.springframework.boot.autoconfigure.AutoConfiguration.imports")
|
|
245943
|
+
].some(pathExists19);
|
|
245944
|
+
}
|
|
245945
|
+
function hasMavenMainJvmSource(workspaceRoot, componentPath) {
|
|
245946
|
+
const absoluteRoot = absoluteComponentRoot(workspaceRoot, componentPath);
|
|
245947
|
+
return [
|
|
245948
|
+
path64.join(absoluteRoot, "src", "main", "java"),
|
|
245949
|
+
path64.join(absoluteRoot, "src", "main", "kotlin"),
|
|
245950
|
+
path64.join(absoluteRoot, "src", "main", "scala")
|
|
245951
|
+
].some((root) => hasFileUnderRoot(root, /\.(?:java|kt|scala)$/iu));
|
|
245952
|
+
}
|
|
245566
245953
|
function hasRuntimeSourceFiles(workspaceRoot, componentPath) {
|
|
245567
245954
|
if (isUnderJvmResourceRoot4(componentPath)) {
|
|
245568
245955
|
return false;
|
|
@@ -245588,11 +245975,24 @@ function hasRuntimeSourceFiles(workspaceRoot, componentPath) {
|
|
|
245588
245975
|
function resolveKind(workspaceRoot, candidate, localProjectKinds) {
|
|
245589
245976
|
const lowerPath = candidate.path.toLowerCase();
|
|
245590
245977
|
const packageJson = readPackageJson(workspaceRoot, candidate.path);
|
|
245978
|
+
const maven = readMavenMetadata(workspaceRoot, candidate.path);
|
|
245591
245979
|
const hasRunnableFrontendEvidence = hasRunnableFrontendComponentEvidence(workspaceRoot, candidate.path);
|
|
245592
245980
|
const hasPublishSurface = hasPackagePublishSurface(packageJson);
|
|
245981
|
+
const hasMavenRunnableEvidence = Boolean(
|
|
245982
|
+
maven && (hasMavenMainEntrypoint(workspaceRoot, candidate.path) || hasMavenConfiguredMainClassEntrypoint(workspaceRoot, candidate.path, maven.configuredMainClass) || maven.hasSpringBootPlugin && maven.hasSpringBootRepackageGoal && hasMavenMainEntrypoint(workspaceRoot, candidate.path) || maven.packaging === "war" && hasMavenMainEntrypoint(workspaceRoot, candidate.path))
|
|
245983
|
+
);
|
|
245984
|
+
const hasMavenLibraryEvidence = Boolean(
|
|
245985
|
+
maven && !hasMavenRunnableEvidence && (maven.packaging === "jar" || maven.packaging === "maven-plugin" || maven.packaging === "pom") && (hasMavenMainJvmSource(workspaceRoot, candidate.path) || maven.hasMainResources || maven.hasDependencyManagement || maven.hasSpringBootAutoconfigureDependency || maven.hasSpringBootAutoconfigureProcessor || hasMavenAutoConfigurationMetadata(workspaceRoot, candidate.path) || maven.hasDocumentationTooling || maven.hasTestJava || maven.hasTestResources)
|
|
245986
|
+
);
|
|
245593
245987
|
if (lowerPath.endsWith("/db") || lowerPath.endsWith("/database") || lowerPath.endsWith("/data")) {
|
|
245594
245988
|
return "data";
|
|
245595
245989
|
}
|
|
245990
|
+
if (hasMavenLibraryEvidence) {
|
|
245991
|
+
return "library";
|
|
245992
|
+
}
|
|
245993
|
+
if (maven && !hasMavenRunnableEvidence && localProjectKinds.primaryKind === "backend") {
|
|
245994
|
+
return "library";
|
|
245995
|
+
}
|
|
245596
245996
|
const classification = candidate.architectureRoot?.classification;
|
|
245597
245997
|
if (classification === "frontend_app") {
|
|
245598
245998
|
return hasPublishSurface && !hasRunnableFrontendEvidence ? "library" : "frontend";
|
|
@@ -245687,6 +246087,11 @@ function classifyGovernanceRole(input2) {
|
|
|
245687
246087
|
const mavenMetadataText = `${maven?.artifactId ?? ""} ${maven?.name ?? ""}`.toLowerCase();
|
|
245688
246088
|
const hasMavenMainSource = Boolean(maven?.hasMainJava || maven?.hasMainResources);
|
|
245689
246089
|
const hasMavenTestSource = Boolean(maven?.hasTestJava || maven?.hasTestResources);
|
|
246090
|
+
const hasMavenMainEntrypointEvidence = Boolean(maven && hasMavenMainEntrypoint(input2.workspaceRoot, input2.candidate.path));
|
|
246091
|
+
const hasMavenMainJvmSourceEvidence = Boolean(maven && hasMavenMainJvmSource(input2.workspaceRoot, input2.candidate.path));
|
|
246092
|
+
const hasMavenAutoConfigurationEvidence = Boolean(maven && (hasMavenAutoConfigurationMetadata(input2.workspaceRoot, input2.candidate.path) || maven.hasSpringBootAutoconfigureDependency || maven.hasSpringBootAutoconfigureProcessor));
|
|
246093
|
+
const hasMavenExecutableConfiguration = Boolean(maven && (hasMavenConfiguredMainClassEntrypoint(input2.workspaceRoot, input2.candidate.path, maven.configuredMainClass) || maven.hasSpringBootPlugin && maven.hasSpringBootRepackageGoal && hasMavenMainEntrypointEvidence || maven.packaging === "war" && hasMavenMainEntrypointEvidence));
|
|
246094
|
+
const hasMavenRunnableApplicationEvidence = Boolean(hasMavenMainEntrypointEvidence || hasMavenExecutableConfiguration);
|
|
245690
246095
|
const isMavenPomOnly = Boolean(maven?.packaging === "pom" && !hasMavenMainSource && !hasMavenTestSource);
|
|
245691
246096
|
const hasMavenTestContext = hasAnyToken(pathText, [
|
|
245692
246097
|
/(^|\/)(test-framework|testsuite|integration-tests?|test-apps)(\/|$)/u
|
|
@@ -245725,17 +246130,19 @@ function classifyGovernanceRole(input2) {
|
|
|
245725
246130
|
if (maven?.hasPom) {
|
|
245726
246131
|
addEvidence6(evidence, `Maven packaging ${maven.packaging ?? "jar"}`);
|
|
245727
246132
|
}
|
|
245728
|
-
if (maven && (maven.packaging === "jar" || maven.packaging === "war") &&
|
|
246133
|
+
if (maven && (maven.packaging === "jar" || maven.packaging === "war") && hasMavenRunnableApplicationEvidence) {
|
|
245729
246134
|
runtimeScore += 3;
|
|
245730
|
-
addEvidence6(evidence, "Maven
|
|
246135
|
+
addEvidence6(evidence, "Maven executable application evidence");
|
|
245731
246136
|
}
|
|
245732
|
-
if (maven?.packaging === "war" &&
|
|
246137
|
+
if (maven?.packaging === "war" && hasMavenMainJvmSourceEvidence) {
|
|
245733
246138
|
runtimeScore += 1;
|
|
245734
246139
|
addEvidence6(evidence, "Maven deployable WAR artifact");
|
|
245735
246140
|
}
|
|
245736
|
-
if (maven && hasMavenMainSource && !hasMavenTestContext && !hasMavenBomEvidence && maven.packaging !== "maven-plugin") {
|
|
245737
|
-
|
|
245738
|
-
|
|
246141
|
+
if (maven && hasMavenMainSource && !hasMavenRunnableApplicationEvidence && !hasMavenTestContext && !hasMavenBomEvidence && maven.packaging !== "maven-plugin") {
|
|
246142
|
+
addEvidence6(evidence, "Maven library main source/resource surface");
|
|
246143
|
+
}
|
|
246144
|
+
if (hasMavenAutoConfigurationEvidence && !hasMavenRunnableApplicationEvidence) {
|
|
246145
|
+
addEvidence6(evidence, "Maven Spring Boot auto-configuration/starter library evidence");
|
|
245739
246146
|
}
|
|
245740
246147
|
if (hasAnyToken(descriptiveManifestText, [/\b(e2e|end-to-end|testing|test helper|test utilities|fixtures?)\b/u])) {
|
|
245741
246148
|
supportScore += 3;
|
|
@@ -245776,6 +246183,10 @@ function classifyGovernanceRole(input2) {
|
|
|
245776
246183
|
supportScore += 5;
|
|
245777
246184
|
addEvidence6(evidence, "Maven plugin/build-tooling module");
|
|
245778
246185
|
}
|
|
246186
|
+
if (maven?.hasDocumentationTooling && !hasMavenMainJvmSourceEvidence) {
|
|
246187
|
+
supportScore += 4;
|
|
246188
|
+
addEvidence6(evidence, "Maven documentation tooling without JVM runtime source");
|
|
246189
|
+
}
|
|
245779
246190
|
if (hasMavenBomEvidence) {
|
|
245780
246191
|
supportScore += 5;
|
|
245781
246192
|
addEvidence6(evidence, "Maven BOM/dependency-management module without runtime source");
|
|
@@ -246168,7 +246579,7 @@ function isCliSupportCandidate(component, allComponents) {
|
|
|
246168
246579
|
}
|
|
246169
246580
|
function hasIndependentRuntimeEvidence(component) {
|
|
246170
246581
|
const text = componentEvidenceText(component);
|
|
246171
|
-
return component.governanceRole === "runtime" && (/Maven
|
|
246582
|
+
return component.governanceRole === "runtime" && (/Maven executable application evidence/iu.test(text) || /Maven deployable WAR artifact/iu.test(text) || /Published package surface signal/iu.test(text) && !/Path contains support\/tooling role tokens/iu.test(text));
|
|
246172
246583
|
}
|
|
246173
246584
|
function hasSupportRoleEvidence(component) {
|
|
246174
246585
|
const text = componentEvidenceText(component);
|