@codeyam/codeyam-cli 0.1.0-staging.e38f7bd → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +21 -17
- 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 +228 -24
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +205 -10
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +181 -23
- 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 +38 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +1619 -125
- package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +324 -5
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +216 -36
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +2543 -399
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +21 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +976 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +243 -77
- 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 +71 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +161 -19
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +163 -14
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- 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 +441 -82
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +174 -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 +74 -7
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +89 -112
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +63 -2
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1419 -101
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +216 -109
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +614 -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/getConditionalUsagesFromCode.ts +143 -31
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
- 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 +17 -7
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -102
- 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 -53
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
- 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 +127 -3
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +121 -2
- package/analyzer-template/packages/analyze/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +79 -59
- package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
- package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
- 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 +570 -180
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +54 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
- 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 +22 -13
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +313 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +711 -78
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +550 -137
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +264 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +78 -83
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +4 -8
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1067 -167
- 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/checkS3ObjectExists.d.ts +15 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
- 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 +3 -3
- package/analyzer-template/packages/aws/s3/index.ts +1 -0
- 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/checkS3ObjectExists.ts +47 -0
- package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
- package/analyzer-template/packages/database/package.json +1 -1
- 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 +18 -5
- package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
- package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +36 -9
- 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 +13 -0
- 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 +28 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
- package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +30 -5
- 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 +7 -14
- 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 +193 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
- package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
- package/analyzer-template/packages/generate/src/lib/directExecutionScript.ts +17 -2
- package/analyzer-template/packages/generate/src/lib/getComponentScenarioPath.ts +8 -3
- package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
- 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 -2
- 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 +13 -3
- 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/tableRelations.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -11
- 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 +30 -7
- 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 +9 -3
- 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/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 +2 -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 +8 -0
- 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 +22 -1
- 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 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.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 +23 -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 +5 -4
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.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 +189 -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 +8 -4
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js +10 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js +7 -3
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.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 +2 -2
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +87 -13
- 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 +7 -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 +11 -6
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
- 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/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js +26 -2
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.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 +1 -1
- 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 +5 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +104 -13
- 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 +7 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +11 -10
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +228 -3
- 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 +4 -4
- package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
- package/analyzer-template/packages/utils/dist/types/index.d.ts +2 -2
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +87 -13
- 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 +7 -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 +11 -6
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
- 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/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js +26 -2
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js.map +1 -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 +93 -2
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.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/applyUniversalMocks.ts +28 -2
- package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +108 -2
- package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
- package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
- package/analyzer-template/playwright/capture.ts +57 -26
- package/analyzer-template/playwright/captureStatic.ts +1 -1
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
- package/analyzer-template/playwright/takeScreenshot.ts +15 -9
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/TESTING.md +83 -0
- package/analyzer-template/project/analyzeBaselineCommit.ts +9 -0
- package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
- package/analyzer-template/project/analyzeFileEntities.ts +4 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +9 -0
- package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
- package/analyzer-template/project/constructMockCode.ts +1319 -158
- 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 +82 -42
- 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 +13 -9
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +93 -42
- package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
- package/analyzer-template/project/orchestrateCapture.ts +88 -12
- package/analyzer-template/project/reconcileMockDataKeys.ts +245 -2
- package/analyzer-template/project/runAnalysis.ts +11 -0
- package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
- package/analyzer-template/project/serverOnlyModules.ts +413 -0
- package/analyzer-template/project/start.ts +72 -19
- package/analyzer-template/project/startScenarioCapture.ts +79 -41
- package/analyzer-template/project/writeMockDataTsx.ts +466 -73
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +1433 -214
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +56 -22
- package/analyzer-template/project/writeUniversalMocks.ts +32 -11
- package/analyzer-template/scripts/comboWorkerLoop.cjs +99 -50
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/analyzer-template/tsconfig.json +2 -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 +2 -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 +1171 -120
- 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 +34 -9
- 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 +12 -6
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +73 -36
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +72 -13
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +204 -2
- 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 +11 -9
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +338 -0
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -0
- package/background/src/lib/virtualized/project/start.js +62 -19
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +61 -31
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +404 -62
- 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 +1056 -146
- 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 +57 -20
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/background/src/lib/virtualized/project/writeUniversalMocks.js +27 -12
- package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +180 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/cli.js +11 -1
- 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/analyze.js +5 -3
- 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 +44 -18
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +30 -34
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/detect-universal-mocks.js +2 -0
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +49 -257
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +264 -0
- package/codeyam-cli/src/commands/memory.js.map +1 -0
- package/codeyam-cli/src/commands/recapture.js +228 -0
- package/codeyam-cli/src/commands/recapture.js.map +1 -0
- package/codeyam-cli/src/commands/report.js +72 -24
- 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/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/utils/__tests__/npmVersionCheck.test.js +179 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.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 +128 -82
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +29 -15
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +7 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +104 -23
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/database.js +91 -5
- package/codeyam-cli/src/utils/database.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +253 -106
- package/codeyam-cli/src/utils/generateReport.js.map +1 -1
- package/codeyam-cli/src/utils/git.js +79 -0
- package/codeyam-cli/src/utils/git.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +76 -42
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
- package/codeyam-cli/src/utils/labsAutoCheck.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/progress.js +7 -0
- package/codeyam-cli/src/utils/progress.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +249 -16
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +103 -7
- 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/requireSimulations.js +10 -0
- package/codeyam-cli/src/utils/requireSimulations.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 +230 -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 +75 -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 +378 -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 +115 -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__/ruleState.test.js +293 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/index.js +6 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -0
- package/codeyam-cli/src/utils/rules/parser.js +83 -0
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.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/staleness.js +137 -0
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
- package/codeyam-cli/src/utils/serverState.js +37 -10
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +21 -42
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/versionInfo.js +25 -19
- package/codeyam-cli/src/utils/versionInfo.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__/dependency-smoke.test.js +66 -0
- package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/database.js +118 -6
- 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/backgroundServer.js +55 -10
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +60 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-jNYXRRNI.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-bwuHPyTa.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-kykTbcnD.js → EntityTypeBadge-CvzqMxcu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BH0XDim7.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-EhOseatT.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-yjIHlOGa.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-Cq5o8jL4.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-BvMu2i-g.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-kgBTLoJD.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-BzPgx-xO.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CwZrv-Ok.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BX2Ny2Qj.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-C06nsHKY.js → TruncatedFilePath-CDpEprKa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-BRx8ZGZo.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-4S4yPfFw.js +27 -0
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +17 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-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.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.save-fixture-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/book-open-D4IPYH_y.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-CG65viiV.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-DB3aFuEO.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-igfMr5DY.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/copy-Coc4o_8c.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-D1zB-pYc.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-JTAjQ54M.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CYqBrC9s.js → entity._sha._-B0h9AqE6.js} +22 -15
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CtYowLOt.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-PePWg17F.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-I-Wo99C_.js +29 -0
- package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-9sMMAiWJ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-Co65J0s3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-BdHOxVfg.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-CCgBKWy4.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-CUM5iXwc.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-_417gcQW.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-BK0C1H1T.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-TzRHMVog.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-390cb8fa.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-CzZySbBE.js +78 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-hjzB7t2z.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-DnbDhvTU.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/search-DcAwD_Ln.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-CclxrcPK.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DVNJVQgD.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/terminal-DbEAHMbA.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CAD5b1o_.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BqgrAzs3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-Blr5oZDE.js → useLastLogLine-DAFqfEDH.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DZlYx2c4.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-Bbf4Hokd.js → useToast-ihdMtlf6.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CxaRxKVt.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-D4DT0nM_.js +259 -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 +1 -3
- package/codeyam-cli/src/webserver/devServer.js.map +1 -1
- package/codeyam-cli/src/webserver/server.js +35 -25
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam-debug.md} +48 -4
- package/codeyam-cli/templates/codeyam-diagnose.md +481 -0
- package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
- package/codeyam-cli/templates/codeyam-memory.md +396 -0
- package/codeyam-cli/templates/codeyam-new-rule.md +13 -0
- package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam-setup.md} +151 -4
- package/codeyam-cli/templates/{codeyam-sim-skill.md → codeyam-sim.md} +1 -1
- package/codeyam-cli/templates/{codeyam-test-skill.md → codeyam-test.md} +1 -1
- package/codeyam-cli/templates/{codeyam-verify-skill.md → codeyam-verify.md} +1 -1
- package/codeyam-cli/templates/rule-notification-hook.py +56 -0
- package/codeyam-cli/templates/rule-reflection-hook.py +627 -0
- package/codeyam-cli/templates/rules-instructions.md +132 -0
- package/package.json +25 -22
- package/packages/ai/index.js +8 -6
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +181 -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 +154 -9
- 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 +138 -23
- package/packages/ai/src/lib/astScopes/methodSemantics.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 +23 -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 +1235 -104
- 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 +178 -31
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1961 -224
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +19 -4
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +661 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +180 -56
- 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 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +139 -13
- 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/convertDotNotation.js +142 -12
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
- 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 +371 -73
- 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/dataStructureChunking.js +126 -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 +62 -5
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +81 -90
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +50 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +1127 -91
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +193 -83
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +414 -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/getConditionalUsagesFromCode.js +84 -14
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
- 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 +16 -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 -64
- 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 -34
- 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 +16 -3
- 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 +98 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/index.js +1 -0
- 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 +96 -26
- 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/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 +428 -123
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +42 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +21 -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 +9 -10
- package/packages/analyze/src/lib/files/analyzeInitial.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 +17 -8
- package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +255 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
- 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 +550 -62
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.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 +404 -85
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +144 -0
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +56 -69
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +4 -8
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +875 -141
- 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/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 +13 -3
- 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 +9 -3
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- 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 +8 -0
- 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 +22 -1
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +23 -4
- package/packages/database/src/lib/loadEntities.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 +23 -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 +5 -4
- package/packages/database/src/lib/updateCommitMetadata.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 +189 -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 +8 -4
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/packages/generate/src/lib/deepMerge.js +27 -1
- package/packages/generate/src/lib/deepMerge.js.map +1 -1
- package/packages/generate/src/lib/directExecutionScript.js +10 -1
- package/packages/generate/src/lib/directExecutionScript.js.map +1 -1
- package/packages/generate/src/lib/getComponentScenarioPath.js +7 -3
- package/packages/generate/src/lib/getComponentScenarioPath.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.map +1 -1
- package/packages/utils/src/lib/applyUniversalMocks.js +26 -2
- package/packages/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +93 -2
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/packages/utils/src/lib/lightweightEntityExtractor.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/finalize-analyzer.cjs +8 -74
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -197
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -271
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -294
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
- package/analyzer-template/packages/ai/src/lib/transformMockDataToMatchSchema.ts +0 -156
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -115
- 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/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-D4htqD-x.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-Catz6XEN.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-TlHocYno.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CVMmGuIc.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-JkfQ-VaI.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-CVZ0H4BL.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BrMAP1nP.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CJhE4cCv.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-faVIcr_i.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLMa2sgx.js +0 -7
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-DwYjrK_h.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CgXbbZRx.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-B2oHQ-zo.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-BBYuR56H.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CT0Q5lVu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-Bj5GHkhb.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-eW5z9AyZ.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-B9tSboXM.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-CmO-EZAB.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-DLinnTOx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-CIxwBQvb.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-xPz593l2.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/index-_LjBsTxX.js +0 -8
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-D_EGChhq.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-ca438c41.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-CHHYHuzL.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-DY8yoDpH.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-BT6wVHd5.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-gv3H7JV7.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-BthANBVv.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CANr3QJ5.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-BtBPtyHx.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-N2cTnejq.js +0 -166
- package/codeyam-cli/templates/debug-command.md +0 -141
- 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 -136
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -220
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -241
- 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/ai/src/lib/transformMockDataToMatchSchema.js +0 -124
- package/packages/ai/src/lib/transformMockDataToMatchSchema.js.map +0 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -72
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
- /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/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +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,9 +1,322 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
+
import * as crypto from 'crypto';
|
|
2
3
|
import { StructuredPath } from "./paths.js";
|
|
3
4
|
import { nodeToSource } from "./nodeToSource.js";
|
|
4
5
|
import { methodRegistry, ArrayPushSemantics } from "./methodSemantics.js";
|
|
5
|
-
import { isArithmeticOperator, isAssignmentOperator, isBitwiseCompoundOperator, isComparisonOperator, isDefinedType, isNumericCompoundOperator, leftOrRightType, unwrapExpression, } from "./sharedPatterns.js";
|
|
6
|
+
import { getComparisonOperatorString, isArithmeticOperator, isAssignmentOperator, isBitwiseCompoundOperator, isComparisonOperator, isDefinedType, isNumericCompoundOperator, leftOrRightType, unwrapExpression, } from "./sharedPatterns.js";
|
|
6
7
|
import { processBindingPattern } from "./processBindings.js";
|
|
8
|
+
import { extractConditionalEffectsFromTernary, findUseStateSetters, } from "./conditionalEffectsExtractor.js";
|
|
9
|
+
import { detectArrayDerivedPattern } from "./arrayDerivationDetector.js";
|
|
10
|
+
/**
|
|
11
|
+
* Recursively extracts root variable names from an expression AST node.
|
|
12
|
+
* Used to identify which variables flow into JSX expression children,
|
|
13
|
+
* so we can link them to the return value schema.
|
|
14
|
+
*
|
|
15
|
+
* Examples:
|
|
16
|
+
* - `filteredTopPaths.map(...)` → ['filteredTopPaths']
|
|
17
|
+
* - `a && b` → ['a', 'b']
|
|
18
|
+
* - `condition ? x : y` → ['condition', 'x', 'y']
|
|
19
|
+
*/
|
|
20
|
+
function extractRootVariableNames(node) {
|
|
21
|
+
const ignoredIdentifiers = new Set([
|
|
22
|
+
'undefined',
|
|
23
|
+
'null',
|
|
24
|
+
'true',
|
|
25
|
+
'false',
|
|
26
|
+
'NaN',
|
|
27
|
+
'Infinity',
|
|
28
|
+
]);
|
|
29
|
+
if (ts.isIdentifier(node)) {
|
|
30
|
+
const name = node.text;
|
|
31
|
+
return ignoredIdentifiers.has(name) ? [] : [name];
|
|
32
|
+
}
|
|
33
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
34
|
+
return extractRootVariableNames(node.expression);
|
|
35
|
+
}
|
|
36
|
+
if (ts.isCallExpression(node)) {
|
|
37
|
+
return extractRootVariableNames(node.expression);
|
|
38
|
+
}
|
|
39
|
+
if (ts.isBinaryExpression(node)) {
|
|
40
|
+
return [
|
|
41
|
+
...extractRootVariableNames(node.left),
|
|
42
|
+
...extractRootVariableNames(node.right),
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
if (ts.isPrefixUnaryExpression(node)) {
|
|
46
|
+
return extractRootVariableNames(node.operand);
|
|
47
|
+
}
|
|
48
|
+
if (ts.isConditionalExpression(node)) {
|
|
49
|
+
return [
|
|
50
|
+
...extractRootVariableNames(node.condition),
|
|
51
|
+
...extractRootVariableNames(node.whenTrue),
|
|
52
|
+
...extractRootVariableNames(node.whenFalse),
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
if (ts.isParenthesizedExpression(node)) {
|
|
56
|
+
return extractRootVariableNames(node.expression);
|
|
57
|
+
}
|
|
58
|
+
// Stop recursion at JSX elements and other terminal nodes
|
|
59
|
+
if (ts.isJsxElement(node) ||
|
|
60
|
+
ts.isJsxFragment(node) ||
|
|
61
|
+
ts.isJsxSelfClosingElement(node)) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks if a JSX element has props that reference variables from the parent scope.
|
|
68
|
+
* This is used to detect unconditionally-rendered children that should have their
|
|
69
|
+
* execution flows merged into the parent.
|
|
70
|
+
*
|
|
71
|
+
* We want to track children where the parent controls data that affects the child's
|
|
72
|
+
* conditional rendering. Static props (like title="Dashboard") don't need tracking
|
|
73
|
+
* because they don't create variable execution flows.
|
|
74
|
+
*
|
|
75
|
+
* Examples:
|
|
76
|
+
* - <WorkoutsView workouts={workouts} /> → true (workouts is a variable)
|
|
77
|
+
* - <ItemList items={items} count={count} /> → true (items, count are variables)
|
|
78
|
+
* - <Header title="Dashboard" /> → false (static string)
|
|
79
|
+
* - <Footer /> → false (no props)
|
|
80
|
+
* - <Button onClick={handleClick} /> → false (only callback, no data props)
|
|
81
|
+
*
|
|
82
|
+
* @returns true if the component has at least one prop that references a variable
|
|
83
|
+
* (excluding callbacks which typically start with 'on' or 'handle')
|
|
84
|
+
*/
|
|
85
|
+
function hasDataPropsFromParent(node, componentName) {
|
|
86
|
+
const attributes = ts.isJsxElement(node)
|
|
87
|
+
? node.openingElement.attributes.properties
|
|
88
|
+
: node.attributes.properties;
|
|
89
|
+
const dataProps = [];
|
|
90
|
+
for (const attr of attributes) {
|
|
91
|
+
// Spread attributes always reference parent data: {...props}
|
|
92
|
+
if (ts.isJsxSpreadAttribute(attr)) {
|
|
93
|
+
const spreadText = attr.expression?.getText() || '...spread';
|
|
94
|
+
dataProps.push(`{...${spreadText}}`);
|
|
95
|
+
console.log(`[UnconditionalChild] ${componentName}: Found spread attribute {${spreadText}}`);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (ts.isJsxAttribute(attr)) {
|
|
99
|
+
const propName = attr.name.getText();
|
|
100
|
+
// Skip callback props - they don't create data-driven execution flows
|
|
101
|
+
// Callbacks typically start with 'on' (onClick, onChange) or 'handle' (handleSubmit)
|
|
102
|
+
if (propName.startsWith('on') ||
|
|
103
|
+
propName.startsWith('handle') ||
|
|
104
|
+
propName === 'ref') {
|
|
105
|
+
console.log(`[UnconditionalChild] ${componentName}: Skipping callback prop '${propName}'`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
// Check if the prop value is a JSX expression (references a variable)
|
|
109
|
+
// vs a string literal which is static
|
|
110
|
+
if (attr.initializer) {
|
|
111
|
+
if (ts.isJsxExpression(attr.initializer)) {
|
|
112
|
+
// JSX expression like prop={value} - this references a variable
|
|
113
|
+
// Could be a simple identifier, property access, or more complex expression
|
|
114
|
+
const expression = attr.initializer.expression;
|
|
115
|
+
if (expression) {
|
|
116
|
+
// Skip if it's just a function/arrow function (callback)
|
|
117
|
+
if (ts.isArrowFunction(expression) ||
|
|
118
|
+
ts.isFunctionExpression(expression)) {
|
|
119
|
+
console.log(`[UnconditionalChild] ${componentName}: Skipping inline callback prop '${propName}'`);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
// This is a data prop that references parent state/props
|
|
123
|
+
const exprText = expression.getText();
|
|
124
|
+
dataProps.push(`${propName}={${exprText}}`);
|
|
125
|
+
console.log(`[UnconditionalChild] ${componentName}: Found data prop '${propName}' = {${exprText}}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
// String literals like prop="value" are static
|
|
130
|
+
console.log(`[UnconditionalChild] ${componentName}: Skipping static prop '${propName}'`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const hasDataProps = dataProps.length > 0;
|
|
136
|
+
if (hasDataProps) {
|
|
137
|
+
console.log(`[UnconditionalChild] ${componentName}: Has ${dataProps.length} data props: [${dataProps.join(', ')}]`);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
console.log(`[UnconditionalChild] ${componentName}: No data props found, will NOT track`);
|
|
141
|
+
}
|
|
142
|
+
return { hasDataProps, dataProps };
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Extracts the component name from a JSX element.
|
|
146
|
+
* Returns null for intrinsic elements (div, span, etc.) since we only care about
|
|
147
|
+
* custom components for gating condition tracking.
|
|
148
|
+
*
|
|
149
|
+
* Examples:
|
|
150
|
+
* - <ChildViewer /> → "ChildViewer"
|
|
151
|
+
* - <ScenarioViewer scenario={...} /> → "ScenarioViewer"
|
|
152
|
+
* - <div> → null (intrinsic element)
|
|
153
|
+
*/
|
|
154
|
+
function getComponentNameFromJsx(node) {
|
|
155
|
+
let tagName;
|
|
156
|
+
if (ts.isJsxElement(node)) {
|
|
157
|
+
tagName = node.openingElement.tagName;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
tagName = node.tagName;
|
|
161
|
+
}
|
|
162
|
+
// Get the text of the tag name
|
|
163
|
+
const name = tagName.getText();
|
|
164
|
+
// Check if it's a custom component (starts with uppercase) vs intrinsic element
|
|
165
|
+
// Custom components start with uppercase: <MyComponent />
|
|
166
|
+
// Intrinsic elements start with lowercase: <div />
|
|
167
|
+
if (name &&
|
|
168
|
+
name[0] === name[0].toUpperCase() &&
|
|
169
|
+
name[0] !== name[0].toLowerCase()) {
|
|
170
|
+
return name;
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Extracts condition paths from a logical AND chain expression.
|
|
176
|
+
* Used for creating gating conditions for child components.
|
|
177
|
+
*
|
|
178
|
+
* Example: `hasData && isReady && <Component />` returns ['hasData', 'isReady']
|
|
179
|
+
*/
|
|
180
|
+
function extractConditionPathsFromAndChain(expr, sourceFile) {
|
|
181
|
+
const paths = [];
|
|
182
|
+
const unwrapped = unwrapExpression(expr);
|
|
183
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
184
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
185
|
+
// Recursively get conditions from left side
|
|
186
|
+
paths.push(...extractConditionPathsFromAndChain(unwrapped.left, sourceFile));
|
|
187
|
+
// Process right side if it's not JSX (JSX is the consequence, not a condition)
|
|
188
|
+
const rightUnwrapped = unwrapExpression(unwrapped.right);
|
|
189
|
+
if (!ts.isJsxElement(rightUnwrapped) &&
|
|
190
|
+
!ts.isJsxSelfClosingElement(rightUnwrapped) &&
|
|
191
|
+
!ts.isJsxFragment(rightUnwrapped)) {
|
|
192
|
+
paths.push(...extractConditionPathsFromAndChain(unwrapped.right, sourceFile));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
// Base case: extract path from this expression
|
|
197
|
+
const path = StructuredPath.fromNode(unwrapped, sourceFile);
|
|
198
|
+
if (path) {
|
|
199
|
+
paths.push(path.toString());
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return paths;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Finds the rightmost JSX element in an && chain.
|
|
206
|
+
* Example: `a && b && <Component />` returns <Component />
|
|
207
|
+
*/
|
|
208
|
+
function findJsxInAndChain(expr) {
|
|
209
|
+
const unwrapped = unwrapExpression(expr);
|
|
210
|
+
if (ts.isJsxElement(unwrapped) || ts.isJsxSelfClosingElement(unwrapped)) {
|
|
211
|
+
return unwrapped;
|
|
212
|
+
}
|
|
213
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
214
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
215
|
+
// Check right side first (most common case: condition && <Jsx />)
|
|
216
|
+
const rightResult = findJsxInAndChain(unwrapped.right);
|
|
217
|
+
if (rightResult)
|
|
218
|
+
return rightResult;
|
|
219
|
+
// Also check left side for rare cases
|
|
220
|
+
return findJsxInAndChain(unwrapped.left);
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Fix 32: Finds a JSX fragment in an && chain.
|
|
226
|
+
* Example: `activeTab && <><ChildA /><ChildB /></>` returns the fragment
|
|
227
|
+
* This is needed to propagate parent conditions through fragments.
|
|
228
|
+
*/
|
|
229
|
+
function findJsxFragmentInAndChain(expr) {
|
|
230
|
+
const unwrapped = unwrapExpression(expr);
|
|
231
|
+
if (ts.isJsxFragment(unwrapped)) {
|
|
232
|
+
return unwrapped;
|
|
233
|
+
}
|
|
234
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
235
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
236
|
+
// Check right side first (most common case: condition && <></>)
|
|
237
|
+
const rightResult = findJsxFragmentInAndChain(unwrapped.right);
|
|
238
|
+
if (rightResult)
|
|
239
|
+
return rightResult;
|
|
240
|
+
// Also check left side for rare cases
|
|
241
|
+
return findJsxFragmentInAndChain(unwrapped.left);
|
|
242
|
+
}
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Detects if a property access looks like an environment variable store access.
|
|
247
|
+
* Matches patterns like `env.DATABASE_URL`, `env.IS_FORMBRICKS_CLOUD`, etc.
|
|
248
|
+
* where the object is named "env" and the property looks like an env var name.
|
|
249
|
+
*/
|
|
250
|
+
function isEnvStoreAccess(fullText) {
|
|
251
|
+
// Match: env.SOME_VAR or env.someVar (but object must be exactly "env")
|
|
252
|
+
// This catches patterns from @t3-oss/env-nextjs and similar packages
|
|
253
|
+
const envStorePattern = /^env\.[A-Z_][A-Z0-9_]*$/;
|
|
254
|
+
return envStorePattern.test(fullText);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Converts a call expression argument to a StructuredPath.
|
|
258
|
+
*
|
|
259
|
+
* IMPORTANT: We always use the original source text for callbacks, never cyScope names.
|
|
260
|
+
* cyScope names are internal identifiers for child scopes and should NEVER appear
|
|
261
|
+
* in schema paths or call signatures. Using cyScope names causes data merge conflicts
|
|
262
|
+
* because the same callback gets different identifiers in different contexts.
|
|
263
|
+
*/
|
|
264
|
+
function getArgPathForCallSignature(arg, context) {
|
|
265
|
+
// Always use the standard path conversion - never replace with cyScope names
|
|
266
|
+
return (StructuredPath.fromNode(arg, context.sourceFile) ||
|
|
267
|
+
nodeToSource(arg, context.sourceFile));
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Builds a StructuredPath for a call expression using the original source text.
|
|
271
|
+
*
|
|
272
|
+
* IMPORTANT: This function ensures consistent call signatures by always using
|
|
273
|
+
* the original callback text, never cyScope names. This prevents schema path
|
|
274
|
+
* conflicts where the same call would have different paths.
|
|
275
|
+
*/
|
|
276
|
+
function buildCallPathFromSource(node, context) {
|
|
277
|
+
const expression = node.expression;
|
|
278
|
+
// Convert arguments using original source text
|
|
279
|
+
const argPaths = node.arguments.map((arg) => getArgPathForCallSignature(arg, context));
|
|
280
|
+
// Handle type arguments if present
|
|
281
|
+
let typeArgs = undefined;
|
|
282
|
+
if (node.typeArguments && node.typeArguments.length > 0) {
|
|
283
|
+
typeArgs = node.typeArguments.map((typeArg) => typeArg.getText(context.sourceFile));
|
|
284
|
+
}
|
|
285
|
+
if (ts.isIdentifier(expression)) {
|
|
286
|
+
// Simple function call: func(arg1, arg2)
|
|
287
|
+
return StructuredPath.fromFunction(expression.text, argPaths, typeArgs);
|
|
288
|
+
}
|
|
289
|
+
else if (ts.isPropertyAccessExpression(expression)) {
|
|
290
|
+
// Method call: obj.method(arg1, arg2)
|
|
291
|
+
const objPath = StructuredPath.fromNode(expression.expression, context.sourceFile);
|
|
292
|
+
if (!objPath)
|
|
293
|
+
return null;
|
|
294
|
+
return objPath
|
|
295
|
+
.withProperty(expression.name.text)
|
|
296
|
+
.withFunctionCall(argPaths, typeArgs);
|
|
297
|
+
}
|
|
298
|
+
else if (ts.isCallExpression(expression)) {
|
|
299
|
+
// Chained call: func(arg1)(arg2)
|
|
300
|
+
const funcPath = buildCallPathFromSource(expression, context);
|
|
301
|
+
if (!funcPath)
|
|
302
|
+
return null;
|
|
303
|
+
return funcPath.withFunctionCall(argPaths, typeArgs);
|
|
304
|
+
}
|
|
305
|
+
else if (ts.isElementAccessExpression(expression)) {
|
|
306
|
+
// Element access call: obj[key](args)
|
|
307
|
+
const basePath = StructuredPath.fromNode(expression, context.sourceFile);
|
|
308
|
+
if (!basePath)
|
|
309
|
+
return null;
|
|
310
|
+
return basePath.withFunctionCall(argPaths, typeArgs);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
// Complex call expression
|
|
314
|
+
const basePath = StructuredPath.fromNode(expression, context.sourceFile);
|
|
315
|
+
if (!basePath)
|
|
316
|
+
return null;
|
|
317
|
+
return basePath.withFunctionCall(argPaths, typeArgs);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
7
320
|
/**
|
|
8
321
|
* Checks if an expression is likely an array type.
|
|
9
322
|
* Uses TypeScript's type checker when available, falls back to heuristics.
|
|
@@ -81,102 +394,753 @@ export function markConditionVariablesAsNullable(condition, context) {
|
|
|
81
394
|
}
|
|
82
395
|
}
|
|
83
396
|
/**
|
|
84
|
-
*
|
|
85
|
-
|
|
397
|
+
* Helper to extract source location from an AST node
|
|
398
|
+
*/
|
|
399
|
+
function getSourceLocation(node, sourceFile) {
|
|
400
|
+
const start = node.getStart(sourceFile);
|
|
401
|
+
const { line, character } = sourceFile.getLineAndCharacterOfPosition(start);
|
|
402
|
+
const codeSnippet = node.getText(sourceFile);
|
|
403
|
+
return {
|
|
404
|
+
lineNumber: line + 1, // Convert to 1-based
|
|
405
|
+
column: character,
|
|
406
|
+
codeSnippet: codeSnippet.length > 100
|
|
407
|
+
? codeSnippet.slice(0, 100) + '...'
|
|
408
|
+
: codeSnippet,
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Extracts the root array path from an expression that ends with .map().
|
|
413
|
+
* Handles chained methods like .filter().map(), .slice().map(), etc.
|
|
86
414
|
*
|
|
87
|
-
*
|
|
415
|
+
* Examples:
|
|
416
|
+
* - items.map(...) → "items"
|
|
417
|
+
* - data.users.map(...) → "data.users"
|
|
418
|
+
* - items.filter(...).map(...) → "items"
|
|
419
|
+
* - items.slice(0, 5).map(...) → "items"
|
|
420
|
+
*/
|
|
421
|
+
function extractArrayPathFromMapCall(expr, sourceFile) {
|
|
422
|
+
// Walk up the chain to find the root array
|
|
423
|
+
let current = expr.expression;
|
|
424
|
+
while (ts.isPropertyAccessExpression(current)) {
|
|
425
|
+
const methodName = current.name.getText(sourceFile);
|
|
426
|
+
// Common array methods that return arrays (so we keep going up)
|
|
427
|
+
const arrayReturningMethods = [
|
|
428
|
+
'map',
|
|
429
|
+
'filter',
|
|
430
|
+
'slice',
|
|
431
|
+
'concat',
|
|
432
|
+
'flat',
|
|
433
|
+
'flatMap',
|
|
434
|
+
'reverse',
|
|
435
|
+
'sort',
|
|
436
|
+
'toReversed',
|
|
437
|
+
'toSorted',
|
|
438
|
+
'toSpliced',
|
|
439
|
+
];
|
|
440
|
+
if (arrayReturningMethods.includes(methodName)) {
|
|
441
|
+
const objectExpr = current.expression;
|
|
442
|
+
// If the object is a call expression (chained method), keep going
|
|
443
|
+
if (ts.isCallExpression(objectExpr)) {
|
|
444
|
+
current = objectExpr.expression;
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
// Found the root - it's an identifier or property access
|
|
448
|
+
const path = StructuredPath.fromNode(objectExpr, sourceFile);
|
|
449
|
+
return path ? path.toString() : null;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
// Not an array method we recognize
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Extracts JSX rendering usages from a JSX expression.
|
|
461
|
+
* Detects:
|
|
462
|
+
* - array.map() calls → 'array-map' type
|
|
463
|
+
* - string interpolations (identifiers/property access) → 'text-interpolation' type
|
|
464
|
+
*
|
|
465
|
+
* Recursively searches inside && chains and ternary expressions.
|
|
466
|
+
*
|
|
467
|
+
* @param expr The expression inside {expr}
|
|
88
468
|
* @param context The analysis context
|
|
89
|
-
* @param location Where this condition appears (if, ternary, logical-and, switch)
|
|
90
469
|
*/
|
|
91
|
-
|
|
92
|
-
const unwrapped = unwrapExpression(
|
|
93
|
-
|
|
94
|
-
//
|
|
470
|
+
function extractJsxRenderingUsage(expr, context) {
|
|
471
|
+
const unwrapped = unwrapExpression(expr);
|
|
472
|
+
const sourceLocation = getSourceLocation(expr, context.sourceFile);
|
|
473
|
+
// Detect array.map() calls
|
|
474
|
+
if (ts.isCallExpression(unwrapped)) {
|
|
475
|
+
const calleeExpr = unwrapped.expression;
|
|
476
|
+
if (ts.isPropertyAccessExpression(calleeExpr)) {
|
|
477
|
+
const methodName = calleeExpr.name.getText(context.sourceFile);
|
|
478
|
+
if (methodName === 'map') {
|
|
479
|
+
const arrayPath = extractArrayPathFromMapCall(unwrapped, context.sourceFile);
|
|
480
|
+
if (arrayPath) {
|
|
481
|
+
context.addJsxRenderingUsage({
|
|
482
|
+
path: arrayPath,
|
|
483
|
+
renderingType: 'array-map',
|
|
484
|
+
valueType: 'array',
|
|
485
|
+
sourceLocation,
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
// Detect simple string interpolations: {title} or {user.name}
|
|
492
|
+
else if (ts.isIdentifier(unwrapped) ||
|
|
493
|
+
ts.isPropertyAccessExpression(unwrapped)) {
|
|
494
|
+
const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
|
|
495
|
+
if (path) {
|
|
496
|
+
const pathStr = path.toString();
|
|
497
|
+
const typeInfo = context.getTypeInfo(path);
|
|
498
|
+
// Only track as text interpolation if it's a string type
|
|
499
|
+
// Check for 'string' type, or types that contain 'string' (but not 'string[]')
|
|
500
|
+
if (typeInfo === 'string' ||
|
|
501
|
+
(typeInfo &&
|
|
502
|
+
typeInfo.includes('string') &&
|
|
503
|
+
!typeInfo.includes('string[]'))) {
|
|
504
|
+
context.addJsxRenderingUsage({
|
|
505
|
+
path: pathStr,
|
|
506
|
+
renderingType: 'text-interpolation',
|
|
507
|
+
valueType: 'string',
|
|
508
|
+
sourceLocation,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
// Recursively search inside && chains: {showList && items.map(...)}
|
|
514
|
+
else if (ts.isBinaryExpression(unwrapped) &&
|
|
515
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
516
|
+
// Check the right side of the && chain (where .map() typically appears)
|
|
517
|
+
const rightSide = unwrapExpression(unwrapped.right);
|
|
518
|
+
extractJsxRenderingUsage(rightSide, context);
|
|
519
|
+
// Also check nested && chains on the left
|
|
520
|
+
extractJsxRenderingUsage(unwrapped.left, context);
|
|
521
|
+
}
|
|
522
|
+
// Recursively search inside ternaries: {isEmpty ? null : items.map(...)}
|
|
523
|
+
else if (ts.isConditionalExpression(unwrapped)) {
|
|
524
|
+
extractJsxRenderingUsage(unwrapped.whenTrue, context);
|
|
525
|
+
extractJsxRenderingUsage(unwrapped.whenFalse, context);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Counts the number of conditions in an && chain (excluding JSX consequence)
|
|
530
|
+
*/
|
|
531
|
+
function countConditionsInAndChain(expr) {
|
|
532
|
+
const unwrapped = unwrapExpression(expr);
|
|
95
533
|
if (ts.isBinaryExpression(unwrapped) &&
|
|
96
534
|
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
97
|
-
|
|
98
|
-
extractConditionalUsage(unwrapped.left, context, location);
|
|
99
|
-
// Process right side if it's not JSX (JSX is the consequence, not the condition)
|
|
535
|
+
const leftCount = countConditionsInAndChain(unwrapped.left);
|
|
100
536
|
const rightUnwrapped = unwrapExpression(unwrapped.right);
|
|
101
537
|
const isJsxConsequence = ts.isJsxElement(rightUnwrapped) ||
|
|
102
538
|
ts.isJsxSelfClosingElement(rightUnwrapped) ||
|
|
103
539
|
ts.isJsxFragment(rightUnwrapped);
|
|
104
|
-
if (
|
|
105
|
-
|
|
540
|
+
if (isJsxConsequence) {
|
|
541
|
+
return leftCount;
|
|
106
542
|
}
|
|
107
|
-
return;
|
|
543
|
+
return leftCount + countConditionsInAndChain(unwrapped.right);
|
|
108
544
|
}
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
545
|
+
// Single condition (not an && chain)
|
|
546
|
+
return 1;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Extracts conditionals from JSX elements by recursively traversing children.
|
|
550
|
+
*
|
|
551
|
+
* This is CRITICAL for extracting compound conditionals from JSX expressions
|
|
552
|
+
* like `{hasNewerVersion && !isActive && <Banner />}`.
|
|
553
|
+
*
|
|
554
|
+
* This function is called BEFORE the child boundary check in processExpression
|
|
555
|
+
* because JSX elements are NOT scopes - their expressions use variables from
|
|
556
|
+
* the parent scope and should have their conditionals extracted regardless of
|
|
557
|
+
* whether the JSX is within a child boundary.
|
|
558
|
+
*
|
|
559
|
+
* Fix 32: Added parentConditions parameter to track gating conditions from
|
|
560
|
+
* parent && chains. When we find a component nested inside multiple conditionals
|
|
561
|
+
* like `{activeTab && <>{ternary ? ... : <Component />}</>}`, ALL parent
|
|
562
|
+
* conditions should be added as gating conditions for the component.
|
|
563
|
+
*
|
|
564
|
+
* @param node The JSX element, self-closing element, or fragment to traverse
|
|
565
|
+
* @param context The analysis context
|
|
566
|
+
* @param parentConditions Accumulated gating conditions from parent && chains
|
|
567
|
+
*/
|
|
568
|
+
function extractConditionalsFromJsx(node, context, parentConditions = []) {
|
|
569
|
+
// Get children to process
|
|
570
|
+
let children;
|
|
571
|
+
if (ts.isJsxElement(node)) {
|
|
572
|
+
children = node.children;
|
|
573
|
+
}
|
|
574
|
+
else if (ts.isJsxFragment(node)) {
|
|
575
|
+
children = node.children;
|
|
576
|
+
}
|
|
577
|
+
// JsxSelfClosingElement has no children
|
|
578
|
+
if (!children) {
|
|
115
579
|
return;
|
|
116
580
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
581
|
+
for (const child of children) {
|
|
582
|
+
// Process JSX expressions: {expr}
|
|
583
|
+
if (ts.isJsxExpression(child) && child.expression) {
|
|
584
|
+
const expr = unwrapExpression(child.expression);
|
|
585
|
+
// Extract JSX rendering usages (array.map, text interpolation)
|
|
586
|
+
// This handles direct usages like {items.map(...)} or {user.name}
|
|
587
|
+
extractJsxRenderingUsage(expr, context);
|
|
588
|
+
// If the expression is an && chain, extract its conditional usages
|
|
589
|
+
if (ts.isBinaryExpression(expr) &&
|
|
590
|
+
expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
591
|
+
// Mark nullable variables
|
|
592
|
+
markConditionVariablesAsNullable(expr, context);
|
|
593
|
+
// Extract conditional usage (this handles compound conditionals)
|
|
594
|
+
// Pass controlsJsxRendering: true since this conditional controls JSX rendering
|
|
595
|
+
extractConditionalUsage(expr, context, 'logical-and', {
|
|
596
|
+
controlsJsxRendering: true,
|
|
597
|
+
});
|
|
598
|
+
// Extract all condition paths from the && chain for gating tracking
|
|
599
|
+
const conditionPaths = extractConditionPathsFromAndChain(expr, context.sourceFile);
|
|
600
|
+
const sourceLocation = getSourceLocation(expr, context.sourceFile);
|
|
601
|
+
// Fix 32: Build accumulated conditions including parent conditions
|
|
602
|
+
const accumulatedConditions = [
|
|
603
|
+
...parentConditions,
|
|
604
|
+
...conditionPaths.map((path) => ({
|
|
605
|
+
path,
|
|
606
|
+
sourceLocation,
|
|
607
|
+
isNegated: false,
|
|
608
|
+
})),
|
|
609
|
+
];
|
|
610
|
+
// Track gating conditions for child components
|
|
611
|
+
// Example: {hasAnalysis && <ScenarioViewer />}
|
|
612
|
+
const jsxElement = findJsxInAndChain(expr);
|
|
613
|
+
if (jsxElement) {
|
|
614
|
+
const componentName = getComponentNameFromJsx(jsxElement);
|
|
615
|
+
if (componentName) {
|
|
616
|
+
// Fix 32: Add ALL accumulated conditions (parent + current) as gating conditions
|
|
617
|
+
for (const condition of accumulatedConditions) {
|
|
618
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
619
|
+
path: condition.path,
|
|
620
|
+
conditionType: 'truthiness',
|
|
621
|
+
location: 'logical-and',
|
|
622
|
+
sourceLocation: condition.sourceLocation,
|
|
623
|
+
controlsJsxRendering: true,
|
|
624
|
+
isNegated: condition.isNegated,
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
// Fix 32: Recursively process nested JSX with accumulated conditions
|
|
629
|
+
if (ts.isJsxElement(jsxElement) ||
|
|
630
|
+
ts.isJsxSelfClosingElement(jsxElement)) {
|
|
631
|
+
extractConditionalsFromJsx(jsxElement, context, accumulatedConditions);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
// Fix 32: Also check for nested JSX fragments
|
|
635
|
+
const jsxFragment = findJsxFragmentInAndChain(expr);
|
|
636
|
+
if (jsxFragment) {
|
|
637
|
+
extractConditionalsFromJsx(jsxFragment, context, accumulatedConditions);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
// If the expression is a ternary, extract its conditional
|
|
641
|
+
else if (ts.isConditionalExpression(expr)) {
|
|
642
|
+
// Pass controlsJsxRendering: true since this conditional controls JSX rendering
|
|
643
|
+
extractConditionalUsage(expr.condition, context, 'ternary', {
|
|
644
|
+
controlsJsxRendering: true,
|
|
645
|
+
});
|
|
646
|
+
// Track gating conditions for components in both branches of the ternary
|
|
647
|
+
// Example: {isError ? <ErrorView /> : <SuccessView />}
|
|
648
|
+
const conditionPath = StructuredPath.fromNode(unwrapExpression(expr.condition), context.sourceFile);
|
|
649
|
+
const sourceLocation = getSourceLocation(expr, context.sourceFile);
|
|
650
|
+
// Recursively process the whenTrue and whenFalse branches for JSX
|
|
651
|
+
const whenTrue = unwrapExpression(expr.whenTrue);
|
|
652
|
+
const whenFalse = unwrapExpression(expr.whenFalse);
|
|
653
|
+
// Fix 32: Build conditions for whenTrue branch (parent conditions + ternary condition truthy)
|
|
654
|
+
const whenTrueConditions = [
|
|
655
|
+
...parentConditions,
|
|
656
|
+
...(conditionPath
|
|
657
|
+
? [
|
|
658
|
+
{
|
|
659
|
+
path: conditionPath.toString(),
|
|
660
|
+
sourceLocation,
|
|
661
|
+
isNegated: false,
|
|
662
|
+
},
|
|
663
|
+
]
|
|
664
|
+
: []),
|
|
665
|
+
];
|
|
666
|
+
// Fix 32: Build conditions for whenFalse branch (parent conditions + ternary condition falsy)
|
|
667
|
+
const whenFalseConditions = [
|
|
668
|
+
...parentConditions,
|
|
669
|
+
...(conditionPath
|
|
670
|
+
? [
|
|
671
|
+
{
|
|
672
|
+
path: conditionPath.toString(),
|
|
673
|
+
sourceLocation,
|
|
674
|
+
isNegated: true,
|
|
675
|
+
},
|
|
676
|
+
]
|
|
677
|
+
: []),
|
|
678
|
+
];
|
|
679
|
+
// Handle whenTrue branch (condition is truthy)
|
|
680
|
+
if (ts.isJsxElement(whenTrue) || ts.isJsxSelfClosingElement(whenTrue)) {
|
|
681
|
+
const componentName = getComponentNameFromJsx(whenTrue);
|
|
682
|
+
if (componentName) {
|
|
683
|
+
// Fix 32: Add ALL conditions (parent + ternary) as gating conditions
|
|
684
|
+
for (const condition of whenTrueConditions) {
|
|
685
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
686
|
+
path: condition.path,
|
|
687
|
+
conditionType: 'truthiness',
|
|
688
|
+
location: 'ternary',
|
|
689
|
+
sourceLocation: condition.sourceLocation,
|
|
690
|
+
controlsJsxRendering: true,
|
|
691
|
+
isNegated: condition.isNegated,
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
if (ts.isJsxElement(whenTrue) ||
|
|
697
|
+
ts.isJsxSelfClosingElement(whenTrue) ||
|
|
698
|
+
ts.isJsxFragment(whenTrue)) {
|
|
699
|
+
extractConditionalsFromJsx(whenTrue, context, whenTrueConditions);
|
|
700
|
+
}
|
|
701
|
+
// Handle whenFalse branch (condition is falsy/negated)
|
|
702
|
+
if (ts.isJsxElement(whenFalse) ||
|
|
703
|
+
ts.isJsxSelfClosingElement(whenFalse)) {
|
|
704
|
+
const componentName = getComponentNameFromJsx(whenFalse);
|
|
705
|
+
if (componentName) {
|
|
706
|
+
// Fix 32: Add ALL conditions (parent + ternary) as gating conditions
|
|
707
|
+
for (const condition of whenFalseConditions) {
|
|
708
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
709
|
+
path: condition.path,
|
|
710
|
+
conditionType: 'truthiness',
|
|
711
|
+
location: 'ternary',
|
|
712
|
+
sourceLocation: condition.sourceLocation,
|
|
713
|
+
controlsJsxRendering: true,
|
|
714
|
+
isNegated: condition.isNegated,
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
if (ts.isJsxElement(whenFalse) ||
|
|
720
|
+
ts.isJsxSelfClosingElement(whenFalse) ||
|
|
721
|
+
ts.isJsxFragment(whenFalse)) {
|
|
722
|
+
extractConditionalsFromJsx(whenFalse, context, whenFalseConditions);
|
|
723
|
+
}
|
|
724
|
+
// Handle chained ternaries: a ? <A/> : b ? <B/> : <C/>
|
|
725
|
+
// When whenFalse is another ConditionalExpression, recursively process it
|
|
726
|
+
else if (ts.isConditionalExpression(whenFalse)) {
|
|
727
|
+
// Extract conditional usage for the nested ternary's condition
|
|
728
|
+
extractConditionalUsage(whenFalse.condition, context, 'ternary', {
|
|
729
|
+
controlsJsxRendering: true,
|
|
730
|
+
});
|
|
731
|
+
// Get the nested condition path
|
|
732
|
+
const nestedConditionPath = StructuredPath.fromNode(unwrapExpression(whenFalse.condition), context.sourceFile);
|
|
733
|
+
const nestedSourceLocation = getSourceLocation(whenFalse, context.sourceFile);
|
|
734
|
+
const nestedWhenTrue = unwrapExpression(whenFalse.whenTrue);
|
|
735
|
+
const nestedWhenFalse = unwrapExpression(whenFalse.whenFalse);
|
|
736
|
+
// Fix 32: Build conditions for nested whenTrue (parent falsy + nested truthy)
|
|
737
|
+
const nestedWhenTrueConditions = [
|
|
738
|
+
...whenFalseConditions, // Parent ternary was falsy to get here
|
|
739
|
+
...(nestedConditionPath
|
|
740
|
+
? [
|
|
741
|
+
{
|
|
742
|
+
path: nestedConditionPath.toString(),
|
|
743
|
+
sourceLocation: nestedSourceLocation,
|
|
744
|
+
isNegated: false,
|
|
745
|
+
},
|
|
746
|
+
]
|
|
747
|
+
: []),
|
|
748
|
+
];
|
|
749
|
+
// Fix 32: Build conditions for nested whenFalse (parent falsy + nested falsy)
|
|
750
|
+
const nestedWhenFalseConditions = [
|
|
751
|
+
...whenFalseConditions, // Parent ternary was falsy to get here
|
|
752
|
+
...(nestedConditionPath
|
|
753
|
+
? [
|
|
754
|
+
{
|
|
755
|
+
path: nestedConditionPath.toString(),
|
|
756
|
+
sourceLocation: nestedSourceLocation,
|
|
757
|
+
isNegated: true,
|
|
758
|
+
},
|
|
759
|
+
]
|
|
760
|
+
: []),
|
|
761
|
+
];
|
|
762
|
+
// Handle nested whenTrue branch
|
|
763
|
+
if (ts.isJsxElement(nestedWhenTrue) ||
|
|
764
|
+
ts.isJsxSelfClosingElement(nestedWhenTrue)) {
|
|
765
|
+
const componentName = getComponentNameFromJsx(nestedWhenTrue);
|
|
766
|
+
if (componentName) {
|
|
767
|
+
// Fix 32: Add ALL accumulated conditions
|
|
768
|
+
for (const condition of nestedWhenTrueConditions) {
|
|
769
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
770
|
+
path: condition.path,
|
|
771
|
+
conditionType: 'truthiness',
|
|
772
|
+
location: 'ternary',
|
|
773
|
+
sourceLocation: condition.sourceLocation,
|
|
774
|
+
controlsJsxRendering: true,
|
|
775
|
+
isNegated: condition.isNegated,
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
if (ts.isJsxElement(nestedWhenTrue) ||
|
|
781
|
+
ts.isJsxSelfClosingElement(nestedWhenTrue) ||
|
|
782
|
+
ts.isJsxFragment(nestedWhenTrue)) {
|
|
783
|
+
extractConditionalsFromJsx(nestedWhenTrue, context, nestedWhenTrueConditions);
|
|
784
|
+
}
|
|
785
|
+
// Handle nested whenFalse branch (this could be another chained ternary or JSX)
|
|
786
|
+
if (ts.isJsxElement(nestedWhenFalse) ||
|
|
787
|
+
ts.isJsxSelfClosingElement(nestedWhenFalse)) {
|
|
788
|
+
const componentName = getComponentNameFromJsx(nestedWhenFalse);
|
|
789
|
+
if (componentName) {
|
|
790
|
+
// Fix 32: Add ALL accumulated conditions
|
|
791
|
+
for (const condition of nestedWhenFalseConditions) {
|
|
792
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
793
|
+
path: condition.path,
|
|
794
|
+
conditionType: 'truthiness',
|
|
795
|
+
location: 'ternary',
|
|
796
|
+
sourceLocation: condition.sourceLocation,
|
|
797
|
+
controlsJsxRendering: true,
|
|
798
|
+
isNegated: condition.isNegated,
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
if (ts.isJsxElement(nestedWhenFalse) ||
|
|
804
|
+
ts.isJsxSelfClosingElement(nestedWhenFalse) ||
|
|
805
|
+
ts.isJsxFragment(nestedWhenFalse)) {
|
|
806
|
+
extractConditionalsFromJsx(nestedWhenFalse, context, nestedWhenFalseConditions);
|
|
807
|
+
}
|
|
808
|
+
// If nestedWhenFalse is yet another ConditionalExpression, the recursion
|
|
809
|
+
// will handle it on the next iteration when this function processes it
|
|
810
|
+
else if (ts.isConditionalExpression(nestedWhenFalse)) {
|
|
811
|
+
// Recursively handle deeper nesting by wrapping in a synthetic process
|
|
812
|
+
// We create a fake JsxExpression context to reuse the same logic
|
|
813
|
+
const syntheticChild = {
|
|
814
|
+
kind: ts.SyntaxKind.JsxExpression,
|
|
815
|
+
expression: nestedWhenFalse,
|
|
816
|
+
};
|
|
817
|
+
// Process via the main JSX expression handler by recursing
|
|
818
|
+
// For now, just extract conditionals directly
|
|
819
|
+
extractConditionalUsage(nestedWhenFalse.condition, context, 'ternary', { controlsJsxRendering: true });
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
// Recursively process nested JSX elements - Fix 32: pass parent conditions
|
|
825
|
+
else if (ts.isJsxElement(child)) {
|
|
826
|
+
// Check if this is a user-defined component (vs intrinsic element like div)
|
|
827
|
+
const componentName = getComponentNameFromJsx(child);
|
|
828
|
+
if (componentName) {
|
|
829
|
+
if (parentConditions.length > 0) {
|
|
830
|
+
// If there are parent conditions, record them as gating conditions
|
|
831
|
+
console.log(`[ChildBoundary] ${componentName}: Conditionally rendered with ${parentConditions.length} gating conditions`);
|
|
832
|
+
for (const condition of parentConditions) {
|
|
833
|
+
console.log(`[ChildBoundary] ${componentName}: Adding gating condition path='${condition.path}' isNegated=${condition.isNegated}`);
|
|
834
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
835
|
+
path: condition.path,
|
|
836
|
+
conditionType: 'truthiness',
|
|
837
|
+
location: 'ternary',
|
|
838
|
+
sourceLocation: condition.sourceLocation,
|
|
839
|
+
controlsJsxRendering: true,
|
|
840
|
+
isNegated: condition.isNegated,
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
else {
|
|
845
|
+
// No parent conditions - check if it has data props for unconditional tracking
|
|
846
|
+
console.log(`[ChildBoundary] ${componentName}: Checking for unconditional rendering with data props...`);
|
|
847
|
+
const { hasDataProps, dataProps } = hasDataPropsFromParent(child, componentName);
|
|
848
|
+
if (hasDataProps) {
|
|
849
|
+
// Fix: Track unconditionally-rendered children that receive data props
|
|
850
|
+
// These need to be tracked for flow merging even without gating conditions
|
|
851
|
+
// Example: <WorkoutsView workouts={workouts} /> - parent controls workouts data
|
|
852
|
+
console.log(`[ChildBoundary] ${componentName}: TRACKING as unconditionally-rendered with data props: [${dataProps.join(', ')}]`);
|
|
853
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
854
|
+
path: '__unconditional__',
|
|
855
|
+
conditionType: 'truthiness',
|
|
856
|
+
location: 'unconditional',
|
|
857
|
+
controlsJsxRendering: true,
|
|
858
|
+
isNegated: false,
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
extractConditionalsFromJsx(child, context, parentConditions);
|
|
864
|
+
}
|
|
865
|
+
// Handle self-closing JSX elements (e.g., <ScenarioViewer />)
|
|
866
|
+
else if (ts.isJsxSelfClosingElement(child)) {
|
|
867
|
+
// Check if this is a user-defined component (vs intrinsic element like div)
|
|
868
|
+
const componentName = getComponentNameFromJsx(child);
|
|
869
|
+
if (componentName) {
|
|
870
|
+
if (parentConditions.length > 0) {
|
|
871
|
+
// If there are parent conditions, record them as gating conditions
|
|
872
|
+
console.log(`[ChildBoundary] ${componentName}: Conditionally rendered (self-closing) with ${parentConditions.length} gating conditions`);
|
|
873
|
+
for (const condition of parentConditions) {
|
|
874
|
+
console.log(`[ChildBoundary] ${componentName}: Adding gating condition path='${condition.path}' isNegated=${condition.isNegated}`);
|
|
875
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
876
|
+
path: condition.path,
|
|
877
|
+
conditionType: 'truthiness',
|
|
878
|
+
location: 'ternary',
|
|
879
|
+
sourceLocation: condition.sourceLocation,
|
|
880
|
+
controlsJsxRendering: true,
|
|
881
|
+
isNegated: condition.isNegated,
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
// No parent conditions - check if it has data props for unconditional tracking
|
|
887
|
+
console.log(`[ChildBoundary] ${componentName}: Checking for unconditional rendering (self-closing) with data props...`);
|
|
888
|
+
const { hasDataProps, dataProps } = hasDataPropsFromParent(child, componentName);
|
|
889
|
+
if (hasDataProps) {
|
|
890
|
+
// Fix: Track unconditionally-rendered children that receive data props
|
|
891
|
+
console.log(`[ChildBoundary] ${componentName}: TRACKING as unconditionally-rendered (self-closing) with data props: [${dataProps.join(', ')}]`);
|
|
892
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
893
|
+
path: '__unconditional__',
|
|
894
|
+
conditionType: 'truthiness',
|
|
895
|
+
location: 'unconditional',
|
|
896
|
+
controlsJsxRendering: true,
|
|
897
|
+
isNegated: false,
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
// Self-closing elements have no children, so no recursion needed
|
|
903
|
+
}
|
|
904
|
+
// Recursively process nested JSX fragments - Fix 32: pass parent conditions
|
|
905
|
+
else if (ts.isJsxFragment(child)) {
|
|
906
|
+
extractConditionalsFromJsx(child, context, parentConditions);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Extracts conditional usages from a condition expression for key attribute detection.
|
|
912
|
+
* This function identifies which attributes are used in conditionals and how they're used.
|
|
913
|
+
* It also tracks compound conditionals (&&-chains) where all conditions must be true together.
|
|
914
|
+
*
|
|
915
|
+
* @param condition The condition expression to analyze
|
|
916
|
+
* @param context The analysis context
|
|
917
|
+
* @param location Where this condition appears (if, ternary, logical-and, switch)
|
|
918
|
+
* @param options Additional options including controlsJsxRendering flag
|
|
919
|
+
*/
|
|
920
|
+
export function extractConditionalUsage(condition, context, location, options = {}) {
|
|
921
|
+
const { controlsJsxRendering } = options;
|
|
922
|
+
// Internal recursive function with chain tracking
|
|
923
|
+
function extractWithChainTracking(expr, chainInfo, isNegated) {
|
|
924
|
+
const unwrapped = unwrapExpression(expr);
|
|
925
|
+
// Handle binary expressions with && (logical AND chains)
|
|
926
|
+
// Example: `a && b && <Component />` - both a and b are conditional checks
|
|
927
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
928
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
929
|
+
// Track if we're creating the chain at this level (root of the chain)
|
|
930
|
+
const isChainRoot = !chainInfo;
|
|
931
|
+
// If no chainInfo, this is the root of a new chain
|
|
932
|
+
if (isChainRoot) {
|
|
933
|
+
const chainLength = countConditionsInAndChain(unwrapped);
|
|
934
|
+
// Only create chain tracking for chains with 2+ conditions
|
|
935
|
+
if (chainLength >= 2) {
|
|
936
|
+
const chainId = `chain_${crypto.randomUUID().slice(0, 8)}`;
|
|
937
|
+
const chainExpression = unwrapped.getText(context.sourceFile);
|
|
938
|
+
const compound = {
|
|
939
|
+
chainId,
|
|
940
|
+
expression: chainExpression.length > 200
|
|
941
|
+
? chainExpression.slice(0, 200) + '...'
|
|
942
|
+
: chainExpression,
|
|
943
|
+
conditions: [],
|
|
944
|
+
location,
|
|
945
|
+
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
946
|
+
controlsJsxRendering,
|
|
947
|
+
};
|
|
948
|
+
chainInfo = {
|
|
949
|
+
chainId,
|
|
950
|
+
chainLength,
|
|
951
|
+
chainExpression: compound.expression,
|
|
952
|
+
currentPosition: 0,
|
|
953
|
+
compound,
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
// Recursively process left side
|
|
958
|
+
extractWithChainTracking(unwrapped.left, chainInfo, false);
|
|
959
|
+
// Process right side if it's not JSX (JSX is the consequence, not the condition)
|
|
960
|
+
const rightUnwrapped = unwrapExpression(unwrapped.right);
|
|
961
|
+
const isJsxConsequence = ts.isJsxElement(rightUnwrapped) ||
|
|
962
|
+
ts.isJsxSelfClosingElement(rightUnwrapped) ||
|
|
963
|
+
ts.isJsxFragment(rightUnwrapped);
|
|
964
|
+
if (!isJsxConsequence) {
|
|
965
|
+
extractWithChainTracking(unwrapped.right, chainInfo, false);
|
|
966
|
+
}
|
|
967
|
+
// If this is the root of the chain, register the compound conditional
|
|
968
|
+
if (isChainRoot && chainInfo) {
|
|
969
|
+
context.addCompoundConditional(chainInfo.compound);
|
|
970
|
+
}
|
|
133
971
|
return;
|
|
134
972
|
}
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
973
|
+
// Handle binary expressions with || (logical OR)
|
|
974
|
+
// When OR is inside an && chain, we need to continue chain tracking
|
|
975
|
+
// and mark conditions as OR alternatives
|
|
976
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
977
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
|
|
978
|
+
if (chainInfo) {
|
|
979
|
+
// We're inside an && chain - continue tracking but mark as OR alternatives
|
|
980
|
+
// Generate an orGroupId so conditions from both sides can be grouped
|
|
981
|
+
const orGroupId = chainInfo.currentOrGroupId ?? `or_${crypto.randomUUID().slice(0, 8)}`;
|
|
982
|
+
// Process left side with OR group tracking
|
|
983
|
+
const leftChainInfo = {
|
|
984
|
+
...chainInfo,
|
|
985
|
+
currentOrGroupId: orGroupId,
|
|
986
|
+
};
|
|
987
|
+
extractWithChainTracking(unwrapped.left, leftChainInfo, false);
|
|
988
|
+
// Process right side with same OR group
|
|
989
|
+
// Note: we use leftChainInfo's currentPosition which may have been updated
|
|
990
|
+
const rightChainInfo = {
|
|
991
|
+
...leftChainInfo,
|
|
992
|
+
currentPosition: chainInfo.currentPosition,
|
|
993
|
+
};
|
|
994
|
+
extractWithChainTracking(unwrapped.right, rightChainInfo, false);
|
|
995
|
+
}
|
|
996
|
+
else {
|
|
997
|
+
// Not inside a chain - OR breaks into independent conditional checks
|
|
998
|
+
extractWithChainTracking(unwrapped.left, null, false);
|
|
999
|
+
extractWithChainTracking(unwrapped.right, null, false);
|
|
1000
|
+
}
|
|
144
1001
|
return;
|
|
145
1002
|
}
|
|
146
|
-
//
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
1003
|
+
// Handle comparison operators (===, !==, <, >, <=, >=)
|
|
1004
|
+
// Example: `if (status === 'active')` - status is compared against 'active'
|
|
1005
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
1006
|
+
isComparisonOperator(unwrapped.operatorToken.kind)) {
|
|
1007
|
+
// Try to extract the variable and the compared value
|
|
1008
|
+
const leftPath = StructuredPath.fromNode(unwrapped.left, context.sourceFile);
|
|
1009
|
+
const rightPath = StructuredPath.fromNode(unwrapped.right, context.sourceFile);
|
|
1010
|
+
// Determine the compared value for computing requiredValue
|
|
1011
|
+
const getRequiredValue = (literalValue, isNegatedComparison) => {
|
|
1012
|
+
if (literalValue === undefined)
|
|
1013
|
+
return undefined;
|
|
1014
|
+
// For !== comparisons, the condition is true when NOT equal to the value
|
|
1015
|
+
// For === comparisons, the condition is true when equal to the value
|
|
1016
|
+
const isNotEqual = unwrapped.operatorToken.kind ===
|
|
1017
|
+
ts.SyntaxKind.ExclamationEqualsEqualsToken ||
|
|
1018
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsToken;
|
|
1019
|
+
if (isNotEqual) {
|
|
1020
|
+
// !== 'value' means requiredValue is NOT 'value', but we express this as "not 'value'"
|
|
1021
|
+
return `not ${literalValue}`;
|
|
1022
|
+
}
|
|
1023
|
+
return literalValue;
|
|
1024
|
+
};
|
|
1025
|
+
// Get the comparison operator string for the compound condition
|
|
1026
|
+
const comparisonOperator = getComparisonOperatorString(unwrapped.operatorToken.kind);
|
|
1027
|
+
// Helper to add a condition
|
|
1028
|
+
const addCondition = (path, conditionType, comparedValues, requiredValue, sourceExpr) => {
|
|
1029
|
+
const usage = {
|
|
1030
|
+
path,
|
|
1031
|
+
conditionType,
|
|
1032
|
+
comparedValues,
|
|
1033
|
+
location,
|
|
1034
|
+
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
1035
|
+
isNegated,
|
|
1036
|
+
controlsJsxRendering,
|
|
1037
|
+
};
|
|
1038
|
+
// Check for inline array-derived patterns (.length) on the source expression
|
|
1039
|
+
if (sourceExpr) {
|
|
1040
|
+
const arrayDerived = detectArrayDerivedPattern(sourceExpr);
|
|
1041
|
+
if (arrayDerived) {
|
|
1042
|
+
usage.derivedFrom = {
|
|
1043
|
+
operation: arrayDerived.operation,
|
|
1044
|
+
sourcePath: arrayDerived.sourcePath,
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
// Add chain info if part of a compound conditional
|
|
1049
|
+
if (chainInfo) {
|
|
1050
|
+
usage.chainId = chainInfo.chainId;
|
|
1051
|
+
usage.chainPosition = chainInfo.currentPosition;
|
|
1052
|
+
usage.chainLength = chainInfo.chainLength;
|
|
1053
|
+
usage.chainExpression = chainInfo.chainExpression;
|
|
1054
|
+
chainInfo.currentPosition++;
|
|
1055
|
+
// Add to compound conditional conditions
|
|
1056
|
+
chainInfo.compound.conditions.push({
|
|
1057
|
+
path,
|
|
1058
|
+
conditionType,
|
|
1059
|
+
comparedValues,
|
|
1060
|
+
isNegated,
|
|
1061
|
+
requiredValue,
|
|
1062
|
+
...(comparisonOperator && { comparisonOperator }),
|
|
1063
|
+
...(chainInfo.currentOrGroupId && {
|
|
1064
|
+
orGroupId: chainInfo.currentOrGroupId,
|
|
1065
|
+
}),
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
context.addConditionalUsage(usage);
|
|
1069
|
+
};
|
|
1070
|
+
// Check if left is a variable and right is a literal
|
|
1071
|
+
if (leftPath && isLiteralExpression(unwrapped.right)) {
|
|
1072
|
+
const literalValue = getLiteralValue(unwrapped.right, context);
|
|
1073
|
+
addCondition(leftPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated), unwrapped.left);
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
// Check if right is a variable and left is a literal
|
|
1077
|
+
if (rightPath && isLiteralExpression(unwrapped.left)) {
|
|
1078
|
+
const literalValue = getLiteralValue(unwrapped.left, context);
|
|
1079
|
+
addCondition(rightPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated), unwrapped.right);
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
// Both sides are variables - record both as comparisons without specific values
|
|
1083
|
+
if (leftPath) {
|
|
1084
|
+
addCondition(leftPath.toLeftHandSideString(), 'comparison', undefined, undefined, unwrapped.left);
|
|
1085
|
+
}
|
|
1086
|
+
if (rightPath) {
|
|
1087
|
+
addCondition(rightPath.toLeftHandSideString(), 'comparison', undefined, undefined, unwrapped.right);
|
|
1088
|
+
}
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
// Handle prefix unary NOT expression: !variable
|
|
1092
|
+
// Example: `if (!isVisible)` - isVisible is a truthiness check (negated)
|
|
1093
|
+
if (ts.isPrefixUnaryExpression(unwrapped) &&
|
|
1094
|
+
unwrapped.operator === ts.SyntaxKind.ExclamationToken) {
|
|
1095
|
+
extractWithChainTracking(unwrapped.operand, chainInfo, !isNegated);
|
|
1096
|
+
return;
|
|
153
1097
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
1098
|
+
// Handle simple identifiers or property accesses (truthiness checks)
|
|
1099
|
+
// Example: `if (x)` or `x && <JSX />` - x is checked for truthiness
|
|
1100
|
+
const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
|
|
1101
|
+
if (path && !path.isLiteral()) {
|
|
1102
|
+
const pathStr = path.toLeftHandSideString();
|
|
1103
|
+
const usage = {
|
|
1104
|
+
path: pathStr,
|
|
1105
|
+
conditionType: 'truthiness',
|
|
158
1106
|
location,
|
|
159
|
-
|
|
1107
|
+
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
1108
|
+
isNegated,
|
|
1109
|
+
controlsJsxRendering,
|
|
1110
|
+
};
|
|
1111
|
+
// Check for inline array-derived patterns (.some(), .every(), .includes(), .length)
|
|
1112
|
+
// This populates derivedFrom so downstream code can resolve to the base array path
|
|
1113
|
+
const arrayDerived = detectArrayDerivedPattern(unwrapped);
|
|
1114
|
+
if (arrayDerived) {
|
|
1115
|
+
usage.derivedFrom = {
|
|
1116
|
+
operation: arrayDerived.operation,
|
|
1117
|
+
sourcePath: arrayDerived.sourcePath,
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
// Add chain info if part of a compound conditional
|
|
1121
|
+
if (chainInfo) {
|
|
1122
|
+
usage.chainId = chainInfo.chainId;
|
|
1123
|
+
usage.chainPosition = chainInfo.currentPosition;
|
|
1124
|
+
usage.chainLength = chainInfo.chainLength;
|
|
1125
|
+
usage.chainExpression = chainInfo.chainExpression;
|
|
1126
|
+
chainInfo.currentPosition++;
|
|
1127
|
+
// Add to compound conditional conditions
|
|
1128
|
+
// For truthiness, requiredValue is true if not negated, false if negated
|
|
1129
|
+
chainInfo.compound.conditions.push({
|
|
1130
|
+
path: pathStr,
|
|
1131
|
+
conditionType: 'truthiness',
|
|
1132
|
+
isNegated,
|
|
1133
|
+
requiredValue: !isNegated,
|
|
1134
|
+
...(chainInfo.currentOrGroupId && {
|
|
1135
|
+
orGroupId: chainInfo.currentOrGroupId,
|
|
1136
|
+
}),
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
context.addConditionalUsage(usage);
|
|
160
1140
|
}
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
// Handle prefix unary NOT expression: !variable
|
|
164
|
-
// Example: `if (!isVisible)` - isVisible is a truthiness check
|
|
165
|
-
if (ts.isPrefixUnaryExpression(unwrapped) &&
|
|
166
|
-
unwrapped.operator === ts.SyntaxKind.ExclamationToken) {
|
|
167
|
-
extractConditionalUsage(unwrapped.operand, context, location);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
// Handle simple identifiers or property accesses (truthiness checks)
|
|
171
|
-
// Example: `if (x)` or `x && <JSX />` - x is checked for truthiness
|
|
172
|
-
const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
|
|
173
|
-
if (path && !path.isLiteral()) {
|
|
174
|
-
context.addConditionalUsage({
|
|
175
|
-
path: path.toLeftHandSideString(),
|
|
176
|
-
conditionType: 'truthiness',
|
|
177
|
-
location,
|
|
178
|
-
});
|
|
179
1141
|
}
|
|
1142
|
+
// Start extraction with no chain info
|
|
1143
|
+
extractWithChainTracking(condition, null, false);
|
|
180
1144
|
}
|
|
181
1145
|
/**
|
|
182
1146
|
* Helper to check if an expression is a literal value
|
|
@@ -254,7 +1218,24 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
254
1218
|
unwrappedNode.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
255
1219
|
markConditionVariablesAsNullable(unwrappedNode, context);
|
|
256
1220
|
// Extract conditional usages for key attribute detection
|
|
257
|
-
|
|
1221
|
+
// Only call from the OUTERMOST && expression to avoid duplicates
|
|
1222
|
+
// Check if parent is also a && (meaning we're nested)
|
|
1223
|
+
const parent = unwrappedNode.parent;
|
|
1224
|
+
const parentIsAndChain = parent &&
|
|
1225
|
+
ts.isBinaryExpression(parent) &&
|
|
1226
|
+
parent.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken;
|
|
1227
|
+
if (!parentIsAndChain) {
|
|
1228
|
+
extractConditionalUsage(unwrappedNode, context, 'logical-and');
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
// CRITICAL: Extract conditionals from JSX BEFORE checking child boundaries
|
|
1232
|
+
// JSX elements are NOT scopes - their expressions use variables from the parent scope.
|
|
1233
|
+
// Even if the JSX element is within a child boundary (e.g., because it contains callbacks),
|
|
1234
|
+
// we must still extract conditionals from JSX expression children like {x && <div>...</div>}
|
|
1235
|
+
if (ts.isJsxElement(unwrappedNode) ||
|
|
1236
|
+
ts.isJsxSelfClosingElement(unwrappedNode) ||
|
|
1237
|
+
ts.isJsxFragment(unwrappedNode)) {
|
|
1238
|
+
extractConditionalsFromJsx(unwrappedNode, context);
|
|
258
1239
|
}
|
|
259
1240
|
// If the node falls within an excluded child scope, stop processing it.
|
|
260
1241
|
if (context.isChildBoundary(node)) {
|
|
@@ -284,15 +1265,21 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
284
1265
|
const equivalentVariables = context.getEquivalentVariables();
|
|
285
1266
|
const structure = context.getStructure();
|
|
286
1267
|
// Propagate existing equivalencies for sub-properties
|
|
287
|
-
for (const [key,
|
|
1268
|
+
for (const [key, rawValue] of Object.entries(equivalentVariables)) {
|
|
288
1269
|
// Check if this equivalency is for a sub-property of the identifier
|
|
289
1270
|
// e.g., completeDataStructure['Function Arguments'] or completeDataStructure.foo
|
|
290
1271
|
if (key.startsWith(nodePathStr + '.') ||
|
|
291
1272
|
key.startsWith(nodePathStr + '[')) {
|
|
292
1273
|
const subPath = key.substring(nodePathStr.length);
|
|
293
1274
|
const newTargetPath = StructuredPath.fromBase(targetPath.toString() + subPath);
|
|
294
|
-
|
|
295
|
-
|
|
1275
|
+
// Handle both string and string[] values
|
|
1276
|
+
const values = Array.isArray(rawValue) ? rawValue : [rawValue];
|
|
1277
|
+
for (const value of values) {
|
|
1278
|
+
if (typeof value === 'string') {
|
|
1279
|
+
const valuePath = StructuredPath.fromBase(value);
|
|
1280
|
+
context.addEquivalence(newTargetPath, valuePath);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
296
1283
|
}
|
|
297
1284
|
}
|
|
298
1285
|
// Propagate existing structure entries for sub-properties
|
|
@@ -386,7 +1373,8 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
386
1373
|
const propertyPath = objectPath.withProperty(unwrappedNode.name.text);
|
|
387
1374
|
// Check if this is an environment variable access
|
|
388
1375
|
const fullText = unwrappedNode.getText(context.sourceFile);
|
|
389
|
-
if (fullText.includes('.env.') //
|
|
1376
|
+
if (fullText.includes('.env.') || // process.env.X, window.env.X
|
|
1377
|
+
isEnvStoreAccess(fullText) // env.X where env is likely an env config object
|
|
390
1378
|
) {
|
|
391
1379
|
context.addEnvironmentVariable(fullText);
|
|
392
1380
|
}
|
|
@@ -610,6 +1598,13 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
610
1598
|
// e.g., `const tab = segments[0] || 'default'` should trace tab back to segments[0]
|
|
611
1599
|
if (operatorKind === ts.SyntaxKind.QuestionQuestionToken) {
|
|
612
1600
|
// specifically for ?? we create an equivalence to the left side
|
|
1601
|
+
// IMPORTANT: Also process the left side recursively to apply method semantics
|
|
1602
|
+
// (e.g., for `const segments = splat?.split('/') ?? []`, we need split semantics)
|
|
1603
|
+
processExpression({
|
|
1604
|
+
node: unwrappedNode.left,
|
|
1605
|
+
context,
|
|
1606
|
+
// Don't pass targetPath here - we'll establish equivalence separately below
|
|
1607
|
+
});
|
|
613
1608
|
if (targetPath) {
|
|
614
1609
|
resultPath = StructuredPath.fromNode(unwrappedNode.left, context.sourceFile);
|
|
615
1610
|
}
|
|
@@ -620,12 +1615,46 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
620
1615
|
}
|
|
621
1616
|
}
|
|
622
1617
|
else if (operatorKind === ts.SyntaxKind.BarBarToken) {
|
|
623
|
-
// For ||,
|
|
1618
|
+
// For ||, create equivalences to BOTH sides
|
|
624
1619
|
// This enables data flow tracing through fallback expressions
|
|
1620
|
+
// e.g., `const item = items.find(...) || null` should trace to both:
|
|
1621
|
+
// - items[] (from the find result)
|
|
1622
|
+
// - null (from the fallback)
|
|
625
1623
|
if (targetPath) {
|
|
626
|
-
|
|
1624
|
+
// Get paths for both sides
|
|
1625
|
+
const leftPath = StructuredPath.fromNode(unwrappedNode.left, context.sourceFile);
|
|
1626
|
+
const rightPath = StructuredPath.fromNode(unwrappedNode.right, context.sourceFile);
|
|
1627
|
+
// Collect all valid paths
|
|
1628
|
+
const allPaths = [];
|
|
1629
|
+
if (leftPath)
|
|
1630
|
+
allPaths.push(leftPath);
|
|
1631
|
+
if (rightPath)
|
|
1632
|
+
allPaths.push(rightPath);
|
|
1633
|
+
// Add multiple equivalencies to track both sources
|
|
1634
|
+
if (allPaths.length > 0) {
|
|
1635
|
+
context.addMultipleEquivalencies(targetPath, allPaths);
|
|
1636
|
+
}
|
|
1637
|
+
// Process both sides to capture their internal structures
|
|
1638
|
+
processExpression({
|
|
1639
|
+
node: unwrappedNode.left,
|
|
1640
|
+
context,
|
|
1641
|
+
});
|
|
1642
|
+
processExpression({
|
|
1643
|
+
node: unwrappedNode.right,
|
|
1644
|
+
context,
|
|
1645
|
+
});
|
|
1646
|
+
// Register the type for the target path
|
|
1647
|
+
const leftType = context.inferTypeFromNode(unwrappedNode.left);
|
|
1648
|
+
const rightType = context.inferTypeFromNode(unwrappedNode.right);
|
|
1649
|
+
const orResultType = isDefinedType(leftType)
|
|
1650
|
+
? leftType
|
|
1651
|
+
: rightType || 'unknown';
|
|
1652
|
+
context.addType(targetPath, orResultType);
|
|
1653
|
+
// Return early - we've already handled equivalencies with addMultipleEquivalencies
|
|
1654
|
+
// Don't fall through to the generic addEquivalence call below
|
|
1655
|
+
return true;
|
|
627
1656
|
}
|
|
628
|
-
// Note:
|
|
1657
|
+
// Note: When there's no targetPath, we don't recursively process
|
|
629
1658
|
// because || is often used in boolean contexts where the full expression matters
|
|
630
1659
|
}
|
|
631
1660
|
}
|
|
@@ -666,9 +1695,10 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
666
1695
|
context.markUnsupported(unwrappedNode.expression, `processExpression: Couldn't get path for called expression: ${ts.SyntaxKind[unwrappedNode.expression.kind]}`, false);
|
|
667
1696
|
return false;
|
|
668
1697
|
}
|
|
669
|
-
//
|
|
670
|
-
//
|
|
671
|
-
|
|
1698
|
+
// Build call path using original source text for consistent schema paths.
|
|
1699
|
+
// IMPORTANT: Never use cyScope names in call paths - they are internal identifiers
|
|
1700
|
+
// that should not appear in schema paths or call signatures.
|
|
1701
|
+
const callPath = buildCallPathFromSource(unwrappedNode, context);
|
|
672
1702
|
// 2. Process all arguments recursively WITH targetPath for proper equivalence
|
|
673
1703
|
for (let i = 0; i < unwrappedNode.arguments.length; i++) {
|
|
674
1704
|
const arg = unwrappedNode.arguments[i];
|
|
@@ -702,18 +1732,44 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
702
1732
|
const semantics = semanticsList[0];
|
|
703
1733
|
// Get the source expression path (e.g., the object for obj.method())
|
|
704
1734
|
const sourceExpr = unwrappedNode.expression.expression;
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
1735
|
+
const unwrappedSourceExpr = unwrapExpression(sourceExpr);
|
|
1736
|
+
// When the source is a ternary expression like (cond ? arr : arr.slice()),
|
|
1737
|
+
// apply method semantics to BOTH branches directly. The ternary itself isn't
|
|
1738
|
+
// a variable - it's just a choice between two paths that both flow to the result.
|
|
1739
|
+
if (ts.isConditionalExpression(unwrappedSourceExpr)) {
|
|
1740
|
+
const branches = [
|
|
1741
|
+
unwrappedSourceExpr.whenTrue,
|
|
1742
|
+
unwrappedSourceExpr.whenFalse,
|
|
1743
|
+
];
|
|
1744
|
+
for (const branch of branches) {
|
|
1745
|
+
const branchPath = StructuredPath.fromNode(branch, context.sourceFile);
|
|
1746
|
+
if (branchPath) {
|
|
1747
|
+
const isArraySemantics = semantics instanceof ArrayPushSemantics;
|
|
1748
|
+
const shouldApply = !isArraySemantics ||
|
|
1749
|
+
isLikelyArrayType(branch, context.typeChecker);
|
|
1750
|
+
if (shouldApply) {
|
|
1751
|
+
semantics.addEquivalences(callPath, branchPath, context);
|
|
1752
|
+
returnType = semantics.getReturnType();
|
|
1753
|
+
handledBySemantics = true;
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
else {
|
|
1759
|
+
// Regular (non-ternary) source expression
|
|
1760
|
+
const sourcePath = StructuredPath.fromNode(sourceExpr, context.sourceFile);
|
|
1761
|
+
if (sourcePath) {
|
|
1762
|
+
// For array-specific semantics (like push), verify the source is actually an array
|
|
1763
|
+
// This prevents router.push() from being mistakenly treated as Array.push()
|
|
1764
|
+
const isArraySemantics = semantics instanceof ArrayPushSemantics;
|
|
1765
|
+
const shouldApply = !isArraySemantics ||
|
|
1766
|
+
isLikelyArrayType(sourceExpr, context.typeChecker);
|
|
1767
|
+
if (shouldApply) {
|
|
1768
|
+
// Apply method semantics
|
|
1769
|
+
semantics.addEquivalences(callPath, sourcePath, context);
|
|
1770
|
+
returnType = semantics.getReturnType();
|
|
1771
|
+
handledBySemantics = true;
|
|
1772
|
+
}
|
|
717
1773
|
}
|
|
718
1774
|
}
|
|
719
1775
|
}
|
|
@@ -798,6 +1854,12 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
798
1854
|
}
|
|
799
1855
|
// Create a path for this property within the base
|
|
800
1856
|
const propPath = targetPath.withProperty(propName);
|
|
1857
|
+
// Handle child boundaries (callback functions) in object properties
|
|
1858
|
+
// This establishes equivalency between the property path and the child scope
|
|
1859
|
+
// e.g., columns[0].renderCell → cyScope1()
|
|
1860
|
+
if (context.isChildBoundary(property.initializer)) {
|
|
1861
|
+
context.addChildBoundaryEquivalence(propPath, property.initializer);
|
|
1862
|
+
}
|
|
801
1863
|
// Process the property value with propPath as targetPath
|
|
802
1864
|
// This allows nested object literals to work correctly
|
|
803
1865
|
processExpression({
|
|
@@ -1032,14 +2094,24 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
1032
2094
|
markConditionVariablesAsNullable(unwrappedNode.condition, context);
|
|
1033
2095
|
// Extract conditional usages for key attribute detection
|
|
1034
2096
|
extractConditionalUsage(unwrappedNode.condition, context, 'ternary');
|
|
2097
|
+
// Extract conditional effects (setter calls in ternary branches)
|
|
2098
|
+
const knownSetters = findUseStateSetters(context.sourceFile);
|
|
2099
|
+
const effects = extractConditionalEffectsFromTernary(unwrappedNode, context, knownSetters);
|
|
2100
|
+
for (const effect of effects) {
|
|
2101
|
+
context.addConditionalEffect(effect);
|
|
2102
|
+
}
|
|
1035
2103
|
// Process all parts recursively
|
|
1036
2104
|
processExpression({
|
|
1037
2105
|
node: unwrappedNode.condition,
|
|
1038
2106
|
context,
|
|
1039
2107
|
typeHint: 'boolean | unknown',
|
|
1040
2108
|
}); //TODO: could we capture that this is evidence of a boolean type?
|
|
1041
|
-
|
|
1042
|
-
|
|
2109
|
+
// Process both branches WITH targetPath to establish equivalencies
|
|
2110
|
+
// This is critical for tracing nested properties through ternary assignments
|
|
2111
|
+
// e.g., const items = condition ? arr1 : arr2; items.map(i => i.prop)
|
|
2112
|
+
// We need items to be equivalent to both arr1 AND arr2 for proper tracing
|
|
2113
|
+
processExpression({ node: unwrappedNode.whenTrue, context, targetPath });
|
|
2114
|
+
processExpression({ node: unwrappedNode.whenFalse, context, targetPath });
|
|
1043
2115
|
// Create a path for the whole expression
|
|
1044
2116
|
const expressionSourcePath = nodeToSource(unwrappedNode, context.sourceFile);
|
|
1045
2117
|
// Infer type based on branches
|
|
@@ -1054,10 +2126,22 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
1054
2126
|
}
|
|
1055
2127
|
// Register type for the expression
|
|
1056
2128
|
context.addType(expressionSourcePath, resultType);
|
|
1057
|
-
// If targetPath is provided,
|
|
2129
|
+
// If targetPath is provided, only register type (don't overwrite branch equivalencies)
|
|
2130
|
+
// The equivalencies to individual branches (set above) are more useful for tracing
|
|
2131
|
+
// than an equivalency to the entire ternary expression text
|
|
1058
2132
|
if (targetPath) {
|
|
1059
|
-
|
|
1060
|
-
|
|
2133
|
+
// NOTE: We intentionally do NOT add equivalence here.
|
|
2134
|
+
// The branch processing above already added equivalencies:
|
|
2135
|
+
// targetPath -> whenTrue branch
|
|
2136
|
+
// targetPath -> whenFalse branch
|
|
2137
|
+
// Adding an equivalence to expressionSourcePath would overwrite those
|
|
2138
|
+
// with a useless equivalence to the ternary text itself.
|
|
2139
|
+
//
|
|
2140
|
+
// Use updateSchemaType instead of addType because:
|
|
2141
|
+
// 1. Branch processing may have already set a type on targetPath
|
|
2142
|
+
// 2. addType has a guard that prevents overwriting specific types with 'unknown'
|
|
2143
|
+
// 3. updateSchemaType bypasses this guard, ensuring the ternary's computed type is used
|
|
2144
|
+
context.updateSchemaType(targetPath, resultType);
|
|
1061
2145
|
}
|
|
1062
2146
|
return true;
|
|
1063
2147
|
}
|
|
@@ -1114,6 +2198,32 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
1114
2198
|
}
|
|
1115
2199
|
// Handle Arrow Functions: (p) => p.prop, (a, b) => { ... }
|
|
1116
2200
|
if (ts.isArrowFunction(unwrappedNode)) {
|
|
2201
|
+
// If this arrow function is a child boundary (e.g., a .map() callback),
|
|
2202
|
+
// don't process its parameters here - they will be processed when the
|
|
2203
|
+
// child scope is analyzed separately. This prevents parameter variables
|
|
2204
|
+
// from leaking into the parent scope's equivalencies.
|
|
2205
|
+
// Check if this arrow function is a child boundary (i.e., should be processed
|
|
2206
|
+
// as a separate child scope, not here in the parent scope).
|
|
2207
|
+
//
|
|
2208
|
+
// We use two checks because childBoundary positions can be unreliable:
|
|
2209
|
+
// 1. Position-based check (standard isChildBoundary)
|
|
2210
|
+
// 2. Text-based check: if the arrow function text doesn't appear in the
|
|
2211
|
+
// statement text, it was replaced with a cyScope placeholder
|
|
2212
|
+
const isChildBoundary = context.isChildBoundary(unwrappedNode);
|
|
2213
|
+
// Text-based child scope detection for when positions are unreliable
|
|
2214
|
+
const arrowFnText = unwrappedNode.getText(context.sourceFile);
|
|
2215
|
+
const firstLine = arrowFnText.split('\n')[0].trim();
|
|
2216
|
+
const searchText = firstLine.substring(0, Math.min(20, firstLine.length));
|
|
2217
|
+
const isInStatementText = context.statementInfo.text.includes(searchText);
|
|
2218
|
+
const isChildScope = !isInStatementText && arrowFnText.length > 10;
|
|
2219
|
+
if (isChildBoundary || isChildScope) {
|
|
2220
|
+
// The method semantics (e.g., ArrayMapSemantics) have already established
|
|
2221
|
+
// the necessary equivalences between the child scope placeholder and array elements
|
|
2222
|
+
if (targetPath) {
|
|
2223
|
+
context.addType(targetPath, 'function');
|
|
2224
|
+
}
|
|
2225
|
+
return true;
|
|
2226
|
+
}
|
|
1117
2227
|
// Create a path for the function
|
|
1118
2228
|
const functionPath = StructuredPath.empty();
|
|
1119
2229
|
// Process parameters
|
|
@@ -1405,6 +2515,15 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
1405
2515
|
for (const child of unwrappedNode.children) {
|
|
1406
2516
|
// Process expressions in JSX children: <div>{expr}</div>
|
|
1407
2517
|
if (ts.isJsxExpression(child) && child.expression) {
|
|
2518
|
+
// When processing return value JSX, link root variables to return value schema
|
|
2519
|
+
if (targetPath && targetPath.base !== '') {
|
|
2520
|
+
const varNames = [
|
|
2521
|
+
...new Set(extractRootVariableNames(child.expression)),
|
|
2522
|
+
];
|
|
2523
|
+
for (const varName of varNames) {
|
|
2524
|
+
context.addEquivalence(targetPath.withProperty(varName), StructuredPath.fromBase(varName));
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
1408
2527
|
// Process the expression with StructuredPath.empty() as targetPath
|
|
1409
2528
|
// to trigger type registration without imposing prefix
|
|
1410
2529
|
processExpression({
|
|
@@ -1435,6 +2554,15 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
1435
2554
|
for (const child of unwrappedNode.children) {
|
|
1436
2555
|
// Process expressions in JSX children: <>{expr}</>
|
|
1437
2556
|
if (ts.isJsxExpression(child) && child.expression) {
|
|
2557
|
+
// When processing return value JSX, link root variables to return value schema
|
|
2558
|
+
if (targetPath && targetPath.base !== '') {
|
|
2559
|
+
const varNames = [
|
|
2560
|
+
...new Set(extractRootVariableNames(child.expression)),
|
|
2561
|
+
];
|
|
2562
|
+
for (const varName of varNames) {
|
|
2563
|
+
context.addEquivalence(targetPath.withProperty(varName), StructuredPath.fromBase(varName));
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
1438
2566
|
// Process the expression to extract structure
|
|
1439
2567
|
processExpression({
|
|
1440
2568
|
node: child.expression,
|
|
@@ -1618,6 +2746,9 @@ function processJsxAttribute(attr, context, componentPath, targetPath) {
|
|
|
1618
2746
|
if (ts.isJsxExpression(attr.initializer) && attr.initializer.expression) {
|
|
1619
2747
|
const expression = attr.initializer.expression;
|
|
1620
2748
|
if (context.isChildBoundary(expression)) {
|
|
2749
|
+
// Create equivalency between attribute path and child scope
|
|
2750
|
+
// e.g., Grid().signature[0].renderRow → cyScope1()
|
|
2751
|
+
context.addChildBoundaryEquivalence(attributePath, expression);
|
|
1621
2752
|
return true;
|
|
1622
2753
|
}
|
|
1623
2754
|
// Process the expression with attributePath as targetPath
|