@codeyam/codeyam-cli 0.1.0-staging.76566f9 → 0.1.0-staging.79ef713
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 +15 -12
- package/analyzer-template/packages/ai/index.ts +20 -5
- package/analyzer-template/packages/ai/package.json +3 -3
- package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +212 -24
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +183 -10
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +181 -23
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +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 +1128 -30
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +259 -6
- 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 +1577 -313
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +296 -35
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +54 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +129 -20
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +80 -5
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +393 -90
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/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 +33 -7
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +86 -142
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +59 -3
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1358 -67
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +200 -196
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +578 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2267 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +5 -5
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +328 -7
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +111 -87
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -142
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +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 +824 -0
- package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +122 -3
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
- package/analyzer-template/packages/analyze/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +79 -59
- package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
- package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +449 -283
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +34 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
- package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
- package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +201 -46
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +254 -41
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +306 -20
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +264 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -3
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +723 -46
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
- package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
- package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
- package/analyzer-template/packages/aws/package.json +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/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +17 -1
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
- package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
- package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
- package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +7 -3
- package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
- 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/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +8 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -18
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +17 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/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/loadAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
- package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.js +3 -0
- package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/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/Commit.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +3 -0
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +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 +153 -5
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/github/package.json +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/Commit.ts +2 -0
- package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
- package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +9 -77
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +181 -5
- package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- package/analyzer-template/packages/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/Commit.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +3 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +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 +153 -5
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/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 +57 -26
- package/analyzer-template/playwright/captureStatic.ts +1 -1
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/analyzeBaselineCommit.ts +9 -0
- package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
- package/analyzer-template/project/analyzeFileEntities.ts +4 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +9 -0
- package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
- package/analyzer-template/project/constructMockCode.ts +1004 -105
- package/analyzer-template/project/controller/startController.ts +16 -1
- package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
- package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
- package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
- package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
- package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
- package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
- package/analyzer-template/project/orchestrateCapture.ts +81 -9
- package/analyzer-template/project/reconcileMockDataKeys.ts +240 -0
- package/analyzer-template/project/runAnalysis.ts +11 -0
- package/analyzer-template/project/serverOnlyModules.ts +127 -2
- package/analyzer-template/project/start.ts +51 -15
- package/analyzer-template/project/startScenarioCapture.ts +6 -0
- package/analyzer-template/project/writeMockDataTsx.ts +298 -11
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +312 -42
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +23 -13
- package/analyzer-template/scripts/comboWorkerLoop.cjs +99 -50
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/analyzer-template/tsconfig.json +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 +7 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js +7 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +879 -69
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/controller/startController.js +11 -1
- package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +3 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +7 -5
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +65 -10
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +199 -0
- 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 +47 -15
- 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 +255 -8
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +245 -41
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
- package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +23 -13
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +180 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/cli.js +7 -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 +35 -23
- 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/memory.js +264 -0
- package/codeyam-cli/src/commands/memory.js.map +1 -0
- 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 +29 -15
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +16 -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 +76 -17
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +109 -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/ruleReflection/__tests__/confusionDetector.test.js +82 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +285 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +115 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/index.js +6 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -0
- package/codeyam-cli/src/utils/rules/parser.js +78 -0
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
- package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
- package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +137 -0
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
- package/codeyam-cli/src/utils/serverState.js.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 +74 -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/CopyButton-CA3JxPb7.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-B86KKU7e.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CzGX-miz.js → EntityTypeBadge-B5ctlSYt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BqY8gDAW.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-ClaLpuOo.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-BDhPilK7.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CBQPrpT0.js → LibraryFunctionPreview-VeqEBv9v.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-D1CdlbrV.js → LoadingDots-Bs7Nn1Jr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-wDPcZNKx.js → LogViewer-Bm3PmcCz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-C6PKeMYR.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-BfmDgXxG.js → SafeScreenshot-Gq3Ocjo6.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BNLaXBHR.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-6J7zDUD5.js → TruncatedFilePath-CiwXDxLh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-B3TDXxnk.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BtBFH820.js +27 -0
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DfKzxuoe.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/book-open-PttOB2SF.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BYimnrHg.js → chevron-down-TJp6ofnp.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-JE9ZIoBl.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CaVsIRxt.js → circle-check-CXhHQYrI.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-6y9ALfGT.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CgUsG7ib.js → createLucideIcon-Ca9fAY46.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-C5lqplTC.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-Dt-SjPsw.js → entity._sha._-n38keI1k.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DGgZjdFg.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CfLCUi9S.js → entity._sha_.edit._scenarioId-38yPijoD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DKJyZfAY.js → entry.client-BSHEfydn.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-DCPhhSMo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-0N0YJQv7.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{git-D62Lxxmv.js → git-DXnyr8uP.js} +8 -8
- package/codeyam-cli/src/webserver/build/client/assets/globals-Bh6jH0cL.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-BosqDOlH.js → index-CcsFv748.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-CzNNiTkw.js → index-ChN9-fAY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-CdVUfvji.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CNp9QFCX.js → loader-circle-CTqLEAGU.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-87319d0f.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-CPIDnDEj.js +76 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-D6vreykR.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-D6oziHts.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-DDGjYAMJ.js → search-B8VUL8nl.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-eBI36Yv5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CPoAg7Zo.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/terminal-BrCP7uQo.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CBc5dE1s.js → triangle-alert-BZz2NjYa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-DNwUduNu.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BqPPNjAl.js → useLastLogLine-COky1GVF.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CpZgwliL.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-DWHcCcl1.js → useToast-Bv9JFvUO.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-9ox9LcrG.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Cq5Vqcob.js +260 -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-memory-hook.sh +199 -0
- package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam:debug.md} +48 -4
- package/codeyam-cli/templates/{debug-codeyam.md → codeyam:diagnose.md} +204 -26
- package/codeyam-cli/templates/codeyam:memory.md +404 -0
- package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
- package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam:setup.md} +1 -1
- package/codeyam-cli/templates/{codeyam-sim-skill.md → codeyam:sim.md} +1 -1
- package/codeyam-cli/templates/{codeyam-test-skill.md → codeyam:test.md} +1 -1
- package/codeyam-cli/templates/{codeyam-verify-skill.md → codeyam:verify.md} +1 -1
- package/codeyam-cli/templates/rule-notification-hook.py +56 -0
- package/codeyam-cli/templates/rule-reflection-hook.py +590 -0
- package/codeyam-cli/templates/rules-instructions.md +123 -0
- package/package.json +12 -9
- package/packages/ai/index.js +8 -6
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +165 -13
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +138 -9
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js +138 -23
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +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 +866 -29
- 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 +1240 -181
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +230 -23
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +52 -3
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +111 -14
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +73 -5
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +333 -81
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
- package/packages/ai/src/lib/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 +21 -5
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +78 -120
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +47 -2
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +1082 -62
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +177 -163
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +400 -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 +1646 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -2
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +270 -7
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +88 -46
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -100
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +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 +677 -0
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
- package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
- package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/index.js +1 -0
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +75 -36
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
- package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/analysisContext.js +30 -5
- package/packages/analyze/src/lib/analysisContext.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
- package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +196 -57
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +24 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
- package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
- package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +170 -40
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +211 -29
- 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 +218 -20
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +144 -0
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -3
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +599 -38
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
- package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/index.js +1 -0
- package/packages/analyze/src/lib/index.js.map +1 -1
- package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
- package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +8 -1
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/packages/database/src/lib/loadAnalyses.js +45 -2
- package/packages/database/src/lib/loadAnalyses.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +8 -0
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadBranch.js +11 -1
- package/packages/database/src/lib/loadBranch.js.map +1 -1
- package/packages/database/src/lib/loadCommit.js +7 -0
- package/packages/database/src/lib/loadCommit.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +22 -1
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +23 -4
- package/packages/database/src/lib/loadEntities.js.map +1 -1
- package/packages/database/src/lib/loadEntityBranches.js +9 -0
- package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/database/src/lib/updateCommitMetadata.js +5 -4
- package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/packages/generate/index.js +3 -0
- package/packages/generate/index.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/packages/generate/src/lib/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/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)-CVP_WGQ3.js +0 -32
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +0 -51
- package/codeyam-cli/src/webserver/build/client/assets/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-C9s7Lhdl.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-0d27da29.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-B_wIKCIf.js +0 -56
- package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CU58-Ttc.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-D35o2uae.js +0 -175
- package/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.agent-transcripts-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-key-attributes-l0sNRNKZ.js → api.health-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-valid-values-l0sNRNKZ.js → api.memory-profile-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
|
@@ -79,15 +79,29 @@
|
|
|
79
79
|
* - `helpers/README.md` - Overview of the helper module architecture
|
|
80
80
|
*/
|
|
81
81
|
import fillInSchemaGapsAndUnknowns from "./helpers/fillInSchemaGapsAndUnknowns.js";
|
|
82
|
+
import { clearCleanKnownObjectFunctionsCache } from "./helpers/cleanKnownObjectFunctions.js";
|
|
83
|
+
import { clearCleanNonObjectFunctionsCache } from "./helpers/cleanNonObjectFunctions.js";
|
|
84
|
+
/**
|
|
85
|
+
* Patterns that indicate recursive type structures in schema paths.
|
|
86
|
+
* Used by hasExcessivePatternRepetition() to detect exponential path blowup.
|
|
87
|
+
*/
|
|
88
|
+
const RECURSIVE_PATH_PATTERNS = [
|
|
89
|
+
/\.attributes\.properties\[\]/g, // TypeScript AST JSX nodes
|
|
90
|
+
/\.children\[\]/g, // Tree structures
|
|
91
|
+
/\.elements\[\]/g, // Array-like structures
|
|
92
|
+
/\.members\[\]/g, // Class/interface members
|
|
93
|
+
/\.properties\[\]/g, // Object properties
|
|
94
|
+
/\.items\[\]/g, // Generic items arrays
|
|
95
|
+
];
|
|
82
96
|
import ensureSchemaConsistency from "./helpers/ensureSchemaConsistency.js";
|
|
83
97
|
import cleanPath from "./helpers/cleanPath.js";
|
|
84
98
|
import { PathManager } from "./helpers/PathManager.js";
|
|
85
|
-
import { uniqueId,
|
|
99
|
+
import { uniqueId, uniqueScopeAndPaths, uniqueScopeVariables, } from "./helpers/uniqueIdUtils.js";
|
|
86
100
|
import selectBestValue from "./helpers/selectBestValue.js";
|
|
87
101
|
import { VisitedTracker } from "./helpers/VisitedTracker.js";
|
|
88
102
|
import { DebugTracer } from "./helpers/DebugTracer.js";
|
|
89
103
|
import { BatchSchemaProcessor } from "./helpers/BatchSchemaProcessor.js";
|
|
90
|
-
import {
|
|
104
|
+
import { ROOT_SCOPE_NAME, ScopeTreeManager, } from "./helpers/ScopeTreeManager.js";
|
|
91
105
|
import cleanScopeNodeName from "./helpers/cleanScopeNodeName.js";
|
|
92
106
|
import getFunctionCallRoot from "./helpers/getFunctionCallRoot.js";
|
|
93
107
|
import cleanPathOfNonTransformingFunctions from "./helpers/cleanPathOfNonTransformingFunctions.js";
|
|
@@ -108,6 +122,17 @@ export function resetScopeDataStructureMetrics() {
|
|
|
108
122
|
followEquivalenciesEarlyExitPhase1Count = 0;
|
|
109
123
|
followEquivalenciesWithWorkCount = 0;
|
|
110
124
|
addEquivalencyCallCount = 0;
|
|
125
|
+
// Clear module-level caches to prevent unbounded memory growth across entities
|
|
126
|
+
const knownObjectCache = clearCleanKnownObjectFunctionsCache();
|
|
127
|
+
const nonObjectCache = clearCleanNonObjectFunctionsCache();
|
|
128
|
+
if (knownObjectCache.count > 0 || nonObjectCache.count > 0) {
|
|
129
|
+
const totalBytes = knownObjectCache.estimatedBytes + nonObjectCache.estimatedBytes;
|
|
130
|
+
console.log('CodeYam: Cleared analysis caches', {
|
|
131
|
+
knownObjectCache: `${knownObjectCache.count} entries, ${(knownObjectCache.estimatedBytes / 1024).toFixed(1)}KB`,
|
|
132
|
+
nonObjectCache: `${nonObjectCache.count} entries, ${(nonObjectCache.estimatedBytes / 1024).toFixed(1)}KB`,
|
|
133
|
+
totalKB: `${(totalBytes / 1024).toFixed(1)}KB`,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
111
136
|
}
|
|
112
137
|
// Performance: Pre-computed Sets for equivalency reason filtering (O(1) vs O(n))
|
|
113
138
|
const ALLOWED_EQUIVALENCY_REASONS = new Set([
|
|
@@ -176,6 +201,26 @@ export class ScopeDataStructure {
|
|
|
176
201
|
* Maps local variable path to array of usages.
|
|
177
202
|
*/
|
|
178
203
|
this.rawConditionalUsages = {};
|
|
204
|
+
/**
|
|
205
|
+
* Conditional effects collected during AST analysis.
|
|
206
|
+
* Tracks what setter calls happen inside conditionals (if, switch, ternary).
|
|
207
|
+
*/
|
|
208
|
+
this.rawConditionalEffects = [];
|
|
209
|
+
/**
|
|
210
|
+
* Compound conditionals collected during AST analysis.
|
|
211
|
+
* Groups conditions that must all be true together (e.g., a && b && c).
|
|
212
|
+
*/
|
|
213
|
+
this.rawCompoundConditionals = [];
|
|
214
|
+
/**
|
|
215
|
+
* Gating conditions for child component boundaries.
|
|
216
|
+
* Maps child component name to the conditions that must be true for it to render.
|
|
217
|
+
*/
|
|
218
|
+
this.rawChildBoundaryGatingConditions = {};
|
|
219
|
+
/**
|
|
220
|
+
* JSX rendering usages collected during AST analysis.
|
|
221
|
+
* Tracks arrays rendered via .map() and strings interpolated in JSX.
|
|
222
|
+
*/
|
|
223
|
+
this.rawJsxRenderingUsages = [];
|
|
179
224
|
this.lastAddToSchemaId = 0;
|
|
180
225
|
this.lastEquivalencyId = 0;
|
|
181
226
|
this.lastEquivalencyDatabaseId = 0;
|
|
@@ -430,6 +475,10 @@ export class ScopeDataStructure {
|
|
|
430
475
|
}
|
|
431
476
|
return;
|
|
432
477
|
}
|
|
478
|
+
// PERF: Early exit for paths with repeated function-call signature patterns
|
|
479
|
+
if (this.hasExcessivePatternRepetition(path)) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
433
482
|
// Update chain metadata for database tracking
|
|
434
483
|
if (equivalencyValueChain.length > 0) {
|
|
435
484
|
equivalencyValueChain[equivalencyValueChain.length - 1].addToSchemaId =
|
|
@@ -599,7 +648,6 @@ export class ScopeDataStructure {
|
|
|
599
648
|
}
|
|
600
649
|
addEquivalency(path, equivalentPath, equivalentScopeName, scopeNode, equivalencyReason, equivalencyValueChain, traceId) {
|
|
601
650
|
var _a;
|
|
602
|
-
// DEBUG: Detect infinite loops
|
|
603
651
|
addEquivalencyCallCount++;
|
|
604
652
|
if (addEquivalencyCallCount > 50000) {
|
|
605
653
|
console.error('INFINITE LOOP DETECTED in addEquivalency', {
|
|
@@ -927,6 +975,12 @@ export class ScopeDataStructure {
|
|
|
927
975
|
const value1 = scopeNode.schema[schemaPath];
|
|
928
976
|
const value2 = equivalentScopeNode.schema[equivalentSchemaPath];
|
|
929
977
|
const bestValue = selectBestValue(value1, value2);
|
|
978
|
+
// PERF: Skip paths with repeated function-call signature patterns
|
|
979
|
+
// to prevent recursive type expansion (e.g., string.localeCompare returns string)
|
|
980
|
+
if (this.hasExcessivePatternRepetition(schemaPath) ||
|
|
981
|
+
this.hasExcessivePatternRepetition(equivalentSchemaPath)) {
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
930
984
|
scopeNode.schema[schemaPath] = bestValue;
|
|
931
985
|
equivalentScopeNode.schema[equivalentSchemaPath] = bestValue;
|
|
932
986
|
}
|
|
@@ -938,6 +992,10 @@ export class ScopeDataStructure {
|
|
|
938
992
|
equivalentPath,
|
|
939
993
|
...remainingSchemaPathParts,
|
|
940
994
|
]);
|
|
995
|
+
// PERF: Skip paths with repeated function-call signature patterns
|
|
996
|
+
if (this.hasExcessivePatternRepetition(newEquivalentPath)) {
|
|
997
|
+
continue;
|
|
998
|
+
}
|
|
941
999
|
equivalentScopeNode.schema[newEquivalentPath] =
|
|
942
1000
|
scopeNode.schema[schemaPath];
|
|
943
1001
|
}
|
|
@@ -994,26 +1052,103 @@ export class ScopeDataStructure {
|
|
|
994
1052
|
isValidPath(path) {
|
|
995
1053
|
return this.pathManager.isValidPath(path);
|
|
996
1054
|
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Detects if a path contains excessive repetition of the same pattern.
|
|
1057
|
+
*
|
|
1058
|
+
* This prevents exponential blowup when analyzing recursive type structures.
|
|
1059
|
+
* For example, TypeScript AST nodes have `.attributes.properties[]` where each
|
|
1060
|
+
* property is also a node with `.attributes.properties[]`. Without this check,
|
|
1061
|
+
* paths like `signature[0].attributes.properties[].attributes.properties[].attributes.properties[]...`
|
|
1062
|
+
* would be generated exponentially.
|
|
1063
|
+
*
|
|
1064
|
+
* Two detection strategies:
|
|
1065
|
+
* 1. Known patterns: Check RECURSIVE_PATH_PATTERNS for common recursive structures
|
|
1066
|
+
* 2. Generic detection: For longer paths, detect any 2-3 part segment that repeats
|
|
1067
|
+
*
|
|
1068
|
+
* @param path - The schema path to check
|
|
1069
|
+
* @param maxRepetitions - Maximum allowed repetitions of any pattern (default: 2)
|
|
1070
|
+
* @returns true if the path has excessive repetition
|
|
1071
|
+
*/
|
|
1072
|
+
hasExcessivePatternRepetition(path, maxRepetitions = 2) {
|
|
1073
|
+
// Check known recursive patterns
|
|
1074
|
+
for (const pattern of RECURSIVE_PATH_PATTERNS) {
|
|
1075
|
+
const matches = path.match(pattern);
|
|
1076
|
+
if (matches && matches.length > maxRepetitions) {
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
// Check for repeated function calls that indicate recursive type expansion.
|
|
1081
|
+
// E.g., localeCompare(b[])...localeCompare(b[]) means string.localeCompare
|
|
1082
|
+
// returns a type that again has localeCompare, causing infinite expansion.
|
|
1083
|
+
// We extract all function call patterns like "funcName(args)" and check if
|
|
1084
|
+
// the same normalized call appears more than once.
|
|
1085
|
+
const funcCallPattern = /(?:^|\.)[^.([]+\([^)]*\)/g;
|
|
1086
|
+
const funcCallMatches = path.match(funcCallPattern);
|
|
1087
|
+
if (funcCallMatches && funcCallMatches.length > 1) {
|
|
1088
|
+
const seen = new Set();
|
|
1089
|
+
for (const match of funcCallMatches) {
|
|
1090
|
+
// Strip leading dot and normalize array indices
|
|
1091
|
+
const normalized = match.replace(/^\./, '').replace(/\[\d+\]/g, '[]');
|
|
1092
|
+
if (seen.has(normalized))
|
|
1093
|
+
return true;
|
|
1094
|
+
seen.add(normalized);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
// For longer paths, detect any repeated multi-part segments we haven't explicitly listed
|
|
1098
|
+
const pathParts = this.splitPath(path);
|
|
1099
|
+
if (pathParts.length <= 6) {
|
|
1100
|
+
return false;
|
|
1101
|
+
}
|
|
1102
|
+
// Check for repeated sequences of 2-3 consecutive parts
|
|
1103
|
+
for (let segmentLength = 2; segmentLength <= 3; segmentLength++) {
|
|
1104
|
+
const seen = new Map();
|
|
1105
|
+
for (let i = 0; i <= pathParts.length - segmentLength; i++) {
|
|
1106
|
+
const segment = pathParts.slice(i, i + segmentLength).join('.');
|
|
1107
|
+
const normalizedSegment = segment.replace(/\[\d+\]/g, '[]');
|
|
1108
|
+
const count = (seen.get(normalizedSegment) || 0) + 1;
|
|
1109
|
+
seen.set(normalizedSegment, count);
|
|
1110
|
+
if (count > maxRepetitions) {
|
|
1111
|
+
return true;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
return false;
|
|
1116
|
+
}
|
|
997
1117
|
addToTree(pathParts) {
|
|
998
1118
|
this.scopeTreeManager.addPath(pathParts);
|
|
999
1119
|
}
|
|
1000
1120
|
setInstantiatedVariables(scopeNode) {
|
|
1001
1121
|
let instantiatedVariables = scopeNode.analysis?.instantiatedVariables ?? [];
|
|
1002
|
-
for (const [path,
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1122
|
+
for (const [path, rawEquivalentPath] of Object.entries(scopeNode.analysis.isolatedEquivalentVariables ?? {})) {
|
|
1123
|
+
// Normalize to array for consistent handling (supports both string and string[])
|
|
1124
|
+
const equivalentPaths = Array.isArray(rawEquivalentPath)
|
|
1125
|
+
? rawEquivalentPath
|
|
1126
|
+
: rawEquivalentPath
|
|
1127
|
+
? [rawEquivalentPath]
|
|
1128
|
+
: [];
|
|
1129
|
+
for (const equivalentPath of equivalentPaths) {
|
|
1130
|
+
if (typeof equivalentPath !== 'string') {
|
|
1131
|
+
continue;
|
|
1132
|
+
}
|
|
1133
|
+
if (equivalentPath.startsWith('signature[')) {
|
|
1134
|
+
const equivalentPathParts = this.splitPath(equivalentPath);
|
|
1135
|
+
instantiatedVariables.push(equivalentPathParts[0]);
|
|
1136
|
+
instantiatedVariables.push(path);
|
|
1137
|
+
}
|
|
1010
1138
|
}
|
|
1011
1139
|
const duplicateInstantiated = instantiatedVariables.find((v) => path.split('::cyDuplicateKey')[0] === v.split('::cyDuplicateKey')[0]);
|
|
1012
1140
|
if (duplicateInstantiated) {
|
|
1013
1141
|
instantiatedVariables.push(path);
|
|
1014
1142
|
}
|
|
1015
1143
|
}
|
|
1016
|
-
|
|
1144
|
+
const instantiatedSeen = new Set();
|
|
1145
|
+
instantiatedVariables = instantiatedVariables.filter((varName) => {
|
|
1146
|
+
if (instantiatedSeen.has(varName)) {
|
|
1147
|
+
return false;
|
|
1148
|
+
}
|
|
1149
|
+
instantiatedSeen.add(varName);
|
|
1150
|
+
return true;
|
|
1151
|
+
});
|
|
1017
1152
|
scopeNode.instantiatedVariables = instantiatedVariables;
|
|
1018
1153
|
if (!scopeNode.tree || scopeNode.tree.length === 0) {
|
|
1019
1154
|
return;
|
|
@@ -1025,125 +1160,156 @@ export class ScopeDataStructure {
|
|
|
1025
1160
|
const parentInstantiatedVariables = [
|
|
1026
1161
|
...(parentScopeNode.parentInstantiatedVariables ?? []),
|
|
1027
1162
|
...parentScopeNode.instantiatedVariables.filter((v) => !v.startsWith('signature[') && !v.startsWith('returnValue')),
|
|
1028
|
-
].filter((varName
|
|
1029
|
-
|
|
1030
|
-
|
|
1163
|
+
].filter((varName) => !instantiatedSeen.has(varName));
|
|
1164
|
+
const parentInstantiatedSeen = new Set();
|
|
1165
|
+
const dedupedParentInstantiatedVariables = parentInstantiatedVariables.filter((varName) => {
|
|
1166
|
+
if (parentInstantiatedSeen.has(varName)) {
|
|
1167
|
+
return false;
|
|
1168
|
+
}
|
|
1169
|
+
parentInstantiatedSeen.add(varName);
|
|
1170
|
+
return true;
|
|
1171
|
+
});
|
|
1172
|
+
scopeNode.parentInstantiatedVariables = dedupedParentInstantiatedVariables;
|
|
1031
1173
|
}
|
|
1032
1174
|
trackFunctionCalls(scopeNode) {
|
|
1033
1175
|
this.captureFunctionCalls(scopeNode);
|
|
1034
1176
|
this.checkExternalFunctionCalls();
|
|
1035
1177
|
}
|
|
1036
1178
|
determineEquivalenciesAndBuildSchema(scopeNode) {
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
if (Object.keys(isolatedEquivalentVariables || {}).some((k) => k.includes('Fetcher') || k.includes('fetcher'))) {
|
|
1040
|
-
console.log('CodeYam DEBUG determineEquivalenciesAndBuildSchema:', JSON.stringify({
|
|
1041
|
-
scopeNodeName: scopeNode.name,
|
|
1042
|
-
fetcherEquivalencies: Object.entries(isolatedEquivalentVariables || {})
|
|
1043
|
-
.filter(([k, v]) => k.includes('Fetcher') ||
|
|
1044
|
-
k.includes('fetcher') ||
|
|
1045
|
-
String(v).includes('Fetcher') ||
|
|
1046
|
-
String(v).includes('fetcher'))
|
|
1047
|
-
.reduce((acc, [k, v]) => {
|
|
1048
|
-
acc[k] = v;
|
|
1049
|
-
return acc;
|
|
1050
|
-
}, {}),
|
|
1051
|
-
}, null, 2));
|
|
1179
|
+
if (!scopeNode.analysis) {
|
|
1180
|
+
return;
|
|
1052
1181
|
}
|
|
1182
|
+
const { isolatedStructure, isolatedEquivalentVariables } = scopeNode.analysis;
|
|
1183
|
+
// Flatten isolatedEquivalentVariables values for allPaths (handles both string and string[])
|
|
1184
|
+
const flattenedEquivValues = Object.values(isolatedEquivalentVariables || {}).flatMap((v) => (Array.isArray(v) ? v : [v]));
|
|
1053
1185
|
const allPaths = Array.from(new Set([
|
|
1054
1186
|
...Object.keys(isolatedStructure || {}),
|
|
1055
1187
|
...Object.keys(isolatedEquivalentVariables || {}),
|
|
1056
|
-
...
|
|
1188
|
+
...flattenedEquivValues,
|
|
1057
1189
|
]));
|
|
1058
1190
|
for (let path in isolatedEquivalentVariables) {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1191
|
+
const rawEquivalentValue = isolatedEquivalentVariables?.[path];
|
|
1192
|
+
// Normalize to array for consistent handling
|
|
1193
|
+
const equivalentValues = Array.isArray(rawEquivalentValue)
|
|
1194
|
+
? rawEquivalentValue
|
|
1195
|
+
: [rawEquivalentValue];
|
|
1196
|
+
for (let equivalentValue of equivalentValues) {
|
|
1197
|
+
if (equivalentValue && this.isValidPath(equivalentValue)) {
|
|
1198
|
+
// IMPORTANT: DO NOT strip ::cyDuplicateKey:: markers from equivalencies.
|
|
1199
|
+
// These markers are critical for distinguishing variable reassignments.
|
|
1200
|
+
// For example, with:
|
|
1201
|
+
// let fetcher = useFetcher<ConfigData>();
|
|
1202
|
+
// const configData = fetcher.data?.data;
|
|
1203
|
+
// fetcher = useFetcher<SettingsData>();
|
|
1204
|
+
// const settingsData = fetcher.data?.data;
|
|
1205
|
+
//
|
|
1206
|
+
// mergeStatements creates:
|
|
1207
|
+
// fetcher → useFetcher<ConfigData>()...
|
|
1208
|
+
// fetcher::cyDuplicateKey1:: → useFetcher<SettingsData>()...
|
|
1209
|
+
// configData → fetcher.data.data
|
|
1210
|
+
// settingsData → fetcher::cyDuplicateKey1::.data.data
|
|
1211
|
+
//
|
|
1212
|
+
// If we strip ::cyDuplicateKey::, settingsData would incorrectly trace
|
|
1213
|
+
// to useFetcher<ConfigData>() instead of useFetcher<SettingsData>().
|
|
1214
|
+
path = cleanPath(path, allPaths);
|
|
1215
|
+
equivalentValue = cleanPath(equivalentValue, allPaths);
|
|
1216
|
+
this.addEquivalency(path, equivalentValue, scopeNode.name, scopeNode, 'original equivalency');
|
|
1217
|
+
// Propagate equivalencies involving parent-scope variables to those parent scopes.
|
|
1218
|
+
// This handles patterns like: collected.push({...entity}) where 'collected' is defined
|
|
1219
|
+
// in a parent scope. The equivalency collected[] -> push().signature[0] needs to be
|
|
1220
|
+
// visible when tracing from the parent scope.
|
|
1221
|
+
const rootVariable = this.extractRootVariable(path);
|
|
1222
|
+
const equivalentRootVariable = this.extractRootVariable(equivalentValue);
|
|
1223
|
+
// Skip propagation for self-referential reassignment patterns like:
|
|
1224
|
+
// x = x.method().functionCallReturnValue
|
|
1225
|
+
// where the path IS the variable itself (not a sub-path like x[] or x.prop).
|
|
1226
|
+
// These create circular references since both sides reference the same variable.
|
|
1227
|
+
//
|
|
1228
|
+
// But DO propagate for patterns like collected[] -> collected.push(...).signature[0]
|
|
1229
|
+
// where the path has additional segments beyond the root variable.
|
|
1230
|
+
const pathIsJustRootVariable = path === rootVariable;
|
|
1231
|
+
const isSelfReferentialReassignment = pathIsJustRootVariable && rootVariable === equivalentRootVariable;
|
|
1232
|
+
if (rootVariable &&
|
|
1233
|
+
!isSelfReferentialReassignment &&
|
|
1234
|
+
scopeNode.parentInstantiatedVariables?.includes(rootVariable)) {
|
|
1235
|
+
// Find the parent scope where this variable is defined
|
|
1236
|
+
for (const parentScopeName of scopeNode.tree || []) {
|
|
1237
|
+
const parentScope = this.scopeNodes[parentScopeName];
|
|
1238
|
+
if (parentScope?.instantiatedVariables?.includes(rootVariable)) {
|
|
1239
|
+
// Add the equivalency to the parent scope as well
|
|
1240
|
+
this.addEquivalency(path, equivalentValue, scopeNode.name, // The equivalent path's scope remains the child scope
|
|
1241
|
+
parentScope, // But store it in the parent scope's equivalencies
|
|
1242
|
+
'propagated parent-variable equivalency');
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1091
1245
|
}
|
|
1092
1246
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1247
|
+
// Propagate sub-property equivalencies when the equivalentValue is a simple variable
|
|
1248
|
+
// that has sub-properties defined in the isolatedEquivalentVariables.
|
|
1249
|
+
// This handles cases like: dataItem={{ structure: completeDataStructure }}
|
|
1250
|
+
// where completeDataStructure has sub-properties like completeDataStructure['Function Arguments']
|
|
1251
|
+
// We need to propagate these to create: dataItem.structure['Function Arguments'] equivalencies
|
|
1252
|
+
const isSimpleVariable = !equivalentValue.startsWith('signature[') &&
|
|
1253
|
+
!equivalentValue.includes('functionCallReturnValue') &&
|
|
1254
|
+
!equivalentValue.includes('.') &&
|
|
1255
|
+
!equivalentValue.includes('[');
|
|
1256
|
+
if (isSimpleVariable) {
|
|
1257
|
+
// Look in current scope and all parent scopes for sub-properties
|
|
1258
|
+
const scopesToCheck = [scopeNode.name, ...scopeNode.tree];
|
|
1259
|
+
for (const scopeName of scopesToCheck) {
|
|
1260
|
+
const checkScope = this.scopeNodes[scopeName];
|
|
1261
|
+
if (!checkScope?.analysis?.isolatedEquivalentVariables)
|
|
1262
|
+
continue;
|
|
1263
|
+
for (const [subPath, rawSubValue] of Object.entries(checkScope.analysis.isolatedEquivalentVariables)) {
|
|
1264
|
+
// Normalize to array for consistent handling
|
|
1265
|
+
const subValues = Array.isArray(rawSubValue)
|
|
1266
|
+
? rawSubValue
|
|
1267
|
+
: rawSubValue
|
|
1268
|
+
? [rawSubValue]
|
|
1269
|
+
: [];
|
|
1270
|
+
// Check if this is a sub-property of the equivalentValue variable
|
|
1271
|
+
// e.g., completeDataStructure['Function Arguments'] or completeDataStructure.foo
|
|
1272
|
+
const matchesDot = subPath.startsWith(equivalentValue + '.');
|
|
1273
|
+
const matchesBracket = subPath.startsWith(equivalentValue + '[');
|
|
1274
|
+
if (matchesDot || matchesBracket) {
|
|
1275
|
+
const subPropertyPath = subPath.substring(equivalentValue.length);
|
|
1276
|
+
const newPath = cleanPath(path + subPropertyPath, allPaths);
|
|
1277
|
+
for (const subValue of subValues) {
|
|
1278
|
+
if (typeof subValue !== 'string')
|
|
1279
|
+
continue;
|
|
1280
|
+
const newEquivalentValue = cleanPath(subValue.replace(/::cyDuplicateKey\d+::/g, ''), allPaths);
|
|
1281
|
+
if (newEquivalentValue &&
|
|
1282
|
+
this.isValidPath(newEquivalentValue)) {
|
|
1283
|
+
this.addEquivalency(newPath, newEquivalentValue, checkScope.name, // Use the scope where the sub-property was found
|
|
1284
|
+
scopeNode, 'propagated sub-property equivalency');
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
// Also check if equivalentValue itself maps to a functionCallReturnValue
|
|
1289
|
+
// e.g., result = useMemo(...).functionCallReturnValue
|
|
1290
|
+
for (const subValue of subValues) {
|
|
1291
|
+
if (subPath === equivalentValue &&
|
|
1292
|
+
typeof subValue === 'string' &&
|
|
1293
|
+
subValue.endsWith('.functionCallReturnValue')) {
|
|
1294
|
+
this.propagateFunctionCallReturnSubProperties(path, subValue, scopeNode, allPaths);
|
|
1295
|
+
}
|
|
1123
1296
|
}
|
|
1124
|
-
}
|
|
1125
|
-
// Also check if equivalentValue itself maps to a functionCallReturnValue
|
|
1126
|
-
// e.g., result = useMemo(...).functionCallReturnValue
|
|
1127
|
-
if (subPath === equivalentValue &&
|
|
1128
|
-
typeof subValue === 'string' &&
|
|
1129
|
-
subValue.endsWith('.functionCallReturnValue')) {
|
|
1130
|
-
this.propagateFunctionCallReturnSubProperties(path, subValue, scopeNode, allPaths);
|
|
1131
1297
|
}
|
|
1132
1298
|
}
|
|
1133
1299
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1300
|
+
// Handle function call return values by propagating returnValue.* sub-properties
|
|
1301
|
+
// from the callback scope to the usage path
|
|
1302
|
+
if (equivalentValue.endsWith('.functionCallReturnValue')) {
|
|
1303
|
+
this.propagateFunctionCallReturnSubProperties(path, equivalentValue, scopeNode, allPaths);
|
|
1304
|
+
// Track which variable receives the return value of each function call
|
|
1305
|
+
// This enables generating separate mock data for each call site
|
|
1306
|
+
this.trackReceivingVariable(path, equivalentValue);
|
|
1307
|
+
}
|
|
1308
|
+
// Also track variables that receive destructured properties from function call return values
|
|
1309
|
+
// e.g., "userData" -> "db.query('users').functionCallReturnValue.data"
|
|
1310
|
+
if (equivalentValue.includes('.functionCallReturnValue.')) {
|
|
1311
|
+
this.trackReceivingVariable(path, equivalentValue);
|
|
1312
|
+
}
|
|
1147
1313
|
}
|
|
1148
1314
|
}
|
|
1149
1315
|
}
|
|
@@ -1151,7 +1317,7 @@ export class ScopeDataStructure {
|
|
|
1151
1317
|
// This eliminates deep call stacks and improves deduplication
|
|
1152
1318
|
this.batchProcessor = new BatchSchemaProcessor();
|
|
1153
1319
|
this.batchQueuedSet = new Set();
|
|
1154
|
-
for (const key of
|
|
1320
|
+
for (const key of allPaths) {
|
|
1155
1321
|
let value = isolatedStructure[key] ?? 'unknown';
|
|
1156
1322
|
if (['null', 'undefined'].includes(value)) {
|
|
1157
1323
|
value = 'unknown';
|
|
@@ -1185,7 +1351,14 @@ export class ScopeDataStructure {
|
|
|
1185
1351
|
processBatchQueue() {
|
|
1186
1352
|
if (!this.batchProcessor)
|
|
1187
1353
|
return;
|
|
1354
|
+
let iterations = 0;
|
|
1188
1355
|
while (this.batchProcessor.hasWork()) {
|
|
1356
|
+
iterations++;
|
|
1357
|
+
// Safety: detect potential infinite loops
|
|
1358
|
+
if (iterations > 100000) {
|
|
1359
|
+
console.error(`[ScopeDataStructure] processBatchQueue exceeded 100k iterations, possible infinite loop!`);
|
|
1360
|
+
break;
|
|
1361
|
+
}
|
|
1189
1362
|
const item = this.batchProcessor.getNextWork();
|
|
1190
1363
|
if (!item)
|
|
1191
1364
|
break;
|
|
@@ -1232,18 +1405,6 @@ export class ScopeDataStructure {
|
|
|
1232
1405
|
// Find the FunctionCallInfo that matches this call signature
|
|
1233
1406
|
const searchKey = getFunctionCallRoot(callSignature);
|
|
1234
1407
|
const functionCallInfo = this.getExternalFunctionCallsIndex().get(searchKey);
|
|
1235
|
-
// DEBUG: Track useFetcher calls
|
|
1236
|
-
if (searchKey === 'useFetcher' || callSignature.includes('useFetcher')) {
|
|
1237
|
-
console.log('CodeYam DEBUG trackReceivingVariable:', JSON.stringify({
|
|
1238
|
-
receivingVariable,
|
|
1239
|
-
equivalentValue,
|
|
1240
|
-
callSignature,
|
|
1241
|
-
searchKey,
|
|
1242
|
-
foundFunctionCallInfo: !!functionCallInfo,
|
|
1243
|
-
existingRecvVars: functionCallInfo?.receivingVariableNames,
|
|
1244
|
-
existingCallSigToVar: functionCallInfo?.callSignatureToVariable,
|
|
1245
|
-
}, null, 2));
|
|
1246
|
-
}
|
|
1247
1408
|
if (!functionCallInfo) {
|
|
1248
1409
|
return;
|
|
1249
1410
|
}
|
|
@@ -1292,8 +1453,15 @@ export class ScopeDataStructure {
|
|
|
1292
1453
|
const checkScope = this.scopeNodes[scopeName];
|
|
1293
1454
|
if (!checkScope?.analysis?.isolatedEquivalentVariables)
|
|
1294
1455
|
continue;
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1456
|
+
const rawFunctionRef = checkScope.analysis.isolatedEquivalentVariables[functionName];
|
|
1457
|
+
// Normalize to array and find first string ending with 'F'
|
|
1458
|
+
const functionRefs = Array.isArray(rawFunctionRef)
|
|
1459
|
+
? rawFunctionRef
|
|
1460
|
+
: rawFunctionRef
|
|
1461
|
+
? [rawFunctionRef]
|
|
1462
|
+
: [];
|
|
1463
|
+
const functionRef = functionRefs.find((r) => typeof r === 'string' && r.endsWith('F'));
|
|
1464
|
+
if (typeof functionRef === 'string') {
|
|
1297
1465
|
callbackScopeName = functionRef.slice(0, -1);
|
|
1298
1466
|
break;
|
|
1299
1467
|
}
|
|
@@ -1316,22 +1484,32 @@ export class ScopeDataStructure {
|
|
|
1316
1484
|
if (!callbackScope.analysis?.isolatedEquivalentVariables)
|
|
1317
1485
|
return;
|
|
1318
1486
|
const isolatedVars = callbackScope.analysis.isolatedEquivalentVariables;
|
|
1487
|
+
// Get the first returnValue equivalency (normalize array to single value for these checks)
|
|
1488
|
+
const rawReturnValue = isolatedVars.returnValue;
|
|
1489
|
+
const firstReturnValue = Array.isArray(rawReturnValue)
|
|
1490
|
+
? rawReturnValue[0]
|
|
1491
|
+
: rawReturnValue;
|
|
1319
1492
|
// First, check if returnValue is an alias to another variable (e.g., returnValue = intermediate)
|
|
1320
1493
|
// If so, we need to look for that variable's sub-properties too
|
|
1321
|
-
const returnValueAlias = typeof
|
|
1322
|
-
|
|
1323
|
-
? isolatedVars.returnValue
|
|
1494
|
+
const returnValueAlias = typeof firstReturnValue === 'string' && !firstReturnValue.includes('.')
|
|
1495
|
+
? firstReturnValue
|
|
1324
1496
|
: undefined;
|
|
1325
1497
|
// Pattern 3: Object.keys(X).reduce() - the reduce result has the same sub-properties as X
|
|
1326
1498
|
// When returnValue = "Object.keys(source).reduce(...).functionCallReturnValue", look for source.* sub-properties
|
|
1327
1499
|
let reduceSourceVar;
|
|
1328
|
-
if (typeof
|
|
1329
|
-
const reduceMatch =
|
|
1500
|
+
if (typeof firstReturnValue === 'string') {
|
|
1501
|
+
const reduceMatch = firstReturnValue.match(/^Object\.keys\((\w+)\)\.reduce\(.*\)\.functionCallReturnValue$/);
|
|
1330
1502
|
if (reduceMatch) {
|
|
1331
1503
|
reduceSourceVar = reduceMatch[1];
|
|
1332
1504
|
}
|
|
1333
1505
|
}
|
|
1334
|
-
for (const [subPath,
|
|
1506
|
+
for (const [subPath, rawSubValue] of Object.entries(isolatedVars)) {
|
|
1507
|
+
// Normalize to array for consistent handling
|
|
1508
|
+
const subValues = Array.isArray(rawSubValue)
|
|
1509
|
+
? rawSubValue
|
|
1510
|
+
: rawSubValue
|
|
1511
|
+
? [rawSubValue]
|
|
1512
|
+
: [];
|
|
1335
1513
|
// Check for direct returnValue.* sub-properties
|
|
1336
1514
|
const isReturnValueSub = subPath.startsWith('returnValue.') ||
|
|
1337
1515
|
subPath.startsWith('returnValue[');
|
|
@@ -1343,33 +1521,36 @@ export class ScopeDataStructure {
|
|
|
1343
1521
|
const isReduceSourceSub = reduceSourceVar &&
|
|
1344
1522
|
(subPath.startsWith(reduceSourceVar + '.') ||
|
|
1345
1523
|
subPath.startsWith(reduceSourceVar + '['));
|
|
1346
|
-
if (
|
|
1347
|
-
(!isReturnValueSub && !isAliasSub && !isReduceSourceSub))
|
|
1348
|
-
continue;
|
|
1349
|
-
// Convert alias/reduceSource paths to returnValue paths
|
|
1350
|
-
let effectiveSubPath = subPath;
|
|
1351
|
-
if (isAliasSub && !isReturnValueSub) {
|
|
1352
|
-
// Replace the alias prefix with returnValue
|
|
1353
|
-
effectiveSubPath =
|
|
1354
|
-
'returnValue' + subPath.substring(returnValueAlias.length);
|
|
1355
|
-
}
|
|
1356
|
-
else if (isReduceSourceSub && !isReturnValueSub && !isAliasSub) {
|
|
1357
|
-
// Replace the reduce source prefix with returnValue
|
|
1358
|
-
effectiveSubPath =
|
|
1359
|
-
'returnValue' + subPath.substring(reduceSourceVar.length);
|
|
1360
|
-
}
|
|
1361
|
-
const subPropertyPath = effectiveSubPath.substring('returnValue'.length);
|
|
1362
|
-
const newPath = cleanPath(path + subPropertyPath, allPaths);
|
|
1363
|
-
let newEquivalentValue = cleanPath(subValue.replace(/::cyDuplicateKey\d+::/g, ''), allPaths);
|
|
1364
|
-
// Resolve variable references through parent scope equivalencies
|
|
1365
|
-
const resolved = this.resolveVariableThroughParentScopes(newEquivalentValue, callbackScope, allPaths);
|
|
1366
|
-
newEquivalentValue = resolved.resolvedPath;
|
|
1367
|
-
const equivalentScopeName = resolved.scopeName;
|
|
1368
|
-
if (!newEquivalentValue || !this.isValidPath(newEquivalentValue))
|
|
1524
|
+
if (!isReturnValueSub && !isAliasSub && !isReduceSourceSub)
|
|
1369
1525
|
continue;
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1526
|
+
for (const subValue of subValues) {
|
|
1527
|
+
if (typeof subValue !== 'string')
|
|
1528
|
+
continue;
|
|
1529
|
+
// Convert alias/reduceSource paths to returnValue paths
|
|
1530
|
+
let effectiveSubPath = subPath;
|
|
1531
|
+
if (isAliasSub && !isReturnValueSub) {
|
|
1532
|
+
// Replace the alias prefix with returnValue
|
|
1533
|
+
effectiveSubPath =
|
|
1534
|
+
'returnValue' + subPath.substring(returnValueAlias.length);
|
|
1535
|
+
}
|
|
1536
|
+
else if (isReduceSourceSub && !isReturnValueSub && !isAliasSub) {
|
|
1537
|
+
// Replace the reduce source prefix with returnValue
|
|
1538
|
+
effectiveSubPath =
|
|
1539
|
+
'returnValue' + subPath.substring(reduceSourceVar.length);
|
|
1540
|
+
}
|
|
1541
|
+
const subPropertyPath = effectiveSubPath.substring('returnValue'.length);
|
|
1542
|
+
const newPath = cleanPath(path + subPropertyPath, allPaths);
|
|
1543
|
+
let newEquivalentValue = cleanPath(subValue.replace(/::cyDuplicateKey\d+::/g, ''), allPaths);
|
|
1544
|
+
// Resolve variable references through parent scope equivalencies
|
|
1545
|
+
const resolved = this.resolveVariableThroughParentScopes(newEquivalentValue, callbackScope, allPaths);
|
|
1546
|
+
newEquivalentValue = resolved.resolvedPath;
|
|
1547
|
+
const equivalentScopeName = resolved.scopeName;
|
|
1548
|
+
if (!newEquivalentValue || !this.isValidPath(newEquivalentValue))
|
|
1549
|
+
continue;
|
|
1550
|
+
this.addEquivalency(newPath, newEquivalentValue, equivalentScopeName, scopeNode, 'propagated function call return sub-property equivalency');
|
|
1551
|
+
// Ensure the database entry has the usage path
|
|
1552
|
+
this.addUsageToEquivalencyDatabaseEntry(newPath, newEquivalentValue, equivalentScopeName, scopeNode.name);
|
|
1553
|
+
}
|
|
1373
1554
|
}
|
|
1374
1555
|
}
|
|
1375
1556
|
/**
|
|
@@ -1401,7 +1582,14 @@ export class ScopeDataStructure {
|
|
|
1401
1582
|
const parentScope = this.scopeNodes[parentScopeName];
|
|
1402
1583
|
if (!parentScope?.analysis?.isolatedEquivalentVariables)
|
|
1403
1584
|
continue;
|
|
1404
|
-
const
|
|
1585
|
+
const rawRootEquiv = parentScope.analysis.isolatedEquivalentVariables[rootVar];
|
|
1586
|
+
// Normalize to array and use first string value
|
|
1587
|
+
const rootEquivs = Array.isArray(rawRootEquiv)
|
|
1588
|
+
? rawRootEquiv
|
|
1589
|
+
: rawRootEquiv
|
|
1590
|
+
? [rawRootEquiv]
|
|
1591
|
+
: [];
|
|
1592
|
+
const rootEquiv = rootEquivs.find((r) => typeof r === 'string');
|
|
1405
1593
|
if (typeof rootEquiv === 'string') {
|
|
1406
1594
|
return {
|
|
1407
1595
|
resolvedPath: cleanPath(rootEquiv + restOfPath, allPaths),
|
|
@@ -1595,9 +1783,21 @@ export class ScopeDataStructure {
|
|
|
1595
1783
|
const remainingPath = this.joinPathParts(remainingPathParts);
|
|
1596
1784
|
if (relevantSubPathParts.every((part, i) => part === schemaPathParts[i]) &&
|
|
1597
1785
|
equivalentValue.scopeNodeName === scopeNode.name) {
|
|
1786
|
+
// DEBUG
|
|
1598
1787
|
continue;
|
|
1599
1788
|
}
|
|
1600
1789
|
const newEquivalentPath = this.joinPathParts([schemaPath, remainingPath]);
|
|
1790
|
+
// PERF: Detect repeated patterns in paths to prevent exponential blowup
|
|
1791
|
+
// Paths like `signature[0].attributes.properties[].attributes.properties[]...`
|
|
1792
|
+
// indicate recursive type structures that cause exponential schema explosion
|
|
1793
|
+
if (this.hasExcessivePatternRepetition(newEquivalentPath)) {
|
|
1794
|
+
if (traceId && debugLevel > 0) {
|
|
1795
|
+
console.info('Debug: skipping path with excessive pattern repetition', {
|
|
1796
|
+
path: newEquivalentPath,
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
continue;
|
|
1800
|
+
}
|
|
1601
1801
|
if (!equivalentScopeNode) {
|
|
1602
1802
|
if (traceId) {
|
|
1603
1803
|
console.info('Debug Propagation: missing equivalent scope info', {
|
|
@@ -1869,9 +2069,70 @@ export class ScopeDataStructure {
|
|
|
1869
2069
|
// Update inverted index
|
|
1870
2070
|
this.intermediatesOrderIndex.set(pathId, databaseEntry);
|
|
1871
2071
|
if (intermediateIndex === 0) {
|
|
1872
|
-
|
|
2072
|
+
let isValidSourceCandidate = pathInfo.schemaPath.startsWith('signature[') ||
|
|
1873
2073
|
pathInfo.schemaPath.includes('functionCallReturnValue');
|
|
1874
|
-
if
|
|
2074
|
+
// Check if path STARTS with a spread pattern like [...var]
|
|
2075
|
+
// This handles cases like [...files][][0] or [...files].sort(...).functionCallReturnValue[][0]
|
|
2076
|
+
// where the spread source variable needs to be resolved to a signature path.
|
|
2077
|
+
// We do this REGARDLESS of isValidSourceCandidate because even paths containing
|
|
2078
|
+
// functionCallReturnValue may need spread resolution to trace back to the signature.
|
|
2079
|
+
const spreadMatch = pathInfo.schemaPath.match(/^\[\.\.\.(\w+)\]/);
|
|
2080
|
+
if (spreadMatch) {
|
|
2081
|
+
const spreadVar = spreadMatch[1];
|
|
2082
|
+
const spreadPattern = spreadMatch[0]; // The full [...var] match
|
|
2083
|
+
const scopeNode = this.scopeNodes[pathInfo.scopeNodeName];
|
|
2084
|
+
if (scopeNode?.equivalencies) {
|
|
2085
|
+
// Follow the equivalency chain to find a signature path
|
|
2086
|
+
// e.g., files (cyScope1) → files (root) → signature[0].files
|
|
2087
|
+
const resolveToSignature = (varName, currentScopeName, visited) => {
|
|
2088
|
+
const visitKey = `${currentScopeName}::${varName}`;
|
|
2089
|
+
if (visited.has(visitKey))
|
|
2090
|
+
return null;
|
|
2091
|
+
visited.add(visitKey);
|
|
2092
|
+
const currentScope = this.scopeNodes[currentScopeName];
|
|
2093
|
+
if (!currentScope?.equivalencies)
|
|
2094
|
+
return null;
|
|
2095
|
+
const varEquivs = currentScope.equivalencies[varName];
|
|
2096
|
+
if (!varEquivs)
|
|
2097
|
+
return null;
|
|
2098
|
+
// First check if any equivalency directly points to a signature path
|
|
2099
|
+
const signatureEquiv = varEquivs.find((eq) => eq.schemaPath.startsWith('signature['));
|
|
2100
|
+
if (signatureEquiv) {
|
|
2101
|
+
return signatureEquiv;
|
|
2102
|
+
}
|
|
2103
|
+
// Otherwise, follow the chain to other scopes
|
|
2104
|
+
for (const equiv of varEquivs) {
|
|
2105
|
+
// If the equivalency points to the same variable in a different scope,
|
|
2106
|
+
// follow the chain
|
|
2107
|
+
if (equiv.schemaPath === varName &&
|
|
2108
|
+
equiv.scopeNodeName !== currentScopeName) {
|
|
2109
|
+
const result = resolveToSignature(varName, equiv.scopeNodeName, visited);
|
|
2110
|
+
if (result)
|
|
2111
|
+
return result;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
return null;
|
|
2115
|
+
};
|
|
2116
|
+
const signatureEquiv = resolveToSignature(spreadVar, pathInfo.scopeNodeName, new Set());
|
|
2117
|
+
if (signatureEquiv) {
|
|
2118
|
+
// Replace ONLY the [...var] part with the resolved signature path
|
|
2119
|
+
// This preserves any suffix like .sort(...).functionCallReturnValue[][0]
|
|
2120
|
+
const resolvedPath = pathInfo.schemaPath.replace(spreadPattern, signatureEquiv.schemaPath);
|
|
2121
|
+
// Add the resolved path as a source candidate
|
|
2122
|
+
if (!databaseEntry.sourceCandidates.some((sc) => sc.schemaPath === resolvedPath &&
|
|
2123
|
+
sc.scopeNodeName === pathInfo.scopeNodeName)) {
|
|
2124
|
+
databaseEntry.sourceCandidates.push({
|
|
2125
|
+
scopeNodeName: pathInfo.scopeNodeName,
|
|
2126
|
+
schemaPath: resolvedPath,
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
isValidSourceCandidate = true;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
if (isValidSourceCandidate &&
|
|
2134
|
+
!databaseEntry.sourceCandidates.some((sc) => sc.schemaPath === pathInfo.schemaPath &&
|
|
2135
|
+
sc.scopeNodeName === pathInfo.scopeNodeName)) {
|
|
1875
2136
|
databaseEntry.sourceCandidates.push(pathInfo);
|
|
1876
2137
|
}
|
|
1877
2138
|
}
|
|
@@ -2017,6 +2278,13 @@ export class ScopeDataStructure {
|
|
|
2017
2278
|
delete scopeNode.schema[key];
|
|
2018
2279
|
}
|
|
2019
2280
|
}
|
|
2281
|
+
// Ensure parameter-to-signature equivalencies are fully propagated.
|
|
2282
|
+
// When a parameter variable (e.g., `node`) is equivalenced to `signature[N]`,
|
|
2283
|
+
// all sub-paths of that variable should also appear under `signature[N]`.
|
|
2284
|
+
// This handles cases where the sub-path was added to the schema via a propagation
|
|
2285
|
+
// chain that already included the variable↔signature equivalency, causing the
|
|
2286
|
+
// cycle detection to prevent the reverse mapping.
|
|
2287
|
+
this.propagateParameterToSignaturePaths(scopeNode);
|
|
2020
2288
|
fillInSchemaGapsAndUnknowns(scopeNode, fillInUnknowns);
|
|
2021
2289
|
if (final) {
|
|
2022
2290
|
for (const manager of this.equivalencyManagers) {
|
|
@@ -2028,6 +2296,40 @@ export class ScopeDataStructure {
|
|
|
2028
2296
|
ensureSchemaConsistency(scopeNode.schema);
|
|
2029
2297
|
}
|
|
2030
2298
|
}
|
|
2299
|
+
/**
|
|
2300
|
+
* For each equivalency where a simple variable maps to signature[N],
|
|
2301
|
+
* ensure all sub-paths of that variable are reflected under signature[N].
|
|
2302
|
+
*/
|
|
2303
|
+
propagateParameterToSignaturePaths(scopeNode) {
|
|
2304
|
+
// Find variable → signature[N] equivalencies
|
|
2305
|
+
for (const [varName, equivalencies] of Object.entries(scopeNode.equivalencies)) {
|
|
2306
|
+
// Only process simple variable names (no dots, brackets, or parens)
|
|
2307
|
+
if (varName.includes('.') ||
|
|
2308
|
+
varName.includes('[') ||
|
|
2309
|
+
varName.includes('(')) {
|
|
2310
|
+
continue;
|
|
2311
|
+
}
|
|
2312
|
+
for (const equiv of equivalencies) {
|
|
2313
|
+
if (equiv.scopeNodeName === scopeNode.name &&
|
|
2314
|
+
equiv.schemaPath.startsWith('signature[')) {
|
|
2315
|
+
const signaturePath = equiv.schemaPath;
|
|
2316
|
+
const varPrefix = varName + '.';
|
|
2317
|
+
const varBracketPrefix = varName + '[';
|
|
2318
|
+
// Find all schema keys starting with the variable
|
|
2319
|
+
for (const key in scopeNode.schema) {
|
|
2320
|
+
if (key.startsWith(varPrefix) || key.startsWith(varBracketPrefix)) {
|
|
2321
|
+
const suffix = key.slice(varName.length);
|
|
2322
|
+
const sigKey = signaturePath + suffix;
|
|
2323
|
+
// Only add if the signature path doesn't already exist
|
|
2324
|
+
if (!scopeNode.schema[sigKey]) {
|
|
2325
|
+
scopeNode.schema[sigKey] = scopeNode.schema[key];
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2031
2333
|
filterAndConvertSchema({ filterPath, newPath, schema, }) {
|
|
2032
2334
|
const filterPathParts = this.splitPath(filterPath);
|
|
2033
2335
|
return Object.keys(schema).reduce((acc, key) => {
|
|
@@ -2087,6 +2389,10 @@ export class ScopeDataStructure {
|
|
|
2087
2389
|
path,
|
|
2088
2390
|
...this.splitPath(key).slice(equivalentValueSchemaPathParts.length),
|
|
2089
2391
|
]);
|
|
2392
|
+
// PERF: Skip keys with repeated function-call signature patterns
|
|
2393
|
+
// to prevent recursive type expansion (e.g., string.localeCompare returns string)
|
|
2394
|
+
if (this.hasExcessivePatternRepetition(newKey))
|
|
2395
|
+
continue;
|
|
2090
2396
|
resolvedSchema[newKey] = value;
|
|
2091
2397
|
}
|
|
2092
2398
|
}
|
|
@@ -2108,6 +2414,9 @@ export class ScopeDataStructure {
|
|
|
2108
2414
|
if (!subSchema)
|
|
2109
2415
|
continue;
|
|
2110
2416
|
for (const resolvedKey in subSchema) {
|
|
2417
|
+
// PERF: Skip keys with repeated function-call signature patterns
|
|
2418
|
+
if (this.hasExcessivePatternRepetition(resolvedKey))
|
|
2419
|
+
continue;
|
|
2111
2420
|
if (!resolvedSchema[resolvedKey] ||
|
|
2112
2421
|
subSchema[resolvedKey] === 'unknown') {
|
|
2113
2422
|
resolvedSchema[resolvedKey] = subSchema[resolvedKey];
|
|
@@ -2244,9 +2553,22 @@ export class ScopeDataStructure {
|
|
|
2244
2553
|
}
|
|
2245
2554
|
}
|
|
2246
2555
|
}
|
|
2247
|
-
return mergedSchema;
|
|
2556
|
+
return this.filterDuplicateKeys(mergedSchema);
|
|
2248
2557
|
}
|
|
2249
|
-
return schema;
|
|
2558
|
+
return this.filterDuplicateKeys(schema);
|
|
2559
|
+
}
|
|
2560
|
+
/**
|
|
2561
|
+
* Filter out ::cyDuplicateKey:: entries from a schema.
|
|
2562
|
+
* These are internal markers for tracking variable reassignments
|
|
2563
|
+
* and should not appear in output schemas or LLM prompts.
|
|
2564
|
+
*/
|
|
2565
|
+
filterDuplicateKeys(schema) {
|
|
2566
|
+
return Object.entries(schema).reduce((acc, [key, value]) => {
|
|
2567
|
+
if (!key.includes('::cyDuplicateKey')) {
|
|
2568
|
+
acc[key] = value;
|
|
2569
|
+
}
|
|
2570
|
+
return acc;
|
|
2571
|
+
}, {});
|
|
2250
2572
|
}
|
|
2251
2573
|
getEquivalencies(scopeName) {
|
|
2252
2574
|
const scopeNode = this.getScopeOrFunctionCallInfo(scopeName);
|
|
@@ -2268,15 +2590,131 @@ export class ScopeDataStructure {
|
|
|
2268
2590
|
if (!scopeNode) {
|
|
2269
2591
|
return {};
|
|
2270
2592
|
}
|
|
2271
|
-
|
|
2593
|
+
// Collect all descendant scope names (including the scope itself)
|
|
2594
|
+
// This ensures we include external calls from nested scopes like cyScope2
|
|
2595
|
+
const getAllDescendantScopeNames = (node) => {
|
|
2596
|
+
const names = new Set([node.name]);
|
|
2597
|
+
for (const child of node.children) {
|
|
2598
|
+
for (const name of getAllDescendantScopeNames(child)) {
|
|
2599
|
+
names.add(name);
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
return names;
|
|
2603
|
+
};
|
|
2604
|
+
const treeNode = this.scopeTreeManager.findNode(scopeNode.name);
|
|
2605
|
+
const descendantScopeNames = treeNode
|
|
2606
|
+
? getAllDescendantScopeNames(treeNode)
|
|
2607
|
+
: new Set([scopeNode.name]);
|
|
2608
|
+
// Get all external function calls made from this scope or any descendant scope
|
|
2609
|
+
// This allows us to include prop equivalencies from JSX components
|
|
2610
|
+
// that were rendered in nested scopes (e.g., FileTableRow called from cyScope2)
|
|
2611
|
+
const externalCallsFromScope = this.externalFunctionCalls.filter((efc) => descendantScopeNames.has(efc.callScope));
|
|
2612
|
+
const externalCallNames = new Set(externalCallsFromScope.map((efc) => efc.name));
|
|
2613
|
+
// Helper to check if a usage belongs to this scope (directly, via descendant, or via external call)
|
|
2614
|
+
const usageMatchesScope = (usage) => descendantScopeNames.has(usage.scopeNodeName) ||
|
|
2615
|
+
externalCallNames.has(usage.scopeNodeName);
|
|
2616
|
+
const entries = this.equivalencyDatabase.filter((entry) => entry.usages.some(usageMatchesScope));
|
|
2617
|
+
// Helper to resolve a source candidate through equivalency chains to find signature paths
|
|
2618
|
+
const resolveToSignature = (source, visited) => {
|
|
2619
|
+
const visitKey = `${source.scopeNodeName}::${source.schemaPath}`;
|
|
2620
|
+
if (visited.has(visitKey))
|
|
2621
|
+
return [];
|
|
2622
|
+
visited.add(visitKey);
|
|
2623
|
+
// If already a signature path, return as-is
|
|
2624
|
+
if (source.schemaPath.startsWith('signature[')) {
|
|
2625
|
+
return [source];
|
|
2626
|
+
}
|
|
2627
|
+
const currentScope = this.scopeNodes[source.scopeNodeName];
|
|
2628
|
+
if (!currentScope?.equivalencies)
|
|
2629
|
+
return [source];
|
|
2630
|
+
// Check for direct equivalencies FIRST (full path match)
|
|
2631
|
+
// This ensures paths like "useMemo(...).functionCallReturnValue" follow to "cyScope1::returnValue"
|
|
2632
|
+
// before prefix matching tries "useMemo(...)" which goes to the useMemo scope
|
|
2633
|
+
const directEquivs = currentScope.equivalencies[source.schemaPath];
|
|
2634
|
+
if (directEquivs?.length > 0) {
|
|
2635
|
+
const results = [];
|
|
2636
|
+
for (const equiv of directEquivs) {
|
|
2637
|
+
const resolved = resolveToSignature({
|
|
2638
|
+
scopeNodeName: equiv.scopeNodeName,
|
|
2639
|
+
schemaPath: equiv.schemaPath,
|
|
2640
|
+
}, visited);
|
|
2641
|
+
results.push(...resolved);
|
|
2642
|
+
}
|
|
2643
|
+
if (results.length > 0)
|
|
2644
|
+
return results;
|
|
2645
|
+
}
|
|
2646
|
+
// Handle spread patterns like [...items].sort().functionCallReturnValue
|
|
2647
|
+
// Extract the spread variable and resolve it through the equivalency chain
|
|
2648
|
+
const spreadMatch = source.schemaPath.match(/^\[\.\.\.(\w+)\]/);
|
|
2649
|
+
if (spreadMatch) {
|
|
2650
|
+
const spreadVar = spreadMatch[1];
|
|
2651
|
+
const spreadPattern = spreadMatch[0];
|
|
2652
|
+
const varEquivs = currentScope.equivalencies[spreadVar];
|
|
2653
|
+
if (varEquivs?.length > 0) {
|
|
2654
|
+
const results = [];
|
|
2655
|
+
for (const equiv of varEquivs) {
|
|
2656
|
+
// Follow the variable equivalency and then resolve from there
|
|
2657
|
+
const resolvedVar = resolveToSignature({
|
|
2658
|
+
scopeNodeName: equiv.scopeNodeName,
|
|
2659
|
+
schemaPath: equiv.schemaPath,
|
|
2660
|
+
}, visited);
|
|
2661
|
+
// For each resolved variable path, create the full path with array element suffix
|
|
2662
|
+
for (const rv of resolvedVar) {
|
|
2663
|
+
if (rv.schemaPath.startsWith('signature[')) {
|
|
2664
|
+
// Get the suffix after the spread pattern
|
|
2665
|
+
let suffix = source.schemaPath.slice(spreadPattern.length);
|
|
2666
|
+
// Clean the suffix: strip array method chains like .sort(...).functionCallReturnValue[]
|
|
2667
|
+
// These don't change the data identity, just transform it.
|
|
2668
|
+
// Keep only the final element access parts like [0], [1], etc.
|
|
2669
|
+
// Pattern: strip everything from a method call up through functionCallReturnValue[]
|
|
2670
|
+
suffix = suffix.replace(/\.\w+\([^)]*\)\.functionCallReturnValue\[\]/g, '');
|
|
2671
|
+
// Also handle simpler case without nested parens
|
|
2672
|
+
suffix = suffix.replace(/\.sort\(\w*\(\)\)\.functionCallReturnValue\[\]/g, '');
|
|
2673
|
+
// Add [] to indicate array element access from the spread
|
|
2674
|
+
const resolvedPath = rv.schemaPath + '[]' + suffix;
|
|
2675
|
+
results.push({
|
|
2676
|
+
scopeNodeName: rv.scopeNodeName,
|
|
2677
|
+
schemaPath: resolvedPath,
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
if (results.length > 0)
|
|
2683
|
+
return results;
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
// Try to find prefix equivalencies that can resolve this path
|
|
2687
|
+
// For path like "cyScope3().signature[0][0]", check "cyScope3().signature[0]", etc.
|
|
2688
|
+
const pathParts = this.splitPath(source.schemaPath);
|
|
2689
|
+
for (let i = pathParts.length - 1; i > 0; i--) {
|
|
2690
|
+
const prefix = this.joinPathParts(pathParts.slice(0, i));
|
|
2691
|
+
const suffix = this.joinPathParts(pathParts.slice(i));
|
|
2692
|
+
const prefixEquivs = currentScope.equivalencies[prefix];
|
|
2693
|
+
if (prefixEquivs?.length > 0) {
|
|
2694
|
+
const results = [];
|
|
2695
|
+
for (const equiv of prefixEquivs) {
|
|
2696
|
+
const newPath = this.joinPathParts([equiv.schemaPath, suffix]);
|
|
2697
|
+
const resolved = resolveToSignature({ scopeNodeName: equiv.scopeNodeName, schemaPath: newPath }, visited);
|
|
2698
|
+
results.push(...resolved);
|
|
2699
|
+
}
|
|
2700
|
+
if (results.length > 0)
|
|
2701
|
+
return results;
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
return [source];
|
|
2705
|
+
};
|
|
2272
2706
|
return entries.reduce((acc, entry) => {
|
|
2273
2707
|
var _a;
|
|
2274
2708
|
if (entry.sourceCandidates.length === 0)
|
|
2275
2709
|
return acc;
|
|
2276
|
-
const usages = entry.usages.filter(
|
|
2710
|
+
const usages = entry.usages.filter(usageMatchesScope);
|
|
2277
2711
|
for (const usage of usages) {
|
|
2278
2712
|
acc[_a = usage.schemaPath] || (acc[_a] = []);
|
|
2279
|
-
|
|
2713
|
+
// Resolve each source candidate through the equivalency chain
|
|
2714
|
+
for (const source of entry.sourceCandidates) {
|
|
2715
|
+
const resolvedSources = resolveToSignature(source, new Set());
|
|
2716
|
+
acc[usage.schemaPath].push(...resolvedSources);
|
|
2717
|
+
}
|
|
2280
2718
|
}
|
|
2281
2719
|
return acc;
|
|
2282
2720
|
}, {});
|
|
@@ -2344,6 +2782,49 @@ export class ScopeDataStructure {
|
|
|
2344
2782
|
}
|
|
2345
2783
|
}
|
|
2346
2784
|
}
|
|
2785
|
+
// Enrich schema with deeply nested paths from internal function call scopes.
|
|
2786
|
+
// When a function call like traverse(tree) exists, and traverse's scope has
|
|
2787
|
+
// signature[0].children[path][entityName] (from propagateParameterToSignaturePaths),
|
|
2788
|
+
// we need to map those paths back to the argument variable (tree) in this scope.
|
|
2789
|
+
// This handles cases where cycle detection prevented the equivalency chain from
|
|
2790
|
+
// propagating deep paths during Phase 2 batch queue processing.
|
|
2791
|
+
for (const equivalenceKey in equivalencies ?? {}) {
|
|
2792
|
+
// Look for keys matching function call pattern: funcName(...).signature[N]
|
|
2793
|
+
const funcCallMatch = equivalenceKey.match(/^([^(]+)\(.*?\)\.(signature\[\d+\])$/);
|
|
2794
|
+
if (!funcCallMatch)
|
|
2795
|
+
continue;
|
|
2796
|
+
const calledFunctionName = funcCallMatch[1];
|
|
2797
|
+
const signatureParam = funcCallMatch[2]; // e.g., "signature[0]"
|
|
2798
|
+
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
2799
|
+
if (equivalenceValue.scopeNodeName !== scopeName)
|
|
2800
|
+
continue;
|
|
2801
|
+
const targetVariable = equivalenceValue.schemaPath;
|
|
2802
|
+
// Get the called function's schema (includes propagated parameter paths)
|
|
2803
|
+
const childSchema = this.getSchema({
|
|
2804
|
+
scopeName: calledFunctionName,
|
|
2805
|
+
});
|
|
2806
|
+
if (!childSchema)
|
|
2807
|
+
continue;
|
|
2808
|
+
// Map child function's signature paths to parent variable paths
|
|
2809
|
+
const sigPrefix = signatureParam + '.';
|
|
2810
|
+
const sigBracketPrefix = signatureParam + '[';
|
|
2811
|
+
for (const childKey in childSchema) {
|
|
2812
|
+
let suffix = null;
|
|
2813
|
+
if (childKey.startsWith(sigPrefix)) {
|
|
2814
|
+
suffix = childKey.slice(signatureParam.length);
|
|
2815
|
+
}
|
|
2816
|
+
else if (childKey.startsWith(sigBracketPrefix)) {
|
|
2817
|
+
suffix = childKey.slice(signatureParam.length);
|
|
2818
|
+
}
|
|
2819
|
+
if (suffix !== null) {
|
|
2820
|
+
const parentKey = targetVariable + suffix;
|
|
2821
|
+
if (!schema[parentKey]) {
|
|
2822
|
+
schema[parentKey] = childSchema[childKey];
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2347
2828
|
// Propagate nested paths from variables to their signature equivalents
|
|
2348
2829
|
// e.g., if workouts = signature[0].workouts, then workouts[].title becomes
|
|
2349
2830
|
// signature[0].workouts[].title
|
|
@@ -2368,7 +2849,7 @@ export class ScopeDataStructure {
|
|
|
2368
2849
|
}
|
|
2369
2850
|
}
|
|
2370
2851
|
}
|
|
2371
|
-
return tempScopeNode.schema;
|
|
2852
|
+
return this.filterDuplicateKeys(tempScopeNode.schema);
|
|
2372
2853
|
}
|
|
2373
2854
|
getReturnValue({ functionName, fillInUnknowns, }) {
|
|
2374
2855
|
// Trigger finalization on all managers to apply any pending updates
|
|
@@ -2411,14 +2892,27 @@ export class ScopeDataStructure {
|
|
|
2411
2892
|
// Include function paths even if their return value wasn't captured
|
|
2412
2893
|
// This ensures methods like onAuthStateChange are included in the schema
|
|
2413
2894
|
// But exclude signature entries (they should only be included via functionCallReturnValue paths)
|
|
2414
|
-
|
|
2895
|
+
// Also exclude bare function call signatures - paths that are JUST a call like
|
|
2896
|
+
// "useCustomSizes(projectSlug)" should not be included as return values.
|
|
2897
|
+
// These represent "the function exists" not actual return data, and including
|
|
2898
|
+
// them causes nested path bugs in dependencySchemas.
|
|
2899
|
+
(schema[key] === 'function' &&
|
|
2900
|
+
key.indexOf('signature[') === -1 &&
|
|
2901
|
+
// Exclude bare call signatures: function calls with no dots OUTSIDE parentheses
|
|
2902
|
+
// e.g., "useCustomSizes(projectSlug)" is bare (exclude)
|
|
2903
|
+
// e.g., "loadProject({nested.property})" is bare - dots are inside args (exclude)
|
|
2904
|
+
// e.g., "getSupabase().auth.method()" has dots outside - method chain (include)
|
|
2905
|
+
!this.isBareCallSignature(key)))
|
|
2415
2906
|
.reduce((acc, key) => {
|
|
2416
2907
|
acc[key] = schema[key];
|
|
2417
2908
|
const keyParts = this.splitPath(key);
|
|
2418
2909
|
for (const path in schema) {
|
|
2419
2910
|
const pathParts = this.splitPath(path);
|
|
2420
2911
|
if (pathParts.every((p, i) => keyParts[i] === p)) {
|
|
2421
|
-
|
|
2912
|
+
// Also exclude bare call signatures from prefix paths
|
|
2913
|
+
if (!this.isBareCallSignature(path)) {
|
|
2914
|
+
acc[path] = schema[path];
|
|
2915
|
+
}
|
|
2422
2916
|
}
|
|
2423
2917
|
}
|
|
2424
2918
|
return acc;
|
|
@@ -2432,7 +2926,56 @@ export class ScopeDataStructure {
|
|
|
2432
2926
|
this.onlyEquivalencies = true;
|
|
2433
2927
|
this.validateSchema(tempScopeNode, true, fillInUnknowns);
|
|
2434
2928
|
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
2435
|
-
return
|
|
2929
|
+
// Remove bare call signatures from the return value schema.
|
|
2930
|
+
// fillInSchemaGapsAndUnknowns may add parent paths like "useCustomSizes(projectSlug)"
|
|
2931
|
+
// when it sees "useCustomSizes(projectSlug).functionCallReturnValue". These bare
|
|
2932
|
+
// call signatures represent "the function exists" not actual return data, and
|
|
2933
|
+
// including them causes nested path bugs in dependencySchemas.
|
|
2934
|
+
const resultSchema = tempScopeNode.schema;
|
|
2935
|
+
for (const key of Object.keys(resultSchema)) {
|
|
2936
|
+
if (this.isBareCallSignature(key)) {
|
|
2937
|
+
delete resultSchema[key];
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
return resultSchema;
|
|
2941
|
+
}
|
|
2942
|
+
/**
|
|
2943
|
+
* Checks if a schema key is a "bare call signature" - a function call with no
|
|
2944
|
+
* method chain before it and no path segments after it.
|
|
2945
|
+
*
|
|
2946
|
+
* A bare call signature represents "this function exists" rather than actual
|
|
2947
|
+
* return data, and including them causes nested path bugs in dependencySchemas.
|
|
2948
|
+
*
|
|
2949
|
+
* Examples:
|
|
2950
|
+
* - "useCustomSizes(projectSlug)" -> bare (true)
|
|
2951
|
+
* - "loadProject({nested.property})" -> bare (dots are inside args, true)
|
|
2952
|
+
* - "getSupabase().auth.method()" -> not bare (has dots outside parens, false)
|
|
2953
|
+
* - "useProject().functionCallReturnValue" -> not bare (has path after, false)
|
|
2954
|
+
*/
|
|
2955
|
+
isBareCallSignature(key) {
|
|
2956
|
+
// Must end with ) and contain ( to be a call
|
|
2957
|
+
if (!key.endsWith(')') || key.indexOf('(') === -1) {
|
|
2958
|
+
return false;
|
|
2959
|
+
}
|
|
2960
|
+
// Check if there are any dots OUTSIDE of parentheses
|
|
2961
|
+
// Strip out content inside balanced parentheses, then check for dots
|
|
2962
|
+
let depth = 0;
|
|
2963
|
+
let hasDotsOutsideParens = false;
|
|
2964
|
+
for (let i = 0; i < key.length; i++) {
|
|
2965
|
+
const char = key[i];
|
|
2966
|
+
if (char === '(') {
|
|
2967
|
+
depth++;
|
|
2968
|
+
}
|
|
2969
|
+
else if (char === ')') {
|
|
2970
|
+
depth--;
|
|
2971
|
+
}
|
|
2972
|
+
else if (char === '.' && depth === 0) {
|
|
2973
|
+
hasDotsOutsideParens = true;
|
|
2974
|
+
break;
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
// It's a bare call signature if there are no dots outside parentheses
|
|
2978
|
+
return !hasDotsOutsideParens;
|
|
2436
2979
|
}
|
|
2437
2980
|
/**
|
|
2438
2981
|
* Replaces cyScope placeholder references (e.g., cyScope10()) in schema keys
|
|
@@ -2503,13 +3046,365 @@ export class ScopeDataStructure {
|
|
|
2503
3046
|
getEquivalentSignatureVariables() {
|
|
2504
3047
|
const scopeNode = this.scopeNodes[this.scopeTreeManager.getRootName()];
|
|
2505
3048
|
const equivalentSignatureVariables = {};
|
|
3049
|
+
// Helper to add equivalencies - accumulates into array if multiple values for same key
|
|
3050
|
+
// This is critical for OR expressions like `x = a || b` where x should map to both a and b
|
|
3051
|
+
const addEquivalency = (key, value) => {
|
|
3052
|
+
const existing = equivalentSignatureVariables[key];
|
|
3053
|
+
if (existing === undefined) {
|
|
3054
|
+
// First value - store as string
|
|
3055
|
+
equivalentSignatureVariables[key] = value;
|
|
3056
|
+
}
|
|
3057
|
+
else if (typeof existing === 'string') {
|
|
3058
|
+
if (existing !== value) {
|
|
3059
|
+
// Second different value - convert to array
|
|
3060
|
+
equivalentSignatureVariables[key] = [existing, value];
|
|
3061
|
+
}
|
|
3062
|
+
// Same value - no change needed
|
|
3063
|
+
}
|
|
3064
|
+
else {
|
|
3065
|
+
// Already an array - add if not already present
|
|
3066
|
+
if (!existing.includes(value)) {
|
|
3067
|
+
existing.push(value);
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
};
|
|
2506
3071
|
for (const [path, equivalentValues] of Object.entries(scopeNode.equivalencies)) {
|
|
2507
3072
|
for (const equivalentValue of equivalentValues) {
|
|
3073
|
+
// Case 1: Props/signature equivalencies (existing behavior)
|
|
3074
|
+
// Maps local variable names to their signature paths
|
|
3075
|
+
// e.g., "propValue" -> "signature[0].prop"
|
|
2508
3076
|
if (path.startsWith('signature[')) {
|
|
2509
|
-
|
|
3077
|
+
addEquivalency(equivalentValue.schemaPath, path);
|
|
3078
|
+
}
|
|
3079
|
+
// Case 2: Hook variable equivalencies (new behavior)
|
|
3080
|
+
// The equivalencies are stored as: path = variable name, schemaPath = data source
|
|
3081
|
+
// e.g., path = "debugFetcher", schemaPath = "useFetcher<...>().functionCallReturnValue"
|
|
3082
|
+
// We need to map: "debugFetcher" -> "useFetcher<...>()"
|
|
3083
|
+
// This enables resolving paths like "debugFetcher.state" to
|
|
3084
|
+
// "useFetcher<...>().state" for execution flow validation
|
|
3085
|
+
if (equivalentValue.schemaPath.endsWith('.functionCallReturnValue')) {
|
|
3086
|
+
// Extract the hook call path (everything before .functionCallReturnValue)
|
|
3087
|
+
let hookCallPath = equivalentValue.schemaPath.slice(0, -'.functionCallReturnValue'.length);
|
|
3088
|
+
// Only include if it looks like a hook call (contains parentheses)
|
|
3089
|
+
// and the variable name (path) is a simple identifier (no dots)
|
|
3090
|
+
if (hookCallPath.includes('(') && !path.includes('.')) {
|
|
3091
|
+
// Special case: If hookCallPath is a callback scope (cyScope pattern),
|
|
3092
|
+
// trace through it to find what the callback actually returns.
|
|
3093
|
+
// This handles useState(() => { return prop; }) patterns.
|
|
3094
|
+
const cyScopeMatch = hookCallPath.match(/^(cyScope\d+)\(\)$/);
|
|
3095
|
+
if (cyScopeMatch) {
|
|
3096
|
+
// Use the equivalency database to trace the callback's return value
|
|
3097
|
+
// to its actual source (e.g., viewModeFromUrl -> segments -> params -> useParams)
|
|
3098
|
+
const dbEntry = this.getEquivalenciesDatabaseEntry(scopeNode.name, // Component scope
|
|
3099
|
+
path);
|
|
3100
|
+
if (dbEntry?.sourceCandidates?.length > 0) {
|
|
3101
|
+
// Use the traced source instead of the callback scope
|
|
3102
|
+
hookCallPath = dbEntry.sourceCandidates[0].schemaPath;
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
addEquivalency(path, hookCallPath);
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
// Case 3: Destructured variables from local variables
|
|
3109
|
+
// e.g., const { scenarios } = currentEntityAnalysis;
|
|
3110
|
+
// This creates: path = "scenarios", schemaPath = "currentEntityAnalysis.scenarios"
|
|
3111
|
+
// We need to map: "scenarios" -> "currentEntityAnalysis.scenarios"
|
|
3112
|
+
// AND resolve transitively if currentEntityAnalysis is itself equivalent to a hook call
|
|
3113
|
+
if (!path.includes('.') && // path is a simple identifier
|
|
3114
|
+
!equivalentValue.schemaPath.startsWith('signature[') && // not a signature path
|
|
3115
|
+
!equivalentValue.schemaPath.endsWith('.functionCallReturnValue') // not already handled above
|
|
3116
|
+
) {
|
|
3117
|
+
// Add equivalency (will accumulate if multiple values for OR expressions)
|
|
3118
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3119
|
+
}
|
|
3120
|
+
// Case 4: Child component prop mappings (Fix 22)
|
|
3121
|
+
// When parent renders <ChildComponent prop={value} />, we get equivalencies like:
|
|
3122
|
+
// path = "ChildComponent().signature[0].prop"
|
|
3123
|
+
// schemaPath = "value" (the variable passed as the prop)
|
|
3124
|
+
// We need to include these so translateChildPathToParent can work.
|
|
3125
|
+
// Pattern: ComponentName().signature[N] or ComponentName().signature[N].propName
|
|
3126
|
+
if (path.includes('().signature[') &&
|
|
3127
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable, not a function call
|
|
3128
|
+
) {
|
|
3129
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3130
|
+
}
|
|
3131
|
+
// Case 5: Destructured function parameters (Fix 25)
|
|
3132
|
+
// When a function has destructured props: function Comp({ propA, propB }: Props)
|
|
3133
|
+
// We get equivalencies like:
|
|
3134
|
+
// path = "propA" (the destructured variable name)
|
|
3135
|
+
// schemaPath = "signature[0].propA" (the signature path)
|
|
3136
|
+
// We need to map: "propA" -> "signature[0].propA"
|
|
3137
|
+
// This enables translateChildPathToParent to resolve child variable paths
|
|
3138
|
+
// to their signature paths when merging execution flows.
|
|
3139
|
+
if (!path.includes('.') && // path is a simple identifier (destructured prop name)
|
|
3140
|
+
equivalentValue.schemaPath.startsWith('signature[') // schemaPath IS a signature path
|
|
3141
|
+
) {
|
|
3142
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3143
|
+
}
|
|
3144
|
+
// Case 7: Method calls on variables that result in .functionCallReturnValue (Fix 33)
|
|
3145
|
+
// When we have patterns like:
|
|
3146
|
+
// path = "segments" (simple identifier)
|
|
3147
|
+
// schemaPath = "splat.split('/').functionCallReturnValue"
|
|
3148
|
+
// This is a method call on a variable (not a hook call), but we still need to
|
|
3149
|
+
// track it so transitive resolution can resolve `splat` to its actual source.
|
|
3150
|
+
// E.g., if splat -> useParams().functionCallReturnValue['*'], then
|
|
3151
|
+
// segments -> useParams().functionCallReturnValue['*'].split('/').functionCallReturnValue
|
|
3152
|
+
if (!path.includes('.') && // path is a simple identifier
|
|
3153
|
+
equivalentValue.schemaPath.endsWith('.functionCallReturnValue') && // ends with function return
|
|
3154
|
+
equivalentValue.schemaPath.includes('.') // has property access (method call)
|
|
3155
|
+
) {
|
|
3156
|
+
// Check if this looks like a method call on a variable (not a hook call)
|
|
3157
|
+
// Hook calls look like: hookName() or hookName<T>()
|
|
3158
|
+
// Method calls look like: variable.method() or variable.method<T>()
|
|
3159
|
+
const hookCallPath = equivalentValue.schemaPath.slice(0, -'.functionCallReturnValue'.length);
|
|
3160
|
+
// If it's a method call (contains a dot before the parenthesis), include it
|
|
3161
|
+
const dotBeforeParen = hookCallPath.indexOf('.');
|
|
3162
|
+
const parenPos = hookCallPath.indexOf('(');
|
|
3163
|
+
if (dotBeforeParen !== -1 && dotBeforeParen < parenPos) {
|
|
3164
|
+
// This is a method call like "splat.split('/')", not a hook call
|
|
3165
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
// Case 6: Collect JSX child prop equivalencies from child scopes (Fix 26)
|
|
3171
|
+
// When a parent component renders <ChildComponent prop={value} />, the JSX
|
|
3172
|
+
// return statement may be in a child scope (e.g., cyScope2). The equivalencies
|
|
3173
|
+
// like ChildComponent().signature[0].prop -> value get stored in that child scope.
|
|
3174
|
+
// But translateChildPathToParent needs to find them from the parent scope's context.
|
|
3175
|
+
// So we collect Case 4 patterns from ALL child scopes that belong to this root scope.
|
|
3176
|
+
const rootName = this.scopeTreeManager.getRootName();
|
|
3177
|
+
for (const [scopeName, childScopeNode] of Object.entries(this.scopeNodes)) {
|
|
3178
|
+
// Skip the root scope (already processed above)
|
|
3179
|
+
if (scopeName === rootName)
|
|
3180
|
+
continue;
|
|
3181
|
+
// Only include scopes that are children of the root (their tree includes root)
|
|
3182
|
+
if (!childScopeNode.tree?.includes(rootName))
|
|
3183
|
+
continue;
|
|
3184
|
+
// Look for Case 4 patterns in the child scope
|
|
3185
|
+
for (const [path, equivalentValues] of Object.entries(childScopeNode.equivalencies || {})) {
|
|
3186
|
+
for (const equivalentValue of equivalentValues) {
|
|
3187
|
+
// Case 4 pattern: ChildComponent().signature[0].propName -> parentVariable
|
|
3188
|
+
if (path.includes('().signature[') &&
|
|
3189
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable
|
|
3190
|
+
) {
|
|
3191
|
+
// Only add if not already present from the root scope
|
|
3192
|
+
// Root scope values take precedence over child scope values
|
|
3193
|
+
if (!(path in equivalentSignatureVariables)) {
|
|
3194
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
2510
3197
|
}
|
|
2511
3198
|
}
|
|
2512
3199
|
}
|
|
3200
|
+
// Transitive resolution: Resolve variable chains through multiple levels
|
|
3201
|
+
// E.g., analysis → currentEntityAnalysis → useLoaderData().functionCallReturnValue.currentEntityAnalysis
|
|
3202
|
+
// We need multiple passes because resolutions can depend on each other
|
|
3203
|
+
const maxIterations = 5; // Prevent infinite loops
|
|
3204
|
+
// Helper function to resolve a single source path using equivalencies
|
|
3205
|
+
const resolveSourcePath = (sourcePath, equivMap) => {
|
|
3206
|
+
// Extract base variable from the path
|
|
3207
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
3208
|
+
const bracketIndex = sourcePath.indexOf('[');
|
|
3209
|
+
let baseVar;
|
|
3210
|
+
let rest;
|
|
3211
|
+
if (dotIndex === -1 && bracketIndex === -1) {
|
|
3212
|
+
baseVar = sourcePath;
|
|
3213
|
+
rest = '';
|
|
3214
|
+
}
|
|
3215
|
+
else if (dotIndex === -1) {
|
|
3216
|
+
baseVar = sourcePath.slice(0, bracketIndex);
|
|
3217
|
+
rest = sourcePath.slice(bracketIndex);
|
|
3218
|
+
}
|
|
3219
|
+
else if (bracketIndex === -1) {
|
|
3220
|
+
baseVar = sourcePath.slice(0, dotIndex);
|
|
3221
|
+
rest = sourcePath.slice(dotIndex);
|
|
3222
|
+
}
|
|
3223
|
+
else {
|
|
3224
|
+
const firstIndex = Math.min(dotIndex, bracketIndex);
|
|
3225
|
+
baseVar = sourcePath.slice(0, firstIndex);
|
|
3226
|
+
rest = sourcePath.slice(firstIndex);
|
|
3227
|
+
}
|
|
3228
|
+
// Look up the base variable in equivalencies
|
|
3229
|
+
if (baseVar in equivMap && equivMap[baseVar] !== sourcePath) {
|
|
3230
|
+
const baseResolved = equivMap[baseVar];
|
|
3231
|
+
// Skip if baseResolved is an array (handle later)
|
|
3232
|
+
if (Array.isArray(baseResolved))
|
|
3233
|
+
return null;
|
|
3234
|
+
// If it resolves to a signature path, build the full resolved path
|
|
3235
|
+
if (baseResolved.startsWith('signature[') ||
|
|
3236
|
+
baseResolved.includes('()')) {
|
|
3237
|
+
if (baseResolved.endsWith('()')) {
|
|
3238
|
+
return baseResolved + '.functionCallReturnValue' + rest;
|
|
3239
|
+
}
|
|
3240
|
+
return baseResolved + rest;
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
return null;
|
|
3244
|
+
};
|
|
3245
|
+
for (let iteration = 0; iteration < maxIterations; iteration++) {
|
|
3246
|
+
let changed = false;
|
|
3247
|
+
for (const [varName, sourcePathOrArray] of Object.entries(equivalentSignatureVariables)) {
|
|
3248
|
+
// Handle arrays (OR expressions) by resolving each element
|
|
3249
|
+
if (Array.isArray(sourcePathOrArray)) {
|
|
3250
|
+
const resolvedArray = [];
|
|
3251
|
+
let arrayChanged = false;
|
|
3252
|
+
for (const sourcePath of sourcePathOrArray) {
|
|
3253
|
+
// Try to resolve this path using transitive resolution
|
|
3254
|
+
const resolved = resolveSourcePath(sourcePath, equivalentSignatureVariables);
|
|
3255
|
+
if (resolved && resolved !== sourcePath) {
|
|
3256
|
+
resolvedArray.push(resolved);
|
|
3257
|
+
arrayChanged = true;
|
|
3258
|
+
}
|
|
3259
|
+
else {
|
|
3260
|
+
resolvedArray.push(sourcePath);
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
if (arrayChanged) {
|
|
3264
|
+
equivalentSignatureVariables[varName] = resolvedArray;
|
|
3265
|
+
changed = true;
|
|
3266
|
+
}
|
|
3267
|
+
continue;
|
|
3268
|
+
}
|
|
3269
|
+
const sourcePath = sourcePathOrArray;
|
|
3270
|
+
// Skip if already fully resolved (contains function call syntax)
|
|
3271
|
+
// BUT first check for computed value patterns that need resolution (Fix 28)
|
|
3272
|
+
// AND method call patterns that need base variable resolution (Fix 33)
|
|
3273
|
+
if (sourcePath.includes('()')) {
|
|
3274
|
+
// Fix 28: Handle computed value patterns with dependency arrays
|
|
3275
|
+
// Patterns like `functionName(arg, [dep1, dep2, ...])` are NOT controllable
|
|
3276
|
+
// data sources. We trace through the dependencies to find controllable sources.
|
|
3277
|
+
const bracketStart = sourcePath.indexOf('[');
|
|
3278
|
+
const bracketEnd = sourcePath.lastIndexOf(']');
|
|
3279
|
+
if (bracketStart !== -1 && bracketEnd > bracketStart) {
|
|
3280
|
+
const arrayContent = sourcePath.slice(bracketStart + 1, bracketEnd);
|
|
3281
|
+
const items = arrayContent.split(',').map((s) => s.trim());
|
|
3282
|
+
// Only process if this looks like a dependency array:
|
|
3283
|
+
// multiple items that are all simple identifiers (not numbers or expressions)
|
|
3284
|
+
const isIdentifier = (s) => /^\w+$/.test(s) && !/^\d+$/.test(s);
|
|
3285
|
+
if (items.length > 1 && items.every(isIdentifier)) {
|
|
3286
|
+
// Look for a dependency that's already resolved to a controllable source
|
|
3287
|
+
for (const dep of items) {
|
|
3288
|
+
if (dep in equivalentSignatureVariables) {
|
|
3289
|
+
const resolvedDep = equivalentSignatureVariables[dep];
|
|
3290
|
+
// Use if it's a controllable path (contains hook call)
|
|
3291
|
+
// and is NOT another unresolved computed pattern (has comma-separated deps)
|
|
3292
|
+
const hasCommaInBrackets = resolvedDep.includes('[') &&
|
|
3293
|
+
resolvedDep.includes(',') &&
|
|
3294
|
+
resolvedDep.indexOf(',') > resolvedDep.indexOf('[');
|
|
3295
|
+
if (resolvedDep.includes('()') && !hasCommaInBrackets) {
|
|
3296
|
+
// Computed value is typically an element from an array
|
|
3297
|
+
equivalentSignatureVariables[varName] = resolvedDep + '[]';
|
|
3298
|
+
changed = true;
|
|
3299
|
+
break;
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
// Fix 33: Handle method call patterns on variables
|
|
3306
|
+
// Patterns like: "splat.split('/').functionCallReturnValue"
|
|
3307
|
+
// We need to resolve the base variable (splat) to its actual source
|
|
3308
|
+
// Check if this is a method call on a variable (dot before first parenthesis)
|
|
3309
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
3310
|
+
const parenIndex = sourcePath.indexOf('(');
|
|
3311
|
+
if (dotIndex !== -1 &&
|
|
3312
|
+
dotIndex < parenIndex &&
|
|
3313
|
+
!sourcePath.startsWith('use') // Not a hook call like useState()
|
|
3314
|
+
) {
|
|
3315
|
+
// Extract the base variable (before the first dot)
|
|
3316
|
+
const baseVar = sourcePath.slice(0, dotIndex);
|
|
3317
|
+
const rest = sourcePath.slice(dotIndex); // includes ".method(...).functionCallReturnValue"
|
|
3318
|
+
// Check if the base variable can be resolved
|
|
3319
|
+
if (baseVar in equivalentSignatureVariables &&
|
|
3320
|
+
baseVar !== varName) {
|
|
3321
|
+
const baseResolved = equivalentSignatureVariables[baseVar];
|
|
3322
|
+
// Skip if baseResolved is an array (OR expression)
|
|
3323
|
+
if (Array.isArray(baseResolved))
|
|
3324
|
+
continue;
|
|
3325
|
+
// Only resolve if the base resolved to something useful (contains () or .)
|
|
3326
|
+
if (baseResolved.includes('()') || baseResolved.includes('.')) {
|
|
3327
|
+
const newPath = baseResolved + rest;
|
|
3328
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
3329
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
3330
|
+
changed = true;
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
// Fix 38: Handle cyScope lazy initializer return values
|
|
3336
|
+
// When we have viewMode -> cyScope20(), trace through to find what cyScope20 returns.
|
|
3337
|
+
// The lazy initializer's return value should be the controllable data source.
|
|
3338
|
+
// Pattern: cyScopeN() where N is a number
|
|
3339
|
+
const cyScopeMatch = sourcePath.match(/^(cyScope\d+)\(\)$/);
|
|
3340
|
+
if (cyScopeMatch) {
|
|
3341
|
+
const cyScopeName = cyScopeMatch[1];
|
|
3342
|
+
const cyScopeNode = this.scopeNodes[cyScopeName];
|
|
3343
|
+
if (cyScopeNode?.equivalencies) {
|
|
3344
|
+
// Look for returnValue equivalency in the cyScope
|
|
3345
|
+
const returnValueEquivs = cyScopeNode.equivalencies['returnValue'];
|
|
3346
|
+
if (returnValueEquivs && returnValueEquivs.length > 0) {
|
|
3347
|
+
// Get the first return value source
|
|
3348
|
+
const returnSource = returnValueEquivs[0].schemaPath;
|
|
3349
|
+
// If the return source is a simple variable (not a complex path),
|
|
3350
|
+
// resolve varName directly to that variable
|
|
3351
|
+
if (returnSource &&
|
|
3352
|
+
!returnSource.includes('(') &&
|
|
3353
|
+
!returnSource.includes('[')) {
|
|
3354
|
+
// Update varName to point to the return source
|
|
3355
|
+
if (equivalentSignatureVariables[varName] !== returnSource) {
|
|
3356
|
+
equivalentSignatureVariables[varName] = returnSource;
|
|
3357
|
+
changed = true;
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
continue;
|
|
3364
|
+
}
|
|
3365
|
+
// Check if the source path starts with a variable that's also in the map
|
|
3366
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
3367
|
+
let baseVar;
|
|
3368
|
+
let rest;
|
|
3369
|
+
if (dotIndex > 0) {
|
|
3370
|
+
// Path has a dot: "a.b.c" -> baseVar="a", rest=".b.c"
|
|
3371
|
+
baseVar = sourcePath.slice(0, dotIndex);
|
|
3372
|
+
rest = sourcePath.slice(dotIndex); // includes the leading dot
|
|
3373
|
+
}
|
|
3374
|
+
else {
|
|
3375
|
+
// Path is a simple identifier: "currentEntityAnalysis" -> baseVar="currentEntityAnalysis", rest=""
|
|
3376
|
+
baseVar = sourcePath;
|
|
3377
|
+
rest = '';
|
|
3378
|
+
}
|
|
3379
|
+
if (baseVar in equivalentSignatureVariables && baseVar !== varName) {
|
|
3380
|
+
// Handle array case (OR expressions) - use first element
|
|
3381
|
+
const rawBaseResolved = equivalentSignatureVariables[baseVar];
|
|
3382
|
+
const baseResolved = Array.isArray(rawBaseResolved)
|
|
3383
|
+
? rawBaseResolved[0]
|
|
3384
|
+
: rawBaseResolved;
|
|
3385
|
+
if (!baseResolved)
|
|
3386
|
+
continue;
|
|
3387
|
+
// If the base resolves to a hook call, add .functionCallReturnValue
|
|
3388
|
+
if (baseResolved.endsWith('()')) {
|
|
3389
|
+
const newPath = baseResolved + '.functionCallReturnValue' + rest;
|
|
3390
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
3391
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
3392
|
+
changed = true;
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
else if (baseResolved !== sourcePath) {
|
|
3396
|
+
const newPath = baseResolved + rest;
|
|
3397
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
3398
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
3399
|
+
changed = true;
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
// Stop if no changes were made in this iteration
|
|
3405
|
+
if (!changed)
|
|
3406
|
+
break;
|
|
3407
|
+
}
|
|
2513
3408
|
return equivalentSignatureVariables;
|
|
2514
3409
|
}
|
|
2515
3410
|
getVariableInfo(variableName, scopeName, final) {
|
|
@@ -2669,9 +3564,112 @@ export class ScopeDataStructure {
|
|
|
2669
3564
|
}
|
|
2670
3565
|
}
|
|
2671
3566
|
}
|
|
3567
|
+
/**
|
|
3568
|
+
* Add conditional effects from AST analysis.
|
|
3569
|
+
* Called during scope analysis to collect all setter calls inside conditionals.
|
|
3570
|
+
*/
|
|
3571
|
+
addConditionalEffects(effects) {
|
|
3572
|
+
// Add effects, avoiding duplicates based on effect stateVariable and condition paths
|
|
3573
|
+
for (const effect of effects) {
|
|
3574
|
+
const exists = this.rawConditionalEffects.some((existing) => {
|
|
3575
|
+
// Same effect target (stateVariable + value)
|
|
3576
|
+
const sameEffect = existing.effect.stateVariable === effect.effect.stateVariable &&
|
|
3577
|
+
existing.effect.value === effect.effect.value;
|
|
3578
|
+
if (!sameEffect)
|
|
3579
|
+
return false;
|
|
3580
|
+
// Same condition(s)
|
|
3581
|
+
if (existing.condition && effect.condition) {
|
|
3582
|
+
return (existing.condition.path === effect.condition.path &&
|
|
3583
|
+
existing.condition.requiredValue === effect.condition.requiredValue);
|
|
3584
|
+
}
|
|
3585
|
+
if (existing.conditions && effect.conditions) {
|
|
3586
|
+
if (existing.conditions.length !== effect.conditions.length)
|
|
3587
|
+
return false;
|
|
3588
|
+
return existing.conditions.every((ec, i) => {
|
|
3589
|
+
const newCond = effect.conditions[i];
|
|
3590
|
+
return (ec.path === newCond.path &&
|
|
3591
|
+
ec.requiredValue === newCond.requiredValue);
|
|
3592
|
+
});
|
|
3593
|
+
}
|
|
3594
|
+
return false;
|
|
3595
|
+
});
|
|
3596
|
+
if (!exists) {
|
|
3597
|
+
this.rawConditionalEffects.push(effect);
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
/**
|
|
3602
|
+
* Get conditional effects collected during analysis.
|
|
3603
|
+
*/
|
|
3604
|
+
getConditionalEffects() {
|
|
3605
|
+
return this.rawConditionalEffects;
|
|
3606
|
+
}
|
|
3607
|
+
/**
|
|
3608
|
+
* Add compound conditionals from AST analysis.
|
|
3609
|
+
* Called during scope analysis to collect grouped conditions (e.g., a && b && c).
|
|
3610
|
+
*/
|
|
3611
|
+
addCompoundConditionals(compounds) {
|
|
3612
|
+
// Add compounds, avoiding duplicates based on chainId
|
|
3613
|
+
for (const compound of compounds) {
|
|
3614
|
+
const exists = this.rawCompoundConditionals.some((existing) => existing.chainId === compound.chainId);
|
|
3615
|
+
if (!exists) {
|
|
3616
|
+
this.rawCompoundConditionals.push(compound);
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
/**
|
|
3621
|
+
* Get compound conditionals collected during analysis.
|
|
3622
|
+
*/
|
|
3623
|
+
getCompoundConditionals() {
|
|
3624
|
+
return this.rawCompoundConditionals;
|
|
3625
|
+
}
|
|
3626
|
+
/**
|
|
3627
|
+
* Add child boundary gating conditions from AST analysis.
|
|
3628
|
+
* These track which conditions must be true for a child component to render.
|
|
3629
|
+
*/
|
|
3630
|
+
addChildBoundaryGatingConditions(conditions) {
|
|
3631
|
+
for (const [childName, usages] of Object.entries(conditions)) {
|
|
3632
|
+
if (!this.rawChildBoundaryGatingConditions[childName]) {
|
|
3633
|
+
this.rawChildBoundaryGatingConditions[childName] = [];
|
|
3634
|
+
}
|
|
3635
|
+
// Add usages, avoiding duplicates
|
|
3636
|
+
for (const usage of usages) {
|
|
3637
|
+
const exists = this.rawChildBoundaryGatingConditions[childName].some((existing) => existing.path === usage.path &&
|
|
3638
|
+
existing.conditionType === usage.conditionType &&
|
|
3639
|
+
existing.isNegated === usage.isNegated);
|
|
3640
|
+
if (!exists) {
|
|
3641
|
+
this.rawChildBoundaryGatingConditions[childName].push(usage);
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
/**
|
|
3647
|
+
* Get enriched child boundary gating conditions with source tracing.
|
|
3648
|
+
* Similar to getEnrichedConditionalUsages but for gating conditions.
|
|
3649
|
+
*/
|
|
3650
|
+
getEnrichedChildBoundaryGatingConditions() {
|
|
3651
|
+
const enriched = {};
|
|
3652
|
+
const rootScopeName = this.scopeTreeManager.getTree().name;
|
|
3653
|
+
for (const [childName, usages] of Object.entries(this.rawChildBoundaryGatingConditions)) {
|
|
3654
|
+
enriched[childName] = usages.map((usage) => {
|
|
3655
|
+
// Try to trace this path back to a data source
|
|
3656
|
+
const explanation = this.explainPath(rootScopeName, usage.path);
|
|
3657
|
+
let sourceDataPath;
|
|
3658
|
+
if (explanation.source) {
|
|
3659
|
+
sourceDataPath = `${explanation.source.scope}.${explanation.source.path}`;
|
|
3660
|
+
}
|
|
3661
|
+
return {
|
|
3662
|
+
...usage,
|
|
3663
|
+
sourceDataPath,
|
|
3664
|
+
};
|
|
3665
|
+
});
|
|
3666
|
+
}
|
|
3667
|
+
return enriched;
|
|
3668
|
+
}
|
|
2672
3669
|
/**
|
|
2673
3670
|
* Get enriched conditional usages with source tracing.
|
|
2674
3671
|
* Uses explainPath to trace each local variable back to its data source.
|
|
3672
|
+
* Preserves all fields from the raw conditional usages including derivedFrom.
|
|
2675
3673
|
*/
|
|
2676
3674
|
getEnrichedConditionalUsages() {
|
|
2677
3675
|
const enriched = {};
|
|
@@ -2692,9 +3690,29 @@ export class ScopeDataStructure {
|
|
|
2692
3690
|
}
|
|
2693
3691
|
return enriched;
|
|
2694
3692
|
}
|
|
3693
|
+
/**
|
|
3694
|
+
* Add JSX rendering usages from AST analysis.
|
|
3695
|
+
* These track arrays rendered via .map() and strings interpolated in JSX.
|
|
3696
|
+
*/
|
|
3697
|
+
addJsxRenderingUsages(usages) {
|
|
3698
|
+
// Add usages, avoiding duplicates based on path and renderingType
|
|
3699
|
+
for (const usage of usages) {
|
|
3700
|
+
const exists = this.rawJsxRenderingUsages.some((existing) => existing.path === usage.path &&
|
|
3701
|
+
existing.renderingType === usage.renderingType);
|
|
3702
|
+
if (!exists) {
|
|
3703
|
+
this.rawJsxRenderingUsages.push(usage);
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
/**
|
|
3708
|
+
* Get JSX rendering usages collected during analysis.
|
|
3709
|
+
*/
|
|
3710
|
+
getJsxRenderingUsages() {
|
|
3711
|
+
return this.rawJsxRenderingUsages;
|
|
3712
|
+
}
|
|
2695
3713
|
toSerializable() {
|
|
2696
|
-
// Helper to clean cyScope from a string
|
|
2697
|
-
const cleanCyScope = (str) => this.replaceCyScopeInString(str);
|
|
3714
|
+
// Helper to clean cyScope and cyDuplicateKey from a string for output
|
|
3715
|
+
const cleanCyScope = (str) => this.replaceCyScopeInString(str).replace(/::cyDuplicateKey\d+::/g, '');
|
|
2698
3716
|
// Helper to convert ScopeVariable to SerializableScopeVariable (with cyScope cleaned)
|
|
2699
3717
|
const toSerializableVariable = (vars) => vars.map((v) => ({
|
|
2700
3718
|
scopeNodeName: cleanCyScope(v.scopeNodeName),
|
|
@@ -2914,7 +3932,8 @@ export class ScopeDataStructure {
|
|
|
2914
3932
|
}
|
|
2915
3933
|
}
|
|
2916
3934
|
if (Object.keys(varSchema).length > 0) {
|
|
2917
|
-
|
|
3935
|
+
// Clean the variable name when using as key in output
|
|
3936
|
+
perVariableSchemas[cleanCyScope(varName)] = varSchema;
|
|
2918
3937
|
}
|
|
2919
3938
|
}
|
|
2920
3939
|
// Only include if we have any entries
|
|
@@ -2922,11 +3941,21 @@ export class ScopeDataStructure {
|
|
|
2922
3941
|
perVariableSchemas = undefined;
|
|
2923
3942
|
}
|
|
2924
3943
|
}
|
|
3944
|
+
// Enrich the schema with inferred types by applying fillInSchemaGapsAndUnknowns.
|
|
3945
|
+
// This ensures the serialized schema has the same type inference as getReturnValue().
|
|
3946
|
+
// Without this, evidence like "entities[].analyses: array" becomes "unknown".
|
|
3947
|
+
const enrichedSchema = { ...efc.schema };
|
|
3948
|
+
const tempScopeNode = {
|
|
3949
|
+
name: efc.name,
|
|
3950
|
+
schema: enrichedSchema,
|
|
3951
|
+
equivalencies: efc.equivalencies ?? {},
|
|
3952
|
+
};
|
|
3953
|
+
fillInSchemaGapsAndUnknowns(tempScopeNode, true);
|
|
2925
3954
|
return {
|
|
2926
3955
|
name: efc.name,
|
|
2927
3956
|
callSignature: efc.callSignature,
|
|
2928
3957
|
callScope: efc.callScope,
|
|
2929
|
-
schema:
|
|
3958
|
+
schema: enrichedSchema,
|
|
2930
3959
|
equivalencies: efc.equivalencies
|
|
2931
3960
|
? Object.entries(efc.equivalencies).reduce((acc, [key, vars]) => {
|
|
2932
3961
|
// Clean cyScope from the key as well as variable properties
|
|
@@ -2935,8 +3964,13 @@ export class ScopeDataStructure {
|
|
|
2935
3964
|
}, {})
|
|
2936
3965
|
: undefined,
|
|
2937
3966
|
allCallSignatures: efc.allCallSignatures,
|
|
2938
|
-
receivingVariableNames: efc.receivingVariableNames,
|
|
2939
|
-
callSignatureToVariable: efc.callSignatureToVariable
|
|
3967
|
+
receivingVariableNames: efc.receivingVariableNames?.map(cleanCyScope),
|
|
3968
|
+
callSignatureToVariable: efc.callSignatureToVariable
|
|
3969
|
+
? Object.fromEntries(Object.entries(efc.callSignatureToVariable).map(([k, v]) => [
|
|
3970
|
+
k,
|
|
3971
|
+
cleanCyScope(v),
|
|
3972
|
+
]))
|
|
3973
|
+
: undefined,
|
|
2940
3974
|
perVariableSchemas,
|
|
2941
3975
|
};
|
|
2942
3976
|
});
|
|
@@ -3038,6 +4072,12 @@ export class ScopeDataStructure {
|
|
|
3038
4072
|
};
|
|
3039
4073
|
// Apply deduplication
|
|
3040
4074
|
const deduplicatedExternalFunctionCalls = deduplicateParameterizedEntries(externalFunctionCalls);
|
|
4075
|
+
// IMPORTANT: Get equivalent signature variables BEFORE calling getFunctionResult
|
|
4076
|
+
// because getFunctionResult calls validateSchema which may remove equivalencies
|
|
4077
|
+
// during the finalize step (e.g., cleanNonObjectFunctions removes method call
|
|
4078
|
+
// equivalencies like `segments -> splat.split('/').functionCallReturnValue`).
|
|
4079
|
+
// Fix 33: Move this call before any schema validation to preserve method call chains.
|
|
4080
|
+
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
3041
4081
|
// Get root function result
|
|
3042
4082
|
const rootFunction = getFunctionResult();
|
|
3043
4083
|
// Get results for each external function (use cleaned calls for consistency)
|
|
@@ -3045,14 +4085,29 @@ export class ScopeDataStructure {
|
|
|
3045
4085
|
for (const efc of cleanedExternalCalls) {
|
|
3046
4086
|
functionResults[efc.name] = getFunctionResult(efc.name);
|
|
3047
4087
|
}
|
|
3048
|
-
// Get equivalent signature variables
|
|
3049
|
-
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
3050
4088
|
const environmentVariables = this.getEnvironmentVariables();
|
|
3051
4089
|
// Get enriched conditional usages with source tracing
|
|
3052
4090
|
const enrichedConditionalUsages = this.getEnrichedConditionalUsages();
|
|
3053
4091
|
const conditionalUsages = Object.keys(enrichedConditionalUsages).length > 0
|
|
3054
4092
|
? enrichedConditionalUsages
|
|
3055
4093
|
: undefined;
|
|
4094
|
+
// Get conditional effects (setter calls inside conditionals)
|
|
4095
|
+
const conditionalEffects = this.rawConditionalEffects.length > 0
|
|
4096
|
+
? this.rawConditionalEffects
|
|
4097
|
+
: undefined;
|
|
4098
|
+
// Get compound conditionals (grouped conditions that must all be true)
|
|
4099
|
+
const compoundConditionals = this.rawCompoundConditionals.length > 0
|
|
4100
|
+
? this.rawCompoundConditionals
|
|
4101
|
+
: undefined;
|
|
4102
|
+
// Get child boundary gating conditions
|
|
4103
|
+
const enrichedGatingConditions = this.getEnrichedChildBoundaryGatingConditions();
|
|
4104
|
+
const childBoundaryGatingConditions = Object.keys(enrichedGatingConditions).length > 0
|
|
4105
|
+
? enrichedGatingConditions
|
|
4106
|
+
: undefined;
|
|
4107
|
+
// Get JSX rendering usages (arrays via .map(), strings via interpolation)
|
|
4108
|
+
const jsxRenderingUsages = this.rawJsxRenderingUsages.length > 0
|
|
4109
|
+
? this.rawJsxRenderingUsages
|
|
4110
|
+
: undefined;
|
|
3056
4111
|
return {
|
|
3057
4112
|
externalFunctionCalls: deduplicatedExternalFunctionCalls,
|
|
3058
4113
|
rootFunction,
|
|
@@ -3060,6 +4115,10 @@ export class ScopeDataStructure {
|
|
|
3060
4115
|
equivalentSignatureVariables,
|
|
3061
4116
|
environmentVariables,
|
|
3062
4117
|
conditionalUsages,
|
|
4118
|
+
conditionalEffects,
|
|
4119
|
+
compoundConditionals,
|
|
4120
|
+
childBoundaryGatingConditions,
|
|
4121
|
+
jsxRenderingUsages,
|
|
3063
4122
|
};
|
|
3064
4123
|
}
|
|
3065
4124
|
// ═══════════════════════════════════════════════════════════════════════════
|