@codeyam/codeyam-cli 0.1.0-staging.d0ad4ae → 0.1.0-staging.d3e886e
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/log.txt +3 -3
- package/analyzer-template/package.json +10 -10
- package/analyzer-template/packages/ai/index.ts +21 -5
- package/analyzer-template/packages/ai/package.json +2 -2
- package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +226 -24
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +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 +1215 -29
- package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +265 -6
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +216 -36
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1750 -318
- 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 +205 -0
- 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 +140 -14
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +393 -90
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +183 -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 +4 -3
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +86 -149
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +59 -3
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1382 -65
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +200 -196
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +710 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2484 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +5 -5
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +328 -7
- package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +111 -87
- package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +28 -170
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +110 -6
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -89
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +11 -11
- package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +824 -0
- package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +122 -3
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
- package/analyzer-template/packages/analyze/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +65 -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/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 +447 -255
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +31 -4
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -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 +14 -14
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +4 -4
- 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 +193 -76
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +203 -41
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -188
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +272 -23
- 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 +825 -71
- 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/package.json +3 -3
- package/analyzer-template/packages/database/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +14 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +17 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
- package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
- package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
- package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +7 -3
- package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
- package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
- package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -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 +11 -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/labsRequestsTable.d.ts +23 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +1 -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/projectToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/analyzer-template/packages/github/dist/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/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +3 -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/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/ProjectMetadata.ts +7 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +3 -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/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +3 -54
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +1 -21
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +153 -5
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +93 -2
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +108 -2
- package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
- package/analyzer-template/playwright/capture.ts +20 -8
- package/analyzer-template/playwright/captureStatic.ts +1 -1
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- 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 +425 -43
- 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/SequentialCaptureTaskRunner.ts +18 -7
- package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
- package/analyzer-template/project/orchestrateCapture.ts +71 -6
- package/analyzer-template/project/reconcileMockDataKeys.ts +214 -0
- package/analyzer-template/project/runAnalysis.ts +6 -0
- package/analyzer-template/project/start.ts +46 -12
- package/analyzer-template/project/writeMockDataTsx.ts +295 -10
- package/analyzer-template/project/writeScenarioComponents.ts +218 -26
- package/analyzer-template/project/writeSimpleRoot.ts +21 -11
- package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
- package/analyzer-template/tsconfig.json +2 -1
- package/background/src/lib/local/createLocalAnalyzer.js +1 -1
- package/background/src/lib/local/createLocalAnalyzer.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 +350 -13
- 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/SequentialCaptureTaskRunner.js +7 -5
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +58 -6
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +177 -0
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +5 -0
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +42 -12
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +251 -6
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +164 -29
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
- 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 +4 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +18 -2
- package/codeyam-cli/src/codeyam-cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +4 -2
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +10 -11
- package/codeyam-cli/src/commands/baseline.js.map +1 -1
- package/codeyam-cli/src/commands/debug.js +37 -23
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +30 -34
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/detect-universal-mocks.js +2 -0
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +49 -257
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +264 -0
- package/codeyam-cli/src/commands/memory.js.map +1 -0
- package/codeyam-cli/src/commands/recapture.js +31 -18
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/report.js +46 -1
- package/codeyam-cli/src/commands/report.js.map +1 -1
- package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
- package/codeyam-cli/src/commands/setup-simulations.js +284 -0
- package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
- package/codeyam-cli/src/commands/start.js +8 -12
- package/codeyam-cli/src/commands/start.js.map +1 -1
- package/codeyam-cli/src/commands/test-startup.js +2 -0
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/verify.js +14 -2
- package/codeyam-cli/src/commands/verify.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +179 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +128 -82
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +29 -15
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +7 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +102 -21
- package/codeyam-cli/src/utils/backgroundServer.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/install-skills.js +76 -37
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
- package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
- package/codeyam-cli/src/utils/progress.js +7 -0
- package/codeyam-cli/src/utils/progress.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +5 -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/requireSimulations.js +10 -0
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +378 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +115 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/index.js +6 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -0
- package/codeyam-cli/src/utils/rules/parser.js +83 -0
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
- package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
- package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +137 -0
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
- package/codeyam-cli/src/utils/serverState.js +37 -10
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +21 -42
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/versionInfo.js +25 -19
- package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
- package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
- package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/database.js +22 -6
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +50 -0
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +51 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-jNYXRRNI.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-bwuHPyTa.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-CvzqMxcu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BH0XDim7.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-EhOseatT.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-yjIHlOGa.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-Cq5o8jL4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-BvMu2i-g.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-kgBTLoJD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-BzPgx-xO.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-CwZrv-Ok.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BX2Ny2Qj.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-CDpEprKa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-BRx8ZGZo.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-4S4yPfFw.js +27 -0
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +17 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/book-open-D4IPYH_y.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-CG65viiV.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-DB3aFuEO.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-igfMr5DY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-Coc4o_8c.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-D1zB-pYc.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-JTAjQ54M.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-D0-YwkBh.js → entity._sha._-B0h9AqE6.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CtYowLOt.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-C1H_a_Y3.js → entity._sha_.edit._scenarioId-PePWg17F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-I-Wo99C_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-9sMMAiWJ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-Co65J0s3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{git-CZu4fif0.js → git-BdHOxVfg.js} +8 -8
- package/codeyam-cli/src/webserver/build/client/assets/globals-CCgBKWy4.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-CUM5iXwc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-_417gcQW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-BK0C1H1T.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-TzRHMVog.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-390cb8fa.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-CzZySbBE.js +78 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-hjzB7t2z.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-DnbDhvTU.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-DcAwD_Ln.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-CclxrcPK.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DVNJVQgD.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/terminal-DbEAHMbA.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-CAD5b1o_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BqgrAzs3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-aSv48UbS.js → useLastLogLine-DAFqfEDH.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DZlYx2c4.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-ihdMtlf6.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CxaRxKVt.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-D4DT0nM_.js +259 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/server.js +35 -25
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam-debug.md} +48 -4
- package/codeyam-cli/templates/codeyam-diagnose.md +481 -0
- package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
- package/codeyam-cli/templates/codeyam-memory.md +396 -0
- package/codeyam-cli/templates/codeyam-new-rule.md +13 -0
- package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam-setup.md} +13 -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 +627 -0
- package/codeyam-cli/templates/rules-instructions.md +132 -0
- package/package.json +15 -12
- package/packages/ai/index.js +8 -6
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +179 -13
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +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 +931 -29
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
- package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +178 -31
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1367 -187
- 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 +179 -0
- 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 +122 -12
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +333 -81
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructureChunking.js +130 -0
- package/packages/ai/src/lib/dataStructureChunking.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 +4 -3
- 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 +1098 -60
- 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 +495 -0
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1807 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -2
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +270 -7
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +88 -46
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -119
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +83 -6
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -70
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +9 -9
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
- package/packages/ai/src/lib/resolvePathToControllable.js +677 -0
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
- package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
- package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/index.js +1 -0
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +60 -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/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 +189 -41
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +21 -4
- 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/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 +10 -10
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +4 -4
- 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 +164 -68
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +178 -31
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -129
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +187 -21
- 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 +670 -53
- 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/database/src/lib/analysisBranchToDb.js +1 -1
- package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/packages/database/src/lib/analysisToDb.js +1 -1
- package/packages/database/src/lib/analysisToDb.js.map +1 -1
- package/packages/database/src/lib/branchToDb.js +1 -1
- package/packages/database/src/lib/branchToDb.js.map +1 -1
- package/packages/database/src/lib/commitBranchToDb.js +1 -1
- package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
- package/packages/database/src/lib/commitToDb.js +1 -1
- package/packages/database/src/lib/commitToDb.js.map +1 -1
- package/packages/database/src/lib/fileToDb.js +1 -1
- package/packages/database/src/lib/fileToDb.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +11 -1
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/packages/database/src/lib/loadAnalyses.js +45 -2
- package/packages/database/src/lib/loadAnalyses.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +8 -0
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadBranch.js +11 -1
- package/packages/database/src/lib/loadBranch.js.map +1 -1
- package/packages/database/src/lib/loadCommit.js +7 -0
- package/packages/database/src/lib/loadCommit.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +22 -1
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +23 -4
- package/packages/database/src/lib/loadEntities.js.map +1 -1
- package/packages/database/src/lib/loadEntityBranches.js +9 -0
- package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/database/src/lib/projectToDb.js +1 -1
- package/packages/database/src/lib/projectToDb.js.map +1 -1
- package/packages/database/src/lib/saveFiles.js +1 -1
- package/packages/database/src/lib/saveFiles.js.map +1 -1
- package/packages/database/src/lib/scenarioToDb.js +1 -1
- package/packages/database/src/lib/scenarioToDb.js.map +1 -1
- package/packages/database/src/lib/updateCommitMetadata.js +5 -4
- package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/packages/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/fs/rsyncCopy.js +93 -2
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/packages/utils/src/lib/safeFileName.js +29 -3
- package/packages/utils/src/lib/safeFileName.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +8 -76
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -109
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -584
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -341
- 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/codeyam-cli/src/webserver/build/client/assets/EntityItem-Cmysw5OP.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CAneekK2.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-Cu16OUmx.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DcAUIpD_.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BMKg0SAF.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/_index-DSmTpjmK.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BF_aK4y6.js +0 -32
- 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-RJCf3Tvw.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-EylcgScH.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DMe7kvgo.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-BW7Cyeyi.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-wHVy_II5.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-2d191949.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-FHgpM6gc.js +0 -56
- package/codeyam-cli/src/webserver/build/client/assets/settings-6D8k8Jp5.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CDJZnWhN.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-Dv18q8LD.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-0ToGk4K3.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-1BX144Eg.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-pU0o5t1o.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-YzfkRwdn.js +0 -178
- package/codeyam-cli/templates/debug-codeyam.md +0 -625
- package/packages/ai/src/lib/findMatchingAttribute.js +0 -81
- package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -425
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -267
- 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/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.labs-unlock-l0sNRNKZ.js} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { splitOutsideParenthesesAndArrays, joinParenthesesAndArrays, } from "../../../../../../packages/ai/index.js";
|
|
2
2
|
import { cleanKnownObjectFunctionsFromMapping } from "../../../../../../packages/ai/index.js";
|
|
3
|
+
import { transformationTracer } from "./TransformationTracer.js";
|
|
3
4
|
function cleanFunctionName(functionName) {
|
|
4
5
|
return functionName?.split('<')[0];
|
|
5
6
|
}
|
|
@@ -24,6 +25,50 @@ function getTypeParameter(functionName) {
|
|
|
24
25
|
}
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
28
|
+
// Primitive types that should not have child paths
|
|
29
|
+
const PRIMITIVE_TYPES = new Set([
|
|
30
|
+
'number',
|
|
31
|
+
'string',
|
|
32
|
+
'boolean',
|
|
33
|
+
'null',
|
|
34
|
+
'undefined',
|
|
35
|
+
]);
|
|
36
|
+
// Check if a type string represents a primitive type
|
|
37
|
+
// Handles union types like "string | undefined" or "number | null"
|
|
38
|
+
function isPrimitiveType(typeStr) {
|
|
39
|
+
if (PRIMITIVE_TYPES.has(typeStr)) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
// Check union types - if ALL parts of the union are primitives, it's primitive
|
|
43
|
+
// e.g., "string | undefined" -> ["string", "undefined"] -> both are primitive -> true
|
|
44
|
+
// e.g., "object | null" -> ["object", "null"] -> object is not primitive -> false
|
|
45
|
+
if (typeStr.includes('|')) {
|
|
46
|
+
const parts = typeStr.split('|').map((p) => p.trim());
|
|
47
|
+
return parts.every((part) => PRIMITIVE_TYPES.has(part));
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
// Extract signature index from a path like "signature[0]" or "signature[0].foo"
|
|
52
|
+
// Returns the index number or undefined if not a signature path
|
|
53
|
+
function extractSignatureIndex(path) {
|
|
54
|
+
const match = path.match(/^signature\[(\d+)\]/);
|
|
55
|
+
return match ? parseInt(match[1], 10) : undefined;
|
|
56
|
+
}
|
|
57
|
+
// Check if a new schema path would go through a primitive type
|
|
58
|
+
// e.g., if schema has 'entities[].scenarioCount': 'number', then
|
|
59
|
+
// 'entities[].scenarioCount.sha' would go through a primitive and should be rejected
|
|
60
|
+
function wouldGoThroughPrimitive(newPath, schema) {
|
|
61
|
+
const pathParts = splitOutsideParenthesesAndArrays(newPath);
|
|
62
|
+
// Check each prefix of the path (excluding the full path itself)
|
|
63
|
+
for (let i = 1; i < pathParts.length; i++) {
|
|
64
|
+
const prefixPath = joinParenthesesAndArrays(pathParts.slice(0, i));
|
|
65
|
+
const prefixType = schema[prefixPath];
|
|
66
|
+
if (prefixType && isPrimitiveType(prefixType)) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
27
72
|
// Check if schemaPathPart matches or is a function call variant of pathPart
|
|
28
73
|
// e.g., 'isEntityBeingAnalyzed(entity.sha)' matches 'isEntityBeingAnalyzed'
|
|
29
74
|
function pathPartMatches(pathPart, schemaPathPart) {
|
|
@@ -39,11 +84,13 @@ function pathPartMatches(pathPart, schemaPathPart) {
|
|
|
39
84
|
function bestValueFromOptions(options) {
|
|
40
85
|
options = options.filter(Boolean);
|
|
41
86
|
const known = options.find((o) => !o.includes('unknown'));
|
|
42
|
-
if (known)
|
|
87
|
+
if (known) {
|
|
43
88
|
return known;
|
|
89
|
+
}
|
|
44
90
|
const notUnknown = options.find((o) => o !== 'unknown');
|
|
45
|
-
if (notUnknown)
|
|
91
|
+
if (notUnknown) {
|
|
46
92
|
return notUnknown;
|
|
93
|
+
}
|
|
47
94
|
return options[0] ?? 'unknown';
|
|
48
95
|
}
|
|
49
96
|
export default function mergeInDependentDataStructure({ importedExports, dependentAnalyses, rootScopeName, dataStructure, dependencySchemas, }) {
|
|
@@ -88,8 +135,32 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
88
135
|
}
|
|
89
136
|
}
|
|
90
137
|
let equivalentSchemaPaths = [];
|
|
138
|
+
// O(1) index for findOrCreateEquivalentSchemaPathsEntry.
|
|
139
|
+
// Maps "(rootPath)::(normalizedFuncName)" → the entry containing that root.
|
|
140
|
+
// This replaces the O(E) linear search that was causing O(E²) gather performance.
|
|
141
|
+
const espIndex = new Map();
|
|
142
|
+
const espIndexKey = (path, functionName) => {
|
|
143
|
+
const normalized = cleanFunctionName(functionName);
|
|
144
|
+
const funcKey = normalized === rootScopeName ? '__self__' : normalized || '__self__';
|
|
145
|
+
return `${path}::${funcKey}`;
|
|
146
|
+
};
|
|
147
|
+
const updateEspIndex = (entry) => {
|
|
148
|
+
for (const root of entry.equivalentRoots) {
|
|
149
|
+
const funcName = root.function?.name ?? rootScopeName;
|
|
150
|
+
espIndex.set(espIndexKey(root.schemaRootPath, funcName), entry);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
// Pre-build a lookup map from cleaned function name to dependency for O(1) lookups.
|
|
154
|
+
// This avoids O(n) linear search in findRelevantDependency which was causing O(n²) performance.
|
|
155
|
+
const dependencyByCleanedName = new Map();
|
|
156
|
+
for (const dep of importedExports) {
|
|
157
|
+
const cleanedName = cleanFunctionName(dep.name);
|
|
158
|
+
if (!dependencyByCleanedName.has(cleanedName)) {
|
|
159
|
+
dependencyByCleanedName.set(cleanedName, dep);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
91
162
|
const findRelevantDependency = (functionName) => {
|
|
92
|
-
return
|
|
163
|
+
return dependencyByCleanedName.get(cleanFunctionName(functionName));
|
|
93
164
|
};
|
|
94
165
|
const findRelevantDependentDataStructure = (functionName) => {
|
|
95
166
|
const dependency = findRelevantDependency(functionName);
|
|
@@ -117,8 +188,8 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
117
188
|
});
|
|
118
189
|
return mergedDataStructure.dependencySchemas[filePath][name];
|
|
119
190
|
};
|
|
120
|
-
const cleanSchema = (schema) => {
|
|
121
|
-
cleanKnownObjectFunctionsFromMapping
|
|
191
|
+
const cleanSchema = (schema, context) => {
|
|
192
|
+
transformationTracer.traceSchemaTransform(rootScopeName, 'cleanKnownObjectFunctionsFromMapping', schema, cleanKnownObjectFunctionsFromMapping, context);
|
|
122
193
|
};
|
|
123
194
|
const translatePath = (path, dependencyName) => {
|
|
124
195
|
if (path.startsWith(dependencyName)) {
|
|
@@ -158,6 +229,41 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
158
229
|
const gatherAllEquivalentSchemaPaths = (functionName, sourceAndUsageEquivalencies, dataStructure) => {
|
|
159
230
|
if (!sourceAndUsageEquivalencies)
|
|
160
231
|
return;
|
|
232
|
+
const normalizedSchemaCache = new Map();
|
|
233
|
+
const getSchemaIndex = (schema) => {
|
|
234
|
+
if (!schema)
|
|
235
|
+
return { byFirstPart: new Map() };
|
|
236
|
+
const cached = normalizedSchemaCache.get(schema);
|
|
237
|
+
if (cached)
|
|
238
|
+
return cached;
|
|
239
|
+
const byFirstPart = new Map();
|
|
240
|
+
for (const path in schema) {
|
|
241
|
+
let parts = splitOutsideParenthesesAndArrays(path);
|
|
242
|
+
if (parts[0].startsWith(functionName)) {
|
|
243
|
+
const baseName = cleanFunctionName(parts[0]);
|
|
244
|
+
if (!functionsWithMultipleTypeParams.has(baseName)) {
|
|
245
|
+
parts =
|
|
246
|
+
parts[1] === 'functionCallReturnValue'
|
|
247
|
+
? ['returnValue', ...parts.slice(2)]
|
|
248
|
+
: parts.slice(1);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const entry = { path, parts };
|
|
252
|
+
// Index by the base of the first part (before any function call args)
|
|
253
|
+
const firstPart = parts[0] ?? '';
|
|
254
|
+
const parenIdx = firstPart.indexOf('(');
|
|
255
|
+
const firstPartBase = parenIdx >= 0 ? firstPart.slice(0, parenIdx) : firstPart;
|
|
256
|
+
let bucket = byFirstPart.get(firstPartBase);
|
|
257
|
+
if (!bucket) {
|
|
258
|
+
bucket = [];
|
|
259
|
+
byFirstPart.set(firstPartBase, bucket);
|
|
260
|
+
}
|
|
261
|
+
bucket.push(entry);
|
|
262
|
+
}
|
|
263
|
+
const result = { byFirstPart };
|
|
264
|
+
normalizedSchemaCache.set(schema, result);
|
|
265
|
+
return result;
|
|
266
|
+
};
|
|
161
267
|
const findOrCreateEquivalentSchemaPathsEntry = (allPaths) => {
|
|
162
268
|
const equivalentRoots = allPaths
|
|
163
269
|
.filter((p) => p.functionName === rootScopeName ||
|
|
@@ -169,19 +275,93 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
169
275
|
: findRelevantDependency(p.functionName),
|
|
170
276
|
}));
|
|
171
277
|
let equivalentSchemaPathsEntry;
|
|
278
|
+
// Collect the signature indices from the new roots we want to add
|
|
279
|
+
const newRootSignatureIndices = new Set();
|
|
280
|
+
for (const root of equivalentRoots) {
|
|
281
|
+
const idx = extractSignatureIndex(root.schemaRootPath);
|
|
282
|
+
if (idx !== undefined) {
|
|
283
|
+
newRootSignatureIndices.add(idx);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// Use espIndex Map for O(1) lookup instead of O(E) linear search.
|
|
287
|
+
// Falls back to linear search only when Map hit has a signature index conflict.
|
|
172
288
|
for (const pathInfo of allPaths) {
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
289
|
+
if (equivalentSchemaPathsEntry)
|
|
290
|
+
break;
|
|
291
|
+
const candidate = espIndex.get(espIndexKey(pathInfo.path, pathInfo.functionName));
|
|
292
|
+
if (!candidate)
|
|
293
|
+
continue;
|
|
294
|
+
// Verify no signature index conflict with the candidate entry
|
|
295
|
+
if (newRootSignatureIndices.size > 0) {
|
|
296
|
+
const existingIndicesByFunction = new Map();
|
|
297
|
+
for (const er of candidate.equivalentRoots) {
|
|
298
|
+
const funcKey = er.function
|
|
299
|
+
? `${er.function.name}::${er.function.filePath}`
|
|
300
|
+
: '__self__';
|
|
301
|
+
const idx = extractSignatureIndex(er.schemaRootPath);
|
|
302
|
+
if (idx !== undefined) {
|
|
303
|
+
if (!existingIndicesByFunction.has(funcKey)) {
|
|
304
|
+
existingIndicesByFunction.set(funcKey, new Set());
|
|
305
|
+
}
|
|
306
|
+
existingIndicesByFunction.get(funcKey).add(idx);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
let hasConflict = false;
|
|
310
|
+
for (const newRoot of equivalentRoots) {
|
|
311
|
+
const funcKey = newRoot.function
|
|
312
|
+
? `${newRoot.function.name}::${newRoot.function.filePath}`
|
|
313
|
+
: '__self__';
|
|
314
|
+
const newIdx = extractSignatureIndex(newRoot.schemaRootPath);
|
|
315
|
+
if (newIdx !== undefined) {
|
|
316
|
+
const existingIndices = existingIndicesByFunction.get(funcKey);
|
|
317
|
+
if (existingIndices && existingIndices.size > 0) {
|
|
318
|
+
if (!existingIndices.has(newIdx)) {
|
|
319
|
+
hasConflict = true;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (hasConflict)
|
|
326
|
+
continue;
|
|
180
327
|
}
|
|
328
|
+
equivalentSchemaPathsEntry = candidate;
|
|
181
329
|
}
|
|
182
330
|
if (!equivalentSchemaPathsEntry) {
|
|
331
|
+
// Before creating a new entry, filter out roots that have conflicting
|
|
332
|
+
// signature indices from the same function. An entry should never contain
|
|
333
|
+
// roots with different signature indices from the same function.
|
|
334
|
+
// This prevents the bug where signature[1], signature[2], signature[4]
|
|
335
|
+
// all get merged together due to incorrect sourceEquivalencies.
|
|
336
|
+
let filteredRoots = equivalentRoots;
|
|
337
|
+
if (newRootSignatureIndices.size > 1) {
|
|
338
|
+
// There are multiple signature indices - we need to filter to keep only
|
|
339
|
+
// one consistent set. We'll keep the roots that match the PRIMARY index
|
|
340
|
+
// (the first signature index we encounter from self, or the lowest index).
|
|
341
|
+
// First, determine the primary index - prefer the self root's index
|
|
342
|
+
let primaryIndex;
|
|
343
|
+
for (const root of equivalentRoots) {
|
|
344
|
+
if (!root.function) {
|
|
345
|
+
// This is a self root
|
|
346
|
+
const idx = extractSignatureIndex(root.schemaRootPath);
|
|
347
|
+
if (idx !== undefined) {
|
|
348
|
+
primaryIndex = idx;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
// If no self root has a signature index, use the lowest index
|
|
354
|
+
if (primaryIndex === undefined) {
|
|
355
|
+
primaryIndex = Math.min(...newRootSignatureIndices);
|
|
356
|
+
}
|
|
357
|
+
// Filter roots: keep if no signature index OR signature index matches primary
|
|
358
|
+
filteredRoots = equivalentRoots.filter((root) => {
|
|
359
|
+
const idx = extractSignatureIndex(root.schemaRootPath);
|
|
360
|
+
return idx === undefined || idx === primaryIndex;
|
|
361
|
+
});
|
|
362
|
+
}
|
|
183
363
|
equivalentSchemaPathsEntry = {
|
|
184
|
-
equivalentRoots,
|
|
364
|
+
equivalentRoots: filteredRoots,
|
|
185
365
|
equivalentPostfixes: {},
|
|
186
366
|
};
|
|
187
367
|
equivalentSchemaPaths.push(equivalentSchemaPathsEntry);
|
|
@@ -189,25 +369,167 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
189
369
|
else {
|
|
190
370
|
equivalentSchemaPathsEntry.equivalentRoots.push(...equivalentRoots);
|
|
191
371
|
}
|
|
372
|
+
// Deduplicate roots using a Set for O(n) instead of O(n²)
|
|
373
|
+
const seenRoots = new Set();
|
|
192
374
|
equivalentSchemaPathsEntry.equivalentRoots =
|
|
193
|
-
equivalentSchemaPathsEntry.equivalentRoots.filter((er
|
|
194
|
-
|
|
195
|
-
|
|
375
|
+
equivalentSchemaPathsEntry.equivalentRoots.filter((er) => {
|
|
376
|
+
const key = er.schemaRootPath + '::' + (er.function?.name ?? '');
|
|
377
|
+
if (seenRoots.has(key))
|
|
378
|
+
return false;
|
|
379
|
+
seenRoots.add(key);
|
|
380
|
+
return true;
|
|
381
|
+
});
|
|
382
|
+
// Keep the espIndex in sync after adding/deduplicating roots
|
|
383
|
+
updateEspIndex(equivalentSchemaPathsEntry);
|
|
196
384
|
return equivalentSchemaPathsEntry;
|
|
197
385
|
};
|
|
198
|
-
|
|
386
|
+
// Helper to extract function name from a path that starts with a function call.
|
|
387
|
+
// e.g., 'ScenarioViewer().signature[0].scenario' -> 'ScenarioViewer'
|
|
388
|
+
// Returns undefined if the path doesn't start with a function call or the function isn't a dependency.
|
|
389
|
+
const extractFunctionNameFromPath = (path) => {
|
|
390
|
+
const parts = splitOutsideParenthesesAndArrays(path);
|
|
391
|
+
if (parts.length > 0 && parts[0].endsWith(')')) {
|
|
392
|
+
// Extract the function name without the () suffix and type params
|
|
393
|
+
const funcCallPart = parts[0];
|
|
394
|
+
const funcName = cleanFunctionName(funcCallPart.replace(/\(\)$/, ''));
|
|
395
|
+
// Check if this function is a dependency
|
|
396
|
+
if (findRelevantDependency(funcName)) {
|
|
397
|
+
return funcName;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return undefined;
|
|
401
|
+
};
|
|
402
|
+
const allEquivalencies = [
|
|
199
403
|
sourceAndUsageEquivalencies.usageEquivalencies,
|
|
200
404
|
sourceAndUsageEquivalencies.sourceEquivalencies,
|
|
201
|
-
].filter(Boolean)
|
|
202
|
-
|
|
405
|
+
].filter(Boolean);
|
|
406
|
+
for (const equivalencies of allEquivalencies) {
|
|
407
|
+
const schemaPathEntries = Object.entries(equivalencies);
|
|
408
|
+
for (const [schemaPath, usages] of schemaPathEntries) {
|
|
409
|
+
// First, check if the raw schemaPath starts with a function call to a dependency.
|
|
410
|
+
// If so, use that dependency name for translation (so translatePath can strip the prefix).
|
|
411
|
+
const extractedFuncName = extractFunctionNameFromPath(schemaPath);
|
|
412
|
+
const effectiveFunctionName = extractedFuncName || functionName;
|
|
413
|
+
const translatedPath = translatePath(schemaPath, effectiveFunctionName);
|
|
203
414
|
const allPaths = [
|
|
204
|
-
{ path:
|
|
415
|
+
{ path: translatedPath, functionName: effectiveFunctionName },
|
|
205
416
|
...usages.map((u) => ({
|
|
206
417
|
path: translatePath(u.schemaPath, u.scopeNodeName),
|
|
207
418
|
functionName: u.scopeNodeName,
|
|
208
419
|
})),
|
|
209
420
|
].filter((pathInfo) => !pathInfo.path.includes('.map('));
|
|
421
|
+
// Fix 38: Derive base paths from property access paths.
|
|
422
|
+
// When we have equivalent paths like:
|
|
423
|
+
// Parent: signature[0].scenarios[].name
|
|
424
|
+
// Child: signature[0].selectedScenario.name
|
|
425
|
+
// We want to derive the base paths by finding the common suffix:
|
|
426
|
+
// Common suffix: .name
|
|
427
|
+
// Parent base: signature[0].scenarios[]
|
|
428
|
+
// Child base: signature[0].selectedScenario
|
|
429
|
+
// This allows the merge to find nested child schema fields under the base prop.
|
|
430
|
+
// Find child signature paths (paths from child components)
|
|
431
|
+
const childPaths = allPaths.filter((p) => p.functionName &&
|
|
432
|
+
p.functionName !== rootScopeName &&
|
|
433
|
+
p.functionName !== effectiveFunctionName);
|
|
434
|
+
// Find parent paths (paths from this component)
|
|
435
|
+
const parentPaths = allPaths.filter((p) => !p.functionName ||
|
|
436
|
+
p.functionName === rootScopeName ||
|
|
437
|
+
p.functionName === effectiveFunctionName);
|
|
438
|
+
const derivedBasePaths = [];
|
|
439
|
+
const allPathSet = new Set(allPaths.map((p) => p.path));
|
|
440
|
+
const derivedBasePathSet = new Set();
|
|
441
|
+
// For each child path, find its equivalent parent path and derive bases
|
|
442
|
+
for (const childPathInfo of childPaths) {
|
|
443
|
+
const childParts = splitOutsideParenthesesAndArrays(childPathInfo.path);
|
|
444
|
+
// Look for a parent path that shares a common suffix with this child path
|
|
445
|
+
for (const parentPathInfo of parentPaths) {
|
|
446
|
+
const parentParts = splitOutsideParenthesesAndArrays(parentPathInfo.path);
|
|
447
|
+
// Find the common suffix (from the end)
|
|
448
|
+
let commonSuffixLength = 0;
|
|
449
|
+
const minLen = Math.min(childParts.length, parentParts.length);
|
|
450
|
+
for (let i = 1; i <= minLen; i++) {
|
|
451
|
+
if (childParts[childParts.length - i] ===
|
|
452
|
+
parentParts[parentParts.length - i]) {
|
|
453
|
+
commonSuffixLength = i;
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
// If there's a common suffix and both paths have more parts than the suffix
|
|
460
|
+
if (commonSuffixLength > 0 &&
|
|
461
|
+
childParts.length > commonSuffixLength &&
|
|
462
|
+
parentParts.length > commonSuffixLength) {
|
|
463
|
+
const childBaseParts = childParts.slice(0, childParts.length - commonSuffixLength);
|
|
464
|
+
const parentBaseParts = parentParts.slice(0, parentParts.length - commonSuffixLength);
|
|
465
|
+
// Only derive if BOTH paths look like signature paths.
|
|
466
|
+
// This ensures we're handling JSX child-to-parent prop mappings,
|
|
467
|
+
// not other complex equivalencies like function call returns.
|
|
468
|
+
const isChildSignaturePath = childBaseParts[0]?.startsWith('signature[') ||
|
|
469
|
+
(childBaseParts[0]?.endsWith(')') &&
|
|
470
|
+
childBaseParts[1]?.startsWith('signature['));
|
|
471
|
+
const isParentSignaturePath = parentBaseParts[0]?.startsWith('signature[');
|
|
472
|
+
if (isChildSignaturePath && isParentSignaturePath) {
|
|
473
|
+
const childBase = joinParenthesesAndArrays(childBaseParts);
|
|
474
|
+
const parentBase = joinParenthesesAndArrays(parentBaseParts);
|
|
475
|
+
// Only derive if:
|
|
476
|
+
// 1. Parent has array iteration (e.g., scenarios[]) and child does NOT
|
|
477
|
+
// 2. Bases are different
|
|
478
|
+
// 3. Child base is NOT just "signature[N]" (too generic - every component has this)
|
|
479
|
+
// We only want specific prop paths like "signature[0].selectedScenario"
|
|
480
|
+
// This targets array-to-object mappings like scenarios[] -> selectedScenario
|
|
481
|
+
const parentHasArrayIterator = parentBase.includes('[]');
|
|
482
|
+
const childHasArrayIterator = childBase.includes('[]');
|
|
483
|
+
// Skip if child base is just the generic signature marker (e.g., "signature[0]")
|
|
484
|
+
const childBaseIsGenericSignature = /^signature\[\d+\]$/.test(childBase);
|
|
485
|
+
if (childBase !== parentBase &&
|
|
486
|
+
parentHasArrayIterator &&
|
|
487
|
+
!childHasArrayIterator &&
|
|
488
|
+
!childBaseIsGenericSignature) {
|
|
489
|
+
// Add child base if not already present (O(1) Set lookup)
|
|
490
|
+
if (!allPathSet.has(childBase) &&
|
|
491
|
+
!derivedBasePathSet.has(childBase)) {
|
|
492
|
+
derivedBasePaths.push({
|
|
493
|
+
path: childBase,
|
|
494
|
+
functionName: childPathInfo.functionName,
|
|
495
|
+
});
|
|
496
|
+
derivedBasePathSet.add(childBase);
|
|
497
|
+
}
|
|
498
|
+
// Add parent base if not already present (O(1) Set lookup)
|
|
499
|
+
if (!allPathSet.has(parentBase) &&
|
|
500
|
+
!derivedBasePathSet.has(parentBase)) {
|
|
501
|
+
derivedBasePaths.push({
|
|
502
|
+
path: parentBase,
|
|
503
|
+
functionName: parentPathInfo.functionName,
|
|
504
|
+
});
|
|
505
|
+
derivedBasePathSet.add(parentBase);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
allPaths.push(...derivedBasePaths);
|
|
210
513
|
const entry = findOrCreateEquivalentSchemaPathsEntry(allPaths);
|
|
514
|
+
// Trace equivalency gathering - helps debug why paths may not be connected
|
|
515
|
+
if (allPaths.length > 1) {
|
|
516
|
+
transformationTracer.operation(rootScopeName, {
|
|
517
|
+
operation: 'gatherEquivalency',
|
|
518
|
+
stage: 'gathering',
|
|
519
|
+
path: translatedPath,
|
|
520
|
+
context: {
|
|
521
|
+
sourceFunction: functionName,
|
|
522
|
+
equivalentPaths: allPaths.map((p) => ({
|
|
523
|
+
path: p.path,
|
|
524
|
+
function: p.functionName,
|
|
525
|
+
})),
|
|
526
|
+
equivalentRoots: entry.equivalentRoots.map((r) => ({
|
|
527
|
+
path: r.schemaRootPath,
|
|
528
|
+
function: r.function?.name,
|
|
529
|
+
})),
|
|
530
|
+
},
|
|
531
|
+
});
|
|
532
|
+
}
|
|
211
533
|
for (const equivalentRoot of entry.equivalentRoots) {
|
|
212
534
|
const dataStructures = equivalentRoot.function &&
|
|
213
535
|
equivalentRoot.function.name !== rootScopeName
|
|
@@ -216,23 +538,36 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
216
538
|
findRelevantDependentAnalysisDataStructure(equivalentRoot.function.name),
|
|
217
539
|
]
|
|
218
540
|
: [dataStructure];
|
|
219
|
-
|
|
541
|
+
// Determine if this is a signature schema path.
|
|
542
|
+
// The path might be 'signature[0]...' directly, or 'FuncName().signature[0]...' if it has a function prefix.
|
|
543
|
+
const schemaRootParts = splitOutsideParenthesesAndArrays(equivalentRoot.schemaRootPath);
|
|
544
|
+
const isSignaturePath = equivalentRoot.schemaRootPath.startsWith('signature[') ||
|
|
545
|
+
(schemaRootParts[0]?.endsWith(')') &&
|
|
546
|
+
schemaRootParts[1]?.startsWith('signature['));
|
|
547
|
+
const schemas = dataStructures.map((dataStructure) => isSignaturePath
|
|
220
548
|
? dataStructure?.signatureSchema
|
|
221
549
|
: dataStructure?.returnValueSchema);
|
|
222
|
-
|
|
550
|
+
let pathParts = splitOutsideParenthesesAndArrays(equivalentRoot.schemaRootPath);
|
|
551
|
+
// Fix: When processing a child component's schema, the schemaRootPath has the function
|
|
552
|
+
// prefix (e.g., 'ScenarioViewer().signature[0].scenario'), but the child's schema paths
|
|
553
|
+
// don't have that prefix (e.g., 'signature[0].scenario.metadata.screenshotPaths').
|
|
554
|
+
// Strip the function prefix from pathParts so they can match.
|
|
555
|
+
if (equivalentRoot.function &&
|
|
556
|
+
pathParts[0].endsWith(')') &&
|
|
557
|
+
pathParts[1]?.startsWith('signature[')) {
|
|
558
|
+
pathParts = pathParts.slice(1);
|
|
559
|
+
}
|
|
223
560
|
for (const schema of schemas) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
}
|
|
561
|
+
// Use pre-computed index to only iterate schema entries whose
|
|
562
|
+
// normalized first part matches pathParts[0], instead of all entries.
|
|
563
|
+
const schemaIndex = getSchemaIndex(schema);
|
|
564
|
+
const lookupPart = pathParts[0] ?? '';
|
|
565
|
+
const lookupParenIdx = lookupPart.indexOf('(');
|
|
566
|
+
const lookupBase = lookupParenIdx >= 0
|
|
567
|
+
? lookupPart.slice(0, lookupParenIdx)
|
|
568
|
+
: lookupPart;
|
|
569
|
+
const candidates = schemaIndex.byFirstPart.get(lookupBase) || [];
|
|
570
|
+
for (const { path: schemaPath, parts: schemaPathParts, } of candidates) {
|
|
236
571
|
if (schemaPathParts.length < pathParts.length)
|
|
237
572
|
continue;
|
|
238
573
|
// Check if all path parts match (allowing function call variants)
|
|
@@ -291,13 +626,27 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
291
626
|
else {
|
|
292
627
|
// Regular exact match - use the standard postfix logic
|
|
293
628
|
const postfix = joinParenthesesAndArrays(schemaPathParts.slice(matchedUpToIndex));
|
|
294
|
-
entry.equivalentPostfixes[postfix]
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
629
|
+
const previousValue = entry.equivalentPostfixes[postfix];
|
|
630
|
+
const newValue = schema[schemaPath];
|
|
631
|
+
entry.equivalentPostfixes[postfix] = previousValue
|
|
632
|
+
? bestValueFromOptions([previousValue, newValue])
|
|
633
|
+
: newValue;
|
|
634
|
+
// Trace postfix gathering - shows where type info comes from
|
|
635
|
+
if (entry.equivalentPostfixes[postfix] !== previousValue) {
|
|
636
|
+
transformationTracer.operation(rootScopeName, {
|
|
637
|
+
operation: 'gatherPostfix',
|
|
638
|
+
stage: 'gathering',
|
|
639
|
+
path: postfix || '(root)',
|
|
640
|
+
before: previousValue,
|
|
641
|
+
after: entry.equivalentPostfixes[postfix],
|
|
642
|
+
context: {
|
|
643
|
+
sourceSchemaPath: schemaPath,
|
|
644
|
+
sourceFunction: equivalentRoot.function?.name || rootScopeName,
|
|
645
|
+
equivalentRootPath: equivalentRoot.schemaRootPath,
|
|
646
|
+
rawValue: newValue,
|
|
647
|
+
},
|
|
648
|
+
});
|
|
649
|
+
}
|
|
301
650
|
}
|
|
302
651
|
}
|
|
303
652
|
}
|
|
@@ -329,10 +678,14 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
329
678
|
const entry = findOrCreateEquivalentSchemaPathsEntry([
|
|
330
679
|
{ path: translatedBasePath, functionName: functionName },
|
|
331
680
|
]);
|
|
332
|
-
|
|
681
|
+
const newRoot = {
|
|
333
682
|
schemaRootPath: translatedBasePath,
|
|
334
683
|
function: findRelevantDependency(functionName),
|
|
335
|
-
}
|
|
684
|
+
};
|
|
685
|
+
entry.equivalentRoots.push(newRoot);
|
|
686
|
+
// Update index for the newly added root
|
|
687
|
+
const newRootFuncName = newRoot.function?.name ?? rootScopeName;
|
|
688
|
+
espIndex.set(espIndexKey(newRoot.schemaRootPath, newRootFuncName), entry);
|
|
336
689
|
const basePathParts = splitOutsideParenthesesAndArrays(basePath);
|
|
337
690
|
for (const schemaPath in dataStructure.returnValueSchema) {
|
|
338
691
|
const schemaPathParts = splitOutsideParenthesesAndArrays(schemaPath);
|
|
@@ -346,12 +699,13 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
346
699
|
continue;
|
|
347
700
|
}
|
|
348
701
|
const postfix = joinParenthesesAndArrays(schemaPathParts.slice(basePathParts.length));
|
|
349
|
-
|
|
702
|
+
const newValue = entry.equivalentPostfixes[postfix]
|
|
350
703
|
? bestValueFromOptions([
|
|
351
704
|
entry.equivalentPostfixes[postfix],
|
|
352
705
|
dataStructure.returnValueSchema[schemaPath],
|
|
353
706
|
])
|
|
354
707
|
: dataStructure.returnValueSchema[schemaPath];
|
|
708
|
+
entry.equivalentPostfixes[postfix] = newValue;
|
|
355
709
|
}
|
|
356
710
|
}
|
|
357
711
|
}
|
|
@@ -390,6 +744,8 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
390
744
|
}
|
|
391
745
|
const findEquivalentSchemaPathEntry = (schemaSubPath, equivalentRootFunction) => {
|
|
392
746
|
let postfix;
|
|
747
|
+
// Get the signature index we're looking for (if any)
|
|
748
|
+
const lookingForSignatureIndex = extractSignatureIndex(schemaSubPath);
|
|
393
749
|
const equivalentEntry = mergedEquivalentSchemaPaths.find((esp) => esp.equivalentRoots.some((er) => {
|
|
394
750
|
if ((schemaSubPath.startsWith('returnValue') ||
|
|
395
751
|
schemaSubPath.startsWith('signature[')) &&
|
|
@@ -398,6 +754,26 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
398
754
|
return false;
|
|
399
755
|
}
|
|
400
756
|
if (schemaSubPath === er.schemaRootPath) {
|
|
757
|
+
// Additional check: if we're looking for a signature path, make sure
|
|
758
|
+
// the entry doesn't already have DIFFERENT signature indices.
|
|
759
|
+
// This prevents entries with signature[1], signature[2], signature[4]
|
|
760
|
+
// from all being merged together.
|
|
761
|
+
if (lookingForSignatureIndex !== undefined) {
|
|
762
|
+
const hasConflictingSignatureIndex = esp.equivalentRoots.some((otherRoot) => {
|
|
763
|
+
// Only check roots from the same function
|
|
764
|
+
if (otherRoot.function?.name !== equivalentRootFunction?.name ||
|
|
765
|
+
otherRoot.function?.filePath !==
|
|
766
|
+
equivalentRootFunction?.filePath) {
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
const otherIndex = extractSignatureIndex(otherRoot.schemaRootPath);
|
|
770
|
+
return (otherIndex !== undefined &&
|
|
771
|
+
otherIndex !== lookingForSignatureIndex);
|
|
772
|
+
});
|
|
773
|
+
if (hasConflictingSignatureIndex) {
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
401
777
|
postfix = er.postfix;
|
|
402
778
|
return true;
|
|
403
779
|
}
|
|
@@ -478,13 +854,51 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
478
854
|
if (mockedDependencies.has(`${filePath}::${name}`)) {
|
|
479
855
|
continue;
|
|
480
856
|
}
|
|
481
|
-
const
|
|
482
|
-
gatherAllEquivalentSchemaPaths(name,
|
|
857
|
+
const childMergedDataStructure = dependentAnalyses[filePath][name].metadata?.mergedDataStructure || {};
|
|
858
|
+
gatherAllEquivalentSchemaPaths(name, childMergedDataStructure);
|
|
483
859
|
}
|
|
484
860
|
}
|
|
485
861
|
equivalentSchemaPaths = mergeAllEquivalentSchemaPaths();
|
|
862
|
+
// Collect schemas that need cleaning — batch the calls for the end instead of
|
|
863
|
+
// calling cleanSchema inside the inner root loop (which was O(roots * schemaSize)).
|
|
864
|
+
const schemasToClean = new Set();
|
|
486
865
|
for (const esp of equivalentSchemaPaths) {
|
|
487
|
-
|
|
866
|
+
// Pre-compute which postfixes have children to avoid O(n²) lookups in the inner loop.
|
|
867
|
+
// A postfix "has children" if there are other postfixes that extend it.
|
|
868
|
+
const postfixesWithChildren = new Set();
|
|
869
|
+
const postfixKeys = Object.keys(esp.equivalentPostfixes);
|
|
870
|
+
// Check for empty postfix having children (any other postfixes exist)
|
|
871
|
+
if (postfixKeys.length > 1 && '' in esp.equivalentPostfixes) {
|
|
872
|
+
postfixesWithChildren.add('');
|
|
873
|
+
}
|
|
874
|
+
// Check for array element postfixes having children using a prefix set.
|
|
875
|
+
// This avoids O(n²) scans across large postfix lists.
|
|
876
|
+
// e.g., 'currentEntities[]' has children if a path like 'currentEntities[].sha' exists.
|
|
877
|
+
const postfixPrefixSet = new Set();
|
|
878
|
+
for (const postfixPath of postfixKeys) {
|
|
879
|
+
if (!postfixPath)
|
|
880
|
+
continue;
|
|
881
|
+
const parts = splitOutsideParenthesesAndArrays(postfixPath);
|
|
882
|
+
for (let i = 1; i < parts.length; i++) {
|
|
883
|
+
postfixPrefixSet.add(joinParenthesesAndArrays(parts.slice(0, i)));
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
for (const postfixPath of postfixKeys) {
|
|
887
|
+
if (postfixPath.endsWith('[]') && postfixPrefixSet.has(postfixPath)) {
|
|
888
|
+
postfixesWithChildren.add(postfixPath);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
// Deduplicate equivalentRoots that would write to the same schema paths.
|
|
892
|
+
// Roots with the same (function, schemaRootPath, postfix) are redundant.
|
|
893
|
+
const seenRootKeys = new Set();
|
|
894
|
+
const uniqueRoots = esp.equivalentRoots.filter((root) => {
|
|
895
|
+
const key = `${root.function?.filePath ?? ''}::${root.function?.name ?? ''}::${root.schemaRootPath}::${root.postfix ?? ''}`;
|
|
896
|
+
if (seenRootKeys.has(key))
|
|
897
|
+
return false;
|
|
898
|
+
seenRootKeys.add(key);
|
|
899
|
+
return true;
|
|
900
|
+
});
|
|
901
|
+
for (const equivalentRoot of uniqueRoots) {
|
|
488
902
|
let merged;
|
|
489
903
|
if (equivalentRoot.function) {
|
|
490
904
|
merged = findOrCreateDependentSchemas(equivalentRoot.function);
|
|
@@ -500,9 +914,21 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
500
914
|
for (const [postfixPath, postfixValue] of Object.entries(esp.equivalentPostfixes)) {
|
|
501
915
|
let relevantPostfix = postfixPath;
|
|
502
916
|
if (equivalentRoot.postfix) {
|
|
917
|
+
// Check if postfixPath starts with equivalentRoot.postfix at a path boundary.
|
|
918
|
+
// Must ensure exact path part match - "entityCode" should NOT match "entity" prefix.
|
|
919
|
+
// Valid: "entity.foo" starts with "entity" (boundary at '.')
|
|
920
|
+
// Valid: "entity[0]" starts with "entity" (boundary at '[')
|
|
921
|
+
// Invalid: "entityCode" starts with "entity" (no boundary, different property)
|
|
503
922
|
if (!postfixPath.startsWith(equivalentRoot.postfix)) {
|
|
504
923
|
continue;
|
|
505
924
|
}
|
|
925
|
+
// Additional check: ensure the match is at a path boundary
|
|
926
|
+
const nextChar = postfixPath[equivalentRoot.postfix.length];
|
|
927
|
+
if (nextChar !== undefined && nextChar !== '.' && nextChar !== '[') {
|
|
928
|
+
// The postfixPath continues with more characters that aren't a path separator.
|
|
929
|
+
// This means "entity" matched "entityCode" which is wrong - they're different properties.
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
506
932
|
const postFixPathParts = splitOutsideParenthesesAndArrays(postfixPath);
|
|
507
933
|
const equivalentRootPostFixParts = splitOutsideParenthesesAndArrays(equivalentRoot.postfix);
|
|
508
934
|
relevantPostfix = joinParenthesesAndArrays(postFixPathParts.slice(equivalentRootPostFixParts.length));
|
|
@@ -511,11 +937,87 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
511
937
|
equivalentRoot.schemaRootPath,
|
|
512
938
|
relevantPostfix,
|
|
513
939
|
]);
|
|
940
|
+
// Skip paths that would go through a primitive type
|
|
941
|
+
// e.g., if schema has 'entities[].scenarioCount': 'number', skip 'entities[].scenarioCount.sha'
|
|
942
|
+
if (wouldGoThroughPrimitive(newSchemaPath, schema)) {
|
|
943
|
+
transformationTracer.operation(rootScopeName, {
|
|
944
|
+
operation: 'skipPrimitivePath',
|
|
945
|
+
stage: 'merged',
|
|
946
|
+
path: newSchemaPath,
|
|
947
|
+
context: {
|
|
948
|
+
reason: 'would go through primitive type',
|
|
949
|
+
postfixValue,
|
|
950
|
+
},
|
|
951
|
+
});
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
// Skip setting primitive type when there are child postfixes that indicate structure.
|
|
955
|
+
// This prevents downgrading an object/array element to a primitive type.
|
|
956
|
+
// Uses pre-computed postfixesWithChildren Set for O(1) lookup instead of O(n) iteration.
|
|
957
|
+
const hasChildPostfixes = (relevantPostfix === '' || relevantPostfix.endsWith('[]')) &&
|
|
958
|
+
postfixesWithChildren.has(postfixPath);
|
|
959
|
+
if (PRIMITIVE_TYPES.has(postfixValue) && hasChildPostfixes) {
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
// Don't overwrite a more specific type with a less specific one
|
|
963
|
+
// This can happen when nested roots share entries with their parent roots
|
|
964
|
+
const existingType = schema[newSchemaPath];
|
|
965
|
+
if (existingType) {
|
|
966
|
+
// Don't overwrite a primitive type with 'object' or 'array'
|
|
967
|
+
// e.g., if schema has 'entities[].scenarioCount': 'number', don't overwrite with 'object'
|
|
968
|
+
if (PRIMITIVE_TYPES.has(existingType) &&
|
|
969
|
+
(postfixValue === 'object' || postfixValue === 'array')) {
|
|
970
|
+
transformationTracer.operation(rootScopeName, {
|
|
971
|
+
operation: 'skipTypeDowngrade',
|
|
972
|
+
stage: 'merged',
|
|
973
|
+
path: newSchemaPath,
|
|
974
|
+
context: {
|
|
975
|
+
reason: 'would overwrite primitive with object/array',
|
|
976
|
+
existingType,
|
|
977
|
+
newType: postfixValue,
|
|
978
|
+
},
|
|
979
|
+
});
|
|
980
|
+
continue;
|
|
981
|
+
}
|
|
982
|
+
// Don't overwrite a complex/union type with a primitive
|
|
983
|
+
// e.g., if schema has 'scenarios[]': 'Scenario | null', don't overwrite with 'string'
|
|
984
|
+
if (!PRIMITIVE_TYPES.has(existingType) &&
|
|
985
|
+
PRIMITIVE_TYPES.has(postfixValue)) {
|
|
986
|
+
transformationTracer.operation(rootScopeName, {
|
|
987
|
+
operation: 'skipTypeDowngrade',
|
|
988
|
+
stage: 'merged',
|
|
989
|
+
path: newSchemaPath,
|
|
990
|
+
context: {
|
|
991
|
+
reason: 'would overwrite complex type with primitive',
|
|
992
|
+
existingType,
|
|
993
|
+
newType: postfixValue,
|
|
994
|
+
},
|
|
995
|
+
});
|
|
996
|
+
continue;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
// Log the successful postfix merge
|
|
1000
|
+
transformationTracer.operation(rootScopeName, {
|
|
1001
|
+
operation: 'mergePostfix',
|
|
1002
|
+
stage: 'merged',
|
|
1003
|
+
path: newSchemaPath,
|
|
1004
|
+
before: existingType,
|
|
1005
|
+
after: postfixValue,
|
|
1006
|
+
context: {
|
|
1007
|
+
schemaRootPath: equivalentRoot.schemaRootPath,
|
|
1008
|
+
postfix: relevantPostfix,
|
|
1009
|
+
dependency: equivalentRoot.function?.name,
|
|
1010
|
+
},
|
|
1011
|
+
});
|
|
514
1012
|
schema[newSchemaPath] = postfixValue;
|
|
515
1013
|
}
|
|
516
|
-
|
|
1014
|
+
schemasToClean.add(schema);
|
|
517
1015
|
}
|
|
518
1016
|
}
|
|
1017
|
+
// Batch-clean all modified schemas once (instead of once per root per ESP entry)
|
|
1018
|
+
for (const schema of schemasToClean) {
|
|
1019
|
+
cleanSchema(schema, { stage: 'afterMergePostfix' });
|
|
1020
|
+
}
|
|
519
1021
|
// Propagate equivalency-derived attributes to generic function call variants.
|
|
520
1022
|
// When attributes are traced via equivalencies (e.g., fileComparisons from buildDataMap.signature[2]),
|
|
521
1023
|
// they get written to non-generic paths (returnValue.data.x or funcName().functionCallReturnValue.data.x).
|
|
@@ -612,6 +1114,14 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
612
1114
|
// e.g., returnValue[].label -> getOptions().functionCallReturnValue[].label
|
|
613
1115
|
normalizedPath = path.replace(/^returnValue/, `${dependency.name}().functionCallReturnValue`);
|
|
614
1116
|
}
|
|
1117
|
+
transformationTracer.operation(rootScopeName, {
|
|
1118
|
+
operation: 'normalizeReturnValuePath',
|
|
1119
|
+
stage: 'merged',
|
|
1120
|
+
path: normalizedPath,
|
|
1121
|
+
before: path,
|
|
1122
|
+
after: normalizedPath,
|
|
1123
|
+
context: { dependency: dependency.name, value },
|
|
1124
|
+
});
|
|
615
1125
|
depSchema.returnValueSchema[normalizedPath] = value;
|
|
616
1126
|
}
|
|
617
1127
|
// Now copy paths from the source schema (dependencySchemas)
|
|
@@ -678,7 +1188,78 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
678
1188
|
}
|
|
679
1189
|
}
|
|
680
1190
|
}
|
|
681
|
-
cleanSchema(depSchema.returnValueSchema
|
|
1191
|
+
cleanSchema(depSchema.returnValueSchema, {
|
|
1192
|
+
stage: 'afterMockedDependencyMerge',
|
|
1193
|
+
dependency: dependency.name,
|
|
1194
|
+
});
|
|
1195
|
+
// Pull signature requirements from downstream functions into the mocked return value.
|
|
1196
|
+
// When a mocked function's return flows into another function's signature (via usageEquivalencies),
|
|
1197
|
+
// we need to include that function's signature requirements in the mock.
|
|
1198
|
+
//
|
|
1199
|
+
// Example: fromE5() returns a currency object that flows to calculateTotalPrice(price, quantity).
|
|
1200
|
+
// calculateTotalPrice's signatureSchema shows signature[0].multiply() is required.
|
|
1201
|
+
// We need to add multiply() to fromE5's mock return value.
|
|
1202
|
+
const usageEquivalencies = srcSchema.usageEquivalencies ?? {};
|
|
1203
|
+
for (const [returnPath, equivalencies] of Object.entries(usageEquivalencies)) {
|
|
1204
|
+
// Only process return value paths (functionCallReturnValue)
|
|
1205
|
+
if (!returnPath.includes('.functionCallReturnValue'))
|
|
1206
|
+
continue;
|
|
1207
|
+
for (const equiv of equivalencies) {
|
|
1208
|
+
// Check if this equivalency points to a signature path
|
|
1209
|
+
const signatureMatch = equiv.schemaPath.match(/\.signature\[(\d+)\]$/);
|
|
1210
|
+
if (!signatureMatch)
|
|
1211
|
+
continue;
|
|
1212
|
+
const targetFunctionName = cleanFunctionName(equiv.scopeNodeName);
|
|
1213
|
+
const signatureIndex = signatureMatch[1];
|
|
1214
|
+
// Look up the target function's analysis to get its signature requirements
|
|
1215
|
+
// First try dependentAnalyses, then dependencySchemas
|
|
1216
|
+
let targetSignatureSchema;
|
|
1217
|
+
// Check dependentAnalyses first (has the full merged analysis)
|
|
1218
|
+
for (const depFilePath in dependentAnalyses) {
|
|
1219
|
+
const analysis = dependentAnalyses[depFilePath]?.[targetFunctionName];
|
|
1220
|
+
if (analysis?.metadata?.mergedDataStructure?.signatureSchema) {
|
|
1221
|
+
targetSignatureSchema =
|
|
1222
|
+
analysis.metadata.mergedDataStructure.signatureSchema;
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
// Fallback to dependencySchemas if not found
|
|
1227
|
+
if (!targetSignatureSchema) {
|
|
1228
|
+
for (const depFilePath in dependencySchemas) {
|
|
1229
|
+
const schema = dependencySchemas[depFilePath]?.[targetFunctionName];
|
|
1230
|
+
if (schema?.signatureSchema) {
|
|
1231
|
+
targetSignatureSchema = schema.signatureSchema;
|
|
1232
|
+
break;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
if (!targetSignatureSchema)
|
|
1237
|
+
continue;
|
|
1238
|
+
// Find all paths in the target's signatureSchema that extend from signature[N]
|
|
1239
|
+
// e.g., signature[0].multiply(quantity) -> .multiply(quantity)
|
|
1240
|
+
const signaturePrefix = `signature[${signatureIndex}]`;
|
|
1241
|
+
for (const [sigPath, sigType] of Object.entries(targetSignatureSchema)) {
|
|
1242
|
+
if (!sigPath.startsWith(signaturePrefix))
|
|
1243
|
+
continue;
|
|
1244
|
+
// Skip the base signature[N] path itself - we only want the method/property extensions
|
|
1245
|
+
if (sigPath === signaturePrefix)
|
|
1246
|
+
continue;
|
|
1247
|
+
// Extract the suffix after signature[N] (e.g., ".multiply(quantity)")
|
|
1248
|
+
const suffix = sigPath.slice(signaturePrefix.length);
|
|
1249
|
+
// Build the path for the mocked return value
|
|
1250
|
+
// e.g., fromE5(priceE5).functionCallReturnValue.multiply(quantity)
|
|
1251
|
+
const returnValuePath = returnPath + suffix;
|
|
1252
|
+
// Add to the mocked dependency's return value schema if not already present
|
|
1253
|
+
if (!(returnValuePath in depSchema.returnValueSchema)) {
|
|
1254
|
+
depSchema.returnValueSchema[returnValuePath] = sigType;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
cleanSchema(depSchema.returnValueSchema, {
|
|
1260
|
+
stage: 'afterSignatureRequirementsMerge',
|
|
1261
|
+
dependency: dependency.name,
|
|
1262
|
+
});
|
|
682
1263
|
}
|
|
683
1264
|
// Process the input dependencySchemas FIRST (before child dependentAnalyses).
|
|
684
1265
|
// This ensures the parent entity's direct usage of dependencies takes precedence.
|
|
@@ -714,7 +1295,38 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
714
1295
|
// from the copied schema. Without this, method call paths on primitives like
|
|
715
1296
|
// "projectSlug.replace(...)" would cause convertDotNotation to create nested
|
|
716
1297
|
// object structures instead of preserving the primitive type.
|
|
717
|
-
cleanSchema(depSchema.returnValueSchema
|
|
1298
|
+
cleanSchema(depSchema.returnValueSchema, {
|
|
1299
|
+
stage: 'afterDependencySchemaCopy',
|
|
1300
|
+
filePath,
|
|
1301
|
+
dependency: name,
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
// TYPE REFINEMENT: Check if dependentAnalyses has a more specific type for this dependency.
|
|
1305
|
+
// When a parent passes `entity.filePath` (string | undefined) to a child component
|
|
1306
|
+
// that requires `filePath: string`, we should use the child's more specific type.
|
|
1307
|
+
// This prevents mock data from having undefined values for required props.
|
|
1308
|
+
//
|
|
1309
|
+
// This runs REGARDLESS of whether equivalencies already processed the schema,
|
|
1310
|
+
// because equivalencies copy the parent's type (string | undefined), not the child's
|
|
1311
|
+
// required type (string).
|
|
1312
|
+
const depSchema = findOrCreateDependentSchemas({ filePath, name });
|
|
1313
|
+
const childAnalysis = dependentAnalyses[filePath]?.[name];
|
|
1314
|
+
const childSignatureSchema = childAnalysis?.metadata?.mergedDataStructure?.signatureSchema;
|
|
1315
|
+
if (childSignatureSchema) {
|
|
1316
|
+
for (const path in depSchema.signatureSchema) {
|
|
1317
|
+
const parentType = depSchema.signatureSchema[path];
|
|
1318
|
+
const childType = childSignatureSchema[path];
|
|
1319
|
+
if (parentType && childType) {
|
|
1320
|
+
// Check if parent has optional type and child has required type
|
|
1321
|
+
const parentIsOptional = parentType.includes('| undefined') ||
|
|
1322
|
+
parentType.includes('| null');
|
|
1323
|
+
const childIsOptional = childType.includes('| undefined') || childType.includes('| null');
|
|
1324
|
+
// If child requires a more specific type (not optional), use it
|
|
1325
|
+
if (parentIsOptional && !childIsOptional) {
|
|
1326
|
+
depSchema.signatureSchema[path] = childType;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
718
1330
|
}
|
|
719
1331
|
// For functions with multiple different type parameters, also create separate entries
|
|
720
1332
|
// for each type-parameterized variant. This allows gatherDataForMocks to look up
|
|
@@ -746,7 +1358,12 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
746
1358
|
srcSchema.returnValueSchema[path];
|
|
747
1359
|
}
|
|
748
1360
|
}
|
|
749
|
-
cleanSchema(variantSchema.returnValueSchema
|
|
1361
|
+
cleanSchema(variantSchema.returnValueSchema, {
|
|
1362
|
+
stage: 'afterTypeVariantCopy',
|
|
1363
|
+
filePath,
|
|
1364
|
+
dependency: name,
|
|
1365
|
+
variant,
|
|
1366
|
+
});
|
|
750
1367
|
}
|
|
751
1368
|
}
|
|
752
1369
|
}
|
|
@@ -797,8 +1414,8 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
797
1414
|
// Merge in the nested dependency schemas
|
|
798
1415
|
for (const path in nestedDepSchema.returnValueSchema) {
|
|
799
1416
|
if (!(path in targetDepSchema.returnValueSchema)) {
|
|
800
|
-
|
|
801
|
-
|
|
1417
|
+
const value = nestedDepSchema.returnValueSchema[path];
|
|
1418
|
+
targetDepSchema.returnValueSchema[path] = value;
|
|
802
1419
|
}
|
|
803
1420
|
}
|
|
804
1421
|
for (const path in nestedDepSchema.signatureSchema) {
|