@codeyam/codeyam-cli 0.1.0-staging.036391e → 0.1.0-staging.03e0fb2
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 +14 -14
- package/analyzer-template/packages/ai/index.ts +1 -0
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +14 -0
- 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/completionCall.ts +102 -113
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +408 -13
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +70 -19
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +40 -13
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +32 -5
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +134 -2
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +359 -142
- 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/src/lib/asts/nodes/getNodeType.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +18 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +50 -25
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +153 -76
- package/analyzer-template/packages/aws/package.json +10 -10
- 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/tables/debugReportsTable.ts +1 -1
- 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/tables/debugReportsTable.d.ts +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/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +98 -3
- 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 +121 -3
- package/analyzer-template/project/constructMockCode.ts +34 -7
- package/analyzer-template/project/orchestrateCapture.ts +4 -1
- package/analyzer-template/project/writeScenarioComponents.ts +76 -12
- 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 +30 -7
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +56 -7
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +1 -1
- package/codeyam-cli/src/cli.js +31 -24
- 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/init.js +49 -257
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +95 -81
- 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 +185 -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 -23
- 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 +43 -63
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/labsAutoCheck.js +0 -29
- package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -1
- 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/requireSimulations.js +10 -0
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +7 -8
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +0 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +97 -6
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +4 -6
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +3 -3
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -1
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
- package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +23 -23
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -1
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.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 +19 -4
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
- package/codeyam-cli/src/utils/rules/pathMatcher.js +34 -3
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
- package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
- package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
- package/codeyam-cli/src/utils/rules/ruleState.js +10 -10
- package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -1
- package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
- package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +6 -6
- 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/utils/simulationGateMiddleware.js +159 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
- package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
- package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
- package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
- package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
- package/codeyam-cli/src/utils/versionInfo.js +46 -0
- 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 +14 -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 +36 -7
- 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-CA3JxPb7.js → CopyButton-CtmbP4Gl.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-B86KKU7e.js → EntityItem-DlMph_Hm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-B5ctlSYt.js → EntityTypeBadge-B-0PjGOU.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BqY8gDAW.js → EntityTypeIcon-DN9eiJAO.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-ClaLpuOo.js → InlineSpinner-C1rIyZdV.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-BDhPilK7.js → InteractivePreview-rE_fI2h2.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-VeqEBv9v.js → LibraryFunctionPreview-CnatsCw2.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-Bs7Nn1Jr.js → LoadingDots-CSP6DZrh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-Bm3PmcCz.js → LogViewer-CMK8Q7yk.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-C6PKeMYR.js → ReportIssueModal-TCV_HBjy.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-Gq3Ocjo6.js → SafeScreenshot-CG2uh31y.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-BNLaXBHR.js → ScenarioViewer-CU_TDYd8.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CiwXDxLh.js → TruncatedFilePath-D7IoaWUW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{_index-B3TDXxnk.js → _index-B8z7mjR-.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BtBFH820.js → activity.(_tab)-DZu78RI1.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-Dm5RS9il.js +22 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-PttOB2SF.js → book-open-Bp5FLkd4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-TJp6ofnp.js → chevron-down-DQJA9f4o.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-JE9ZIoBl.js → chunk-JZWAC4HX-7VptmeIr.js} +9 -9
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CXhHQYrI.js → circle-check-B6C4LY9o.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-6y9ALfGT.js → copy-6nzYCu0G.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-Ca9fAY46.js → createLucideIcon-D-QUFOwe.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-C5lqplTC.js → dev.empty-DmzSmblj.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-n38keI1k.js → entity._sha._-C6PQhwY5.js} +9 -9
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js → entity._sha.scenarios._scenarioId.fullscreen-DVTcUnur.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-DGgZjdFg.js → entity._sha_.create-scenario-BVgNO76F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-38yPijoD.js → entity._sha_.edit._scenarioId-C7ysA4Jq.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-BSHEfydn.js → entry.client-CU6EUArK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DCPhhSMo.js → fileTableUtils-EWpfFU4X.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{files-0N0YJQv7.js → files-CrxAoWIL.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{git-DXnyr8uP.js → git-BldHtKeW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-CLmFdUae.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-ChN9-fAY.js → index-7-1FmlHo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-CcsFv748.js → index-DuYcwYp_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-CPPVOSWB.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CTqLEAGU.js → loader-circle-BnDcD54R.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-717e346a.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-0wMU4KXe.js +93 -0
- package/codeyam-cli/src/webserver/build/client/assets/{pause-D6vreykR.js → pause-DhQX2g22.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-DqfSDjyQ.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-B8VUL8nl.js → search-DborVoKD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-BWunYSXt.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-CPoAg7Zo.js → simulations-BtrtCYJg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-BrCP7uQo.js → terminal-Bs4NC-VZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BZz2NjYa.js → triangle-alert-DTf3Jojp.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-DNwUduNu.js → useCustomSizes-D_bDZyDU.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-COky1GVF.js → useLastLogLine-DZp6rrQD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-CpZgwliL.js → useReportContext-BsQb6rFd.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-Bv9JFvUO.js → useToast-BOur3mUv.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/{index-DV1ykEI6.js → index-B8jmgmn2.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-9OU4lmvL.js +285 -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 +14 -14
- package/codeyam-cli/templates/{codeyam:memory.md → codeyam-memory.md} +16 -24
- package/codeyam-cli/templates/{codeyam:new-rule.md → codeyam-new-rule.md} +1 -3
- 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/hooks/staleness-check.sh +43 -0
- package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
- package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
- package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
- package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
- package/codeyam-cli/templates/rule-notification-hook.py +44 -17
- package/codeyam-cli/templates/rule-reflection-hook.py +88 -31
- package/codeyam-cli/templates/rules-instructions.md +45 -90
- package/package.json +12 -12
- package/packages/ai/index.js +1 -1
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +14 -0
- package/packages/ai/src/lib/analyzeScope.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/completionCall.js +0 -5
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +341 -10
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +59 -17
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructureChunking.js +30 -11
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +22 -3
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +97 -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/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/src/lib/asts/nodes/getNodeType.js +1 -0
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +11 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +42 -13
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +123 -67
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.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/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 +98 -3
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +8 -76
- package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -118
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
- package/codeyam-cli/src/commands/list.js +0 -31
- package/codeyam-cli/src/commands/list.js.map +0 -1
- package/codeyam-cli/src/commands/webapp-info.js +0 -146
- package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
- package/codeyam-cli/src/utils/universal-mocks.js +0 -152
- package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DfKzxuoe.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/globals-DoeDFXZN.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-CmBYA0PH.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-76786b8e.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-CrNQfdMO.js +0 -76
- package/codeyam-cli/src/webserver/build/client/assets/root-QAY34PIo.js +0 -62
- package/codeyam-cli/src/webserver/build/client/assets/settings-eBI36Yv5.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BrcVrUEv.js +0 -260
- package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
- package/codeyam-cli/templates/codeyam:diagnose.md +0 -805
- /package/codeyam-cli/src/webserver/build/client/assets/{api.labs-survey-l0sNRNKZ.js → api.rule-path-l0sNRNKZ.js} +0 -0
|
@@ -181,6 +181,7 @@ const SILENTLY_IGNORED_EQUIVALENCY_REASONS = new Set([
|
|
|
181
181
|
'transformed non-object function equivalency - implicit parent equivalency - rerouted via useCallback',
|
|
182
182
|
'transformed non-object function equivalency - Array.from() equivalency',
|
|
183
183
|
'Spread operator equivalency key update: Explicit array deconstruction equivalency value',
|
|
184
|
+
// 'transformed non-object function equivalency - Explicit array deconstruction equivalency value',
|
|
184
185
|
]);
|
|
185
186
|
export class ScopeDataStructure {
|
|
186
187
|
// Getter for backward compatibility - returns the tree structure
|
|
@@ -1925,6 +1926,8 @@ export class ScopeDataStructure {
|
|
|
1925
1926
|
return;
|
|
1926
1927
|
}
|
|
1927
1928
|
const usageScopeNode = this.getScopeOrFunctionCallInfo(usageEquivalency.scopeNodeName);
|
|
1929
|
+
if (!usageScopeNode)
|
|
1930
|
+
continue;
|
|
1928
1931
|
// Guard against infinite recursion by tracking which paths we've already
|
|
1929
1932
|
// added from addComplexSourcePathVariables
|
|
1930
1933
|
if (this.visitedTracker.checkAndMarkComplexSourceVisited(usageScopeNode.name, newUsageEquivalentPath)) {
|
|
@@ -1973,6 +1976,8 @@ export class ScopeDataStructure {
|
|
|
1973
1976
|
continue;
|
|
1974
1977
|
}
|
|
1975
1978
|
const usageScopeNode = this.getScopeOrFunctionCallInfo(usageEquivalency.scopeNodeName);
|
|
1979
|
+
if (!usageScopeNode)
|
|
1980
|
+
continue;
|
|
1976
1981
|
// This is put in place to avoid propagating array functions like 'filter' through complex equivalencies
|
|
1977
1982
|
// but may cause problems if the funtion call is not on a known object (e.g. string or array)
|
|
1978
1983
|
if (newUsageEquivalentPath.endsWith(')') ||
|
|
@@ -2301,6 +2306,21 @@ export class ScopeDataStructure {
|
|
|
2301
2306
|
* ensure all sub-paths of that variable are reflected under signature[N].
|
|
2302
2307
|
*/
|
|
2303
2308
|
propagateParameterToSignaturePaths(scopeNode) {
|
|
2309
|
+
// Helper: check if a type is a concrete scalar that cannot have sub-properties.
|
|
2310
|
+
const SCALAR_TYPES = new Set([
|
|
2311
|
+
'string',
|
|
2312
|
+
'number',
|
|
2313
|
+
'boolean',
|
|
2314
|
+
'bigint',
|
|
2315
|
+
'symbol',
|
|
2316
|
+
'void',
|
|
2317
|
+
'never',
|
|
2318
|
+
]);
|
|
2319
|
+
const isDefinitelyScalar = (type) => {
|
|
2320
|
+
const parts = type.split('|').map((s) => s.trim());
|
|
2321
|
+
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
2322
|
+
return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
|
|
2323
|
+
};
|
|
2304
2324
|
// Find variable → signature[N] equivalencies
|
|
2305
2325
|
for (const [varName, equivalencies] of Object.entries(scopeNode.equivalencies)) {
|
|
2306
2326
|
// Only process simple variable names (no dots, brackets, or parens)
|
|
@@ -2322,7 +2342,37 @@ export class ScopeDataStructure {
|
|
|
2322
2342
|
const sigKey = signaturePath + suffix;
|
|
2323
2343
|
// Only add if the signature path doesn't already exist
|
|
2324
2344
|
if (!scopeNode.schema[sigKey]) {
|
|
2325
|
-
|
|
2345
|
+
// Check if this path represents variable conflation:
|
|
2346
|
+
// When a standalone variable (e.g., showWorkoutForm from useState)
|
|
2347
|
+
// appears as a sub-property of a scalar-typed ancestor (e.g.,
|
|
2348
|
+
// activity_type = "string"), it's from scope conflation, not real
|
|
2349
|
+
// property access. Block these while allowing legitimate built-in
|
|
2350
|
+
// accesses like string.length or string.slice.
|
|
2351
|
+
let isConflatedPath = false;
|
|
2352
|
+
let checkPos = signaturePath.length;
|
|
2353
|
+
while (true) {
|
|
2354
|
+
checkPos = sigKey.indexOf('.', checkPos + 1);
|
|
2355
|
+
if (checkPos === -1)
|
|
2356
|
+
break;
|
|
2357
|
+
const ancestorPath = sigKey.substring(0, checkPos);
|
|
2358
|
+
const ancestorType = scopeNode.schema[ancestorPath];
|
|
2359
|
+
if (ancestorType && isDefinitelyScalar(ancestorType)) {
|
|
2360
|
+
// Ancestor is scalar — check if the immediate sub-property
|
|
2361
|
+
// is also a standalone variable (indicating conflation)
|
|
2362
|
+
const afterDot = sigKey.substring(checkPos + 1);
|
|
2363
|
+
const nextSep = afterDot.search(/[.\[]/);
|
|
2364
|
+
const subPropName = nextSep === -1
|
|
2365
|
+
? afterDot
|
|
2366
|
+
: afterDot.substring(0, nextSep);
|
|
2367
|
+
if (scopeNode.schema[subPropName] !== undefined) {
|
|
2368
|
+
isConflatedPath = true;
|
|
2369
|
+
break;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
if (!isConflatedPath) {
|
|
2374
|
+
scopeNode.schema[sigKey] = scopeNode.schema[key];
|
|
2375
|
+
}
|
|
2326
2376
|
}
|
|
2327
2377
|
}
|
|
2328
2378
|
}
|
|
@@ -2703,21 +2753,91 @@ export class ScopeDataStructure {
|
|
|
2703
2753
|
}
|
|
2704
2754
|
return [source];
|
|
2705
2755
|
};
|
|
2706
|
-
|
|
2756
|
+
const acc = entries.reduce((result, entry) => {
|
|
2707
2757
|
var _a;
|
|
2708
2758
|
if (entry.sourceCandidates.length === 0)
|
|
2709
|
-
return
|
|
2759
|
+
return result;
|
|
2710
2760
|
const usages = entry.usages.filter(usageMatchesScope);
|
|
2711
2761
|
for (const usage of usages) {
|
|
2712
|
-
|
|
2762
|
+
result[_a = usage.schemaPath] || (result[_a] = []);
|
|
2713
2763
|
// Resolve each source candidate through the equivalency chain
|
|
2714
2764
|
for (const source of entry.sourceCandidates) {
|
|
2715
2765
|
const resolvedSources = resolveToSignature(source, new Set());
|
|
2716
|
-
|
|
2766
|
+
result[usage.schemaPath].push(...resolvedSources);
|
|
2717
2767
|
}
|
|
2718
2768
|
}
|
|
2719
|
-
return
|
|
2769
|
+
return result;
|
|
2720
2770
|
}, {});
|
|
2771
|
+
// Post-processing: enrich useState-backed sources with co-located external
|
|
2772
|
+
// function calls. When a useState value resolves to a setter variable that
|
|
2773
|
+
// lives in the same scope as a fetch/API call, that fetch is a data source.
|
|
2774
|
+
this.enrichUseStateSourcesWithCoLocatedCalls(acc);
|
|
2775
|
+
return acc;
|
|
2776
|
+
}
|
|
2777
|
+
/**
|
|
2778
|
+
* For each source that ends at a useState path, check if the setter was called
|
|
2779
|
+
* from a scope that also contains external function calls (like fetch).
|
|
2780
|
+
* If so, add those external calls as additional source candidates.
|
|
2781
|
+
*/
|
|
2782
|
+
enrichUseStateSourcesWithCoLocatedCalls(acc) {
|
|
2783
|
+
const rootScopeName = this.scopeTreeManager.getRootName();
|
|
2784
|
+
const rootScope = this.scopeNodes[rootScopeName];
|
|
2785
|
+
if (!rootScope)
|
|
2786
|
+
return;
|
|
2787
|
+
// Collect all descendants for each scope node
|
|
2788
|
+
const getAllDescendants = (node) => {
|
|
2789
|
+
const names = new Set([node.name]);
|
|
2790
|
+
for (const child of node.children) {
|
|
2791
|
+
for (const name of getAllDescendants(child)) {
|
|
2792
|
+
names.add(name);
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
return names;
|
|
2796
|
+
};
|
|
2797
|
+
for (const [usagePath, sources] of Object.entries(acc)) {
|
|
2798
|
+
const additionalSources = [];
|
|
2799
|
+
for (const source of sources) {
|
|
2800
|
+
// Check if this source is a useState-related terminal path
|
|
2801
|
+
// (e.g., useState(X).functionCallReturnValue[1] or useState(X).signature[0])
|
|
2802
|
+
if (!source.schemaPath.match(/^useState\([^)]*\)\./))
|
|
2803
|
+
continue;
|
|
2804
|
+
// Find the useState call from the source path
|
|
2805
|
+
const useStateCallMatch = source.schemaPath.match(/^(useState\([^)]*\))\./);
|
|
2806
|
+
if (!useStateCallMatch)
|
|
2807
|
+
continue;
|
|
2808
|
+
const useStateCall = useStateCallMatch[1];
|
|
2809
|
+
// Look in the root scope for the useState value equivalency
|
|
2810
|
+
// which tells us where the setter was called from
|
|
2811
|
+
const valuePath = `${useStateCall}.functionCallReturnValue[0]`;
|
|
2812
|
+
const valueEquivs = rootScope.equivalencies[valuePath];
|
|
2813
|
+
if (!valueEquivs)
|
|
2814
|
+
continue;
|
|
2815
|
+
for (const equiv of valueEquivs) {
|
|
2816
|
+
// Find the scope where the setter was called
|
|
2817
|
+
const setterScopeName = equiv.scopeNodeName;
|
|
2818
|
+
const setterScopeTree = this.scopeTreeManager.findNode(setterScopeName);
|
|
2819
|
+
if (!setterScopeTree)
|
|
2820
|
+
continue;
|
|
2821
|
+
// Get all descendant scope names from the setter scope
|
|
2822
|
+
const relatedScopes = getAllDescendants(setterScopeTree);
|
|
2823
|
+
// Find external function calls in those scopes whose return values
|
|
2824
|
+
// are actually consumed (assigned to a variable). This excludes
|
|
2825
|
+
// fire-and-forget calls like analytics.track() or console.log().
|
|
2826
|
+
const coLocatedCalls = this.externalFunctionCalls.filter((efc) => relatedScopes.has(efc.callScope) &&
|
|
2827
|
+
efc.receivingVariableNames &&
|
|
2828
|
+
efc.receivingVariableNames.length > 0);
|
|
2829
|
+
for (const call of coLocatedCalls) {
|
|
2830
|
+
additionalSources.push({
|
|
2831
|
+
scopeNodeName: call.callScope,
|
|
2832
|
+
schemaPath: `${call.callSignature}.functionCallReturnValue`,
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
if (additionalSources.length > 0) {
|
|
2838
|
+
acc[usagePath].push(...additionalSources);
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2721
2841
|
}
|
|
2722
2842
|
getUsageEquivalencies(functionName) {
|
|
2723
2843
|
const scopeNode = this.getScopeOrFunctionCallInfo(functionName);
|
|
@@ -2825,6 +2945,23 @@ export class ScopeDataStructure {
|
|
|
2825
2945
|
}
|
|
2826
2946
|
}
|
|
2827
2947
|
}
|
|
2948
|
+
// Helper: check if a type is a concrete scalar that cannot have sub-properties.
|
|
2949
|
+
// e.g., "string", "number | undefined", "boolean | null" are scalar.
|
|
2950
|
+
// "object", "array", "function", "unknown", "Workout", etc. are NOT scalar.
|
|
2951
|
+
const SCALAR_TYPES = new Set([
|
|
2952
|
+
'string',
|
|
2953
|
+
'number',
|
|
2954
|
+
'boolean',
|
|
2955
|
+
'bigint',
|
|
2956
|
+
'symbol',
|
|
2957
|
+
'void',
|
|
2958
|
+
'never',
|
|
2959
|
+
]);
|
|
2960
|
+
const isDefinitelyScalarType = (type) => {
|
|
2961
|
+
const parts = type.split('|').map((s) => s.trim());
|
|
2962
|
+
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
2963
|
+
return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
|
|
2964
|
+
};
|
|
2828
2965
|
// Propagate nested paths from variables to their signature equivalents
|
|
2829
2966
|
// e.g., if workouts = signature[0].workouts, then workouts[].title becomes
|
|
2830
2967
|
// signature[0].workouts[].title
|
|
@@ -2844,7 +2981,67 @@ export class ScopeDataStructure {
|
|
|
2844
2981
|
const signatureKey = signaturePath + suffix;
|
|
2845
2982
|
// Add to schema if not already present
|
|
2846
2983
|
if (!tempScopeNode.schema[signatureKey]) {
|
|
2847
|
-
|
|
2984
|
+
// Check if this path represents variable conflation:
|
|
2985
|
+
// When a standalone variable (e.g., showWorkoutForm from useState)
|
|
2986
|
+
// appears as a sub-property of a scalar-typed ancestor (e.g.,
|
|
2987
|
+
// activity_type = "string"), it's from scope conflation, not real
|
|
2988
|
+
// property access. Block these while allowing legitimate built-in
|
|
2989
|
+
// accesses like string.length or string.slice.
|
|
2990
|
+
let isConflatedPath = false;
|
|
2991
|
+
let checkPos = signaturePath.length;
|
|
2992
|
+
while (true) {
|
|
2993
|
+
checkPos = signatureKey.indexOf('.', checkPos + 1);
|
|
2994
|
+
if (checkPos === -1)
|
|
2995
|
+
break;
|
|
2996
|
+
const ancestorPath = signatureKey.substring(0, checkPos);
|
|
2997
|
+
const ancestorType = tempScopeNode.schema[ancestorPath];
|
|
2998
|
+
if (ancestorType && isDefinitelyScalarType(ancestorType)) {
|
|
2999
|
+
// Ancestor is scalar — check if the immediate sub-property
|
|
3000
|
+
// is also a standalone variable (indicating conflation)
|
|
3001
|
+
const afterDot = signatureKey.substring(checkPos + 1);
|
|
3002
|
+
const nextSep = afterDot.search(/[.\[]/);
|
|
3003
|
+
const subPropName = nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
|
|
3004
|
+
if (schema[subPropName] !== undefined) {
|
|
3005
|
+
isConflatedPath = true;
|
|
3006
|
+
break;
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
if (!isConflatedPath) {
|
|
3011
|
+
tempScopeNode.schema[signatureKey] = schema[schemaKey];
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
// Post-process: filter out conflated signature paths.
|
|
3018
|
+
// During phase 2 scope analysis, useState(false) conflation can create
|
|
3019
|
+
// bad paths like signature[0].mockWorkouts[].activity_type.showWorkoutForm
|
|
3020
|
+
// directly in scopeNode.schema. These flow through signatureInSchema into
|
|
3021
|
+
// tempScopeNode.schema without any guard. Filter them out here by checking:
|
|
3022
|
+
// 1. An ancestor in the path has a concrete scalar type (string, number, boolean, etc.)
|
|
3023
|
+
// 2. The immediate sub-property of that scalar ancestor is also a standalone
|
|
3024
|
+
// variable in the schema (indicating conflation, not a real property access)
|
|
3025
|
+
for (const key of Object.keys(tempScopeNode.schema)) {
|
|
3026
|
+
if (!key.startsWith('signature['))
|
|
3027
|
+
continue;
|
|
3028
|
+
// Walk through the path looking for scalar-typed ancestors
|
|
3029
|
+
let pos = 0;
|
|
3030
|
+
while (true) {
|
|
3031
|
+
pos = key.indexOf('.', pos + 1);
|
|
3032
|
+
if (pos === -1)
|
|
3033
|
+
break;
|
|
3034
|
+
const ancestorPath = key.substring(0, pos);
|
|
3035
|
+
const ancestorType = tempScopeNode.schema[ancestorPath];
|
|
3036
|
+
if (ancestorType && isDefinitelyScalarType(ancestorType)) {
|
|
3037
|
+
// Found a scalar ancestor — check if the sub-property name
|
|
3038
|
+
// is a standalone variable in the getSchema() result
|
|
3039
|
+
const afterDot = key.substring(pos + 1);
|
|
3040
|
+
const nextSep = afterDot.search(/[.\[]/);
|
|
3041
|
+
const subPropName = nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
|
|
3042
|
+
if (schema[subPropName] !== undefined) {
|
|
3043
|
+
delete tempScopeNode.schema[key];
|
|
3044
|
+
break;
|
|
2848
3045
|
}
|
|
2849
3046
|
}
|
|
2850
3047
|
}
|
|
@@ -3114,6 +3311,13 @@ export class ScopeDataStructure {
|
|
|
3114
3311
|
!equivalentValue.schemaPath.startsWith('signature[') && // not a signature path
|
|
3115
3312
|
!equivalentValue.schemaPath.endsWith('.functionCallReturnValue') // not already handled above
|
|
3116
3313
|
) {
|
|
3314
|
+
// Skip bare "returnValue" from child scopes — this is the child's return value,
|
|
3315
|
+
// not a meaningful data source path in the parent scope
|
|
3316
|
+
if (equivalentValue.schemaPath === 'returnValue' &&
|
|
3317
|
+
equivalentValue.scopeNodeName !==
|
|
3318
|
+
this.scopeTreeManager.getRootName()) {
|
|
3319
|
+
continue;
|
|
3320
|
+
}
|
|
3117
3321
|
// Add equivalency (will accumulate if multiple values for OR expressions)
|
|
3118
3322
|
addEquivalency(path, equivalentValue.schemaPath);
|
|
3119
3323
|
}
|
|
@@ -3452,7 +3656,95 @@ export class ScopeDataStructure {
|
|
|
3452
3656
|
// Replace cyScope placeholders in all external function call data
|
|
3453
3657
|
// This ensures call signatures and schema paths use actual callback text
|
|
3454
3658
|
// instead of internal cyScope names, preventing mock data merge conflicts.
|
|
3455
|
-
|
|
3659
|
+
const rootScopeName = this.scopeTreeManager.getRootName();
|
|
3660
|
+
const rootSchema = this.scopeNodes[rootScopeName]?.schema ?? {};
|
|
3661
|
+
return this.externalFunctionCalls.map((efc) => {
|
|
3662
|
+
const cleaned = this.cleanCyScopeFromFunctionCallInfo(efc);
|
|
3663
|
+
return this.filterConflatedExternalPaths(cleaned, rootSchema);
|
|
3664
|
+
});
|
|
3665
|
+
}
|
|
3666
|
+
/**
|
|
3667
|
+
* Filters out conflated paths from external function call schemas.
|
|
3668
|
+
*
|
|
3669
|
+
* When multiple useState(false) calls create equivalency conflation during
|
|
3670
|
+
* Phase 1 analysis, standalone boolean state variables (like showWorkoutForm,
|
|
3671
|
+
* showGoalForm) can bleed into external function call schemas as sub-properties
|
|
3672
|
+
* of unrelated data fields (like data[].activity_type.showWorkoutForm).
|
|
3673
|
+
*
|
|
3674
|
+
* Detection: group sub-properties by parent path. If 2+ sub-properties of
|
|
3675
|
+
* the same parent all match standalone root scope variable names, treat them
|
|
3676
|
+
* as conflation artifacts and remove them.
|
|
3677
|
+
*/
|
|
3678
|
+
filterConflatedExternalPaths(efc, rootSchema) {
|
|
3679
|
+
// Build a set of top-level root scope variable names (simple names, no dots/brackets)
|
|
3680
|
+
const topLevelRootVars = new Set();
|
|
3681
|
+
for (const key of Object.keys(rootSchema)) {
|
|
3682
|
+
if (!key.includes('.') && !key.includes('[')) {
|
|
3683
|
+
topLevelRootVars.add(key);
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
if (topLevelRootVars.size === 0)
|
|
3687
|
+
return efc;
|
|
3688
|
+
// Group sub-property matches by their parent path.
|
|
3689
|
+
// For a path like "...data[].activity_type.showWorkoutForm",
|
|
3690
|
+
// parent = "...data[].activity_type", child = "showWorkoutForm"
|
|
3691
|
+
const parentToConflatedKeys = new Map();
|
|
3692
|
+
for (const key of Object.keys(efc.schema)) {
|
|
3693
|
+
const lastDot = key.lastIndexOf('.');
|
|
3694
|
+
if (lastDot === -1)
|
|
3695
|
+
continue;
|
|
3696
|
+
const parent = key.substring(0, lastDot);
|
|
3697
|
+
const child = key.substring(lastDot + 1);
|
|
3698
|
+
// Skip array access or function call patterns
|
|
3699
|
+
if (child.includes('[') || child.includes('('))
|
|
3700
|
+
continue;
|
|
3701
|
+
// Only consider paths inside array element chains (contains []).
|
|
3702
|
+
// Direct children of functionCallReturnValue are legitimate destructured
|
|
3703
|
+
// return values, not conflation. Conflation happens deeper in the chain
|
|
3704
|
+
// when array element fields get corrupted sub-properties.
|
|
3705
|
+
if (!parent.includes('['))
|
|
3706
|
+
continue;
|
|
3707
|
+
if (topLevelRootVars.has(child)) {
|
|
3708
|
+
if (!parentToConflatedKeys.has(parent)) {
|
|
3709
|
+
parentToConflatedKeys.set(parent, []);
|
|
3710
|
+
}
|
|
3711
|
+
parentToConflatedKeys.get(parent).push(key);
|
|
3712
|
+
}
|
|
3713
|
+
}
|
|
3714
|
+
// Only filter when 2+ sub-properties of the same parent match root scope vars.
|
|
3715
|
+
// This threshold avoids false positives from coincidental name matches.
|
|
3716
|
+
const keysToRemove = new Set();
|
|
3717
|
+
const parentsToRestore = new Set();
|
|
3718
|
+
for (const [parent, conflatedKeys] of parentToConflatedKeys) {
|
|
3719
|
+
if (conflatedKeys.length >= 2) {
|
|
3720
|
+
for (const key of conflatedKeys) {
|
|
3721
|
+
keysToRemove.add(key);
|
|
3722
|
+
}
|
|
3723
|
+
parentsToRestore.add(parent);
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
if (keysToRemove.size === 0)
|
|
3727
|
+
return efc;
|
|
3728
|
+
// Create a new schema without the conflated paths
|
|
3729
|
+
const newSchema = {};
|
|
3730
|
+
for (const [key, value] of Object.entries(efc.schema)) {
|
|
3731
|
+
if (keysToRemove.has(key))
|
|
3732
|
+
continue;
|
|
3733
|
+
// Restore parent type: if it was changed to "object" because of conflated
|
|
3734
|
+
// sub-properties, and now all those sub-properties are removed, change it
|
|
3735
|
+
// back to "unknown" (we don't know the original type)
|
|
3736
|
+
if (parentsToRestore.has(key) && value === 'object') {
|
|
3737
|
+
// Check if there are any remaining sub-properties
|
|
3738
|
+
const hasRemainingSubProps = Object.keys(efc.schema).some((k) => !keysToRemove.has(k) &&
|
|
3739
|
+
k !== key &&
|
|
3740
|
+
(k.startsWith(key + '.') || k.startsWith(key + '[')));
|
|
3741
|
+
newSchema[key] = hasRemainingSubProps ? value : 'unknown';
|
|
3742
|
+
}
|
|
3743
|
+
else {
|
|
3744
|
+
newSchema[key] = value;
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
return { ...efc, schema: newSchema };
|
|
3456
3748
|
}
|
|
3457
3749
|
/**
|
|
3458
3750
|
* Cleans cyScope placeholder references from a FunctionCallInfo.
|
|
@@ -3673,6 +3965,7 @@ export class ScopeDataStructure {
|
|
|
3673
3965
|
*/
|
|
3674
3966
|
getEnrichedConditionalUsages() {
|
|
3675
3967
|
const enriched = {};
|
|
3968
|
+
console.log(`[getEnrichedConditionalUsages] Processing ${Object.keys(this.rawConditionalUsages).length} conditional paths: [${Object.keys(this.rawConditionalUsages).join(', ')}]`);
|
|
3676
3969
|
for (const [path, usages] of Object.entries(this.rawConditionalUsages)) {
|
|
3677
3970
|
// Try to trace this path back to a data source
|
|
3678
3971
|
// First, try the root scope
|
|
@@ -3680,9 +3973,47 @@ export class ScopeDataStructure {
|
|
|
3680
3973
|
const explanation = this.explainPath(rootScopeName, path);
|
|
3681
3974
|
let sourceDataPath;
|
|
3682
3975
|
if (explanation.source) {
|
|
3683
|
-
|
|
3684
|
-
|
|
3976
|
+
const { scope, path: sourcePath } = explanation.source;
|
|
3977
|
+
// Build initial path — avoid redundant prefix when path already contains the scope call
|
|
3978
|
+
let fullPath;
|
|
3979
|
+
if (sourcePath.startsWith(`${scope}(`)) {
|
|
3980
|
+
fullPath = sourcePath;
|
|
3981
|
+
}
|
|
3982
|
+
else {
|
|
3983
|
+
fullPath = `${scope}.${sourcePath}`;
|
|
3984
|
+
}
|
|
3985
|
+
sourceDataPath = fullPath;
|
|
3986
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" explainPath → scope="${scope}", sourcePath="${sourcePath}" → sourceDataPath="${sourceDataPath}"`);
|
|
3987
|
+
}
|
|
3988
|
+
else {
|
|
3989
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" explainPath → no source found`);
|
|
3990
|
+
}
|
|
3991
|
+
// If explainPath didn't find a useful external source (e.g., it traced to
|
|
3992
|
+
// useState or just to the component scope itself), check sourceEquivalencies
|
|
3993
|
+
// for an external function call source like a fetch call
|
|
3994
|
+
const hasExternalSource = sourceDataPath?.includes('.functionCallReturnValue');
|
|
3995
|
+
if (!hasExternalSource) {
|
|
3996
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" no external source (sourceDataPath="${sourceDataPath}"), checking sourceEquivalencies fallback...`);
|
|
3997
|
+
const sourceEquiv = this.getSourceEquivalencies();
|
|
3998
|
+
const returnValueKey = `returnValue.${path}`;
|
|
3999
|
+
const sources = sourceEquiv[returnValueKey];
|
|
4000
|
+
if (sources) {
|
|
4001
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies["${returnValueKey}"] has ${sources.length} sources: [${sources.map((s) => s.schemaPath).join(', ')}]`);
|
|
4002
|
+
const externalSource = sources.find((s) => s.schemaPath.includes('.functionCallReturnValue') &&
|
|
4003
|
+
!s.schemaPath.startsWith('useState('));
|
|
4004
|
+
if (externalSource) {
|
|
4005
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies fallback found external source: "${externalSource.schemaPath}"`);
|
|
4006
|
+
sourceDataPath = externalSource.schemaPath;
|
|
4007
|
+
}
|
|
4008
|
+
else {
|
|
4009
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies fallback found no external function call source`);
|
|
4010
|
+
}
|
|
4011
|
+
}
|
|
4012
|
+
else {
|
|
4013
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies["${returnValueKey}"] not found`);
|
|
4014
|
+
}
|
|
3685
4015
|
}
|
|
4016
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" FINAL sourceDataPath="${sourceDataPath ?? '(none)'}" (${usages.length} usages)`);
|
|
3686
4017
|
enriched[path] = usages.map((usage) => ({
|
|
3687
4018
|
...usage,
|
|
3688
4019
|
sourceDataPath,
|