@codeyam/codeyam-cli 0.1.0-staging.483fdc2 → 0.1.0-staging.4c0c3c9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +4 -4
- package/analyzer-template/packages/ai/index.ts +1 -0
- package/analyzer-template/packages/ai/package.json +2 -2
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +23 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +101 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +6 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +330 -9
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +11 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +2 -2
- 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 +20 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +84 -19
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +33 -15
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +58 -3
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +46 -5
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +38 -2
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +359 -142
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +51 -3
- package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +24 -4
- package/analyzer-template/packages/analyze/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +69 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +4 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +59 -26
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +194 -15
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +372 -57
- package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
- 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 +6 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
- 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/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 +3 -0
- 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/debugReportsTable.d.ts +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/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/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/types/src/types/ProjectMetadata.ts +7 -0
- 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/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/src/lib/fs/rsyncCopy.ts +108 -2
- package/analyzer-template/project/constructMockCode.ts +38 -3
- package/analyzer-template/project/writeMockDataTsx.ts +119 -17
- package/analyzer-template/project/writeScenarioComponents.ts +60 -12
- package/analyzer-template/project/writeSimpleRoot.ts +21 -11
- 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/constructMockCode.js +32 -3
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +102 -13
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +60 -15
- 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 +44 -10
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/cli.js +2 -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 +2 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -1
- package/codeyam-cli/src/commands/debug.js +2 -0
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +31 -20
- 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 +17 -26
- package/codeyam-cli/src/commands/memory.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +2 -0
- package/codeyam-cli/src/commands/recapture.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/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__/setupClaudeCodeSettings.test.js +128 -86
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.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 +90 -19
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +2 -2
- package/codeyam-cli/src/utils/install-skills.js +57 -54
- 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 +4 -0
- package/codeyam-cli/src/utils/queue/job.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 +1 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -1
- package/codeyam-cli/src/utils/rules/parser.js +2 -25
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
- 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 +16 -11
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -1
- 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 -44
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.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 +15 -3
- 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 +11 -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-DsN1wKrm.js → EntityItem-bwuHPyTa.js} +1 -1
- 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-Ba2JVPzP.js → EntityTypeIcon-BH0XDim7.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-C8lyxW9k.js → InlineSpinner-EhOseatT.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-yjIHlOGa.js} +2 -2
- 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-OApQuNyq.js → ReportIssueModal-BzPgx-xO.js} +3 -8
- 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-DzccYyI8.js → ScenarioViewer-BX2Ny2Qj.js} +2 -2
- 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-BwqWJOgH.js → _index-BRx8ZGZo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BwavGCpm.js → activity.(_tab)-4S4yPfFw.js} +6 -11
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +17 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-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/{dev.empty-BBnGWYga.js → dev.empty-JTAjQ54M.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BJUiQqZF.js → entity._sha._-B0h9AqE6.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js → entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D1T4TGjf.js → entity._sha_.create-scenario-CtYowLOt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.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/{fileTableUtils-DMJ7zii9.js → fileTableUtils-9sMMAiWJ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{files-CJ6lTdTA.js → files-Co65J0s3.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{git-CPTZZ-JZ.js → git-BdHOxVfg.js} +1 -1
- 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-DwFIBT09.js → simulations-DVNJVQgD.js} +1 -1
- 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-C1v1PQzo.js → useCustomSizes-BqgrAzs3.js} +1 -1
- 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-DYxHZQuP.js → useReportContext-DZlYx2c4.js} +1 -1
- 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-TD1f-DHV.js → index-CxaRxKVt.js} +1 -1
- 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/templates/{codeyam:debug.md → codeyam-debug.md} +1 -1
- package/codeyam-cli/templates/codeyam-diagnose.md +481 -0
- package/codeyam-cli/templates/codeyam-memory-hook.sh +19 -20
- package/codeyam-cli/templates/{codeyam:memory.md → codeyam-memory.md} +26 -33
- package/codeyam-cli/templates/codeyam-new-rule.md +13 -0
- package/codeyam-cli/templates/{codeyam:setup.md → codeyam-setup.md} +13 -1
- package/codeyam-cli/templates/{codeyam:sim.md → codeyam-sim.md} +1 -1
- package/codeyam-cli/templates/{codeyam:test.md → codeyam-test.md} +1 -1
- package/codeyam-cli/templates/{codeyam:verify.md → codeyam-verify.md} +1 -1
- package/codeyam-cli/templates/rule-notification-hook.py +56 -0
- package/codeyam-cli/templates/rule-reflection-hook.py +554 -88
- package/codeyam-cli/templates/rules-instructions.md +54 -48
- package/package.json +9 -9
- package/packages/ai/index.js +1 -1
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +21 -1
- package/packages/ai/src/lib/analyzeScope.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/processExpression.js +78 -1
- 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/dataStructure/ScopeDataStructure.js +262 -8
- 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/helpers/cleanKnownObjectFunctions.js +11 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +2 -2
- 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 +15 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +78 -17
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructureChunking.js +26 -11
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +46 -2
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +32 -3
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +16 -2
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +242 -81
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +39 -3
- 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/promptGenerators/collapseNullableObjects.js +97 -0
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +17 -2
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/analyze/index.js +1 -0
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +52 -2
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +3 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.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 +5 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +51 -14
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +116 -13
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +310 -45
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.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/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 +3 -0
- package/packages/database/src/lib/kysely/db.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/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/utils/src/lib/fs/rsyncCopy.js +93 -2
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +8 -76
- package/codeyam-cli/src/utils/reviewedRules.js +0 -92
- package/codeyam-cli/src/utils/reviewedRules.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/globals-CX9f-5xM.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-bba56ec1.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-DuTFSyJ2.js +0 -92
- package/codeyam-cli/src/webserver/build/client/assets/root-DTfSQARG.js +0 -62
- package/codeyam-cli/src/webserver/build/client/assets/settings-CS5f3WzT.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BQ-1XyEa.js +0 -258
- package/codeyam-cli/templates/codeyam:diagnose.md +0 -803
- package/codeyam-cli/templates/codeyam:new-rule.md +0 -52
|
@@ -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
|
}
|
|
@@ -47,6 +48,12 @@ function isPrimitiveType(typeStr) {
|
|
|
47
48
|
}
|
|
48
49
|
return false;
|
|
49
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
|
+
}
|
|
50
57
|
// Check if a new schema path would go through a primitive type
|
|
51
58
|
// e.g., if schema has 'entities[].scenarioCount': 'number', then
|
|
52
59
|
// 'entities[].scenarioCount.sha' would go through a primitive and should be rejected
|
|
@@ -128,6 +135,21 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
128
135
|
}
|
|
129
136
|
}
|
|
130
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
|
+
};
|
|
131
153
|
// Pre-build a lookup map from cleaned function name to dependency for O(1) lookups.
|
|
132
154
|
// This avoids O(n) linear search in findRelevantDependency which was causing O(n²) performance.
|
|
133
155
|
const dependencyByCleanedName = new Map();
|
|
@@ -166,8 +188,8 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
166
188
|
});
|
|
167
189
|
return mergedDataStructure.dependencySchemas[filePath][name];
|
|
168
190
|
};
|
|
169
|
-
const cleanSchema = (schema) => {
|
|
170
|
-
cleanKnownObjectFunctionsFromMapping
|
|
191
|
+
const cleanSchema = (schema, context) => {
|
|
192
|
+
transformationTracer.traceSchemaTransform(rootScopeName, 'cleanKnownObjectFunctionsFromMapping', schema, cleanKnownObjectFunctionsFromMapping, context);
|
|
171
193
|
};
|
|
172
194
|
const translatePath = (path, dependencyName) => {
|
|
173
195
|
if (path.startsWith(dependencyName)) {
|
|
@@ -207,6 +229,41 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
207
229
|
const gatherAllEquivalentSchemaPaths = (functionName, sourceAndUsageEquivalencies, dataStructure) => {
|
|
208
230
|
if (!sourceAndUsageEquivalencies)
|
|
209
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
|
+
};
|
|
210
267
|
const findOrCreateEquivalentSchemaPathsEntry = (allPaths) => {
|
|
211
268
|
const equivalentRoots = allPaths
|
|
212
269
|
.filter((p) => p.functionName === rootScopeName ||
|
|
@@ -218,19 +275,93 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
218
275
|
: findRelevantDependency(p.functionName),
|
|
219
276
|
}));
|
|
220
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.
|
|
221
288
|
for (const pathInfo of allPaths) {
|
|
222
|
-
if (
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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;
|
|
229
327
|
}
|
|
328
|
+
equivalentSchemaPathsEntry = candidate;
|
|
230
329
|
}
|
|
231
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
|
+
}
|
|
232
363
|
equivalentSchemaPathsEntry = {
|
|
233
|
-
equivalentRoots,
|
|
364
|
+
equivalentRoots: filteredRoots,
|
|
234
365
|
equivalentPostfixes: {},
|
|
235
366
|
};
|
|
236
367
|
equivalentSchemaPaths.push(equivalentSchemaPathsEntry);
|
|
@@ -248,6 +379,8 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
248
379
|
seenRoots.add(key);
|
|
249
380
|
return true;
|
|
250
381
|
});
|
|
382
|
+
// Keep the espIndex in sync after adding/deduplicating roots
|
|
383
|
+
updateEspIndex(equivalentSchemaPathsEntry);
|
|
251
384
|
return equivalentSchemaPathsEntry;
|
|
252
385
|
};
|
|
253
386
|
// Helper to extract function name from a path that starts with a function call.
|
|
@@ -303,6 +436,8 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
303
436
|
p.functionName === rootScopeName ||
|
|
304
437
|
p.functionName === effectiveFunctionName);
|
|
305
438
|
const derivedBasePaths = [];
|
|
439
|
+
const allPathSet = new Set(allPaths.map((p) => p.path));
|
|
440
|
+
const derivedBasePathSet = new Set();
|
|
306
441
|
// For each child path, find its equivalent parent path and derive bases
|
|
307
442
|
for (const childPathInfo of childPaths) {
|
|
308
443
|
const childParts = splitOutsideParenthesesAndArrays(childPathInfo.path);
|
|
@@ -351,23 +486,23 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
351
486
|
parentHasArrayIterator &&
|
|
352
487
|
!childHasArrayIterator &&
|
|
353
488
|
!childBaseIsGenericSignature) {
|
|
354
|
-
// Add child base if not already present
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if (!childBaseExists) {
|
|
489
|
+
// Add child base if not already present (O(1) Set lookup)
|
|
490
|
+
if (!allPathSet.has(childBase) &&
|
|
491
|
+
!derivedBasePathSet.has(childBase)) {
|
|
358
492
|
derivedBasePaths.push({
|
|
359
493
|
path: childBase,
|
|
360
494
|
functionName: childPathInfo.functionName,
|
|
361
495
|
});
|
|
496
|
+
derivedBasePathSet.add(childBase);
|
|
362
497
|
}
|
|
363
|
-
// Add parent base if not already present
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
if (!parentBaseExists) {
|
|
498
|
+
// Add parent base if not already present (O(1) Set lookup)
|
|
499
|
+
if (!allPathSet.has(parentBase) &&
|
|
500
|
+
!derivedBasePathSet.has(parentBase)) {
|
|
367
501
|
derivedBasePaths.push({
|
|
368
502
|
path: parentBase,
|
|
369
503
|
functionName: parentPathInfo.functionName,
|
|
370
504
|
});
|
|
505
|
+
derivedBasePathSet.add(parentBase);
|
|
371
506
|
}
|
|
372
507
|
}
|
|
373
508
|
}
|
|
@@ -376,6 +511,25 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
376
511
|
}
|
|
377
512
|
allPaths.push(...derivedBasePaths);
|
|
378
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
|
+
}
|
|
379
533
|
for (const equivalentRoot of entry.equivalentRoots) {
|
|
380
534
|
const dataStructures = equivalentRoot.function &&
|
|
381
535
|
equivalentRoot.function.name !== rootScopeName
|
|
@@ -404,18 +558,16 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
404
558
|
pathParts = pathParts.slice(1);
|
|
405
559
|
}
|
|
406
560
|
for (const schema of schemas) {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
}
|
|
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) {
|
|
419
571
|
if (schemaPathParts.length < pathParts.length)
|
|
420
572
|
continue;
|
|
421
573
|
// Check if all path parts match (allowing function call variants)
|
|
@@ -474,13 +626,27 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
474
626
|
else {
|
|
475
627
|
// Regular exact match - use the standard postfix logic
|
|
476
628
|
const postfix = joinParenthesesAndArrays(schemaPathParts.slice(matchedUpToIndex));
|
|
477
|
-
entry.equivalentPostfixes[postfix]
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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
|
+
}
|
|
484
650
|
}
|
|
485
651
|
}
|
|
486
652
|
}
|
|
@@ -512,10 +678,14 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
512
678
|
const entry = findOrCreateEquivalentSchemaPathsEntry([
|
|
513
679
|
{ path: translatedBasePath, functionName: functionName },
|
|
514
680
|
]);
|
|
515
|
-
|
|
681
|
+
const newRoot = {
|
|
516
682
|
schemaRootPath: translatedBasePath,
|
|
517
683
|
function: findRelevantDependency(functionName),
|
|
518
|
-
}
|
|
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);
|
|
519
689
|
const basePathParts = splitOutsideParenthesesAndArrays(basePath);
|
|
520
690
|
for (const schemaPath in dataStructure.returnValueSchema) {
|
|
521
691
|
const schemaPathParts = splitOutsideParenthesesAndArrays(schemaPath);
|
|
@@ -529,12 +699,13 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
529
699
|
continue;
|
|
530
700
|
}
|
|
531
701
|
const postfix = joinParenthesesAndArrays(schemaPathParts.slice(basePathParts.length));
|
|
532
|
-
|
|
702
|
+
const newValue = entry.equivalentPostfixes[postfix]
|
|
533
703
|
? bestValueFromOptions([
|
|
534
704
|
entry.equivalentPostfixes[postfix],
|
|
535
705
|
dataStructure.returnValueSchema[schemaPath],
|
|
536
706
|
])
|
|
537
707
|
: dataStructure.returnValueSchema[schemaPath];
|
|
708
|
+
entry.equivalentPostfixes[postfix] = newValue;
|
|
538
709
|
}
|
|
539
710
|
}
|
|
540
711
|
}
|
|
@@ -573,6 +744,8 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
573
744
|
}
|
|
574
745
|
const findEquivalentSchemaPathEntry = (schemaSubPath, equivalentRootFunction) => {
|
|
575
746
|
let postfix;
|
|
747
|
+
// Get the signature index we're looking for (if any)
|
|
748
|
+
const lookingForSignatureIndex = extractSignatureIndex(schemaSubPath);
|
|
576
749
|
const equivalentEntry = mergedEquivalentSchemaPaths.find((esp) => esp.equivalentRoots.some((er) => {
|
|
577
750
|
if ((schemaSubPath.startsWith('returnValue') ||
|
|
578
751
|
schemaSubPath.startsWith('signature[')) &&
|
|
@@ -581,6 +754,26 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
581
754
|
return false;
|
|
582
755
|
}
|
|
583
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
|
+
}
|
|
584
777
|
postfix = er.postfix;
|
|
585
778
|
return true;
|
|
586
779
|
}
|
|
@@ -666,6 +859,9 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
666
859
|
}
|
|
667
860
|
}
|
|
668
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();
|
|
669
865
|
for (const esp of equivalentSchemaPaths) {
|
|
670
866
|
// Pre-compute which postfixes have children to avoid O(n²) lookups in the inner loop.
|
|
671
867
|
// A postfix "has children" if there are other postfixes that extend it.
|
|
@@ -744,6 +940,15 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
744
940
|
// Skip paths that would go through a primitive type
|
|
745
941
|
// e.g., if schema has 'entities[].scenarioCount': 'number', skip 'entities[].scenarioCount.sha'
|
|
746
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
|
+
});
|
|
747
952
|
continue;
|
|
748
953
|
}
|
|
749
954
|
// Skip setting primitive type when there are child postfixes that indicate structure.
|
|
@@ -762,20 +967,57 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
762
967
|
// e.g., if schema has 'entities[].scenarioCount': 'number', don't overwrite with 'object'
|
|
763
968
|
if (PRIMITIVE_TYPES.has(existingType) &&
|
|
764
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
|
+
});
|
|
765
980
|
continue;
|
|
766
981
|
}
|
|
767
982
|
// Don't overwrite a complex/union type with a primitive
|
|
768
983
|
// e.g., if schema has 'scenarios[]': 'Scenario | null', don't overwrite with 'string'
|
|
769
984
|
if (!PRIMITIVE_TYPES.has(existingType) &&
|
|
770
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
|
+
});
|
|
771
996
|
continue;
|
|
772
997
|
}
|
|
773
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
|
+
});
|
|
774
1012
|
schema[newSchemaPath] = postfixValue;
|
|
775
1013
|
}
|
|
776
|
-
|
|
1014
|
+
schemasToClean.add(schema);
|
|
777
1015
|
}
|
|
778
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
|
+
}
|
|
779
1021
|
// Propagate equivalency-derived attributes to generic function call variants.
|
|
780
1022
|
// When attributes are traced via equivalencies (e.g., fileComparisons from buildDataMap.signature[2]),
|
|
781
1023
|
// they get written to non-generic paths (returnValue.data.x or funcName().functionCallReturnValue.data.x).
|
|
@@ -872,6 +1114,14 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
872
1114
|
// e.g., returnValue[].label -> getOptions().functionCallReturnValue[].label
|
|
873
1115
|
normalizedPath = path.replace(/^returnValue/, `${dependency.name}().functionCallReturnValue`);
|
|
874
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
|
+
});
|
|
875
1125
|
depSchema.returnValueSchema[normalizedPath] = value;
|
|
876
1126
|
}
|
|
877
1127
|
// Now copy paths from the source schema (dependencySchemas)
|
|
@@ -938,7 +1188,10 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
938
1188
|
}
|
|
939
1189
|
}
|
|
940
1190
|
}
|
|
941
|
-
cleanSchema(depSchema.returnValueSchema
|
|
1191
|
+
cleanSchema(depSchema.returnValueSchema, {
|
|
1192
|
+
stage: 'afterMockedDependencyMerge',
|
|
1193
|
+
dependency: dependency.name,
|
|
1194
|
+
});
|
|
942
1195
|
// Pull signature requirements from downstream functions into the mocked return value.
|
|
943
1196
|
// When a mocked function's return flows into another function's signature (via usageEquivalencies),
|
|
944
1197
|
// we need to include that function's signature requirements in the mock.
|
|
@@ -1003,7 +1256,10 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
1003
1256
|
}
|
|
1004
1257
|
}
|
|
1005
1258
|
}
|
|
1006
|
-
cleanSchema(depSchema.returnValueSchema
|
|
1259
|
+
cleanSchema(depSchema.returnValueSchema, {
|
|
1260
|
+
stage: 'afterSignatureRequirementsMerge',
|
|
1261
|
+
dependency: dependency.name,
|
|
1262
|
+
});
|
|
1007
1263
|
}
|
|
1008
1264
|
// Process the input dependencySchemas FIRST (before child dependentAnalyses).
|
|
1009
1265
|
// This ensures the parent entity's direct usage of dependencies takes precedence.
|
|
@@ -1039,7 +1295,11 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
1039
1295
|
// from the copied schema. Without this, method call paths on primitives like
|
|
1040
1296
|
// "projectSlug.replace(...)" would cause convertDotNotation to create nested
|
|
1041
1297
|
// object structures instead of preserving the primitive type.
|
|
1042
|
-
cleanSchema(depSchema.returnValueSchema
|
|
1298
|
+
cleanSchema(depSchema.returnValueSchema, {
|
|
1299
|
+
stage: 'afterDependencySchemaCopy',
|
|
1300
|
+
filePath,
|
|
1301
|
+
dependency: name,
|
|
1302
|
+
});
|
|
1043
1303
|
}
|
|
1044
1304
|
// TYPE REFINEMENT: Check if dependentAnalyses has a more specific type for this dependency.
|
|
1045
1305
|
// When a parent passes `entity.filePath` (string | undefined) to a child component
|
|
@@ -1098,7 +1358,12 @@ export default function mergeInDependentDataStructure({ importedExports, depende
|
|
|
1098
1358
|
srcSchema.returnValueSchema[path];
|
|
1099
1359
|
}
|
|
1100
1360
|
}
|
|
1101
|
-
cleanSchema(variantSchema.returnValueSchema
|
|
1361
|
+
cleanSchema(variantSchema.returnValueSchema, {
|
|
1362
|
+
stage: 'afterTypeVariantCopy',
|
|
1363
|
+
filePath,
|
|
1364
|
+
dependency: name,
|
|
1365
|
+
variant,
|
|
1366
|
+
});
|
|
1102
1367
|
}
|
|
1103
1368
|
}
|
|
1104
1369
|
}
|