@codeyam/codeyam-cli 0.1.0-staging.1 → 0.1.0-staging.da5baf5
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 +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +5 -5
- package/analyzer-template/packages/ai/index.ts +2 -1
- package/analyzer-template/packages/ai/package.json +2 -2
- package/analyzer-template/packages/ai/scripts/ai-test-matrix.mjs +424 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +24 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +6 -16
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +197 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +28 -2
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +127 -4
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +1 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1821 -542
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.ts +138 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +139 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/DebugTracer.ts +224 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/PathManager.ts +203 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/README.md +294 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +161 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.ts +235 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +14 -6
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/selectBestValue.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.ts +113 -0
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +36 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityDocumentation.ts +20 -2
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +51 -107
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +56 -160
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +79 -265
- package/analyzer-template/packages/ai/src/lib/generateEntityDocumentation.ts +16 -2
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +53 -176
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +53 -154
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +84 -254
- package/analyzer-template/packages/ai/src/lib/generateStatementAnalysis.ts +48 -71
- package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +27 -6
- package/analyzer-template/packages/ai/src/lib/getLLMCallStats.ts +0 -14
- package/analyzer-template/packages/ai/src/lib/modelInfo.ts +15 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +42 -4
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.ts +8 -33
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +54 -62
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +93 -109
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.ts +8 -27
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +33 -38
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +30 -30
- package/analyzer-template/packages/ai/src/lib/types/index.ts +2 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +39 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +52 -6
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +238 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.ts +25 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +8 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +6 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +34 -15
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +17 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +35 -16
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +7 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +9 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +6 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +9 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +15 -7
- package/analyzer-template/packages/aws/package.json +2 -2
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +28 -21
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.ts +18 -11
- package/analyzer-template/packages/generate/src/lib/scenarioComponent.ts +6 -3
- 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 +28 -21
- 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/componentScenarioPageRemix.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.js +5 -3
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/index.d.ts +2 -0
- package/analyzer-template/packages/github/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/index.js +2 -0
- package/analyzer-template/packages/github/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.d.ts +25 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.js +40 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.js.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js +5 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +12 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/ui-components/src/scenario-editor/components/DataItemEditor.tsx +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.js +2 -0
- package/analyzer-template/packages/utils/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.d.ts +25 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.js +40 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.js.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js +5 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +12 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/utils/index.ts +2 -0
- package/analyzer-template/packages/utils/src/lib/Semaphore.ts +42 -0
- package/analyzer-template/packages/utils/src/lib/frameworks/getNextRoutePath.ts +8 -3
- package/analyzer-template/packages/utils/src/lib/frameworks/getRemixRoutePath.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.ts +1 -0
- package/analyzer-template/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.ts +33 -0
- package/analyzer-template/project/constructMockCode.ts +170 -6
- package/analyzer-template/project/reconcileMockDataKeys.ts +13 -0
- package/analyzer-template/project/startScenarioCapture.ts +24 -0
- package/analyzer-template/project/trackGeneratedFiles.ts +41 -0
- package/analyzer-template/project/writeMockDataTsx.ts +125 -4
- package/analyzer-template/project/writeScenarioComponents.ts +175 -45
- package/analyzer-template/project/writeUniversalMocks.ts +72 -10
- package/background/src/lib/virtualized/project/constructMockCode.js +158 -7
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +12 -0
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +18 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js +30 -0
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js.map +1 -0
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +95 -3
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +130 -28
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeUniversalMocks.js +59 -9
- package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +288 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -0
- package/codeyam-cli/scripts/extract-setup.js +130 -0
- package/codeyam-cli/scripts/extract-setup.js.map +1 -0
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +238 -0
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +1 -0
- package/codeyam-cli/src/cli.js +4 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +0 -0
- package/codeyam-cli/src/commands/debug.js +190 -0
- package/codeyam-cli/src/commands/debug.js.map +1 -0
- package/codeyam-cli/src/commands/init.js +4 -23
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/setup-sandbox.js +164 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/cleanupAnalysisFiles.test.js +6 -6
- package/codeyam-cli/src/utils/__tests__/cleanupAnalysisFiles.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +8 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +4 -3
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +25 -5
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/cleanupAnalysisFiles.js +2 -2
- package/codeyam-cli/src/utils/cleanupAnalysisFiles.js.map +1 -1
- package/codeyam-cli/src/utils/fileWatcher.js +75 -5
- package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +3 -2
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +4 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +2 -1
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +63 -2
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +15 -35
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BFRmw1TF.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-Dh-FldQK.js → InteractivePreview-CRfBaL5B.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-BYVx9KFp.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-Dp6DC845.js → LogViewer-CRcT5fOZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-Bual6h18.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Dj4Mm0AR.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-wtCIkGzq.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/_index-Cjdlwanz.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-Dv3k2aEm.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/chart-column-DOftqM9U.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-De6i8FUT.js +26 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-alert-0WShkwuc.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/clock-DXui5oLF.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DPFKgE96.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-1Z6D0fLM.js → entity._sha._-BxaXKsIx.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-BRD2FrH5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-69R47Ffu.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entityVersioning-DO2gCvXv.js → entityVersioning-Bk_YB1jM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-B5l8I1m3.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/file-text-fb2mx25c.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-l_Eh9jQG.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-BCnOUEl9.js +12 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-BxkM6Up7.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-BgDzgbQW.js +8 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-DE3HAwpF.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-5579bc45.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-o8NMI2bW.js +16 -0
- package/codeyam-cli/src/webserver/build/client/assets/search-BymWwY_X.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-C7G4GDvW.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-Dc4MlMpK.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-Duh3oShE.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BBlyqxij.js → useLastLogLine-AlhS7g5F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-XY00p4rI.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/zap-Dra7vum1.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/index-Dpr7o3dP.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BM5nyvlV.js +166 -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 +1 -1
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/codeyam-setup-skill.md +85 -94
- package/package.json +7 -10
- package/packages/ai/index.js +1 -2
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +13 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +6 -15
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +134 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/paths.js +28 -3
- package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +111 -3
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +1 -3
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1320 -396
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.js +137 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +112 -0
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/DebugTracer.js +176 -0
- package/packages/ai/src/lib/dataStructure/helpers/DebugTracer.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/PathManager.js +178 -0
- package/packages/ai/src/lib/dataStructure/helpers/PathManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +138 -0
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.js +199 -0
- package/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +14 -6
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/selectBestValue.js +62 -0
- package/packages/ai/src/lib/dataStructure/helpers/selectBestValue.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.js +90 -0
- package/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.js.map +1 -0
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +22 -0
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js +19 -1
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +51 -107
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +55 -156
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +79 -262
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js +15 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +53 -176
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +52 -152
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +88 -258
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateStatementAnalysis.js +46 -71
- package/packages/ai/src/lib/generateStatementAnalysis.js.map +1 -1
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js +13 -8
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
- package/packages/ai/src/lib/getLLMCallStats.js +0 -14
- package/packages/ai/src/lib/getLLMCallStats.js.map +1 -1
- package/packages/ai/src/lib/modelInfo.js +15 -0
- package/packages/ai/src/lib/modelInfo.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +36 -3
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js +8 -33
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +35 -41
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +59 -72
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js +8 -27
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +24 -27
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +21 -22
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/types/index.js +2 -0
- package/packages/ai/src/lib/types/index.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +7 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +45 -5
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +191 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js +16 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js.map +1 -0
- package/packages/analyze/src/lib/asts/sourceFiles/index.js +2 -0
- package/packages/analyze/src/lib/asts/sourceFiles/index.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +6 -8
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +5 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +21 -9
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +10 -4
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +21 -9
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +6 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +9 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +5 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +9 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +16 -7
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +28 -21
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/packages/generate/src/lib/scenarioComponent.js +5 -3
- package/packages/generate/src/lib/scenarioComponent.js.map +1 -1
- package/packages/utils/index.js +2 -0
- package/packages/utils/index.js.map +1 -1
- package/packages/utils/src/lib/Semaphore.js +40 -0
- package/packages/utils/src/lib/Semaphore.js.map +1 -0
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js +5 -3
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/packages/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/packages/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityDataMap.ts +0 -375
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-GqWwt5wG.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-p0fuyqGQ.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-xwuhwsZH.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bl2IRh55.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-M2QuSHKC.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-CAVtep9Q.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLmzsLsT.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/chart-column-B2I7jQx2.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/circle-alert-GwwOAbhw.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/components-CAx5ONX_.js +0 -40
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgyOwWip.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DGy3zrli.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-ChAdTrrU.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-D9L7267w.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-C6FRgjPr.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-C3-cQjgv.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-Dp4EB9nv.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-Da3jt49-.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-DN7Vr40D.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-172a4629.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-COyVTsPq.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-CvyP_1Lo.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-Hbf8b7J_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-MZc4XdmE.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-BMBi0VzO.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-C_VxoXTh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/zap-B4gsLUZQ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/cy-logo-cli.svg +0 -13
- package/codeyam-cli/src/webserver/build/server/assets/index-eAULANMV.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-lutv16q5.js +0 -161
- package/codeyam-cli/src/webserver/public/cy-logo-cli.svg +0 -13
- package/packages/ai/src/lib/generateEntityDataMap.js +0 -335
- package/packages/ai/src/lib/generateEntityDataMap.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js +0 -17
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js.map +0 -1
|
@@ -423,6 +423,194 @@ export class ArrayMapSemantics implements MethodSemantics {
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Array flatMap method semantics
|
|
428
|
+
*
|
|
429
|
+
* flatMap() maps each element using a mapping function, then flattens the result into a new array
|
|
430
|
+
*/
|
|
431
|
+
export class ArrayFlatMapSemantics implements MethodSemantics {
|
|
432
|
+
getReturnType(): string {
|
|
433
|
+
return 'array';
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
addEquivalences(
|
|
437
|
+
methodCallPath: StructuredPath,
|
|
438
|
+
sourcePath: StructuredPath,
|
|
439
|
+
context: AnalysisContext,
|
|
440
|
+
): void {
|
|
441
|
+
// Mark source as array
|
|
442
|
+
context.addType(sourcePath, 'array');
|
|
443
|
+
|
|
444
|
+
// Get the last function call segment to access the arguments
|
|
445
|
+
const lastFunctionCallSegment = methodCallPath.getLastFunctionCallSegment();
|
|
446
|
+
|
|
447
|
+
if (lastFunctionCallSegment && lastFunctionCallSegment.args.length > 0) {
|
|
448
|
+
// The first argument is the callback
|
|
449
|
+
const callbackPath = lastFunctionCallSegment.args[0];
|
|
450
|
+
|
|
451
|
+
// Add the callback to the structure
|
|
452
|
+
context.addType(callbackPath, 'function');
|
|
453
|
+
|
|
454
|
+
// Mark that the callback's first parameter receives array elements
|
|
455
|
+
context.addEquivalence(
|
|
456
|
+
callbackPath.withParameter(0),
|
|
457
|
+
sourcePath.withElement('*'),
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
isComplete(): boolean {
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Array at method semantics
|
|
469
|
+
*
|
|
470
|
+
* at() returns the element at the given index, supporting negative indices
|
|
471
|
+
*/
|
|
472
|
+
export class ArrayAtSemantics implements MethodSemantics {
|
|
473
|
+
getReturnType(): string {
|
|
474
|
+
return 'unknown'; // Returns element type or undefined
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
addEquivalences(
|
|
478
|
+
methodCallPath: StructuredPath,
|
|
479
|
+
sourcePath: StructuredPath,
|
|
480
|
+
context: AnalysisContext,
|
|
481
|
+
): void {
|
|
482
|
+
// Mark source as array
|
|
483
|
+
context.addType(sourcePath, 'array');
|
|
484
|
+
|
|
485
|
+
// The return value is equivalent to an array element
|
|
486
|
+
context.addEquivalence(
|
|
487
|
+
methodCallPath.withReturnValues(),
|
|
488
|
+
sourcePath.withElement('*'),
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
isComplete(): boolean {
|
|
493
|
+
return true;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Array findLast method semantics
|
|
499
|
+
*
|
|
500
|
+
* findLast() returns the last element that passes the test, or undefined
|
|
501
|
+
*/
|
|
502
|
+
export class ArrayFindLastSemantics implements MethodSemantics {
|
|
503
|
+
getReturnType(): string {
|
|
504
|
+
return 'unknown'; // Could be any type from the array or undefined
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
addEquivalences(
|
|
508
|
+
methodCallPath: StructuredPath,
|
|
509
|
+
sourcePath: StructuredPath,
|
|
510
|
+
context: AnalysisContext,
|
|
511
|
+
): void {
|
|
512
|
+
// Mark source as array
|
|
513
|
+
context.addType(sourcePath, 'array');
|
|
514
|
+
|
|
515
|
+
// Get the last function call segment to access the arguments
|
|
516
|
+
const functionCallSegment = methodCallPath.getLastFunctionCallSegment();
|
|
517
|
+
|
|
518
|
+
if (functionCallSegment && functionCallSegment.args.length > 0) {
|
|
519
|
+
// The first argument is the callback
|
|
520
|
+
const callbackPath = functionCallSegment.args[0];
|
|
521
|
+
|
|
522
|
+
// Add the callback to the structure
|
|
523
|
+
context.addType(callbackPath, 'function');
|
|
524
|
+
|
|
525
|
+
// Mark that the callback's first parameter receives array elements
|
|
526
|
+
context.addEquivalence(
|
|
527
|
+
callbackPath.withParameter(0),
|
|
528
|
+
sourcePath.withElement('*'),
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
isComplete(): boolean {
|
|
534
|
+
return true;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Object.fromEntries method semantics
|
|
540
|
+
*
|
|
541
|
+
* fromEntries() transforms a list of key-value pairs into an object
|
|
542
|
+
*/
|
|
543
|
+
export class ObjectFromEntriesSemantics implements MethodSemantics {
|
|
544
|
+
getReturnType(): string {
|
|
545
|
+
return 'object';
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
addEquivalences(
|
|
549
|
+
methodCallPath: StructuredPath,
|
|
550
|
+
sourcePath: StructuredPath,
|
|
551
|
+
context: AnalysisContext,
|
|
552
|
+
): void {
|
|
553
|
+
// The source path would be Object, not particularly useful
|
|
554
|
+
// The argument is an iterable of key-value pairs
|
|
555
|
+
const functionCallSegment = methodCallPath.getLastFunctionCallSegment();
|
|
556
|
+
|
|
557
|
+
if (functionCallSegment && functionCallSegment.args.length > 0) {
|
|
558
|
+
// Mark the argument as an array (iterable of entries)
|
|
559
|
+
const entriesPath = functionCallSegment.args[0];
|
|
560
|
+
context.addType(entriesPath, 'array');
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
isComplete(): boolean {
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Promise.then method semantics
|
|
571
|
+
*
|
|
572
|
+
* then() registers a callback to be called when the promise resolves,
|
|
573
|
+
* and returns a new promise that resolves to the callback's return value
|
|
574
|
+
*/
|
|
575
|
+
export class PromiseThenSemantics implements MethodSemantics {
|
|
576
|
+
getReturnType(): string {
|
|
577
|
+
return 'unknown'; // Returns a Promise resolving to the callback's return
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
addEquivalences(
|
|
581
|
+
methodCallPath: StructuredPath,
|
|
582
|
+
sourcePath: StructuredPath,
|
|
583
|
+
context: AnalysisContext,
|
|
584
|
+
): void {
|
|
585
|
+
// Get the callback argument
|
|
586
|
+
const functionCallSegment = methodCallPath.getLastFunctionCallSegment();
|
|
587
|
+
|
|
588
|
+
if (functionCallSegment && functionCallSegment.args.length > 0) {
|
|
589
|
+
const callbackPath = functionCallSegment.args[0];
|
|
590
|
+
|
|
591
|
+
// Mark the callback as a function
|
|
592
|
+
context.addType(callbackPath, 'function');
|
|
593
|
+
|
|
594
|
+
// The callback's first parameter receives the resolved value of the source promise
|
|
595
|
+
// For promise.then(response => ...), response = promise's resolved value
|
|
596
|
+
// Note: Don't add .functionCallReturnValue - the system adds it automatically
|
|
597
|
+
// via toRightHandSideString() when storing equivalences
|
|
598
|
+
context.addEquivalence(callbackPath.withParameter(0), sourcePath);
|
|
599
|
+
|
|
600
|
+
// The .then() return value (when chained) resolves to the callback's return
|
|
601
|
+
// This enables chained .then() calls to track through
|
|
602
|
+
context.addEquivalence(
|
|
603
|
+
methodCallPath.withProperty('functionCallReturnValue'),
|
|
604
|
+
callbackPath.withProperty('returnValue'),
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
isComplete(): boolean {
|
|
610
|
+
return true;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
426
614
|
/**
|
|
427
615
|
* UseMemo React hook semantics
|
|
428
616
|
*
|
|
@@ -513,13 +701,22 @@ export function createMethodRegistry(): MethodSemanticsRegistry {
|
|
|
513
701
|
// Register array methods
|
|
514
702
|
registry.register('filter', new ArrayFilterSemantics(), 'Array');
|
|
515
703
|
registry.register('map', new ArrayMapSemantics(), 'Array');
|
|
704
|
+
registry.register('flatMap', new ArrayFlatMapSemantics(), 'Array');
|
|
516
705
|
registry.register('join', new ArrayJoinSemantics(), 'Array');
|
|
517
706
|
registry.register('find', new ArrayFindSemantics(), 'Array');
|
|
707
|
+
registry.register('findLast', new ArrayFindLastSemantics(), 'Array');
|
|
708
|
+
registry.register('at', new ArrayAtSemantics(), 'Array');
|
|
518
709
|
registry.register('reduce', new ArrayReduceSemantics(), 'Array');
|
|
519
710
|
registry.register('concat', new ArrayConcatSemantics(), 'Array');
|
|
520
711
|
registry.register('slice', new ArraySliceSemantics(), 'Array');
|
|
521
712
|
registry.register('splice', new ArraySpliceSemantics(), 'Array');
|
|
522
713
|
|
|
714
|
+
// Register Object methods
|
|
715
|
+
registry.register('fromEntries', new ObjectFromEntriesSemantics(), 'Object');
|
|
716
|
+
|
|
717
|
+
// Register Promise methods
|
|
718
|
+
registry.register('then', new PromiseThenSemantics(), 'Promise');
|
|
719
|
+
|
|
523
720
|
// Register React hooks
|
|
524
721
|
registry.register('useState', new UseStateSemantics(), 'React');
|
|
525
722
|
registry.register('useMemo', new UseMemoSemantics(), 'React');
|
|
@@ -17,6 +17,25 @@ interface ToStringWithSegmentsOptions {
|
|
|
17
17
|
withNestedReturnValues?: boolean;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Check if a string is a valid JavaScript identifier (can use dot notation)
|
|
22
|
+
* Valid identifiers start with a letter, underscore, or dollar sign
|
|
23
|
+
* and contain only letters, digits, underscores, and dollar signs
|
|
24
|
+
*
|
|
25
|
+
* Also allows computed property markers like *f.path* (wrapped in asterisks)
|
|
26
|
+
* which are used internally to represent dynamic property accesses
|
|
27
|
+
*/
|
|
28
|
+
function isValidIdentifier(name: string): boolean {
|
|
29
|
+
if (!name || name.length === 0) return false;
|
|
30
|
+
// First char: letter, underscore, or dollar sign
|
|
31
|
+
// Rest: letter, digit, underscore, or dollar sign
|
|
32
|
+
// Also allow computed property markers like *expression*
|
|
33
|
+
return (
|
|
34
|
+
/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name) ||
|
|
35
|
+
(name.startsWith('*') && name.endsWith('*'))
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
20
39
|
/**
|
|
21
40
|
* A structured representation of a variable or property path
|
|
22
41
|
*
|
|
@@ -335,8 +354,15 @@ export class StructuredPath {
|
|
|
335
354
|
switch (segment.type) {
|
|
336
355
|
case PathRelationship.PROPERTY:
|
|
337
356
|
const propSegment = segment as PropertySegment;
|
|
338
|
-
|
|
339
|
-
|
|
357
|
+
// Use bracket notation for property names that aren't valid identifiers
|
|
358
|
+
// (e.g. names with spaces, hyphens, starting with numbers, etc.)
|
|
359
|
+
if (isValidIdentifier(propSegment.name)) {
|
|
360
|
+
if (result) result += '.';
|
|
361
|
+
result += propSegment.name;
|
|
362
|
+
} else {
|
|
363
|
+
// Use bracket notation with quoted string for non-identifier names
|
|
364
|
+
result += `['${propSegment.name}']`;
|
|
365
|
+
}
|
|
340
366
|
break;
|
|
341
367
|
|
|
342
368
|
case PathRelationship.ELEMENT:
|
|
@@ -326,6 +326,46 @@ export function processExpression({
|
|
|
326
326
|
if (targetPath) {
|
|
327
327
|
context.addEquivalence(targetPath, nodePath);
|
|
328
328
|
context.addType(targetPath, inferredNodeType);
|
|
329
|
+
|
|
330
|
+
// Propagate sub-properties from the identifier to the targetPath
|
|
331
|
+
// This handles cases like: dataItem={{ structure: completeDataStructure }}
|
|
332
|
+
// where completeDataStructure was defined as { 'Function Arguments': dataStructure.arguments }
|
|
333
|
+
// We need to propagate completeDataStructure['Function Arguments'] to
|
|
334
|
+
// ChildComponent().signature[0].dataItem.structure['Function Arguments']
|
|
335
|
+
const nodePathStr = nodePath.toString();
|
|
336
|
+
const equivalentVariables = context.getEquivalentVariables();
|
|
337
|
+
const structure = context.getStructure();
|
|
338
|
+
|
|
339
|
+
// Propagate existing equivalencies for sub-properties
|
|
340
|
+
for (const [key, value] of Object.entries(equivalentVariables)) {
|
|
341
|
+
// Check if this equivalency is for a sub-property of the identifier
|
|
342
|
+
// e.g., completeDataStructure['Function Arguments'] or completeDataStructure.foo
|
|
343
|
+
if (
|
|
344
|
+
key.startsWith(nodePathStr + '.') ||
|
|
345
|
+
key.startsWith(nodePathStr + '[')
|
|
346
|
+
) {
|
|
347
|
+
const subPath = key.substring(nodePathStr.length);
|
|
348
|
+
const newTargetPath = StructuredPath.fromBase(
|
|
349
|
+
targetPath.toString() + subPath,
|
|
350
|
+
);
|
|
351
|
+
const valuePath = StructuredPath.fromBase(value);
|
|
352
|
+
context.addEquivalence(newTargetPath, valuePath);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Propagate existing structure entries for sub-properties
|
|
357
|
+
for (const [key, value] of Object.entries(structure)) {
|
|
358
|
+
if (
|
|
359
|
+
key.startsWith(nodePathStr + '.') ||
|
|
360
|
+
key.startsWith(nodePathStr + '[')
|
|
361
|
+
) {
|
|
362
|
+
const subPath = key.substring(nodePathStr.length);
|
|
363
|
+
const newTargetPath = StructuredPath.fromBase(
|
|
364
|
+
targetPath.toString() + subPath,
|
|
365
|
+
);
|
|
366
|
+
context.addType(newTargetPath, value);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
329
369
|
}
|
|
330
370
|
context.addType(nodePath, inferredNodeType);
|
|
331
371
|
return true;
|
|
@@ -756,6 +796,9 @@ export function processExpression({
|
|
|
756
796
|
} else {
|
|
757
797
|
resultType = rightType || 'unknown';
|
|
758
798
|
}
|
|
799
|
+
// For || and ??, create an equivalence to the left side
|
|
800
|
+
// This ensures the equivalency chain is preserved through fallback expressions
|
|
801
|
+
// e.g., `const tab = segments[0] || 'default'` should trace tab back to segments[0]
|
|
759
802
|
if (operatorKind === ts.SyntaxKind.QuestionQuestionToken) {
|
|
760
803
|
// specifically for ?? we create an equivalence to the left side
|
|
761
804
|
if (targetPath) {
|
|
@@ -774,6 +817,17 @@ export function processExpression({
|
|
|
774
817
|
context.sourceFile,
|
|
775
818
|
);
|
|
776
819
|
}
|
|
820
|
+
} else if (operatorKind === ts.SyntaxKind.BarBarToken) {
|
|
821
|
+
// For ||, also create an equivalence to the left side
|
|
822
|
+
// This enables data flow tracing through fallback expressions
|
|
823
|
+
if (targetPath) {
|
|
824
|
+
resultPath = StructuredPath.fromNode(
|
|
825
|
+
unwrappedNode.left,
|
|
826
|
+
context.sourceFile,
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
// Note: Unlike ??, we don't set targetPath when there's no target
|
|
830
|
+
// because || is often used in boolean contexts where the full expression matters
|
|
777
831
|
}
|
|
778
832
|
} else if (operatorKind === ts.SyntaxKind.InstanceOfKeyword) {
|
|
779
833
|
resultType = 'boolean';
|
|
@@ -1009,24 +1063,27 @@ export function processExpression({
|
|
|
1009
1063
|
context.addType(valuePath, valueType);
|
|
1010
1064
|
} else if (ts.isSpreadAssignment(property)) {
|
|
1011
1065
|
// Handle spread: { ...obj }
|
|
1012
|
-
// Process the spread expression first (without targetPath for now)
|
|
1013
|
-
processExpression({ node: property.expression, context });
|
|
1014
|
-
|
|
1015
1066
|
// Create a path for this spread source
|
|
1016
1067
|
let spreadSourcePath: StructuredPath | null = null;
|
|
1017
1068
|
|
|
1018
1069
|
// Handle simple identifier spread: { ...obj }
|
|
1019
1070
|
if (ts.isIdentifier(property.expression)) {
|
|
1071
|
+
// Process the spread expression first
|
|
1072
|
+
processExpression({ node: property.expression, context });
|
|
1073
|
+
|
|
1020
1074
|
spreadSourcePath = StructuredPath.fromBase(
|
|
1021
1075
|
property.expression.text,
|
|
1022
1076
|
);
|
|
1023
1077
|
// Establish equivalence between the target and the spread source
|
|
1024
1078
|
context.addEquivalence(targetPath, spreadSourcePath);
|
|
1025
|
-
// and we
|
|
1079
|
+
// and we know obj is an object
|
|
1026
1080
|
context.addType(spreadSourcePath, 'object');
|
|
1027
1081
|
}
|
|
1028
1082
|
// Handle property access spread: { ...obj.prop }
|
|
1029
1083
|
else if (ts.isPropertyAccessExpression(property.expression)) {
|
|
1084
|
+
// Process the spread expression first
|
|
1085
|
+
processExpression({ node: property.expression, context });
|
|
1086
|
+
|
|
1030
1087
|
spreadSourcePath = StructuredPath.fromNode(
|
|
1031
1088
|
property.expression,
|
|
1032
1089
|
context.sourceFile,
|
|
@@ -1035,8 +1092,55 @@ export function processExpression({
|
|
|
1035
1092
|
context.addEquivalence(targetPath, spreadSourcePath);
|
|
1036
1093
|
}
|
|
1037
1094
|
}
|
|
1095
|
+
// Handle object literal spread: { ...{ key: value } }
|
|
1096
|
+
// This propagates sub-properties from the spread object to the target
|
|
1097
|
+
else if (ts.isObjectLiteralExpression(property.expression)) {
|
|
1098
|
+
// Recursively process the spread object literal WITH targetPath
|
|
1099
|
+
// This ensures sub-properties like { args: x } become targetPath.args = x
|
|
1100
|
+
processExpression({
|
|
1101
|
+
node: property.expression,
|
|
1102
|
+
context,
|
|
1103
|
+
targetPath,
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
// Handle conditional spread: { ...(x ? {...} : {}) }
|
|
1107
|
+
else if (ts.isParenthesizedExpression(property.expression)) {
|
|
1108
|
+
// Unwrap parentheses and process
|
|
1109
|
+
const unwrapped = property.expression.expression;
|
|
1110
|
+
|
|
1111
|
+
// Handle conditional expression inside parens: (x ? {...} : {})
|
|
1112
|
+
if (ts.isConditionalExpression(unwrapped)) {
|
|
1113
|
+
// Process both branches - whenTrue and whenFalse
|
|
1114
|
+
// For tracing, we care about non-empty branches
|
|
1115
|
+
if (ts.isObjectLiteralExpression(unwrapped.whenTrue)) {
|
|
1116
|
+
processExpression({
|
|
1117
|
+
node: unwrapped.whenTrue,
|
|
1118
|
+
context,
|
|
1119
|
+
targetPath,
|
|
1120
|
+
});
|
|
1121
|
+
} else {
|
|
1122
|
+
processExpression({ node: unwrapped.whenTrue, context });
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
if (ts.isObjectLiteralExpression(unwrapped.whenFalse)) {
|
|
1126
|
+
processExpression({
|
|
1127
|
+
node: unwrapped.whenFalse,
|
|
1128
|
+
context,
|
|
1129
|
+
targetPath,
|
|
1130
|
+
});
|
|
1131
|
+
} else {
|
|
1132
|
+
processExpression({ node: unwrapped.whenFalse, context });
|
|
1133
|
+
}
|
|
1134
|
+
} else {
|
|
1135
|
+
// Other parenthesized expression - just process normally
|
|
1136
|
+
processExpression({ node: property.expression, context });
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1038
1139
|
// Handle other expression types
|
|
1039
1140
|
else {
|
|
1141
|
+
// Process the spread expression
|
|
1142
|
+
processExpression({ node: property.expression, context });
|
|
1143
|
+
|
|
1040
1144
|
// For complex expressions, use their source representation
|
|
1041
1145
|
spreadSourcePath = nodeToSource(
|
|
1042
1146
|
property.expression,
|
|
@@ -1960,6 +2064,25 @@ export function processExpression({
|
|
|
1960
2064
|
return result;
|
|
1961
2065
|
}
|
|
1962
2066
|
|
|
2067
|
+
// Handle yield expressions in generator functions
|
|
2068
|
+
if (ts.isYieldExpression(unwrappedNode)) {
|
|
2069
|
+
// yield returns whatever is yielded, or undefined if no expression
|
|
2070
|
+
if (unwrappedNode.expression) {
|
|
2071
|
+
// Process the yielded expression
|
|
2072
|
+
const result = processExpression({
|
|
2073
|
+
node: unwrappedNode.expression,
|
|
2074
|
+
context,
|
|
2075
|
+
targetPath,
|
|
2076
|
+
});
|
|
2077
|
+
return result;
|
|
2078
|
+
}
|
|
2079
|
+
// yield with no expression returns undefined
|
|
2080
|
+
if (targetPath) {
|
|
2081
|
+
context.addType(targetPath, 'undefined');
|
|
2082
|
+
}
|
|
2083
|
+
return true;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
1963
2086
|
if (ts.isRegularExpressionLiteral(unwrappedNode)) {
|
|
1964
2087
|
// Regular expressions are treated as string literals
|
|
1965
2088
|
const regexPath = StructuredPath.createLiteralPath(
|