@codeyam/codeyam-cli 0.1.0-staging.1669d45 → 0.1.0-staging.323686
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +8 -8
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +3 -3
- package/analyzer-template/packages/ai/index.ts +9 -1
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +48 -34
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +31 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +139 -23
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +6 -126
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +277 -8
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +73 -1
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +198 -34
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +108 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +205 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +23 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +87 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +32 -7
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -0
- package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
- package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +626 -6
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +26 -1
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +375 -6
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1003 -45
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +23 -6
- package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +154 -32
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +22 -1
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
- package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +10 -13
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -7
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +142 -73
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +42 -5
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +77 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
- package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
- package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
- package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
- package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +8 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +25 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +51 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/types/index.ts +1 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +25 -0
- package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +64 -1
- package/analyzer-template/packages/utils/dist/types/index.d.ts +1 -1
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +25 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +51 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
- package/analyzer-template/playwright/capture.ts +20 -8
- package/analyzer-template/playwright/captureStatic.ts +1 -1
- package/analyzer-template/project/analyzeBaselineCommit.ts +5 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +5 -0
- package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
- package/analyzer-template/project/constructMockCode.ts +314 -29
- package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
- package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
- package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
- package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
- package/analyzer-template/project/orchestrateCapture.ts +71 -6
- package/analyzer-template/project/reconcileMockDataKeys.ts +152 -9
- package/analyzer-template/project/runAnalysis.ts +4 -0
- package/analyzer-template/project/start.ts +35 -11
- package/analyzer-template/project/writeMockDataTsx.ts +114 -2
- package/analyzer-template/project/writeScenarioComponents.ts +101 -8
- package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +5 -0
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js +5 -0
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +255 -4
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +7 -5
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +58 -6
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +126 -9
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +3 -0
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +32 -11
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +89 -2
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +57 -8
- package/background/src/lib/virtualized/project/writeScenarioComponents.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/commands/memory.js +273 -0
- package/codeyam-cli/src/commands/memory.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +4 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +21 -2
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +20 -6
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +1 -0
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +6 -0
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/rules/index.js +5 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -0
- package/codeyam-cli/src/utils/rules/parser.js +106 -0
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +132 -0
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +2 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +7 -3
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +40 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-DsN1wKrm.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-COi5OvsN.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BwdQv49w.js → EntityTypeIcon-Ba2JVPzP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-CEleMv_j.js → InlineSpinner-C8lyxW9k.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-D68KarMg.js → InteractivePreview-aht4aafF.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-L75Wvqgw.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-C53WM8qn.js → LoadingDots-B0GLXMsr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CrNkmy4i.js → LogViewer-xgeCVgSM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-OApQuNyq.js +16 -0
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CQifa1n-.js → SafeScreenshot-DuDvi0jm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CyaBFX7l.js → ScenarioViewer-DzccYyI8.js} +3 -13
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-D36O1rzU.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-BwqWJOgH.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BwavGCpm.js +32 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-DgTPh8H-.js → chevron-down-Cx24_aWc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-DdQKK6on.js → chunk-EPOLDU6W-CXRTFQ3F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-Dmr2bb1R.js → circle-check-BOARzkeR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-Do4ZLUYa.js → createLucideIcon-BdhJEx6B.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BBnGWYga.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CbdFyxZh.js → entity._sha._-BJUiQqZF.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-B4iCfs5M.js → entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-wDWZZO1W.js → entity._sha_.create-scenario-D1T4TGjf.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMbl7MeQ.js → entity._sha_.edit._scenarioId-CTBG2mmz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-5wRKRIH9.js → entry.client-CS2cb_eZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DD3SDH7t.js → fileTableUtils-DMJ7zii9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-CJ6lTdTA.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{git-zXjT7J0G.js → git-CPTZZ-JZ.js} +8 -8
- package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-DLbXwndH.js → index-B1h680n5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-gPZ-lad1.js → index-lzqtyFU8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BsPXJ81F.js → loader-circle-B7B9V-bu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-7522edd4.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-yxFcrxBX.js +92 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-eVAaavTS.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-P2FKIUql.js → search-CxXUmBSd.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{settings-B2eDuBj8.js → settings-CS5f3WzT.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-L18M6-kN.js → simulations-DwFIBT09.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BDz7kbVA.js → triangle-alert-B6LgvRJg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-29dDmbH8.js → useCustomSizes-C1v1PQzo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BUm0UVJm.js → useLastLogLine-aSv48UbS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-CkIOKTrZ.js → useReportContext-DYxHZQuP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-KKw5kTn-.js → useToast-mBRpZPiu.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-DVzYx8PN.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-4Cr0uToj.js +257 -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-memory-hook.sh +200 -0
- package/codeyam-cli/templates/codeyam:debug.md +47 -3
- package/codeyam-cli/templates/codeyam:diagnose.md +203 -25
- package/codeyam-cli/templates/codeyam:memory.md +462 -0
- package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
- package/package.json +8 -5
- package/packages/ai/index.js +5 -2
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +41 -17
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +24 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +109 -23
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +1 -102
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +228 -11
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +161 -30
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +86 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +179 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +19 -0
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +70 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +29 -7
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructureChunking.js +111 -0
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
- package/packages/ai/src/lib/e2eDataTracking.js +241 -0
- package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
- package/packages/ai/src/lib/generateEntityScenarioData.js +510 -7
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +19 -1
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +273 -4
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +738 -40
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +15 -7
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
- package/packages/ai/src/lib/resolvePathToControllable.js +131 -27
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +7 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/src/lib/analysisContext.js +30 -5
- package/packages/analyze/src/lib/analysisContext.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +8 -4
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -7
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +116 -66
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +37 -5
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +65 -0
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +8 -1
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- package/packages/database/src/lib/loadAnalyses.js +45 -2
- package/packages/database/src/lib/loadAnalyses.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +8 -0
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadBranch.js +11 -1
- package/packages/database/src/lib/loadBranch.js.map +1 -1
- package/packages/database/src/lib/loadCommit.js +7 -0
- package/packages/database/src/lib/loadCommit.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +22 -1
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +23 -4
- package/packages/database/src/lib/loadEntities.js.map +1 -1
- package/packages/database/src/lib/loadEntityBranches.js +9 -0
- package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
- package/packages/database/src/lib/updateCommitMetadata.js +5 -4
- package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/packages/types/index.js.map +1 -1
- package/packages/utils/src/lib/safeFileName.js +29 -3
- package/packages/utils/src/lib/safeFileName.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-vauWK972.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DzJRkCkr.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/_index-Be83mo_j.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BN6wu6Y-.js +0 -37
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Bn6aCAy_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-DKyMFI90.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-DTTQ3gY7.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-22590fcf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-BsAarjAM.js +0 -57
- package/codeyam-cli/src/webserver/build/server/assets/index-BND5I5fv.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-CFXnd7MG.js +0 -228
|
@@ -139,6 +139,96 @@ export class ArrayFilterSemantics implements MethodSemantics {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Array some method semantics
|
|
144
|
+
*
|
|
145
|
+
* some() returns true if at least one element passes the test, false otherwise
|
|
146
|
+
* The callback receives array elements to test
|
|
147
|
+
*/
|
|
148
|
+
export class ArraySomeSemantics implements MethodSemantics {
|
|
149
|
+
getReturnType(): string {
|
|
150
|
+
return 'boolean';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
addEquivalences(
|
|
154
|
+
methodCallPath: StructuredPath,
|
|
155
|
+
sourcePath: StructuredPath,
|
|
156
|
+
context: AnalysisContext,
|
|
157
|
+
): void {
|
|
158
|
+
// Mark source as array
|
|
159
|
+
context.addType(sourcePath, 'array');
|
|
160
|
+
|
|
161
|
+
// Mark return as boolean
|
|
162
|
+
context.addType(methodCallPath, 'boolean');
|
|
163
|
+
|
|
164
|
+
// Get the last function call segment to access the arguments
|
|
165
|
+
const lastFunctionCallSegment = methodCallPath.getLastFunctionCallSegment();
|
|
166
|
+
|
|
167
|
+
if (lastFunctionCallSegment && lastFunctionCallSegment.args.length > 0) {
|
|
168
|
+
// The first argument is the callback
|
|
169
|
+
const callbackPath = lastFunctionCallSegment.args[0];
|
|
170
|
+
|
|
171
|
+
// Add the callback to the structure
|
|
172
|
+
context.addType(callbackPath, 'function');
|
|
173
|
+
|
|
174
|
+
// Mark that the callback's first parameter receives array elements
|
|
175
|
+
context.addEquivalence(
|
|
176
|
+
callbackPath.withParameter(0),
|
|
177
|
+
sourcePath.withElement('*'),
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
isComplete(): boolean {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Array every method semantics
|
|
189
|
+
*
|
|
190
|
+
* every() returns true if all elements pass the test, false otherwise
|
|
191
|
+
* The callback receives array elements to test
|
|
192
|
+
*/
|
|
193
|
+
export class ArrayEverySemantics implements MethodSemantics {
|
|
194
|
+
getReturnType(): string {
|
|
195
|
+
return 'boolean';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
addEquivalences(
|
|
199
|
+
methodCallPath: StructuredPath,
|
|
200
|
+
sourcePath: StructuredPath,
|
|
201
|
+
context: AnalysisContext,
|
|
202
|
+
): void {
|
|
203
|
+
// Mark source as array
|
|
204
|
+
context.addType(sourcePath, 'array');
|
|
205
|
+
|
|
206
|
+
// Mark return as boolean
|
|
207
|
+
context.addType(methodCallPath, 'boolean');
|
|
208
|
+
|
|
209
|
+
// Get the last function call segment to access the arguments
|
|
210
|
+
const lastFunctionCallSegment = methodCallPath.getLastFunctionCallSegment();
|
|
211
|
+
|
|
212
|
+
if (lastFunctionCallSegment && lastFunctionCallSegment.args.length > 0) {
|
|
213
|
+
// The first argument is the callback
|
|
214
|
+
const callbackPath = lastFunctionCallSegment.args[0];
|
|
215
|
+
|
|
216
|
+
// Add the callback to the structure
|
|
217
|
+
context.addType(callbackPath, 'function');
|
|
218
|
+
|
|
219
|
+
// Mark that the callback's first parameter receives array elements
|
|
220
|
+
context.addEquivalence(
|
|
221
|
+
callbackPath.withParameter(0),
|
|
222
|
+
sourcePath.withElement('*'),
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
isComplete(): boolean {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
142
232
|
/**
|
|
143
233
|
* Array find method semantics
|
|
144
234
|
*
|
|
@@ -173,12 +263,12 @@ export class ArrayFindSemantics implements MethodSemantics {
|
|
|
173
263
|
sourcePath.withElement('*'),
|
|
174
264
|
);
|
|
175
265
|
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
//
|
|
266
|
+
// NOTE: We intentionally do NOT create an equivalency from the find result
|
|
267
|
+
// to the array element here. While semantically correct (find returns an element),
|
|
268
|
+
// doing so causes type inference issues where the array element gets typed as
|
|
269
|
+
// 'function' instead of 'object'. The tracing back to source arrays happens
|
|
270
|
+
// through the || operator processing and null guard in addEquivalence.
|
|
271
|
+
// See: analyzeScopeNoAI1.test.ts for tests that break if this is uncommented.
|
|
182
272
|
// context.addEquivalence(methodCallPath, sourcePath.withElement('*'));
|
|
183
273
|
}
|
|
184
274
|
}
|
|
@@ -239,11 +329,17 @@ export class ArrayReduceSemantics implements MethodSemantics {
|
|
|
239
329
|
/**
|
|
240
330
|
* Array concat method semantics
|
|
241
331
|
*
|
|
242
|
-
* concat() returns a new array combining the original
|
|
332
|
+
* concat() returns a new array/string combining the original and additional items
|
|
333
|
+
*
|
|
334
|
+
* NOTE: We intentionally do NOT type the source as 'array' here because
|
|
335
|
+
* .concat() exists on both arrays AND strings. Typing the source prematurely
|
|
336
|
+
* causes type contamination when the source is equivalent to other paths
|
|
337
|
+
* via ?? chains. Type inference happens later in checkIfKnownType() based
|
|
338
|
+
* on accumulated evidence from all methods called on a path.
|
|
243
339
|
*/
|
|
244
340
|
export class ArrayConcatSemantics implements MethodSemantics {
|
|
245
341
|
getReturnType(): string {
|
|
246
|
-
return '
|
|
342
|
+
return 'unknown'; // Could be array or string depending on source
|
|
247
343
|
}
|
|
248
344
|
|
|
249
345
|
addEquivalences(
|
|
@@ -251,23 +347,24 @@ export class ArrayConcatSemantics implements MethodSemantics {
|
|
|
251
347
|
sourcePath: StructuredPath,
|
|
252
348
|
context: AnalysisContext,
|
|
253
349
|
): void {
|
|
254
|
-
//
|
|
255
|
-
|
|
350
|
+
// NOTE: We use 'unknown' instead of 'array' for the source because .concat()
|
|
351
|
+
// exists on both arrays AND strings. Using 'array' causes type contamination
|
|
352
|
+
// when the source is equivalent to other paths via ?? chains.
|
|
353
|
+
context.addType(sourcePath, 'unknown');
|
|
256
354
|
|
|
257
|
-
// Any arguments are also added to the
|
|
355
|
+
// Any arguments are also added to the result
|
|
258
356
|
const functionCallSegment = methodCallPath.getLastFunctionCallSegment();
|
|
259
357
|
|
|
260
358
|
if (functionCallSegment) {
|
|
261
359
|
// Each argument could be an array or single element
|
|
262
360
|
functionCallSegment.args.forEach((argPath) => {
|
|
263
361
|
// No need to guess the type - we'll discover it through normal processing
|
|
264
|
-
// But we can indicate that these elements will be in the result
|
|
362
|
+
// But we can indicate that these elements will be in the result
|
|
265
363
|
context.addEquivalence(methodCallPath, argPath);
|
|
266
364
|
});
|
|
267
365
|
}
|
|
268
366
|
|
|
269
|
-
// The original
|
|
270
|
-
context.addType(methodCallPath, 'array');
|
|
367
|
+
// The original elements are also in the result
|
|
271
368
|
context.addEquivalence(methodCallPath, sourcePath.withElement('*'));
|
|
272
369
|
}
|
|
273
370
|
|
|
@@ -279,11 +376,17 @@ export class ArrayConcatSemantics implements MethodSemantics {
|
|
|
279
376
|
/**
|
|
280
377
|
* Array slice method semantics
|
|
281
378
|
*
|
|
282
|
-
* slice() returns a shallow copy of a portion of an array
|
|
379
|
+
* slice() returns a shallow copy of a portion of an array (or string)
|
|
380
|
+
*
|
|
381
|
+
* NOTE: We intentionally do NOT type the source as 'array' here because
|
|
382
|
+
* .slice() exists on both arrays AND strings. Typing the source prematurely
|
|
383
|
+
* causes type contamination when the source is equivalent to other paths
|
|
384
|
+
* via ?? chains. Type inference happens later in checkIfKnownType() based
|
|
385
|
+
* on accumulated evidence from all methods called on a path.
|
|
283
386
|
*/
|
|
284
387
|
export class ArraySliceSemantics implements MethodSemantics {
|
|
285
388
|
getReturnType(): string {
|
|
286
|
-
return '
|
|
389
|
+
return 'unknown'; // Could be array or string depending on source
|
|
287
390
|
}
|
|
288
391
|
|
|
289
392
|
addEquivalences(
|
|
@@ -291,12 +394,15 @@ export class ArraySliceSemantics implements MethodSemantics {
|
|
|
291
394
|
sourcePath: StructuredPath,
|
|
292
395
|
context: AnalysisContext,
|
|
293
396
|
): void {
|
|
294
|
-
//
|
|
295
|
-
|
|
397
|
+
// NOTE: We use 'unknown' instead of 'array' for the source because .slice()
|
|
398
|
+
// exists on both arrays AND strings. Using 'array' causes type contamination
|
|
399
|
+
// when the source is equivalent to other paths via ?? chains.
|
|
400
|
+
// Type inference happens later in checkIfKnownType() based on accumulated evidence.
|
|
401
|
+
context.addType(sourcePath, 'unknown');
|
|
296
402
|
|
|
297
|
-
//
|
|
403
|
+
// Still track the return value type for data structure tracking
|
|
298
404
|
const methodCallPathWithReturnValues = methodCallPath.withReturnValues();
|
|
299
|
-
context.addType(methodCallPathWithReturnValues, '
|
|
405
|
+
context.addType(methodCallPathWithReturnValues, 'unknown');
|
|
300
406
|
}
|
|
301
407
|
|
|
302
408
|
isComplete(): boolean {
|
|
@@ -518,6 +624,12 @@ export class ArrayFlatMapSemantics implements MethodSemantics {
|
|
|
518
624
|
* Array at method semantics
|
|
519
625
|
*
|
|
520
626
|
* at() returns the element at the given index, supporting negative indices
|
|
627
|
+
*
|
|
628
|
+
* NOTE: We intentionally do NOT type the source as 'array' here because
|
|
629
|
+
* .at() exists on both arrays AND strings. Typing the source prematurely
|
|
630
|
+
* causes type contamination when the source is equivalent to other paths
|
|
631
|
+
* via ?? chains. Type inference happens later in checkIfKnownType() based
|
|
632
|
+
* on accumulated evidence from all methods called on a path.
|
|
521
633
|
*/
|
|
522
634
|
export class ArrayAtSemantics implements MethodSemantics {
|
|
523
635
|
getReturnType(): string {
|
|
@@ -529,10 +641,12 @@ export class ArrayAtSemantics implements MethodSemantics {
|
|
|
529
641
|
sourcePath: StructuredPath,
|
|
530
642
|
context: AnalysisContext,
|
|
531
643
|
): void {
|
|
532
|
-
//
|
|
533
|
-
|
|
644
|
+
// NOTE: We use 'unknown' instead of 'array' for the source because .at()
|
|
645
|
+
// exists on both arrays AND strings. Using 'array' causes type contamination
|
|
646
|
+
// when the source is equivalent to other paths via ?? chains.
|
|
647
|
+
context.addType(sourcePath, 'unknown');
|
|
534
648
|
|
|
535
|
-
// The return value is equivalent to an
|
|
649
|
+
// The return value is equivalent to an element
|
|
536
650
|
context.addEquivalence(
|
|
537
651
|
methodCallPath.withReturnValues(),
|
|
538
652
|
sourcePath.withElement('*'),
|
|
@@ -800,6 +914,8 @@ export function createMethodRegistry(): MethodSemanticsRegistry {
|
|
|
800
914
|
registry.register('slice', new ArraySliceSemantics(), 'Array');
|
|
801
915
|
registry.register('splice', new ArraySpliceSemantics(), 'Array');
|
|
802
916
|
registry.register('push', new ArrayPushSemantics(), 'Array');
|
|
917
|
+
registry.register('some', new ArraySomeSemantics(), 'Array');
|
|
918
|
+
registry.register('every', new ArrayEverySemantics(), 'Array');
|
|
803
919
|
|
|
804
920
|
// Register Object methods
|
|
805
921
|
registry.register('fromEntries', new ObjectFromEntriesSemantics(), 'Object');
|
package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts
CHANGED
|
@@ -3,131 +3,10 @@ import { AnalysisContext } from '../types';
|
|
|
3
3
|
import { PatternHandler } from './patternHandler';
|
|
4
4
|
import { StructuredPath } from '../paths';
|
|
5
5
|
import { processBindingPattern } from '../processBindings';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
function getSimplePath(node: ts.Expression): string | null {
|
|
12
|
-
if (ts.isIdentifier(node)) {
|
|
13
|
-
return node.text;
|
|
14
|
-
}
|
|
15
|
-
if (ts.isPropertyAccessExpression(node)) {
|
|
16
|
-
const objectPath = getSimplePath(node.expression);
|
|
17
|
-
if (objectPath) {
|
|
18
|
-
return `${objectPath}.${node.name.text}`;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
// Handle optional chaining: a?.b
|
|
22
|
-
if (ts.isNonNullExpression(node)) {
|
|
23
|
-
return getSimplePath(node.expression);
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Array methods that return boolean predicates */
|
|
29
|
-
const ARRAY_PREDICATE_METHODS = ['includes', 'some', 'every'] as const;
|
|
30
|
-
type ArrayPredicateMethod = (typeof ARRAY_PREDICATE_METHODS)[number];
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Maps array method names to derivation operation names
|
|
34
|
-
*/
|
|
35
|
-
function getArrayPredicateOperation(
|
|
36
|
-
methodName: string,
|
|
37
|
-
): 'arrayIncludes' | 'arraySome' | 'arrayEvery' | null {
|
|
38
|
-
switch (methodName) {
|
|
39
|
-
case 'includes':
|
|
40
|
-
return 'arrayIncludes';
|
|
41
|
-
case 'some':
|
|
42
|
-
return 'arraySome';
|
|
43
|
-
case 'every':
|
|
44
|
-
return 'arrayEvery';
|
|
45
|
-
default:
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Detects if an expression is an array predicate call and extracts the array path.
|
|
52
|
-
* Patterns detected:
|
|
53
|
-
* - arr.includes(x) → { sourcePath: 'arr', operation: 'arrayIncludes' }
|
|
54
|
-
* - arr?.includes(x) → { sourcePath: 'arr', operation: 'arrayIncludes' }
|
|
55
|
-
* - arr.some(fn) → { sourcePath: 'arr', operation: 'arraySome' }
|
|
56
|
-
* - arr.every(fn) → { sourcePath: 'arr', operation: 'arrayEvery' }
|
|
57
|
-
* - Boolean(x && arr?.includes(y)) → { sourcePath: 'arr', operation: 'arrayIncludes' }
|
|
58
|
-
*/
|
|
59
|
-
function detectArrayPredicatePattern(expr: ts.Expression): {
|
|
60
|
-
sourcePath: string;
|
|
61
|
-
operation: 'arrayIncludes' | 'arraySome' | 'arrayEvery';
|
|
62
|
-
} | null {
|
|
63
|
-
// Unwrap Boolean() calls: Boolean(x) → x
|
|
64
|
-
if (
|
|
65
|
-
ts.isCallExpression(expr) &&
|
|
66
|
-
ts.isIdentifier(expr.expression) &&
|
|
67
|
-
expr.expression.text === 'Boolean' &&
|
|
68
|
-
expr.arguments.length === 1
|
|
69
|
-
) {
|
|
70
|
-
return detectArrayPredicatePattern(expr.arguments[0]);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Handle logical AND: a && b - check both sides for array predicates
|
|
74
|
-
if (
|
|
75
|
-
ts.isBinaryExpression(expr) &&
|
|
76
|
-
expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
|
|
77
|
-
) {
|
|
78
|
-
// Try the right side first (more likely to have the predicate)
|
|
79
|
-
const rightResult = detectArrayPredicatePattern(expr.right);
|
|
80
|
-
if (rightResult) return rightResult;
|
|
81
|
-
// Try the left side
|
|
82
|
-
const leftResult = detectArrayPredicatePattern(expr.left);
|
|
83
|
-
if (leftResult) return leftResult;
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Handle parenthesized expressions
|
|
88
|
-
if (ts.isParenthesizedExpression(expr)) {
|
|
89
|
-
return detectArrayPredicatePattern(expr.expression);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (!ts.isCallExpression(expr)) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const callExpr = expr.expression;
|
|
97
|
-
|
|
98
|
-
// Handle both regular property access (arr.includes) and optional chaining (arr?.includes)
|
|
99
|
-
let objectExpr: ts.Expression | null = null;
|
|
100
|
-
let methodName: string | null = null;
|
|
101
|
-
|
|
102
|
-
if (ts.isPropertyAccessExpression(callExpr)) {
|
|
103
|
-
objectExpr = callExpr.expression;
|
|
104
|
-
methodName = callExpr.name.text;
|
|
105
|
-
} else if (
|
|
106
|
-
ts.isElementAccessExpression(callExpr) &&
|
|
107
|
-
ts.isStringLiteral(callExpr.argumentExpression)
|
|
108
|
-
) {
|
|
109
|
-
// Handle arr["includes"]() syntax (rare but possible)
|
|
110
|
-
objectExpr = callExpr.expression;
|
|
111
|
-
methodName = callExpr.argumentExpression.text;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (!objectExpr || !methodName) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const operation = getArrayPredicateOperation(methodName);
|
|
119
|
-
if (!operation) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Get the source path for the array
|
|
124
|
-
const sourcePath = getSimplePath(objectExpr);
|
|
125
|
-
if (!sourcePath) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return { sourcePath, operation };
|
|
130
|
-
}
|
|
6
|
+
import {
|
|
7
|
+
getSimplePath,
|
|
8
|
+
detectArrayPredicatePattern,
|
|
9
|
+
} from '../arrayDerivationDetector';
|
|
131
10
|
|
|
132
11
|
/**
|
|
133
12
|
* Detects if an expression is a boolean derivation pattern and extracts the info.
|
|
@@ -154,7 +33,8 @@ function detectDerivationPattern(expr: ts.Expression): {
|
|
|
154
33
|
| 'and'
|
|
155
34
|
| 'arrayIncludes'
|
|
156
35
|
| 'arraySome'
|
|
157
|
-
| 'arrayEvery'
|
|
36
|
+
| 'arrayEvery'
|
|
37
|
+
| 'arrayLength';
|
|
158
38
|
comparedValue?: string;
|
|
159
39
|
} | null {
|
|
160
40
|
// Check for array predicate methods first
|