@codeyam/codeyam-cli 0.1.0-staging.76566f9 → 0.1.0-staging.78c1cad
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/analyzer-template/.build-info.json +8 -8
- package/analyzer-template/common/execAsync.ts +1 -1
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +32 -29
- package/analyzer-template/packages/ai/index.ts +21 -5
- package/analyzer-template/packages/ai/package.json +4 -4
- package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +226 -24
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +217 -13
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +316 -23
- package/analyzer-template/packages/ai/src/lib/astScopes/nodeToSource.ts +19 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +11 -4
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +15 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +1229 -30
- package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +265 -6
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +247 -66
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +2041 -328
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.ts +10 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +296 -35
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +70 -9
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +129 -20
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +140 -14
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +393 -90
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +183 -0
- package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
- package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
- package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +33 -7
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +86 -142
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +59 -3
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1461 -67
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +200 -196
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +677 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2484 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +5 -5
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +328 -7
- package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +111 -87
- package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -142
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +110 -6
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -89
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +11 -11
- package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +824 -0
- package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +122 -3
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
- package/analyzer-template/packages/analyze/index.ts +6 -1
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +79 -59
- package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +132 -33
- package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
- package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +492 -282
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +47 -37
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +25 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +13 -14
- package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +21 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +115 -20
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +35 -15
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +15 -12
- package/analyzer-template/packages/analyze/src/lib/files/analyzeNextRoute.ts +8 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
- package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1352 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +201 -46
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +304 -66
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +579 -29
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +166 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -3
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1839 -844
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
- package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
- package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
- package/analyzer-template/packages/aws/package.json +10 -10
- package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
- package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
- package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
- package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
- package/analyzer-template/packages/database/index.ts +1 -0
- package/analyzer-template/packages/database/package.json +4 -4
- package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +22 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +17 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +164 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +38 -15
- package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
- package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +58 -19
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -9
- package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
- package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +5 -6
- package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
- package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +96 -152
- package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
- package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
- package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
- package/analyzer-template/packages/generate/index.ts +3 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +221 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
- package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
- package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/index.js +1 -0
- package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +4 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +16 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -18
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +17 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +29 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +149 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +7 -6
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +15 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +45 -14
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -10
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts +4 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js +5 -5
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +5 -5
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +76 -89
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
- package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.js +3 -0
- package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +217 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts +3 -4
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js +0 -1
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js +2 -0
- package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +71 -27
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +8 -0
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +19 -54
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +1 -21
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +153 -5
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/github/package.json +2 -2
- package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
- package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
- package/analyzer-template/packages/process/index.ts +2 -0
- package/analyzer-template/packages/process/package.json +12 -0
- package/analyzer-template/packages/process/tsconfig.json +8 -0
- package/analyzer-template/packages/types/index.ts +3 -6
- package/analyzer-template/packages/types/src/enums/ProjectFramework.ts +2 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +87 -27
- package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
- package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
- package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +8 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +19 -77
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +181 -5
- package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- package/analyzer-template/packages/ui-components/package.json +1 -1
- package/analyzer-template/packages/utils/dist/types/index.d.ts +3 -4
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js +0 -1
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js +2 -0
- package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +71 -27
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +8 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +19 -54
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +1 -21
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +153 -5
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts +3 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +120 -4
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +148 -3
- package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
- package/analyzer-template/playwright/capture.ts +57 -26
- package/analyzer-template/playwright/captureFromUrl.ts +89 -82
- package/analyzer-template/playwright/captureStatic.ts +1 -1
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/analyzeBaselineCommit.ts +9 -0
- package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
- package/analyzer-template/project/analyzeFileEntities.ts +30 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +9 -0
- package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
- package/analyzer-template/project/constructMockCode.ts +1149 -130
- package/analyzer-template/project/controller/startController.ts +16 -1
- package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
- package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
- package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
- package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
- package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
- package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
- package/analyzer-template/project/orchestrateCapture.ts +85 -10
- package/analyzer-template/project/reconcileMockDataKeys.ts +246 -1
- package/analyzer-template/project/runAnalysis.ts +11 -0
- package/analyzer-template/project/runMultiScenarioServer.ts +26 -3
- package/analyzer-template/project/serverOnlyModules.ts +127 -2
- package/analyzer-template/project/start.ts +54 -15
- package/analyzer-template/project/startScenarioCapture.ts +15 -0
- package/analyzer-template/project/writeClientLogRoute.ts +125 -0
- package/analyzer-template/project/writeMockDataTsx.ts +315 -11
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +420 -57
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +23 -13
- package/analyzer-template/scripts/comboWorkerLoop.cjs +99 -50
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/analyzer-template/tsconfig.json +14 -1
- package/background/src/lib/local/createLocalAnalyzer.js +2 -30
- package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
- package/background/src/lib/local/execAsync.js +1 -1
- package/background/src/lib/local/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/common/execAsync.js +1 -1
- package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +7 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js +24 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js +7 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +1002 -88
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/controller/startController.js +11 -1
- package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +3 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +7 -5
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +69 -11
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +206 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +9 -0
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js +23 -3
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +106 -3
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +49 -15
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +12 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
- package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +267 -8
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +326 -51
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
- package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +23 -13
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +386 -9
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
- package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
- package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
- package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
- package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
- package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
- package/codeyam-cli/src/cli.js +62 -23
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +18 -2
- package/codeyam-cli/src/codeyam-cli.js.map +1 -1
- package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js +47 -0
- package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js +71 -0
- package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js +30 -0
- package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
- package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +56 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +101 -47
- package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +22 -10
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +176 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -0
- package/codeyam-cli/src/commands/debug.js +37 -23
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +43 -35
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/editor.js +5923 -0
- package/codeyam-cli/src/commands/editor.js.map +1 -0
- package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js +23 -0
- package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js.map +1 -0
- package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
- package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
- package/codeyam-cli/src/commands/init.js +148 -292
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +278 -0
- package/codeyam-cli/src/commands/memory.js.map +1 -0
- package/codeyam-cli/src/commands/recapture.js +31 -18
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/report.js +46 -1
- package/codeyam-cli/src/commands/report.js.map +1 -1
- package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
- package/codeyam-cli/src/commands/setup-simulations.js +284 -0
- package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
- package/codeyam-cli/src/commands/start.js +8 -12
- package/codeyam-cli/src/commands/start.js.map +1 -1
- package/codeyam-cli/src/commands/status.js +23 -1
- package/codeyam-cli/src/commands/status.js.map +1 -1
- package/codeyam-cli/src/commands/telemetry.js +37 -0
- package/codeyam-cli/src/commands/telemetry.js.map +1 -0
- package/codeyam-cli/src/commands/test-startup.js +3 -1
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/verify.js +14 -2
- package/codeyam-cli/src/commands/verify.js.map +1 -1
- package/codeyam-cli/src/commands/wipe.js +108 -0
- package/codeyam-cli/src/commands/wipe.js.map +1 -0
- package/codeyam-cli/src/data/designSystems.js +27 -0
- package/codeyam-cli/src/data/designSystems.js.map +1 -0
- package/codeyam-cli/src/data/techStacks.js +77 -0
- package/codeyam-cli/src/data/techStacks.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
- package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js +46 -0
- package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
- package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js +181 -0
- package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +4024 -0
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
- package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js +137 -0
- package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +304 -0
- package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +194 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +381 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js +67 -0
- package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
- package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
- package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +594 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
- package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
- package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +361 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +153 -0
- package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +291 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +1768 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +329 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +2121 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
- package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
- package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +122 -0
- package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js +302 -0
- package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +129 -0
- package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
- package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
- package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js +127 -0
- package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +284 -0
- package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
- package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +672 -0
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js +84 -0
- package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +175 -82
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
- package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +51 -0
- package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js +216 -0
- package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +148 -0
- package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -0
- package/codeyam-cli/src/utils/analysisRunner.js +67 -22
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +26 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
- package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
- package/codeyam-cli/src/utils/backgroundServer.js +203 -30
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/buildFlags.js +4 -0
- package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
- package/codeyam-cli/src/utils/database.js +128 -7
- package/codeyam-cli/src/utils/database.js.map +1 -1
- package/codeyam-cli/src/utils/devModeEvents.js +40 -0
- package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
- package/codeyam-cli/src/utils/devServerState.js +71 -0
- package/codeyam-cli/src/utils/devServerState.js.map +1 -0
- package/codeyam-cli/src/utils/editorApi.js +95 -0
- package/codeyam-cli/src/utils/editorApi.js.map +1 -0
- package/codeyam-cli/src/utils/editorAudit.js +844 -0
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
- package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
- package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
- package/codeyam-cli/src/utils/editorCapture.js +102 -0
- package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
- package/codeyam-cli/src/utils/editorDevServer.js +197 -0
- package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js +50 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
- package/codeyam-cli/src/utils/editorEntityHelpers.js +144 -0
- package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorGuard.js +36 -0
- package/codeyam-cli/src/utils/editorGuard.js.map +1 -0
- package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
- package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
- package/codeyam-cli/src/utils/editorJournal.js +225 -0
- package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js +152 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorMigration.js +224 -0
- package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
- package/codeyam-cli/src/utils/editorMockState.js +248 -0
- package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
- package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
- package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorPreview.js +139 -0
- package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
- package/codeyam-cli/src/utils/editorRecapture.js +109 -0
- package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarioSwitch.js +134 -0
- package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarios.js +677 -0
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
- package/codeyam-cli/src/utils/editorSeedAdapter.js +462 -0
- package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
- package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
- package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js +394 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +227 -0
- package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
- package/codeyam-cli/src/utils/fileMetadata.js +5 -0
- package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
- package/codeyam-cli/src/utils/fileWatcher.js +63 -9
- package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +4 -3
- package/codeyam-cli/src/utils/generateReport.js.map +1 -1
- package/codeyam-cli/src/utils/git.js +182 -0
- package/codeyam-cli/src/utils/git.js.map +1 -0
- package/codeyam-cli/src/utils/glossaryAdd.js +74 -0
- package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +134 -39
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
- package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
- package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
- package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
- package/codeyam-cli/src/utils/manualEntityAnalysis.js +196 -0
- package/codeyam-cli/src/utils/manualEntityAnalysis.js.map +1 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
- package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
- package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
- package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
- package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
- package/codeyam-cli/src/utils/progress.js +8 -1
- package/codeyam-cli/src/utils/progress.js.map +1 -1
- package/codeyam-cli/src/utils/project.js +15 -5
- package/codeyam-cli/src/utils/project.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
- package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js +159 -0
- package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js.map +1 -0
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
- package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +214 -7
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +7 -0
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
- package/codeyam-cli/src/utils/registerScenarioResult.js +52 -0
- package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
- package/codeyam-cli/src/utils/requireSimulations.js +10 -0
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
- package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
- package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +229 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +74 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +376 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +113 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
- package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/index.js +7 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -0
- package/codeyam-cli/src/utils/rules/parser.js +93 -0
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js +49 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
- package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
- package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
- package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
- package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
- package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
- package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +137 -0
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
- package/codeyam-cli/src/utils/scenarioCoverage.js +77 -0
- package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
- package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
- package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
- package/codeyam-cli/src/utils/scenariosManifest.js +313 -0
- package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
- package/codeyam-cli/src/utils/screenshotHash.js +26 -0
- package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
- package/codeyam-cli/src/utils/serverState.js +94 -12
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +96 -45
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/simulationGateMiddleware.js +175 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
- package/codeyam-cli/src/utils/slugUtils.js +25 -0
- package/codeyam-cli/src/utils/slugUtils.js.map +1 -0
- package/codeyam-cli/src/utils/syncMocksMiddleware.js +7 -26
- package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
- package/codeyam-cli/src/utils/telemetry.js +106 -0
- package/codeyam-cli/src/utils/telemetry.js.map +1 -0
- package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
- package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.js +53 -0
- package/codeyam-cli/src/utils/testResultCache.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.server.js +81 -0
- package/codeyam-cli/src/utils/testResultCache.server.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.server.test.js +187 -0
- package/codeyam-cli/src/utils/testResultCache.server.test.js.map +1 -0
- package/codeyam-cli/src/utils/testResultCache.test.js +230 -0
- package/codeyam-cli/src/utils/testResultCache.test.js.map +1 -0
- package/codeyam-cli/src/utils/testRunner.js +350 -0
- package/codeyam-cli/src/utils/testRunner.js.map +1 -0
- package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
- package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
- package/codeyam-cli/src/utils/versionInfo.js +67 -15
- package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +38 -3
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/utils/wipe.js +128 -0
- package/codeyam-cli/src/utils/wipe.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +98 -0
- package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +107 -0
- package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
- package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +647 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +315 -0
- package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js +135 -0
- package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/clientErrors.js +86 -0
- package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/database.js +129 -50
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/git.js +397 -0
- package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
- package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js +34 -0
- package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js.map +1 -0
- package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
- package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
- package/codeyam-cli/src/webserver/backgroundServer.js +186 -37
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +51 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CLe80MMu.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-Crt_KN_U.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CD7lGABo.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CgTNOhnu.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DtYTSPL2.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-D3s1MFkb.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-D1CdlbrV.js → LoadingDots-By5zI316.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-wDPcZNKx.js → LogViewer-CM5zg40N.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-CQENLSrF.js +36 -0
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-C2PLkej3.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DanvyBPb.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CefgqbCr.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bc8BG-Lw.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-BA_Ry-rs.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/_index-C1YkzTAV.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-yH46LLUz.js +27 -0
- package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
- package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-CHx25PAe.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-Bg3e7q4S.js +22 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-scenario-data-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-coverage-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-schema-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-verify-routes-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.interactive-switch-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/book-open-CL-lMgHh.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BYimnrHg.js → chevron-down-GmAjGS9-.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BAdwhyCx.js +43 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CaVsIRxt.js → circle-check-DFcQkN5j.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/copy-C6iF61Xs.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-4ImjHTVC.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-Coe5NhbS.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-DoA97ML3.svg} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CRepiabR.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor._tab-Gbk_i5Js.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-CRxPi2BB.js +96 -0
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-CluPkvXJ.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-Dt-SjPsw.js → entity._sha._-DYJRGiDI.js} +14 -13
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-wdiwx5-Z.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-BrkN-40Y.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DxfhekTZ.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CfLCUi9S.js → entity._sha_.edit._scenarioId-CRXJWmpB.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DKJyZfAY.js → entry.client-SuW9syRS.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-D-xGrg29.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-Bq_fbXP5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-BsGHu8WX.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-BosqDOlH.js → index-Bp1l4hSv.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-CzNNiTkw.js → index-CWV9XZiG.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/index-DE3jI_dv.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-B_IX45ih.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CNp9QFCX.js → loader-circle-De-7qQ2u.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/manifest-9032538f.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-Cx2xEx7s.js +101 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-CFxEKL1u.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-dKFRTYcy.js +80 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-DDGjYAMJ.js → search-BdBb5aqc.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/settings-DdE-Untf.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DSCdE99u.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/terminal-CrplD4b1.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CBc5dE1s.js → triangle-alert-DqJ0j69l.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-DhXHbEjP.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-D9QZKaLJ.js +2 -0
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-Cy5Qg_UR.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useToast-5HR2j9ZE.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
- package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-B6HnVI5u.js +16 -0
- package/codeyam-cli/src/webserver/build/server/assets/index-rV_xLS1u.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/init-BdWDvetv.js +10 -0
- package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-B_jdq5dT.js +689 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/devServer.js +39 -5
- package/codeyam-cli/src/webserver/devServer.js.map +1 -1
- package/codeyam-cli/src/webserver/editorProxy.js +1028 -0
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
- package/codeyam-cli/src/webserver/idleDetector.js +130 -0
- package/codeyam-cli/src/webserver/idleDetector.js.map +1 -0
- package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
- package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
- package/codeyam-cli/src/webserver/public/sound-test.html +98 -0
- package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
- package/codeyam-cli/src/webserver/scripts/journalCapture.ts +283 -0
- package/codeyam-cli/src/webserver/server.js +414 -26
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +952 -0
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
- package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
- package/codeyam-cli/templates/chrome-extension-react/EXTENSION_SETUP.md +75 -0
- package/codeyam-cli/templates/chrome-extension-react/README.md +46 -0
- package/codeyam-cli/templates/chrome-extension-react/gitignore +15 -0
- package/codeyam-cli/templates/chrome-extension-react/index.html +12 -0
- package/codeyam-cli/templates/chrome-extension-react/package.json +27 -0
- package/codeyam-cli/templates/chrome-extension-react/popup.html +12 -0
- package/codeyam-cli/templates/chrome-extension-react/public/manifest.json +15 -0
- package/codeyam-cli/templates/chrome-extension-react/src/background/service-worker.ts +7 -0
- package/codeyam-cli/templates/chrome-extension-react/src/globals.css +6 -0
- package/codeyam-cli/templates/chrome-extension-react/src/lib/storage.ts +37 -0
- package/codeyam-cli/templates/chrome-extension-react/src/popup/App.tsx +12 -0
- package/codeyam-cli/templates/chrome-extension-react/src/popup/main.tsx +10 -0
- package/codeyam-cli/templates/chrome-extension-react/tsconfig.json +24 -0
- package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +41 -0
- package/codeyam-cli/templates/codeyam-editor-claude.md +149 -0
- package/codeyam-cli/templates/codeyam-editor-reference.md +216 -0
- package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
- package/codeyam-cli/templates/commands/codeyam-diagnose.md +481 -0
- package/codeyam-cli/templates/design-systems/clean-dashboard-design-system.md +255 -0
- package/codeyam-cli/templates/design-systems/editorial-design-system.md +267 -0
- package/codeyam-cli/templates/design-systems/mono-brutalist-design-system.md +256 -0
- package/codeyam-cli/templates/design-systems/neo-brutalist-design-system.md +294 -0
- package/codeyam-cli/templates/editor-step-hook.py +368 -0
- package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +203 -0
- package/codeyam-cli/templates/expo-react-native/README.md +41 -0
- package/codeyam-cli/templates/expo-react-native/__tests__/.gitkeep +0 -0
- package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +13 -0
- package/codeyam-cli/templates/expo-react-native/app/index.tsx +36 -0
- package/codeyam-cli/templates/expo-react-native/app.json +18 -0
- package/codeyam-cli/templates/expo-react-native/babel.config.js +9 -0
- package/codeyam-cli/templates/expo-react-native/gitignore +12 -0
- package/codeyam-cli/templates/expo-react-native/global.css +10 -0
- package/codeyam-cli/templates/expo-react-native/lib/storage.ts +32 -0
- package/codeyam-cli/templates/expo-react-native/lib/theme.ts +73 -0
- package/codeyam-cli/templates/expo-react-native/metro.config.js +6 -0
- package/codeyam-cli/templates/expo-react-native/nativewind-env.d.ts +1 -0
- package/codeyam-cli/templates/expo-react-native/package.json +48 -0
- package/codeyam-cli/templates/expo-react-native/tailwind.config.js +10 -0
- package/codeyam-cli/templates/expo-react-native/tsconfig.json +10 -0
- package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
- package/codeyam-cli/templates/isolation-route/expo-router.tsx.template +54 -0
- package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
- package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
- package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
- package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
- package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
- package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_PATTERNS.md +308 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_UPGRADE.md +304 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +126 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/FEATURE_PATTERNS.md +37 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +24 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/env +4 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +64 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +39 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +40 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +140 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
- package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/README.md +52 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/SUPABASE_SETUP.md +104 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/api/todos/route.ts +17 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/globals.css +26 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/layout.tsx +34 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/prisma.ts +20 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/supabase.ts +12 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/app/page.tsx +10 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/env +9 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/eslint.config.mjs +11 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/gitignore +40 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/next.config.ts +11 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +37 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/postcss.config.mjs +7 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/schema.prisma +27 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/seed.ts +39 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/prisma.config.ts +12 -0
- package/codeyam-cli/templates/nextjs-prisma-supabase/tsconfig.json +34 -0
- package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
- package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
- package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
- package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
- package/codeyam-cli/templates/rule-notification-hook.py +83 -0
- package/codeyam-cli/templates/rule-reflection-hook.py +647 -0
- package/codeyam-cli/templates/rules-instructions.md +78 -0
- package/codeyam-cli/templates/seed-adapters/supabase.ts +291 -0
- package/codeyam-cli/templates/{codeyam-debug-skill.md → skills/codeyam-debug/SKILL.md} +48 -4
- package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +244 -0
- package/codeyam-cli/templates/skills/codeyam-memory/SKILL.md +611 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
- package/codeyam-cli/templates/skills/codeyam-new-rule/SKILL.md +11 -0
- package/codeyam-cli/templates/{codeyam-setup-skill.md → skills/codeyam-setup/SKILL.md} +13 -1
- package/codeyam-cli/templates/{codeyam-sim-skill.md → skills/codeyam-sim/SKILL.md} +1 -1
- package/codeyam-cli/templates/{codeyam-test-skill.md → skills/codeyam-test/SKILL.md} +1 -1
- package/codeyam-cli/templates/{codeyam-verify-skill.md → skills/codeyam-verify/SKILL.md} +1 -1
- package/package.json +35 -24
- package/packages/ai/index.js +8 -6
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +179 -13
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +160 -13
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js +237 -23
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/nodeToSource.js +16 -0
- package/packages/ai/src/lib/astScopes/nodeToSource.js.map +1 -1
- package/packages/ai/src/lib/astScopes/paths.js +12 -3
- package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +7 -0
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +944 -30
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
- package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +24 -9
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +188 -38
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1627 -199
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js +9 -2
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +230 -23
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +66 -7
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +111 -14
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
- package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +122 -12
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +333 -81
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
- package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
- package/packages/ai/src/lib/dataStructureChunking.js +130 -0
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
- package/packages/ai/src/lib/deepEqual.js +32 -0
- package/packages/ai/src/lib/deepEqual.js.map +1 -0
- package/packages/ai/src/lib/e2eDataTracking.js +241 -0
- package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +21 -5
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +78 -120
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +47 -2
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +1156 -62
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +177 -163
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +484 -0
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1807 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -2
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +270 -7
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +88 -46
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -100
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +83 -6
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -70
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +9 -9
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
- package/packages/ai/src/lib/resolvePathToControllable.js +677 -0
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
- package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
- package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/index.js +2 -1
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +75 -36
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/ProjectAnalyzer.js +109 -30
- package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/analysisContext.js +30 -5
- package/packages/analyze/src/lib/analysisContext.js.map +1 -1
- package/packages/analyze/src/lib/asts/index.js +4 -2
- package/packages/analyze/src/lib/asts/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
- package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +220 -57
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +37 -27
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +14 -2
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +11 -8
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +14 -0
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +75 -21
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +22 -11
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +10 -10
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeNextRoute.js +5 -1
- package/packages/analyze/src/lib/files/analyzeNextRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
- package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
- package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +907 -0
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +170 -40
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +253 -42
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +381 -26
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +104 -0
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -3
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +1478 -672
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
- package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/index.js +1 -0
- package/packages/analyze/src/lib/index.js.map +1 -1
- package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
- package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/packages/database/index.js +1 -0
- package/packages/database/index.js.map +1 -1
- package/packages/database/src/lib/analysisBranchToDb.js +1 -1
- package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/packages/database/src/lib/analysisToDb.js +1 -1
- package/packages/database/src/lib/analysisToDb.js.map +1 -1
- package/packages/database/src/lib/branchToDb.js +1 -1
- package/packages/database/src/lib/branchToDb.js.map +1 -1
- package/packages/database/src/lib/commitBranchToDb.js +1 -1
- package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
- package/packages/database/src/lib/commitToDb.js +1 -1
- package/packages/database/src/lib/commitToDb.js.map +1 -1
- package/packages/database/src/lib/fileToDb.js +1 -1
- package/packages/database/src/lib/fileToDb.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +16 -1
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +149 -0
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/packages/database/src/lib/loadAnalyses.js +45 -2
- package/packages/database/src/lib/loadAnalyses.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +15 -1
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadBranch.js +11 -1
- package/packages/database/src/lib/loadBranch.js.map +1 -1
- package/packages/database/src/lib/loadCommit.js +7 -0
- package/packages/database/src/lib/loadCommit.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +45 -14
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +23 -10
- package/packages/database/src/lib/loadEntities.js.map +1 -1
- package/packages/database/src/lib/loadEntity.js +5 -5
- package/packages/database/src/lib/loadEntity.js.map +1 -1
- package/packages/database/src/lib/loadEntityBranches.js +9 -0
- package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +5 -5
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/database/src/lib/projectToDb.js +1 -1
- package/packages/database/src/lib/projectToDb.js.map +1 -1
- package/packages/database/src/lib/saveFiles.js +1 -1
- package/packages/database/src/lib/saveFiles.js.map +1 -1
- package/packages/database/src/lib/scenarioToDb.js +1 -1
- package/packages/database/src/lib/scenarioToDb.js.map +1 -1
- package/packages/database/src/lib/updateCommitMetadata.js +76 -89
- package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
- package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
- package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
- package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
- package/packages/generate/index.js +3 -0
- package/packages/generate/index.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +217 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
- package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
- package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/packages/process/index.js +3 -0
- package/packages/process/index.js.map +1 -0
- package/packages/process/src/GlobalProcessManager.js.map +1 -0
- package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
- package/packages/process/src/ProcessManager.js.map +1 -0
- package/packages/process/src/index.js.map +1 -0
- package/packages/process/src/managedExecAsync.js.map +1 -0
- package/packages/types/index.js +0 -1
- package/packages/types/index.js.map +1 -1
- package/packages/types/src/enums/ProjectFramework.js +2 -0
- package/packages/types/src/enums/ProjectFramework.js.map +1 -1
- package/packages/types/src/types/Scenario.js +1 -21
- package/packages/types/src/types/Scenario.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +120 -4
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/packages/utils/src/lib/safeFileName.js +29 -3
- package/packages/utils/src/lib/safeFileName.js.map +1 -1
- package/scripts/npm-post-install.cjs +34 -0
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -409
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -288
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -495
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -120
- package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
- package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
- package/analyzer-template/process/README.md +0 -507
- package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
- package/background/src/lib/process/ProcessManager.js.map +0 -1
- package/background/src/lib/process/index.js.map +0 -1
- package/background/src/lib/process/managedExecAsync.js.map +0 -1
- package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -118
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
- package/codeyam-cli/src/commands/list.js +0 -31
- package/codeyam-cli/src/commands/list.js.map +0 -1
- package/codeyam-cli/src/commands/webapp-info.js +0 -146
- package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
- package/codeyam-cli/src/utils/universal-mocks.js +0 -152
- package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CzGX-miz.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CBQPrpT0.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BfmDgXxG.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-6J7zDUD5.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CVP_WGQ3.js +0 -32
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +0 -51
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgUsG7ib.js +0 -21
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DAtOlaWE.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-D62Lxxmv.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/globals-C9s7Lhdl.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-0d27da29.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-B_wIKCIf.js +0 -56
- package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-BqPPNjAl.js +0 -2
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-DWHcCcl1.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CU58-Ttc.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-D35o2uae.js +0 -175
- package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
- package/codeyam-cli/templates/debug-codeyam.md +0 -625
- package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
- package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -298
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -226
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -408
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/isFrontend.js +0 -5
- package/packages/ai/src/lib/isFrontend.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -77
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
- package/scripts/finalize-analyzer.cjs +0 -81
- /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.link-scenario-value-l0sNRNKZ.js → api.agent-transcripts-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-key-attributes-l0sNRNKZ.js → api.dev-mode-events-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-valid-values-l0sNRNKZ.js → api.editor-audit-l0sNRNKZ.js} +0 -0
- /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { splitOutsideParenthesesAndArrays, joinParenthesesAndArrays, } from "../../../../../../packages/ai/index.js";
|
|
2
2
|
import { cleanKnownObjectFunctionsFromMapping } from "../../../../../../packages/ai/index.js";
|
|
3
|
+
import { transformationTracer } from "./TransformationTracer.js";
|
|
3
4
|
function cleanFunctionName(functionName) {
|
|
4
5
|
return functionName?.split('<')[0];
|
|
5
6
|
}
|
|
@@ -24,6 +25,82 @@ function getTypeParameter(functionName) {
|
|
|
24
25
|
}
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if a schema path contains a Set/Map collection method call.
|
|
30
|
+
* Paths like `.has(articleId)`, `.delete(articleId)`, `.add(articleId)` represent
|
|
31
|
+
* membership checks on Sets/Maps, not meaningful data flow for schema generation.
|
|
32
|
+
* These create massive combinatorial explosions when every filter field (filterRatings,
|
|
33
|
+
* filterPublications, filterAuthors, etc.) × every method (has, delete, add) gets
|
|
34
|
+
* tracked as a separate equivalency.
|
|
35
|
+
*/
|
|
36
|
+
const COLLECTION_METHOD_PATTERN = /\.(?:has|delete|add|clear|get|set)\(/;
|
|
37
|
+
function isCollectionMethodPath(path) {
|
|
38
|
+
return COLLECTION_METHOD_PATTERN.test(path);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check if a path contains an inline object literal inside a function call argument.
|
|
42
|
+
* e.g., setUndoEntry({ label: '...', undo: () => {} }) has '{' inside '(' ')'.
|
|
43
|
+
* These paths are call-site snapshots where the source code text was captured
|
|
44
|
+
* as the path. They don't represent schema structure and are very expensive to
|
|
45
|
+
* parse (avg 319 chars). They account for ~55% of equivalencies in complex entities.
|
|
46
|
+
*/
|
|
47
|
+
const INLINE_OBJECT_ARG_PATTERN = /\([^)]*\{[^}]*:/;
|
|
48
|
+
function hasInlineObjectArg(path) {
|
|
49
|
+
// Match function calls containing object literals with key-value pairs.
|
|
50
|
+
// Pattern: open paren, then { with a : inside before closing }.
|
|
51
|
+
// e.g., setUndoEntry({ label: '...' }) matches
|
|
52
|
+
// e.g., find(item) does NOT match
|
|
53
|
+
// e.g., fn({a:1, b:2}) matches
|
|
54
|
+
return INLINE_OBJECT_ARG_PATTERN.test(path);
|
|
55
|
+
}
|
|
56
|
+
// Primitive types that should not have child paths
|
|
57
|
+
const PRIMITIVE_TYPES = new Set([
|
|
58
|
+
'number',
|
|
59
|
+
'string',
|
|
60
|
+
'boolean',
|
|
61
|
+
'null',
|
|
62
|
+
'undefined',
|
|
63
|
+
]);
|
|
64
|
+
// Check if a type string represents a primitive type
|
|
65
|
+
// Handles union types like "string | undefined" or "number | null"
|
|
66
|
+
// Also handles string literal unions like "'suggestion' | 'warning' | 'tip'"
|
|
67
|
+
function isPrimitiveType(typeStr) {
|
|
68
|
+
if (PRIMITIVE_TYPES.has(typeStr)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
// Check union types - if ALL parts of the union are primitives, it's primitive
|
|
72
|
+
// e.g., "string | undefined" -> ["string", "undefined"] -> both are primitive -> true
|
|
73
|
+
// e.g., "object | null" -> ["object", "null"] -> object is not primitive -> false
|
|
74
|
+
// e.g., "'suggestion' | 'warning'" -> string literal union -> true
|
|
75
|
+
if (typeStr.includes('|')) {
|
|
76
|
+
const parts = typeStr.split('|').map((p) => p.trim());
|
|
77
|
+
return parts.every((part) => PRIMITIVE_TYPES.has(part) ||
|
|
78
|
+
// String literal values like 'suggestion', 'warning' are primitives
|
|
79
|
+
(part.startsWith("'") && part.endsWith("'")));
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
// Extract signature index from a path like "signature[0]" or "signature[0].foo"
|
|
84
|
+
// Returns the index number or undefined if not a signature path
|
|
85
|
+
function extractSignatureIndex(path) {
|
|
86
|
+
const match = path.match(/^signature\[(\d+)\]/);
|
|
87
|
+
return match ? parseInt(match[1], 10) : undefined;
|
|
88
|
+
}
|
|
89
|
+
// Check if a new schema path would go through a primitive type
|
|
90
|
+
// e.g., if schema has 'entities[].scenarioCount': 'number', then
|
|
91
|
+
// 'entities[].scenarioCount.sha' would go through a primitive and should be rejected
|
|
92
|
+
function wouldGoThroughPrimitive(newPath, schema) {
|
|
93
|
+
const pathParts = splitOutsideParenthesesAndArrays(newPath);
|
|
94
|
+
// Check each prefix of the path (excluding the full path itself)
|
|
95
|
+
for (let i = 1; i < pathParts.length; i++) {
|
|
96
|
+
const prefixPath = joinParenthesesAndArrays(pathParts.slice(0, i));
|
|
97
|
+
const prefixType = schema[prefixPath];
|
|
98
|
+
if (prefixType && isPrimitiveType(prefixType)) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
27
104
|
// Check if schemaPathPart matches or is a function call variant of pathPart
|
|
28
105
|
// e.g., 'isEntityBeingAnalyzed(entity.sha)' matches 'isEntityBeingAnalyzed'
|
|
29
106
|
function pathPartMatches(pathPart, schemaPathPart) {
|
|
@@ -38,15 +115,51 @@ function pathPartMatches(pathPart, schemaPathPart) {
|
|
|
38
115
|
}
|
|
39
116
|
function bestValueFromOptions(options) {
|
|
40
117
|
options = options.filter(Boolean);
|
|
41
|
-
const known = options.
|
|
42
|
-
if (known)
|
|
43
|
-
|
|
118
|
+
const known = options.filter((o) => !o.includes('unknown'));
|
|
119
|
+
if (known.length > 0) {
|
|
120
|
+
// Among known values, prefer string literal unions over bare primitives.
|
|
121
|
+
// e.g., "'draft' | 'inProgress' | 'paused' | 'completed'" is more specific than "string".
|
|
122
|
+
// This handles cases where a dependency schema has a bare type like "string" but the
|
|
123
|
+
// child entity's analysis has the actual literal union from TypeScript type resolution.
|
|
124
|
+
if (known.length > 1 && known.some((o) => PRIMITIVE_TYPES.has(o))) {
|
|
125
|
+
const literalUnion = known.find((o) => !PRIMITIVE_TYPES.has(o) && o.includes("'"));
|
|
126
|
+
if (literalUnion) {
|
|
127
|
+
return literalUnion;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return known[0];
|
|
131
|
+
}
|
|
44
132
|
const notUnknown = options.find((o) => o !== 'unknown');
|
|
45
|
-
if (notUnknown)
|
|
133
|
+
if (notUnknown) {
|
|
46
134
|
return notUnknown;
|
|
135
|
+
}
|
|
47
136
|
return options[0] ?? 'unknown';
|
|
48
137
|
}
|
|
49
|
-
|
|
138
|
+
/** Timeout (ms) for the merge operation. Throws DataStructureTimeoutError if exceeded.
|
|
139
|
+
* All successful merges complete in <300ms. Anything exceeding 2s is pathological. */
|
|
140
|
+
const MERGE_TIMEOUT_MS = 2000;
|
|
141
|
+
/** Cap for schema size during postfix application and dep copy.
|
|
142
|
+
* Successful merges produce <3K ret keys. Beyond 5K, further entries
|
|
143
|
+
* are cross-products of unrelated equivalencies — noise, not signal. */
|
|
144
|
+
const SCHEMA_KEY_CAP = 5000;
|
|
145
|
+
export class DataStructureTimeoutError extends Error {
|
|
146
|
+
constructor(entityName, elapsedMs) {
|
|
147
|
+
super(`Data structure merge timed out for ${entityName} after ${Math.round(elapsedMs / 1000)}s (limit: ${MERGE_TIMEOUT_MS / 1000}s)`);
|
|
148
|
+
this.name = 'DataStructureTimeoutError';
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
export default function mergeInDependentDataStructure({ importedExports, dependentAnalyses, rootScopeName, dataStructure, dependencySchemas, timeoutMs = MERGE_TIMEOUT_MS, }) {
|
|
152
|
+
const mergeStartTime = Date.now();
|
|
153
|
+
const mergeDeadline = timeoutMs > 0 ? mergeStartTime + timeoutMs : 0;
|
|
154
|
+
/** Call in hot loops. Throws DataStructureTimeoutError if deadline exceeded.
|
|
155
|
+
* Date.now() is ~20ns — negligible vs the ms-scale string ops in each iteration. */
|
|
156
|
+
const checkDeadline = () => {
|
|
157
|
+
if (!mergeDeadline)
|
|
158
|
+
return;
|
|
159
|
+
if (Date.now() > mergeDeadline) {
|
|
160
|
+
throw new DataStructureTimeoutError(rootScopeName, Date.now() - mergeStartTime);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
50
163
|
const mergedDataStructure = {
|
|
51
164
|
signatureSchema: { ...(dataStructure.signatureSchema ?? {}) },
|
|
52
165
|
returnValueSchema: { ...(dataStructure.returnValueSchema ?? {}) },
|
|
@@ -55,763 +168,1456 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
55
168
|
dependencySchemas: {},
|
|
56
169
|
environmentVariables: [...(dataStructure.environmentVariables || [])],
|
|
57
170
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
171
|
+
try {
|
|
172
|
+
// Build a set of functions that have multiple DIFFERENT type parameters.
|
|
173
|
+
// For these functions, we must NOT normalize paths to avoid merging different schemas.
|
|
174
|
+
// e.g., if we have both useFetcher<{ data: UserData }>() and useFetcher<{ data: ConfigData }>(),
|
|
175
|
+
// they must stay separate and not both become 'returnValue'.
|
|
176
|
+
const functionsWithMultipleTypeParams = new Set();
|
|
177
|
+
const typeParamsByFunction = {};
|
|
178
|
+
// Helper to scan a schema for type parameters
|
|
179
|
+
const scanSchemaForTypeParams = (schema) => {
|
|
180
|
+
for (const schemaPath of Object.keys(schema ?? {})) {
|
|
181
|
+
const parts = splitOutsideParenthesesAndArrays(schemaPath);
|
|
182
|
+
if (parts.length > 0) {
|
|
183
|
+
const firstPart = parts[0];
|
|
184
|
+
const typeParam = getTypeParameter(firstPart);
|
|
185
|
+
if (typeParam) {
|
|
186
|
+
const baseName = cleanFunctionName(firstPart);
|
|
187
|
+
typeParamsByFunction[baseName] || (typeParamsByFunction[baseName] = new Set());
|
|
188
|
+
typeParamsByFunction[baseName].add(typeParam);
|
|
189
|
+
if (typeParamsByFunction[baseName].size > 1) {
|
|
190
|
+
functionsWithMultipleTypeParams.add(baseName);
|
|
191
|
+
}
|
|
77
192
|
}
|
|
78
193
|
}
|
|
79
194
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
scanSchemaForTypeParams(dependencySchemas[filePath][name]?.returnValueSchema);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
let equivalentSchemaPaths = [];
|
|
91
|
-
const findRelevantDependency = (functionName) => {
|
|
92
|
-
return importedExports.find((d) => cleanFunctionName(d.name) === cleanFunctionName(functionName));
|
|
93
|
-
};
|
|
94
|
-
const findRelevantDependentDataStructure = (functionName) => {
|
|
95
|
-
const dependency = findRelevantDependency(functionName);
|
|
96
|
-
if (!dependency)
|
|
97
|
-
return;
|
|
98
|
-
return dependencySchemas?.[dependency.filePath]?.[dependency.name];
|
|
99
|
-
};
|
|
100
|
-
const findRelevantDependentAnalysisDataStructure = (functionName) => {
|
|
101
|
-
const dependency = findRelevantDependency(functionName);
|
|
102
|
-
if (!dependency)
|
|
103
|
-
return;
|
|
104
|
-
const dependentAnalysis = dependentAnalyses[dependency.filePath]?.[dependency.name];
|
|
105
|
-
if (!dependentAnalysis?.metadata?.mergedDataStructure) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
return dependentAnalysis.metadata.mergedDataStructure;
|
|
109
|
-
};
|
|
110
|
-
const findOrCreateDependentSchemas = (dependency) => {
|
|
111
|
-
var _a, _b;
|
|
112
|
-
const { filePath, name } = dependency;
|
|
113
|
-
(_a = mergedDataStructure.dependencySchemas)[filePath] || (_a[filePath] = {});
|
|
114
|
-
(_b = mergedDataStructure.dependencySchemas[filePath])[name] || (_b[name] = {
|
|
115
|
-
signatureSchema: {},
|
|
116
|
-
returnValueSchema: {},
|
|
117
|
-
});
|
|
118
|
-
return mergedDataStructure.dependencySchemas[filePath][name];
|
|
119
|
-
};
|
|
120
|
-
const cleanSchema = (schema) => {
|
|
121
|
-
cleanKnownObjectFunctionsFromMapping(schema);
|
|
122
|
-
};
|
|
123
|
-
const translatePath = (path, dependencyName) => {
|
|
124
|
-
if (path.startsWith(dependencyName)) {
|
|
125
|
-
const pathParts = splitOutsideParenthesesAndArrays(path);
|
|
126
|
-
if (pathParts.length > 1) {
|
|
127
|
-
if (pathParts[1].startsWith('functionCallReturnValue')) {
|
|
128
|
-
// Check if this function has multiple DIFFERENT type parameters.
|
|
129
|
-
// If so, DON'T normalize to returnValue - keep the full path to avoid
|
|
130
|
-
// merging different type-parameterized variants together.
|
|
131
|
-
// e.g., useFetcher<{ data: UserData }>().functionCallReturnValue.data
|
|
132
|
-
// should NOT be merged with useFetcher<{ data: ConfigData }>().functionCallReturnValue.data
|
|
133
|
-
const baseName = cleanFunctionName(pathParts[0]);
|
|
134
|
-
if (functionsWithMultipleTypeParams.has(baseName)) {
|
|
135
|
-
return path; // Keep the original path with type parameters
|
|
136
|
-
}
|
|
137
|
-
// functionCallReturnValue immediately follows - normalize to returnValue
|
|
138
|
-
// e.g., useAuth().functionCallReturnValue.user -> returnValue.user
|
|
139
|
-
return joinParenthesesAndArrays([
|
|
140
|
-
'returnValue',
|
|
141
|
-
...pathParts.slice(2),
|
|
142
|
-
]);
|
|
143
|
-
}
|
|
144
|
-
else if (pathParts[0].endsWith(')') &&
|
|
145
|
-
pathParts[1].startsWith('signature[')) {
|
|
146
|
-
// Hook-style with signature access (e.g., BranchChangesTab().signature[0]...)
|
|
147
|
-
// Strip the function name for signature equivalency matching
|
|
148
|
-
return joinParenthesesAndArrays(pathParts.slice(1));
|
|
149
|
-
}
|
|
150
|
-
// For all other cases (object-style APIs like getSupabase().auth and
|
|
151
|
-
// direct object references like supabase.from), preserve the path as-is.
|
|
152
|
-
// The prefix must be kept for proper schema lookups in constructMockCode
|
|
153
|
-
// and gatherDataForMocks.
|
|
195
|
+
};
|
|
196
|
+
// Scan the root entity's schema
|
|
197
|
+
scanSchemaForTypeParams(dataStructure.returnValueSchema);
|
|
198
|
+
// Also scan all dependency schemas for type parameters
|
|
199
|
+
for (const filePath of Object.keys(dependencySchemas ?? {})) {
|
|
200
|
+
for (const name of Object.keys(dependencySchemas[filePath] ?? {})) {
|
|
201
|
+
scanSchemaForTypeParams(dependencySchemas[filePath][name]?.returnValueSchema);
|
|
154
202
|
}
|
|
155
203
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}));
|
|
171
|
-
let equivalentSchemaPathsEntry;
|
|
172
|
-
for (const pathInfo of allPaths) {
|
|
173
|
-
if (!equivalentSchemaPathsEntry) {
|
|
174
|
-
equivalentSchemaPathsEntry = equivalentSchemaPaths.find((esp) => esp.equivalentRoots.some((er) => er.schemaRootPath === pathInfo.path &&
|
|
175
|
-
(er.function?.name ===
|
|
176
|
-
cleanFunctionName(pathInfo.functionName) ||
|
|
177
|
-
(!er.function &&
|
|
178
|
-
cleanFunctionName(pathInfo.functionName) ===
|
|
179
|
-
rootScopeName))));
|
|
180
|
-
}
|
|
204
|
+
let equivalentSchemaPaths = [];
|
|
205
|
+
// O(1) index for findOrCreateEquivalentSchemaPathsEntry.
|
|
206
|
+
// Maps "(rootPath)::(normalizedFuncName)" → the entry containing that root.
|
|
207
|
+
// This replaces the O(E) linear search that was causing O(E²) gather performance.
|
|
208
|
+
const espIndex = new Map();
|
|
209
|
+
const espIndexKey = (path, functionName) => {
|
|
210
|
+
const normalized = cleanFunctionName(functionName);
|
|
211
|
+
const funcKey = normalized === rootScopeName ? '__self__' : normalized || '__self__';
|
|
212
|
+
return `${path}::${funcKey}`;
|
|
213
|
+
};
|
|
214
|
+
const updateEspIndex = (entry) => {
|
|
215
|
+
for (const root of entry.equivalentRoots) {
|
|
216
|
+
const funcName = root.function?.name ?? rootScopeName;
|
|
217
|
+
espIndex.set(espIndexKey(root.schemaRootPath, funcName), entry);
|
|
181
218
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
219
|
+
};
|
|
220
|
+
// Pre-build a lookup map from cleaned function name to dependency for O(1) lookups.
|
|
221
|
+
// This avoids O(n) linear search in findRelevantDependency which was causing O(n²) performance.
|
|
222
|
+
const dependencyByCleanedName = new Map();
|
|
223
|
+
for (const dep of importedExports) {
|
|
224
|
+
const cleanedName = cleanFunctionName(dep.name);
|
|
225
|
+
if (!dependencyByCleanedName.has(cleanedName)) {
|
|
226
|
+
dependencyByCleanedName.set(cleanedName, dep);
|
|
188
227
|
}
|
|
189
|
-
|
|
190
|
-
|
|
228
|
+
}
|
|
229
|
+
const findRelevantDependency = (functionName) => {
|
|
230
|
+
return dependencyByCleanedName.get(cleanFunctionName(functionName));
|
|
231
|
+
};
|
|
232
|
+
const findRelevantDependentDataStructure = (functionName) => {
|
|
233
|
+
const dependency = findRelevantDependency(functionName);
|
|
234
|
+
if (!dependency)
|
|
235
|
+
return;
|
|
236
|
+
return dependencySchemas?.[dependency.filePath]?.[dependency.name];
|
|
237
|
+
};
|
|
238
|
+
const findRelevantDependentAnalysisDataStructure = (functionName) => {
|
|
239
|
+
const dependency = findRelevantDependency(functionName);
|
|
240
|
+
if (!dependency)
|
|
241
|
+
return;
|
|
242
|
+
const dependentAnalysis = dependentAnalyses[dependency.filePath]?.[dependency.name];
|
|
243
|
+
if (!dependentAnalysis?.metadata?.mergedDataStructure) {
|
|
244
|
+
return;
|
|
191
245
|
}
|
|
192
|
-
|
|
193
|
-
equivalentSchemaPathsEntry.equivalentRoots.filter((er, index, self) => index ===
|
|
194
|
-
self.findIndex((e) => e.schemaRootPath === er.schemaRootPath &&
|
|
195
|
-
e.function?.name === er.function?.name));
|
|
196
|
-
return equivalentSchemaPathsEntry;
|
|
246
|
+
return dependentAnalysis.metadata.mergedDataStructure;
|
|
197
247
|
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
248
|
+
const findOrCreateDependentSchemas = (dependency) => {
|
|
249
|
+
var _a, _b;
|
|
250
|
+
const { filePath, name } = dependency;
|
|
251
|
+
(_a = mergedDataStructure.dependencySchemas)[filePath] || (_a[filePath] = {});
|
|
252
|
+
(_b = mergedDataStructure.dependencySchemas[filePath])[name] || (_b[name] = {
|
|
253
|
+
signatureSchema: {},
|
|
254
|
+
returnValueSchema: {},
|
|
255
|
+
});
|
|
256
|
+
return mergedDataStructure.dependencySchemas[filePath][name];
|
|
257
|
+
};
|
|
258
|
+
const cleanSchema = (schema, context) => {
|
|
259
|
+
transformationTracer.traceSchemaTransform(rootScopeName, 'cleanKnownObjectFunctionsFromMapping', schema, cleanKnownObjectFunctionsFromMapping, context);
|
|
260
|
+
};
|
|
261
|
+
// Cache translatePath results — the same path is often translated multiple times
|
|
262
|
+
// (once per equivalency entry that references it). Avoids redundant
|
|
263
|
+
// splitOutsideParenthesesAndArrays calls on long paths.
|
|
264
|
+
const translatePathCache = new Map();
|
|
265
|
+
const translatePath = (path, dependencyName) => {
|
|
266
|
+
const cacheKey = `${dependencyName}\0${path}`;
|
|
267
|
+
const cached = translatePathCache.get(cacheKey);
|
|
268
|
+
if (cached !== undefined)
|
|
269
|
+
return cached;
|
|
270
|
+
let result = path;
|
|
271
|
+
if (path.startsWith(dependencyName)) {
|
|
272
|
+
const pathParts = splitOutsideParenthesesAndArrays(path);
|
|
273
|
+
if (pathParts.length > 1) {
|
|
274
|
+
if (pathParts[1].startsWith('functionCallReturnValue')) {
|
|
275
|
+
// Check if this function has multiple DIFFERENT type parameters.
|
|
276
|
+
// If so, DON'T normalize to returnValue - keep the full path to avoid
|
|
277
|
+
// merging different type-parameterized variants together.
|
|
278
|
+
const baseName = cleanFunctionName(pathParts[0]);
|
|
279
|
+
if (!functionsWithMultipleTypeParams.has(baseName)) {
|
|
280
|
+
// functionCallReturnValue immediately follows - normalize to returnValue
|
|
281
|
+
result = joinParenthesesAndArrays([
|
|
282
|
+
'returnValue',
|
|
283
|
+
...pathParts.slice(2),
|
|
284
|
+
]);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
else if (pathParts[0].endsWith(')') &&
|
|
288
|
+
pathParts[1].startsWith('signature[')) {
|
|
289
|
+
// Hook-style with signature access
|
|
290
|
+
result = joinParenthesesAndArrays(pathParts.slice(1));
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
translatePathCache.set(cacheKey, result);
|
|
295
|
+
return result;
|
|
296
|
+
};
|
|
297
|
+
const gatherAllEquivalentSchemaPaths = (functionName, sourceAndUsageEquivalencies, dataStructure) => {
|
|
298
|
+
checkDeadline();
|
|
299
|
+
if (!sourceAndUsageEquivalencies)
|
|
300
|
+
return;
|
|
301
|
+
const normalizedSchemaCache = new Map();
|
|
302
|
+
const getSchemaIndex = (schema) => {
|
|
303
|
+
if (!schema)
|
|
304
|
+
return { byFirstPart: new Map() };
|
|
305
|
+
const cached = normalizedSchemaCache.get(schema);
|
|
306
|
+
if (cached)
|
|
307
|
+
return cached;
|
|
308
|
+
const byFirstPart = new Map();
|
|
309
|
+
for (const path in schema) {
|
|
310
|
+
checkDeadline();
|
|
311
|
+
let parts = splitOutsideParenthesesAndArrays(path);
|
|
312
|
+
if (parts[0].startsWith(functionName)) {
|
|
313
|
+
const baseName = cleanFunctionName(parts[0]);
|
|
314
|
+
if (!functionsWithMultipleTypeParams.has(baseName)) {
|
|
315
|
+
parts =
|
|
316
|
+
parts[1] === 'functionCallReturnValue'
|
|
317
|
+
? ['returnValue', ...parts.slice(2)]
|
|
318
|
+
: parts.slice(1);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
const entry = { path, parts };
|
|
322
|
+
// Index by the base of the first part (before any function call args)
|
|
323
|
+
const firstPart = parts[0] ?? '';
|
|
324
|
+
const parenIdx = firstPart.indexOf('(');
|
|
325
|
+
const firstPartBase = parenIdx >= 0 ? firstPart.slice(0, parenIdx) : firstPart;
|
|
326
|
+
let bucket = byFirstPart.get(firstPartBase);
|
|
327
|
+
if (!bucket) {
|
|
328
|
+
bucket = [];
|
|
329
|
+
byFirstPart.set(firstPartBase, bucket);
|
|
330
|
+
}
|
|
331
|
+
bucket.push(entry);
|
|
332
|
+
}
|
|
333
|
+
const result = { byFirstPart };
|
|
334
|
+
normalizedSchemaCache.set(schema, result);
|
|
335
|
+
return result;
|
|
336
|
+
};
|
|
337
|
+
const findOrCreateEquivalentSchemaPathsEntry = (allPaths) => {
|
|
338
|
+
const equivalentRoots = allPaths
|
|
339
|
+
.filter((p) => p.functionName === rootScopeName ||
|
|
340
|
+
!!findRelevantDependency(p.functionName))
|
|
341
|
+
.map((p) => ({
|
|
342
|
+
schemaRootPath: p.path,
|
|
343
|
+
function: p.functionName === rootScopeName
|
|
344
|
+
? undefined
|
|
345
|
+
: findRelevantDependency(p.functionName),
|
|
346
|
+
}));
|
|
347
|
+
let equivalentSchemaPathsEntry;
|
|
348
|
+
// Collect the signature indices from the new roots we want to add
|
|
349
|
+
const newRootSignatureIndices = new Set();
|
|
350
|
+
for (const root of equivalentRoots) {
|
|
351
|
+
const idx = extractSignatureIndex(root.schemaRootPath);
|
|
352
|
+
if (idx !== undefined) {
|
|
353
|
+
newRootSignatureIndices.add(idx);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
// Use espIndex Map for O(1) lookup instead of O(E) linear search.
|
|
357
|
+
// Falls back to linear search only when Map hit has a signature index conflict.
|
|
358
|
+
for (const pathInfo of allPaths) {
|
|
359
|
+
checkDeadline();
|
|
360
|
+
if (equivalentSchemaPathsEntry)
|
|
361
|
+
break;
|
|
362
|
+
const candidate = espIndex.get(espIndexKey(pathInfo.path, pathInfo.functionName));
|
|
363
|
+
if (!candidate)
|
|
364
|
+
continue;
|
|
365
|
+
// Verify no signature index conflict with the candidate entry
|
|
366
|
+
if (newRootSignatureIndices.size > 0) {
|
|
367
|
+
const existingIndicesByFunction = new Map();
|
|
368
|
+
for (const er of candidate.equivalentRoots) {
|
|
369
|
+
const funcKey = er.function
|
|
370
|
+
? `${er.function.name}::${er.function.filePath}`
|
|
371
|
+
: '__self__';
|
|
372
|
+
const idx = extractSignatureIndex(er.schemaRootPath);
|
|
373
|
+
if (idx !== undefined) {
|
|
374
|
+
if (!existingIndicesByFunction.has(funcKey)) {
|
|
375
|
+
existingIndicesByFunction.set(funcKey, new Set());
|
|
234
376
|
}
|
|
377
|
+
existingIndicesByFunction.get(funcKey).add(idx);
|
|
235
378
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
379
|
+
}
|
|
380
|
+
let hasConflict = false;
|
|
381
|
+
for (const newRoot of equivalentRoots) {
|
|
382
|
+
const funcKey = newRoot.function
|
|
383
|
+
? `${newRoot.function.name}::${newRoot.function.filePath}`
|
|
384
|
+
: '__self__';
|
|
385
|
+
const newIdx = extractSignatureIndex(newRoot.schemaRootPath);
|
|
386
|
+
if (newIdx !== undefined) {
|
|
387
|
+
const existingIndices = existingIndicesByFunction.get(funcKey);
|
|
388
|
+
if (existingIndices && existingIndices.size > 0) {
|
|
389
|
+
if (!existingIndices.has(newIdx)) {
|
|
390
|
+
hasConflict = true;
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (hasConflict)
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
equivalentSchemaPathsEntry = candidate;
|
|
400
|
+
}
|
|
401
|
+
if (!equivalentSchemaPathsEntry) {
|
|
402
|
+
// Before creating a new entry, filter out roots that have conflicting
|
|
403
|
+
// signature indices from the same function. An entry should never contain
|
|
404
|
+
// roots with different signature indices from the same function.
|
|
405
|
+
// This prevents the bug where signature[1], signature[2], signature[4]
|
|
406
|
+
// all get merged together due to incorrect sourceEquivalencies.
|
|
407
|
+
let filteredRoots = equivalentRoots;
|
|
408
|
+
if (newRootSignatureIndices.size > 1) {
|
|
409
|
+
// There are multiple signature indices - we need to filter to keep only
|
|
410
|
+
// one consistent set. We'll keep the roots that match the PRIMARY index
|
|
411
|
+
// (the first signature index we encounter from self, or the lowest index).
|
|
412
|
+
// First, determine the primary index - prefer the self root's index
|
|
413
|
+
let primaryIndex;
|
|
414
|
+
for (const root of equivalentRoots) {
|
|
415
|
+
if (!root.function) {
|
|
416
|
+
// This is a self root
|
|
417
|
+
const idx = extractSignatureIndex(root.schemaRootPath);
|
|
418
|
+
if (idx !== undefined) {
|
|
419
|
+
primaryIndex = idx;
|
|
244
420
|
break;
|
|
245
421
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
// If no self root has a signature index, use the lowest index
|
|
425
|
+
if (primaryIndex === undefined) {
|
|
426
|
+
primaryIndex = Math.min(...newRootSignatureIndices);
|
|
427
|
+
}
|
|
428
|
+
// Filter roots: keep if no signature index OR signature index matches primary
|
|
429
|
+
filteredRoots = equivalentRoots.filter((root) => {
|
|
430
|
+
const idx = extractSignatureIndex(root.schemaRootPath);
|
|
431
|
+
return idx === undefined || idx === primaryIndex;
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
equivalentSchemaPathsEntry = {
|
|
435
|
+
equivalentRoots: filteredRoots,
|
|
436
|
+
equivalentPostfixes: {},
|
|
437
|
+
};
|
|
438
|
+
equivalentSchemaPaths.push(equivalentSchemaPathsEntry);
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
equivalentSchemaPathsEntry.equivalentRoots.push(...equivalentRoots);
|
|
442
|
+
}
|
|
443
|
+
// Deduplicate roots using a Set for O(n) instead of O(n²)
|
|
444
|
+
const seenRoots = new Set();
|
|
445
|
+
equivalentSchemaPathsEntry.equivalentRoots =
|
|
446
|
+
equivalentSchemaPathsEntry.equivalentRoots.filter((er) => {
|
|
447
|
+
const key = er.schemaRootPath + '::' + (er.function?.name ?? '');
|
|
448
|
+
if (seenRoots.has(key))
|
|
449
|
+
return false;
|
|
450
|
+
seenRoots.add(key);
|
|
451
|
+
return true;
|
|
452
|
+
});
|
|
453
|
+
// Keep the espIndex in sync after adding/deduplicating roots
|
|
454
|
+
updateEspIndex(equivalentSchemaPathsEntry);
|
|
455
|
+
return equivalentSchemaPathsEntry;
|
|
456
|
+
};
|
|
457
|
+
// Helper to extract function name from a path that starts with a function call.
|
|
458
|
+
// e.g., 'ScenarioViewer().signature[0].scenario' -> 'ScenarioViewer'
|
|
459
|
+
// Returns undefined if the path doesn't start with a function call or the function isn't a dependency.
|
|
460
|
+
const extractFunctionNameFromPath = (path) => {
|
|
461
|
+
const parts = splitOutsideParenthesesAndArrays(path);
|
|
462
|
+
if (parts.length > 0 && parts[0].endsWith(')')) {
|
|
463
|
+
// Extract the function name without the () suffix and type params
|
|
464
|
+
const funcCallPart = parts[0];
|
|
465
|
+
const funcName = cleanFunctionName(funcCallPart.replace(/\(\)$/, ''));
|
|
466
|
+
// Check if this function is a dependency
|
|
467
|
+
if (findRelevantDependency(funcName)) {
|
|
468
|
+
return funcName;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return undefined;
|
|
472
|
+
};
|
|
473
|
+
const allEquivalencies = [
|
|
474
|
+
sourceAndUsageEquivalencies.usageEquivalencies,
|
|
475
|
+
sourceAndUsageEquivalencies.sourceEquivalencies,
|
|
476
|
+
].filter(Boolean);
|
|
477
|
+
// Global dedup across ALL equivalency entries. The same (scope, targetPath)
|
|
478
|
+
// pair often appears in 30-50 different source entries (e.g., every variable
|
|
479
|
+
// that flows through loadView references the same 50 target paths).
|
|
480
|
+
// Processing these redundantly accounts for 96% of work in the gather phase.
|
|
481
|
+
const globalSeenTargets = new Set();
|
|
482
|
+
for (const equivalencies of allEquivalencies) {
|
|
483
|
+
const schemaPathEntries = Object.entries(equivalencies);
|
|
484
|
+
for (const [schemaPath, usages] of schemaPathEntries) {
|
|
485
|
+
checkDeadline();
|
|
486
|
+
// Skip equivalency entries whose source path is a Set/Map membership operation.
|
|
487
|
+
// Patterns like `.has(articleId)`, `.delete(articleId)`, `.add(articleId)` on
|
|
488
|
+
// Sets/Maps represent membership checks, not meaningful data flow for schema generation.
|
|
489
|
+
// In the Margo LibraryPage case, these account for 74% of all equivalency targets
|
|
490
|
+
// (19,444 of 26,340) and cause a combinatorial explosion in the merge.
|
|
491
|
+
if (isCollectionMethodPath(schemaPath))
|
|
492
|
+
continue;
|
|
493
|
+
// Skip paths with inline object literals in function call arguments.
|
|
494
|
+
// These are call-site snapshots (e.g., setUndoEntry({ label: '...', undo: ... }))
|
|
495
|
+
// that embed source code text as path strings. They're expensive to parse
|
|
496
|
+
// and don't contribute useful schema information.
|
|
497
|
+
if (hasInlineObjectArg(schemaPath))
|
|
498
|
+
continue;
|
|
499
|
+
// First, check if the raw schemaPath starts with a function call to a dependency.
|
|
500
|
+
// If so, use that dependency name for translation (so translatePath can strip the prefix).
|
|
501
|
+
const extractedFuncName = extractFunctionNameFromPath(schemaPath);
|
|
502
|
+
const effectiveFunctionName = extractedFuncName || functionName;
|
|
503
|
+
const translatedPath = translatePath(schemaPath, effectiveFunctionName);
|
|
504
|
+
const allPathsRaw = [
|
|
505
|
+
{ path: translatedPath, functionName: effectiveFunctionName },
|
|
506
|
+
...usages
|
|
507
|
+
.filter((u) => !isCollectionMethodPath(u.schemaPath))
|
|
508
|
+
.map((u) => ({
|
|
509
|
+
path: translatePath(u.schemaPath, u.scopeNodeName),
|
|
510
|
+
functionName: u.scopeNodeName,
|
|
511
|
+
})),
|
|
512
|
+
].filter((pathInfo) => !pathInfo.path.includes('.map('));
|
|
513
|
+
// Deduplicate by translated path + function name, both within this entry
|
|
514
|
+
// AND across all entries. The same target path appears in 30-50 different
|
|
515
|
+
// source entries (every variable flowing through loadView references the same
|
|
516
|
+
// 50 target paths). Without global dedup, we process 5,533 targets instead of 217.
|
|
517
|
+
const allPaths = allPathsRaw.filter((p) => {
|
|
518
|
+
const key = `${p.functionName ?? ''}::${p.path}`;
|
|
519
|
+
if (globalSeenTargets.has(key))
|
|
520
|
+
return false;
|
|
521
|
+
globalSeenTargets.add(key);
|
|
522
|
+
return true;
|
|
523
|
+
});
|
|
524
|
+
// Fix 38: Derive base paths from property access paths.
|
|
525
|
+
// When we have equivalent paths like:
|
|
526
|
+
// Parent: signature[0].scenarios[].name
|
|
527
|
+
// Child: signature[0].selectedScenario.name
|
|
528
|
+
// We want to derive the base paths by finding the common suffix:
|
|
529
|
+
// Common suffix: .name
|
|
530
|
+
// Parent base: signature[0].scenarios[]
|
|
531
|
+
// Child base: signature[0].selectedScenario
|
|
532
|
+
// This allows the merge to find nested child schema fields under the base prop.
|
|
533
|
+
// Find child signature paths (paths from child components)
|
|
534
|
+
const childPaths = allPaths.filter((p) => p.functionName &&
|
|
535
|
+
p.functionName !== rootScopeName &&
|
|
536
|
+
p.functionName !== effectiveFunctionName);
|
|
537
|
+
// Find parent paths (paths from this component)
|
|
538
|
+
const parentPaths = allPaths.filter((p) => !p.functionName ||
|
|
539
|
+
p.functionName === rootScopeName ||
|
|
540
|
+
p.functionName === effectiveFunctionName);
|
|
541
|
+
const derivedBasePaths = [];
|
|
542
|
+
const allPathSet = new Set(allPaths.map((p) => p.path));
|
|
543
|
+
const derivedBasePathSet = new Set();
|
|
544
|
+
// For each child path, find its equivalent parent path and derive bases
|
|
545
|
+
for (const childPathInfo of childPaths) {
|
|
546
|
+
checkDeadline();
|
|
547
|
+
const childParts = splitOutsideParenthesesAndArrays(childPathInfo.path);
|
|
548
|
+
// Look for a parent path that shares a common suffix with this child path
|
|
549
|
+
for (const parentPathInfo of parentPaths) {
|
|
550
|
+
const parentParts = splitOutsideParenthesesAndArrays(parentPathInfo.path);
|
|
551
|
+
// Find the common suffix (from the end)
|
|
552
|
+
let commonSuffixLength = 0;
|
|
553
|
+
const minLen = Math.min(childParts.length, parentParts.length);
|
|
554
|
+
for (let i = 1; i <= minLen; i++) {
|
|
555
|
+
if (childParts[childParts.length - i] ===
|
|
556
|
+
parentParts[parentParts.length - i]) {
|
|
557
|
+
commonSuffixLength = i;
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
break;
|
|
254
561
|
}
|
|
255
562
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
])
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
563
|
+
// If there's a common suffix and both paths have more parts than the suffix
|
|
564
|
+
if (commonSuffixLength > 0 &&
|
|
565
|
+
childParts.length > commonSuffixLength &&
|
|
566
|
+
parentParts.length > commonSuffixLength) {
|
|
567
|
+
const childBaseParts = childParts.slice(0, childParts.length - commonSuffixLength);
|
|
568
|
+
const parentBaseParts = parentParts.slice(0, parentParts.length - commonSuffixLength);
|
|
569
|
+
// Only derive if BOTH paths look like signature paths.
|
|
570
|
+
// This ensures we're handling JSX child-to-parent prop mappings,
|
|
571
|
+
// not other complex equivalencies like function call returns.
|
|
572
|
+
const isChildSignaturePath = childBaseParts[0]?.startsWith('signature[') ||
|
|
573
|
+
(childBaseParts[0]?.endsWith(')') &&
|
|
574
|
+
childBaseParts[1]?.startsWith('signature['));
|
|
575
|
+
const isParentSignaturePath = parentBaseParts[0]?.startsWith('signature[');
|
|
576
|
+
if (isChildSignaturePath && isParentSignaturePath) {
|
|
577
|
+
const childBase = joinParenthesesAndArrays(childBaseParts);
|
|
578
|
+
const parentBase = joinParenthesesAndArrays(parentBaseParts);
|
|
579
|
+
// Only derive if:
|
|
580
|
+
// 1. Parent has array iteration (e.g., scenarios[]) and child does NOT
|
|
581
|
+
// 2. Bases are different
|
|
582
|
+
// 3. Child base is NOT just "signature[N]" (too generic - every component has this)
|
|
583
|
+
// We only want specific prop paths like "signature[0].selectedScenario"
|
|
584
|
+
// This targets array-to-object mappings like scenarios[] -> selectedScenario
|
|
585
|
+
const parentHasArrayIterator = parentBase.includes('[]');
|
|
586
|
+
const childHasArrayIterator = childBase.includes('[]');
|
|
587
|
+
// Skip if child base is just the generic signature marker (e.g., "signature[0]")
|
|
588
|
+
const childBaseIsGenericSignature = /^signature\[\d+\]$/.test(childBase);
|
|
589
|
+
if (childBase !== parentBase &&
|
|
590
|
+
parentHasArrayIterator &&
|
|
591
|
+
!childHasArrayIterator &&
|
|
592
|
+
!childBaseIsGenericSignature) {
|
|
593
|
+
// Add child base if not already present (O(1) Set lookup)
|
|
594
|
+
if (!allPathSet.has(childBase) &&
|
|
595
|
+
!derivedBasePathSet.has(childBase)) {
|
|
596
|
+
derivedBasePaths.push({
|
|
597
|
+
path: childBase,
|
|
598
|
+
functionName: childPathInfo.functionName,
|
|
599
|
+
});
|
|
600
|
+
derivedBasePathSet.add(childBase);
|
|
601
|
+
}
|
|
602
|
+
// Add parent base if not already present (O(1) Set lookup)
|
|
603
|
+
if (!allPathSet.has(parentBase) &&
|
|
604
|
+
!derivedBasePathSet.has(parentBase)) {
|
|
605
|
+
derivedBasePaths.push({
|
|
606
|
+
path: parentBase,
|
|
607
|
+
functionName: parentPathInfo.functionName,
|
|
608
|
+
});
|
|
609
|
+
derivedBasePathSet.add(parentBase);
|
|
610
|
+
}
|
|
289
611
|
}
|
|
290
612
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
allPaths.push(...derivedBasePaths);
|
|
617
|
+
const entry = findOrCreateEquivalentSchemaPathsEntry(allPaths);
|
|
618
|
+
// Trace equivalency gathering - helps debug why paths may not be connected
|
|
619
|
+
if (allPaths.length > 1) {
|
|
620
|
+
transformationTracer.operation(rootScopeName, {
|
|
621
|
+
operation: 'gatherEquivalency',
|
|
622
|
+
stage: 'gathering',
|
|
623
|
+
path: translatedPath,
|
|
624
|
+
context: {
|
|
625
|
+
sourceFunction: functionName,
|
|
626
|
+
equivalentPaths: allPaths.map((p) => ({
|
|
627
|
+
path: p.path,
|
|
628
|
+
function: p.functionName,
|
|
629
|
+
})),
|
|
630
|
+
equivalentRoots: entry.equivalentRoots.map((r) => ({
|
|
631
|
+
path: r.schemaRootPath,
|
|
632
|
+
function: r.function?.name,
|
|
633
|
+
})),
|
|
634
|
+
},
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
for (const equivalentRoot of entry.equivalentRoots) {
|
|
638
|
+
checkDeadline();
|
|
639
|
+
const dataStructures = equivalentRoot.function &&
|
|
640
|
+
equivalentRoot.function.name !== rootScopeName
|
|
641
|
+
? [
|
|
642
|
+
findRelevantDependentDataStructure(equivalentRoot.function.name),
|
|
643
|
+
findRelevantDependentAnalysisDataStructure(equivalentRoot.function.name),
|
|
644
|
+
]
|
|
645
|
+
: [dataStructure];
|
|
646
|
+
// Determine if this is a signature schema path.
|
|
647
|
+
// The path might be 'signature[0]...' directly, or 'FuncName().signature[0]...' if it has a function prefix.
|
|
648
|
+
const schemaRootParts = splitOutsideParenthesesAndArrays(equivalentRoot.schemaRootPath);
|
|
649
|
+
const isSignaturePath = equivalentRoot.schemaRootPath.startsWith('signature[') ||
|
|
650
|
+
(schemaRootParts[0]?.endsWith(')') &&
|
|
651
|
+
schemaRootParts[1]?.startsWith('signature['));
|
|
652
|
+
const schemas = dataStructures.map((dataStructure) => isSignaturePath
|
|
653
|
+
? dataStructure?.signatureSchema
|
|
654
|
+
: dataStructure?.returnValueSchema);
|
|
655
|
+
let pathParts = splitOutsideParenthesesAndArrays(equivalentRoot.schemaRootPath);
|
|
656
|
+
// Fix: When processing a child component's schema, the schemaRootPath has the function
|
|
657
|
+
// prefix (e.g., 'ScenarioViewer().signature[0].scenario'), but the child's schema paths
|
|
658
|
+
// don't have that prefix (e.g., 'signature[0].scenario.metadata.screenshotPaths').
|
|
659
|
+
// Strip the function prefix from pathParts so they can match.
|
|
660
|
+
if (equivalentRoot.function &&
|
|
661
|
+
pathParts[0].endsWith(')') &&
|
|
662
|
+
pathParts[1]?.startsWith('signature[')) {
|
|
663
|
+
pathParts = pathParts.slice(1);
|
|
664
|
+
}
|
|
665
|
+
for (const schema of schemas) {
|
|
666
|
+
// Use pre-computed index to only iterate schema entries whose
|
|
667
|
+
// normalized first part matches pathParts[0], instead of all entries.
|
|
668
|
+
const schemaIndex = getSchemaIndex(schema);
|
|
669
|
+
const lookupPart = pathParts[0] ?? '';
|
|
670
|
+
const lookupParenIdx = lookupPart.indexOf('(');
|
|
671
|
+
const lookupBase = lookupParenIdx >= 0
|
|
672
|
+
? lookupPart.slice(0, lookupParenIdx)
|
|
673
|
+
: lookupPart;
|
|
674
|
+
const candidates = schemaIndex.byFirstPart.get(lookupBase) || [];
|
|
675
|
+
for (const { path: schemaPath, parts: schemaPathParts, } of candidates) {
|
|
676
|
+
checkDeadline();
|
|
677
|
+
if (schemaPathParts.length < pathParts.length)
|
|
678
|
+
continue;
|
|
679
|
+
// Check if all path parts match (allowing function call variants)
|
|
680
|
+
let allMatch = true;
|
|
681
|
+
let matchedUpToIndex = pathParts.length;
|
|
682
|
+
for (let i = 0; i < pathParts.length; i++) {
|
|
683
|
+
if (!pathPartMatches(pathParts[i], schemaPathParts[i])) {
|
|
684
|
+
allMatch = false;
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
// If the last pathPart matched a function call variant,
|
|
688
|
+
// we need to include it in the postfix calculation
|
|
689
|
+
if (i === pathParts.length - 1 &&
|
|
690
|
+
schemaPathParts[i] !== pathParts[i] &&
|
|
691
|
+
schemaPathParts[i].startsWith(pathParts[i] + '(')) {
|
|
692
|
+
// The schemaPathPart is a function call variant (e.g., 'isEntityBeingAnalyzed(entity.sha)')
|
|
693
|
+
// We want to include this as part of the postfix
|
|
694
|
+
matchedUpToIndex = i;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
if (allMatch) {
|
|
698
|
+
// When we matched a function call variant at the end (e.g., 'foo' matched 'foo(args)'),
|
|
699
|
+
// the base itself should be marked as a function, and the function call details
|
|
700
|
+
// should be included as sub-paths
|
|
701
|
+
if (matchedUpToIndex < pathParts.length) {
|
|
702
|
+
// This is a function call variant match at the last position
|
|
703
|
+
// Mark the base as a function (empty postfix = the base path itself)
|
|
704
|
+
entry.equivalentPostfixes[''] = bestValueFromOptions([
|
|
705
|
+
entry.equivalentPostfixes[''],
|
|
706
|
+
'function',
|
|
707
|
+
]);
|
|
708
|
+
// Also capture the function call and any remaining parts
|
|
709
|
+
// e.g., 'isEntityBeingAnalyzed(entity.sha)' or 'isEntityBeingAnalyzed(entity.sha).functionCallReturnValue'
|
|
710
|
+
const funcCallPart = schemaPathParts[matchedUpToIndex];
|
|
711
|
+
const baseName = pathParts[matchedUpToIndex]; // e.g., 'isEntityBeingAnalyzed'
|
|
712
|
+
const argsMatch = funcCallPart.match(/\(.*\)$/);
|
|
713
|
+
if (argsMatch) {
|
|
714
|
+
// Create postfix using just the args portion: (entity.sha) instead of isEntityBeingAnalyzed(entity.sha)
|
|
715
|
+
// This avoids duplicating the base name in the final path
|
|
716
|
+
const argsPortion = argsMatch[0]; // e.g., '(entity.sha)'
|
|
717
|
+
const remainingParts = schemaPathParts.slice(matchedUpToIndex + 1);
|
|
718
|
+
// Build the postfix as: (args).remaining.parts
|
|
719
|
+
const funcPostfix = joinParenthesesAndArrays([
|
|
720
|
+
argsPortion,
|
|
721
|
+
...remainingParts,
|
|
722
|
+
]);
|
|
723
|
+
entry.equivalentPostfixes[funcPostfix] = entry
|
|
724
|
+
.equivalentPostfixes[funcPostfix]
|
|
725
|
+
? bestValueFromOptions([
|
|
726
|
+
entry.equivalentPostfixes[funcPostfix],
|
|
727
|
+
schema[schemaPath],
|
|
728
|
+
])
|
|
729
|
+
: schema[schemaPath];
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
// Regular exact match - use the standard postfix logic
|
|
734
|
+
const postfix = joinParenthesesAndArrays(schemaPathParts.slice(matchedUpToIndex));
|
|
735
|
+
const previousValue = entry.equivalentPostfixes[postfix];
|
|
736
|
+
const newValue = schema[schemaPath];
|
|
737
|
+
entry.equivalentPostfixes[postfix] = previousValue
|
|
738
|
+
? bestValueFromOptions([previousValue, newValue])
|
|
739
|
+
: newValue;
|
|
740
|
+
// Trace postfix gathering - shows where type info comes from
|
|
741
|
+
if (entry.equivalentPostfixes[postfix] !== previousValue) {
|
|
742
|
+
transformationTracer.operation(rootScopeName, {
|
|
743
|
+
operation: 'gatherPostfix',
|
|
744
|
+
stage: 'gathering',
|
|
745
|
+
path: postfix || '(root)',
|
|
746
|
+
before: previousValue,
|
|
747
|
+
after: entry.equivalentPostfixes[postfix],
|
|
748
|
+
context: {
|
|
749
|
+
sourceSchemaPath: schemaPath,
|
|
750
|
+
sourceFunction: equivalentRoot.function?.name || rootScopeName,
|
|
751
|
+
equivalentRootPath: equivalentRoot.schemaRootPath,
|
|
752
|
+
rawValue: newValue,
|
|
753
|
+
},
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
}
|
|
301
757
|
}
|
|
302
758
|
}
|
|
303
759
|
}
|
|
304
760
|
}
|
|
305
761
|
}
|
|
306
762
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
763
|
+
if (Object.keys(dataStructure?.returnValueSchema ?? {}).length > 0) {
|
|
764
|
+
// Find all paths that contain functionCallReturnValue and extract unique base paths
|
|
765
|
+
// For each path containing functionCallReturnValue, find the FIRST occurrence and use
|
|
766
|
+
// that as a base path. This handles nested cases like:
|
|
767
|
+
// X().functionCallReturnValue.A.B.Y().functionCallReturnValue
|
|
768
|
+
// where we want both X().functionCallReturnValue and Y().functionCallReturnValue as bases
|
|
769
|
+
const allBasePaths = new Set();
|
|
770
|
+
for (const path of Object.keys(dataStructure.returnValueSchema)) {
|
|
771
|
+
checkDeadline();
|
|
772
|
+
const parts = splitOutsideParenthesesAndArrays(path);
|
|
773
|
+
// Find all positions of functionCallReturnValue and create base paths for each
|
|
774
|
+
for (let i = 0; i < parts.length; i++) {
|
|
775
|
+
if (parts[i] === 'functionCallReturnValue') {
|
|
776
|
+
const basePath = joinParenthesesAndArrays(parts.slice(0, i + 1));
|
|
777
|
+
allBasePaths.add(basePath);
|
|
778
|
+
}
|
|
322
779
|
}
|
|
323
780
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
781
|
+
// Sort by length so shorter paths are processed first
|
|
782
|
+
const sortedBasePaths = [...allBasePaths].sort((a, b) => a.length - b.length);
|
|
783
|
+
for (const basePath of sortedBasePaths) {
|
|
784
|
+
const translatedBasePath = translatePath(basePath, functionName);
|
|
785
|
+
const entry = findOrCreateEquivalentSchemaPathsEntry([
|
|
786
|
+
{ path: translatedBasePath, functionName: functionName },
|
|
787
|
+
]);
|
|
788
|
+
const newRoot = {
|
|
789
|
+
schemaRootPath: translatedBasePath,
|
|
790
|
+
function: findRelevantDependency(functionName),
|
|
791
|
+
};
|
|
792
|
+
entry.equivalentRoots.push(newRoot);
|
|
793
|
+
// Update index for the newly added root
|
|
794
|
+
const newRootFuncName = newRoot.function?.name ?? rootScopeName;
|
|
795
|
+
espIndex.set(espIndexKey(newRoot.schemaRootPath, newRootFuncName), entry);
|
|
796
|
+
const basePathParts = splitOutsideParenthesesAndArrays(basePath);
|
|
797
|
+
for (const schemaPath in dataStructure.returnValueSchema) {
|
|
798
|
+
checkDeadline();
|
|
799
|
+
const schemaPathParts = splitOutsideParenthesesAndArrays(schemaPath);
|
|
800
|
+
if (schemaPathParts.length < basePathParts.length)
|
|
801
|
+
continue;
|
|
802
|
+
// Check if this schemaPath actually starts with this basePath
|
|
803
|
+
// (not just has the same length prefix)
|
|
804
|
+
const prefixParts = schemaPathParts.slice(0, basePathParts.length);
|
|
805
|
+
if (joinParenthesesAndArrays(prefixParts) !==
|
|
806
|
+
joinParenthesesAndArrays(basePathParts)) {
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
const postfix = joinParenthesesAndArrays(schemaPathParts.slice(basePathParts.length));
|
|
810
|
+
const newValue = entry.equivalentPostfixes[postfix]
|
|
811
|
+
? bestValueFromOptions([
|
|
812
|
+
entry.equivalentPostfixes[postfix],
|
|
813
|
+
dataStructure.returnValueSchema[schemaPath],
|
|
814
|
+
])
|
|
815
|
+
: dataStructure.returnValueSchema[schemaPath];
|
|
816
|
+
entry.equivalentPostfixes[postfix] = newValue;
|
|
347
817
|
}
|
|
348
|
-
const postfix = joinParenthesesAndArrays(schemaPathParts.slice(basePathParts.length));
|
|
349
|
-
entry.equivalentPostfixes[postfix] = entry.equivalentPostfixes[postfix]
|
|
350
|
-
? bestValueFromOptions([
|
|
351
|
-
entry.equivalentPostfixes[postfix],
|
|
352
|
-
dataStructure.returnValueSchema[schemaPath],
|
|
353
|
-
])
|
|
354
|
-
: dataStructure.returnValueSchema[schemaPath];
|
|
355
818
|
}
|
|
356
819
|
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
parentEntry.equivalentPostfixes
|
|
384
|
-
|
|
820
|
+
};
|
|
821
|
+
const mergeAllEquivalentSchemaPaths = () => {
|
|
822
|
+
const mergedEquivalentSchemaPaths = [];
|
|
823
|
+
// Pre-pass: Connect entries with array/array-element relationships.
|
|
824
|
+
// This handles cases like:
|
|
825
|
+
// - Entry A has root 'surveys' (array)
|
|
826
|
+
// - Entry B has root 'surveys[]' (array element)
|
|
827
|
+
// These need to be connected so Entry B's field postfixes flow to Entry A.
|
|
828
|
+
// We do this before the main merge to ensure the connection happens regardless
|
|
829
|
+
// of processing order.
|
|
830
|
+
for (const esp of equivalentSchemaPaths) {
|
|
831
|
+
checkDeadline();
|
|
832
|
+
for (const root of esp.equivalentRoots) {
|
|
833
|
+
if (root.schemaRootPath.endsWith('[]')) {
|
|
834
|
+
// Find a matching parent entry with the base array path
|
|
835
|
+
const baseArrayPath = root.schemaRootPath.slice(0, -2);
|
|
836
|
+
const parentEntry = equivalentSchemaPaths.find((other) => other !== esp &&
|
|
837
|
+
other.equivalentRoots.some((otherRoot) => otherRoot.schemaRootPath === baseArrayPath &&
|
|
838
|
+
otherRoot.function?.name === root.function?.name &&
|
|
839
|
+
otherRoot.function?.filePath === root.function?.filePath));
|
|
840
|
+
if (parentEntry) {
|
|
841
|
+
// Add transformed postfixes from child (array element) to parent (array)
|
|
842
|
+
// so they can be applied with [] prefix to parent paths
|
|
843
|
+
for (const [postfixPath, postfixValue] of Object.entries(esp.equivalentPostfixes)) {
|
|
844
|
+
checkDeadline();
|
|
845
|
+
const transformedPostfix = joinParenthesesAndArrays(['[]', postfixPath].filter(Boolean));
|
|
846
|
+
if (!(transformedPostfix in parentEntry.equivalentPostfixes)) {
|
|
847
|
+
parentEntry.equivalentPostfixes[transformedPostfix] =
|
|
848
|
+
postfixValue;
|
|
849
|
+
}
|
|
385
850
|
}
|
|
386
851
|
}
|
|
387
852
|
}
|
|
388
853
|
}
|
|
389
854
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
schemaSubPath.startsWith('
|
|
396
|
-
|
|
397
|
-
er.function?.
|
|
855
|
+
const findEquivalentSchemaPathEntry = (schemaSubPath, equivalentRootFunction) => {
|
|
856
|
+
let postfix;
|
|
857
|
+
// Get the signature index we're looking for (if any)
|
|
858
|
+
const lookingForSignatureIndex = extractSignatureIndex(schemaSubPath);
|
|
859
|
+
const equivalentEntry = mergedEquivalentSchemaPaths.find((esp) => esp.equivalentRoots.some((er) => {
|
|
860
|
+
if ((schemaSubPath.startsWith('returnValue') ||
|
|
861
|
+
schemaSubPath.startsWith('signature[')) &&
|
|
862
|
+
(er.function?.name !== equivalentRootFunction?.name ||
|
|
863
|
+
er.function?.filePath !== equivalentRootFunction?.filePath)) {
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
if (schemaSubPath === er.schemaRootPath) {
|
|
867
|
+
// Additional check: if we're looking for a signature path, make sure
|
|
868
|
+
// the entry doesn't already have DIFFERENT signature indices.
|
|
869
|
+
// This prevents entries with signature[1], signature[2], signature[4]
|
|
870
|
+
// from all being merged together.
|
|
871
|
+
if (lookingForSignatureIndex !== undefined) {
|
|
872
|
+
const hasConflictingSignatureIndex = esp.equivalentRoots.some((otherRoot) => {
|
|
873
|
+
// Only check roots from the same function
|
|
874
|
+
if (otherRoot.function?.name !==
|
|
875
|
+
equivalentRootFunction?.name ||
|
|
876
|
+
otherRoot.function?.filePath !==
|
|
877
|
+
equivalentRootFunction?.filePath) {
|
|
878
|
+
return false;
|
|
879
|
+
}
|
|
880
|
+
const otherIndex = extractSignatureIndex(otherRoot.schemaRootPath);
|
|
881
|
+
return (otherIndex !== undefined &&
|
|
882
|
+
otherIndex !== lookingForSignatureIndex);
|
|
883
|
+
});
|
|
884
|
+
if (hasConflictingSignatureIndex) {
|
|
885
|
+
return false;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
postfix = er.postfix;
|
|
889
|
+
return true;
|
|
890
|
+
}
|
|
398
891
|
return false;
|
|
892
|
+
}));
|
|
893
|
+
return { equivalentEntry, postfix };
|
|
894
|
+
};
|
|
895
|
+
const sortedEquivalentSchemaPaths = equivalentSchemaPaths.sort((a, b) => Math.max(...a.equivalentRoots.map((er) => splitOutsideParenthesesAndArrays(er.schemaRootPath).length)) -
|
|
896
|
+
Math.max(...b.equivalentRoots.map((er) => splitOutsideParenthesesAndArrays(er.schemaRootPath).length)));
|
|
897
|
+
for (const esp of sortedEquivalentSchemaPaths) {
|
|
898
|
+
checkDeadline();
|
|
899
|
+
if (esp.equivalentRoots.length === 0)
|
|
900
|
+
continue;
|
|
901
|
+
let bestCandidateLength;
|
|
902
|
+
let bestCandidate;
|
|
903
|
+
let postfix;
|
|
904
|
+
for (const equivalentRoot of esp.equivalentRoots) {
|
|
905
|
+
const rootSchemaPath = equivalentRoot.schemaRootPath;
|
|
906
|
+
const schemaPathParts = splitOutsideParenthesesAndArrays(rootSchemaPath);
|
|
907
|
+
for (let i = 0; i < schemaPathParts.length; i++) {
|
|
908
|
+
const subPath = joinParenthesesAndArrays(schemaPathParts.slice(0, i + 1));
|
|
909
|
+
const { equivalentEntry, postfix: equivalentEntryPostfix } = findEquivalentSchemaPathEntry(subPath, equivalentRoot.function);
|
|
910
|
+
if (equivalentEntry &&
|
|
911
|
+
(!bestCandidateLength || bestCandidateLength > i + 1)) {
|
|
912
|
+
bestCandidate = equivalentEntry;
|
|
913
|
+
bestCandidateLength = i + 1;
|
|
914
|
+
postfix = joinParenthesesAndArrays([
|
|
915
|
+
equivalentEntryPostfix,
|
|
916
|
+
...schemaPathParts.slice(i + 1),
|
|
917
|
+
].filter(Boolean));
|
|
918
|
+
}
|
|
919
|
+
}
|
|
399
920
|
}
|
|
400
|
-
if (
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
return { equivalentEntry, postfix };
|
|
407
|
-
};
|
|
408
|
-
const sortedEquivalentSchemaPaths = equivalentSchemaPaths.sort((a, b) => Math.max(...a.equivalentRoots.map((er) => splitOutsideParenthesesAndArrays(er.schemaRootPath).length)) -
|
|
409
|
-
Math.max(...b.equivalentRoots.map((er) => splitOutsideParenthesesAndArrays(er.schemaRootPath).length)));
|
|
410
|
-
for (const esp of sortedEquivalentSchemaPaths) {
|
|
411
|
-
if (esp.equivalentRoots.length === 0)
|
|
412
|
-
continue;
|
|
413
|
-
let bestCandidateLength;
|
|
414
|
-
let bestCandidate;
|
|
415
|
-
let postfix;
|
|
416
|
-
for (const equivalentRoot of esp.equivalentRoots) {
|
|
417
|
-
const rootSchemaPath = equivalentRoot.schemaRootPath;
|
|
418
|
-
const schemaPathParts = splitOutsideParenthesesAndArrays(rootSchemaPath);
|
|
419
|
-
for (let i = 0; i < schemaPathParts.length; i++) {
|
|
420
|
-
const subPath = joinParenthesesAndArrays(schemaPathParts.slice(0, i + 1));
|
|
421
|
-
const { equivalentEntry, postfix: equivalentEntryPostfix } = findEquivalentSchemaPathEntry(subPath, equivalentRoot.function);
|
|
422
|
-
if (equivalentEntry &&
|
|
423
|
-
(!bestCandidateLength || bestCandidateLength > i + 1)) {
|
|
424
|
-
bestCandidate = equivalentEntry;
|
|
425
|
-
bestCandidateLength = i + 1;
|
|
426
|
-
postfix = joinParenthesesAndArrays([equivalentEntryPostfix, ...schemaPathParts.slice(i + 1)].filter(Boolean));
|
|
921
|
+
if (bestCandidate) {
|
|
922
|
+
for (const root of esp.equivalentRoots) {
|
|
923
|
+
if (postfix.length > 0) {
|
|
924
|
+
root.postfix = postfix;
|
|
925
|
+
}
|
|
926
|
+
bestCandidate.equivalentRoots.push(root);
|
|
427
927
|
}
|
|
928
|
+
const postfixesToMerge = postfix.length > 0
|
|
929
|
+
? Object.keys(esp.equivalentPostfixes).reduce((acc, postfixPath) => {
|
|
930
|
+
const fullPath = joinParenthesesAndArrays([
|
|
931
|
+
postfix,
|
|
932
|
+
postfixPath,
|
|
933
|
+
]);
|
|
934
|
+
acc[fullPath] = esp.equivalentPostfixes[postfixPath];
|
|
935
|
+
return acc;
|
|
936
|
+
}, {})
|
|
937
|
+
: esp.equivalentPostfixes;
|
|
938
|
+
bestCandidate.equivalentPostfixes = {
|
|
939
|
+
...bestCandidate.equivalentPostfixes,
|
|
940
|
+
...postfixesToMerge,
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
mergedEquivalentSchemaPaths.push(esp);
|
|
428
945
|
}
|
|
429
946
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
const postfixesToMerge = postfix.length > 0
|
|
438
|
-
? Object.keys(esp.equivalentPostfixes).reduce((acc, postfixPath) => {
|
|
439
|
-
const fullPath = joinParenthesesAndArrays([
|
|
440
|
-
postfix,
|
|
441
|
-
postfixPath,
|
|
442
|
-
]);
|
|
443
|
-
acc[fullPath] = esp.equivalentPostfixes[postfixPath];
|
|
444
|
-
return acc;
|
|
445
|
-
}, {})
|
|
446
|
-
: esp.equivalentPostfixes;
|
|
447
|
-
bestCandidate.equivalentPostfixes = {
|
|
448
|
-
...bestCandidate.equivalentPostfixes,
|
|
449
|
-
...postfixesToMerge,
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
else {
|
|
453
|
-
mergedEquivalentSchemaPaths.push(esp);
|
|
947
|
+
return mergedEquivalentSchemaPaths;
|
|
948
|
+
};
|
|
949
|
+
// Build a lookup of mocked dependencies to skip their internal implementation
|
|
950
|
+
const mockedDependencies = new Set();
|
|
951
|
+
for (const dep of importedExports) {
|
|
952
|
+
if (dep.isMocked) {
|
|
953
|
+
mockedDependencies.add(`${dep.filePath}::${dep.name}`);
|
|
454
954
|
}
|
|
455
955
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
gatherAllEquivalentSchemaPaths(rootScopeName, dataStructure);
|
|
466
|
-
// Process dependencySchemas for all dependencies (including mocked ones)
|
|
467
|
-
// dependencySchemas contains usage information (how dependencies are called),
|
|
468
|
-
// not internal implementation, so we want this for mocked dependencies too
|
|
469
|
-
for (const dependency of importedExports) {
|
|
470
|
-
const dependentDataStructure = dependencySchemas?.[dependency.filePath]?.[dependency.name];
|
|
471
|
-
if (!dependentDataStructure)
|
|
472
|
-
continue;
|
|
473
|
-
gatherAllEquivalentSchemaPaths(dependency.name, dependentDataStructure, dependentDataStructure);
|
|
474
|
-
}
|
|
475
|
-
for (const filePath in dependentAnalyses) {
|
|
476
|
-
for (const name in dependentAnalyses[filePath]) {
|
|
477
|
-
// Skip mocked dependencies - we don't want to merge in their internal implementation
|
|
478
|
-
if (mockedDependencies.has(`${filePath}::${name}`)) {
|
|
956
|
+
gatherAllEquivalentSchemaPaths(rootScopeName, dataStructure);
|
|
957
|
+
// Process dependencySchemas for all dependencies (including mocked ones)
|
|
958
|
+
// dependencySchemas contains usage information (how dependencies are called),
|
|
959
|
+
// not internal implementation, so we want this for mocked dependencies too
|
|
960
|
+
for (const dependency of importedExports) {
|
|
961
|
+
checkDeadline();
|
|
962
|
+
const dependentDataStructure = dependencySchemas?.[dependency.filePath]?.[dependency.name];
|
|
963
|
+
if (!dependentDataStructure)
|
|
479
964
|
continue;
|
|
965
|
+
gatherAllEquivalentSchemaPaths(dependency.name, dependentDataStructure, dependentDataStructure);
|
|
966
|
+
}
|
|
967
|
+
for (const filePath in dependentAnalyses) {
|
|
968
|
+
for (const name in dependentAnalyses[filePath]) {
|
|
969
|
+
// Skip mocked dependencies - we don't want to merge in their internal implementation
|
|
970
|
+
if (mockedDependencies.has(`${filePath}::${name}`)) {
|
|
971
|
+
continue;
|
|
972
|
+
}
|
|
973
|
+
const childMergedDataStructure = dependentAnalyses[filePath][name].metadata?.mergedDataStructure || {};
|
|
974
|
+
gatherAllEquivalentSchemaPaths(name, childMergedDataStructure);
|
|
480
975
|
}
|
|
481
|
-
const mergedDataStructure = dependentAnalyses[filePath][name].metadata?.mergedDataStructure || {};
|
|
482
|
-
gatherAllEquivalentSchemaPaths(name, mergedDataStructure);
|
|
483
976
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
for
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
977
|
+
const gatherElapsed = Date.now() - mergeStartTime;
|
|
978
|
+
equivalentSchemaPaths = mergeAllEquivalentSchemaPaths();
|
|
979
|
+
const mergeEspElapsed = Date.now() - mergeStartTime;
|
|
980
|
+
// Collect schemas that need cleaning — batch the calls for the end instead of
|
|
981
|
+
// calling cleanSchema inside the inner root loop (which was O(roots * schemaSize)).
|
|
982
|
+
const schemasToClean = new Set();
|
|
983
|
+
for (const esp of equivalentSchemaPaths) {
|
|
984
|
+
checkDeadline();
|
|
985
|
+
// Pre-compute which postfixes have children to avoid O(n²) lookups in the inner loop.
|
|
986
|
+
// A postfix "has children" if there are other postfixes that extend it.
|
|
987
|
+
const postfixesWithChildren = new Set();
|
|
988
|
+
const postfixKeys = Object.keys(esp.equivalentPostfixes);
|
|
989
|
+
// Pre-parse ALL postfix paths once. These parsed parts are reused in:
|
|
990
|
+
// 1. The children detection loop below
|
|
991
|
+
// 2. The inner postfix application loop (lines that split postfixPath and equivalentRoot.postfix)
|
|
992
|
+
// This eliminates thousands of redundant splitOutsideParenthesesAndArrays calls.
|
|
993
|
+
const postfixPartsCache = new Map();
|
|
994
|
+
for (const postfixPath of postfixKeys) {
|
|
995
|
+
if (!postfixPath)
|
|
996
|
+
continue;
|
|
997
|
+
postfixPartsCache.set(postfixPath, splitOutsideParenthesesAndArrays(postfixPath));
|
|
491
998
|
}
|
|
492
|
-
|
|
493
|
-
|
|
999
|
+
// Check for empty postfix having children (any other postfixes exist)
|
|
1000
|
+
if (postfixKeys.length > 1 && '' in esp.equivalentPostfixes) {
|
|
1001
|
+
postfixesWithChildren.add('');
|
|
494
1002
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
506
|
-
const postFixPathParts = splitOutsideParenthesesAndArrays(postfixPath);
|
|
507
|
-
const equivalentRootPostFixParts = splitOutsideParenthesesAndArrays(equivalentRoot.postfix);
|
|
508
|
-
relevantPostfix = joinParenthesesAndArrays(postFixPathParts.slice(equivalentRootPostFixParts.length));
|
|
1003
|
+
// Check for array element postfixes having children using a prefix set.
|
|
1004
|
+
// This avoids O(n²) scans across large postfix lists.
|
|
1005
|
+
// e.g., 'currentEntities[]' has children if a path like 'currentEntities[].sha' exists.
|
|
1006
|
+
const postfixPrefixSet = new Set();
|
|
1007
|
+
for (const postfixPath of postfixKeys) {
|
|
1008
|
+
if (!postfixPath)
|
|
1009
|
+
continue;
|
|
1010
|
+
const parts = postfixPartsCache.get(postfixPath);
|
|
1011
|
+
for (let i = 1; i < parts.length; i++) {
|
|
1012
|
+
postfixPrefixSet.add(joinParenthesesAndArrays(parts.slice(0, i)));
|
|
509
1013
|
}
|
|
510
|
-
const newSchemaPath = joinParenthesesAndArrays([
|
|
511
|
-
equivalentRoot.schemaRootPath,
|
|
512
|
-
relevantPostfix,
|
|
513
|
-
]);
|
|
514
|
-
schema[newSchemaPath] = postfixValue;
|
|
515
1014
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
// Propagate equivalency-derived attributes to generic function call variants.
|
|
520
|
-
// When attributes are traced via equivalencies (e.g., fileComparisons from buildDataMap.signature[2]),
|
|
521
|
-
// they get written to non-generic paths (returnValue.data.x or funcName().functionCallReturnValue.data.x).
|
|
522
|
-
// If the ORIGINAL input schema has generic variants (funcName<T>().functionCallReturnValue.data),
|
|
523
|
-
// we need to copy the attributes to those paths too.
|
|
524
|
-
for (const filePath in mergedDataStructure.dependencySchemas) {
|
|
525
|
-
for (const depName in mergedDataStructure.dependencySchemas[filePath]) {
|
|
526
|
-
const depSchema = mergedDataStructure.dependencySchemas[filePath][depName];
|
|
527
|
-
const returnValueSchema = depSchema.returnValueSchema;
|
|
528
|
-
// Look at the ORIGINAL input dependencySchemas for generic variants,
|
|
529
|
-
// since the merged schema may have lost them during equivalency processing
|
|
530
|
-
const originalSchema = dependencySchemas?.[filePath]?.[depName];
|
|
531
|
-
const schemaToSearchForGenericVariants = originalSchema?.returnValueSchema || returnValueSchema;
|
|
532
|
-
// Find all unique generic variants of this function
|
|
533
|
-
// e.g., useFetcher<BranchEntityDiffResult>() from useFetcher<BranchEntityDiffResult>().functionCallReturnValue.data
|
|
534
|
-
const genericVariants = new Set();
|
|
535
|
-
const genericRegex = new RegExp(`^${depName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}<[^>]+>\\(\\)`);
|
|
536
|
-
for (const path in schemaToSearchForGenericVariants) {
|
|
537
|
-
const match = path.match(genericRegex);
|
|
538
|
-
if (match) {
|
|
539
|
-
genericVariants.add(match[0]);
|
|
1015
|
+
for (const postfixPath of postfixKeys) {
|
|
1016
|
+
if (postfixPath.endsWith('[]') && postfixPrefixSet.has(postfixPath)) {
|
|
1017
|
+
postfixesWithChildren.add(postfixPath);
|
|
540
1018
|
}
|
|
541
1019
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
1020
|
+
// Deduplicate equivalentRoots that would write to the same schema paths.
|
|
1021
|
+
// Roots with the same (function, schemaRootPath, postfix) are redundant.
|
|
1022
|
+
const seenRootKeys = new Set();
|
|
1023
|
+
const uniqueRoots = esp.equivalentRoots.filter((root) => {
|
|
1024
|
+
const key = `${root.function?.filePath ?? ''}::${root.function?.name ?? ''}::${root.schemaRootPath}::${root.postfix ?? ''}`;
|
|
1025
|
+
if (seenRootKeys.has(key))
|
|
1026
|
+
return false;
|
|
1027
|
+
seenRootKeys.add(key);
|
|
1028
|
+
return true;
|
|
1029
|
+
});
|
|
1030
|
+
for (const equivalentRoot of uniqueRoots) {
|
|
1031
|
+
checkDeadline();
|
|
1032
|
+
let merged;
|
|
1033
|
+
if (equivalentRoot.function) {
|
|
1034
|
+
merged = findOrCreateDependentSchemas(equivalentRoot.function);
|
|
1035
|
+
}
|
|
1036
|
+
else {
|
|
1037
|
+
merged = mergedDataStructure;
|
|
1038
|
+
}
|
|
1039
|
+
if (!merged)
|
|
1040
|
+
continue;
|
|
1041
|
+
const schema = equivalentRoot.schemaRootPath.startsWith('signature[')
|
|
1042
|
+
? merged.signatureSchema
|
|
1043
|
+
: merged.returnValueSchema;
|
|
1044
|
+
// Skip if this schema has already grown past the cap
|
|
1045
|
+
if (Object.keys(schema).length > SCHEMA_KEY_CAP)
|
|
1046
|
+
continue;
|
|
1047
|
+
for (const [postfixPath, postfixValue] of Object.entries(esp.equivalentPostfixes)) {
|
|
1048
|
+
checkDeadline();
|
|
1049
|
+
let relevantPostfix = postfixPath;
|
|
1050
|
+
if (equivalentRoot.postfix) {
|
|
1051
|
+
// Check if postfixPath starts with equivalentRoot.postfix at a path boundary.
|
|
1052
|
+
// Must ensure exact path part match - "entityCode" should NOT match "entity" prefix.
|
|
1053
|
+
// Valid: "entity.foo" starts with "entity" (boundary at '.')
|
|
1054
|
+
// Valid: "entity[0]" starts with "entity" (boundary at '[')
|
|
1055
|
+
// Invalid: "entityCode" starts with "entity" (no boundary, different property)
|
|
1056
|
+
if (!postfixPath.startsWith(equivalentRoot.postfix)) {
|
|
1057
|
+
continue;
|
|
1058
|
+
}
|
|
1059
|
+
// Additional check: ensure the match is at a path boundary
|
|
1060
|
+
const nextChar = postfixPath[equivalentRoot.postfix.length];
|
|
1061
|
+
if (nextChar !== undefined &&
|
|
1062
|
+
nextChar !== '.' &&
|
|
1063
|
+
nextChar !== '[') {
|
|
1064
|
+
// The postfixPath continues with more characters that aren't a path separator.
|
|
1065
|
+
// This means "entity" matched "entityCode" which is wrong - they're different properties.
|
|
1066
|
+
continue;
|
|
556
1067
|
}
|
|
1068
|
+
const postFixPathParts = postfixPartsCache.get(postfixPath) ??
|
|
1069
|
+
splitOutsideParenthesesAndArrays(postfixPath);
|
|
1070
|
+
// Cache equivalentRoot.postfix parts — same root reused across all postfixes
|
|
1071
|
+
if (!postfixPartsCache.has(equivalentRoot.postfix)) {
|
|
1072
|
+
postfixPartsCache.set(equivalentRoot.postfix, splitOutsideParenthesesAndArrays(equivalentRoot.postfix));
|
|
1073
|
+
}
|
|
1074
|
+
const equivalentRootPostFixParts = postfixPartsCache.get(equivalentRoot.postfix);
|
|
1075
|
+
relevantPostfix = joinParenthesesAndArrays(postFixPathParts.slice(equivalentRootPostFixParts.length));
|
|
557
1076
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
1077
|
+
const newSchemaPath = joinParenthesesAndArrays([
|
|
1078
|
+
equivalentRoot.schemaRootPath,
|
|
1079
|
+
relevantPostfix,
|
|
1080
|
+
]);
|
|
1081
|
+
// Skip paths that would go through a primitive type
|
|
1082
|
+
// e.g., if schema has 'entities[].scenarioCount': 'number', skip 'entities[].scenarioCount.sha'
|
|
1083
|
+
if (wouldGoThroughPrimitive(newSchemaPath, schema)) {
|
|
1084
|
+
transformationTracer.operation(rootScopeName, {
|
|
1085
|
+
operation: 'skipPrimitivePath',
|
|
1086
|
+
stage: 'merged',
|
|
1087
|
+
path: newSchemaPath,
|
|
1088
|
+
context: {
|
|
1089
|
+
reason: 'would go through primitive type',
|
|
1090
|
+
postfixValue,
|
|
1091
|
+
},
|
|
1092
|
+
});
|
|
1093
|
+
continue;
|
|
1094
|
+
}
|
|
1095
|
+
// Skip setting primitive type when there are child postfixes that indicate structure.
|
|
1096
|
+
// This prevents downgrading an object/array element to a primitive type.
|
|
1097
|
+
// Uses pre-computed postfixesWithChildren Set for O(1) lookup instead of O(n) iteration.
|
|
1098
|
+
const hasChildPostfixes = (relevantPostfix === '' || relevantPostfix.endsWith('[]')) &&
|
|
1099
|
+
postfixesWithChildren.has(postfixPath);
|
|
1100
|
+
if (PRIMITIVE_TYPES.has(postfixValue) && hasChildPostfixes) {
|
|
1101
|
+
continue;
|
|
1102
|
+
}
|
|
1103
|
+
// Don't overwrite a more specific type with a less specific one
|
|
1104
|
+
// This can happen when nested roots share entries with their parent roots
|
|
1105
|
+
const existingType = schema[newSchemaPath];
|
|
1106
|
+
if (existingType) {
|
|
1107
|
+
// Don't overwrite a primitive type with 'object' or 'array'
|
|
1108
|
+
// e.g., if schema has 'entities[].scenarioCount': 'number', don't overwrite with 'object'
|
|
1109
|
+
if (PRIMITIVE_TYPES.has(existingType) &&
|
|
1110
|
+
(postfixValue === 'object' || postfixValue === 'array')) {
|
|
1111
|
+
transformationTracer.operation(rootScopeName, {
|
|
1112
|
+
operation: 'skipTypeDowngrade',
|
|
1113
|
+
stage: 'merged',
|
|
1114
|
+
path: newSchemaPath,
|
|
1115
|
+
context: {
|
|
1116
|
+
reason: 'would overwrite primitive with object/array',
|
|
1117
|
+
existingType,
|
|
1118
|
+
newType: postfixValue,
|
|
1119
|
+
},
|
|
1120
|
+
});
|
|
1121
|
+
continue;
|
|
1122
|
+
}
|
|
1123
|
+
// Don't overwrite a complex/union type with a primitive
|
|
1124
|
+
// e.g., if schema has 'scenarios[]': 'Scenario | null', don't overwrite with 'string'
|
|
1125
|
+
if (!PRIMITIVE_TYPES.has(existingType) &&
|
|
1126
|
+
PRIMITIVE_TYPES.has(postfixValue)) {
|
|
1127
|
+
transformationTracer.operation(rootScopeName, {
|
|
1128
|
+
operation: 'skipTypeDowngrade',
|
|
1129
|
+
stage: 'merged',
|
|
1130
|
+
path: newSchemaPath,
|
|
1131
|
+
context: {
|
|
1132
|
+
reason: 'would overwrite complex type with primitive',
|
|
1133
|
+
existingType,
|
|
1134
|
+
newType: postfixValue,
|
|
1135
|
+
},
|
|
1136
|
+
});
|
|
1137
|
+
continue;
|
|
566
1138
|
}
|
|
567
1139
|
}
|
|
1140
|
+
// Log the successful postfix merge
|
|
1141
|
+
transformationTracer.operation(rootScopeName, {
|
|
1142
|
+
operation: 'mergePostfix',
|
|
1143
|
+
stage: 'merged',
|
|
1144
|
+
path: newSchemaPath,
|
|
1145
|
+
before: existingType,
|
|
1146
|
+
after: postfixValue,
|
|
1147
|
+
context: {
|
|
1148
|
+
schemaRootPath: equivalentRoot.schemaRootPath,
|
|
1149
|
+
postfix: relevantPostfix,
|
|
1150
|
+
dependency: equivalentRoot.function?.name,
|
|
1151
|
+
},
|
|
1152
|
+
});
|
|
1153
|
+
schema[newSchemaPath] = postfixValue;
|
|
568
1154
|
}
|
|
569
|
-
|
|
570
|
-
// Add the new generic variant paths
|
|
571
|
-
for (const [path, value] of pathsToAdd) {
|
|
572
|
-
returnValueSchema[path] = value;
|
|
1155
|
+
schemasToClean.add(schema);
|
|
573
1156
|
}
|
|
574
1157
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
for (const dependency of importedExports) {
|
|
580
|
-
if (!dependency.isMocked)
|
|
581
|
-
continue;
|
|
582
|
-
const srcSchema = dependencySchemas?.[dependency.filePath]?.[dependency.name];
|
|
583
|
-
if (!srcSchema?.returnValueSchema)
|
|
584
|
-
continue;
|
|
585
|
-
const depSchema = findOrCreateDependentSchemas({
|
|
586
|
-
filePath: dependency.filePath,
|
|
587
|
-
name: dependency.name,
|
|
588
|
-
});
|
|
589
|
-
// First, normalize any returnValue paths that were written by equivalency processing
|
|
590
|
-
// to the standard functionName().functionCallReturnValue format.
|
|
591
|
-
// This includes both returnValue. (dot) and returnValue[ (array) paths.
|
|
592
|
-
const pathsToNormalize = [];
|
|
593
|
-
for (const path in depSchema.returnValueSchema) {
|
|
594
|
-
if (path === 'returnValue' ||
|
|
595
|
-
path.startsWith('returnValue.') ||
|
|
596
|
-
path.startsWith('returnValue[')) {
|
|
597
|
-
pathsToNormalize.push([path, depSchema.returnValueSchema[path]]);
|
|
598
|
-
}
|
|
1158
|
+
const postfixElapsed = Date.now() - mergeStartTime;
|
|
1159
|
+
// Batch-clean all modified schemas once (instead of once per root per ESP entry)
|
|
1160
|
+
for (const schema of schemasToClean) {
|
|
1161
|
+
cleanSchema(schema, { stage: 'afterMergePostfix' });
|
|
599
1162
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
//
|
|
611
|
-
//
|
|
612
|
-
|
|
613
|
-
|
|
1163
|
+
const cleanElapsed = Date.now() - mergeStartTime;
|
|
1164
|
+
// Propagate equivalency-derived attributes to generic function call variants.
|
|
1165
|
+
// When attributes are traced via equivalencies (e.g., fileComparisons from buildDataMap.signature[2]),
|
|
1166
|
+
// they get written to non-generic paths (returnValue.data.x or funcName().functionCallReturnValue.data.x).
|
|
1167
|
+
// If the ORIGINAL input schema has generic variants (funcName<T>().functionCallReturnValue.data),
|
|
1168
|
+
// we need to copy the attributes to those paths too.
|
|
1169
|
+
for (const filePath in mergedDataStructure.dependencySchemas) {
|
|
1170
|
+
for (const depName in mergedDataStructure.dependencySchemas[filePath]) {
|
|
1171
|
+
const depSchema = mergedDataStructure.dependencySchemas[filePath][depName];
|
|
1172
|
+
const returnValueSchema = depSchema.returnValueSchema;
|
|
1173
|
+
// Look at the ORIGINAL input dependencySchemas for generic variants,
|
|
1174
|
+
// since the merged schema may have lost them during equivalency processing
|
|
1175
|
+
const originalSchema = dependencySchemas?.[filePath]?.[depName];
|
|
1176
|
+
const schemaToSearchForGenericVariants = originalSchema?.returnValueSchema || returnValueSchema;
|
|
1177
|
+
// Find all unique generic variants of this function
|
|
1178
|
+
// e.g., useFetcher<BranchEntityDiffResult>() from useFetcher<BranchEntityDiffResult>().functionCallReturnValue.data
|
|
1179
|
+
const genericVariants = new Set();
|
|
1180
|
+
const genericRegex = new RegExp(`^${depName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}<[^>]+>\\(\\)`);
|
|
1181
|
+
for (const path in schemaToSearchForGenericVariants) {
|
|
1182
|
+
checkDeadline();
|
|
1183
|
+
const match = path.match(genericRegex);
|
|
1184
|
+
if (match) {
|
|
1185
|
+
genericVariants.add(match[0]);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
if (genericVariants.size === 0)
|
|
1189
|
+
continue;
|
|
1190
|
+
// For each returnValue. path or non-generic function call path,
|
|
1191
|
+
// create corresponding paths for each generic variant
|
|
1192
|
+
const pathsToAdd = [];
|
|
1193
|
+
for (const path in returnValueSchema) {
|
|
1194
|
+
checkDeadline();
|
|
1195
|
+
const value = returnValueSchema[path];
|
|
1196
|
+
// Handle returnValue. paths
|
|
1197
|
+
if (path.startsWith('returnValue.')) {
|
|
1198
|
+
const suffix = path.slice('returnValue.'.length);
|
|
1199
|
+
for (const genericVariant of genericVariants) {
|
|
1200
|
+
const genericPath = `${genericVariant}.functionCallReturnValue.${suffix}`;
|
|
1201
|
+
if (!(genericPath in returnValueSchema)) {
|
|
1202
|
+
pathsToAdd.push([genericPath, value]);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
// Handle non-generic function call paths like depName().functionCallReturnValue.x
|
|
1207
|
+
else if (path.startsWith(`${depName}().functionCallReturnValue.`)) {
|
|
1208
|
+
const suffix = path.slice(`${depName}().functionCallReturnValue.`.length);
|
|
1209
|
+
for (const genericVariant of genericVariants) {
|
|
1210
|
+
const genericPath = `${genericVariant}.functionCallReturnValue.${suffix}`;
|
|
1211
|
+
if (!(genericPath in returnValueSchema)) {
|
|
1212
|
+
pathsToAdd.push([genericPath, value]);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
// Add the new generic variant paths
|
|
1218
|
+
for (const [path, value] of pathsToAdd) {
|
|
1219
|
+
returnValueSchema[path] = value;
|
|
1220
|
+
}
|
|
614
1221
|
}
|
|
615
|
-
depSchema.returnValueSchema[normalizedPath] = value;
|
|
616
1222
|
}
|
|
617
|
-
//
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
// This ensures consistency across the codebase and allows constructMockCode
|
|
623
|
-
// and gatherDataForMocks to work correctly.
|
|
624
|
-
if (path === 'returnValue' || path.startsWith('returnValue.')) {
|
|
625
|
-
// Convert 'returnValue' -> 'name().functionCallReturnValue'
|
|
626
|
-
// Convert 'returnValue.foo' -> 'name().functionCallReturnValue.foo'
|
|
627
|
-
const normalizedPath = path === 'returnValue'
|
|
628
|
-
? `${dependency.name}().functionCallReturnValue`
|
|
629
|
-
: path.replace(/^returnValue\./, `${dependency.name}().functionCallReturnValue.`);
|
|
630
|
-
// Always write srcSchema values - they take precedence over equivalency-derived values
|
|
631
|
-
depSchema.returnValueSchema[normalizedPath] = value;
|
|
1223
|
+
// For mocked dependencies: copy paths from dependencySchemas (usage info) and normalize
|
|
1224
|
+
// returnValue. paths that were created by equivalency processing.
|
|
1225
|
+
// This ensures all paths use the consistent functionName().functionCallReturnValue. format.
|
|
1226
|
+
for (const dependency of importedExports) {
|
|
1227
|
+
if (!dependency.isMocked)
|
|
632
1228
|
continue;
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
// These are needed for constructMockCode to build the proper mock data hierarchy
|
|
636
|
-
// Example: supabase.auth.getSession().functionCallReturnValue.data.session
|
|
637
|
-
if (path.includes('.functionCallReturnValue')) {
|
|
638
|
-
// Always write srcSchema values - they take precedence over equivalency-derived values
|
|
639
|
-
depSchema.returnValueSchema[path] = value;
|
|
1229
|
+
const srcSchema = dependencySchemas?.[dependency.filePath]?.[dependency.name];
|
|
1230
|
+
if (!srcSchema?.returnValueSchema)
|
|
640
1231
|
continue;
|
|
1232
|
+
const depSchema = findOrCreateDependentSchemas({
|
|
1233
|
+
filePath: dependency.filePath,
|
|
1234
|
+
name: dependency.name,
|
|
1235
|
+
});
|
|
1236
|
+
// First, normalize any returnValue paths that were written by equivalency processing
|
|
1237
|
+
// to the standard functionName().functionCallReturnValue format.
|
|
1238
|
+
// This includes both returnValue. (dot) and returnValue[ (array) paths.
|
|
1239
|
+
const pathsToNormalize = [];
|
|
1240
|
+
for (const path in depSchema.returnValueSchema) {
|
|
1241
|
+
checkDeadline();
|
|
1242
|
+
if (path === 'returnValue' ||
|
|
1243
|
+
path.startsWith('returnValue.') ||
|
|
1244
|
+
path.startsWith('returnValue[')) {
|
|
1245
|
+
pathsToNormalize.push([path, depSchema.returnValueSchema[path]]);
|
|
1246
|
+
}
|
|
641
1247
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
!path.startsWith('returnValue')) {
|
|
651
|
-
if (!(path in depSchema.returnValueSchema)) {
|
|
652
|
-
depSchema.returnValueSchema[path] = value;
|
|
1248
|
+
for (const [path, value] of pathsToNormalize) {
|
|
1249
|
+
delete depSchema.returnValueSchema[path];
|
|
1250
|
+
let normalizedPath;
|
|
1251
|
+
if (path === 'returnValue') {
|
|
1252
|
+
normalizedPath = `${dependency.name}().functionCallReturnValue`;
|
|
1253
|
+
}
|
|
1254
|
+
else if (path.startsWith('returnValue.')) {
|
|
1255
|
+
normalizedPath = path.replace(/^returnValue\./, `${dependency.name}().functionCallReturnValue.`);
|
|
653
1256
|
}
|
|
1257
|
+
else {
|
|
1258
|
+
// path.startsWith('returnValue[')
|
|
1259
|
+
// e.g., returnValue[] -> getOptions().functionCallReturnValue[]
|
|
1260
|
+
// e.g., returnValue[].label -> getOptions().functionCallReturnValue[].label
|
|
1261
|
+
normalizedPath = path.replace(/^returnValue/, `${dependency.name}().functionCallReturnValue`);
|
|
1262
|
+
}
|
|
1263
|
+
transformationTracer.operation(rootScopeName, {
|
|
1264
|
+
operation: 'normalizeReturnValuePath',
|
|
1265
|
+
stage: 'merged',
|
|
1266
|
+
path: normalizedPath,
|
|
1267
|
+
before: path,
|
|
1268
|
+
after: normalizedPath,
|
|
1269
|
+
context: { dependency: dependency.name, value },
|
|
1270
|
+
});
|
|
1271
|
+
depSchema.returnValueSchema[normalizedPath] = value;
|
|
654
1272
|
}
|
|
655
|
-
//
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
// Only keep object paths that are within functionCallReturnValue
|
|
672
|
-
if (isFunctionStyleDependency &&
|
|
673
|
-
!path.includes('.functionCallReturnValue')) {
|
|
1273
|
+
// Now copy paths from the source schema (dependencySchemas)
|
|
1274
|
+
for (const path in srcSchema.returnValueSchema) {
|
|
1275
|
+
checkDeadline();
|
|
1276
|
+
const value = srcSchema.returnValueSchema[path];
|
|
1277
|
+
// Normalize paths starting with 'returnValue' to use the standard format:
|
|
1278
|
+
// 'returnValue.foo' -> 'dependencyName().functionCallReturnValue.foo'
|
|
1279
|
+
// This ensures consistency across the codebase and allows constructMockCode
|
|
1280
|
+
// and gatherDataForMocks to work correctly.
|
|
1281
|
+
if (path === 'returnValue' || path.startsWith('returnValue.')) {
|
|
1282
|
+
// Convert 'returnValue' -> 'name().functionCallReturnValue'
|
|
1283
|
+
// Convert 'returnValue.foo' -> 'name().functionCallReturnValue.foo'
|
|
1284
|
+
const normalizedPath = path === 'returnValue'
|
|
1285
|
+
? `${dependency.name}().functionCallReturnValue`
|
|
1286
|
+
: path.replace(/^returnValue\./, `${dependency.name}().functionCallReturnValue.`);
|
|
1287
|
+
// Always write srcSchema values - they take precedence over equivalency-derived values
|
|
1288
|
+
depSchema.returnValueSchema[normalizedPath] = value;
|
|
674
1289
|
continue;
|
|
675
1290
|
}
|
|
676
|
-
|
|
1291
|
+
// Copy paths containing functionCallReturnValue (return value structures)
|
|
1292
|
+
// These are needed for constructMockCode to build the proper mock data hierarchy
|
|
1293
|
+
// Example: supabase.auth.getSession().functionCallReturnValue.data.session
|
|
1294
|
+
if (path.includes('.functionCallReturnValue')) {
|
|
1295
|
+
// Always write srcSchema values - they take precedence over equivalency-derived values
|
|
677
1296
|
depSchema.returnValueSchema[path] = value;
|
|
1297
|
+
continue;
|
|
678
1298
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
// - Be marked as mocked
|
|
692
|
-
// Without this, their schemas would be lost entirely.
|
|
693
|
-
for (const filePath in dependencySchemas) {
|
|
694
|
-
for (const name in dependencySchemas[filePath]) {
|
|
695
|
-
const srcSchema = dependencySchemas[filePath][name];
|
|
696
|
-
if (!srcSchema)
|
|
697
|
-
continue;
|
|
698
|
-
// Skip mocked dependencies - they were already processed above with path normalization
|
|
699
|
-
if (mockedDependencies.has(`${filePath}::${name}`)) {
|
|
700
|
-
continue;
|
|
701
|
-
}
|
|
702
|
-
// Check if this dependency was already processed by equivalencies
|
|
703
|
-
const existingSchema = mergedDataStructure.dependencySchemas[filePath]?.[name];
|
|
704
|
-
// Only add if no existing schema (equivalencies didn't process it)
|
|
705
|
-
if (!existingSchema) {
|
|
706
|
-
const depSchema = findOrCreateDependentSchemas({ filePath, name });
|
|
707
|
-
for (const path in srcSchema.returnValueSchema) {
|
|
708
|
-
depSchema.returnValueSchema[path] = srcSchema.returnValueSchema[path];
|
|
1299
|
+
// Copy function-typed paths that end with () (are function calls)
|
|
1300
|
+
// These include:
|
|
1301
|
+
// - Function stubs without functionCallReturnValue (like onAuthStateChange)
|
|
1302
|
+
// - Function markers with async-function type (like getSession(): async-function)
|
|
1303
|
+
// which are needed for constructMockCode to know to generate async functions
|
|
1304
|
+
// Skip paths starting with 'returnValue' - they were already handled above
|
|
1305
|
+
if (['function', 'async-function'].includes(value) &&
|
|
1306
|
+
path.endsWith(')') &&
|
|
1307
|
+
!path.startsWith('returnValue')) {
|
|
1308
|
+
if (!(path in depSchema.returnValueSchema)) {
|
|
1309
|
+
depSchema.returnValueSchema[path] = value;
|
|
1310
|
+
}
|
|
709
1311
|
}
|
|
710
|
-
for
|
|
711
|
-
|
|
1312
|
+
// Copy object-typed paths for chained API access patterns (like trpc.customer.getCustomersByOrg)
|
|
1313
|
+
// These intermediate paths are needed for constructMockCode to build the nested mock structure.
|
|
1314
|
+
// Example: for trpc.customer.getCustomersByOrg.useQuery().functionCallReturnValue.data,
|
|
1315
|
+
// we need 'trpc', 'trpc.customer', 'trpc.customer.getCustomersByOrg' all typed as 'object'.
|
|
1316
|
+
// Skip paths starting with 'returnValue' - they were already handled above
|
|
1317
|
+
//
|
|
1318
|
+
// EXCEPTION: For function-style dependencies like getSupabase(), skip intermediate object
|
|
1319
|
+
// paths like 'getSupabase().auth' that are just property access after a function call.
|
|
1320
|
+
// These aren't needed because constructMockCode can infer the structure from the actual
|
|
1321
|
+
// function call paths like 'getSupabase().auth.getUser()'. We only need object paths
|
|
1322
|
+
// for object-style dependencies like 'supabase.auth' where the dependency itself is an object.
|
|
1323
|
+
if (value === 'object' && !path.startsWith('returnValue')) {
|
|
1324
|
+
// Check if this is a function-style dependency (path starts with name() or name<T>())
|
|
1325
|
+
const isFunctionStyleDependency = path.startsWith(`${dependency.name}()`) ||
|
|
1326
|
+
path.match(new RegExp(`^${dependency.name}<[^>]+>\\(\\)`));
|
|
1327
|
+
// For function-style dependencies, skip intermediate object paths
|
|
1328
|
+
// Only keep object paths that are within functionCallReturnValue
|
|
1329
|
+
if (isFunctionStyleDependency &&
|
|
1330
|
+
!path.includes('.functionCallReturnValue')) {
|
|
1331
|
+
continue;
|
|
1332
|
+
}
|
|
1333
|
+
if (!(path in depSchema.returnValueSchema)) {
|
|
1334
|
+
depSchema.returnValueSchema[path] = value;
|
|
1335
|
+
}
|
|
712
1336
|
}
|
|
713
|
-
// Clean known object functions (like String.prototype.replace, Array.prototype.map)
|
|
714
|
-
// from the copied schema. Without this, method call paths on primitives like
|
|
715
|
-
// "projectSlug.replace(...)" would cause convertDotNotation to create nested
|
|
716
|
-
// object structures instead of preserving the primitive type.
|
|
717
|
-
cleanSchema(depSchema.returnValueSchema);
|
|
718
1337
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
//
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
1338
|
+
cleanSchema(depSchema.returnValueSchema, {
|
|
1339
|
+
stage: 'afterMockedDependencyMerge',
|
|
1340
|
+
dependency: dependency.name,
|
|
1341
|
+
});
|
|
1342
|
+
// Pull signature requirements from downstream functions into the mocked return value.
|
|
1343
|
+
// When a mocked function's return flows into another function's signature (via usageEquivalencies),
|
|
1344
|
+
// we need to include that function's signature requirements in the mock.
|
|
1345
|
+
//
|
|
1346
|
+
// Example: fromE5() returns a currency object that flows to calculateTotalPrice(price, quantity).
|
|
1347
|
+
// calculateTotalPrice's signatureSchema shows signature[0].multiply() is required.
|
|
1348
|
+
// We need to add multiply() to fromE5's mock return value.
|
|
1349
|
+
const usageEquivalencies = srcSchema.usageEquivalencies ?? {};
|
|
1350
|
+
for (const [returnPath, equivalencies] of Object.entries(usageEquivalencies)) {
|
|
1351
|
+
// Only process return value paths (functionCallReturnValue)
|
|
1352
|
+
if (!returnPath.includes('.functionCallReturnValue'))
|
|
1353
|
+
continue;
|
|
1354
|
+
for (const equiv of equivalencies) {
|
|
1355
|
+
// Check if this equivalency points to a signature path
|
|
1356
|
+
const signatureMatch = equiv.schemaPath.match(/\.signature\[(\d+)\]$/);
|
|
1357
|
+
if (!signatureMatch)
|
|
1358
|
+
continue;
|
|
1359
|
+
const targetFunctionName = cleanFunctionName(equiv.scopeNodeName);
|
|
1360
|
+
const signatureIndex = signatureMatch[1];
|
|
1361
|
+
// Look up the target function's analysis to get its signature requirements
|
|
1362
|
+
// First try dependentAnalyses, then dependencySchemas
|
|
1363
|
+
let targetSignatureSchema;
|
|
1364
|
+
// Check dependentAnalyses first (has the full merged analysis)
|
|
1365
|
+
for (const depFilePath in dependentAnalyses) {
|
|
1366
|
+
const analysis = dependentAnalyses[depFilePath]?.[targetFunctionName];
|
|
1367
|
+
if (analysis?.metadata?.mergedDataStructure?.signatureSchema) {
|
|
1368
|
+
targetSignatureSchema =
|
|
1369
|
+
analysis.metadata.mergedDataStructure.signatureSchema;
|
|
1370
|
+
break;
|
|
1371
|
+
}
|
|
734
1372
|
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
1373
|
+
// Fallback to dependencySchemas if not found
|
|
1374
|
+
if (!targetSignatureSchema) {
|
|
1375
|
+
for (const depFilePath in dependencySchemas) {
|
|
1376
|
+
const schema = dependencySchemas[depFilePath]?.[targetFunctionName];
|
|
1377
|
+
if (schema?.signatureSchema) {
|
|
1378
|
+
targetSignatureSchema = schema.signatureSchema;
|
|
1379
|
+
break;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
if (!targetSignatureSchema)
|
|
1384
|
+
continue;
|
|
1385
|
+
// Find all paths in the target's signatureSchema that extend from signature[N]
|
|
1386
|
+
// e.g., signature[0].multiply(quantity) -> .multiply(quantity)
|
|
1387
|
+
const signaturePrefix = `signature[${signatureIndex}]`;
|
|
1388
|
+
for (const [sigPath, sigType] of Object.entries(targetSignatureSchema)) {
|
|
1389
|
+
if (!sigPath.startsWith(signaturePrefix))
|
|
1390
|
+
continue;
|
|
1391
|
+
// Skip the base signature[N] path itself - we only want the method/property extensions
|
|
1392
|
+
if (sigPath === signaturePrefix)
|
|
1393
|
+
continue;
|
|
1394
|
+
// Extract the suffix after signature[N] (e.g., ".multiply(quantity)")
|
|
1395
|
+
const suffix = sigPath.slice(signaturePrefix.length);
|
|
1396
|
+
// Build the path for the mocked return value
|
|
1397
|
+
// e.g., fromE5(priceE5).functionCallReturnValue.multiply(quantity)
|
|
1398
|
+
const returnValuePath = returnPath + suffix;
|
|
1399
|
+
// Add to the mocked dependency's return value schema if not already present
|
|
1400
|
+
if (!(returnValuePath in depSchema.returnValueSchema)) {
|
|
1401
|
+
depSchema.returnValueSchema[returnValuePath] = sigType;
|
|
747
1402
|
}
|
|
748
1403
|
}
|
|
749
|
-
cleanSchema(variantSchema.returnValueSchema);
|
|
750
1404
|
}
|
|
751
1405
|
}
|
|
1406
|
+
cleanSchema(depSchema.returnValueSchema, {
|
|
1407
|
+
stage: 'afterSignatureRequirementsMerge',
|
|
1408
|
+
dependency: dependency.name,
|
|
1409
|
+
});
|
|
752
1410
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
1411
|
+
// Process the input dependencySchemas FIRST (before child dependentAnalyses).
|
|
1412
|
+
// This ensures the parent entity's direct usage of dependencies takes precedence.
|
|
1413
|
+
// When both parent and child use the same dependency (e.g., useLoaderData),
|
|
1414
|
+
// the parent's schema paths are preserved, and child's paths are merged in later.
|
|
1415
|
+
//
|
|
1416
|
+
// Some dependencies (like .d.ts type declaration files) may not have:
|
|
1417
|
+
// - Equivalencies with the root scope
|
|
1418
|
+
// - A dependent analysis (they're just type declarations)
|
|
1419
|
+
// - Be marked as mocked
|
|
1420
|
+
// Without this, their schemas would be lost entirely.
|
|
1421
|
+
for (const filePath in dependencySchemas) {
|
|
1422
|
+
for (const name in dependencySchemas[filePath]) {
|
|
1423
|
+
const srcSchema = dependencySchemas[filePath][name];
|
|
1424
|
+
if (!srcSchema)
|
|
1425
|
+
continue;
|
|
1426
|
+
// Skip mocked dependencies - they were already processed above with path normalization
|
|
1427
|
+
if (mockedDependencies.has(`${filePath}::${name}`)) {
|
|
1428
|
+
continue;
|
|
1429
|
+
}
|
|
1430
|
+
// Check if this dependency was already processed by equivalencies
|
|
1431
|
+
const existingSchema = mergedDataStructure.dependencySchemas[filePath]?.[name];
|
|
1432
|
+
// Only add if no existing schema (equivalencies didn't process it)
|
|
1433
|
+
if (!existingSchema) {
|
|
1434
|
+
const depSchema = findOrCreateDependentSchemas({ filePath, name });
|
|
1435
|
+
for (const path in srcSchema.returnValueSchema) {
|
|
1436
|
+
checkDeadline();
|
|
1437
|
+
depSchema.returnValueSchema[path] =
|
|
1438
|
+
srcSchema.returnValueSchema[path];
|
|
776
1439
|
}
|
|
1440
|
+
for (const path in srcSchema.signatureSchema) {
|
|
1441
|
+
checkDeadline();
|
|
1442
|
+
depSchema.signatureSchema[path] = srcSchema.signatureSchema[path];
|
|
1443
|
+
}
|
|
1444
|
+
// Clean known object functions (like String.prototype.replace, Array.prototype.map)
|
|
1445
|
+
// from the copied schema. Without this, method call paths on primitives like
|
|
1446
|
+
// "projectSlug.replace(...)" would cause convertDotNotation to create nested
|
|
1447
|
+
// object structures instead of preserving the primitive type.
|
|
1448
|
+
cleanSchema(depSchema.returnValueSchema, {
|
|
1449
|
+
stage: 'afterDependencySchemaCopy',
|
|
1450
|
+
filePath,
|
|
1451
|
+
dependency: name,
|
|
1452
|
+
});
|
|
777
1453
|
}
|
|
778
|
-
//
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
1454
|
+
// TYPE REFINEMENT: Check if dependentAnalyses has a more specific type for this dependency.
|
|
1455
|
+
// When a parent passes `entity.filePath` (string | undefined) to a child component
|
|
1456
|
+
// that requires `filePath: string`, we should use the child's more specific type.
|
|
1457
|
+
// This prevents mock data from having undefined values for required props.
|
|
1458
|
+
//
|
|
1459
|
+
// This runs REGARDLESS of whether equivalencies already processed the schema,
|
|
1460
|
+
// because equivalencies copy the parent's type (string | undefined), not the child's
|
|
1461
|
+
// required type (string).
|
|
1462
|
+
const depSchema = findOrCreateDependentSchemas({ filePath, name });
|
|
1463
|
+
const childAnalysis = dependentAnalyses[filePath]?.[name];
|
|
1464
|
+
const childSignatureSchema = childAnalysis?.metadata?.mergedDataStructure?.signatureSchema;
|
|
1465
|
+
if (childSignatureSchema) {
|
|
1466
|
+
for (const path in depSchema.signatureSchema) {
|
|
1467
|
+
checkDeadline();
|
|
1468
|
+
const parentType = depSchema.signatureSchema[path];
|
|
1469
|
+
const childType = childSignatureSchema[path];
|
|
1470
|
+
if (parentType && childType) {
|
|
1471
|
+
// Check if parent has optional type and child has required type
|
|
1472
|
+
const parentIsOptional = parentType.includes('| undefined') ||
|
|
1473
|
+
parentType.includes('| null');
|
|
1474
|
+
const childIsOptional = childType.includes('| undefined') ||
|
|
1475
|
+
childType.includes('| null');
|
|
1476
|
+
// If child requires a more specific type (not optional), use it
|
|
1477
|
+
if (parentIsOptional && !childIsOptional) {
|
|
1478
|
+
depSchema.signatureSchema[path] = childType;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
784
1481
|
}
|
|
785
1482
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
for
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
1483
|
+
// For functions with multiple different type parameters, also create separate entries
|
|
1484
|
+
// for each type-parameterized variant. This allows gatherDataForMocks to look up
|
|
1485
|
+
// the specific schema for each call signature.
|
|
1486
|
+
// This runs regardless of whether the base entry already existed, since we need
|
|
1487
|
+
// the separate variant entries for proper schema lookup.
|
|
1488
|
+
const baseName = cleanFunctionName(name);
|
|
1489
|
+
if (functionsWithMultipleTypeParams.has(baseName)) {
|
|
1490
|
+
// Find all unique type-parameterized call signatures in the schema
|
|
1491
|
+
const typeParamVariants = new Set();
|
|
1492
|
+
for (const path of Object.keys(srcSchema.returnValueSchema)) {
|
|
1493
|
+
const parts = splitOutsideParenthesesAndArrays(path);
|
|
1494
|
+
if (parts.length > 0 &&
|
|
1495
|
+
parts[0].includes('<') &&
|
|
1496
|
+
parts[0].endsWith(')')) {
|
|
1497
|
+
typeParamVariants.add(parts[0]);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
// Create a separate entry for each type-parameterized variant
|
|
1501
|
+
for (const variant of typeParamVariants) {
|
|
1502
|
+
const variantSchema = findOrCreateDependentSchemas({
|
|
1503
|
+
filePath,
|
|
1504
|
+
name: variant,
|
|
796
1505
|
});
|
|
797
|
-
//
|
|
798
|
-
for (const path in
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
1506
|
+
// Copy only paths that belong to this variant
|
|
1507
|
+
for (const path in srcSchema.returnValueSchema) {
|
|
1508
|
+
checkDeadline();
|
|
1509
|
+
if (path.startsWith(variant)) {
|
|
1510
|
+
variantSchema.returnValueSchema[path] =
|
|
1511
|
+
srcSchema.returnValueSchema[path];
|
|
802
1512
|
}
|
|
803
1513
|
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1514
|
+
cleanSchema(variantSchema.returnValueSchema, {
|
|
1515
|
+
stage: 'afterTypeVariantCopy',
|
|
1516
|
+
filePath,
|
|
1517
|
+
dependency: name,
|
|
1518
|
+
variant,
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
// Ensure ALL dependencies from dependentAnalyses are included in dependencySchemas,
|
|
1525
|
+
// even if they have no equivalencies with the root scope.
|
|
1526
|
+
// This preserves nested functionCallReturnValue paths that would otherwise be lost.
|
|
1527
|
+
// EXCEPT: Skip mocked dependencies - we don't want their internal implementation details.
|
|
1528
|
+
for (const filePath in dependentAnalyses) {
|
|
1529
|
+
for (const name in dependentAnalyses[filePath]) {
|
|
1530
|
+
checkDeadline();
|
|
1531
|
+
const dependentMergedDataStructure = dependentAnalyses[filePath][name].metadata?.mergedDataStructure;
|
|
1532
|
+
if (!dependentMergedDataStructure)
|
|
1533
|
+
continue;
|
|
1534
|
+
const isMocked = mockedDependencies.has(`${filePath}::${name}`);
|
|
1535
|
+
// For mocked dependencies: ONLY copy nested dependencySchemas (skip internal implementation)
|
|
1536
|
+
// For non-mocked dependencies: copy everything (signature, returnValue, and nested dependencySchemas)
|
|
1537
|
+
if (!isMocked) {
|
|
1538
|
+
// Create the dependency schema entry if it doesn't exist
|
|
1539
|
+
const depSchema = findOrCreateDependentSchemas({ filePath, name });
|
|
1540
|
+
// Copy over paths from the dependent's returnValueSchema.
|
|
1541
|
+
// Only add paths that don't already exist (don't overwrite values set by equivalencies).
|
|
1542
|
+
// Skip if either source or target exceeds the cap — copying 2,531 paths from
|
|
1543
|
+
// ArticleTable with translatePath on each takes ~1.5s for one entity.
|
|
1544
|
+
const srcRetSize = Object.keys(dependentMergedDataStructure.returnValueSchema || {}).length;
|
|
1545
|
+
if (srcRetSize > SCHEMA_KEY_CAP ||
|
|
1546
|
+
Object.keys(depSchema.returnValueSchema).length > SCHEMA_KEY_CAP)
|
|
1547
|
+
continue;
|
|
1548
|
+
for (const path in dependentMergedDataStructure.returnValueSchema) {
|
|
1549
|
+
// Fast path: only call translatePath when the path starts with the
|
|
1550
|
+
// dependency name (e.g., "ArticleTable().functionCallReturnValue.x").
|
|
1551
|
+
// Most paths start with "returnValue" or "signature" and don't need translation.
|
|
1552
|
+
const translatedPath = path.startsWith(name)
|
|
1553
|
+
? translatePath(path, name)
|
|
1554
|
+
: path;
|
|
1555
|
+
if (!(translatedPath in depSchema.returnValueSchema)) {
|
|
1556
|
+
depSchema.returnValueSchema[translatedPath] =
|
|
1557
|
+
dependentMergedDataStructure.returnValueSchema[path];
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
// Copy over signature schema as well
|
|
1561
|
+
for (const path in dependentMergedDataStructure.signatureSchema) {
|
|
1562
|
+
const translatedPath = path.startsWith(name)
|
|
1563
|
+
? translatePath(path, name)
|
|
1564
|
+
: path;
|
|
1565
|
+
if (!(translatedPath in depSchema.signatureSchema)) {
|
|
1566
|
+
depSchema.signatureSchema[translatedPath] =
|
|
1567
|
+
dependentMergedDataStructure.signatureSchema[path];
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
// Copy nested dependencySchemas for ALL entities (including mocked ones)
|
|
1572
|
+
// This represents what dependencies THIS entity uses, not its internal implementation
|
|
1573
|
+
if (dependentMergedDataStructure.dependencySchemas) {
|
|
1574
|
+
for (const depFilePath in dependentMergedDataStructure.dependencySchemas) {
|
|
1575
|
+
for (const depName in dependentMergedDataStructure
|
|
1576
|
+
.dependencySchemas[depFilePath]) {
|
|
1577
|
+
const nestedDepSchema = dependentMergedDataStructure.dependencySchemas[depFilePath][depName];
|
|
1578
|
+
const targetDepSchema = findOrCreateDependentSchemas({
|
|
1579
|
+
filePath: depFilePath,
|
|
1580
|
+
name: depName,
|
|
1581
|
+
});
|
|
1582
|
+
// Merge in the nested dependency schemas
|
|
1583
|
+
for (const path in nestedDepSchema.returnValueSchema) {
|
|
1584
|
+
checkDeadline();
|
|
1585
|
+
if (!(path in targetDepSchema.returnValueSchema)) {
|
|
1586
|
+
const value = nestedDepSchema.returnValueSchema[path];
|
|
1587
|
+
targetDepSchema.returnValueSchema[path] = value;
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
for (const path in nestedDepSchema.signatureSchema) {
|
|
1591
|
+
checkDeadline();
|
|
1592
|
+
if (!(path in targetDepSchema.signatureSchema)) {
|
|
1593
|
+
targetDepSchema.signatureSchema[path] =
|
|
1594
|
+
nestedDepSchema.signatureSchema[path];
|
|
1595
|
+
}
|
|
808
1596
|
}
|
|
809
1597
|
}
|
|
810
1598
|
}
|
|
811
1599
|
}
|
|
812
1600
|
}
|
|
813
1601
|
}
|
|
1602
|
+
const totalElapsed = Date.now() - mergeStartTime;
|
|
1603
|
+
const retKeys = Object.keys(mergedDataStructure.returnValueSchema).length;
|
|
1604
|
+
// Only log phase breakdown for slow merges (>2s)
|
|
1605
|
+
if (totalElapsed > 2000) {
|
|
1606
|
+
console.log(`CodeYam Log Level 2: ${rootScopeName} merge phases: gather=${gatherElapsed}ms mergeESP=${mergeEspElapsed - gatherElapsed}ms postfix=${postfixElapsed - mergeEspElapsed}ms clean=${cleanElapsed - postfixElapsed}ms depCopy=${totalElapsed - cleanElapsed}ms total=${totalElapsed}ms ret=${retKeys}`);
|
|
1607
|
+
}
|
|
1608
|
+
return mergedDataStructure;
|
|
1609
|
+
}
|
|
1610
|
+
catch (error) {
|
|
1611
|
+
if (error instanceof DataStructureTimeoutError) {
|
|
1612
|
+
// Return partial results instead of propagating the timeout.
|
|
1613
|
+
// By this point, mergedDataStructure has valid data from completed phases
|
|
1614
|
+
// (gather + mergeESP complete in <1s, postfix/clean/depCopy may be partial).
|
|
1615
|
+
const retKeys = Object.keys(mergedDataStructure.returnValueSchema).length;
|
|
1616
|
+
console.log(`CodeYam Log Level 1: ${rootScopeName} merge timed out — returning partial results (${retKeys} ret keys, ${Math.round((Date.now() - mergeStartTime) / 1000)}s)`);
|
|
1617
|
+
mergedDataStructure.timedOut = true;
|
|
1618
|
+
return mergedDataStructure;
|
|
1619
|
+
}
|
|
1620
|
+
throw error;
|
|
814
1621
|
}
|
|
815
|
-
return mergedDataStructure;
|
|
816
1622
|
}
|
|
817
1623
|
//# sourceMappingURL=mergeInDependentDataStructure.js.map
|