@codeyam/codeyam-cli 0.1.0-staging.b8a55ba → 0.1.0-staging.c90f8c9
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 +9 -6
- package/analyzer-template/packages/ai/index.ts +10 -3
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +126 -6
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +116 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +140 -6
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +15 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +849 -9
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +244 -0
- 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 +892 -117
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +2 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +296 -35
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +120 -76
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +80 -5
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +8 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -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 +86 -142
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +1 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1111 -87
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +191 -191
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +570 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1977 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +5 -5
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +276 -3
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +33 -3
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -142
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +90 -6
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -89
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +11 -11
- package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +812 -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 +118 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +14 -0
- 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/files/analyze/analyzeEntities/prepareDataStructures.ts +381 -265
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +18 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -7
- 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/enums/steps.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +148 -41
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +506 -59
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +157 -74
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +156 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +35 -129
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -3
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +420 -87
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
- package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
- package/analyzer-template/packages/aws/package.json +3 -3
- package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
- package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
- package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
- package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +17 -1
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +16 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +7 -3
- 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/scenarioComponentForServer.ts +114 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -18
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +17 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/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/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/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 +13 -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/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.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/scenarioComponentForServer.d.ts +8 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts +3 -4
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js +0 -1
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +71 -27
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/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/Scenario.d.ts +9 -54
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +1 -21
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +148 -0
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
- package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
- package/analyzer-template/packages/process/index.ts +2 -0
- package/analyzer-template/packages/process/package.json +12 -0
- package/analyzer-template/packages/process/tsconfig.json +8 -0
- package/analyzer-template/packages/types/index.ts +3 -6
- package/analyzer-template/packages/types/src/types/Analysis.ts +87 -27
- package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +9 -77
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +175 -0
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/index.d.ts +3 -4
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js +0 -1
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +71 -27
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/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/Scenario.d.ts +9 -54
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +1 -21
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +148 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.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/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/safeFileName.ts +48 -3
- package/analyzer-template/playwright/capture.ts +37 -18
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/analyzeBaselineCommit.ts +4 -0
- package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
- package/analyzer-template/project/analyzeFileEntities.ts +4 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +4 -0
- package/analyzer-template/project/constructMockCode.ts +1112 -169
- package/analyzer-template/project/controller/startController.ts +16 -1
- package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
- package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +7 -1
- package/analyzer-template/project/orchestrateCapture.ts +36 -3
- package/analyzer-template/project/reconcileMockDataKeys.ts +220 -78
- package/analyzer-template/project/runAnalysis.ts +11 -0
- package/analyzer-template/project/serverOnlyModules.ts +127 -2
- package/analyzer-template/project/start.ts +16 -4
- package/analyzer-template/project/startScenarioCapture.ts +6 -0
- package/analyzer-template/project/writeMockDataTsx.ts +164 -24
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +304 -112
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +11 -35
- package/analyzer-template/scripts/comboWorkerLoop.cjs +1 -0
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/analyzer-template/tsconfig.json +2 -1
- package/background/src/lib/local/createLocalAnalyzer.js +1 -29
- 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 +2 -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 +2 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +987 -130
- 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/executeLibraryFunctionDirect.js +6 -3
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.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/KyselyAnalysisLoader.js +3 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +3 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +27 -4
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +188 -47
- 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/serverOnlyModules.js +106 -3
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +15 -4
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +7 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +139 -23
- 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 +228 -95
- 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 +11 -34
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/src/cli.js +5 -1
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +1 -1
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +174 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -0
- package/codeyam-cli/src/commands/debug.js +28 -18
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +0 -15
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +29 -18
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/report.js +46 -1
- package/codeyam-cli/src/commands/report.js.map +1 -1
- package/codeyam-cli/src/commands/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 +1 -1
- package/codeyam-cli/src/commands/test-startup.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__/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 +31 -27
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +28 -14
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +12 -2
- 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 +4 -3
- 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 +31 -17
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +105 -0
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +6 -0
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +7 -5
- 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/app/lib/database.js +73 -20
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +40 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BXhEawa3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CzGX-miz.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-Ba2JVPzP.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-C8lyxW9k.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-aht4aafF.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CBQPrpT0.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-D1CdlbrV.js → LoadingDots-B0GLXMsr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-wDPcZNKx.js → LogViewer-xgeCVgSM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-D4TZhLuw.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-BfmDgXxG.js → SafeScreenshot-DuDvi0jm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DEx02QDa.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-6J7zDUD5.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-BwqWJOgH.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DoLIqZX2.js +37 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BYimnrHg.js → chevron-down-Cx24_aWc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-CXRTFQ3F.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CaVsIRxt.js → circle-check-BOARzkeR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CgUsG7ib.js → createLucideIcon-BdhJEx6B.js} +1 -1
- 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-BRb-0kQl.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-zUEpfPsu.js → entity._sha._-C2N4Op8e.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D1T4TGjf.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CfLCUi9S.js → entity._sha_.edit._scenarioId-CTBG2mmz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DKJyZfAY.js → entry.client-CS2cb_eZ.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DAtOlaWE.js → fileTableUtils-DMJ7zii9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-Cs4MdYtv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{git-D62Lxxmv.js → git-B4RJRvYB.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/git-commit-horizontal-CysbcZxi.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-DMUaGAqV.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-CzNNiTkw.js → index-B1h680n5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-BosqDOlH.js → index-lzqtyFU8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CNp9QFCX.js → loader-circle-B7B9V-bu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-f874c610.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-Bz5TunQg.js +57 -0
- package/codeyam-cli/src/webserver/build/client/assets/rules-hEkvVw2-.js +97 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-DDGjYAMJ.js → search-CxXUmBSd.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-CS5f3WzT.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DwFIBT09.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CBc5dE1s.js → triangle-alert-B6LgvRJg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C1v1PQzo.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BqPPNjAl.js → useLastLogLine-aSv48UbS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DYxHZQuP.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-DWHcCcl1.js → useToast-mBRpZPiu.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-uNNbimct.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-B08qC4Y7.js +257 -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/server.js +35 -25
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/codeyam-power-rules-hook.sh +200 -0
- package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam:debug.md} +48 -4
- package/codeyam-cli/templates/{debug-codeyam.md → codeyam:diagnose.md} +185 -23
- package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
- package/codeyam-cli/templates/codeyam:power-rules.md +449 -0
- package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam:setup.md} +139 -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/package.json +6 -5
- package/packages/ai/index.js +5 -4
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +97 -0
- 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 +84 -1
- 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 +97 -6
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +7 -0
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +654 -13
- package/packages/ai/src/lib/astScopes/processExpression.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 +715 -64
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +2 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +230 -23
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +77 -55
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +67 -3
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.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/fillInSchemaGapsAndUnknowns.js +6 -1
- 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 +111 -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 +78 -120
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +1 -0
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +906 -82
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +170 -162
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +392 -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 +1440 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -2
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +231 -4
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +26 -3
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -100
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +68 -6
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -70
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +9 -9
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
- package/packages/ai/src/lib/resolvePathToControllable.js +667 -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/analyze/src/lib/FileAnalyzer.js +15 -0
- package/packages/analyze/src/lib/FileAnalyzer.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/files/analyze/analyzeEntities/prepareDataStructures.js +151 -52
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +10 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.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/validateDependencyAnalyses.js +31 -7
- 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/enums/steps.js +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +121 -37
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +410 -55
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +126 -57
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +96 -0
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +27 -98
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -3
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +342 -83
- 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/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/kysely/tables/debugReportsTable.js.map +1 -1
- package/packages/database/src/lib/loadAnalyses.js +45 -2
- package/packages/database/src/lib/loadAnalyses.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +13 -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/loadReadyToBeCapturedAnalyses.js +7 -4
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.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/scenarioComponentForServer.js +89 -0
- package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
- package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
- package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/packages/process/index.js +3 -0
- package/packages/process/index.js.map +1 -0
- package/packages/process/src/GlobalProcessManager.js.map +1 -0
- package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
- package/packages/process/src/ProcessManager.js.map +1 -0
- package/packages/process/src/index.js.map +1 -0
- package/packages/process/src/managedExecAsync.js.map +1 -0
- package/packages/types/index.js +0 -1
- package/packages/types/index.js.map +1 -1
- package/packages/types/src/types/Scenario.js +1 -21
- package/packages/types/src/types/Scenario.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 +3 -3
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -409
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -288
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -495
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -120
- package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
- package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
- package/analyzer-template/process/README.md +0 -507
- package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
- package/background/src/lib/process/ProcessManager.js.map +0 -1
- package/background/src/lib/process/index.js.map +0 -1
- package/background/src/lib/process/managedExecAsync.js.map +0 -1
- package/codeyam-cli/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/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js +0 -7
- package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-2mG6mjVb.js +0 -32
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +0 -51
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-C6vQASxy.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-09d684be.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-BxJUvKau.js +0 -56
- package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CV6i1S1A.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BDlyhfrv.js +0 -175
- package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
- package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -298
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -226
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -408
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/isFrontend.js +0 -5
- package/packages/ai/src/lib/isFrontend.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -77
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
- /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.link-scenario-value-l0sNRNKZ.js → api.health-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-key-attributes-l0sNRNKZ.js → api.restart-server-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-valid-values-l0sNRNKZ.js → api.rules-l0sNRNKZ.js} +0 -0
- /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
|
@@ -5,6 +5,120 @@ import { nodeToSource } from "./nodeToSource.js";
|
|
|
5
5
|
import { methodRegistry, ArrayPushSemantics } from "./methodSemantics.js";
|
|
6
6
|
import { isArithmeticOperator, isAssignmentOperator, isBitwiseCompoundOperator, isComparisonOperator, isDefinedType, isNumericCompoundOperator, leftOrRightType, unwrapExpression, } from "./sharedPatterns.js";
|
|
7
7
|
import { processBindingPattern } from "./processBindings.js";
|
|
8
|
+
import { extractConditionalEffectsFromTernary, findUseStateSetters, } from "./conditionalEffectsExtractor.js";
|
|
9
|
+
import { detectArrayDerivedPattern } from "./arrayDerivationDetector.js";
|
|
10
|
+
/**
|
|
11
|
+
* Extracts the component name from a JSX element.
|
|
12
|
+
* Returns null for intrinsic elements (div, span, etc.) since we only care about
|
|
13
|
+
* custom components for gating condition tracking.
|
|
14
|
+
*
|
|
15
|
+
* Examples:
|
|
16
|
+
* - <ChildViewer /> → "ChildViewer"
|
|
17
|
+
* - <ScenarioViewer scenario={...} /> → "ScenarioViewer"
|
|
18
|
+
* - <div> → null (intrinsic element)
|
|
19
|
+
*/
|
|
20
|
+
function getComponentNameFromJsx(node) {
|
|
21
|
+
let tagName;
|
|
22
|
+
if (ts.isJsxElement(node)) {
|
|
23
|
+
tagName = node.openingElement.tagName;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
tagName = node.tagName;
|
|
27
|
+
}
|
|
28
|
+
// Get the text of the tag name
|
|
29
|
+
const name = tagName.getText();
|
|
30
|
+
// Check if it's a custom component (starts with uppercase) vs intrinsic element
|
|
31
|
+
// Custom components start with uppercase: <MyComponent />
|
|
32
|
+
// Intrinsic elements start with lowercase: <div />
|
|
33
|
+
if (name &&
|
|
34
|
+
name[0] === name[0].toUpperCase() &&
|
|
35
|
+
name[0] !== name[0].toLowerCase()) {
|
|
36
|
+
return name;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Extracts condition paths from a logical AND chain expression.
|
|
42
|
+
* Used for creating gating conditions for child components.
|
|
43
|
+
*
|
|
44
|
+
* Example: `hasData && isReady && <Component />` returns ['hasData', 'isReady']
|
|
45
|
+
*/
|
|
46
|
+
function extractConditionPathsFromAndChain(expr, sourceFile) {
|
|
47
|
+
const paths = [];
|
|
48
|
+
const unwrapped = unwrapExpression(expr);
|
|
49
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
50
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
51
|
+
// Recursively get conditions from left side
|
|
52
|
+
paths.push(...extractConditionPathsFromAndChain(unwrapped.left, sourceFile));
|
|
53
|
+
// Process right side if it's not JSX (JSX is the consequence, not a condition)
|
|
54
|
+
const rightUnwrapped = unwrapExpression(unwrapped.right);
|
|
55
|
+
if (!ts.isJsxElement(rightUnwrapped) &&
|
|
56
|
+
!ts.isJsxSelfClosingElement(rightUnwrapped) &&
|
|
57
|
+
!ts.isJsxFragment(rightUnwrapped)) {
|
|
58
|
+
paths.push(...extractConditionPathsFromAndChain(unwrapped.right, sourceFile));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// Base case: extract path from this expression
|
|
63
|
+
const path = StructuredPath.fromNode(unwrapped, sourceFile);
|
|
64
|
+
if (path) {
|
|
65
|
+
paths.push(path.toString());
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return paths;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Finds the rightmost JSX element in an && chain.
|
|
72
|
+
* Example: `a && b && <Component />` returns <Component />
|
|
73
|
+
*/
|
|
74
|
+
function findJsxInAndChain(expr) {
|
|
75
|
+
const unwrapped = unwrapExpression(expr);
|
|
76
|
+
if (ts.isJsxElement(unwrapped) || ts.isJsxSelfClosingElement(unwrapped)) {
|
|
77
|
+
return unwrapped;
|
|
78
|
+
}
|
|
79
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
80
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
81
|
+
// Check right side first (most common case: condition && <Jsx />)
|
|
82
|
+
const rightResult = findJsxInAndChain(unwrapped.right);
|
|
83
|
+
if (rightResult)
|
|
84
|
+
return rightResult;
|
|
85
|
+
// Also check left side for rare cases
|
|
86
|
+
return findJsxInAndChain(unwrapped.left);
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Fix 32: Finds a JSX fragment in an && chain.
|
|
92
|
+
* Example: `activeTab && <><ChildA /><ChildB /></>` returns the fragment
|
|
93
|
+
* This is needed to propagate parent conditions through fragments.
|
|
94
|
+
*/
|
|
95
|
+
function findJsxFragmentInAndChain(expr) {
|
|
96
|
+
const unwrapped = unwrapExpression(expr);
|
|
97
|
+
if (ts.isJsxFragment(unwrapped)) {
|
|
98
|
+
return unwrapped;
|
|
99
|
+
}
|
|
100
|
+
if (ts.isBinaryExpression(unwrapped) &&
|
|
101
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
102
|
+
// Check right side first (most common case: condition && <></>)
|
|
103
|
+
const rightResult = findJsxFragmentInAndChain(unwrapped.right);
|
|
104
|
+
if (rightResult)
|
|
105
|
+
return rightResult;
|
|
106
|
+
// Also check left side for rare cases
|
|
107
|
+
return findJsxFragmentInAndChain(unwrapped.left);
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Detects if a property access looks like an environment variable store access.
|
|
113
|
+
* Matches patterns like `env.DATABASE_URL`, `env.IS_FORMBRICKS_CLOUD`, etc.
|
|
114
|
+
* where the object is named "env" and the property looks like an env var name.
|
|
115
|
+
*/
|
|
116
|
+
function isEnvStoreAccess(fullText) {
|
|
117
|
+
// Match: env.SOME_VAR or env.someVar (but object must be exactly "env")
|
|
118
|
+
// This catches patterns from @t3-oss/env-nextjs and similar packages
|
|
119
|
+
const envStorePattern = /^env\.[A-Z_][A-Z0-9_]*$/;
|
|
120
|
+
return envStorePattern.test(fullText);
|
|
121
|
+
}
|
|
8
122
|
/**
|
|
9
123
|
* Converts a call expression argument to a StructuredPath.
|
|
10
124
|
*
|
|
@@ -160,6 +274,123 @@ function getSourceLocation(node, sourceFile) {
|
|
|
160
274
|
: codeSnippet,
|
|
161
275
|
};
|
|
162
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* Extracts the root array path from an expression that ends with .map().
|
|
279
|
+
* Handles chained methods like .filter().map(), .slice().map(), etc.
|
|
280
|
+
*
|
|
281
|
+
* Examples:
|
|
282
|
+
* - items.map(...) → "items"
|
|
283
|
+
* - data.users.map(...) → "data.users"
|
|
284
|
+
* - items.filter(...).map(...) → "items"
|
|
285
|
+
* - items.slice(0, 5).map(...) → "items"
|
|
286
|
+
*/
|
|
287
|
+
function extractArrayPathFromMapCall(expr, sourceFile) {
|
|
288
|
+
// Walk up the chain to find the root array
|
|
289
|
+
let current = expr.expression;
|
|
290
|
+
while (ts.isPropertyAccessExpression(current)) {
|
|
291
|
+
const methodName = current.name.getText(sourceFile);
|
|
292
|
+
// Common array methods that return arrays (so we keep going up)
|
|
293
|
+
const arrayReturningMethods = [
|
|
294
|
+
'map',
|
|
295
|
+
'filter',
|
|
296
|
+
'slice',
|
|
297
|
+
'concat',
|
|
298
|
+
'flat',
|
|
299
|
+
'flatMap',
|
|
300
|
+
'reverse',
|
|
301
|
+
'sort',
|
|
302
|
+
'toReversed',
|
|
303
|
+
'toSorted',
|
|
304
|
+
'toSpliced',
|
|
305
|
+
];
|
|
306
|
+
if (arrayReturningMethods.includes(methodName)) {
|
|
307
|
+
const objectExpr = current.expression;
|
|
308
|
+
// If the object is a call expression (chained method), keep going
|
|
309
|
+
if (ts.isCallExpression(objectExpr)) {
|
|
310
|
+
current = objectExpr.expression;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
// Found the root - it's an identifier or property access
|
|
314
|
+
const path = StructuredPath.fromNode(objectExpr, sourceFile);
|
|
315
|
+
return path ? path.toString() : null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
// Not an array method we recognize
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Extracts JSX rendering usages from a JSX expression.
|
|
327
|
+
* Detects:
|
|
328
|
+
* - array.map() calls → 'array-map' type
|
|
329
|
+
* - string interpolations (identifiers/property access) → 'text-interpolation' type
|
|
330
|
+
*
|
|
331
|
+
* Recursively searches inside && chains and ternary expressions.
|
|
332
|
+
*
|
|
333
|
+
* @param expr The expression inside {expr}
|
|
334
|
+
* @param context The analysis context
|
|
335
|
+
*/
|
|
336
|
+
function extractJsxRenderingUsage(expr, context) {
|
|
337
|
+
const unwrapped = unwrapExpression(expr);
|
|
338
|
+
const sourceLocation = getSourceLocation(expr, context.sourceFile);
|
|
339
|
+
// Detect array.map() calls
|
|
340
|
+
if (ts.isCallExpression(unwrapped)) {
|
|
341
|
+
const calleeExpr = unwrapped.expression;
|
|
342
|
+
if (ts.isPropertyAccessExpression(calleeExpr)) {
|
|
343
|
+
const methodName = calleeExpr.name.getText(context.sourceFile);
|
|
344
|
+
if (methodName === 'map') {
|
|
345
|
+
const arrayPath = extractArrayPathFromMapCall(unwrapped, context.sourceFile);
|
|
346
|
+
if (arrayPath) {
|
|
347
|
+
context.addJsxRenderingUsage({
|
|
348
|
+
path: arrayPath,
|
|
349
|
+
renderingType: 'array-map',
|
|
350
|
+
valueType: 'array',
|
|
351
|
+
sourceLocation,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// Detect simple string interpolations: {title} or {user.name}
|
|
358
|
+
else if (ts.isIdentifier(unwrapped) ||
|
|
359
|
+
ts.isPropertyAccessExpression(unwrapped)) {
|
|
360
|
+
const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
|
|
361
|
+
if (path) {
|
|
362
|
+
const pathStr = path.toString();
|
|
363
|
+
const typeInfo = context.getTypeInfo(path);
|
|
364
|
+
// Only track as text interpolation if it's a string type
|
|
365
|
+
// Check for 'string' type, or types that contain 'string' (but not 'string[]')
|
|
366
|
+
if (typeInfo === 'string' ||
|
|
367
|
+
(typeInfo &&
|
|
368
|
+
typeInfo.includes('string') &&
|
|
369
|
+
!typeInfo.includes('string[]'))) {
|
|
370
|
+
context.addJsxRenderingUsage({
|
|
371
|
+
path: pathStr,
|
|
372
|
+
renderingType: 'text-interpolation',
|
|
373
|
+
valueType: 'string',
|
|
374
|
+
sourceLocation,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
// Recursively search inside && chains: {showList && items.map(...)}
|
|
380
|
+
else if (ts.isBinaryExpression(unwrapped) &&
|
|
381
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
382
|
+
// Check the right side of the && chain (where .map() typically appears)
|
|
383
|
+
const rightSide = unwrapExpression(unwrapped.right);
|
|
384
|
+
extractJsxRenderingUsage(rightSide, context);
|
|
385
|
+
// Also check nested && chains on the left
|
|
386
|
+
extractJsxRenderingUsage(unwrapped.left, context);
|
|
387
|
+
}
|
|
388
|
+
// Recursively search inside ternaries: {isEmpty ? null : items.map(...)}
|
|
389
|
+
else if (ts.isConditionalExpression(unwrapped)) {
|
|
390
|
+
extractJsxRenderingUsage(unwrapped.whenTrue, context);
|
|
391
|
+
extractJsxRenderingUsage(unwrapped.whenFalse, context);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
163
394
|
/**
|
|
164
395
|
* Counts the number of conditions in an && chain (excluding JSX consequence)
|
|
165
396
|
*/
|
|
@@ -180,6 +411,326 @@ function countConditionsInAndChain(expr) {
|
|
|
180
411
|
// Single condition (not an && chain)
|
|
181
412
|
return 1;
|
|
182
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Extracts conditionals from JSX elements by recursively traversing children.
|
|
416
|
+
*
|
|
417
|
+
* This is CRITICAL for extracting compound conditionals from JSX expressions
|
|
418
|
+
* like `{hasNewerVersion && !isActive && <Banner />}`.
|
|
419
|
+
*
|
|
420
|
+
* This function is called BEFORE the child boundary check in processExpression
|
|
421
|
+
* because JSX elements are NOT scopes - their expressions use variables from
|
|
422
|
+
* the parent scope and should have their conditionals extracted regardless of
|
|
423
|
+
* whether the JSX is within a child boundary.
|
|
424
|
+
*
|
|
425
|
+
* Fix 32: Added parentConditions parameter to track gating conditions from
|
|
426
|
+
* parent && chains. When we find a component nested inside multiple conditionals
|
|
427
|
+
* like `{activeTab && <>{ternary ? ... : <Component />}</>}`, ALL parent
|
|
428
|
+
* conditions should be added as gating conditions for the component.
|
|
429
|
+
*
|
|
430
|
+
* @param node The JSX element, self-closing element, or fragment to traverse
|
|
431
|
+
* @param context The analysis context
|
|
432
|
+
* @param parentConditions Accumulated gating conditions from parent && chains
|
|
433
|
+
*/
|
|
434
|
+
function extractConditionalsFromJsx(node, context, parentConditions = []) {
|
|
435
|
+
// Get children to process
|
|
436
|
+
let children;
|
|
437
|
+
if (ts.isJsxElement(node)) {
|
|
438
|
+
children = node.children;
|
|
439
|
+
}
|
|
440
|
+
else if (ts.isJsxFragment(node)) {
|
|
441
|
+
children = node.children;
|
|
442
|
+
}
|
|
443
|
+
// JsxSelfClosingElement has no children
|
|
444
|
+
if (!children) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
for (const child of children) {
|
|
448
|
+
// Process JSX expressions: {expr}
|
|
449
|
+
if (ts.isJsxExpression(child) && child.expression) {
|
|
450
|
+
const expr = unwrapExpression(child.expression);
|
|
451
|
+
// Extract JSX rendering usages (array.map, text interpolation)
|
|
452
|
+
// This handles direct usages like {items.map(...)} or {user.name}
|
|
453
|
+
extractJsxRenderingUsage(expr, context);
|
|
454
|
+
// If the expression is an && chain, extract its conditional usages
|
|
455
|
+
if (ts.isBinaryExpression(expr) &&
|
|
456
|
+
expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
457
|
+
// Mark nullable variables
|
|
458
|
+
markConditionVariablesAsNullable(expr, context);
|
|
459
|
+
// Extract conditional usage (this handles compound conditionals)
|
|
460
|
+
// Pass controlsJsxRendering: true since this conditional controls JSX rendering
|
|
461
|
+
extractConditionalUsage(expr, context, 'logical-and', {
|
|
462
|
+
controlsJsxRendering: true,
|
|
463
|
+
});
|
|
464
|
+
// Extract all condition paths from the && chain for gating tracking
|
|
465
|
+
const conditionPaths = extractConditionPathsFromAndChain(expr, context.sourceFile);
|
|
466
|
+
const sourceLocation = getSourceLocation(expr, context.sourceFile);
|
|
467
|
+
// Fix 32: Build accumulated conditions including parent conditions
|
|
468
|
+
const accumulatedConditions = [
|
|
469
|
+
...parentConditions,
|
|
470
|
+
...conditionPaths.map((path) => ({
|
|
471
|
+
path,
|
|
472
|
+
sourceLocation,
|
|
473
|
+
isNegated: false,
|
|
474
|
+
})),
|
|
475
|
+
];
|
|
476
|
+
// Track gating conditions for child components
|
|
477
|
+
// Example: {hasAnalysis && <ScenarioViewer />}
|
|
478
|
+
const jsxElement = findJsxInAndChain(expr);
|
|
479
|
+
if (jsxElement) {
|
|
480
|
+
const componentName = getComponentNameFromJsx(jsxElement);
|
|
481
|
+
if (componentName) {
|
|
482
|
+
// Fix 32: Add ALL accumulated conditions (parent + current) as gating conditions
|
|
483
|
+
for (const condition of accumulatedConditions) {
|
|
484
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
485
|
+
path: condition.path,
|
|
486
|
+
conditionType: 'truthiness',
|
|
487
|
+
location: 'logical-and',
|
|
488
|
+
sourceLocation: condition.sourceLocation,
|
|
489
|
+
controlsJsxRendering: true,
|
|
490
|
+
isNegated: condition.isNegated,
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
// Fix 32: Recursively process nested JSX with accumulated conditions
|
|
495
|
+
if (ts.isJsxElement(jsxElement) ||
|
|
496
|
+
ts.isJsxSelfClosingElement(jsxElement)) {
|
|
497
|
+
extractConditionalsFromJsx(jsxElement, context, accumulatedConditions);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
// Fix 32: Also check for nested JSX fragments
|
|
501
|
+
const jsxFragment = findJsxFragmentInAndChain(expr);
|
|
502
|
+
if (jsxFragment) {
|
|
503
|
+
extractConditionalsFromJsx(jsxFragment, context, accumulatedConditions);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
// If the expression is a ternary, extract its conditional
|
|
507
|
+
else if (ts.isConditionalExpression(expr)) {
|
|
508
|
+
// Pass controlsJsxRendering: true since this conditional controls JSX rendering
|
|
509
|
+
extractConditionalUsage(expr.condition, context, 'ternary', {
|
|
510
|
+
controlsJsxRendering: true,
|
|
511
|
+
});
|
|
512
|
+
// Track gating conditions for components in both branches of the ternary
|
|
513
|
+
// Example: {isError ? <ErrorView /> : <SuccessView />}
|
|
514
|
+
const conditionPath = StructuredPath.fromNode(unwrapExpression(expr.condition), context.sourceFile);
|
|
515
|
+
const sourceLocation = getSourceLocation(expr, context.sourceFile);
|
|
516
|
+
// Recursively process the whenTrue and whenFalse branches for JSX
|
|
517
|
+
const whenTrue = unwrapExpression(expr.whenTrue);
|
|
518
|
+
const whenFalse = unwrapExpression(expr.whenFalse);
|
|
519
|
+
// Fix 32: Build conditions for whenTrue branch (parent conditions + ternary condition truthy)
|
|
520
|
+
const whenTrueConditions = [
|
|
521
|
+
...parentConditions,
|
|
522
|
+
...(conditionPath
|
|
523
|
+
? [
|
|
524
|
+
{
|
|
525
|
+
path: conditionPath.toString(),
|
|
526
|
+
sourceLocation,
|
|
527
|
+
isNegated: false,
|
|
528
|
+
},
|
|
529
|
+
]
|
|
530
|
+
: []),
|
|
531
|
+
];
|
|
532
|
+
// Fix 32: Build conditions for whenFalse branch (parent conditions + ternary condition falsy)
|
|
533
|
+
const whenFalseConditions = [
|
|
534
|
+
...parentConditions,
|
|
535
|
+
...(conditionPath
|
|
536
|
+
? [
|
|
537
|
+
{
|
|
538
|
+
path: conditionPath.toString(),
|
|
539
|
+
sourceLocation,
|
|
540
|
+
isNegated: true,
|
|
541
|
+
},
|
|
542
|
+
]
|
|
543
|
+
: []),
|
|
544
|
+
];
|
|
545
|
+
// Handle whenTrue branch (condition is truthy)
|
|
546
|
+
if (ts.isJsxElement(whenTrue) || ts.isJsxSelfClosingElement(whenTrue)) {
|
|
547
|
+
const componentName = getComponentNameFromJsx(whenTrue);
|
|
548
|
+
if (componentName) {
|
|
549
|
+
// Fix 32: Add ALL conditions (parent + ternary) as gating conditions
|
|
550
|
+
for (const condition of whenTrueConditions) {
|
|
551
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
552
|
+
path: condition.path,
|
|
553
|
+
conditionType: 'truthiness',
|
|
554
|
+
location: 'ternary',
|
|
555
|
+
sourceLocation: condition.sourceLocation,
|
|
556
|
+
controlsJsxRendering: true,
|
|
557
|
+
isNegated: condition.isNegated,
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
if (ts.isJsxElement(whenTrue) ||
|
|
563
|
+
ts.isJsxSelfClosingElement(whenTrue) ||
|
|
564
|
+
ts.isJsxFragment(whenTrue)) {
|
|
565
|
+
extractConditionalsFromJsx(whenTrue, context, whenTrueConditions);
|
|
566
|
+
}
|
|
567
|
+
// Handle whenFalse branch (condition is falsy/negated)
|
|
568
|
+
if (ts.isJsxElement(whenFalse) ||
|
|
569
|
+
ts.isJsxSelfClosingElement(whenFalse)) {
|
|
570
|
+
const componentName = getComponentNameFromJsx(whenFalse);
|
|
571
|
+
if (componentName) {
|
|
572
|
+
// Fix 32: Add ALL conditions (parent + ternary) as gating conditions
|
|
573
|
+
for (const condition of whenFalseConditions) {
|
|
574
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
575
|
+
path: condition.path,
|
|
576
|
+
conditionType: 'truthiness',
|
|
577
|
+
location: 'ternary',
|
|
578
|
+
sourceLocation: condition.sourceLocation,
|
|
579
|
+
controlsJsxRendering: true,
|
|
580
|
+
isNegated: condition.isNegated,
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
if (ts.isJsxElement(whenFalse) ||
|
|
586
|
+
ts.isJsxSelfClosingElement(whenFalse) ||
|
|
587
|
+
ts.isJsxFragment(whenFalse)) {
|
|
588
|
+
extractConditionalsFromJsx(whenFalse, context, whenFalseConditions);
|
|
589
|
+
}
|
|
590
|
+
// Handle chained ternaries: a ? <A/> : b ? <B/> : <C/>
|
|
591
|
+
// When whenFalse is another ConditionalExpression, recursively process it
|
|
592
|
+
else if (ts.isConditionalExpression(whenFalse)) {
|
|
593
|
+
// Extract conditional usage for the nested ternary's condition
|
|
594
|
+
extractConditionalUsage(whenFalse.condition, context, 'ternary', {
|
|
595
|
+
controlsJsxRendering: true,
|
|
596
|
+
});
|
|
597
|
+
// Get the nested condition path
|
|
598
|
+
const nestedConditionPath = StructuredPath.fromNode(unwrapExpression(whenFalse.condition), context.sourceFile);
|
|
599
|
+
const nestedSourceLocation = getSourceLocation(whenFalse, context.sourceFile);
|
|
600
|
+
const nestedWhenTrue = unwrapExpression(whenFalse.whenTrue);
|
|
601
|
+
const nestedWhenFalse = unwrapExpression(whenFalse.whenFalse);
|
|
602
|
+
// Fix 32: Build conditions for nested whenTrue (parent falsy + nested truthy)
|
|
603
|
+
const nestedWhenTrueConditions = [
|
|
604
|
+
...whenFalseConditions, // Parent ternary was falsy to get here
|
|
605
|
+
...(nestedConditionPath
|
|
606
|
+
? [
|
|
607
|
+
{
|
|
608
|
+
path: nestedConditionPath.toString(),
|
|
609
|
+
sourceLocation: nestedSourceLocation,
|
|
610
|
+
isNegated: false,
|
|
611
|
+
},
|
|
612
|
+
]
|
|
613
|
+
: []),
|
|
614
|
+
];
|
|
615
|
+
// Fix 32: Build conditions for nested whenFalse (parent falsy + nested falsy)
|
|
616
|
+
const nestedWhenFalseConditions = [
|
|
617
|
+
...whenFalseConditions, // Parent ternary was falsy to get here
|
|
618
|
+
...(nestedConditionPath
|
|
619
|
+
? [
|
|
620
|
+
{
|
|
621
|
+
path: nestedConditionPath.toString(),
|
|
622
|
+
sourceLocation: nestedSourceLocation,
|
|
623
|
+
isNegated: true,
|
|
624
|
+
},
|
|
625
|
+
]
|
|
626
|
+
: []),
|
|
627
|
+
];
|
|
628
|
+
// Handle nested whenTrue branch
|
|
629
|
+
if (ts.isJsxElement(nestedWhenTrue) ||
|
|
630
|
+
ts.isJsxSelfClosingElement(nestedWhenTrue)) {
|
|
631
|
+
const componentName = getComponentNameFromJsx(nestedWhenTrue);
|
|
632
|
+
if (componentName) {
|
|
633
|
+
// Fix 32: Add ALL accumulated conditions
|
|
634
|
+
for (const condition of nestedWhenTrueConditions) {
|
|
635
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
636
|
+
path: condition.path,
|
|
637
|
+
conditionType: 'truthiness',
|
|
638
|
+
location: 'ternary',
|
|
639
|
+
sourceLocation: condition.sourceLocation,
|
|
640
|
+
controlsJsxRendering: true,
|
|
641
|
+
isNegated: condition.isNegated,
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (ts.isJsxElement(nestedWhenTrue) ||
|
|
647
|
+
ts.isJsxSelfClosingElement(nestedWhenTrue) ||
|
|
648
|
+
ts.isJsxFragment(nestedWhenTrue)) {
|
|
649
|
+
extractConditionalsFromJsx(nestedWhenTrue, context, nestedWhenTrueConditions);
|
|
650
|
+
}
|
|
651
|
+
// Handle nested whenFalse branch (this could be another chained ternary or JSX)
|
|
652
|
+
if (ts.isJsxElement(nestedWhenFalse) ||
|
|
653
|
+
ts.isJsxSelfClosingElement(nestedWhenFalse)) {
|
|
654
|
+
const componentName = getComponentNameFromJsx(nestedWhenFalse);
|
|
655
|
+
if (componentName) {
|
|
656
|
+
// Fix 32: Add ALL accumulated conditions
|
|
657
|
+
for (const condition of nestedWhenFalseConditions) {
|
|
658
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
659
|
+
path: condition.path,
|
|
660
|
+
conditionType: 'truthiness',
|
|
661
|
+
location: 'ternary',
|
|
662
|
+
sourceLocation: condition.sourceLocation,
|
|
663
|
+
controlsJsxRendering: true,
|
|
664
|
+
isNegated: condition.isNegated,
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (ts.isJsxElement(nestedWhenFalse) ||
|
|
670
|
+
ts.isJsxSelfClosingElement(nestedWhenFalse) ||
|
|
671
|
+
ts.isJsxFragment(nestedWhenFalse)) {
|
|
672
|
+
extractConditionalsFromJsx(nestedWhenFalse, context, nestedWhenFalseConditions);
|
|
673
|
+
}
|
|
674
|
+
// If nestedWhenFalse is yet another ConditionalExpression, the recursion
|
|
675
|
+
// will handle it on the next iteration when this function processes it
|
|
676
|
+
else if (ts.isConditionalExpression(nestedWhenFalse)) {
|
|
677
|
+
// Recursively handle deeper nesting by wrapping in a synthetic process
|
|
678
|
+
// We create a fake JsxExpression context to reuse the same logic
|
|
679
|
+
const syntheticChild = {
|
|
680
|
+
kind: ts.SyntaxKind.JsxExpression,
|
|
681
|
+
expression: nestedWhenFalse,
|
|
682
|
+
};
|
|
683
|
+
// Process via the main JSX expression handler by recursing
|
|
684
|
+
// For now, just extract conditionals directly
|
|
685
|
+
extractConditionalUsage(nestedWhenFalse.condition, context, 'ternary', { controlsJsxRendering: true });
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
// Recursively process nested JSX elements - Fix 32: pass parent conditions
|
|
691
|
+
else if (ts.isJsxElement(child)) {
|
|
692
|
+
// Check if this is a user-defined component (vs intrinsic element like div)
|
|
693
|
+
// If it's a component AND there are parent conditions, record the gating conditions
|
|
694
|
+
const componentName = getComponentNameFromJsx(child);
|
|
695
|
+
if (componentName && parentConditions.length > 0) {
|
|
696
|
+
for (const condition of parentConditions) {
|
|
697
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
698
|
+
path: condition.path,
|
|
699
|
+
conditionType: 'truthiness',
|
|
700
|
+
location: 'ternary',
|
|
701
|
+
sourceLocation: condition.sourceLocation,
|
|
702
|
+
controlsJsxRendering: true,
|
|
703
|
+
isNegated: condition.isNegated,
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
extractConditionalsFromJsx(child, context, parentConditions);
|
|
708
|
+
}
|
|
709
|
+
// Handle self-closing JSX elements (e.g., <ScenarioViewer />)
|
|
710
|
+
else if (ts.isJsxSelfClosingElement(child)) {
|
|
711
|
+
// Check if this is a user-defined component (vs intrinsic element like div)
|
|
712
|
+
// If it's a component AND there are parent conditions, record the gating conditions
|
|
713
|
+
const componentName = getComponentNameFromJsx(child);
|
|
714
|
+
if (componentName && parentConditions.length > 0) {
|
|
715
|
+
for (const condition of parentConditions) {
|
|
716
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
717
|
+
path: condition.path,
|
|
718
|
+
conditionType: 'truthiness',
|
|
719
|
+
location: 'ternary',
|
|
720
|
+
sourceLocation: condition.sourceLocation,
|
|
721
|
+
controlsJsxRendering: true,
|
|
722
|
+
isNegated: condition.isNegated,
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
// Self-closing elements have no children, so no recursion needed
|
|
727
|
+
}
|
|
728
|
+
// Recursively process nested JSX fragments - Fix 32: pass parent conditions
|
|
729
|
+
else if (ts.isJsxFragment(child)) {
|
|
730
|
+
extractConditionalsFromJsx(child, context, parentConditions);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
183
734
|
/**
|
|
184
735
|
* Extracts conditional usages from a condition expression for key attribute detection.
|
|
185
736
|
* This function identifies which attributes are used in conditionals and how they're used.
|
|
@@ -188,8 +739,10 @@ function countConditionsInAndChain(expr) {
|
|
|
188
739
|
* @param condition The condition expression to analyze
|
|
189
740
|
* @param context The analysis context
|
|
190
741
|
* @param location Where this condition appears (if, ternary, logical-and, switch)
|
|
742
|
+
* @param options Additional options including controlsJsxRendering flag
|
|
191
743
|
*/
|
|
192
|
-
export function extractConditionalUsage(condition, context, location) {
|
|
744
|
+
export function extractConditionalUsage(condition, context, location, options = {}) {
|
|
745
|
+
const { controlsJsxRendering } = options;
|
|
193
746
|
// Internal recursive function with chain tracking
|
|
194
747
|
function extractWithChainTracking(expr, chainInfo, isNegated) {
|
|
195
748
|
const unwrapped = unwrapExpression(expr);
|
|
@@ -214,6 +767,7 @@ export function extractConditionalUsage(condition, context, location) {
|
|
|
214
767
|
conditions: [],
|
|
215
768
|
location,
|
|
216
769
|
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
770
|
+
controlsJsxRendering,
|
|
217
771
|
};
|
|
218
772
|
chainInfo = {
|
|
219
773
|
chainId,
|
|
@@ -241,12 +795,33 @@ export function extractConditionalUsage(condition, context, location) {
|
|
|
241
795
|
return;
|
|
242
796
|
}
|
|
243
797
|
// Handle binary expressions with || (logical OR)
|
|
244
|
-
// OR
|
|
798
|
+
// When OR is inside an && chain, we need to continue chain tracking
|
|
799
|
+
// and mark conditions as OR alternatives
|
|
245
800
|
if (ts.isBinaryExpression(unwrapped) &&
|
|
246
801
|
unwrapped.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
802
|
+
if (chainInfo) {
|
|
803
|
+
// We're inside an && chain - continue tracking but mark as OR alternatives
|
|
804
|
+
// Generate an orGroupId so conditions from both sides can be grouped
|
|
805
|
+
const orGroupId = chainInfo.currentOrGroupId ?? `or_${crypto.randomUUID().slice(0, 8)}`;
|
|
806
|
+
// Process left side with OR group tracking
|
|
807
|
+
const leftChainInfo = {
|
|
808
|
+
...chainInfo,
|
|
809
|
+
currentOrGroupId: orGroupId,
|
|
810
|
+
};
|
|
811
|
+
extractWithChainTracking(unwrapped.left, leftChainInfo, false);
|
|
812
|
+
// Process right side with same OR group
|
|
813
|
+
// Note: we use leftChainInfo's currentPosition which may have been updated
|
|
814
|
+
const rightChainInfo = {
|
|
815
|
+
...leftChainInfo,
|
|
816
|
+
currentPosition: chainInfo.currentPosition,
|
|
817
|
+
};
|
|
818
|
+
extractWithChainTracking(unwrapped.right, rightChainInfo, false);
|
|
819
|
+
}
|
|
820
|
+
else {
|
|
821
|
+
// Not inside a chain - OR breaks into independent conditional checks
|
|
822
|
+
extractWithChainTracking(unwrapped.left, null, false);
|
|
823
|
+
extractWithChainTracking(unwrapped.right, null, false);
|
|
824
|
+
}
|
|
250
825
|
return;
|
|
251
826
|
}
|
|
252
827
|
// Handle comparison operators (===, !==, <, >, <=, >=)
|
|
@@ -272,7 +847,7 @@ export function extractConditionalUsage(condition, context, location) {
|
|
|
272
847
|
return literalValue;
|
|
273
848
|
};
|
|
274
849
|
// Helper to add a condition
|
|
275
|
-
const addCondition = (path, conditionType, comparedValues, requiredValue) => {
|
|
850
|
+
const addCondition = (path, conditionType, comparedValues, requiredValue, sourceExpr) => {
|
|
276
851
|
const usage = {
|
|
277
852
|
path,
|
|
278
853
|
conditionType,
|
|
@@ -280,7 +855,18 @@ export function extractConditionalUsage(condition, context, location) {
|
|
|
280
855
|
location,
|
|
281
856
|
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
282
857
|
isNegated,
|
|
858
|
+
controlsJsxRendering,
|
|
283
859
|
};
|
|
860
|
+
// Check for inline array-derived patterns (.length) on the source expression
|
|
861
|
+
if (sourceExpr) {
|
|
862
|
+
const arrayDerived = detectArrayDerivedPattern(sourceExpr);
|
|
863
|
+
if (arrayDerived) {
|
|
864
|
+
usage.derivedFrom = {
|
|
865
|
+
operation: arrayDerived.operation,
|
|
866
|
+
sourcePath: arrayDerived.sourcePath,
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
}
|
|
284
870
|
// Add chain info if part of a compound conditional
|
|
285
871
|
if (chainInfo) {
|
|
286
872
|
usage.chainId = chainInfo.chainId;
|
|
@@ -295,6 +881,9 @@ export function extractConditionalUsage(condition, context, location) {
|
|
|
295
881
|
comparedValues,
|
|
296
882
|
isNegated,
|
|
297
883
|
requiredValue,
|
|
884
|
+
...(chainInfo.currentOrGroupId && {
|
|
885
|
+
orGroupId: chainInfo.currentOrGroupId,
|
|
886
|
+
}),
|
|
298
887
|
});
|
|
299
888
|
}
|
|
300
889
|
context.addConditionalUsage(usage);
|
|
@@ -302,21 +891,21 @@ export function extractConditionalUsage(condition, context, location) {
|
|
|
302
891
|
// Check if left is a variable and right is a literal
|
|
303
892
|
if (leftPath && isLiteralExpression(unwrapped.right)) {
|
|
304
893
|
const literalValue = getLiteralValue(unwrapped.right, context);
|
|
305
|
-
addCondition(leftPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated));
|
|
894
|
+
addCondition(leftPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated), unwrapped.left);
|
|
306
895
|
return;
|
|
307
896
|
}
|
|
308
897
|
// Check if right is a variable and left is a literal
|
|
309
898
|
if (rightPath && isLiteralExpression(unwrapped.left)) {
|
|
310
899
|
const literalValue = getLiteralValue(unwrapped.left, context);
|
|
311
|
-
addCondition(rightPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated));
|
|
900
|
+
addCondition(rightPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated), unwrapped.right);
|
|
312
901
|
return;
|
|
313
902
|
}
|
|
314
903
|
// Both sides are variables - record both as comparisons without specific values
|
|
315
904
|
if (leftPath) {
|
|
316
|
-
addCondition(leftPath.toLeftHandSideString(), 'comparison');
|
|
905
|
+
addCondition(leftPath.toLeftHandSideString(), 'comparison', undefined, undefined, unwrapped.left);
|
|
317
906
|
}
|
|
318
907
|
if (rightPath) {
|
|
319
|
-
addCondition(rightPath.toLeftHandSideString(), 'comparison');
|
|
908
|
+
addCondition(rightPath.toLeftHandSideString(), 'comparison', undefined, undefined, unwrapped.right);
|
|
320
909
|
}
|
|
321
910
|
return;
|
|
322
911
|
}
|
|
@@ -338,7 +927,17 @@ export function extractConditionalUsage(condition, context, location) {
|
|
|
338
927
|
location,
|
|
339
928
|
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
340
929
|
isNegated,
|
|
930
|
+
controlsJsxRendering,
|
|
341
931
|
};
|
|
932
|
+
// Check for inline array-derived patterns (.some(), .every(), .includes(), .length)
|
|
933
|
+
// This populates derivedFrom so downstream code can resolve to the base array path
|
|
934
|
+
const arrayDerived = detectArrayDerivedPattern(unwrapped);
|
|
935
|
+
if (arrayDerived) {
|
|
936
|
+
usage.derivedFrom = {
|
|
937
|
+
operation: arrayDerived.operation,
|
|
938
|
+
sourcePath: arrayDerived.sourcePath,
|
|
939
|
+
};
|
|
940
|
+
}
|
|
342
941
|
// Add chain info if part of a compound conditional
|
|
343
942
|
if (chainInfo) {
|
|
344
943
|
usage.chainId = chainInfo.chainId;
|
|
@@ -353,6 +952,9 @@ export function extractConditionalUsage(condition, context, location) {
|
|
|
353
952
|
conditionType: 'truthiness',
|
|
354
953
|
isNegated,
|
|
355
954
|
requiredValue: !isNegated,
|
|
955
|
+
...(chainInfo.currentOrGroupId && {
|
|
956
|
+
orGroupId: chainInfo.currentOrGroupId,
|
|
957
|
+
}),
|
|
356
958
|
});
|
|
357
959
|
}
|
|
358
960
|
context.addConditionalUsage(usage);
|
|
@@ -447,6 +1049,15 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
447
1049
|
extractConditionalUsage(unwrappedNode, context, 'logical-and');
|
|
448
1050
|
}
|
|
449
1051
|
}
|
|
1052
|
+
// CRITICAL: Extract conditionals from JSX BEFORE checking child boundaries
|
|
1053
|
+
// JSX elements are NOT scopes - their expressions use variables from the parent scope.
|
|
1054
|
+
// Even if the JSX element is within a child boundary (e.g., because it contains callbacks),
|
|
1055
|
+
// we must still extract conditionals from JSX expression children like {x && <div>...</div>}
|
|
1056
|
+
if (ts.isJsxElement(unwrappedNode) ||
|
|
1057
|
+
ts.isJsxSelfClosingElement(unwrappedNode) ||
|
|
1058
|
+
ts.isJsxFragment(unwrappedNode)) {
|
|
1059
|
+
extractConditionalsFromJsx(unwrappedNode, context);
|
|
1060
|
+
}
|
|
450
1061
|
// If the node falls within an excluded child scope, stop processing it.
|
|
451
1062
|
if (context.isChildBoundary(node)) {
|
|
452
1063
|
return true;
|
|
@@ -577,7 +1188,8 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
577
1188
|
const propertyPath = objectPath.withProperty(unwrappedNode.name.text);
|
|
578
1189
|
// Check if this is an environment variable access
|
|
579
1190
|
const fullText = unwrappedNode.getText(context.sourceFile);
|
|
580
|
-
if (fullText.includes('.env.') //
|
|
1191
|
+
if (fullText.includes('.env.') || // process.env.X, window.env.X
|
|
1192
|
+
isEnvStoreAccess(fullText) // env.X where env is likely an env config object
|
|
581
1193
|
) {
|
|
582
1194
|
context.addEnvironmentVariable(fullText);
|
|
583
1195
|
}
|
|
@@ -801,6 +1413,13 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
801
1413
|
// e.g., `const tab = segments[0] || 'default'` should trace tab back to segments[0]
|
|
802
1414
|
if (operatorKind === ts.SyntaxKind.QuestionQuestionToken) {
|
|
803
1415
|
// specifically for ?? we create an equivalence to the left side
|
|
1416
|
+
// IMPORTANT: Also process the left side recursively to apply method semantics
|
|
1417
|
+
// (e.g., for `const segments = splat?.split('/') ?? []`, we need split semantics)
|
|
1418
|
+
processExpression({
|
|
1419
|
+
node: unwrappedNode.left,
|
|
1420
|
+
context,
|
|
1421
|
+
// Don't pass targetPath here - we'll establish equivalence separately below
|
|
1422
|
+
});
|
|
804
1423
|
if (targetPath) {
|
|
805
1424
|
resultPath = StructuredPath.fromNode(unwrappedNode.left, context.sourceFile);
|
|
806
1425
|
}
|
|
@@ -811,12 +1430,28 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
811
1430
|
}
|
|
812
1431
|
}
|
|
813
1432
|
else if (operatorKind === ts.SyntaxKind.BarBarToken) {
|
|
814
|
-
// For ||,
|
|
1433
|
+
// For ||, create equivalences to BOTH sides
|
|
815
1434
|
// This enables data flow tracing through fallback expressions
|
|
1435
|
+
// e.g., `const item = items.find(...) || null` should trace to both:
|
|
1436
|
+
// - items[] (from the find result)
|
|
1437
|
+
// - null (from the fallback)
|
|
816
1438
|
if (targetPath) {
|
|
1439
|
+
// Process left side recursively to capture its full equivalency chain
|
|
1440
|
+
processExpression({
|
|
1441
|
+
node: unwrappedNode.left,
|
|
1442
|
+
context,
|
|
1443
|
+
targetPath,
|
|
1444
|
+
});
|
|
1445
|
+
// Process right side recursively for completeness
|
|
1446
|
+
processExpression({
|
|
1447
|
+
node: unwrappedNode.right,
|
|
1448
|
+
context,
|
|
1449
|
+
targetPath,
|
|
1450
|
+
});
|
|
1451
|
+
// Set resultPath to left side for type inference
|
|
817
1452
|
resultPath = StructuredPath.fromNode(unwrappedNode.left, context.sourceFile);
|
|
818
1453
|
}
|
|
819
|
-
// Note:
|
|
1454
|
+
// Note: When there's no targetPath, we don't recursively process
|
|
820
1455
|
// because || is often used in boolean contexts where the full expression matters
|
|
821
1456
|
}
|
|
822
1457
|
}
|
|
@@ -1230,6 +1865,12 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
|
|
|
1230
1865
|
markConditionVariablesAsNullable(unwrappedNode.condition, context);
|
|
1231
1866
|
// Extract conditional usages for key attribute detection
|
|
1232
1867
|
extractConditionalUsage(unwrappedNode.condition, context, 'ternary');
|
|
1868
|
+
// Extract conditional effects (setter calls in ternary branches)
|
|
1869
|
+
const knownSetters = findUseStateSetters(context.sourceFile);
|
|
1870
|
+
const effects = extractConditionalEffectsFromTernary(unwrappedNode, context, knownSetters);
|
|
1871
|
+
for (const effect of effects) {
|
|
1872
|
+
context.addConditionalEffect(effect);
|
|
1873
|
+
}
|
|
1233
1874
|
// Process all parts recursively
|
|
1234
1875
|
processExpression({
|
|
1235
1876
|
node: unwrappedNode.condition,
|